From 88337f5e7afcf219cd4b1e69c868e405f9220e5d Mon Sep 17 00:00:00 2001 From: Timo Kreuzer Date: Tue, 19 May 2026 13:38:11 +0300 Subject: [PATCH] [SHLWAPI] Reformat WhichPlatform (no code changes) --- dll/win32/shlwapi/ordinal.c | 84 ++++++++++++++++++------------------- 1 file changed, 42 insertions(+), 42 deletions(-) diff --git a/dll/win32/shlwapi/ordinal.c b/dll/win32/shlwapi/ordinal.c index 080631d6bb7..f76eb4e79e4 100644 --- a/dll/win32/shlwapi/ordinal.c +++ b/dll/win32/shlwapi/ordinal.c @@ -2942,50 +2942,50 @@ UINT WINAPI WhichPlatform(void) DWORD WINAPI WhichPlatform(void) #endif { - static const char szIntegratedBrowser[] = "IntegratedBrowser"; - static DWORD dwState = 0; - HKEY hKey; - DWORD dwRet, dwData, dwSize; - HMODULE hshell32; + static const char szIntegratedBrowser[] = "IntegratedBrowser"; + static DWORD dwState = 0; + HKEY hKey; + DWORD dwRet, dwData, dwSize; + HMODULE hshell32; - if (dwState) + if (dwState) + return dwState; + + /* If shell32 exports DllGetVersion(), the browser is integrated */ + dwState = 1; + hshell32 = LoadLibraryA("shell32.dll"); + if (hshell32) + { + FARPROC pDllGetVersion; + pDllGetVersion = GetProcAddress(hshell32, "DllGetVersion"); + dwState = pDllGetVersion ? 2 : 1; + FreeLibrary(hshell32); + } + + /* Set or delete the key accordingly */ + dwRet = RegOpenKeyExA(HKEY_LOCAL_MACHINE, + "Software\\Microsoft\\Internet Explorer", 0, + KEY_ALL_ACCESS, &hKey); + if (!dwRet) + { + dwRet = RegQueryValueExA(hKey, szIntegratedBrowser, 0, 0, + (LPBYTE)&dwData, &dwSize); + + if (!dwRet && dwState == 1) + { + /* Value exists but browser is not integrated */ + RegDeleteValueA(hKey, szIntegratedBrowser); + } + else if (dwRet && dwState == 2) + { + /* Browser is integrated but value does not exist */ + dwData = TRUE; + RegSetValueExA(hKey, szIntegratedBrowser, 0, REG_DWORD, + (LPBYTE)&dwData, sizeof(dwData)); + } + RegCloseKey(hKey); + } return dwState; - - /* If shell32 exports DllGetVersion(), the browser is integrated */ - dwState = 1; - hshell32 = LoadLibraryA("shell32.dll"); - if (hshell32) - { - FARPROC pDllGetVersion; - pDllGetVersion = GetProcAddress(hshell32, "DllGetVersion"); - dwState = pDllGetVersion ? 2 : 1; - FreeLibrary(hshell32); - } - - /* Set or delete the key accordingly */ - dwRet = RegOpenKeyExA(HKEY_LOCAL_MACHINE, - "Software\\Microsoft\\Internet Explorer", 0, - KEY_ALL_ACCESS, &hKey); - if (!dwRet) - { - dwRet = RegQueryValueExA(hKey, szIntegratedBrowser, 0, 0, - (LPBYTE)&dwData, &dwSize); - - if (!dwRet && dwState == 1) - { - /* Value exists but browser is not integrated */ - RegDeleteValueA(hKey, szIntegratedBrowser); - } - else if (dwRet && dwState == 2) - { - /* Browser is integrated but value does not exist */ - dwData = TRUE; - RegSetValueExA(hKey, szIntegratedBrowser, 0, REG_DWORD, - (LPBYTE)&dwData, sizeof(dwData)); - } - RegCloseKey(hKey); - } - return dwState; } /*************************************************************************