shlwapi: Use public definitions for WhichPlatform().
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
cf4a78b3e5
commit
017c953d86
|
@ -2291,72 +2291,6 @@ BOOL WINAPI GUIDFromStringW(LPCWSTR idstr, CLSID *id)
|
||||||
return SUCCEEDED(CLSIDFromString((LPCOLESTR)idstr, id));
|
return SUCCEEDED(CLSIDFromString((LPCOLESTR)idstr, id));
|
||||||
}
|
}
|
||||||
|
|
||||||
/*************************************************************************
|
|
||||||
* @ [SHLWAPI.276]
|
|
||||||
*
|
|
||||||
* Determine if the browser is integrated into the shell, and set a registry
|
|
||||||
* key accordingly.
|
|
||||||
*
|
|
||||||
* PARAMS
|
|
||||||
* None.
|
|
||||||
*
|
|
||||||
* RETURNS
|
|
||||||
* 1, If the browser is not integrated.
|
|
||||||
* 2, If the browser is integrated.
|
|
||||||
*
|
|
||||||
* NOTES
|
|
||||||
* The key "HKLM\Software\Microsoft\Internet Explorer\IntegratedBrowser" is
|
|
||||||
* either set to TRUE, or removed depending on whether the browser is deemed
|
|
||||||
* to be integrated.
|
|
||||||
*/
|
|
||||||
DWORD WINAPI WhichPlatform(void)
|
|
||||||
{
|
|
||||||
static const char szIntegratedBrowser[] = "IntegratedBrowser";
|
|
||||||
static DWORD dwState = 0;
|
|
||||||
HKEY hKey;
|
|
||||||
DWORD dwRet, dwData, dwSize;
|
|
||||||
HMODULE hshell32;
|
|
||||||
|
|
||||||
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;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*************************************************************************
|
/*************************************************************************
|
||||||
* @ [SHLWAPI.278]
|
* @ [SHLWAPI.278]
|
||||||
*
|
*
|
||||||
|
|
|
@ -108,3 +108,51 @@ HRESULT WINAPI DllGetVersion (DLLVERSIONINFO *pdvi)
|
||||||
WARN("pdvi->cbSize = %d, unhandled\n", pdvi2->info1.cbSize);
|
WARN("pdvi->cbSize = %d, unhandled\n", pdvi2->info1.cbSize);
|
||||||
return E_INVALIDARG;
|
return E_INVALIDARG;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*************************************************************************
|
||||||
|
* WhichPlatform() [SHLWAPI.276]
|
||||||
|
*/
|
||||||
|
UINT WINAPI WhichPlatform(void)
|
||||||
|
{
|
||||||
|
static const char szIntegratedBrowser[] = "IntegratedBrowser";
|
||||||
|
static DWORD state = PLATFORM_UNKNOWN;
|
||||||
|
DWORD ret, data, size;
|
||||||
|
HMODULE hshell32;
|
||||||
|
HKEY hKey;
|
||||||
|
|
||||||
|
if (state)
|
||||||
|
return state;
|
||||||
|
|
||||||
|
/* If shell32 exports DllGetVersion(), the browser is integrated */
|
||||||
|
state = PLATFORM_BROWSERONLY;
|
||||||
|
hshell32 = LoadLibraryA("shell32.dll");
|
||||||
|
if (hshell32)
|
||||||
|
{
|
||||||
|
FARPROC pDllGetVersion;
|
||||||
|
pDllGetVersion = GetProcAddress(hshell32, "DllGetVersion");
|
||||||
|
state = pDllGetVersion ? PLATFORM_INTEGRATED : PLATFORM_BROWSERONLY;
|
||||||
|
FreeLibrary(hshell32);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Set or delete the key accordingly */
|
||||||
|
ret = RegOpenKeyExA(HKEY_LOCAL_MACHINE, "Software\\Microsoft\\Internet Explorer", 0, KEY_ALL_ACCESS, &hKey);
|
||||||
|
if (!ret)
|
||||||
|
{
|
||||||
|
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 (ret && state == PLATFORM_INTEGRATED)
|
||||||
|
{
|
||||||
|
/* Browser is integrated but value does not exist */
|
||||||
|
data = TRUE;
|
||||||
|
RegSetValueExA(hKey, szIntegratedBrowser, 0, REG_DWORD, (BYTE *)&data, sizeof(data));
|
||||||
|
}
|
||||||
|
RegCloseKey(hKey);
|
||||||
|
}
|
||||||
|
|
||||||
|
return state;
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in New Issue