2 * tests for Microsoft Installer functionality
4 * Copyright 2005 Mike McCormack for CodeWeavers
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
21 #define _WIN32_MSI 300
29 #include "wine/test.h"
31 static BOOL (WINAPI *pConvertSidToStringSidA)(PSID, LPSTR*);
33 static INSTALLSTATE (WINAPI *pMsiGetComponentPathA)
34 (LPCSTR, LPCSTR, LPSTR, DWORD*);
35 static UINT (WINAPI *pMsiGetFileHashA)
36 (LPCSTR, DWORD, PMSIFILEHASHINFO);
37 static UINT (WINAPI *pMsiGetProductInfoExA)
38 (LPCSTR, LPCSTR, MSIINSTALLCONTEXT, LPCSTR, LPSTR, LPDWORD);
39 static UINT (WINAPI *pMsiOpenPackageExA)
40 (LPCSTR, DWORD, MSIHANDLE*);
41 static UINT (WINAPI *pMsiOpenPackageExW)
42 (LPCWSTR, DWORD, MSIHANDLE*);
43 static UINT (WINAPI *pMsiQueryComponentStateA)
44 (LPCSTR, LPCSTR, MSIINSTALLCONTEXT, LPCSTR, INSTALLSTATE*);
45 static INSTALLSTATE (WINAPI *pMsiUseFeatureExA)
46 (LPCSTR, LPCSTR ,DWORD, DWORD );
48 static void init_functionpointers(void)
50 HMODULE hmsi = GetModuleHandleA("msi.dll");
51 HMODULE hadvapi32 = GetModuleHandleA("advapi32.dll");
53 #define GET_PROC(dll, func) \
54 p ## func = (void *)GetProcAddress(dll, #func); \
56 trace("GetProcAddress(%s) failed\n", #func);
58 GET_PROC(hmsi, MsiGetComponentPathA)
59 GET_PROC(hmsi, MsiGetFileHashA)
60 GET_PROC(hmsi, MsiGetProductInfoExA)
61 GET_PROC(hmsi, MsiOpenPackageExA)
62 GET_PROC(hmsi, MsiOpenPackageExW)
63 GET_PROC(hmsi, MsiQueryComponentStateA)
64 GET_PROC(hmsi, MsiUseFeatureExA)
66 GET_PROC(hadvapi32, ConvertSidToStringSidA)
71 static void test_usefeature(void)
75 if (!pMsiUseFeatureExA)
77 skip("MsiUseFeatureExA not implemented\n");
81 r = MsiQueryFeatureState(NULL,NULL);
82 ok( r == INSTALLSTATE_INVALIDARG, "wrong return val\n");
84 r = MsiQueryFeatureState("{9085040-6000-11d3-8cfe-0150048383c9}" ,NULL);
85 ok( r == INSTALLSTATE_INVALIDARG, "wrong return val\n");
87 r = pMsiUseFeatureExA(NULL,NULL,0,0);
88 ok( r == INSTALLSTATE_INVALIDARG, "wrong return val\n");
90 r = pMsiUseFeatureExA(NULL, "WORDVIEWFiles", -2, 1 );
91 ok( r == INSTALLSTATE_INVALIDARG, "wrong return val\n");
93 r = pMsiUseFeatureExA("{90850409-6000-11d3-8cfe-0150048383c9}",
95 ok( r == INSTALLSTATE_INVALIDARG, "wrong return val\n");
97 r = pMsiUseFeatureExA("{9085040-6000-11d3-8cfe-0150048383c9}",
98 "WORDVIEWFiles", -2, 0 );
99 ok( r == INSTALLSTATE_INVALIDARG, "wrong return val\n");
101 r = pMsiUseFeatureExA("{0085040-6000-11d3-8cfe-0150048383c9}",
102 "WORDVIEWFiles", -2, 0 );
103 ok( r == INSTALLSTATE_INVALIDARG, "wrong return val\n");
105 r = pMsiUseFeatureExA("{90850409-6000-11d3-8cfe-0150048383c9}",
106 "WORDVIEWFiles", -2, 1 );
107 ok( r == INSTALLSTATE_INVALIDARG, "wrong return val\n");
110 static void test_null(void)
115 DWORD dwType, cbData;
116 LPBYTE lpData = NULL;
119 r = pMsiOpenPackageExW(NULL, 0, &hpkg);
120 ok( r == ERROR_INVALID_PARAMETER,"wrong error\n");
122 state = MsiQueryProductStateW(NULL);
123 ok( state == INSTALLSTATE_INVALIDARG, "wrong return\n");
125 r = MsiEnumFeaturesW(NULL,0,NULL,NULL);
126 ok( r == ERROR_INVALID_PARAMETER,"wrong error\n");
128 r = MsiConfigureFeatureW(NULL, NULL, 0);
129 ok( r == ERROR_INVALID_PARAMETER, "wrong error\n");
131 r = MsiConfigureFeatureA("{00000000-0000-0000-0000-000000000000}", NULL, 0);
132 ok( r == ERROR_INVALID_PARAMETER, "wrong error\n");
134 r = MsiConfigureFeatureA("{00000000-0000-0000-0000-000000000000}", "foo", 0);
135 ok( r == ERROR_INVALID_PARAMETER, "wrong error %d\n", r);
137 r = MsiConfigureFeatureA("{00000000-0000-0000-0000-000000000000}", "foo", INSTALLSTATE_DEFAULT);
138 ok( r == ERROR_UNKNOWN_PRODUCT, "wrong error %d\n", r);
140 /* make sure empty string to MsiGetProductInfo is not a handle to default registry value, saving and restoring the
141 * necessary registry values */
143 /* empty product string */
144 r = RegOpenKeyA(HKEY_LOCAL_MACHINE, "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall", &hkey);
145 ok( r == ERROR_SUCCESS, "wrong error %d\n", r);
147 r = RegQueryValueExA(hkey, NULL, 0, &dwType, lpData, &cbData);
148 ok ( r == ERROR_SUCCESS || r == ERROR_FILE_NOT_FOUND, "wrong error %d\n", r);
149 if ( r == ERROR_SUCCESS )
151 lpData = HeapAlloc(GetProcessHeap(), 0, cbData);
153 skip("Out of memory\n");
156 r = RegQueryValueExA(hkey, NULL, 0, &dwType, lpData, &cbData);
157 ok ( r == ERROR_SUCCESS, "wrong error %d\n", r);
161 r = RegSetValueA(hkey, NULL, REG_SZ, "test", strlen("test"));
162 ok( r == ERROR_SUCCESS, "wrong error %d\n", r);
164 r = MsiGetProductInfoA("", "", NULL, NULL);
165 ok ( r == ERROR_INVALID_PARAMETER, "wrong error %d\n", r);
169 r = RegSetValueExA(hkey, NULL, 0, dwType, lpData, cbData);
170 ok ( r == ERROR_SUCCESS, "wrong error %d\n", r);
172 HeapFree(GetProcessHeap(), 0, lpData);
176 r = RegDeleteValueA(hkey, NULL);
177 ok ( r == ERROR_SUCCESS, "wrong error %d\n", r);
180 r = RegCloseKey(hkey);
181 ok( r == ERROR_SUCCESS, "wrong error %d\n", r);
183 /* empty attribute */
184 r = RegCreateKeyA(HKEY_LOCAL_MACHINE, "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\{F1C3AF50-8B56-4A69-A00C-00773FE42F30}", &hkey);
185 ok( r == ERROR_SUCCESS, "wrong error %d\n", r);
187 r = RegSetValueA(hkey, NULL, REG_SZ, "test", strlen("test"));
188 ok( r == ERROR_SUCCESS, "wrong error %d\n", r);
190 r = MsiGetProductInfoA("{F1C3AF50-8B56-4A69-A00C-00773FE42F30}", "", NULL, NULL);
191 ok ( r == ERROR_UNKNOWN_PROPERTY, "wrong error %d\n", r);
193 r = RegCloseKey(hkey);
194 ok( r == ERROR_SUCCESS, "wrong error %d\n", r);
196 r = RegDeleteKeyA(HKEY_LOCAL_MACHINE, "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\{F1C3AF50-8B56-4A69-A00C-00773FE42F30}");
197 ok( r == ERROR_SUCCESS, "wrong error %d\n", r);
200 static void test_getcomponentpath(void)
206 if(!pMsiGetComponentPathA)
209 r = pMsiGetComponentPathA( NULL, NULL, NULL, NULL );
210 ok( r == INSTALLSTATE_INVALIDARG, "wrong return value\n");
212 r = pMsiGetComponentPathA( "bogus", "bogus", NULL, NULL );
213 ok( r == INSTALLSTATE_INVALIDARG, "wrong return value\n");
215 r = pMsiGetComponentPathA( "bogus", "{00000000-0000-0000-000000000000}", NULL, NULL );
216 ok( r == INSTALLSTATE_INVALIDARG, "wrong return value\n");
220 r = pMsiGetComponentPathA( "bogus", "{00000000-0000-0000-000000000000}", buffer, &sz );
221 ok( r == INSTALLSTATE_INVALIDARG, "wrong return value\n");
223 r = pMsiGetComponentPathA( "{00000000-78E1-11D2-B60F-006097C998E7}",
224 "{00000000-0000-0000-0000-000000000000}", buffer, &sz );
225 ok( r == INSTALLSTATE_UNKNOWN, "wrong return value\n");
227 r = pMsiGetComponentPathA( "{00000409-78E1-11D2-B60F-006097C998E7}",
228 "{00000000-0000-0000-0000-00000000}", buffer, &sz );
229 ok( r == INSTALLSTATE_INVALIDARG, "wrong return value\n");
231 r = pMsiGetComponentPathA( "{00000409-78E1-11D2-B60F-006097C998E7}",
232 "{029E403D-A86A-1D11-5B5B0006799C897E}", buffer, &sz );
233 ok( r == INSTALLSTATE_INVALIDARG, "wrong return value\n");
235 r = pMsiGetComponentPathA( "{00000000-78E1-11D2-B60F-006097C9987e}",
236 "{00000000-A68A-11d1-5B5B-0006799C897E}", buffer, &sz );
237 ok( r == INSTALLSTATE_UNKNOWN, "wrong return value\n");
240 static void create_file(LPCSTR name, LPCSTR data, DWORD size)
245 file = CreateFileA(name, GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, 0, NULL);
246 ok(file != INVALID_HANDLE_VALUE, "Failure to open file %s\n", name);
247 WriteFile(file, data, strlen(data), &written, NULL);
251 SetFilePointer(file, size, NULL, FILE_BEGIN);
258 #define HASHSIZE sizeof(MSIFILEHASHINFO)
264 MSIFILEHASHINFO hash;
269 { 0x98500190, 0xb04fd23c, 0x7d3f96d6, 0x727fe128 },
273 { "C:\\Program Files\\msitest\\caesar\n", 0,
275 { 0x2b566794, 0xfd42181b, 0x2514d6e4, 0x5768b4e2 },
279 { "C:\\Program Files\\msitest\\caesar\n", 500,
281 { 0x58095058, 0x805efeff, 0x10f3483e, 0x0147d653 },
286 static void test_MsiGetFileHash(void)
288 const char name[] = "msitest.bin";
290 MSIFILEHASHINFO hash;
293 if (!pMsiGetFileHashA)
295 skip("MsiGetFileHash not implemented\n");
299 hash.dwFileHashInfoSize = sizeof(MSIFILEHASHINFO);
301 /* szFilePath is NULL */
302 r = pMsiGetFileHashA(NULL, 0, &hash);
303 ok(r == ERROR_INVALID_PARAMETER, "Expected ERROR_INVALID_PARAMETER, got %d\n", r);
305 /* szFilePath is empty */
306 r = pMsiGetFileHashA("", 0, &hash);
307 ok(r == ERROR_PATH_NOT_FOUND || r == ERROR_BAD_PATHNAME,
308 "Expected ERROR_PATH_NOT_FOUND or ERROR_BAD_PATHNAME, got %d\n", r);
310 /* szFilePath is nonexistent */
311 r = pMsiGetFileHashA(name, 0, &hash);
312 ok(r == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %d\n", r);
314 /* dwOptions is non-zero */
315 r = pMsiGetFileHashA(name, 1, &hash);
316 ok(r == ERROR_INVALID_PARAMETER, "Expected ERROR_INVALID_PARAMETER, got %d\n", r);
318 /* pHash.dwFileHashInfoSize is not correct */
319 hash.dwFileHashInfoSize = 0;
320 r = pMsiGetFileHashA(name, 0, &hash);
321 ok(r == ERROR_INVALID_PARAMETER, "Expected ERROR_INVALID_PARAMETER, got %d\n", r);
324 r = pMsiGetFileHashA(name, 0, NULL);
325 ok(r == ERROR_INVALID_PARAMETER, "Expected ERROR_INVALID_PARAMETER, got %d\n", r);
327 for (i = 0; i < sizeof(hash_data) / sizeof(hash_data[0]); i++)
329 create_file(name, hash_data[i].data, hash_data[i].size);
331 memset(&hash, 0, sizeof(MSIFILEHASHINFO));
332 hash.dwFileHashInfoSize = sizeof(MSIFILEHASHINFO);
334 r = pMsiGetFileHashA(name, 0, &hash);
335 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
336 ok(!memcmp(&hash, &hash_data[i].hash, HASHSIZE), "Hash incorrect\n");
342 /* copied from dlls/msi/registry.c */
343 static BOOL squash_guid(LPCWSTR in, LPWSTR out)
348 if (FAILED(CLSIDFromString((LPOLESTR)in, &guid)))
362 out[17+i*2] = in[n++];
363 out[16+i*2] = in[n++];
368 out[17+i*2] = in[n++];
369 out[16+i*2] = in[n++];
375 static void create_test_guid(LPSTR prodcode, LPSTR squashed)
377 WCHAR guidW[MAX_PATH];
378 WCHAR squashedW[MAX_PATH];
383 hr = CoCreateGuid(&guid);
384 ok(hr == S_OK, "Expected S_OK, got %d\n", hr);
386 size = StringFromGUID2(&guid, (LPOLESTR)guidW, MAX_PATH);
387 ok(size == 39, "Expected 39, got %d\n", hr);
389 WideCharToMultiByte(CP_ACP, 0, guidW, size, prodcode, MAX_PATH, NULL, NULL);
390 squash_guid(guidW, squashedW);
391 WideCharToMultiByte(CP_ACP, 0, squashedW, -1, squashed, MAX_PATH, NULL, NULL);
394 static void get_user_sid(LPSTR *usersid)
401 OpenProcessToken(GetCurrentProcess(), TOKEN_QUERY, &token);
403 GetTokenInformation(token, TokenUser, (void *)buf, size, &size);
404 user = (PTOKEN_USER)buf;
405 pConvertSidToStringSidA(user->User.Sid, usersid);
408 static void test_MsiQueryProductState(void)
410 CHAR prodcode[MAX_PATH];
411 CHAR prod_squashed[MAX_PATH];
412 CHAR keypath[MAX_PATH*2];
416 HKEY userkey, localkey, props;
420 create_test_guid(prodcode, prod_squashed);
421 get_user_sid(&usersid);
424 state = MsiQueryProductStateA(NULL);
425 ok(state == INSTALLSTATE_INVALIDARG, "Expected INSTALLSTATE_INVALIDARG, got %d\n", state);
428 state = MsiQueryProductStateA("");
429 ok(state == INSTALLSTATE_INVALIDARG, "Expected INSTALLSTATE_INVALIDARG, got %d\n", state);
431 /* garbage prodcode */
432 state = MsiQueryProductStateA("garbage");
433 ok(state == INSTALLSTATE_INVALIDARG, "Expected INSTALLSTATE_INVALIDARG, got %d\n", state);
435 /* guid without brackets */
436 state = MsiQueryProductStateA("6700E8CF-95AB-4D9C-BC2C-15840DEA7A5D");
437 ok(state == INSTALLSTATE_INVALIDARG, "Expected INSTALLSTATE_INVALIDARG, got %d\n", state);
439 /* guid with brackets */
440 state = MsiQueryProductStateA("{6700E8CF-95AB-4D9C-BC2C-15840DEA7A5D}");
441 ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
443 /* same length as guid, but random */
444 state = MsiQueryProductStateA("A938G02JF-2NF3N93-VN3-2NNF-3KGKALDNF93");
445 ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
447 /* MSIINSTALLCONTEXT_USERUNMANAGED */
449 state = MsiQueryProductStateA(prodcode);
450 ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
452 lstrcpyA(keypath, "Software\\Microsoft\\Installer\\Products\\");
453 lstrcatA(keypath, prod_squashed);
455 res = RegCreateKeyA(HKEY_CURRENT_USER, keypath, &userkey);
456 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
458 /* user product key exists */
459 state = MsiQueryProductStateA(prodcode);
460 ok(state == INSTALLSTATE_ADVERTISED, "Expected INSTALLSTATE_ADVERTISED, got %d\n", state);
462 lstrcpyA(keypath, "Software\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\");
463 lstrcatA(keypath, prodcode);
465 res = RegCreateKeyA(HKEY_LOCAL_MACHINE, keypath, &localkey);
466 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
468 /* local uninstall key exists */
469 state = MsiQueryProductStateA(prodcode);
470 ok(state == INSTALLSTATE_ADVERTISED, "Expected INSTALLSTATE_ADVERTISED, got %d\n", state);
473 res = RegSetValueExA(localkey, "WindowsInstaller", 0, REG_DWORD, (const BYTE *)&data, sizeof(DWORD));
474 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
476 /* WindowsInstaller value exists */
477 state = MsiQueryProductStateA(prodcode);
478 ok(state == INSTALLSTATE_ADVERTISED, "Expected INSTALLSTATE_ADVERTISED, got %d\n", state);
480 RegDeleteValueA(localkey, "WindowsInstaller");
481 RegDeleteKeyA(localkey, "");
483 lstrcpyA(keypath, "Software\\Microsoft\\Windows\\CurrentVersion\\Installer\\UserData\\");
484 lstrcatA(keypath, usersid);
485 lstrcatA(keypath, "\\Products\\");
486 lstrcatA(keypath, prod_squashed);
488 res = RegCreateKeyA(HKEY_LOCAL_MACHINE, keypath, &localkey);
489 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
491 /* local product key exists */
492 state = MsiQueryProductStateA(prodcode);
493 ok(state == INSTALLSTATE_ADVERTISED, "Expected INSTALLSTATE_ADVERTISED, got %d\n", state);
495 res = RegCreateKeyA(localkey, "InstallProperties", &props);
496 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
498 /* install properties key exists */
499 state = MsiQueryProductStateA(prodcode);
500 ok(state == INSTALLSTATE_ADVERTISED, "Expected INSTALLSTATE_ADVERTISED, got %d\n", state);
503 res = RegSetValueExA(props, "WindowsInstaller", 0, REG_DWORD, (const BYTE *)&data, sizeof(DWORD));
504 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
506 /* WindowsInstaller value exists */
507 state = MsiQueryProductStateA(prodcode);
508 ok(state == INSTALLSTATE_DEFAULT, "Expected INSTALLSTATE_DEFAULT, got %d\n", state);
511 res = RegSetValueExA(props, "WindowsInstaller", 0, REG_DWORD, (const BYTE *)&data, sizeof(DWORD));
512 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
514 /* WindowsInstaller value is not 1 */
515 state = MsiQueryProductStateA(prodcode);
516 ok(state == INSTALLSTATE_DEFAULT, "Expected INSTALLSTATE_DEFAULT, got %d\n", state);
518 RegDeleteKeyA(userkey, "");
520 /* user product key does not exist */
521 state = MsiQueryProductStateA(prodcode);
522 ok(state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
524 RegDeleteValueA(props, "WindowsInstaller");
525 RegDeleteKeyA(props, "");
527 RegDeleteKeyA(localkey, "");
528 RegCloseKey(localkey);
529 RegDeleteKeyA(userkey, "");
530 RegCloseKey(userkey);
532 /* MSIINSTALLCONTEXT_USERMANAGED */
534 lstrcpyA(keypath, "Software\\Microsoft\\Windows\\CurrentVersion\\Installer\\Managed\\");
535 lstrcatA(keypath, usersid);
536 lstrcatA(keypath, "\\Installer\\Products\\");
537 lstrcatA(keypath, prod_squashed);
539 res = RegCreateKeyA(HKEY_LOCAL_MACHINE, keypath, &prodkey);
540 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
542 state = MsiQueryProductStateA(prodcode);
543 ok(state == INSTALLSTATE_ADVERTISED,
544 "Expected INSTALLSTATE_ADVERTISED, got %d\n", state);
546 lstrcpyA(keypath, "Software\\Microsoft\\Windows\\CurrentVersion\\Installer\\UserData\\");
547 lstrcatA(keypath, usersid);
548 lstrcatA(keypath, "\\Products\\");
549 lstrcatA(keypath, prod_squashed);
551 res = RegCreateKeyA(HKEY_LOCAL_MACHINE, keypath, &localkey);
552 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
554 state = MsiQueryProductStateA(prodcode);
555 ok(state == INSTALLSTATE_ADVERTISED,
556 "Expected INSTALLSTATE_ADVERTISED, got %d\n", state);
558 res = RegCreateKeyA(localkey, "InstallProperties", &props);
559 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
561 state = MsiQueryProductStateA(prodcode);
562 ok(state == INSTALLSTATE_ADVERTISED,
563 "Expected INSTALLSTATE_ADVERTISED, got %d\n", state);
566 res = RegSetValueExA(props, "WindowsInstaller", 0, REG_DWORD, (const BYTE *)&data, sizeof(DWORD));
567 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
569 /* WindowsInstaller value exists */
570 state = MsiQueryProductStateA(prodcode);
571 ok(state == INSTALLSTATE_DEFAULT, "Expected INSTALLSTATE_DEFAULT, got %d\n", state);
573 RegDeleteValueA(props, "WindowsInstaller");
574 RegDeleteKeyA(props, "");
576 RegDeleteKeyA(localkey, "");
577 RegCloseKey(localkey);
578 RegDeleteKeyA(prodkey, "");
579 RegCloseKey(prodkey);
581 /* MSIINSTALLCONTEXT_MACHINE */
583 lstrcpyA(keypath, "Software\\Classes\\Installer\\Products\\");
584 lstrcatA(keypath, prod_squashed);
586 res = RegCreateKeyA(HKEY_LOCAL_MACHINE, keypath, &prodkey);
587 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
589 state = MsiQueryProductStateA(prodcode);
590 ok(state == INSTALLSTATE_ADVERTISED, "Expected INSTALLSTATE_ADVERTISED, got %d\n", state);
592 lstrcpyA(keypath, "Software\\Microsoft\\Windows\\CurrentVersion\\Installer\\UserData\\");
593 lstrcatA(keypath, "S-1-5-18\\Products\\");
594 lstrcatA(keypath, prod_squashed);
596 res = RegCreateKeyA(HKEY_LOCAL_MACHINE, keypath, &localkey);
597 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
599 state = MsiQueryProductStateA(prodcode);
600 ok(state == INSTALLSTATE_ADVERTISED,
601 "Expected INSTALLSTATE_ADVERTISED, got %d\n", state);
603 res = RegCreateKeyA(localkey, "InstallProperties", &props);
604 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
606 state = MsiQueryProductStateA(prodcode);
607 ok(state == INSTALLSTATE_ADVERTISED,
608 "Expected INSTALLSTATE_ADVERTISED, got %d\n", state);
611 res = RegSetValueExA(props, "WindowsInstaller", 0, REG_DWORD, (const BYTE *)&data, sizeof(DWORD));
612 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
614 /* WindowsInstaller value exists */
615 state = MsiQueryProductStateA(prodcode);
616 ok(state == INSTALLSTATE_DEFAULT, "Expected INSTALLSTATE_DEFAULT, got %d\n", state);
618 RegDeleteValueA(props, "WindowsInstaller");
619 RegDeleteKeyA(props, "");
621 RegDeleteKeyA(localkey, "");
622 RegCloseKey(localkey);
623 RegDeleteKeyA(prodkey, "");
624 RegCloseKey(prodkey);
629 static const char table_enc85[] =
630 "!$%&'()*+,-.0123456789=?@ABCDEFGHIJKLMNO"
631 "PQRSTUVWXYZ[]^_`abcdefghijklmnopqrstuvwx"
635 * Encodes a base85 guid given a GUID pointer
636 * Caller should provide a 21 character buffer for the encoded string.
638 * returns TRUE if successful, FALSE if not
640 static BOOL encode_base85_guid( GUID *guid, LPWSTR str )
642 unsigned int x, *p, i;
644 p = (unsigned int*) guid;
648 *str++ = table_enc85[x%85];
650 *str++ = table_enc85[x%85];
652 *str++ = table_enc85[x%85];
654 *str++ = table_enc85[x%85];
656 *str++ = table_enc85[x%85];
663 static void compose_base85_guid(LPSTR component, LPSTR comp_base85, LPSTR squashed)
665 WCHAR guidW[MAX_PATH];
666 WCHAR base85W[MAX_PATH];
667 WCHAR squashedW[MAX_PATH];
672 hr = CoCreateGuid(&guid);
673 ok(hr == S_OK, "Expected S_OK, got %d\n", hr);
675 size = StringFromGUID2(&guid, (LPOLESTR)guidW, MAX_PATH);
676 ok(size == 39, "Expected 39, got %d\n", hr);
678 WideCharToMultiByte(CP_ACP, 0, guidW, size, component, MAX_PATH, NULL, NULL);
679 encode_base85_guid(&guid, base85W);
680 WideCharToMultiByte(CP_ACP, 0, base85W, -1, comp_base85, MAX_PATH, NULL, NULL);
681 squash_guid(guidW, squashedW);
682 WideCharToMultiByte(CP_ACP, 0, squashedW, -1, squashed, MAX_PATH, NULL, NULL);
685 static void test_MsiQueryFeatureState(void)
687 HKEY userkey, localkey, compkey;
688 CHAR prodcode[MAX_PATH];
689 CHAR prod_squashed[MAX_PATH];
690 CHAR component[MAX_PATH];
691 CHAR comp_base85[MAX_PATH];
692 CHAR comp_squashed[MAX_PATH];
693 CHAR keypath[MAX_PATH*2];
698 create_test_guid(prodcode, prod_squashed);
699 compose_base85_guid(component, comp_base85, comp_squashed);
700 get_user_sid(&usersid);
703 state = MsiQueryFeatureStateA(NULL, "feature");
704 ok(state == INSTALLSTATE_INVALIDARG, "Expected INSTALLSTATE_INVALIDARG, got %d\n", state);
707 state = MsiQueryFeatureStateA("", "feature");
708 ok(state == INSTALLSTATE_INVALIDARG, "Expected INSTALLSTATE_INVALIDARG, got %d\n", state);
710 /* garbage prodcode */
711 state = MsiQueryFeatureStateA("garbage", "feature");
712 ok(state == INSTALLSTATE_INVALIDARG, "Expected INSTALLSTATE_INVALIDARG, got %d\n", state);
714 /* guid without brackets */
715 state = MsiQueryFeatureStateA("6700E8CF-95AB-4D9C-BC2C-15840DEA7A5D", "feature");
716 ok(state == INSTALLSTATE_INVALIDARG, "Expected INSTALLSTATE_INVALIDARG, got %d\n", state);
718 /* guid with brackets */
719 state = MsiQueryFeatureStateA("{6700E8CF-95AB-4D9C-BC2C-15840DEA7A5D}", "feature");
720 ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
722 /* same length as guid, but random */
723 state = MsiQueryFeatureStateA("A938G02JF-2NF3N93-VN3-2NNF-3KGKALDNF93", "feature");
724 ok(state == INSTALLSTATE_INVALIDARG, "Expected INSTALLSTATE_INVALIDARG, got %d\n", state);
727 state = MsiQueryFeatureStateA(prodcode, NULL);
728 ok(state == INSTALLSTATE_INVALIDARG, "Expected INSTALLSTATE_INVALIDARG, got %d\n", state);
730 /* empty szFeature */
731 state = MsiQueryFeatureStateA(prodcode, "");
732 ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
734 /* feature key does not exist yet */
735 state = MsiQueryFeatureStateA(prodcode, "feature");
736 ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
738 /* MSIINSTALLCONTEXT_USERUNMANAGED */
740 lstrcpyA(keypath, "Software\\Microsoft\\Installer\\Features\\");
741 lstrcatA(keypath, prod_squashed);
743 res = RegCreateKeyA(HKEY_CURRENT_USER, keypath, &userkey);
744 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
746 /* feature key exists */
747 state = MsiQueryFeatureStateA(prodcode, "feature");
748 ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
750 res = RegSetValueExA(userkey, "feature", 0, REG_SZ, (const BYTE *)"", 2);
751 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
753 /* feature value exists */
754 state = MsiQueryFeatureStateA(prodcode, "feature");
755 ok(state == INSTALLSTATE_ADVERTISED, "Expected INSTALLSTATE_ADVERTISED, got %d\n", state);
757 lstrcpyA(keypath, "Software\\Microsoft\\Windows\\CurrentVersion\\Installer\\UserData\\");
758 lstrcatA(keypath, usersid);
759 lstrcatA(keypath, "\\Products\\");
760 lstrcatA(keypath, prod_squashed);
761 lstrcatA(keypath, "\\Features");
763 res = RegCreateKeyA(HKEY_LOCAL_MACHINE, keypath, &localkey);
764 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
766 /* userdata features key exists */
767 state = MsiQueryFeatureStateA(prodcode, "feature");
768 ok(state == INSTALLSTATE_ADVERTISED, "Expected INSTALLSTATE_ADVERTISED, got %d\n", state);
770 res = RegSetValueExA(localkey, "feature", 0, REG_SZ, (const BYTE *)"aaaaaaaaaaaaaaaaaaa", 20);
771 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
773 state = MsiQueryFeatureStateA(prodcode, "feature");
774 ok(state == INSTALLSTATE_BADCONFIG, "Expected INSTALLSTATE_BADCONFIG, got %d\n", state);
776 res = RegSetValueExA(localkey, "feature", 0, REG_SZ, (const BYTE *)"aaaaaaaaaaaaaaaaaaaa", 21);
777 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
779 state = MsiQueryFeatureStateA(prodcode, "feature");
780 ok(state == INSTALLSTATE_ADVERTISED, "Expected INSTALLSTATE_ADVERTISED, got %d\n", state);
782 res = RegSetValueExA(localkey, "feature", 0, REG_SZ, (const BYTE *)"aaaaaaaaaaaaaaaaaaaaa", 22);
783 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
785 state = MsiQueryFeatureStateA(prodcode, "feature");
786 ok(state == INSTALLSTATE_ADVERTISED, "Expected INSTALLSTATE_ADVERTISED, got %d\n", state);
788 res = RegSetValueExA(localkey, "feature", 0, REG_SZ, (const BYTE *)comp_base85, 21);
789 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
791 state = MsiQueryFeatureStateA(prodcode, "feature");
792 ok(state == INSTALLSTATE_ADVERTISED, "Expected INSTALLSTATE_ADVERTISED, got %d\n", state);
794 lstrcpyA(keypath, "Software\\Microsoft\\Windows\\CurrentVersion\\Installer\\UserData\\");
795 lstrcatA(keypath, usersid);
796 lstrcatA(keypath, "\\Components\\");
797 lstrcatA(keypath, comp_squashed);
799 res = RegCreateKeyA(HKEY_LOCAL_MACHINE, keypath, &compkey);
800 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
802 state = MsiQueryFeatureStateA(prodcode, "feature");
803 ok(state == INSTALLSTATE_ADVERTISED, "Expected INSTALLSTATE_ADVERTISED, got %d\n", state);
805 res = RegSetValueExA(compkey, prod_squashed, 0, REG_SZ, (const BYTE *)"", 1);
806 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
808 state = MsiQueryFeatureStateA(prodcode, "feature");
809 ok(state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
811 res = RegSetValueExA(compkey, prod_squashed, 0, REG_SZ, (const BYTE *)"apple", 1);
812 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
814 state = MsiQueryFeatureStateA(prodcode, "feature");
815 ok(state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
817 RegDeleteValueA(compkey, prod_squashed);
818 RegDeleteKeyA(compkey, "");
819 RegDeleteValueA(localkey, "feature");
820 RegDeleteValueA(userkey, "feature");
821 RegDeleteKeyA(userkey, "");
822 RegCloseKey(compkey);
823 RegCloseKey(localkey);
824 RegCloseKey(userkey);
826 /* MSIINSTALLCONTEXT_USERMANAGED */
828 lstrcpyA(keypath, "Software\\Microsoft\\Windows\\CurrentVersion\\Installer\\Managed\\");
829 lstrcatA(keypath, usersid);
830 lstrcatA(keypath, "\\Installer\\Features\\");
831 lstrcatA(keypath, prod_squashed);
833 res = RegCreateKeyA(HKEY_LOCAL_MACHINE, keypath, &userkey);
834 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
836 /* feature key exists */
837 state = MsiQueryFeatureStateA(prodcode, "feature");
838 ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
840 res = RegSetValueExA(userkey, "feature", 0, REG_SZ, (const BYTE *)"", 2);
841 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
843 /* feature value exists */
844 state = MsiQueryFeatureStateA(prodcode, "feature");
847 ok(state == INSTALLSTATE_ADVERTISED, "Expected INSTALLSTATE_ADVERTISED, got %d\n", state);
850 lstrcpyA(keypath, "Software\\Microsoft\\Windows\\CurrentVersion\\Installer\\UserData\\");
851 lstrcatA(keypath, usersid);
852 lstrcatA(keypath, "\\Products\\");
853 lstrcatA(keypath, prod_squashed);
854 lstrcatA(keypath, "\\Features");
856 res = RegCreateKeyA(HKEY_LOCAL_MACHINE, keypath, &localkey);
857 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
859 /* userdata features key exists */
860 state = MsiQueryFeatureStateA(prodcode, "feature");
863 ok(state == INSTALLSTATE_ADVERTISED, "Expected INSTALLSTATE_ADVERTISED, got %d\n", state);
866 res = RegSetValueExA(localkey, "feature", 0, REG_SZ, (const BYTE *)"aaaaaaaaaaaaaaaaaaa", 20);
867 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
869 state = MsiQueryFeatureStateA(prodcode, "feature");
872 ok(state == INSTALLSTATE_BADCONFIG, "Expected INSTALLSTATE_BADCONFIG, got %d\n", state);
875 res = RegSetValueExA(localkey, "feature", 0, REG_SZ, (const BYTE *)"aaaaaaaaaaaaaaaaaaaa", 21);
876 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
878 state = MsiQueryFeatureStateA(prodcode, "feature");
881 ok(state == INSTALLSTATE_ADVERTISED, "Expected INSTALLSTATE_ADVERTISED, got %d\n", state);
884 res = RegSetValueExA(localkey, "feature", 0, REG_SZ, (const BYTE *)"aaaaaaaaaaaaaaaaaaaaa", 22);
885 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
887 state = MsiQueryFeatureStateA(prodcode, "feature");
890 ok(state == INSTALLSTATE_ADVERTISED, "Expected INSTALLSTATE_ADVERTISED, got %d\n", state);
893 res = RegSetValueExA(localkey, "feature", 0, REG_SZ, (const BYTE *)comp_base85, 21);
894 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
896 state = MsiQueryFeatureStateA(prodcode, "feature");
899 ok(state == INSTALLSTATE_ADVERTISED, "Expected INSTALLSTATE_ADVERTISED, got %d\n", state);
902 lstrcpyA(keypath, "Software\\Microsoft\\Windows\\CurrentVersion\\Installer\\UserData\\");
903 lstrcatA(keypath, usersid);
904 lstrcatA(keypath, "\\Components\\");
905 lstrcatA(keypath, comp_squashed);
907 res = RegCreateKeyA(HKEY_LOCAL_MACHINE, keypath, &compkey);
908 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
910 state = MsiQueryFeatureStateA(prodcode, "feature");
913 ok(state == INSTALLSTATE_ADVERTISED, "Expected INSTALLSTATE_ADVERTISED, got %d\n", state);
916 res = RegSetValueExA(compkey, prod_squashed, 0, REG_SZ, (const BYTE *)"", 1);
917 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
919 state = MsiQueryFeatureStateA(prodcode, "feature");
922 ok(state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
925 res = RegSetValueExA(compkey, prod_squashed, 0, REG_SZ, (const BYTE *)"apple", 1);
926 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
928 state = MsiQueryFeatureStateA(prodcode, "feature");
931 ok(state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
934 RegDeleteValueA(compkey, prod_squashed);
935 RegDeleteKeyA(compkey, "");
936 RegDeleteValueA(localkey, "feature");
937 RegDeleteValueA(userkey, "feature");
938 RegDeleteKeyA(userkey, "");
939 RegCloseKey(compkey);
940 RegCloseKey(localkey);
941 RegCloseKey(userkey);
943 /* MSIINSTALLCONTEXT_MACHINE */
945 lstrcpyA(keypath, "Software\\Classes\\Installer\\Features\\");
946 lstrcatA(keypath, prod_squashed);
948 res = RegCreateKeyA(HKEY_LOCAL_MACHINE, keypath, &userkey);
949 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
951 /* feature key exists */
952 state = MsiQueryFeatureStateA(prodcode, "feature");
953 ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
955 res = RegSetValueExA(userkey, "feature", 0, REG_SZ, (const BYTE *)"", 2);
956 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
958 /* feature value exists */
959 state = MsiQueryFeatureStateA(prodcode, "feature");
962 ok(state == INSTALLSTATE_ADVERTISED, "Expected INSTALLSTATE_ADVERTISED, got %d\n", state);
965 lstrcpyA(keypath, "Software\\Microsoft\\Windows\\CurrentVersion\\Installer\\UserData\\");
966 lstrcatA(keypath, "S-1-5-18\\Products\\");
967 lstrcatA(keypath, prod_squashed);
968 lstrcatA(keypath, "\\Features");
970 res = RegCreateKeyA(HKEY_LOCAL_MACHINE, keypath, &localkey);
971 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
973 /* userdata features key exists */
974 state = MsiQueryFeatureStateA(prodcode, "feature");
977 ok(state == INSTALLSTATE_ADVERTISED, "Expected INSTALLSTATE_ADVERTISED, got %d\n", state);
980 res = RegSetValueExA(localkey, "feature", 0, REG_SZ, (const BYTE *)"aaaaaaaaaaaaaaaaaaa", 20);
981 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
983 state = MsiQueryFeatureStateA(prodcode, "feature");
986 ok(state == INSTALLSTATE_BADCONFIG, "Expected INSTALLSTATE_BADCONFIG, got %d\n", state);
989 res = RegSetValueExA(localkey, "feature", 0, REG_SZ, (const BYTE *)"aaaaaaaaaaaaaaaaaaaa", 21);
990 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
992 state = MsiQueryFeatureStateA(prodcode, "feature");
995 ok(state == INSTALLSTATE_ADVERTISED, "Expected INSTALLSTATE_ADVERTISED, got %d\n", state);
998 res = RegSetValueExA(localkey, "feature", 0, REG_SZ, (const BYTE *)"aaaaaaaaaaaaaaaaaaaaa", 22);
999 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
1001 state = MsiQueryFeatureStateA(prodcode, "feature");
1004 ok(state == INSTALLSTATE_ADVERTISED, "Expected INSTALLSTATE_ADVERTISED, got %d\n", state);
1007 res = RegSetValueExA(localkey, "feature", 0, REG_SZ, (const BYTE *)comp_base85, 21);
1008 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
1010 state = MsiQueryFeatureStateA(prodcode, "feature");
1013 ok(state == INSTALLSTATE_ADVERTISED, "Expected INSTALLSTATE_ADVERTISED, got %d\n", state);
1016 lstrcpyA(keypath, "Software\\Microsoft\\Windows\\CurrentVersion\\Installer\\UserData\\");
1017 lstrcatA(keypath, "S-1-5-18\\Components\\");
1018 lstrcatA(keypath, comp_squashed);
1020 res = RegCreateKeyA(HKEY_LOCAL_MACHINE, keypath, &compkey);
1021 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
1023 state = MsiQueryFeatureStateA(prodcode, "feature");
1026 ok(state == INSTALLSTATE_ADVERTISED, "Expected INSTALLSTATE_ADVERTISED, got %d\n", state);
1029 res = RegSetValueExA(compkey, prod_squashed, 0, REG_SZ, (const BYTE *)"", 1);
1030 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
1032 state = MsiQueryFeatureStateA(prodcode, "feature");
1035 ok(state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
1038 res = RegSetValueExA(compkey, prod_squashed, 0, REG_SZ, (const BYTE *)"apple", 1);
1039 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
1041 state = MsiQueryFeatureStateA(prodcode, "feature");
1044 ok(state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
1047 RegDeleteValueA(compkey, prod_squashed);
1048 RegDeleteKeyA(compkey, "");
1049 RegDeleteValueA(localkey, "feature");
1050 RegDeleteValueA(userkey, "feature");
1051 RegDeleteKeyA(userkey, "");
1052 RegCloseKey(compkey);
1053 RegCloseKey(localkey);
1054 RegCloseKey(userkey);
1057 static void test_MsiQueryComponentState(void)
1059 HKEY compkey, prodkey;
1060 CHAR prodcode[MAX_PATH];
1061 CHAR prod_squashed[MAX_PATH];
1062 CHAR component[MAX_PATH];
1063 CHAR comp_base85[MAX_PATH];
1064 CHAR comp_squashed[MAX_PATH];
1065 CHAR keypath[MAX_PATH];
1071 static const INSTALLSTATE MAGIC_ERROR = 0xdeadbeef;
1073 if (!pMsiQueryComponentStateA)
1075 skip("MsiQueryComponentStateA not implemented\n");
1079 create_test_guid(prodcode, prod_squashed);
1080 compose_base85_guid(component, comp_base85, comp_squashed);
1081 get_user_sid(&usersid);
1083 /* NULL szProductCode */
1084 state = MAGIC_ERROR;
1085 r = pMsiQueryComponentStateA(NULL, NULL, MSIINSTALLCONTEXT_MACHINE, component, &state);
1086 ok(r == ERROR_INVALID_PARAMETER, "Expected ERROR_INVALID_PARAMETER, got %d\n", r);
1087 ok(state == MAGIC_ERROR, "Expected 0xdeadbeef, got %d\n", state);
1089 /* empty szProductCode */
1090 state = MAGIC_ERROR;
1091 r = pMsiQueryComponentStateA("", NULL, MSIINSTALLCONTEXT_MACHINE, component, &state);
1092 ok(r == ERROR_INVALID_PARAMETER, "Expected ERROR_INVALID_PARAMETER, got %d\n", r);
1093 ok(state == MAGIC_ERROR, "Expected 0xdeadbeef, got %d\n", state);
1095 /* random szProductCode */
1096 state = MAGIC_ERROR;
1097 r = pMsiQueryComponentStateA("random", NULL, MSIINSTALLCONTEXT_MACHINE, component, &state);
1098 ok(r == ERROR_INVALID_PARAMETER, "Expected ERROR_INVALID_PARAMETER, got %d\n", r);
1099 ok(state == MAGIC_ERROR, "Expected 0xdeadbeef, got %d\n", state);
1101 /* GUID-length szProductCode */
1102 state = MAGIC_ERROR;
1103 r = pMsiQueryComponentStateA("DJANE93KNDNAS-2KN2NR93KMN3LN13=L1N3KDE", NULL, MSIINSTALLCONTEXT_MACHINE, component, &state);
1104 ok(r == ERROR_INVALID_PARAMETER, "Expected ERROR_INVALID_PARAMETER, got %d\n", r);
1105 ok(state == MAGIC_ERROR, "Expected 0xdeadbeef, got %d\n", state);
1107 /* GUID-length with brackets */
1108 state = MAGIC_ERROR;
1109 r = pMsiQueryComponentStateA("{JANE93KNDNAS-2KN2NR93KMN3LN13=L1N3KD}", NULL, MSIINSTALLCONTEXT_MACHINE, component, &state);
1110 ok(r == ERROR_INVALID_PARAMETER, "Expected ERROR_INVALID_PARAMETER, got %d\n", r);
1111 ok(state == MAGIC_ERROR, "Expected 0xdeadbeef, got %d\n", state);
1114 state = MAGIC_ERROR;
1115 r = pMsiQueryComponentStateA(prodcode, NULL, MSIINSTALLCONTEXT_MACHINE, component, &state);
1116 ok(r == ERROR_UNKNOWN_PRODUCT, "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r);
1117 ok(state == MAGIC_ERROR, "Expected 0xdeadbeef, got %d\n", state);
1119 state = MAGIC_ERROR;
1120 r = pMsiQueryComponentStateA(prodcode, NULL, MSIINSTALLCONTEXT_MACHINE, component, &state);
1121 ok(r == ERROR_UNKNOWN_PRODUCT, "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r);
1122 ok(state == MAGIC_ERROR, "Expected 0xdeadbeef, got %d\n", state);
1124 lstrcpyA(keypath, "Software\\Classes\\Installer\\Products\\");
1125 lstrcatA(keypath, prod_squashed);
1127 res = RegCreateKeyA(HKEY_LOCAL_MACHINE, keypath, &prodkey);
1128 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
1130 state = MAGIC_ERROR;
1131 r = pMsiQueryComponentStateA(prodcode, NULL, MSIINSTALLCONTEXT_MACHINE, component, &state);
1132 ok(r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r);
1133 ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
1135 RegDeleteKeyA(prodkey, "");
1136 RegCloseKey(prodkey);
1138 /* create local system product key */
1139 lstrcpyA(keypath, "Software\\Microsoft\\Windows\\CurrentVersion\\Installer\\UserData\\S-1-5-18\\Products\\");
1140 lstrcatA(keypath, prod_squashed);
1141 lstrcatA(keypath, "\\InstallProperties");
1143 res = RegCreateKeyA(HKEY_LOCAL_MACHINE, keypath, &prodkey);
1144 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
1146 /* local system product key exists */
1147 state = MAGIC_ERROR;
1148 r = pMsiQueryComponentStateA(prodcode, NULL, MSIINSTALLCONTEXT_MACHINE, component, &state);
1149 ok(r == ERROR_UNKNOWN_PRODUCT, "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r);
1150 ok(state == MAGIC_ERROR, "Expected 0xdeadbeef, got %d\n", state);
1152 res = RegSetValueExA(prodkey, "LocalPackage", 0, REG_SZ, (const BYTE *)"msitest.msi", 11);
1153 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
1155 /* LocalPackage value exists */
1156 state = MAGIC_ERROR;
1157 r = pMsiQueryComponentStateA(prodcode, NULL, MSIINSTALLCONTEXT_MACHINE, component, &state);
1158 ok(r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r);
1159 ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
1161 lstrcpyA(keypath, "Software\\Microsoft\\Windows\\CurrentVersion\\Installer\\UserData\\S-1-5-18\\Components\\");
1162 lstrcatA(keypath, comp_squashed);
1164 res = RegCreateKeyA(HKEY_LOCAL_MACHINE, keypath, &compkey);
1165 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
1167 /* component key exists */
1168 state = MAGIC_ERROR;
1169 r = pMsiQueryComponentStateA(prodcode, NULL, MSIINSTALLCONTEXT_MACHINE, component, &state);
1170 ok(r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r);
1171 ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
1173 res = RegSetValueExA(compkey, prod_squashed, 0, REG_SZ, (const BYTE *)"", 0);
1174 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
1176 /* component\product exists */
1177 state = MAGIC_ERROR;
1178 r = pMsiQueryComponentStateA(prodcode, NULL, MSIINSTALLCONTEXT_MACHINE, component, &state);
1179 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
1180 ok(state == INSTALLSTATE_NOTUSED, "Expected INSTALLSTATE_NOTUSED, got %d\n", state);
1182 res = RegSetValueExA(compkey, prod_squashed, 0, REG_SZ, (const BYTE *)"hi", 2);
1183 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
1185 state = MAGIC_ERROR;
1186 r = pMsiQueryComponentStateA(prodcode, NULL, MSIINSTALLCONTEXT_MACHINE, component, &state);
1187 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
1188 ok(state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
1190 RegDeleteValueA(prodkey, "LocalPackage");
1191 RegDeleteKeyA(prodkey, "");
1192 RegDeleteValueA(compkey, prod_squashed);
1193 RegDeleteKeyA(prodkey, "");
1194 RegCloseKey(prodkey);
1195 RegCloseKey(compkey);
1197 /* MSIINSTALLCONTEXT_USERUNMANAGED */
1199 state = MAGIC_ERROR;
1200 r = pMsiQueryComponentStateA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED, component, &state);
1201 ok(r == ERROR_UNKNOWN_PRODUCT, "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r);
1202 ok(state == MAGIC_ERROR, "Expected 0xdeadbeef, got %d\n", state);
1204 lstrcpyA(keypath, "Software\\Microsoft\\Installer\\Products\\");
1205 lstrcatA(keypath, prod_squashed);
1207 res = RegCreateKeyA(HKEY_CURRENT_USER, keypath, &prodkey);
1208 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
1210 state = MAGIC_ERROR;
1211 r = pMsiQueryComponentStateA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED, component, &state);
1212 ok(r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r);
1213 ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
1215 RegDeleteKeyA(prodkey, "");
1216 RegCloseKey(prodkey);
1218 lstrcpyA(keypath, "Software\\Microsoft\\Windows\\CurrentVersion\\Installer\\UserData\\");
1219 lstrcatA(keypath, usersid);
1220 lstrcatA(keypath, "\\Products\\");
1221 lstrcatA(keypath, prod_squashed);
1222 lstrcatA(keypath, "\\InstallProperties");
1224 res = RegCreateKeyA(HKEY_LOCAL_MACHINE, keypath, &prodkey);
1225 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
1227 res = RegSetValueExA(prodkey, "LocalPackage", 0, REG_SZ, (const BYTE *)"msitest.msi", 11);
1228 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
1230 RegCloseKey(prodkey);
1232 state = MAGIC_ERROR;
1233 r = pMsiQueryComponentStateA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED, component, &state);
1234 ok(r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r);
1235 ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
1237 lstrcpyA(keypath, "Software\\Microsoft\\Windows\\CurrentVersion\\Installer\\UserData\\");
1238 lstrcatA(keypath, usersid);
1239 lstrcatA(keypath, "\\Components\\");
1240 lstrcatA(keypath, comp_squashed);
1242 res = RegCreateKeyA(HKEY_LOCAL_MACHINE, keypath, &compkey);
1243 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
1245 /* component key exists */
1246 state = MAGIC_ERROR;
1247 r = pMsiQueryComponentStateA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED, component, &state);
1248 ok(r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r);
1249 ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
1251 res = RegSetValueExA(compkey, prod_squashed, 0, REG_SZ, (const BYTE *)"", 0);
1252 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
1254 /* component\product exists */
1255 state = MAGIC_ERROR;
1256 r = pMsiQueryComponentStateA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED, component, &state);
1257 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
1258 ok(state == INSTALLSTATE_NOTUSED, "Expected INSTALLSTATE_NOTUSED, got %d\n", state);
1260 res = RegSetValueExA(compkey, prod_squashed, 0, REG_SZ, (const BYTE *)"hi", 2);
1261 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
1263 state = MAGIC_ERROR;
1264 r = pMsiQueryComponentStateA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED, component, &state);
1265 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
1266 ok(state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
1268 /* MSIINSTALLCONTEXT_USERMANAGED */
1270 state = MAGIC_ERROR;
1271 r = pMsiQueryComponentStateA(prodcode, NULL, MSIINSTALLCONTEXT_USERMANAGED, component, &state);
1272 ok(r == ERROR_UNKNOWN_PRODUCT, "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r);
1273 ok(state == MAGIC_ERROR, "Expected 0xdeadbeef, got %d\n", state);
1275 lstrcpyA(keypath, "Software\\Microsoft\\Installer\\Products\\");
1276 lstrcatA(keypath, prod_squashed);
1278 res = RegCreateKeyA(HKEY_CURRENT_USER, keypath, &prodkey);
1279 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
1281 state = MAGIC_ERROR;
1282 r = pMsiQueryComponentStateA(prodcode, NULL, MSIINSTALLCONTEXT_USERMANAGED, component, &state);
1283 ok(r == ERROR_UNKNOWN_PRODUCT, "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r);
1284 ok(state == MAGIC_ERROR, "Expected 0xdeadbeef, got %d\n", state);
1286 RegDeleteKeyA(prodkey, "");
1287 RegCloseKey(prodkey);
1289 lstrcpyA(keypath, "Software\\Microsoft\\Windows\\CurrentVersion\\Installer\\Managed\\");
1290 lstrcatA(keypath, usersid);
1291 lstrcatA(keypath, "\\Installer\\Products\\");
1292 lstrcatA(keypath, prod_squashed);
1294 res = RegCreateKeyA(HKEY_LOCAL_MACHINE, keypath, &prodkey);
1295 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
1297 state = MAGIC_ERROR;
1298 r = pMsiQueryComponentStateA(prodcode, NULL, MSIINSTALLCONTEXT_USERMANAGED, component, &state);
1299 ok(r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r);
1300 ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
1302 RegDeleteKeyA(prodkey, "");
1303 RegCloseKey(prodkey);
1305 lstrcpyA(keypath, "Software\\Microsoft\\Windows\\CurrentVersion\\Installer\\UserData\\");
1306 lstrcatA(keypath, usersid);
1307 lstrcatA(keypath, "\\Products\\");
1308 lstrcatA(keypath, prod_squashed);
1309 lstrcatA(keypath, "\\InstallProperties");
1311 res = RegOpenKeyA(HKEY_LOCAL_MACHINE, keypath, &prodkey);
1312 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
1314 res = RegSetValueExA(prodkey, "ManagedLocalPackage", 0, REG_SZ, (const BYTE *)"msitest.msi", 11);
1315 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
1317 state = MAGIC_ERROR;
1318 r = pMsiQueryComponentStateA(prodcode, NULL, MSIINSTALLCONTEXT_USERMANAGED, component, &state);
1319 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
1320 ok(state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
1322 RegDeleteValueA(prodkey, "LocalPackage");
1323 RegDeleteValueA(prodkey, "ManagedLocalPackage");
1324 RegDeleteKeyA(prodkey, "");
1325 RegDeleteValueA(compkey, prod_squashed);
1326 RegDeleteKeyA(compkey, "");
1327 RegCloseKey(prodkey);
1328 RegCloseKey(compkey);
1331 static void test_MsiGetComponentPath(void)
1333 HKEY compkey, prodkey, installprop;
1334 CHAR prodcode[MAX_PATH];
1335 CHAR prod_squashed[MAX_PATH];
1336 CHAR component[MAX_PATH];
1337 CHAR comp_base85[MAX_PATH];
1338 CHAR comp_squashed[MAX_PATH];
1339 CHAR keypath[MAX_PATH];
1340 CHAR path[MAX_PATH];
1346 create_test_guid(prodcode, prod_squashed);
1347 compose_base85_guid(component, comp_base85, comp_squashed);
1348 get_user_sid(&usersid);
1350 /* NULL szProduct */
1352 state = MsiGetComponentPathA(NULL, component, path, &size);
1353 ok(state == INSTALLSTATE_INVALIDARG, "Expected INSTALLSTATE_INVALIDARG, got %d\n", state);
1354 ok(size == MAX_PATH, "Expected size to be unchanged, got %d\n", size);
1356 /* NULL szComponent */
1358 state = MsiGetComponentPathA(prodcode, NULL, path, &size);
1359 ok(state == INSTALLSTATE_INVALIDARG, "Expected INSTALLSTATE_INVALIDARG, got %d\n", state);
1360 ok(size == MAX_PATH, "Expected size to be unchanged, got %d\n", size);
1362 /* NULL lpPathBuf */
1364 state = MsiGetComponentPathA(prodcode, component, NULL, &size);
1365 ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
1366 ok(size == MAX_PATH, "Expected size to be unchanged, got %d\n", size);
1370 state = MsiGetComponentPathA(prodcode, component, path, NULL);
1371 ok(state == INSTALLSTATE_INVALIDARG, "Expected INSTALLSTATE_INVALIDARG, got %d\n", state);
1372 ok(size == MAX_PATH, "Expected size to be unchanged, got %d\n", size);
1374 /* all params valid */
1376 state = MsiGetComponentPathA(prodcode, component, path, &size);
1377 ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
1378 ok(size == MAX_PATH, "Expected size to be unchanged, got %d\n", size);
1380 lstrcpyA(keypath, "Software\\Microsoft\\Windows\\CurrentVersion\\");
1381 lstrcatA(keypath, "Installer\\UserData\\S-1-5-18\\Components\\");
1382 lstrcatA(keypath, comp_squashed);
1384 res = RegCreateKeyA(HKEY_LOCAL_MACHINE, keypath, &compkey);
1385 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
1387 /* local system component key exists */
1389 state = MsiGetComponentPathA(prodcode, component, path, &size);
1390 ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
1391 ok(size == MAX_PATH, "Expected size to be unchanged, got %d\n", size);
1393 res = RegSetValueExA(compkey, prod_squashed, 0, REG_SZ, (const BYTE *)"C:\\imapath", 10);
1394 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
1396 /* product value exists */
1398 state = MsiGetComponentPathA(prodcode, component, path, &size);
1399 ok(state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
1400 ok(!lstrcmpA(path, "C:\\imapath"), "Expected C:\\imapath, got %s\n", path);
1401 ok(size == 10, "Expected 10, got %d\n", size);
1403 lstrcpyA(keypath, "Software\\Microsoft\\Windows\\CurrentVersion\\");
1404 lstrcatA(keypath, "Installer\\UserData\\S-1-5-18\\Products\\");
1405 lstrcatA(keypath, prod_squashed);
1406 lstrcatA(keypath, "\\InstallProperties");
1408 res = RegCreateKeyA(HKEY_LOCAL_MACHINE, keypath, &installprop);
1409 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
1412 res = RegSetValueExA(installprop, "WindowsInstaller", 0, REG_DWORD, (const BYTE *)&val, sizeof(DWORD));
1413 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
1415 /* install properties key exists */
1417 state = MsiGetComponentPathA(prodcode, component, path, &size);
1418 ok(state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
1419 ok(!lstrcmpA(path, "C:\\imapath"), "Expected C:\\imapath, got %s\n", path);
1420 ok(size == 10, "Expected 10, got %d\n", size);
1422 create_file("C:\\imapath", "C:\\imapath", 11);
1426 state = MsiGetComponentPathA(prodcode, component, path, &size);
1427 ok(state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
1428 ok(!lstrcmpA(path, "C:\\imapath"), "Expected C:\\imapath, got %s\n", path);
1429 ok(size == 10, "Expected 10, got %d\n", size);
1431 RegDeleteValueA(compkey, prod_squashed);
1432 RegDeleteKeyA(compkey, "");
1433 RegDeleteValueA(installprop, "WindowsInstaller");
1434 RegDeleteKeyA(installprop, "");
1435 RegCloseKey(compkey);
1436 RegCloseKey(installprop);
1437 DeleteFileA("C:\\imapath");
1439 lstrcpyA(keypath, "Software\\Microsoft\\Windows\\CurrentVersion\\");
1440 lstrcatA(keypath, "Installer\\UserData\\");
1441 lstrcatA(keypath, usersid);
1442 lstrcatA(keypath, "\\Components\\");
1443 lstrcatA(keypath, comp_squashed);
1445 res = RegCreateKeyA(HKEY_LOCAL_MACHINE, keypath, &compkey);
1446 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
1448 /* user managed component key exists */
1450 state = MsiGetComponentPathA(prodcode, component, path, &size);
1451 ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
1452 ok(size == MAX_PATH, "Expected size to be unchanged, got %d\n", size);
1454 res = RegSetValueExA(compkey, prod_squashed, 0, REG_SZ, (const BYTE *)"C:\\imapath", 10);
1455 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
1457 /* product value exists */
1459 state = MsiGetComponentPathA(prodcode, component, path, &size);
1460 ok(state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
1461 ok(!lstrcmpA(path, "C:\\imapath"), "Expected C:\\imapath, got %s\n", path);
1462 ok(size == 10, "Expected 10, got %d\n", size);
1464 lstrcpyA(keypath, "Software\\Microsoft\\Windows\\CurrentVersion\\");
1465 lstrcatA(keypath, "Installer\\UserData\\S-1-5-18\\Products\\");
1466 lstrcatA(keypath, prod_squashed);
1467 lstrcatA(keypath, "\\InstallProperties");
1469 res = RegCreateKeyA(HKEY_LOCAL_MACHINE, keypath, &installprop);
1470 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
1473 res = RegSetValueExA(installprop, "WindowsInstaller", 0, REG_DWORD, (const BYTE *)&val, sizeof(DWORD));
1474 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
1476 /* install properties key exists */
1478 state = MsiGetComponentPathA(prodcode, component, path, &size);
1479 ok(state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
1480 ok(!lstrcmpA(path, "C:\\imapath"), "Expected C:\\imapath, got %s\n", path);
1481 ok(size == 10, "Expected 10, got %d\n", size);
1483 create_file("C:\\imapath", "C:\\imapath", 11);
1487 state = MsiGetComponentPathA(prodcode, component, path, &size);
1488 ok(state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
1489 ok(!lstrcmpA(path, "C:\\imapath"), "Expected C:\\imapath, got %s\n", path);
1490 ok(size == 10, "Expected 10, got %d\n", size);
1492 RegDeleteValueA(compkey, prod_squashed);
1493 RegDeleteKeyA(compkey, "");
1494 RegDeleteValueA(installprop, "WindowsInstaller");
1495 RegDeleteKeyA(installprop, "");
1496 RegCloseKey(compkey);
1497 RegCloseKey(installprop);
1498 DeleteFileA("C:\\imapath");
1500 lstrcpyA(keypath, "Software\\Microsoft\\Windows\\CurrentVersion\\");
1501 lstrcatA(keypath, "Installer\\Managed\\");
1502 lstrcatA(keypath, usersid);
1503 lstrcatA(keypath, "\\Installer\\Products\\");
1504 lstrcatA(keypath, prod_squashed);
1506 res = RegCreateKeyA(HKEY_LOCAL_MACHINE, keypath, &prodkey);
1507 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
1509 /* user managed product key exists */
1511 state = MsiGetComponentPathA(prodcode, component, path, &size);
1512 ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
1513 ok(size == MAX_PATH, "Expected size to be unchanged, got %d\n", size);
1515 lstrcpyA(keypath, "Software\\Microsoft\\Windows\\CurrentVersion\\");
1516 lstrcatA(keypath, "Installer\\UserData\\");
1517 lstrcatA(keypath, usersid);
1518 lstrcatA(keypath, "\\Components\\");
1519 lstrcatA(keypath, comp_squashed);
1521 res = RegCreateKeyA(HKEY_LOCAL_MACHINE, keypath, &compkey);
1522 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
1524 /* user managed component key exists */
1526 state = MsiGetComponentPathA(prodcode, component, path, &size);
1527 ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
1528 ok(size == MAX_PATH, "Expected size to be unchanged, got %d\n", size);
1530 res = RegSetValueExA(compkey, prod_squashed, 0, REG_SZ, (const BYTE *)"C:\\imapath", 10);
1531 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
1533 /* product value exists */
1535 state = MsiGetComponentPathA(prodcode, component, path, &size);
1536 ok(state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
1537 ok(!lstrcmpA(path, "C:\\imapath"), "Expected C:\\imapath, got %s\n", path);
1538 ok(size == 10, "Expected 10, got %d\n", size);
1540 lstrcpyA(keypath, "Software\\Microsoft\\Windows\\CurrentVersion\\");
1541 lstrcatA(keypath, "Installer\\UserData\\S-1-5-18\\Products\\");
1542 lstrcatA(keypath, prod_squashed);
1543 lstrcatA(keypath, "\\InstallProperties");
1545 res = RegCreateKeyA(HKEY_LOCAL_MACHINE, keypath, &installprop);
1546 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
1549 res = RegSetValueExA(installprop, "WindowsInstaller", 0, REG_DWORD, (const BYTE *)&val, sizeof(DWORD));
1550 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
1552 /* install properties key exists */
1554 state = MsiGetComponentPathA(prodcode, component, path, &size);
1555 ok(state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
1556 ok(!lstrcmpA(path, "C:\\imapath"), "Expected C:\\imapath, got %s\n", path);
1557 ok(size == 10, "Expected 10, got %d\n", size);
1559 create_file("C:\\imapath", "C:\\imapath", 11);
1563 state = MsiGetComponentPathA(prodcode, component, path, &size);
1564 ok(state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
1565 ok(!lstrcmpA(path, "C:\\imapath"), "Expected C:\\imapath, got %s\n", path);
1566 ok(size == 10, "Expected 10, got %d\n", size);
1568 RegDeleteValueA(compkey, prod_squashed);
1569 RegDeleteKeyA(prodkey, "");
1570 RegDeleteKeyA(compkey, "");
1571 RegDeleteValueA(installprop, "WindowsInstaller");
1572 RegDeleteKeyA(installprop, "");
1573 RegCloseKey(prodkey);
1574 RegCloseKey(compkey);
1575 RegCloseKey(installprop);
1576 DeleteFileA("C:\\imapath");
1578 lstrcpyA(keypath, "Software\\Microsoft\\Installer\\Products\\");
1579 lstrcatA(keypath, prod_squashed);
1581 res = RegCreateKeyA(HKEY_CURRENT_USER, keypath, &prodkey);
1582 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
1584 /* user unmanaged product key exists */
1586 state = MsiGetComponentPathA(prodcode, component, path, &size);
1587 ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
1588 ok(size == MAX_PATH, "Expected size to be unchanged, got %d\n", size);
1590 lstrcpyA(keypath, "Software\\Microsoft\\Windows\\CurrentVersion\\");
1591 lstrcatA(keypath, "Installer\\UserData\\");
1592 lstrcatA(keypath, usersid);
1593 lstrcatA(keypath, "\\Components\\");
1594 lstrcatA(keypath, comp_squashed);
1596 res = RegCreateKeyA(HKEY_LOCAL_MACHINE, keypath, &compkey);
1597 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
1599 /* user unmanaged component key exists */
1601 state = MsiGetComponentPathA(prodcode, component, path, &size);
1602 ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
1603 ok(size == MAX_PATH, "Expected size to be unchanged, got %d\n", size);
1605 res = RegSetValueExA(compkey, prod_squashed, 0, REG_SZ, (const BYTE *)"C:\\imapath", 10);
1606 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
1608 /* product value exists */
1610 state = MsiGetComponentPathA(prodcode, component, path, &size);
1611 ok(state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
1612 ok(!lstrcmpA(path, "C:\\imapath"), "Expected C:\\imapath, got %s\n", path);
1613 ok(size == 10, "Expected 10, got %d\n", size);
1615 create_file("C:\\imapath", "C:\\imapath", 11);
1619 state = MsiGetComponentPathA(prodcode, component, path, &size);
1620 ok(state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
1621 ok(!lstrcmpA(path, "C:\\imapath"), "Expected C:\\imapath, got %s\n", path);
1622 ok(size == 10, "Expected 10, got %d\n", size);
1624 RegDeleteValueA(compkey, prod_squashed);
1625 RegDeleteKeyA(prodkey, "");
1626 RegDeleteKeyA(compkey, "");
1627 RegCloseKey(prodkey);
1628 RegCloseKey(compkey);
1629 RegCloseKey(installprop);
1630 DeleteFileA("C:\\imapath");
1632 lstrcpyA(keypath, "Software\\Classes\\Installer\\Products\\");
1633 lstrcatA(keypath, prod_squashed);
1635 res = RegCreateKeyA(HKEY_LOCAL_MACHINE, keypath, &prodkey);
1636 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
1638 /* local classes product key exists */
1640 state = MsiGetComponentPathA(prodcode, component, path, &size);
1641 ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
1642 ok(size == MAX_PATH, "Expected size to be unchanged, got %d\n", size);
1644 lstrcpyA(keypath, "Software\\Microsoft\\Windows\\CurrentVersion\\");
1645 lstrcatA(keypath, "Installer\\UserData\\S-1-5-18\\Components\\");
1646 lstrcatA(keypath, comp_squashed);
1648 res = RegCreateKeyA(HKEY_LOCAL_MACHINE, keypath, &compkey);
1649 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
1651 /* local user component key exists */
1653 state = MsiGetComponentPathA(prodcode, component, path, &size);
1654 ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
1655 ok(size == MAX_PATH, "Expected size to be unchanged, got %d\n", size);
1657 res = RegSetValueExA(compkey, prod_squashed, 0, REG_SZ, (const BYTE *)"C:\\imapath", 10);
1658 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
1660 /* product value exists */
1662 state = MsiGetComponentPathA(prodcode, component, path, &size);
1663 ok(state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
1664 ok(!lstrcmpA(path, "C:\\imapath"), "Expected C:\\imapath, got %s\n", path);
1665 ok(size == 10, "Expected 10, got %d\n", size);
1667 create_file("C:\\imapath", "C:\\imapath", 11);
1671 state = MsiGetComponentPathA(prodcode, component, path, &size);
1672 ok(state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
1673 ok(!lstrcmpA(path, "C:\\imapath"), "Expected C:\\imapath, got %s\n", path);
1674 ok(size == 10, "Expected 10, got %d\n", size);
1676 RegDeleteValueA(compkey, prod_squashed);
1677 RegDeleteKeyA(prodkey, "");
1678 RegDeleteKeyA(compkey, "");
1679 RegCloseKey(prodkey);
1680 RegCloseKey(compkey);
1681 DeleteFileA("C:\\imapath");
1684 static void test_MsiGetProductCode(void)
1686 HKEY compkey, prodkey;
1687 CHAR prodcode[MAX_PATH];
1688 CHAR prod_squashed[MAX_PATH];
1689 CHAR prodcode2[MAX_PATH];
1690 CHAR prod2_squashed[MAX_PATH];
1691 CHAR component[MAX_PATH];
1692 CHAR comp_base85[MAX_PATH];
1693 CHAR comp_squashed[MAX_PATH];
1694 CHAR keypath[MAX_PATH];
1695 CHAR product[MAX_PATH];
1700 create_test_guid(prodcode, prod_squashed);
1701 create_test_guid(prodcode2, prod2_squashed);
1702 compose_base85_guid(component, comp_base85, comp_squashed);
1703 get_user_sid(&usersid);
1705 /* szComponent is NULL */
1706 lstrcpyA(product, "prod");
1707 r = MsiGetProductCodeA(NULL, product);
1708 ok(r == ERROR_INVALID_PARAMETER, "Expected ERROR_INVALID_PARAMETER, got %d\n", r);
1709 ok(!lstrcmpA(product, "prod"), "Expected product to be unchanged, got %s\n", product);
1711 /* szComponent is empty */
1712 lstrcpyA(product, "prod");
1713 r = MsiGetProductCodeA("", product);
1714 ok(r == ERROR_INVALID_PARAMETER, "Expected ERROR_INVALID_PARAMETER, got %d\n", r);
1715 ok(!lstrcmpA(product, "prod"), "Expected product to be unchanged, got %s\n", product);
1717 /* garbage szComponent */
1718 lstrcpyA(product, "prod");
1719 r = MsiGetProductCodeA("garbage", product);
1720 ok(r == ERROR_INVALID_PARAMETER, "Expected ERROR_INVALID_PARAMETER, got %d\n", r);
1721 ok(!lstrcmpA(product, "prod"), "Expected product to be unchanged, got %s\n", product);
1723 /* guid without brackets */
1724 lstrcpyA(product, "prod");
1725 r = MsiGetProductCodeA("6700E8CF-95AB-4D9C-BC2C-15840DEA7A5D", product);
1726 ok(r == ERROR_INVALID_PARAMETER, "Expected ERROR_INVALID_PARAMETER, got %d\n", r);
1727 ok(!lstrcmpA(product, "prod"), "Expected product to be unchanged, got %s\n", product);
1729 /* guid with brackets */
1730 lstrcpyA(product, "prod");
1731 r = MsiGetProductCodeA("{6700E8CF-95AB-4D9C-BC2C-15840DEA7A5D}", product);
1732 ok(r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r);
1733 ok(!lstrcmpA(product, "prod"), "Expected product to be unchanged, got %s\n", product);
1735 /* same length as guid, but random */
1736 lstrcpyA(product, "prod");
1737 r = MsiGetProductCodeA("A938G02JF-2NF3N93-VN3-2NNF-3KGKALDNF93", product);
1738 ok(r == ERROR_INVALID_PARAMETER, "Expected ERROR_INVALID_PARAMETER, got %d\n", r);
1739 ok(!lstrcmpA(product, "prod"), "Expected product to be unchanged, got %s\n", product);
1741 /* all params correct, szComponent not published */
1742 lstrcpyA(product, "prod");
1743 r = MsiGetProductCodeA(component, product);
1744 ok(r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r);
1745 ok(!lstrcmpA(product, "prod"), "Expected product to be unchanged, got %s\n", product);
1747 lstrcpyA(keypath, "Software\\Microsoft\\Windows\\CurrentVersion\\");
1748 lstrcatA(keypath, "Installer\\UserData\\");
1749 lstrcatA(keypath, usersid);
1750 lstrcatA(keypath, "\\Components\\");
1751 lstrcatA(keypath, comp_squashed);
1753 res = RegCreateKeyA(HKEY_LOCAL_MACHINE, keypath, &compkey);
1754 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
1756 /* user unmanaged component key exists */
1757 lstrcpyA(product, "prod");
1758 r = MsiGetProductCodeA(component, product);
1759 ok(r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r);
1760 ok(!lstrcmpA(product, "prod"), "Expected product to be unchanged, got %s\n", product);
1762 res = RegSetValueExA(compkey, prod_squashed, 0, REG_SZ, (const BYTE *)"C:\\imapath", 10);
1763 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
1765 /* product value exists */
1766 lstrcpyA(product, "prod");
1767 r = MsiGetProductCodeA(component, product);
1768 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
1769 ok(!lstrcmpA(product, prodcode), "Expected %s, got %s\n", prodcode, product);
1771 res = RegSetValueExA(compkey, prod2_squashed, 0, REG_SZ, (const BYTE *)"C:\\another", 10);
1772 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
1774 lstrcpyA(keypath, "Software\\Microsoft\\Windows\\CurrentVersion\\");
1775 lstrcatA(keypath, "Installer\\Managed\\");
1776 lstrcatA(keypath, usersid);
1777 lstrcatA(keypath, "\\Installer\\Products\\");
1778 lstrcatA(keypath, prod_squashed);
1780 res = RegCreateKeyA(HKEY_LOCAL_MACHINE, keypath, &prodkey);
1781 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
1783 /* user managed product key of first product exists */
1784 lstrcpyA(product, "prod");
1785 r = MsiGetProductCodeA(component, product);
1786 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
1787 ok(!lstrcmpA(product, prodcode), "Expected %s, got %s\n", prodcode, product);
1789 RegDeleteKeyA(prodkey, "");
1790 RegCloseKey(prodkey);
1792 RegDeleteKeyA(prodkey, "");
1793 RegCloseKey(prodkey);
1795 lstrcpyA(keypath, "Software\\Microsoft\\Installer\\Products\\");
1796 lstrcatA(keypath, prod_squashed);
1798 res = RegCreateKeyA(HKEY_CURRENT_USER, keypath, &prodkey);
1799 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
1801 /* user unmanaged product key exists */
1802 lstrcpyA(product, "prod");
1803 r = MsiGetProductCodeA(component, product);
1804 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
1805 ok(!lstrcmpA(product, prodcode), "Expected %s, got %s\n", prodcode, product);
1807 RegDeleteKeyA(prodkey, "");
1808 RegCloseKey(prodkey);
1810 lstrcpyA(keypath, "Software\\Classes\\Installer\\Products\\");
1811 lstrcatA(keypath, prod_squashed);
1813 res = RegCreateKeyA(HKEY_LOCAL_MACHINE, keypath, &prodkey);
1814 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
1816 /* local classes product key exists */
1817 lstrcpyA(product, "prod");
1818 r = MsiGetProductCodeA(component, product);
1819 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
1820 ok(!lstrcmpA(product, prodcode), "Expected %s, got %s\n", prodcode, product);
1822 RegDeleteKeyA(prodkey, "");
1823 RegCloseKey(prodkey);
1825 lstrcpyA(keypath, "Software\\Microsoft\\Windows\\CurrentVersion\\");
1826 lstrcatA(keypath, "Installer\\Managed\\");
1827 lstrcatA(keypath, usersid);
1828 lstrcatA(keypath, "\\Installer\\Products\\");
1829 lstrcatA(keypath, prod2_squashed);
1831 res = RegCreateKeyA(HKEY_LOCAL_MACHINE, keypath, &prodkey);
1832 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
1834 /* user managed product key of second product exists */
1835 lstrcpyA(product, "prod");
1836 r = MsiGetProductCodeA(component, product);
1837 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
1838 ok(!lstrcmpA(product, prodcode2), "Expected %s, got %s\n", prodcode2, product);
1840 RegDeleteKeyA(prodkey, "");
1841 RegCloseKey(prodkey);
1842 RegDeleteValueA(compkey, prod_squashed);
1843 RegDeleteValueA(compkey, prod2_squashed);
1844 RegDeleteKeyA(compkey, "");
1845 RegCloseKey(compkey);
1847 lstrcpyA(keypath, "Software\\Microsoft\\Windows\\CurrentVersion\\");
1848 lstrcatA(keypath, "Installer\\UserData\\S-1-5-18\\Components\\");
1849 lstrcatA(keypath, comp_squashed);
1851 res = RegCreateKeyA(HKEY_LOCAL_MACHINE, keypath, &compkey);
1852 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
1854 /* local user component key exists */
1855 lstrcpyA(product, "prod");
1856 r = MsiGetProductCodeA(component, product);
1857 ok(r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r);
1858 ok(!lstrcmpA(product, "prod"), "Expected product to be unchanged, got %s\n", product);
1860 res = RegSetValueExA(compkey, prod_squashed, 0, REG_SZ, (const BYTE *)"C:\\imapath", 10);
1861 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
1863 /* product value exists */
1864 lstrcpyA(product, "prod");
1865 r = MsiGetProductCodeA(component, product);
1866 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
1867 ok(!lstrcmpA(product, prodcode), "Expected %s, got %s\n", prodcode, product);
1869 res = RegSetValueExA(compkey, prod2_squashed, 0, REG_SZ, (const BYTE *)"C:\\another", 10);
1870 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
1872 lstrcpyA(keypath, "Software\\Microsoft\\Windows\\CurrentVersion\\");
1873 lstrcatA(keypath, "Installer\\Managed\\");
1874 lstrcatA(keypath, usersid);
1875 lstrcatA(keypath, "\\Installer\\Products\\");
1876 lstrcatA(keypath, prod_squashed);
1878 res = RegCreateKeyA(HKEY_LOCAL_MACHINE, keypath, &prodkey);
1879 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
1881 /* user managed product key of first product exists */
1882 lstrcpyA(product, "prod");
1883 r = MsiGetProductCodeA(component, product);
1884 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
1885 ok(!lstrcmpA(product, prodcode), "Expected %s, got %s\n", prodcode, product);
1887 RegDeleteKeyA(prodkey, "");
1888 RegCloseKey(prodkey);
1890 lstrcpyA(keypath, "Software\\Microsoft\\Installer\\Products\\");
1891 lstrcatA(keypath, prod_squashed);
1893 res = RegCreateKeyA(HKEY_CURRENT_USER, keypath, &prodkey);
1894 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
1896 /* user unmanaged product key exists */
1897 lstrcpyA(product, "prod");
1898 r = MsiGetProductCodeA(component, product);
1899 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
1900 ok(!lstrcmpA(product, prodcode), "Expected %s, got %s\n", prodcode, product);
1902 RegDeleteKeyA(prodkey, "");
1903 RegCloseKey(prodkey);
1905 lstrcpyA(keypath, "Software\\Classes\\Installer\\Products\\");
1906 lstrcatA(keypath, prod_squashed);
1908 res = RegCreateKeyA(HKEY_LOCAL_MACHINE, keypath, &prodkey);
1909 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
1911 /* local classes product key exists */
1912 lstrcpyA(product, "prod");
1913 r = MsiGetProductCodeA(component, product);
1914 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
1915 ok(!lstrcmpA(product, prodcode), "Expected %s, got %s\n", prodcode, product);
1917 RegDeleteKeyA(prodkey, "");
1918 RegCloseKey(prodkey);
1920 lstrcpyA(keypath, "Software\\Microsoft\\Windows\\CurrentVersion\\");
1921 lstrcatA(keypath, "Installer\\Managed\\");
1922 lstrcatA(keypath, usersid);
1923 lstrcatA(keypath, "\\Installer\\Products\\");
1924 lstrcatA(keypath, prod2_squashed);
1926 res = RegCreateKeyA(HKEY_LOCAL_MACHINE, keypath, &prodkey);
1927 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
1929 /* user managed product key of second product exists */
1930 lstrcpyA(product, "prod");
1931 r = MsiGetProductCodeA(component, product);
1932 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
1933 ok(!lstrcmpA(product, prodcode2), "Expected %s, got %s\n", prodcode2, product);
1935 RegDeleteKeyA(prodkey, "");
1936 RegCloseKey(prodkey);
1937 RegDeleteValueA(compkey, prod_squashed);
1938 RegDeleteValueA(compkey, prod2_squashed);
1939 RegDeleteKeyA(compkey, "");
1940 RegCloseKey(compkey);
1943 static void test_MsiEnumClients(void)
1946 CHAR prodcode[MAX_PATH];
1947 CHAR prod_squashed[MAX_PATH];
1948 CHAR prodcode2[MAX_PATH];
1949 CHAR prod2_squashed[MAX_PATH];
1950 CHAR component[MAX_PATH];
1951 CHAR comp_base85[MAX_PATH];
1952 CHAR comp_squashed[MAX_PATH];
1953 CHAR product[MAX_PATH];
1954 CHAR keypath[MAX_PATH];
1959 create_test_guid(prodcode, prod_squashed);
1960 create_test_guid(prodcode2, prod2_squashed);
1961 compose_base85_guid(component, comp_base85, comp_squashed);
1962 get_user_sid(&usersid);
1964 /* NULL szComponent */
1966 r = MsiEnumClientsA(NULL, 0, product);
1967 ok(r == ERROR_INVALID_PARAMETER, "Expected ERROR_INVALID_PARAMETER, got %d\n", r);
1968 ok(!lstrcmpA(product, ""), "Expected product to be unchanged, got %s\n", product);
1970 /* empty szComponent */
1972 r = MsiEnumClientsA("", 0, product);
1973 ok(r == ERROR_INVALID_PARAMETER, "Expected ERROR_INVALID_PARAMETER, got %d\n", r);
1974 ok(!lstrcmpA(product, ""), "Expected product to be unchanged, got %s\n", product);
1976 /* NULL lpProductBuf */
1977 r = MsiEnumClientsA(component, 0, NULL);
1978 ok(r == ERROR_INVALID_PARAMETER, "Expected ERROR_INVALID_PARAMETER, got %d\n", r);
1980 /* all params correct, component missing */
1982 r = MsiEnumClientsA(component, 0, product);
1983 ok(r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r);
1984 ok(!lstrcmpA(product, ""), "Expected product to be unchanged, got %s\n", product);
1986 lstrcpyA(keypath, "Software\\Microsoft\\Windows\\CurrentVersion\\");
1987 lstrcatA(keypath, "Installer\\UserData\\");
1988 lstrcatA(keypath, usersid);
1989 lstrcatA(keypath, "\\Components\\");
1990 lstrcatA(keypath, comp_squashed);
1992 res = RegCreateKeyA(HKEY_LOCAL_MACHINE, keypath, &compkey);
1993 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
1995 /* user unmanaged component key exists */
1997 r = MsiEnumClientsA(component, 0, product);
1998 ok(r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r);
1999 ok(!lstrcmpA(product, ""), "Expected product to be unchanged, got %s\n", product);
2001 /* index > 0, no products exist */
2003 r = MsiEnumClientsA(component, 1, product);
2004 ok(r == ERROR_INVALID_PARAMETER, "Expected ERROR_INVALID_PARAMETER, got %d\n", r);
2005 ok(!lstrcmpA(product, ""), "Expected product to be unchanged, got %s\n", product);
2007 res = RegSetValueExA(compkey, prod_squashed, 0, REG_SZ, (const BYTE *)"C:\\imapath", 10);
2008 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
2010 /* product value exists */
2011 r = MsiEnumClientsA(component, 0, product);
2012 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
2013 ok(!lstrcmpA(product, prodcode), "Expected %s, got %s\n", prodcode, product);
2015 /* try index 0 again */
2017 r = MsiEnumClientsA(component, 0, product);
2018 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
2019 ok(!lstrcmpA(product, prodcode), "Expected %s, got %s\n", prodcode, product);
2021 /* try index 1, second product value does not exist */
2023 r = MsiEnumClientsA(component, 1, product);
2024 ok(r == ERROR_NO_MORE_ITEMS, "Expected ERROR_NO_MORE_ITEMS, got %d\n", r);
2025 ok(!lstrcmpA(product, ""), "Expected product to be unchanged, got %s\n", product);
2027 res = RegSetValueExA(compkey, prod2_squashed, 0, REG_SZ, (const BYTE *)"C:\\another", 10);
2028 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
2030 /* try index 1, second product value does exist */
2032 r = MsiEnumClientsA(component, 1, product);
2035 ok(r == ERROR_INVALID_PARAMETER, "Expected ERROR_INVALID_PARAMETER, got %d\n", r);
2036 ok(!lstrcmpA(product, ""), "Expected product to be unchanged, got %s\n", product);
2039 /* start the enumeration over */
2041 r = MsiEnumClientsA(component, 0, product);
2042 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
2043 ok(!lstrcmpA(product, prodcode) || !lstrcmpA(product, prodcode2),
2044 "Expected %s or %s, got %s\n", prodcode, prodcode2, product);
2046 /* correctly query second product */
2048 r = MsiEnumClientsA(component, 1, product);
2049 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
2050 ok(!lstrcmpA(product, prodcode) || !lstrcmpA(product, prodcode2),
2051 "Expected %s or %s, got %s\n", prodcode, prodcode2, product);
2053 RegDeleteValueA(compkey, prod_squashed);
2054 RegDeleteValueA(compkey, prod2_squashed);
2055 RegDeleteKeyA(compkey, "");
2056 RegCloseKey(compkey);
2058 lstrcpyA(keypath, "Software\\Microsoft\\Windows\\CurrentVersion\\");
2059 lstrcatA(keypath, "Installer\\UserData\\S-1-5-18\\Components\\");
2060 lstrcatA(keypath, comp_squashed);
2062 res = RegCreateKeyA(HKEY_LOCAL_MACHINE, keypath, &compkey);
2063 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
2065 /* user local component key exists */
2067 r = MsiEnumClientsA(component, 0, product);
2068 ok(r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r);
2069 ok(!lstrcmpA(product, ""), "Expected product to be unchanged, got %s\n", product);
2071 /* index > 0, no products exist */
2073 r = MsiEnumClientsA(component, 1, product);
2074 ok(r == ERROR_INVALID_PARAMETER, "Expected ERROR_INVALID_PARAMETER, got %d\n", r);
2075 ok(!lstrcmpA(product, ""), "Expected product to be unchanged, got %s\n", product);
2077 res = RegSetValueExA(compkey, prod_squashed, 0, REG_SZ, (const BYTE *)"C:\\imapath", 10);
2078 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
2080 /* product value exists */
2082 r = MsiEnumClientsA(component, 0, product);
2083 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
2084 ok(!lstrcmpA(product, prodcode), "Expected %s, got %s\n", prodcode, product);
2086 /* try index 0 again */
2088 r = MsiEnumClientsA(component, 0, product);
2089 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
2091 /* try index 1, second product value does not exist */
2093 r = MsiEnumClientsA(component, 1, product);
2094 ok(r == ERROR_NO_MORE_ITEMS, "Expected ERROR_NO_MORE_ITEMS, got %d\n", r);
2095 ok(!lstrcmpA(product, ""), "Expected product to be unchanged, got %s\n", product);
2097 res = RegSetValueExA(compkey, prod2_squashed, 0, REG_SZ, (const BYTE *)"C:\\another", 10);
2098 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
2100 /* try index 1, second product value does exist */
2102 r = MsiEnumClientsA(component, 1, product);
2105 ok(r == ERROR_INVALID_PARAMETER, "Expected ERROR_INVALID_PARAMETER, got %d\n", r);
2106 ok(!lstrcmpA(product, ""), "Expected product to be unchanged, got %s\n", product);
2109 /* start the enumeration over */
2111 r = MsiEnumClientsA(component, 0, product);
2112 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
2113 ok(!lstrcmpA(product, prodcode) || !lstrcmpA(product, prodcode2),
2114 "Expected %s or %s, got %s\n", prodcode, prodcode2, product);
2116 /* correctly query second product */
2118 r = MsiEnumClientsA(component, 1, product);
2119 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
2120 ok(!lstrcmpA(product, prodcode) || !lstrcmpA(product, prodcode2),
2121 "Expected %s or %s, got %s\n", prodcode, prodcode2, product);
2123 RegDeleteValueA(compkey, prod_squashed);
2124 RegDeleteValueA(compkey, prod2_squashed);
2125 RegDeleteKeyA(compkey, "");
2126 RegCloseKey(compkey);
2129 static void get_version_info(LPSTR path, LPSTR *vercheck, LPDWORD verchecksz,
2130 LPSTR *langcheck, LPDWORD langchecksz)
2133 VS_FIXEDFILEINFO *ffi;
2134 DWORD size = GetFileVersionInfoSizeA(path, NULL);
2137 version = HeapAlloc(GetProcessHeap(), 0, size);
2138 GetFileVersionInfoA(path, 0, size, version);
2140 VerQueryValueA(version, "\\", (LPVOID *)&ffi, &size);
2141 *vercheck = HeapAlloc(GetProcessHeap(), 0, MAX_PATH);
2142 sprintf(*vercheck, "%d.%d.%d.%d", HIWORD(ffi->dwFileVersionMS),
2143 LOWORD(ffi->dwFileVersionMS), HIWORD(ffi->dwFileVersionLS),
2144 LOWORD(ffi->dwFileVersionLS));
2145 *verchecksz = lstrlenA(*vercheck);
2147 VerQueryValue(version, "\\VarFileInfo\\Translation", (void **)&lang, &size);
2148 *langcheck = HeapAlloc(GetProcessHeap(), 0, MAX_PATH);
2149 sprintf(*langcheck, "%d", *lang);
2150 *langchecksz = lstrlenA(*langcheck);
2152 HeapFree(GetProcessHeap(), 0, version);
2155 static void test_MsiGetFileVersion(void)
2158 DWORD versz, langsz;
2159 char version[MAX_PATH];
2160 char lang[MAX_PATH];
2161 char path[MAX_PATH];
2162 LPSTR vercheck, langcheck;
2163 DWORD verchecksz, langchecksz;
2165 /* NULL szFilePath */
2168 lstrcpyA(version, "version");
2169 lstrcpyA(lang, "lang");
2170 r = MsiGetFileVersionA(NULL, version, &versz, lang, &langsz);
2171 ok(r == ERROR_INVALID_PARAMETER,
2172 "Expected ERROR_INVALID_PARAMETER, got %d\n", r);
2173 ok(!lstrcmpA(version, "version"),
2174 "Expected version to be unchanged, got %s\n", version);
2175 ok(versz == MAX_PATH, "Expected %d, got %d\n", MAX_PATH, versz);
2176 ok(!lstrcmpA(lang, "lang"),
2177 "Expected lang to be unchanged, got %s\n", lang);
2178 ok(langsz == MAX_PATH, "Expected %d, got %d\n", MAX_PATH, langsz);
2180 /* empty szFilePath */
2183 lstrcpyA(version, "version");
2184 lstrcpyA(lang, "lang");
2185 r = MsiGetFileVersionA("", version, &versz, lang, &langsz);
2186 ok(r == ERROR_FILE_NOT_FOUND,
2187 "Expected ERROR_FILE_NOT_FOUND, got %d\n", r);
2188 ok(!lstrcmpA(version, "version"),
2189 "Expected version to be unchanged, got %s\n", version);
2190 ok(versz == MAX_PATH, "Expected %d, got %d\n", MAX_PATH, versz);
2191 ok(!lstrcmpA(lang, "lang"),
2192 "Expected lang to be unchanged, got %s\n", lang);
2193 ok(langsz == MAX_PATH, "Expected %d, got %d\n", MAX_PATH, langsz);
2195 /* nonexistent szFilePath */
2198 lstrcpyA(version, "version");
2199 lstrcpyA(lang, "lang");
2200 r = MsiGetFileVersionA("nonexistent", version, &versz, lang, &langsz);
2201 ok(r == ERROR_FILE_NOT_FOUND,
2202 "Expected ERROR_FILE_NOT_FOUND, got %d\n", r);
2203 ok(!lstrcmpA(version, "version"),
2204 "Expected version to be unchanged, got %s\n", version);
2205 ok(versz == MAX_PATH, "Expected %d, got %d\n", MAX_PATH, versz);
2206 ok(!lstrcmpA(lang, "lang"),
2207 "Expected lang to be unchanged, got %s\n", lang);
2208 ok(langsz == MAX_PATH, "Expected %d, got %d\n", MAX_PATH, langsz);
2210 /* nonexistent szFilePath, valid lpVersionBuf, NULL pcchVersionBuf */
2213 lstrcpyA(version, "version");
2214 lstrcpyA(lang, "lang");
2215 r = MsiGetFileVersionA("nonexistent", version, NULL, lang, &langsz);
2216 ok(r == ERROR_INVALID_PARAMETER,
2217 "Expected ERROR_INVALID_PARAMETER, got %d\n", r);
2218 ok(!lstrcmpA(version, "version"),
2219 "Expected version to be unchanged, got %s\n", version);
2220 ok(versz == MAX_PATH, "Expected %d, got %d\n", MAX_PATH, versz);
2221 ok(!lstrcmpA(lang, "lang"),
2222 "Expected lang to be unchanged, got %s\n", lang);
2223 ok(langsz == MAX_PATH, "Expected %d, got %d\n", MAX_PATH, langsz);
2225 /* nonexistent szFilePath, valid lpLangBuf, NULL pcchLangBuf */
2228 lstrcpyA(version, "version");
2229 lstrcpyA(lang, "lang");
2230 r = MsiGetFileVersionA("nonexistent", version, &versz, lang, NULL);
2231 ok(r == ERROR_INVALID_PARAMETER,
2232 "Expected ERROR_INVALID_PARAMETER, got %d\n", r);
2233 ok(!lstrcmpA(version, "version"),
2234 "Expected version to be unchanged, got %s\n", version);
2235 ok(versz == MAX_PATH, "Expected %d, got %d\n", MAX_PATH, versz);
2236 ok(!lstrcmpA(lang, "lang"),
2237 "Expected lang to be unchanged, got %s\n", lang);
2238 ok(langsz == MAX_PATH, "Expected %d, got %d\n", MAX_PATH, langsz);
2240 /* nonexistent szFilePath, valid lpVersionBuf, pcchVersionBuf is zero */
2243 lstrcpyA(version, "version");
2244 lstrcpyA(lang, "lang");
2245 r = MsiGetFileVersionA("nonexistent", version, &versz, lang, &langsz);
2246 ok(r == ERROR_FILE_NOT_FOUND,
2247 "Expected ERROR_FILE_NOT_FOUND, got %d\n", r);
2248 ok(!lstrcmpA(version, "version"),
2249 "Expected version to be unchanged, got %s\n", version);
2250 ok(versz == 0, "Expected 0, got %d\n", versz);
2251 ok(!lstrcmpA(lang, "lang"),
2252 "Expected lang to be unchanged, got %s\n", lang);
2253 ok(langsz == MAX_PATH, "Expected %d, got %d\n", MAX_PATH, langsz);
2255 /* nonexistent szFilePath, valid lpLangBuf, pcchLangBuf is zero */
2258 lstrcpyA(version, "version");
2259 lstrcpyA(lang, "lang");
2260 r = MsiGetFileVersionA("nonexistent", version, &versz, lang, &langsz);
2261 ok(r == ERROR_FILE_NOT_FOUND,
2262 "Expected ERROR_FILE_NOT_FOUND, got %d\n", r);
2263 ok(!lstrcmpA(version, "version"),
2264 "Expected version to be unchanged, got %s\n", version);
2265 ok(versz == MAX_PATH, "Expected %d, got %d\n", MAX_PATH, versz);
2266 ok(!lstrcmpA(lang, "lang"),
2267 "Expected lang to be unchanged, got %s\n", lang);
2268 ok(langsz == 0, "Expected 0, got %d\n", langsz);
2270 /* nonexistent szFilePath, rest NULL */
2271 r = MsiGetFileVersionA("nonexistent", NULL, NULL, NULL, NULL);
2272 ok(r == ERROR_FILE_NOT_FOUND,
2273 "Expected ERROR_FILE_NOT_FOUND, got %d\n", r);
2275 create_file("ver.txt", "ver.txt", 20);
2277 /* file exists, no version information */
2280 lstrcpyA(version, "version");
2281 lstrcpyA(lang, "lang");
2282 r = MsiGetFileVersionA("ver.txt", version, &versz, lang, &langsz);
2283 ok(versz == MAX_PATH, "Expected %d, got %d\n", MAX_PATH, versz);
2284 ok(!lstrcmpA(version, "version"),
2285 "Expected version to be unchanged, got %s\n", version);
2286 ok(langsz == MAX_PATH, "Expected %d, got %d\n", MAX_PATH, langsz);
2287 ok(!lstrcmpA(lang, "lang"),
2288 "Expected lang to be unchanged, got %s\n", lang);
2289 ok(r == ERROR_FILE_INVALID,
2290 "Expected ERROR_FILE_INVALID, got %d\n", r);
2292 DeleteFileA("ver.txt");
2294 /* relative path, has version information */
2297 lstrcpyA(version, "version");
2298 lstrcpyA(lang, "lang");
2299 r = MsiGetFileVersionA("kernel32.dll", version, &versz, lang, &langsz);
2302 ok(r == ERROR_FILE_NOT_FOUND,
2303 "Expected ERROR_FILE_NOT_FOUND, got %d\n", r);
2304 ok(!lstrcmpA(version, "version"),
2305 "Expected version to be unchanged, got %s\n", version);
2306 ok(versz == MAX_PATH, "Expected %d, got %d\n", MAX_PATH, versz);
2307 ok(!lstrcmpA(lang, "lang"),
2308 "Expected lang to be unchanged, got %s\n", lang);
2309 ok(langsz == MAX_PATH, "Expected %d, got %d\n", MAX_PATH, langsz);
2312 GetSystemDirectoryA(path, MAX_PATH);
2313 lstrcatA(path, "\\kernel32.dll");
2315 get_version_info(path, &vercheck, &verchecksz, &langcheck, &langchecksz);
2317 /* absolute path, has version information */
2320 lstrcpyA(version, "version");
2321 lstrcpyA(lang, "lang");
2322 r = MsiGetFileVersionA(path, version, &versz, lang, &langsz);
2323 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
2324 ok(versz == verchecksz, "Expected %d, got %d\n", verchecksz, versz);
2325 ok(!lstrcmpA(lang, langcheck), "Expected %s, got %s\n", langcheck, lang);
2326 ok(langsz == langchecksz, "Expected %d, got %d\n", langchecksz, langsz);
2327 ok(!lstrcmpA(version, vercheck),
2328 "Expected %s, got %s\n", vercheck, version);
2330 /* only check version */
2332 lstrcpyA(version, "version");
2333 r = MsiGetFileVersionA(path, version, &versz, NULL, NULL);
2334 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
2335 ok(versz == verchecksz, "Expected %d, got %d\n", verchecksz, versz);
2336 ok(!lstrcmpA(version, vercheck),
2337 "Expected %s, got %s\n", vercheck, version);
2339 /* only check language */
2341 lstrcpyA(lang, "lang");
2342 r = MsiGetFileVersionA(path, NULL, NULL, lang, &langsz);
2343 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
2344 ok(!lstrcmpA(lang, langcheck), "Expected %s, got %s\n", langcheck, lang);
2345 ok(langsz == langchecksz, "Expected %d, got %d\n", langchecksz, langsz);
2347 /* get pcchVersionBuf */
2349 r = MsiGetFileVersionA(path, NULL, &versz, NULL, NULL);
2350 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
2351 ok(versz == verchecksz, "Expected %d, got %d\n", verchecksz, versz);
2353 /* get pcchLangBuf */
2355 r = MsiGetFileVersionA(path, NULL, NULL, NULL, &langsz);
2356 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
2357 ok(langsz == langchecksz, "Expected %d, got %d\n", langchecksz, langsz);
2359 /* pcchVersionBuf not big enough */
2361 lstrcpyA(version, "version");
2362 r = MsiGetFileVersionA(path, version, &versz, NULL, NULL);
2363 ok(r == ERROR_MORE_DATA, "Expected ERROR_MORE_DATA, got %d\n", r);
2364 ok(!strncmp(version, vercheck, 4),
2365 "Expected first 4 characters of %s, got %s\n", vercheck, version);
2366 ok(versz == verchecksz, "Expected %d, got %d\n", verchecksz, versz);
2368 /* pcchLangBuf not big enough */
2370 lstrcpyA(lang, "lang");
2371 r = MsiGetFileVersionA(path, NULL, NULL, lang, &langsz);
2372 ok(r == ERROR_MORE_DATA, "Expected ERROR_MORE_DATA, got %d\n", r);
2373 ok(!strncmp(lang, langcheck, 2),
2374 "Expected first character of %s, got %s\n", langcheck, lang);
2375 ok(langsz == langchecksz, "Expected %d, got %d\n", langchecksz, langsz);
2377 HeapFree(GetProcessHeap(), 0, vercheck);
2378 HeapFree(GetProcessHeap(), 0, langcheck);
2381 static void test_MsiGetProductInfo(void)
2385 HKEY propkey, source;
2386 HKEY prodkey, localkey;
2387 CHAR prodcode[MAX_PATH];
2388 CHAR prod_squashed[MAX_PATH];
2389 CHAR packcode[MAX_PATH];
2390 CHAR pack_squashed[MAX_PATH];
2392 CHAR keypath[MAX_PATH];
2396 create_test_guid(prodcode, prod_squashed);
2397 create_test_guid(packcode, pack_squashed);
2398 get_user_sid(&usersid);
2400 /* NULL szProduct */
2402 lstrcpyA(buf, "apple");
2403 r = MsiGetProductInfoA(NULL, INSTALLPROPERTY_HELPLINK, buf, &sz);
2404 ok(r == ERROR_INVALID_PARAMETER,
2405 "Expected ERROR_INVALID_PARAMETER, got %d\n", r);
2406 ok(!lstrcmpA(buf, "apple"), "Expected buf to be unchanged, got %s\n", buf);
2407 ok(sz == MAX_PATH, "Expected MAX_PATH, got %d\n", sz);
2409 /* empty szProduct */
2411 lstrcpyA(buf, "apple");
2412 r = MsiGetProductInfoA("", INSTALLPROPERTY_HELPLINK, buf, &sz);
2413 ok(r == ERROR_INVALID_PARAMETER,
2414 "Expected ERROR_INVALID_PARAMETER, got %d\n", r);
2415 ok(!lstrcmpA(buf, "apple"), "Expected buf to be unchanged, got %s\n", buf);
2416 ok(sz == MAX_PATH, "Expected MAX_PATH, got %d\n", sz);
2418 /* garbage szProduct */
2420 lstrcpyA(buf, "apple");
2421 r = MsiGetProductInfoA("garbage", INSTALLPROPERTY_HELPLINK, buf, &sz);
2422 ok(r == ERROR_INVALID_PARAMETER,
2423 "Expected ERROR_INVALID_PARAMETER, got %d\n", r);
2424 ok(!lstrcmpA(buf, "apple"), "Expected buf to be unchanged, got %s\n", buf);
2425 ok(sz == MAX_PATH, "Expected MAX_PATH, got %d\n", sz);
2427 /* guid without brackets */
2429 lstrcpyA(buf, "apple");
2430 r = MsiGetProductInfoA("6700E8CF-95AB-4D9C-BC2C-15840DEA7A5D",
2431 INSTALLPROPERTY_HELPLINK, buf, &sz);
2432 ok(r == ERROR_INVALID_PARAMETER,
2433 "Expected ERROR_INVALID_PARAMETER, got %d\n", r);
2434 ok(!lstrcmpA(buf, "apple"), "Expected buf to be unchanged, got %s\n", buf);
2435 ok(sz == MAX_PATH, "Expected MAX_PATH, got %d\n", sz);
2437 /* guid with brackets */
2439 lstrcpyA(buf, "apple");
2440 r = MsiGetProductInfoA("{6700E8CF-95AB-4D9C-BC2C-15840DEA7A5D}",
2441 INSTALLPROPERTY_HELPLINK, buf, &sz);
2442 ok(r == ERROR_UNKNOWN_PRODUCT,
2443 "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r);
2444 ok(!lstrcmpA(buf, "apple"), "Expected buf to be unchanged, got %s\n", buf);
2445 ok(sz == MAX_PATH, "Expected MAX_PATH, got %d\n", sz);
2447 /* same length as guid, but random */
2449 lstrcpyA(buf, "apple");
2450 r = MsiGetProductInfoA("A938G02JF-2NF3N93-VN3-2NNF-3KGKALDNF93",
2451 INSTALLPROPERTY_HELPLINK, buf, &sz);
2452 ok(r == ERROR_INVALID_PARAMETER,
2453 "Expected ERROR_INVALID_PARAMETER, got %d\n", r);
2454 ok(!lstrcmpA(buf, "apple"), "Expected buf to be unchanged, got %s\n", buf);
2455 ok(sz == MAX_PATH, "Expected MAX_PATH, got %d\n", sz);
2457 /* not installed, NULL szAttribute */
2459 lstrcpyA(buf, "apple");
2460 r = MsiGetProductInfoA(prodcode, NULL, buf, &sz);
2461 ok(r == ERROR_INVALID_PARAMETER,
2462 "Expected ERROR_INVALID_PARAMETER, got %d\n", r);
2463 ok(!lstrcmpA(buf, "apple"), "Expected buf to be unchanged, got %s\n", buf);
2464 ok(sz == MAX_PATH, "Expected MAX_PATH, got %d\n", sz);
2466 /* not installed, NULL lpValueBuf */
2468 lstrcpyA(buf, "apple");
2469 r = MsiGetProductInfoA(prodcode, INSTALLPROPERTY_HELPLINK, NULL, &sz);
2470 ok(r == ERROR_UNKNOWN_PRODUCT,
2471 "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r);
2472 ok(!lstrcmpA(buf, "apple"), "Expected buf to be unchanged, got %s\n", buf);
2473 ok(sz == MAX_PATH, "Expected MAX_PATH, got %d\n", sz);
2475 /* not installed, NULL pcchValueBuf */
2477 lstrcpyA(buf, "apple");
2478 r = MsiGetProductInfoA(prodcode, INSTALLPROPERTY_HELPLINK, buf, NULL);
2479 ok(r == ERROR_INVALID_PARAMETER,
2480 "Expected ERROR_INVALID_PARAMETER, got %d\n", r);
2481 ok(!lstrcmpA(buf, "apple"), "Expected buf to be unchanged, got %s\n", buf);
2482 ok(sz == MAX_PATH, "Expected MAX_PATH, got %d\n", sz);
2484 /* created guid cannot possibly be an installed product code */
2486 lstrcpyA(buf, "apple");
2487 r = MsiGetProductInfoA(prodcode, INSTALLPROPERTY_HELPLINK, buf, &sz);
2488 ok(r == ERROR_UNKNOWN_PRODUCT,
2489 "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r);
2490 ok(!lstrcmpA(buf, "apple"), "Expected buf to be unchanged, got %s\n", buf);
2491 ok(sz == MAX_PATH, "Expected MAX_PATH, got %d\n", sz);
2493 lstrcpyA(keypath, "Software\\Microsoft\\Windows\\CurrentVersion\\Installer\\Managed\\");
2494 lstrcatA(keypath, usersid);
2495 lstrcatA(keypath, "\\Installer\\Products\\");
2496 lstrcatA(keypath, prod_squashed);
2498 res = RegCreateKeyA(HKEY_LOCAL_MACHINE, keypath, &prodkey);
2499 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
2501 /* managed product code exists */
2503 lstrcpyA(buf, "apple");
2504 r = MsiGetProductInfoA(prodcode, INSTALLPROPERTY_HELPLINK, buf, &sz);
2505 ok(r == ERROR_UNKNOWN_PROPERTY,
2506 "Expected ERROR_UNKNOWN_PROPERTY, got %d\n", r);
2507 ok(!lstrcmpA(buf, "apple"), "Expected buf to be unchanged, got %s\n", buf);
2508 ok(sz == MAX_PATH, "Expected MAX_PATH, got %d\n", sz);
2510 RegDeleteKeyA(prodkey, "");
2511 RegCloseKey(prodkey);
2513 lstrcpyA(keypath, "Software\\Microsoft\\Windows\\CurrentVersion\\Installer\\UserData\\");
2514 lstrcatA(keypath, usersid);
2515 lstrcatA(keypath, "\\Products\\");
2516 lstrcatA(keypath, prod_squashed);
2518 res = RegCreateKeyA(HKEY_LOCAL_MACHINE, keypath, &localkey);
2519 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
2521 /* local user product code exists */
2523 lstrcpyA(buf, "apple");
2524 r = MsiGetProductInfoA(prodcode, INSTALLPROPERTY_HELPLINK, buf, &sz);
2525 ok(r == ERROR_UNKNOWN_PRODUCT,
2526 "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r);
2527 ok(!lstrcmpA(buf, "apple"), "Expected buf to be unchanged, got %s\n", buf);
2528 ok(sz == MAX_PATH, "Expected MAX_PATH, got %d\n", sz);
2530 lstrcpyA(keypath, "Software\\Microsoft\\Windows\\CurrentVersion\\Installer\\Managed\\");
2531 lstrcatA(keypath, usersid);
2532 lstrcatA(keypath, "\\Installer\\Products\\");
2533 lstrcatA(keypath, prod_squashed);
2535 res = RegCreateKeyA(HKEY_LOCAL_MACHINE, keypath, &prodkey);
2536 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
2538 /* both local and managed product code exist */
2540 lstrcpyA(buf, "apple");
2541 r = MsiGetProductInfoA(prodcode, INSTALLPROPERTY_HELPLINK, buf, &sz);
2542 ok(r == ERROR_UNKNOWN_PROPERTY,
2543 "Expected ERROR_UNKNOWN_PROPERTY, got %d\n", r);
2544 ok(!lstrcmpA(buf, "apple"), "Expected buf to be unchanged, got %s\n", buf);
2545 ok(sz == MAX_PATH, "Expected MAX_PATH, got %d\n", sz);
2547 res = RegCreateKeyA(localkey, "InstallProperties", &propkey);
2548 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
2550 /* InstallProperties key exists */
2552 lstrcpyA(buf, "apple");
2553 r = MsiGetProductInfoA(prodcode, INSTALLPROPERTY_HELPLINK, buf, &sz);
2554 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
2555 ok(!lstrcmpA(buf, ""), "Expected \"\", got \"%s\"\n", buf);
2556 ok(sz == 0, "Expected 0, got %d\n", sz);
2558 res = RegSetValueExA(propkey, "HelpLink", 0, REG_SZ, (LPBYTE)"link", 5);
2559 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
2561 /* HelpLink value exists */
2563 lstrcpyA(buf, "apple");
2564 r = MsiGetProductInfoA(prodcode, INSTALLPROPERTY_HELPLINK, buf, &sz);
2565 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
2566 ok(!lstrcmpA(buf, "link"), "Expected \"link\", got \"%s\"\n", buf);
2567 ok(sz == 4, "Expected 4, got %d\n", sz);
2569 /* pcchBuf is NULL */
2570 r = MsiGetProductInfoA(prodcode, INSTALLPROPERTY_HELPLINK, NULL, NULL);
2571 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
2573 /* lpValueBuf is NULL */
2575 r = MsiGetProductInfoA(prodcode, INSTALLPROPERTY_HELPLINK, NULL, &sz);
2576 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
2577 ok(sz == 4, "Expected 4, got %d\n", sz);
2579 /* lpValueBuf is NULL, pcchValueBuf is too small */
2581 r = MsiGetProductInfoA(prodcode, INSTALLPROPERTY_HELPLINK, NULL, &sz);
2582 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
2583 ok(sz == 4, "Expected 4, got %d\n", sz);
2585 /* lpValueBuf is NULL, pcchValueBuf is too small */
2587 lstrcpyA(buf, "apple");
2588 r = MsiGetProductInfoA(prodcode, INSTALLPROPERTY_HELPLINK, buf, &sz);
2589 ok(!lstrcmpA(buf, "apple"), "Expected buf to remain unchanged, got \"%s\"\n", buf);
2590 ok(r == ERROR_MORE_DATA, "Expected ERROR_MORE_DATA, got %d\n", r);
2591 ok(sz == 4, "Expected 4, got %d\n", sz);
2593 /* lpValueBuf is NULL, pcchValueBuf is exactly 4 */
2595 lstrcpyA(buf, "apple");
2596 r = MsiGetProductInfoA(prodcode, INSTALLPROPERTY_HELPLINK, buf, &sz);
2597 ok(r == ERROR_MORE_DATA, "Expected ERROR_MORE_DATA, got %d\n", r);
2598 ok(!lstrcmpA(buf, "apple"),
2599 "Expected buf to remain unchanged, got \"%s\"\n", buf);
2600 ok(sz == 4, "Expected 4, got %d\n", sz);
2602 res = RegSetValueExA(propkey, "IMadeThis", 0, REG_SZ, (LPBYTE)"random", 7);
2603 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
2605 /* random property not supported by MSI, value exists */
2607 lstrcpyA(buf, "apple");
2608 r = MsiGetProductInfoA(prodcode, "IMadeThis", buf, &sz);
2609 ok(r == ERROR_UNKNOWN_PROPERTY,
2610 "Expected ERROR_UNKNOWN_PROPERTY, got %d\n", r);
2611 ok(!lstrcmpA(buf, "apple"), "Expected \"apple\", got \"%s\"\n", buf);
2612 ok(sz == MAX_PATH, "Expected MAX_PATH, got %d\n", sz);
2614 RegDeleteValueA(propkey, "IMadeThis");
2615 RegDeleteValueA(propkey, "HelpLink");
2616 RegDeleteKeyA(propkey, "");
2617 RegDeleteKeyA(localkey, "");
2618 RegDeleteKeyA(prodkey, "");
2619 RegCloseKey(propkey);
2620 RegCloseKey(localkey);
2621 RegCloseKey(prodkey);
2623 lstrcpyA(keypath, "Software\\Microsoft\\Installer\\Products\\");
2624 lstrcatA(keypath, prod_squashed);
2626 res = RegCreateKeyA(HKEY_CURRENT_USER, keypath, &prodkey);
2627 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
2629 /* user product key exists */
2631 lstrcpyA(buf, "apple");
2632 r = MsiGetProductInfoA(prodcode, INSTALLPROPERTY_HELPLINK, buf, &sz);
2633 ok(r == ERROR_UNKNOWN_PROPERTY,
2634 "Expected ERROR_UNKNOWN_PROPERTY, got %d\n", r);
2635 ok(!lstrcmpA(buf, "apple"), "Expected \"apple\", got \"%s\"\n", buf);
2636 ok(sz == MAX_PATH, "Expected MAX_PATH, got %d\n", sz);
2638 lstrcpyA(keypath, "Software\\Microsoft\\Windows\\CurrentVersion\\Installer\\UserData\\");
2639 lstrcatA(keypath, usersid);
2640 lstrcatA(keypath, "\\Products\\");
2641 lstrcatA(keypath, prod_squashed);
2643 res = RegCreateKeyA(HKEY_LOCAL_MACHINE, keypath, &localkey);
2644 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
2646 /* local user product key exists */
2648 lstrcpyA(buf, "apple");
2649 r = MsiGetProductInfoA(prodcode, INSTALLPROPERTY_HELPLINK, buf, &sz);
2650 ok(r == ERROR_UNKNOWN_PROPERTY,
2651 "Expected ERROR_UNKNOWN_PROPERTY, got %d\n", r);
2652 ok(!lstrcmpA(buf, "apple"), "Expected \"apple\", got \"%s\"\n", buf);
2653 ok(sz == MAX_PATH, "Expected MAX_PATH, got %d\n", sz);
2655 res = RegCreateKeyA(localkey, "InstallProperties", &propkey);
2656 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
2658 /* InstallProperties key exists */
2660 lstrcpyA(buf, "apple");
2661 r = MsiGetProductInfoA(prodcode, INSTALLPROPERTY_HELPLINK, buf, &sz);
2662 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
2663 ok(!lstrcmpA(buf, ""), "Expected \"\", got \"%s\"\n", buf);
2664 ok(sz == 0, "Expected 0, got %d\n", sz);
2666 res = RegSetValueExA(propkey, "HelpLink", 0, REG_SZ, (LPBYTE)"link", 5);
2667 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
2669 /* HelpLink value exists */
2671 lstrcpyA(buf, "apple");
2672 r = MsiGetProductInfoA(prodcode, INSTALLPROPERTY_HELPLINK, buf, &sz);
2673 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
2674 ok(!lstrcmpA(buf, "link"), "Expected \"link\", got \"%s\"\n", buf);
2675 ok(sz == 4, "Expected 4, got %d\n", sz);
2677 RegDeleteValueA(propkey, "HelpLink");
2678 RegDeleteKeyA(propkey, "");
2679 RegDeleteKeyA(localkey, "");
2680 RegDeleteKeyA(prodkey, "");
2681 RegCloseKey(propkey);
2682 RegCloseKey(localkey);
2683 RegCloseKey(prodkey);
2685 lstrcpyA(keypath, "Software\\Classes\\Installer\\Products\\");
2686 lstrcatA(keypath, prod_squashed);
2688 res = RegCreateKeyA(HKEY_LOCAL_MACHINE, keypath, &prodkey);
2689 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
2691 /* classes product key exists */
2693 lstrcpyA(buf, "apple");
2694 r = MsiGetProductInfoA(prodcode, INSTALLPROPERTY_HELPLINK, buf, &sz);
2695 ok(r == ERROR_UNKNOWN_PROPERTY,
2696 "Expected ERROR_UNKNOWN_PROPERTY, got %d\n", r);
2697 ok(!lstrcmpA(buf, "apple"), "Expected \"apple\", got \"%s\"\n", buf);
2698 ok(sz == MAX_PATH, "Expected MAX_PATH, got %d\n", sz);
2700 lstrcpyA(keypath, "Software\\Microsoft\\Windows\\CurrentVersion\\Installer\\UserData\\");
2701 lstrcatA(keypath, usersid);
2702 lstrcatA(keypath, "\\Products\\");
2703 lstrcatA(keypath, prod_squashed);
2705 res = RegCreateKeyA(HKEY_LOCAL_MACHINE, keypath, &localkey);
2706 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
2708 /* local user product key exists */
2710 lstrcpyA(buf, "apple");
2711 r = MsiGetProductInfoA(prodcode, INSTALLPROPERTY_HELPLINK, buf, &sz);
2712 ok(r == ERROR_UNKNOWN_PROPERTY,
2713 "Expected ERROR_UNKNOWN_PROPERTY, got %d\n", r);
2714 ok(!lstrcmpA(buf, "apple"), "Expected \"apple\", got \"%s\"\n", buf);
2715 ok(sz == MAX_PATH, "Expected MAX_PATH, got %d\n", sz);
2717 res = RegCreateKeyA(localkey, "InstallProperties", &propkey);
2718 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
2720 /* InstallProperties key exists */
2722 lstrcpyA(buf, "apple");
2723 r = MsiGetProductInfoA(prodcode, INSTALLPROPERTY_HELPLINK, buf, &sz);
2724 ok(r == ERROR_UNKNOWN_PROPERTY,
2725 "Expected ERROR_UNKNOWN_PROPERTY, got %d\n", r);
2726 ok(!lstrcmpA(buf, "apple"), "Expected \"apple\", got \"%s\"\n", buf);
2727 ok(sz == MAX_PATH, "Expected MAX_PATH, got %d\n", sz);
2729 RegDeleteKeyA(propkey, "");
2730 RegDeleteKeyA(localkey, "");
2731 RegCloseKey(propkey);
2732 RegCloseKey(localkey);
2734 lstrcpyA(keypath, "Software\\Microsoft\\Windows\\CurrentVersion\\Installer\\UserData\\");
2735 lstrcatA(keypath, "S-1-5-18\\\\Products\\");
2736 lstrcatA(keypath, prod_squashed);
2738 res = RegCreateKeyA(HKEY_LOCAL_MACHINE, keypath, &localkey);
2739 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
2741 /* Local System product key exists */
2743 lstrcpyA(buf, "apple");
2744 r = MsiGetProductInfoA(prodcode, INSTALLPROPERTY_HELPLINK, buf, &sz);
2745 ok(r == ERROR_UNKNOWN_PROPERTY,
2746 "Expected ERROR_UNKNOWN_PROPERTY, got %d\n", r);
2747 ok(!lstrcmpA(buf, "apple"), "Expected \"apple\", got \"%s\"\n", buf);
2748 ok(sz == MAX_PATH, "Expected MAX_PATH, got %d\n", sz);
2750 res = RegCreateKeyA(localkey, "InstallProperties", &propkey);
2751 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
2753 /* InstallProperties key exists */
2755 lstrcpyA(buf, "apple");
2756 r = MsiGetProductInfoA(prodcode, INSTALLPROPERTY_HELPLINK, buf, &sz);
2757 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
2758 ok(!lstrcmpA(buf, ""), "Expected \"\", got \"%s\"\n", buf);
2759 ok(sz == 0, "Expected 0, got %d\n", sz);
2761 res = RegSetValueExA(propkey, "HelpLink", 0, REG_SZ, (LPBYTE)"link", 5);
2762 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
2764 /* HelpLink value exists */
2766 lstrcpyA(buf, "apple");
2767 r = MsiGetProductInfoA(prodcode, INSTALLPROPERTY_HELPLINK, buf, &sz);
2768 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
2769 ok(!lstrcmpA(buf, "link"), "Expected \"link\", got \"%s\"\n", buf);
2770 ok(sz == 4, "Expected 4, got %d\n", sz);
2772 res = RegSetValueExA(propkey, "HelpLink", 0, REG_DWORD,
2773 (const BYTE *)&val, sizeof(DWORD));
2774 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
2776 /* HelpLink type is REG_DWORD */
2778 lstrcpyA(buf, "apple");
2779 r = MsiGetProductInfoA(prodcode, INSTALLPROPERTY_HELPLINK, buf, &sz);
2780 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
2781 ok(!lstrcmpA(buf, "42"), "Expected \"42\", got \"%s\"\n", buf);
2782 ok(sz == 2, "Expected 2, got %d\n", sz);
2784 res = RegSetValueExA(propkey, "DisplayName", 0, REG_SZ, (LPBYTE)"name", 5);
2785 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
2787 /* DisplayName value exists */
2789 lstrcpyA(buf, "apple");
2790 r = MsiGetProductInfoA(prodcode, INSTALLPROPERTY_INSTALLEDPRODUCTNAME, buf, &sz);
2791 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
2792 ok(!lstrcmpA(buf, "name"), "Expected \"name\", got \"%s\"\n", buf);
2793 ok(sz == 4, "Expected 4, got %d\n", sz);
2795 res = RegSetValueExA(propkey, "DisplayName", 0, REG_DWORD,
2796 (const BYTE *)&val, sizeof(DWORD));
2797 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
2799 /* DisplayName type is REG_DWORD */
2801 lstrcpyA(buf, "apple");
2802 r = MsiGetProductInfoA(prodcode, INSTALLPROPERTY_INSTALLEDPRODUCTNAME, buf, &sz);
2803 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
2804 ok(!lstrcmpA(buf, "42"), "Expected \"42\", got \"%s\"\n", buf);
2805 ok(sz == 2, "Expected 2, got %d\n", sz);
2807 res = RegSetValueExA(propkey, "DisplayVersion", 0, REG_SZ, (LPBYTE)"1.1.1", 6);
2808 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
2810 /* DisplayVersion value exists */
2812 lstrcpyA(buf, "apple");
2813 r = MsiGetProductInfoA(prodcode, INSTALLPROPERTY_VERSIONSTRING, buf, &sz);
2814 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
2815 ok(!lstrcmpA(buf, "1.1.1"), "Expected \"1.1.1\", got \"%s\"\n", buf);
2816 ok(sz == 5, "Expected 5, got %d\n", sz);
2818 res = RegSetValueExA(propkey, "DisplayVersion", 0,
2819 REG_DWORD, (const BYTE *)&val, sizeof(DWORD));
2820 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
2822 /* DisplayVersion type is REG_DWORD */
2824 lstrcpyA(buf, "apple");
2825 r = MsiGetProductInfoA(prodcode, INSTALLPROPERTY_VERSIONSTRING, buf, &sz);
2826 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
2827 ok(!lstrcmpA(buf, "42"), "Expected \"42\", got \"%s\"\n", buf);
2828 ok(sz == 2, "Expected 2, got %d\n", sz);
2830 res = RegSetValueExA(propkey, "HelpTelephone", 0, REG_SZ, (LPBYTE)"tele", 5);
2831 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
2833 /* HelpTelephone value exists */
2835 lstrcpyA(buf, "apple");
2836 r = MsiGetProductInfoA(prodcode, INSTALLPROPERTY_HELPTELEPHONE, buf, &sz);
2837 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
2838 ok(!lstrcmpA(buf, "tele"), "Expected \"tele\", got \"%s\"\n", buf);
2839 ok(sz == 4, "Expected 4, got %d\n", sz);
2841 res = RegSetValueExA(propkey, "HelpTelephone", 0, REG_DWORD,
2842 (const BYTE *)&val, sizeof(DWORD));
2843 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
2845 /* HelpTelephone type is REG_DWORD */
2847 lstrcpyA(buf, "apple");
2848 r = MsiGetProductInfoA(prodcode, INSTALLPROPERTY_HELPTELEPHONE, buf, &sz);
2849 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
2850 ok(!lstrcmpA(buf, "42"), "Expected \"42\", got \"%s\"\n", buf);
2851 ok(sz == 2, "Expected 2, got %d\n", sz);
2853 res = RegSetValueExA(propkey, "InstallLocation", 0, REG_SZ, (LPBYTE)"loc", 4);
2854 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
2856 /* InstallLocation value exists */
2858 lstrcpyA(buf, "apple");
2859 r = MsiGetProductInfoA(prodcode, INSTALLPROPERTY_INSTALLLOCATION, buf, &sz);
2860 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
2861 ok(!lstrcmpA(buf, "loc"), "Expected \"loc\", got \"%s\"\n", buf);
2862 ok(sz == 3, "Expected 3, got %d\n", sz);
2864 res = RegSetValueExA(propkey, "InstallLocation", 0, REG_DWORD,
2865 (const BYTE *)&val, sizeof(DWORD));
2866 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
2868 /* InstallLocation type is REG_DWORD */
2870 lstrcpyA(buf, "apple");
2871 r = MsiGetProductInfoA(prodcode, INSTALLPROPERTY_INSTALLLOCATION, buf, &sz);
2872 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
2873 ok(!lstrcmpA(buf, "42"), "Expected \"42\", got \"%s\"\n", buf);
2874 ok(sz == 2, "Expected 2, got %d\n", sz);
2876 res = RegSetValueExA(propkey, "InstallSource", 0, REG_SZ, (LPBYTE)"source", 7);
2877 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
2879 /* InstallSource value exists */
2881 lstrcpyA(buf, "apple");
2882 r = MsiGetProductInfoA(prodcode, INSTALLPROPERTY_INSTALLSOURCE, buf, &sz);
2883 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
2884 ok(!lstrcmpA(buf, "source"), "Expected \"source\", got \"%s\"\n", buf);
2885 ok(sz == 6, "Expected 6, got %d\n", sz);
2887 res = RegSetValueExA(propkey, "InstallSource", 0, REG_DWORD,
2888 (const BYTE *)&val, sizeof(DWORD));
2889 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
2891 /* InstallSource type is REG_DWORD */
2893 lstrcpyA(buf, "apple");
2894 r = MsiGetProductInfoA(prodcode, INSTALLPROPERTY_INSTALLSOURCE, buf, &sz);
2895 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
2896 ok(!lstrcmpA(buf, "42"), "Expected \"42\", got \"%s\"\n", buf);
2897 ok(sz == 2, "Expected 2, got %d\n", sz);
2899 res = RegSetValueExA(propkey, "InstallDate", 0, REG_SZ, (LPBYTE)"date", 5);
2900 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
2902 /* InstallDate value exists */
2904 lstrcpyA(buf, "apple");
2905 r = MsiGetProductInfoA(prodcode, INSTALLPROPERTY_INSTALLDATE, buf, &sz);
2906 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
2907 ok(!lstrcmpA(buf, "date"), "Expected \"date\", got \"%s\"\n", buf);
2908 ok(sz == 4, "Expected 4, got %d\n", sz);
2910 res = RegSetValueExA(propkey, "InstallDate", 0, REG_DWORD,
2911 (const BYTE *)&val, sizeof(DWORD));
2912 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
2914 /* InstallDate type is REG_DWORD */
2916 lstrcpyA(buf, "apple");
2917 r = MsiGetProductInfoA(prodcode, INSTALLPROPERTY_INSTALLDATE, buf, &sz);
2918 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
2919 ok(!lstrcmpA(buf, "42"), "Expected \"42\", got \"%s\"\n", buf);
2920 ok(sz == 2, "Expected 2, got %d\n", sz);
2922 res = RegSetValueExA(propkey, "Publisher", 0, REG_SZ, (LPBYTE)"pub", 4);
2923 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
2925 /* Publisher value exists */
2927 lstrcpyA(buf, "apple");
2928 r = MsiGetProductInfoA(prodcode, INSTALLPROPERTY_PUBLISHER, buf, &sz);
2929 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
2930 ok(!lstrcmpA(buf, "pub"), "Expected \"pub\", got \"%s\"\n", buf);
2931 ok(sz == 3, "Expected 3, got %d\n", sz);
2933 res = RegSetValueExA(propkey, "Publisher", 0, REG_DWORD,
2934 (const BYTE *)&val, sizeof(DWORD));
2935 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
2937 /* Publisher type is REG_DWORD */
2939 lstrcpyA(buf, "apple");
2940 r = MsiGetProductInfoA(prodcode, INSTALLPROPERTY_PUBLISHER, buf, &sz);
2941 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
2942 ok(!lstrcmpA(buf, "42"), "Expected \"42\", got \"%s\"\n", buf);
2943 ok(sz == 2, "Expected 2, got %d\n", sz);
2945 res = RegSetValueExA(propkey, "LocalPackage", 0, REG_SZ, (LPBYTE)"pack", 5);
2946 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
2948 /* LocalPackage value exists */
2950 lstrcpyA(buf, "apple");
2951 r = MsiGetProductInfoA(prodcode, INSTALLPROPERTY_LOCALPACKAGE, buf, &sz);
2952 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
2953 ok(!lstrcmpA(buf, "pack"), "Expected \"pack\", got \"%s\"\n", buf);
2954 ok(sz == 4, "Expected 4, got %d\n", sz);
2956 res = RegSetValueExA(propkey, "LocalPackage", 0, REG_DWORD,
2957 (const BYTE *)&val, sizeof(DWORD));
2958 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
2960 /* LocalPackage type is REG_DWORD */
2962 lstrcpyA(buf, "apple");
2963 r = MsiGetProductInfoA(prodcode, INSTALLPROPERTY_LOCALPACKAGE, buf, &sz);
2964 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
2965 ok(!lstrcmpA(buf, "42"), "Expected \"42\", got \"%s\"\n", buf);
2966 ok(sz == 2, "Expected 2, got %d\n", sz);
2968 res = RegSetValueExA(propkey, "UrlInfoAbout", 0, REG_SZ, (LPBYTE)"about", 6);
2969 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
2971 /* UrlInfoAbout value exists */
2973 lstrcpyA(buf, "apple");
2974 r = MsiGetProductInfoA(prodcode, INSTALLPROPERTY_URLINFOABOUT, buf, &sz);
2975 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
2976 ok(!lstrcmpA(buf, "about"), "Expected \"about\", got \"%s\"\n", buf);
2977 ok(sz == 5, "Expected 5, got %d\n", sz);
2979 res = RegSetValueExA(propkey, "UrlInfoAbout", 0, REG_DWORD,
2980 (const BYTE *)&val, sizeof(DWORD));
2981 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
2983 /* UrlInfoAbout type is REG_DWORD */
2985 lstrcpyA(buf, "apple");
2986 r = MsiGetProductInfoA(prodcode, INSTALLPROPERTY_URLINFOABOUT, buf, &sz);
2987 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
2988 ok(!lstrcmpA(buf, "42"), "Expected \"42\", got \"%s\"\n", buf);
2989 ok(sz == 2, "Expected 2, got %d\n", sz);
2991 res = RegSetValueExA(propkey, "UrlUpdateInfo", 0, REG_SZ, (LPBYTE)"info", 5);
2992 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
2994 /* UrlUpdateInfo value exists */
2996 lstrcpyA(buf, "apple");
2997 r = MsiGetProductInfoA(prodcode, INSTALLPROPERTY_URLUPDATEINFO, buf, &sz);
2998 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
2999 ok(!lstrcmpA(buf, "info"), "Expected \"info\", got \"%s\"\n", buf);
3000 ok(sz == 4, "Expected 4, got %d\n", sz);
3002 res = RegSetValueExA(propkey, "UrlUpdateInfo", 0, REG_DWORD,
3003 (const BYTE *)&val, sizeof(DWORD));
3004 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
3006 /* UrlUpdateInfo type is REG_DWORD */
3008 lstrcpyA(buf, "apple");
3009 r = MsiGetProductInfoA(prodcode, INSTALLPROPERTY_URLUPDATEINFO, buf, &sz);
3010 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
3011 ok(!lstrcmpA(buf, "42"), "Expected \"42\", got \"%s\"\n", buf);
3012 ok(sz == 2, "Expected 2, got %d\n", sz);
3014 res = RegSetValueExA(propkey, "VersionMinor", 0, REG_SZ, (LPBYTE)"1", 2);
3015 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
3017 /* VersionMinor value exists */
3019 lstrcpyA(buf, "apple");
3020 r = MsiGetProductInfoA(prodcode, INSTALLPROPERTY_VERSIONMINOR, buf, &sz);
3021 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
3022 ok(!lstrcmpA(buf, "1"), "Expected \"1\", got \"%s\"\n", buf);
3023 ok(sz == 1, "Expected 1, got %d\n", sz);
3025 res = RegSetValueExA(propkey, "VersionMinor", 0, REG_DWORD,
3026 (const BYTE *)&val, sizeof(DWORD));
3027 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
3029 /* VersionMinor type is REG_DWORD */
3031 lstrcpyA(buf, "apple");
3032 r = MsiGetProductInfoA(prodcode, INSTALLPROPERTY_VERSIONMINOR, buf, &sz);
3033 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
3034 ok(!lstrcmpA(buf, "42"), "Expected \"42\", got \"%s\"\n", buf);
3035 ok(sz == 2, "Expected 2, got %d\n", sz);
3037 res = RegSetValueExA(propkey, "VersionMajor", 0, REG_SZ, (LPBYTE)"1", 2);
3038 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
3040 /* VersionMajor value exists */
3042 lstrcpyA(buf, "apple");
3043 r = MsiGetProductInfoA(prodcode, INSTALLPROPERTY_VERSIONMAJOR, buf, &sz);
3044 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
3045 ok(!lstrcmpA(buf, "1"), "Expected \"1\", got \"%s\"\n", buf);
3046 ok(sz == 1, "Expected 1, got %d\n", sz);
3048 res = RegSetValueExA(propkey, "VersionMajor", 0, REG_DWORD,
3049 (const BYTE *)&val, sizeof(DWORD));
3050 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
3052 /* VersionMajor type is REG_DWORD */
3054 lstrcpyA(buf, "apple");
3055 r = MsiGetProductInfoA(prodcode, INSTALLPROPERTY_VERSIONMAJOR, buf, &sz);
3056 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
3057 ok(!lstrcmpA(buf, "42"), "Expected \"42\", got \"%s\"\n", buf);
3058 ok(sz == 2, "Expected 2, got %d\n", sz);
3060 res = RegSetValueExA(propkey, "ProductID", 0, REG_SZ, (LPBYTE)"id", 3);
3061 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
3063 /* ProductID value exists */
3065 lstrcpyA(buf, "apple");
3066 r = MsiGetProductInfoA(prodcode, INSTALLPROPERTY_PRODUCTID, buf, &sz);
3067 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
3068 ok(!lstrcmpA(buf, "id"), "Expected \"id\", got \"%s\"\n", buf);
3069 ok(sz == 2, "Expected 2, got %d\n", sz);
3071 res = RegSetValueExA(propkey, "ProductID", 0, REG_DWORD,
3072 (const BYTE *)&val, sizeof(DWORD));
3073 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
3075 /* ProductID type is REG_DWORD */
3077 lstrcpyA(buf, "apple");
3078 r = MsiGetProductInfoA(prodcode, INSTALLPROPERTY_PRODUCTID, buf, &sz);
3079 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
3080 ok(!lstrcmpA(buf, "42"), "Expected \"42\", got \"%s\"\n", buf);
3081 ok(sz == 2, "Expected 2, got %d\n", sz);
3083 res = RegSetValueExA(propkey, "RegCompany", 0, REG_SZ, (LPBYTE)"comp", 5);
3084 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
3086 /* RegCompany value exists */
3088 lstrcpyA(buf, "apple");
3089 r = MsiGetProductInfoA(prodcode, INSTALLPROPERTY_REGCOMPANY, buf, &sz);
3090 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
3091 ok(!lstrcmpA(buf, "comp"), "Expected \"comp\", got \"%s\"\n", buf);
3092 ok(sz == 4, "Expected 4, got %d\n", sz);
3094 res = RegSetValueExA(propkey, "RegCompany", 0, REG_DWORD,
3095 (const BYTE *)&val, sizeof(DWORD));
3096 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
3098 /* RegCompany type is REG_DWORD */
3100 lstrcpyA(buf, "apple");
3101 r = MsiGetProductInfoA(prodcode, INSTALLPROPERTY_REGCOMPANY, buf, &sz);
3102 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
3103 ok(!lstrcmpA(buf, "42"), "Expected \"42\", got \"%s\"\n", buf);
3104 ok(sz == 2, "Expected 2, got %d\n", sz);
3106 res = RegSetValueExA(propkey, "RegOwner", 0, REG_SZ, (LPBYTE)"own", 4);
3107 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
3109 /* RegOwner value exists */
3111 lstrcpyA(buf, "apple");
3112 r = MsiGetProductInfoA(prodcode, INSTALLPROPERTY_REGOWNER, buf, &sz);
3113 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
3114 ok(!lstrcmpA(buf, "own"), "Expected \"own\", got \"%s\"\n", buf);
3115 ok(sz == 3, "Expected 3, got %d\n", sz);
3117 res = RegSetValueExA(propkey, "RegOwner", 0, REG_DWORD,
3118 (const BYTE *)&val, sizeof(DWORD));
3119 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
3121 /* RegOwner type is REG_DWORD */
3123 lstrcpyA(buf, "apple");
3124 r = MsiGetProductInfoA(prodcode, INSTALLPROPERTY_REGOWNER, buf, &sz);
3125 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
3126 ok(!lstrcmpA(buf, "42"), "Expected \"42\", got \"%s\"\n", buf);
3127 ok(sz == 2, "Expected 2, got %d\n", sz);
3129 res = RegSetValueExA(propkey, "InstanceType", 0, REG_SZ, (LPBYTE)"type", 5);
3130 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
3132 /* InstanceType value exists */
3134 lstrcpyA(buf, "apple");
3135 r = MsiGetProductInfoA(prodcode, INSTALLPROPERTY_INSTANCETYPE, buf, &sz);
3136 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
3137 ok(!lstrcmpA(buf, ""), "Expected \"\", got \"%s\"\n", buf);
3138 ok(sz == 0, "Expected 0, got %d\n", sz);
3140 res = RegSetValueExA(propkey, "InstanceType", 0, REG_DWORD,
3141 (const BYTE *)&val, sizeof(DWORD));
3142 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
3144 /* InstanceType type is REG_DWORD */
3146 lstrcpyA(buf, "apple");
3147 r = MsiGetProductInfoA(prodcode, INSTALLPROPERTY_INSTANCETYPE, buf, &sz);
3148 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
3149 ok(!lstrcmpA(buf, ""), "Expected \"\", got \"%s\"\n", buf);
3150 ok(sz == 0, "Expected 0, got %d\n", sz);
3152 res = RegSetValueExA(prodkey, "InstanceType", 0, REG_SZ, (LPBYTE)"type", 5);
3153 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
3155 /* InstanceType value exists */
3157 lstrcpyA(buf, "apple");
3158 r = MsiGetProductInfoA(prodcode, INSTALLPROPERTY_INSTANCETYPE, buf, &sz);
3159 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
3160 ok(!lstrcmpA(buf, "type"), "Expected \"type\", got \"%s\"\n", buf);
3161 ok(sz == 4, "Expected 4, got %d\n", sz);
3163 res = RegSetValueExA(prodkey, "InstanceType", 0, REG_DWORD,
3164 (const BYTE *)&val, sizeof(DWORD));
3165 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
3167 /* InstanceType type is REG_DWORD */
3169 lstrcpyA(buf, "apple");
3170 r = MsiGetProductInfoA(prodcode, INSTALLPROPERTY_INSTANCETYPE, buf, &sz);
3171 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
3172 ok(!lstrcmpA(buf, "42"), "Expected \"42\", got \"%s\"\n", buf);
3173 ok(sz == 2, "Expected 2, got %d\n", sz);
3175 res = RegSetValueExA(propkey, "Transforms", 0, REG_SZ, (LPBYTE)"tforms", 7);
3176 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
3178 /* Transforms value exists */
3180 lstrcpyA(buf, "apple");
3181 r = MsiGetProductInfoA(prodcode, INSTALLPROPERTY_TRANSFORMS, buf, &sz);
3182 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
3183 ok(!lstrcmpA(buf, ""), "Expected \"\", got \"%s\"\n", buf);
3184 ok(sz == 0, "Expected 0, got %d\n", sz);
3186 res = RegSetValueExA(propkey, "Transforms", 0, REG_DWORD,
3187 (const BYTE *)&val, sizeof(DWORD));
3188 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
3190 /* Transforms type is REG_DWORD */
3192 lstrcpyA(buf, "apple");
3193 r = MsiGetProductInfoA(prodcode, INSTALLPROPERTY_TRANSFORMS, buf, &sz);
3194 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
3195 ok(!lstrcmpA(buf, ""), "Expected \"\", got \"%s\"\n", buf);
3196 ok(sz == 0, "Expected 0, got %d\n", sz);
3198 res = RegSetValueExA(prodkey, "Transforms", 0, REG_SZ, (LPBYTE)"tforms", 7);
3199 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
3201 /* Transforms value exists */
3203 lstrcpyA(buf, "apple");
3204 r = MsiGetProductInfoA(prodcode, INSTALLPROPERTY_TRANSFORMS, buf, &sz);
3205 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
3206 ok(!lstrcmpA(buf, "tforms"), "Expected \"tforms\", got \"%s\"\n", buf);
3207 ok(sz == 6, "Expected 6, got %d\n", sz);
3209 res = RegSetValueExA(prodkey, "Transforms", 0, REG_DWORD,
3210 (const BYTE *)&val, sizeof(DWORD));
3211 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
3213 /* Transforms type is REG_DWORD */
3215 lstrcpyA(buf, "apple");
3216 r = MsiGetProductInfoA(prodcode, INSTALLPROPERTY_TRANSFORMS, buf, &sz);
3217 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
3218 ok(!lstrcmpA(buf, "42"), "Expected \"42\", got \"%s\"\n", buf);
3219 ok(sz == 2, "Expected 2, got %d\n", sz);
3221 res = RegSetValueExA(propkey, "Language", 0, REG_SZ, (LPBYTE)"lang", 5);
3222 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
3224 /* Language value exists */
3226 lstrcpyA(buf, "apple");
3227 r = MsiGetProductInfoA(prodcode, INSTALLPROPERTY_LANGUAGE, buf, &sz);
3228 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
3229 ok(!lstrcmpA(buf, ""), "Expected \"\", got \"%s\"\n", buf);
3230 ok(sz == 0, "Expected 0, got %d\n", sz);
3232 res = RegSetValueExA(propkey, "Language", 0, REG_DWORD,
3233 (const BYTE *)&val, sizeof(DWORD));
3234 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
3236 /* Language type is REG_DWORD */
3238 lstrcpyA(buf, "apple");
3239 r = MsiGetProductInfoA(prodcode, INSTALLPROPERTY_LANGUAGE, buf, &sz);
3240 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
3241 ok(!lstrcmpA(buf, ""), "Expected \"\", got \"%s\"\n", buf);
3242 ok(sz == 0, "Expected 0, got %d\n", sz);
3244 res = RegSetValueExA(prodkey, "Language", 0, REG_SZ, (LPBYTE)"lang", 5);
3245 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
3247 /* Language value exists */
3249 lstrcpyA(buf, "apple");
3250 r = MsiGetProductInfoA(prodcode, INSTALLPROPERTY_LANGUAGE, buf, &sz);
3251 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
3252 ok(!lstrcmpA(buf, "lang"), "Expected \"lang\", got \"%s\"\n", buf);
3253 ok(sz == 4, "Expected 4, got %d\n", sz);
3255 res = RegSetValueExA(prodkey, "Language", 0, REG_DWORD,
3256 (const BYTE *)&val, sizeof(DWORD));
3257 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
3259 /* Language type is REG_DWORD */
3261 lstrcpyA(buf, "apple");
3262 r = MsiGetProductInfoA(prodcode, INSTALLPROPERTY_LANGUAGE, buf, &sz);
3263 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
3264 ok(!lstrcmpA(buf, "42"), "Expected \"42\", got \"%s\"\n", buf);
3265 ok(sz == 2, "Expected 2, got %d\n", sz);
3267 res = RegSetValueExA(propkey, "ProductName", 0, REG_SZ, (LPBYTE)"name", 5);
3268 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
3270 /* ProductName value exists */
3272 lstrcpyA(buf, "apple");
3273 r = MsiGetProductInfoA(prodcode, INSTALLPROPERTY_PRODUCTNAME, buf, &sz);
3274 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
3275 ok(!lstrcmpA(buf, ""), "Expected \"\", got \"%s\"\n", buf);
3276 ok(sz == 0, "Expected 0, got %d\n", sz);
3278 res = RegSetValueExA(propkey, "ProductName", 0, REG_DWORD,
3279 (const BYTE *)&val, sizeof(DWORD));
3280 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
3282 /* ProductName type is REG_DWORD */
3284 lstrcpyA(buf, "apple");
3285 r = MsiGetProductInfoA(prodcode, INSTALLPROPERTY_PRODUCTNAME, buf, &sz);
3286 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
3287 ok(!lstrcmpA(buf, ""), "Expected \"\", got \"%s\"\n", buf);
3288 ok(sz == 0, "Expected 0, got %d\n", sz);
3290 res = RegSetValueExA(prodkey, "ProductName", 0, REG_SZ, (LPBYTE)"name", 5);
3291 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
3293 /* ProductName value exists */
3295 lstrcpyA(buf, "apple");
3296 r = MsiGetProductInfoA(prodcode, INSTALLPROPERTY_PRODUCTNAME, buf, &sz);
3297 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
3298 ok(!lstrcmpA(buf, "name"), "Expected \"name\", got \"%s\"\n", buf);
3299 ok(sz == 4, "Expected 4, got %d\n", sz);
3301 res = RegSetValueExA(prodkey, "ProductName", 0, REG_DWORD,
3302 (const BYTE *)&val, sizeof(DWORD));
3303 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
3305 /* ProductName type is REG_DWORD */
3307 lstrcpyA(buf, "apple");
3308 r = MsiGetProductInfoA(prodcode, INSTALLPROPERTY_PRODUCTNAME, buf, &sz);
3309 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
3310 ok(!lstrcmpA(buf, "42"), "Expected \"42\", got \"%s\"\n", buf);
3311 ok(sz == 2, "Expected 2, got %d\n", sz);
3313 res = RegSetValueExA(propkey, "Assignment", 0, REG_SZ, (LPBYTE)"at", 3);
3314 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
3316 /* Assignment value exists */
3318 lstrcpyA(buf, "apple");
3319 r = MsiGetProductInfoA(prodcode, INSTALLPROPERTY_ASSIGNMENTTYPE, buf, &sz);
3320 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
3321 ok(!lstrcmpA(buf, ""), "Expected \"\", got \"%s\"\n", buf);
3322 ok(sz == 0, "Expected 0, got %d\n", sz);
3324 res = RegSetValueExA(propkey, "Assignment", 0, REG_DWORD,
3325 (const BYTE *)&val, sizeof(DWORD));
3326 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
3328 /* Assignment type is REG_DWORD */
3330 lstrcpyA(buf, "apple");
3331 r = MsiGetProductInfoA(prodcode, INSTALLPROPERTY_ASSIGNMENTTYPE, buf, &sz);
3332 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
3333 ok(!lstrcmpA(buf, ""), "Expected \"\", got \"%s\"\n", buf);
3334 ok(sz == 0, "Expected 0, got %d\n", sz);
3336 res = RegSetValueExA(prodkey, "Assignment", 0, REG_SZ, (LPBYTE)"at", 3);
3337 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
3339 /* Assignment value exists */
3341 lstrcpyA(buf, "apple");
3342 r = MsiGetProductInfoA(prodcode, INSTALLPROPERTY_ASSIGNMENTTYPE, buf, &sz);
3343 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
3344 ok(!lstrcmpA(buf, "at"), "Expected \"at\", got \"%s\"\n", buf);
3345 ok(sz == 2, "Expected 2, got %d\n", sz);
3347 res = RegSetValueExA(prodkey, "Assignment", 0, REG_DWORD,
3348 (const BYTE *)&val, sizeof(DWORD));
3349 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
3351 /* Assignment type is REG_DWORD */
3353 lstrcpyA(buf, "apple");
3354 r = MsiGetProductInfoA(prodcode, INSTALLPROPERTY_ASSIGNMENTTYPE, buf, &sz);
3355 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
3356 ok(!lstrcmpA(buf, "42"), "Expected \"42\", got \"%s\"\n", buf);
3357 ok(sz == 2, "Expected 2, got %d\n", sz);
3359 res = RegSetValueExA(propkey, "PackageCode", 0, REG_SZ, (LPBYTE)"code", 5);
3360 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
3362 /* PackageCode value exists */
3364 lstrcpyA(buf, "apple");
3365 r = MsiGetProductInfoA(prodcode, INSTALLPROPERTY_PACKAGECODE, buf, &sz);
3366 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
3367 ok(!lstrcmpA(buf, ""), "Expected \"\", got \"%s\"\n", buf);
3368 ok(sz == 0, "Expected 0, got %d\n", sz);
3370 res = RegSetValueExA(propkey, "PackageCode", 0, REG_DWORD,
3371 (const BYTE *)&val, sizeof(DWORD));
3372 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
3374 /* PackageCode type is REG_DWORD */
3376 lstrcpyA(buf, "apple");
3377 r = MsiGetProductInfoA(prodcode, INSTALLPROPERTY_PACKAGECODE, buf, &sz);
3378 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
3379 ok(!lstrcmpA(buf, ""), "Expected \"\", got \"%s\"\n", buf);
3380 ok(sz == 0, "Expected 0, got %d\n", sz);
3382 res = RegSetValueExA(prodkey, "PackageCode", 0, REG_SZ, (LPBYTE)"code", 5);
3383 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
3385 /* PackageCode value exists */
3387 lstrcpyA(buf, "apple");
3388 r = MsiGetProductInfoA(prodcode, INSTALLPROPERTY_PACKAGECODE, buf, &sz);
3389 ok(r == ERROR_BAD_CONFIGURATION,
3390 "Expected ERROR_BAD_CONFIGURATION, got %d\n", r);
3391 ok(!lstrcmpA(buf, "code"), "Expected \"code\", got \"%s\"\n", buf);
3392 ok(sz == MAX_PATH, "Expected MAX_PATH, got %d\n", sz);
3394 res = RegSetValueExA(prodkey, "PackageCode", 0, REG_DWORD,
3395 (const BYTE *)&val, sizeof(DWORD));
3396 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
3398 /* PackageCode type is REG_DWORD */
3400 lstrcpyA(buf, "apple");
3401 r = MsiGetProductInfoA(prodcode, INSTALLPROPERTY_PACKAGECODE, buf, &sz);
3402 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
3403 ok(!lstrcmpA(buf, "42"), "Expected \"42\", got \"%s\"\n", buf);
3404 ok(sz == 2, "Expected 2, got %d\n", sz);
3406 res = RegSetValueExA(prodkey, "PackageCode", 0, REG_SZ, (LPBYTE)pack_squashed, 33);
3407 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
3409 /* PackageCode value exists */
3411 lstrcpyA(buf, "apple");
3412 r = MsiGetProductInfoA(prodcode, INSTALLPROPERTY_PACKAGECODE, buf, &sz);
3413 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
3414 ok(!lstrcmpA(buf, packcode), "Expected \"%s\", got \"%s\"\n", packcode, buf);
3415 ok(sz == 38, "Expected 38, got %d\n", sz);
3417 res = RegSetValueExA(propkey, "Version", 0, REG_SZ, (LPBYTE)"ver", 4);
3418 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
3420 /* Version value exists */
3422 lstrcpyA(buf, "apple");
3423 r = MsiGetProductInfoA(prodcode, INSTALLPROPERTY_VERSION, buf, &sz);
3424 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
3425 ok(!lstrcmpA(buf, ""), "Expected \"\", got \"%s\"\n", buf);
3426 ok(sz == 0, "Expected 0, got %d\n", sz);
3428 res = RegSetValueExA(propkey, "Version", 0, REG_DWORD,
3429 (const BYTE *)&val, sizeof(DWORD));
3430 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
3432 /* Version type is REG_DWORD */
3434 lstrcpyA(buf, "apple");
3435 r = MsiGetProductInfoA(prodcode, INSTALLPROPERTY_VERSION, buf, &sz);
3436 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
3437 ok(!lstrcmpA(buf, ""), "Expected \"\", got \"%s\"\n", buf);
3438 ok(sz == 0, "Expected 0, got %d\n", sz);
3440 res = RegSetValueExA(prodkey, "Version", 0, REG_SZ, (LPBYTE)"ver", 4);
3441 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
3443 /* Version value exists */
3445 lstrcpyA(buf, "apple");
3446 r = MsiGetProductInfoA(prodcode, INSTALLPROPERTY_VERSION, buf, &sz);
3447 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
3448 ok(!lstrcmpA(buf, "ver"), "Expected \"ver\", got \"%s\"\n", buf);
3449 ok(sz == 3, "Expected 3, got %d\n", sz);
3451 res = RegSetValueExA(prodkey, "Version", 0, REG_DWORD,
3452 (const BYTE *)&val, sizeof(DWORD));
3453 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
3455 /* Version type is REG_DWORD */
3457 lstrcpyA(buf, "apple");
3458 r = MsiGetProductInfoA(prodcode, INSTALLPROPERTY_VERSION, buf, &sz);
3459 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
3460 ok(!lstrcmpA(buf, "42"), "Expected \"42\", got \"%s\"\n", buf);
3461 ok(sz == 2, "Expected 2, got %d\n", sz);
3463 res = RegSetValueExA(propkey, "ProductIcon", 0, REG_SZ, (LPBYTE)"ico", 4);
3464 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
3466 /* ProductIcon value exists */
3468 lstrcpyA(buf, "apple");
3469 r = MsiGetProductInfoA(prodcode, INSTALLPROPERTY_PRODUCTICON, buf, &sz);
3470 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
3471 ok(!lstrcmpA(buf, ""), "Expected \"\", got \"%s\"\n", buf);
3472 ok(sz == 0, "Expected 0, got %d\n", sz);
3474 res = RegSetValueExA(propkey, "ProductIcon", 0, REG_DWORD,
3475 (const BYTE *)&val, sizeof(DWORD));
3476 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
3478 /* ProductIcon type is REG_DWORD */
3480 lstrcpyA(buf, "apple");
3481 r = MsiGetProductInfoA(prodcode, INSTALLPROPERTY_PRODUCTICON, buf, &sz);
3482 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
3483 ok(!lstrcmpA(buf, ""), "Expected \"\", got \"%s\"\n", buf);
3484 ok(sz == 0, "Expected 0, got %d\n", sz);
3486 res = RegSetValueExA(prodkey, "ProductIcon", 0, REG_SZ, (LPBYTE)"ico", 4);
3487 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
3489 /* ProductIcon value exists */
3491 lstrcpyA(buf, "apple");
3492 r = MsiGetProductInfoA(prodcode, INSTALLPROPERTY_PRODUCTICON, buf, &sz);
3493 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
3494 ok(!lstrcmpA(buf, "ico"), "Expected \"ico\", got \"%s\"\n", buf);
3495 ok(sz == 3, "Expected 3, got %d\n", sz);
3497 res = RegSetValueExA(prodkey, "ProductIcon", 0, REG_DWORD,
3498 (const BYTE *)&val, sizeof(DWORD));
3499 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
3501 /* ProductIcon type is REG_DWORD */
3503 lstrcpyA(buf, "apple");
3504 r = MsiGetProductInfoA(prodcode, INSTALLPROPERTY_PRODUCTICON, buf, &sz);
3505 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
3506 ok(!lstrcmpA(buf, "42"), "Expected \"42\", got \"%s\"\n", buf);
3507 ok(sz == 2, "Expected 2, got %d\n", sz);
3509 res = RegCreateKeyA(prodkey, "SourceList", &source);
3510 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
3512 res = RegSetValueExA(source, "PackageName", 0, REG_SZ, (LPBYTE)"packname", 9);
3513 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
3516 lstrcpyA(buf, "apple");
3517 r = MsiGetProductInfoA(prodcode, INSTALLPROPERTY_PACKAGENAME, buf, &sz);
3518 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
3519 ok(!lstrcmpA(buf, "packname"), "Expected \"packname\", got \"%s\"\n", buf);
3520 ok(sz == 8, "Expected 8, got %d\n", sz);
3522 res = RegSetValueExA(source, "PackageName", 0, REG_DWORD,
3523 (const BYTE *)&val, sizeof(DWORD));
3524 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
3526 /* PackageName type is REG_DWORD */
3528 lstrcpyA(buf, "apple");
3529 r = MsiGetProductInfoA(prodcode, INSTALLPROPERTY_PACKAGENAME, buf, &sz);
3530 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
3531 ok(!lstrcmpA(buf, "42"), "Expected \"42\", got \"%s\"\n", buf);
3532 ok(sz == 2, "Expected 2, got %d\n", sz);
3534 res = RegSetValueExA(propkey, "AuthorizedLUAApp", 0, REG_SZ, (LPBYTE)"auth", 5);
3535 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
3537 /* Authorized value exists */
3539 lstrcpyA(buf, "apple");
3540 r = MsiGetProductInfoA(prodcode, INSTALLPROPERTY_AUTHORIZED_LUA_APP, buf, &sz);
3541 if (r != ERROR_UNKNOWN_PROPERTY)
3543 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
3544 ok(!lstrcmpA(buf, ""), "Expected \"\", got \"%s\"\n", buf);
3545 ok(sz == 0, "Expected 0, got %d\n", sz);
3548 res = RegSetValueExA(propkey, "AuthorizedLUAApp", 0, REG_DWORD,
3549 (const BYTE *)&val, sizeof(DWORD));
3550 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
3552 /* AuthorizedLUAApp type is REG_DWORD */
3554 lstrcpyA(buf, "apple");
3555 r = MsiGetProductInfoA(prodcode, INSTALLPROPERTY_AUTHORIZED_LUA_APP, buf, &sz);
3556 if (r != ERROR_UNKNOWN_PROPERTY)
3558 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
3559 ok(!lstrcmpA(buf, ""), "Expected \"\", got \"%s\"\n", buf);
3560 ok(sz == 0, "Expected 0, got %d\n", sz);
3563 res = RegSetValueExA(prodkey, "AuthorizedLUAApp", 0, REG_SZ, (LPBYTE)"auth", 5);
3564 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
3566 /* Authorized value exists */
3568 lstrcpyA(buf, "apple");
3569 r = MsiGetProductInfoA(prodcode, INSTALLPROPERTY_AUTHORIZED_LUA_APP, buf, &sz);
3570 if (r != ERROR_UNKNOWN_PROPERTY)
3572 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
3573 ok(!lstrcmpA(buf, "auth"), "Expected \"auth\", got \"%s\"\n", buf);
3574 ok(sz == 4, "Expected 4, got %d\n", sz);
3577 res = RegSetValueExA(prodkey, "AuthorizedLUAApp", 0, REG_DWORD,
3578 (const BYTE *)&val, sizeof(DWORD));
3579 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
3581 /* AuthorizedLUAApp type is REG_DWORD */
3583 lstrcpyA(buf, "apple");
3584 r = MsiGetProductInfoA(prodcode, INSTALLPROPERTY_AUTHORIZED_LUA_APP, buf, &sz);
3585 if (r != ERROR_UNKNOWN_PROPERTY)
3587 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
3588 ok(!lstrcmpA(buf, "42"), "Expected \"42\", got \"%s\"\n", buf);
3589 ok(sz == 2, "Expected 2, got %d\n", sz);
3592 RegDeleteValueA(propkey, "HelpLink");
3593 RegDeleteValueA(propkey, "DisplayName");
3594 RegDeleteValueA(propkey, "DisplayVersion");
3595 RegDeleteValueA(propkey, "HelpTelephone");
3596 RegDeleteValueA(propkey, "InstallLocation");
3597 RegDeleteValueA(propkey, "InstallSource");
3598 RegDeleteValueA(propkey, "InstallDate");
3599 RegDeleteValueA(propkey, "Publisher");
3600 RegDeleteValueA(propkey, "LocalPackage");
3601 RegDeleteValueA(propkey, "UrlInfoAbout");
3602 RegDeleteValueA(propkey, "UrlUpdateInfo");
3603 RegDeleteValueA(propkey, "VersionMinor");
3604 RegDeleteValueA(propkey, "VersionMajor");
3605 RegDeleteValueA(propkey, "ProductID");
3606 RegDeleteValueA(propkey, "RegCompany");
3607 RegDeleteValueA(propkey, "RegOwner");
3608 RegDeleteValueA(propkey, "InstanceType");
3609 RegDeleteValueA(propkey, "Transforms");
3610 RegDeleteValueA(propkey, "Language");
3611 RegDeleteValueA(propkey, "ProductName");
3612 RegDeleteValueA(propkey, "Assignment");
3613 RegDeleteValueA(propkey, "PackageCode");
3614 RegDeleteValueA(propkey, "Version");
3615 RegDeleteValueA(propkey, "ProductIcon");
3616 RegDeleteValueA(propkey, "AuthorizedLUAApp");
3617 RegDeleteKeyA(propkey, "");
3618 RegDeleteKeyA(localkey, "");
3619 RegDeleteValueA(prodkey, "InstanceType");
3620 RegDeleteValueA(prodkey, "Transforms");
3621 RegDeleteValueA(prodkey, "Language");
3622 RegDeleteValueA(prodkey, "ProductName");
3623 RegDeleteValueA(prodkey, "Assignment");
3624 RegDeleteValueA(prodkey, "PackageCode");
3625 RegDeleteValueA(prodkey, "Version");
3626 RegDeleteValueA(prodkey, "ProductIcon");
3627 RegDeleteValueA(prodkey, "AuthorizedLUAApp");
3628 RegDeleteValueA(source, "PackageName");
3629 RegDeleteKeyA(source, "");
3630 RegDeleteKeyA(prodkey, "");
3631 RegCloseKey(propkey);
3632 RegCloseKey(localkey);
3633 RegCloseKey(source);
3634 RegCloseKey(prodkey);
3637 static void test_MsiGetProductInfoEx(void)
3641 HKEY propkey, userkey;
3642 HKEY prodkey, localkey;
3643 CHAR prodcode[MAX_PATH];
3644 CHAR prod_squashed[MAX_PATH];
3645 CHAR packcode[MAX_PATH];
3646 CHAR pack_squashed[MAX_PATH];
3648 CHAR keypath[MAX_PATH];
3652 if (!pMsiGetProductInfoExA)
3654 skip("MsiGetProductInfoExA is not available\n");
3658 create_test_guid(prodcode, prod_squashed);
3659 create_test_guid(packcode, pack_squashed);
3660 get_user_sid(&usersid);
3662 /* NULL szProductCode */
3664 lstrcpyA(buf, "apple");
3665 r = pMsiGetProductInfoExA(NULL, usersid, MSIINSTALLCONTEXT_USERUNMANAGED,
3666 INSTALLPROPERTY_PRODUCTSTATE, buf, &sz);
3667 ok(r == ERROR_INVALID_PARAMETER,
3668 "Expected ERROR_INVALID_PARAMETER, got %d\n", r);
3669 ok(!lstrcmpA(buf, "apple"), "Expected buf to be unchanged, got %s\n", buf);
3670 ok(sz == MAX_PATH, "Expected MAX_PATH, got %d\n", sz);
3672 /* empty szProductCode */
3674 lstrcpyA(buf, "apple");
3675 r = pMsiGetProductInfoExA("", usersid, MSIINSTALLCONTEXT_USERUNMANAGED,
3676 INSTALLPROPERTY_PRODUCTSTATE, buf, &sz);
3677 ok(r == ERROR_INVALID_PARAMETER,
3678 "Expected ERROR_INVALID_PARAMETER, got %d\n", r);
3679 ok(!lstrcmpA(buf, "apple"), "Expected buf to be unchanged, got %s\n", buf);
3680 ok(sz == MAX_PATH, "Expected MAX_PATH, got %d\n", sz);
3682 /* garbage szProductCode */
3684 lstrcpyA(buf, "apple");
3685 r = pMsiGetProductInfoExA("garbage", usersid, MSIINSTALLCONTEXT_USERUNMANAGED,
3686 INSTALLPROPERTY_PRODUCTSTATE, buf, &sz);
3687 ok(r == ERROR_INVALID_PARAMETER,
3688 "Expected ERROR_INVALID_PARAMETER, got %d\n", r);
3689 ok(!lstrcmpA(buf, "apple"), "Expected buf to be unchanged, got %s\n", buf);
3690 ok(sz == MAX_PATH, "Expected MAX_PATH, got %d\n", sz);
3692 /* guid without brackets */
3694 lstrcpyA(buf, "apple");
3695 r = pMsiGetProductInfoExA("6700E8CF-95AB-4D9C-BC2C-15840DEA7A5D", usersid,
3696 MSIINSTALLCONTEXT_USERUNMANAGED,
3697 INSTALLPROPERTY_PRODUCTSTATE, buf, &sz);
3698 ok(r == ERROR_INVALID_PARAMETER,
3699 "Expected ERROR_INVALID_PARAMETER, got %d\n", r);
3700 ok(!lstrcmpA(buf, "apple"), "Expected buf to be unchanged, got %s\n", buf);
3701 ok(sz == MAX_PATH, "Expected MAX_PATH, got %d\n", sz);
3703 /* guid with brackets */
3705 lstrcpyA(buf, "apple");
3706 r = pMsiGetProductInfoExA("{6700E8CF-95AB-4D9C-BC2C-15840DEA7A5D}", usersid,
3707 MSIINSTALLCONTEXT_USERUNMANAGED,
3708 INSTALLPROPERTY_PRODUCTSTATE, buf, &sz);
3709 ok(r == ERROR_UNKNOWN_PRODUCT,
3710 "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r);
3711 ok(!lstrcmpA(buf, "apple"), "Expected buf to be unchanged, got %s\n", buf);
3712 ok(sz == MAX_PATH, "Expected MAX_PATH, got %d\n", sz);
3714 /* szValue is non-NULL while pcchValue is NULL */
3715 lstrcpyA(buf, "apple");
3716 r = pMsiGetProductInfoExA(prodcode, usersid,
3717 MSIINSTALLCONTEXT_USERUNMANAGED,
3718 INSTALLPROPERTY_PRODUCTSTATE, buf, NULL);
3719 ok(r == ERROR_INVALID_PARAMETER,
3720 "Expected ERROR_INVALID_PARAMETER, got %d\n", r);
3721 ok(!lstrcmpA(buf, "apple"), "Expected buf to be unchanged, got %s\n", buf);
3723 /* dwContext is out of range */
3725 lstrcpyA(buf, "apple");
3726 r = pMsiGetProductInfoExA(prodcode, usersid, 42,
3727 INSTALLPROPERTY_PRODUCTSTATE, buf, &sz);
3728 ok(r == ERROR_INVALID_PARAMETER,
3729 "Expected ERROR_INVALID_PARAMETER, got %d\n", r);
3730 ok(!lstrcmpA(buf, "apple"), "Expected buf to be unchanged, got %s\n", buf);
3731 ok(sz == MAX_PATH, "Expected MAX_PATH, got %d\n", sz);
3733 /* szProperty is NULL */
3735 lstrcpyA(buf, "apple");
3736 r = pMsiGetProductInfoExA(prodcode, usersid,
3737 MSIINSTALLCONTEXT_USERUNMANAGED,
3739 ok(r == ERROR_INVALID_PARAMETER,
3740 "Expected ERROR_INVALID_PARAMETER, got %d\n", r);
3741 ok(!lstrcmpA(buf, "apple"), "Expected buf to be unchanged, got %s\n", buf);
3742 ok(sz == MAX_PATH, "Expected MAX_PATH, got %d\n", sz);
3744 /* szProperty is empty */
3746 lstrcpyA(buf, "apple");
3747 r = pMsiGetProductInfoExA(prodcode, usersid,
3748 MSIINSTALLCONTEXT_USERUNMANAGED,
3750 ok(r == ERROR_INVALID_PARAMETER,
3751 "Expected ERROR_INVALID_PARAMETER, got %d\n", r);
3752 ok(!lstrcmpA(buf, "apple"), "Expected buf to be unchanged, got %s\n", buf);
3753 ok(sz == MAX_PATH, "Expected MAX_PATH, got %d\n", sz);
3755 /* szProperty is not a valid property */
3757 lstrcpyA(buf, "apple");
3758 r = pMsiGetProductInfoExA(prodcode, usersid,
3759 MSIINSTALLCONTEXT_USERUNMANAGED,
3760 "notvalid", buf, &sz);
3761 ok(r == ERROR_UNKNOWN_PRODUCT,
3762 "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r);
3763 ok(!lstrcmpA(buf, "apple"), "Expected buf to be unchanged, got %s\n", buf);
3764 ok(sz == MAX_PATH, "Expected MAX_PATH, got %d\n", sz);
3766 /* same length as guid, but random */
3768 lstrcpyA(buf, "apple");
3769 r = pMsiGetProductInfoExA("A938G02JF-2NF3N93-VN3-2NNF-3KGKALDNF93", usersid,
3770 MSIINSTALLCONTEXT_USERUNMANAGED,
3771 INSTALLPROPERTY_PRODUCTSTATE, buf, &sz);
3772 ok(r == ERROR_INVALID_PARAMETER,
3773 "Expected ERROR_INVALID_PARAMETER, got %d\n", r);
3774 ok(!lstrcmpA(buf, "apple"), "Expected buf to be unchanged, got %s\n", buf);
3775 ok(sz == MAX_PATH, "Expected MAX_PATH, got %d\n", sz);
3777 /* MSIINSTALLCONTEXT_USERUNMANAGED */
3779 lstrcpyA(keypath, "Software\\Microsoft\\Windows\\CurrentVersion\\Installer\\UserData\\");
3780 lstrcatA(keypath, usersid);
3781 lstrcatA(keypath, "\\Products\\");
3782 lstrcatA(keypath, prod_squashed);
3784 res = RegCreateKeyA(HKEY_LOCAL_MACHINE, keypath, &localkey);
3785 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
3787 /* local user product key exists */
3789 lstrcpyA(buf, "apple");
3790 r = pMsiGetProductInfoExA(prodcode, usersid,
3791 MSIINSTALLCONTEXT_USERUNMANAGED,
3792 INSTALLPROPERTY_PRODUCTSTATE, buf, &sz);
3793 ok(r == ERROR_UNKNOWN_PRODUCT,
3794 "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r);
3795 ok(!lstrcmpA(buf, "apple"), "Expected buf to be unchanged, got %s\n", buf);
3796 ok(sz == MAX_PATH, "Expected MAX_PATH, got %d\n", sz);
3798 res = RegCreateKeyA(localkey, "InstallProperties", &propkey);
3799 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
3801 /* InstallProperties key exists */
3803 lstrcpyA(buf, "apple");
3804 r = pMsiGetProductInfoExA(prodcode, usersid,
3805 MSIINSTALLCONTEXT_USERUNMANAGED,
3806 INSTALLPROPERTY_PRODUCTSTATE, buf, &sz);
3807 ok(r == ERROR_UNKNOWN_PRODUCT,
3808 "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r);
3809 ok(!lstrcmpA(buf, "apple"), "Expected buf to be unchanged, got %s\n", buf);
3810 ok(sz == MAX_PATH, "Expected MAX_PATH, got %d\n", sz);
3812 res = RegSetValueExA(propkey, "LocalPackage", 0, REG_SZ, (LPBYTE)"local", 6);
3813 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
3815 /* LocalPackage value exists */
3817 lstrcpyA(buf, "apple");
3818 r = pMsiGetProductInfoExA(prodcode, usersid,
3819 MSIINSTALLCONTEXT_USERUNMANAGED,
3820 INSTALLPROPERTY_PRODUCTSTATE, buf, &sz);
3821 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
3822 ok(!lstrcmpA(buf, "5"), "Expected \"5\", got \"%s\"\n", buf);
3823 ok(sz == 1, "Expected 1, got %d\n", sz);
3825 RegDeleteValueA(propkey, "LocalPackage");
3827 /* LocalPackage value must exist */
3829 lstrcpyA(buf, "apple");
3830 r = pMsiGetProductInfoExA(prodcode, usersid,
3831 MSIINSTALLCONTEXT_USERUNMANAGED,
3832 INSTALLPROPERTY_HELPLINK, buf, &sz);
3833 ok(r == ERROR_UNKNOWN_PRODUCT,
3834 "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r);
3835 ok(!lstrcmpA(buf, "apple"), "Expected buf to be unchanged, got %s\n", buf);
3836 ok(sz == MAX_PATH, "Expected MAX_PATH, got %d\n", sz);
3838 res = RegSetValueExA(propkey, "LocalPackage", 0, REG_SZ, (LPBYTE)"local", 6);
3839 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
3841 /* LocalPackage exists, but HelpLink does not exist */
3843 lstrcpyA(buf, "apple");
3844 r = pMsiGetProductInfoExA(prodcode, usersid,
3845 MSIINSTALLCONTEXT_USERUNMANAGED,
3846 INSTALLPROPERTY_HELPLINK, buf, &sz);
3847 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
3848 ok(!lstrcmpA(buf, ""), "Expected \"\", got \"%s\"\n", buf);
3849 ok(sz == 0, "Expected 0, got %d\n", sz);
3851 res = RegSetValueExA(propkey, "HelpLink", 0, REG_SZ, (LPBYTE)"link", 5);
3852 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
3854 /* HelpLink value exists */
3856 lstrcpyA(buf, "apple");
3857 r = pMsiGetProductInfoExA(prodcode, usersid,
3858 MSIINSTALLCONTEXT_USERUNMANAGED,
3859 INSTALLPROPERTY_HELPLINK, buf, &sz);
3860 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
3861 ok(!lstrcmpA(buf, "link"), "Expected \"link\", got \"%s\"\n", buf);
3862 ok(sz == 4, "Expected 4, got %d\n", sz);
3864 res = RegSetValueExA(propkey, "HelpTelephone", 0, REG_SZ, (LPBYTE)"phone", 6);
3865 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
3867 /* HelpTelephone value exists */
3869 lstrcpyA(buf, "apple");
3870 r = pMsiGetProductInfoExA(prodcode, usersid,
3871 MSIINSTALLCONTEXT_USERUNMANAGED,
3872 INSTALLPROPERTY_HELPTELEPHONE, buf, &sz);
3873 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
3874 ok(!lstrcmpA(buf, "phone"), "Expected \"phone\", got \"%s\"\n", buf);
3875 ok(sz == 5, "Expected 5, got %d\n", sz);
3877 /* szValue and pcchValue are NULL */
3878 r = pMsiGetProductInfoExA(prodcode, usersid,
3879 MSIINSTALLCONTEXT_USERUNMANAGED,
3880 INSTALLPROPERTY_HELPTELEPHONE, NULL, NULL);
3881 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
3883 /* pcchValue is exactly 5 */
3885 lstrcpyA(buf, "apple");
3886 r = pMsiGetProductInfoExA(prodcode, usersid,
3887 MSIINSTALLCONTEXT_USERUNMANAGED,
3888 INSTALLPROPERTY_HELPTELEPHONE, buf, &sz);
3889 ok(r == ERROR_MORE_DATA,
3890 "Expected ERROR_MORE_DATA, got %d\n", r);
3891 ok(!lstrcmpA(buf, ""), "Expected \"\", got \"%s\"\n", buf);
3892 ok(sz == 10, "Expected 10, got %d\n", sz);
3894 /* szValue is NULL, pcchValue is exactly 5 */
3896 r = pMsiGetProductInfoExA(prodcode, usersid,
3897 MSIINSTALLCONTEXT_USERUNMANAGED,
3898 INSTALLPROPERTY_HELPTELEPHONE, NULL, &sz);
3899 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
3900 ok(sz == 10, "Expected 10, got %d\n", sz);
3902 /* szValue is NULL, pcchValue is MAX_PATH */
3904 r = pMsiGetProductInfoExA(prodcode, usersid,
3905 MSIINSTALLCONTEXT_USERUNMANAGED,
3906 INSTALLPROPERTY_HELPTELEPHONE, NULL, &sz);
3907 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
3908 ok(sz == 10, "Expected 10, got %d\n", sz);
3910 /* pcchValue is exactly 0 */
3912 lstrcpyA(buf, "apple");
3913 r = pMsiGetProductInfoExA(prodcode, usersid,
3914 MSIINSTALLCONTEXT_USERUNMANAGED,
3915 INSTALLPROPERTY_HELPTELEPHONE, buf, &sz);
3916 ok(r == ERROR_MORE_DATA,
3917 "Expected ERROR_MORE_DATA, got %d\n", r);
3918 ok(!lstrcmpA(buf, "apple"), "Expected \"apple\", got \"%s\"\n", buf);
3919 ok(sz == 10, "Expected 10, got %d\n", sz);
3921 res = RegSetValueExA(propkey, "notvalid", 0, REG_SZ, (LPBYTE)"invalid", 8);
3922 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
3924 /* szProperty is not a valid property */
3926 lstrcpyA(buf, "apple");
3927 r = pMsiGetProductInfoExA(prodcode, usersid,
3928 MSIINSTALLCONTEXT_USERUNMANAGED,
3929 "notvalid", buf, &sz);
3930 ok(r == ERROR_UNKNOWN_PROPERTY,
3931 "Expected ERROR_UNKNOWN_PROPERTY, got %d\n", r);
3932 ok(!lstrcmpA(buf, "apple"), "Expected buf to be unchanged, got %s\n", buf);
3933 ok(sz == MAX_PATH, "Expected MAX_PATH, got %d\n", sz);
3935 res = RegSetValueExA(propkey, "InstallDate", 0, REG_SZ, (LPBYTE)"date", 5);
3936 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
3938 /* InstallDate value exists */
3940 lstrcpyA(buf, "apple");
3941 r = pMsiGetProductInfoExA(prodcode, usersid,
3942 MSIINSTALLCONTEXT_USERUNMANAGED,
3943 INSTALLPROPERTY_INSTALLDATE, buf, &sz);
3944 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
3945 ok(!lstrcmpA(buf, "date"), "Expected \"date\", got \"%s\"\n", buf);
3946 ok(sz == 4, "Expected 4, got %d\n", sz);
3948 res = RegSetValueExA(propkey, "DisplayName", 0, REG_SZ, (LPBYTE)"name", 5);
3949 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
3951 /* DisplayName value exists */
3953 lstrcpyA(buf, "apple");
3954 r = pMsiGetProductInfoExA(prodcode, usersid,
3955 MSIINSTALLCONTEXT_USERUNMANAGED,
3956 INSTALLPROPERTY_INSTALLEDPRODUCTNAME, buf, &sz);
3957 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
3958 ok(!lstrcmpA(buf, "name"), "Expected \"name\", got \"%s\"\n", buf);
3959 ok(sz == 4, "Expected 4, got %d\n", sz);
3961 res = RegSetValueExA(propkey, "InstallLocation", 0, REG_SZ, (LPBYTE)"loc", 4);
3962 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
3964 /* InstallLocation value exists */
3966 lstrcpyA(buf, "apple");
3967 r = pMsiGetProductInfoExA(prodcode, usersid,
3968 MSIINSTALLCONTEXT_USERUNMANAGED,
3969 INSTALLPROPERTY_INSTALLLOCATION, buf, &sz);
3970 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
3971 ok(!lstrcmpA(buf, "loc"), "Expected \"loc\", got \"%s\"\n", buf);
3972 ok(sz == 3, "Expected 3, got %d\n", sz);
3974 res = RegSetValueExA(propkey, "InstallSource", 0, REG_SZ, (LPBYTE)"source", 7);
3975 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
3977 /* InstallSource value exists */
3979 lstrcpyA(buf, "apple");
3980 r = pMsiGetProductInfoExA(prodcode, usersid,
3981 MSIINSTALLCONTEXT_USERUNMANAGED,
3982 INSTALLPROPERTY_INSTALLSOURCE, buf, &sz);
3983 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
3984 ok(!lstrcmpA(buf, "source"), "Expected \"source\", got \"%s\"\n", buf);
3985 ok(sz == 6, "Expected 6, got %d\n", sz);
3987 res = RegSetValueExA(propkey, "LocalPackage", 0, REG_SZ, (LPBYTE)"local", 6);
3988 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
3990 /* LocalPackage value exists */
3992 lstrcpyA(buf, "apple");
3993 r = pMsiGetProductInfoExA(prodcode, usersid,
3994 MSIINSTALLCONTEXT_USERUNMANAGED,
3995 INSTALLPROPERTY_LOCALPACKAGE, buf, &sz);
3996 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
3997 ok(!lstrcmpA(buf, "local"), "Expected \"local\", got \"%s\"\n", buf);
3998 ok(sz == 5, "Expected 5, got %d\n", sz);
4000 res = RegSetValueExA(propkey, "Publisher", 0, REG_SZ, (LPBYTE)"pub", 4);
4001 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
4003 /* Publisher value exists */
4005 lstrcpyA(buf, "apple");
4006 r = pMsiGetProductInfoExA(prodcode, usersid,
4007 MSIINSTALLCONTEXT_USERUNMANAGED,
4008 INSTALLPROPERTY_PUBLISHER, buf, &sz);
4009 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
4010 ok(!lstrcmpA(buf, "pub"), "Expected \"pub\", got \"%s\"\n", buf);
4011 ok(sz == 3, "Expected 3, got %d\n", sz);
4013 res = RegSetValueExA(propkey, "URLInfoAbout", 0, REG_SZ, (LPBYTE)"about", 6);
4014 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
4016 /* URLInfoAbout value exists */
4018 lstrcpyA(buf, "apple");
4019 r = pMsiGetProductInfoExA(prodcode, usersid,
4020 MSIINSTALLCONTEXT_USERUNMANAGED,
4021 INSTALLPROPERTY_URLINFOABOUT, buf, &sz);
4022 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
4023 ok(!lstrcmpA(buf, "about"), "Expected \"about\", got \"%s\"\n", buf);
4024 ok(sz == 5, "Expected 5, got %d\n", sz);
4026 res = RegSetValueExA(propkey, "URLUpdateInfo", 0, REG_SZ, (LPBYTE)"update", 7);
4027 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
4029 /* URLUpdateInfo value exists */
4031 lstrcpyA(buf, "apple");
4032 r = pMsiGetProductInfoExA(prodcode, usersid,
4033 MSIINSTALLCONTEXT_USERUNMANAGED,
4034 INSTALLPROPERTY_URLUPDATEINFO, buf, &sz);
4035 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
4036 ok(!lstrcmpA(buf, "update"), "Expected \"update\", got \"%s\"\n", buf);
4037 ok(sz == 6, "Expected 6, got %d\n", sz);
4039 res = RegSetValueExA(propkey, "VersionMinor", 0, REG_SZ, (LPBYTE)"2", 2);
4040 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
4042 /* VersionMinor value exists */
4044 lstrcpyA(buf, "apple");
4045 r = pMsiGetProductInfoExA(prodcode, usersid,
4046 MSIINSTALLCONTEXT_USERUNMANAGED,
4047 INSTALLPROPERTY_VERSIONMINOR, buf, &sz);
4048 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
4049 ok(!lstrcmpA(buf, "2"), "Expected \"2\", got \"%s\"\n", buf);
4050 ok(sz == 1, "Expected 1, got %d\n", sz);
4052 res = RegSetValueExA(propkey, "VersionMajor", 0, REG_SZ, (LPBYTE)"3", 2);
4053 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
4055 /* VersionMajor value exists */
4057 lstrcpyA(buf, "apple");
4058 r = pMsiGetProductInfoExA(prodcode, usersid,
4059 MSIINSTALLCONTEXT_USERUNMANAGED,
4060 INSTALLPROPERTY_VERSIONMAJOR, buf, &sz);
4061 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
4062 ok(!lstrcmpA(buf, "3"), "Expected \"3\", got \"%s\"\n", buf);
4063 ok(sz == 1, "Expected 1, got %d\n", sz);
4065 res = RegSetValueExA(propkey, "DisplayVersion", 0, REG_SZ, (LPBYTE)"3.2.1", 6);
4066 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
4068 /* DisplayVersion value exists */
4070 lstrcpyA(buf, "apple");
4071 r = pMsiGetProductInfoExA(prodcode, usersid,
4072 MSIINSTALLCONTEXT_USERUNMANAGED,
4073 INSTALLPROPERTY_VERSIONSTRING, buf, &sz);
4074 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
4075 ok(!lstrcmpA(buf, "3.2.1"), "Expected \"3.2.1\", got \"%s\"\n", buf);
4076 ok(sz == 5, "Expected 5, got %d\n", sz);
4078 res = RegSetValueExA(propkey, "ProductID", 0, REG_SZ, (LPBYTE)"id", 3);
4079 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
4081 /* ProductID value exists */
4083 lstrcpyA(buf, "apple");
4084 r = pMsiGetProductInfoExA(prodcode, usersid,
4085 MSIINSTALLCONTEXT_USERUNMANAGED,
4086 INSTALLPROPERTY_PRODUCTID, buf, &sz);
4087 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
4088 ok(!lstrcmpA(buf, "id"), "Expected \"id\", got \"%s\"\n", buf);
4089 ok(sz == 2, "Expected 2, got %d\n", sz);
4091 res = RegSetValueExA(propkey, "RegCompany", 0, REG_SZ, (LPBYTE)"comp", 5);
4092 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
4094 /* RegCompany value exists */
4096 lstrcpyA(buf, "apple");
4097 r = pMsiGetProductInfoExA(prodcode, usersid,
4098 MSIINSTALLCONTEXT_USERUNMANAGED,
4099 INSTALLPROPERTY_REGCOMPANY, buf, &sz);
4100 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
4101 ok(!lstrcmpA(buf, "comp"), "Expected \"comp\", got \"%s\"\n", buf);
4102 ok(sz == 4, "Expected 4, got %d\n", sz);
4104 res = RegSetValueExA(propkey, "RegOwner", 0, REG_SZ, (LPBYTE)"owner", 6);
4105 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
4107 /* RegOwner value exists */
4109 lstrcpyA(buf, "apple");
4110 r = pMsiGetProductInfoExA(prodcode, usersid,
4111 MSIINSTALLCONTEXT_USERUNMANAGED,
4112 INSTALLPROPERTY_REGOWNER, buf, &sz);
4113 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
4114 ok(!lstrcmpA(buf, "owner"), "Expected \"owner\", got \"%s\"\n", buf);
4115 ok(sz == 5, "Expected 5, got %d\n", sz);
4117 res = RegSetValueExA(propkey, "Transforms", 0, REG_SZ, (LPBYTE)"trans", 6);
4118 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
4120 /* Transforms value exists */
4122 lstrcpyA(buf, "apple");
4123 r = pMsiGetProductInfoExA(prodcode, usersid,
4124 MSIINSTALLCONTEXT_USERUNMANAGED,
4125 INSTALLPROPERTY_TRANSFORMS, buf, &sz);
4126 ok(r == ERROR_UNKNOWN_PRODUCT,
4127 "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r);
4128 ok(!lstrcmpA(buf, "apple"), "Expected buf to be unchanged, got %s\n", buf);
4129 ok(sz == MAX_PATH, "Expected MAX_PATH, got %d\n", sz);
4131 res = RegSetValueExA(propkey, "Language", 0, REG_SZ, (LPBYTE)"lang", 5);
4132 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
4134 /* Language value exists */
4136 lstrcpyA(buf, "apple");
4137 r = pMsiGetProductInfoExA(prodcode, usersid,
4138 MSIINSTALLCONTEXT_USERUNMANAGED,
4139 INSTALLPROPERTY_LANGUAGE, buf, &sz);
4140 ok(r == ERROR_UNKNOWN_PRODUCT,
4141 "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r);
4142 ok(!lstrcmpA(buf, "apple"), "Expected buf to be unchanged, got %s\n", buf);
4143 ok(sz == MAX_PATH, "Expected MAX_PATH, got %d\n", sz);
4145 res = RegSetValueExA(propkey, "ProductName", 0, REG_SZ, (LPBYTE)"name", 5);
4146 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
4148 /* ProductName value exists */
4150 lstrcpyA(buf, "apple");
4151 r = pMsiGetProductInfoExA(prodcode, usersid,
4152 MSIINSTALLCONTEXT_USERUNMANAGED,
4153 INSTALLPROPERTY_PRODUCTNAME, buf, &sz);
4154 ok(r == ERROR_UNKNOWN_PRODUCT,
4155 "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r);
4156 ok(!lstrcmpA(buf, "apple"), "Expected buf to be unchanged, got %s\n", buf);
4157 ok(sz == MAX_PATH, "Expected MAX_PATH, got %d\n", sz);
4159 res = RegSetValueExA(propkey, "AssignmentType", 0, REG_SZ, (LPBYTE)"type", 5);
4160 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
4164 /* AssignmentType value exists */
4166 lstrcpyA(buf, "apple");
4167 r = pMsiGetProductInfoExA(prodcode, usersid,
4168 MSIINSTALLCONTEXT_USERUNMANAGED,
4169 INSTALLPROPERTY_ASSIGNMENTTYPE, buf, &sz);
4170 ok(r == ERROR_UNKNOWN_PRODUCT,
4171 "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r);
4172 ok(!lstrcmpA(buf, "apple"), "Expected buf to be unchanged, got %s\n", buf);
4173 ok(sz == MAX_PATH, "Expected MAX_PATH, got %d\n", sz);
4175 res = RegSetValueExA(propkey, "PackageCode", 0, REG_SZ, (LPBYTE)"code", 5);
4176 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
4178 /* PackageCode value exists */
4180 lstrcpyA(buf, "apple");
4181 r = pMsiGetProductInfoExA(prodcode, usersid,
4182 MSIINSTALLCONTEXT_USERUNMANAGED,
4183 INSTALLPROPERTY_PACKAGECODE, buf, &sz);
4184 ok(r == ERROR_UNKNOWN_PRODUCT,
4185 "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r);
4186 ok(!lstrcmpA(buf, "apple"), "Expected buf to be unchanged, got %s\n", buf);
4187 ok(sz == MAX_PATH, "Expected MAX_PATH, got %d\n", sz);
4189 res = RegSetValueExA(propkey, "Version", 0, REG_SZ, (LPBYTE)"ver", 4);
4190 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
4192 /* Version value exists */
4194 lstrcpyA(buf, "apple");
4195 r = pMsiGetProductInfoExA(prodcode, usersid,
4196 MSIINSTALLCONTEXT_USERUNMANAGED,
4197 INSTALLPROPERTY_VERSION, buf, &sz);
4198 ok(r == ERROR_UNKNOWN_PRODUCT,
4199 "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r);
4200 ok(!lstrcmpA(buf, "apple"), "Expected buf to be unchanged, got %s\n", buf);
4201 ok(sz == MAX_PATH, "Expected MAX_PATH, got %d\n", sz);
4203 res = RegSetValueExA(propkey, "ProductIcon", 0, REG_SZ, (LPBYTE)"icon", 5);
4204 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
4206 /* ProductIcon value exists */
4208 lstrcpyA(buf, "apple");
4209 r = pMsiGetProductInfoExA(prodcode, usersid,
4210 MSIINSTALLCONTEXT_USERUNMANAGED,
4211 INSTALLPROPERTY_PRODUCTICON, buf, &sz);
4212 ok(r == ERROR_UNKNOWN_PRODUCT,
4213 "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r);
4214 ok(!lstrcmpA(buf, "apple"), "Expected buf to be unchanged, got %s\n", buf);
4215 ok(sz == MAX_PATH, "Expected MAX_PATH, got %d\n", sz);
4217 res = RegSetValueExA(propkey, "PackageName", 0, REG_SZ, (LPBYTE)"name", 5);
4218 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
4220 /* PackageName value exists */
4222 lstrcpyA(buf, "apple");
4223 r = pMsiGetProductInfoExA(prodcode, usersid,
4224 MSIINSTALLCONTEXT_USERUNMANAGED,
4225 INSTALLPROPERTY_PACKAGENAME, buf, &sz);
4226 ok(r == ERROR_UNKNOWN_PRODUCT,
4227 "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r);
4228 ok(!lstrcmpA(buf, "apple"), "Expected buf to be unchanged, got %s\n", buf);
4229 ok(sz == MAX_PATH, "Expected MAX_PATH, got %d\n", sz);
4231 res = RegSetValueExA(propkey, "AuthorizedLUAApp", 0, REG_SZ, (LPBYTE)"auth", 5);
4232 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
4234 /* AuthorizedLUAApp value exists */
4236 lstrcpyA(buf, "apple");
4237 r = pMsiGetProductInfoExA(prodcode, usersid,
4238 MSIINSTALLCONTEXT_USERUNMANAGED,
4239 INSTALLPROPERTY_AUTHORIZED_LUA_APP, buf, &sz);
4240 ok(r == ERROR_UNKNOWN_PRODUCT,
4241 "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r);
4242 ok(!lstrcmpA(buf, "apple"), "Expected buf to be unchanged, got %s\n", buf);
4243 ok(sz == MAX_PATH, "Expected MAX_PATH, got %d\n", sz);
4245 RegDeleteValueA(propkey, "AuthorizedLUAApp");
4246 RegDeleteValueA(propkey, "PackageName");
4247 RegDeleteValueA(propkey, "ProductIcon");
4248 RegDeleteValueA(propkey, "Version");
4249 RegDeleteValueA(propkey, "PackageCode");
4250 RegDeleteValueA(propkey, "AssignmentType");
4251 RegDeleteValueA(propkey, "ProductName");
4252 RegDeleteValueA(propkey, "Language");
4253 RegDeleteValueA(propkey, "Transforms");
4254 RegDeleteValueA(propkey, "RegOwner");
4255 RegDeleteValueA(propkey, "RegCompany");
4256 RegDeleteValueA(propkey, "ProductID");
4257 RegDeleteValueA(propkey, "DisplayVersion");
4258 RegDeleteValueA(propkey, "VersionMajor");
4259 RegDeleteValueA(propkey, "VersionMinor");
4260 RegDeleteValueA(propkey, "URLUpdateInfo");
4261 RegDeleteValueA(propkey, "URLInfoAbout");
4262 RegDeleteValueA(propkey, "Publisher");
4263 RegDeleteValueA(propkey, "LocalPackage");
4264 RegDeleteValueA(propkey, "InstallSource");
4265 RegDeleteValueA(propkey, "InstallLocation");
4266 RegDeleteValueA(propkey, "DisplayName");
4267 RegDeleteValueA(propkey, "InstallDate");
4268 RegDeleteValueA(propkey, "HelpTelephone");
4269 RegDeleteValueA(propkey, "HelpLink");
4270 RegDeleteValueA(propkey, "LocalPackage");
4271 RegDeleteKeyA(propkey, "");
4272 RegCloseKey(propkey);
4273 RegDeleteKeyA(localkey, "");
4274 RegCloseKey(localkey);
4276 lstrcpyA(keypath, "Software\\Microsoft\\Windows\\CurrentVersion\\Installer\\Managed\\");
4277 lstrcatA(keypath, usersid);
4278 lstrcatA(keypath, "\\Installer\\Products\\");
4279 lstrcatA(keypath, prod_squashed);
4281 res = RegCreateKeyA(HKEY_LOCAL_MACHINE, keypath, &userkey);
4282 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
4284 /* user product key exists */
4286 lstrcpyA(buf, "apple");
4287 r = pMsiGetProductInfoExA(prodcode, usersid,
4288 MSIINSTALLCONTEXT_USERUNMANAGED,
4289 INSTALLPROPERTY_PRODUCTSTATE, buf, &sz);
4290 ok(r == ERROR_UNKNOWN_PRODUCT,
4291 "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r);
4292 ok(!lstrcmpA(buf, "apple"), "Expected buf to be unchanged, got %s\n", buf);
4293 ok(sz == MAX_PATH, "Expected MAX_PATH, got %d\n", sz);
4295 RegDeleteKeyA(userkey, "");
4296 RegCloseKey(userkey);
4298 lstrcpyA(keypath, "Software\\Microsoft\\Installer\\Products\\");
4299 lstrcatA(keypath, prod_squashed);
4301 res = RegCreateKeyA(HKEY_CURRENT_USER, keypath, &prodkey);
4302 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
4305 lstrcpyA(buf, "apple");
4306 r = pMsiGetProductInfoExA(prodcode, usersid,
4307 MSIINSTALLCONTEXT_USERUNMANAGED,
4308 INSTALLPROPERTY_PRODUCTSTATE, buf, &sz);
4309 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
4310 ok(!lstrcmpA(buf, "1"), "Expected \"1\", got \"%s\"\n", buf);
4311 ok(sz == 1, "Expected 1, got %d\n", sz);
4313 res = RegSetValueExA(prodkey, "HelpLink", 0, REG_SZ, (LPBYTE)"link", 5);
4314 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
4316 /* HelpLink value exists */
4318 lstrcpyA(buf, "apple");
4319 r = pMsiGetProductInfoExA(prodcode, usersid,
4320 MSIINSTALLCONTEXT_USERUNMANAGED,
4321 INSTALLPROPERTY_HELPLINK, buf, &sz);
4322 ok(r == ERROR_UNKNOWN_PROPERTY,
4323 "Expected ERROR_UNKNOWN_PROPERTY, got %d\n", r);
4324 ok(!lstrcmpA(buf, "apple"), "Expected buf to be unchanged, got %s\n", buf);
4325 ok(sz == MAX_PATH, "Expected MAX_PATH, got %d\n", sz);
4327 res = RegSetValueExA(prodkey, "HelpTelephone", 0, REG_SZ, (LPBYTE)"phone", 6);
4328 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
4330 /* HelpTelephone value exists */
4332 lstrcpyA(buf, "apple");
4333 r = pMsiGetProductInfoExA(prodcode, usersid,
4334 MSIINSTALLCONTEXT_USERUNMANAGED,
4335 INSTALLPROPERTY_HELPTELEPHONE, buf, &sz);
4336 ok(r == ERROR_UNKNOWN_PROPERTY,
4337 "Expected ERROR_UNKNOWN_PROPERTY, got %d\n", r);
4338 ok(!lstrcmpA(buf, "apple"), "Expected buf to be unchanged, got %s\n", buf);
4339 ok(sz == MAX_PATH, "Expected MAX_PATH, got %d\n", sz);
4341 res = RegSetValueExA(prodkey, "InstallDate", 0, REG_SZ, (LPBYTE)"date", 5);
4342 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
4344 /* InstallDate value exists */
4346 lstrcpyA(buf, "apple");
4347 r = pMsiGetProductInfoExA(prodcode, usersid,
4348 MSIINSTALLCONTEXT_USERUNMANAGED,
4349 INSTALLPROPERTY_INSTALLDATE, buf, &sz);
4350 ok(r == ERROR_UNKNOWN_PROPERTY,
4351 "Expected ERROR_UNKNOWN_PROPERTY, got %d\n", r);
4352 ok(!lstrcmpA(buf, "apple"), "Expected buf to be unchanged, got %s\n", buf);
4353 ok(sz == MAX_PATH, "Expected MAX_PATH, got %d\n", sz);
4355 res = RegSetValueExA(prodkey, "DisplayName", 0, REG_SZ, (LPBYTE)"name", 5);
4356 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
4358 /* DisplayName value exists */
4360 lstrcpyA(buf, "apple");
4361 r = pMsiGetProductInfoExA(prodcode, usersid,
4362 MSIINSTALLCONTEXT_USERUNMANAGED,
4363 INSTALLPROPERTY_INSTALLEDPRODUCTNAME, buf, &sz);
4364 ok(r == ERROR_UNKNOWN_PROPERTY,
4365 "Expected ERROR_UNKNOWN_PROPERTY, got %d\n", r);
4366 ok(!lstrcmpA(buf, "apple"), "Expected buf to be unchanged, got %s\n", buf);
4367 ok(sz == MAX_PATH, "Expected MAX_PATH, got %d\n", sz);
4369 res = RegSetValueExA(prodkey, "InstallLocation", 0, REG_SZ, (LPBYTE)"loc", 4);
4370 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
4372 /* InstallLocation value exists */
4374 lstrcpyA(buf, "apple");
4375 r = pMsiGetProductInfoExA(prodcode, usersid,
4376 MSIINSTALLCONTEXT_USERUNMANAGED,
4377 INSTALLPROPERTY_INSTALLLOCATION, buf, &sz);
4378 ok(r == ERROR_UNKNOWN_PROPERTY,
4379 "Expected ERROR_UNKNOWN_PROPERTY, got %d\n", r);
4380 ok(!lstrcmpA(buf, "apple"), "Expected buf to be unchanged, got %s\n", buf);
4381 ok(sz == MAX_PATH, "Expected MAX_PATH, got %d\n", sz);
4383 res = RegSetValueExA(prodkey, "InstallSource", 0, REG_SZ, (LPBYTE)"source", 7);
4384 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
4386 /* InstallSource value exists */
4388 lstrcpyA(buf, "apple");
4389 r = pMsiGetProductInfoExA(prodcode, usersid,
4390 MSIINSTALLCONTEXT_USERUNMANAGED,
4391 INSTALLPROPERTY_INSTALLSOURCE, buf, &sz);
4392 ok(r == ERROR_UNKNOWN_PROPERTY,
4393 "Expected ERROR_UNKNOWN_PROPERTY, got %d\n", r);
4394 ok(!lstrcmpA(buf, "apple"), "Expected buf to be unchanged, got %s\n", buf);
4395 ok(sz == MAX_PATH, "Expected MAX_PATH, got %d\n", sz);
4397 res = RegSetValueExA(prodkey, "LocalPackage", 0, REG_SZ, (LPBYTE)"local", 6);
4398 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
4400 /* LocalPackage value exists */
4402 lstrcpyA(buf, "apple");
4403 r = pMsiGetProductInfoExA(prodcode, usersid,
4404 MSIINSTALLCONTEXT_USERUNMANAGED,
4405 INSTALLPROPERTY_LOCALPACKAGE, buf, &sz);
4406 ok(r == ERROR_UNKNOWN_PROPERTY,
4407 "Expected ERROR_UNKNOWN_PROPERTY, got %d\n", r);
4408 ok(!lstrcmpA(buf, "apple"), "Expected buf to be unchanged, got %s\n", buf);
4409 ok(sz == MAX_PATH, "Expected MAX_PATH, got %d\n", sz);
4411 res = RegSetValueExA(prodkey, "Publisher", 0, REG_SZ, (LPBYTE)"pub", 4);
4412 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
4414 /* Publisher value exists */
4416 lstrcpyA(buf, "apple");
4417 r = pMsiGetProductInfoExA(prodcode, usersid,
4418 MSIINSTALLCONTEXT_USERUNMANAGED,
4419 INSTALLPROPERTY_PUBLISHER, buf, &sz);
4420 ok(r == ERROR_UNKNOWN_PROPERTY,
4421 "Expected ERROR_UNKNOWN_PROPERTY, got %d\n", r);
4422 ok(!lstrcmpA(buf, "apple"), "Expected buf to be unchanged, got %s\n", buf);
4423 ok(sz == MAX_PATH, "Expected MAX_PATH, got %d\n", sz);
4425 res = RegSetValueExA(prodkey, "URLInfoAbout", 0, REG_SZ, (LPBYTE)"about", 6);
4426 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
4428 /* URLInfoAbout value exists */
4430 lstrcpyA(buf, "apple");
4431 r = pMsiGetProductInfoExA(prodcode, usersid,
4432 MSIINSTALLCONTEXT_USERUNMANAGED,
4433 INSTALLPROPERTY_URLINFOABOUT, buf, &sz);
4434 ok(r == ERROR_UNKNOWN_PROPERTY,
4435 "Expected ERROR_UNKNOWN_PROPERTY, got %d\n", r);
4436 ok(!lstrcmpA(buf, "apple"), "Expected buf to be unchanged, got %s\n", buf);
4437 ok(sz == MAX_PATH, "Expected MAX_PATH, got %d\n", sz);
4439 res = RegSetValueExA(prodkey, "URLUpdateInfo", 0, REG_SZ, (LPBYTE)"update", 7);
4440 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
4442 /* URLUpdateInfo value exists */
4444 lstrcpyA(buf, "apple");
4445 r = pMsiGetProductInfoExA(prodcode, usersid,
4446 MSIINSTALLCONTEXT_USERUNMANAGED,
4447 INSTALLPROPERTY_URLUPDATEINFO, buf, &sz);
4448 ok(r == ERROR_UNKNOWN_PROPERTY,
4449 "Expected ERROR_UNKNOWN_PROPERTY, got %d\n", r);
4450 ok(!lstrcmpA(buf, "apple"), "Expected buf to be unchanged, got %s\n", buf);
4451 ok(sz == MAX_PATH, "Expected MAX_PATH, got %d\n", sz);
4453 res = RegSetValueExA(prodkey, "VersionMinor", 0, REG_SZ, (LPBYTE)"2", 2);
4454 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
4456 /* VersionMinor value exists */
4458 lstrcpyA(buf, "apple");
4459 r = pMsiGetProductInfoExA(prodcode, usersid,
4460 MSIINSTALLCONTEXT_USERUNMANAGED,
4461 INSTALLPROPERTY_VERSIONMINOR, buf, &sz);
4462 ok(r == ERROR_UNKNOWN_PROPERTY,
4463 "Expected ERROR_UNKNOWN_PROPERTY, got %d\n", r);
4464 ok(!lstrcmpA(buf, "apple"), "Expected buf to be unchanged, got %s\n", buf);
4465 ok(sz == MAX_PATH, "Expected MAX_PATH, got %d\n", sz);
4467 res = RegSetValueExA(prodkey, "VersionMajor", 0, REG_SZ, (LPBYTE)"3", 2);
4468 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
4470 /* VersionMajor value exists */
4472 lstrcpyA(buf, "apple");
4473 r = pMsiGetProductInfoExA(prodcode, usersid,
4474 MSIINSTALLCONTEXT_USERUNMANAGED,
4475 INSTALLPROPERTY_VERSIONMAJOR, buf, &sz);
4476 ok(r == ERROR_UNKNOWN_PROPERTY,
4477 "Expected ERROR_UNKNOWN_PROPERTY, got %d\n", r);
4478 ok(!lstrcmpA(buf, "apple"), "Expected buf to be unchanged, got %s\n", buf);
4479 ok(sz == MAX_PATH, "Expected MAX_PATH, got %d\n", sz);
4481 res = RegSetValueExA(prodkey, "DisplayVersion", 0, REG_SZ, (LPBYTE)"3.2.1", 6);
4482 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
4484 /* DisplayVersion value exists */
4486 lstrcpyA(buf, "apple");
4487 r = pMsiGetProductInfoExA(prodcode, usersid,
4488 MSIINSTALLCONTEXT_USERUNMANAGED,
4489 INSTALLPROPERTY_VERSIONSTRING, buf, &sz);
4490 ok(r == ERROR_UNKNOWN_PROPERTY,
4491 "Expected ERROR_UNKNOWN_PROPERTY, got %d\n", r);
4492 ok(!lstrcmpA(buf, "apple"), "Expected buf to be unchanged, got %s\n", buf);
4493 ok(sz == MAX_PATH, "Expected MAX_PATH, got %d\n", sz);
4495 res = RegSetValueExA(prodkey, "ProductID", 0, REG_SZ, (LPBYTE)"id", 3);
4496 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
4498 /* ProductID value exists */
4500 lstrcpyA(buf, "apple");
4501 r = pMsiGetProductInfoExA(prodcode, usersid,
4502 MSIINSTALLCONTEXT_USERUNMANAGED,
4503 INSTALLPROPERTY_PRODUCTID, buf, &sz);
4504 ok(r == ERROR_UNKNOWN_PROPERTY,
4505 "Expected ERROR_UNKNOWN_PROPERTY, got %d\n", r);
4506 ok(!lstrcmpA(buf, "apple"), "Expected buf to be unchanged, got %s\n", buf);
4507 ok(sz == MAX_PATH, "Expected MAX_PATH, got %d\n", sz);
4509 res = RegSetValueExA(prodkey, "RegCompany", 0, REG_SZ, (LPBYTE)"comp", 5);
4510 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
4512 /* RegCompany value exists */
4514 lstrcpyA(buf, "apple");
4515 r = pMsiGetProductInfoExA(prodcode, usersid,
4516 MSIINSTALLCONTEXT_USERUNMANAGED,
4517 INSTALLPROPERTY_REGCOMPANY, buf, &sz);
4518 ok(r == ERROR_UNKNOWN_PROPERTY,
4519 "Expected ERROR_UNKNOWN_PROPERTY, got %d\n", r);
4520 ok(!lstrcmpA(buf, "apple"), "Expected buf to be unchanged, got %s\n", buf);
4521 ok(sz == MAX_PATH, "Expected MAX_PATH, got %d\n", sz);
4523 res = RegSetValueExA(prodkey, "RegOwner", 0, REG_SZ, (LPBYTE)"owner", 6);
4524 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
4526 /* RegOwner value exists */
4528 lstrcpyA(buf, "apple");
4529 r = pMsiGetProductInfoExA(prodcode, usersid,
4530 MSIINSTALLCONTEXT_USERUNMANAGED,
4531 INSTALLPROPERTY_REGOWNER, buf, &sz);
4532 ok(r == ERROR_UNKNOWN_PROPERTY,
4533 "Expected ERROR_UNKNOWN_PROPERTY, got %d\n", r);
4534 ok(!lstrcmpA(buf, "apple"), "Expected buf to be unchanged, got %s\n", buf);
4535 ok(sz == MAX_PATH, "Expected MAX_PATH, got %d\n", sz);
4537 res = RegSetValueExA(prodkey, "Transforms", 0, REG_SZ, (LPBYTE)"trans", 6);
4538 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
4540 /* Transforms value exists */
4542 lstrcpyA(buf, "apple");
4543 r = pMsiGetProductInfoExA(prodcode, usersid,
4544 MSIINSTALLCONTEXT_USERUNMANAGED,
4545 INSTALLPROPERTY_TRANSFORMS, buf, &sz);
4546 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
4547 ok(!lstrcmpA(buf, "trans"), "Expected \"trans\", got \"%s\"\n", buf);
4548 ok(sz == 5, "Expected 5, got %d\n", sz);
4550 res = RegSetValueExA(prodkey, "Language", 0, REG_SZ, (LPBYTE)"lang", 5);
4551 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
4553 /* Language value exists */
4555 lstrcpyA(buf, "apple");
4556 r = pMsiGetProductInfoExA(prodcode, usersid,
4557 MSIINSTALLCONTEXT_USERUNMANAGED,
4558 INSTALLPROPERTY_LANGUAGE, buf, &sz);
4559 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
4560 ok(!lstrcmpA(buf, "lang"), "Expected \"lang\", got \"%s\"\n", buf);
4561 ok(sz == 4, "Expected 4, got %d\n", sz);
4563 res = RegSetValueExA(prodkey, "ProductName", 0, REG_SZ, (LPBYTE)"name", 5);
4564 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
4566 /* ProductName value exists */
4568 lstrcpyA(buf, "apple");
4569 r = pMsiGetProductInfoExA(prodcode, usersid,
4570 MSIINSTALLCONTEXT_USERUNMANAGED,
4571 INSTALLPROPERTY_PRODUCTNAME, buf, &sz);
4572 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
4573 ok(!lstrcmpA(buf, "name"), "Expected \"name\", got \"%s\"\n", buf);
4574 ok(sz == 4, "Expected 4, got %d\n", sz);
4576 res = RegSetValueExA(prodkey, "AssignmentType", 0, REG_SZ, (LPBYTE)"type", 5);
4577 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
4581 /* AssignmentType value exists */
4583 lstrcpyA(buf, "apple");
4584 r = pMsiGetProductInfoExA(prodcode, usersid,
4585 MSIINSTALLCONTEXT_USERUNMANAGED,
4586 INSTALLPROPERTY_ASSIGNMENTTYPE, buf, &sz);
4587 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
4588 ok(!lstrcmpA(buf, ""), "Expected \"\", got \"%s\"\n", buf);
4589 ok(sz == 0, "Expected 0, got %d\n", sz);
4591 res = RegSetValueExA(prodkey, "PackageCode", 0, REG_SZ, (LPBYTE)"code", 5);
4592 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
4596 /* PackageCode value exists */
4598 lstrcpyA(buf, "apple");
4599 r = pMsiGetProductInfoExA(prodcode, usersid,
4600 MSIINSTALLCONTEXT_USERUNMANAGED,
4601 INSTALLPROPERTY_PACKAGECODE, buf, &sz);
4604 ok(r == ERROR_BAD_CONFIGURATION,
4605 "Expected ERROR_BAD_CONFIGURATION, got %d\n", r);
4606 ok(!lstrcmpA(buf, "apple"), "Expected buf to be unchanged, got %s\n", buf);
4607 ok(sz == MAX_PATH, "Expected MAX_PATH, got %d\n", sz);
4610 res = RegSetValueExA(prodkey, "Version", 0, REG_SZ, (LPBYTE)"ver", 4);
4611 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
4613 /* Version value exists */
4615 lstrcpyA(buf, "apple");
4616 r = pMsiGetProductInfoExA(prodcode, usersid,
4617 MSIINSTALLCONTEXT_USERUNMANAGED,
4618 INSTALLPROPERTY_VERSION, buf, &sz);
4619 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
4620 ok(!lstrcmpA(buf, "ver"), "Expected \"ver\", got \"%s\"\n", buf);
4621 ok(sz == 3, "Expected 3, got %d\n", sz);
4623 res = RegSetValueExA(prodkey, "ProductIcon", 0, REG_SZ, (LPBYTE)"icon", 5);
4624 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
4626 /* ProductIcon value exists */
4628 lstrcpyA(buf, "apple");
4629 r = pMsiGetProductInfoExA(prodcode, usersid,
4630 MSIINSTALLCONTEXT_USERUNMANAGED,
4631 INSTALLPROPERTY_PRODUCTICON, buf, &sz);
4632 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
4633 ok(!lstrcmpA(buf, "icon"), "Expected \"icon\", got \"%s\"\n", buf);
4634 ok(sz == 4, "Expected 4, got %d\n", sz);
4636 res = RegSetValueExA(prodkey, "PackageName", 0, REG_SZ, (LPBYTE)"name", 5);
4637 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
4639 /* PackageName value exists */
4641 lstrcpyA(buf, "apple");
4642 r = pMsiGetProductInfoExA(prodcode, usersid,
4643 MSIINSTALLCONTEXT_USERUNMANAGED,
4644 INSTALLPROPERTY_PACKAGENAME, buf, &sz);
4647 ok(r == ERROR_UNKNOWN_PRODUCT,
4648 "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r);
4649 ok(!lstrcmpA(buf, "apple"), "Expected buf to be unchanged, got %s\n", buf);
4650 ok(sz == MAX_PATH, "Expected MAX_PATH, got %d\n", sz);
4653 res = RegSetValueExA(prodkey, "AuthorizedLUAApp", 0, REG_SZ, (LPBYTE)"auth", 5);
4654 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
4656 /* AuthorizedLUAApp value exists */
4658 lstrcpyA(buf, "apple");
4659 r = pMsiGetProductInfoExA(prodcode, usersid,
4660 MSIINSTALLCONTEXT_USERUNMANAGED,
4661 INSTALLPROPERTY_AUTHORIZED_LUA_APP, buf, &sz);
4662 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
4663 ok(!lstrcmpA(buf, "auth"), "Expected \"auth\", got \"%s\"\n", buf);
4664 ok(sz == 4, "Expected 4, got %d\n", sz);
4666 RegDeleteValueA(prodkey, "AuthorizedLUAApp");
4667 RegDeleteValueA(prodkey, "PackageName");
4668 RegDeleteValueA(prodkey, "ProductIcon");
4669 RegDeleteValueA(prodkey, "Version");
4670 RegDeleteValueA(prodkey, "PackageCode");
4671 RegDeleteValueA(prodkey, "AssignmentType");
4672 RegDeleteValueA(prodkey, "ProductName");
4673 RegDeleteValueA(prodkey, "Language");
4674 RegDeleteValueA(prodkey, "Transforms");
4675 RegDeleteValueA(prodkey, "RegOwner");
4676 RegDeleteValueA(prodkey, "RegCompany");
4677 RegDeleteValueA(prodkey, "ProductID");
4678 RegDeleteValueA(prodkey, "DisplayVersion");
4679 RegDeleteValueA(prodkey, "VersionMajor");
4680 RegDeleteValueA(prodkey, "VersionMinor");
4681 RegDeleteValueA(prodkey, "URLUpdateInfo");
4682 RegDeleteValueA(prodkey, "URLInfoAbout");
4683 RegDeleteValueA(prodkey, "Publisher");
4684 RegDeleteValueA(prodkey, "LocalPackage");
4685 RegDeleteValueA(prodkey, "InstallSource");
4686 RegDeleteValueA(prodkey, "InstallLocation");
4687 RegDeleteValueA(prodkey, "DisplayName");
4688 RegDeleteValueA(prodkey, "InstallDate");
4689 RegDeleteValueA(prodkey, "HelpTelephone");
4690 RegDeleteValueA(prodkey, "HelpLink");
4691 RegDeleteValueA(prodkey, "LocalPackage");
4692 RegDeleteKeyA(prodkey, "");
4693 RegCloseKey(prodkey);
4695 /* MSIINSTALLCONTEXT_USERMANAGED */
4697 lstrcpyA(keypath, "Software\\Microsoft\\Windows\\CurrentVersion\\Installer\\UserData\\");
4698 lstrcatA(keypath, usersid);
4699 lstrcatA(keypath, "\\Products\\");
4700 lstrcatA(keypath, prod_squashed);
4702 res = RegCreateKeyA(HKEY_LOCAL_MACHINE, keypath, &localkey);
4703 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
4705 /* local user product key exists */
4707 lstrcpyA(buf, "apple");
4708 r = pMsiGetProductInfoExA(prodcode, usersid,
4709 MSIINSTALLCONTEXT_USERMANAGED,
4710 INSTALLPROPERTY_PRODUCTSTATE, buf, &sz);
4711 ok(r == ERROR_UNKNOWN_PRODUCT,
4712 "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r);
4713 ok(!lstrcmpA(buf, "apple"), "Expected buf to be unchanged, got %s\n", buf);
4714 ok(sz == MAX_PATH, "Expected MAX_PATH, got %d\n", sz);
4716 res = RegCreateKeyA(localkey, "InstallProperties", &propkey);
4717 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
4719 /* InstallProperties key exists */
4721 lstrcpyA(buf, "apple");
4722 r = pMsiGetProductInfoExA(prodcode, usersid,
4723 MSIINSTALLCONTEXT_USERMANAGED,
4724 INSTALLPROPERTY_PRODUCTSTATE, buf, &sz);
4725 ok(r == ERROR_UNKNOWN_PRODUCT,
4726 "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r);
4727 ok(!lstrcmpA(buf, "apple"), "Expected buf to be unchanged, got %s\n", buf);
4728 ok(sz == MAX_PATH, "Expected MAX_PATH, got %d\n", sz);
4730 res = RegSetValueExA(propkey, "ManagedLocalPackage", 0, REG_SZ, (LPBYTE)"local", 6);
4731 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
4733 /* ManagedLocalPackage value exists */
4735 lstrcpyA(buf, "apple");
4736 r = pMsiGetProductInfoExA(prodcode, usersid,
4737 MSIINSTALLCONTEXT_USERMANAGED,
4738 INSTALLPROPERTY_PRODUCTSTATE, buf, &sz);
4739 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
4740 ok(!lstrcmpA(buf, "5"), "Expected \"5\", got \"%s\"\n", buf);
4741 ok(sz == 1, "Expected 1, got %d\n", sz);
4743 res = RegSetValueExA(propkey, "HelpLink", 0, REG_SZ, (LPBYTE)"link", 5);
4744 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
4746 /* HelpLink value exists */
4748 lstrcpyA(buf, "apple");
4749 r = pMsiGetProductInfoExA(prodcode, usersid,
4750 MSIINSTALLCONTEXT_USERMANAGED,
4751 INSTALLPROPERTY_HELPLINK, buf, &sz);
4752 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
4753 ok(!lstrcmpA(buf, "link"), "Expected \"link\", got \"%s\"\n", buf);
4754 ok(sz == 4, "Expected 4, got %d\n", sz);
4756 res = RegSetValueExA(propkey, "HelpTelephone", 0, REG_SZ, (LPBYTE)"phone", 6);
4757 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
4759 /* HelpTelephone value exists */
4761 lstrcpyA(buf, "apple");
4762 r = pMsiGetProductInfoExA(prodcode, usersid,
4763 MSIINSTALLCONTEXT_USERMANAGED,
4764 INSTALLPROPERTY_HELPTELEPHONE, buf, &sz);
4765 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
4766 ok(!lstrcmpA(buf, "phone"), "Expected \"phone\", got \"%s\"\n", buf);
4767 ok(sz == 5, "Expected 5, got %d\n", sz);
4769 res = RegSetValueExA(propkey, "InstallDate", 0, REG_SZ, (LPBYTE)"date", 5);
4770 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
4772 /* InstallDate value exists */
4774 lstrcpyA(buf, "apple");
4775 r = pMsiGetProductInfoExA(prodcode, usersid,
4776 MSIINSTALLCONTEXT_USERMANAGED,
4777 INSTALLPROPERTY_INSTALLDATE, buf, &sz);
4778 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
4779 ok(!lstrcmpA(buf, "date"), "Expected \"date\", got \"%s\"\n", buf);
4780 ok(sz == 4, "Expected 4, got %d\n", sz);
4782 res = RegSetValueExA(propkey, "DisplayName", 0, REG_SZ, (LPBYTE)"name", 5);
4783 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
4785 /* DisplayName value exists */
4787 lstrcpyA(buf, "apple");
4788 r = pMsiGetProductInfoExA(prodcode, usersid,
4789 MSIINSTALLCONTEXT_USERMANAGED,
4790 INSTALLPROPERTY_INSTALLEDPRODUCTNAME, buf, &sz);
4791 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
4792 ok(!lstrcmpA(buf, "name"), "Expected \"name\", got \"%s\"\n", buf);
4793 ok(sz == 4, "Expected 4, got %d\n", sz);
4795 res = RegSetValueExA(propkey, "InstallLocation", 0, REG_SZ, (LPBYTE)"loc", 4);
4796 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
4798 /* InstallLocation value exists */
4800 lstrcpyA(buf, "apple");
4801 r = pMsiGetProductInfoExA(prodcode, usersid,
4802 MSIINSTALLCONTEXT_USERMANAGED,
4803 INSTALLPROPERTY_INSTALLLOCATION, buf, &sz);
4804 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
4805 ok(!lstrcmpA(buf, "loc"), "Expected \"loc\", got \"%s\"\n", buf);
4806 ok(sz == 3, "Expected 3, got %d\n", sz);
4808 res = RegSetValueExA(propkey, "InstallSource", 0, REG_SZ, (LPBYTE)"source", 7);
4809 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
4811 /* InstallSource value exists */
4813 lstrcpyA(buf, "apple");
4814 r = pMsiGetProductInfoExA(prodcode, usersid,
4815 MSIINSTALLCONTEXT_USERMANAGED,
4816 INSTALLPROPERTY_INSTALLSOURCE, buf, &sz);
4817 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
4818 ok(!lstrcmpA(buf, "source"), "Expected \"source\", got \"%s\"\n", buf);
4819 ok(sz == 6, "Expected 6, got %d\n", sz);
4821 res = RegSetValueExA(propkey, "LocalPackage", 0, REG_SZ, (LPBYTE)"local", 6);
4822 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
4824 /* LocalPackage value exists */
4826 lstrcpyA(buf, "apple");
4827 r = pMsiGetProductInfoExA(prodcode, usersid,
4828 MSIINSTALLCONTEXT_USERMANAGED,
4829 INSTALLPROPERTY_LOCALPACKAGE, buf, &sz);
4830 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
4831 ok(!lstrcmpA(buf, "local"), "Expected \"local\", got \"%s\"\n", buf);
4832 ok(sz == 5, "Expected 5, got %d\n", sz);
4834 res = RegSetValueExA(propkey, "Publisher", 0, REG_SZ, (LPBYTE)"pub", 4);
4835 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
4837 /* Publisher value exists */
4839 lstrcpyA(buf, "apple");
4840 r = pMsiGetProductInfoExA(prodcode, usersid,
4841 MSIINSTALLCONTEXT_USERMANAGED,
4842 INSTALLPROPERTY_PUBLISHER, buf, &sz);
4843 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
4844 ok(!lstrcmpA(buf, "pub"), "Expected \"pub\", got \"%s\"\n", buf);
4845 ok(sz == 3, "Expected 3, got %d\n", sz);
4847 res = RegSetValueExA(propkey, "URLInfoAbout", 0, REG_SZ, (LPBYTE)"about", 6);
4848 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
4850 /* URLInfoAbout value exists */
4852 lstrcpyA(buf, "apple");
4853 r = pMsiGetProductInfoExA(prodcode, usersid,
4854 MSIINSTALLCONTEXT_USERMANAGED,
4855 INSTALLPROPERTY_URLINFOABOUT, buf, &sz);
4856 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
4857 ok(!lstrcmpA(buf, "about"), "Expected \"about\", got \"%s\"\n", buf);
4858 ok(sz == 5, "Expected 5, got %d\n", sz);
4860 res = RegSetValueExA(propkey, "URLUpdateInfo", 0, REG_SZ, (LPBYTE)"update", 7);
4861 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
4863 /* URLUpdateInfo value exists */
4865 lstrcpyA(buf, "apple");
4866 r = pMsiGetProductInfoExA(prodcode, usersid,
4867 MSIINSTALLCONTEXT_USERMANAGED,
4868 INSTALLPROPERTY_URLUPDATEINFO, buf, &sz);
4869 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
4870 ok(!lstrcmpA(buf, "update"), "Expected \"update\", got \"%s\"\n", buf);
4871 ok(sz == 6, "Expected 6, got %d\n", sz);
4873 res = RegSetValueExA(propkey, "VersionMinor", 0, REG_SZ, (LPBYTE)"2", 2);
4874 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
4876 /* VersionMinor value exists */
4878 lstrcpyA(buf, "apple");
4879 r = pMsiGetProductInfoExA(prodcode, usersid,
4880 MSIINSTALLCONTEXT_USERMANAGED,
4881 INSTALLPROPERTY_VERSIONMINOR, buf, &sz);
4882 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
4883 ok(!lstrcmpA(buf, "2"), "Expected \"2\", got \"%s\"\n", buf);
4884 ok(sz == 1, "Expected 1, got %d\n", sz);
4886 res = RegSetValueExA(propkey, "VersionMajor", 0, REG_SZ, (LPBYTE)"3", 2);
4887 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
4889 /* VersionMajor value exists */
4891 lstrcpyA(buf, "apple");
4892 r = pMsiGetProductInfoExA(prodcode, usersid,
4893 MSIINSTALLCONTEXT_USERMANAGED,
4894 INSTALLPROPERTY_VERSIONMAJOR, buf, &sz);
4895 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
4896 ok(!lstrcmpA(buf, "3"), "Expected \"3\", got \"%s\"\n", buf);
4897 ok(sz == 1, "Expected 1, got %d\n", sz);
4899 res = RegSetValueExA(propkey, "DisplayVersion", 0, REG_SZ, (LPBYTE)"3.2.1", 6);
4900 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
4902 /* DisplayVersion value exists */
4904 lstrcpyA(buf, "apple");
4905 r = pMsiGetProductInfoExA(prodcode, usersid,
4906 MSIINSTALLCONTEXT_USERMANAGED,
4907 INSTALLPROPERTY_VERSIONSTRING, buf, &sz);
4908 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
4909 ok(!lstrcmpA(buf, "3.2.1"), "Expected \"3.2.1\", got \"%s\"\n", buf);
4910 ok(sz == 5, "Expected 5, got %d\n", sz);
4912 res = RegSetValueExA(propkey, "ProductID", 0, REG_SZ, (LPBYTE)"id", 3);
4913 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
4915 /* ProductID value exists */
4917 lstrcpyA(buf, "apple");
4918 r = pMsiGetProductInfoExA(prodcode, usersid,
4919 MSIINSTALLCONTEXT_USERMANAGED,
4920 INSTALLPROPERTY_PRODUCTID, buf, &sz);
4921 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
4922 ok(!lstrcmpA(buf, "id"), "Expected \"id\", got \"%s\"\n", buf);
4923 ok(sz == 2, "Expected 2, got %d\n", sz);
4925 res = RegSetValueExA(propkey, "RegCompany", 0, REG_SZ, (LPBYTE)"comp", 5);
4926 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
4928 /* RegCompany value exists */
4930 lstrcpyA(buf, "apple");
4931 r = pMsiGetProductInfoExA(prodcode, usersid,
4932 MSIINSTALLCONTEXT_USERMANAGED,
4933 INSTALLPROPERTY_REGCOMPANY, buf, &sz);
4934 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
4935 ok(!lstrcmpA(buf, "comp"), "Expected \"comp\", got \"%s\"\n", buf);
4936 ok(sz == 4, "Expected 4, got %d\n", sz);
4938 res = RegSetValueExA(propkey, "RegOwner", 0, REG_SZ, (LPBYTE)"owner", 6);
4939 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
4941 /* RegOwner value exists */
4943 lstrcpyA(buf, "apple");
4944 r = pMsiGetProductInfoExA(prodcode, usersid,
4945 MSIINSTALLCONTEXT_USERMANAGED,
4946 INSTALLPROPERTY_REGOWNER, buf, &sz);
4947 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
4948 ok(!lstrcmpA(buf, "owner"), "Expected \"owner\", got \"%s\"\n", buf);
4949 ok(sz == 5, "Expected 5, got %d\n", sz);
4951 res = RegSetValueExA(propkey, "Transforms", 0, REG_SZ, (LPBYTE)"trans", 6);
4952 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
4954 /* Transforms value exists */
4956 lstrcpyA(buf, "apple");
4957 r = pMsiGetProductInfoExA(prodcode, usersid,
4958 MSIINSTALLCONTEXT_USERMANAGED,
4959 INSTALLPROPERTY_TRANSFORMS, buf, &sz);
4960 ok(r == ERROR_UNKNOWN_PRODUCT,
4961 "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r);
4962 ok(!lstrcmpA(buf, "apple"), "Expected buf to be unchanged, got %s\n", buf);
4963 ok(sz == MAX_PATH, "Expected MAX_PATH, got %d\n", sz);
4965 res = RegSetValueExA(propkey, "Language", 0, REG_SZ, (LPBYTE)"lang", 5);
4966 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
4968 /* Language value exists */
4970 lstrcpyA(buf, "apple");
4971 r = pMsiGetProductInfoExA(prodcode, usersid,
4972 MSIINSTALLCONTEXT_USERMANAGED,
4973 INSTALLPROPERTY_LANGUAGE, buf, &sz);
4974 ok(r == ERROR_UNKNOWN_PRODUCT,
4975 "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r);
4976 ok(!lstrcmpA(buf, "apple"), "Expected buf to be unchanged, got %s\n", buf);
4977 ok(sz == MAX_PATH, "Expected MAX_PATH, got %d\n", sz);
4979 res = RegSetValueExA(propkey, "ProductName", 0, REG_SZ, (LPBYTE)"name", 5);
4980 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
4982 /* ProductName value exists */
4984 lstrcpyA(buf, "apple");
4985 r = pMsiGetProductInfoExA(prodcode, usersid,
4986 MSIINSTALLCONTEXT_USERMANAGED,
4987 INSTALLPROPERTY_PRODUCTNAME, buf, &sz);
4988 ok(r == ERROR_UNKNOWN_PRODUCT,
4989 "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r);
4990 ok(!lstrcmpA(buf, "apple"), "Expected buf to be unchanged, got %s\n", buf);
4991 ok(sz == MAX_PATH, "Expected MAX_PATH, got %d\n", sz);
4993 res = RegSetValueExA(propkey, "AssignmentType", 0, REG_SZ, (LPBYTE)"type", 5);
4994 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
4998 /* AssignmentType value exists */
5000 lstrcpyA(buf, "apple");
5001 r = pMsiGetProductInfoExA(prodcode, usersid,
5002 MSIINSTALLCONTEXT_USERMANAGED,
5003 INSTALLPROPERTY_ASSIGNMENTTYPE, buf, &sz);
5004 ok(r == ERROR_UNKNOWN_PRODUCT,
5005 "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r);
5006 ok(!lstrcmpA(buf, "apple"), "Expected buf to be unchanged, got %s\n", buf);
5007 ok(sz == MAX_PATH, "Expected MAX_PATH, got %d\n", sz);
5009 res = RegSetValueExA(propkey, "PackageCode", 0, REG_SZ, (LPBYTE)"code", 5);
5010 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
5012 /* PackageCode value exists */
5014 lstrcpyA(buf, "apple");
5015 r = pMsiGetProductInfoExA(prodcode, usersid,
5016 MSIINSTALLCONTEXT_USERMANAGED,
5017 INSTALLPROPERTY_PACKAGECODE, buf, &sz);
5018 ok(r == ERROR_UNKNOWN_PRODUCT,
5019 "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r);
5020 ok(!lstrcmpA(buf, "apple"), "Expected buf to be unchanged, got %s\n", buf);
5021 ok(sz == MAX_PATH, "Expected MAX_PATH, got %d\n", sz);
5023 res = RegSetValueExA(propkey, "Version", 0, REG_SZ, (LPBYTE)"ver", 4);
5024 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
5026 /* Version value exists */
5028 lstrcpyA(buf, "apple");
5029 r = pMsiGetProductInfoExA(prodcode, usersid,
5030 MSIINSTALLCONTEXT_USERMANAGED,
5031 INSTALLPROPERTY_VERSION, buf, &sz);
5032 ok(r == ERROR_UNKNOWN_PRODUCT,
5033 "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r);
5034 ok(!lstrcmpA(buf, "apple"), "Expected buf to be unchanged, got %s\n", buf);
5035 ok(sz == MAX_PATH, "Expected MAX_PATH, got %d\n", sz);
5037 res = RegSetValueExA(propkey, "ProductIcon", 0, REG_SZ, (LPBYTE)"icon", 5);
5038 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
5040 /* ProductIcon value exists */
5042 lstrcpyA(buf, "apple");
5043 r = pMsiGetProductInfoExA(prodcode, usersid,
5044 MSIINSTALLCONTEXT_USERMANAGED,
5045 INSTALLPROPERTY_PRODUCTICON, buf, &sz);
5046 ok(r == ERROR_UNKNOWN_PRODUCT,
5047 "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r);
5048 ok(!lstrcmpA(buf, "apple"), "Expected buf to be unchanged, got %s\n", buf);
5049 ok(sz == MAX_PATH, "Expected MAX_PATH, got %d\n", sz);
5051 res = RegSetValueExA(propkey, "PackageName", 0, REG_SZ, (LPBYTE)"name", 5);
5052 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
5054 /* PackageName value exists */
5056 lstrcpyA(buf, "apple");
5057 r = pMsiGetProductInfoExA(prodcode, usersid,
5058 MSIINSTALLCONTEXT_USERMANAGED,
5059 INSTALLPROPERTY_PACKAGENAME, buf, &sz);
5060 ok(r == ERROR_UNKNOWN_PRODUCT,
5061 "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r);
5062 ok(!lstrcmpA(buf, "apple"), "Expected buf to be unchanged, got %s\n", buf);
5063 ok(sz == MAX_PATH, "Expected MAX_PATH, got %d\n", sz);
5065 res = RegSetValueExA(propkey, "AuthorizedLUAApp", 0, REG_SZ, (LPBYTE)"auth", 5);
5066 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
5068 /* AuthorizedLUAApp value exists */
5070 lstrcpyA(buf, "apple");
5071 r = pMsiGetProductInfoExA(prodcode, usersid,
5072 MSIINSTALLCONTEXT_USERMANAGED,
5073 INSTALLPROPERTY_AUTHORIZED_LUA_APP, buf, &sz);
5074 ok(r == ERROR_UNKNOWN_PRODUCT,
5075 "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r);
5076 ok(!lstrcmpA(buf, "apple"), "Expected buf to be unchanged, got %s\n", buf);
5077 ok(sz == MAX_PATH, "Expected MAX_PATH, got %d\n", sz);
5079 RegDeleteValueA(propkey, "AuthorizedLUAApp");
5080 RegDeleteValueA(propkey, "PackageName");
5081 RegDeleteValueA(propkey, "ProductIcon");
5082 RegDeleteValueA(propkey, "Version");
5083 RegDeleteValueA(propkey, "PackageCode");
5084 RegDeleteValueA(propkey, "AssignmentType");
5085 RegDeleteValueA(propkey, "ProductName");
5086 RegDeleteValueA(propkey, "Language");
5087 RegDeleteValueA(propkey, "Transforms");
5088 RegDeleteValueA(propkey, "RegOwner");
5089 RegDeleteValueA(propkey, "RegCompany");
5090 RegDeleteValueA(propkey, "ProductID");
5091 RegDeleteValueA(propkey, "DisplayVersion");
5092 RegDeleteValueA(propkey, "VersionMajor");
5093 RegDeleteValueA(propkey, "VersionMinor");
5094 RegDeleteValueA(propkey, "URLUpdateInfo");
5095 RegDeleteValueA(propkey, "URLInfoAbout");
5096 RegDeleteValueA(propkey, "Publisher");
5097 RegDeleteValueA(propkey, "LocalPackage");
5098 RegDeleteValueA(propkey, "InstallSource");
5099 RegDeleteValueA(propkey, "InstallLocation");
5100 RegDeleteValueA(propkey, "DisplayName");
5101 RegDeleteValueA(propkey, "InstallDate");
5102 RegDeleteValueA(propkey, "HelpTelephone");
5103 RegDeleteValueA(propkey, "HelpLink");
5104 RegDeleteValueA(propkey, "ManagedLocalPackage");
5105 RegDeleteKeyA(propkey, "");
5106 RegCloseKey(propkey);
5107 RegDeleteKeyA(localkey, "");
5108 RegCloseKey(localkey);
5110 lstrcpyA(keypath, "Software\\Microsoft\\Windows\\CurrentVersion\\Installer\\Managed\\");
5111 lstrcatA(keypath, usersid);
5112 lstrcatA(keypath, "\\Installer\\Products\\");
5113 lstrcatA(keypath, prod_squashed);
5115 res = RegCreateKeyA(HKEY_LOCAL_MACHINE, keypath, &userkey);
5116 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
5118 /* user product key exists */
5120 lstrcpyA(buf, "apple");
5121 r = pMsiGetProductInfoExA(prodcode, usersid,
5122 MSIINSTALLCONTEXT_USERMANAGED,
5123 INSTALLPROPERTY_PRODUCTSTATE, buf, &sz);
5124 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
5125 ok(!lstrcmpA(buf, "1"), "Expected \"1\", got \"%s\"\n", buf);
5126 ok(sz == 1, "Expected 1, got %d\n", sz);
5128 RegDeleteKeyA(userkey, "");
5129 RegCloseKey(userkey);
5131 lstrcpyA(keypath, "Software\\Microsoft\\Installer\\Products\\");
5132 lstrcatA(keypath, prod_squashed);
5134 res = RegCreateKeyA(HKEY_CURRENT_USER, keypath, &prodkey);
5135 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
5137 /* current user product key exists */
5139 lstrcpyA(buf, "apple");
5140 r = pMsiGetProductInfoExA(prodcode, usersid,
5141 MSIINSTALLCONTEXT_USERMANAGED,
5142 INSTALLPROPERTY_PRODUCTSTATE, buf, &sz);
5143 ok(r == ERROR_UNKNOWN_PRODUCT,
5144 "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r);
5145 ok(!lstrcmpA(buf, "apple"), "Expected buf to be unchanged, got %s\n", buf);
5146 ok(sz == MAX_PATH, "Expected MAX_PATH, got %d\n", sz);
5148 res = RegSetValueExA(prodkey, "HelpLink", 0, REG_SZ, (LPBYTE)"link", 5);
5149 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
5151 /* HelpLink value exists, user product key does not exist */
5153 lstrcpyA(buf, "apple");
5154 r = pMsiGetProductInfoExA(prodcode, usersid,
5155 MSIINSTALLCONTEXT_USERMANAGED,
5156 INSTALLPROPERTY_HELPLINK, buf, &sz);
5157 ok(r == ERROR_UNKNOWN_PRODUCT,
5158 "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r);
5159 ok(!lstrcmpA(buf, "apple"), "Expected buf to be unchanged, got %s\n", buf);
5160 ok(sz == MAX_PATH, "Expected MAX_PATH, got %d\n", sz);
5162 lstrcpyA(keypath, "Software\\Microsoft\\Windows\\CurrentVersion\\Installer\\Managed\\");
5163 lstrcatA(keypath, usersid);
5164 lstrcatA(keypath, "\\Installer\\Products\\");
5165 lstrcatA(keypath, prod_squashed);
5167 res = RegCreateKeyA(HKEY_LOCAL_MACHINE, keypath, &userkey);
5168 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
5170 res = RegSetValueExA(userkey, "HelpLink", 0, REG_SZ, (LPBYTE)"link", 5);
5171 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
5173 /* HelpLink value exists, user product key does exist */
5175 lstrcpyA(buf, "apple");
5176 r = pMsiGetProductInfoExA(prodcode, usersid,
5177 MSIINSTALLCONTEXT_USERMANAGED,
5178 INSTALLPROPERTY_HELPLINK, buf, &sz);
5179 ok(r == ERROR_UNKNOWN_PROPERTY,
5180 "Expected ERROR_UNKNOWN_PROPERTY, got %d\n", r);
5181 ok(!lstrcmpA(buf, "apple"), "Expected buf to be unchanged, got %s\n", buf);
5182 ok(sz == MAX_PATH, "Expected MAX_PATH, got %d\n", sz);
5184 res = RegSetValueExA(userkey, "HelpTelephone", 0, REG_SZ, (LPBYTE)"phone", 6);
5185 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
5187 /* HelpTelephone value exists */
5189 lstrcpyA(buf, "apple");
5190 r = pMsiGetProductInfoExA(prodcode, usersid,
5191 MSIINSTALLCONTEXT_USERMANAGED,
5192 INSTALLPROPERTY_HELPTELEPHONE, buf, &sz);
5193 ok(r == ERROR_UNKNOWN_PROPERTY,
5194 "Expected ERROR_UNKNOWN_PROPERTY, got %d\n", r);
5195 ok(!lstrcmpA(buf, "apple"), "Expected buf to be unchanged, got %s\n", buf);
5196 ok(sz == MAX_PATH, "Expected MAX_PATH, got %d\n", sz);
5198 res = RegSetValueExA(userkey, "InstallDate", 0, REG_SZ, (LPBYTE)"date", 5);
5199 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
5201 /* InstallDate value exists */
5203 lstrcpyA(buf, "apple");
5204 r = pMsiGetProductInfoExA(prodcode, usersid,
5205 MSIINSTALLCONTEXT_USERMANAGED,
5206 INSTALLPROPERTY_INSTALLDATE, buf, &sz);
5207 ok(r == ERROR_UNKNOWN_PROPERTY,
5208 "Expected ERROR_UNKNOWN_PROPERTY, got %d\n", r);
5209 ok(!lstrcmpA(buf, "apple"), "Expected buf to be unchanged, got %s\n", buf);
5210 ok(sz == MAX_PATH, "Expected MAX_PATH, got %d\n", sz);
5212 res = RegSetValueExA(userkey, "DisplayName", 0, REG_SZ, (LPBYTE)"name", 5);
5213 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
5215 /* DisplayName value exists */
5217 lstrcpyA(buf, "apple");
5218 r = pMsiGetProductInfoExA(prodcode, usersid,
5219 MSIINSTALLCONTEXT_USERMANAGED,
5220 INSTALLPROPERTY_INSTALLEDPRODUCTNAME, buf, &sz);
5221 ok(r == ERROR_UNKNOWN_PROPERTY,
5222 "Expected ERROR_UNKNOWN_PROPERTY, got %d\n", r);
5223 ok(!lstrcmpA(buf, "apple"), "Expected buf to be unchanged, got %s\n", buf);
5224 ok(sz == MAX_PATH, "Expected MAX_PATH, got %d\n", sz);
5226 res = RegSetValueExA(userkey, "InstallLocation", 0, REG_SZ, (LPBYTE)"loc", 4);
5227 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
5229 /* InstallLocation value exists */
5231 lstrcpyA(buf, "apple");
5232 r = pMsiGetProductInfoExA(prodcode, usersid,
5233 MSIINSTALLCONTEXT_USERMANAGED,
5234 INSTALLPROPERTY_INSTALLLOCATION, buf, &sz);
5235 ok(r == ERROR_UNKNOWN_PROPERTY,
5236 "Expected ERROR_UNKNOWN_PROPERTY, got %d\n", r);
5237 ok(!lstrcmpA(buf, "apple"), "Expected buf to be unchanged, got %s\n", buf);
5238 ok(sz == MAX_PATH, "Expected MAX_PATH, got %d\n", sz);
5240 res = RegSetValueExA(userkey, "InstallSource", 0, REG_SZ, (LPBYTE)"source", 7);
5241 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
5243 /* InstallSource value exists */
5245 lstrcpyA(buf, "apple");
5246 r = pMsiGetProductInfoExA(prodcode, usersid,
5247 MSIINSTALLCONTEXT_USERMANAGED,
5248 INSTALLPROPERTY_INSTALLSOURCE, buf, &sz);
5249 ok(r == ERROR_UNKNOWN_PROPERTY,
5250 "Expected ERROR_UNKNOWN_PROPERTY, got %d\n", r);
5251 ok(!lstrcmpA(buf, "apple"), "Expected buf to be unchanged, got %s\n", buf);
5252 ok(sz == MAX_PATH, "Expected MAX_PATH, got %d\n", sz);
5254 res = RegSetValueExA(userkey, "LocalPackage", 0, REG_SZ, (LPBYTE)"local", 6);
5255 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
5257 /* LocalPackage value exists */
5259 lstrcpyA(buf, "apple");
5260 r = pMsiGetProductInfoExA(prodcode, usersid,
5261 MSIINSTALLCONTEXT_USERMANAGED,
5262 INSTALLPROPERTY_LOCALPACKAGE, buf, &sz);
5263 ok(r == ERROR_UNKNOWN_PROPERTY,
5264 "Expected ERROR_UNKNOWN_PROPERTY, got %d\n", r);
5265 ok(!lstrcmpA(buf, "apple"), "Expected buf to be unchanged, got %s\n", buf);
5266 ok(sz == MAX_PATH, "Expected MAX_PATH, got %d\n", sz);
5268 res = RegSetValueExA(userkey, "Publisher", 0, REG_SZ, (LPBYTE)"pub", 4);
5269 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
5271 /* Publisher value exists */
5273 lstrcpyA(buf, "apple");
5274 r = pMsiGetProductInfoExA(prodcode, usersid,
5275 MSIINSTALLCONTEXT_USERMANAGED,
5276 INSTALLPROPERTY_PUBLISHER, buf, &sz);
5277 ok(r == ERROR_UNKNOWN_PROPERTY,
5278 "Expected ERROR_UNKNOWN_PROPERTY, got %d\n", r);
5279 ok(!lstrcmpA(buf, "apple"), "Expected buf to be unchanged, got %s\n", buf);
5280 ok(sz == MAX_PATH, "Expected MAX_PATH, got %d\n", sz);
5282 res = RegSetValueExA(userkey, "URLInfoAbout", 0, REG_SZ, (LPBYTE)"about", 6);
5283 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
5285 /* URLInfoAbout value exists */
5287 lstrcpyA(buf, "apple");
5288 r = pMsiGetProductInfoExA(prodcode, usersid,
5289 MSIINSTALLCONTEXT_USERMANAGED,
5290 INSTALLPROPERTY_URLINFOABOUT, buf, &sz);
5291 ok(r == ERROR_UNKNOWN_PROPERTY,
5292 "Expected ERROR_UNKNOWN_PROPERTY, got %d\n", r);
5293 ok(!lstrcmpA(buf, "apple"), "Expected buf to be unchanged, got %s\n", buf);
5294 ok(sz == MAX_PATH, "Expected MAX_PATH, got %d\n", sz);
5296 res = RegSetValueExA(userkey, "URLUpdateInfo", 0, REG_SZ, (LPBYTE)"update", 7);
5297 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
5299 /* URLUpdateInfo value exists */
5301 lstrcpyA(buf, "apple");
5302 r = pMsiGetProductInfoExA(prodcode, usersid,
5303 MSIINSTALLCONTEXT_USERMANAGED,
5304 INSTALLPROPERTY_URLUPDATEINFO, buf, &sz);
5305 ok(r == ERROR_UNKNOWN_PROPERTY,
5306 "Expected ERROR_UNKNOWN_PROPERTY, got %d\n", r);
5307 ok(!lstrcmpA(buf, "apple"), "Expected buf to be unchanged, got %s\n", buf);
5308 ok(sz == MAX_PATH, "Expected MAX_PATH, got %d\n", sz);
5310 res = RegSetValueExA(userkey, "VersionMinor", 0, REG_SZ, (LPBYTE)"2", 2);
5311 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
5313 /* VersionMinor value exists */
5315 lstrcpyA(buf, "apple");
5316 r = pMsiGetProductInfoExA(prodcode, usersid,
5317 MSIINSTALLCONTEXT_USERMANAGED,
5318 INSTALLPROPERTY_VERSIONMINOR, buf, &sz);
5319 ok(r == ERROR_UNKNOWN_PROPERTY,
5320 "Expected ERROR_UNKNOWN_PROPERTY, got %d\n", r);
5321 ok(!lstrcmpA(buf, "apple"), "Expected buf to be unchanged, got %s\n", buf);
5322 ok(sz == MAX_PATH, "Expected MAX_PATH, got %d\n", sz);
5324 res = RegSetValueExA(userkey, "VersionMajor", 0, REG_SZ, (LPBYTE)"3", 2);
5325 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
5327 /* VersionMajor value exists */
5329 lstrcpyA(buf, "apple");
5330 r = pMsiGetProductInfoExA(prodcode, usersid,
5331 MSIINSTALLCONTEXT_USERMANAGED,
5332 INSTALLPROPERTY_VERSIONMAJOR, buf, &sz);
5333 ok(r == ERROR_UNKNOWN_PROPERTY,
5334 "Expected ERROR_UNKNOWN_PROPERTY, got %d\n", r);
5335 ok(!lstrcmpA(buf, "apple"), "Expected buf to be unchanged, got %s\n", buf);
5336 ok(sz == MAX_PATH, "Expected MAX_PATH, got %d\n", sz);
5338 res = RegSetValueExA(userkey, "DisplayVersion", 0, REG_SZ, (LPBYTE)"3.2.1", 6);
5339 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
5341 /* DisplayVersion value exists */
5343 lstrcpyA(buf, "apple");
5344 r = pMsiGetProductInfoExA(prodcode, usersid,
5345 MSIINSTALLCONTEXT_USERMANAGED,
5346 INSTALLPROPERTY_VERSIONSTRING, buf, &sz);
5347 ok(r == ERROR_UNKNOWN_PROPERTY,
5348 "Expected ERROR_UNKNOWN_PROPERTY, got %d\n", r);
5349 ok(!lstrcmpA(buf, "apple"), "Expected buf to be unchanged, got %s\n", buf);
5350 ok(sz == MAX_PATH, "Expected MAX_PATH, got %d\n", sz);
5352 res = RegSetValueExA(userkey, "ProductID", 0, REG_SZ, (LPBYTE)"id", 3);
5353 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
5355 /* ProductID value exists */
5357 lstrcpyA(buf, "apple");
5358 r = pMsiGetProductInfoExA(prodcode, usersid,
5359 MSIINSTALLCONTEXT_USERMANAGED,
5360 INSTALLPROPERTY_PRODUCTID, buf, &sz);
5361 ok(r == ERROR_UNKNOWN_PROPERTY,
5362 "Expected ERROR_UNKNOWN_PROPERTY, got %d\n", r);
5363 ok(!lstrcmpA(buf, "apple"), "Expected buf to be unchanged, got %s\n", buf);
5364 ok(sz == MAX_PATH, "Expected MAX_PATH, got %d\n", sz);
5366 res = RegSetValueExA(userkey, "RegCompany", 0, REG_SZ, (LPBYTE)"comp", 5);
5367 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
5369 /* RegCompany value exists */
5371 lstrcpyA(buf, "apple");
5372 r = pMsiGetProductInfoExA(prodcode, usersid,
5373 MSIINSTALLCONTEXT_USERMANAGED,
5374 INSTALLPROPERTY_REGCOMPANY, buf, &sz);
5375 ok(r == ERROR_UNKNOWN_PROPERTY,
5376 "Expected ERROR_UNKNOWN_PROPERTY, got %d\n", r);
5377 ok(!lstrcmpA(buf, "apple"), "Expected buf to be unchanged, got %s\n", buf);
5378 ok(sz == MAX_PATH, "Expected MAX_PATH, got %d\n", sz);
5380 res = RegSetValueExA(userkey, "RegOwner", 0, REG_SZ, (LPBYTE)"owner", 6);
5381 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
5383 /* RegOwner value exists */
5385 lstrcpyA(buf, "apple");
5386 r = pMsiGetProductInfoExA(prodcode, usersid,
5387 MSIINSTALLCONTEXT_USERMANAGED,
5388 INSTALLPROPERTY_REGOWNER, buf, &sz);
5389 ok(r == ERROR_UNKNOWN_PROPERTY,
5390 "Expected ERROR_UNKNOWN_PROPERTY, got %d\n", r);
5391 ok(!lstrcmpA(buf, "apple"), "Expected buf to be unchanged, got %s\n", buf);
5392 ok(sz == MAX_PATH, "Expected MAX_PATH, got %d\n", sz);
5394 res = RegSetValueExA(userkey, "Transforms", 0, REG_SZ, (LPBYTE)"trans", 6);
5395 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
5397 /* Transforms value exists */
5399 lstrcpyA(buf, "apple");
5400 r = pMsiGetProductInfoExA(prodcode, usersid,
5401 MSIINSTALLCONTEXT_USERMANAGED,
5402 INSTALLPROPERTY_TRANSFORMS, buf, &sz);
5403 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
5404 ok(!lstrcmpA(buf, "trans"), "Expected \"trans\", got \"%s\"\n", buf);
5405 ok(sz == 5, "Expected 5, got %d\n", sz);
5407 res = RegSetValueExA(userkey, "Language", 0, REG_SZ, (LPBYTE)"lang", 5);
5408 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
5410 /* Language value exists */
5412 lstrcpyA(buf, "apple");
5413 r = pMsiGetProductInfoExA(prodcode, usersid,
5414 MSIINSTALLCONTEXT_USERMANAGED,
5415 INSTALLPROPERTY_LANGUAGE, buf, &sz);
5416 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
5417 ok(!lstrcmpA(buf, "lang"), "Expected \"lang\", got \"%s\"\n", buf);
5418 ok(sz == 4, "Expected 4, got %d\n", sz);
5420 res = RegSetValueExA(userkey, "ProductName", 0, REG_SZ, (LPBYTE)"name", 5);
5421 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
5423 /* ProductName value exists */
5425 lstrcpyA(buf, "apple");
5426 r = pMsiGetProductInfoExA(prodcode, usersid,
5427 MSIINSTALLCONTEXT_USERMANAGED,
5428 INSTALLPROPERTY_PRODUCTNAME, buf, &sz);
5429 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
5430 ok(!lstrcmpA(buf, "name"), "Expected \"name\", got \"%s\"\n", buf);
5431 ok(sz == 4, "Expected 4, got %d\n", sz);
5433 res = RegSetValueExA(userkey, "AssignmentType", 0, REG_SZ, (LPBYTE)"type", 5);
5434 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
5438 /* AssignmentType value exists */
5440 lstrcpyA(buf, "apple");
5441 r = pMsiGetProductInfoExA(prodcode, usersid,
5442 MSIINSTALLCONTEXT_USERMANAGED,
5443 INSTALLPROPERTY_ASSIGNMENTTYPE, buf, &sz);
5444 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
5445 ok(!lstrcmpA(buf, ""), "Expected \"\", got \"%s\"\n", buf);
5446 ok(sz == 0, "Expected 0, got %d\n", sz);
5448 res = RegSetValueExA(userkey, "PackageCode", 0, REG_SZ, (LPBYTE)"code", 5);
5449 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
5453 /* PackageCode value exists */
5455 lstrcpyA(buf, "apple");
5456 r = pMsiGetProductInfoExA(prodcode, usersid,
5457 MSIINSTALLCONTEXT_USERMANAGED,
5458 INSTALLPROPERTY_PACKAGECODE, buf, &sz);
5461 ok(r == ERROR_BAD_CONFIGURATION,
5462 "Expected ERROR_BAD_CONFIGURATION, got %d\n", r);
5463 ok(!lstrcmpA(buf, "apple"), "Expected buf to be unchanged, got %s\n", buf);
5464 ok(sz == MAX_PATH, "Expected MAX_PATH, got %d\n", sz);
5467 res = RegSetValueExA(userkey, "Version", 0, REG_SZ, (LPBYTE)"ver", 4);
5468 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
5470 /* Version value exists */
5472 lstrcpyA(buf, "apple");
5473 r = pMsiGetProductInfoExA(prodcode, usersid,
5474 MSIINSTALLCONTEXT_USERMANAGED,
5475 INSTALLPROPERTY_VERSION, buf, &sz);
5476 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
5477 ok(!lstrcmpA(buf, "ver"), "Expected \"ver\", got \"%s\"\n", buf);
5478 ok(sz == 3, "Expected 3, got %d\n", sz);
5480 res = RegSetValueExA(userkey, "ProductIcon", 0, REG_SZ, (LPBYTE)"icon", 5);
5481 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
5483 /* ProductIcon value exists */
5485 lstrcpyA(buf, "apple");
5486 r = pMsiGetProductInfoExA(prodcode, usersid,
5487 MSIINSTALLCONTEXT_USERMANAGED,
5488 INSTALLPROPERTY_PRODUCTICON, buf, &sz);
5489 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
5490 ok(!lstrcmpA(buf, "icon"), "Expected \"icon\", got \"%s\"\n", buf);
5491 ok(sz == 4, "Expected 4, got %d\n", sz);
5493 res = RegSetValueExA(userkey, "PackageName", 0, REG_SZ, (LPBYTE)"name", 5);
5494 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
5496 /* PackageName value exists */
5498 lstrcpyA(buf, "apple");
5499 r = pMsiGetProductInfoExA(prodcode, usersid,
5500 MSIINSTALLCONTEXT_USERMANAGED,
5501 INSTALLPROPERTY_PACKAGENAME, buf, &sz);
5504 ok(r == ERROR_UNKNOWN_PRODUCT,
5505 "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r);
5506 ok(!lstrcmpA(buf, "apple"), "Expected buf to be unchanged, got %s\n", buf);
5507 ok(sz == MAX_PATH, "Expected MAX_PATH, got %d\n", sz);
5510 res = RegSetValueExA(userkey, "AuthorizedLUAApp", 0, REG_SZ, (LPBYTE)"auth", 5);
5511 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
5513 /* AuthorizedLUAApp value exists */
5515 lstrcpyA(buf, "apple");
5516 r = pMsiGetProductInfoExA(prodcode, usersid,
5517 MSIINSTALLCONTEXT_USERMANAGED,
5518 INSTALLPROPERTY_AUTHORIZED_LUA_APP, buf, &sz);
5519 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
5520 ok(!lstrcmpA(buf, "auth"), "Expected \"auth\", got \"%s\"\n", buf);
5521 ok(sz == 4, "Expected 4, got %d\n", sz);
5523 RegDeleteValueA(userkey, "AuthorizedLUAApp");
5524 RegDeleteValueA(userkey, "PackageName");
5525 RegDeleteValueA(userkey, "ProductIcon");
5526 RegDeleteValueA(userkey, "Version");
5527 RegDeleteValueA(userkey, "PackageCode");
5528 RegDeleteValueA(userkey, "AssignmentType");
5529 RegDeleteValueA(userkey, "ProductName");
5530 RegDeleteValueA(userkey, "Language");
5531 RegDeleteValueA(userkey, "Transforms");
5532 RegDeleteValueA(userkey, "RegOwner");
5533 RegDeleteValueA(userkey, "RegCompany");
5534 RegDeleteValueA(userkey, "ProductID");
5535 RegDeleteValueA(userkey, "DisplayVersion");
5536 RegDeleteValueA(userkey, "VersionMajor");
5537 RegDeleteValueA(userkey, "VersionMinor");
5538 RegDeleteValueA(userkey, "URLUpdateInfo");
5539 RegDeleteValueA(userkey, "URLInfoAbout");
5540 RegDeleteValueA(userkey, "Publisher");
5541 RegDeleteValueA(userkey, "LocalPackage");
5542 RegDeleteValueA(userkey, "InstallSource");
5543 RegDeleteValueA(userkey, "InstallLocation");
5544 RegDeleteValueA(userkey, "DisplayName");
5545 RegDeleteValueA(userkey, "InstallDate");
5546 RegDeleteValueA(userkey, "HelpTelephone");
5547 RegDeleteValueA(userkey, "HelpLink");
5548 RegDeleteKeyA(userkey, "");
5549 RegCloseKey(userkey);
5550 RegDeleteKeyA(prodkey, "");
5551 RegCloseKey(prodkey);
5553 /* MSIINSTALLCONTEXT_MACHINE */
5555 /* szUserSid is non-NULL */
5557 lstrcpyA(buf, "apple");
5558 r = pMsiGetProductInfoExA(prodcode, usersid,
5559 MSIINSTALLCONTEXT_MACHINE,
5560 INSTALLPROPERTY_PRODUCTSTATE, buf, &sz);
5561 ok(r == ERROR_INVALID_PARAMETER,
5562 "Expected ERROR_INVALID_PARAMETER, got %d\n", r);
5563 ok(!lstrcmpA(buf, "apple"), "Expected buf to be unchanged, got %s\n", buf);
5564 ok(sz == MAX_PATH, "Expected MAX_PATH, got %d\n", sz);
5566 lstrcpyA(keypath, "Software\\Microsoft\\Windows\\CurrentVersion\\Installer\\UserData\\S-1-5-18\\Products\\");
5567 lstrcatA(keypath, prod_squashed);
5569 res = RegCreateKeyA(HKEY_LOCAL_MACHINE, keypath, &localkey);
5570 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
5572 /* local system product key exists */
5574 lstrcpyA(buf, "apple");
5575 r = pMsiGetProductInfoExA(prodcode, NULL,
5576 MSIINSTALLCONTEXT_MACHINE,
5577 INSTALLPROPERTY_PRODUCTSTATE, buf, &sz);
5578 ok(r == ERROR_UNKNOWN_PRODUCT,
5579 "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r);
5580 ok(!lstrcmpA(buf, "apple"), "Expected buf to be unchanged, got %s\n", buf);
5581 ok(sz == MAX_PATH, "Expected MAX_PATH, got %d\n", sz);
5583 res = RegCreateKeyA(localkey, "InstallProperties", &propkey);
5584 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
5586 /* InstallProperties key exists */
5588 lstrcpyA(buf, "apple");
5589 r = pMsiGetProductInfoExA(prodcode, NULL,
5590 MSIINSTALLCONTEXT_MACHINE,
5591 INSTALLPROPERTY_PRODUCTSTATE, buf, &sz);
5592 ok(r == ERROR_UNKNOWN_PRODUCT,
5593 "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r);
5594 ok(!lstrcmpA(buf, "apple"), "Expected buf to be unchanged, got %s\n", buf);
5595 ok(sz == MAX_PATH, "Expected MAX_PATH, got %d\n", sz);
5597 res = RegSetValueExA(propkey, "LocalPackage", 0, REG_SZ, (LPBYTE)"local", 6);
5598 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
5600 /* LocalPackage value exists */
5602 lstrcpyA(buf, "apple");
5603 r = pMsiGetProductInfoExA(prodcode, NULL,
5604 MSIINSTALLCONTEXT_MACHINE,
5605 INSTALLPROPERTY_PRODUCTSTATE, buf, &sz);
5606 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
5607 ok(!lstrcmpA(buf, "5"), "Expected \"5\", got \"%s\"\n", buf);
5608 ok(sz == 1, "Expected 1, got %d\n", sz);
5610 res = RegSetValueExA(propkey, "HelpLink", 0, REG_SZ, (LPBYTE)"link", 5);
5611 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
5613 /* HelpLink value exists */
5615 lstrcpyA(buf, "apple");
5616 r = pMsiGetProductInfoExA(prodcode, NULL,
5617 MSIINSTALLCONTEXT_MACHINE,
5618 INSTALLPROPERTY_HELPLINK, buf, &sz);
5619 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
5620 ok(!lstrcmpA(buf, "link"), "Expected \"link\", got \"%s\"\n", buf);
5621 ok(sz == 4, "Expected 4, got %d\n", sz);
5623 res = RegSetValueExA(propkey, "HelpTelephone", 0, REG_SZ, (LPBYTE)"phone", 6);
5624 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
5626 /* HelpTelephone value exists */
5628 lstrcpyA(buf, "apple");
5629 r = pMsiGetProductInfoExA(prodcode, NULL,
5630 MSIINSTALLCONTEXT_MACHINE,
5631 INSTALLPROPERTY_HELPTELEPHONE, buf, &sz);
5632 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
5633 ok(!lstrcmpA(buf, "phone"), "Expected \"phone\", got \"%s\"\n", buf);
5634 ok(sz == 5, "Expected 5, got %d\n", sz);
5636 res = RegSetValueExA(propkey, "InstallDate", 0, REG_SZ, (LPBYTE)"date", 5);
5637 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
5639 /* InstallDate value exists */
5641 lstrcpyA(buf, "apple");
5642 r = pMsiGetProductInfoExA(prodcode, NULL,
5643 MSIINSTALLCONTEXT_MACHINE,
5644 INSTALLPROPERTY_INSTALLDATE, buf, &sz);
5645 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
5646 ok(!lstrcmpA(buf, "date"), "Expected \"date\", got \"%s\"\n", buf);
5647 ok(sz == 4, "Expected 4, got %d\n", sz);
5649 res = RegSetValueExA(propkey, "DisplayName", 0, REG_SZ, (LPBYTE)"name", 5);
5650 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
5652 /* DisplayName value exists */
5654 lstrcpyA(buf, "apple");
5655 r = pMsiGetProductInfoExA(prodcode, NULL,
5656 MSIINSTALLCONTEXT_MACHINE,
5657 INSTALLPROPERTY_INSTALLEDPRODUCTNAME, buf, &sz);
5658 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
5659 ok(!lstrcmpA(buf, "name"), "Expected \"name\", got \"%s\"\n", buf);
5660 ok(sz == 4, "Expected 4, got %d\n", sz);
5662 res = RegSetValueExA(propkey, "InstallLocation", 0, REG_SZ, (LPBYTE)"loc", 4);
5663 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
5665 /* InstallLocation value exists */
5667 lstrcpyA(buf, "apple");
5668 r = pMsiGetProductInfoExA(prodcode, NULL,
5669 MSIINSTALLCONTEXT_MACHINE,
5670 INSTALLPROPERTY_INSTALLLOCATION, buf, &sz);
5671 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
5672 ok(!lstrcmpA(buf, "loc"), "Expected \"loc\", got \"%s\"\n", buf);
5673 ok(sz == 3, "Expected 3, got %d\n", sz);
5675 res = RegSetValueExA(propkey, "InstallSource", 0, REG_SZ, (LPBYTE)"source", 7);
5676 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
5678 /* InstallSource value exists */
5680 lstrcpyA(buf, "apple");
5681 r = pMsiGetProductInfoExA(prodcode, NULL,
5682 MSIINSTALLCONTEXT_MACHINE,
5683 INSTALLPROPERTY_INSTALLSOURCE, buf, &sz);
5684 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
5685 ok(!lstrcmpA(buf, "source"), "Expected \"source\", got \"%s\"\n", buf);
5686 ok(sz == 6, "Expected 6, got %d\n", sz);
5688 res = RegSetValueExA(propkey, "LocalPackage", 0, REG_SZ, (LPBYTE)"local", 6);
5689 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
5691 /* LocalPackage value exists */
5693 lstrcpyA(buf, "apple");
5694 r = pMsiGetProductInfoExA(prodcode, NULL,
5695 MSIINSTALLCONTEXT_MACHINE,
5696 INSTALLPROPERTY_LOCALPACKAGE, buf, &sz);
5697 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
5698 ok(!lstrcmpA(buf, "local"), "Expected \"local\", got \"%s\"\n", buf);
5699 ok(sz == 5, "Expected 5, got %d\n", sz);
5701 res = RegSetValueExA(propkey, "Publisher", 0, REG_SZ, (LPBYTE)"pub", 4);
5702 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
5704 /* Publisher value exists */
5706 lstrcpyA(buf, "apple");
5707 r = pMsiGetProductInfoExA(prodcode, NULL,
5708 MSIINSTALLCONTEXT_MACHINE,
5709 INSTALLPROPERTY_PUBLISHER, buf, &sz);
5710 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
5711 ok(!lstrcmpA(buf, "pub"), "Expected \"pub\", got \"%s\"\n", buf);
5712 ok(sz == 3, "Expected 3, got %d\n", sz);
5714 res = RegSetValueExA(propkey, "URLInfoAbout", 0, REG_SZ, (LPBYTE)"about", 6);
5715 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
5717 /* URLInfoAbout value exists */
5719 lstrcpyA(buf, "apple");
5720 r = pMsiGetProductInfoExA(prodcode, NULL,
5721 MSIINSTALLCONTEXT_MACHINE,
5722 INSTALLPROPERTY_URLINFOABOUT, buf, &sz);
5723 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
5724 ok(!lstrcmpA(buf, "about"), "Expected \"about\", got \"%s\"\n", buf);
5725 ok(sz == 5, "Expected 5, got %d\n", sz);
5727 res = RegSetValueExA(propkey, "URLUpdateInfo", 0, REG_SZ, (LPBYTE)"update", 7);
5728 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
5730 /* URLUpdateInfo value exists */
5732 lstrcpyA(buf, "apple");
5733 r = pMsiGetProductInfoExA(prodcode, NULL,
5734 MSIINSTALLCONTEXT_MACHINE,
5735 INSTALLPROPERTY_URLUPDATEINFO, buf, &sz);
5736 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
5737 ok(!lstrcmpA(buf, "update"), "Expected \"update\", got \"%s\"\n", buf);
5738 ok(sz == 6, "Expected 6, got %d\n", sz);
5740 res = RegSetValueExA(propkey, "VersionMinor", 0, REG_SZ, (LPBYTE)"2", 2);
5741 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
5743 /* VersionMinor value exists */
5745 lstrcpyA(buf, "apple");
5746 r = pMsiGetProductInfoExA(prodcode, NULL,
5747 MSIINSTALLCONTEXT_MACHINE,
5748 INSTALLPROPERTY_VERSIONMINOR, buf, &sz);
5749 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
5750 ok(!lstrcmpA(buf, "2"), "Expected \"2\", got \"%s\"\n", buf);
5751 ok(sz == 1, "Expected 1, got %d\n", sz);
5753 res = RegSetValueExA(propkey, "VersionMajor", 0, REG_SZ, (LPBYTE)"3", 2);
5754 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
5756 /* VersionMajor value exists */
5758 lstrcpyA(buf, "apple");
5759 r = pMsiGetProductInfoExA(prodcode, NULL,
5760 MSIINSTALLCONTEXT_MACHINE,
5761 INSTALLPROPERTY_VERSIONMAJOR, buf, &sz);
5762 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
5763 ok(!lstrcmpA(buf, "3"), "Expected \"3\", got \"%s\"\n", buf);
5764 ok(sz == 1, "Expected 1, got %d\n", sz);
5766 res = RegSetValueExA(propkey, "DisplayVersion", 0, REG_SZ, (LPBYTE)"3.2.1", 6);
5767 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
5769 /* DisplayVersion value exists */
5771 lstrcpyA(buf, "apple");
5772 r = pMsiGetProductInfoExA(prodcode, NULL,
5773 MSIINSTALLCONTEXT_MACHINE,
5774 INSTALLPROPERTY_VERSIONSTRING, buf, &sz);
5775 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
5776 ok(!lstrcmpA(buf, "3.2.1"), "Expected \"3.2.1\", got \"%s\"\n", buf);
5777 ok(sz == 5, "Expected 5, got %d\n", sz);
5779 res = RegSetValueExA(propkey, "ProductID", 0, REG_SZ, (LPBYTE)"id", 3);
5780 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
5782 /* ProductID value exists */
5784 lstrcpyA(buf, "apple");
5785 r = pMsiGetProductInfoExA(prodcode, NULL,
5786 MSIINSTALLCONTEXT_MACHINE,
5787 INSTALLPROPERTY_PRODUCTID, buf, &sz);
5788 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
5789 ok(!lstrcmpA(buf, "id"), "Expected \"id\", got \"%s\"\n", buf);
5790 ok(sz == 2, "Expected 2, got %d\n", sz);
5792 res = RegSetValueExA(propkey, "RegCompany", 0, REG_SZ, (LPBYTE)"comp", 5);
5793 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
5795 /* RegCompany value exists */
5797 lstrcpyA(buf, "apple");
5798 r = pMsiGetProductInfoExA(prodcode, NULL,
5799 MSIINSTALLCONTEXT_MACHINE,
5800 INSTALLPROPERTY_REGCOMPANY, buf, &sz);
5801 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
5802 ok(!lstrcmpA(buf, "comp"), "Expected \"comp\", got \"%s\"\n", buf);
5803 ok(sz == 4, "Expected 4, got %d\n", sz);
5805 res = RegSetValueExA(propkey, "RegOwner", 0, REG_SZ, (LPBYTE)"owner", 6);
5806 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
5808 /* RegOwner value exists */
5810 lstrcpyA(buf, "apple");
5811 r = pMsiGetProductInfoExA(prodcode, NULL,
5812 MSIINSTALLCONTEXT_MACHINE,
5813 INSTALLPROPERTY_REGOWNER, buf, &sz);
5814 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
5815 ok(!lstrcmpA(buf, "owner"), "Expected \"owner\", got \"%s\"\n", buf);
5816 ok(sz == 5, "Expected 5, got %d\n", sz);
5818 res = RegSetValueExA(propkey, "Transforms", 0, REG_SZ, (LPBYTE)"trans", 6);
5819 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
5821 /* Transforms value exists */
5823 lstrcpyA(buf, "apple");
5824 r = pMsiGetProductInfoExA(prodcode, NULL,
5825 MSIINSTALLCONTEXT_MACHINE,
5826 INSTALLPROPERTY_TRANSFORMS, buf, &sz);
5827 ok(r == ERROR_UNKNOWN_PRODUCT,
5828 "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r);
5829 ok(!lstrcmpA(buf, "apple"), "Expected buf to be unchanged, got %s\n", buf);
5830 ok(sz == MAX_PATH, "Expected MAX_PATH, got %d\n", sz);
5832 res = RegSetValueExA(propkey, "Language", 0, REG_SZ, (LPBYTE)"lang", 5);
5833 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
5835 /* Language value exists */
5837 lstrcpyA(buf, "apple");
5838 r = pMsiGetProductInfoExA(prodcode, NULL,
5839 MSIINSTALLCONTEXT_MACHINE,
5840 INSTALLPROPERTY_LANGUAGE, buf, &sz);
5841 ok(r == ERROR_UNKNOWN_PRODUCT,
5842 "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r);
5843 ok(!lstrcmpA(buf, "apple"), "Expected buf to be unchanged, got %s\n", buf);
5844 ok(sz == MAX_PATH, "Expected MAX_PATH, got %d\n", sz);
5846 res = RegSetValueExA(propkey, "ProductName", 0, REG_SZ, (LPBYTE)"name", 5);
5847 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
5849 /* ProductName value exists */
5851 lstrcpyA(buf, "apple");
5852 r = pMsiGetProductInfoExA(prodcode, NULL,
5853 MSIINSTALLCONTEXT_MACHINE,
5854 INSTALLPROPERTY_PRODUCTNAME, buf, &sz);
5855 ok(r == ERROR_UNKNOWN_PRODUCT,
5856 "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r);
5857 ok(!lstrcmpA(buf, "apple"), "Expected buf to be unchanged, got %s\n", buf);
5858 ok(sz == MAX_PATH, "Expected MAX_PATH, got %d\n", sz);
5860 res = RegSetValueExA(propkey, "AssignmentType", 0, REG_SZ, (LPBYTE)"type", 5);
5861 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
5865 /* AssignmentType value exists */
5867 lstrcpyA(buf, "apple");
5868 r = pMsiGetProductInfoExA(prodcode, NULL,
5869 MSIINSTALLCONTEXT_MACHINE,
5870 INSTALLPROPERTY_ASSIGNMENTTYPE, buf, &sz);
5871 ok(r == ERROR_UNKNOWN_PRODUCT,
5872 "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r);
5873 ok(!lstrcmpA(buf, "apple"), "Expected buf to be unchanged, got %s\n", buf);
5874 ok(sz == MAX_PATH, "Expected MAX_PATH, got %d\n", sz);
5876 res = RegSetValueExA(propkey, "PackageCode", 0, REG_SZ, (LPBYTE)"code", 5);
5877 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
5879 /* PackageCode value exists */
5881 lstrcpyA(buf, "apple");
5882 r = pMsiGetProductInfoExA(prodcode, NULL,
5883 MSIINSTALLCONTEXT_MACHINE,
5884 INSTALLPROPERTY_PACKAGECODE, buf, &sz);
5885 ok(r == ERROR_UNKNOWN_PRODUCT,
5886 "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r);
5887 ok(!lstrcmpA(buf, "apple"), "Expected buf to be unchanged, got %s\n", buf);
5888 ok(sz == MAX_PATH, "Expected MAX_PATH, got %d\n", sz);
5890 res = RegSetValueExA(propkey, "Version", 0, REG_SZ, (LPBYTE)"ver", 4);
5891 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
5893 /* Version value exists */
5895 lstrcpyA(buf, "apple");
5896 r = pMsiGetProductInfoExA(prodcode, NULL,
5897 MSIINSTALLCONTEXT_MACHINE,
5898 INSTALLPROPERTY_VERSION, buf, &sz);
5899 ok(r == ERROR_UNKNOWN_PRODUCT,
5900 "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r);
5901 ok(!lstrcmpA(buf, "apple"), "Expected buf to be unchanged, got %s\n", buf);
5902 ok(sz == MAX_PATH, "Expected MAX_PATH, got %d\n", sz);
5904 res = RegSetValueExA(propkey, "ProductIcon", 0, REG_SZ, (LPBYTE)"icon", 5);
5905 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
5907 /* ProductIcon value exists */
5909 lstrcpyA(buf, "apple");
5910 r = pMsiGetProductInfoExA(prodcode, NULL,
5911 MSIINSTALLCONTEXT_MACHINE,
5912 INSTALLPROPERTY_PRODUCTICON, buf, &sz);
5913 ok(r == ERROR_UNKNOWN_PRODUCT,
5914 "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r);
5915 ok(!lstrcmpA(buf, "apple"), "Expected buf to be unchanged, got %s\n", buf);
5916 ok(sz == MAX_PATH, "Expected MAX_PATH, got %d\n", sz);
5918 res = RegSetValueExA(propkey, "PackageName", 0, REG_SZ, (LPBYTE)"name", 5);
5919 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
5921 /* PackageName value exists */
5923 lstrcpyA(buf, "apple");
5924 r = pMsiGetProductInfoExA(prodcode, NULL,
5925 MSIINSTALLCONTEXT_MACHINE,
5926 INSTALLPROPERTY_PACKAGENAME, buf, &sz);
5927 ok(r == ERROR_UNKNOWN_PRODUCT,
5928 "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r);
5929 ok(!lstrcmpA(buf, "apple"), "Expected buf to be unchanged, got %s\n", buf);
5930 ok(sz == MAX_PATH, "Expected MAX_PATH, got %d\n", sz);
5932 res = RegSetValueExA(propkey, "AuthorizedLUAApp", 0, REG_SZ, (LPBYTE)"auth", 5);
5933 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
5935 /* AuthorizedLUAApp value exists */
5937 lstrcpyA(buf, "apple");
5938 r = pMsiGetProductInfoExA(prodcode, NULL,
5939 MSIINSTALLCONTEXT_MACHINE,
5940 INSTALLPROPERTY_AUTHORIZED_LUA_APP, buf, &sz);
5941 ok(r == ERROR_UNKNOWN_PRODUCT,
5942 "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r);
5943 ok(!lstrcmpA(buf, "apple"), "Expected buf to be unchanged, got %s\n", buf);
5944 ok(sz == MAX_PATH, "Expected MAX_PATH, got %d\n", sz);
5946 RegDeleteValueA(propkey, "AuthorizedLUAApp");
5947 RegDeleteValueA(propkey, "PackageName");
5948 RegDeleteValueA(propkey, "ProductIcon");
5949 RegDeleteValueA(propkey, "Version");
5950 RegDeleteValueA(propkey, "PackageCode");
5951 RegDeleteValueA(propkey, "AssignmentType");
5952 RegDeleteValueA(propkey, "ProductName");
5953 RegDeleteValueA(propkey, "Language");
5954 RegDeleteValueA(propkey, "Transforms");
5955 RegDeleteValueA(propkey, "RegOwner");
5956 RegDeleteValueA(propkey, "RegCompany");
5957 RegDeleteValueA(propkey, "ProductID");
5958 RegDeleteValueA(propkey, "DisplayVersion");
5959 RegDeleteValueA(propkey, "VersionMajor");
5960 RegDeleteValueA(propkey, "VersionMinor");
5961 RegDeleteValueA(propkey, "URLUpdateInfo");
5962 RegDeleteValueA(propkey, "URLInfoAbout");
5963 RegDeleteValueA(propkey, "Publisher");
5964 RegDeleteValueA(propkey, "LocalPackage");
5965 RegDeleteValueA(propkey, "InstallSource");
5966 RegDeleteValueA(propkey, "InstallLocation");
5967 RegDeleteValueA(propkey, "DisplayName");
5968 RegDeleteValueA(propkey, "InstallDate");
5969 RegDeleteValueA(propkey, "HelpTelephone");
5970 RegDeleteValueA(propkey, "HelpLink");
5971 RegDeleteValueA(propkey, "LocalPackage");
5972 RegDeleteKeyA(propkey, "");
5973 RegCloseKey(propkey);
5974 RegDeleteKeyA(localkey, "");
5975 RegCloseKey(localkey);
5977 lstrcpyA(keypath, "Software\\Classes\\Installer\\Products\\");
5978 lstrcatA(keypath, prod_squashed);
5980 res = RegCreateKeyA(HKEY_LOCAL_MACHINE, keypath, &prodkey);
5981 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
5983 /* local classes product key exists */
5985 lstrcpyA(buf, "apple");
5986 r = pMsiGetProductInfoExA(prodcode, NULL,
5987 MSIINSTALLCONTEXT_MACHINE,
5988 INSTALLPROPERTY_PRODUCTSTATE, buf, &sz);
5989 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
5990 ok(!lstrcmpA(buf, "1"), "Expected \"1\", got \"%s\"\n", buf);
5991 ok(sz == 1, "Expected 1, got %d\n", sz);
5993 res = RegSetValueExA(prodkey, "HelpLink", 0, REG_SZ, (LPBYTE)"link", 5);
5994 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
5996 /* HelpLink value exists */
5998 lstrcpyA(buf, "apple");
5999 r = pMsiGetProductInfoExA(prodcode, NULL,
6000 MSIINSTALLCONTEXT_MACHINE,
6001 INSTALLPROPERTY_HELPLINK, buf, &sz);
6002 ok(r == ERROR_UNKNOWN_PROPERTY,
6003 "Expected ERROR_UNKNOWN_PROPERTY, got %d\n", r);
6004 ok(!lstrcmpA(buf, "apple"), "Expected buf to be unchanged, got %s\n", buf);
6005 ok(sz == MAX_PATH, "Expected MAX_PATH, got %d\n", sz);
6007 res = RegSetValueExA(prodkey, "HelpTelephone", 0, REG_SZ, (LPBYTE)"phone", 6);
6008 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
6010 /* HelpTelephone value exists */
6012 lstrcpyA(buf, "apple");
6013 r = pMsiGetProductInfoExA(prodcode, NULL,
6014 MSIINSTALLCONTEXT_MACHINE,
6015 INSTALLPROPERTY_HELPTELEPHONE, buf, &sz);
6016 ok(r == ERROR_UNKNOWN_PROPERTY,
6017 "Expected ERROR_UNKNOWN_PROPERTY, got %d\n", r);
6018 ok(!lstrcmpA(buf, "apple"), "Expected buf to be unchanged, got %s\n", buf);
6019 ok(sz == MAX_PATH, "Expected MAX_PATH, got %d\n", sz);
6021 res = RegSetValueExA(prodkey, "InstallDate", 0, REG_SZ, (LPBYTE)"date", 5);
6022 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
6024 /* InstallDate value exists */
6026 lstrcpyA(buf, "apple");
6027 r = pMsiGetProductInfoExA(prodcode, NULL,
6028 MSIINSTALLCONTEXT_MACHINE,
6029 INSTALLPROPERTY_INSTALLDATE, buf, &sz);
6030 ok(r == ERROR_UNKNOWN_PROPERTY,
6031 "Expected ERROR_UNKNOWN_PROPERTY, got %d\n", r);
6032 ok(!lstrcmpA(buf, "apple"), "Expected buf to be unchanged, got %s\n", buf);
6033 ok(sz == MAX_PATH, "Expected MAX_PATH, got %d\n", sz);
6035 res = RegSetValueExA(prodkey, "DisplayName", 0, REG_SZ, (LPBYTE)"name", 5);
6036 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
6038 /* DisplayName value exists */
6040 lstrcpyA(buf, "apple");
6041 r = pMsiGetProductInfoExA(prodcode, NULL,
6042 MSIINSTALLCONTEXT_MACHINE,
6043 INSTALLPROPERTY_INSTALLEDPRODUCTNAME, buf, &sz);
6044 ok(r == ERROR_UNKNOWN_PROPERTY,
6045 "Expected ERROR_UNKNOWN_PROPERTY, got %d\n", r);
6046 ok(!lstrcmpA(buf, "apple"), "Expected buf to be unchanged, got %s\n", buf);
6047 ok(sz == MAX_PATH, "Expected MAX_PATH, got %d\n", sz);
6049 res = RegSetValueExA(prodkey, "InstallLocation", 0, REG_SZ, (LPBYTE)"loc", 4);
6050 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
6052 /* InstallLocation value exists */
6054 lstrcpyA(buf, "apple");
6055 r = pMsiGetProductInfoExA(prodcode, NULL,
6056 MSIINSTALLCONTEXT_MACHINE,
6057 INSTALLPROPERTY_INSTALLLOCATION, buf, &sz);
6058 ok(r == ERROR_UNKNOWN_PROPERTY,
6059 "Expected ERROR_UNKNOWN_PROPERTY, got %d\n", r);
6060 ok(!lstrcmpA(buf, "apple"), "Expected buf to be unchanged, got %s\n", buf);
6061 ok(sz == MAX_PATH, "Expected MAX_PATH, got %d\n", sz);
6063 res = RegSetValueExA(prodkey, "InstallSource", 0, REG_SZ, (LPBYTE)"source", 7);
6064 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
6066 /* InstallSource value exists */
6068 lstrcpyA(buf, "apple");
6069 r = pMsiGetProductInfoExA(prodcode, NULL,
6070 MSIINSTALLCONTEXT_MACHINE,
6071 INSTALLPROPERTY_INSTALLSOURCE, buf, &sz);
6072 ok(r == ERROR_UNKNOWN_PROPERTY,
6073 "Expected ERROR_UNKNOWN_PROPERTY, got %d\n", r);
6074 ok(!lstrcmpA(buf, "apple"), "Expected buf to be unchanged, got %s\n", buf);
6075 ok(sz == MAX_PATH, "Expected MAX_PATH, got %d\n", sz);
6077 res = RegSetValueExA(prodkey, "LocalPackage", 0, REG_SZ, (LPBYTE)"local", 6);
6078 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
6080 /* LocalPackage value exists */
6082 lstrcpyA(buf, "apple");
6083 r = pMsiGetProductInfoExA(prodcode, NULL,
6084 MSIINSTALLCONTEXT_MACHINE,
6085 INSTALLPROPERTY_LOCALPACKAGE, buf, &sz);
6086 ok(r == ERROR_UNKNOWN_PROPERTY,
6087 "Expected ERROR_UNKNOWN_PROPERTY, got %d\n", r);
6088 ok(!lstrcmpA(buf, "apple"), "Expected buf to be unchanged, got %s\n", buf);
6089 ok(sz == MAX_PATH, "Expected MAX_PATH, got %d\n", sz);
6091 res = RegSetValueExA(prodkey, "Publisher", 0, REG_SZ, (LPBYTE)"pub", 4);
6092 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
6094 /* Publisher value exists */
6096 lstrcpyA(buf, "apple");
6097 r = pMsiGetProductInfoExA(prodcode, NULL,
6098 MSIINSTALLCONTEXT_MACHINE,
6099 INSTALLPROPERTY_PUBLISHER, buf, &sz);
6100 ok(r == ERROR_UNKNOWN_PROPERTY,
6101 "Expected ERROR_UNKNOWN_PROPERTY, got %d\n", r);
6102 ok(!lstrcmpA(buf, "apple"), "Expected buf to be unchanged, got %s\n", buf);
6103 ok(sz == MAX_PATH, "Expected MAX_PATH, got %d\n", sz);
6105 res = RegSetValueExA(prodkey, "URLInfoAbout", 0, REG_SZ, (LPBYTE)"about", 6);
6106 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
6108 /* URLInfoAbout value exists */
6110 lstrcpyA(buf, "apple");
6111 r = pMsiGetProductInfoExA(prodcode, NULL,
6112 MSIINSTALLCONTEXT_MACHINE,
6113 INSTALLPROPERTY_URLINFOABOUT, buf, &sz);
6114 ok(r == ERROR_UNKNOWN_PROPERTY,
6115 "Expected ERROR_UNKNOWN_PROPERTY, got %d\n", r);
6116 ok(!lstrcmpA(buf, "apple"), "Expected buf to be unchanged, got %s\n", buf);
6117 ok(sz == MAX_PATH, "Expected MAX_PATH, got %d\n", sz);
6119 res = RegSetValueExA(prodkey, "URLUpdateInfo", 0, REG_SZ, (LPBYTE)"update", 7);
6120 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
6122 /* URLUpdateInfo value exists */
6124 lstrcpyA(buf, "apple");
6125 r = pMsiGetProductInfoExA(prodcode, NULL,
6126 MSIINSTALLCONTEXT_MACHINE,
6127 INSTALLPROPERTY_URLUPDATEINFO, buf, &sz);
6128 ok(r == ERROR_UNKNOWN_PROPERTY,
6129 "Expected ERROR_UNKNOWN_PROPERTY, got %d\n", r);
6130 ok(!lstrcmpA(buf, "apple"), "Expected buf to be unchanged, got %s\n", buf);
6131 ok(sz == MAX_PATH, "Expected MAX_PATH, got %d\n", sz);
6133 res = RegSetValueExA(prodkey, "VersionMinor", 0, REG_SZ, (LPBYTE)"2", 2);
6134 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
6136 /* VersionMinor value exists */
6138 lstrcpyA(buf, "apple");
6139 r = pMsiGetProductInfoExA(prodcode, NULL,
6140 MSIINSTALLCONTEXT_MACHINE,
6141 INSTALLPROPERTY_VERSIONMINOR, buf, &sz);
6142 ok(r == ERROR_UNKNOWN_PROPERTY,
6143 "Expected ERROR_UNKNOWN_PROPERTY, got %d\n", r);
6144 ok(!lstrcmpA(buf, "apple"), "Expected buf to be unchanged, got %s\n", buf);
6145 ok(sz == MAX_PATH, "Expected MAX_PATH, got %d\n", sz);
6147 res = RegSetValueExA(prodkey, "VersionMajor", 0, REG_SZ, (LPBYTE)"3", 2);
6148 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
6150 /* VersionMajor value exists */
6152 lstrcpyA(buf, "apple");
6153 r = pMsiGetProductInfoExA(prodcode, NULL,
6154 MSIINSTALLCONTEXT_MACHINE,
6155 INSTALLPROPERTY_VERSIONMAJOR, buf, &sz);
6156 ok(r == ERROR_UNKNOWN_PROPERTY,
6157 "Expected ERROR_UNKNOWN_PROPERTY, got %d\n", r);
6158 ok(!lstrcmpA(buf, "apple"), "Expected buf to be unchanged, got %s\n", buf);
6159 ok(sz == MAX_PATH, "Expected MAX_PATH, got %d\n", sz);
6161 res = RegSetValueExA(prodkey, "DisplayVersion", 0, REG_SZ, (LPBYTE)"3.2.1", 6);
6162 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
6164 /* DisplayVersion value exists */
6166 lstrcpyA(buf, "apple");
6167 r = pMsiGetProductInfoExA(prodcode, NULL,
6168 MSIINSTALLCONTEXT_MACHINE,
6169 INSTALLPROPERTY_VERSIONSTRING, buf, &sz);
6170 ok(r == ERROR_UNKNOWN_PROPERTY,
6171 "Expected ERROR_UNKNOWN_PROPERTY, got %d\n", r);
6172 ok(!lstrcmpA(buf, "apple"), "Expected buf to be unchanged, got %s\n", buf);
6173 ok(sz == MAX_PATH, "Expected MAX_PATH, got %d\n", sz);
6175 res = RegSetValueExA(prodkey, "ProductID", 0, REG_SZ, (LPBYTE)"id", 3);
6176 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
6178 /* ProductID value exists */
6180 lstrcpyA(buf, "apple");
6181 r = pMsiGetProductInfoExA(prodcode, NULL,
6182 MSIINSTALLCONTEXT_MACHINE,
6183 INSTALLPROPERTY_PRODUCTID, buf, &sz);
6184 ok(r == ERROR_UNKNOWN_PROPERTY,
6185 "Expected ERROR_UNKNOWN_PROPERTY, got %d\n", r);
6186 ok(!lstrcmpA(buf, "apple"), "Expected buf to be unchanged, got %s\n", buf);
6187 ok(sz == MAX_PATH, "Expected MAX_PATH, got %d\n", sz);
6189 res = RegSetValueExA(prodkey, "RegCompany", 0, REG_SZ, (LPBYTE)"comp", 5);
6190 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
6192 /* RegCompany value exists */
6194 lstrcpyA(buf, "apple");
6195 r = pMsiGetProductInfoExA(prodcode, NULL,
6196 MSIINSTALLCONTEXT_MACHINE,
6197 INSTALLPROPERTY_REGCOMPANY, buf, &sz);
6198 ok(r == ERROR_UNKNOWN_PROPERTY,
6199 "Expected ERROR_UNKNOWN_PROPERTY, got %d\n", r);
6200 ok(!lstrcmpA(buf, "apple"), "Expected buf to be unchanged, got %s\n", buf);
6201 ok(sz == MAX_PATH, "Expected MAX_PATH, got %d\n", sz);
6203 res = RegSetValueExA(prodkey, "RegOwner", 0, REG_SZ, (LPBYTE)"owner", 6);
6204 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
6206 /* RegOwner value exists */
6208 lstrcpyA(buf, "apple");
6209 r = pMsiGetProductInfoExA(prodcode, NULL,
6210 MSIINSTALLCONTEXT_MACHINE,
6211 INSTALLPROPERTY_REGOWNER, buf, &sz);
6212 ok(r == ERROR_UNKNOWN_PROPERTY,
6213 "Expected ERROR_UNKNOWN_PROPERTY, got %d\n", r);
6214 ok(!lstrcmpA(buf, "apple"), "Expected buf to be unchanged, got %s\n", buf);
6215 ok(sz == MAX_PATH, "Expected MAX_PATH, got %d\n", sz);
6217 res = RegSetValueExA(prodkey, "Transforms", 0, REG_SZ, (LPBYTE)"trans", 6);
6218 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
6220 /* Transforms value exists */
6222 lstrcpyA(buf, "apple");
6223 r = pMsiGetProductInfoExA(prodcode, NULL,
6224 MSIINSTALLCONTEXT_MACHINE,
6225 INSTALLPROPERTY_TRANSFORMS, buf, &sz);
6226 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
6227 ok(!lstrcmpA(buf, "trans"), "Expected \"trans\", got \"%s\"\n", buf);
6228 ok(sz == 5, "Expected 5, got %d\n", sz);
6230 res = RegSetValueExA(prodkey, "Language", 0, REG_SZ, (LPBYTE)"lang", 5);
6231 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
6233 /* Language value exists */
6235 lstrcpyA(buf, "apple");
6236 r = pMsiGetProductInfoExA(prodcode, NULL,
6237 MSIINSTALLCONTEXT_MACHINE,
6238 INSTALLPROPERTY_LANGUAGE, buf, &sz);
6239 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
6240 ok(!lstrcmpA(buf, "lang"), "Expected \"lang\", got \"%s\"\n", buf);
6241 ok(sz == 4, "Expected 4, got %d\n", sz);
6243 res = RegSetValueExA(prodkey, "ProductName", 0, REG_SZ, (LPBYTE)"name", 5);
6244 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
6246 /* ProductName value exists */
6248 lstrcpyA(buf, "apple");
6249 r = pMsiGetProductInfoExA(prodcode, NULL,
6250 MSIINSTALLCONTEXT_MACHINE,
6251 INSTALLPROPERTY_PRODUCTNAME, buf, &sz);
6252 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
6253 ok(!lstrcmpA(buf, "name"), "Expected \"name\", got \"%s\"\n", buf);
6254 ok(sz == 4, "Expected 4, got %d\n", sz);
6256 res = RegSetValueExA(prodkey, "AssignmentType", 0, REG_SZ, (LPBYTE)"type", 5);
6257 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
6261 /* AssignmentType value exists */
6263 lstrcpyA(buf, "apple");
6264 r = pMsiGetProductInfoExA(prodcode, NULL,
6265 MSIINSTALLCONTEXT_MACHINE,
6266 INSTALLPROPERTY_ASSIGNMENTTYPE, buf, &sz);
6267 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
6268 ok(!lstrcmpA(buf, ""), "Expected \"\", got \"%s\"\n", buf);
6269 ok(sz == 0, "Expected 0, got %d\n", sz);
6271 res = RegSetValueExA(prodkey, "PackageCode", 0, REG_SZ, (LPBYTE)"code", 5);
6272 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
6276 /* PackageCode value exists */
6278 lstrcpyA(buf, "apple");
6279 r = pMsiGetProductInfoExA(prodcode, NULL,
6280 MSIINSTALLCONTEXT_MACHINE,
6281 INSTALLPROPERTY_PACKAGECODE, buf, &sz);
6284 ok(r == ERROR_BAD_CONFIGURATION,
6285 "Expected ERROR_BAD_CONFIGURATION, got %d\n", r);
6286 ok(!lstrcmpA(buf, "apple"), "Expected buf to be unchanged, got %s\n", buf);
6287 ok(sz == MAX_PATH, "Expected MAX_PATH, got %d\n", sz);
6290 res = RegSetValueExA(prodkey, "Version", 0, REG_SZ, (LPBYTE)"ver", 4);
6291 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
6293 /* Version value exists */
6295 lstrcpyA(buf, "apple");
6296 r = pMsiGetProductInfoExA(prodcode, NULL,
6297 MSIINSTALLCONTEXT_MACHINE,
6298 INSTALLPROPERTY_VERSION, buf, &sz);
6299 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
6300 ok(!lstrcmpA(buf, "ver"), "Expected \"ver\", got \"%s\"\n", buf);
6301 ok(sz == 3, "Expected 3, got %d\n", sz);
6303 res = RegSetValueExA(prodkey, "ProductIcon", 0, REG_SZ, (LPBYTE)"icon", 5);
6304 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
6306 /* ProductIcon value exists */
6308 lstrcpyA(buf, "apple");
6309 r = pMsiGetProductInfoExA(prodcode, NULL,
6310 MSIINSTALLCONTEXT_MACHINE,
6311 INSTALLPROPERTY_PRODUCTICON, buf, &sz);
6312 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
6313 ok(!lstrcmpA(buf, "icon"), "Expected \"icon\", got \"%s\"\n", buf);
6314 ok(sz == 4, "Expected 4, got %d\n", sz);
6316 res = RegSetValueExA(prodkey, "PackageName", 0, REG_SZ, (LPBYTE)"name", 5);
6317 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
6319 /* PackageName value exists */
6321 lstrcpyA(buf, "apple");
6322 r = pMsiGetProductInfoExA(prodcode, NULL,
6323 MSIINSTALLCONTEXT_MACHINE,
6324 INSTALLPROPERTY_PACKAGENAME, buf, &sz);
6327 ok(r == ERROR_UNKNOWN_PRODUCT,
6328 "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r);
6329 ok(!lstrcmpA(buf, "apple"), "Expected buf to be unchanged, got %s\n", buf);
6330 ok(sz == MAX_PATH, "Expected MAX_PATH, got %d\n", sz);
6333 res = RegSetValueExA(prodkey, "AuthorizedLUAApp", 0, REG_SZ, (LPBYTE)"auth", 5);
6334 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
6336 /* AuthorizedLUAApp value exists */
6338 lstrcpyA(buf, "apple");
6339 r = pMsiGetProductInfoExA(prodcode, NULL,
6340 MSIINSTALLCONTEXT_MACHINE,
6341 INSTALLPROPERTY_AUTHORIZED_LUA_APP, buf, &sz);
6342 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
6343 ok(!lstrcmpA(buf, "auth"), "Expected \"auth\", got \"%s\"\n", buf);
6344 ok(sz == 4, "Expected 4, got %d\n", sz);
6346 RegDeleteValueA(prodkey, "AuthorizedLUAApp");
6347 RegDeleteValueA(prodkey, "PackageName");
6348 RegDeleteValueA(prodkey, "ProductIcon");
6349 RegDeleteValueA(prodkey, "Version");
6350 RegDeleteValueA(prodkey, "PackageCode");
6351 RegDeleteValueA(prodkey, "AssignmentType");
6352 RegDeleteValueA(prodkey, "ProductName");
6353 RegDeleteValueA(prodkey, "Language");
6354 RegDeleteValueA(prodkey, "Transforms");
6355 RegDeleteValueA(prodkey, "RegOwner");
6356 RegDeleteValueA(prodkey, "RegCompany");
6357 RegDeleteValueA(prodkey, "ProductID");
6358 RegDeleteValueA(prodkey, "DisplayVersion");
6359 RegDeleteValueA(prodkey, "VersionMajor");
6360 RegDeleteValueA(prodkey, "VersionMinor");
6361 RegDeleteValueA(prodkey, "URLUpdateInfo");
6362 RegDeleteValueA(prodkey, "URLInfoAbout");
6363 RegDeleteValueA(prodkey, "Publisher");
6364 RegDeleteValueA(prodkey, "LocalPackage");
6365 RegDeleteValueA(prodkey, "InstallSource");
6366 RegDeleteValueA(prodkey, "InstallLocation");
6367 RegDeleteValueA(prodkey, "DisplayName");
6368 RegDeleteValueA(prodkey, "InstallDate");
6369 RegDeleteValueA(prodkey, "HelpTelephone");
6370 RegDeleteValueA(prodkey, "HelpLink");
6371 RegDeleteKeyA(prodkey, "");
6372 RegCloseKey(prodkey);
6377 init_functionpointers();
6381 test_getcomponentpath();
6382 test_MsiGetFileHash();
6384 if (!pConvertSidToStringSidA)
6385 skip("ConvertSidToStringSidA not implemented\n");
6388 /* These tests rely on get_user_sid that needs ConvertSidToStringSidA */
6389 test_MsiQueryProductState();
6390 test_MsiQueryFeatureState();
6391 test_MsiQueryComponentState();
6392 test_MsiGetComponentPath();
6393 test_MsiGetProductCode();
6394 test_MsiEnumClients();
6395 test_MsiGetProductInfo();
6396 test_MsiGetProductInfoEx();
6399 test_MsiGetFileVersion();