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 if (r != ERROR_UNKNOWN_PROPERTY)
3211 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
3212 ok(!lstrcmpA(buf, ""), "Expected \"\", got \"%s\"\n", buf);
3213 ok(sz == 0, "Expected 0, got %d\n", sz);
3216 res = RegSetValueExA(propkey, "AuthorizedLUAApp", 0, REG_DWORD,
3217 (const BYTE *)&val, sizeof(DWORD));
3218 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
3220 /* AuthorizedLUAApp type is REG_DWORD */
3222 lstrcpyA(buf, "apple");
3223 r = MsiGetProductInfoA(prodcode, INSTALLPROPERTY_AUTHORIZED_LUA_APP, buf, &sz);
3224 if (r != ERROR_UNKNOWN_PROPERTY)
3226 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
3227 ok(!lstrcmpA(buf, ""), "Expected \"\", got \"%s\"\n", buf);
3228 ok(sz == 0, "Expected 0, got %d\n", sz);
3231 res = RegSetValueExA(prodkey, "AuthorizedLUAApp", 0, REG_SZ, (LPBYTE)"auth", 5);
3232 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
3234 /* Authorized value exists */
3236 lstrcpyA(buf, "apple");
3237 r = MsiGetProductInfoA(prodcode, INSTALLPROPERTY_AUTHORIZED_LUA_APP, buf, &sz);
3238 if (r != ERROR_UNKNOWN_PROPERTY)
3240 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
3241 ok(!lstrcmpA(buf, "auth"), "Expected \"auth\", got \"%s\"\n", buf);
3242 ok(sz == 4, "Expected 4, got %d\n", sz);
3245 res = RegSetValueExA(prodkey, "AuthorizedLUAApp", 0, REG_DWORD,
3246 (const BYTE *)&val, sizeof(DWORD));
3247 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
3249 /* AuthorizedLUAApp type is REG_DWORD */
3251 lstrcpyA(buf, "apple");
3252 r = MsiGetProductInfoA(prodcode, INSTALLPROPERTY_AUTHORIZED_LUA_APP, buf, &sz);
3253 if (r != ERROR_UNKNOWN_PROPERTY)
3255 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
3256 ok(!lstrcmpA(buf, "42"), "Expected \"42\", got \"%s\"\n", buf);
3257 ok(sz == 2, "Expected 2, got %d\n", sz);
3260 RegDeleteValueA(propkey, "HelpLink");
3261 RegDeleteValueA(propkey, "DisplayName");
3262 RegDeleteValueA(propkey, "DisplayVersion");
3263 RegDeleteValueA(propkey, "HelpTelephone");
3264 RegDeleteValueA(propkey, "InstallLocation");
3265 RegDeleteValueA(propkey, "InstallSource");
3266 RegDeleteValueA(propkey, "InstallDate");
3267 RegDeleteValueA(propkey, "Publisher");
3268 RegDeleteValueA(propkey, "LocalPackage");
3269 RegDeleteValueA(propkey, "UrlInfoAbout");
3270 RegDeleteValueA(propkey, "UrlUpdateInfo");
3271 RegDeleteValueA(propkey, "VersionMinor");
3272 RegDeleteValueA(propkey, "VersionMajor");
3273 RegDeleteValueA(propkey, "ProductID");
3274 RegDeleteValueA(propkey, "RegCompany");
3275 RegDeleteValueA(propkey, "RegOwner");
3276 RegDeleteValueA(propkey, "InstanceType");
3277 RegDeleteValueA(propkey, "Transforms");
3278 RegDeleteValueA(propkey, "Language");
3279 RegDeleteValueA(propkey, "ProductName");
3280 RegDeleteValueA(propkey, "Assignment");
3281 RegDeleteValueA(propkey, "PackageCode");
3282 RegDeleteValueA(propkey, "Version");
3283 RegDeleteValueA(propkey, "ProductIcon");
3284 RegDeleteValueA(propkey, "AuthorizedLUAApp");
3285 RegDeleteKeyA(propkey, "");
3286 RegDeleteKeyA(localkey, "");
3287 RegDeleteValueA(prodkey, "InstanceType");
3288 RegDeleteValueA(prodkey, "Transforms");
3289 RegDeleteValueA(prodkey, "Language");
3290 RegDeleteValueA(prodkey, "ProductName");
3291 RegDeleteValueA(prodkey, "Assignment");
3292 RegDeleteValueA(prodkey, "PackageCode");
3293 RegDeleteValueA(prodkey, "Version");
3294 RegDeleteValueA(prodkey, "ProductIcon");
3295 RegDeleteValueA(prodkey, "AuthorizedLUAApp");
3296 RegDeleteValueA(source, "PackageName");
3297 RegDeleteKeyA(source, "");
3298 RegDeleteKeyA(prodkey, "");
3299 RegCloseKey(propkey);
3300 RegCloseKey(localkey);
3301 RegCloseKey(source);
3302 RegCloseKey(prodkey);
3305 static void test_MsiGetProductInfoEx(void)
3309 HKEY propkey, userkey;
3310 HKEY prodkey, localkey;
3311 CHAR prodcode[MAX_PATH];
3312 CHAR prod_squashed[MAX_PATH];
3313 CHAR packcode[MAX_PATH];
3314 CHAR pack_squashed[MAX_PATH];
3316 CHAR keypath[MAX_PATH];
3320 if (!pMsiGetProductInfoExA)
3322 skip("MsiGetProductInfoExA is not available\n");
3326 create_test_guid(prodcode, prod_squashed);
3327 create_test_guid(packcode, pack_squashed);
3328 get_user_sid(&usersid);
3330 /* NULL szProductCode */
3332 lstrcpyA(buf, "apple");
3333 r = pMsiGetProductInfoExA(NULL, usersid, MSIINSTALLCONTEXT_USERUNMANAGED,
3334 INSTALLPROPERTY_PRODUCTSTATE, buf, &sz);
3335 ok(r == ERROR_INVALID_PARAMETER,
3336 "Expected ERROR_INVALID_PARAMETER, got %d\n", r);
3337 ok(!lstrcmpA(buf, "apple"), "Expected buf to be unchanged, got %s\n", buf);
3338 ok(sz == MAX_PATH, "Expected MAX_PATH, got %d\n", sz);
3340 /* empty szProductCode */
3342 lstrcpyA(buf, "apple");
3343 r = pMsiGetProductInfoExA("", usersid, MSIINSTALLCONTEXT_USERUNMANAGED,
3344 INSTALLPROPERTY_PRODUCTSTATE, buf, &sz);
3345 ok(r == ERROR_INVALID_PARAMETER,
3346 "Expected ERROR_INVALID_PARAMETER, got %d\n", r);
3347 ok(!lstrcmpA(buf, "apple"), "Expected buf to be unchanged, got %s\n", buf);
3348 ok(sz == MAX_PATH, "Expected MAX_PATH, got %d\n", sz);
3350 /* garbage szProductCode */
3352 lstrcpyA(buf, "apple");
3353 r = pMsiGetProductInfoExA("garbage", usersid, MSIINSTALLCONTEXT_USERUNMANAGED,
3354 INSTALLPROPERTY_PRODUCTSTATE, buf, &sz);
3355 ok(r == ERROR_INVALID_PARAMETER,
3356 "Expected ERROR_INVALID_PARAMETER, got %d\n", r);
3357 ok(!lstrcmpA(buf, "apple"), "Expected buf to be unchanged, got %s\n", buf);
3358 ok(sz == MAX_PATH, "Expected MAX_PATH, got %d\n", sz);
3360 /* guid without brackets */
3362 lstrcpyA(buf, "apple");
3363 r = pMsiGetProductInfoExA("6700E8CF-95AB-4D9C-BC2C-15840DEA7A5D", usersid,
3364 MSIINSTALLCONTEXT_USERUNMANAGED,
3365 INSTALLPROPERTY_PRODUCTSTATE, buf, &sz);
3366 ok(r == ERROR_INVALID_PARAMETER,
3367 "Expected ERROR_INVALID_PARAMETER, got %d\n", r);
3368 ok(!lstrcmpA(buf, "apple"), "Expected buf to be unchanged, got %s\n", buf);
3369 ok(sz == MAX_PATH, "Expected MAX_PATH, got %d\n", sz);
3371 /* guid with brackets */
3373 lstrcpyA(buf, "apple");
3374 r = pMsiGetProductInfoExA("{6700E8CF-95AB-4D9C-BC2C-15840DEA7A5D}", usersid,
3375 MSIINSTALLCONTEXT_USERUNMANAGED,
3376 INSTALLPROPERTY_PRODUCTSTATE, buf, &sz);
3377 ok(r == ERROR_UNKNOWN_PRODUCT,
3378 "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r);
3379 ok(!lstrcmpA(buf, "apple"), "Expected buf to be unchanged, got %s\n", buf);
3380 ok(sz == MAX_PATH, "Expected MAX_PATH, got %d\n", sz);
3382 /* szValue is non-NULL while pcchValue is NULL */
3383 lstrcpyA(buf, "apple");
3384 r = pMsiGetProductInfoExA(prodcode, usersid,
3385 MSIINSTALLCONTEXT_USERUNMANAGED,
3386 INSTALLPROPERTY_PRODUCTSTATE, buf, NULL);
3387 ok(r == ERROR_INVALID_PARAMETER,
3388 "Expected ERROR_INVALID_PARAMETER, got %d\n", r);
3389 ok(!lstrcmpA(buf, "apple"), "Expected buf to be unchanged, got %s\n", buf);
3391 /* dwContext is out of range */
3393 lstrcpyA(buf, "apple");
3394 r = pMsiGetProductInfoExA(prodcode, usersid, 42,
3395 INSTALLPROPERTY_PRODUCTSTATE, buf, &sz);
3396 ok(r == ERROR_INVALID_PARAMETER,
3397 "Expected ERROR_INVALID_PARAMETER, got %d\n", r);
3398 ok(!lstrcmpA(buf, "apple"), "Expected buf to be unchanged, got %s\n", buf);
3399 ok(sz == MAX_PATH, "Expected MAX_PATH, got %d\n", sz);
3401 /* szProperty is NULL */
3403 lstrcpyA(buf, "apple");
3404 r = pMsiGetProductInfoExA(prodcode, usersid,
3405 MSIINSTALLCONTEXT_USERUNMANAGED,
3407 ok(r == ERROR_INVALID_PARAMETER,
3408 "Expected ERROR_INVALID_PARAMETER, got %d\n", r);
3409 ok(!lstrcmpA(buf, "apple"), "Expected buf to be unchanged, got %s\n", buf);
3410 ok(sz == MAX_PATH, "Expected MAX_PATH, got %d\n", sz);
3412 /* szProperty is empty */
3414 lstrcpyA(buf, "apple");
3415 r = pMsiGetProductInfoExA(prodcode, usersid,
3416 MSIINSTALLCONTEXT_USERUNMANAGED,
3418 ok(r == ERROR_INVALID_PARAMETER,
3419 "Expected ERROR_INVALID_PARAMETER, got %d\n", r);
3420 ok(!lstrcmpA(buf, "apple"), "Expected buf to be unchanged, got %s\n", buf);
3421 ok(sz == MAX_PATH, "Expected MAX_PATH, got %d\n", sz);
3423 /* szProperty is not a valid property */
3425 lstrcpyA(buf, "apple");
3426 r = pMsiGetProductInfoExA(prodcode, usersid,
3427 MSIINSTALLCONTEXT_USERUNMANAGED,
3428 "notvalid", buf, &sz);
3429 ok(r == ERROR_UNKNOWN_PRODUCT,
3430 "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r);
3431 ok(!lstrcmpA(buf, "apple"), "Expected buf to be unchanged, got %s\n", buf);
3432 ok(sz == MAX_PATH, "Expected MAX_PATH, got %d\n", sz);
3434 /* same length as guid, but random */
3436 lstrcpyA(buf, "apple");
3437 r = pMsiGetProductInfoExA("A938G02JF-2NF3N93-VN3-2NNF-3KGKALDNF93", usersid,
3438 MSIINSTALLCONTEXT_USERUNMANAGED,
3439 INSTALLPROPERTY_PRODUCTSTATE, buf, &sz);
3440 ok(r == ERROR_INVALID_PARAMETER,
3441 "Expected ERROR_INVALID_PARAMETER, got %d\n", r);
3442 ok(!lstrcmpA(buf, "apple"), "Expected buf to be unchanged, got %s\n", buf);
3443 ok(sz == MAX_PATH, "Expected MAX_PATH, got %d\n", sz);
3445 /* MSIINSTALLCONTEXT_USERUNMANAGED */
3447 lstrcpyA(keypath, "Software\\Microsoft\\Windows\\CurrentVersion\\Installer\\UserData\\");
3448 lstrcatA(keypath, usersid);
3449 lstrcatA(keypath, "\\Products\\");
3450 lstrcatA(keypath, prod_squashed);
3452 res = RegCreateKeyA(HKEY_LOCAL_MACHINE, keypath, &localkey);
3453 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
3455 /* local user product key exists */
3457 lstrcpyA(buf, "apple");
3458 r = pMsiGetProductInfoExA(prodcode, usersid,
3459 MSIINSTALLCONTEXT_USERUNMANAGED,
3460 INSTALLPROPERTY_PRODUCTSTATE, buf, &sz);
3461 ok(r == ERROR_UNKNOWN_PRODUCT,
3462 "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r);
3463 ok(!lstrcmpA(buf, "apple"), "Expected buf to be unchanged, got %s\n", buf);
3464 ok(sz == MAX_PATH, "Expected MAX_PATH, got %d\n", sz);
3466 res = RegCreateKeyA(localkey, "InstallProperties", &propkey);
3467 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
3469 /* InstallProperties key exists */
3471 lstrcpyA(buf, "apple");
3472 r = pMsiGetProductInfoExA(prodcode, usersid,
3473 MSIINSTALLCONTEXT_USERUNMANAGED,
3474 INSTALLPROPERTY_PRODUCTSTATE, buf, &sz);
3475 ok(r == ERROR_UNKNOWN_PRODUCT,
3476 "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r);
3477 ok(!lstrcmpA(buf, "apple"), "Expected buf to be unchanged, got %s\n", buf);
3478 ok(sz == MAX_PATH, "Expected MAX_PATH, got %d\n", sz);
3480 res = RegSetValueExA(propkey, "LocalPackage", 0, REG_SZ, (LPBYTE)"local", 6);
3481 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
3483 /* LocalPackage value exists */
3485 lstrcpyA(buf, "apple");
3486 r = pMsiGetProductInfoExA(prodcode, usersid,
3487 MSIINSTALLCONTEXT_USERUNMANAGED,
3488 INSTALLPROPERTY_PRODUCTSTATE, buf, &sz);
3489 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
3490 ok(!lstrcmpA(buf, "5"), "Expected \"5\", got \"%s\"\n", buf);
3491 ok(sz == 1, "Expected 1, got %d\n", sz);
3493 RegDeleteValueA(propkey, "LocalPackage");
3495 /* LocalPackage value must exist */
3497 lstrcpyA(buf, "apple");
3498 r = pMsiGetProductInfoExA(prodcode, usersid,
3499 MSIINSTALLCONTEXT_USERUNMANAGED,
3500 INSTALLPROPERTY_HELPLINK, buf, &sz);
3501 ok(r == ERROR_UNKNOWN_PRODUCT,
3502 "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r);
3503 ok(!lstrcmpA(buf, "apple"), "Expected buf to be unchanged, got %s\n", buf);
3504 ok(sz == MAX_PATH, "Expected MAX_PATH, got %d\n", sz);
3506 res = RegSetValueExA(propkey, "LocalPackage", 0, REG_SZ, (LPBYTE)"local", 6);
3507 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
3509 /* LocalPackage exists, but HelpLink does not exist */
3511 lstrcpyA(buf, "apple");
3512 r = pMsiGetProductInfoExA(prodcode, usersid,
3513 MSIINSTALLCONTEXT_USERUNMANAGED,
3514 INSTALLPROPERTY_HELPLINK, buf, &sz);
3515 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
3516 ok(!lstrcmpA(buf, ""), "Expected \"\", got \"%s\"\n", buf);
3517 ok(sz == 0, "Expected 0, got %d\n", sz);
3519 res = RegSetValueExA(propkey, "HelpLink", 0, REG_SZ, (LPBYTE)"link", 5);
3520 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
3522 /* HelpLink value exists */
3524 lstrcpyA(buf, "apple");
3525 r = pMsiGetProductInfoExA(prodcode, usersid,
3526 MSIINSTALLCONTEXT_USERUNMANAGED,
3527 INSTALLPROPERTY_HELPLINK, buf, &sz);
3528 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
3529 ok(!lstrcmpA(buf, "link"), "Expected \"link\", got \"%s\"\n", buf);
3530 ok(sz == 4, "Expected 4, got %d\n", sz);
3532 res = RegSetValueExA(propkey, "HelpTelephone", 0, REG_SZ, (LPBYTE)"phone", 6);
3533 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
3535 /* HelpTelephone value exists */
3537 lstrcpyA(buf, "apple");
3538 r = pMsiGetProductInfoExA(prodcode, usersid,
3539 MSIINSTALLCONTEXT_USERUNMANAGED,
3540 INSTALLPROPERTY_HELPTELEPHONE, buf, &sz);
3541 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
3542 ok(!lstrcmpA(buf, "phone"), "Expected \"phone\", got \"%s\"\n", buf);
3543 ok(sz == 5, "Expected 5, got %d\n", sz);
3545 /* szValue and pcchValue are NULL */
3546 r = pMsiGetProductInfoExA(prodcode, usersid,
3547 MSIINSTALLCONTEXT_USERUNMANAGED,
3548 INSTALLPROPERTY_HELPTELEPHONE, NULL, NULL);
3549 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
3551 /* pcchValue is exactly 5 */
3553 lstrcpyA(buf, "apple");
3554 r = pMsiGetProductInfoExA(prodcode, usersid,
3555 MSIINSTALLCONTEXT_USERUNMANAGED,
3556 INSTALLPROPERTY_HELPTELEPHONE, buf, &sz);
3557 ok(r == ERROR_MORE_DATA,
3558 "Expected ERROR_MORE_DATA, got %d\n", r);
3559 ok(!lstrcmpA(buf, ""), "Expected \"\", got \"%s\"\n", buf);
3560 ok(sz == 10, "Expected 10, got %d\n", sz);
3562 /* szValue is NULL, pcchValue is exactly 5 */
3564 r = pMsiGetProductInfoExA(prodcode, usersid,
3565 MSIINSTALLCONTEXT_USERUNMANAGED,
3566 INSTALLPROPERTY_HELPTELEPHONE, NULL, &sz);
3567 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
3568 ok(sz == 10, "Expected 10, got %d\n", sz);
3570 /* szValue is NULL, pcchValue is MAX_PATH */
3572 r = pMsiGetProductInfoExA(prodcode, usersid,
3573 MSIINSTALLCONTEXT_USERUNMANAGED,
3574 INSTALLPROPERTY_HELPTELEPHONE, NULL, &sz);
3575 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
3576 ok(sz == 10, "Expected 10, got %d\n", sz);
3578 /* pcchValue is exactly 0 */
3580 lstrcpyA(buf, "apple");
3581 r = pMsiGetProductInfoExA(prodcode, usersid,
3582 MSIINSTALLCONTEXT_USERUNMANAGED,
3583 INSTALLPROPERTY_HELPTELEPHONE, buf, &sz);
3584 ok(r == ERROR_MORE_DATA,
3585 "Expected ERROR_MORE_DATA, got %d\n", r);
3586 ok(!lstrcmpA(buf, "apple"), "Expected \"apple\", got \"%s\"\n", buf);
3587 ok(sz == 10, "Expected 10, got %d\n", sz);
3589 res = RegSetValueExA(propkey, "notvalid", 0, REG_SZ, (LPBYTE)"invalid", 8);
3590 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
3592 /* szProperty is not a valid property */
3594 lstrcpyA(buf, "apple");
3595 r = pMsiGetProductInfoExA(prodcode, usersid,
3596 MSIINSTALLCONTEXT_USERUNMANAGED,
3597 "notvalid", buf, &sz);
3598 ok(r == ERROR_UNKNOWN_PROPERTY,
3599 "Expected ERROR_UNKNOWN_PROPERTY, got %d\n", r);
3600 ok(!lstrcmpA(buf, "apple"), "Expected buf to be unchanged, got %s\n", buf);
3601 ok(sz == MAX_PATH, "Expected MAX_PATH, got %d\n", sz);
3603 res = RegSetValueExA(propkey, "InstallDate", 0, REG_SZ, (LPBYTE)"date", 5);
3604 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
3606 /* InstallDate value exists */
3608 lstrcpyA(buf, "apple");
3609 r = pMsiGetProductInfoExA(prodcode, usersid,
3610 MSIINSTALLCONTEXT_USERUNMANAGED,
3611 INSTALLPROPERTY_INSTALLDATE, buf, &sz);
3612 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
3613 ok(!lstrcmpA(buf, "date"), "Expected \"date\", got \"%s\"\n", buf);
3614 ok(sz == 4, "Expected 4, got %d\n", sz);
3616 res = RegSetValueExA(propkey, "DisplayName", 0, REG_SZ, (LPBYTE)"name", 5);
3617 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
3619 /* DisplayName value exists */
3621 lstrcpyA(buf, "apple");
3622 r = pMsiGetProductInfoExA(prodcode, usersid,
3623 MSIINSTALLCONTEXT_USERUNMANAGED,
3624 INSTALLPROPERTY_INSTALLEDPRODUCTNAME, buf, &sz);
3625 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
3626 ok(!lstrcmpA(buf, "name"), "Expected \"name\", got \"%s\"\n", buf);
3627 ok(sz == 4, "Expected 4, got %d\n", sz);
3629 res = RegSetValueExA(propkey, "InstallLocation", 0, REG_SZ, (LPBYTE)"loc", 4);
3630 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
3632 /* InstallLocation value exists */
3634 lstrcpyA(buf, "apple");
3635 r = pMsiGetProductInfoExA(prodcode, usersid,
3636 MSIINSTALLCONTEXT_USERUNMANAGED,
3637 INSTALLPROPERTY_INSTALLLOCATION, buf, &sz);
3638 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
3639 ok(!lstrcmpA(buf, "loc"), "Expected \"loc\", got \"%s\"\n", buf);
3640 ok(sz == 3, "Expected 3, got %d\n", sz);
3642 res = RegSetValueExA(propkey, "InstallSource", 0, REG_SZ, (LPBYTE)"source", 7);
3643 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
3645 /* InstallSource value exists */
3647 lstrcpyA(buf, "apple");
3648 r = pMsiGetProductInfoExA(prodcode, usersid,
3649 MSIINSTALLCONTEXT_USERUNMANAGED,
3650 INSTALLPROPERTY_INSTALLSOURCE, buf, &sz);
3651 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
3652 ok(!lstrcmpA(buf, "source"), "Expected \"source\", got \"%s\"\n", buf);
3653 ok(sz == 6, "Expected 6, got %d\n", sz);
3655 res = RegSetValueExA(propkey, "LocalPackage", 0, REG_SZ, (LPBYTE)"local", 6);
3656 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
3658 /* LocalPackage value exists */
3660 lstrcpyA(buf, "apple");
3661 r = pMsiGetProductInfoExA(prodcode, usersid,
3662 MSIINSTALLCONTEXT_USERUNMANAGED,
3663 INSTALLPROPERTY_LOCALPACKAGE, buf, &sz);
3664 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
3665 ok(!lstrcmpA(buf, "local"), "Expected \"local\", got \"%s\"\n", buf);
3666 ok(sz == 5, "Expected 5, got %d\n", sz);
3668 res = RegSetValueExA(propkey, "Publisher", 0, REG_SZ, (LPBYTE)"pub", 4);
3669 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
3671 /* Publisher value exists */
3673 lstrcpyA(buf, "apple");
3674 r = pMsiGetProductInfoExA(prodcode, usersid,
3675 MSIINSTALLCONTEXT_USERUNMANAGED,
3676 INSTALLPROPERTY_PUBLISHER, buf, &sz);
3677 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
3678 ok(!lstrcmpA(buf, "pub"), "Expected \"pub\", got \"%s\"\n", buf);
3679 ok(sz == 3, "Expected 3, got %d\n", sz);
3681 res = RegSetValueExA(propkey, "URLInfoAbout", 0, REG_SZ, (LPBYTE)"about", 6);
3682 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
3684 /* URLInfoAbout value exists */
3686 lstrcpyA(buf, "apple");
3687 r = pMsiGetProductInfoExA(prodcode, usersid,
3688 MSIINSTALLCONTEXT_USERUNMANAGED,
3689 INSTALLPROPERTY_URLINFOABOUT, buf, &sz);
3690 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
3691 ok(!lstrcmpA(buf, "about"), "Expected \"about\", got \"%s\"\n", buf);
3692 ok(sz == 5, "Expected 5, got %d\n", sz);
3694 res = RegSetValueExA(propkey, "URLUpdateInfo", 0, REG_SZ, (LPBYTE)"update", 7);
3695 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
3697 /* URLUpdateInfo value exists */
3699 lstrcpyA(buf, "apple");
3700 r = pMsiGetProductInfoExA(prodcode, usersid,
3701 MSIINSTALLCONTEXT_USERUNMANAGED,
3702 INSTALLPROPERTY_URLUPDATEINFO, buf, &sz);
3703 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
3704 ok(!lstrcmpA(buf, "update"), "Expected \"update\", got \"%s\"\n", buf);
3705 ok(sz == 6, "Expected 6, got %d\n", sz);
3707 res = RegSetValueExA(propkey, "VersionMinor", 0, REG_SZ, (LPBYTE)"2", 2);
3708 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
3710 /* VersionMinor value exists */
3712 lstrcpyA(buf, "apple");
3713 r = pMsiGetProductInfoExA(prodcode, usersid,
3714 MSIINSTALLCONTEXT_USERUNMANAGED,
3715 INSTALLPROPERTY_VERSIONMINOR, buf, &sz);
3716 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
3717 ok(!lstrcmpA(buf, "2"), "Expected \"2\", got \"%s\"\n", buf);
3718 ok(sz == 1, "Expected 1, got %d\n", sz);
3720 res = RegSetValueExA(propkey, "VersionMajor", 0, REG_SZ, (LPBYTE)"3", 2);
3721 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
3723 /* VersionMajor value exists */
3725 lstrcpyA(buf, "apple");
3726 r = pMsiGetProductInfoExA(prodcode, usersid,
3727 MSIINSTALLCONTEXT_USERUNMANAGED,
3728 INSTALLPROPERTY_VERSIONMAJOR, buf, &sz);
3729 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
3730 ok(!lstrcmpA(buf, "3"), "Expected \"3\", got \"%s\"\n", buf);
3731 ok(sz == 1, "Expected 1, got %d\n", sz);
3733 res = RegSetValueExA(propkey, "DisplayVersion", 0, REG_SZ, (LPBYTE)"3.2.1", 6);
3734 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
3736 /* DisplayVersion value exists */
3738 lstrcpyA(buf, "apple");
3739 r = pMsiGetProductInfoExA(prodcode, usersid,
3740 MSIINSTALLCONTEXT_USERUNMANAGED,
3741 INSTALLPROPERTY_VERSIONSTRING, buf, &sz);
3742 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
3743 ok(!lstrcmpA(buf, "3.2.1"), "Expected \"3.2.1\", got \"%s\"\n", buf);
3744 ok(sz == 5, "Expected 5, got %d\n", sz);
3746 res = RegSetValueExA(propkey, "ProductID", 0, REG_SZ, (LPBYTE)"id", 3);
3747 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
3749 /* ProductID value exists */
3751 lstrcpyA(buf, "apple");
3752 r = pMsiGetProductInfoExA(prodcode, usersid,
3753 MSIINSTALLCONTEXT_USERUNMANAGED,
3754 INSTALLPROPERTY_PRODUCTID, buf, &sz);
3755 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
3756 ok(!lstrcmpA(buf, "id"), "Expected \"id\", got \"%s\"\n", buf);
3757 ok(sz == 2, "Expected 2, got %d\n", sz);
3759 res = RegSetValueExA(propkey, "RegCompany", 0, REG_SZ, (LPBYTE)"comp", 5);
3760 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
3762 /* RegCompany value exists */
3764 lstrcpyA(buf, "apple");
3765 r = pMsiGetProductInfoExA(prodcode, usersid,
3766 MSIINSTALLCONTEXT_USERUNMANAGED,
3767 INSTALLPROPERTY_REGCOMPANY, buf, &sz);
3768 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
3769 ok(!lstrcmpA(buf, "comp"), "Expected \"comp\", got \"%s\"\n", buf);
3770 ok(sz == 4, "Expected 4, got %d\n", sz);
3772 res = RegSetValueExA(propkey, "RegOwner", 0, REG_SZ, (LPBYTE)"owner", 6);
3773 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
3775 /* RegOwner value exists */
3777 lstrcpyA(buf, "apple");
3778 r = pMsiGetProductInfoExA(prodcode, usersid,
3779 MSIINSTALLCONTEXT_USERUNMANAGED,
3780 INSTALLPROPERTY_REGOWNER, buf, &sz);
3781 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
3782 ok(!lstrcmpA(buf, "owner"), "Expected \"owner\", got \"%s\"\n", buf);
3783 ok(sz == 5, "Expected 5, got %d\n", sz);
3785 res = RegSetValueExA(propkey, "Transforms", 0, REG_SZ, (LPBYTE)"trans", 6);
3786 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
3788 /* Transforms value exists */
3790 lstrcpyA(buf, "apple");
3791 r = pMsiGetProductInfoExA(prodcode, usersid,
3792 MSIINSTALLCONTEXT_USERUNMANAGED,
3793 INSTALLPROPERTY_TRANSFORMS, buf, &sz);
3794 ok(r == ERROR_UNKNOWN_PRODUCT,
3795 "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r);
3796 ok(!lstrcmpA(buf, "apple"), "Expected buf to be unchanged, got %s\n", buf);
3797 ok(sz == MAX_PATH, "Expected MAX_PATH, got %d\n", sz);
3799 res = RegSetValueExA(propkey, "Language", 0, REG_SZ, (LPBYTE)"lang", 5);
3800 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
3802 /* Language value exists */
3804 lstrcpyA(buf, "apple");
3805 r = pMsiGetProductInfoExA(prodcode, usersid,
3806 MSIINSTALLCONTEXT_USERUNMANAGED,
3807 INSTALLPROPERTY_LANGUAGE, buf, &sz);
3808 ok(r == ERROR_UNKNOWN_PRODUCT,
3809 "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r);
3810 ok(!lstrcmpA(buf, "apple"), "Expected buf to be unchanged, got %s\n", buf);
3811 ok(sz == MAX_PATH, "Expected MAX_PATH, got %d\n", sz);
3813 res = RegSetValueExA(propkey, "ProductName", 0, REG_SZ, (LPBYTE)"name", 5);
3814 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
3816 /* ProductName value exists */
3818 lstrcpyA(buf, "apple");
3819 r = pMsiGetProductInfoExA(prodcode, usersid,
3820 MSIINSTALLCONTEXT_USERUNMANAGED,
3821 INSTALLPROPERTY_PRODUCTNAME, buf, &sz);
3822 ok(r == ERROR_UNKNOWN_PRODUCT,
3823 "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r);
3824 ok(!lstrcmpA(buf, "apple"), "Expected buf to be unchanged, got %s\n", buf);
3825 ok(sz == MAX_PATH, "Expected MAX_PATH, got %d\n", sz);
3827 res = RegSetValueExA(propkey, "AssignmentType", 0, REG_SZ, (LPBYTE)"type", 5);
3828 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
3832 /* AssignmentType value exists */
3834 lstrcpyA(buf, "apple");
3835 r = pMsiGetProductInfoExA(prodcode, usersid,
3836 MSIINSTALLCONTEXT_USERUNMANAGED,
3837 INSTALLPROPERTY_ASSIGNMENTTYPE, buf, &sz);
3838 ok(r == ERROR_UNKNOWN_PRODUCT,
3839 "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r);
3840 ok(!lstrcmpA(buf, "apple"), "Expected buf to be unchanged, got %s\n", buf);
3841 ok(sz == MAX_PATH, "Expected MAX_PATH, got %d\n", sz);
3843 res = RegSetValueExA(propkey, "PackageCode", 0, REG_SZ, (LPBYTE)"code", 5);
3844 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
3846 /* PackageCode value exists */
3848 lstrcpyA(buf, "apple");
3849 r = pMsiGetProductInfoExA(prodcode, usersid,
3850 MSIINSTALLCONTEXT_USERUNMANAGED,
3851 INSTALLPROPERTY_PACKAGECODE, buf, &sz);
3852 ok(r == ERROR_UNKNOWN_PRODUCT,
3853 "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r);
3854 ok(!lstrcmpA(buf, "apple"), "Expected buf to be unchanged, got %s\n", buf);
3855 ok(sz == MAX_PATH, "Expected MAX_PATH, got %d\n", sz);
3857 res = RegSetValueExA(propkey, "Version", 0, REG_SZ, (LPBYTE)"ver", 4);
3858 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
3860 /* Version value exists */
3862 lstrcpyA(buf, "apple");
3863 r = pMsiGetProductInfoExA(prodcode, usersid,
3864 MSIINSTALLCONTEXT_USERUNMANAGED,
3865 INSTALLPROPERTY_VERSION, buf, &sz);
3866 ok(r == ERROR_UNKNOWN_PRODUCT,
3867 "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r);
3868 ok(!lstrcmpA(buf, "apple"), "Expected buf to be unchanged, got %s\n", buf);
3869 ok(sz == MAX_PATH, "Expected MAX_PATH, got %d\n", sz);
3871 res = RegSetValueExA(propkey, "ProductIcon", 0, REG_SZ, (LPBYTE)"icon", 5);
3872 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
3874 /* ProductIcon value exists */
3876 lstrcpyA(buf, "apple");
3877 r = pMsiGetProductInfoExA(prodcode, usersid,
3878 MSIINSTALLCONTEXT_USERUNMANAGED,
3879 INSTALLPROPERTY_PRODUCTICON, buf, &sz);
3880 ok(r == ERROR_UNKNOWN_PRODUCT,
3881 "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r);
3882 ok(!lstrcmpA(buf, "apple"), "Expected buf to be unchanged, got %s\n", buf);
3883 ok(sz == MAX_PATH, "Expected MAX_PATH, got %d\n", sz);
3885 res = RegSetValueExA(propkey, "PackageName", 0, REG_SZ, (LPBYTE)"name", 5);
3886 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
3888 /* PackageName value exists */
3890 lstrcpyA(buf, "apple");
3891 r = pMsiGetProductInfoExA(prodcode, usersid,
3892 MSIINSTALLCONTEXT_USERUNMANAGED,
3893 INSTALLPROPERTY_PACKAGENAME, buf, &sz);
3894 ok(r == ERROR_UNKNOWN_PRODUCT,
3895 "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r);
3896 ok(!lstrcmpA(buf, "apple"), "Expected buf to be unchanged, got %s\n", buf);
3897 ok(sz == MAX_PATH, "Expected MAX_PATH, got %d\n", sz);
3899 res = RegSetValueExA(propkey, "AuthorizedLUAApp", 0, REG_SZ, (LPBYTE)"auth", 5);
3900 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
3902 /* AuthorizedLUAApp value exists */
3904 lstrcpyA(buf, "apple");
3905 r = pMsiGetProductInfoExA(prodcode, usersid,
3906 MSIINSTALLCONTEXT_USERUNMANAGED,
3907 INSTALLPROPERTY_AUTHORIZED_LUA_APP, buf, &sz);
3908 ok(r == ERROR_UNKNOWN_PRODUCT,
3909 "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r);
3910 ok(!lstrcmpA(buf, "apple"), "Expected buf to be unchanged, got %s\n", buf);
3911 ok(sz == MAX_PATH, "Expected MAX_PATH, got %d\n", sz);
3913 RegDeleteValueA(propkey, "AuthorizedLUAApp");
3914 RegDeleteValueA(propkey, "PackageName");
3915 RegDeleteValueA(propkey, "ProductIcon");
3916 RegDeleteValueA(propkey, "Version");
3917 RegDeleteValueA(propkey, "PackageCode");
3918 RegDeleteValueA(propkey, "AssignmentType");
3919 RegDeleteValueA(propkey, "ProductName");
3920 RegDeleteValueA(propkey, "Language");
3921 RegDeleteValueA(propkey, "Transforms");
3922 RegDeleteValueA(propkey, "RegOwner");
3923 RegDeleteValueA(propkey, "RegCompany");
3924 RegDeleteValueA(propkey, "ProductID");
3925 RegDeleteValueA(propkey, "DisplayVersion");
3926 RegDeleteValueA(propkey, "VersionMajor");
3927 RegDeleteValueA(propkey, "VersionMinor");
3928 RegDeleteValueA(propkey, "URLUpdateInfo");
3929 RegDeleteValueA(propkey, "URLInfoAbout");
3930 RegDeleteValueA(propkey, "Publisher");
3931 RegDeleteValueA(propkey, "LocalPackage");
3932 RegDeleteValueA(propkey, "InstallSource");
3933 RegDeleteValueA(propkey, "InstallLocation");
3934 RegDeleteValueA(propkey, "DisplayName");
3935 RegDeleteValueA(propkey, "InstallDate");
3936 RegDeleteValueA(propkey, "HelpTelephone");
3937 RegDeleteValueA(propkey, "HelpLink");
3938 RegDeleteValueA(propkey, "LocalPackage");
3939 RegDeleteKeyA(propkey, "");
3940 RegCloseKey(propkey);
3941 RegDeleteKeyA(localkey, "");
3942 RegCloseKey(localkey);
3944 lstrcpyA(keypath, "Software\\Microsoft\\Windows\\CurrentVersion\\Installer\\Managed\\");
3945 lstrcatA(keypath, usersid);
3946 lstrcatA(keypath, "\\Installer\\Products\\");
3947 lstrcatA(keypath, prod_squashed);
3949 res = RegCreateKeyA(HKEY_LOCAL_MACHINE, keypath, &userkey);
3950 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
3952 /* user product key exists */
3954 lstrcpyA(buf, "apple");
3955 r = pMsiGetProductInfoExA(prodcode, usersid,
3956 MSIINSTALLCONTEXT_USERUNMANAGED,
3957 INSTALLPROPERTY_PRODUCTSTATE, buf, &sz);
3958 ok(r == ERROR_UNKNOWN_PRODUCT,
3959 "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r);
3960 ok(!lstrcmpA(buf, "apple"), "Expected buf to be unchanged, got %s\n", buf);
3961 ok(sz == MAX_PATH, "Expected MAX_PATH, got %d\n", sz);
3963 RegDeleteKeyA(userkey, "");
3964 RegCloseKey(userkey);
3966 lstrcpyA(keypath, "Software\\Microsoft\\Installer\\Products\\");
3967 lstrcatA(keypath, prod_squashed);
3969 res = RegCreateKeyA(HKEY_CURRENT_USER, keypath, &prodkey);
3970 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
3973 lstrcpyA(buf, "apple");
3974 r = pMsiGetProductInfoExA(prodcode, usersid,
3975 MSIINSTALLCONTEXT_USERUNMANAGED,
3976 INSTALLPROPERTY_PRODUCTSTATE, buf, &sz);
3977 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
3978 ok(!lstrcmpA(buf, "1"), "Expected \"1\", got \"%s\"\n", buf);
3979 ok(sz == 1, "Expected 1, got %d\n", sz);
3981 res = RegSetValueExA(prodkey, "HelpLink", 0, REG_SZ, (LPBYTE)"link", 5);
3982 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
3984 /* HelpLink value exists */
3986 lstrcpyA(buf, "apple");
3987 r = pMsiGetProductInfoExA(prodcode, usersid,
3988 MSIINSTALLCONTEXT_USERUNMANAGED,
3989 INSTALLPROPERTY_HELPLINK, buf, &sz);
3990 ok(r == ERROR_UNKNOWN_PROPERTY,
3991 "Expected ERROR_UNKNOWN_PROPERTY, got %d\n", r);
3992 ok(!lstrcmpA(buf, "apple"), "Expected buf to be unchanged, got %s\n", buf);
3993 ok(sz == MAX_PATH, "Expected MAX_PATH, got %d\n", sz);
3995 res = RegSetValueExA(prodkey, "HelpTelephone", 0, REG_SZ, (LPBYTE)"phone", 6);
3996 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
3998 /* HelpTelephone value exists */
4000 lstrcpyA(buf, "apple");
4001 r = pMsiGetProductInfoExA(prodcode, usersid,
4002 MSIINSTALLCONTEXT_USERUNMANAGED,
4003 INSTALLPROPERTY_HELPTELEPHONE, buf, &sz);
4004 ok(r == ERROR_UNKNOWN_PROPERTY,
4005 "Expected ERROR_UNKNOWN_PROPERTY, got %d\n", r);
4006 ok(!lstrcmpA(buf, "apple"), "Expected buf to be unchanged, got %s\n", buf);
4007 ok(sz == MAX_PATH, "Expected MAX_PATH, got %d\n", sz);
4009 res = RegSetValueExA(prodkey, "InstallDate", 0, REG_SZ, (LPBYTE)"date", 5);
4010 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
4012 /* InstallDate value exists */
4014 lstrcpyA(buf, "apple");
4015 r = pMsiGetProductInfoExA(prodcode, usersid,
4016 MSIINSTALLCONTEXT_USERUNMANAGED,
4017 INSTALLPROPERTY_INSTALLDATE, buf, &sz);
4018 ok(r == ERROR_UNKNOWN_PROPERTY,
4019 "Expected ERROR_UNKNOWN_PROPERTY, got %d\n", r);
4020 ok(!lstrcmpA(buf, "apple"), "Expected buf to be unchanged, got %s\n", buf);
4021 ok(sz == MAX_PATH, "Expected MAX_PATH, got %d\n", sz);
4023 res = RegSetValueExA(prodkey, "DisplayName", 0, REG_SZ, (LPBYTE)"name", 5);
4024 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
4026 /* DisplayName value exists */
4028 lstrcpyA(buf, "apple");
4029 r = pMsiGetProductInfoExA(prodcode, usersid,
4030 MSIINSTALLCONTEXT_USERUNMANAGED,
4031 INSTALLPROPERTY_INSTALLEDPRODUCTNAME, buf, &sz);
4032 ok(r == ERROR_UNKNOWN_PROPERTY,
4033 "Expected ERROR_UNKNOWN_PROPERTY, got %d\n", r);
4034 ok(!lstrcmpA(buf, "apple"), "Expected buf to be unchanged, got %s\n", buf);
4035 ok(sz == MAX_PATH, "Expected MAX_PATH, got %d\n", sz);
4037 res = RegSetValueExA(prodkey, "InstallLocation", 0, REG_SZ, (LPBYTE)"loc", 4);
4038 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
4040 /* InstallLocation value exists */
4042 lstrcpyA(buf, "apple");
4043 r = pMsiGetProductInfoExA(prodcode, usersid,
4044 MSIINSTALLCONTEXT_USERUNMANAGED,
4045 INSTALLPROPERTY_INSTALLLOCATION, buf, &sz);
4046 ok(r == ERROR_UNKNOWN_PROPERTY,
4047 "Expected ERROR_UNKNOWN_PROPERTY, got %d\n", r);
4048 ok(!lstrcmpA(buf, "apple"), "Expected buf to be unchanged, got %s\n", buf);
4049 ok(sz == MAX_PATH, "Expected MAX_PATH, got %d\n", sz);
4051 res = RegSetValueExA(prodkey, "InstallSource", 0, REG_SZ, (LPBYTE)"source", 7);
4052 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
4054 /* InstallSource value exists */
4056 lstrcpyA(buf, "apple");
4057 r = pMsiGetProductInfoExA(prodcode, usersid,
4058 MSIINSTALLCONTEXT_USERUNMANAGED,
4059 INSTALLPROPERTY_INSTALLSOURCE, buf, &sz);
4060 ok(r == ERROR_UNKNOWN_PROPERTY,
4061 "Expected ERROR_UNKNOWN_PROPERTY, got %d\n", r);
4062 ok(!lstrcmpA(buf, "apple"), "Expected buf to be unchanged, got %s\n", buf);
4063 ok(sz == MAX_PATH, "Expected MAX_PATH, got %d\n", sz);
4065 res = RegSetValueExA(prodkey, "LocalPackage", 0, REG_SZ, (LPBYTE)"local", 6);
4066 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
4068 /* LocalPackage value exists */
4070 lstrcpyA(buf, "apple");
4071 r = pMsiGetProductInfoExA(prodcode, usersid,
4072 MSIINSTALLCONTEXT_USERUNMANAGED,
4073 INSTALLPROPERTY_LOCALPACKAGE, buf, &sz);
4074 ok(r == ERROR_UNKNOWN_PROPERTY,
4075 "Expected ERROR_UNKNOWN_PROPERTY, got %d\n", r);
4076 ok(!lstrcmpA(buf, "apple"), "Expected buf to be unchanged, got %s\n", buf);
4077 ok(sz == MAX_PATH, "Expected MAX_PATH, got %d\n", sz);
4079 res = RegSetValueExA(prodkey, "Publisher", 0, REG_SZ, (LPBYTE)"pub", 4);
4080 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
4082 /* Publisher value exists */
4084 lstrcpyA(buf, "apple");
4085 r = pMsiGetProductInfoExA(prodcode, usersid,
4086 MSIINSTALLCONTEXT_USERUNMANAGED,
4087 INSTALLPROPERTY_PUBLISHER, buf, &sz);
4088 ok(r == ERROR_UNKNOWN_PROPERTY,
4089 "Expected ERROR_UNKNOWN_PROPERTY, got %d\n", r);
4090 ok(!lstrcmpA(buf, "apple"), "Expected buf to be unchanged, got %s\n", buf);
4091 ok(sz == MAX_PATH, "Expected MAX_PATH, got %d\n", sz);
4093 res = RegSetValueExA(prodkey, "URLInfoAbout", 0, REG_SZ, (LPBYTE)"about", 6);
4094 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
4096 /* URLInfoAbout value exists */
4098 lstrcpyA(buf, "apple");
4099 r = pMsiGetProductInfoExA(prodcode, usersid,
4100 MSIINSTALLCONTEXT_USERUNMANAGED,
4101 INSTALLPROPERTY_URLINFOABOUT, buf, &sz);
4102 ok(r == ERROR_UNKNOWN_PROPERTY,
4103 "Expected ERROR_UNKNOWN_PROPERTY, got %d\n", r);
4104 ok(!lstrcmpA(buf, "apple"), "Expected buf to be unchanged, got %s\n", buf);
4105 ok(sz == MAX_PATH, "Expected MAX_PATH, got %d\n", sz);
4107 res = RegSetValueExA(prodkey, "URLUpdateInfo", 0, REG_SZ, (LPBYTE)"update", 7);
4108 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
4110 /* URLUpdateInfo value exists */
4112 lstrcpyA(buf, "apple");
4113 r = pMsiGetProductInfoExA(prodcode, usersid,
4114 MSIINSTALLCONTEXT_USERUNMANAGED,
4115 INSTALLPROPERTY_URLUPDATEINFO, buf, &sz);
4116 ok(r == ERROR_UNKNOWN_PROPERTY,
4117 "Expected ERROR_UNKNOWN_PROPERTY, got %d\n", r);
4118 ok(!lstrcmpA(buf, "apple"), "Expected buf to be unchanged, got %s\n", buf);
4119 ok(sz == MAX_PATH, "Expected MAX_PATH, got %d\n", sz);
4121 res = RegSetValueExA(prodkey, "VersionMinor", 0, REG_SZ, (LPBYTE)"2", 2);
4122 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
4124 /* VersionMinor value exists */
4126 lstrcpyA(buf, "apple");
4127 r = pMsiGetProductInfoExA(prodcode, usersid,
4128 MSIINSTALLCONTEXT_USERUNMANAGED,
4129 INSTALLPROPERTY_VERSIONMINOR, buf, &sz);
4130 ok(r == ERROR_UNKNOWN_PROPERTY,
4131 "Expected ERROR_UNKNOWN_PROPERTY, got %d\n", r);
4132 ok(!lstrcmpA(buf, "apple"), "Expected buf to be unchanged, got %s\n", buf);
4133 ok(sz == MAX_PATH, "Expected MAX_PATH, got %d\n", sz);
4135 res = RegSetValueExA(prodkey, "VersionMajor", 0, REG_SZ, (LPBYTE)"3", 2);
4136 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
4138 /* VersionMajor value exists */
4140 lstrcpyA(buf, "apple");
4141 r = pMsiGetProductInfoExA(prodcode, usersid,
4142 MSIINSTALLCONTEXT_USERUNMANAGED,
4143 INSTALLPROPERTY_VERSIONMAJOR, buf, &sz);
4144 ok(r == ERROR_UNKNOWN_PROPERTY,
4145 "Expected ERROR_UNKNOWN_PROPERTY, got %d\n", r);
4146 ok(!lstrcmpA(buf, "apple"), "Expected buf to be unchanged, got %s\n", buf);
4147 ok(sz == MAX_PATH, "Expected MAX_PATH, got %d\n", sz);
4149 res = RegSetValueExA(prodkey, "DisplayVersion", 0, REG_SZ, (LPBYTE)"3.2.1", 6);
4150 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
4152 /* DisplayVersion value exists */
4154 lstrcpyA(buf, "apple");
4155 r = pMsiGetProductInfoExA(prodcode, usersid,
4156 MSIINSTALLCONTEXT_USERUNMANAGED,
4157 INSTALLPROPERTY_VERSIONSTRING, buf, &sz);
4158 ok(r == ERROR_UNKNOWN_PROPERTY,
4159 "Expected ERROR_UNKNOWN_PROPERTY, got %d\n", r);
4160 ok(!lstrcmpA(buf, "apple"), "Expected buf to be unchanged, got %s\n", buf);
4161 ok(sz == MAX_PATH, "Expected MAX_PATH, got %d\n", sz);
4163 res = RegSetValueExA(prodkey, "ProductID", 0, REG_SZ, (LPBYTE)"id", 3);
4164 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
4166 /* ProductID value exists */
4168 lstrcpyA(buf, "apple");
4169 r = pMsiGetProductInfoExA(prodcode, usersid,
4170 MSIINSTALLCONTEXT_USERUNMANAGED,
4171 INSTALLPROPERTY_PRODUCTID, buf, &sz);
4172 ok(r == ERROR_UNKNOWN_PROPERTY,
4173 "Expected ERROR_UNKNOWN_PROPERTY, got %d\n", r);
4174 ok(!lstrcmpA(buf, "apple"), "Expected buf to be unchanged, got %s\n", buf);
4175 ok(sz == MAX_PATH, "Expected MAX_PATH, got %d\n", sz);
4177 res = RegSetValueExA(prodkey, "RegCompany", 0, REG_SZ, (LPBYTE)"comp", 5);
4178 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
4180 /* RegCompany value exists */
4182 lstrcpyA(buf, "apple");
4183 r = pMsiGetProductInfoExA(prodcode, usersid,
4184 MSIINSTALLCONTEXT_USERUNMANAGED,
4185 INSTALLPROPERTY_REGCOMPANY, buf, &sz);
4186 ok(r == ERROR_UNKNOWN_PROPERTY,
4187 "Expected ERROR_UNKNOWN_PROPERTY, got %d\n", r);
4188 ok(!lstrcmpA(buf, "apple"), "Expected buf to be unchanged, got %s\n", buf);
4189 ok(sz == MAX_PATH, "Expected MAX_PATH, got %d\n", sz);
4191 res = RegSetValueExA(prodkey, "RegOwner", 0, REG_SZ, (LPBYTE)"owner", 6);
4192 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
4194 /* RegOwner value exists */
4196 lstrcpyA(buf, "apple");
4197 r = pMsiGetProductInfoExA(prodcode, usersid,
4198 MSIINSTALLCONTEXT_USERUNMANAGED,
4199 INSTALLPROPERTY_REGOWNER, buf, &sz);
4200 ok(r == ERROR_UNKNOWN_PROPERTY,
4201 "Expected ERROR_UNKNOWN_PROPERTY, got %d\n", r);
4202 ok(!lstrcmpA(buf, "apple"), "Expected buf to be unchanged, got %s\n", buf);
4203 ok(sz == MAX_PATH, "Expected MAX_PATH, got %d\n", sz);
4205 res = RegSetValueExA(prodkey, "Transforms", 0, REG_SZ, (LPBYTE)"trans", 6);
4206 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
4208 /* Transforms value exists */
4210 lstrcpyA(buf, "apple");
4211 r = pMsiGetProductInfoExA(prodcode, usersid,
4212 MSIINSTALLCONTEXT_USERUNMANAGED,
4213 INSTALLPROPERTY_TRANSFORMS, buf, &sz);
4214 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
4215 ok(!lstrcmpA(buf, "trans"), "Expected \"trans\", got \"%s\"\n", buf);
4216 ok(sz == 5, "Expected 5, got %d\n", sz);
4218 res = RegSetValueExA(prodkey, "Language", 0, REG_SZ, (LPBYTE)"lang", 5);
4219 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
4221 /* Language value exists */
4223 lstrcpyA(buf, "apple");
4224 r = pMsiGetProductInfoExA(prodcode, usersid,
4225 MSIINSTALLCONTEXT_USERUNMANAGED,
4226 INSTALLPROPERTY_LANGUAGE, buf, &sz);
4227 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
4228 ok(!lstrcmpA(buf, "lang"), "Expected \"lang\", got \"%s\"\n", buf);
4229 ok(sz == 4, "Expected 4, got %d\n", sz);
4231 res = RegSetValueExA(prodkey, "ProductName", 0, REG_SZ, (LPBYTE)"name", 5);
4232 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
4234 /* ProductName value exists */
4236 lstrcpyA(buf, "apple");
4237 r = pMsiGetProductInfoExA(prodcode, usersid,
4238 MSIINSTALLCONTEXT_USERUNMANAGED,
4239 INSTALLPROPERTY_PRODUCTNAME, buf, &sz);
4240 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
4241 ok(!lstrcmpA(buf, "name"), "Expected \"name\", got \"%s\"\n", buf);
4242 ok(sz == 4, "Expected 4, got %d\n", sz);
4244 res = RegSetValueExA(prodkey, "AssignmentType", 0, REG_SZ, (LPBYTE)"type", 5);
4245 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
4249 /* AssignmentType value exists */
4251 lstrcpyA(buf, "apple");
4252 r = pMsiGetProductInfoExA(prodcode, usersid,
4253 MSIINSTALLCONTEXT_USERUNMANAGED,
4254 INSTALLPROPERTY_ASSIGNMENTTYPE, buf, &sz);
4255 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
4256 ok(!lstrcmpA(buf, ""), "Expected \"\", got \"%s\"\n", buf);
4257 ok(sz == 0, "Expected 0, got %d\n", sz);
4259 res = RegSetValueExA(prodkey, "PackageCode", 0, REG_SZ, (LPBYTE)"code", 5);
4260 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
4264 /* PackageCode value exists */
4266 lstrcpyA(buf, "apple");
4267 r = pMsiGetProductInfoExA(prodcode, usersid,
4268 MSIINSTALLCONTEXT_USERUNMANAGED,
4269 INSTALLPROPERTY_PACKAGECODE, buf, &sz);
4272 ok(r == ERROR_BAD_CONFIGURATION,
4273 "Expected ERROR_BAD_CONFIGURATION, got %d\n", r);
4274 ok(!lstrcmpA(buf, "apple"), "Expected buf to be unchanged, got %s\n", buf);
4275 ok(sz == MAX_PATH, "Expected MAX_PATH, got %d\n", sz);
4278 res = RegSetValueExA(prodkey, "Version", 0, REG_SZ, (LPBYTE)"ver", 4);
4279 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
4281 /* Version value exists */
4283 lstrcpyA(buf, "apple");
4284 r = pMsiGetProductInfoExA(prodcode, usersid,
4285 MSIINSTALLCONTEXT_USERUNMANAGED,
4286 INSTALLPROPERTY_VERSION, buf, &sz);
4287 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
4288 ok(!lstrcmpA(buf, "ver"), "Expected \"ver\", got \"%s\"\n", buf);
4289 ok(sz == 3, "Expected 3, got %d\n", sz);
4291 res = RegSetValueExA(prodkey, "ProductIcon", 0, REG_SZ, (LPBYTE)"icon", 5);
4292 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
4294 /* ProductIcon value exists */
4296 lstrcpyA(buf, "apple");
4297 r = pMsiGetProductInfoExA(prodcode, usersid,
4298 MSIINSTALLCONTEXT_USERUNMANAGED,
4299 INSTALLPROPERTY_PRODUCTICON, buf, &sz);
4300 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
4301 ok(!lstrcmpA(buf, "icon"), "Expected \"icon\", got \"%s\"\n", buf);
4302 ok(sz == 4, "Expected 4, got %d\n", sz);
4304 res = RegSetValueExA(prodkey, "PackageName", 0, REG_SZ, (LPBYTE)"name", 5);
4305 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
4307 /* PackageName value exists */
4309 lstrcpyA(buf, "apple");
4310 r = pMsiGetProductInfoExA(prodcode, usersid,
4311 MSIINSTALLCONTEXT_USERUNMANAGED,
4312 INSTALLPROPERTY_PACKAGENAME, buf, &sz);
4315 ok(r == ERROR_UNKNOWN_PRODUCT,
4316 "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r);
4317 ok(!lstrcmpA(buf, "apple"), "Expected buf to be unchanged, got %s\n", buf);
4318 ok(sz == MAX_PATH, "Expected MAX_PATH, got %d\n", sz);
4321 res = RegSetValueExA(prodkey, "AuthorizedLUAApp", 0, REG_SZ, (LPBYTE)"auth", 5);
4322 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
4324 /* AuthorizedLUAApp value exists */
4326 lstrcpyA(buf, "apple");
4327 r = pMsiGetProductInfoExA(prodcode, usersid,
4328 MSIINSTALLCONTEXT_USERUNMANAGED,
4329 INSTALLPROPERTY_AUTHORIZED_LUA_APP, buf, &sz);
4330 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
4331 ok(!lstrcmpA(buf, "auth"), "Expected \"auth\", got \"%s\"\n", buf);
4332 ok(sz == 4, "Expected 4, got %d\n", sz);
4334 RegDeleteValueA(prodkey, "AuthorizedLUAApp");
4335 RegDeleteValueA(prodkey, "PackageName");
4336 RegDeleteValueA(prodkey, "ProductIcon");
4337 RegDeleteValueA(prodkey, "Version");
4338 RegDeleteValueA(prodkey, "PackageCode");
4339 RegDeleteValueA(prodkey, "AssignmentType");
4340 RegDeleteValueA(prodkey, "ProductName");
4341 RegDeleteValueA(prodkey, "Language");
4342 RegDeleteValueA(prodkey, "Transforms");
4343 RegDeleteValueA(prodkey, "RegOwner");
4344 RegDeleteValueA(prodkey, "RegCompany");
4345 RegDeleteValueA(prodkey, "ProductID");
4346 RegDeleteValueA(prodkey, "DisplayVersion");
4347 RegDeleteValueA(prodkey, "VersionMajor");
4348 RegDeleteValueA(prodkey, "VersionMinor");
4349 RegDeleteValueA(prodkey, "URLUpdateInfo");
4350 RegDeleteValueA(prodkey, "URLInfoAbout");
4351 RegDeleteValueA(prodkey, "Publisher");
4352 RegDeleteValueA(prodkey, "LocalPackage");
4353 RegDeleteValueA(prodkey, "InstallSource");
4354 RegDeleteValueA(prodkey, "InstallLocation");
4355 RegDeleteValueA(prodkey, "DisplayName");
4356 RegDeleteValueA(prodkey, "InstallDate");
4357 RegDeleteValueA(prodkey, "HelpTelephone");
4358 RegDeleteValueA(prodkey, "HelpLink");
4359 RegDeleteValueA(prodkey, "LocalPackage");
4360 RegDeleteKeyA(prodkey, "");
4361 RegCloseKey(prodkey);
4363 /* MSIINSTALLCONTEXT_USERMANAGED */
4365 lstrcpyA(keypath, "Software\\Microsoft\\Windows\\CurrentVersion\\Installer\\UserData\\");
4366 lstrcatA(keypath, usersid);
4367 lstrcatA(keypath, "\\Products\\");
4368 lstrcatA(keypath, prod_squashed);
4370 res = RegCreateKeyA(HKEY_LOCAL_MACHINE, keypath, &localkey);
4371 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
4373 /* local user product key exists */
4375 lstrcpyA(buf, "apple");
4376 r = pMsiGetProductInfoExA(prodcode, usersid,
4377 MSIINSTALLCONTEXT_USERMANAGED,
4378 INSTALLPROPERTY_PRODUCTSTATE, buf, &sz);
4379 ok(r == ERROR_UNKNOWN_PRODUCT,
4380 "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r);
4381 ok(!lstrcmpA(buf, "apple"), "Expected buf to be unchanged, got %s\n", buf);
4382 ok(sz == MAX_PATH, "Expected MAX_PATH, got %d\n", sz);
4384 res = RegCreateKeyA(localkey, "InstallProperties", &propkey);
4385 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
4387 /* InstallProperties key exists */
4389 lstrcpyA(buf, "apple");
4390 r = pMsiGetProductInfoExA(prodcode, usersid,
4391 MSIINSTALLCONTEXT_USERMANAGED,
4392 INSTALLPROPERTY_PRODUCTSTATE, buf, &sz);
4393 ok(r == ERROR_UNKNOWN_PRODUCT,
4394 "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r);
4395 ok(!lstrcmpA(buf, "apple"), "Expected buf to be unchanged, got %s\n", buf);
4396 ok(sz == MAX_PATH, "Expected MAX_PATH, got %d\n", sz);
4398 res = RegSetValueExA(propkey, "ManagedLocalPackage", 0, REG_SZ, (LPBYTE)"local", 6);
4399 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
4401 /* ManagedLocalPackage value exists */
4403 lstrcpyA(buf, "apple");
4404 r = pMsiGetProductInfoExA(prodcode, usersid,
4405 MSIINSTALLCONTEXT_USERMANAGED,
4406 INSTALLPROPERTY_PRODUCTSTATE, buf, &sz);
4407 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
4408 ok(!lstrcmpA(buf, "5"), "Expected \"5\", got \"%s\"\n", buf);
4409 ok(sz == 1, "Expected 1, got %d\n", sz);
4411 res = RegSetValueExA(propkey, "HelpLink", 0, REG_SZ, (LPBYTE)"link", 5);
4412 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
4414 /* HelpLink value exists */
4416 lstrcpyA(buf, "apple");
4417 r = pMsiGetProductInfoExA(prodcode, usersid,
4418 MSIINSTALLCONTEXT_USERMANAGED,
4419 INSTALLPROPERTY_HELPLINK, buf, &sz);
4420 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
4421 ok(!lstrcmpA(buf, "link"), "Expected \"link\", got \"%s\"\n", buf);
4422 ok(sz == 4, "Expected 4, got %d\n", sz);
4424 res = RegSetValueExA(propkey, "HelpTelephone", 0, REG_SZ, (LPBYTE)"phone", 6);
4425 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
4427 /* HelpTelephone value exists */
4429 lstrcpyA(buf, "apple");
4430 r = pMsiGetProductInfoExA(prodcode, usersid,
4431 MSIINSTALLCONTEXT_USERMANAGED,
4432 INSTALLPROPERTY_HELPTELEPHONE, buf, &sz);
4433 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
4434 ok(!lstrcmpA(buf, "phone"), "Expected \"phone\", got \"%s\"\n", buf);
4435 ok(sz == 5, "Expected 5, got %d\n", sz);
4437 res = RegSetValueExA(propkey, "InstallDate", 0, REG_SZ, (LPBYTE)"date", 5);
4438 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
4440 /* InstallDate value exists */
4442 lstrcpyA(buf, "apple");
4443 r = pMsiGetProductInfoExA(prodcode, usersid,
4444 MSIINSTALLCONTEXT_USERMANAGED,
4445 INSTALLPROPERTY_INSTALLDATE, buf, &sz);
4446 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
4447 ok(!lstrcmpA(buf, "date"), "Expected \"date\", got \"%s\"\n", buf);
4448 ok(sz == 4, "Expected 4, got %d\n", sz);
4450 res = RegSetValueExA(propkey, "DisplayName", 0, REG_SZ, (LPBYTE)"name", 5);
4451 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
4453 /* DisplayName value exists */
4455 lstrcpyA(buf, "apple");
4456 r = pMsiGetProductInfoExA(prodcode, usersid,
4457 MSIINSTALLCONTEXT_USERMANAGED,
4458 INSTALLPROPERTY_INSTALLEDPRODUCTNAME, buf, &sz);
4459 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
4460 ok(!lstrcmpA(buf, "name"), "Expected \"name\", got \"%s\"\n", buf);
4461 ok(sz == 4, "Expected 4, got %d\n", sz);
4463 res = RegSetValueExA(propkey, "InstallLocation", 0, REG_SZ, (LPBYTE)"loc", 4);
4464 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
4466 /* InstallLocation value exists */
4468 lstrcpyA(buf, "apple");
4469 r = pMsiGetProductInfoExA(prodcode, usersid,
4470 MSIINSTALLCONTEXT_USERMANAGED,
4471 INSTALLPROPERTY_INSTALLLOCATION, buf, &sz);
4472 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
4473 ok(!lstrcmpA(buf, "loc"), "Expected \"loc\", got \"%s\"\n", buf);
4474 ok(sz == 3, "Expected 3, got %d\n", sz);
4476 res = RegSetValueExA(propkey, "InstallSource", 0, REG_SZ, (LPBYTE)"source", 7);
4477 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
4479 /* InstallSource value exists */
4481 lstrcpyA(buf, "apple");
4482 r = pMsiGetProductInfoExA(prodcode, usersid,
4483 MSIINSTALLCONTEXT_USERMANAGED,
4484 INSTALLPROPERTY_INSTALLSOURCE, buf, &sz);
4485 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
4486 ok(!lstrcmpA(buf, "source"), "Expected \"source\", got \"%s\"\n", buf);
4487 ok(sz == 6, "Expected 6, got %d\n", sz);
4489 res = RegSetValueExA(propkey, "LocalPackage", 0, REG_SZ, (LPBYTE)"local", 6);
4490 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
4492 /* LocalPackage value exists */
4494 lstrcpyA(buf, "apple");
4495 r = pMsiGetProductInfoExA(prodcode, usersid,
4496 MSIINSTALLCONTEXT_USERMANAGED,
4497 INSTALLPROPERTY_LOCALPACKAGE, buf, &sz);
4498 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
4499 ok(!lstrcmpA(buf, "local"), "Expected \"local\", got \"%s\"\n", buf);
4500 ok(sz == 5, "Expected 5, got %d\n", sz);
4502 res = RegSetValueExA(propkey, "Publisher", 0, REG_SZ, (LPBYTE)"pub", 4);
4503 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
4505 /* Publisher value exists */
4507 lstrcpyA(buf, "apple");
4508 r = pMsiGetProductInfoExA(prodcode, usersid,
4509 MSIINSTALLCONTEXT_USERMANAGED,
4510 INSTALLPROPERTY_PUBLISHER, buf, &sz);
4511 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
4512 ok(!lstrcmpA(buf, "pub"), "Expected \"pub\", got \"%s\"\n", buf);
4513 ok(sz == 3, "Expected 3, got %d\n", sz);
4515 res = RegSetValueExA(propkey, "URLInfoAbout", 0, REG_SZ, (LPBYTE)"about", 6);
4516 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
4518 /* URLInfoAbout value exists */
4520 lstrcpyA(buf, "apple");
4521 r = pMsiGetProductInfoExA(prodcode, usersid,
4522 MSIINSTALLCONTEXT_USERMANAGED,
4523 INSTALLPROPERTY_URLINFOABOUT, buf, &sz);
4524 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
4525 ok(!lstrcmpA(buf, "about"), "Expected \"about\", got \"%s\"\n", buf);
4526 ok(sz == 5, "Expected 5, got %d\n", sz);
4528 res = RegSetValueExA(propkey, "URLUpdateInfo", 0, REG_SZ, (LPBYTE)"update", 7);
4529 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
4531 /* URLUpdateInfo value exists */
4533 lstrcpyA(buf, "apple");
4534 r = pMsiGetProductInfoExA(prodcode, usersid,
4535 MSIINSTALLCONTEXT_USERMANAGED,
4536 INSTALLPROPERTY_URLUPDATEINFO, buf, &sz);
4537 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
4538 ok(!lstrcmpA(buf, "update"), "Expected \"update\", got \"%s\"\n", buf);
4539 ok(sz == 6, "Expected 6, got %d\n", sz);
4541 res = RegSetValueExA(propkey, "VersionMinor", 0, REG_SZ, (LPBYTE)"2", 2);
4542 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
4544 /* VersionMinor value exists */
4546 lstrcpyA(buf, "apple");
4547 r = pMsiGetProductInfoExA(prodcode, usersid,
4548 MSIINSTALLCONTEXT_USERMANAGED,
4549 INSTALLPROPERTY_VERSIONMINOR, buf, &sz);
4550 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
4551 ok(!lstrcmpA(buf, "2"), "Expected \"2\", got \"%s\"\n", buf);
4552 ok(sz == 1, "Expected 1, got %d\n", sz);
4554 res = RegSetValueExA(propkey, "VersionMajor", 0, REG_SZ, (LPBYTE)"3", 2);
4555 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
4557 /* VersionMajor value exists */
4559 lstrcpyA(buf, "apple");
4560 r = pMsiGetProductInfoExA(prodcode, usersid,
4561 MSIINSTALLCONTEXT_USERMANAGED,
4562 INSTALLPROPERTY_VERSIONMAJOR, buf, &sz);
4563 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
4564 ok(!lstrcmpA(buf, "3"), "Expected \"3\", got \"%s\"\n", buf);
4565 ok(sz == 1, "Expected 1, got %d\n", sz);
4567 res = RegSetValueExA(propkey, "DisplayVersion", 0, REG_SZ, (LPBYTE)"3.2.1", 6);
4568 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
4570 /* DisplayVersion value exists */
4572 lstrcpyA(buf, "apple");
4573 r = pMsiGetProductInfoExA(prodcode, usersid,
4574 MSIINSTALLCONTEXT_USERMANAGED,
4575 INSTALLPROPERTY_VERSIONSTRING, buf, &sz);
4576 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
4577 ok(!lstrcmpA(buf, "3.2.1"), "Expected \"3.2.1\", got \"%s\"\n", buf);
4578 ok(sz == 5, "Expected 5, got %d\n", sz);
4580 res = RegSetValueExA(propkey, "ProductID", 0, REG_SZ, (LPBYTE)"id", 3);
4581 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
4583 /* ProductID value exists */
4585 lstrcpyA(buf, "apple");
4586 r = pMsiGetProductInfoExA(prodcode, usersid,
4587 MSIINSTALLCONTEXT_USERMANAGED,
4588 INSTALLPROPERTY_PRODUCTID, buf, &sz);
4589 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
4590 ok(!lstrcmpA(buf, "id"), "Expected \"id\", got \"%s\"\n", buf);
4591 ok(sz == 2, "Expected 2, got %d\n", sz);
4593 res = RegSetValueExA(propkey, "RegCompany", 0, REG_SZ, (LPBYTE)"comp", 5);
4594 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
4596 /* RegCompany value exists */
4598 lstrcpyA(buf, "apple");
4599 r = pMsiGetProductInfoExA(prodcode, usersid,
4600 MSIINSTALLCONTEXT_USERMANAGED,
4601 INSTALLPROPERTY_REGCOMPANY, buf, &sz);
4602 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
4603 ok(!lstrcmpA(buf, "comp"), "Expected \"comp\", got \"%s\"\n", buf);
4604 ok(sz == 4, "Expected 4, got %d\n", sz);
4606 res = RegSetValueExA(propkey, "RegOwner", 0, REG_SZ, (LPBYTE)"owner", 6);
4607 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
4609 /* RegOwner value exists */
4611 lstrcpyA(buf, "apple");
4612 r = pMsiGetProductInfoExA(prodcode, usersid,
4613 MSIINSTALLCONTEXT_USERMANAGED,
4614 INSTALLPROPERTY_REGOWNER, buf, &sz);
4615 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
4616 ok(!lstrcmpA(buf, "owner"), "Expected \"owner\", got \"%s\"\n", buf);
4617 ok(sz == 5, "Expected 5, got %d\n", sz);
4619 res = RegSetValueExA(propkey, "Transforms", 0, REG_SZ, (LPBYTE)"trans", 6);
4620 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
4622 /* Transforms value exists */
4624 lstrcpyA(buf, "apple");
4625 r = pMsiGetProductInfoExA(prodcode, usersid,
4626 MSIINSTALLCONTEXT_USERMANAGED,
4627 INSTALLPROPERTY_TRANSFORMS, buf, &sz);
4628 ok(r == ERROR_UNKNOWN_PRODUCT,
4629 "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r);
4630 ok(!lstrcmpA(buf, "apple"), "Expected buf to be unchanged, got %s\n", buf);
4631 ok(sz == MAX_PATH, "Expected MAX_PATH, got %d\n", sz);
4633 res = RegSetValueExA(propkey, "Language", 0, REG_SZ, (LPBYTE)"lang", 5);
4634 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
4636 /* Language value exists */
4638 lstrcpyA(buf, "apple");
4639 r = pMsiGetProductInfoExA(prodcode, usersid,
4640 MSIINSTALLCONTEXT_USERMANAGED,
4641 INSTALLPROPERTY_LANGUAGE, buf, &sz);
4642 ok(r == ERROR_UNKNOWN_PRODUCT,
4643 "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r);
4644 ok(!lstrcmpA(buf, "apple"), "Expected buf to be unchanged, got %s\n", buf);
4645 ok(sz == MAX_PATH, "Expected MAX_PATH, got %d\n", sz);
4647 res = RegSetValueExA(propkey, "ProductName", 0, REG_SZ, (LPBYTE)"name", 5);
4648 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
4650 /* ProductName value exists */
4652 lstrcpyA(buf, "apple");
4653 r = pMsiGetProductInfoExA(prodcode, usersid,
4654 MSIINSTALLCONTEXT_USERMANAGED,
4655 INSTALLPROPERTY_PRODUCTNAME, buf, &sz);
4656 ok(r == ERROR_UNKNOWN_PRODUCT,
4657 "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r);
4658 ok(!lstrcmpA(buf, "apple"), "Expected buf to be unchanged, got %s\n", buf);
4659 ok(sz == MAX_PATH, "Expected MAX_PATH, got %d\n", sz);
4661 res = RegSetValueExA(propkey, "AssignmentType", 0, REG_SZ, (LPBYTE)"type", 5);
4662 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
4666 /* AssignmentType value exists */
4668 lstrcpyA(buf, "apple");
4669 r = pMsiGetProductInfoExA(prodcode, usersid,
4670 MSIINSTALLCONTEXT_USERMANAGED,
4671 INSTALLPROPERTY_ASSIGNMENTTYPE, buf, &sz);
4672 ok(r == ERROR_UNKNOWN_PRODUCT,
4673 "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r);
4674 ok(!lstrcmpA(buf, "apple"), "Expected buf to be unchanged, got %s\n", buf);
4675 ok(sz == MAX_PATH, "Expected MAX_PATH, got %d\n", sz);
4677 res = RegSetValueExA(propkey, "PackageCode", 0, REG_SZ, (LPBYTE)"code", 5);
4678 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
4680 /* PackageCode value exists */
4682 lstrcpyA(buf, "apple");
4683 r = pMsiGetProductInfoExA(prodcode, usersid,
4684 MSIINSTALLCONTEXT_USERMANAGED,
4685 INSTALLPROPERTY_PACKAGECODE, buf, &sz);
4686 ok(r == ERROR_UNKNOWN_PRODUCT,
4687 "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r);
4688 ok(!lstrcmpA(buf, "apple"), "Expected buf to be unchanged, got %s\n", buf);
4689 ok(sz == MAX_PATH, "Expected MAX_PATH, got %d\n", sz);
4691 res = RegSetValueExA(propkey, "Version", 0, REG_SZ, (LPBYTE)"ver", 4);
4692 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
4694 /* Version value exists */
4696 lstrcpyA(buf, "apple");
4697 r = pMsiGetProductInfoExA(prodcode, usersid,
4698 MSIINSTALLCONTEXT_USERMANAGED,
4699 INSTALLPROPERTY_VERSION, buf, &sz);
4700 ok(r == ERROR_UNKNOWN_PRODUCT,
4701 "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r);
4702 ok(!lstrcmpA(buf, "apple"), "Expected buf to be unchanged, got %s\n", buf);
4703 ok(sz == MAX_PATH, "Expected MAX_PATH, got %d\n", sz);
4705 res = RegSetValueExA(propkey, "ProductIcon", 0, REG_SZ, (LPBYTE)"icon", 5);
4706 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
4708 /* ProductIcon value exists */
4710 lstrcpyA(buf, "apple");
4711 r = pMsiGetProductInfoExA(prodcode, usersid,
4712 MSIINSTALLCONTEXT_USERMANAGED,
4713 INSTALLPROPERTY_PRODUCTICON, buf, &sz);
4714 ok(r == ERROR_UNKNOWN_PRODUCT,
4715 "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r);
4716 ok(!lstrcmpA(buf, "apple"), "Expected buf to be unchanged, got %s\n", buf);
4717 ok(sz == MAX_PATH, "Expected MAX_PATH, got %d\n", sz);
4719 res = RegSetValueExA(propkey, "PackageName", 0, REG_SZ, (LPBYTE)"name", 5);
4720 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
4722 /* PackageName value exists */
4724 lstrcpyA(buf, "apple");
4725 r = pMsiGetProductInfoExA(prodcode, usersid,
4726 MSIINSTALLCONTEXT_USERMANAGED,
4727 INSTALLPROPERTY_PACKAGENAME, buf, &sz);
4728 ok(r == ERROR_UNKNOWN_PRODUCT,
4729 "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r);
4730 ok(!lstrcmpA(buf, "apple"), "Expected buf to be unchanged, got %s\n", buf);
4731 ok(sz == MAX_PATH, "Expected MAX_PATH, got %d\n", sz);
4733 res = RegSetValueExA(propkey, "AuthorizedLUAApp", 0, REG_SZ, (LPBYTE)"auth", 5);
4734 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
4736 /* AuthorizedLUAApp value exists */
4738 lstrcpyA(buf, "apple");
4739 r = pMsiGetProductInfoExA(prodcode, usersid,
4740 MSIINSTALLCONTEXT_USERMANAGED,
4741 INSTALLPROPERTY_AUTHORIZED_LUA_APP, buf, &sz);
4742 ok(r == ERROR_UNKNOWN_PRODUCT,
4743 "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r);
4744 ok(!lstrcmpA(buf, "apple"), "Expected buf to be unchanged, got %s\n", buf);
4745 ok(sz == MAX_PATH, "Expected MAX_PATH, got %d\n", sz);
4747 RegDeleteValueA(propkey, "AuthorizedLUAApp");
4748 RegDeleteValueA(propkey, "PackageName");
4749 RegDeleteValueA(propkey, "ProductIcon");
4750 RegDeleteValueA(propkey, "Version");
4751 RegDeleteValueA(propkey, "PackageCode");
4752 RegDeleteValueA(propkey, "AssignmentType");
4753 RegDeleteValueA(propkey, "ProductName");
4754 RegDeleteValueA(propkey, "Language");
4755 RegDeleteValueA(propkey, "Transforms");
4756 RegDeleteValueA(propkey, "RegOwner");
4757 RegDeleteValueA(propkey, "RegCompany");
4758 RegDeleteValueA(propkey, "ProductID");
4759 RegDeleteValueA(propkey, "DisplayVersion");
4760 RegDeleteValueA(propkey, "VersionMajor");
4761 RegDeleteValueA(propkey, "VersionMinor");
4762 RegDeleteValueA(propkey, "URLUpdateInfo");
4763 RegDeleteValueA(propkey, "URLInfoAbout");
4764 RegDeleteValueA(propkey, "Publisher");
4765 RegDeleteValueA(propkey, "LocalPackage");
4766 RegDeleteValueA(propkey, "InstallSource");
4767 RegDeleteValueA(propkey, "InstallLocation");
4768 RegDeleteValueA(propkey, "DisplayName");
4769 RegDeleteValueA(propkey, "InstallDate");
4770 RegDeleteValueA(propkey, "HelpTelephone");
4771 RegDeleteValueA(propkey, "HelpLink");
4772 RegDeleteValueA(propkey, "ManagedLocalPackage");
4773 RegDeleteKeyA(propkey, "");
4774 RegCloseKey(propkey);
4775 RegDeleteKeyA(localkey, "");
4776 RegCloseKey(localkey);
4778 lstrcpyA(keypath, "Software\\Microsoft\\Windows\\CurrentVersion\\Installer\\Managed\\");
4779 lstrcatA(keypath, usersid);
4780 lstrcatA(keypath, "\\Installer\\Products\\");
4781 lstrcatA(keypath, prod_squashed);
4783 res = RegCreateKeyA(HKEY_LOCAL_MACHINE, keypath, &userkey);
4784 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
4786 /* user product key exists */
4788 lstrcpyA(buf, "apple");
4789 r = pMsiGetProductInfoExA(prodcode, usersid,
4790 MSIINSTALLCONTEXT_USERMANAGED,
4791 INSTALLPROPERTY_PRODUCTSTATE, buf, &sz);
4792 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
4793 ok(!lstrcmpA(buf, "1"), "Expected \"1\", got \"%s\"\n", buf);
4794 ok(sz == 1, "Expected 1, got %d\n", sz);
4796 RegDeleteKeyA(userkey, "");
4797 RegCloseKey(userkey);
4799 lstrcpyA(keypath, "Software\\Microsoft\\Installer\\Products\\");
4800 lstrcatA(keypath, prod_squashed);
4802 res = RegCreateKeyA(HKEY_CURRENT_USER, keypath, &prodkey);
4803 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
4805 /* current user product key exists */
4807 lstrcpyA(buf, "apple");
4808 r = pMsiGetProductInfoExA(prodcode, usersid,
4809 MSIINSTALLCONTEXT_USERMANAGED,
4810 INSTALLPROPERTY_PRODUCTSTATE, buf, &sz);
4811 ok(r == ERROR_UNKNOWN_PRODUCT,
4812 "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r);
4813 ok(!lstrcmpA(buf, "apple"), "Expected buf to be unchanged, got %s\n", buf);
4814 ok(sz == MAX_PATH, "Expected MAX_PATH, got %d\n", sz);
4816 res = RegSetValueExA(prodkey, "HelpLink", 0, REG_SZ, (LPBYTE)"link", 5);
4817 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
4819 /* HelpLink value exists, user product key does not exist */
4821 lstrcpyA(buf, "apple");
4822 r = pMsiGetProductInfoExA(prodcode, usersid,
4823 MSIINSTALLCONTEXT_USERMANAGED,
4824 INSTALLPROPERTY_HELPLINK, buf, &sz);
4825 ok(r == ERROR_UNKNOWN_PRODUCT,
4826 "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r);
4827 ok(!lstrcmpA(buf, "apple"), "Expected buf to be unchanged, got %s\n", buf);
4828 ok(sz == MAX_PATH, "Expected MAX_PATH, got %d\n", sz);
4830 lstrcpyA(keypath, "Software\\Microsoft\\Windows\\CurrentVersion\\Installer\\Managed\\");
4831 lstrcatA(keypath, usersid);
4832 lstrcatA(keypath, "\\Installer\\Products\\");
4833 lstrcatA(keypath, prod_squashed);
4835 res = RegCreateKeyA(HKEY_LOCAL_MACHINE, keypath, &userkey);
4836 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
4838 res = RegSetValueExA(userkey, "HelpLink", 0, REG_SZ, (LPBYTE)"link", 5);
4839 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
4841 /* HelpLink value exists, user product key does exist */
4843 lstrcpyA(buf, "apple");
4844 r = pMsiGetProductInfoExA(prodcode, usersid,
4845 MSIINSTALLCONTEXT_USERMANAGED,
4846 INSTALLPROPERTY_HELPLINK, buf, &sz);
4847 ok(r == ERROR_UNKNOWN_PROPERTY,
4848 "Expected ERROR_UNKNOWN_PROPERTY, got %d\n", r);
4849 ok(!lstrcmpA(buf, "apple"), "Expected buf to be unchanged, got %s\n", buf);
4850 ok(sz == MAX_PATH, "Expected MAX_PATH, got %d\n", sz);
4852 res = RegSetValueExA(userkey, "HelpTelephone", 0, REG_SZ, (LPBYTE)"phone", 6);
4853 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
4855 /* HelpTelephone value exists */
4857 lstrcpyA(buf, "apple");
4858 r = pMsiGetProductInfoExA(prodcode, usersid,
4859 MSIINSTALLCONTEXT_USERMANAGED,
4860 INSTALLPROPERTY_HELPTELEPHONE, buf, &sz);
4861 ok(r == ERROR_UNKNOWN_PROPERTY,
4862 "Expected ERROR_UNKNOWN_PROPERTY, got %d\n", r);
4863 ok(!lstrcmpA(buf, "apple"), "Expected buf to be unchanged, got %s\n", buf);
4864 ok(sz == MAX_PATH, "Expected MAX_PATH, got %d\n", sz);
4866 res = RegSetValueExA(userkey, "InstallDate", 0, REG_SZ, (LPBYTE)"date", 5);
4867 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
4869 /* InstallDate value exists */
4871 lstrcpyA(buf, "apple");
4872 r = pMsiGetProductInfoExA(prodcode, usersid,
4873 MSIINSTALLCONTEXT_USERMANAGED,
4874 INSTALLPROPERTY_INSTALLDATE, buf, &sz);
4875 ok(r == ERROR_UNKNOWN_PROPERTY,
4876 "Expected ERROR_UNKNOWN_PROPERTY, got %d\n", r);
4877 ok(!lstrcmpA(buf, "apple"), "Expected buf to be unchanged, got %s\n", buf);
4878 ok(sz == MAX_PATH, "Expected MAX_PATH, got %d\n", sz);
4880 res = RegSetValueExA(userkey, "DisplayName", 0, REG_SZ, (LPBYTE)"name", 5);
4881 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
4883 /* DisplayName value exists */
4885 lstrcpyA(buf, "apple");
4886 r = pMsiGetProductInfoExA(prodcode, usersid,
4887 MSIINSTALLCONTEXT_USERMANAGED,
4888 INSTALLPROPERTY_INSTALLEDPRODUCTNAME, buf, &sz);
4889 ok(r == ERROR_UNKNOWN_PROPERTY,
4890 "Expected ERROR_UNKNOWN_PROPERTY, got %d\n", r);
4891 ok(!lstrcmpA(buf, "apple"), "Expected buf to be unchanged, got %s\n", buf);
4892 ok(sz == MAX_PATH, "Expected MAX_PATH, got %d\n", sz);
4894 res = RegSetValueExA(userkey, "InstallLocation", 0, REG_SZ, (LPBYTE)"loc", 4);
4895 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
4897 /* InstallLocation value exists */
4899 lstrcpyA(buf, "apple");
4900 r = pMsiGetProductInfoExA(prodcode, usersid,
4901 MSIINSTALLCONTEXT_USERMANAGED,
4902 INSTALLPROPERTY_INSTALLLOCATION, buf, &sz);
4903 ok(r == ERROR_UNKNOWN_PROPERTY,
4904 "Expected ERROR_UNKNOWN_PROPERTY, got %d\n", r);
4905 ok(!lstrcmpA(buf, "apple"), "Expected buf to be unchanged, got %s\n", buf);
4906 ok(sz == MAX_PATH, "Expected MAX_PATH, got %d\n", sz);
4908 res = RegSetValueExA(userkey, "InstallSource", 0, REG_SZ, (LPBYTE)"source", 7);
4909 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
4911 /* InstallSource value exists */
4913 lstrcpyA(buf, "apple");
4914 r = pMsiGetProductInfoExA(prodcode, usersid,
4915 MSIINSTALLCONTEXT_USERMANAGED,
4916 INSTALLPROPERTY_INSTALLSOURCE, buf, &sz);
4917 ok(r == ERROR_UNKNOWN_PROPERTY,
4918 "Expected ERROR_UNKNOWN_PROPERTY, got %d\n", r);
4919 ok(!lstrcmpA(buf, "apple"), "Expected buf to be unchanged, got %s\n", buf);
4920 ok(sz == MAX_PATH, "Expected MAX_PATH, got %d\n", sz);
4922 res = RegSetValueExA(userkey, "LocalPackage", 0, REG_SZ, (LPBYTE)"local", 6);
4923 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
4925 /* LocalPackage value exists */
4927 lstrcpyA(buf, "apple");
4928 r = pMsiGetProductInfoExA(prodcode, usersid,
4929 MSIINSTALLCONTEXT_USERMANAGED,
4930 INSTALLPROPERTY_LOCALPACKAGE, buf, &sz);
4931 ok(r == ERROR_UNKNOWN_PROPERTY,
4932 "Expected ERROR_UNKNOWN_PROPERTY, got %d\n", r);
4933 ok(!lstrcmpA(buf, "apple"), "Expected buf to be unchanged, got %s\n", buf);
4934 ok(sz == MAX_PATH, "Expected MAX_PATH, got %d\n", sz);
4936 res = RegSetValueExA(userkey, "Publisher", 0, REG_SZ, (LPBYTE)"pub", 4);
4937 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
4939 /* Publisher value exists */
4941 lstrcpyA(buf, "apple");
4942 r = pMsiGetProductInfoExA(prodcode, usersid,
4943 MSIINSTALLCONTEXT_USERMANAGED,
4944 INSTALLPROPERTY_PUBLISHER, buf, &sz);
4945 ok(r == ERROR_UNKNOWN_PROPERTY,
4946 "Expected ERROR_UNKNOWN_PROPERTY, got %d\n", r);
4947 ok(!lstrcmpA(buf, "apple"), "Expected buf to be unchanged, got %s\n", buf);
4948 ok(sz == MAX_PATH, "Expected MAX_PATH, got %d\n", sz);
4950 res = RegSetValueExA(userkey, "URLInfoAbout", 0, REG_SZ, (LPBYTE)"about", 6);
4951 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
4953 /* URLInfoAbout value exists */
4955 lstrcpyA(buf, "apple");
4956 r = pMsiGetProductInfoExA(prodcode, usersid,
4957 MSIINSTALLCONTEXT_USERMANAGED,
4958 INSTALLPROPERTY_URLINFOABOUT, buf, &sz);
4959 ok(r == ERROR_UNKNOWN_PROPERTY,
4960 "Expected ERROR_UNKNOWN_PROPERTY, got %d\n", r);
4961 ok(!lstrcmpA(buf, "apple"), "Expected buf to be unchanged, got %s\n", buf);
4962 ok(sz == MAX_PATH, "Expected MAX_PATH, got %d\n", sz);
4964 res = RegSetValueExA(userkey, "URLUpdateInfo", 0, REG_SZ, (LPBYTE)"update", 7);
4965 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
4967 /* URLUpdateInfo value exists */
4969 lstrcpyA(buf, "apple");
4970 r = pMsiGetProductInfoExA(prodcode, usersid,
4971 MSIINSTALLCONTEXT_USERMANAGED,
4972 INSTALLPROPERTY_URLUPDATEINFO, buf, &sz);
4973 ok(r == ERROR_UNKNOWN_PROPERTY,
4974 "Expected ERROR_UNKNOWN_PROPERTY, got %d\n", r);
4975 ok(!lstrcmpA(buf, "apple"), "Expected buf to be unchanged, got %s\n", buf);
4976 ok(sz == MAX_PATH, "Expected MAX_PATH, got %d\n", sz);
4978 res = RegSetValueExA(userkey, "VersionMinor", 0, REG_SZ, (LPBYTE)"2", 2);
4979 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
4981 /* VersionMinor value exists */
4983 lstrcpyA(buf, "apple");
4984 r = pMsiGetProductInfoExA(prodcode, usersid,
4985 MSIINSTALLCONTEXT_USERMANAGED,
4986 INSTALLPROPERTY_VERSIONMINOR, buf, &sz);
4987 ok(r == ERROR_UNKNOWN_PROPERTY,
4988 "Expected ERROR_UNKNOWN_PROPERTY, got %d\n", r);
4989 ok(!lstrcmpA(buf, "apple"), "Expected buf to be unchanged, got %s\n", buf);
4990 ok(sz == MAX_PATH, "Expected MAX_PATH, got %d\n", sz);
4992 res = RegSetValueExA(userkey, "VersionMajor", 0, REG_SZ, (LPBYTE)"3", 2);
4993 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
4995 /* VersionMajor value exists */
4997 lstrcpyA(buf, "apple");
4998 r = pMsiGetProductInfoExA(prodcode, usersid,
4999 MSIINSTALLCONTEXT_USERMANAGED,
5000 INSTALLPROPERTY_VERSIONMAJOR, buf, &sz);
5001 ok(r == ERROR_UNKNOWN_PROPERTY,
5002 "Expected ERROR_UNKNOWN_PROPERTY, got %d\n", r);
5003 ok(!lstrcmpA(buf, "apple"), "Expected buf to be unchanged, got %s\n", buf);
5004 ok(sz == MAX_PATH, "Expected MAX_PATH, got %d\n", sz);
5006 res = RegSetValueExA(userkey, "DisplayVersion", 0, REG_SZ, (LPBYTE)"3.2.1", 6);
5007 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
5009 /* DisplayVersion value exists */
5011 lstrcpyA(buf, "apple");
5012 r = pMsiGetProductInfoExA(prodcode, usersid,
5013 MSIINSTALLCONTEXT_USERMANAGED,
5014 INSTALLPROPERTY_VERSIONSTRING, buf, &sz);
5015 ok(r == ERROR_UNKNOWN_PROPERTY,
5016 "Expected ERROR_UNKNOWN_PROPERTY, got %d\n", r);
5017 ok(!lstrcmpA(buf, "apple"), "Expected buf to be unchanged, got %s\n", buf);
5018 ok(sz == MAX_PATH, "Expected MAX_PATH, got %d\n", sz);
5020 res = RegSetValueExA(userkey, "ProductID", 0, REG_SZ, (LPBYTE)"id", 3);
5021 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
5023 /* ProductID value exists */
5025 lstrcpyA(buf, "apple");
5026 r = pMsiGetProductInfoExA(prodcode, usersid,
5027 MSIINSTALLCONTEXT_USERMANAGED,
5028 INSTALLPROPERTY_PRODUCTID, buf, &sz);
5029 ok(r == ERROR_UNKNOWN_PROPERTY,
5030 "Expected ERROR_UNKNOWN_PROPERTY, got %d\n", r);
5031 ok(!lstrcmpA(buf, "apple"), "Expected buf to be unchanged, got %s\n", buf);
5032 ok(sz == MAX_PATH, "Expected MAX_PATH, got %d\n", sz);
5034 res = RegSetValueExA(userkey, "RegCompany", 0, REG_SZ, (LPBYTE)"comp", 5);
5035 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
5037 /* RegCompany value exists */
5039 lstrcpyA(buf, "apple");
5040 r = pMsiGetProductInfoExA(prodcode, usersid,
5041 MSIINSTALLCONTEXT_USERMANAGED,
5042 INSTALLPROPERTY_REGCOMPANY, buf, &sz);
5043 ok(r == ERROR_UNKNOWN_PROPERTY,
5044 "Expected ERROR_UNKNOWN_PROPERTY, got %d\n", r);
5045 ok(!lstrcmpA(buf, "apple"), "Expected buf to be unchanged, got %s\n", buf);
5046 ok(sz == MAX_PATH, "Expected MAX_PATH, got %d\n", sz);
5048 res = RegSetValueExA(userkey, "RegOwner", 0, REG_SZ, (LPBYTE)"owner", 6);
5049 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
5051 /* RegOwner value exists */
5053 lstrcpyA(buf, "apple");
5054 r = pMsiGetProductInfoExA(prodcode, usersid,
5055 MSIINSTALLCONTEXT_USERMANAGED,
5056 INSTALLPROPERTY_REGOWNER, buf, &sz);
5057 ok(r == ERROR_UNKNOWN_PROPERTY,
5058 "Expected ERROR_UNKNOWN_PROPERTY, got %d\n", r);
5059 ok(!lstrcmpA(buf, "apple"), "Expected buf to be unchanged, got %s\n", buf);
5060 ok(sz == MAX_PATH, "Expected MAX_PATH, got %d\n", sz);
5062 res = RegSetValueExA(userkey, "Transforms", 0, REG_SZ, (LPBYTE)"trans", 6);
5063 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
5065 /* Transforms value exists */
5067 lstrcpyA(buf, "apple");
5068 r = pMsiGetProductInfoExA(prodcode, usersid,
5069 MSIINSTALLCONTEXT_USERMANAGED,
5070 INSTALLPROPERTY_TRANSFORMS, buf, &sz);
5071 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
5072 ok(!lstrcmpA(buf, "trans"), "Expected \"trans\", got \"%s\"\n", buf);
5073 ok(sz == 5, "Expected 5, got %d\n", sz);
5075 res = RegSetValueExA(userkey, "Language", 0, REG_SZ, (LPBYTE)"lang", 5);
5076 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
5078 /* Language value exists */
5080 lstrcpyA(buf, "apple");
5081 r = pMsiGetProductInfoExA(prodcode, usersid,
5082 MSIINSTALLCONTEXT_USERMANAGED,
5083 INSTALLPROPERTY_LANGUAGE, buf, &sz);
5084 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
5085 ok(!lstrcmpA(buf, "lang"), "Expected \"lang\", got \"%s\"\n", buf);
5086 ok(sz == 4, "Expected 4, got %d\n", sz);
5088 res = RegSetValueExA(userkey, "ProductName", 0, REG_SZ, (LPBYTE)"name", 5);
5089 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
5091 /* ProductName value exists */
5093 lstrcpyA(buf, "apple");
5094 r = pMsiGetProductInfoExA(prodcode, usersid,
5095 MSIINSTALLCONTEXT_USERMANAGED,
5096 INSTALLPROPERTY_PRODUCTNAME, buf, &sz);
5097 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
5098 ok(!lstrcmpA(buf, "name"), "Expected \"name\", got \"%s\"\n", buf);
5099 ok(sz == 4, "Expected 4, got %d\n", sz);
5101 res = RegSetValueExA(userkey, "AssignmentType", 0, REG_SZ, (LPBYTE)"type", 5);
5102 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
5106 /* AssignmentType value exists */
5108 lstrcpyA(buf, "apple");
5109 r = pMsiGetProductInfoExA(prodcode, usersid,
5110 MSIINSTALLCONTEXT_USERMANAGED,
5111 INSTALLPROPERTY_ASSIGNMENTTYPE, buf, &sz);
5112 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
5113 ok(!lstrcmpA(buf, ""), "Expected \"\", got \"%s\"\n", buf);
5114 ok(sz == 0, "Expected 0, got %d\n", sz);
5116 res = RegSetValueExA(userkey, "PackageCode", 0, REG_SZ, (LPBYTE)"code", 5);
5117 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
5121 /* PackageCode value exists */
5123 lstrcpyA(buf, "apple");
5124 r = pMsiGetProductInfoExA(prodcode, usersid,
5125 MSIINSTALLCONTEXT_USERMANAGED,
5126 INSTALLPROPERTY_PACKAGECODE, buf, &sz);
5129 ok(r == ERROR_BAD_CONFIGURATION,
5130 "Expected ERROR_BAD_CONFIGURATION, got %d\n", r);
5131 ok(!lstrcmpA(buf, "apple"), "Expected buf to be unchanged, got %s\n", buf);
5132 ok(sz == MAX_PATH, "Expected MAX_PATH, got %d\n", sz);
5135 res = RegSetValueExA(userkey, "Version", 0, REG_SZ, (LPBYTE)"ver", 4);
5136 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
5138 /* Version value exists */
5140 lstrcpyA(buf, "apple");
5141 r = pMsiGetProductInfoExA(prodcode, usersid,
5142 MSIINSTALLCONTEXT_USERMANAGED,
5143 INSTALLPROPERTY_VERSION, buf, &sz);
5144 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
5145 ok(!lstrcmpA(buf, "ver"), "Expected \"ver\", got \"%s\"\n", buf);
5146 ok(sz == 3, "Expected 3, got %d\n", sz);
5148 res = RegSetValueExA(userkey, "ProductIcon", 0, REG_SZ, (LPBYTE)"icon", 5);
5149 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
5151 /* ProductIcon value exists */
5153 lstrcpyA(buf, "apple");
5154 r = pMsiGetProductInfoExA(prodcode, usersid,
5155 MSIINSTALLCONTEXT_USERMANAGED,
5156 INSTALLPROPERTY_PRODUCTICON, buf, &sz);
5157 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
5158 ok(!lstrcmpA(buf, "icon"), "Expected \"icon\", got \"%s\"\n", buf);
5159 ok(sz == 4, "Expected 4, got %d\n", sz);
5161 res = RegSetValueExA(userkey, "PackageName", 0, REG_SZ, (LPBYTE)"name", 5);
5162 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
5164 /* PackageName value exists */
5166 lstrcpyA(buf, "apple");
5167 r = pMsiGetProductInfoExA(prodcode, usersid,
5168 MSIINSTALLCONTEXT_USERMANAGED,
5169 INSTALLPROPERTY_PACKAGENAME, buf, &sz);
5172 ok(r == ERROR_UNKNOWN_PRODUCT,
5173 "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r);
5174 ok(!lstrcmpA(buf, "apple"), "Expected buf to be unchanged, got %s\n", buf);
5175 ok(sz == MAX_PATH, "Expected MAX_PATH, got %d\n", sz);
5178 res = RegSetValueExA(userkey, "AuthorizedLUAApp", 0, REG_SZ, (LPBYTE)"auth", 5);
5179 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
5181 /* AuthorizedLUAApp value exists */
5183 lstrcpyA(buf, "apple");
5184 r = pMsiGetProductInfoExA(prodcode, usersid,
5185 MSIINSTALLCONTEXT_USERMANAGED,
5186 INSTALLPROPERTY_AUTHORIZED_LUA_APP, buf, &sz);
5187 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
5188 ok(!lstrcmpA(buf, "auth"), "Expected \"auth\", got \"%s\"\n", buf);
5189 ok(sz == 4, "Expected 4, got %d\n", sz);
5191 RegDeleteValueA(userkey, "AuthorizedLUAApp");
5192 RegDeleteValueA(userkey, "PackageName");
5193 RegDeleteValueA(userkey, "ProductIcon");
5194 RegDeleteValueA(userkey, "Version");
5195 RegDeleteValueA(userkey, "PackageCode");
5196 RegDeleteValueA(userkey, "AssignmentType");
5197 RegDeleteValueA(userkey, "ProductName");
5198 RegDeleteValueA(userkey, "Language");
5199 RegDeleteValueA(userkey, "Transforms");
5200 RegDeleteValueA(userkey, "RegOwner");
5201 RegDeleteValueA(userkey, "RegCompany");
5202 RegDeleteValueA(userkey, "ProductID");
5203 RegDeleteValueA(userkey, "DisplayVersion");
5204 RegDeleteValueA(userkey, "VersionMajor");
5205 RegDeleteValueA(userkey, "VersionMinor");
5206 RegDeleteValueA(userkey, "URLUpdateInfo");
5207 RegDeleteValueA(userkey, "URLInfoAbout");
5208 RegDeleteValueA(userkey, "Publisher");
5209 RegDeleteValueA(userkey, "LocalPackage");
5210 RegDeleteValueA(userkey, "InstallSource");
5211 RegDeleteValueA(userkey, "InstallLocation");
5212 RegDeleteValueA(userkey, "DisplayName");
5213 RegDeleteValueA(userkey, "InstallDate");
5214 RegDeleteValueA(userkey, "HelpTelephone");
5215 RegDeleteValueA(userkey, "HelpLink");
5216 RegDeleteKeyA(userkey, "");
5217 RegCloseKey(userkey);
5218 RegDeleteKeyA(prodkey, "");
5219 RegCloseKey(prodkey);
5221 /* MSIINSTALLCONTEXT_MACHINE */
5223 /* szUserSid is non-NULL */
5225 lstrcpyA(buf, "apple");
5226 r = pMsiGetProductInfoExA(prodcode, usersid,
5227 MSIINSTALLCONTEXT_MACHINE,
5228 INSTALLPROPERTY_PRODUCTSTATE, buf, &sz);
5229 ok(r == ERROR_INVALID_PARAMETER,
5230 "Expected ERROR_INVALID_PARAMETER, got %d\n", r);
5231 ok(!lstrcmpA(buf, "apple"), "Expected buf to be unchanged, got %s\n", buf);
5232 ok(sz == MAX_PATH, "Expected MAX_PATH, got %d\n", sz);
5234 lstrcpyA(keypath, "Software\\Microsoft\\Windows\\CurrentVersion\\Installer\\UserData\\S-1-5-18\\Products\\");
5235 lstrcatA(keypath, prod_squashed);
5237 res = RegCreateKeyA(HKEY_LOCAL_MACHINE, keypath, &localkey);
5238 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
5240 /* local system product key exists */
5242 lstrcpyA(buf, "apple");
5243 r = pMsiGetProductInfoExA(prodcode, NULL,
5244 MSIINSTALLCONTEXT_MACHINE,
5245 INSTALLPROPERTY_PRODUCTSTATE, buf, &sz);
5246 ok(r == ERROR_UNKNOWN_PRODUCT,
5247 "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r);
5248 ok(!lstrcmpA(buf, "apple"), "Expected buf to be unchanged, got %s\n", buf);
5249 ok(sz == MAX_PATH, "Expected MAX_PATH, got %d\n", sz);
5251 res = RegCreateKeyA(localkey, "InstallProperties", &propkey);
5252 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
5254 /* InstallProperties key exists */
5256 lstrcpyA(buf, "apple");
5257 r = pMsiGetProductInfoExA(prodcode, NULL,
5258 MSIINSTALLCONTEXT_MACHINE,
5259 INSTALLPROPERTY_PRODUCTSTATE, buf, &sz);
5260 ok(r == ERROR_UNKNOWN_PRODUCT,
5261 "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r);
5262 ok(!lstrcmpA(buf, "apple"), "Expected buf to be unchanged, got %s\n", buf);
5263 ok(sz == MAX_PATH, "Expected MAX_PATH, got %d\n", sz);
5265 res = RegSetValueExA(propkey, "LocalPackage", 0, REG_SZ, (LPBYTE)"local", 6);
5266 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
5268 /* LocalPackage value exists */
5270 lstrcpyA(buf, "apple");
5271 r = pMsiGetProductInfoExA(prodcode, NULL,
5272 MSIINSTALLCONTEXT_MACHINE,
5273 INSTALLPROPERTY_PRODUCTSTATE, buf, &sz);
5274 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
5275 ok(!lstrcmpA(buf, "5"), "Expected \"5\", got \"%s\"\n", buf);
5276 ok(sz == 1, "Expected 1, got %d\n", sz);
5278 res = RegSetValueExA(propkey, "HelpLink", 0, REG_SZ, (LPBYTE)"link", 5);
5279 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
5281 /* HelpLink value exists */
5283 lstrcpyA(buf, "apple");
5284 r = pMsiGetProductInfoExA(prodcode, NULL,
5285 MSIINSTALLCONTEXT_MACHINE,
5286 INSTALLPROPERTY_HELPLINK, buf, &sz);
5287 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
5288 ok(!lstrcmpA(buf, "link"), "Expected \"link\", got \"%s\"\n", buf);
5289 ok(sz == 4, "Expected 4, got %d\n", sz);
5291 res = RegSetValueExA(propkey, "HelpTelephone", 0, REG_SZ, (LPBYTE)"phone", 6);
5292 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
5294 /* HelpTelephone value exists */
5296 lstrcpyA(buf, "apple");
5297 r = pMsiGetProductInfoExA(prodcode, NULL,
5298 MSIINSTALLCONTEXT_MACHINE,
5299 INSTALLPROPERTY_HELPTELEPHONE, buf, &sz);
5300 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
5301 ok(!lstrcmpA(buf, "phone"), "Expected \"phone\", got \"%s\"\n", buf);
5302 ok(sz == 5, "Expected 5, got %d\n", sz);
5304 res = RegSetValueExA(propkey, "InstallDate", 0, REG_SZ, (LPBYTE)"date", 5);
5305 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
5307 /* InstallDate value exists */
5309 lstrcpyA(buf, "apple");
5310 r = pMsiGetProductInfoExA(prodcode, NULL,
5311 MSIINSTALLCONTEXT_MACHINE,
5312 INSTALLPROPERTY_INSTALLDATE, buf, &sz);
5313 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
5314 ok(!lstrcmpA(buf, "date"), "Expected \"date\", got \"%s\"\n", buf);
5315 ok(sz == 4, "Expected 4, got %d\n", sz);
5317 res = RegSetValueExA(propkey, "DisplayName", 0, REG_SZ, (LPBYTE)"name", 5);
5318 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
5320 /* DisplayName value exists */
5322 lstrcpyA(buf, "apple");
5323 r = pMsiGetProductInfoExA(prodcode, NULL,
5324 MSIINSTALLCONTEXT_MACHINE,
5325 INSTALLPROPERTY_INSTALLEDPRODUCTNAME, buf, &sz);
5326 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
5327 ok(!lstrcmpA(buf, "name"), "Expected \"name\", got \"%s\"\n", buf);
5328 ok(sz == 4, "Expected 4, got %d\n", sz);
5330 res = RegSetValueExA(propkey, "InstallLocation", 0, REG_SZ, (LPBYTE)"loc", 4);
5331 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
5333 /* InstallLocation value exists */
5335 lstrcpyA(buf, "apple");
5336 r = pMsiGetProductInfoExA(prodcode, NULL,
5337 MSIINSTALLCONTEXT_MACHINE,
5338 INSTALLPROPERTY_INSTALLLOCATION, buf, &sz);
5339 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
5340 ok(!lstrcmpA(buf, "loc"), "Expected \"loc\", got \"%s\"\n", buf);
5341 ok(sz == 3, "Expected 3, got %d\n", sz);
5343 res = RegSetValueExA(propkey, "InstallSource", 0, REG_SZ, (LPBYTE)"source", 7);
5344 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
5346 /* InstallSource value exists */
5348 lstrcpyA(buf, "apple");
5349 r = pMsiGetProductInfoExA(prodcode, NULL,
5350 MSIINSTALLCONTEXT_MACHINE,
5351 INSTALLPROPERTY_INSTALLSOURCE, buf, &sz);
5352 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
5353 ok(!lstrcmpA(buf, "source"), "Expected \"source\", got \"%s\"\n", buf);
5354 ok(sz == 6, "Expected 6, got %d\n", sz);
5356 res = RegSetValueExA(propkey, "LocalPackage", 0, REG_SZ, (LPBYTE)"local", 6);
5357 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
5359 /* LocalPackage value exists */
5361 lstrcpyA(buf, "apple");
5362 r = pMsiGetProductInfoExA(prodcode, NULL,
5363 MSIINSTALLCONTEXT_MACHINE,
5364 INSTALLPROPERTY_LOCALPACKAGE, buf, &sz);
5365 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
5366 ok(!lstrcmpA(buf, "local"), "Expected \"local\", got \"%s\"\n", buf);
5367 ok(sz == 5, "Expected 5, got %d\n", sz);
5369 res = RegSetValueExA(propkey, "Publisher", 0, REG_SZ, (LPBYTE)"pub", 4);
5370 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
5372 /* Publisher value exists */
5374 lstrcpyA(buf, "apple");
5375 r = pMsiGetProductInfoExA(prodcode, NULL,
5376 MSIINSTALLCONTEXT_MACHINE,
5377 INSTALLPROPERTY_PUBLISHER, buf, &sz);
5378 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
5379 ok(!lstrcmpA(buf, "pub"), "Expected \"pub\", got \"%s\"\n", buf);
5380 ok(sz == 3, "Expected 3, got %d\n", sz);
5382 res = RegSetValueExA(propkey, "URLInfoAbout", 0, REG_SZ, (LPBYTE)"about", 6);
5383 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
5385 /* URLInfoAbout value exists */
5387 lstrcpyA(buf, "apple");
5388 r = pMsiGetProductInfoExA(prodcode, NULL,
5389 MSIINSTALLCONTEXT_MACHINE,
5390 INSTALLPROPERTY_URLINFOABOUT, buf, &sz);
5391 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
5392 ok(!lstrcmpA(buf, "about"), "Expected \"about\", got \"%s\"\n", buf);
5393 ok(sz == 5, "Expected 5, got %d\n", sz);
5395 res = RegSetValueExA(propkey, "URLUpdateInfo", 0, REG_SZ, (LPBYTE)"update", 7);
5396 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
5398 /* URLUpdateInfo value exists */
5400 lstrcpyA(buf, "apple");
5401 r = pMsiGetProductInfoExA(prodcode, NULL,
5402 MSIINSTALLCONTEXT_MACHINE,
5403 INSTALLPROPERTY_URLUPDATEINFO, buf, &sz);
5404 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
5405 ok(!lstrcmpA(buf, "update"), "Expected \"update\", got \"%s\"\n", buf);
5406 ok(sz == 6, "Expected 6, got %d\n", sz);
5408 res = RegSetValueExA(propkey, "VersionMinor", 0, REG_SZ, (LPBYTE)"2", 2);
5409 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
5411 /* VersionMinor value exists */
5413 lstrcpyA(buf, "apple");
5414 r = pMsiGetProductInfoExA(prodcode, NULL,
5415 MSIINSTALLCONTEXT_MACHINE,
5416 INSTALLPROPERTY_VERSIONMINOR, buf, &sz);
5417 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
5418 ok(!lstrcmpA(buf, "2"), "Expected \"2\", got \"%s\"\n", buf);
5419 ok(sz == 1, "Expected 1, got %d\n", sz);
5421 res = RegSetValueExA(propkey, "VersionMajor", 0, REG_SZ, (LPBYTE)"3", 2);
5422 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
5424 /* VersionMajor value exists */
5426 lstrcpyA(buf, "apple");
5427 r = pMsiGetProductInfoExA(prodcode, NULL,
5428 MSIINSTALLCONTEXT_MACHINE,
5429 INSTALLPROPERTY_VERSIONMAJOR, buf, &sz);
5430 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
5431 ok(!lstrcmpA(buf, "3"), "Expected \"3\", got \"%s\"\n", buf);
5432 ok(sz == 1, "Expected 1, got %d\n", sz);
5434 res = RegSetValueExA(propkey, "DisplayVersion", 0, REG_SZ, (LPBYTE)"3.2.1", 6);
5435 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
5437 /* DisplayVersion value exists */
5439 lstrcpyA(buf, "apple");
5440 r = pMsiGetProductInfoExA(prodcode, NULL,
5441 MSIINSTALLCONTEXT_MACHINE,
5442 INSTALLPROPERTY_VERSIONSTRING, buf, &sz);
5443 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
5444 ok(!lstrcmpA(buf, "3.2.1"), "Expected \"3.2.1\", got \"%s\"\n", buf);
5445 ok(sz == 5, "Expected 5, got %d\n", sz);
5447 res = RegSetValueExA(propkey, "ProductID", 0, REG_SZ, (LPBYTE)"id", 3);
5448 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
5450 /* ProductID value exists */
5452 lstrcpyA(buf, "apple");
5453 r = pMsiGetProductInfoExA(prodcode, NULL,
5454 MSIINSTALLCONTEXT_MACHINE,
5455 INSTALLPROPERTY_PRODUCTID, buf, &sz);
5456 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
5457 ok(!lstrcmpA(buf, "id"), "Expected \"id\", got \"%s\"\n", buf);
5458 ok(sz == 2, "Expected 2, got %d\n", sz);
5460 res = RegSetValueExA(propkey, "RegCompany", 0, REG_SZ, (LPBYTE)"comp", 5);
5461 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
5463 /* RegCompany value exists */
5465 lstrcpyA(buf, "apple");
5466 r = pMsiGetProductInfoExA(prodcode, NULL,
5467 MSIINSTALLCONTEXT_MACHINE,
5468 INSTALLPROPERTY_REGCOMPANY, buf, &sz);
5469 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
5470 ok(!lstrcmpA(buf, "comp"), "Expected \"comp\", got \"%s\"\n", buf);
5471 ok(sz == 4, "Expected 4, got %d\n", sz);
5473 res = RegSetValueExA(propkey, "RegOwner", 0, REG_SZ, (LPBYTE)"owner", 6);
5474 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
5476 /* RegOwner value exists */
5478 lstrcpyA(buf, "apple");
5479 r = pMsiGetProductInfoExA(prodcode, NULL,
5480 MSIINSTALLCONTEXT_MACHINE,
5481 INSTALLPROPERTY_REGOWNER, buf, &sz);
5482 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
5483 ok(!lstrcmpA(buf, "owner"), "Expected \"owner\", got \"%s\"\n", buf);
5484 ok(sz == 5, "Expected 5, got %d\n", sz);
5486 res = RegSetValueExA(propkey, "Transforms", 0, REG_SZ, (LPBYTE)"trans", 6);
5487 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
5489 /* Transforms value exists */
5491 lstrcpyA(buf, "apple");
5492 r = pMsiGetProductInfoExA(prodcode, NULL,
5493 MSIINSTALLCONTEXT_MACHINE,
5494 INSTALLPROPERTY_TRANSFORMS, buf, &sz);
5495 ok(r == ERROR_UNKNOWN_PRODUCT,
5496 "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r);
5497 ok(!lstrcmpA(buf, "apple"), "Expected buf to be unchanged, got %s\n", buf);
5498 ok(sz == MAX_PATH, "Expected MAX_PATH, got %d\n", sz);
5500 res = RegSetValueExA(propkey, "Language", 0, REG_SZ, (LPBYTE)"lang", 5);
5501 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
5503 /* Language value exists */
5505 lstrcpyA(buf, "apple");
5506 r = pMsiGetProductInfoExA(prodcode, NULL,
5507 MSIINSTALLCONTEXT_MACHINE,
5508 INSTALLPROPERTY_LANGUAGE, buf, &sz);
5509 ok(r == ERROR_UNKNOWN_PRODUCT,
5510 "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r);
5511 ok(!lstrcmpA(buf, "apple"), "Expected buf to be unchanged, got %s\n", buf);
5512 ok(sz == MAX_PATH, "Expected MAX_PATH, got %d\n", sz);
5514 res = RegSetValueExA(propkey, "ProductName", 0, REG_SZ, (LPBYTE)"name", 5);
5515 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
5517 /* ProductName value exists */
5519 lstrcpyA(buf, "apple");
5520 r = pMsiGetProductInfoExA(prodcode, NULL,
5521 MSIINSTALLCONTEXT_MACHINE,
5522 INSTALLPROPERTY_PRODUCTNAME, buf, &sz);
5523 ok(r == ERROR_UNKNOWN_PRODUCT,
5524 "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r);
5525 ok(!lstrcmpA(buf, "apple"), "Expected buf to be unchanged, got %s\n", buf);
5526 ok(sz == MAX_PATH, "Expected MAX_PATH, got %d\n", sz);
5528 res = RegSetValueExA(propkey, "AssignmentType", 0, REG_SZ, (LPBYTE)"type", 5);
5529 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
5533 /* AssignmentType value exists */
5535 lstrcpyA(buf, "apple");
5536 r = pMsiGetProductInfoExA(prodcode, NULL,
5537 MSIINSTALLCONTEXT_MACHINE,
5538 INSTALLPROPERTY_ASSIGNMENTTYPE, buf, &sz);
5539 ok(r == ERROR_UNKNOWN_PRODUCT,
5540 "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r);
5541 ok(!lstrcmpA(buf, "apple"), "Expected buf to be unchanged, got %s\n", buf);
5542 ok(sz == MAX_PATH, "Expected MAX_PATH, got %d\n", sz);
5544 res = RegSetValueExA(propkey, "PackageCode", 0, REG_SZ, (LPBYTE)"code", 5);
5545 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
5547 /* PackageCode value exists */
5549 lstrcpyA(buf, "apple");
5550 r = pMsiGetProductInfoExA(prodcode, NULL,
5551 MSIINSTALLCONTEXT_MACHINE,
5552 INSTALLPROPERTY_PACKAGECODE, buf, &sz);
5553 ok(r == ERROR_UNKNOWN_PRODUCT,
5554 "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r);
5555 ok(!lstrcmpA(buf, "apple"), "Expected buf to be unchanged, got %s\n", buf);
5556 ok(sz == MAX_PATH, "Expected MAX_PATH, got %d\n", sz);
5558 res = RegSetValueExA(propkey, "Version", 0, REG_SZ, (LPBYTE)"ver", 4);
5559 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
5561 /* Version value exists */
5563 lstrcpyA(buf, "apple");
5564 r = pMsiGetProductInfoExA(prodcode, NULL,
5565 MSIINSTALLCONTEXT_MACHINE,
5566 INSTALLPROPERTY_VERSION, buf, &sz);
5567 ok(r == ERROR_UNKNOWN_PRODUCT,
5568 "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r);
5569 ok(!lstrcmpA(buf, "apple"), "Expected buf to be unchanged, got %s\n", buf);
5570 ok(sz == MAX_PATH, "Expected MAX_PATH, got %d\n", sz);
5572 res = RegSetValueExA(propkey, "ProductIcon", 0, REG_SZ, (LPBYTE)"icon", 5);
5573 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
5575 /* ProductIcon value exists */
5577 lstrcpyA(buf, "apple");
5578 r = pMsiGetProductInfoExA(prodcode, NULL,
5579 MSIINSTALLCONTEXT_MACHINE,
5580 INSTALLPROPERTY_PRODUCTICON, buf, &sz);
5581 ok(r == ERROR_UNKNOWN_PRODUCT,
5582 "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r);
5583 ok(!lstrcmpA(buf, "apple"), "Expected buf to be unchanged, got %s\n", buf);
5584 ok(sz == MAX_PATH, "Expected MAX_PATH, got %d\n", sz);
5586 res = RegSetValueExA(propkey, "PackageName", 0, REG_SZ, (LPBYTE)"name", 5);
5587 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
5589 /* PackageName value exists */
5591 lstrcpyA(buf, "apple");
5592 r = pMsiGetProductInfoExA(prodcode, NULL,
5593 MSIINSTALLCONTEXT_MACHINE,
5594 INSTALLPROPERTY_PACKAGENAME, buf, &sz);
5595 ok(r == ERROR_UNKNOWN_PRODUCT,
5596 "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r);
5597 ok(!lstrcmpA(buf, "apple"), "Expected buf to be unchanged, got %s\n", buf);
5598 ok(sz == MAX_PATH, "Expected MAX_PATH, got %d\n", sz);
5600 res = RegSetValueExA(propkey, "AuthorizedLUAApp", 0, REG_SZ, (LPBYTE)"auth", 5);
5601 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
5603 /* AuthorizedLUAApp value exists */
5605 lstrcpyA(buf, "apple");
5606 r = pMsiGetProductInfoExA(prodcode, NULL,
5607 MSIINSTALLCONTEXT_MACHINE,
5608 INSTALLPROPERTY_AUTHORIZED_LUA_APP, buf, &sz);
5609 ok(r == ERROR_UNKNOWN_PRODUCT,
5610 "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r);
5611 ok(!lstrcmpA(buf, "apple"), "Expected buf to be unchanged, got %s\n", buf);
5612 ok(sz == MAX_PATH, "Expected MAX_PATH, got %d\n", sz);
5614 RegDeleteValueA(propkey, "AuthorizedLUAApp");
5615 RegDeleteValueA(propkey, "PackageName");
5616 RegDeleteValueA(propkey, "ProductIcon");
5617 RegDeleteValueA(propkey, "Version");
5618 RegDeleteValueA(propkey, "PackageCode");
5619 RegDeleteValueA(propkey, "AssignmentType");
5620 RegDeleteValueA(propkey, "ProductName");
5621 RegDeleteValueA(propkey, "Language");
5622 RegDeleteValueA(propkey, "Transforms");
5623 RegDeleteValueA(propkey, "RegOwner");
5624 RegDeleteValueA(propkey, "RegCompany");
5625 RegDeleteValueA(propkey, "ProductID");
5626 RegDeleteValueA(propkey, "DisplayVersion");
5627 RegDeleteValueA(propkey, "VersionMajor");
5628 RegDeleteValueA(propkey, "VersionMinor");
5629 RegDeleteValueA(propkey, "URLUpdateInfo");
5630 RegDeleteValueA(propkey, "URLInfoAbout");
5631 RegDeleteValueA(propkey, "Publisher");
5632 RegDeleteValueA(propkey, "LocalPackage");
5633 RegDeleteValueA(propkey, "InstallSource");
5634 RegDeleteValueA(propkey, "InstallLocation");
5635 RegDeleteValueA(propkey, "DisplayName");
5636 RegDeleteValueA(propkey, "InstallDate");
5637 RegDeleteValueA(propkey, "HelpTelephone");
5638 RegDeleteValueA(propkey, "HelpLink");
5639 RegDeleteValueA(propkey, "LocalPackage");
5640 RegDeleteKeyA(propkey, "");
5641 RegCloseKey(propkey);
5642 RegDeleteKeyA(localkey, "");
5643 RegCloseKey(localkey);
5645 lstrcpyA(keypath, "Software\\Classes\\Installer\\Products\\");
5646 lstrcatA(keypath, prod_squashed);
5648 res = RegCreateKeyA(HKEY_LOCAL_MACHINE, keypath, &prodkey);
5649 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
5651 /* local classes product key exists */
5653 lstrcpyA(buf, "apple");
5654 r = pMsiGetProductInfoExA(prodcode, NULL,
5655 MSIINSTALLCONTEXT_MACHINE,
5656 INSTALLPROPERTY_PRODUCTSTATE, buf, &sz);
5657 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
5658 ok(!lstrcmpA(buf, "1"), "Expected \"1\", got \"%s\"\n", buf);
5659 ok(sz == 1, "Expected 1, got %d\n", sz);
5661 res = RegSetValueExA(prodkey, "HelpLink", 0, REG_SZ, (LPBYTE)"link", 5);
5662 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
5664 /* HelpLink value exists */
5666 lstrcpyA(buf, "apple");
5667 r = pMsiGetProductInfoExA(prodcode, NULL,
5668 MSIINSTALLCONTEXT_MACHINE,
5669 INSTALLPROPERTY_HELPLINK, buf, &sz);
5670 ok(r == ERROR_UNKNOWN_PROPERTY,
5671 "Expected ERROR_UNKNOWN_PROPERTY, got %d\n", r);
5672 ok(!lstrcmpA(buf, "apple"), "Expected buf to be unchanged, got %s\n", buf);
5673 ok(sz == MAX_PATH, "Expected MAX_PATH, got %d\n", sz);
5675 res = RegSetValueExA(prodkey, "HelpTelephone", 0, REG_SZ, (LPBYTE)"phone", 6);
5676 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
5678 /* HelpTelephone value exists */
5680 lstrcpyA(buf, "apple");
5681 r = pMsiGetProductInfoExA(prodcode, NULL,
5682 MSIINSTALLCONTEXT_MACHINE,
5683 INSTALLPROPERTY_HELPTELEPHONE, buf, &sz);
5684 ok(r == ERROR_UNKNOWN_PROPERTY,
5685 "Expected ERROR_UNKNOWN_PROPERTY, got %d\n", r);
5686 ok(!lstrcmpA(buf, "apple"), "Expected buf to be unchanged, got %s\n", buf);
5687 ok(sz == MAX_PATH, "Expected MAX_PATH, got %d\n", sz);
5689 res = RegSetValueExA(prodkey, "InstallDate", 0, REG_SZ, (LPBYTE)"date", 5);
5690 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
5692 /* InstallDate value exists */
5694 lstrcpyA(buf, "apple");
5695 r = pMsiGetProductInfoExA(prodcode, NULL,
5696 MSIINSTALLCONTEXT_MACHINE,
5697 INSTALLPROPERTY_INSTALLDATE, buf, &sz);
5698 ok(r == ERROR_UNKNOWN_PROPERTY,
5699 "Expected ERROR_UNKNOWN_PROPERTY, got %d\n", r);
5700 ok(!lstrcmpA(buf, "apple"), "Expected buf to be unchanged, got %s\n", buf);
5701 ok(sz == MAX_PATH, "Expected MAX_PATH, got %d\n", sz);
5703 res = RegSetValueExA(prodkey, "DisplayName", 0, REG_SZ, (LPBYTE)"name", 5);
5704 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
5706 /* DisplayName value exists */
5708 lstrcpyA(buf, "apple");
5709 r = pMsiGetProductInfoExA(prodcode, NULL,
5710 MSIINSTALLCONTEXT_MACHINE,
5711 INSTALLPROPERTY_INSTALLEDPRODUCTNAME, buf, &sz);
5712 ok(r == ERROR_UNKNOWN_PROPERTY,
5713 "Expected ERROR_UNKNOWN_PROPERTY, got %d\n", r);
5714 ok(!lstrcmpA(buf, "apple"), "Expected buf to be unchanged, got %s\n", buf);
5715 ok(sz == MAX_PATH, "Expected MAX_PATH, got %d\n", sz);
5717 res = RegSetValueExA(prodkey, "InstallLocation", 0, REG_SZ, (LPBYTE)"loc", 4);
5718 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
5720 /* InstallLocation value exists */
5722 lstrcpyA(buf, "apple");
5723 r = pMsiGetProductInfoExA(prodcode, NULL,
5724 MSIINSTALLCONTEXT_MACHINE,
5725 INSTALLPROPERTY_INSTALLLOCATION, buf, &sz);
5726 ok(r == ERROR_UNKNOWN_PROPERTY,
5727 "Expected ERROR_UNKNOWN_PROPERTY, got %d\n", r);
5728 ok(!lstrcmpA(buf, "apple"), "Expected buf to be unchanged, got %s\n", buf);
5729 ok(sz == MAX_PATH, "Expected MAX_PATH, got %d\n", sz);
5731 res = RegSetValueExA(prodkey, "InstallSource", 0, REG_SZ, (LPBYTE)"source", 7);
5732 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
5734 /* InstallSource value exists */
5736 lstrcpyA(buf, "apple");
5737 r = pMsiGetProductInfoExA(prodcode, NULL,
5738 MSIINSTALLCONTEXT_MACHINE,
5739 INSTALLPROPERTY_INSTALLSOURCE, buf, &sz);
5740 ok(r == ERROR_UNKNOWN_PROPERTY,
5741 "Expected ERROR_UNKNOWN_PROPERTY, got %d\n", r);
5742 ok(!lstrcmpA(buf, "apple"), "Expected buf to be unchanged, got %s\n", buf);
5743 ok(sz == MAX_PATH, "Expected MAX_PATH, got %d\n", sz);
5745 res = RegSetValueExA(prodkey, "LocalPackage", 0, REG_SZ, (LPBYTE)"local", 6);
5746 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
5748 /* LocalPackage value exists */
5750 lstrcpyA(buf, "apple");
5751 r = pMsiGetProductInfoExA(prodcode, NULL,
5752 MSIINSTALLCONTEXT_MACHINE,
5753 INSTALLPROPERTY_LOCALPACKAGE, buf, &sz);
5754 ok(r == ERROR_UNKNOWN_PROPERTY,
5755 "Expected ERROR_UNKNOWN_PROPERTY, got %d\n", r);
5756 ok(!lstrcmpA(buf, "apple"), "Expected buf to be unchanged, got %s\n", buf);
5757 ok(sz == MAX_PATH, "Expected MAX_PATH, got %d\n", sz);
5759 res = RegSetValueExA(prodkey, "Publisher", 0, REG_SZ, (LPBYTE)"pub", 4);
5760 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
5762 /* Publisher value exists */
5764 lstrcpyA(buf, "apple");
5765 r = pMsiGetProductInfoExA(prodcode, NULL,
5766 MSIINSTALLCONTEXT_MACHINE,
5767 INSTALLPROPERTY_PUBLISHER, buf, &sz);
5768 ok(r == ERROR_UNKNOWN_PROPERTY,
5769 "Expected ERROR_UNKNOWN_PROPERTY, got %d\n", r);
5770 ok(!lstrcmpA(buf, "apple"), "Expected buf to be unchanged, got %s\n", buf);
5771 ok(sz == MAX_PATH, "Expected MAX_PATH, got %d\n", sz);
5773 res = RegSetValueExA(prodkey, "URLInfoAbout", 0, REG_SZ, (LPBYTE)"about", 6);
5774 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
5776 /* URLInfoAbout value exists */
5778 lstrcpyA(buf, "apple");
5779 r = pMsiGetProductInfoExA(prodcode, NULL,
5780 MSIINSTALLCONTEXT_MACHINE,
5781 INSTALLPROPERTY_URLINFOABOUT, buf, &sz);
5782 ok(r == ERROR_UNKNOWN_PROPERTY,
5783 "Expected ERROR_UNKNOWN_PROPERTY, got %d\n", r);
5784 ok(!lstrcmpA(buf, "apple"), "Expected buf to be unchanged, got %s\n", buf);
5785 ok(sz == MAX_PATH, "Expected MAX_PATH, got %d\n", sz);
5787 res = RegSetValueExA(prodkey, "URLUpdateInfo", 0, REG_SZ, (LPBYTE)"update", 7);
5788 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
5790 /* URLUpdateInfo value exists */
5792 lstrcpyA(buf, "apple");
5793 r = pMsiGetProductInfoExA(prodcode, NULL,
5794 MSIINSTALLCONTEXT_MACHINE,
5795 INSTALLPROPERTY_URLUPDATEINFO, buf, &sz);
5796 ok(r == ERROR_UNKNOWN_PROPERTY,
5797 "Expected ERROR_UNKNOWN_PROPERTY, got %d\n", r);
5798 ok(!lstrcmpA(buf, "apple"), "Expected buf to be unchanged, got %s\n", buf);
5799 ok(sz == MAX_PATH, "Expected MAX_PATH, got %d\n", sz);
5801 res = RegSetValueExA(prodkey, "VersionMinor", 0, REG_SZ, (LPBYTE)"2", 2);
5802 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
5804 /* VersionMinor value exists */
5806 lstrcpyA(buf, "apple");
5807 r = pMsiGetProductInfoExA(prodcode, NULL,
5808 MSIINSTALLCONTEXT_MACHINE,
5809 INSTALLPROPERTY_VERSIONMINOR, buf, &sz);
5810 ok(r == ERROR_UNKNOWN_PROPERTY,
5811 "Expected ERROR_UNKNOWN_PROPERTY, got %d\n", r);
5812 ok(!lstrcmpA(buf, "apple"), "Expected buf to be unchanged, got %s\n", buf);
5813 ok(sz == MAX_PATH, "Expected MAX_PATH, got %d\n", sz);
5815 res = RegSetValueExA(prodkey, "VersionMajor", 0, REG_SZ, (LPBYTE)"3", 2);
5816 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
5818 /* VersionMajor value exists */
5820 lstrcpyA(buf, "apple");
5821 r = pMsiGetProductInfoExA(prodcode, NULL,
5822 MSIINSTALLCONTEXT_MACHINE,
5823 INSTALLPROPERTY_VERSIONMAJOR, buf, &sz);
5824 ok(r == ERROR_UNKNOWN_PROPERTY,
5825 "Expected ERROR_UNKNOWN_PROPERTY, got %d\n", r);
5826 ok(!lstrcmpA(buf, "apple"), "Expected buf to be unchanged, got %s\n", buf);
5827 ok(sz == MAX_PATH, "Expected MAX_PATH, got %d\n", sz);
5829 res = RegSetValueExA(prodkey, "DisplayVersion", 0, REG_SZ, (LPBYTE)"3.2.1", 6);
5830 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
5832 /* DisplayVersion value exists */
5834 lstrcpyA(buf, "apple");
5835 r = pMsiGetProductInfoExA(prodcode, NULL,
5836 MSIINSTALLCONTEXT_MACHINE,
5837 INSTALLPROPERTY_VERSIONSTRING, buf, &sz);
5838 ok(r == ERROR_UNKNOWN_PROPERTY,
5839 "Expected ERROR_UNKNOWN_PROPERTY, got %d\n", r);
5840 ok(!lstrcmpA(buf, "apple"), "Expected buf to be unchanged, got %s\n", buf);
5841 ok(sz == MAX_PATH, "Expected MAX_PATH, got %d\n", sz);
5843 res = RegSetValueExA(prodkey, "ProductID", 0, REG_SZ, (LPBYTE)"id", 3);
5844 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
5846 /* ProductID value exists */
5848 lstrcpyA(buf, "apple");
5849 r = pMsiGetProductInfoExA(prodcode, NULL,
5850 MSIINSTALLCONTEXT_MACHINE,
5851 INSTALLPROPERTY_PRODUCTID, buf, &sz);
5852 ok(r == ERROR_UNKNOWN_PROPERTY,
5853 "Expected ERROR_UNKNOWN_PROPERTY, got %d\n", r);
5854 ok(!lstrcmpA(buf, "apple"), "Expected buf to be unchanged, got %s\n", buf);
5855 ok(sz == MAX_PATH, "Expected MAX_PATH, got %d\n", sz);
5857 res = RegSetValueExA(prodkey, "RegCompany", 0, REG_SZ, (LPBYTE)"comp", 5);
5858 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
5860 /* RegCompany value exists */
5862 lstrcpyA(buf, "apple");
5863 r = pMsiGetProductInfoExA(prodcode, NULL,
5864 MSIINSTALLCONTEXT_MACHINE,
5865 INSTALLPROPERTY_REGCOMPANY, buf, &sz);
5866 ok(r == ERROR_UNKNOWN_PROPERTY,
5867 "Expected ERROR_UNKNOWN_PROPERTY, got %d\n", r);
5868 ok(!lstrcmpA(buf, "apple"), "Expected buf to be unchanged, got %s\n", buf);
5869 ok(sz == MAX_PATH, "Expected MAX_PATH, got %d\n", sz);
5871 res = RegSetValueExA(prodkey, "RegOwner", 0, REG_SZ, (LPBYTE)"owner", 6);
5872 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
5874 /* RegOwner value exists */
5876 lstrcpyA(buf, "apple");
5877 r = pMsiGetProductInfoExA(prodcode, NULL,
5878 MSIINSTALLCONTEXT_MACHINE,
5879 INSTALLPROPERTY_REGOWNER, buf, &sz);
5880 ok(r == ERROR_UNKNOWN_PROPERTY,
5881 "Expected ERROR_UNKNOWN_PROPERTY, got %d\n", r);
5882 ok(!lstrcmpA(buf, "apple"), "Expected buf to be unchanged, got %s\n", buf);
5883 ok(sz == MAX_PATH, "Expected MAX_PATH, got %d\n", sz);
5885 res = RegSetValueExA(prodkey, "Transforms", 0, REG_SZ, (LPBYTE)"trans", 6);
5886 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
5888 /* Transforms value exists */
5890 lstrcpyA(buf, "apple");
5891 r = pMsiGetProductInfoExA(prodcode, NULL,
5892 MSIINSTALLCONTEXT_MACHINE,
5893 INSTALLPROPERTY_TRANSFORMS, buf, &sz);
5894 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
5895 ok(!lstrcmpA(buf, "trans"), "Expected \"trans\", got \"%s\"\n", buf);
5896 ok(sz == 5, "Expected 5, got %d\n", sz);
5898 res = RegSetValueExA(prodkey, "Language", 0, REG_SZ, (LPBYTE)"lang", 5);
5899 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
5901 /* Language value exists */
5903 lstrcpyA(buf, "apple");
5904 r = pMsiGetProductInfoExA(prodcode, NULL,
5905 MSIINSTALLCONTEXT_MACHINE,
5906 INSTALLPROPERTY_LANGUAGE, buf, &sz);
5907 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
5908 ok(!lstrcmpA(buf, "lang"), "Expected \"lang\", got \"%s\"\n", buf);
5909 ok(sz == 4, "Expected 4, got %d\n", sz);
5911 res = RegSetValueExA(prodkey, "ProductName", 0, REG_SZ, (LPBYTE)"name", 5);
5912 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
5914 /* ProductName value exists */
5916 lstrcpyA(buf, "apple");
5917 r = pMsiGetProductInfoExA(prodcode, NULL,
5918 MSIINSTALLCONTEXT_MACHINE,
5919 INSTALLPROPERTY_PRODUCTNAME, buf, &sz);
5920 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
5921 ok(!lstrcmpA(buf, "name"), "Expected \"name\", got \"%s\"\n", buf);
5922 ok(sz == 4, "Expected 4, got %d\n", sz);
5924 res = RegSetValueExA(prodkey, "AssignmentType", 0, REG_SZ, (LPBYTE)"type", 5);
5925 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
5929 /* AssignmentType value exists */
5931 lstrcpyA(buf, "apple");
5932 r = pMsiGetProductInfoExA(prodcode, NULL,
5933 MSIINSTALLCONTEXT_MACHINE,
5934 INSTALLPROPERTY_ASSIGNMENTTYPE, buf, &sz);
5935 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
5936 ok(!lstrcmpA(buf, ""), "Expected \"\", got \"%s\"\n", buf);
5937 ok(sz == 0, "Expected 0, got %d\n", sz);
5939 res = RegSetValueExA(prodkey, "PackageCode", 0, REG_SZ, (LPBYTE)"code", 5);
5940 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
5944 /* PackageCode value exists */
5946 lstrcpyA(buf, "apple");
5947 r = pMsiGetProductInfoExA(prodcode, NULL,
5948 MSIINSTALLCONTEXT_MACHINE,
5949 INSTALLPROPERTY_PACKAGECODE, buf, &sz);
5952 ok(r == ERROR_BAD_CONFIGURATION,
5953 "Expected ERROR_BAD_CONFIGURATION, got %d\n", r);
5954 ok(!lstrcmpA(buf, "apple"), "Expected buf to be unchanged, got %s\n", buf);
5955 ok(sz == MAX_PATH, "Expected MAX_PATH, got %d\n", sz);
5958 res = RegSetValueExA(prodkey, "Version", 0, REG_SZ, (LPBYTE)"ver", 4);
5959 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
5961 /* Version value exists */
5963 lstrcpyA(buf, "apple");
5964 r = pMsiGetProductInfoExA(prodcode, NULL,
5965 MSIINSTALLCONTEXT_MACHINE,
5966 INSTALLPROPERTY_VERSION, buf, &sz);
5967 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
5968 ok(!lstrcmpA(buf, "ver"), "Expected \"ver\", got \"%s\"\n", buf);
5969 ok(sz == 3, "Expected 3, got %d\n", sz);
5971 res = RegSetValueExA(prodkey, "ProductIcon", 0, REG_SZ, (LPBYTE)"icon", 5);
5972 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
5974 /* ProductIcon value exists */
5976 lstrcpyA(buf, "apple");
5977 r = pMsiGetProductInfoExA(prodcode, NULL,
5978 MSIINSTALLCONTEXT_MACHINE,
5979 INSTALLPROPERTY_PRODUCTICON, buf, &sz);
5980 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
5981 ok(!lstrcmpA(buf, "icon"), "Expected \"icon\", got \"%s\"\n", buf);
5982 ok(sz == 4, "Expected 4, got %d\n", sz);
5984 res = RegSetValueExA(prodkey, "PackageName", 0, REG_SZ, (LPBYTE)"name", 5);
5985 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
5987 /* PackageName value exists */
5989 lstrcpyA(buf, "apple");
5990 r = pMsiGetProductInfoExA(prodcode, NULL,
5991 MSIINSTALLCONTEXT_MACHINE,
5992 INSTALLPROPERTY_PACKAGENAME, buf, &sz);
5995 ok(r == ERROR_UNKNOWN_PRODUCT,
5996 "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r);
5997 ok(!lstrcmpA(buf, "apple"), "Expected buf to be unchanged, got %s\n", buf);
5998 ok(sz == MAX_PATH, "Expected MAX_PATH, got %d\n", sz);
6001 res = RegSetValueExA(prodkey, "AuthorizedLUAApp", 0, REG_SZ, (LPBYTE)"auth", 5);
6002 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
6004 /* AuthorizedLUAApp value exists */
6006 lstrcpyA(buf, "apple");
6007 r = pMsiGetProductInfoExA(prodcode, NULL,
6008 MSIINSTALLCONTEXT_MACHINE,
6009 INSTALLPROPERTY_AUTHORIZED_LUA_APP, buf, &sz);
6010 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
6011 ok(!lstrcmpA(buf, "auth"), "Expected \"auth\", got \"%s\"\n", buf);
6012 ok(sz == 4, "Expected 4, got %d\n", sz);
6014 RegDeleteValueA(prodkey, "AuthorizedLUAApp");
6015 RegDeleteValueA(prodkey, "PackageName");
6016 RegDeleteValueA(prodkey, "ProductIcon");
6017 RegDeleteValueA(prodkey, "Version");
6018 RegDeleteValueA(prodkey, "PackageCode");
6019 RegDeleteValueA(prodkey, "AssignmentType");
6020 RegDeleteValueA(prodkey, "ProductName");
6021 RegDeleteValueA(prodkey, "Language");
6022 RegDeleteValueA(prodkey, "Transforms");
6023 RegDeleteValueA(prodkey, "RegOwner");
6024 RegDeleteValueA(prodkey, "RegCompany");
6025 RegDeleteValueA(prodkey, "ProductID");
6026 RegDeleteValueA(prodkey, "DisplayVersion");
6027 RegDeleteValueA(prodkey, "VersionMajor");
6028 RegDeleteValueA(prodkey, "VersionMinor");
6029 RegDeleteValueA(prodkey, "URLUpdateInfo");
6030 RegDeleteValueA(prodkey, "URLInfoAbout");
6031 RegDeleteValueA(prodkey, "Publisher");
6032 RegDeleteValueA(prodkey, "LocalPackage");
6033 RegDeleteValueA(prodkey, "InstallSource");
6034 RegDeleteValueA(prodkey, "InstallLocation");
6035 RegDeleteValueA(prodkey, "DisplayName");
6036 RegDeleteValueA(prodkey, "InstallDate");
6037 RegDeleteValueA(prodkey, "HelpTelephone");
6038 RegDeleteValueA(prodkey, "HelpLink");
6039 RegDeleteKeyA(prodkey, "");
6040 RegCloseKey(prodkey);
6045 init_functionpointers();
6049 test_getcomponentpath();
6050 test_MsiGetFileHash();
6052 if (!pConvertSidToStringSidA)
6053 skip("ConvertSidToStringSidA not implemented\n");
6056 /* These tests rely on get_user_sid that needs ConvertSidToStringSidA */
6057 test_MsiQueryProductState();
6058 test_MsiQueryFeatureState();
6059 test_MsiQueryComponentState();
6060 test_MsiGetComponentPath();
6061 test_MsiGetProductCode();
6062 test_MsiEnumClients();
6063 test_MsiGetProductInfo();
6064 test_MsiGetProductInfoEx();
6067 test_MsiGetFileVersion();