msi: If the user product key exists, the product's state is advertised.
This commit is contained in:
parent
e92f66558a
commit
15823e1acf
|
@ -762,7 +762,7 @@ INSTALLSTATE WINAPI MsiQueryProductStateA(LPCSTR szProduct)
|
||||||
INSTALLSTATE WINAPI MsiQueryProductStateW(LPCWSTR szProduct)
|
INSTALLSTATE WINAPI MsiQueryProductStateW(LPCWSTR szProduct)
|
||||||
{
|
{
|
||||||
UINT rc;
|
UINT rc;
|
||||||
INSTALLSTATE rrc = INSTALLSTATE_UNKNOWN;
|
INSTALLSTATE state = INSTALLSTATE_UNKNOWN;
|
||||||
HKEY hkey = 0;
|
HKEY hkey = 0;
|
||||||
DWORD sz;
|
DWORD sz;
|
||||||
|
|
||||||
|
@ -780,31 +780,32 @@ INSTALLSTATE WINAPI MsiQueryProductStateW(LPCWSTR szProduct)
|
||||||
if (rc != ERROR_SUCCESS)
|
if (rc != ERROR_SUCCESS)
|
||||||
goto end;
|
goto end;
|
||||||
|
|
||||||
|
state = INSTALLSTATE_ADVERTISED;
|
||||||
RegCloseKey(hkey);
|
RegCloseKey(hkey);
|
||||||
|
|
||||||
rc = MSIREG_OpenUninstallKey(szProduct,&hkey,FALSE);
|
rc = MSIREG_OpenUninstallKey(szProduct,&hkey,FALSE);
|
||||||
if (rc != ERROR_SUCCESS)
|
if (rc != ERROR_SUCCESS)
|
||||||
goto end;
|
goto end;
|
||||||
|
|
||||||
sz = sizeof(rrc);
|
sz = sizeof(state);
|
||||||
rc = RegQueryValueExW(hkey,szWindowsInstaller,NULL,NULL,(LPVOID)&rrc, &sz);
|
rc = RegQueryValueExW(hkey,szWindowsInstaller,NULL,NULL,(LPVOID)&state, &sz);
|
||||||
if (rc != ERROR_SUCCESS)
|
if (rc != ERROR_SUCCESS)
|
||||||
goto end;
|
goto end;
|
||||||
|
|
||||||
switch (rrc)
|
switch (state)
|
||||||
{
|
{
|
||||||
case 1:
|
case 1:
|
||||||
/* default */
|
/* default */
|
||||||
rrc = INSTALLSTATE_DEFAULT;
|
state = INSTALLSTATE_DEFAULT;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
FIXME("Unknown install state read from registry (%i)\n",rrc);
|
FIXME("Unknown install state read from registry (%i)\n",state);
|
||||||
rrc = INSTALLSTATE_UNKNOWN;
|
state = INSTALLSTATE_UNKNOWN;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
end:
|
end:
|
||||||
RegCloseKey(hkey);
|
RegCloseKey(hkey);
|
||||||
return rrc;
|
return state;
|
||||||
}
|
}
|
||||||
|
|
||||||
INSTALLUILEVEL WINAPI MsiSetInternalUI(INSTALLUILEVEL dwUILevel, HWND *phWnd)
|
INSTALLUILEVEL WINAPI MsiSetInternalUI(INSTALLUILEVEL dwUILevel, HWND *phWnd)
|
||||||
|
|
|
@ -377,10 +377,7 @@ static void test_MsiQueryProductState(void)
|
||||||
|
|
||||||
/* user product key exists */
|
/* user product key exists */
|
||||||
state = MsiQueryProductStateA(prodcode);
|
state = MsiQueryProductStateA(prodcode);
|
||||||
todo_wine
|
ok(state == INSTALLSTATE_ADVERTISED, "Expected INSTALLSTATE_ADVERTISED, got %d\n", state);
|
||||||
{
|
|
||||||
ok(state == INSTALLSTATE_ADVERTISED, "Expected INSTALLSTATE_ADVERTISED, got %d\n", state);
|
|
||||||
}
|
|
||||||
|
|
||||||
lstrcpyA(keypath, "Software\\Microsoft\\Windows\\CurrentVersion\\Installer\\UserData\\");
|
lstrcpyA(keypath, "Software\\Microsoft\\Windows\\CurrentVersion\\Installer\\UserData\\");
|
||||||
lstrcatA(keypath, usersid);
|
lstrcatA(keypath, usersid);
|
||||||
|
@ -392,20 +389,14 @@ static void test_MsiQueryProductState(void)
|
||||||
|
|
||||||
/* local product key exists */
|
/* local product key exists */
|
||||||
state = MsiQueryProductStateA(prodcode);
|
state = MsiQueryProductStateA(prodcode);
|
||||||
todo_wine
|
ok(state == INSTALLSTATE_ADVERTISED, "Expected INSTALLSTATE_ADVERTISED, got %d\n", state);
|
||||||
{
|
|
||||||
ok(state == INSTALLSTATE_ADVERTISED, "Expected INSTALLSTATE_ADVERTISED, got %d\n", state);
|
|
||||||
}
|
|
||||||
|
|
||||||
res = RegCreateKeyA(localkey, "InstallProperties", &props);
|
res = RegCreateKeyA(localkey, "InstallProperties", &props);
|
||||||
ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
|
ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
|
||||||
|
|
||||||
/* install properties key exists */
|
/* install properties key exists */
|
||||||
state = MsiQueryProductStateA(prodcode);
|
state = MsiQueryProductStateA(prodcode);
|
||||||
todo_wine
|
ok(state == INSTALLSTATE_ADVERTISED, "Expected INSTALLSTATE_ADVERTISED, got %d\n", state);
|
||||||
{
|
|
||||||
ok(state == INSTALLSTATE_ADVERTISED, "Expected INSTALLSTATE_ADVERTISED, got %d\n", state);
|
|
||||||
}
|
|
||||||
|
|
||||||
data = 1;
|
data = 1;
|
||||||
res = RegSetValueExA(props, "WindowsInstaller", 0, REG_DWORD, (const BYTE *)&data, sizeof(DWORD));
|
res = RegSetValueExA(props, "WindowsInstaller", 0, REG_DWORD, (const BYTE *)&data, sizeof(DWORD));
|
||||||
|
|
Loading…
Reference in New Issue