mirror of
https://github.com/ApfelTeeSaft/reactos.git
synced 2026-08-26 19:33:31 +00:00
[SHLWAPI] Update WhichPlatform from Wine-10.0
This commit is contained in:
+17
-24
@@ -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;
|
||||
}
|
||||
|
||||
/*************************************************************************
|
||||
|
||||
Reference in New Issue
Block a user