@ -246,197 +246,6 @@ HRESULT WINAPI _DllGetClassObject(
@@ -246,197 +246,6 @@ HRESULT WINAPI _DllGetClassObject(
DEFINE_GUID ( CLSID_EPStart10 ,
0x9717d01 , 0x5d10 , 0x4fb5 , 0xbd , 0x5 , 0x46 , 0x38 , 0xb , 0x51 , 0x65 , 0xaa ) ;
# pragma region "Updates"
# if WITH_MAIN_PATCHER
DWORD CheckForUpdatesThread ( LPVOID timeout )
{
HRESULT hr = S_OK ;
HSTRING_HEADER header_AppIdHString ;
HSTRING AppIdHString = NULL ;
HSTRING_HEADER header_ToastNotificationManagerHString ;
HSTRING ToastNotificationManagerHString = NULL ;
__x_ABI_CWindows_CUI_CNotifications_CIToastNotificationManagerStatics * toastStatics = NULL ;
__x_ABI_CWindows_CUI_CNotifications_CIToastNotifier * notifier = NULL ;
HSTRING_HEADER header_ToastNotificationHString ;
HSTRING ToastNotificationHString = NULL ;
__x_ABI_CWindows_CUI_CNotifications_CIToastNotificationFactory * notifFactory = NULL ;
__x_ABI_CWindows_CUI_CNotifications_CIToastNotification * toast = NULL ;
while ( TRUE )
{
HWND hShell_TrayWnd = FindWindowExW (
NULL ,
NULL ,
L " Shell_TrayWnd " ,
NULL
) ;
if ( hShell_TrayWnd )
{
Sleep ( timeout ) ;
break ;
}
Sleep ( 100 ) ;
}
printf ( " [Updates] Starting daemon. \n " ) ;
if ( SUCCEEDED ( hr ) )
{
hr = RoInitialize ( RO_INIT_MULTITHREADED ) ;
}
if ( SUCCEEDED ( hr ) )
{
hr = WindowsCreateStringReference (
APPID ,
( UINT32 ) ( sizeof ( APPID ) / sizeof ( TCHAR ) - 1 ) ,
& header_AppIdHString ,
& AppIdHString
) ;
}
if ( SUCCEEDED ( hr ) )
{
hr = WindowsCreateStringReference (
RuntimeClass_Windows_UI_Notifications_ToastNotificationManager ,
( UINT32 ) ( sizeof ( RuntimeClass_Windows_UI_Notifications_ToastNotificationManager ) / sizeof ( wchar_t ) - 1 ) ,
& header_ToastNotificationManagerHString ,
& ToastNotificationManagerHString
) ;
}
if ( SUCCEEDED ( hr ) )
{
hr = RoGetActivationFactory (
ToastNotificationManagerHString ,
& UIID_IToastNotificationManagerStatics ,
( LPVOID * ) & toastStatics
) ;
}
if ( SUCCEEDED ( hr ) )
{
hr = toastStatics - > lpVtbl - > CreateToastNotifierWithId (
toastStatics ,
AppIdHString ,
& notifier
) ;
}
if ( SUCCEEDED ( hr ) )
{
hr = WindowsCreateStringReference (
RuntimeClass_Windows_UI_Notifications_ToastNotification ,
( UINT32 ) ( sizeof ( RuntimeClass_Windows_UI_Notifications_ToastNotification ) / sizeof ( wchar_t ) - 1 ) ,
& header_ToastNotificationHString ,
& ToastNotificationHString
) ;
}
if ( SUCCEEDED ( hr ) )
{
hr = RoGetActivationFactory (
ToastNotificationHString ,
& UIID_IToastNotificationFactory ,
( LPVOID * ) & notifFactory
) ;
}
HANDLE hEvents [ 2 ] ;
hEvents [ 0 ] = CreateEventW ( NULL , FALSE , FALSE , L " EP_Ev_CheckForUpdates_ " _T ( EP_CLSID ) ) ;
hEvents [ 1 ] = CreateEventW ( NULL , FALSE , FALSE , L " EP_Ev_InstallUpdates_ " _T ( EP_CLSID ) ) ;
if ( hEvents [ 0 ] & & hEvents [ 1 ] )
{
if ( bShowUpdateToast )
{
ShowUpdateSuccessNotification ( hModule , notifier , notifFactory , & toast ) ;
HKEY hKey = NULL ;
RegCreateKeyExW (
HKEY_CURRENT_USER ,
TEXT ( REGPATH ) ,
0 ,
NULL ,
REG_OPTION_NON_VOLATILE ,
KEY_READ | KEY_WOW64_64KEY | KEY_WRITE ,
NULL ,
& hKey ,
NULL
) ;
if ( hKey = = NULL | | hKey = = INVALID_HANDLE_VALUE )
{
hKey = NULL ;
}
if ( hKey )
{
bShowUpdateToast = FALSE ;
RegSetValueExW (
hKey ,
TEXT ( " IsUpdatePending " ) ,
0 ,
REG_DWORD ,
& bShowUpdateToast ,
sizeof ( DWORD )
) ;
RegCloseKey ( hKey ) ;
}
}
if ( dwUpdatePolicy ! = UPDATE_POLICY_MANUAL )
{
InstallUpdatesIfAvailable ( hModule , notifier , notifFactory , & toast , UPDATES_OP_DEFAULT , bAllocConsole , dwUpdatePolicy ) ;
}
DWORD dwRet = 0 ;
while ( TRUE )
{
switch ( WaitForMultipleObjects ( 2 , hEvents , FALSE , INFINITE ) )
{
case WAIT_OBJECT_0 :
{
InstallUpdatesIfAvailable ( hModule , notifier , notifFactory , & toast , UPDATES_OP_CHECK , bAllocConsole , dwUpdatePolicy ) ;
break ;
}
case WAIT_OBJECT_0 + 1 :
{
InstallUpdatesIfAvailable ( hModule , notifier , notifFactory , & toast , UPDATES_OP_INSTALL , bAllocConsole , dwUpdatePolicy ) ;
break ;
}
default :
{
break ;
}
}
}
CloseHandle ( hEvents [ 0 ] ) ;
CloseHandle ( hEvents [ 1 ] ) ;
}
if ( toast )
{
toast - > lpVtbl - > Release ( toast ) ;
}
if ( notifFactory )
{
notifFactory - > lpVtbl - > Release ( notifFactory ) ;
}
if ( ToastNotificationHString )
{
WindowsDeleteString ( ToastNotificationHString ) ;
}
if ( notifier )
{
notifier - > lpVtbl - > Release ( notifier ) ;
}
if ( toastStatics )
{
toastStatics - > lpVtbl - > Release ( toastStatics ) ;
}
if ( ToastNotificationManagerHString )
{
WindowsDeleteString ( ToastNotificationManagerHString ) ;
}
if ( AppIdHString )
{
WindowsDeleteString ( AppIdHString ) ;
}
}
# endif
# pragma endregion
# pragma region "Generics"
# if WITH_MAIN_PATCHER
HWND GetMonitorInfoFromPointForTaskbarFlyoutActivation ( POINT ptCursor , DWORD dwFlags , LPMONITORINFO lpMi )