Delay load SetCurrentProcessExplicitAppUserModelID

Appears to be the only thing preventing 86Box from running on Vista.
Note that this doesn't mean a change in the official system requirements.
This commit is contained in:
David Hrdlička
2022-01-08 21:43:04 +01:00
parent 750f00d0dc
commit 65310e0141
2 changed files with 12 additions and 3 deletions

View File

@@ -450,9 +450,6 @@ WinMain(HINSTANCE hInst, HINSTANCE hPrev, LPSTR lpszArg, int nCmdShow)
{
char **argv = NULL;
int argc, i;
wchar_t * AppID = L"86Box.86Box\0";
SetCurrentProcessExplicitAppUserModelID(AppID);
/* Initialize the COM library for the main thread. */
CoInitializeEx(NULL, COINIT_MULTITHREADED);

View File

@@ -92,6 +92,13 @@ static dllimp_t user32_imports[] = {
{ NULL, NULL }
};
/* Taskbar application ID API, Windows 7+ */
void* shell32_handle = NULL;
static HRESULT (WINAPI *pSetCurrentProcessExplicitAppUserModelID)(PCWSTR AppID);
static dllimp_t shell32_imports[]= {
{ "SetCurrentProcessExplicitAppUserModelID", &pSetCurrentProcessExplicitAppUserModelID }
};
int
win_get_dpi(HWND hwnd) {
if (user32_handle != NULL) {
@@ -1244,6 +1251,11 @@ ui_init(int nCmdShow)
/* Load DPI related Windows 10 APIs */
user32_handle = dynld_module("user32.dll", user32_imports);
/* Set the application ID for the taskbar. */
shell32_handle = dynld_module("shell32.dll", shell32_imports);
if (shell32_handle)
pSetCurrentProcessExplicitAppUserModelID(L"86Box.86Box");
/* Set up TaskDialog configuration. */
tdconfig.cbSize = sizeof(tdconfig);
tdconfig.dwFlags = TDF_ENABLE_HYPERLINKS;