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;
419 create_test_guid(prodcode, prod_squashed);
420 get_user_sid(&usersid);
423 state = MsiQueryProductStateA(NULL);
424 ok(state == INSTALLSTATE_INVALIDARG, "Expected INSTALLSTATE_INVALIDARG, got %d\n", state);
427 state = MsiQueryProductStateA("");
428 ok(state == INSTALLSTATE_INVALIDARG, "Expected INSTALLSTATE_INVALIDARG, got %d\n", state);
430 /* garbage prodcode */
431 state = MsiQueryProductStateA("garbage");
432 ok(state == INSTALLSTATE_INVALIDARG, "Expected INSTALLSTATE_INVALIDARG, got %d\n", state);
434 /* guid without brackets */
435 state = MsiQueryProductStateA("6700E8CF-95AB-4D9C-BC2C-15840DEA7A5D");
436 ok(state == INSTALLSTATE_INVALIDARG, "Expected INSTALLSTATE_INVALIDARG, got %d\n", state);
438 /* guid with brackets */
439 state = MsiQueryProductStateA("{6700E8CF-95AB-4D9C-BC2C-15840DEA7A5D}");
440 ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
442 /* same length as guid, but random */
443 state = MsiQueryProductStateA("A938G02JF-2NF3N93-VN3-2NNF-3KGKALDNF93");
444 ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
446 /* created guid cannot possibly be an installed product code */
447 state = MsiQueryProductStateA(prodcode);
448 ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
450 lstrcpyA(keypath, "Software\\Microsoft\\Installer\\Products\\");
451 lstrcatA(keypath, prod_squashed);
453 res = RegCreateKeyA(HKEY_CURRENT_USER, keypath, &userkey);
454 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
456 /* user product key exists */
457 state = MsiQueryProductStateA(prodcode);
458 ok(state == INSTALLSTATE_ADVERTISED, "Expected INSTALLSTATE_ADVERTISED, got %d\n", state);
460 lstrcpyA(keypath, "Software\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\");
461 lstrcatA(keypath, prodcode);
463 res = RegCreateKeyA(HKEY_LOCAL_MACHINE, keypath, &localkey);
464 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
466 /* local uninstall key exists */
467 state = MsiQueryProductStateA(prodcode);
468 ok(state == INSTALLSTATE_ADVERTISED, "Expected INSTALLSTATE_ADVERTISED, got %d\n", state);
471 res = RegSetValueExA(localkey, "WindowsInstaller", 0, REG_DWORD, (const BYTE *)&data, sizeof(DWORD));
472 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
474 /* WindowsInstaller value exists */
475 state = MsiQueryProductStateA(prodcode);
476 ok(state == INSTALLSTATE_ADVERTISED, "Expected INSTALLSTATE_ADVERTISED, got %d\n", state);
478 RegDeleteValueA(localkey, "WindowsInstaller");
479 RegDeleteKeyA(localkey, "");
481 lstrcpyA(keypath, "Software\\Microsoft\\Windows\\CurrentVersion\\Installer\\UserData\\");
482 lstrcatA(keypath, usersid);
483 lstrcatA(keypath, "\\Products\\");
484 lstrcatA(keypath, prod_squashed);
486 res = RegCreateKeyA(HKEY_LOCAL_MACHINE, keypath, &localkey);
487 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
489 /* local product key exists */
490 state = MsiQueryProductStateA(prodcode);
491 ok(state == INSTALLSTATE_ADVERTISED, "Expected INSTALLSTATE_ADVERTISED, got %d\n", state);
493 res = RegCreateKeyA(localkey, "InstallProperties", &props);
494 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
496 /* install properties key exists */
497 state = MsiQueryProductStateA(prodcode);
498 ok(state == INSTALLSTATE_ADVERTISED, "Expected INSTALLSTATE_ADVERTISED, got %d\n", state);
501 res = RegSetValueExA(props, "WindowsInstaller", 0, REG_DWORD, (const BYTE *)&data, sizeof(DWORD));
502 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
504 /* WindowsInstaller value exists */
505 state = MsiQueryProductStateA(prodcode);
506 ok(state == INSTALLSTATE_DEFAULT, "Expected INSTALLSTATE_DEFAULT, got %d\n", state);
509 res = RegSetValueExA(props, "WindowsInstaller", 0, REG_DWORD, (const BYTE *)&data, sizeof(DWORD));
510 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
512 /* WindowsInstaller value is not 1 */
513 state = MsiQueryProductStateA(prodcode);
514 ok(state == INSTALLSTATE_DEFAULT, "Expected INSTALLSTATE_DEFAULT, got %d\n", state);
516 RegDeleteKeyA(userkey, "");
518 /* user product key does not exist */
519 state = MsiQueryProductStateA(prodcode);
520 ok(state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
523 RegDeleteValueA(props, "WindowsInstaller");
524 RegDeleteKeyA(props, "");
525 RegDeleteKeyA(localkey, "");
526 RegCloseKey(userkey);
527 RegCloseKey(localkey);
531 static const char table_enc85[] =
532 "!$%&'()*+,-.0123456789=?@ABCDEFGHIJKLMNO"
533 "PQRSTUVWXYZ[]^_`abcdefghijklmnopqrstuvwx"
537 * Encodes a base85 guid given a GUID pointer
538 * Caller should provide a 21 character buffer for the encoded string.
540 * returns TRUE if successful, FALSE if not
542 static BOOL encode_base85_guid( GUID *guid, LPWSTR str )
544 unsigned int x, *p, i;
546 p = (unsigned int*) guid;
550 *str++ = table_enc85[x%85];
552 *str++ = table_enc85[x%85];
554 *str++ = table_enc85[x%85];
556 *str++ = table_enc85[x%85];
558 *str++ = table_enc85[x%85];
565 static void compose_base85_guid(LPSTR component, LPSTR comp_base85, LPSTR squashed)
567 WCHAR guidW[MAX_PATH];
568 WCHAR base85W[MAX_PATH];
569 WCHAR squashedW[MAX_PATH];
574 hr = CoCreateGuid(&guid);
575 ok(hr == S_OK, "Expected S_OK, got %d\n", hr);
577 size = StringFromGUID2(&guid, (LPOLESTR)guidW, MAX_PATH);
578 ok(size == 39, "Expected 39, got %d\n", hr);
580 WideCharToMultiByte(CP_ACP, 0, guidW, size, component, MAX_PATH, NULL, NULL);
581 encode_base85_guid(&guid, base85W);
582 WideCharToMultiByte(CP_ACP, 0, base85W, -1, comp_base85, MAX_PATH, NULL, NULL);
583 squash_guid(guidW, squashedW);
584 WideCharToMultiByte(CP_ACP, 0, squashedW, -1, squashed, MAX_PATH, NULL, NULL);
587 static void test_MsiQueryFeatureState(void)
589 HKEY userkey, localkey, compkey;
590 CHAR prodcode[MAX_PATH];
591 CHAR prod_squashed[MAX_PATH];
592 CHAR component[MAX_PATH];
593 CHAR comp_base85[MAX_PATH];
594 CHAR comp_squashed[MAX_PATH];
595 CHAR keypath[MAX_PATH*2];
600 create_test_guid(prodcode, prod_squashed);
601 compose_base85_guid(component, comp_base85, comp_squashed);
602 get_user_sid(&usersid);
605 state = MsiQueryFeatureStateA(NULL, "feature");
606 ok(state == INSTALLSTATE_INVALIDARG, "Expected INSTALLSTATE_INVALIDARG, got %d\n", state);
609 state = MsiQueryFeatureStateA("", "feature");
610 ok(state == INSTALLSTATE_INVALIDARG, "Expected INSTALLSTATE_INVALIDARG, got %d\n", state);
612 /* garbage prodcode */
613 state = MsiQueryFeatureStateA("garbage", "feature");
614 ok(state == INSTALLSTATE_INVALIDARG, "Expected INSTALLSTATE_INVALIDARG, got %d\n", state);
616 /* guid without brackets */
617 state = MsiQueryFeatureStateA("6700E8CF-95AB-4D9C-BC2C-15840DEA7A5D", "feature");
618 ok(state == INSTALLSTATE_INVALIDARG, "Expected INSTALLSTATE_INVALIDARG, got %d\n", state);
620 /* guid with brackets */
621 state = MsiQueryFeatureStateA("{6700E8CF-95AB-4D9C-BC2C-15840DEA7A5D}", "feature");
622 ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
624 /* same length as guid, but random */
625 state = MsiQueryFeatureStateA("A938G02JF-2NF3N93-VN3-2NNF-3KGKALDNF93", "feature");
626 ok(state == INSTALLSTATE_INVALIDARG, "Expected INSTALLSTATE_INVALIDARG, got %d\n", state);
629 state = MsiQueryFeatureStateA(prodcode, NULL);
630 ok(state == INSTALLSTATE_INVALIDARG, "Expected INSTALLSTATE_INVALIDARG, got %d\n", state);
632 /* empty szFeature */
633 state = MsiQueryFeatureStateA(prodcode, "");
634 ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
636 /* feature key does not exist yet */
637 state = MsiQueryFeatureStateA(prodcode, "feature");
638 ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
640 lstrcpyA(keypath, "Software\\Microsoft\\Installer\\Features\\");
641 lstrcatA(keypath, prod_squashed);
643 res = RegCreateKeyA(HKEY_CURRENT_USER, keypath, &userkey);
644 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
646 /* feature key exists */
647 state = MsiQueryFeatureStateA(prodcode, "feature");
648 ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
650 res = RegSetValueExA(userkey, "feature", 0, REG_SZ, (const BYTE *)"", 2);
651 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
653 state = MsiQueryFeatureStateA(prodcode, "feature");
654 ok(state == INSTALLSTATE_ADVERTISED, "Expected INSTALLSTATE_ADVERTISED, got %d\n", state);
656 lstrcpyA(keypath, "Software\\Microsoft\\Windows\\CurrentVersion\\Installer\\UserData\\");
657 lstrcatA(keypath, usersid);
658 lstrcatA(keypath, "\\Products\\");
659 lstrcatA(keypath, prod_squashed);
660 lstrcatA(keypath, "\\Features");
662 res = RegCreateKeyA(HKEY_LOCAL_MACHINE, keypath, &localkey);
663 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
665 state = MsiQueryFeatureStateA(prodcode, "feature");
666 ok(state == INSTALLSTATE_ADVERTISED, "Expected INSTALLSTATE_ADVERTISED, got %d\n", state);
668 res = RegSetValueExA(localkey, "feature", 0, REG_SZ, (const BYTE *)"aaaaaaaaaaaaaaaaaaa", 20);
669 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
671 state = MsiQueryFeatureStateA(prodcode, "feature");
672 ok(state == INSTALLSTATE_BADCONFIG, "Expected INSTALLSTATE_BADCONFIG, got %d\n", state);
674 res = RegSetValueExA(localkey, "feature", 0, REG_SZ, (const BYTE *)"aaaaaaaaaaaaaaaaaaaa", 21);
675 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
677 state = MsiQueryFeatureStateA(prodcode, "feature");
678 ok(state == INSTALLSTATE_ADVERTISED, "Expected INSTALLSTATE_ADVERTISED, got %d\n", state);
680 res = RegSetValueExA(localkey, "feature", 0, REG_SZ, (const BYTE *)"aaaaaaaaaaaaaaaaaaaaa", 22);
681 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
683 state = MsiQueryFeatureStateA(prodcode, "feature");
684 ok(state == INSTALLSTATE_ADVERTISED, "Expected INSTALLSTATE_ADVERTISED, got %d\n", state);
686 res = RegSetValueExA(localkey, "feature", 0, REG_SZ, (const BYTE *)comp_base85, 21);
687 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
689 state = MsiQueryFeatureStateA(prodcode, "feature");
690 ok(state == INSTALLSTATE_ADVERTISED, "Expected INSTALLSTATE_ADVERTISED, got %d\n", state);
692 lstrcpyA(keypath, "Software\\Microsoft\\Windows\\CurrentVersion\\Installer\\UserData\\");
693 lstrcatA(keypath, usersid);
694 lstrcatA(keypath, "\\Components\\");
695 lstrcatA(keypath, comp_squashed);
697 res = RegCreateKeyA(HKEY_LOCAL_MACHINE, keypath, &compkey);
698 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
700 state = MsiQueryFeatureStateA(prodcode, "feature");
701 ok(state == INSTALLSTATE_ADVERTISED, "Expected INSTALLSTATE_ADVERTISED, got %d\n", state);
703 res = RegSetValueExA(compkey, prod_squashed, 0, REG_SZ, (const BYTE *)"", 1);
704 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
706 state = MsiQueryFeatureStateA(prodcode, "feature");
707 ok(state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
709 res = RegSetValueExA(compkey, prod_squashed, 0, REG_SZ, (const BYTE *)"apple", 1);
710 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
712 state = MsiQueryFeatureStateA(prodcode, "feature");
713 ok(state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
715 RegDeleteValueA(compkey, prod_squashed);
716 RegDeleteValueA(compkey, "");
717 RegDeleteValueA(localkey, "feature");
718 RegDeleteValueA(userkey, "feature");
719 RegDeleteKeyA(userkey, "");
720 RegCloseKey(compkey);
721 RegCloseKey(localkey);
722 RegCloseKey(userkey);
725 static void test_MsiQueryComponentState(void)
727 HKEY compkey, prodkey;
728 CHAR prodcode[MAX_PATH];
729 CHAR prod_squashed[MAX_PATH];
730 CHAR component[MAX_PATH];
731 CHAR comp_base85[MAX_PATH];
732 CHAR comp_squashed[MAX_PATH];
733 CHAR keypath[MAX_PATH];
739 static const INSTALLSTATE MAGIC_ERROR = 0xdeadbeef;
741 if (!pMsiQueryComponentStateA)
743 skip("MsiQueryComponentStateA not implemented\n");
747 create_test_guid(prodcode, prod_squashed);
748 compose_base85_guid(component, comp_base85, comp_squashed);
749 get_user_sid(&usersid);
751 /* NULL szProductCode */
753 r = pMsiQueryComponentStateA(NULL, NULL, MSIINSTALLCONTEXT_MACHINE, component, &state);
754 ok(r == ERROR_INVALID_PARAMETER, "Expected ERROR_INVALID_PARAMETER, got %d\n", r);
755 ok(state == MAGIC_ERROR, "Expected 0xdeadbeef, got %d\n", state);
757 /* empty szProductCode */
759 r = pMsiQueryComponentStateA("", NULL, MSIINSTALLCONTEXT_MACHINE, component, &state);
760 ok(r == ERROR_INVALID_PARAMETER, "Expected ERROR_INVALID_PARAMETER, got %d\n", r);
761 ok(state == MAGIC_ERROR, "Expected 0xdeadbeef, got %d\n", state);
763 /* random szProductCode */
765 r = pMsiQueryComponentStateA("random", NULL, MSIINSTALLCONTEXT_MACHINE, component, &state);
766 ok(r == ERROR_INVALID_PARAMETER, "Expected ERROR_INVALID_PARAMETER, got %d\n", r);
767 ok(state == MAGIC_ERROR, "Expected 0xdeadbeef, got %d\n", state);
769 /* GUID-length szProductCode */
771 r = pMsiQueryComponentStateA("DJANE93KNDNAS-2KN2NR93KMN3LN13=L1N3KDE", NULL, MSIINSTALLCONTEXT_MACHINE, component, &state);
772 ok(r == ERROR_INVALID_PARAMETER, "Expected ERROR_INVALID_PARAMETER, got %d\n", r);
773 ok(state == MAGIC_ERROR, "Expected 0xdeadbeef, got %d\n", state);
775 /* GUID-length with brackets */
777 r = pMsiQueryComponentStateA("{JANE93KNDNAS-2KN2NR93KMN3LN13=L1N3KD}", NULL, MSIINSTALLCONTEXT_MACHINE, component, &state);
778 ok(r == ERROR_INVALID_PARAMETER, "Expected ERROR_INVALID_PARAMETER, got %d\n", r);
779 ok(state == MAGIC_ERROR, "Expected 0xdeadbeef, got %d\n", state);
783 r = pMsiQueryComponentStateA(prodcode, NULL, MSIINSTALLCONTEXT_MACHINE, component, &state);
784 ok(r == ERROR_UNKNOWN_PRODUCT, "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r);
785 ok(state == MAGIC_ERROR, "Expected 0xdeadbeef, got %d\n", state);
788 r = pMsiQueryComponentStateA(prodcode, NULL, MSIINSTALLCONTEXT_MACHINE, component, &state);
789 ok(r == ERROR_UNKNOWN_PRODUCT, "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r);
790 ok(state == MAGIC_ERROR, "Expected 0xdeadbeef, got %d\n", state);
792 lstrcpyA(keypath, "Software\\Classes\\Installer\\Products\\");
793 lstrcatA(keypath, prod_squashed);
795 res = RegCreateKeyA(HKEY_LOCAL_MACHINE, keypath, &prodkey);
796 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
799 r = pMsiQueryComponentStateA(prodcode, NULL, MSIINSTALLCONTEXT_MACHINE, component, &state);
800 ok(r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r);
801 ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
803 RegDeleteKeyA(prodkey, "");
804 RegCloseKey(prodkey);
806 /* create local system product key */
807 lstrcpyA(keypath, "Software\\Microsoft\\Windows\\CurrentVersion\\Installer\\UserData\\S-1-5-18\\Products\\");
808 lstrcatA(keypath, prod_squashed);
809 lstrcatA(keypath, "\\InstallProperties");
811 res = RegCreateKeyA(HKEY_LOCAL_MACHINE, keypath, &prodkey);
812 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
814 /* local system product key exists */
816 r = pMsiQueryComponentStateA(prodcode, NULL, MSIINSTALLCONTEXT_MACHINE, component, &state);
817 ok(r == ERROR_UNKNOWN_PRODUCT, "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r);
818 ok(state == MAGIC_ERROR, "Expected 0xdeadbeef, got %d\n", state);
820 res = RegSetValueExA(prodkey, "LocalPackage", 0, REG_SZ, (const BYTE *)"msitest.msi", 11);
821 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
823 /* LocalPackage value exists */
825 r = pMsiQueryComponentStateA(prodcode, NULL, MSIINSTALLCONTEXT_MACHINE, component, &state);
826 ok(r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r);
827 ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
829 lstrcpyA(keypath, "Software\\Microsoft\\Windows\\CurrentVersion\\Installer\\UserData\\S-1-5-18\\Components\\");
830 lstrcatA(keypath, comp_squashed);
832 res = RegCreateKeyA(HKEY_LOCAL_MACHINE, keypath, &compkey);
833 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
835 /* component key exists */
837 r = pMsiQueryComponentStateA(prodcode, NULL, MSIINSTALLCONTEXT_MACHINE, component, &state);
838 ok(r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r);
839 ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
841 res = RegSetValueExA(compkey, prod_squashed, 0, REG_SZ, (const BYTE *)"", 0);
842 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
844 /* component\product exists */
846 r = pMsiQueryComponentStateA(prodcode, NULL, MSIINSTALLCONTEXT_MACHINE, component, &state);
847 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
848 ok(state == INSTALLSTATE_NOTUSED, "Expected INSTALLSTATE_NOTUSED, got %d\n", state);
850 res = RegSetValueExA(compkey, prod_squashed, 0, REG_SZ, (const BYTE *)"hi", 2);
851 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
854 r = pMsiQueryComponentStateA(prodcode, NULL, MSIINSTALLCONTEXT_MACHINE, component, &state);
855 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
856 ok(state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
858 RegDeleteValueA(prodkey, "LocalPackage");
859 RegDeleteKeyA(prodkey, "");
860 RegDeleteValueA(compkey, prod_squashed);
861 RegDeleteKeyA(prodkey, "");
862 RegCloseKey(prodkey);
863 RegCloseKey(compkey);
865 /* MSIINSTALLCONTEXT_USERUNMANAGED */
868 r = pMsiQueryComponentStateA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED, component, &state);
869 ok(r == ERROR_UNKNOWN_PRODUCT, "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r);
870 ok(state == MAGIC_ERROR, "Expected 0xdeadbeef, got %d\n", state);
872 lstrcpyA(keypath, "Software\\Microsoft\\Installer\\Products\\");
873 lstrcatA(keypath, prod_squashed);
875 res = RegCreateKeyA(HKEY_CURRENT_USER, keypath, &prodkey);
876 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
879 r = pMsiQueryComponentStateA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED, component, &state);
880 ok(r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r);
881 ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
883 RegDeleteKeyA(prodkey, "");
884 RegCloseKey(prodkey);
886 lstrcpyA(keypath, "Software\\Microsoft\\Windows\\CurrentVersion\\Installer\\UserData\\");
887 lstrcatA(keypath, usersid);
888 lstrcatA(keypath, "\\Products\\");
889 lstrcatA(keypath, prod_squashed);
890 lstrcatA(keypath, "\\InstallProperties");
892 res = RegCreateKeyA(HKEY_LOCAL_MACHINE, keypath, &prodkey);
893 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
895 res = RegSetValueExA(prodkey, "LocalPackage", 0, REG_SZ, (const BYTE *)"msitest.msi", 11);
896 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
898 RegCloseKey(prodkey);
901 r = pMsiQueryComponentStateA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED, component, &state);
902 ok(r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r);
903 ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
905 lstrcpyA(keypath, "Software\\Microsoft\\Windows\\CurrentVersion\\Installer\\UserData\\");
906 lstrcatA(keypath, usersid);
907 lstrcatA(keypath, "\\Components\\");
908 lstrcatA(keypath, comp_squashed);
910 res = RegCreateKeyA(HKEY_LOCAL_MACHINE, keypath, &compkey);
911 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
913 /* component key exists */
915 r = pMsiQueryComponentStateA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED, component, &state);
916 ok(r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r);
917 ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
919 res = RegSetValueExA(compkey, prod_squashed, 0, REG_SZ, (const BYTE *)"", 0);
920 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
922 /* component\product exists */
924 r = pMsiQueryComponentStateA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED, component, &state);
925 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
926 ok(state == INSTALLSTATE_NOTUSED, "Expected INSTALLSTATE_NOTUSED, got %d\n", state);
928 res = RegSetValueExA(compkey, prod_squashed, 0, REG_SZ, (const BYTE *)"hi", 2);
929 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
932 r = pMsiQueryComponentStateA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED, component, &state);
933 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
934 ok(state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
936 /* MSIINSTALLCONTEXT_USERMANAGED */
939 r = pMsiQueryComponentStateA(prodcode, NULL, MSIINSTALLCONTEXT_USERMANAGED, component, &state);
940 ok(r == ERROR_UNKNOWN_PRODUCT, "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r);
941 ok(state == MAGIC_ERROR, "Expected 0xdeadbeef, got %d\n", state);
943 lstrcpyA(keypath, "Software\\Microsoft\\Installer\\Products\\");
944 lstrcatA(keypath, prod_squashed);
946 res = RegCreateKeyA(HKEY_CURRENT_USER, keypath, &prodkey);
947 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
950 r = pMsiQueryComponentStateA(prodcode, NULL, MSIINSTALLCONTEXT_USERMANAGED, component, &state);
951 ok(r == ERROR_UNKNOWN_PRODUCT, "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r);
952 ok(state == MAGIC_ERROR, "Expected 0xdeadbeef, got %d\n", state);
954 RegDeleteKeyA(prodkey, "");
955 RegCloseKey(prodkey);
957 lstrcpyA(keypath, "Software\\Microsoft\\Windows\\CurrentVersion\\Installer\\Managed\\");
958 lstrcatA(keypath, usersid);
959 lstrcatA(keypath, "\\Installer\\Products\\");
960 lstrcatA(keypath, prod_squashed);
962 res = RegCreateKeyA(HKEY_LOCAL_MACHINE, keypath, &prodkey);
963 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
966 r = pMsiQueryComponentStateA(prodcode, NULL, MSIINSTALLCONTEXT_USERMANAGED, component, &state);
967 ok(r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r);
968 ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
970 RegDeleteKeyA(prodkey, "");
971 RegCloseKey(prodkey);
973 lstrcpyA(keypath, "Software\\Microsoft\\Windows\\CurrentVersion\\Installer\\UserData\\");
974 lstrcatA(keypath, usersid);
975 lstrcatA(keypath, "\\Products\\");
976 lstrcatA(keypath, prod_squashed);
977 lstrcatA(keypath, "\\InstallProperties");
979 res = RegOpenKeyA(HKEY_LOCAL_MACHINE, keypath, &prodkey);
980 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
982 res = RegSetValueExA(prodkey, "ManagedLocalPackage", 0, REG_SZ, (const BYTE *)"msitest.msi", 11);
983 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
986 r = pMsiQueryComponentStateA(prodcode, NULL, MSIINSTALLCONTEXT_USERMANAGED, component, &state);
987 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
988 ok(state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
990 RegDeleteValueA(prodkey, "LocalPackage");
991 RegDeleteValueA(prodkey, "ManagedLocalPackage");
992 RegDeleteKeyA(prodkey, "");
993 RegDeleteValueA(compkey, prod_squashed);
994 RegDeleteKeyA(compkey, "");
995 RegCloseKey(prodkey);
996 RegCloseKey(compkey);
999 static void test_MsiGetComponentPath(void)
1001 HKEY compkey, prodkey, installprop;
1002 CHAR prodcode[MAX_PATH];
1003 CHAR prod_squashed[MAX_PATH];
1004 CHAR component[MAX_PATH];
1005 CHAR comp_base85[MAX_PATH];
1006 CHAR comp_squashed[MAX_PATH];
1007 CHAR keypath[MAX_PATH];
1008 CHAR path[MAX_PATH];
1014 create_test_guid(prodcode, prod_squashed);
1015 compose_base85_guid(component, comp_base85, comp_squashed);
1016 get_user_sid(&usersid);
1018 /* NULL szProduct */
1020 state = MsiGetComponentPathA(NULL, component, path, &size);
1021 ok(state == INSTALLSTATE_INVALIDARG, "Expected INSTALLSTATE_INVALIDARG, got %d\n", state);
1022 ok(size == MAX_PATH, "Expected size to be unchanged, got %d\n", size);
1024 /* NULL szComponent */
1026 state = MsiGetComponentPathA(prodcode, NULL, path, &size);
1027 ok(state == INSTALLSTATE_INVALIDARG, "Expected INSTALLSTATE_INVALIDARG, got %d\n", state);
1028 ok(size == MAX_PATH, "Expected size to be unchanged, got %d\n", size);
1030 /* NULL lpPathBuf */
1032 state = MsiGetComponentPathA(prodcode, component, NULL, &size);
1033 ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
1034 ok(size == MAX_PATH, "Expected size to be unchanged, got %d\n", size);
1038 state = MsiGetComponentPathA(prodcode, component, path, NULL);
1039 ok(state == INSTALLSTATE_INVALIDARG, "Expected INSTALLSTATE_INVALIDARG, got %d\n", state);
1040 ok(size == MAX_PATH, "Expected size to be unchanged, got %d\n", size);
1042 /* all params valid */
1044 state = MsiGetComponentPathA(prodcode, component, path, &size);
1045 ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
1046 ok(size == MAX_PATH, "Expected size to be unchanged, got %d\n", size);
1048 lstrcpyA(keypath, "Software\\Microsoft\\Windows\\CurrentVersion\\");
1049 lstrcatA(keypath, "Installer\\UserData\\S-1-5-18\\Components\\");
1050 lstrcatA(keypath, comp_squashed);
1052 res = RegCreateKeyA(HKEY_LOCAL_MACHINE, keypath, &compkey);
1053 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
1055 /* local system component key exists */
1057 state = MsiGetComponentPathA(prodcode, component, path, &size);
1058 ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
1059 ok(size == MAX_PATH, "Expected size to be unchanged, got %d\n", size);
1061 res = RegSetValueExA(compkey, prod_squashed, 0, REG_SZ, (const BYTE *)"C:\\imapath", 10);
1062 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
1064 /* product value exists */
1066 state = MsiGetComponentPathA(prodcode, component, path, &size);
1067 ok(state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
1068 ok(!lstrcmpA(path, "C:\\imapath"), "Expected C:\\imapath, got %s\n", path);
1069 ok(size == 10, "Expected 10, got %d\n", size);
1071 lstrcpyA(keypath, "Software\\Microsoft\\Windows\\CurrentVersion\\");
1072 lstrcatA(keypath, "Installer\\UserData\\S-1-5-18\\Products\\");
1073 lstrcatA(keypath, prod_squashed);
1074 lstrcatA(keypath, "\\InstallProperties");
1076 res = RegCreateKeyA(HKEY_LOCAL_MACHINE, keypath, &installprop);
1077 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
1080 res = RegSetValueExA(installprop, "WindowsInstaller", 0, REG_DWORD, (const BYTE *)&val, sizeof(DWORD));
1081 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
1083 /* install properties key exists */
1085 state = MsiGetComponentPathA(prodcode, component, path, &size);
1086 ok(state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
1087 ok(!lstrcmpA(path, "C:\\imapath"), "Expected C:\\imapath, got %s\n", path);
1088 ok(size == 10, "Expected 10, got %d\n", size);
1090 create_file("C:\\imapath", "C:\\imapath", 11);
1094 state = MsiGetComponentPathA(prodcode, component, path, &size);
1095 ok(state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
1096 ok(!lstrcmpA(path, "C:\\imapath"), "Expected C:\\imapath, got %s\n", path);
1097 ok(size == 10, "Expected 10, got %d\n", size);
1099 RegDeleteValueA(compkey, prod_squashed);
1100 RegDeleteKeyA(compkey, "");
1101 RegDeleteValueA(installprop, "WindowsInstaller");
1102 RegDeleteKeyA(installprop, "");
1103 RegCloseKey(compkey);
1104 RegCloseKey(installprop);
1105 DeleteFileA("C:\\imapath");
1107 lstrcpyA(keypath, "Software\\Microsoft\\Windows\\CurrentVersion\\");
1108 lstrcatA(keypath, "Installer\\UserData\\");
1109 lstrcatA(keypath, usersid);
1110 lstrcatA(keypath, "\\Components\\");
1111 lstrcatA(keypath, comp_squashed);
1113 res = RegCreateKeyA(HKEY_LOCAL_MACHINE, keypath, &compkey);
1114 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
1116 /* user managed component key exists */
1118 state = MsiGetComponentPathA(prodcode, component, path, &size);
1119 ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
1120 ok(size == MAX_PATH, "Expected size to be unchanged, got %d\n", size);
1122 res = RegSetValueExA(compkey, prod_squashed, 0, REG_SZ, (const BYTE *)"C:\\imapath", 10);
1123 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
1125 /* product value exists */
1127 state = MsiGetComponentPathA(prodcode, component, path, &size);
1128 ok(state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
1129 ok(!lstrcmpA(path, "C:\\imapath"), "Expected C:\\imapath, got %s\n", path);
1130 ok(size == 10, "Expected 10, got %d\n", size);
1132 lstrcpyA(keypath, "Software\\Microsoft\\Windows\\CurrentVersion\\");
1133 lstrcatA(keypath, "Installer\\UserData\\S-1-5-18\\Products\\");
1134 lstrcatA(keypath, prod_squashed);
1135 lstrcatA(keypath, "\\InstallProperties");
1137 res = RegCreateKeyA(HKEY_LOCAL_MACHINE, keypath, &installprop);
1138 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
1141 res = RegSetValueExA(installprop, "WindowsInstaller", 0, REG_DWORD, (const BYTE *)&val, sizeof(DWORD));
1142 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
1144 /* install properties key exists */
1146 state = MsiGetComponentPathA(prodcode, component, path, &size);
1147 ok(state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
1148 ok(!lstrcmpA(path, "C:\\imapath"), "Expected C:\\imapath, got %s\n", path);
1149 ok(size == 10, "Expected 10, got %d\n", size);
1151 create_file("C:\\imapath", "C:\\imapath", 11);
1155 state = MsiGetComponentPathA(prodcode, component, path, &size);
1156 ok(state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
1157 ok(!lstrcmpA(path, "C:\\imapath"), "Expected C:\\imapath, got %s\n", path);
1158 ok(size == 10, "Expected 10, got %d\n", size);
1160 RegDeleteValueA(compkey, prod_squashed);
1161 RegDeleteKeyA(compkey, "");
1162 RegDeleteValueA(installprop, "WindowsInstaller");
1163 RegDeleteKeyA(installprop, "");
1164 RegCloseKey(compkey);
1165 RegCloseKey(installprop);
1166 DeleteFileA("C:\\imapath");
1168 lstrcpyA(keypath, "Software\\Microsoft\\Windows\\CurrentVersion\\");
1169 lstrcatA(keypath, "Installer\\Managed\\");
1170 lstrcatA(keypath, usersid);
1171 lstrcatA(keypath, "\\Installer\\Products\\");
1172 lstrcatA(keypath, prod_squashed);
1174 res = RegCreateKeyA(HKEY_LOCAL_MACHINE, keypath, &prodkey);
1175 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
1177 /* user managed product key exists */
1179 state = MsiGetComponentPathA(prodcode, component, path, &size);
1180 ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
1181 ok(size == MAX_PATH, "Expected size to be unchanged, got %d\n", size);
1183 lstrcpyA(keypath, "Software\\Microsoft\\Windows\\CurrentVersion\\");
1184 lstrcatA(keypath, "Installer\\UserData\\");
1185 lstrcatA(keypath, usersid);
1186 lstrcatA(keypath, "\\Components\\");
1187 lstrcatA(keypath, comp_squashed);
1189 res = RegCreateKeyA(HKEY_LOCAL_MACHINE, keypath, &compkey);
1190 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
1192 /* user managed component key exists */
1194 state = MsiGetComponentPathA(prodcode, component, path, &size);
1195 ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
1196 ok(size == MAX_PATH, "Expected size to be unchanged, got %d\n", size);
1198 res = RegSetValueExA(compkey, prod_squashed, 0, REG_SZ, (const BYTE *)"C:\\imapath", 10);
1199 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
1201 /* product value exists */
1203 state = MsiGetComponentPathA(prodcode, component, path, &size);
1204 ok(state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
1205 ok(!lstrcmpA(path, "C:\\imapath"), "Expected C:\\imapath, got %s\n", path);
1206 ok(size == 10, "Expected 10, got %d\n", size);
1208 lstrcpyA(keypath, "Software\\Microsoft\\Windows\\CurrentVersion\\");
1209 lstrcatA(keypath, "Installer\\UserData\\S-1-5-18\\Products\\");
1210 lstrcatA(keypath, prod_squashed);
1211 lstrcatA(keypath, "\\InstallProperties");
1213 res = RegCreateKeyA(HKEY_LOCAL_MACHINE, keypath, &installprop);
1214 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
1217 res = RegSetValueExA(installprop, "WindowsInstaller", 0, REG_DWORD, (const BYTE *)&val, sizeof(DWORD));
1218 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
1220 /* install properties key exists */
1222 state = MsiGetComponentPathA(prodcode, component, path, &size);
1223 ok(state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
1224 ok(!lstrcmpA(path, "C:\\imapath"), "Expected C:\\imapath, got %s\n", path);
1225 ok(size == 10, "Expected 10, got %d\n", size);
1227 create_file("C:\\imapath", "C:\\imapath", 11);
1231 state = MsiGetComponentPathA(prodcode, component, path, &size);
1232 ok(state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
1233 ok(!lstrcmpA(path, "C:\\imapath"), "Expected C:\\imapath, got %s\n", path);
1234 ok(size == 10, "Expected 10, got %d\n", size);
1236 RegDeleteValueA(compkey, prod_squashed);
1237 RegDeleteKeyA(prodkey, "");
1238 RegDeleteKeyA(compkey, "");
1239 RegDeleteValueA(installprop, "WindowsInstaller");
1240 RegDeleteKeyA(installprop, "");
1241 RegCloseKey(prodkey);
1242 RegCloseKey(compkey);
1243 RegCloseKey(installprop);
1244 DeleteFileA("C:\\imapath");
1246 lstrcpyA(keypath, "Software\\Microsoft\\Installer\\Products\\");
1247 lstrcatA(keypath, prod_squashed);
1249 res = RegCreateKeyA(HKEY_CURRENT_USER, keypath, &prodkey);
1250 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
1252 /* user unmanaged product key exists */
1254 state = MsiGetComponentPathA(prodcode, component, path, &size);
1255 ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
1256 ok(size == MAX_PATH, "Expected size to be unchanged, got %d\n", size);
1258 lstrcpyA(keypath, "Software\\Microsoft\\Windows\\CurrentVersion\\");
1259 lstrcatA(keypath, "Installer\\UserData\\");
1260 lstrcatA(keypath, usersid);
1261 lstrcatA(keypath, "\\Components\\");
1262 lstrcatA(keypath, comp_squashed);
1264 res = RegCreateKeyA(HKEY_LOCAL_MACHINE, keypath, &compkey);
1265 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
1267 /* user unmanaged component key exists */
1269 state = MsiGetComponentPathA(prodcode, component, path, &size);
1270 ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
1271 ok(size == MAX_PATH, "Expected size to be unchanged, got %d\n", size);
1273 res = RegSetValueExA(compkey, prod_squashed, 0, REG_SZ, (const BYTE *)"C:\\imapath", 10);
1274 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
1276 /* product value exists */
1278 state = MsiGetComponentPathA(prodcode, component, path, &size);
1279 ok(state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
1280 ok(!lstrcmpA(path, "C:\\imapath"), "Expected C:\\imapath, got %s\n", path);
1281 ok(size == 10, "Expected 10, got %d\n", size);
1283 create_file("C:\\imapath", "C:\\imapath", 11);
1287 state = MsiGetComponentPathA(prodcode, component, path, &size);
1288 ok(state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
1289 ok(!lstrcmpA(path, "C:\\imapath"), "Expected C:\\imapath, got %s\n", path);
1290 ok(size == 10, "Expected 10, got %d\n", size);
1292 RegDeleteValueA(compkey, prod_squashed);
1293 RegDeleteKeyA(prodkey, "");
1294 RegDeleteKeyA(compkey, "");
1295 RegCloseKey(prodkey);
1296 RegCloseKey(compkey);
1297 RegCloseKey(installprop);
1298 DeleteFileA("C:\\imapath");
1300 lstrcpyA(keypath, "Software\\Classes\\Installer\\Products\\");
1301 lstrcatA(keypath, prod_squashed);
1303 res = RegCreateKeyA(HKEY_LOCAL_MACHINE, keypath, &prodkey);
1304 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
1306 /* local classes product key exists */
1308 state = MsiGetComponentPathA(prodcode, component, path, &size);
1309 ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
1310 ok(size == MAX_PATH, "Expected size to be unchanged, got %d\n", size);
1312 lstrcpyA(keypath, "Software\\Microsoft\\Windows\\CurrentVersion\\");
1313 lstrcatA(keypath, "Installer\\UserData\\S-1-5-18\\Components\\");
1314 lstrcatA(keypath, comp_squashed);
1316 res = RegCreateKeyA(HKEY_LOCAL_MACHINE, keypath, &compkey);
1317 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
1319 /* local user component key exists */
1321 state = MsiGetComponentPathA(prodcode, component, path, &size);
1322 ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
1323 ok(size == MAX_PATH, "Expected size to be unchanged, got %d\n", size);
1325 res = RegSetValueExA(compkey, prod_squashed, 0, REG_SZ, (const BYTE *)"C:\\imapath", 10);
1326 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
1328 /* product value exists */
1330 state = MsiGetComponentPathA(prodcode, component, path, &size);
1331 ok(state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
1332 ok(!lstrcmpA(path, "C:\\imapath"), "Expected C:\\imapath, got %s\n", path);
1333 ok(size == 10, "Expected 10, got %d\n", size);
1335 create_file("C:\\imapath", "C:\\imapath", 11);
1339 state = MsiGetComponentPathA(prodcode, component, path, &size);
1340 ok(state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
1341 ok(!lstrcmpA(path, "C:\\imapath"), "Expected C:\\imapath, got %s\n", path);
1342 ok(size == 10, "Expected 10, got %d\n", size);
1344 RegDeleteValueA(compkey, prod_squashed);
1345 RegDeleteKeyA(prodkey, "");
1346 RegDeleteKeyA(compkey, "");
1347 RegCloseKey(prodkey);
1348 RegCloseKey(compkey);
1349 DeleteFileA("C:\\imapath");
1352 static void test_MsiGetProductCode(void)
1354 HKEY compkey, prodkey;
1355 CHAR prodcode[MAX_PATH];
1356 CHAR prod_squashed[MAX_PATH];
1357 CHAR prodcode2[MAX_PATH];
1358 CHAR prod2_squashed[MAX_PATH];
1359 CHAR component[MAX_PATH];
1360 CHAR comp_base85[MAX_PATH];
1361 CHAR comp_squashed[MAX_PATH];
1362 CHAR keypath[MAX_PATH];
1363 CHAR product[MAX_PATH];
1368 create_test_guid(prodcode, prod_squashed);
1369 create_test_guid(prodcode2, prod2_squashed);
1370 compose_base85_guid(component, comp_base85, comp_squashed);
1371 get_user_sid(&usersid);
1373 /* szComponent is NULL */
1374 lstrcpyA(product, "prod");
1375 r = MsiGetProductCodeA(NULL, product);
1376 ok(r == ERROR_INVALID_PARAMETER, "Expected ERROR_INVALID_PARAMETER, got %d\n", r);
1377 ok(!lstrcmpA(product, "prod"), "Expected product to be unchanged, got %s\n", product);
1379 /* szComponent is empty */
1380 lstrcpyA(product, "prod");
1381 r = MsiGetProductCodeA("", product);
1382 ok(r == ERROR_INVALID_PARAMETER, "Expected ERROR_INVALID_PARAMETER, got %d\n", r);
1383 ok(!lstrcmpA(product, "prod"), "Expected product to be unchanged, got %s\n", product);
1385 /* garbage szComponent */
1386 lstrcpyA(product, "prod");
1387 r = MsiGetProductCodeA("garbage", product);
1388 ok(r == ERROR_INVALID_PARAMETER, "Expected ERROR_INVALID_PARAMETER, got %d\n", r);
1389 ok(!lstrcmpA(product, "prod"), "Expected product to be unchanged, got %s\n", product);
1391 /* guid without brackets */
1392 lstrcpyA(product, "prod");
1393 r = MsiGetProductCodeA("6700E8CF-95AB-4D9C-BC2C-15840DEA7A5D", product);
1394 ok(r == ERROR_INVALID_PARAMETER, "Expected ERROR_INVALID_PARAMETER, got %d\n", r);
1395 ok(!lstrcmpA(product, "prod"), "Expected product to be unchanged, got %s\n", product);
1397 /* guid with brackets */
1398 lstrcpyA(product, "prod");
1399 r = MsiGetProductCodeA("{6700E8CF-95AB-4D9C-BC2C-15840DEA7A5D}", product);
1400 ok(r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r);
1401 ok(!lstrcmpA(product, "prod"), "Expected product to be unchanged, got %s\n", product);
1403 /* same length as guid, but random */
1404 lstrcpyA(product, "prod");
1405 r = MsiGetProductCodeA("A938G02JF-2NF3N93-VN3-2NNF-3KGKALDNF93", product);
1406 ok(r == ERROR_INVALID_PARAMETER, "Expected ERROR_INVALID_PARAMETER, got %d\n", r);
1407 ok(!lstrcmpA(product, "prod"), "Expected product to be unchanged, got %s\n", product);
1409 /* all params correct, szComponent not published */
1410 lstrcpyA(product, "prod");
1411 r = MsiGetProductCodeA(component, product);
1412 ok(r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r);
1413 ok(!lstrcmpA(product, "prod"), "Expected product to be unchanged, got %s\n", product);
1415 lstrcpyA(keypath, "Software\\Microsoft\\Windows\\CurrentVersion\\");
1416 lstrcatA(keypath, "Installer\\UserData\\");
1417 lstrcatA(keypath, usersid);
1418 lstrcatA(keypath, "\\Components\\");
1419 lstrcatA(keypath, comp_squashed);
1421 res = RegCreateKeyA(HKEY_LOCAL_MACHINE, keypath, &compkey);
1422 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
1424 /* user unmanaged component key exists */
1425 lstrcpyA(product, "prod");
1426 r = MsiGetProductCodeA(component, product);
1427 ok(r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r);
1428 ok(!lstrcmpA(product, "prod"), "Expected product to be unchanged, got %s\n", product);
1430 res = RegSetValueExA(compkey, prod_squashed, 0, REG_SZ, (const BYTE *)"C:\\imapath", 10);
1431 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
1433 /* product value exists */
1434 lstrcpyA(product, "prod");
1435 r = MsiGetProductCodeA(component, product);
1436 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
1437 ok(!lstrcmpA(product, prodcode), "Expected %s, got %s\n", prodcode, product);
1439 res = RegSetValueExA(compkey, prod2_squashed, 0, REG_SZ, (const BYTE *)"C:\\another", 10);
1440 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
1442 lstrcpyA(keypath, "Software\\Microsoft\\Windows\\CurrentVersion\\");
1443 lstrcatA(keypath, "Installer\\Managed\\");
1444 lstrcatA(keypath, usersid);
1445 lstrcatA(keypath, "\\Installer\\Products\\");
1446 lstrcatA(keypath, prod_squashed);
1448 res = RegCreateKeyA(HKEY_LOCAL_MACHINE, keypath, &prodkey);
1449 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
1451 /* user managed product key of first product exists */
1452 lstrcpyA(product, "prod");
1453 r = MsiGetProductCodeA(component, product);
1454 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
1455 ok(!lstrcmpA(product, prodcode), "Expected %s, got %s\n", prodcode, product);
1457 RegDeleteKeyA(prodkey, "");
1458 RegCloseKey(prodkey);
1460 RegDeleteKeyA(prodkey, "");
1461 RegCloseKey(prodkey);
1463 lstrcpyA(keypath, "Software\\Microsoft\\Installer\\Products\\");
1464 lstrcatA(keypath, prod_squashed);
1466 res = RegCreateKeyA(HKEY_CURRENT_USER, keypath, &prodkey);
1467 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
1469 /* user unmanaged product key exists */
1470 lstrcpyA(product, "prod");
1471 r = MsiGetProductCodeA(component, product);
1472 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
1473 ok(!lstrcmpA(product, prodcode), "Expected %s, got %s\n", prodcode, product);
1475 RegDeleteKeyA(prodkey, "");
1476 RegCloseKey(prodkey);
1478 lstrcpyA(keypath, "Software\\Classes\\Installer\\Products\\");
1479 lstrcatA(keypath, prod_squashed);
1481 res = RegCreateKeyA(HKEY_LOCAL_MACHINE, keypath, &prodkey);
1482 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
1484 /* local classes product key exists */
1485 lstrcpyA(product, "prod");
1486 r = MsiGetProductCodeA(component, product);
1487 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
1488 ok(!lstrcmpA(product, prodcode), "Expected %s, got %s\n", prodcode, product);
1490 RegDeleteKeyA(prodkey, "");
1491 RegCloseKey(prodkey);
1493 lstrcpyA(keypath, "Software\\Microsoft\\Windows\\CurrentVersion\\");
1494 lstrcatA(keypath, "Installer\\Managed\\");
1495 lstrcatA(keypath, usersid);
1496 lstrcatA(keypath, "\\Installer\\Products\\");
1497 lstrcatA(keypath, prod2_squashed);
1499 res = RegCreateKeyA(HKEY_LOCAL_MACHINE, keypath, &prodkey);
1500 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
1502 /* user managed product key of second product exists */
1503 lstrcpyA(product, "prod");
1504 r = MsiGetProductCodeA(component, product);
1505 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
1506 ok(!lstrcmpA(product, prodcode2), "Expected %s, got %s\n", prodcode2, product);
1508 RegDeleteKeyA(prodkey, "");
1509 RegCloseKey(prodkey);
1510 RegDeleteValueA(compkey, prod_squashed);
1511 RegDeleteValueA(compkey, prod2_squashed);
1512 RegDeleteKeyA(compkey, "");
1513 RegCloseKey(compkey);
1515 lstrcpyA(keypath, "Software\\Microsoft\\Windows\\CurrentVersion\\");
1516 lstrcatA(keypath, "Installer\\UserData\\S-1-5-18\\Components\\");
1517 lstrcatA(keypath, comp_squashed);
1519 res = RegCreateKeyA(HKEY_LOCAL_MACHINE, keypath, &compkey);
1520 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
1522 /* local user component key exists */
1523 lstrcpyA(product, "prod");
1524 r = MsiGetProductCodeA(component, product);
1525 ok(r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r);
1526 ok(!lstrcmpA(product, "prod"), "Expected product to be unchanged, got %s\n", product);
1528 res = RegSetValueExA(compkey, prod_squashed, 0, REG_SZ, (const BYTE *)"C:\\imapath", 10);
1529 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
1531 /* product value exists */
1532 lstrcpyA(product, "prod");
1533 r = MsiGetProductCodeA(component, product);
1534 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
1535 ok(!lstrcmpA(product, prodcode), "Expected %s, got %s\n", prodcode, product);
1537 res = RegSetValueExA(compkey, prod2_squashed, 0, REG_SZ, (const BYTE *)"C:\\another", 10);
1538 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
1540 lstrcpyA(keypath, "Software\\Microsoft\\Windows\\CurrentVersion\\");
1541 lstrcatA(keypath, "Installer\\Managed\\");
1542 lstrcatA(keypath, usersid);
1543 lstrcatA(keypath, "\\Installer\\Products\\");
1544 lstrcatA(keypath, prod_squashed);
1546 res = RegCreateKeyA(HKEY_LOCAL_MACHINE, keypath, &prodkey);
1547 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
1549 /* user managed product key of first product exists */
1550 lstrcpyA(product, "prod");
1551 r = MsiGetProductCodeA(component, product);
1552 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
1553 ok(!lstrcmpA(product, prodcode), "Expected %s, got %s\n", prodcode, product);
1555 RegDeleteKeyA(prodkey, "");
1556 RegCloseKey(prodkey);
1558 lstrcpyA(keypath, "Software\\Microsoft\\Installer\\Products\\");
1559 lstrcatA(keypath, prod_squashed);
1561 res = RegCreateKeyA(HKEY_CURRENT_USER, keypath, &prodkey);
1562 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
1564 /* user unmanaged product key exists */
1565 lstrcpyA(product, "prod");
1566 r = MsiGetProductCodeA(component, product);
1567 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
1568 ok(!lstrcmpA(product, prodcode), "Expected %s, got %s\n", prodcode, product);
1570 RegDeleteKeyA(prodkey, "");
1571 RegCloseKey(prodkey);
1573 lstrcpyA(keypath, "Software\\Classes\\Installer\\Products\\");
1574 lstrcatA(keypath, prod_squashed);
1576 res = RegCreateKeyA(HKEY_LOCAL_MACHINE, keypath, &prodkey);
1577 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
1579 /* local classes product key exists */
1580 lstrcpyA(product, "prod");
1581 r = MsiGetProductCodeA(component, product);
1582 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
1583 ok(!lstrcmpA(product, prodcode), "Expected %s, got %s\n", prodcode, product);
1585 RegDeleteKeyA(prodkey, "");
1586 RegCloseKey(prodkey);
1588 lstrcpyA(keypath, "Software\\Microsoft\\Windows\\CurrentVersion\\");
1589 lstrcatA(keypath, "Installer\\Managed\\");
1590 lstrcatA(keypath, usersid);
1591 lstrcatA(keypath, "\\Installer\\Products\\");
1592 lstrcatA(keypath, prod2_squashed);
1594 res = RegCreateKeyA(HKEY_LOCAL_MACHINE, keypath, &prodkey);
1595 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
1597 /* user managed product key of second product exists */
1598 lstrcpyA(product, "prod");
1599 r = MsiGetProductCodeA(component, product);
1600 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
1601 ok(!lstrcmpA(product, prodcode2), "Expected %s, got %s\n", prodcode2, product);
1603 RegDeleteKeyA(prodkey, "");
1604 RegCloseKey(prodkey);
1605 RegDeleteValueA(compkey, prod_squashed);
1606 RegDeleteValueA(compkey, prod2_squashed);
1607 RegDeleteKeyA(compkey, "");
1608 RegCloseKey(compkey);
1611 static void test_MsiEnumClients(void)
1614 CHAR prodcode[MAX_PATH];
1615 CHAR prod_squashed[MAX_PATH];
1616 CHAR prodcode2[MAX_PATH];
1617 CHAR prod2_squashed[MAX_PATH];
1618 CHAR component[MAX_PATH];
1619 CHAR comp_base85[MAX_PATH];
1620 CHAR comp_squashed[MAX_PATH];
1621 CHAR product[MAX_PATH];
1622 CHAR keypath[MAX_PATH];
1627 create_test_guid(prodcode, prod_squashed);
1628 create_test_guid(prodcode2, prod2_squashed);
1629 compose_base85_guid(component, comp_base85, comp_squashed);
1630 get_user_sid(&usersid);
1632 /* NULL szComponent */
1634 r = MsiEnumClientsA(NULL, 0, product);
1635 ok(r == ERROR_INVALID_PARAMETER, "Expected ERROR_INVALID_PARAMETER, got %d\n", r);
1636 ok(!lstrcmpA(product, ""), "Expected product to be unchanged, got %s\n", product);
1638 /* empty szComponent */
1640 r = MsiEnumClientsA("", 0, product);
1641 ok(r == ERROR_INVALID_PARAMETER, "Expected ERROR_INVALID_PARAMETER, got %d\n", r);
1642 ok(!lstrcmpA(product, ""), "Expected product to be unchanged, got %s\n", product);
1644 /* NULL lpProductBuf */
1645 r = MsiEnumClientsA(component, 0, NULL);
1646 ok(r == ERROR_INVALID_PARAMETER, "Expected ERROR_INVALID_PARAMETER, got %d\n", r);
1648 /* all params correct, component missing */
1650 r = MsiEnumClientsA(component, 0, product);
1651 ok(r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r);
1652 ok(!lstrcmpA(product, ""), "Expected product to be unchanged, got %s\n", product);
1654 lstrcpyA(keypath, "Software\\Microsoft\\Windows\\CurrentVersion\\");
1655 lstrcatA(keypath, "Installer\\UserData\\");
1656 lstrcatA(keypath, usersid);
1657 lstrcatA(keypath, "\\Components\\");
1658 lstrcatA(keypath, comp_squashed);
1660 res = RegCreateKeyA(HKEY_LOCAL_MACHINE, keypath, &compkey);
1661 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
1663 /* user unmanaged component key exists */
1665 r = MsiEnumClientsA(component, 0, product);
1666 ok(r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r);
1667 ok(!lstrcmpA(product, ""), "Expected product to be unchanged, got %s\n", product);
1669 /* index > 0, no products exist */
1671 r = MsiEnumClientsA(component, 1, product);
1672 ok(r == ERROR_INVALID_PARAMETER, "Expected ERROR_INVALID_PARAMETER, got %d\n", r);
1673 ok(!lstrcmpA(product, ""), "Expected product to be unchanged, got %s\n", product);
1675 res = RegSetValueExA(compkey, prod_squashed, 0, REG_SZ, (const BYTE *)"C:\\imapath", 10);
1676 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
1678 /* product value exists */
1679 r = MsiEnumClientsA(component, 0, product);
1680 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
1681 ok(!lstrcmpA(product, prodcode), "Expected %s, got %s\n", prodcode, product);
1683 /* try index 0 again */
1685 r = MsiEnumClientsA(component, 0, product);
1686 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
1687 ok(!lstrcmpA(product, prodcode), "Expected %s, got %s\n", prodcode, product);
1689 /* try index 1, second product value does not exist */
1691 r = MsiEnumClientsA(component, 1, product);
1692 ok(r == ERROR_NO_MORE_ITEMS, "Expected ERROR_NO_MORE_ITEMS, got %d\n", r);
1693 ok(!lstrcmpA(product, ""), "Expected product to be unchanged, got %s\n", product);
1695 res = RegSetValueExA(compkey, prod2_squashed, 0, REG_SZ, (const BYTE *)"C:\\another", 10);
1696 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
1698 /* try index 1, second product value does exist */
1700 r = MsiEnumClientsA(component, 1, product);
1703 ok(r == ERROR_INVALID_PARAMETER, "Expected ERROR_INVALID_PARAMETER, got %d\n", r);
1704 ok(!lstrcmpA(product, ""), "Expected product to be unchanged, got %s\n", product);
1707 /* start the enumeration over */
1709 r = MsiEnumClientsA(component, 0, product);
1710 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
1711 ok(!lstrcmpA(product, prodcode) || !lstrcmpA(product, prodcode2),
1712 "Expected %s or %s, got %s\n", prodcode, prodcode2, product);
1714 /* correctly query second product */
1716 r = MsiEnumClientsA(component, 1, product);
1717 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
1718 ok(!lstrcmpA(product, prodcode) || !lstrcmpA(product, prodcode2),
1719 "Expected %s or %s, got %s\n", prodcode, prodcode2, product);
1721 RegDeleteValueA(compkey, prod_squashed);
1722 RegDeleteValueA(compkey, prod2_squashed);
1723 RegDeleteKeyA(compkey, "");
1724 RegCloseKey(compkey);
1726 lstrcpyA(keypath, "Software\\Microsoft\\Windows\\CurrentVersion\\");
1727 lstrcatA(keypath, "Installer\\UserData\\S-1-5-18\\Components\\");
1728 lstrcatA(keypath, comp_squashed);
1730 res = RegCreateKeyA(HKEY_LOCAL_MACHINE, keypath, &compkey);
1731 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
1733 /* user local component key exists */
1735 r = MsiEnumClientsA(component, 0, product);
1736 ok(r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r);
1737 ok(!lstrcmpA(product, ""), "Expected product to be unchanged, got %s\n", product);
1739 /* index > 0, no products exist */
1741 r = MsiEnumClientsA(component, 1, product);
1742 ok(r == ERROR_INVALID_PARAMETER, "Expected ERROR_INVALID_PARAMETER, got %d\n", r);
1743 ok(!lstrcmpA(product, ""), "Expected product to be unchanged, got %s\n", product);
1745 res = RegSetValueExA(compkey, prod_squashed, 0, REG_SZ, (const BYTE *)"C:\\imapath", 10);
1746 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
1748 /* product value exists */
1750 r = MsiEnumClientsA(component, 0, product);
1751 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
1752 ok(!lstrcmpA(product, prodcode), "Expected %s, got %s\n", prodcode, product);
1754 /* try index 0 again */
1756 r = MsiEnumClientsA(component, 0, product);
1757 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
1759 /* try index 1, second product value does not exist */
1761 r = MsiEnumClientsA(component, 1, product);
1762 ok(r == ERROR_NO_MORE_ITEMS, "Expected ERROR_NO_MORE_ITEMS, got %d\n", r);
1763 ok(!lstrcmpA(product, ""), "Expected product to be unchanged, got %s\n", product);
1765 res = RegSetValueExA(compkey, prod2_squashed, 0, REG_SZ, (const BYTE *)"C:\\another", 10);
1766 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
1768 /* try index 1, second product value does exist */
1770 r = MsiEnumClientsA(component, 1, product);
1773 ok(r == ERROR_INVALID_PARAMETER, "Expected ERROR_INVALID_PARAMETER, got %d\n", r);
1774 ok(!lstrcmpA(product, ""), "Expected product to be unchanged, got %s\n", product);
1777 /* start the enumeration over */
1779 r = MsiEnumClientsA(component, 0, product);
1780 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
1781 ok(!lstrcmpA(product, prodcode) || !lstrcmpA(product, prodcode2),
1782 "Expected %s or %s, got %s\n", prodcode, prodcode2, product);
1784 /* correctly query second product */
1786 r = MsiEnumClientsA(component, 1, product);
1787 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
1788 ok(!lstrcmpA(product, prodcode) || !lstrcmpA(product, prodcode2),
1789 "Expected %s or %s, got %s\n", prodcode, prodcode2, product);
1791 RegDeleteValueA(compkey, prod_squashed);
1792 RegDeleteValueA(compkey, prod2_squashed);
1793 RegDeleteKeyA(compkey, "");
1794 RegCloseKey(compkey);
1797 static void get_version_info(LPSTR path, LPSTR *vercheck, LPDWORD verchecksz,
1798 LPSTR *langcheck, LPDWORD langchecksz)
1801 VS_FIXEDFILEINFO *ffi;
1802 DWORD size = GetFileVersionInfoSizeA(path, NULL);
1805 version = HeapAlloc(GetProcessHeap(), 0, size);
1806 GetFileVersionInfoA(path, 0, size, version);
1808 VerQueryValueA(version, "\\", (LPVOID *)&ffi, &size);
1809 *vercheck = HeapAlloc(GetProcessHeap(), 0, MAX_PATH);
1810 sprintf(*vercheck, "%d.%d.%d.%d", HIWORD(ffi->dwFileVersionMS),
1811 LOWORD(ffi->dwFileVersionMS), HIWORD(ffi->dwFileVersionLS),
1812 LOWORD(ffi->dwFileVersionLS));
1813 *verchecksz = lstrlenA(*vercheck);
1815 VerQueryValue(version, "\\VarFileInfo\\Translation", (void **)&lang, &size);
1816 *langcheck = HeapAlloc(GetProcessHeap(), 0, MAX_PATH);
1817 sprintf(*langcheck, "%d", *lang);
1818 *langchecksz = lstrlenA(*langcheck);
1820 HeapFree(GetProcessHeap(), 0, version);
1823 static void test_MsiGetFileVersion(void)
1826 DWORD versz, langsz;
1827 char version[MAX_PATH];
1828 char lang[MAX_PATH];
1829 char path[MAX_PATH];
1830 LPSTR vercheck, langcheck;
1831 DWORD verchecksz, langchecksz;
1833 /* NULL szFilePath */
1836 lstrcpyA(version, "version");
1837 lstrcpyA(lang, "lang");
1838 r = MsiGetFileVersionA(NULL, version, &versz, lang, &langsz);
1839 ok(r == ERROR_INVALID_PARAMETER,
1840 "Expected ERROR_INVALID_PARAMETER, got %d\n", r);
1841 ok(!lstrcmpA(version, "version"),
1842 "Expected version to be unchanged, got %s\n", version);
1843 ok(versz == MAX_PATH, "Expected %d, got %d\n", MAX_PATH, versz);
1844 ok(!lstrcmpA(lang, "lang"),
1845 "Expected lang to be unchanged, got %s\n", lang);
1846 ok(langsz == MAX_PATH, "Expected %d, got %d\n", MAX_PATH, langsz);
1848 /* empty szFilePath */
1851 lstrcpyA(version, "version");
1852 lstrcpyA(lang, "lang");
1853 r = MsiGetFileVersionA("", version, &versz, lang, &langsz);
1854 ok(r == ERROR_FILE_NOT_FOUND,
1855 "Expected ERROR_FILE_NOT_FOUND, got %d\n", r);
1856 ok(!lstrcmpA(version, "version"),
1857 "Expected version to be unchanged, got %s\n", version);
1858 ok(versz == MAX_PATH, "Expected %d, got %d\n", MAX_PATH, versz);
1859 ok(!lstrcmpA(lang, "lang"),
1860 "Expected lang to be unchanged, got %s\n", lang);
1861 ok(langsz == MAX_PATH, "Expected %d, got %d\n", MAX_PATH, langsz);
1863 /* nonexistent szFilePath */
1866 lstrcpyA(version, "version");
1867 lstrcpyA(lang, "lang");
1868 r = MsiGetFileVersionA("nonexistent", version, &versz, lang, &langsz);
1869 ok(r == ERROR_FILE_NOT_FOUND,
1870 "Expected ERROR_FILE_NOT_FOUND, got %d\n", r);
1871 ok(!lstrcmpA(version, "version"),
1872 "Expected version to be unchanged, got %s\n", version);
1873 ok(versz == MAX_PATH, "Expected %d, got %d\n", MAX_PATH, versz);
1874 ok(!lstrcmpA(lang, "lang"),
1875 "Expected lang to be unchanged, got %s\n", lang);
1876 ok(langsz == MAX_PATH, "Expected %d, got %d\n", MAX_PATH, langsz);
1878 /* nonexistent szFilePath, valid lpVersionBuf, NULL pcchVersionBuf */
1881 lstrcpyA(version, "version");
1882 lstrcpyA(lang, "lang");
1883 r = MsiGetFileVersionA("nonexistent", version, NULL, lang, &langsz);
1884 ok(r == ERROR_INVALID_PARAMETER,
1885 "Expected ERROR_INVALID_PARAMETER, got %d\n", r);
1886 ok(!lstrcmpA(version, "version"),
1887 "Expected version to be unchanged, got %s\n", version);
1888 ok(versz == MAX_PATH, "Expected %d, got %d\n", MAX_PATH, versz);
1889 ok(!lstrcmpA(lang, "lang"),
1890 "Expected lang to be unchanged, got %s\n", lang);
1891 ok(langsz == MAX_PATH, "Expected %d, got %d\n", MAX_PATH, langsz);
1893 /* nonexistent szFilePath, valid lpLangBuf, NULL pcchLangBuf */
1896 lstrcpyA(version, "version");
1897 lstrcpyA(lang, "lang");
1898 r = MsiGetFileVersionA("nonexistent", version, &versz, lang, NULL);
1899 ok(r == ERROR_INVALID_PARAMETER,
1900 "Expected ERROR_INVALID_PARAMETER, got %d\n", r);
1901 ok(!lstrcmpA(version, "version"),
1902 "Expected version to be unchanged, got %s\n", version);
1903 ok(versz == MAX_PATH, "Expected %d, got %d\n", MAX_PATH, versz);
1904 ok(!lstrcmpA(lang, "lang"),
1905 "Expected lang to be unchanged, got %s\n", lang);
1906 ok(langsz == MAX_PATH, "Expected %d, got %d\n", MAX_PATH, langsz);
1908 /* nonexistent szFilePath, valid lpVersionBuf, pcchVersionBuf is zero */
1911 lstrcpyA(version, "version");
1912 lstrcpyA(lang, "lang");
1913 r = MsiGetFileVersionA("nonexistent", version, &versz, lang, &langsz);
1914 ok(r == ERROR_FILE_NOT_FOUND,
1915 "Expected ERROR_FILE_NOT_FOUND, got %d\n", r);
1916 ok(!lstrcmpA(version, "version"),
1917 "Expected version to be unchanged, got %s\n", version);
1918 ok(versz == 0, "Expected 0, got %d\n", versz);
1919 ok(!lstrcmpA(lang, "lang"),
1920 "Expected lang to be unchanged, got %s\n", lang);
1921 ok(langsz == MAX_PATH, "Expected %d, got %d\n", MAX_PATH, langsz);
1923 /* nonexistent szFilePath, valid lpLangBuf, pcchLangBuf is zero */
1926 lstrcpyA(version, "version");
1927 lstrcpyA(lang, "lang");
1928 r = MsiGetFileVersionA("nonexistent", version, &versz, lang, &langsz);
1929 ok(r == ERROR_FILE_NOT_FOUND,
1930 "Expected ERROR_FILE_NOT_FOUND, got %d\n", r);
1931 ok(!lstrcmpA(version, "version"),
1932 "Expected version to be unchanged, got %s\n", version);
1933 ok(versz == MAX_PATH, "Expected %d, got %d\n", MAX_PATH, versz);
1934 ok(!lstrcmpA(lang, "lang"),
1935 "Expected lang to be unchanged, got %s\n", lang);
1936 ok(langsz == 0, "Expected 0, got %d\n", langsz);
1938 /* nonexistent szFilePath, rest NULL */
1939 r = MsiGetFileVersionA("nonexistent", NULL, NULL, NULL, NULL);
1940 ok(r == ERROR_FILE_NOT_FOUND,
1941 "Expected ERROR_FILE_NOT_FOUND, got %d\n", r);
1943 create_file("ver.txt", "ver.txt", 20);
1945 /* file exists, no version information */
1948 lstrcpyA(version, "version");
1949 lstrcpyA(lang, "lang");
1950 r = MsiGetFileVersionA("ver.txt", version, &versz, lang, &langsz);
1951 ok(versz == MAX_PATH, "Expected %d, got %d\n", MAX_PATH, versz);
1952 ok(!lstrcmpA(version, "version"),
1953 "Expected version to be unchanged, got %s\n", version);
1954 ok(langsz == MAX_PATH, "Expected %d, got %d\n", MAX_PATH, langsz);
1955 ok(!lstrcmpA(lang, "lang"),
1956 "Expected lang to be unchanged, got %s\n", lang);
1957 ok(r == ERROR_FILE_INVALID,
1958 "Expected ERROR_FILE_INVALID, got %d\n", r);
1960 DeleteFileA("ver.txt");
1962 /* relative path, has version information */
1965 lstrcpyA(version, "version");
1966 lstrcpyA(lang, "lang");
1967 r = MsiGetFileVersionA("kernel32.dll", version, &versz, lang, &langsz);
1970 ok(r == ERROR_FILE_NOT_FOUND,
1971 "Expected ERROR_FILE_NOT_FOUND, got %d\n", r);
1972 ok(!lstrcmpA(version, "version"),
1973 "Expected version to be unchanged, got %s\n", version);
1974 ok(versz == MAX_PATH, "Expected %d, got %d\n", MAX_PATH, versz);
1975 ok(!lstrcmpA(lang, "lang"),
1976 "Expected lang to be unchanged, got %s\n", lang);
1977 ok(langsz == MAX_PATH, "Expected %d, got %d\n", MAX_PATH, langsz);
1980 GetSystemDirectoryA(path, MAX_PATH);
1981 lstrcatA(path, "\\kernel32.dll");
1983 get_version_info(path, &vercheck, &verchecksz, &langcheck, &langchecksz);
1985 /* absolute path, has version information */
1988 lstrcpyA(version, "version");
1989 lstrcpyA(lang, "lang");
1990 r = MsiGetFileVersionA(path, version, &versz, lang, &langsz);
1991 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
1992 ok(versz == verchecksz, "Expected %d, got %d\n", verchecksz, versz);
1993 ok(!lstrcmpA(lang, langcheck), "Expected %s, got %s\n", langcheck, lang);
1994 ok(langsz == langchecksz, "Expected %d, got %d\n", langchecksz, langsz);
1995 ok(!lstrcmpA(version, vercheck),
1996 "Expected %s, got %s\n", vercheck, version);
1998 /* only check version */
2000 lstrcpyA(version, "version");
2001 r = MsiGetFileVersionA(path, version, &versz, NULL, NULL);
2002 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
2003 ok(versz == verchecksz, "Expected %d, got %d\n", verchecksz, versz);
2004 ok(!lstrcmpA(version, vercheck),
2005 "Expected %s, got %s\n", vercheck, version);
2007 /* only check language */
2009 lstrcpyA(lang, "lang");
2010 r = MsiGetFileVersionA(path, NULL, NULL, lang, &langsz);
2011 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
2012 ok(!lstrcmpA(lang, langcheck), "Expected %s, got %s\n", langcheck, lang);
2013 ok(langsz == langchecksz, "Expected %d, got %d\n", langchecksz, langsz);
2015 /* get pcchVersionBuf */
2017 r = MsiGetFileVersionA(path, NULL, &versz, NULL, NULL);
2018 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
2019 ok(versz == verchecksz, "Expected %d, got %d\n", verchecksz, versz);
2021 /* get pcchLangBuf */
2023 r = MsiGetFileVersionA(path, NULL, NULL, NULL, &langsz);
2024 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
2025 ok(langsz == langchecksz, "Expected %d, got %d\n", langchecksz, langsz);
2027 /* pcchVersionBuf not big enough */
2029 lstrcpyA(version, "version");
2030 r = MsiGetFileVersionA(path, version, &versz, NULL, NULL);
2031 ok(r == ERROR_MORE_DATA, "Expected ERROR_MORE_DATA, got %d\n", r);
2032 ok(!strncmp(version, vercheck, 4),
2033 "Expected first 4 characters of %s, got %s\n", vercheck, version);
2034 ok(versz == verchecksz, "Expected %d, got %d\n", verchecksz, versz);
2036 /* pcchLangBuf not big enough */
2038 lstrcpyA(lang, "lang");
2039 r = MsiGetFileVersionA(path, NULL, NULL, lang, &langsz);
2040 ok(r == ERROR_MORE_DATA, "Expected ERROR_MORE_DATA, got %d\n", r);
2041 ok(!strncmp(lang, langcheck, 2),
2042 "Expected first character of %s, got %s\n", langcheck, lang);
2043 ok(langsz == langchecksz, "Expected %d, got %d\n", langchecksz, langsz);
2045 HeapFree(GetProcessHeap(), 0, vercheck);
2046 HeapFree(GetProcessHeap(), 0, langcheck);
2049 static void test_MsiGetProductInfo(void)
2053 HKEY propkey, source;
2054 HKEY prodkey, localkey;
2055 CHAR prodcode[MAX_PATH];
2056 CHAR prod_squashed[MAX_PATH];
2057 CHAR packcode[MAX_PATH];
2058 CHAR pack_squashed[MAX_PATH];
2060 CHAR keypath[MAX_PATH];
2064 create_test_guid(prodcode, prod_squashed);
2065 create_test_guid(packcode, pack_squashed);
2066 get_user_sid(&usersid);
2068 /* NULL szProduct */
2070 lstrcpyA(buf, "apple");
2071 r = MsiGetProductInfoA(NULL, INSTALLPROPERTY_HELPLINK, buf, &sz);
2072 ok(r == ERROR_INVALID_PARAMETER,
2073 "Expected ERROR_INVALID_PARAMETER, got %d\n", r);
2074 ok(!lstrcmpA(buf, "apple"), "Expected buf to be unchanged, got %s\n", buf);
2075 ok(sz == MAX_PATH, "Expected MAX_PATH, got %d\n", sz);
2077 /* empty szProduct */
2079 lstrcpyA(buf, "apple");
2080 r = MsiGetProductInfoA("", INSTALLPROPERTY_HELPLINK, buf, &sz);
2081 ok(r == ERROR_INVALID_PARAMETER,
2082 "Expected ERROR_INVALID_PARAMETER, got %d\n", r);
2083 ok(!lstrcmpA(buf, "apple"), "Expected buf to be unchanged, got %s\n", buf);
2084 ok(sz == MAX_PATH, "Expected MAX_PATH, got %d\n", sz);
2086 /* garbage szProduct */
2088 lstrcpyA(buf, "apple");
2089 r = MsiGetProductInfoA("garbage", INSTALLPROPERTY_HELPLINK, buf, &sz);
2090 ok(r == ERROR_INVALID_PARAMETER,
2091 "Expected ERROR_INVALID_PARAMETER, got %d\n", r);
2092 ok(!lstrcmpA(buf, "apple"), "Expected buf to be unchanged, got %s\n", buf);
2093 ok(sz == MAX_PATH, "Expected MAX_PATH, got %d\n", sz);
2095 /* guid without brackets */
2097 lstrcpyA(buf, "apple");
2098 r = MsiGetProductInfoA("6700E8CF-95AB-4D9C-BC2C-15840DEA7A5D",
2099 INSTALLPROPERTY_HELPLINK, buf, &sz);
2100 ok(r == ERROR_INVALID_PARAMETER,
2101 "Expected ERROR_INVALID_PARAMETER, got %d\n", r);
2102 ok(!lstrcmpA(buf, "apple"), "Expected buf to be unchanged, got %s\n", buf);
2103 ok(sz == MAX_PATH, "Expected MAX_PATH, got %d\n", sz);
2105 /* guid with brackets */
2107 lstrcpyA(buf, "apple");
2108 r = MsiGetProductInfoA("{6700E8CF-95AB-4D9C-BC2C-15840DEA7A5D}",
2109 INSTALLPROPERTY_HELPLINK, buf, &sz);
2110 ok(r == ERROR_UNKNOWN_PRODUCT,
2111 "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r);
2112 ok(!lstrcmpA(buf, "apple"), "Expected buf to be unchanged, got %s\n", buf);
2113 ok(sz == MAX_PATH, "Expected MAX_PATH, got %d\n", sz);
2115 /* same length as guid, but random */
2117 lstrcpyA(buf, "apple");
2118 r = MsiGetProductInfoA("A938G02JF-2NF3N93-VN3-2NNF-3KGKALDNF93",
2119 INSTALLPROPERTY_HELPLINK, buf, &sz);
2120 ok(r == ERROR_INVALID_PARAMETER,
2121 "Expected ERROR_INVALID_PARAMETER, got %d\n", r);
2122 ok(!lstrcmpA(buf, "apple"), "Expected buf to be unchanged, got %s\n", buf);
2123 ok(sz == MAX_PATH, "Expected MAX_PATH, got %d\n", sz);
2125 /* not installed, NULL szAttribute */
2127 lstrcpyA(buf, "apple");
2128 r = MsiGetProductInfoA(prodcode, NULL, buf, &sz);
2129 ok(r == ERROR_INVALID_PARAMETER,
2130 "Expected ERROR_INVALID_PARAMETER, got %d\n", r);
2131 ok(!lstrcmpA(buf, "apple"), "Expected buf to be unchanged, got %s\n", buf);
2132 ok(sz == MAX_PATH, "Expected MAX_PATH, got %d\n", sz);
2134 /* not installed, NULL lpValueBuf */
2136 lstrcpyA(buf, "apple");
2137 r = MsiGetProductInfoA(prodcode, INSTALLPROPERTY_HELPLINK, NULL, &sz);
2138 ok(r == ERROR_UNKNOWN_PRODUCT,
2139 "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r);
2140 ok(!lstrcmpA(buf, "apple"), "Expected buf to be unchanged, got %s\n", buf);
2141 ok(sz == MAX_PATH, "Expected MAX_PATH, got %d\n", sz);
2143 /* not installed, NULL pcchValueBuf */
2145 lstrcpyA(buf, "apple");
2146 r = MsiGetProductInfoA(prodcode, INSTALLPROPERTY_HELPLINK, buf, NULL);
2147 ok(r == ERROR_INVALID_PARAMETER,
2148 "Expected ERROR_INVALID_PARAMETER, got %d\n", r);
2149 ok(!lstrcmpA(buf, "apple"), "Expected buf to be unchanged, got %s\n", buf);
2150 ok(sz == MAX_PATH, "Expected MAX_PATH, got %d\n", sz);
2152 /* created guid cannot possibly be an installed product code */
2154 lstrcpyA(buf, "apple");
2155 r = MsiGetProductInfoA(prodcode, INSTALLPROPERTY_HELPLINK, buf, &sz);
2156 ok(r == ERROR_UNKNOWN_PRODUCT,
2157 "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r);
2158 ok(!lstrcmpA(buf, "apple"), "Expected buf to be unchanged, got %s\n", buf);
2159 ok(sz == MAX_PATH, "Expected MAX_PATH, got %d\n", sz);
2161 lstrcpyA(keypath, "Software\\Microsoft\\Windows\\CurrentVersion\\Installer\\Managed\\");
2162 lstrcatA(keypath, usersid);
2163 lstrcatA(keypath, "\\Installer\\Products\\");
2164 lstrcatA(keypath, prod_squashed);
2166 res = RegCreateKeyA(HKEY_LOCAL_MACHINE, keypath, &prodkey);
2167 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
2169 /* managed product code exists */
2171 lstrcpyA(buf, "apple");
2172 r = MsiGetProductInfoA(prodcode, INSTALLPROPERTY_HELPLINK, buf, &sz);
2173 ok(r == ERROR_UNKNOWN_PROPERTY,
2174 "Expected ERROR_UNKNOWN_PROPERTY, got %d\n", r);
2175 ok(!lstrcmpA(buf, "apple"), "Expected buf to be unchanged, got %s\n", buf);
2176 ok(sz == MAX_PATH, "Expected MAX_PATH, got %d\n", sz);
2178 RegDeleteKeyA(prodkey, "");
2179 RegCloseKey(prodkey);
2181 lstrcpyA(keypath, "Software\\Microsoft\\Windows\\CurrentVersion\\Installer\\UserData\\");
2182 lstrcatA(keypath, usersid);
2183 lstrcatA(keypath, "\\Products\\");
2184 lstrcatA(keypath, prod_squashed);
2186 res = RegCreateKeyA(HKEY_LOCAL_MACHINE, keypath, &localkey);
2187 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
2189 /* local user product code exists */
2191 lstrcpyA(buf, "apple");
2192 r = MsiGetProductInfoA(prodcode, INSTALLPROPERTY_HELPLINK, buf, &sz);
2193 ok(r == ERROR_UNKNOWN_PRODUCT,
2194 "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r);
2195 ok(!lstrcmpA(buf, "apple"), "Expected buf to be unchanged, got %s\n", buf);
2196 ok(sz == MAX_PATH, "Expected MAX_PATH, got %d\n", sz);
2198 lstrcpyA(keypath, "Software\\Microsoft\\Windows\\CurrentVersion\\Installer\\Managed\\");
2199 lstrcatA(keypath, usersid);
2200 lstrcatA(keypath, "\\Installer\\Products\\");
2201 lstrcatA(keypath, prod_squashed);
2203 res = RegCreateKeyA(HKEY_LOCAL_MACHINE, keypath, &prodkey);
2204 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
2206 /* both local and managed product code exist */
2208 lstrcpyA(buf, "apple");
2209 r = MsiGetProductInfoA(prodcode, INSTALLPROPERTY_HELPLINK, buf, &sz);
2210 ok(r == ERROR_UNKNOWN_PROPERTY,
2211 "Expected ERROR_UNKNOWN_PROPERTY, got %d\n", r);
2212 ok(!lstrcmpA(buf, "apple"), "Expected buf to be unchanged, got %s\n", buf);
2213 ok(sz == MAX_PATH, "Expected MAX_PATH, got %d\n", sz);
2215 res = RegCreateKeyA(localkey, "InstallProperties", &propkey);
2216 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
2218 /* InstallProperties key exists */
2220 lstrcpyA(buf, "apple");
2221 r = MsiGetProductInfoA(prodcode, INSTALLPROPERTY_HELPLINK, buf, &sz);
2222 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
2223 ok(!lstrcmpA(buf, ""), "Expected \"\", got \"%s\"\n", buf);
2224 ok(sz == 0, "Expected 0, got %d\n", sz);
2226 res = RegSetValueExA(propkey, "HelpLink", 0, REG_SZ, (LPBYTE)"link", 5);
2227 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
2229 /* HelpLink value exists */
2231 lstrcpyA(buf, "apple");
2232 r = MsiGetProductInfoA(prodcode, INSTALLPROPERTY_HELPLINK, buf, &sz);
2233 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
2234 ok(!lstrcmpA(buf, "link"), "Expected \"link\", got \"%s\"\n", buf);
2235 ok(sz == 4, "Expected 4, got %d\n", sz);
2237 /* pcchBuf is NULL */
2238 r = MsiGetProductInfoA(prodcode, INSTALLPROPERTY_HELPLINK, NULL, NULL);
2239 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
2241 /* lpValueBuf is NULL */
2243 r = MsiGetProductInfoA(prodcode, INSTALLPROPERTY_HELPLINK, NULL, &sz);
2244 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
2245 ok(sz == 4, "Expected 4, got %d\n", sz);
2247 /* lpValueBuf is NULL, pcchValueBuf is too small */
2249 r = MsiGetProductInfoA(prodcode, INSTALLPROPERTY_HELPLINK, NULL, &sz);
2250 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
2251 ok(sz == 4, "Expected 4, got %d\n", sz);
2253 /* lpValueBuf is NULL, pcchValueBuf is too small */
2255 lstrcpyA(buf, "apple");
2256 r = MsiGetProductInfoA(prodcode, INSTALLPROPERTY_HELPLINK, buf, &sz);
2257 ok(!lstrcmpA(buf, "apple"), "Expected buf to remain unchanged, got \"%s\"\n", buf);
2258 ok(r == ERROR_MORE_DATA, "Expected ERROR_MORE_DATA, got %d\n", r);
2259 ok(sz == 4, "Expected 4, got %d\n", sz);
2261 /* lpValueBuf is NULL, pcchValueBuf is exactly 4 */
2263 lstrcpyA(buf, "apple");
2264 r = MsiGetProductInfoA(prodcode, INSTALLPROPERTY_HELPLINK, buf, &sz);
2265 ok(r == ERROR_MORE_DATA, "Expected ERROR_MORE_DATA, got %d\n", r);
2266 ok(!lstrcmpA(buf, "apple"),
2267 "Expected buf to remain unchanged, got \"%s\"\n", buf);
2268 ok(sz == 4, "Expected 4, got %d\n", sz);
2270 res = RegSetValueExA(propkey, "IMadeThis", 0, REG_SZ, (LPBYTE)"random", 7);
2271 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
2273 /* random property not supported by MSI, value exists */
2275 lstrcpyA(buf, "apple");
2276 r = MsiGetProductInfoA(prodcode, "IMadeThis", buf, &sz);
2277 ok(r == ERROR_UNKNOWN_PROPERTY,
2278 "Expected ERROR_UNKNOWN_PROPERTY, got %d\n", r);
2279 ok(!lstrcmpA(buf, "apple"), "Expected \"apple\", got \"%s\"\n", buf);
2280 ok(sz == MAX_PATH, "Expected MAX_PATH, got %d\n", sz);
2282 RegDeleteValueA(propkey, "IMadeThis");
2283 RegDeleteValueA(propkey, "HelpLink");
2284 RegDeleteKeyA(propkey, "");
2285 RegDeleteKeyA(localkey, "");
2286 RegDeleteKeyA(prodkey, "");
2287 RegCloseKey(propkey);
2288 RegCloseKey(localkey);
2289 RegCloseKey(prodkey);
2291 lstrcpyA(keypath, "Software\\Microsoft\\Installer\\Products\\");
2292 lstrcatA(keypath, prod_squashed);
2294 res = RegCreateKeyA(HKEY_CURRENT_USER, keypath, &prodkey);
2295 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
2297 /* user product key exists */
2299 lstrcpyA(buf, "apple");
2300 r = MsiGetProductInfoA(prodcode, INSTALLPROPERTY_HELPLINK, buf, &sz);
2301 ok(r == ERROR_UNKNOWN_PROPERTY,
2302 "Expected ERROR_UNKNOWN_PROPERTY, got %d\n", r);
2303 ok(!lstrcmpA(buf, "apple"), "Expected \"apple\", got \"%s\"\n", buf);
2304 ok(sz == MAX_PATH, "Expected MAX_PATH, got %d\n", sz);
2306 lstrcpyA(keypath, "Software\\Microsoft\\Windows\\CurrentVersion\\Installer\\UserData\\");
2307 lstrcatA(keypath, usersid);
2308 lstrcatA(keypath, "\\Products\\");
2309 lstrcatA(keypath, prod_squashed);
2311 res = RegCreateKeyA(HKEY_LOCAL_MACHINE, keypath, &localkey);
2312 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
2314 /* local user product key exists */
2316 lstrcpyA(buf, "apple");
2317 r = MsiGetProductInfoA(prodcode, INSTALLPROPERTY_HELPLINK, buf, &sz);
2318 ok(r == ERROR_UNKNOWN_PROPERTY,
2319 "Expected ERROR_UNKNOWN_PROPERTY, got %d\n", r);
2320 ok(!lstrcmpA(buf, "apple"), "Expected \"apple\", got \"%s\"\n", buf);
2321 ok(sz == MAX_PATH, "Expected MAX_PATH, got %d\n", sz);
2323 res = RegCreateKeyA(localkey, "InstallProperties", &propkey);
2324 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
2326 /* InstallProperties key exists */
2328 lstrcpyA(buf, "apple");
2329 r = MsiGetProductInfoA(prodcode, INSTALLPROPERTY_HELPLINK, buf, &sz);
2330 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
2331 ok(!lstrcmpA(buf, ""), "Expected \"\", got \"%s\"\n", buf);
2332 ok(sz == 0, "Expected 0, got %d\n", sz);
2334 res = RegSetValueExA(propkey, "HelpLink", 0, REG_SZ, (LPBYTE)"link", 5);
2335 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
2337 /* HelpLink value exists */
2339 lstrcpyA(buf, "apple");
2340 r = MsiGetProductInfoA(prodcode, INSTALLPROPERTY_HELPLINK, buf, &sz);
2341 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
2342 ok(!lstrcmpA(buf, "link"), "Expected \"link\", got \"%s\"\n", buf);
2343 ok(sz == 4, "Expected 4, got %d\n", sz);
2345 RegDeleteValueA(propkey, "HelpLink");
2346 RegDeleteKeyA(propkey, "");
2347 RegDeleteKeyA(localkey, "");
2348 RegDeleteKeyA(prodkey, "");
2349 RegCloseKey(propkey);
2350 RegCloseKey(localkey);
2351 RegCloseKey(prodkey);
2353 lstrcpyA(keypath, "Software\\Classes\\Installer\\Products\\");
2354 lstrcatA(keypath, prod_squashed);
2356 res = RegCreateKeyA(HKEY_LOCAL_MACHINE, keypath, &prodkey);
2357 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
2359 /* classes product key exists */
2361 lstrcpyA(buf, "apple");
2362 r = MsiGetProductInfoA(prodcode, INSTALLPROPERTY_HELPLINK, buf, &sz);
2363 ok(r == ERROR_UNKNOWN_PROPERTY,
2364 "Expected ERROR_UNKNOWN_PROPERTY, got %d\n", r);
2365 ok(!lstrcmpA(buf, "apple"), "Expected \"apple\", got \"%s\"\n", buf);
2366 ok(sz == MAX_PATH, "Expected MAX_PATH, got %d\n", sz);
2368 lstrcpyA(keypath, "Software\\Microsoft\\Windows\\CurrentVersion\\Installer\\UserData\\");
2369 lstrcatA(keypath, usersid);
2370 lstrcatA(keypath, "\\Products\\");
2371 lstrcatA(keypath, prod_squashed);
2373 res = RegCreateKeyA(HKEY_LOCAL_MACHINE, keypath, &localkey);
2374 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
2376 /* local user product key exists */
2378 lstrcpyA(buf, "apple");
2379 r = MsiGetProductInfoA(prodcode, INSTALLPROPERTY_HELPLINK, buf, &sz);
2380 ok(r == ERROR_UNKNOWN_PROPERTY,
2381 "Expected ERROR_UNKNOWN_PROPERTY, got %d\n", r);
2382 ok(!lstrcmpA(buf, "apple"), "Expected \"apple\", got \"%s\"\n", buf);
2383 ok(sz == MAX_PATH, "Expected MAX_PATH, got %d\n", sz);
2385 res = RegCreateKeyA(localkey, "InstallProperties", &propkey);
2386 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
2388 /* InstallProperties key exists */
2390 lstrcpyA(buf, "apple");
2391 r = MsiGetProductInfoA(prodcode, INSTALLPROPERTY_HELPLINK, buf, &sz);
2392 ok(r == ERROR_UNKNOWN_PROPERTY,
2393 "Expected ERROR_UNKNOWN_PROPERTY, got %d\n", r);
2394 ok(!lstrcmpA(buf, "apple"), "Expected \"apple\", got \"%s\"\n", buf);
2395 ok(sz == MAX_PATH, "Expected MAX_PATH, got %d\n", sz);
2397 RegDeleteKeyA(propkey, "");
2398 RegDeleteKeyA(localkey, "");
2399 RegCloseKey(propkey);
2400 RegCloseKey(localkey);
2402 lstrcpyA(keypath, "Software\\Microsoft\\Windows\\CurrentVersion\\Installer\\UserData\\");
2403 lstrcatA(keypath, "S-1-5-18\\\\Products\\");
2404 lstrcatA(keypath, prod_squashed);
2406 res = RegCreateKeyA(HKEY_LOCAL_MACHINE, keypath, &localkey);
2407 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
2409 /* Local System product key exists */
2411 lstrcpyA(buf, "apple");
2412 r = MsiGetProductInfoA(prodcode, INSTALLPROPERTY_HELPLINK, buf, &sz);
2413 ok(r == ERROR_UNKNOWN_PROPERTY,
2414 "Expected ERROR_UNKNOWN_PROPERTY, got %d\n", r);
2415 ok(!lstrcmpA(buf, "apple"), "Expected \"apple\", got \"%s\"\n", buf);
2416 ok(sz == MAX_PATH, "Expected MAX_PATH, got %d\n", sz);
2418 res = RegCreateKeyA(localkey, "InstallProperties", &propkey);
2419 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
2421 /* InstallProperties key exists */
2423 lstrcpyA(buf, "apple");
2424 r = MsiGetProductInfoA(prodcode, INSTALLPROPERTY_HELPLINK, buf, &sz);
2425 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
2426 ok(!lstrcmpA(buf, ""), "Expected \"\", got \"%s\"\n", buf);
2427 ok(sz == 0, "Expected 0, got %d\n", sz);
2429 res = RegSetValueExA(propkey, "HelpLink", 0, REG_SZ, (LPBYTE)"link", 5);
2430 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
2432 /* HelpLink value exists */
2434 lstrcpyA(buf, "apple");
2435 r = MsiGetProductInfoA(prodcode, INSTALLPROPERTY_HELPLINK, buf, &sz);
2436 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
2437 ok(!lstrcmpA(buf, "link"), "Expected \"link\", got \"%s\"\n", buf);
2438 ok(sz == 4, "Expected 4, got %d\n", sz);
2440 res = RegSetValueExA(propkey, "HelpLink", 0, REG_DWORD,
2441 (const BYTE *)&val, sizeof(DWORD));
2442 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
2444 /* HelpLink type is REG_DWORD */
2446 lstrcpyA(buf, "apple");
2447 r = MsiGetProductInfoA(prodcode, INSTALLPROPERTY_HELPLINK, buf, &sz);
2448 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
2449 ok(!lstrcmpA(buf, "42"), "Expected \"42\", got \"%s\"\n", buf);
2450 ok(sz == 2, "Expected 2, got %d\n", sz);
2452 res = RegSetValueExA(propkey, "DisplayName", 0, REG_SZ, (LPBYTE)"name", 5);
2453 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
2455 /* DisplayName value exists */
2457 lstrcpyA(buf, "apple");
2458 r = MsiGetProductInfoA(prodcode, INSTALLPROPERTY_INSTALLEDPRODUCTNAME, buf, &sz);
2459 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
2460 ok(!lstrcmpA(buf, "name"), "Expected \"name\", got \"%s\"\n", buf);
2461 ok(sz == 4, "Expected 4, got %d\n", sz);
2463 res = RegSetValueExA(propkey, "DisplayName", 0, REG_DWORD,
2464 (const BYTE *)&val, sizeof(DWORD));
2465 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
2467 /* DisplayName type is REG_DWORD */
2469 lstrcpyA(buf, "apple");
2470 r = MsiGetProductInfoA(prodcode, INSTALLPROPERTY_INSTALLEDPRODUCTNAME, buf, &sz);
2471 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
2472 ok(!lstrcmpA(buf, "42"), "Expected \"42\", got \"%s\"\n", buf);
2473 ok(sz == 2, "Expected 2, got %d\n", sz);
2475 res = RegSetValueExA(propkey, "DisplayVersion", 0, REG_SZ, (LPBYTE)"1.1.1", 6);
2476 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
2478 /* DisplayVersion value exists */
2480 lstrcpyA(buf, "apple");
2481 r = MsiGetProductInfoA(prodcode, INSTALLPROPERTY_VERSIONSTRING, buf, &sz);
2482 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
2483 ok(!lstrcmpA(buf, "1.1.1"), "Expected \"1.1.1\", got \"%s\"\n", buf);
2484 ok(sz == 5, "Expected 5, got %d\n", sz);
2486 res = RegSetValueExA(propkey, "DisplayVersion", 0,
2487 REG_DWORD, (const BYTE *)&val, sizeof(DWORD));
2488 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
2490 /* DisplayVersion type is REG_DWORD */
2492 lstrcpyA(buf, "apple");
2493 r = MsiGetProductInfoA(prodcode, INSTALLPROPERTY_VERSIONSTRING, buf, &sz);
2494 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
2495 ok(!lstrcmpA(buf, "42"), "Expected \"42\", got \"%s\"\n", buf);
2496 ok(sz == 2, "Expected 2, got %d\n", sz);
2498 res = RegSetValueExA(propkey, "HelpTelephone", 0, REG_SZ, (LPBYTE)"tele", 5);
2499 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
2501 /* HelpTelephone value exists */
2503 lstrcpyA(buf, "apple");
2504 r = MsiGetProductInfoA(prodcode, INSTALLPROPERTY_HELPTELEPHONE, buf, &sz);
2505 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
2506 ok(!lstrcmpA(buf, "tele"), "Expected \"tele\", got \"%s\"\n", buf);
2507 ok(sz == 4, "Expected 4, got %d\n", sz);
2509 res = RegSetValueExA(propkey, "HelpTelephone", 0, REG_DWORD,
2510 (const BYTE *)&val, sizeof(DWORD));
2511 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
2513 /* HelpTelephone type is REG_DWORD */
2515 lstrcpyA(buf, "apple");
2516 r = MsiGetProductInfoA(prodcode, INSTALLPROPERTY_HELPTELEPHONE, buf, &sz);
2517 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
2518 ok(!lstrcmpA(buf, "42"), "Expected \"42\", got \"%s\"\n", buf);
2519 ok(sz == 2, "Expected 2, got %d\n", sz);
2521 res = RegSetValueExA(propkey, "InstallLocation", 0, REG_SZ, (LPBYTE)"loc", 4);
2522 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
2524 /* InstallLocation value exists */
2526 lstrcpyA(buf, "apple");
2527 r = MsiGetProductInfoA(prodcode, INSTALLPROPERTY_INSTALLLOCATION, buf, &sz);
2528 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
2529 ok(!lstrcmpA(buf, "loc"), "Expected \"loc\", got \"%s\"\n", buf);
2530 ok(sz == 3, "Expected 3, got %d\n", sz);
2532 res = RegSetValueExA(propkey, "InstallLocation", 0, REG_DWORD,
2533 (const BYTE *)&val, sizeof(DWORD));
2534 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
2536 /* InstallLocation type is REG_DWORD */
2538 lstrcpyA(buf, "apple");
2539 r = MsiGetProductInfoA(prodcode, INSTALLPROPERTY_INSTALLLOCATION, buf, &sz);
2540 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
2541 ok(!lstrcmpA(buf, "42"), "Expected \"42\", got \"%s\"\n", buf);
2542 ok(sz == 2, "Expected 2, got %d\n", sz);
2544 res = RegSetValueExA(propkey, "InstallSource", 0, REG_SZ, (LPBYTE)"source", 7);
2545 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
2547 /* InstallSource value exists */
2549 lstrcpyA(buf, "apple");
2550 r = MsiGetProductInfoA(prodcode, INSTALLPROPERTY_INSTALLSOURCE, buf, &sz);
2551 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
2552 ok(!lstrcmpA(buf, "source"), "Expected \"source\", got \"%s\"\n", buf);
2553 ok(sz == 6, "Expected 6, got %d\n", sz);
2555 res = RegSetValueExA(propkey, "InstallSource", 0, REG_DWORD,
2556 (const BYTE *)&val, sizeof(DWORD));
2557 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
2559 /* InstallSource type is REG_DWORD */
2561 lstrcpyA(buf, "apple");
2562 r = MsiGetProductInfoA(prodcode, INSTALLPROPERTY_INSTALLSOURCE, buf, &sz);
2563 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
2564 ok(!lstrcmpA(buf, "42"), "Expected \"42\", got \"%s\"\n", buf);
2565 ok(sz == 2, "Expected 2, got %d\n", sz);
2567 res = RegSetValueExA(propkey, "InstallDate", 0, REG_SZ, (LPBYTE)"date", 5);
2568 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
2570 /* InstallDate value exists */
2572 lstrcpyA(buf, "apple");
2573 r = MsiGetProductInfoA(prodcode, INSTALLPROPERTY_INSTALLDATE, buf, &sz);
2574 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
2575 ok(!lstrcmpA(buf, "date"), "Expected \"date\", got \"%s\"\n", buf);
2576 ok(sz == 4, "Expected 4, got %d\n", sz);
2578 res = RegSetValueExA(propkey, "InstallDate", 0, REG_DWORD,
2579 (const BYTE *)&val, sizeof(DWORD));
2580 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
2582 /* InstallDate type is REG_DWORD */
2584 lstrcpyA(buf, "apple");
2585 r = MsiGetProductInfoA(prodcode, INSTALLPROPERTY_INSTALLDATE, buf, &sz);
2586 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
2587 ok(!lstrcmpA(buf, "42"), "Expected \"42\", got \"%s\"\n", buf);
2588 ok(sz == 2, "Expected 2, got %d\n", sz);
2590 res = RegSetValueExA(propkey, "Publisher", 0, REG_SZ, (LPBYTE)"pub", 4);
2591 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
2593 /* Publisher value exists */
2595 lstrcpyA(buf, "apple");
2596 r = MsiGetProductInfoA(prodcode, INSTALLPROPERTY_PUBLISHER, buf, &sz);
2597 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
2598 ok(!lstrcmpA(buf, "pub"), "Expected \"pub\", got \"%s\"\n", buf);
2599 ok(sz == 3, "Expected 3, got %d\n", sz);
2601 res = RegSetValueExA(propkey, "Publisher", 0, REG_DWORD,
2602 (const BYTE *)&val, sizeof(DWORD));
2603 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
2605 /* Publisher type is REG_DWORD */
2607 lstrcpyA(buf, "apple");
2608 r = MsiGetProductInfoA(prodcode, INSTALLPROPERTY_PUBLISHER, buf, &sz);
2609 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
2610 ok(!lstrcmpA(buf, "42"), "Expected \"42\", got \"%s\"\n", buf);
2611 ok(sz == 2, "Expected 2, got %d\n", sz);
2613 res = RegSetValueExA(propkey, "LocalPackage", 0, REG_SZ, (LPBYTE)"pack", 5);
2614 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
2616 /* LocalPackage value exists */
2618 lstrcpyA(buf, "apple");
2619 r = MsiGetProductInfoA(prodcode, INSTALLPROPERTY_LOCALPACKAGE, buf, &sz);
2620 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
2621 ok(!lstrcmpA(buf, "pack"), "Expected \"pack\", got \"%s\"\n", buf);
2622 ok(sz == 4, "Expected 4, got %d\n", sz);
2624 res = RegSetValueExA(propkey, "LocalPackage", 0, REG_DWORD,
2625 (const BYTE *)&val, sizeof(DWORD));
2626 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
2628 /* LocalPackage type is REG_DWORD */
2630 lstrcpyA(buf, "apple");
2631 r = MsiGetProductInfoA(prodcode, INSTALLPROPERTY_LOCALPACKAGE, buf, &sz);
2632 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
2633 ok(!lstrcmpA(buf, "42"), "Expected \"42\", got \"%s\"\n", buf);
2634 ok(sz == 2, "Expected 2, got %d\n", sz);
2636 res = RegSetValueExA(propkey, "UrlInfoAbout", 0, REG_SZ, (LPBYTE)"about", 6);
2637 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
2639 /* UrlInfoAbout value exists */
2641 lstrcpyA(buf, "apple");
2642 r = MsiGetProductInfoA(prodcode, INSTALLPROPERTY_URLINFOABOUT, buf, &sz);
2643 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
2644 ok(!lstrcmpA(buf, "about"), "Expected \"about\", got \"%s\"\n", buf);
2645 ok(sz == 5, "Expected 5, got %d\n", sz);
2647 res = RegSetValueExA(propkey, "UrlInfoAbout", 0, REG_DWORD,
2648 (const BYTE *)&val, sizeof(DWORD));
2649 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
2651 /* UrlInfoAbout type is REG_DWORD */
2653 lstrcpyA(buf, "apple");
2654 r = MsiGetProductInfoA(prodcode, INSTALLPROPERTY_URLINFOABOUT, buf, &sz);
2655 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
2656 ok(!lstrcmpA(buf, "42"), "Expected \"42\", got \"%s\"\n", buf);
2657 ok(sz == 2, "Expected 2, got %d\n", sz);
2659 res = RegSetValueExA(propkey, "UrlUpdateInfo", 0, REG_SZ, (LPBYTE)"info", 5);
2660 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
2662 /* UrlUpdateInfo value exists */
2664 lstrcpyA(buf, "apple");
2665 r = MsiGetProductInfoA(prodcode, INSTALLPROPERTY_URLUPDATEINFO, buf, &sz);
2666 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
2667 ok(!lstrcmpA(buf, "info"), "Expected \"info\", got \"%s\"\n", buf);
2668 ok(sz == 4, "Expected 4, got %d\n", sz);
2670 res = RegSetValueExA(propkey, "UrlUpdateInfo", 0, REG_DWORD,
2671 (const BYTE *)&val, sizeof(DWORD));
2672 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
2674 /* UrlUpdateInfo type is REG_DWORD */
2676 lstrcpyA(buf, "apple");
2677 r = MsiGetProductInfoA(prodcode, INSTALLPROPERTY_URLUPDATEINFO, buf, &sz);
2678 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
2679 ok(!lstrcmpA(buf, "42"), "Expected \"42\", got \"%s\"\n", buf);
2680 ok(sz == 2, "Expected 2, got %d\n", sz);
2682 res = RegSetValueExA(propkey, "VersionMinor", 0, REG_SZ, (LPBYTE)"1", 2);
2683 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
2685 /* VersionMinor value exists */
2687 lstrcpyA(buf, "apple");
2688 r = MsiGetProductInfoA(prodcode, INSTALLPROPERTY_VERSIONMINOR, buf, &sz);
2689 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
2690 ok(!lstrcmpA(buf, "1"), "Expected \"1\", got \"%s\"\n", buf);
2691 ok(sz == 1, "Expected 1, got %d\n", sz);
2693 res = RegSetValueExA(propkey, "VersionMinor", 0, REG_DWORD,
2694 (const BYTE *)&val, sizeof(DWORD));
2695 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
2697 /* VersionMinor type is REG_DWORD */
2699 lstrcpyA(buf, "apple");
2700 r = MsiGetProductInfoA(prodcode, INSTALLPROPERTY_VERSIONMINOR, buf, &sz);
2701 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
2702 ok(!lstrcmpA(buf, "42"), "Expected \"42\", got \"%s\"\n", buf);
2703 ok(sz == 2, "Expected 2, got %d\n", sz);
2705 res = RegSetValueExA(propkey, "VersionMajor", 0, REG_SZ, (LPBYTE)"1", 2);
2706 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
2708 /* VersionMajor value exists */
2710 lstrcpyA(buf, "apple");
2711 r = MsiGetProductInfoA(prodcode, INSTALLPROPERTY_VERSIONMAJOR, buf, &sz);
2712 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
2713 ok(!lstrcmpA(buf, "1"), "Expected \"1\", got \"%s\"\n", buf);
2714 ok(sz == 1, "Expected 1, got %d\n", sz);
2716 res = RegSetValueExA(propkey, "VersionMajor", 0, REG_DWORD,
2717 (const BYTE *)&val, sizeof(DWORD));
2718 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
2720 /* VersionMajor type is REG_DWORD */
2722 lstrcpyA(buf, "apple");
2723 r = MsiGetProductInfoA(prodcode, INSTALLPROPERTY_VERSIONMAJOR, buf, &sz);
2724 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
2725 ok(!lstrcmpA(buf, "42"), "Expected \"42\", got \"%s\"\n", buf);
2726 ok(sz == 2, "Expected 2, got %d\n", sz);
2728 res = RegSetValueExA(propkey, "ProductID", 0, REG_SZ, (LPBYTE)"id", 3);
2729 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
2731 /* ProductID value exists */
2733 lstrcpyA(buf, "apple");
2734 r = MsiGetProductInfoA(prodcode, INSTALLPROPERTY_PRODUCTID, buf, &sz);
2735 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
2736 ok(!lstrcmpA(buf, "id"), "Expected \"id\", got \"%s\"\n", buf);
2737 ok(sz == 2, "Expected 2, got %d\n", sz);
2739 res = RegSetValueExA(propkey, "ProductID", 0, REG_DWORD,
2740 (const BYTE *)&val, sizeof(DWORD));
2741 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
2743 /* ProductID type is REG_DWORD */
2745 lstrcpyA(buf, "apple");
2746 r = MsiGetProductInfoA(prodcode, INSTALLPROPERTY_PRODUCTID, buf, &sz);
2747 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
2748 ok(!lstrcmpA(buf, "42"), "Expected \"42\", got \"%s\"\n", buf);
2749 ok(sz == 2, "Expected 2, got %d\n", sz);
2751 res = RegSetValueExA(propkey, "RegCompany", 0, REG_SZ, (LPBYTE)"comp", 5);
2752 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
2754 /* RegCompany value exists */
2756 lstrcpyA(buf, "apple");
2757 r = MsiGetProductInfoA(prodcode, INSTALLPROPERTY_REGCOMPANY, buf, &sz);
2758 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
2759 ok(!lstrcmpA(buf, "comp"), "Expected \"comp\", got \"%s\"\n", buf);
2760 ok(sz == 4, "Expected 4, got %d\n", sz);
2762 res = RegSetValueExA(propkey, "RegCompany", 0, REG_DWORD,
2763 (const BYTE *)&val, sizeof(DWORD));
2764 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
2766 /* RegCompany type is REG_DWORD */
2768 lstrcpyA(buf, "apple");
2769 r = MsiGetProductInfoA(prodcode, INSTALLPROPERTY_REGCOMPANY, buf, &sz);
2770 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
2771 ok(!lstrcmpA(buf, "42"), "Expected \"42\", got \"%s\"\n", buf);
2772 ok(sz == 2, "Expected 2, got %d\n", sz);
2774 res = RegSetValueExA(propkey, "RegOwner", 0, REG_SZ, (LPBYTE)"own", 4);
2775 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
2777 /* RegOwner value exists */
2779 lstrcpyA(buf, "apple");
2780 r = MsiGetProductInfoA(prodcode, INSTALLPROPERTY_REGOWNER, buf, &sz);
2781 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
2782 ok(!lstrcmpA(buf, "own"), "Expected \"own\", got \"%s\"\n", buf);
2783 ok(sz == 3, "Expected 3, got %d\n", sz);
2785 res = RegSetValueExA(propkey, "RegOwner", 0, REG_DWORD,
2786 (const BYTE *)&val, sizeof(DWORD));
2787 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
2789 /* RegOwner type is REG_DWORD */
2791 lstrcpyA(buf, "apple");
2792 r = MsiGetProductInfoA(prodcode, INSTALLPROPERTY_REGOWNER, buf, &sz);
2793 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
2794 ok(!lstrcmpA(buf, "42"), "Expected \"42\", got \"%s\"\n", buf);
2795 ok(sz == 2, "Expected 2, got %d\n", sz);
2797 res = RegSetValueExA(propkey, "InstanceType", 0, REG_SZ, (LPBYTE)"type", 5);
2798 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
2800 /* InstanceType value exists */
2802 lstrcpyA(buf, "apple");
2803 r = MsiGetProductInfoA(prodcode, INSTALLPROPERTY_INSTANCETYPE, buf, &sz);
2804 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
2805 ok(!lstrcmpA(buf, ""), "Expected \"\", got \"%s\"\n", buf);
2806 ok(sz == 0, "Expected 0, got %d\n", sz);
2808 res = RegSetValueExA(propkey, "InstanceType", 0, REG_DWORD,
2809 (const BYTE *)&val, sizeof(DWORD));
2810 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
2812 /* InstanceType type is REG_DWORD */
2814 lstrcpyA(buf, "apple");
2815 r = MsiGetProductInfoA(prodcode, INSTALLPROPERTY_INSTANCETYPE, buf, &sz);
2816 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
2817 ok(!lstrcmpA(buf, ""), "Expected \"\", got \"%s\"\n", buf);
2818 ok(sz == 0, "Expected 0, got %d\n", sz);
2820 res = RegSetValueExA(prodkey, "InstanceType", 0, REG_SZ, (LPBYTE)"type", 5);
2821 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
2823 /* InstanceType value exists */
2825 lstrcpyA(buf, "apple");
2826 r = MsiGetProductInfoA(prodcode, INSTALLPROPERTY_INSTANCETYPE, buf, &sz);
2827 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
2828 ok(!lstrcmpA(buf, "type"), "Expected \"type\", got \"%s\"\n", buf);
2829 ok(sz == 4, "Expected 4, got %d\n", sz);
2831 res = RegSetValueExA(prodkey, "InstanceType", 0, REG_DWORD,
2832 (const BYTE *)&val, sizeof(DWORD));
2833 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
2835 /* InstanceType type is REG_DWORD */
2837 lstrcpyA(buf, "apple");
2838 r = MsiGetProductInfoA(prodcode, INSTALLPROPERTY_INSTANCETYPE, buf, &sz);
2839 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
2840 ok(!lstrcmpA(buf, "42"), "Expected \"42\", got \"%s\"\n", buf);
2841 ok(sz == 2, "Expected 2, got %d\n", sz);
2843 res = RegSetValueExA(propkey, "Transforms", 0, REG_SZ, (LPBYTE)"tforms", 7);
2844 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
2846 /* Transforms value exists */
2848 lstrcpyA(buf, "apple");
2849 r = MsiGetProductInfoA(prodcode, INSTALLPROPERTY_TRANSFORMS, buf, &sz);
2850 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
2851 ok(!lstrcmpA(buf, ""), "Expected \"\", got \"%s\"\n", buf);
2852 ok(sz == 0, "Expected 0, got %d\n", sz);
2854 res = RegSetValueExA(propkey, "Transforms", 0, REG_DWORD,
2855 (const BYTE *)&val, sizeof(DWORD));
2856 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
2858 /* Transforms type is REG_DWORD */
2860 lstrcpyA(buf, "apple");
2861 r = MsiGetProductInfoA(prodcode, INSTALLPROPERTY_TRANSFORMS, buf, &sz);
2862 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
2863 ok(!lstrcmpA(buf, ""), "Expected \"\", got \"%s\"\n", buf);
2864 ok(sz == 0, "Expected 0, got %d\n", sz);
2866 res = RegSetValueExA(prodkey, "Transforms", 0, REG_SZ, (LPBYTE)"tforms", 7);
2867 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
2869 /* Transforms value exists */
2871 lstrcpyA(buf, "apple");
2872 r = MsiGetProductInfoA(prodcode, INSTALLPROPERTY_TRANSFORMS, buf, &sz);
2873 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
2874 ok(!lstrcmpA(buf, "tforms"), "Expected \"tforms\", got \"%s\"\n", buf);
2875 ok(sz == 6, "Expected 6, got %d\n", sz);
2877 res = RegSetValueExA(prodkey, "Transforms", 0, REG_DWORD,
2878 (const BYTE *)&val, sizeof(DWORD));
2879 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
2881 /* Transforms type is REG_DWORD */
2883 lstrcpyA(buf, "apple");
2884 r = MsiGetProductInfoA(prodcode, INSTALLPROPERTY_TRANSFORMS, buf, &sz);
2885 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
2886 ok(!lstrcmpA(buf, "42"), "Expected \"42\", got \"%s\"\n", buf);
2887 ok(sz == 2, "Expected 2, got %d\n", sz);
2889 res = RegSetValueExA(propkey, "Language", 0, REG_SZ, (LPBYTE)"lang", 5);
2890 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
2892 /* Language value exists */
2894 lstrcpyA(buf, "apple");
2895 r = MsiGetProductInfoA(prodcode, INSTALLPROPERTY_LANGUAGE, buf, &sz);
2896 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
2897 ok(!lstrcmpA(buf, ""), "Expected \"\", got \"%s\"\n", buf);
2898 ok(sz == 0, "Expected 0, got %d\n", sz);
2900 res = RegSetValueExA(propkey, "Language", 0, REG_DWORD,
2901 (const BYTE *)&val, sizeof(DWORD));
2902 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
2904 /* Language type is REG_DWORD */
2906 lstrcpyA(buf, "apple");
2907 r = MsiGetProductInfoA(prodcode, INSTALLPROPERTY_LANGUAGE, buf, &sz);
2908 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
2909 ok(!lstrcmpA(buf, ""), "Expected \"\", got \"%s\"\n", buf);
2910 ok(sz == 0, "Expected 0, got %d\n", sz);
2912 res = RegSetValueExA(prodkey, "Language", 0, REG_SZ, (LPBYTE)"lang", 5);
2913 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
2915 /* Language value exists */
2917 lstrcpyA(buf, "apple");
2918 r = MsiGetProductInfoA(prodcode, INSTALLPROPERTY_LANGUAGE, buf, &sz);
2919 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
2920 ok(!lstrcmpA(buf, "lang"), "Expected \"lang\", got \"%s\"\n", buf);
2921 ok(sz == 4, "Expected 4, got %d\n", sz);
2923 res = RegSetValueExA(prodkey, "Language", 0, REG_DWORD,
2924 (const BYTE *)&val, sizeof(DWORD));
2925 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
2927 /* Language type is REG_DWORD */
2929 lstrcpyA(buf, "apple");
2930 r = MsiGetProductInfoA(prodcode, INSTALLPROPERTY_LANGUAGE, buf, &sz);
2931 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
2932 ok(!lstrcmpA(buf, "42"), "Expected \"42\", got \"%s\"\n", buf);
2933 ok(sz == 2, "Expected 2, got %d\n", sz);
2935 res = RegSetValueExA(propkey, "ProductName", 0, REG_SZ, (LPBYTE)"name", 5);
2936 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
2938 /* ProductName value exists */
2940 lstrcpyA(buf, "apple");
2941 r = MsiGetProductInfoA(prodcode, INSTALLPROPERTY_PRODUCTNAME, buf, &sz);
2942 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
2943 ok(!lstrcmpA(buf, ""), "Expected \"\", got \"%s\"\n", buf);
2944 ok(sz == 0, "Expected 0, got %d\n", sz);
2946 res = RegSetValueExA(propkey, "ProductName", 0, REG_DWORD,
2947 (const BYTE *)&val, sizeof(DWORD));
2948 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
2950 /* ProductName type is REG_DWORD */
2952 lstrcpyA(buf, "apple");
2953 r = MsiGetProductInfoA(prodcode, INSTALLPROPERTY_PRODUCTNAME, buf, &sz);
2954 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
2955 ok(!lstrcmpA(buf, ""), "Expected \"\", got \"%s\"\n", buf);
2956 ok(sz == 0, "Expected 0, got %d\n", sz);
2958 res = RegSetValueExA(prodkey, "ProductName", 0, REG_SZ, (LPBYTE)"name", 5);
2959 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
2961 /* ProductName value exists */
2963 lstrcpyA(buf, "apple");
2964 r = MsiGetProductInfoA(prodcode, INSTALLPROPERTY_PRODUCTNAME, buf, &sz);
2965 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
2966 ok(!lstrcmpA(buf, "name"), "Expected \"name\", got \"%s\"\n", buf);
2967 ok(sz == 4, "Expected 4, got %d\n", sz);
2969 res = RegSetValueExA(prodkey, "ProductName", 0, REG_DWORD,
2970 (const BYTE *)&val, sizeof(DWORD));
2971 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
2973 /* ProductName type is REG_DWORD */
2975 lstrcpyA(buf, "apple");
2976 r = MsiGetProductInfoA(prodcode, INSTALLPROPERTY_PRODUCTNAME, buf, &sz);
2977 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
2978 ok(!lstrcmpA(buf, "42"), "Expected \"42\", got \"%s\"\n", buf);
2979 ok(sz == 2, "Expected 2, got %d\n", sz);
2981 res = RegSetValueExA(propkey, "Assignment", 0, REG_SZ, (LPBYTE)"at", 3);
2982 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
2984 /* Assignment value exists */
2986 lstrcpyA(buf, "apple");
2987 r = MsiGetProductInfoA(prodcode, INSTALLPROPERTY_ASSIGNMENTTYPE, buf, &sz);
2988 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
2989 ok(!lstrcmpA(buf, ""), "Expected \"\", got \"%s\"\n", buf);
2990 ok(sz == 0, "Expected 0, got %d\n", sz);
2992 res = RegSetValueExA(propkey, "Assignment", 0, REG_DWORD,
2993 (const BYTE *)&val, sizeof(DWORD));
2994 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
2996 /* Assignment type is REG_DWORD */
2998 lstrcpyA(buf, "apple");
2999 r = MsiGetProductInfoA(prodcode, INSTALLPROPERTY_ASSIGNMENTTYPE, buf, &sz);
3000 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
3001 ok(!lstrcmpA(buf, ""), "Expected \"\", got \"%s\"\n", buf);
3002 ok(sz == 0, "Expected 0, got %d\n", sz);
3004 res = RegSetValueExA(prodkey, "Assignment", 0, REG_SZ, (LPBYTE)"at", 3);
3005 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
3007 /* Assignment value exists */
3009 lstrcpyA(buf, "apple");
3010 r = MsiGetProductInfoA(prodcode, INSTALLPROPERTY_ASSIGNMENTTYPE, buf, &sz);
3011 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
3012 ok(!lstrcmpA(buf, "at"), "Expected \"at\", got \"%s\"\n", buf);
3013 ok(sz == 2, "Expected 2, got %d\n", sz);
3015 res = RegSetValueExA(prodkey, "Assignment", 0, REG_DWORD,
3016 (const BYTE *)&val, sizeof(DWORD));
3017 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
3019 /* Assignment type is REG_DWORD */
3021 lstrcpyA(buf, "apple");
3022 r = MsiGetProductInfoA(prodcode, INSTALLPROPERTY_ASSIGNMENTTYPE, buf, &sz);
3023 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
3024 ok(!lstrcmpA(buf, "42"), "Expected \"42\", got \"%s\"\n", buf);
3025 ok(sz == 2, "Expected 2, got %d\n", sz);
3027 res = RegSetValueExA(propkey, "PackageCode", 0, REG_SZ, (LPBYTE)"code", 5);
3028 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
3030 /* PackageCode value exists */
3032 lstrcpyA(buf, "apple");
3033 r = MsiGetProductInfoA(prodcode, INSTALLPROPERTY_PACKAGECODE, buf, &sz);
3034 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
3035 ok(!lstrcmpA(buf, ""), "Expected \"\", got \"%s\"\n", buf);
3036 ok(sz == 0, "Expected 0, got %d\n", sz);
3038 res = RegSetValueExA(propkey, "PackageCode", 0, REG_DWORD,
3039 (const BYTE *)&val, sizeof(DWORD));
3040 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
3042 /* PackageCode type is REG_DWORD */
3044 lstrcpyA(buf, "apple");
3045 r = MsiGetProductInfoA(prodcode, INSTALLPROPERTY_PACKAGECODE, buf, &sz);
3046 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
3047 ok(!lstrcmpA(buf, ""), "Expected \"\", got \"%s\"\n", buf);
3048 ok(sz == 0, "Expected 0, got %d\n", sz);
3050 res = RegSetValueExA(prodkey, "PackageCode", 0, REG_SZ, (LPBYTE)"code", 5);
3051 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
3053 /* PackageCode value exists */
3055 lstrcpyA(buf, "apple");
3056 r = MsiGetProductInfoA(prodcode, INSTALLPROPERTY_PACKAGECODE, buf, &sz);
3057 ok(r == ERROR_BAD_CONFIGURATION,
3058 "Expected ERROR_BAD_CONFIGURATION, got %d\n", r);
3059 ok(!lstrcmpA(buf, "code"), "Expected \"code\", got \"%s\"\n", buf);
3060 ok(sz == MAX_PATH, "Expected MAX_PATH, got %d\n", sz);
3062 res = RegSetValueExA(prodkey, "PackageCode", 0, REG_DWORD,
3063 (const BYTE *)&val, sizeof(DWORD));
3064 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
3066 /* PackageCode type is REG_DWORD */
3068 lstrcpyA(buf, "apple");
3069 r = MsiGetProductInfoA(prodcode, INSTALLPROPERTY_PACKAGECODE, buf, &sz);
3070 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
3071 ok(!lstrcmpA(buf, "42"), "Expected \"42\", got \"%s\"\n", buf);
3072 ok(sz == 2, "Expected 2, got %d\n", sz);
3074 res = RegSetValueExA(prodkey, "PackageCode", 0, REG_SZ, (LPBYTE)pack_squashed, 33);
3075 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
3077 /* PackageCode value exists */
3079 lstrcpyA(buf, "apple");
3080 r = MsiGetProductInfoA(prodcode, INSTALLPROPERTY_PACKAGECODE, buf, &sz);
3081 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
3082 ok(!lstrcmpA(buf, packcode), "Expected \"%s\", got \"%s\"\n", packcode, buf);
3083 ok(sz == 38, "Expected 38, got %d\n", sz);
3085 res = RegSetValueExA(propkey, "Version", 0, REG_SZ, (LPBYTE)"ver", 4);
3086 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
3088 /* Version value exists */
3090 lstrcpyA(buf, "apple");
3091 r = MsiGetProductInfoA(prodcode, INSTALLPROPERTY_VERSION, buf, &sz);
3092 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
3093 ok(!lstrcmpA(buf, ""), "Expected \"\", got \"%s\"\n", buf);
3094 ok(sz == 0, "Expected 0, got %d\n", sz);
3096 res = RegSetValueExA(propkey, "Version", 0, REG_DWORD,
3097 (const BYTE *)&val, sizeof(DWORD));
3098 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
3100 /* Version type is REG_DWORD */
3102 lstrcpyA(buf, "apple");
3103 r = MsiGetProductInfoA(prodcode, INSTALLPROPERTY_VERSION, buf, &sz);
3104 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
3105 ok(!lstrcmpA(buf, ""), "Expected \"\", got \"%s\"\n", buf);
3106 ok(sz == 0, "Expected 0, got %d\n", sz);
3108 res = RegSetValueExA(prodkey, "Version", 0, REG_SZ, (LPBYTE)"ver", 4);
3109 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
3111 /* Version value exists */
3113 lstrcpyA(buf, "apple");
3114 r = MsiGetProductInfoA(prodcode, INSTALLPROPERTY_VERSION, buf, &sz);
3115 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
3116 ok(!lstrcmpA(buf, "ver"), "Expected \"ver\", got \"%s\"\n", buf);
3117 ok(sz == 3, "Expected 3, got %d\n", sz);
3119 res = RegSetValueExA(prodkey, "Version", 0, REG_DWORD,
3120 (const BYTE *)&val, sizeof(DWORD));
3121 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
3123 /* Version type is REG_DWORD */
3125 lstrcpyA(buf, "apple");
3126 r = MsiGetProductInfoA(prodcode, INSTALLPROPERTY_VERSION, buf, &sz);
3127 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
3128 ok(!lstrcmpA(buf, "42"), "Expected \"42\", got \"%s\"\n", buf);
3129 ok(sz == 2, "Expected 2, got %d\n", sz);
3131 res = RegSetValueExA(propkey, "ProductIcon", 0, REG_SZ, (LPBYTE)"ico", 4);
3132 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
3134 /* ProductIcon value exists */
3136 lstrcpyA(buf, "apple");
3137 r = MsiGetProductInfoA(prodcode, INSTALLPROPERTY_PRODUCTICON, buf, &sz);
3138 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
3139 ok(!lstrcmpA(buf, ""), "Expected \"\", got \"%s\"\n", buf);
3140 ok(sz == 0, "Expected 0, got %d\n", sz);
3142 res = RegSetValueExA(propkey, "ProductIcon", 0, REG_DWORD,
3143 (const BYTE *)&val, sizeof(DWORD));
3144 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
3146 /* ProductIcon type is REG_DWORD */
3148 lstrcpyA(buf, "apple");
3149 r = MsiGetProductInfoA(prodcode, INSTALLPROPERTY_PRODUCTICON, buf, &sz);
3150 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
3151 ok(!lstrcmpA(buf, ""), "Expected \"\", got \"%s\"\n", buf);
3152 ok(sz == 0, "Expected 0, got %d\n", sz);
3154 res = RegSetValueExA(prodkey, "ProductIcon", 0, REG_SZ, (LPBYTE)"ico", 4);
3155 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
3157 /* ProductIcon value exists */
3159 lstrcpyA(buf, "apple");
3160 r = MsiGetProductInfoA(prodcode, INSTALLPROPERTY_PRODUCTICON, buf, &sz);
3161 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
3162 ok(!lstrcmpA(buf, "ico"), "Expected \"ico\", got \"%s\"\n", buf);
3163 ok(sz == 3, "Expected 3, got %d\n", sz);
3165 res = RegSetValueExA(prodkey, "ProductIcon", 0, REG_DWORD,
3166 (const BYTE *)&val, sizeof(DWORD));
3167 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
3169 /* ProductIcon type is REG_DWORD */
3171 lstrcpyA(buf, "apple");
3172 r = MsiGetProductInfoA(prodcode, INSTALLPROPERTY_PRODUCTICON, buf, &sz);
3173 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
3174 ok(!lstrcmpA(buf, "42"), "Expected \"42\", got \"%s\"\n", buf);
3175 ok(sz == 2, "Expected 2, got %d\n", sz);
3177 res = RegCreateKeyA(prodkey, "SourceList", &source);
3178 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
3180 res = RegSetValueExA(source, "PackageName", 0, REG_SZ, (LPBYTE)"packname", 9);
3181 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
3184 lstrcpyA(buf, "apple");
3185 r = MsiGetProductInfoA(prodcode, INSTALLPROPERTY_PACKAGENAME, buf, &sz);
3186 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
3187 ok(!lstrcmpA(buf, "packname"), "Expected \"packname\", got \"%s\"\n", buf);
3188 ok(sz == 8, "Expected 8, got %d\n", sz);
3190 res = RegSetValueExA(source, "PackageName", 0, REG_DWORD,
3191 (const BYTE *)&val, sizeof(DWORD));
3192 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
3194 /* PackageName type is REG_DWORD */
3196 lstrcpyA(buf, "apple");
3197 r = MsiGetProductInfoA(prodcode, INSTALLPROPERTY_PACKAGENAME, buf, &sz);
3198 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
3199 ok(!lstrcmpA(buf, "42"), "Expected \"42\", got \"%s\"\n", buf);
3200 ok(sz == 2, "Expected 2, got %d\n", sz);
3202 res = RegSetValueExA(propkey, "AuthorizedLUAApp", 0, REG_SZ, (LPBYTE)"auth", 5);
3203 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
3205 /* Authorized value exists */
3207 lstrcpyA(buf, "apple");
3208 r = MsiGetProductInfoA(prodcode, INSTALLPROPERTY_AUTHORIZED_LUA_APP, buf, &sz);
3209 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
3210 ok(!lstrcmpA(buf, ""), "Expected \"\", got \"%s\"\n", buf);
3211 ok(sz == 0, "Expected 0, got %d\n", sz);
3213 res = RegSetValueExA(propkey, "AuthorizedLUAApp", 0, REG_DWORD,
3214 (const BYTE *)&val, sizeof(DWORD));
3215 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
3217 /* AuthorizedLUAApp type is REG_DWORD */
3219 lstrcpyA(buf, "apple");
3220 r = MsiGetProductInfoA(prodcode, INSTALLPROPERTY_AUTHORIZED_LUA_APP, buf, &sz);
3221 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
3222 ok(!lstrcmpA(buf, ""), "Expected \"\", got \"%s\"\n", buf);
3223 ok(sz == 0, "Expected 0, got %d\n", sz);
3225 res = RegSetValueExA(prodkey, "AuthorizedLUAApp", 0, REG_SZ, (LPBYTE)"auth", 5);
3226 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
3228 /* Authorized value exists */
3230 lstrcpyA(buf, "apple");
3231 r = MsiGetProductInfoA(prodcode, INSTALLPROPERTY_AUTHORIZED_LUA_APP, buf, &sz);
3232 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
3233 ok(!lstrcmpA(buf, "auth"), "Expected \"auth\", got \"%s\"\n", buf);
3234 ok(sz == 4, "Expected 4, got %d\n", sz);
3236 res = RegSetValueExA(prodkey, "AuthorizedLUAApp", 0, REG_DWORD,
3237 (const BYTE *)&val, sizeof(DWORD));
3238 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
3240 /* AuthorizedLUAApp type is REG_DWORD */
3242 lstrcpyA(buf, "apple");
3243 r = MsiGetProductInfoA(prodcode, INSTALLPROPERTY_AUTHORIZED_LUA_APP, buf, &sz);
3244 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
3245 ok(!lstrcmpA(buf, "42"), "Expected \"42\", got \"%s\"\n", buf);
3246 ok(sz == 2, "Expected 2, got %d\n", sz);
3248 RegDeleteValueA(propkey, "HelpLink");
3249 RegDeleteValueA(propkey, "DisplayName");
3250 RegDeleteValueA(propkey, "DisplayVersion");
3251 RegDeleteValueA(propkey, "HelpTelephone");
3252 RegDeleteValueA(propkey, "InstallLocation");
3253 RegDeleteValueA(propkey, "InstallSource");
3254 RegDeleteValueA(propkey, "InstallDate");
3255 RegDeleteValueA(propkey, "Publisher");
3256 RegDeleteValueA(propkey, "LocalPackage");
3257 RegDeleteValueA(propkey, "UrlInfoAbout");
3258 RegDeleteValueA(propkey, "UrlUpdateInfo");
3259 RegDeleteValueA(propkey, "VersionMinor");
3260 RegDeleteValueA(propkey, "VersionMajor");
3261 RegDeleteValueA(propkey, "ProductID");
3262 RegDeleteValueA(propkey, "RegCompany");
3263 RegDeleteValueA(propkey, "RegOwner");
3264 RegDeleteValueA(propkey, "InstanceType");
3265 RegDeleteValueA(propkey, "Transforms");
3266 RegDeleteValueA(propkey, "Language");
3267 RegDeleteValueA(propkey, "ProductName");
3268 RegDeleteValueA(propkey, "Assignment");
3269 RegDeleteValueA(propkey, "PackageCode");
3270 RegDeleteValueA(propkey, "Version");
3271 RegDeleteValueA(propkey, "ProductIcon");
3272 RegDeleteValueA(propkey, "AuthorizedLUAApp");
3273 RegDeleteKeyA(propkey, "");
3274 RegDeleteKeyA(localkey, "");
3275 RegDeleteValueA(prodkey, "InstanceType");
3276 RegDeleteValueA(prodkey, "Transforms");
3277 RegDeleteValueA(prodkey, "Language");
3278 RegDeleteValueA(prodkey, "ProductName");
3279 RegDeleteValueA(prodkey, "Assignment");
3280 RegDeleteValueA(prodkey, "PackageCode");
3281 RegDeleteValueA(prodkey, "Version");
3282 RegDeleteValueA(prodkey, "ProductIcon");
3283 RegDeleteValueA(prodkey, "AuthorizedLUAApp");
3284 RegDeleteValueA(source, "PackageName");
3285 RegDeleteKeyA(source, "");
3286 RegDeleteKeyA(prodkey, "");
3287 RegCloseKey(propkey);
3288 RegCloseKey(localkey);
3289 RegCloseKey(source);
3290 RegCloseKey(prodkey);
3293 static void test_MsiGetProductInfoEx(void)
3297 HKEY propkey, userkey;
3298 HKEY prodkey, localkey;
3299 CHAR prodcode[MAX_PATH];
3300 CHAR prod_squashed[MAX_PATH];
3301 CHAR packcode[MAX_PATH];
3302 CHAR pack_squashed[MAX_PATH];
3304 CHAR keypath[MAX_PATH];
3308 if (!pMsiGetProductInfoExA)
3310 skip("MsiGetProductInfoExA is not available\n");
3314 create_test_guid(prodcode, prod_squashed);
3315 create_test_guid(packcode, pack_squashed);
3316 get_user_sid(&usersid);
3318 /* NULL szProductCode */
3320 lstrcpyA(buf, "apple");
3321 r = pMsiGetProductInfoExA(NULL, usersid, MSIINSTALLCONTEXT_USERUNMANAGED,
3322 INSTALLPROPERTY_PRODUCTSTATE, buf, &sz);
3323 ok(r == ERROR_INVALID_PARAMETER,
3324 "Expected ERROR_INVALID_PARAMETER, got %d\n", r);
3325 ok(!lstrcmpA(buf, "apple"), "Expected buf to be unchanged, got %s\n", buf);
3326 ok(sz == MAX_PATH, "Expected MAX_PATH, got %d\n", sz);
3328 /* empty szProductCode */
3330 lstrcpyA(buf, "apple");
3331 r = pMsiGetProductInfoExA("", usersid, MSIINSTALLCONTEXT_USERUNMANAGED,
3332 INSTALLPROPERTY_PRODUCTSTATE, buf, &sz);
3333 ok(r == ERROR_INVALID_PARAMETER,
3334 "Expected ERROR_INVALID_PARAMETER, got %d\n", r);
3335 ok(!lstrcmpA(buf, "apple"), "Expected buf to be unchanged, got %s\n", buf);
3336 ok(sz == MAX_PATH, "Expected MAX_PATH, got %d\n", sz);
3338 /* garbage szProductCode */
3340 lstrcpyA(buf, "apple");
3341 r = pMsiGetProductInfoExA("garbage", usersid, MSIINSTALLCONTEXT_USERUNMANAGED,
3342 INSTALLPROPERTY_PRODUCTSTATE, buf, &sz);
3343 ok(r == ERROR_INVALID_PARAMETER,
3344 "Expected ERROR_INVALID_PARAMETER, got %d\n", r);
3345 ok(!lstrcmpA(buf, "apple"), "Expected buf to be unchanged, got %s\n", buf);
3346 ok(sz == MAX_PATH, "Expected MAX_PATH, got %d\n", sz);
3348 /* guid without brackets */
3350 lstrcpyA(buf, "apple");
3351 r = pMsiGetProductInfoExA("6700E8CF-95AB-4D9C-BC2C-15840DEA7A5D", usersid,
3352 MSIINSTALLCONTEXT_USERUNMANAGED,
3353 INSTALLPROPERTY_PRODUCTSTATE, buf, &sz);
3354 ok(r == ERROR_INVALID_PARAMETER,
3355 "Expected ERROR_INVALID_PARAMETER, got %d\n", r);
3356 ok(!lstrcmpA(buf, "apple"), "Expected buf to be unchanged, got %s\n", buf);
3357 ok(sz == MAX_PATH, "Expected MAX_PATH, got %d\n", sz);
3359 /* guid with brackets */
3361 lstrcpyA(buf, "apple");
3362 r = pMsiGetProductInfoExA("{6700E8CF-95AB-4D9C-BC2C-15840DEA7A5D}", usersid,
3363 MSIINSTALLCONTEXT_USERUNMANAGED,
3364 INSTALLPROPERTY_PRODUCTSTATE, buf, &sz);
3365 ok(r == ERROR_UNKNOWN_PRODUCT,
3366 "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r);
3367 ok(!lstrcmpA(buf, "apple"), "Expected buf to be unchanged, got %s\n", buf);
3368 ok(sz == MAX_PATH, "Expected MAX_PATH, got %d\n", sz);
3370 /* szValue is non-NULL while pcchValue is NULL */
3371 lstrcpyA(buf, "apple");
3372 r = pMsiGetProductInfoExA(prodcode, usersid,
3373 MSIINSTALLCONTEXT_USERUNMANAGED,
3374 INSTALLPROPERTY_PRODUCTSTATE, buf, NULL);
3375 ok(r == ERROR_INVALID_PARAMETER,
3376 "Expected ERROR_INVALID_PARAMETER, got %d\n", r);
3377 ok(!lstrcmpA(buf, "apple"), "Expected buf to be unchanged, got %s\n", buf);
3379 /* dwContext is out of range */
3381 lstrcpyA(buf, "apple");
3382 r = pMsiGetProductInfoExA(prodcode, usersid, 42,
3383 INSTALLPROPERTY_PRODUCTSTATE, buf, &sz);
3384 ok(r == ERROR_INVALID_PARAMETER,
3385 "Expected ERROR_INVALID_PARAMETER, got %d\n", r);
3386 ok(!lstrcmpA(buf, "apple"), "Expected buf to be unchanged, got %s\n", buf);
3387 ok(sz == MAX_PATH, "Expected MAX_PATH, got %d\n", sz);
3389 /* szProperty is NULL */
3391 lstrcpyA(buf, "apple");
3392 r = pMsiGetProductInfoExA(prodcode, usersid,
3393 MSIINSTALLCONTEXT_USERUNMANAGED,
3395 ok(r == ERROR_INVALID_PARAMETER,
3396 "Expected ERROR_INVALID_PARAMETER, got %d\n", r);
3397 ok(!lstrcmpA(buf, "apple"), "Expected buf to be unchanged, got %s\n", buf);
3398 ok(sz == MAX_PATH, "Expected MAX_PATH, got %d\n", sz);
3400 /* szProperty is empty */
3402 lstrcpyA(buf, "apple");
3403 r = pMsiGetProductInfoExA(prodcode, usersid,
3404 MSIINSTALLCONTEXT_USERUNMANAGED,
3406 ok(r == ERROR_INVALID_PARAMETER,
3407 "Expected ERROR_INVALID_PARAMETER, got %d\n", r);
3408 ok(!lstrcmpA(buf, "apple"), "Expected buf to be unchanged, got %s\n", buf);
3409 ok(sz == MAX_PATH, "Expected MAX_PATH, got %d\n", sz);
3411 /* szProperty is not a valid property */
3413 lstrcpyA(buf, "apple");
3414 r = pMsiGetProductInfoExA(prodcode, usersid,
3415 MSIINSTALLCONTEXT_USERUNMANAGED,
3416 "notvalid", buf, &sz);
3417 ok(r == ERROR_UNKNOWN_PRODUCT,
3418 "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r);
3419 ok(!lstrcmpA(buf, "apple"), "Expected buf to be unchanged, got %s\n", buf);
3420 ok(sz == MAX_PATH, "Expected MAX_PATH, got %d\n", sz);
3422 /* same length as guid, but random */
3424 lstrcpyA(buf, "apple");
3425 r = pMsiGetProductInfoExA("A938G02JF-2NF3N93-VN3-2NNF-3KGKALDNF93", usersid,
3426 MSIINSTALLCONTEXT_USERUNMANAGED,
3427 INSTALLPROPERTY_PRODUCTSTATE, buf, &sz);
3428 ok(r == ERROR_INVALID_PARAMETER,
3429 "Expected ERROR_INVALID_PARAMETER, got %d\n", r);
3430 ok(!lstrcmpA(buf, "apple"), "Expected buf to be unchanged, got %s\n", buf);
3431 ok(sz == MAX_PATH, "Expected MAX_PATH, got %d\n", sz);
3433 /* MSIINSTALLCONTEXT_USERUNMANAGED */
3435 lstrcpyA(keypath, "Software\\Microsoft\\Windows\\CurrentVersion\\Installer\\UserData\\");
3436 lstrcatA(keypath, usersid);
3437 lstrcatA(keypath, "\\Products\\");
3438 lstrcatA(keypath, prod_squashed);
3440 res = RegCreateKeyA(HKEY_LOCAL_MACHINE, keypath, &localkey);
3441 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
3443 /* local user product key exists */
3445 lstrcpyA(buf, "apple");
3446 r = pMsiGetProductInfoExA(prodcode, usersid,
3447 MSIINSTALLCONTEXT_USERUNMANAGED,
3448 INSTALLPROPERTY_PRODUCTSTATE, buf, &sz);
3449 ok(r == ERROR_UNKNOWN_PRODUCT,
3450 "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r);
3451 ok(!lstrcmpA(buf, "apple"), "Expected buf to be unchanged, got %s\n", buf);
3452 ok(sz == MAX_PATH, "Expected MAX_PATH, got %d\n", sz);
3454 res = RegCreateKeyA(localkey, "InstallProperties", &propkey);
3455 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
3457 /* InstallProperties key exists */
3459 lstrcpyA(buf, "apple");
3460 r = pMsiGetProductInfoExA(prodcode, usersid,
3461 MSIINSTALLCONTEXT_USERUNMANAGED,
3462 INSTALLPROPERTY_PRODUCTSTATE, buf, &sz);
3463 ok(r == ERROR_UNKNOWN_PRODUCT,
3464 "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r);
3465 ok(!lstrcmpA(buf, "apple"), "Expected buf to be unchanged, got %s\n", buf);
3466 ok(sz == MAX_PATH, "Expected MAX_PATH, got %d\n", sz);
3468 res = RegSetValueExA(propkey, "LocalPackage", 0, REG_SZ, (LPBYTE)"local", 6);
3469 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
3471 /* LocalPackage value exists */
3473 lstrcpyA(buf, "apple");
3474 r = pMsiGetProductInfoExA(prodcode, usersid,
3475 MSIINSTALLCONTEXT_USERUNMANAGED,
3476 INSTALLPROPERTY_PRODUCTSTATE, buf, &sz);
3477 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
3478 ok(!lstrcmpA(buf, "5"), "Expected \"5\", got \"%s\"\n", buf);
3479 ok(sz == 1, "Expected 1, got %d\n", sz);
3481 RegDeleteValueA(propkey, "LocalPackage");
3483 /* LocalPackage value must exist */
3485 lstrcpyA(buf, "apple");
3486 r = pMsiGetProductInfoExA(prodcode, usersid,
3487 MSIINSTALLCONTEXT_USERUNMANAGED,
3488 INSTALLPROPERTY_HELPLINK, buf, &sz);
3489 ok(r == ERROR_UNKNOWN_PRODUCT,
3490 "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r);
3491 ok(!lstrcmpA(buf, "apple"), "Expected buf to be unchanged, got %s\n", buf);
3492 ok(sz == MAX_PATH, "Expected MAX_PATH, got %d\n", sz);
3494 res = RegSetValueExA(propkey, "LocalPackage", 0, REG_SZ, (LPBYTE)"local", 6);
3495 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
3497 /* LocalPackage exists, but HelpLink does not exist */
3499 lstrcpyA(buf, "apple");
3500 r = pMsiGetProductInfoExA(prodcode, usersid,
3501 MSIINSTALLCONTEXT_USERUNMANAGED,
3502 INSTALLPROPERTY_HELPLINK, buf, &sz);
3503 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
3504 ok(!lstrcmpA(buf, ""), "Expected \"\", got \"%s\"\n", buf);
3505 ok(sz == 0, "Expected 0, got %d\n", sz);
3507 res = RegSetValueExA(propkey, "HelpLink", 0, REG_SZ, (LPBYTE)"link", 5);
3508 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
3510 /* HelpLink value exists */
3512 lstrcpyA(buf, "apple");
3513 r = pMsiGetProductInfoExA(prodcode, usersid,
3514 MSIINSTALLCONTEXT_USERUNMANAGED,
3515 INSTALLPROPERTY_HELPLINK, buf, &sz);
3516 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
3517 ok(!lstrcmpA(buf, "link"), "Expected \"link\", got \"%s\"\n", buf);
3518 ok(sz == 4, "Expected 4, got %d\n", sz);
3520 res = RegSetValueExA(propkey, "HelpTelephone", 0, REG_SZ, (LPBYTE)"phone", 6);
3521 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
3523 /* HelpTelephone value exists */
3525 lstrcpyA(buf, "apple");
3526 r = pMsiGetProductInfoExA(prodcode, usersid,
3527 MSIINSTALLCONTEXT_USERUNMANAGED,
3528 INSTALLPROPERTY_HELPTELEPHONE, buf, &sz);
3529 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
3530 ok(!lstrcmpA(buf, "phone"), "Expected \"phone\", got \"%s\"\n", buf);
3531 ok(sz == 5, "Expected 5, got %d\n", sz);
3533 /* szValue and pcchValue are NULL */
3534 r = pMsiGetProductInfoExA(prodcode, usersid,
3535 MSIINSTALLCONTEXT_USERUNMANAGED,
3536 INSTALLPROPERTY_HELPTELEPHONE, NULL, NULL);
3537 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
3539 /* pcchValue is exactly 5 */
3541 lstrcpyA(buf, "apple");
3542 r = pMsiGetProductInfoExA(prodcode, usersid,
3543 MSIINSTALLCONTEXT_USERUNMANAGED,
3544 INSTALLPROPERTY_HELPTELEPHONE, buf, &sz);
3545 ok(r == ERROR_MORE_DATA,
3546 "Expected ERROR_MORE_DATA, got %d\n", r);
3547 ok(!lstrcmpA(buf, ""), "Expected \"\", got \"%s\"\n", buf);
3548 ok(sz == 10, "Expected 10, got %d\n", sz);
3550 /* szValue is NULL, pcchValue is exactly 5 */
3552 r = pMsiGetProductInfoExA(prodcode, usersid,
3553 MSIINSTALLCONTEXT_USERUNMANAGED,
3554 INSTALLPROPERTY_HELPTELEPHONE, NULL, &sz);
3555 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
3556 ok(sz == 10, "Expected 10, got %d\n", sz);
3558 /* szValue is NULL, pcchValue is MAX_PATH */
3560 r = pMsiGetProductInfoExA(prodcode, usersid,
3561 MSIINSTALLCONTEXT_USERUNMANAGED,
3562 INSTALLPROPERTY_HELPTELEPHONE, NULL, &sz);
3563 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
3564 ok(sz == 10, "Expected 10, got %d\n", sz);
3566 /* pcchValue is exactly 0 */
3568 lstrcpyA(buf, "apple");
3569 r = pMsiGetProductInfoExA(prodcode, usersid,
3570 MSIINSTALLCONTEXT_USERUNMANAGED,
3571 INSTALLPROPERTY_HELPTELEPHONE, buf, &sz);
3572 ok(r == ERROR_MORE_DATA,
3573 "Expected ERROR_MORE_DATA, got %d\n", r);
3574 ok(!lstrcmpA(buf, "apple"), "Expected \"apple\", got \"%s\"\n", buf);
3575 ok(sz == 10, "Expected 10, got %d\n", sz);
3577 res = RegSetValueExA(propkey, "notvalid", 0, REG_SZ, (LPBYTE)"invalid", 8);
3578 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
3580 /* szProperty is not a valid property */
3582 lstrcpyA(buf, "apple");
3583 r = pMsiGetProductInfoExA(prodcode, usersid,
3584 MSIINSTALLCONTEXT_USERUNMANAGED,
3585 "notvalid", buf, &sz);
3586 ok(r == ERROR_UNKNOWN_PROPERTY,
3587 "Expected ERROR_UNKNOWN_PROPERTY, got %d\n", r);
3588 ok(!lstrcmpA(buf, "apple"), "Expected buf to be unchanged, got %s\n", buf);
3589 ok(sz == MAX_PATH, "Expected MAX_PATH, got %d\n", sz);
3591 res = RegSetValueExA(propkey, "InstallDate", 0, REG_SZ, (LPBYTE)"date", 5);
3592 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
3594 /* InstallDate value exists */
3596 lstrcpyA(buf, "apple");
3597 r = pMsiGetProductInfoExA(prodcode, usersid,
3598 MSIINSTALLCONTEXT_USERUNMANAGED,
3599 INSTALLPROPERTY_INSTALLDATE, buf, &sz);
3600 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
3601 ok(!lstrcmpA(buf, "date"), "Expected \"date\", got \"%s\"\n", buf);
3602 ok(sz == 4, "Expected 4, got %d\n", sz);
3604 res = RegSetValueExA(propkey, "DisplayName", 0, REG_SZ, (LPBYTE)"name", 5);
3605 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
3607 /* DisplayName value exists */
3609 lstrcpyA(buf, "apple");
3610 r = pMsiGetProductInfoExA(prodcode, usersid,
3611 MSIINSTALLCONTEXT_USERUNMANAGED,
3612 INSTALLPROPERTY_INSTALLEDPRODUCTNAME, buf, &sz);
3613 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
3614 ok(!lstrcmpA(buf, "name"), "Expected \"name\", got \"%s\"\n", buf);
3615 ok(sz == 4, "Expected 4, got %d\n", sz);
3617 res = RegSetValueExA(propkey, "InstallLocation", 0, REG_SZ, (LPBYTE)"loc", 4);
3618 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
3620 /* InstallLocation value exists */
3622 lstrcpyA(buf, "apple");
3623 r = pMsiGetProductInfoExA(prodcode, usersid,
3624 MSIINSTALLCONTEXT_USERUNMANAGED,
3625 INSTALLPROPERTY_INSTALLLOCATION, buf, &sz);
3626 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
3627 ok(!lstrcmpA(buf, "loc"), "Expected \"loc\", got \"%s\"\n", buf);
3628 ok(sz == 3, "Expected 3, got %d\n", sz);
3630 res = RegSetValueExA(propkey, "InstallSource", 0, REG_SZ, (LPBYTE)"source", 7);
3631 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
3633 /* InstallSource value exists */
3635 lstrcpyA(buf, "apple");
3636 r = pMsiGetProductInfoExA(prodcode, usersid,
3637 MSIINSTALLCONTEXT_USERUNMANAGED,
3638 INSTALLPROPERTY_INSTALLSOURCE, buf, &sz);
3639 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
3640 ok(!lstrcmpA(buf, "source"), "Expected \"source\", got \"%s\"\n", buf);
3641 ok(sz == 6, "Expected 6, got %d\n", sz);
3643 res = RegSetValueExA(propkey, "LocalPackage", 0, REG_SZ, (LPBYTE)"local", 6);
3644 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
3646 /* LocalPackage value exists */
3648 lstrcpyA(buf, "apple");
3649 r = pMsiGetProductInfoExA(prodcode, usersid,
3650 MSIINSTALLCONTEXT_USERUNMANAGED,
3651 INSTALLPROPERTY_LOCALPACKAGE, buf, &sz);
3652 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
3653 ok(!lstrcmpA(buf, "local"), "Expected \"local\", got \"%s\"\n", buf);
3654 ok(sz == 5, "Expected 5, got %d\n", sz);
3656 res = RegSetValueExA(propkey, "Publisher", 0, REG_SZ, (LPBYTE)"pub", 4);
3657 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
3659 /* Publisher value exists */
3661 lstrcpyA(buf, "apple");
3662 r = pMsiGetProductInfoExA(prodcode, usersid,
3663 MSIINSTALLCONTEXT_USERUNMANAGED,
3664 INSTALLPROPERTY_PUBLISHER, buf, &sz);
3665 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
3666 ok(!lstrcmpA(buf, "pub"), "Expected \"pub\", got \"%s\"\n", buf);
3667 ok(sz == 3, "Expected 3, got %d\n", sz);
3669 res = RegSetValueExA(propkey, "URLInfoAbout", 0, REG_SZ, (LPBYTE)"about", 6);
3670 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
3672 /* URLInfoAbout value exists */
3674 lstrcpyA(buf, "apple");
3675 r = pMsiGetProductInfoExA(prodcode, usersid,
3676 MSIINSTALLCONTEXT_USERUNMANAGED,
3677 INSTALLPROPERTY_URLINFOABOUT, buf, &sz);
3678 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
3679 ok(!lstrcmpA(buf, "about"), "Expected \"about\", got \"%s\"\n", buf);
3680 ok(sz == 5, "Expected 5, got %d\n", sz);
3682 res = RegSetValueExA(propkey, "URLUpdateInfo", 0, REG_SZ, (LPBYTE)"update", 7);
3683 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
3685 /* URLUpdateInfo value exists */
3687 lstrcpyA(buf, "apple");
3688 r = pMsiGetProductInfoExA(prodcode, usersid,
3689 MSIINSTALLCONTEXT_USERUNMANAGED,
3690 INSTALLPROPERTY_URLUPDATEINFO, buf, &sz);
3691 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
3692 ok(!lstrcmpA(buf, "update"), "Expected \"update\", got \"%s\"\n", buf);
3693 ok(sz == 6, "Expected 6, got %d\n", sz);
3695 res = RegSetValueExA(propkey, "VersionMinor", 0, REG_SZ, (LPBYTE)"2", 2);
3696 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
3698 /* VersionMinor value exists */
3700 lstrcpyA(buf, "apple");
3701 r = pMsiGetProductInfoExA(prodcode, usersid,
3702 MSIINSTALLCONTEXT_USERUNMANAGED,
3703 INSTALLPROPERTY_VERSIONMINOR, buf, &sz);
3704 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
3705 ok(!lstrcmpA(buf, "2"), "Expected \"2\", got \"%s\"\n", buf);
3706 ok(sz == 1, "Expected 1, got %d\n", sz);
3708 res = RegSetValueExA(propkey, "VersionMajor", 0, REG_SZ, (LPBYTE)"3", 2);
3709 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
3711 /* VersionMajor value exists */
3713 lstrcpyA(buf, "apple");
3714 r = pMsiGetProductInfoExA(prodcode, usersid,
3715 MSIINSTALLCONTEXT_USERUNMANAGED,
3716 INSTALLPROPERTY_VERSIONMAJOR, buf, &sz);
3717 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
3718 ok(!lstrcmpA(buf, "3"), "Expected \"3\", got \"%s\"\n", buf);
3719 ok(sz == 1, "Expected 1, got %d\n", sz);
3721 res = RegSetValueExA(propkey, "DisplayVersion", 0, REG_SZ, (LPBYTE)"3.2.1", 6);
3722 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
3724 /* DisplayVersion value exists */
3726 lstrcpyA(buf, "apple");
3727 r = pMsiGetProductInfoExA(prodcode, usersid,
3728 MSIINSTALLCONTEXT_USERUNMANAGED,
3729 INSTALLPROPERTY_VERSIONSTRING, buf, &sz);
3730 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
3731 ok(!lstrcmpA(buf, "3.2.1"), "Expected \"3.2.1\", got \"%s\"\n", buf);
3732 ok(sz == 5, "Expected 5, got %d\n", sz);
3734 res = RegSetValueExA(propkey, "ProductID", 0, REG_SZ, (LPBYTE)"id", 3);
3735 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
3737 /* ProductID value exists */
3739 lstrcpyA(buf, "apple");
3740 r = pMsiGetProductInfoExA(prodcode, usersid,
3741 MSIINSTALLCONTEXT_USERUNMANAGED,
3742 INSTALLPROPERTY_PRODUCTID, buf, &sz);
3743 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
3744 ok(!lstrcmpA(buf, "id"), "Expected \"id\", got \"%s\"\n", buf);
3745 ok(sz == 2, "Expected 2, got %d\n", sz);
3747 res = RegSetValueExA(propkey, "RegCompany", 0, REG_SZ, (LPBYTE)"comp", 5);
3748 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
3750 /* RegCompany value exists */
3752 lstrcpyA(buf, "apple");
3753 r = pMsiGetProductInfoExA(prodcode, usersid,
3754 MSIINSTALLCONTEXT_USERUNMANAGED,
3755 INSTALLPROPERTY_REGCOMPANY, buf, &sz);
3756 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
3757 ok(!lstrcmpA(buf, "comp"), "Expected \"comp\", got \"%s\"\n", buf);
3758 ok(sz == 4, "Expected 4, got %d\n", sz);
3760 res = RegSetValueExA(propkey, "RegOwner", 0, REG_SZ, (LPBYTE)"owner", 6);
3761 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
3763 /* RegOwner value exists */
3765 lstrcpyA(buf, "apple");
3766 r = pMsiGetProductInfoExA(prodcode, usersid,
3767 MSIINSTALLCONTEXT_USERUNMANAGED,
3768 INSTALLPROPERTY_REGOWNER, buf, &sz);
3769 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
3770 ok(!lstrcmpA(buf, "owner"), "Expected \"owner\", got \"%s\"\n", buf);
3771 ok(sz == 5, "Expected 5, got %d\n", sz);
3773 res = RegSetValueExA(propkey, "Transforms", 0, REG_SZ, (LPBYTE)"trans", 6);
3774 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
3776 /* Transforms value exists */
3778 lstrcpyA(buf, "apple");
3779 r = pMsiGetProductInfoExA(prodcode, usersid,
3780 MSIINSTALLCONTEXT_USERUNMANAGED,
3781 INSTALLPROPERTY_TRANSFORMS, buf, &sz);
3782 ok(r == ERROR_UNKNOWN_PRODUCT,
3783 "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r);
3784 ok(!lstrcmpA(buf, "apple"), "Expected buf to be unchanged, got %s\n", buf);
3785 ok(sz == MAX_PATH, "Expected MAX_PATH, got %d\n", sz);
3787 res = RegSetValueExA(propkey, "Language", 0, REG_SZ, (LPBYTE)"lang", 5);
3788 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
3790 /* Language value exists */
3792 lstrcpyA(buf, "apple");
3793 r = pMsiGetProductInfoExA(prodcode, usersid,
3794 MSIINSTALLCONTEXT_USERUNMANAGED,
3795 INSTALLPROPERTY_LANGUAGE, buf, &sz);
3796 ok(r == ERROR_UNKNOWN_PRODUCT,
3797 "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r);
3798 ok(!lstrcmpA(buf, "apple"), "Expected buf to be unchanged, got %s\n", buf);
3799 ok(sz == MAX_PATH, "Expected MAX_PATH, got %d\n", sz);
3801 res = RegSetValueExA(propkey, "ProductName", 0, REG_SZ, (LPBYTE)"name", 5);
3802 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
3804 /* ProductName value exists */
3806 lstrcpyA(buf, "apple");
3807 r = pMsiGetProductInfoExA(prodcode, usersid,
3808 MSIINSTALLCONTEXT_USERUNMANAGED,
3809 INSTALLPROPERTY_PRODUCTNAME, buf, &sz);
3810 ok(r == ERROR_UNKNOWN_PRODUCT,
3811 "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r);
3812 ok(!lstrcmpA(buf, "apple"), "Expected buf to be unchanged, got %s\n", buf);
3813 ok(sz == MAX_PATH, "Expected MAX_PATH, got %d\n", sz);
3815 res = RegSetValueExA(propkey, "AssignmentType", 0, REG_SZ, (LPBYTE)"type", 5);
3816 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
3820 /* AssignmentType value exists */
3822 lstrcpyA(buf, "apple");
3823 r = pMsiGetProductInfoExA(prodcode, usersid,
3824 MSIINSTALLCONTEXT_USERUNMANAGED,
3825 INSTALLPROPERTY_ASSIGNMENTTYPE, buf, &sz);
3826 ok(r == ERROR_UNKNOWN_PRODUCT,
3827 "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r);
3828 ok(!lstrcmpA(buf, "apple"), "Expected buf to be unchanged, got %s\n", buf);
3829 ok(sz == MAX_PATH, "Expected MAX_PATH, got %d\n", sz);
3831 res = RegSetValueExA(propkey, "PackageCode", 0, REG_SZ, (LPBYTE)"code", 5);
3832 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
3834 /* PackageCode value exists */
3836 lstrcpyA(buf, "apple");
3837 r = pMsiGetProductInfoExA(prodcode, usersid,
3838 MSIINSTALLCONTEXT_USERUNMANAGED,
3839 INSTALLPROPERTY_PACKAGECODE, buf, &sz);
3840 ok(r == ERROR_UNKNOWN_PRODUCT,
3841 "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r);
3842 ok(!lstrcmpA(buf, "apple"), "Expected buf to be unchanged, got %s\n", buf);
3843 ok(sz == MAX_PATH, "Expected MAX_PATH, got %d\n", sz);
3845 res = RegSetValueExA(propkey, "Version", 0, REG_SZ, (LPBYTE)"ver", 4);
3846 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
3848 /* Version value exists */
3850 lstrcpyA(buf, "apple");
3851 r = pMsiGetProductInfoExA(prodcode, usersid,
3852 MSIINSTALLCONTEXT_USERUNMANAGED,
3853 INSTALLPROPERTY_VERSION, buf, &sz);
3854 ok(r == ERROR_UNKNOWN_PRODUCT,
3855 "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r);
3856 ok(!lstrcmpA(buf, "apple"), "Expected buf to be unchanged, got %s\n", buf);
3857 ok(sz == MAX_PATH, "Expected MAX_PATH, got %d\n", sz);
3859 res = RegSetValueExA(propkey, "ProductIcon", 0, REG_SZ, (LPBYTE)"icon", 5);
3860 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
3862 /* ProductIcon value exists */
3864 lstrcpyA(buf, "apple");
3865 r = pMsiGetProductInfoExA(prodcode, usersid,
3866 MSIINSTALLCONTEXT_USERUNMANAGED,
3867 INSTALLPROPERTY_PRODUCTICON, buf, &sz);
3868 ok(r == ERROR_UNKNOWN_PRODUCT,
3869 "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r);
3870 ok(!lstrcmpA(buf, "apple"), "Expected buf to be unchanged, got %s\n", buf);
3871 ok(sz == MAX_PATH, "Expected MAX_PATH, got %d\n", sz);
3873 res = RegSetValueExA(propkey, "PackageName", 0, REG_SZ, (LPBYTE)"name", 5);
3874 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
3876 /* PackageName value exists */
3878 lstrcpyA(buf, "apple");
3879 r = pMsiGetProductInfoExA(prodcode, usersid,
3880 MSIINSTALLCONTEXT_USERUNMANAGED,
3881 INSTALLPROPERTY_PACKAGENAME, buf, &sz);
3882 ok(r == ERROR_UNKNOWN_PRODUCT,
3883 "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r);
3884 ok(!lstrcmpA(buf, "apple"), "Expected buf to be unchanged, got %s\n", buf);
3885 ok(sz == MAX_PATH, "Expected MAX_PATH, got %d\n", sz);
3887 res = RegSetValueExA(propkey, "AuthorizedLUAApp", 0, REG_SZ, (LPBYTE)"auth", 5);
3888 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
3890 /* AuthorizedLUAApp value exists */
3892 lstrcpyA(buf, "apple");
3893 r = pMsiGetProductInfoExA(prodcode, usersid,
3894 MSIINSTALLCONTEXT_USERUNMANAGED,
3895 INSTALLPROPERTY_AUTHORIZED_LUA_APP, buf, &sz);
3896 ok(r == ERROR_UNKNOWN_PRODUCT,
3897 "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r);
3898 ok(!lstrcmpA(buf, "apple"), "Expected buf to be unchanged, got %s\n", buf);
3899 ok(sz == MAX_PATH, "Expected MAX_PATH, got %d\n", sz);
3901 RegDeleteValueA(propkey, "AuthorizedLUAApp");
3902 RegDeleteValueA(propkey, "PackageName");
3903 RegDeleteValueA(propkey, "ProductIcon");
3904 RegDeleteValueA(propkey, "Version");
3905 RegDeleteValueA(propkey, "PackageCode");
3906 RegDeleteValueA(propkey, "AssignmentType");
3907 RegDeleteValueA(propkey, "ProductName");
3908 RegDeleteValueA(propkey, "Language");
3909 RegDeleteValueA(propkey, "Transforms");
3910 RegDeleteValueA(propkey, "RegOwner");
3911 RegDeleteValueA(propkey, "RegCompany");
3912 RegDeleteValueA(propkey, "ProductID");
3913 RegDeleteValueA(propkey, "DisplayVersion");
3914 RegDeleteValueA(propkey, "VersionMajor");
3915 RegDeleteValueA(propkey, "VersionMinor");
3916 RegDeleteValueA(propkey, "URLUpdateInfo");
3917 RegDeleteValueA(propkey, "URLInfoAbout");
3918 RegDeleteValueA(propkey, "Publisher");
3919 RegDeleteValueA(propkey, "LocalPackage");
3920 RegDeleteValueA(propkey, "InstallSource");
3921 RegDeleteValueA(propkey, "InstallLocation");
3922 RegDeleteValueA(propkey, "DisplayName");
3923 RegDeleteValueA(propkey, "InstallDate");
3924 RegDeleteValueA(propkey, "HelpTelephone");
3925 RegDeleteValueA(propkey, "HelpLink");
3926 RegDeleteValueA(propkey, "LocalPackage");
3927 RegDeleteKeyA(propkey, "");
3928 RegCloseKey(propkey);
3929 RegDeleteKeyA(localkey, "");
3930 RegCloseKey(localkey);
3932 lstrcpyA(keypath, "Software\\Microsoft\\Windows\\CurrentVersion\\Installer\\Managed\\");
3933 lstrcatA(keypath, usersid);
3934 lstrcatA(keypath, "\\Installer\\Products\\");
3935 lstrcatA(keypath, prod_squashed);
3937 res = RegCreateKeyA(HKEY_LOCAL_MACHINE, keypath, &userkey);
3938 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
3940 /* user product key exists */
3942 lstrcpyA(buf, "apple");
3943 r = pMsiGetProductInfoExA(prodcode, usersid,
3944 MSIINSTALLCONTEXT_USERUNMANAGED,
3945 INSTALLPROPERTY_PRODUCTSTATE, buf, &sz);
3946 ok(r == ERROR_UNKNOWN_PRODUCT,
3947 "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r);
3948 ok(!lstrcmpA(buf, "apple"), "Expected buf to be unchanged, got %s\n", buf);
3949 ok(sz == MAX_PATH, "Expected MAX_PATH, got %d\n", sz);
3951 RegDeleteKeyA(userkey, "");
3952 RegCloseKey(userkey);
3954 lstrcpyA(keypath, "Software\\Microsoft\\Installer\\Products\\");
3955 lstrcatA(keypath, prod_squashed);
3957 res = RegCreateKeyA(HKEY_CURRENT_USER, keypath, &prodkey);
3958 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
3961 lstrcpyA(buf, "apple");
3962 r = pMsiGetProductInfoExA(prodcode, usersid,
3963 MSIINSTALLCONTEXT_USERUNMANAGED,
3964 INSTALLPROPERTY_PRODUCTSTATE, buf, &sz);
3965 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
3966 ok(!lstrcmpA(buf, "1"), "Expected \"1\", got \"%s\"\n", buf);
3967 ok(sz == 1, "Expected 1, got %d\n", sz);
3969 res = RegSetValueExA(prodkey, "HelpLink", 0, REG_SZ, (LPBYTE)"link", 5);
3970 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
3972 /* HelpLink value exists */
3974 lstrcpyA(buf, "apple");
3975 r = pMsiGetProductInfoExA(prodcode, usersid,
3976 MSIINSTALLCONTEXT_USERUNMANAGED,
3977 INSTALLPROPERTY_HELPLINK, buf, &sz);
3978 ok(r == ERROR_UNKNOWN_PROPERTY,
3979 "Expected ERROR_UNKNOWN_PROPERTY, got %d\n", r);
3980 ok(!lstrcmpA(buf, "apple"), "Expected buf to be unchanged, got %s\n", buf);
3981 ok(sz == MAX_PATH, "Expected MAX_PATH, got %d\n", sz);
3983 res = RegSetValueExA(prodkey, "HelpTelephone", 0, REG_SZ, (LPBYTE)"phone", 6);
3984 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
3986 /* HelpTelephone value exists */
3988 lstrcpyA(buf, "apple");
3989 r = pMsiGetProductInfoExA(prodcode, usersid,
3990 MSIINSTALLCONTEXT_USERUNMANAGED,
3991 INSTALLPROPERTY_HELPTELEPHONE, buf, &sz);
3992 ok(r == ERROR_UNKNOWN_PROPERTY,
3993 "Expected ERROR_UNKNOWN_PROPERTY, got %d\n", r);
3994 ok(!lstrcmpA(buf, "apple"), "Expected buf to be unchanged, got %s\n", buf);
3995 ok(sz == MAX_PATH, "Expected MAX_PATH, got %d\n", sz);
3997 res = RegSetValueExA(prodkey, "InstallDate", 0, REG_SZ, (LPBYTE)"date", 5);
3998 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
4000 /* InstallDate value exists */
4002 lstrcpyA(buf, "apple");
4003 r = pMsiGetProductInfoExA(prodcode, usersid,
4004 MSIINSTALLCONTEXT_USERUNMANAGED,
4005 INSTALLPROPERTY_INSTALLDATE, buf, &sz);
4006 ok(r == ERROR_UNKNOWN_PROPERTY,
4007 "Expected ERROR_UNKNOWN_PROPERTY, got %d\n", r);
4008 ok(!lstrcmpA(buf, "apple"), "Expected buf to be unchanged, got %s\n", buf);
4009 ok(sz == MAX_PATH, "Expected MAX_PATH, got %d\n", sz);
4011 res = RegSetValueExA(prodkey, "DisplayName", 0, REG_SZ, (LPBYTE)"name", 5);
4012 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
4014 /* DisplayName value exists */
4016 lstrcpyA(buf, "apple");
4017 r = pMsiGetProductInfoExA(prodcode, usersid,
4018 MSIINSTALLCONTEXT_USERUNMANAGED,
4019 INSTALLPROPERTY_INSTALLEDPRODUCTNAME, buf, &sz);
4020 ok(r == ERROR_UNKNOWN_PROPERTY,
4021 "Expected ERROR_UNKNOWN_PROPERTY, got %d\n", r);
4022 ok(!lstrcmpA(buf, "apple"), "Expected buf to be unchanged, got %s\n", buf);
4023 ok(sz == MAX_PATH, "Expected MAX_PATH, got %d\n", sz);
4025 res = RegSetValueExA(prodkey, "InstallLocation", 0, REG_SZ, (LPBYTE)"loc", 4);
4026 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
4028 /* InstallLocation value exists */
4030 lstrcpyA(buf, "apple");
4031 r = pMsiGetProductInfoExA(prodcode, usersid,
4032 MSIINSTALLCONTEXT_USERUNMANAGED,
4033 INSTALLPROPERTY_INSTALLLOCATION, buf, &sz);
4034 ok(r == ERROR_UNKNOWN_PROPERTY,
4035 "Expected ERROR_UNKNOWN_PROPERTY, got %d\n", r);
4036 ok(!lstrcmpA(buf, "apple"), "Expected buf to be unchanged, got %s\n", buf);
4037 ok(sz == MAX_PATH, "Expected MAX_PATH, got %d\n", sz);
4039 res = RegSetValueExA(prodkey, "InstallSource", 0, REG_SZ, (LPBYTE)"source", 7);
4040 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
4042 /* InstallSource value exists */
4044 lstrcpyA(buf, "apple");
4045 r = pMsiGetProductInfoExA(prodcode, usersid,
4046 MSIINSTALLCONTEXT_USERUNMANAGED,
4047 INSTALLPROPERTY_INSTALLSOURCE, buf, &sz);
4048 ok(r == ERROR_UNKNOWN_PROPERTY,
4049 "Expected ERROR_UNKNOWN_PROPERTY, got %d\n", r);
4050 ok(!lstrcmpA(buf, "apple"), "Expected buf to be unchanged, got %s\n", buf);
4051 ok(sz == MAX_PATH, "Expected MAX_PATH, got %d\n", sz);
4053 res = RegSetValueExA(prodkey, "LocalPackage", 0, REG_SZ, (LPBYTE)"local", 6);
4054 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
4056 /* LocalPackage value exists */
4058 lstrcpyA(buf, "apple");
4059 r = pMsiGetProductInfoExA(prodcode, usersid,
4060 MSIINSTALLCONTEXT_USERUNMANAGED,
4061 INSTALLPROPERTY_LOCALPACKAGE, buf, &sz);
4062 ok(r == ERROR_UNKNOWN_PROPERTY,
4063 "Expected ERROR_UNKNOWN_PROPERTY, got %d\n", r);
4064 ok(!lstrcmpA(buf, "apple"), "Expected buf to be unchanged, got %s\n", buf);
4065 ok(sz == MAX_PATH, "Expected MAX_PATH, got %d\n", sz);
4067 res = RegSetValueExA(prodkey, "Publisher", 0, REG_SZ, (LPBYTE)"pub", 4);
4068 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
4070 /* Publisher value exists */
4072 lstrcpyA(buf, "apple");
4073 r = pMsiGetProductInfoExA(prodcode, usersid,
4074 MSIINSTALLCONTEXT_USERUNMANAGED,
4075 INSTALLPROPERTY_PUBLISHER, buf, &sz);
4076 ok(r == ERROR_UNKNOWN_PROPERTY,
4077 "Expected ERROR_UNKNOWN_PROPERTY, got %d\n", r);
4078 ok(!lstrcmpA(buf, "apple"), "Expected buf to be unchanged, got %s\n", buf);
4079 ok(sz == MAX_PATH, "Expected MAX_PATH, got %d\n", sz);
4081 res = RegSetValueExA(prodkey, "URLInfoAbout", 0, REG_SZ, (LPBYTE)"about", 6);
4082 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
4084 /* URLInfoAbout value exists */
4086 lstrcpyA(buf, "apple");
4087 r = pMsiGetProductInfoExA(prodcode, usersid,
4088 MSIINSTALLCONTEXT_USERUNMANAGED,
4089 INSTALLPROPERTY_URLINFOABOUT, buf, &sz);
4090 ok(r == ERROR_UNKNOWN_PROPERTY,
4091 "Expected ERROR_UNKNOWN_PROPERTY, got %d\n", r);
4092 ok(!lstrcmpA(buf, "apple"), "Expected buf to be unchanged, got %s\n", buf);
4093 ok(sz == MAX_PATH, "Expected MAX_PATH, got %d\n", sz);
4095 res = RegSetValueExA(prodkey, "URLUpdateInfo", 0, REG_SZ, (LPBYTE)"update", 7);
4096 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
4098 /* URLUpdateInfo value exists */
4100 lstrcpyA(buf, "apple");
4101 r = pMsiGetProductInfoExA(prodcode, usersid,
4102 MSIINSTALLCONTEXT_USERUNMANAGED,
4103 INSTALLPROPERTY_URLUPDATEINFO, buf, &sz);
4104 ok(r == ERROR_UNKNOWN_PROPERTY,
4105 "Expected ERROR_UNKNOWN_PROPERTY, got %d\n", r);
4106 ok(!lstrcmpA(buf, "apple"), "Expected buf to be unchanged, got %s\n", buf);
4107 ok(sz == MAX_PATH, "Expected MAX_PATH, got %d\n", sz);
4109 res = RegSetValueExA(prodkey, "VersionMinor", 0, REG_SZ, (LPBYTE)"2", 2);
4110 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
4112 /* VersionMinor value exists */
4114 lstrcpyA(buf, "apple");
4115 r = pMsiGetProductInfoExA(prodcode, usersid,
4116 MSIINSTALLCONTEXT_USERUNMANAGED,
4117 INSTALLPROPERTY_VERSIONMINOR, buf, &sz);
4118 ok(r == ERROR_UNKNOWN_PROPERTY,
4119 "Expected ERROR_UNKNOWN_PROPERTY, got %d\n", r);
4120 ok(!lstrcmpA(buf, "apple"), "Expected buf to be unchanged, got %s\n", buf);
4121 ok(sz == MAX_PATH, "Expected MAX_PATH, got %d\n", sz);
4123 res = RegSetValueExA(prodkey, "VersionMajor", 0, REG_SZ, (LPBYTE)"3", 2);
4124 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
4126 /* VersionMajor value exists */
4128 lstrcpyA(buf, "apple");
4129 r = pMsiGetProductInfoExA(prodcode, usersid,
4130 MSIINSTALLCONTEXT_USERUNMANAGED,
4131 INSTALLPROPERTY_VERSIONMAJOR, buf, &sz);
4132 ok(r == ERROR_UNKNOWN_PROPERTY,
4133 "Expected ERROR_UNKNOWN_PROPERTY, got %d\n", r);
4134 ok(!lstrcmpA(buf, "apple"), "Expected buf to be unchanged, got %s\n", buf);
4135 ok(sz == MAX_PATH, "Expected MAX_PATH, got %d\n", sz);
4137 res = RegSetValueExA(prodkey, "DisplayVersion", 0, REG_SZ, (LPBYTE)"3.2.1", 6);
4138 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
4140 /* DisplayVersion value exists */
4142 lstrcpyA(buf, "apple");
4143 r = pMsiGetProductInfoExA(prodcode, usersid,
4144 MSIINSTALLCONTEXT_USERUNMANAGED,
4145 INSTALLPROPERTY_VERSIONSTRING, buf, &sz);
4146 ok(r == ERROR_UNKNOWN_PROPERTY,
4147 "Expected ERROR_UNKNOWN_PROPERTY, got %d\n", r);
4148 ok(!lstrcmpA(buf, "apple"), "Expected buf to be unchanged, got %s\n", buf);
4149 ok(sz == MAX_PATH, "Expected MAX_PATH, got %d\n", sz);
4151 res = RegSetValueExA(prodkey, "ProductID", 0, REG_SZ, (LPBYTE)"id", 3);
4152 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
4154 /* ProductID value exists */
4156 lstrcpyA(buf, "apple");
4157 r = pMsiGetProductInfoExA(prodcode, usersid,
4158 MSIINSTALLCONTEXT_USERUNMANAGED,
4159 INSTALLPROPERTY_PRODUCTID, buf, &sz);
4160 ok(r == ERROR_UNKNOWN_PROPERTY,
4161 "Expected ERROR_UNKNOWN_PROPERTY, got %d\n", r);
4162 ok(!lstrcmpA(buf, "apple"), "Expected buf to be unchanged, got %s\n", buf);
4163 ok(sz == MAX_PATH, "Expected MAX_PATH, got %d\n", sz);
4165 res = RegSetValueExA(prodkey, "RegCompany", 0, REG_SZ, (LPBYTE)"comp", 5);
4166 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
4168 /* RegCompany value exists */
4170 lstrcpyA(buf, "apple");
4171 r = pMsiGetProductInfoExA(prodcode, usersid,
4172 MSIINSTALLCONTEXT_USERUNMANAGED,
4173 INSTALLPROPERTY_REGCOMPANY, buf, &sz);
4174 ok(r == ERROR_UNKNOWN_PROPERTY,
4175 "Expected ERROR_UNKNOWN_PROPERTY, got %d\n", r);
4176 ok(!lstrcmpA(buf, "apple"), "Expected buf to be unchanged, got %s\n", buf);
4177 ok(sz == MAX_PATH, "Expected MAX_PATH, got %d\n", sz);
4179 res = RegSetValueExA(prodkey, "RegOwner", 0, REG_SZ, (LPBYTE)"owner", 6);
4180 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
4182 /* RegOwner value exists */
4184 lstrcpyA(buf, "apple");
4185 r = pMsiGetProductInfoExA(prodcode, usersid,
4186 MSIINSTALLCONTEXT_USERUNMANAGED,
4187 INSTALLPROPERTY_REGOWNER, buf, &sz);
4188 ok(r == ERROR_UNKNOWN_PROPERTY,
4189 "Expected ERROR_UNKNOWN_PROPERTY, got %d\n", r);
4190 ok(!lstrcmpA(buf, "apple"), "Expected buf to be unchanged, got %s\n", buf);
4191 ok(sz == MAX_PATH, "Expected MAX_PATH, got %d\n", sz);
4193 res = RegSetValueExA(prodkey, "Transforms", 0, REG_SZ, (LPBYTE)"trans", 6);
4194 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
4196 /* Transforms value exists */
4198 lstrcpyA(buf, "apple");
4199 r = pMsiGetProductInfoExA(prodcode, usersid,
4200 MSIINSTALLCONTEXT_USERUNMANAGED,
4201 INSTALLPROPERTY_TRANSFORMS, buf, &sz);
4202 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
4203 ok(!lstrcmpA(buf, "trans"), "Expected \"trans\", got \"%s\"\n", buf);
4204 ok(sz == 5, "Expected 5, got %d\n", sz);
4206 res = RegSetValueExA(prodkey, "Language", 0, REG_SZ, (LPBYTE)"lang", 5);
4207 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
4209 /* Language value exists */
4211 lstrcpyA(buf, "apple");
4212 r = pMsiGetProductInfoExA(prodcode, usersid,
4213 MSIINSTALLCONTEXT_USERUNMANAGED,
4214 INSTALLPROPERTY_LANGUAGE, buf, &sz);
4215 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
4216 ok(!lstrcmpA(buf, "lang"), "Expected \"lang\", got \"%s\"\n", buf);
4217 ok(sz == 4, "Expected 4, got %d\n", sz);
4219 res = RegSetValueExA(prodkey, "ProductName", 0, REG_SZ, (LPBYTE)"name", 5);
4220 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
4222 /* ProductName value exists */
4224 lstrcpyA(buf, "apple");
4225 r = pMsiGetProductInfoExA(prodcode, usersid,
4226 MSIINSTALLCONTEXT_USERUNMANAGED,
4227 INSTALLPROPERTY_PRODUCTNAME, buf, &sz);
4228 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
4229 ok(!lstrcmpA(buf, "name"), "Expected \"name\", got \"%s\"\n", buf);
4230 ok(sz == 4, "Expected 4, got %d\n", sz);
4232 res = RegSetValueExA(prodkey, "AssignmentType", 0, REG_SZ, (LPBYTE)"type", 5);
4233 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
4237 /* AssignmentType value exists */
4239 lstrcpyA(buf, "apple");
4240 r = pMsiGetProductInfoExA(prodcode, usersid,
4241 MSIINSTALLCONTEXT_USERUNMANAGED,
4242 INSTALLPROPERTY_ASSIGNMENTTYPE, buf, &sz);
4243 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
4244 ok(!lstrcmpA(buf, ""), "Expected \"\", got \"%s\"\n", buf);
4245 ok(sz == 0, "Expected 0, got %d\n", sz);
4247 res = RegSetValueExA(prodkey, "PackageCode", 0, REG_SZ, (LPBYTE)"code", 5);
4248 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
4252 /* PackageCode value exists */
4254 lstrcpyA(buf, "apple");
4255 r = pMsiGetProductInfoExA(prodcode, usersid,
4256 MSIINSTALLCONTEXT_USERUNMANAGED,
4257 INSTALLPROPERTY_PACKAGECODE, buf, &sz);
4260 ok(r == ERROR_BAD_CONFIGURATION,
4261 "Expected ERROR_BAD_CONFIGURATION, got %d\n", r);
4262 ok(!lstrcmpA(buf, "apple"), "Expected buf to be unchanged, got %s\n", buf);
4263 ok(sz == MAX_PATH, "Expected MAX_PATH, got %d\n", sz);
4266 res = RegSetValueExA(prodkey, "Version", 0, REG_SZ, (LPBYTE)"ver", 4);
4267 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
4269 /* Version value exists */
4271 lstrcpyA(buf, "apple");
4272 r = pMsiGetProductInfoExA(prodcode, usersid,
4273 MSIINSTALLCONTEXT_USERUNMANAGED,
4274 INSTALLPROPERTY_VERSION, buf, &sz);
4275 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
4276 ok(!lstrcmpA(buf, "ver"), "Expected \"ver\", got \"%s\"\n", buf);
4277 ok(sz == 3, "Expected 3, got %d\n", sz);
4279 res = RegSetValueExA(prodkey, "ProductIcon", 0, REG_SZ, (LPBYTE)"icon", 5);
4280 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
4282 /* ProductIcon value exists */
4284 lstrcpyA(buf, "apple");
4285 r = pMsiGetProductInfoExA(prodcode, usersid,
4286 MSIINSTALLCONTEXT_USERUNMANAGED,
4287 INSTALLPROPERTY_PRODUCTICON, buf, &sz);
4288 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
4289 ok(!lstrcmpA(buf, "icon"), "Expected \"icon\", got \"%s\"\n", buf);
4290 ok(sz == 4, "Expected 4, got %d\n", sz);
4292 res = RegSetValueExA(prodkey, "PackageName", 0, REG_SZ, (LPBYTE)"name", 5);
4293 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
4295 /* PackageName value exists */
4297 lstrcpyA(buf, "apple");
4298 r = pMsiGetProductInfoExA(prodcode, usersid,
4299 MSIINSTALLCONTEXT_USERUNMANAGED,
4300 INSTALLPROPERTY_PACKAGENAME, buf, &sz);
4303 ok(r == ERROR_UNKNOWN_PRODUCT,
4304 "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r);
4305 ok(!lstrcmpA(buf, "apple"), "Expected buf to be unchanged, got %s\n", buf);
4306 ok(sz == MAX_PATH, "Expected MAX_PATH, got %d\n", sz);
4309 res = RegSetValueExA(prodkey, "AuthorizedLUAApp", 0, REG_SZ, (LPBYTE)"auth", 5);
4310 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
4312 /* AuthorizedLUAApp value exists */
4314 lstrcpyA(buf, "apple");
4315 r = pMsiGetProductInfoExA(prodcode, usersid,
4316 MSIINSTALLCONTEXT_USERUNMANAGED,
4317 INSTALLPROPERTY_AUTHORIZED_LUA_APP, buf, &sz);
4318 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
4319 ok(!lstrcmpA(buf, "auth"), "Expected \"auth\", got \"%s\"\n", buf);
4320 ok(sz == 4, "Expected 4, got %d\n", sz);
4322 RegDeleteValueA(prodkey, "AuthorizedLUAApp");
4323 RegDeleteValueA(prodkey, "PackageName");
4324 RegDeleteValueA(prodkey, "ProductIcon");
4325 RegDeleteValueA(prodkey, "Version");
4326 RegDeleteValueA(prodkey, "PackageCode");
4327 RegDeleteValueA(prodkey, "AssignmentType");
4328 RegDeleteValueA(prodkey, "ProductName");
4329 RegDeleteValueA(prodkey, "Language");
4330 RegDeleteValueA(prodkey, "Transforms");
4331 RegDeleteValueA(prodkey, "RegOwner");
4332 RegDeleteValueA(prodkey, "RegCompany");
4333 RegDeleteValueA(prodkey, "ProductID");
4334 RegDeleteValueA(prodkey, "DisplayVersion");
4335 RegDeleteValueA(prodkey, "VersionMajor");
4336 RegDeleteValueA(prodkey, "VersionMinor");
4337 RegDeleteValueA(prodkey, "URLUpdateInfo");
4338 RegDeleteValueA(prodkey, "URLInfoAbout");
4339 RegDeleteValueA(prodkey, "Publisher");
4340 RegDeleteValueA(prodkey, "LocalPackage");
4341 RegDeleteValueA(prodkey, "InstallSource");
4342 RegDeleteValueA(prodkey, "InstallLocation");
4343 RegDeleteValueA(prodkey, "DisplayName");
4344 RegDeleteValueA(prodkey, "InstallDate");
4345 RegDeleteValueA(prodkey, "HelpTelephone");
4346 RegDeleteValueA(prodkey, "HelpLink");
4347 RegDeleteValueA(prodkey, "LocalPackage");
4348 RegDeleteKeyA(prodkey, "");
4349 RegCloseKey(prodkey);
4351 /* MSIINSTALLCONTEXT_USERMANAGED */
4353 lstrcpyA(keypath, "Software\\Microsoft\\Windows\\CurrentVersion\\Installer\\UserData\\");
4354 lstrcatA(keypath, usersid);
4355 lstrcatA(keypath, "\\Products\\");
4356 lstrcatA(keypath, prod_squashed);
4358 res = RegCreateKeyA(HKEY_LOCAL_MACHINE, keypath, &localkey);
4359 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
4361 /* local user product key exists */
4363 lstrcpyA(buf, "apple");
4364 r = pMsiGetProductInfoExA(prodcode, usersid,
4365 MSIINSTALLCONTEXT_USERMANAGED,
4366 INSTALLPROPERTY_PRODUCTSTATE, buf, &sz);
4367 ok(r == ERROR_UNKNOWN_PRODUCT,
4368 "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r);
4369 ok(!lstrcmpA(buf, "apple"), "Expected buf to be unchanged, got %s\n", buf);
4370 ok(sz == MAX_PATH, "Expected MAX_PATH, got %d\n", sz);
4372 res = RegCreateKeyA(localkey, "InstallProperties", &propkey);
4373 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
4375 /* InstallProperties key exists */
4377 lstrcpyA(buf, "apple");
4378 r = pMsiGetProductInfoExA(prodcode, usersid,
4379 MSIINSTALLCONTEXT_USERMANAGED,
4380 INSTALLPROPERTY_PRODUCTSTATE, buf, &sz);
4381 ok(r == ERROR_UNKNOWN_PRODUCT,
4382 "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r);
4383 ok(!lstrcmpA(buf, "apple"), "Expected buf to be unchanged, got %s\n", buf);
4384 ok(sz == MAX_PATH, "Expected MAX_PATH, got %d\n", sz);
4386 res = RegSetValueExA(propkey, "ManagedLocalPackage", 0, REG_SZ, (LPBYTE)"local", 6);
4387 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
4389 /* ManagedLocalPackage value exists */
4391 lstrcpyA(buf, "apple");
4392 r = pMsiGetProductInfoExA(prodcode, usersid,
4393 MSIINSTALLCONTEXT_USERMANAGED,
4394 INSTALLPROPERTY_PRODUCTSTATE, buf, &sz);
4395 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
4396 ok(!lstrcmpA(buf, "5"), "Expected \"5\", got \"%s\"\n", buf);
4397 ok(sz == 1, "Expected 1, got %d\n", sz);
4399 res = RegSetValueExA(propkey, "HelpLink", 0, REG_SZ, (LPBYTE)"link", 5);
4400 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
4402 /* HelpLink value exists */
4404 lstrcpyA(buf, "apple");
4405 r = pMsiGetProductInfoExA(prodcode, usersid,
4406 MSIINSTALLCONTEXT_USERMANAGED,
4407 INSTALLPROPERTY_HELPLINK, buf, &sz);
4408 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
4409 ok(!lstrcmpA(buf, "link"), "Expected \"link\", got \"%s\"\n", buf);
4410 ok(sz == 4, "Expected 4, got %d\n", sz);
4412 res = RegSetValueExA(propkey, "HelpTelephone", 0, REG_SZ, (LPBYTE)"phone", 6);
4413 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
4415 /* HelpTelephone value exists */
4417 lstrcpyA(buf, "apple");
4418 r = pMsiGetProductInfoExA(prodcode, usersid,
4419 MSIINSTALLCONTEXT_USERMANAGED,
4420 INSTALLPROPERTY_HELPTELEPHONE, buf, &sz);
4421 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
4422 ok(!lstrcmpA(buf, "phone"), "Expected \"phone\", got \"%s\"\n", buf);
4423 ok(sz == 5, "Expected 5, got %d\n", sz);
4425 res = RegSetValueExA(propkey, "InstallDate", 0, REG_SZ, (LPBYTE)"date", 5);
4426 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
4428 /* InstallDate value exists */
4430 lstrcpyA(buf, "apple");
4431 r = pMsiGetProductInfoExA(prodcode, usersid,
4432 MSIINSTALLCONTEXT_USERMANAGED,
4433 INSTALLPROPERTY_INSTALLDATE, buf, &sz);
4434 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
4435 ok(!lstrcmpA(buf, "date"), "Expected \"date\", got \"%s\"\n", buf);
4436 ok(sz == 4, "Expected 4, got %d\n", sz);
4438 res = RegSetValueExA(propkey, "DisplayName", 0, REG_SZ, (LPBYTE)"name", 5);
4439 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
4441 /* DisplayName value exists */
4443 lstrcpyA(buf, "apple");
4444 r = pMsiGetProductInfoExA(prodcode, usersid,
4445 MSIINSTALLCONTEXT_USERMANAGED,
4446 INSTALLPROPERTY_INSTALLEDPRODUCTNAME, buf, &sz);
4447 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
4448 ok(!lstrcmpA(buf, "name"), "Expected \"name\", got \"%s\"\n", buf);
4449 ok(sz == 4, "Expected 4, got %d\n", sz);
4451 res = RegSetValueExA(propkey, "InstallLocation", 0, REG_SZ, (LPBYTE)"loc", 4);
4452 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
4454 /* InstallLocation value exists */
4456 lstrcpyA(buf, "apple");
4457 r = pMsiGetProductInfoExA(prodcode, usersid,
4458 MSIINSTALLCONTEXT_USERMANAGED,
4459 INSTALLPROPERTY_INSTALLLOCATION, buf, &sz);
4460 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
4461 ok(!lstrcmpA(buf, "loc"), "Expected \"loc\", got \"%s\"\n", buf);
4462 ok(sz == 3, "Expected 3, got %d\n", sz);
4464 res = RegSetValueExA(propkey, "InstallSource", 0, REG_SZ, (LPBYTE)"source", 7);
4465 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
4467 /* InstallSource value exists */
4469 lstrcpyA(buf, "apple");
4470 r = pMsiGetProductInfoExA(prodcode, usersid,
4471 MSIINSTALLCONTEXT_USERMANAGED,
4472 INSTALLPROPERTY_INSTALLSOURCE, buf, &sz);
4473 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
4474 ok(!lstrcmpA(buf, "source"), "Expected \"source\", got \"%s\"\n", buf);
4475 ok(sz == 6, "Expected 6, got %d\n", sz);
4477 res = RegSetValueExA(propkey, "LocalPackage", 0, REG_SZ, (LPBYTE)"local", 6);
4478 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
4480 /* LocalPackage value exists */
4482 lstrcpyA(buf, "apple");
4483 r = pMsiGetProductInfoExA(prodcode, usersid,
4484 MSIINSTALLCONTEXT_USERMANAGED,
4485 INSTALLPROPERTY_LOCALPACKAGE, buf, &sz);
4486 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
4487 ok(!lstrcmpA(buf, "local"), "Expected \"local\", got \"%s\"\n", buf);
4488 ok(sz == 5, "Expected 5, got %d\n", sz);
4490 res = RegSetValueExA(propkey, "Publisher", 0, REG_SZ, (LPBYTE)"pub", 4);
4491 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
4493 /* Publisher value exists */
4495 lstrcpyA(buf, "apple");
4496 r = pMsiGetProductInfoExA(prodcode, usersid,
4497 MSIINSTALLCONTEXT_USERMANAGED,
4498 INSTALLPROPERTY_PUBLISHER, buf, &sz);
4499 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
4500 ok(!lstrcmpA(buf, "pub"), "Expected \"pub\", got \"%s\"\n", buf);
4501 ok(sz == 3, "Expected 3, got %d\n", sz);
4503 res = RegSetValueExA(propkey, "URLInfoAbout", 0, REG_SZ, (LPBYTE)"about", 6);
4504 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
4506 /* URLInfoAbout value exists */
4508 lstrcpyA(buf, "apple");
4509 r = pMsiGetProductInfoExA(prodcode, usersid,
4510 MSIINSTALLCONTEXT_USERMANAGED,
4511 INSTALLPROPERTY_URLINFOABOUT, buf, &sz);
4512 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
4513 ok(!lstrcmpA(buf, "about"), "Expected \"about\", got \"%s\"\n", buf);
4514 ok(sz == 5, "Expected 5, got %d\n", sz);
4516 res = RegSetValueExA(propkey, "URLUpdateInfo", 0, REG_SZ, (LPBYTE)"update", 7);
4517 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
4519 /* URLUpdateInfo value exists */
4521 lstrcpyA(buf, "apple");
4522 r = pMsiGetProductInfoExA(prodcode, usersid,
4523 MSIINSTALLCONTEXT_USERMANAGED,
4524 INSTALLPROPERTY_URLUPDATEINFO, buf, &sz);
4525 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
4526 ok(!lstrcmpA(buf, "update"), "Expected \"update\", got \"%s\"\n", buf);
4527 ok(sz == 6, "Expected 6, got %d\n", sz);
4529 res = RegSetValueExA(propkey, "VersionMinor", 0, REG_SZ, (LPBYTE)"2", 2);
4530 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
4532 /* VersionMinor value exists */
4534 lstrcpyA(buf, "apple");
4535 r = pMsiGetProductInfoExA(prodcode, usersid,
4536 MSIINSTALLCONTEXT_USERMANAGED,
4537 INSTALLPROPERTY_VERSIONMINOR, buf, &sz);
4538 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
4539 ok(!lstrcmpA(buf, "2"), "Expected \"2\", got \"%s\"\n", buf);
4540 ok(sz == 1, "Expected 1, got %d\n", sz);
4542 res = RegSetValueExA(propkey, "VersionMajor", 0, REG_SZ, (LPBYTE)"3", 2);
4543 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
4545 /* VersionMajor value exists */
4547 lstrcpyA(buf, "apple");
4548 r = pMsiGetProductInfoExA(prodcode, usersid,
4549 MSIINSTALLCONTEXT_USERMANAGED,
4550 INSTALLPROPERTY_VERSIONMAJOR, buf, &sz);
4551 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
4552 ok(!lstrcmpA(buf, "3"), "Expected \"3\", got \"%s\"\n", buf);
4553 ok(sz == 1, "Expected 1, got %d\n", sz);
4555 res = RegSetValueExA(propkey, "DisplayVersion", 0, REG_SZ, (LPBYTE)"3.2.1", 6);
4556 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
4558 /* DisplayVersion value exists */
4560 lstrcpyA(buf, "apple");
4561 r = pMsiGetProductInfoExA(prodcode, usersid,
4562 MSIINSTALLCONTEXT_USERMANAGED,
4563 INSTALLPROPERTY_VERSIONSTRING, buf, &sz);
4564 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
4565 ok(!lstrcmpA(buf, "3.2.1"), "Expected \"3.2.1\", got \"%s\"\n", buf);
4566 ok(sz == 5, "Expected 5, got %d\n", sz);
4568 res = RegSetValueExA(propkey, "ProductID", 0, REG_SZ, (LPBYTE)"id", 3);
4569 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
4571 /* ProductID value exists */
4573 lstrcpyA(buf, "apple");
4574 r = pMsiGetProductInfoExA(prodcode, usersid,
4575 MSIINSTALLCONTEXT_USERMANAGED,
4576 INSTALLPROPERTY_PRODUCTID, buf, &sz);
4577 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
4578 ok(!lstrcmpA(buf, "id"), "Expected \"id\", got \"%s\"\n", buf);
4579 ok(sz == 2, "Expected 2, got %d\n", sz);
4581 res = RegSetValueExA(propkey, "RegCompany", 0, REG_SZ, (LPBYTE)"comp", 5);
4582 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
4584 /* RegCompany value exists */
4586 lstrcpyA(buf, "apple");
4587 r = pMsiGetProductInfoExA(prodcode, usersid,
4588 MSIINSTALLCONTEXT_USERMANAGED,
4589 INSTALLPROPERTY_REGCOMPANY, buf, &sz);
4590 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
4591 ok(!lstrcmpA(buf, "comp"), "Expected \"comp\", got \"%s\"\n", buf);
4592 ok(sz == 4, "Expected 4, got %d\n", sz);
4594 res = RegSetValueExA(propkey, "RegOwner", 0, REG_SZ, (LPBYTE)"owner", 6);
4595 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
4597 /* RegOwner value exists */
4599 lstrcpyA(buf, "apple");
4600 r = pMsiGetProductInfoExA(prodcode, usersid,
4601 MSIINSTALLCONTEXT_USERMANAGED,
4602 INSTALLPROPERTY_REGOWNER, buf, &sz);
4603 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
4604 ok(!lstrcmpA(buf, "owner"), "Expected \"owner\", got \"%s\"\n", buf);
4605 ok(sz == 5, "Expected 5, got %d\n", sz);
4607 res = RegSetValueExA(propkey, "Transforms", 0, REG_SZ, (LPBYTE)"trans", 6);
4608 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
4610 /* Transforms value exists */
4612 lstrcpyA(buf, "apple");
4613 r = pMsiGetProductInfoExA(prodcode, usersid,
4614 MSIINSTALLCONTEXT_USERMANAGED,
4615 INSTALLPROPERTY_TRANSFORMS, buf, &sz);
4616 ok(r == ERROR_UNKNOWN_PRODUCT,
4617 "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r);
4618 ok(!lstrcmpA(buf, "apple"), "Expected buf to be unchanged, got %s\n", buf);
4619 ok(sz == MAX_PATH, "Expected MAX_PATH, got %d\n", sz);
4621 res = RegSetValueExA(propkey, "Language", 0, REG_SZ, (LPBYTE)"lang", 5);
4622 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
4624 /* Language value exists */
4626 lstrcpyA(buf, "apple");
4627 r = pMsiGetProductInfoExA(prodcode, usersid,
4628 MSIINSTALLCONTEXT_USERMANAGED,
4629 INSTALLPROPERTY_LANGUAGE, buf, &sz);
4630 ok(r == ERROR_UNKNOWN_PRODUCT,
4631 "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r);
4632 ok(!lstrcmpA(buf, "apple"), "Expected buf to be unchanged, got %s\n", buf);
4633 ok(sz == MAX_PATH, "Expected MAX_PATH, got %d\n", sz);
4635 res = RegSetValueExA(propkey, "ProductName", 0, REG_SZ, (LPBYTE)"name", 5);
4636 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
4638 /* ProductName value exists */
4640 lstrcpyA(buf, "apple");
4641 r = pMsiGetProductInfoExA(prodcode, usersid,
4642 MSIINSTALLCONTEXT_USERMANAGED,
4643 INSTALLPROPERTY_PRODUCTNAME, buf, &sz);
4644 ok(r == ERROR_UNKNOWN_PRODUCT,
4645 "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r);
4646 ok(!lstrcmpA(buf, "apple"), "Expected buf to be unchanged, got %s\n", buf);
4647 ok(sz == MAX_PATH, "Expected MAX_PATH, got %d\n", sz);
4649 res = RegSetValueExA(propkey, "AssignmentType", 0, REG_SZ, (LPBYTE)"type", 5);
4650 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
4654 /* AssignmentType value exists */
4656 lstrcpyA(buf, "apple");
4657 r = pMsiGetProductInfoExA(prodcode, usersid,
4658 MSIINSTALLCONTEXT_USERMANAGED,
4659 INSTALLPROPERTY_ASSIGNMENTTYPE, buf, &sz);
4660 ok(r == ERROR_UNKNOWN_PRODUCT,
4661 "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r);
4662 ok(!lstrcmpA(buf, "apple"), "Expected buf to be unchanged, got %s\n", buf);
4663 ok(sz == MAX_PATH, "Expected MAX_PATH, got %d\n", sz);
4665 res = RegSetValueExA(propkey, "PackageCode", 0, REG_SZ, (LPBYTE)"code", 5);
4666 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
4668 /* PackageCode value exists */
4670 lstrcpyA(buf, "apple");
4671 r = pMsiGetProductInfoExA(prodcode, usersid,
4672 MSIINSTALLCONTEXT_USERMANAGED,
4673 INSTALLPROPERTY_PACKAGECODE, buf, &sz);
4674 ok(r == ERROR_UNKNOWN_PRODUCT,
4675 "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r);
4676 ok(!lstrcmpA(buf, "apple"), "Expected buf to be unchanged, got %s\n", buf);
4677 ok(sz == MAX_PATH, "Expected MAX_PATH, got %d\n", sz);
4679 res = RegSetValueExA(propkey, "Version", 0, REG_SZ, (LPBYTE)"ver", 4);
4680 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
4682 /* Version value exists */
4684 lstrcpyA(buf, "apple");
4685 r = pMsiGetProductInfoExA(prodcode, usersid,
4686 MSIINSTALLCONTEXT_USERMANAGED,
4687 INSTALLPROPERTY_VERSION, buf, &sz);
4688 ok(r == ERROR_UNKNOWN_PRODUCT,
4689 "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r);
4690 ok(!lstrcmpA(buf, "apple"), "Expected buf to be unchanged, got %s\n", buf);
4691 ok(sz == MAX_PATH, "Expected MAX_PATH, got %d\n", sz);
4693 res = RegSetValueExA(propkey, "ProductIcon", 0, REG_SZ, (LPBYTE)"icon", 5);
4694 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
4696 /* ProductIcon value exists */
4698 lstrcpyA(buf, "apple");
4699 r = pMsiGetProductInfoExA(prodcode, usersid,
4700 MSIINSTALLCONTEXT_USERMANAGED,
4701 INSTALLPROPERTY_PRODUCTICON, buf, &sz);
4702 ok(r == ERROR_UNKNOWN_PRODUCT,
4703 "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r);
4704 ok(!lstrcmpA(buf, "apple"), "Expected buf to be unchanged, got %s\n", buf);
4705 ok(sz == MAX_PATH, "Expected MAX_PATH, got %d\n", sz);
4707 res = RegSetValueExA(propkey, "PackageName", 0, REG_SZ, (LPBYTE)"name", 5);
4708 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
4710 /* PackageName value exists */
4712 lstrcpyA(buf, "apple");
4713 r = pMsiGetProductInfoExA(prodcode, usersid,
4714 MSIINSTALLCONTEXT_USERMANAGED,
4715 INSTALLPROPERTY_PACKAGENAME, buf, &sz);
4716 ok(r == ERROR_UNKNOWN_PRODUCT,
4717 "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r);
4718 ok(!lstrcmpA(buf, "apple"), "Expected buf to be unchanged, got %s\n", buf);
4719 ok(sz == MAX_PATH, "Expected MAX_PATH, got %d\n", sz);
4721 res = RegSetValueExA(propkey, "AuthorizedLUAApp", 0, REG_SZ, (LPBYTE)"auth", 5);
4722 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
4724 /* AuthorizedLUAApp value exists */
4726 lstrcpyA(buf, "apple");
4727 r = pMsiGetProductInfoExA(prodcode, usersid,
4728 MSIINSTALLCONTEXT_USERMANAGED,
4729 INSTALLPROPERTY_AUTHORIZED_LUA_APP, buf, &sz);
4730 ok(r == ERROR_UNKNOWN_PRODUCT,
4731 "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r);
4732 ok(!lstrcmpA(buf, "apple"), "Expected buf to be unchanged, got %s\n", buf);
4733 ok(sz == MAX_PATH, "Expected MAX_PATH, got %d\n", sz);
4735 RegDeleteValueA(propkey, "AuthorizedLUAApp");
4736 RegDeleteValueA(propkey, "PackageName");
4737 RegDeleteValueA(propkey, "ProductIcon");
4738 RegDeleteValueA(propkey, "Version");
4739 RegDeleteValueA(propkey, "PackageCode");
4740 RegDeleteValueA(propkey, "AssignmentType");
4741 RegDeleteValueA(propkey, "ProductName");
4742 RegDeleteValueA(propkey, "Language");
4743 RegDeleteValueA(propkey, "Transforms");
4744 RegDeleteValueA(propkey, "RegOwner");
4745 RegDeleteValueA(propkey, "RegCompany");
4746 RegDeleteValueA(propkey, "ProductID");
4747 RegDeleteValueA(propkey, "DisplayVersion");
4748 RegDeleteValueA(propkey, "VersionMajor");
4749 RegDeleteValueA(propkey, "VersionMinor");
4750 RegDeleteValueA(propkey, "URLUpdateInfo");
4751 RegDeleteValueA(propkey, "URLInfoAbout");
4752 RegDeleteValueA(propkey, "Publisher");
4753 RegDeleteValueA(propkey, "LocalPackage");
4754 RegDeleteValueA(propkey, "InstallSource");
4755 RegDeleteValueA(propkey, "InstallLocation");
4756 RegDeleteValueA(propkey, "DisplayName");
4757 RegDeleteValueA(propkey, "InstallDate");
4758 RegDeleteValueA(propkey, "HelpTelephone");
4759 RegDeleteValueA(propkey, "HelpLink");
4760 RegDeleteValueA(propkey, "ManagedLocalPackage");
4761 RegDeleteKeyA(propkey, "");
4762 RegCloseKey(propkey);
4763 RegDeleteKeyA(localkey, "");
4764 RegCloseKey(localkey);
4766 lstrcpyA(keypath, "Software\\Microsoft\\Windows\\CurrentVersion\\Installer\\Managed\\");
4767 lstrcatA(keypath, usersid);
4768 lstrcatA(keypath, "\\Installer\\Products\\");
4769 lstrcatA(keypath, prod_squashed);
4771 res = RegCreateKeyA(HKEY_LOCAL_MACHINE, keypath, &userkey);
4772 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
4774 /* user product key exists */
4776 lstrcpyA(buf, "apple");
4777 r = pMsiGetProductInfoExA(prodcode, usersid,
4778 MSIINSTALLCONTEXT_USERMANAGED,
4779 INSTALLPROPERTY_PRODUCTSTATE, buf, &sz);
4780 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
4781 ok(!lstrcmpA(buf, "1"), "Expected \"1\", got \"%s\"\n", buf);
4782 ok(sz == 1, "Expected 1, got %d\n", sz);
4784 RegDeleteKeyA(userkey, "");
4785 RegCloseKey(userkey);
4787 lstrcpyA(keypath, "Software\\Microsoft\\Installer\\Products\\");
4788 lstrcatA(keypath, prod_squashed);
4790 res = RegCreateKeyA(HKEY_CURRENT_USER, keypath, &prodkey);
4791 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
4793 /* current user product key exists */
4795 lstrcpyA(buf, "apple");
4796 r = pMsiGetProductInfoExA(prodcode, usersid,
4797 MSIINSTALLCONTEXT_USERMANAGED,
4798 INSTALLPROPERTY_PRODUCTSTATE, buf, &sz);
4799 ok(r == ERROR_UNKNOWN_PRODUCT,
4800 "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r);
4801 ok(!lstrcmpA(buf, "apple"), "Expected buf to be unchanged, got %s\n", buf);
4802 ok(sz == MAX_PATH, "Expected MAX_PATH, got %d\n", sz);
4804 res = RegSetValueExA(prodkey, "HelpLink", 0, REG_SZ, (LPBYTE)"link", 5);
4805 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
4807 /* HelpLink value exists, user product key does not exist */
4809 lstrcpyA(buf, "apple");
4810 r = pMsiGetProductInfoExA(prodcode, usersid,
4811 MSIINSTALLCONTEXT_USERMANAGED,
4812 INSTALLPROPERTY_HELPLINK, buf, &sz);
4813 ok(r == ERROR_UNKNOWN_PRODUCT,
4814 "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r);
4815 ok(!lstrcmpA(buf, "apple"), "Expected buf to be unchanged, got %s\n", buf);
4816 ok(sz == MAX_PATH, "Expected MAX_PATH, got %d\n", sz);
4818 lstrcpyA(keypath, "Software\\Microsoft\\Windows\\CurrentVersion\\Installer\\Managed\\");
4819 lstrcatA(keypath, usersid);
4820 lstrcatA(keypath, "\\Installer\\Products\\");
4821 lstrcatA(keypath, prod_squashed);
4823 res = RegCreateKeyA(HKEY_LOCAL_MACHINE, keypath, &userkey);
4824 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
4826 res = RegSetValueExA(userkey, "HelpLink", 0, REG_SZ, (LPBYTE)"link", 5);
4827 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
4829 /* HelpLink value exists, user product key does exist */
4831 lstrcpyA(buf, "apple");
4832 r = pMsiGetProductInfoExA(prodcode, usersid,
4833 MSIINSTALLCONTEXT_USERMANAGED,
4834 INSTALLPROPERTY_HELPLINK, buf, &sz);
4835 ok(r == ERROR_UNKNOWN_PROPERTY,
4836 "Expected ERROR_UNKNOWN_PROPERTY, got %d\n", r);
4837 ok(!lstrcmpA(buf, "apple"), "Expected buf to be unchanged, got %s\n", buf);
4838 ok(sz == MAX_PATH, "Expected MAX_PATH, got %d\n", sz);
4840 res = RegSetValueExA(userkey, "HelpTelephone", 0, REG_SZ, (LPBYTE)"phone", 6);
4841 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
4843 /* HelpTelephone value exists */
4845 lstrcpyA(buf, "apple");
4846 r = pMsiGetProductInfoExA(prodcode, usersid,
4847 MSIINSTALLCONTEXT_USERMANAGED,
4848 INSTALLPROPERTY_HELPTELEPHONE, buf, &sz);
4849 ok(r == ERROR_UNKNOWN_PROPERTY,
4850 "Expected ERROR_UNKNOWN_PROPERTY, got %d\n", r);
4851 ok(!lstrcmpA(buf, "apple"), "Expected buf to be unchanged, got %s\n", buf);
4852 ok(sz == MAX_PATH, "Expected MAX_PATH, got %d\n", sz);
4854 res = RegSetValueExA(userkey, "InstallDate", 0, REG_SZ, (LPBYTE)"date", 5);
4855 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
4857 /* InstallDate value exists */
4859 lstrcpyA(buf, "apple");
4860 r = pMsiGetProductInfoExA(prodcode, usersid,
4861 MSIINSTALLCONTEXT_USERMANAGED,
4862 INSTALLPROPERTY_INSTALLDATE, buf, &sz);
4863 ok(r == ERROR_UNKNOWN_PROPERTY,
4864 "Expected ERROR_UNKNOWN_PROPERTY, got %d\n", r);
4865 ok(!lstrcmpA(buf, "apple"), "Expected buf to be unchanged, got %s\n", buf);
4866 ok(sz == MAX_PATH, "Expected MAX_PATH, got %d\n", sz);
4868 res = RegSetValueExA(userkey, "DisplayName", 0, REG_SZ, (LPBYTE)"name", 5);
4869 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
4871 /* DisplayName value exists */
4873 lstrcpyA(buf, "apple");
4874 r = pMsiGetProductInfoExA(prodcode, usersid,
4875 MSIINSTALLCONTEXT_USERMANAGED,
4876 INSTALLPROPERTY_INSTALLEDPRODUCTNAME, buf, &sz);
4877 ok(r == ERROR_UNKNOWN_PROPERTY,
4878 "Expected ERROR_UNKNOWN_PROPERTY, got %d\n", r);
4879 ok(!lstrcmpA(buf, "apple"), "Expected buf to be unchanged, got %s\n", buf);
4880 ok(sz == MAX_PATH, "Expected MAX_PATH, got %d\n", sz);
4882 res = RegSetValueExA(userkey, "InstallLocation", 0, REG_SZ, (LPBYTE)"loc", 4);
4883 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
4885 /* InstallLocation value exists */
4887 lstrcpyA(buf, "apple");
4888 r = pMsiGetProductInfoExA(prodcode, usersid,
4889 MSIINSTALLCONTEXT_USERMANAGED,
4890 INSTALLPROPERTY_INSTALLLOCATION, buf, &sz);
4891 ok(r == ERROR_UNKNOWN_PROPERTY,
4892 "Expected ERROR_UNKNOWN_PROPERTY, got %d\n", r);
4893 ok(!lstrcmpA(buf, "apple"), "Expected buf to be unchanged, got %s\n", buf);
4894 ok(sz == MAX_PATH, "Expected MAX_PATH, got %d\n", sz);
4896 res = RegSetValueExA(userkey, "InstallSource", 0, REG_SZ, (LPBYTE)"source", 7);
4897 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
4899 /* InstallSource value exists */
4901 lstrcpyA(buf, "apple");
4902 r = pMsiGetProductInfoExA(prodcode, usersid,
4903 MSIINSTALLCONTEXT_USERMANAGED,
4904 INSTALLPROPERTY_INSTALLSOURCE, buf, &sz);
4905 ok(r == ERROR_UNKNOWN_PROPERTY,
4906 "Expected ERROR_UNKNOWN_PROPERTY, got %d\n", r);
4907 ok(!lstrcmpA(buf, "apple"), "Expected buf to be unchanged, got %s\n", buf);
4908 ok(sz == MAX_PATH, "Expected MAX_PATH, got %d\n", sz);
4910 res = RegSetValueExA(userkey, "LocalPackage", 0, REG_SZ, (LPBYTE)"local", 6);
4911 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
4913 /* LocalPackage value exists */
4915 lstrcpyA(buf, "apple");
4916 r = pMsiGetProductInfoExA(prodcode, usersid,
4917 MSIINSTALLCONTEXT_USERMANAGED,
4918 INSTALLPROPERTY_LOCALPACKAGE, buf, &sz);
4919 ok(r == ERROR_UNKNOWN_PROPERTY,
4920 "Expected ERROR_UNKNOWN_PROPERTY, got %d\n", r);
4921 ok(!lstrcmpA(buf, "apple"), "Expected buf to be unchanged, got %s\n", buf);
4922 ok(sz == MAX_PATH, "Expected MAX_PATH, got %d\n", sz);
4924 res = RegSetValueExA(userkey, "Publisher", 0, REG_SZ, (LPBYTE)"pub", 4);
4925 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
4927 /* Publisher value exists */
4929 lstrcpyA(buf, "apple");
4930 r = pMsiGetProductInfoExA(prodcode, usersid,
4931 MSIINSTALLCONTEXT_USERMANAGED,
4932 INSTALLPROPERTY_PUBLISHER, buf, &sz);
4933 ok(r == ERROR_UNKNOWN_PROPERTY,
4934 "Expected ERROR_UNKNOWN_PROPERTY, got %d\n", r);
4935 ok(!lstrcmpA(buf, "apple"), "Expected buf to be unchanged, got %s\n", buf);
4936 ok(sz == MAX_PATH, "Expected MAX_PATH, got %d\n", sz);
4938 res = RegSetValueExA(userkey, "URLInfoAbout", 0, REG_SZ, (LPBYTE)"about", 6);
4939 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
4941 /* URLInfoAbout value exists */
4943 lstrcpyA(buf, "apple");
4944 r = pMsiGetProductInfoExA(prodcode, usersid,
4945 MSIINSTALLCONTEXT_USERMANAGED,
4946 INSTALLPROPERTY_URLINFOABOUT, buf, &sz);
4947 ok(r == ERROR_UNKNOWN_PROPERTY,
4948 "Expected ERROR_UNKNOWN_PROPERTY, got %d\n", r);
4949 ok(!lstrcmpA(buf, "apple"), "Expected buf to be unchanged, got %s\n", buf);
4950 ok(sz == MAX_PATH, "Expected MAX_PATH, got %d\n", sz);
4952 res = RegSetValueExA(userkey, "URLUpdateInfo", 0, REG_SZ, (LPBYTE)"update", 7);
4953 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
4955 /* URLUpdateInfo value exists */
4957 lstrcpyA(buf, "apple");
4958 r = pMsiGetProductInfoExA(prodcode, usersid,
4959 MSIINSTALLCONTEXT_USERMANAGED,
4960 INSTALLPROPERTY_URLUPDATEINFO, buf, &sz);
4961 ok(r == ERROR_UNKNOWN_PROPERTY,
4962 "Expected ERROR_UNKNOWN_PROPERTY, got %d\n", r);
4963 ok(!lstrcmpA(buf, "apple"), "Expected buf to be unchanged, got %s\n", buf);
4964 ok(sz == MAX_PATH, "Expected MAX_PATH, got %d\n", sz);
4966 res = RegSetValueExA(userkey, "VersionMinor", 0, REG_SZ, (LPBYTE)"2", 2);
4967 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
4969 /* VersionMinor value exists */
4971 lstrcpyA(buf, "apple");
4972 r = pMsiGetProductInfoExA(prodcode, usersid,
4973 MSIINSTALLCONTEXT_USERMANAGED,
4974 INSTALLPROPERTY_VERSIONMINOR, buf, &sz);
4975 ok(r == ERROR_UNKNOWN_PROPERTY,
4976 "Expected ERROR_UNKNOWN_PROPERTY, got %d\n", r);
4977 ok(!lstrcmpA(buf, "apple"), "Expected buf to be unchanged, got %s\n", buf);
4978 ok(sz == MAX_PATH, "Expected MAX_PATH, got %d\n", sz);
4980 res = RegSetValueExA(userkey, "VersionMajor", 0, REG_SZ, (LPBYTE)"3", 2);
4981 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
4983 /* VersionMajor value exists */
4985 lstrcpyA(buf, "apple");
4986 r = pMsiGetProductInfoExA(prodcode, usersid,
4987 MSIINSTALLCONTEXT_USERMANAGED,
4988 INSTALLPROPERTY_VERSIONMAJOR, buf, &sz);
4989 ok(r == ERROR_UNKNOWN_PROPERTY,
4990 "Expected ERROR_UNKNOWN_PROPERTY, got %d\n", r);
4991 ok(!lstrcmpA(buf, "apple"), "Expected buf to be unchanged, got %s\n", buf);
4992 ok(sz == MAX_PATH, "Expected MAX_PATH, got %d\n", sz);
4994 res = RegSetValueExA(userkey, "DisplayVersion", 0, REG_SZ, (LPBYTE)"3.2.1", 6);
4995 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
4997 /* DisplayVersion value exists */
4999 lstrcpyA(buf, "apple");
5000 r = pMsiGetProductInfoExA(prodcode, usersid,
5001 MSIINSTALLCONTEXT_USERMANAGED,
5002 INSTALLPROPERTY_VERSIONSTRING, buf, &sz);
5003 ok(r == ERROR_UNKNOWN_PROPERTY,
5004 "Expected ERROR_UNKNOWN_PROPERTY, got %d\n", r);
5005 ok(!lstrcmpA(buf, "apple"), "Expected buf to be unchanged, got %s\n", buf);
5006 ok(sz == MAX_PATH, "Expected MAX_PATH, got %d\n", sz);
5008 res = RegSetValueExA(userkey, "ProductID", 0, REG_SZ, (LPBYTE)"id", 3);
5009 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
5011 /* ProductID value exists */
5013 lstrcpyA(buf, "apple");
5014 r = pMsiGetProductInfoExA(prodcode, usersid,
5015 MSIINSTALLCONTEXT_USERMANAGED,
5016 INSTALLPROPERTY_PRODUCTID, buf, &sz);
5017 ok(r == ERROR_UNKNOWN_PROPERTY,
5018 "Expected ERROR_UNKNOWN_PROPERTY, got %d\n", r);
5019 ok(!lstrcmpA(buf, "apple"), "Expected buf to be unchanged, got %s\n", buf);
5020 ok(sz == MAX_PATH, "Expected MAX_PATH, got %d\n", sz);
5022 res = RegSetValueExA(userkey, "RegCompany", 0, REG_SZ, (LPBYTE)"comp", 5);
5023 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
5025 /* RegCompany value exists */
5027 lstrcpyA(buf, "apple");
5028 r = pMsiGetProductInfoExA(prodcode, usersid,
5029 MSIINSTALLCONTEXT_USERMANAGED,
5030 INSTALLPROPERTY_REGCOMPANY, buf, &sz);
5031 ok(r == ERROR_UNKNOWN_PROPERTY,
5032 "Expected ERROR_UNKNOWN_PROPERTY, got %d\n", r);
5033 ok(!lstrcmpA(buf, "apple"), "Expected buf to be unchanged, got %s\n", buf);
5034 ok(sz == MAX_PATH, "Expected MAX_PATH, got %d\n", sz);
5036 res = RegSetValueExA(userkey, "RegOwner", 0, REG_SZ, (LPBYTE)"owner", 6);
5037 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
5039 /* RegOwner value exists */
5041 lstrcpyA(buf, "apple");
5042 r = pMsiGetProductInfoExA(prodcode, usersid,
5043 MSIINSTALLCONTEXT_USERMANAGED,
5044 INSTALLPROPERTY_REGOWNER, buf, &sz);
5045 ok(r == ERROR_UNKNOWN_PROPERTY,
5046 "Expected ERROR_UNKNOWN_PROPERTY, got %d\n", r);
5047 ok(!lstrcmpA(buf, "apple"), "Expected buf to be unchanged, got %s\n", buf);
5048 ok(sz == MAX_PATH, "Expected MAX_PATH, got %d\n", sz);
5050 res = RegSetValueExA(userkey, "Transforms", 0, REG_SZ, (LPBYTE)"trans", 6);
5051 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
5053 /* Transforms value exists */
5055 lstrcpyA(buf, "apple");
5056 r = pMsiGetProductInfoExA(prodcode, usersid,
5057 MSIINSTALLCONTEXT_USERMANAGED,
5058 INSTALLPROPERTY_TRANSFORMS, buf, &sz);
5059 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
5060 ok(!lstrcmpA(buf, "trans"), "Expected \"trans\", got \"%s\"\n", buf);
5061 ok(sz == 5, "Expected 5, got %d\n", sz);
5063 res = RegSetValueExA(userkey, "Language", 0, REG_SZ, (LPBYTE)"lang", 5);
5064 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
5066 /* Language value exists */
5068 lstrcpyA(buf, "apple");
5069 r = pMsiGetProductInfoExA(prodcode, usersid,
5070 MSIINSTALLCONTEXT_USERMANAGED,
5071 INSTALLPROPERTY_LANGUAGE, buf, &sz);
5072 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
5073 ok(!lstrcmpA(buf, "lang"), "Expected \"lang\", got \"%s\"\n", buf);
5074 ok(sz == 4, "Expected 4, got %d\n", sz);
5076 res = RegSetValueExA(userkey, "ProductName", 0, REG_SZ, (LPBYTE)"name", 5);
5077 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
5079 /* ProductName value exists */
5081 lstrcpyA(buf, "apple");
5082 r = pMsiGetProductInfoExA(prodcode, usersid,
5083 MSIINSTALLCONTEXT_USERMANAGED,
5084 INSTALLPROPERTY_PRODUCTNAME, buf, &sz);
5085 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
5086 ok(!lstrcmpA(buf, "name"), "Expected \"name\", got \"%s\"\n", buf);
5087 ok(sz == 4, "Expected 4, got %d\n", sz);
5089 res = RegSetValueExA(userkey, "AssignmentType", 0, REG_SZ, (LPBYTE)"type", 5);
5090 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
5094 /* AssignmentType value exists */
5096 lstrcpyA(buf, "apple");
5097 r = pMsiGetProductInfoExA(prodcode, usersid,
5098 MSIINSTALLCONTEXT_USERMANAGED,
5099 INSTALLPROPERTY_ASSIGNMENTTYPE, buf, &sz);
5100 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
5101 ok(!lstrcmpA(buf, ""), "Expected \"\", got \"%s\"\n", buf);
5102 ok(sz == 0, "Expected 0, got %d\n", sz);
5104 res = RegSetValueExA(userkey, "PackageCode", 0, REG_SZ, (LPBYTE)"code", 5);
5105 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
5109 /* PackageCode value exists */
5111 lstrcpyA(buf, "apple");
5112 r = pMsiGetProductInfoExA(prodcode, usersid,
5113 MSIINSTALLCONTEXT_USERMANAGED,
5114 INSTALLPROPERTY_PACKAGECODE, buf, &sz);
5117 ok(r == ERROR_BAD_CONFIGURATION,
5118 "Expected ERROR_BAD_CONFIGURATION, got %d\n", r);
5119 ok(!lstrcmpA(buf, "apple"), "Expected buf to be unchanged, got %s\n", buf);
5120 ok(sz == MAX_PATH, "Expected MAX_PATH, got %d\n", sz);
5123 res = RegSetValueExA(userkey, "Version", 0, REG_SZ, (LPBYTE)"ver", 4);
5124 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
5126 /* Version value exists */
5128 lstrcpyA(buf, "apple");
5129 r = pMsiGetProductInfoExA(prodcode, usersid,
5130 MSIINSTALLCONTEXT_USERMANAGED,
5131 INSTALLPROPERTY_VERSION, buf, &sz);
5132 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
5133 ok(!lstrcmpA(buf, "ver"), "Expected \"ver\", got \"%s\"\n", buf);
5134 ok(sz == 3, "Expected 3, got %d\n", sz);
5136 res = RegSetValueExA(userkey, "ProductIcon", 0, REG_SZ, (LPBYTE)"icon", 5);
5137 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
5139 /* ProductIcon value exists */
5141 lstrcpyA(buf, "apple");
5142 r = pMsiGetProductInfoExA(prodcode, usersid,
5143 MSIINSTALLCONTEXT_USERMANAGED,
5144 INSTALLPROPERTY_PRODUCTICON, buf, &sz);
5145 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
5146 ok(!lstrcmpA(buf, "icon"), "Expected \"icon\", got \"%s\"\n", buf);
5147 ok(sz == 4, "Expected 4, got %d\n", sz);
5149 res = RegSetValueExA(userkey, "PackageName", 0, REG_SZ, (LPBYTE)"name", 5);
5150 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
5152 /* PackageName value exists */
5154 lstrcpyA(buf, "apple");
5155 r = pMsiGetProductInfoExA(prodcode, usersid,
5156 MSIINSTALLCONTEXT_USERMANAGED,
5157 INSTALLPROPERTY_PACKAGENAME, buf, &sz);
5160 ok(r == ERROR_UNKNOWN_PRODUCT,
5161 "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r);
5162 ok(!lstrcmpA(buf, "apple"), "Expected buf to be unchanged, got %s\n", buf);
5163 ok(sz == MAX_PATH, "Expected MAX_PATH, got %d\n", sz);
5166 res = RegSetValueExA(userkey, "AuthorizedLUAApp", 0, REG_SZ, (LPBYTE)"auth", 5);
5167 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
5169 /* AuthorizedLUAApp value exists */
5171 lstrcpyA(buf, "apple");
5172 r = pMsiGetProductInfoExA(prodcode, usersid,
5173 MSIINSTALLCONTEXT_USERMANAGED,
5174 INSTALLPROPERTY_AUTHORIZED_LUA_APP, buf, &sz);
5175 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
5176 ok(!lstrcmpA(buf, "auth"), "Expected \"auth\", got \"%s\"\n", buf);
5177 ok(sz == 4, "Expected 4, got %d\n", sz);
5179 RegDeleteValueA(userkey, "AuthorizedLUAApp");
5180 RegDeleteValueA(userkey, "PackageName");
5181 RegDeleteValueA(userkey, "ProductIcon");
5182 RegDeleteValueA(userkey, "Version");
5183 RegDeleteValueA(userkey, "PackageCode");
5184 RegDeleteValueA(userkey, "AssignmentType");
5185 RegDeleteValueA(userkey, "ProductName");
5186 RegDeleteValueA(userkey, "Language");
5187 RegDeleteValueA(userkey, "Transforms");
5188 RegDeleteValueA(userkey, "RegOwner");
5189 RegDeleteValueA(userkey, "RegCompany");
5190 RegDeleteValueA(userkey, "ProductID");
5191 RegDeleteValueA(userkey, "DisplayVersion");
5192 RegDeleteValueA(userkey, "VersionMajor");
5193 RegDeleteValueA(userkey, "VersionMinor");
5194 RegDeleteValueA(userkey, "URLUpdateInfo");
5195 RegDeleteValueA(userkey, "URLInfoAbout");
5196 RegDeleteValueA(userkey, "Publisher");
5197 RegDeleteValueA(userkey, "LocalPackage");
5198 RegDeleteValueA(userkey, "InstallSource");
5199 RegDeleteValueA(userkey, "InstallLocation");
5200 RegDeleteValueA(userkey, "DisplayName");
5201 RegDeleteValueA(userkey, "InstallDate");
5202 RegDeleteValueA(userkey, "HelpTelephone");
5203 RegDeleteValueA(userkey, "HelpLink");
5204 RegDeleteKeyA(userkey, "");
5205 RegCloseKey(userkey);
5206 RegDeleteKeyA(prodkey, "");
5207 RegCloseKey(prodkey);
5209 /* MSIINSTALLCONTEXT_MACHINE */
5211 /* szUserSid is non-NULL */
5213 lstrcpyA(buf, "apple");
5214 r = pMsiGetProductInfoExA(prodcode, usersid,
5215 MSIINSTALLCONTEXT_MACHINE,
5216 INSTALLPROPERTY_PRODUCTSTATE, buf, &sz);
5217 ok(r == ERROR_INVALID_PARAMETER,
5218 "Expected ERROR_INVALID_PARAMETER, got %d\n", r);
5219 ok(!lstrcmpA(buf, "apple"), "Expected buf to be unchanged, got %s\n", buf);
5220 ok(sz == MAX_PATH, "Expected MAX_PATH, got %d\n", sz);
5222 lstrcpyA(keypath, "Software\\Microsoft\\Windows\\CurrentVersion\\Installer\\UserData\\S-1-5-18\\Products\\");
5223 lstrcatA(keypath, prod_squashed);
5225 res = RegCreateKeyA(HKEY_LOCAL_MACHINE, keypath, &localkey);
5226 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
5228 /* local system product key exists */
5230 lstrcpyA(buf, "apple");
5231 r = pMsiGetProductInfoExA(prodcode, NULL,
5232 MSIINSTALLCONTEXT_MACHINE,
5233 INSTALLPROPERTY_PRODUCTSTATE, buf, &sz);
5234 ok(r == ERROR_UNKNOWN_PRODUCT,
5235 "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r);
5236 ok(!lstrcmpA(buf, "apple"), "Expected buf to be unchanged, got %s\n", buf);
5237 ok(sz == MAX_PATH, "Expected MAX_PATH, got %d\n", sz);
5239 res = RegCreateKeyA(localkey, "InstallProperties", &propkey);
5240 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
5242 /* InstallProperties key exists */
5244 lstrcpyA(buf, "apple");
5245 r = pMsiGetProductInfoExA(prodcode, NULL,
5246 MSIINSTALLCONTEXT_MACHINE,
5247 INSTALLPROPERTY_PRODUCTSTATE, buf, &sz);
5248 ok(r == ERROR_UNKNOWN_PRODUCT,
5249 "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r);
5250 ok(!lstrcmpA(buf, "apple"), "Expected buf to be unchanged, got %s\n", buf);
5251 ok(sz == MAX_PATH, "Expected MAX_PATH, got %d\n", sz);
5253 res = RegSetValueExA(propkey, "LocalPackage", 0, REG_SZ, (LPBYTE)"local", 6);
5254 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
5256 /* LocalPackage value exists */
5258 lstrcpyA(buf, "apple");
5259 r = pMsiGetProductInfoExA(prodcode, NULL,
5260 MSIINSTALLCONTEXT_MACHINE,
5261 INSTALLPROPERTY_PRODUCTSTATE, buf, &sz);
5262 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
5263 ok(!lstrcmpA(buf, "5"), "Expected \"5\", got \"%s\"\n", buf);
5264 ok(sz == 1, "Expected 1, got %d\n", sz);
5266 res = RegSetValueExA(propkey, "HelpLink", 0, REG_SZ, (LPBYTE)"link", 5);
5267 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
5269 /* HelpLink value exists */
5271 lstrcpyA(buf, "apple");
5272 r = pMsiGetProductInfoExA(prodcode, NULL,
5273 MSIINSTALLCONTEXT_MACHINE,
5274 INSTALLPROPERTY_HELPLINK, buf, &sz);
5275 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
5276 ok(!lstrcmpA(buf, "link"), "Expected \"link\", got \"%s\"\n", buf);
5277 ok(sz == 4, "Expected 4, got %d\n", sz);
5279 res = RegSetValueExA(propkey, "HelpTelephone", 0, REG_SZ, (LPBYTE)"phone", 6);
5280 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
5282 /* HelpTelephone value exists */
5284 lstrcpyA(buf, "apple");
5285 r = pMsiGetProductInfoExA(prodcode, NULL,
5286 MSIINSTALLCONTEXT_MACHINE,
5287 INSTALLPROPERTY_HELPTELEPHONE, buf, &sz);
5288 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
5289 ok(!lstrcmpA(buf, "phone"), "Expected \"phone\", got \"%s\"\n", buf);
5290 ok(sz == 5, "Expected 5, got %d\n", sz);
5292 res = RegSetValueExA(propkey, "InstallDate", 0, REG_SZ, (LPBYTE)"date", 5);
5293 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
5295 /* InstallDate value exists */
5297 lstrcpyA(buf, "apple");
5298 r = pMsiGetProductInfoExA(prodcode, NULL,
5299 MSIINSTALLCONTEXT_MACHINE,
5300 INSTALLPROPERTY_INSTALLDATE, buf, &sz);
5301 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
5302 ok(!lstrcmpA(buf, "date"), "Expected \"date\", got \"%s\"\n", buf);
5303 ok(sz == 4, "Expected 4, got %d\n", sz);
5305 res = RegSetValueExA(propkey, "DisplayName", 0, REG_SZ, (LPBYTE)"name", 5);
5306 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
5308 /* DisplayName value exists */
5310 lstrcpyA(buf, "apple");
5311 r = pMsiGetProductInfoExA(prodcode, NULL,
5312 MSIINSTALLCONTEXT_MACHINE,
5313 INSTALLPROPERTY_INSTALLEDPRODUCTNAME, buf, &sz);
5314 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
5315 ok(!lstrcmpA(buf, "name"), "Expected \"name\", got \"%s\"\n", buf);
5316 ok(sz == 4, "Expected 4, got %d\n", sz);
5318 res = RegSetValueExA(propkey, "InstallLocation", 0, REG_SZ, (LPBYTE)"loc", 4);
5319 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
5321 /* InstallLocation value exists */
5323 lstrcpyA(buf, "apple");
5324 r = pMsiGetProductInfoExA(prodcode, NULL,
5325 MSIINSTALLCONTEXT_MACHINE,
5326 INSTALLPROPERTY_INSTALLLOCATION, buf, &sz);
5327 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
5328 ok(!lstrcmpA(buf, "loc"), "Expected \"loc\", got \"%s\"\n", buf);
5329 ok(sz == 3, "Expected 3, got %d\n", sz);
5331 res = RegSetValueExA(propkey, "InstallSource", 0, REG_SZ, (LPBYTE)"source", 7);
5332 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
5334 /* InstallSource value exists */
5336 lstrcpyA(buf, "apple");
5337 r = pMsiGetProductInfoExA(prodcode, NULL,
5338 MSIINSTALLCONTEXT_MACHINE,
5339 INSTALLPROPERTY_INSTALLSOURCE, buf, &sz);
5340 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
5341 ok(!lstrcmpA(buf, "source"), "Expected \"source\", got \"%s\"\n", buf);
5342 ok(sz == 6, "Expected 6, got %d\n", sz);
5344 res = RegSetValueExA(propkey, "LocalPackage", 0, REG_SZ, (LPBYTE)"local", 6);
5345 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
5347 /* LocalPackage value exists */
5349 lstrcpyA(buf, "apple");
5350 r = pMsiGetProductInfoExA(prodcode, NULL,
5351 MSIINSTALLCONTEXT_MACHINE,
5352 INSTALLPROPERTY_LOCALPACKAGE, buf, &sz);
5353 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
5354 ok(!lstrcmpA(buf, "local"), "Expected \"local\", got \"%s\"\n", buf);
5355 ok(sz == 5, "Expected 5, got %d\n", sz);
5357 res = RegSetValueExA(propkey, "Publisher", 0, REG_SZ, (LPBYTE)"pub", 4);
5358 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
5360 /* Publisher value exists */
5362 lstrcpyA(buf, "apple");
5363 r = pMsiGetProductInfoExA(prodcode, NULL,
5364 MSIINSTALLCONTEXT_MACHINE,
5365 INSTALLPROPERTY_PUBLISHER, buf, &sz);
5366 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
5367 ok(!lstrcmpA(buf, "pub"), "Expected \"pub\", got \"%s\"\n", buf);
5368 ok(sz == 3, "Expected 3, got %d\n", sz);
5370 res = RegSetValueExA(propkey, "URLInfoAbout", 0, REG_SZ, (LPBYTE)"about", 6);
5371 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
5373 /* URLInfoAbout value exists */
5375 lstrcpyA(buf, "apple");
5376 r = pMsiGetProductInfoExA(prodcode, NULL,
5377 MSIINSTALLCONTEXT_MACHINE,
5378 INSTALLPROPERTY_URLINFOABOUT, buf, &sz);
5379 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
5380 ok(!lstrcmpA(buf, "about"), "Expected \"about\", got \"%s\"\n", buf);
5381 ok(sz == 5, "Expected 5, got %d\n", sz);
5383 res = RegSetValueExA(propkey, "URLUpdateInfo", 0, REG_SZ, (LPBYTE)"update", 7);
5384 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
5386 /* URLUpdateInfo value exists */
5388 lstrcpyA(buf, "apple");
5389 r = pMsiGetProductInfoExA(prodcode, NULL,
5390 MSIINSTALLCONTEXT_MACHINE,
5391 INSTALLPROPERTY_URLUPDATEINFO, buf, &sz);
5392 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
5393 ok(!lstrcmpA(buf, "update"), "Expected \"update\", got \"%s\"\n", buf);
5394 ok(sz == 6, "Expected 6, got %d\n", sz);
5396 res = RegSetValueExA(propkey, "VersionMinor", 0, REG_SZ, (LPBYTE)"2", 2);
5397 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
5399 /* VersionMinor value exists */
5401 lstrcpyA(buf, "apple");
5402 r = pMsiGetProductInfoExA(prodcode, NULL,
5403 MSIINSTALLCONTEXT_MACHINE,
5404 INSTALLPROPERTY_VERSIONMINOR, buf, &sz);
5405 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
5406 ok(!lstrcmpA(buf, "2"), "Expected \"2\", got \"%s\"\n", buf);
5407 ok(sz == 1, "Expected 1, got %d\n", sz);
5409 res = RegSetValueExA(propkey, "VersionMajor", 0, REG_SZ, (LPBYTE)"3", 2);
5410 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
5412 /* VersionMajor value exists */
5414 lstrcpyA(buf, "apple");
5415 r = pMsiGetProductInfoExA(prodcode, NULL,
5416 MSIINSTALLCONTEXT_MACHINE,
5417 INSTALLPROPERTY_VERSIONMAJOR, buf, &sz);
5418 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
5419 ok(!lstrcmpA(buf, "3"), "Expected \"3\", got \"%s\"\n", buf);
5420 ok(sz == 1, "Expected 1, got %d\n", sz);
5422 res = RegSetValueExA(propkey, "DisplayVersion", 0, REG_SZ, (LPBYTE)"3.2.1", 6);
5423 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
5425 /* DisplayVersion value exists */
5427 lstrcpyA(buf, "apple");
5428 r = pMsiGetProductInfoExA(prodcode, NULL,
5429 MSIINSTALLCONTEXT_MACHINE,
5430 INSTALLPROPERTY_VERSIONSTRING, buf, &sz);
5431 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
5432 ok(!lstrcmpA(buf, "3.2.1"), "Expected \"3.2.1\", got \"%s\"\n", buf);
5433 ok(sz == 5, "Expected 5, got %d\n", sz);
5435 res = RegSetValueExA(propkey, "ProductID", 0, REG_SZ, (LPBYTE)"id", 3);
5436 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
5438 /* ProductID value exists */
5440 lstrcpyA(buf, "apple");
5441 r = pMsiGetProductInfoExA(prodcode, NULL,
5442 MSIINSTALLCONTEXT_MACHINE,
5443 INSTALLPROPERTY_PRODUCTID, buf, &sz);
5444 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
5445 ok(!lstrcmpA(buf, "id"), "Expected \"id\", got \"%s\"\n", buf);
5446 ok(sz == 2, "Expected 2, got %d\n", sz);
5448 res = RegSetValueExA(propkey, "RegCompany", 0, REG_SZ, (LPBYTE)"comp", 5);
5449 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
5451 /* RegCompany value exists */
5453 lstrcpyA(buf, "apple");
5454 r = pMsiGetProductInfoExA(prodcode, NULL,
5455 MSIINSTALLCONTEXT_MACHINE,
5456 INSTALLPROPERTY_REGCOMPANY, buf, &sz);
5457 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
5458 ok(!lstrcmpA(buf, "comp"), "Expected \"comp\", got \"%s\"\n", buf);
5459 ok(sz == 4, "Expected 4, got %d\n", sz);
5461 res = RegSetValueExA(propkey, "RegOwner", 0, REG_SZ, (LPBYTE)"owner", 6);
5462 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
5464 /* RegOwner value exists */
5466 lstrcpyA(buf, "apple");
5467 r = pMsiGetProductInfoExA(prodcode, NULL,
5468 MSIINSTALLCONTEXT_MACHINE,
5469 INSTALLPROPERTY_REGOWNER, buf, &sz);
5470 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
5471 ok(!lstrcmpA(buf, "owner"), "Expected \"owner\", got \"%s\"\n", buf);
5472 ok(sz == 5, "Expected 5, got %d\n", sz);
5474 res = RegSetValueExA(propkey, "Transforms", 0, REG_SZ, (LPBYTE)"trans", 6);
5475 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
5477 /* Transforms value exists */
5479 lstrcpyA(buf, "apple");
5480 r = pMsiGetProductInfoExA(prodcode, NULL,
5481 MSIINSTALLCONTEXT_MACHINE,
5482 INSTALLPROPERTY_TRANSFORMS, buf, &sz);
5483 ok(r == ERROR_UNKNOWN_PRODUCT,
5484 "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r);
5485 ok(!lstrcmpA(buf, "apple"), "Expected buf to be unchanged, got %s\n", buf);
5486 ok(sz == MAX_PATH, "Expected MAX_PATH, got %d\n", sz);
5488 res = RegSetValueExA(propkey, "Language", 0, REG_SZ, (LPBYTE)"lang", 5);
5489 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
5491 /* Language value exists */
5493 lstrcpyA(buf, "apple");
5494 r = pMsiGetProductInfoExA(prodcode, NULL,
5495 MSIINSTALLCONTEXT_MACHINE,
5496 INSTALLPROPERTY_LANGUAGE, buf, &sz);
5497 ok(r == ERROR_UNKNOWN_PRODUCT,
5498 "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r);
5499 ok(!lstrcmpA(buf, "apple"), "Expected buf to be unchanged, got %s\n", buf);
5500 ok(sz == MAX_PATH, "Expected MAX_PATH, got %d\n", sz);
5502 res = RegSetValueExA(propkey, "ProductName", 0, REG_SZ, (LPBYTE)"name", 5);
5503 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
5505 /* ProductName value exists */
5507 lstrcpyA(buf, "apple");
5508 r = pMsiGetProductInfoExA(prodcode, NULL,
5509 MSIINSTALLCONTEXT_MACHINE,
5510 INSTALLPROPERTY_PRODUCTNAME, buf, &sz);
5511 ok(r == ERROR_UNKNOWN_PRODUCT,
5512 "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r);
5513 ok(!lstrcmpA(buf, "apple"), "Expected buf to be unchanged, got %s\n", buf);
5514 ok(sz == MAX_PATH, "Expected MAX_PATH, got %d\n", sz);
5516 res = RegSetValueExA(propkey, "AssignmentType", 0, REG_SZ, (LPBYTE)"type", 5);
5517 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
5521 /* AssignmentType value exists */
5523 lstrcpyA(buf, "apple");
5524 r = pMsiGetProductInfoExA(prodcode, NULL,
5525 MSIINSTALLCONTEXT_MACHINE,
5526 INSTALLPROPERTY_ASSIGNMENTTYPE, buf, &sz);
5527 ok(r == ERROR_UNKNOWN_PRODUCT,
5528 "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r);
5529 ok(!lstrcmpA(buf, "apple"), "Expected buf to be unchanged, got %s\n", buf);
5530 ok(sz == MAX_PATH, "Expected MAX_PATH, got %d\n", sz);
5532 res = RegSetValueExA(propkey, "PackageCode", 0, REG_SZ, (LPBYTE)"code", 5);
5533 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
5535 /* PackageCode value exists */
5537 lstrcpyA(buf, "apple");
5538 r = pMsiGetProductInfoExA(prodcode, NULL,
5539 MSIINSTALLCONTEXT_MACHINE,
5540 INSTALLPROPERTY_PACKAGECODE, buf, &sz);
5541 ok(r == ERROR_UNKNOWN_PRODUCT,
5542 "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r);
5543 ok(!lstrcmpA(buf, "apple"), "Expected buf to be unchanged, got %s\n", buf);
5544 ok(sz == MAX_PATH, "Expected MAX_PATH, got %d\n", sz);
5546 res = RegSetValueExA(propkey, "Version", 0, REG_SZ, (LPBYTE)"ver", 4);
5547 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
5549 /* Version value exists */
5551 lstrcpyA(buf, "apple");
5552 r = pMsiGetProductInfoExA(prodcode, NULL,
5553 MSIINSTALLCONTEXT_MACHINE,
5554 INSTALLPROPERTY_VERSION, buf, &sz);
5555 ok(r == ERROR_UNKNOWN_PRODUCT,
5556 "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r);
5557 ok(!lstrcmpA(buf, "apple"), "Expected buf to be unchanged, got %s\n", buf);
5558 ok(sz == MAX_PATH, "Expected MAX_PATH, got %d\n", sz);
5560 res = RegSetValueExA(propkey, "ProductIcon", 0, REG_SZ, (LPBYTE)"icon", 5);
5561 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
5563 /* ProductIcon value exists */
5565 lstrcpyA(buf, "apple");
5566 r = pMsiGetProductInfoExA(prodcode, NULL,
5567 MSIINSTALLCONTEXT_MACHINE,
5568 INSTALLPROPERTY_PRODUCTICON, buf, &sz);
5569 ok(r == ERROR_UNKNOWN_PRODUCT,
5570 "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r);
5571 ok(!lstrcmpA(buf, "apple"), "Expected buf to be unchanged, got %s\n", buf);
5572 ok(sz == MAX_PATH, "Expected MAX_PATH, got %d\n", sz);
5574 res = RegSetValueExA(propkey, "PackageName", 0, REG_SZ, (LPBYTE)"name", 5);
5575 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
5577 /* PackageName value exists */
5579 lstrcpyA(buf, "apple");
5580 r = pMsiGetProductInfoExA(prodcode, NULL,
5581 MSIINSTALLCONTEXT_MACHINE,
5582 INSTALLPROPERTY_PACKAGENAME, buf, &sz);
5583 ok(r == ERROR_UNKNOWN_PRODUCT,
5584 "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r);
5585 ok(!lstrcmpA(buf, "apple"), "Expected buf to be unchanged, got %s\n", buf);
5586 ok(sz == MAX_PATH, "Expected MAX_PATH, got %d\n", sz);
5588 res = RegSetValueExA(propkey, "AuthorizedLUAApp", 0, REG_SZ, (LPBYTE)"auth", 5);
5589 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
5591 /* AuthorizedLUAApp value exists */
5593 lstrcpyA(buf, "apple");
5594 r = pMsiGetProductInfoExA(prodcode, NULL,
5595 MSIINSTALLCONTEXT_MACHINE,
5596 INSTALLPROPERTY_AUTHORIZED_LUA_APP, buf, &sz);
5597 ok(r == ERROR_UNKNOWN_PRODUCT,
5598 "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r);
5599 ok(!lstrcmpA(buf, "apple"), "Expected buf to be unchanged, got %s\n", buf);
5600 ok(sz == MAX_PATH, "Expected MAX_PATH, got %d\n", sz);
5602 RegDeleteValueA(propkey, "AuthorizedLUAApp");
5603 RegDeleteValueA(propkey, "PackageName");
5604 RegDeleteValueA(propkey, "ProductIcon");
5605 RegDeleteValueA(propkey, "Version");
5606 RegDeleteValueA(propkey, "PackageCode");
5607 RegDeleteValueA(propkey, "AssignmentType");
5608 RegDeleteValueA(propkey, "ProductName");
5609 RegDeleteValueA(propkey, "Language");
5610 RegDeleteValueA(propkey, "Transforms");
5611 RegDeleteValueA(propkey, "RegOwner");
5612 RegDeleteValueA(propkey, "RegCompany");
5613 RegDeleteValueA(propkey, "ProductID");
5614 RegDeleteValueA(propkey, "DisplayVersion");
5615 RegDeleteValueA(propkey, "VersionMajor");
5616 RegDeleteValueA(propkey, "VersionMinor");
5617 RegDeleteValueA(propkey, "URLUpdateInfo");
5618 RegDeleteValueA(propkey, "URLInfoAbout");
5619 RegDeleteValueA(propkey, "Publisher");
5620 RegDeleteValueA(propkey, "LocalPackage");
5621 RegDeleteValueA(propkey, "InstallSource");
5622 RegDeleteValueA(propkey, "InstallLocation");
5623 RegDeleteValueA(propkey, "DisplayName");
5624 RegDeleteValueA(propkey, "InstallDate");
5625 RegDeleteValueA(propkey, "HelpTelephone");
5626 RegDeleteValueA(propkey, "HelpLink");
5627 RegDeleteValueA(propkey, "LocalPackage");
5628 RegDeleteKeyA(propkey, "");
5629 RegCloseKey(propkey);
5630 RegDeleteKeyA(localkey, "");
5631 RegCloseKey(localkey);
5633 lstrcpyA(keypath, "Software\\Classes\\Installer\\Products\\");
5634 lstrcatA(keypath, prod_squashed);
5636 res = RegCreateKeyA(HKEY_LOCAL_MACHINE, keypath, &prodkey);
5637 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
5639 /* local classes product key exists */
5641 lstrcpyA(buf, "apple");
5642 r = pMsiGetProductInfoExA(prodcode, NULL,
5643 MSIINSTALLCONTEXT_MACHINE,
5644 INSTALLPROPERTY_PRODUCTSTATE, buf, &sz);
5645 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
5646 ok(!lstrcmpA(buf, "1"), "Expected \"1\", got \"%s\"\n", buf);
5647 ok(sz == 1, "Expected 1, got %d\n", sz);
5649 res = RegSetValueExA(prodkey, "HelpLink", 0, REG_SZ, (LPBYTE)"link", 5);
5650 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
5652 /* HelpLink value exists */
5654 lstrcpyA(buf, "apple");
5655 r = pMsiGetProductInfoExA(prodcode, NULL,
5656 MSIINSTALLCONTEXT_MACHINE,
5657 INSTALLPROPERTY_HELPLINK, buf, &sz);
5658 ok(r == ERROR_UNKNOWN_PROPERTY,
5659 "Expected ERROR_UNKNOWN_PROPERTY, got %d\n", r);
5660 ok(!lstrcmpA(buf, "apple"), "Expected buf to be unchanged, got %s\n", buf);
5661 ok(sz == MAX_PATH, "Expected MAX_PATH, got %d\n", sz);
5663 res = RegSetValueExA(prodkey, "HelpTelephone", 0, REG_SZ, (LPBYTE)"phone", 6);
5664 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
5666 /* HelpTelephone value exists */
5668 lstrcpyA(buf, "apple");
5669 r = pMsiGetProductInfoExA(prodcode, NULL,
5670 MSIINSTALLCONTEXT_MACHINE,
5671 INSTALLPROPERTY_HELPTELEPHONE, buf, &sz);
5672 ok(r == ERROR_UNKNOWN_PROPERTY,
5673 "Expected ERROR_UNKNOWN_PROPERTY, got %d\n", r);
5674 ok(!lstrcmpA(buf, "apple"), "Expected buf to be unchanged, got %s\n", buf);
5675 ok(sz == MAX_PATH, "Expected MAX_PATH, got %d\n", sz);
5677 res = RegSetValueExA(prodkey, "InstallDate", 0, REG_SZ, (LPBYTE)"date", 5);
5678 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
5680 /* InstallDate value exists */
5682 lstrcpyA(buf, "apple");
5683 r = pMsiGetProductInfoExA(prodcode, NULL,
5684 MSIINSTALLCONTEXT_MACHINE,
5685 INSTALLPROPERTY_INSTALLDATE, buf, &sz);
5686 ok(r == ERROR_UNKNOWN_PROPERTY,
5687 "Expected ERROR_UNKNOWN_PROPERTY, got %d\n", r);
5688 ok(!lstrcmpA(buf, "apple"), "Expected buf to be unchanged, got %s\n", buf);
5689 ok(sz == MAX_PATH, "Expected MAX_PATH, got %d\n", sz);
5691 res = RegSetValueExA(prodkey, "DisplayName", 0, REG_SZ, (LPBYTE)"name", 5);
5692 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
5694 /* DisplayName value exists */
5696 lstrcpyA(buf, "apple");
5697 r = pMsiGetProductInfoExA(prodcode, NULL,
5698 MSIINSTALLCONTEXT_MACHINE,
5699 INSTALLPROPERTY_INSTALLEDPRODUCTNAME, buf, &sz);
5700 ok(r == ERROR_UNKNOWN_PROPERTY,
5701 "Expected ERROR_UNKNOWN_PROPERTY, got %d\n", r);
5702 ok(!lstrcmpA(buf, "apple"), "Expected buf to be unchanged, got %s\n", buf);
5703 ok(sz == MAX_PATH, "Expected MAX_PATH, got %d\n", sz);
5705 res = RegSetValueExA(prodkey, "InstallLocation", 0, REG_SZ, (LPBYTE)"loc", 4);
5706 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
5708 /* InstallLocation value exists */
5710 lstrcpyA(buf, "apple");
5711 r = pMsiGetProductInfoExA(prodcode, NULL,
5712 MSIINSTALLCONTEXT_MACHINE,
5713 INSTALLPROPERTY_INSTALLLOCATION, buf, &sz);
5714 ok(r == ERROR_UNKNOWN_PROPERTY,
5715 "Expected ERROR_UNKNOWN_PROPERTY, got %d\n", r);
5716 ok(!lstrcmpA(buf, "apple"), "Expected buf to be unchanged, got %s\n", buf);
5717 ok(sz == MAX_PATH, "Expected MAX_PATH, got %d\n", sz);
5719 res = RegSetValueExA(prodkey, "InstallSource", 0, REG_SZ, (LPBYTE)"source", 7);
5720 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
5722 /* InstallSource value exists */
5724 lstrcpyA(buf, "apple");
5725 r = pMsiGetProductInfoExA(prodcode, NULL,
5726 MSIINSTALLCONTEXT_MACHINE,
5727 INSTALLPROPERTY_INSTALLSOURCE, buf, &sz);
5728 ok(r == ERROR_UNKNOWN_PROPERTY,
5729 "Expected ERROR_UNKNOWN_PROPERTY, got %d\n", r);
5730 ok(!lstrcmpA(buf, "apple"), "Expected buf to be unchanged, got %s\n", buf);
5731 ok(sz == MAX_PATH, "Expected MAX_PATH, got %d\n", sz);
5733 res = RegSetValueExA(prodkey, "LocalPackage", 0, REG_SZ, (LPBYTE)"local", 6);
5734 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
5736 /* LocalPackage value exists */
5738 lstrcpyA(buf, "apple");
5739 r = pMsiGetProductInfoExA(prodcode, NULL,
5740 MSIINSTALLCONTEXT_MACHINE,
5741 INSTALLPROPERTY_LOCALPACKAGE, buf, &sz);
5742 ok(r == ERROR_UNKNOWN_PROPERTY,
5743 "Expected ERROR_UNKNOWN_PROPERTY, got %d\n", r);
5744 ok(!lstrcmpA(buf, "apple"), "Expected buf to be unchanged, got %s\n", buf);
5745 ok(sz == MAX_PATH, "Expected MAX_PATH, got %d\n", sz);
5747 res = RegSetValueExA(prodkey, "Publisher", 0, REG_SZ, (LPBYTE)"pub", 4);
5748 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
5750 /* Publisher value exists */
5752 lstrcpyA(buf, "apple");
5753 r = pMsiGetProductInfoExA(prodcode, NULL,
5754 MSIINSTALLCONTEXT_MACHINE,
5755 INSTALLPROPERTY_PUBLISHER, buf, &sz);
5756 ok(r == ERROR_UNKNOWN_PROPERTY,
5757 "Expected ERROR_UNKNOWN_PROPERTY, got %d\n", r);
5758 ok(!lstrcmpA(buf, "apple"), "Expected buf to be unchanged, got %s\n", buf);
5759 ok(sz == MAX_PATH, "Expected MAX_PATH, got %d\n", sz);
5761 res = RegSetValueExA(prodkey, "URLInfoAbout", 0, REG_SZ, (LPBYTE)"about", 6);
5762 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
5764 /* URLInfoAbout value exists */
5766 lstrcpyA(buf, "apple");
5767 r = pMsiGetProductInfoExA(prodcode, NULL,
5768 MSIINSTALLCONTEXT_MACHINE,
5769 INSTALLPROPERTY_URLINFOABOUT, buf, &sz);
5770 ok(r == ERROR_UNKNOWN_PROPERTY,
5771 "Expected ERROR_UNKNOWN_PROPERTY, got %d\n", r);
5772 ok(!lstrcmpA(buf, "apple"), "Expected buf to be unchanged, got %s\n", buf);
5773 ok(sz == MAX_PATH, "Expected MAX_PATH, got %d\n", sz);
5775 res = RegSetValueExA(prodkey, "URLUpdateInfo", 0, REG_SZ, (LPBYTE)"update", 7);
5776 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
5778 /* URLUpdateInfo value exists */
5780 lstrcpyA(buf, "apple");
5781 r = pMsiGetProductInfoExA(prodcode, NULL,
5782 MSIINSTALLCONTEXT_MACHINE,
5783 INSTALLPROPERTY_URLUPDATEINFO, buf, &sz);
5784 ok(r == ERROR_UNKNOWN_PROPERTY,
5785 "Expected ERROR_UNKNOWN_PROPERTY, got %d\n", r);
5786 ok(!lstrcmpA(buf, "apple"), "Expected buf to be unchanged, got %s\n", buf);
5787 ok(sz == MAX_PATH, "Expected MAX_PATH, got %d\n", sz);
5789 res = RegSetValueExA(prodkey, "VersionMinor", 0, REG_SZ, (LPBYTE)"2", 2);
5790 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
5792 /* VersionMinor value exists */
5794 lstrcpyA(buf, "apple");
5795 r = pMsiGetProductInfoExA(prodcode, NULL,
5796 MSIINSTALLCONTEXT_MACHINE,
5797 INSTALLPROPERTY_VERSIONMINOR, buf, &sz);
5798 ok(r == ERROR_UNKNOWN_PROPERTY,
5799 "Expected ERROR_UNKNOWN_PROPERTY, got %d\n", r);
5800 ok(!lstrcmpA(buf, "apple"), "Expected buf to be unchanged, got %s\n", buf);
5801 ok(sz == MAX_PATH, "Expected MAX_PATH, got %d\n", sz);
5803 res = RegSetValueExA(prodkey, "VersionMajor", 0, REG_SZ, (LPBYTE)"3", 2);
5804 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
5806 /* VersionMajor value exists */
5808 lstrcpyA(buf, "apple");
5809 r = pMsiGetProductInfoExA(prodcode, NULL,
5810 MSIINSTALLCONTEXT_MACHINE,
5811 INSTALLPROPERTY_VERSIONMAJOR, buf, &sz);
5812 ok(r == ERROR_UNKNOWN_PROPERTY,
5813 "Expected ERROR_UNKNOWN_PROPERTY, got %d\n", r);
5814 ok(!lstrcmpA(buf, "apple"), "Expected buf to be unchanged, got %s\n", buf);
5815 ok(sz == MAX_PATH, "Expected MAX_PATH, got %d\n", sz);
5817 res = RegSetValueExA(prodkey, "DisplayVersion", 0, REG_SZ, (LPBYTE)"3.2.1", 6);
5818 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
5820 /* DisplayVersion value exists */
5822 lstrcpyA(buf, "apple");
5823 r = pMsiGetProductInfoExA(prodcode, NULL,
5824 MSIINSTALLCONTEXT_MACHINE,
5825 INSTALLPROPERTY_VERSIONSTRING, buf, &sz);
5826 ok(r == ERROR_UNKNOWN_PROPERTY,
5827 "Expected ERROR_UNKNOWN_PROPERTY, got %d\n", r);
5828 ok(!lstrcmpA(buf, "apple"), "Expected buf to be unchanged, got %s\n", buf);
5829 ok(sz == MAX_PATH, "Expected MAX_PATH, got %d\n", sz);
5831 res = RegSetValueExA(prodkey, "ProductID", 0, REG_SZ, (LPBYTE)"id", 3);
5832 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
5834 /* ProductID value exists */
5836 lstrcpyA(buf, "apple");
5837 r = pMsiGetProductInfoExA(prodcode, NULL,
5838 MSIINSTALLCONTEXT_MACHINE,
5839 INSTALLPROPERTY_PRODUCTID, buf, &sz);
5840 ok(r == ERROR_UNKNOWN_PROPERTY,
5841 "Expected ERROR_UNKNOWN_PROPERTY, got %d\n", r);
5842 ok(!lstrcmpA(buf, "apple"), "Expected buf to be unchanged, got %s\n", buf);
5843 ok(sz == MAX_PATH, "Expected MAX_PATH, got %d\n", sz);
5845 res = RegSetValueExA(prodkey, "RegCompany", 0, REG_SZ, (LPBYTE)"comp", 5);
5846 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
5848 /* RegCompany value exists */
5850 lstrcpyA(buf, "apple");
5851 r = pMsiGetProductInfoExA(prodcode, NULL,
5852 MSIINSTALLCONTEXT_MACHINE,
5853 INSTALLPROPERTY_REGCOMPANY, buf, &sz);
5854 ok(r == ERROR_UNKNOWN_PROPERTY,
5855 "Expected ERROR_UNKNOWN_PROPERTY, got %d\n", r);
5856 ok(!lstrcmpA(buf, "apple"), "Expected buf to be unchanged, got %s\n", buf);
5857 ok(sz == MAX_PATH, "Expected MAX_PATH, got %d\n", sz);
5859 res = RegSetValueExA(prodkey, "RegOwner", 0, REG_SZ, (LPBYTE)"owner", 6);
5860 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
5862 /* RegOwner value exists */
5864 lstrcpyA(buf, "apple");
5865 r = pMsiGetProductInfoExA(prodcode, NULL,
5866 MSIINSTALLCONTEXT_MACHINE,
5867 INSTALLPROPERTY_REGOWNER, buf, &sz);
5868 ok(r == ERROR_UNKNOWN_PROPERTY,
5869 "Expected ERROR_UNKNOWN_PROPERTY, got %d\n", r);
5870 ok(!lstrcmpA(buf, "apple"), "Expected buf to be unchanged, got %s\n", buf);
5871 ok(sz == MAX_PATH, "Expected MAX_PATH, got %d\n", sz);
5873 res = RegSetValueExA(prodkey, "Transforms", 0, REG_SZ, (LPBYTE)"trans", 6);
5874 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
5876 /* Transforms value exists */
5878 lstrcpyA(buf, "apple");
5879 r = pMsiGetProductInfoExA(prodcode, NULL,
5880 MSIINSTALLCONTEXT_MACHINE,
5881 INSTALLPROPERTY_TRANSFORMS, buf, &sz);
5882 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
5883 ok(!lstrcmpA(buf, "trans"), "Expected \"trans\", got \"%s\"\n", buf);
5884 ok(sz == 5, "Expected 5, got %d\n", sz);
5886 res = RegSetValueExA(prodkey, "Language", 0, REG_SZ, (LPBYTE)"lang", 5);
5887 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
5889 /* Language value exists */
5891 lstrcpyA(buf, "apple");
5892 r = pMsiGetProductInfoExA(prodcode, NULL,
5893 MSIINSTALLCONTEXT_MACHINE,
5894 INSTALLPROPERTY_LANGUAGE, buf, &sz);
5895 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
5896 ok(!lstrcmpA(buf, "lang"), "Expected \"lang\", got \"%s\"\n", buf);
5897 ok(sz == 4, "Expected 4, got %d\n", sz);
5899 res = RegSetValueExA(prodkey, "ProductName", 0, REG_SZ, (LPBYTE)"name", 5);
5900 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
5902 /* ProductName value exists */
5904 lstrcpyA(buf, "apple");
5905 r = pMsiGetProductInfoExA(prodcode, NULL,
5906 MSIINSTALLCONTEXT_MACHINE,
5907 INSTALLPROPERTY_PRODUCTNAME, buf, &sz);
5908 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
5909 ok(!lstrcmpA(buf, "name"), "Expected \"name\", got \"%s\"\n", buf);
5910 ok(sz == 4, "Expected 4, got %d\n", sz);
5912 res = RegSetValueExA(prodkey, "AssignmentType", 0, REG_SZ, (LPBYTE)"type", 5);
5913 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
5917 /* AssignmentType value exists */
5919 lstrcpyA(buf, "apple");
5920 r = pMsiGetProductInfoExA(prodcode, NULL,
5921 MSIINSTALLCONTEXT_MACHINE,
5922 INSTALLPROPERTY_ASSIGNMENTTYPE, buf, &sz);
5923 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
5924 ok(!lstrcmpA(buf, ""), "Expected \"\", got \"%s\"\n", buf);
5925 ok(sz == 0, "Expected 0, got %d\n", sz);
5927 res = RegSetValueExA(prodkey, "PackageCode", 0, REG_SZ, (LPBYTE)"code", 5);
5928 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
5932 /* PackageCode value exists */
5934 lstrcpyA(buf, "apple");
5935 r = pMsiGetProductInfoExA(prodcode, NULL,
5936 MSIINSTALLCONTEXT_MACHINE,
5937 INSTALLPROPERTY_PACKAGECODE, buf, &sz);
5940 ok(r == ERROR_BAD_CONFIGURATION,
5941 "Expected ERROR_BAD_CONFIGURATION, got %d\n", r);
5942 ok(!lstrcmpA(buf, "apple"), "Expected buf to be unchanged, got %s\n", buf);
5943 ok(sz == MAX_PATH, "Expected MAX_PATH, got %d\n", sz);
5946 res = RegSetValueExA(prodkey, "Version", 0, REG_SZ, (LPBYTE)"ver", 4);
5947 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
5949 /* Version value exists */
5951 lstrcpyA(buf, "apple");
5952 r = pMsiGetProductInfoExA(prodcode, NULL,
5953 MSIINSTALLCONTEXT_MACHINE,
5954 INSTALLPROPERTY_VERSION, buf, &sz);
5955 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
5956 ok(!lstrcmpA(buf, "ver"), "Expected \"ver\", got \"%s\"\n", buf);
5957 ok(sz == 3, "Expected 3, got %d\n", sz);
5959 res = RegSetValueExA(prodkey, "ProductIcon", 0, REG_SZ, (LPBYTE)"icon", 5);
5960 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
5962 /* ProductIcon value exists */
5964 lstrcpyA(buf, "apple");
5965 r = pMsiGetProductInfoExA(prodcode, NULL,
5966 MSIINSTALLCONTEXT_MACHINE,
5967 INSTALLPROPERTY_PRODUCTICON, buf, &sz);
5968 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
5969 ok(!lstrcmpA(buf, "icon"), "Expected \"icon\", got \"%s\"\n", buf);
5970 ok(sz == 4, "Expected 4, got %d\n", sz);
5972 res = RegSetValueExA(prodkey, "PackageName", 0, REG_SZ, (LPBYTE)"name", 5);
5973 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
5975 /* PackageName value exists */
5977 lstrcpyA(buf, "apple");
5978 r = pMsiGetProductInfoExA(prodcode, NULL,
5979 MSIINSTALLCONTEXT_MACHINE,
5980 INSTALLPROPERTY_PACKAGENAME, buf, &sz);
5983 ok(r == ERROR_UNKNOWN_PRODUCT,
5984 "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r);
5985 ok(!lstrcmpA(buf, "apple"), "Expected buf to be unchanged, got %s\n", buf);
5986 ok(sz == MAX_PATH, "Expected MAX_PATH, got %d\n", sz);
5989 res = RegSetValueExA(prodkey, "AuthorizedLUAApp", 0, REG_SZ, (LPBYTE)"auth", 5);
5990 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
5992 /* AuthorizedLUAApp value exists */
5994 lstrcpyA(buf, "apple");
5995 r = pMsiGetProductInfoExA(prodcode, NULL,
5996 MSIINSTALLCONTEXT_MACHINE,
5997 INSTALLPROPERTY_AUTHORIZED_LUA_APP, buf, &sz);
5998 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
5999 ok(!lstrcmpA(buf, "auth"), "Expected \"auth\", got \"%s\"\n", buf);
6000 ok(sz == 4, "Expected 4, got %d\n", sz);
6002 RegDeleteValueA(prodkey, "AuthorizedLUAApp");
6003 RegDeleteValueA(prodkey, "PackageName");
6004 RegDeleteValueA(prodkey, "ProductIcon");
6005 RegDeleteValueA(prodkey, "Version");
6006 RegDeleteValueA(prodkey, "PackageCode");
6007 RegDeleteValueA(prodkey, "AssignmentType");
6008 RegDeleteValueA(prodkey, "ProductName");
6009 RegDeleteValueA(prodkey, "Language");
6010 RegDeleteValueA(prodkey, "Transforms");
6011 RegDeleteValueA(prodkey, "RegOwner");
6012 RegDeleteValueA(prodkey, "RegCompany");
6013 RegDeleteValueA(prodkey, "ProductID");
6014 RegDeleteValueA(prodkey, "DisplayVersion");
6015 RegDeleteValueA(prodkey, "VersionMajor");
6016 RegDeleteValueA(prodkey, "VersionMinor");
6017 RegDeleteValueA(prodkey, "URLUpdateInfo");
6018 RegDeleteValueA(prodkey, "URLInfoAbout");
6019 RegDeleteValueA(prodkey, "Publisher");
6020 RegDeleteValueA(prodkey, "LocalPackage");
6021 RegDeleteValueA(prodkey, "InstallSource");
6022 RegDeleteValueA(prodkey, "InstallLocation");
6023 RegDeleteValueA(prodkey, "DisplayName");
6024 RegDeleteValueA(prodkey, "InstallDate");
6025 RegDeleteValueA(prodkey, "HelpTelephone");
6026 RegDeleteValueA(prodkey, "HelpLink");
6027 RegDeleteKeyA(prodkey, "");
6028 RegCloseKey(prodkey);
6033 init_functionpointers();
6037 test_getcomponentpath();
6038 test_MsiGetFileHash();
6040 if (!pConvertSidToStringSidA)
6041 skip("ConvertSidToStringSidA not implemented\n");
6044 /* These tests rely on get_user_sid that needs ConvertSidToStringSidA */
6045 test_MsiQueryProductState();
6046 test_MsiQueryFeatureState();
6047 test_MsiQueryComponentState();
6048 test_MsiGetComponentPath();
6049 test_MsiGetProductCode();
6050 test_MsiEnumClients();
6051 test_MsiGetProductInfo();
6052 test_MsiGetProductInfoEx();
6055 test_MsiGetFileVersion();