From 8bd4911054184fee798c9134c2925c74a4cb6292 Mon Sep 17 00:00:00 2001 From: Timo Kreuzer Date: Tue, 19 May 2026 13:41:36 +0300 Subject: [PATCH] [SHLWAPI] Update WhichPlatform from Wine-10.0 --- dll/win32/shlwapi/ordinal.c | 41 +++++++++++++++---------------------- 1 file changed, 17 insertions(+), 24 deletions(-) diff --git a/dll/win32/shlwapi/ordinal.c b/dll/win32/shlwapi/ordinal.c index f76eb4e79e4..bc4bb44995a 100644 --- a/dll/win32/shlwapi/ordinal.c +++ b/dll/win32/shlwapi/ordinal.c @@ -2936,56 +2936,49 @@ BOOL WINAPI GUIDFromStringW(LPCWSTR idstr, CLSID *id) * either set to TRUE, or removed depending on whether the browser is deemed * to be integrated. */ -#ifdef __REACTOS__ UINT WINAPI WhichPlatform(void) -#else -DWORD WINAPI WhichPlatform(void) -#endif { static const char szIntegratedBrowser[] = "IntegratedBrowser"; - static DWORD dwState = 0; - HKEY hKey; - DWORD dwRet, dwData, dwSize; + static DWORD state = PLATFORM_UNKNOWN; + DWORD ret, data, size; HMODULE hshell32; + HKEY hKey; - if (dwState) - return dwState; + if (state) + return state; /* If shell32 exports DllGetVersion(), the browser is integrated */ - dwState = 1; + state = PLATFORM_BROWSERONLY; hshell32 = LoadLibraryA("shell32.dll"); if (hshell32) { FARPROC pDllGetVersion; pDllGetVersion = GetProcAddress(hshell32, "DllGetVersion"); - dwState = pDllGetVersion ? 2 : 1; + state = pDllGetVersion ? PLATFORM_INTEGRATED : PLATFORM_BROWSERONLY; FreeLibrary(hshell32); } /* Set or delete the key accordingly */ - dwRet = RegOpenKeyExA(HKEY_LOCAL_MACHINE, - "Software\\Microsoft\\Internet Explorer", 0, - KEY_ALL_ACCESS, &hKey); - if (!dwRet) + ret = RegOpenKeyExA(HKEY_LOCAL_MACHINE, "Software\\Microsoft\\Internet Explorer", 0, KEY_ALL_ACCESS, &hKey); + if (!ret) { - dwRet = RegQueryValueExA(hKey, szIntegratedBrowser, 0, 0, - (LPBYTE)&dwData, &dwSize); - - if (!dwRet && dwState == 1) + size = sizeof(data); + ret = RegQueryValueExA(hKey, szIntegratedBrowser, 0, 0, (BYTE *)&data, &size); + if (!ret && state == PLATFORM_BROWSERONLY) { /* Value exists but browser is not integrated */ RegDeleteValueA(hKey, szIntegratedBrowser); } - else if (dwRet && dwState == 2) + else if (ret && state == PLATFORM_INTEGRATED) { /* Browser is integrated but value does not exist */ - dwData = TRUE; - RegSetValueExA(hKey, szIntegratedBrowser, 0, REG_DWORD, - (LPBYTE)&dwData, sizeof(dwData)); + data = TRUE; + RegSetValueExA(hKey, szIntegratedBrowser, 0, REG_DWORD, (BYTE *)&data, sizeof(data)); } RegCloseKey(hKey); } - return dwState; + + return state; } /*************************************************************************