Update of Winetests of non autosynched Dlls. Done by Kamil Horniceck
[reactos.git] / rostests / winetests / msi / msi.c
1 /*
2 * tests for Microsoft Installer functionality
3 *
4 * Copyright 2005 Mike McCormack for CodeWeavers
5 *
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.
10 *
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.
15 *
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
19 */
20
21 #define _WIN32_MSI 300
22
23 #include <stdio.h>
24 #include <windows.h>
25 #include <msi.h>
26 #include <msiquery.h>
27 #include <sddl.h>
28
29 #include "wine/test.h"
30
31 static BOOL (WINAPI *pConvertSidToStringSidA)(PSID, LPSTR*);
32
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 );
47
48 static void init_functionpointers(void)
49 {
50 HMODULE hmsi = GetModuleHandleA("msi.dll");
51 HMODULE hadvapi32 = GetModuleHandleA("advapi32.dll");
52
53 #define GET_PROC(dll, func) \
54 p ## func = (void *)GetProcAddress(dll, #func); \
55 if(!p ## func) \
56 trace("GetProcAddress(%s) failed\n", #func);
57
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)
65
66 GET_PROC(hadvapi32, ConvertSidToStringSidA)
67
68 #undef GET_PROC
69 }
70
71 static void test_usefeature(void)
72 {
73 INSTALLSTATE r;
74
75 if (!pMsiUseFeatureExA)
76 {
77 skip("MsiUseFeatureExA not implemented\n");
78 return;
79 }
80
81 r = MsiQueryFeatureState(NULL,NULL);
82 ok( r == INSTALLSTATE_INVALIDARG, "wrong return val\n");
83
84 r = MsiQueryFeatureState("{9085040-6000-11d3-8cfe-0150048383c9}" ,NULL);
85 ok( r == INSTALLSTATE_INVALIDARG, "wrong return val\n");
86
87 r = pMsiUseFeatureExA(NULL,NULL,0,0);
88 ok( r == INSTALLSTATE_INVALIDARG, "wrong return val\n");
89
90 r = pMsiUseFeatureExA(NULL, "WORDVIEWFiles", -2, 1 );
91 ok( r == INSTALLSTATE_INVALIDARG, "wrong return val\n");
92
93 r = pMsiUseFeatureExA("{90850409-6000-11d3-8cfe-0150048383c9}",
94 NULL, -2, 0 );
95 ok( r == INSTALLSTATE_INVALIDARG, "wrong return val\n");
96
97 r = pMsiUseFeatureExA("{9085040-6000-11d3-8cfe-0150048383c9}",
98 "WORDVIEWFiles", -2, 0 );
99 ok( r == INSTALLSTATE_INVALIDARG, "wrong return val\n");
100
101 r = pMsiUseFeatureExA("{0085040-6000-11d3-8cfe-0150048383c9}",
102 "WORDVIEWFiles", -2, 0 );
103 ok( r == INSTALLSTATE_INVALIDARG, "wrong return val\n");
104
105 r = pMsiUseFeatureExA("{90850409-6000-11d3-8cfe-0150048383c9}",
106 "WORDVIEWFiles", -2, 1 );
107 ok( r == INSTALLSTATE_INVALIDARG, "wrong return val\n");
108 }
109
110 static void test_null(void)
111 {
112 MSIHANDLE hpkg;
113 UINT r;
114 HKEY hkey;
115 DWORD dwType, cbData;
116 LPBYTE lpData = NULL;
117 INSTALLSTATE state;
118
119 r = pMsiOpenPackageExW(NULL, 0, &hpkg);
120 ok( r == ERROR_INVALID_PARAMETER,"wrong error\n");
121
122 state = MsiQueryProductStateW(NULL);
123 ok( state == INSTALLSTATE_INVALIDARG, "wrong return\n");
124
125 r = MsiEnumFeaturesW(NULL,0,NULL,NULL);
126 ok( r == ERROR_INVALID_PARAMETER,"wrong error\n");
127
128 r = MsiConfigureFeatureW(NULL, NULL, 0);
129 ok( r == ERROR_INVALID_PARAMETER, "wrong error\n");
130
131 r = MsiConfigureFeatureA("{00000000-0000-0000-0000-000000000000}", NULL, 0);
132 ok( r == ERROR_INVALID_PARAMETER, "wrong error\n");
133
134 r = MsiConfigureFeatureA("{00000000-0000-0000-0000-000000000000}", "foo", 0);
135 ok( r == ERROR_INVALID_PARAMETER, "wrong error %d\n", r);
136
137 r = MsiConfigureFeatureA("{00000000-0000-0000-0000-000000000000}", "foo", INSTALLSTATE_DEFAULT);
138 ok( r == ERROR_UNKNOWN_PRODUCT, "wrong error %d\n", r);
139
140 /* make sure empty string to MsiGetProductInfo is not a handle to default registry value, saving and restoring the
141 * necessary registry values */
142
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);
146
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 )
150 {
151 lpData = HeapAlloc(GetProcessHeap(), 0, cbData);
152 if (!lpData)
153 skip("Out of memory\n");
154 else
155 {
156 r = RegQueryValueExA(hkey, NULL, 0, &dwType, lpData, &cbData);
157 ok ( r == ERROR_SUCCESS, "wrong error %d\n", r);
158 }
159 }
160
161 r = RegSetValueA(hkey, NULL, REG_SZ, "test", strlen("test"));
162 ok( r == ERROR_SUCCESS, "wrong error %d\n", r);
163
164 r = MsiGetProductInfoA("", "", NULL, NULL);
165 ok ( r == ERROR_INVALID_PARAMETER, "wrong error %d\n", r);
166
167 if (lpData)
168 {
169 r = RegSetValueExA(hkey, NULL, 0, dwType, lpData, cbData);
170 ok ( r == ERROR_SUCCESS, "wrong error %d\n", r);
171
172 HeapFree(GetProcessHeap(), 0, lpData);
173 }
174 else
175 {
176 r = RegDeleteValueA(hkey, NULL);
177 ok ( r == ERROR_SUCCESS, "wrong error %d\n", r);
178 }
179
180 r = RegCloseKey(hkey);
181 ok( r == ERROR_SUCCESS, "wrong error %d\n", r);
182
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);
186
187 r = RegSetValueA(hkey, NULL, REG_SZ, "test", strlen("test"));
188 ok( r == ERROR_SUCCESS, "wrong error %d\n", r);
189
190 r = MsiGetProductInfoA("{F1C3AF50-8B56-4A69-A00C-00773FE42F30}", "", NULL, NULL);
191 ok ( r == ERROR_UNKNOWN_PROPERTY, "wrong error %d\n", r);
192
193 r = RegCloseKey(hkey);
194 ok( r == ERROR_SUCCESS, "wrong error %d\n", r);
195
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);
198 }
199
200 static void test_getcomponentpath(void)
201 {
202 INSTALLSTATE r;
203 char buffer[0x100];
204 DWORD sz;
205
206 if(!pMsiGetComponentPathA)
207 return;
208
209 r = pMsiGetComponentPathA( NULL, NULL, NULL, NULL );
210 ok( r == INSTALLSTATE_INVALIDARG, "wrong return value\n");
211
212 r = pMsiGetComponentPathA( "bogus", "bogus", NULL, NULL );
213 ok( r == INSTALLSTATE_INVALIDARG, "wrong return value\n");
214
215 r = pMsiGetComponentPathA( "bogus", "{00000000-0000-0000-000000000000}", NULL, NULL );
216 ok( r == INSTALLSTATE_INVALIDARG, "wrong return value\n");
217
218 sz = sizeof buffer;
219 buffer[0]=0;
220 r = pMsiGetComponentPathA( "bogus", "{00000000-0000-0000-000000000000}", buffer, &sz );
221 ok( r == INSTALLSTATE_INVALIDARG, "wrong return value\n");
222
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");
226
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");
230
231 r = pMsiGetComponentPathA( "{00000409-78E1-11D2-B60F-006097C998E7}",
232 "{029E403D-A86A-1D11-5B5B0006799C897E}", buffer, &sz );
233 ok( r == INSTALLSTATE_INVALIDARG, "wrong return value\n");
234
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");
238 }
239
240 static void create_file(LPCSTR name, LPCSTR data, DWORD size)
241 {
242 HANDLE file;
243 DWORD written;
244
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);
248
249 if (size)
250 {
251 SetFilePointer(file, size, NULL, FILE_BEGIN);
252 SetEndOfFile(file);
253 }
254
255 CloseHandle(file);
256 }
257
258 #define HASHSIZE sizeof(MSIFILEHASHINFO)
259
260 static const struct
261 {
262 LPCSTR data;
263 DWORD size;
264 MSIFILEHASHINFO hash;
265 } hash_data[] =
266 {
267 { "abc", 0,
268 { HASHSIZE,
269 { 0x98500190, 0xb04fd23c, 0x7d3f96d6, 0x727fe128 },
270 },
271 },
272
273 { "C:\\Program Files\\msitest\\caesar\n", 0,
274 { HASHSIZE,
275 { 0x2b566794, 0xfd42181b, 0x2514d6e4, 0x5768b4e2 },
276 },
277 },
278
279 { "C:\\Program Files\\msitest\\caesar\n", 500,
280 { HASHSIZE,
281 { 0x58095058, 0x805efeff, 0x10f3483e, 0x0147d653 },
282 },
283 },
284 };
285
286 static void test_MsiGetFileHash(void)
287 {
288 const char name[] = "msitest.bin";
289 UINT r;
290 MSIFILEHASHINFO hash;
291 DWORD i;
292
293 if (!pMsiGetFileHashA)
294 {
295 skip("MsiGetFileHash not implemented\n");
296 return;
297 }
298
299 hash.dwFileHashInfoSize = sizeof(MSIFILEHASHINFO);
300
301 /* szFilePath is NULL */
302 r = pMsiGetFileHashA(NULL, 0, &hash);
303 ok(r == ERROR_INVALID_PARAMETER, "Expected ERROR_INVALID_PARAMETER, got %d\n", r);
304
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);
309
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);
313
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);
317
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);
322
323 /* pHash is NULL */
324 r = pMsiGetFileHashA(name, 0, NULL);
325 ok(r == ERROR_INVALID_PARAMETER, "Expected ERROR_INVALID_PARAMETER, got %d\n", r);
326
327 for (i = 0; i < sizeof(hash_data) / sizeof(hash_data[0]); i++)
328 {
329 create_file(name, hash_data[i].data, hash_data[i].size);
330
331 memset(&hash, 0, sizeof(MSIFILEHASHINFO));
332 hash.dwFileHashInfoSize = sizeof(MSIFILEHASHINFO);
333
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");
337
338 DeleteFile(name);
339 }
340 }
341
342 /* copied from dlls/msi/registry.c */
343 static BOOL squash_guid(LPCWSTR in, LPWSTR out)
344 {
345 DWORD i,n=1;
346 GUID guid;
347
348 if (FAILED(CLSIDFromString((LPOLESTR)in, &guid)))
349 return FALSE;
350
351 for(i=0; i<8; i++)
352 out[7-i] = in[n++];
353 n++;
354 for(i=0; i<4; i++)
355 out[11-i] = in[n++];
356 n++;
357 for(i=0; i<4; i++)
358 out[15-i] = in[n++];
359 n++;
360 for(i=0; i<2; i++)
361 {
362 out[17+i*2] = in[n++];
363 out[16+i*2] = in[n++];
364 }
365 n++;
366 for( ; i<8; i++)
367 {
368 out[17+i*2] = in[n++];
369 out[16+i*2] = in[n++];
370 }
371 out[32]=0;
372 return TRUE;
373 }
374
375 static void create_test_guid(LPSTR prodcode, LPSTR squashed)
376 {
377 WCHAR guidW[MAX_PATH];
378 WCHAR squashedW[MAX_PATH];
379 GUID guid;
380 HRESULT hr;
381 int size;
382
383 hr = CoCreateGuid(&guid);
384 ok(hr == S_OK, "Expected S_OK, got %d\n", hr);
385
386 size = StringFromGUID2(&guid, (LPOLESTR)guidW, MAX_PATH);
387 ok(size == 39, "Expected 39, got %d\n", hr);
388
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);
392 }
393
394 static void get_user_sid(LPSTR *usersid)
395 {
396 HANDLE token;
397 BYTE buf[1024];
398 DWORD size;
399 PTOKEN_USER user;
400
401 OpenProcessToken(GetCurrentProcess(), TOKEN_QUERY, &token);
402 size = sizeof(buf);
403 GetTokenInformation(token, TokenUser, (void *)buf, size, &size);
404 user = (PTOKEN_USER)buf;
405 pConvertSidToStringSidA(user->User.Sid, usersid);
406 }
407
408 static void test_MsiQueryProductState(void)
409 {
410 CHAR prodcode[MAX_PATH];
411 CHAR prod_squashed[MAX_PATH];
412 CHAR keypath[MAX_PATH*2];
413 LPSTR usersid;
414 INSTALLSTATE state;
415 LONG res;
416 HKEY userkey, localkey, props;
417 HKEY prodkey;
418 DWORD data;
419
420 create_test_guid(prodcode, prod_squashed);
421 get_user_sid(&usersid);
422
423 /* NULL prodcode */
424 state = MsiQueryProductStateA(NULL);
425 ok(state == INSTALLSTATE_INVALIDARG, "Expected INSTALLSTATE_INVALIDARG, got %d\n", state);
426
427 /* empty prodcode */
428 state = MsiQueryProductStateA("");
429 ok(state == INSTALLSTATE_INVALIDARG, "Expected INSTALLSTATE_INVALIDARG, got %d\n", state);
430
431 /* garbage prodcode */
432 state = MsiQueryProductStateA("garbage");
433 ok(state == INSTALLSTATE_INVALIDARG, "Expected INSTALLSTATE_INVALIDARG, got %d\n", state);
434
435 /* guid without brackets */
436 state = MsiQueryProductStateA("6700E8CF-95AB-4D9C-BC2C-15840DEA7A5D");
437 ok(state == INSTALLSTATE_INVALIDARG, "Expected INSTALLSTATE_INVALIDARG, got %d\n", state);
438
439 /* guid with brackets */
440 state = MsiQueryProductStateA("{6700E8CF-95AB-4D9C-BC2C-15840DEA7A5D}");
441 ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
442
443 /* same length as guid, but random */
444 state = MsiQueryProductStateA("A938G02JF-2NF3N93-VN3-2NNF-3KGKALDNF93");
445 ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
446
447 /* MSIINSTALLCONTEXT_USERUNMANAGED */
448
449 state = MsiQueryProductStateA(prodcode);
450 ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
451
452 lstrcpyA(keypath, "Software\\Microsoft\\Installer\\Products\\");
453 lstrcatA(keypath, prod_squashed);
454
455 res = RegCreateKeyA(HKEY_CURRENT_USER, keypath, &userkey);
456 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
457
458 /* user product key exists */
459 state = MsiQueryProductStateA(prodcode);
460 ok(state == INSTALLSTATE_ADVERTISED, "Expected INSTALLSTATE_ADVERTISED, got %d\n", state);
461
462 lstrcpyA(keypath, "Software\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\");
463 lstrcatA(keypath, prodcode);
464
465 res = RegCreateKeyA(HKEY_LOCAL_MACHINE, keypath, &localkey);
466 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
467
468 /* local uninstall key exists */
469 state = MsiQueryProductStateA(prodcode);
470 ok(state == INSTALLSTATE_ADVERTISED, "Expected INSTALLSTATE_ADVERTISED, got %d\n", state);
471
472 data = 1;
473 res = RegSetValueExA(localkey, "WindowsInstaller", 0, REG_DWORD, (const BYTE *)&data, sizeof(DWORD));
474 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
475
476 /* WindowsInstaller value exists */
477 state = MsiQueryProductStateA(prodcode);
478 ok(state == INSTALLSTATE_ADVERTISED, "Expected INSTALLSTATE_ADVERTISED, got %d\n", state);
479
480 RegDeleteValueA(localkey, "WindowsInstaller");
481 RegDeleteKeyA(localkey, "");
482
483 lstrcpyA(keypath, "Software\\Microsoft\\Windows\\CurrentVersion\\Installer\\UserData\\");
484 lstrcatA(keypath, usersid);
485 lstrcatA(keypath, "\\Products\\");
486 lstrcatA(keypath, prod_squashed);
487
488 res = RegCreateKeyA(HKEY_LOCAL_MACHINE, keypath, &localkey);
489 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
490
491 /* local product key exists */
492 state = MsiQueryProductStateA(prodcode);
493 ok(state == INSTALLSTATE_ADVERTISED, "Expected INSTALLSTATE_ADVERTISED, got %d\n", state);
494
495 res = RegCreateKeyA(localkey, "InstallProperties", &props);
496 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
497
498 /* install properties key exists */
499 state = MsiQueryProductStateA(prodcode);
500 ok(state == INSTALLSTATE_ADVERTISED, "Expected INSTALLSTATE_ADVERTISED, got %d\n", state);
501
502 data = 1;
503 res = RegSetValueExA(props, "WindowsInstaller", 0, REG_DWORD, (const BYTE *)&data, sizeof(DWORD));
504 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
505
506 /* WindowsInstaller value exists */
507 state = MsiQueryProductStateA(prodcode);
508 ok(state == INSTALLSTATE_DEFAULT, "Expected INSTALLSTATE_DEFAULT, got %d\n", state);
509
510 data = 2;
511 res = RegSetValueExA(props, "WindowsInstaller", 0, REG_DWORD, (const BYTE *)&data, sizeof(DWORD));
512 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
513
514 /* WindowsInstaller value is not 1 */
515 state = MsiQueryProductStateA(prodcode);
516 ok(state == INSTALLSTATE_DEFAULT, "Expected INSTALLSTATE_DEFAULT, got %d\n", state);
517
518 RegDeleteKeyA(userkey, "");
519
520 /* user product key does not exist */
521 state = MsiQueryProductStateA(prodcode);
522 ok(state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
523
524 RegDeleteValueA(props, "WindowsInstaller");
525 RegDeleteKeyA(props, "");
526 RegCloseKey(props);
527 RegDeleteKeyA(localkey, "");
528 RegCloseKey(localkey);
529 RegDeleteKeyA(userkey, "");
530 RegCloseKey(userkey);
531
532 /* MSIINSTALLCONTEXT_USERMANAGED */
533
534 lstrcpyA(keypath, "Software\\Microsoft\\Windows\\CurrentVersion\\Installer\\Managed\\");
535 lstrcatA(keypath, usersid);
536 lstrcatA(keypath, "\\Installer\\Products\\");
537 lstrcatA(keypath, prod_squashed);
538
539 res = RegCreateKeyA(HKEY_LOCAL_MACHINE, keypath, &prodkey);
540 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
541
542 state = MsiQueryProductStateA(prodcode);
543 ok(state == INSTALLSTATE_ADVERTISED,
544 "Expected INSTALLSTATE_ADVERTISED, got %d\n", state);
545
546 lstrcpyA(keypath, "Software\\Microsoft\\Windows\\CurrentVersion\\Installer\\UserData\\");
547 lstrcatA(keypath, usersid);
548 lstrcatA(keypath, "\\Products\\");
549 lstrcatA(keypath, prod_squashed);
550
551 res = RegCreateKeyA(HKEY_LOCAL_MACHINE, keypath, &localkey);
552 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
553
554 state = MsiQueryProductStateA(prodcode);
555 ok(state == INSTALLSTATE_ADVERTISED,
556 "Expected INSTALLSTATE_ADVERTISED, got %d\n", state);
557
558 res = RegCreateKeyA(localkey, "InstallProperties", &props);
559 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
560
561 state = MsiQueryProductStateA(prodcode);
562 ok(state == INSTALLSTATE_ADVERTISED,
563 "Expected INSTALLSTATE_ADVERTISED, got %d\n", state);
564
565 data = 1;
566 res = RegSetValueExA(props, "WindowsInstaller", 0, REG_DWORD, (const BYTE *)&data, sizeof(DWORD));
567 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
568
569 /* WindowsInstaller value exists */
570 state = MsiQueryProductStateA(prodcode);
571 ok(state == INSTALLSTATE_DEFAULT, "Expected INSTALLSTATE_DEFAULT, got %d\n", state);
572
573 RegDeleteValueA(props, "WindowsInstaller");
574 RegDeleteKeyA(props, "");
575 RegCloseKey(props);
576 RegDeleteKeyA(localkey, "");
577 RegCloseKey(localkey);
578 RegDeleteKeyA(prodkey, "");
579 RegCloseKey(prodkey);
580
581 /* MSIINSTALLCONTEXT_MACHINE */
582
583 lstrcpyA(keypath, "Software\\Classes\\Installer\\Products\\");
584 lstrcatA(keypath, prod_squashed);
585
586 res = RegCreateKeyA(HKEY_LOCAL_MACHINE, keypath, &prodkey);
587 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
588
589 state = MsiQueryProductStateA(prodcode);
590 ok(state == INSTALLSTATE_ADVERTISED, "Expected INSTALLSTATE_ADVERTISED, got %d\n", state);
591
592 lstrcpyA(keypath, "Software\\Microsoft\\Windows\\CurrentVersion\\Installer\\UserData\\");
593 lstrcatA(keypath, "S-1-5-18\\Products\\");
594 lstrcatA(keypath, prod_squashed);
595
596 res = RegCreateKeyA(HKEY_LOCAL_MACHINE, keypath, &localkey);
597 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
598
599 state = MsiQueryProductStateA(prodcode);
600 ok(state == INSTALLSTATE_ADVERTISED,
601 "Expected INSTALLSTATE_ADVERTISED, got %d\n", state);
602
603 res = RegCreateKeyA(localkey, "InstallProperties", &props);
604 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
605
606 state = MsiQueryProductStateA(prodcode);
607 ok(state == INSTALLSTATE_ADVERTISED,
608 "Expected INSTALLSTATE_ADVERTISED, got %d\n", state);
609
610 data = 1;
611 res = RegSetValueExA(props, "WindowsInstaller", 0, REG_DWORD, (const BYTE *)&data, sizeof(DWORD));
612 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
613
614 /* WindowsInstaller value exists */
615 state = MsiQueryProductStateA(prodcode);
616 ok(state == INSTALLSTATE_DEFAULT, "Expected INSTALLSTATE_DEFAULT, got %d\n", state);
617
618 RegDeleteValueA(props, "WindowsInstaller");
619 RegDeleteKeyA(props, "");
620 RegCloseKey(props);
621 RegDeleteKeyA(localkey, "");
622 RegCloseKey(localkey);
623 RegDeleteKeyA(prodkey, "");
624 RegCloseKey(prodkey);
625
626 LocalFree(usersid);
627 }
628
629 static const char table_enc85[] =
630 "!$%&'()*+,-.0123456789=?@ABCDEFGHIJKLMNO"
631 "PQRSTUVWXYZ[]^_`abcdefghijklmnopqrstuvwx"
632 "yz{}~";
633
634 /*
635 * Encodes a base85 guid given a GUID pointer
636 * Caller should provide a 21 character buffer for the encoded string.
637 *
638 * returns TRUE if successful, FALSE if not
639 */
640 static BOOL encode_base85_guid( GUID *guid, LPWSTR str )
641 {
642 unsigned int x, *p, i;
643
644 p = (unsigned int*) guid;
645 for( i=0; i<4; i++ )
646 {
647 x = p[i];
648 *str++ = table_enc85[x%85];
649 x = x/85;
650 *str++ = table_enc85[x%85];
651 x = x/85;
652 *str++ = table_enc85[x%85];
653 x = x/85;
654 *str++ = table_enc85[x%85];
655 x = x/85;
656 *str++ = table_enc85[x%85];
657 }
658 *str = 0;
659
660 return TRUE;
661 }
662
663 static void compose_base85_guid(LPSTR component, LPSTR comp_base85, LPSTR squashed)
664 {
665 WCHAR guidW[MAX_PATH];
666 WCHAR base85W[MAX_PATH];
667 WCHAR squashedW[MAX_PATH];
668 GUID guid;
669 HRESULT hr;
670 int size;
671
672 hr = CoCreateGuid(&guid);
673 ok(hr == S_OK, "Expected S_OK, got %d\n", hr);
674
675 size = StringFromGUID2(&guid, (LPOLESTR)guidW, MAX_PATH);
676 ok(size == 39, "Expected 39, got %d\n", hr);
677
678 WideCharToMultiByte(CP_ACP, 0, guidW, size, component, MAX_PATH, NULL, NULL);
679 encode_base85_guid(&guid, base85W);
680 WideCharToMultiByte(CP_ACP, 0, base85W, -1, comp_base85, MAX_PATH, NULL, NULL);
681 squash_guid(guidW, squashedW);
682 WideCharToMultiByte(CP_ACP, 0, squashedW, -1, squashed, MAX_PATH, NULL, NULL);
683 }
684
685 static void test_MsiQueryFeatureState(void)
686 {
687 HKEY userkey, localkey, compkey;
688 CHAR prodcode[MAX_PATH];
689 CHAR prod_squashed[MAX_PATH];
690 CHAR component[MAX_PATH];
691 CHAR comp_base85[MAX_PATH];
692 CHAR comp_squashed[MAX_PATH];
693 CHAR keypath[MAX_PATH*2];
694 INSTALLSTATE state;
695 LPSTR usersid;
696 LONG res;
697
698 create_test_guid(prodcode, prod_squashed);
699 compose_base85_guid(component, comp_base85, comp_squashed);
700 get_user_sid(&usersid);
701
702 /* NULL prodcode */
703 state = MsiQueryFeatureStateA(NULL, "feature");
704 ok(state == INSTALLSTATE_INVALIDARG, "Expected INSTALLSTATE_INVALIDARG, got %d\n", state);
705
706 /* empty prodcode */
707 state = MsiQueryFeatureStateA("", "feature");
708 ok(state == INSTALLSTATE_INVALIDARG, "Expected INSTALLSTATE_INVALIDARG, got %d\n", state);
709
710 /* garbage prodcode */
711 state = MsiQueryFeatureStateA("garbage", "feature");
712 ok(state == INSTALLSTATE_INVALIDARG, "Expected INSTALLSTATE_INVALIDARG, got %d\n", state);
713
714 /* guid without brackets */
715 state = MsiQueryFeatureStateA("6700E8CF-95AB-4D9C-BC2C-15840DEA7A5D", "feature");
716 ok(state == INSTALLSTATE_INVALIDARG, "Expected INSTALLSTATE_INVALIDARG, got %d\n", state);
717
718 /* guid with brackets */
719 state = MsiQueryFeatureStateA("{6700E8CF-95AB-4D9C-BC2C-15840DEA7A5D}", "feature");
720 ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
721
722 /* same length as guid, but random */
723 state = MsiQueryFeatureStateA("A938G02JF-2NF3N93-VN3-2NNF-3KGKALDNF93", "feature");
724 ok(state == INSTALLSTATE_INVALIDARG, "Expected INSTALLSTATE_INVALIDARG, got %d\n", state);
725
726 /* NULL szFeature */
727 state = MsiQueryFeatureStateA(prodcode, NULL);
728 ok(state == INSTALLSTATE_INVALIDARG, "Expected INSTALLSTATE_INVALIDARG, got %d\n", state);
729
730 /* empty szFeature */
731 state = MsiQueryFeatureStateA(prodcode, "");
732 ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
733
734 /* feature key does not exist yet */
735 state = MsiQueryFeatureStateA(prodcode, "feature");
736 ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
737
738 lstrcpyA(keypath, "Software\\Microsoft\\Installer\\Features\\");
739 lstrcatA(keypath, prod_squashed);
740
741 res = RegCreateKeyA(HKEY_CURRENT_USER, keypath, &userkey);
742 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
743
744 /* feature key exists */
745 state = MsiQueryFeatureStateA(prodcode, "feature");
746 ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
747
748 res = RegSetValueExA(userkey, "feature", 0, REG_SZ, (const BYTE *)"", 2);
749 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
750
751 state = MsiQueryFeatureStateA(prodcode, "feature");
752 ok(state == INSTALLSTATE_ADVERTISED, "Expected INSTALLSTATE_ADVERTISED, got %d\n", state);
753
754 lstrcpyA(keypath, "Software\\Microsoft\\Windows\\CurrentVersion\\Installer\\UserData\\");
755 lstrcatA(keypath, usersid);
756 lstrcatA(keypath, "\\Products\\");
757 lstrcatA(keypath, prod_squashed);
758 lstrcatA(keypath, "\\Features");
759
760 res = RegCreateKeyA(HKEY_LOCAL_MACHINE, keypath, &localkey);
761 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
762
763 state = MsiQueryFeatureStateA(prodcode, "feature");
764 ok(state == INSTALLSTATE_ADVERTISED, "Expected INSTALLSTATE_ADVERTISED, got %d\n", state);
765
766 res = RegSetValueExA(localkey, "feature", 0, REG_SZ, (const BYTE *)"aaaaaaaaaaaaaaaaaaa", 20);
767 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
768
769 state = MsiQueryFeatureStateA(prodcode, "feature");
770 ok(state == INSTALLSTATE_BADCONFIG, "Expected INSTALLSTATE_BADCONFIG, got %d\n", state);
771
772 res = RegSetValueExA(localkey, "feature", 0, REG_SZ, (const BYTE *)"aaaaaaaaaaaaaaaaaaaa", 21);
773 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
774
775 state = MsiQueryFeatureStateA(prodcode, "feature");
776 ok(state == INSTALLSTATE_ADVERTISED, "Expected INSTALLSTATE_ADVERTISED, got %d\n", state);
777
778 res = RegSetValueExA(localkey, "feature", 0, REG_SZ, (const BYTE *)"aaaaaaaaaaaaaaaaaaaaa", 22);
779 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
780
781 state = MsiQueryFeatureStateA(prodcode, "feature");
782 ok(state == INSTALLSTATE_ADVERTISED, "Expected INSTALLSTATE_ADVERTISED, got %d\n", state);
783
784 res = RegSetValueExA(localkey, "feature", 0, REG_SZ, (const BYTE *)comp_base85, 21);
785 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
786
787 state = MsiQueryFeatureStateA(prodcode, "feature");
788 ok(state == INSTALLSTATE_ADVERTISED, "Expected INSTALLSTATE_ADVERTISED, got %d\n", state);
789
790 lstrcpyA(keypath, "Software\\Microsoft\\Windows\\CurrentVersion\\Installer\\UserData\\");
791 lstrcatA(keypath, usersid);
792 lstrcatA(keypath, "\\Components\\");
793 lstrcatA(keypath, comp_squashed);
794
795 res = RegCreateKeyA(HKEY_LOCAL_MACHINE, keypath, &compkey);
796 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
797
798 state = MsiQueryFeatureStateA(prodcode, "feature");
799 ok(state == INSTALLSTATE_ADVERTISED, "Expected INSTALLSTATE_ADVERTISED, got %d\n", state);
800
801 res = RegSetValueExA(compkey, prod_squashed, 0, REG_SZ, (const BYTE *)"", 1);
802 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
803
804 state = MsiQueryFeatureStateA(prodcode, "feature");
805 ok(state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
806
807 res = RegSetValueExA(compkey, prod_squashed, 0, REG_SZ, (const BYTE *)"apple", 1);
808 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
809
810 state = MsiQueryFeatureStateA(prodcode, "feature");
811 ok(state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
812
813 RegDeleteValueA(compkey, prod_squashed);
814 RegDeleteValueA(compkey, "");
815 RegDeleteValueA(localkey, "feature");
816 RegDeleteValueA(userkey, "feature");
817 RegDeleteKeyA(userkey, "");
818 RegCloseKey(compkey);
819 RegCloseKey(localkey);
820 RegCloseKey(userkey);
821 }
822
823 static void test_MsiQueryComponentState(void)
824 {
825 HKEY compkey, prodkey;
826 CHAR prodcode[MAX_PATH];
827 CHAR prod_squashed[MAX_PATH];
828 CHAR component[MAX_PATH];
829 CHAR comp_base85[MAX_PATH];
830 CHAR comp_squashed[MAX_PATH];
831 CHAR keypath[MAX_PATH];
832 INSTALLSTATE state;
833 LPSTR usersid;
834 LONG res;
835 UINT r;
836
837 static const INSTALLSTATE MAGIC_ERROR = 0xdeadbeef;
838
839 if (!pMsiQueryComponentStateA)
840 {
841 skip("MsiQueryComponentStateA not implemented\n");
842 return;
843 }
844
845 create_test_guid(prodcode, prod_squashed);
846 compose_base85_guid(component, comp_base85, comp_squashed);
847 get_user_sid(&usersid);
848
849 /* NULL szProductCode */
850 state = MAGIC_ERROR;
851 r = pMsiQueryComponentStateA(NULL, NULL, MSIINSTALLCONTEXT_MACHINE, component, &state);
852 ok(r == ERROR_INVALID_PARAMETER, "Expected ERROR_INVALID_PARAMETER, got %d\n", r);
853 ok(state == MAGIC_ERROR, "Expected 0xdeadbeef, got %d\n", state);
854
855 /* empty szProductCode */
856 state = MAGIC_ERROR;
857 r = pMsiQueryComponentStateA("", NULL, MSIINSTALLCONTEXT_MACHINE, component, &state);
858 ok(r == ERROR_INVALID_PARAMETER, "Expected ERROR_INVALID_PARAMETER, got %d\n", r);
859 ok(state == MAGIC_ERROR, "Expected 0xdeadbeef, got %d\n", state);
860
861 /* random szProductCode */
862 state = MAGIC_ERROR;
863 r = pMsiQueryComponentStateA("random", NULL, MSIINSTALLCONTEXT_MACHINE, component, &state);
864 ok(r == ERROR_INVALID_PARAMETER, "Expected ERROR_INVALID_PARAMETER, got %d\n", r);
865 ok(state == MAGIC_ERROR, "Expected 0xdeadbeef, got %d\n", state);
866
867 /* GUID-length szProductCode */
868 state = MAGIC_ERROR;
869 r = pMsiQueryComponentStateA("DJANE93KNDNAS-2KN2NR93KMN3LN13=L1N3KDE", NULL, MSIINSTALLCONTEXT_MACHINE, component, &state);
870 ok(r == ERROR_INVALID_PARAMETER, "Expected ERROR_INVALID_PARAMETER, got %d\n", r);
871 ok(state == MAGIC_ERROR, "Expected 0xdeadbeef, got %d\n", state);
872
873 /* GUID-length with brackets */
874 state = MAGIC_ERROR;
875 r = pMsiQueryComponentStateA("{JANE93KNDNAS-2KN2NR93KMN3LN13=L1N3KD}", NULL, MSIINSTALLCONTEXT_MACHINE, component, &state);
876 ok(r == ERROR_INVALID_PARAMETER, "Expected ERROR_INVALID_PARAMETER, got %d\n", r);
877 ok(state == MAGIC_ERROR, "Expected 0xdeadbeef, got %d\n", state);
878
879 /* actual GUID */
880 state = MAGIC_ERROR;
881 r = pMsiQueryComponentStateA(prodcode, NULL, MSIINSTALLCONTEXT_MACHINE, component, &state);
882 ok(r == ERROR_UNKNOWN_PRODUCT, "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r);
883 ok(state == MAGIC_ERROR, "Expected 0xdeadbeef, got %d\n", state);
884
885 state = MAGIC_ERROR;
886 r = pMsiQueryComponentStateA(prodcode, NULL, MSIINSTALLCONTEXT_MACHINE, component, &state);
887 ok(r == ERROR_UNKNOWN_PRODUCT, "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r);
888 ok(state == MAGIC_ERROR, "Expected 0xdeadbeef, got %d\n", state);
889
890 lstrcpyA(keypath, "Software\\Classes\\Installer\\Products\\");
891 lstrcatA(keypath, prod_squashed);
892
893 res = RegCreateKeyA(HKEY_LOCAL_MACHINE, keypath, &prodkey);
894 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
895
896 state = MAGIC_ERROR;
897 r = pMsiQueryComponentStateA(prodcode, NULL, MSIINSTALLCONTEXT_MACHINE, component, &state);
898 ok(r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r);
899 ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
900
901 RegDeleteKeyA(prodkey, "");
902 RegCloseKey(prodkey);
903
904 /* create local system product key */
905 lstrcpyA(keypath, "Software\\Microsoft\\Windows\\CurrentVersion\\Installer\\UserData\\S-1-5-18\\Products\\");
906 lstrcatA(keypath, prod_squashed);
907 lstrcatA(keypath, "\\InstallProperties");
908
909 res = RegCreateKeyA(HKEY_LOCAL_MACHINE, keypath, &prodkey);
910 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
911
912 /* local system product key exists */
913 state = MAGIC_ERROR;
914 r = pMsiQueryComponentStateA(prodcode, NULL, MSIINSTALLCONTEXT_MACHINE, component, &state);
915 ok(r == ERROR_UNKNOWN_PRODUCT, "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r);
916 ok(state == MAGIC_ERROR, "Expected 0xdeadbeef, got %d\n", state);
917
918 res = RegSetValueExA(prodkey, "LocalPackage", 0, REG_SZ, (const BYTE *)"msitest.msi", 11);
919 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
920
921 /* LocalPackage value exists */
922 state = MAGIC_ERROR;
923 r = pMsiQueryComponentStateA(prodcode, NULL, MSIINSTALLCONTEXT_MACHINE, component, &state);
924 ok(r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r);
925 ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
926
927 lstrcpyA(keypath, "Software\\Microsoft\\Windows\\CurrentVersion\\Installer\\UserData\\S-1-5-18\\Components\\");
928 lstrcatA(keypath, comp_squashed);
929
930 res = RegCreateKeyA(HKEY_LOCAL_MACHINE, keypath, &compkey);
931 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
932
933 /* component key exists */
934 state = MAGIC_ERROR;
935 r = pMsiQueryComponentStateA(prodcode, NULL, MSIINSTALLCONTEXT_MACHINE, component, &state);
936 ok(r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r);
937 ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
938
939 res = RegSetValueExA(compkey, prod_squashed, 0, REG_SZ, (const BYTE *)"", 0);
940 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
941
942 /* component\product exists */
943 state = MAGIC_ERROR;
944 r = pMsiQueryComponentStateA(prodcode, NULL, MSIINSTALLCONTEXT_MACHINE, component, &state);
945 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
946 ok(state == INSTALLSTATE_NOTUSED, "Expected INSTALLSTATE_NOTUSED, got %d\n", state);
947
948 res = RegSetValueExA(compkey, prod_squashed, 0, REG_SZ, (const BYTE *)"hi", 2);
949 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
950
951 state = MAGIC_ERROR;
952 r = pMsiQueryComponentStateA(prodcode, NULL, MSIINSTALLCONTEXT_MACHINE, component, &state);
953 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
954 ok(state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
955
956 RegDeleteValueA(prodkey, "LocalPackage");
957 RegDeleteKeyA(prodkey, "");
958 RegDeleteValueA(compkey, prod_squashed);
959 RegDeleteKeyA(prodkey, "");
960 RegCloseKey(prodkey);
961 RegCloseKey(compkey);
962
963 /* MSIINSTALLCONTEXT_USERUNMANAGED */
964
965 state = MAGIC_ERROR;
966 r = pMsiQueryComponentStateA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED, component, &state);
967 ok(r == ERROR_UNKNOWN_PRODUCT, "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r);
968 ok(state == MAGIC_ERROR, "Expected 0xdeadbeef, got %d\n", state);
969
970 lstrcpyA(keypath, "Software\\Microsoft\\Installer\\Products\\");
971 lstrcatA(keypath, prod_squashed);
972
973 res = RegCreateKeyA(HKEY_CURRENT_USER, keypath, &prodkey);
974 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
975
976 state = MAGIC_ERROR;
977 r = pMsiQueryComponentStateA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED, component, &state);
978 ok(r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r);
979 ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
980
981 RegDeleteKeyA(prodkey, "");
982 RegCloseKey(prodkey);
983
984 lstrcpyA(keypath, "Software\\Microsoft\\Windows\\CurrentVersion\\Installer\\UserData\\");
985 lstrcatA(keypath, usersid);
986 lstrcatA(keypath, "\\Products\\");
987 lstrcatA(keypath, prod_squashed);
988 lstrcatA(keypath, "\\InstallProperties");
989
990 res = RegCreateKeyA(HKEY_LOCAL_MACHINE, keypath, &prodkey);
991 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
992
993 res = RegSetValueExA(prodkey, "LocalPackage", 0, REG_SZ, (const BYTE *)"msitest.msi", 11);
994 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
995
996 RegCloseKey(prodkey);
997
998 state = MAGIC_ERROR;
999 r = pMsiQueryComponentStateA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED, component, &state);
1000 ok(r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r);
1001 ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
1002
1003 lstrcpyA(keypath, "Software\\Microsoft\\Windows\\CurrentVersion\\Installer\\UserData\\");
1004 lstrcatA(keypath, usersid);
1005 lstrcatA(keypath, "\\Components\\");
1006 lstrcatA(keypath, comp_squashed);
1007
1008 res = RegCreateKeyA(HKEY_LOCAL_MACHINE, keypath, &compkey);
1009 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
1010
1011 /* component key exists */
1012 state = MAGIC_ERROR;
1013 r = pMsiQueryComponentStateA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED, component, &state);
1014 ok(r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r);
1015 ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
1016
1017 res = RegSetValueExA(compkey, prod_squashed, 0, REG_SZ, (const BYTE *)"", 0);
1018 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
1019
1020 /* component\product exists */
1021 state = MAGIC_ERROR;
1022 r = pMsiQueryComponentStateA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED, component, &state);
1023 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
1024 ok(state == INSTALLSTATE_NOTUSED, "Expected INSTALLSTATE_NOTUSED, got %d\n", state);
1025
1026 res = RegSetValueExA(compkey, prod_squashed, 0, REG_SZ, (const BYTE *)"hi", 2);
1027 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
1028
1029 state = MAGIC_ERROR;
1030 r = pMsiQueryComponentStateA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED, component, &state);
1031 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
1032 ok(state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
1033
1034 /* MSIINSTALLCONTEXT_USERMANAGED */
1035
1036 state = MAGIC_ERROR;
1037 r = pMsiQueryComponentStateA(prodcode, NULL, MSIINSTALLCONTEXT_USERMANAGED, component, &state);
1038 ok(r == ERROR_UNKNOWN_PRODUCT, "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r);
1039 ok(state == MAGIC_ERROR, "Expected 0xdeadbeef, got %d\n", state);
1040
1041 lstrcpyA(keypath, "Software\\Microsoft\\Installer\\Products\\");
1042 lstrcatA(keypath, prod_squashed);
1043
1044 res = RegCreateKeyA(HKEY_CURRENT_USER, keypath, &prodkey);
1045 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
1046
1047 state = MAGIC_ERROR;
1048 r = pMsiQueryComponentStateA(prodcode, NULL, MSIINSTALLCONTEXT_USERMANAGED, component, &state);
1049 ok(r == ERROR_UNKNOWN_PRODUCT, "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r);
1050 ok(state == MAGIC_ERROR, "Expected 0xdeadbeef, got %d\n", state);
1051
1052 RegDeleteKeyA(prodkey, "");
1053 RegCloseKey(prodkey);
1054
1055 lstrcpyA(keypath, "Software\\Microsoft\\Windows\\CurrentVersion\\Installer\\Managed\\");
1056 lstrcatA(keypath, usersid);
1057 lstrcatA(keypath, "\\Installer\\Products\\");
1058 lstrcatA(keypath, prod_squashed);
1059
1060 res = RegCreateKeyA(HKEY_LOCAL_MACHINE, keypath, &prodkey);
1061 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
1062
1063 state = MAGIC_ERROR;
1064 r = pMsiQueryComponentStateA(prodcode, NULL, MSIINSTALLCONTEXT_USERMANAGED, component, &state);
1065 ok(r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r);
1066 ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
1067
1068 RegDeleteKeyA(prodkey, "");
1069 RegCloseKey(prodkey);
1070
1071 lstrcpyA(keypath, "Software\\Microsoft\\Windows\\CurrentVersion\\Installer\\UserData\\");
1072 lstrcatA(keypath, usersid);
1073 lstrcatA(keypath, "\\Products\\");
1074 lstrcatA(keypath, prod_squashed);
1075 lstrcatA(keypath, "\\InstallProperties");
1076
1077 res = RegOpenKeyA(HKEY_LOCAL_MACHINE, keypath, &prodkey);
1078 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
1079
1080 res = RegSetValueExA(prodkey, "ManagedLocalPackage", 0, REG_SZ, (const BYTE *)"msitest.msi", 11);
1081 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
1082
1083 state = MAGIC_ERROR;
1084 r = pMsiQueryComponentStateA(prodcode, NULL, MSIINSTALLCONTEXT_USERMANAGED, component, &state);
1085 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
1086 ok(state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
1087
1088 RegDeleteValueA(prodkey, "LocalPackage");
1089 RegDeleteValueA(prodkey, "ManagedLocalPackage");
1090 RegDeleteKeyA(prodkey, "");
1091 RegDeleteValueA(compkey, prod_squashed);
1092 RegDeleteKeyA(compkey, "");
1093 RegCloseKey(prodkey);
1094 RegCloseKey(compkey);
1095 }
1096
1097 static void test_MsiGetComponentPath(void)
1098 {
1099 HKEY compkey, prodkey, installprop;
1100 CHAR prodcode[MAX_PATH];
1101 CHAR prod_squashed[MAX_PATH];
1102 CHAR component[MAX_PATH];
1103 CHAR comp_base85[MAX_PATH];
1104 CHAR comp_squashed[MAX_PATH];
1105 CHAR keypath[MAX_PATH];
1106 CHAR path[MAX_PATH];
1107 INSTALLSTATE state;
1108 LPSTR usersid;
1109 DWORD size, val;
1110 LONG res;
1111
1112 create_test_guid(prodcode, prod_squashed);
1113 compose_base85_guid(component, comp_base85, comp_squashed);
1114 get_user_sid(&usersid);
1115
1116 /* NULL szProduct */
1117 size = MAX_PATH;
1118 state = MsiGetComponentPathA(NULL, component, path, &size);
1119 ok(state == INSTALLSTATE_INVALIDARG, "Expected INSTALLSTATE_INVALIDARG, got %d\n", state);
1120 ok(size == MAX_PATH, "Expected size to be unchanged, got %d\n", size);
1121
1122 /* NULL szComponent */
1123 size = MAX_PATH;
1124 state = MsiGetComponentPathA(prodcode, NULL, path, &size);
1125 ok(state == INSTALLSTATE_INVALIDARG, "Expected INSTALLSTATE_INVALIDARG, got %d\n", state);
1126 ok(size == MAX_PATH, "Expected size to be unchanged, got %d\n", size);
1127
1128 /* NULL lpPathBuf */
1129 size = MAX_PATH;
1130 state = MsiGetComponentPathA(prodcode, component, NULL, &size);
1131 ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
1132 ok(size == MAX_PATH, "Expected size to be unchanged, got %d\n", size);
1133
1134 /* NULL pcchBuf */
1135 size = MAX_PATH;
1136 state = MsiGetComponentPathA(prodcode, component, path, NULL);
1137 ok(state == INSTALLSTATE_INVALIDARG, "Expected INSTALLSTATE_INVALIDARG, got %d\n", state);
1138 ok(size == MAX_PATH, "Expected size to be unchanged, got %d\n", size);
1139
1140 /* all params valid */
1141 size = MAX_PATH;
1142 state = MsiGetComponentPathA(prodcode, component, path, &size);
1143 ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
1144 ok(size == MAX_PATH, "Expected size to be unchanged, got %d\n", size);
1145
1146 lstrcpyA(keypath, "Software\\Microsoft\\Windows\\CurrentVersion\\");
1147 lstrcatA(keypath, "Installer\\UserData\\S-1-5-18\\Components\\");
1148 lstrcatA(keypath, comp_squashed);
1149
1150 res = RegCreateKeyA(HKEY_LOCAL_MACHINE, keypath, &compkey);
1151 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
1152
1153 /* local system component key exists */
1154 size = MAX_PATH;
1155 state = MsiGetComponentPathA(prodcode, component, path, &size);
1156 ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
1157 ok(size == MAX_PATH, "Expected size to be unchanged, got %d\n", size);
1158
1159 res = RegSetValueExA(compkey, prod_squashed, 0, REG_SZ, (const BYTE *)"C:\\imapath", 10);
1160 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
1161
1162 /* product value exists */
1163 size = MAX_PATH;
1164 state = MsiGetComponentPathA(prodcode, component, path, &size);
1165 ok(state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
1166 ok(!lstrcmpA(path, "C:\\imapath"), "Expected C:\\imapath, got %s\n", path);
1167 ok(size == 10, "Expected 10, got %d\n", size);
1168
1169 lstrcpyA(keypath, "Software\\Microsoft\\Windows\\CurrentVersion\\");
1170 lstrcatA(keypath, "Installer\\UserData\\S-1-5-18\\Products\\");
1171 lstrcatA(keypath, prod_squashed);
1172 lstrcatA(keypath, "\\InstallProperties");
1173
1174 res = RegCreateKeyA(HKEY_LOCAL_MACHINE, keypath, &installprop);
1175 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
1176
1177 val = 1;
1178 res = RegSetValueExA(installprop, "WindowsInstaller", 0, REG_DWORD, (const BYTE *)&val, sizeof(DWORD));
1179 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
1180
1181 /* install properties key exists */
1182 size = MAX_PATH;
1183 state = MsiGetComponentPathA(prodcode, component, path, &size);
1184 ok(state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
1185 ok(!lstrcmpA(path, "C:\\imapath"), "Expected C:\\imapath, got %s\n", path);
1186 ok(size == 10, "Expected 10, got %d\n", size);
1187
1188 create_file("C:\\imapath", "C:\\imapath", 11);
1189
1190 /* file exists */
1191 size = MAX_PATH;
1192 state = MsiGetComponentPathA(prodcode, component, path, &size);
1193 ok(state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
1194 ok(!lstrcmpA(path, "C:\\imapath"), "Expected C:\\imapath, got %s\n", path);
1195 ok(size == 10, "Expected 10, got %d\n", size);
1196
1197 RegDeleteValueA(compkey, prod_squashed);
1198 RegDeleteKeyA(compkey, "");
1199 RegDeleteValueA(installprop, "WindowsInstaller");
1200 RegDeleteKeyA(installprop, "");
1201 RegCloseKey(compkey);
1202 RegCloseKey(installprop);
1203 DeleteFileA("C:\\imapath");
1204
1205 lstrcpyA(keypath, "Software\\Microsoft\\Windows\\CurrentVersion\\");
1206 lstrcatA(keypath, "Installer\\UserData\\");
1207 lstrcatA(keypath, usersid);
1208 lstrcatA(keypath, "\\Components\\");
1209 lstrcatA(keypath, comp_squashed);
1210
1211 res = RegCreateKeyA(HKEY_LOCAL_MACHINE, keypath, &compkey);
1212 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
1213
1214 /* user managed component key exists */
1215 size = MAX_PATH;
1216 state = MsiGetComponentPathA(prodcode, component, path, &size);
1217 ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
1218 ok(size == MAX_PATH, "Expected size to be unchanged, got %d\n", size);
1219
1220 res = RegSetValueExA(compkey, prod_squashed, 0, REG_SZ, (const BYTE *)"C:\\imapath", 10);
1221 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
1222
1223 /* product value exists */
1224 size = MAX_PATH;
1225 state = MsiGetComponentPathA(prodcode, component, path, &size);
1226 ok(state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
1227 ok(!lstrcmpA(path, "C:\\imapath"), "Expected C:\\imapath, got %s\n", path);
1228 ok(size == 10, "Expected 10, got %d\n", size);
1229
1230 lstrcpyA(keypath, "Software\\Microsoft\\Windows\\CurrentVersion\\");
1231 lstrcatA(keypath, "Installer\\UserData\\S-1-5-18\\Products\\");
1232 lstrcatA(keypath, prod_squashed);
1233 lstrcatA(keypath, "\\InstallProperties");
1234
1235 res = RegCreateKeyA(HKEY_LOCAL_MACHINE, keypath, &installprop);
1236 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
1237
1238 val = 1;
1239 res = RegSetValueExA(installprop, "WindowsInstaller", 0, REG_DWORD, (const BYTE *)&val, sizeof(DWORD));
1240 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
1241
1242 /* install properties key exists */
1243 size = MAX_PATH;
1244 state = MsiGetComponentPathA(prodcode, component, path, &size);
1245 ok(state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
1246 ok(!lstrcmpA(path, "C:\\imapath"), "Expected C:\\imapath, got %s\n", path);
1247 ok(size == 10, "Expected 10, got %d\n", size);
1248
1249 create_file("C:\\imapath", "C:\\imapath", 11);
1250
1251 /* file exists */
1252 size = MAX_PATH;
1253 state = MsiGetComponentPathA(prodcode, component, path, &size);
1254 ok(state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
1255 ok(!lstrcmpA(path, "C:\\imapath"), "Expected C:\\imapath, got %s\n", path);
1256 ok(size == 10, "Expected 10, got %d\n", size);
1257
1258 RegDeleteValueA(compkey, prod_squashed);
1259 RegDeleteKeyA(compkey, "");
1260 RegDeleteValueA(installprop, "WindowsInstaller");
1261 RegDeleteKeyA(installprop, "");
1262 RegCloseKey(compkey);
1263 RegCloseKey(installprop);
1264 DeleteFileA("C:\\imapath");
1265
1266 lstrcpyA(keypath, "Software\\Microsoft\\Windows\\CurrentVersion\\");
1267 lstrcatA(keypath, "Installer\\Managed\\");
1268 lstrcatA(keypath, usersid);
1269 lstrcatA(keypath, "\\Installer\\Products\\");
1270 lstrcatA(keypath, prod_squashed);
1271
1272 res = RegCreateKeyA(HKEY_LOCAL_MACHINE, keypath, &prodkey);
1273 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
1274
1275 /* user managed product key exists */
1276 size = MAX_PATH;
1277 state = MsiGetComponentPathA(prodcode, component, path, &size);
1278 ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
1279 ok(size == MAX_PATH, "Expected size to be unchanged, got %d\n", size);
1280
1281 lstrcpyA(keypath, "Software\\Microsoft\\Windows\\CurrentVersion\\");
1282 lstrcatA(keypath, "Installer\\UserData\\");
1283 lstrcatA(keypath, usersid);
1284 lstrcatA(keypath, "\\Components\\");
1285 lstrcatA(keypath, comp_squashed);
1286
1287 res = RegCreateKeyA(HKEY_LOCAL_MACHINE, keypath, &compkey);
1288 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
1289
1290 /* user managed component key exists */
1291 size = MAX_PATH;
1292 state = MsiGetComponentPathA(prodcode, component, path, &size);
1293 ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
1294 ok(size == MAX_PATH, "Expected size to be unchanged, got %d\n", size);
1295
1296 res = RegSetValueExA(compkey, prod_squashed, 0, REG_SZ, (const BYTE *)"C:\\imapath", 10);
1297 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
1298
1299 /* product value exists */
1300 size = MAX_PATH;
1301 state = MsiGetComponentPathA(prodcode, component, path, &size);
1302 ok(state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
1303 ok(!lstrcmpA(path, "C:\\imapath"), "Expected C:\\imapath, got %s\n", path);
1304 ok(size == 10, "Expected 10, got %d\n", size);
1305
1306 lstrcpyA(keypath, "Software\\Microsoft\\Windows\\CurrentVersion\\");
1307 lstrcatA(keypath, "Installer\\UserData\\S-1-5-18\\Products\\");
1308 lstrcatA(keypath, prod_squashed);
1309 lstrcatA(keypath, "\\InstallProperties");
1310
1311 res = RegCreateKeyA(HKEY_LOCAL_MACHINE, keypath, &installprop);
1312 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
1313
1314 val = 1;
1315 res = RegSetValueExA(installprop, "WindowsInstaller", 0, REG_DWORD, (const BYTE *)&val, sizeof(DWORD));
1316 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
1317
1318 /* install properties key exists */
1319 size = MAX_PATH;
1320 state = MsiGetComponentPathA(prodcode, component, path, &size);
1321 ok(state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
1322 ok(!lstrcmpA(path, "C:\\imapath"), "Expected C:\\imapath, got %s\n", path);
1323 ok(size == 10, "Expected 10, got %d\n", size);
1324
1325 create_file("C:\\imapath", "C:\\imapath", 11);
1326
1327 /* file exists */
1328 size = MAX_PATH;
1329 state = MsiGetComponentPathA(prodcode, component, path, &size);
1330 ok(state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
1331 ok(!lstrcmpA(path, "C:\\imapath"), "Expected C:\\imapath, got %s\n", path);
1332 ok(size == 10, "Expected 10, got %d\n", size);
1333
1334 RegDeleteValueA(compkey, prod_squashed);
1335 RegDeleteKeyA(prodkey, "");
1336 RegDeleteKeyA(compkey, "");
1337 RegDeleteValueA(installprop, "WindowsInstaller");
1338 RegDeleteKeyA(installprop, "");
1339 RegCloseKey(prodkey);
1340 RegCloseKey(compkey);
1341 RegCloseKey(installprop);
1342 DeleteFileA("C:\\imapath");
1343
1344 lstrcpyA(keypath, "Software\\Microsoft\\Installer\\Products\\");
1345 lstrcatA(keypath, prod_squashed);
1346
1347 res = RegCreateKeyA(HKEY_CURRENT_USER, keypath, &prodkey);
1348 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
1349
1350 /* user unmanaged product key exists */
1351 size = MAX_PATH;
1352 state = MsiGetComponentPathA(prodcode, component, path, &size);
1353 ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
1354 ok(size == MAX_PATH, "Expected size to be unchanged, got %d\n", size);
1355
1356 lstrcpyA(keypath, "Software\\Microsoft\\Windows\\CurrentVersion\\");
1357 lstrcatA(keypath, "Installer\\UserData\\");
1358 lstrcatA(keypath, usersid);
1359 lstrcatA(keypath, "\\Components\\");
1360 lstrcatA(keypath, comp_squashed);
1361
1362 res = RegCreateKeyA(HKEY_LOCAL_MACHINE, keypath, &compkey);
1363 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
1364
1365 /* user unmanaged component key exists */
1366 size = MAX_PATH;
1367 state = MsiGetComponentPathA(prodcode, component, path, &size);
1368 ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
1369 ok(size == MAX_PATH, "Expected size to be unchanged, got %d\n", size);
1370
1371 res = RegSetValueExA(compkey, prod_squashed, 0, REG_SZ, (const BYTE *)"C:\\imapath", 10);
1372 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
1373
1374 /* product value exists */
1375 size = MAX_PATH;
1376 state = MsiGetComponentPathA(prodcode, component, path, &size);
1377 ok(state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
1378 ok(!lstrcmpA(path, "C:\\imapath"), "Expected C:\\imapath, got %s\n", path);
1379 ok(size == 10, "Expected 10, got %d\n", size);
1380
1381 create_file("C:\\imapath", "C:\\imapath", 11);
1382
1383 /* file exists */
1384 size = MAX_PATH;
1385 state = MsiGetComponentPathA(prodcode, component, path, &size);
1386 ok(state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
1387 ok(!lstrcmpA(path, "C:\\imapath"), "Expected C:\\imapath, got %s\n", path);
1388 ok(size == 10, "Expected 10, got %d\n", size);
1389
1390 RegDeleteValueA(compkey, prod_squashed);
1391 RegDeleteKeyA(prodkey, "");
1392 RegDeleteKeyA(compkey, "");
1393 RegCloseKey(prodkey);
1394 RegCloseKey(compkey);
1395 RegCloseKey(installprop);
1396 DeleteFileA("C:\\imapath");
1397
1398 lstrcpyA(keypath, "Software\\Classes\\Installer\\Products\\");
1399 lstrcatA(keypath, prod_squashed);
1400
1401 res = RegCreateKeyA(HKEY_LOCAL_MACHINE, keypath, &prodkey);
1402 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
1403
1404 /* local classes product key exists */
1405 size = MAX_PATH;
1406 state = MsiGetComponentPathA(prodcode, component, path, &size);
1407 ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
1408 ok(size == MAX_PATH, "Expected size to be unchanged, got %d\n", size);
1409
1410 lstrcpyA(keypath, "Software\\Microsoft\\Windows\\CurrentVersion\\");
1411 lstrcatA(keypath, "Installer\\UserData\\S-1-5-18\\Components\\");
1412 lstrcatA(keypath, comp_squashed);
1413
1414 res = RegCreateKeyA(HKEY_LOCAL_MACHINE, keypath, &compkey);
1415 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
1416
1417 /* local user component key exists */
1418 size = MAX_PATH;
1419 state = MsiGetComponentPathA(prodcode, component, path, &size);
1420 ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
1421 ok(size == MAX_PATH, "Expected size to be unchanged, got %d\n", size);
1422
1423 res = RegSetValueExA(compkey, prod_squashed, 0, REG_SZ, (const BYTE *)"C:\\imapath", 10);
1424 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
1425
1426 /* product value exists */
1427 size = MAX_PATH;
1428 state = MsiGetComponentPathA(prodcode, component, path, &size);
1429 ok(state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
1430 ok(!lstrcmpA(path, "C:\\imapath"), "Expected C:\\imapath, got %s\n", path);
1431 ok(size == 10, "Expected 10, got %d\n", size);
1432
1433 create_file("C:\\imapath", "C:\\imapath", 11);
1434
1435 /* file exists */
1436 size = MAX_PATH;
1437 state = MsiGetComponentPathA(prodcode, component, path, &size);
1438 ok(state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
1439 ok(!lstrcmpA(path, "C:\\imapath"), "Expected C:\\imapath, got %s\n", path);
1440 ok(size == 10, "Expected 10, got %d\n", size);
1441
1442 RegDeleteValueA(compkey, prod_squashed);
1443 RegDeleteKeyA(prodkey, "");
1444 RegDeleteKeyA(compkey, "");
1445 RegCloseKey(prodkey);
1446 RegCloseKey(compkey);
1447 DeleteFileA("C:\\imapath");
1448 }
1449
1450 static void test_MsiGetProductCode(void)
1451 {
1452 HKEY compkey, prodkey;
1453 CHAR prodcode[MAX_PATH];
1454 CHAR prod_squashed[MAX_PATH];
1455 CHAR prodcode2[MAX_PATH];
1456 CHAR prod2_squashed[MAX_PATH];
1457 CHAR component[MAX_PATH];
1458 CHAR comp_base85[MAX_PATH];
1459 CHAR comp_squashed[MAX_PATH];
1460 CHAR keypath[MAX_PATH];
1461 CHAR product[MAX_PATH];
1462 LPSTR usersid;
1463 LONG res;
1464 UINT r;
1465
1466 create_test_guid(prodcode, prod_squashed);
1467 create_test_guid(prodcode2, prod2_squashed);
1468 compose_base85_guid(component, comp_base85, comp_squashed);
1469 get_user_sid(&usersid);
1470
1471 /* szComponent is NULL */
1472 lstrcpyA(product, "prod");
1473 r = MsiGetProductCodeA(NULL, product);
1474 ok(r == ERROR_INVALID_PARAMETER, "Expected ERROR_INVALID_PARAMETER, got %d\n", r);
1475 ok(!lstrcmpA(product, "prod"), "Expected product to be unchanged, got %s\n", product);
1476
1477 /* szComponent is empty */
1478 lstrcpyA(product, "prod");
1479 r = MsiGetProductCodeA("", product);
1480 ok(r == ERROR_INVALID_PARAMETER, "Expected ERROR_INVALID_PARAMETER, got %d\n", r);
1481 ok(!lstrcmpA(product, "prod"), "Expected product to be unchanged, got %s\n", product);
1482
1483 /* garbage szComponent */
1484 lstrcpyA(product, "prod");
1485 r = MsiGetProductCodeA("garbage", product);
1486 ok(r == ERROR_INVALID_PARAMETER, "Expected ERROR_INVALID_PARAMETER, got %d\n", r);
1487 ok(!lstrcmpA(product, "prod"), "Expected product to be unchanged, got %s\n", product);
1488
1489 /* guid without brackets */
1490 lstrcpyA(product, "prod");
1491 r = MsiGetProductCodeA("6700E8CF-95AB-4D9C-BC2C-15840DEA7A5D", product);
1492 ok(r == ERROR_INVALID_PARAMETER, "Expected ERROR_INVALID_PARAMETER, got %d\n", r);
1493 ok(!lstrcmpA(product, "prod"), "Expected product to be unchanged, got %s\n", product);
1494
1495 /* guid with brackets */
1496 lstrcpyA(product, "prod");
1497 r = MsiGetProductCodeA("{6700E8CF-95AB-4D9C-BC2C-15840DEA7A5D}", product);
1498 ok(r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r);
1499 ok(!lstrcmpA(product, "prod"), "Expected product to be unchanged, got %s\n", product);
1500
1501 /* same length as guid, but random */
1502 lstrcpyA(product, "prod");
1503 r = MsiGetProductCodeA("A938G02JF-2NF3N93-VN3-2NNF-3KGKALDNF93", product);
1504 ok(r == ERROR_INVALID_PARAMETER, "Expected ERROR_INVALID_PARAMETER, got %d\n", r);
1505 ok(!lstrcmpA(product, "prod"), "Expected product to be unchanged, got %s\n", product);
1506
1507 /* all params correct, szComponent not published */
1508 lstrcpyA(product, "prod");
1509 r = MsiGetProductCodeA(component, product);
1510 ok(r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r);
1511 ok(!lstrcmpA(product, "prod"), "Expected product to be unchanged, got %s\n", product);
1512
1513 lstrcpyA(keypath, "Software\\Microsoft\\Windows\\CurrentVersion\\");
1514 lstrcatA(keypath, "Installer\\UserData\\");
1515 lstrcatA(keypath, usersid);
1516 lstrcatA(keypath, "\\Components\\");
1517 lstrcatA(keypath, comp_squashed);
1518
1519 res = RegCreateKeyA(HKEY_LOCAL_MACHINE, keypath, &compkey);
1520 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
1521
1522 /* user unmanaged 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);
1527
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);
1530
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);
1536
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);
1539
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);
1545
1546 res = RegCreateKeyA(HKEY_LOCAL_MACHINE, keypath, &prodkey);
1547 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
1548
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);
1554
1555 RegDeleteKeyA(prodkey, "");
1556 RegCloseKey(prodkey);
1557
1558 RegDeleteKeyA(prodkey, "");
1559 RegCloseKey(prodkey);
1560
1561 lstrcpyA(keypath, "Software\\Microsoft\\Installer\\Products\\");
1562 lstrcatA(keypath, prod_squashed);
1563
1564 res = RegCreateKeyA(HKEY_CURRENT_USER, keypath, &prodkey);
1565 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
1566
1567 /* user unmanaged product key exists */
1568 lstrcpyA(product, "prod");
1569 r = MsiGetProductCodeA(component, product);
1570 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
1571 ok(!lstrcmpA(product, prodcode), "Expected %s, got %s\n", prodcode, product);
1572
1573 RegDeleteKeyA(prodkey, "");
1574 RegCloseKey(prodkey);
1575
1576 lstrcpyA(keypath, "Software\\Classes\\Installer\\Products\\");
1577 lstrcatA(keypath, prod_squashed);
1578
1579 res = RegCreateKeyA(HKEY_LOCAL_MACHINE, keypath, &prodkey);
1580 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
1581
1582 /* local classes product key exists */
1583 lstrcpyA(product, "prod");
1584 r = MsiGetProductCodeA(component, product);
1585 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
1586 ok(!lstrcmpA(product, prodcode), "Expected %s, got %s\n", prodcode, product);
1587
1588 RegDeleteKeyA(prodkey, "");
1589 RegCloseKey(prodkey);
1590
1591 lstrcpyA(keypath, "Software\\Microsoft\\Windows\\CurrentVersion\\");
1592 lstrcatA(keypath, "Installer\\Managed\\");
1593 lstrcatA(keypath, usersid);
1594 lstrcatA(keypath, "\\Installer\\Products\\");
1595 lstrcatA(keypath, prod2_squashed);
1596
1597 res = RegCreateKeyA(HKEY_LOCAL_MACHINE, keypath, &prodkey);
1598 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
1599
1600 /* user managed product key of second product exists */
1601 lstrcpyA(product, "prod");
1602 r = MsiGetProductCodeA(component, product);
1603 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
1604 ok(!lstrcmpA(product, prodcode2), "Expected %s, got %s\n", prodcode2, product);
1605
1606 RegDeleteKeyA(prodkey, "");
1607 RegCloseKey(prodkey);
1608 RegDeleteValueA(compkey, prod_squashed);
1609 RegDeleteValueA(compkey, prod2_squashed);
1610 RegDeleteKeyA(compkey, "");
1611 RegCloseKey(compkey);
1612
1613 lstrcpyA(keypath, "Software\\Microsoft\\Windows\\CurrentVersion\\");
1614 lstrcatA(keypath, "Installer\\UserData\\S-1-5-18\\Components\\");
1615 lstrcatA(keypath, comp_squashed);
1616
1617 res = RegCreateKeyA(HKEY_LOCAL_MACHINE, keypath, &compkey);
1618 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
1619
1620 /* local user component key exists */
1621 lstrcpyA(product, "prod");
1622 r = MsiGetProductCodeA(component, product);
1623 ok(r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r);
1624 ok(!lstrcmpA(product, "prod"), "Expected product to be unchanged, got %s\n", product);
1625
1626 res = RegSetValueExA(compkey, prod_squashed, 0, REG_SZ, (const BYTE *)"C:\\imapath", 10);
1627 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
1628
1629 /* product value exists */
1630 lstrcpyA(product, "prod");
1631 r = MsiGetProductCodeA(component, product);
1632 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
1633 ok(!lstrcmpA(product, prodcode), "Expected %s, got %s\n", prodcode, product);
1634
1635 res = RegSetValueExA(compkey, prod2_squashed, 0, REG_SZ, (const BYTE *)"C:\\another", 10);
1636 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
1637
1638 lstrcpyA(keypath, "Software\\Microsoft\\Windows\\CurrentVersion\\");
1639 lstrcatA(keypath, "Installer\\Managed\\");
1640 lstrcatA(keypath, usersid);
1641 lstrcatA(keypath, "\\Installer\\Products\\");
1642 lstrcatA(keypath, prod_squashed);
1643
1644 res = RegCreateKeyA(HKEY_LOCAL_MACHINE, keypath, &prodkey);
1645 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
1646
1647 /* user managed product key of first product exists */
1648 lstrcpyA(product, "prod");
1649 r = MsiGetProductCodeA(component, product);
1650 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
1651 ok(!lstrcmpA(product, prodcode), "Expected %s, got %s\n", prodcode, product);
1652
1653 RegDeleteKeyA(prodkey, "");
1654 RegCloseKey(prodkey);
1655
1656 lstrcpyA(keypath, "Software\\Microsoft\\Installer\\Products\\");
1657 lstrcatA(keypath, prod_squashed);
1658
1659 res = RegCreateKeyA(HKEY_CURRENT_USER, keypath, &prodkey);
1660 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
1661
1662 /* user unmanaged product key exists */
1663 lstrcpyA(product, "prod");
1664 r = MsiGetProductCodeA(component, product);
1665 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
1666 ok(!lstrcmpA(product, prodcode), "Expected %s, got %s\n", prodcode, product);
1667
1668 RegDeleteKeyA(prodkey, "");
1669 RegCloseKey(prodkey);
1670
1671 lstrcpyA(keypath, "Software\\Classes\\Installer\\Products\\");
1672 lstrcatA(keypath, prod_squashed);
1673
1674 res = RegCreateKeyA(HKEY_LOCAL_MACHINE, keypath, &prodkey);
1675 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
1676
1677 /* local classes product key exists */
1678 lstrcpyA(product, "prod");
1679 r = MsiGetProductCodeA(component, 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);
1682
1683 RegDeleteKeyA(prodkey, "");
1684 RegCloseKey(prodkey);
1685
1686 lstrcpyA(keypath, "Software\\Microsoft\\Windows\\CurrentVersion\\");
1687 lstrcatA(keypath, "Installer\\Managed\\");
1688 lstrcatA(keypath, usersid);
1689 lstrcatA(keypath, "\\Installer\\Products\\");
1690 lstrcatA(keypath, prod2_squashed);
1691
1692 res = RegCreateKeyA(HKEY_LOCAL_MACHINE, keypath, &prodkey);
1693 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
1694
1695 /* user managed product key of second product exists */
1696 lstrcpyA(product, "prod");
1697 r = MsiGetProductCodeA(component, product);
1698 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
1699 ok(!lstrcmpA(product, prodcode2), "Expected %s, got %s\n", prodcode2, product);
1700
1701 RegDeleteKeyA(prodkey, "");
1702 RegCloseKey(prodkey);
1703 RegDeleteValueA(compkey, prod_squashed);
1704 RegDeleteValueA(compkey, prod2_squashed);
1705 RegDeleteKeyA(compkey, "");
1706 RegCloseKey(compkey);
1707 }
1708
1709 static void test_MsiEnumClients(void)
1710 {
1711 HKEY compkey;
1712 CHAR prodcode[MAX_PATH];
1713 CHAR prod_squashed[MAX_PATH];
1714 CHAR prodcode2[MAX_PATH];
1715 CHAR prod2_squashed[MAX_PATH];
1716 CHAR component[MAX_PATH];
1717 CHAR comp_base85[MAX_PATH];
1718 CHAR comp_squashed[MAX_PATH];
1719 CHAR product[MAX_PATH];
1720 CHAR keypath[MAX_PATH];
1721 LPSTR usersid;
1722 LONG res;
1723 UINT r;
1724
1725 create_test_guid(prodcode, prod_squashed);
1726 create_test_guid(prodcode2, prod2_squashed);
1727 compose_base85_guid(component, comp_base85, comp_squashed);
1728 get_user_sid(&usersid);
1729
1730 /* NULL szComponent */
1731 product[0] = '\0';
1732 r = MsiEnumClientsA(NULL, 0, product);
1733 ok(r == ERROR_INVALID_PARAMETER, "Expected ERROR_INVALID_PARAMETER, got %d\n", r);
1734 ok(!lstrcmpA(product, ""), "Expected product to be unchanged, got %s\n", product);
1735
1736 /* empty szComponent */
1737 product[0] = '\0';
1738 r = MsiEnumClientsA("", 0, product);
1739 ok(r == ERROR_INVALID_PARAMETER, "Expected ERROR_INVALID_PARAMETER, got %d\n", r);
1740 ok(!lstrcmpA(product, ""), "Expected product to be unchanged, got %s\n", product);
1741
1742 /* NULL lpProductBuf */
1743 r = MsiEnumClientsA(component, 0, NULL);
1744 ok(r == ERROR_INVALID_PARAMETER, "Expected ERROR_INVALID_PARAMETER, got %d\n", r);
1745
1746 /* all params correct, component missing */
1747 product[0] = '\0';
1748 r = MsiEnumClientsA(component, 0, product);
1749 ok(r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r);
1750 ok(!lstrcmpA(product, ""), "Expected product to be unchanged, got %s\n", product);
1751
1752 lstrcpyA(keypath, "Software\\Microsoft\\Windows\\CurrentVersion\\");
1753 lstrcatA(keypath, "Installer\\UserData\\");
1754 lstrcatA(keypath, usersid);
1755 lstrcatA(keypath, "\\Components\\");
1756 lstrcatA(keypath, comp_squashed);
1757
1758 res = RegCreateKeyA(HKEY_LOCAL_MACHINE, keypath, &compkey);
1759 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
1760
1761 /* user unmanaged component key exists */
1762 product[0] = '\0';
1763 r = MsiEnumClientsA(component, 0, product);
1764 ok(r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r);
1765 ok(!lstrcmpA(product, ""), "Expected product to be unchanged, got %s\n", product);
1766
1767 /* index > 0, no products exist */
1768 product[0] = '\0';
1769 r = MsiEnumClientsA(component, 1, product);
1770 ok(r == ERROR_INVALID_PARAMETER, "Expected ERROR_INVALID_PARAMETER, got %d\n", r);
1771 ok(!lstrcmpA(product, ""), "Expected product to be unchanged, got %s\n", product);
1772
1773 res = RegSetValueExA(compkey, prod_squashed, 0, REG_SZ, (const BYTE *)"C:\\imapath", 10);
1774 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
1775
1776 /* product value exists */
1777 r = MsiEnumClientsA(component, 0, product);
1778 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
1779 ok(!lstrcmpA(product, prodcode), "Expected %s, got %s\n", prodcode, product);
1780
1781 /* try index 0 again */
1782 product[0] = '\0';
1783 r = MsiEnumClientsA(component, 0, product);
1784 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
1785 ok(!lstrcmpA(product, prodcode), "Expected %s, got %s\n", prodcode, product);
1786
1787 /* try index 1, second product value does not exist */
1788 product[0] = '\0';
1789 r = MsiEnumClientsA(component, 1, product);
1790 ok(r == ERROR_NO_MORE_ITEMS, "Expected ERROR_NO_MORE_ITEMS, got %d\n", r);
1791 ok(!lstrcmpA(product, ""), "Expected product to be unchanged, got %s\n", product);
1792
1793 res = RegSetValueExA(compkey, prod2_squashed, 0, REG_SZ, (const BYTE *)"C:\\another", 10);
1794 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
1795
1796 /* try index 1, second product value does exist */
1797 product[0] = '\0';
1798 r = MsiEnumClientsA(component, 1, product);
1799 todo_wine
1800 {
1801 ok(r == ERROR_INVALID_PARAMETER, "Expected ERROR_INVALID_PARAMETER, got %d\n", r);
1802 ok(!lstrcmpA(product, ""), "Expected product to be unchanged, got %s\n", product);
1803 }
1804
1805 /* start the enumeration over */
1806 product[0] = '\0';
1807 r = MsiEnumClientsA(component, 0, product);
1808 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
1809 ok(!lstrcmpA(product, prodcode) || !lstrcmpA(product, prodcode2),
1810 "Expected %s or %s, got %s\n", prodcode, prodcode2, product);
1811
1812 /* correctly query second product */
1813 product[0] = '\0';
1814 r = MsiEnumClientsA(component, 1, product);
1815 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
1816 ok(!lstrcmpA(product, prodcode) || !lstrcmpA(product, prodcode2),
1817 "Expected %s or %s, got %s\n", prodcode, prodcode2, product);
1818
1819 RegDeleteValueA(compkey, prod_squashed);
1820 RegDeleteValueA(compkey, prod2_squashed);
1821 RegDeleteKeyA(compkey, "");
1822 RegCloseKey(compkey);
1823
1824 lstrcpyA(keypath, "Software\\Microsoft\\Windows\\CurrentVersion\\");
1825 lstrcatA(keypath, "Installer\\UserData\\S-1-5-18\\Components\\");
1826 lstrcatA(keypath, comp_squashed);
1827
1828 res = RegCreateKeyA(HKEY_LOCAL_MACHINE, keypath, &compkey);
1829 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
1830
1831 /* user local component key exists */
1832 product[0] = '\0';
1833 r = MsiEnumClientsA(component, 0, product);
1834 ok(r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r);
1835 ok(!lstrcmpA(product, ""), "Expected product to be unchanged, got %s\n", product);
1836
1837 /* index > 0, no products exist */
1838 product[0] = '\0';
1839 r = MsiEnumClientsA(component, 1, product);
1840 ok(r == ERROR_INVALID_PARAMETER, "Expected ERROR_INVALID_PARAMETER, got %d\n", r);
1841 ok(!lstrcmpA(product, ""), "Expected product to be unchanged, got %s\n", product);
1842
1843 res = RegSetValueExA(compkey, prod_squashed, 0, REG_SZ, (const BYTE *)"C:\\imapath", 10);
1844 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
1845
1846 /* product value exists */
1847 product[0] = '\0';
1848 r = MsiEnumClientsA(component, 0, product);
1849 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
1850 ok(!lstrcmpA(product, prodcode), "Expected %s, got %s\n", prodcode, product);
1851
1852 /* try index 0 again */
1853 product[0] = '\0';
1854 r = MsiEnumClientsA(component, 0, product);
1855 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
1856
1857 /* try index 1, second product value does not exist */
1858 product[0] = '\0';
1859 r = MsiEnumClientsA(component, 1, product);
1860 ok(r == ERROR_NO_MORE_ITEMS, "Expected ERROR_NO_MORE_ITEMS, got %d\n", r);
1861 ok(!lstrcmpA(product, ""), "Expected product to be unchanged, got %s\n", product);
1862
1863 res = RegSetValueExA(compkey, prod2_squashed, 0, REG_SZ, (const BYTE *)"C:\\another", 10);
1864 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
1865
1866 /* try index 1, second product value does exist */
1867 product[0] = '\0';
1868 r = MsiEnumClientsA(component, 1, product);
1869 todo_wine
1870 {
1871 ok(r == ERROR_INVALID_PARAMETER, "Expected ERROR_INVALID_PARAMETER, got %d\n", r);
1872 ok(!lstrcmpA(product, ""), "Expected product to be unchanged, got %s\n", product);
1873 }
1874
1875 /* start the enumeration over */
1876 product[0] = '\0';
1877 r = MsiEnumClientsA(component, 0, product);
1878 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
1879 ok(!lstrcmpA(product, prodcode) || !lstrcmpA(product, prodcode2),
1880 "Expected %s or %s, got %s\n", prodcode, prodcode2, product);
1881
1882 /* correctly query second product */
1883 product[0] = '\0';
1884 r = MsiEnumClientsA(component, 1, product);
1885 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
1886 ok(!lstrcmpA(product, prodcode) || !lstrcmpA(product, prodcode2),
1887 "Expected %s or %s, got %s\n", prodcode, prodcode2, product);
1888
1889 RegDeleteValueA(compkey, prod_squashed);
1890 RegDeleteValueA(compkey, prod2_squashed);
1891 RegDeleteKeyA(compkey, "");
1892 RegCloseKey(compkey);
1893 }
1894
1895 static void get_version_info(LPSTR path, LPSTR *vercheck, LPDWORD verchecksz,
1896 LPSTR *langcheck, LPDWORD langchecksz)
1897 {
1898 LPSTR version;
1899 VS_FIXEDFILEINFO *ffi;
1900 DWORD size = GetFileVersionInfoSizeA(path, NULL);
1901 USHORT *lang;
1902
1903 version = HeapAlloc(GetProcessHeap(), 0, size);
1904 GetFileVersionInfoA(path, 0, size, version);
1905
1906 VerQueryValueA(version, "\\", (LPVOID *)&ffi, &size);
1907 *vercheck = HeapAlloc(GetProcessHeap(), 0, MAX_PATH);
1908 sprintf(*vercheck, "%d.%d.%d.%d", HIWORD(ffi->dwFileVersionMS),
1909 LOWORD(ffi->dwFileVersionMS), HIWORD(ffi->dwFileVersionLS),
1910 LOWORD(ffi->dwFileVersionLS));
1911 *verchecksz = lstrlenA(*vercheck);
1912
1913 VerQueryValue(version, "\\VarFileInfo\\Translation", (void **)&lang, &size);
1914 *langcheck = HeapAlloc(GetProcessHeap(), 0, MAX_PATH);
1915 sprintf(*langcheck, "%d", *lang);
1916 *langchecksz = lstrlenA(*langcheck);
1917
1918 HeapFree(GetProcessHeap(), 0, version);
1919 }
1920
1921 static void test_MsiGetFileVersion(void)
1922 {
1923 UINT r;
1924 DWORD versz, langsz;
1925 char version[MAX_PATH];
1926 char lang[MAX_PATH];
1927 char path[MAX_PATH];
1928 LPSTR vercheck, langcheck;
1929 DWORD verchecksz, langchecksz;
1930
1931 /* NULL szFilePath */
1932 versz = MAX_PATH;
1933 langsz = MAX_PATH;
1934 lstrcpyA(version, "version");
1935 lstrcpyA(lang, "lang");
1936 r = MsiGetFileVersionA(NULL, version, &versz, lang, &langsz);
1937 ok(r == ERROR_INVALID_PARAMETER,
1938 "Expected ERROR_INVALID_PARAMETER, got %d\n", r);
1939 ok(!lstrcmpA(version, "version"),
1940 "Expected version to be unchanged, got %s\n", version);
1941 ok(versz == MAX_PATH, "Expected %d, got %d\n", MAX_PATH, versz);
1942 ok(!lstrcmpA(lang, "lang"),
1943 "Expected lang to be unchanged, got %s\n", lang);
1944 ok(langsz == MAX_PATH, "Expected %d, got %d\n", MAX_PATH, langsz);
1945
1946 /* empty szFilePath */
1947 versz = MAX_PATH;
1948 langsz = MAX_PATH;
1949 lstrcpyA(version, "version");
1950 lstrcpyA(lang, "lang");
1951 r = MsiGetFileVersionA("", version, &versz, lang, &langsz);
1952 ok(r == ERROR_FILE_NOT_FOUND,
1953 "Expected ERROR_FILE_NOT_FOUND, got %d\n", r);
1954 ok(!lstrcmpA(version, "version"),
1955 "Expected version to be unchanged, got %s\n", version);
1956 ok(versz == MAX_PATH, "Expected %d, got %d\n", MAX_PATH, versz);
1957 ok(!lstrcmpA(lang, "lang"),
1958 "Expected lang to be unchanged, got %s\n", lang);
1959 ok(langsz == MAX_PATH, "Expected %d, got %d\n", MAX_PATH, langsz);
1960
1961 /* nonexistent szFilePath */
1962 versz = MAX_PATH;
1963 langsz = MAX_PATH;
1964 lstrcpyA(version, "version");
1965 lstrcpyA(lang, "lang");
1966 r = MsiGetFileVersionA("nonexistent", version, &versz, lang, &langsz);
1967 ok(r == ERROR_FILE_NOT_FOUND,
1968 "Expected ERROR_FILE_NOT_FOUND, got %d\n", r);
1969 ok(!lstrcmpA(version, "version"),
1970 "Expected version to be unchanged, got %s\n", version);
1971 ok(versz == MAX_PATH, "Expected %d, got %d\n", MAX_PATH, versz);
1972 ok(!lstrcmpA(lang, "lang"),
1973 "Expected lang to be unchanged, got %s\n", lang);
1974 ok(langsz == MAX_PATH, "Expected %d, got %d\n", MAX_PATH, langsz);
1975
1976 /* nonexistent szFilePath, valid lpVersionBuf, NULL pcchVersionBuf */
1977 versz = MAX_PATH;
1978 langsz = MAX_PATH;
1979 lstrcpyA(version, "version");
1980 lstrcpyA(lang, "lang");
1981 r = MsiGetFileVersionA("nonexistent", version, NULL, lang, &langsz);
1982 ok(r == ERROR_INVALID_PARAMETER,
1983 "Expected ERROR_INVALID_PARAMETER, got %d\n", r);
1984 ok(!lstrcmpA(version, "version"),
1985 "Expected version to be unchanged, got %s\n", version);
1986 ok(versz == MAX_PATH, "Expected %d, got %d\n", MAX_PATH, versz);
1987 ok(!lstrcmpA(lang, "lang"),
1988 "Expected lang to be unchanged, got %s\n", lang);
1989 ok(langsz == MAX_PATH, "Expected %d, got %d\n", MAX_PATH, langsz);
1990
1991 /* nonexistent szFilePath, valid lpLangBuf, NULL pcchLangBuf */
1992 versz = MAX_PATH;
1993 langsz = MAX_PATH;
1994 lstrcpyA(version, "version");
1995 lstrcpyA(lang, "lang");
1996 r = MsiGetFileVersionA("nonexistent", version, &versz, lang, NULL);
1997 ok(r == ERROR_INVALID_PARAMETER,
1998 "Expected ERROR_INVALID_PARAMETER, got %d\n", r);
1999 ok(!lstrcmpA(version, "version"),
2000 "Expected version to be unchanged, got %s\n", version);
2001 ok(versz == MAX_PATH, "Expected %d, got %d\n", MAX_PATH, versz);
2002 ok(!lstrcmpA(lang, "lang"),
2003 "Expected lang to be unchanged, got %s\n", lang);
2004 ok(langsz == MAX_PATH, "Expected %d, got %d\n", MAX_PATH, langsz);
2005
2006 /* nonexistent szFilePath, valid lpVersionBuf, pcchVersionBuf is zero */
2007 versz = 0;
2008 langsz = MAX_PATH;
2009 lstrcpyA(version, "version");
2010 lstrcpyA(lang, "lang");
2011 r = MsiGetFileVersionA("nonexistent", version, &versz, lang, &langsz);
2012 ok(r == ERROR_FILE_NOT_FOUND,
2013 "Expected ERROR_FILE_NOT_FOUND, got %d\n", r);
2014 ok(!lstrcmpA(version, "version"),
2015 "Expected version to be unchanged, got %s\n", version);
2016 ok(versz == 0, "Expected 0, got %d\n", versz);
2017 ok(!lstrcmpA(lang, "lang"),
2018 "Expected lang to be unchanged, got %s\n", lang);
2019 ok(langsz == MAX_PATH, "Expected %d, got %d\n", MAX_PATH, langsz);
2020
2021 /* nonexistent szFilePath, valid lpLangBuf, pcchLangBuf is zero */
2022 versz = MAX_PATH;
2023 langsz = 0;
2024 lstrcpyA(version, "version");
2025 lstrcpyA(lang, "lang");
2026 r = MsiGetFileVersionA("nonexistent", version, &versz, lang, &langsz);
2027 ok(r == ERROR_FILE_NOT_FOUND,
2028 "Expected ERROR_FILE_NOT_FOUND, got %d\n", r);
2029 ok(!lstrcmpA(version, "version"),
2030 "Expected version to be unchanged, got %s\n", version);
2031 ok(versz == MAX_PATH, "Expected %d, got %d\n", MAX_PATH, versz);
2032 ok(!lstrcmpA(lang, "lang"),
2033 "Expected lang to be unchanged, got %s\n", lang);
2034 ok(langsz == 0, "Expected 0, got %d\n", langsz);
2035
2036 /* nonexistent szFilePath, rest NULL */
2037 r = MsiGetFileVersionA("nonexistent", NULL, NULL, NULL, NULL);
2038 ok(r == ERROR_FILE_NOT_FOUND,
2039 "Expected ERROR_FILE_NOT_FOUND, got %d\n", r);
2040
2041 create_file("ver.txt", "ver.txt", 20);
2042
2043 /* file exists, no version information */
2044 versz = MAX_PATH;
2045 langsz = MAX_PATH;
2046 lstrcpyA(version, "version");
2047 lstrcpyA(lang, "lang");
2048 r = MsiGetFileVersionA("ver.txt", version, &versz, lang, &langsz);
2049 ok(versz == MAX_PATH, "Expected %d, got %d\n", MAX_PATH, versz);
2050 ok(!lstrcmpA(version, "version"),
2051 "Expected version to be unchanged, got %s\n", version);
2052 ok(langsz == MAX_PATH, "Expected %d, got %d\n", MAX_PATH, langsz);
2053 ok(!lstrcmpA(lang, "lang"),
2054 "Expected lang to be unchanged, got %s\n", lang);
2055 ok(r == ERROR_FILE_INVALID,
2056 "Expected ERROR_FILE_INVALID, got %d\n", r);
2057
2058 DeleteFileA("ver.txt");
2059
2060 /* relative path, has version information */
2061 versz = MAX_PATH;
2062 langsz = MAX_PATH;
2063 lstrcpyA(version, "version");
2064 lstrcpyA(lang, "lang");
2065 r = MsiGetFileVersionA("kernel32.dll", version, &versz, lang, &langsz);
2066 todo_wine
2067 {
2068 ok(r == ERROR_FILE_NOT_FOUND,
2069 "Expected ERROR_FILE_NOT_FOUND, got %d\n", r);
2070 ok(!lstrcmpA(version, "version"),
2071 "Expected version to be unchanged, got %s\n", version);
2072 ok(versz == MAX_PATH, "Expected %d, got %d\n", MAX_PATH, versz);
2073 ok(!lstrcmpA(lang, "lang"),
2074 "Expected lang to be unchanged, got %s\n", lang);
2075 ok(langsz == MAX_PATH, "Expected %d, got %d\n", MAX_PATH, langsz);
2076 }
2077
2078 GetSystemDirectoryA(path, MAX_PATH);
2079 lstrcatA(path, "\\kernel32.dll");
2080
2081 get_version_info(path, &vercheck, &verchecksz, &langcheck, &langchecksz);
2082
2083 /* absolute path, has version information */
2084 versz = MAX_PATH;
2085 langsz = MAX_PATH;
2086 lstrcpyA(version, "version");
2087 lstrcpyA(lang, "lang");
2088 r = MsiGetFileVersionA(path, version, &versz, lang, &langsz);
2089 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
2090 ok(versz == verchecksz, "Expected %d, got %d\n", verchecksz, versz);
2091 ok(!lstrcmpA(lang, langcheck), "Expected %s, got %s\n", langcheck, lang);
2092 ok(langsz == langchecksz, "Expected %d, got %d\n", langchecksz, langsz);
2093 ok(!lstrcmpA(version, vercheck),
2094 "Expected %s, got %s\n", vercheck, version);
2095
2096 /* only check version */
2097 versz = MAX_PATH;
2098 lstrcpyA(version, "version");
2099 r = MsiGetFileVersionA(path, version, &versz, NULL, NULL);
2100 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
2101 ok(versz == verchecksz, "Expected %d, got %d\n", verchecksz, versz);
2102 ok(!lstrcmpA(version, vercheck),
2103 "Expected %s, got %s\n", vercheck, version);
2104
2105 /* only check language */
2106 langsz = MAX_PATH;
2107 lstrcpyA(lang, "lang");
2108 r = MsiGetFileVersionA(path, NULL, NULL, lang, &langsz);
2109 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
2110 ok(!lstrcmpA(lang, langcheck), "Expected %s, got %s\n", langcheck, lang);
2111 ok(langsz == langchecksz, "Expected %d, got %d\n", langchecksz, langsz);
2112
2113 /* get pcchVersionBuf */
2114 versz = MAX_PATH;
2115 r = MsiGetFileVersionA(path, NULL, &versz, NULL, NULL);
2116 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
2117 ok(versz == verchecksz, "Expected %d, got %d\n", verchecksz, versz);
2118
2119 /* get pcchLangBuf */
2120 langsz = MAX_PATH;
2121 r = MsiGetFileVersionA(path, NULL, NULL, NULL, &langsz);
2122 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
2123 ok(langsz == langchecksz, "Expected %d, got %d\n", langchecksz, langsz);
2124
2125 /* pcchVersionBuf not big enough */
2126 versz = 5;
2127 lstrcpyA(version, "version");
2128 r = MsiGetFileVersionA(path, version, &versz, NULL, NULL);
2129 ok(r == ERROR_MORE_DATA, "Expected ERROR_MORE_DATA, got %d\n", r);
2130 ok(!strncmp(version, vercheck, 4),
2131 "Expected first 4 characters of %s, got %s\n", vercheck, version);
2132 ok(versz == verchecksz, "Expected %d, got %d\n", verchecksz, versz);
2133
2134 /* pcchLangBuf not big enough */
2135 langsz = 3;
2136 lstrcpyA(lang, "lang");
2137 r = MsiGetFileVersionA(path, NULL, NULL, lang, &langsz);
2138 ok(r == ERROR_MORE_DATA, "Expected ERROR_MORE_DATA, got %d\n", r);
2139 ok(!strncmp(lang, langcheck, 2),
2140 "Expected first character of %s, got %s\n", langcheck, lang);
2141 ok(langsz == langchecksz, "Expected %d, got %d\n", langchecksz, langsz);
2142
2143 HeapFree(GetProcessHeap(), 0, vercheck);
2144 HeapFree(GetProcessHeap(), 0, langcheck);
2145 }
2146
2147 static void test_MsiGetProductInfo(void)
2148 {
2149 UINT r;
2150 LONG res;
2151 HKEY propkey, source;
2152 HKEY prodkey, localkey;
2153 CHAR prodcode[MAX_PATH];
2154 CHAR prod_squashed[MAX_PATH];
2155 CHAR packcode[MAX_PATH];
2156 CHAR pack_squashed[MAX_PATH];
2157 CHAR buf[MAX_PATH];
2158 CHAR keypath[MAX_PATH];
2159 LPSTR usersid;
2160 DWORD sz, val = 42;
2161
2162 create_test_guid(prodcode, prod_squashed);
2163 create_test_guid(packcode, pack_squashed);
2164 get_user_sid(&usersid);
2165
2166 /* NULL szProduct */
2167 sz = MAX_PATH;
2168 lstrcpyA(buf, "apple");
2169 r = MsiGetProductInfoA(NULL, INSTALLPROPERTY_HELPLINK, buf, &sz);
2170 ok(r == ERROR_INVALID_PARAMETER,
2171 "Expected ERROR_INVALID_PARAMETER, got %d\n", r);
2172 ok(!lstrcmpA(buf, "apple"), "Expected buf to be unchanged, got %s\n", buf);
2173 ok(sz == MAX_PATH, "Expected MAX_PATH, got %d\n", sz);
2174
2175 /* empty szProduct */
2176 sz = MAX_PATH;
2177 lstrcpyA(buf, "apple");
2178 r = MsiGetProductInfoA("", INSTALLPROPERTY_HELPLINK, buf, &sz);
2179 ok(r == ERROR_INVALID_PARAMETER,
2180 "Expected ERROR_INVALID_PARAMETER, got %d\n", r);
2181 ok(!lstrcmpA(buf, "apple"), "Expected buf to be unchanged, got %s\n", buf);
2182 ok(sz == MAX_PATH, "Expected MAX_PATH, got %d\n", sz);
2183
2184 /* garbage szProduct */
2185 sz = MAX_PATH;
2186 lstrcpyA(buf, "apple");
2187 r = MsiGetProductInfoA("garbage", INSTALLPROPERTY_HELPLINK, buf, &sz);
2188 ok(r == ERROR_INVALID_PARAMETER,
2189 "Expected ERROR_INVALID_PARAMETER, got %d\n", r);
2190 ok(!lstrcmpA(buf, "apple"), "Expected buf to be unchanged, got %s\n", buf);
2191 ok(sz == MAX_PATH, "Expected MAX_PATH, got %d\n", sz);
2192
2193 /* guid without brackets */
2194 sz = MAX_PATH;
2195 lstrcpyA(buf, "apple");
2196 r = MsiGetProductInfoA("6700E8CF-95AB-4D9C-BC2C-15840DEA7A5D",
2197 INSTALLPROPERTY_HELPLINK, buf, &sz);
2198 ok(r == ERROR_INVALID_PARAMETER,
2199 "Expected ERROR_INVALID_PARAMETER, got %d\n", r);
2200 ok(!lstrcmpA(buf, "apple"), "Expected buf to be unchanged, got %s\n", buf);
2201 ok(sz == MAX_PATH, "Expected MAX_PATH, got %d\n", sz);
2202
2203 /* guid with brackets */
2204 sz = MAX_PATH;
2205 lstrcpyA(buf, "apple");
2206 r = MsiGetProductInfoA("{6700E8CF-95AB-4D9C-BC2C-15840DEA7A5D}",
2207 INSTALLPROPERTY_HELPLINK, buf, &sz);
2208 ok(r == ERROR_UNKNOWN_PRODUCT,
2209 "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r);
2210 ok(!lstrcmpA(buf, "apple"), "Expected buf to be unchanged, got %s\n", buf);
2211 ok(sz == MAX_PATH, "Expected MAX_PATH, got %d\n", sz);
2212
2213 /* same length as guid, but random */
2214 sz = MAX_PATH;
2215 lstrcpyA(buf, "apple");
2216 r = MsiGetProductInfoA("A938G02JF-2NF3N93-VN3-2NNF-3KGKALDNF93",
2217 INSTALLPROPERTY_HELPLINK, buf, &sz);
2218 ok(r == ERROR_INVALID_PARAMETER,
2219 "Expected ERROR_INVALID_PARAMETER, got %d\n", r);
2220 ok(!lstrcmpA(buf, "apple"), "Expected buf to be unchanged, got %s\n", buf);
2221 ok(sz == MAX_PATH, "Expected MAX_PATH, got %d\n", sz);
2222
2223 /* not installed, NULL szAttribute */
2224 sz = MAX_PATH;
2225 lstrcpyA(buf, "apple");
2226 r = MsiGetProductInfoA(prodcode, NULL, buf, &sz);
2227 ok(r == ERROR_INVALID_PARAMETER,
2228 "Expected ERROR_INVALID_PARAMETER, got %d\n", r);
2229 ok(!lstrcmpA(buf, "apple"), "Expected buf to be unchanged, got %s\n", buf);
2230 ok(sz == MAX_PATH, "Expected MAX_PATH, got %d\n", sz);
2231
2232 /* not installed, NULL lpValueBuf */
2233 sz = MAX_PATH;
2234 lstrcpyA(buf, "apple");
2235 r = MsiGetProductInfoA(prodcode, INSTALLPROPERTY_HELPLINK, NULL, &sz);
2236 ok(r == ERROR_UNKNOWN_PRODUCT,
2237 "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r);
2238 ok(!lstrcmpA(buf, "apple"), "Expected buf to be unchanged, got %s\n", buf);
2239 ok(sz == MAX_PATH, "Expected MAX_PATH, got %d\n", sz);
2240
2241 /* not installed, NULL pcchValueBuf */
2242 sz = MAX_PATH;
2243 lstrcpyA(buf, "apple");
2244 r = MsiGetProductInfoA(prodcode, INSTALLPROPERTY_HELPLINK, buf, NULL);
2245 ok(r == ERROR_INVALID_PARAMETER,
2246 "Expected ERROR_INVALID_PARAMETER, got %d\n", r);
2247 ok(!lstrcmpA(buf, "apple"), "Expected buf to be unchanged, got %s\n", buf);
2248 ok(sz == MAX_PATH, "Expected MAX_PATH, got %d\n", sz);
2249
2250 /* created guid cannot possibly be an installed product code */
2251 sz = MAX_PATH;
2252 lstrcpyA(buf, "apple");
2253 r = MsiGetProductInfoA(prodcode, INSTALLPROPERTY_HELPLINK, buf, &sz);
2254 ok(r == ERROR_UNKNOWN_PRODUCT,
2255 "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r);
2256 ok(!lstrcmpA(buf, "apple"), "Expected buf to be unchanged, got %s\n", buf);
2257 ok(sz == MAX_PATH, "Expected MAX_PATH, got %d\n", sz);
2258
2259 lstrcpyA(keypath, "Software\\Microsoft\\Windows\\CurrentVersion\\Installer\\Managed\\");
2260 lstrcatA(keypath, usersid);
2261 lstrcatA(keypath, "\\Installer\\Products\\");
2262 lstrcatA(keypath, prod_squashed);
2263
2264 res = RegCreateKeyA(HKEY_LOCAL_MACHINE, keypath, &prodkey);
2265 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
2266
2267 /* managed product code exists */
2268 sz = MAX_PATH;
2269 lstrcpyA(buf, "apple");
2270 r = MsiGetProductInfoA(prodcode, INSTALLPROPERTY_HELPLINK, buf, &sz);
2271 ok(r == ERROR_UNKNOWN_PROPERTY,
2272 "Expected ERROR_UNKNOWN_PROPERTY, got %d\n", r);
2273 ok(!lstrcmpA(buf, "apple"), "Expected buf to be unchanged, got %s\n", buf);
2274 ok(sz == MAX_PATH, "Expected MAX_PATH, got %d\n", sz);
2275
2276 RegDeleteKeyA(prodkey, "");
2277 RegCloseKey(prodkey);
2278
2279 lstrcpyA(keypath, "Software\\Microsoft\\Windows\\CurrentVersion\\Installer\\UserData\\");
2280 lstrcatA(keypath, usersid);
2281 lstrcatA(keypath, "\\Products\\");
2282 lstrcatA(keypath, prod_squashed);
2283
2284 res = RegCreateKeyA(HKEY_LOCAL_MACHINE, keypath, &localkey);
2285 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
2286
2287 /* local user product code exists */
2288 sz = MAX_PATH;
2289 lstrcpyA(buf, "apple");
2290 r = MsiGetProductInfoA(prodcode, INSTALLPROPERTY_HELPLINK, buf, &sz);
2291 ok(r == ERROR_UNKNOWN_PRODUCT,
2292 "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r);
2293 ok(!lstrcmpA(buf, "apple"), "Expected buf to be unchanged, got %s\n", buf);
2294 ok(sz == MAX_PATH, "Expected MAX_PATH, got %d\n", sz);
2295
2296 lstrcpyA(keypath, "Software\\Microsoft\\Windows\\CurrentVersion\\Installer\\Managed\\");
2297 lstrcatA(keypath, usersid);
2298 lstrcatA(keypath, "\\Installer\\Products\\");
2299 lstrcatA(keypath, prod_squashed);
2300
2301 res = RegCreateKeyA(HKEY_LOCAL_MACHINE, keypath, &prodkey);
2302 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
2303
2304 /* both local and managed product code exist */
2305 sz = MAX_PATH;
2306 lstrcpyA(buf, "apple");
2307 r = MsiGetProductInfoA(prodcode, INSTALLPROPERTY_HELPLINK, buf, &sz);
2308 ok(r == ERROR_UNKNOWN_PROPERTY,
2309 "Expected ERROR_UNKNOWN_PROPERTY, got %d\n", r);
2310 ok(!lstrcmpA(buf, "apple"), "Expected buf to be unchanged, got %s\n", buf);
2311 ok(sz == MAX_PATH, "Expected MAX_PATH, got %d\n", sz);
2312
2313 res = RegCreateKeyA(localkey, "InstallProperties", &propkey);
2314 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
2315
2316 /* InstallProperties key exists */
2317 sz = MAX_PATH;
2318 lstrcpyA(buf, "apple");
2319 r = MsiGetProductInfoA(prodcode, INSTALLPROPERTY_HELPLINK, buf, &sz);
2320 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
2321 ok(!lstrcmpA(buf, ""), "Expected \"\", got \"%s\"\n", buf);
2322 ok(sz == 0, "Expected 0, got %d\n", sz);
2323
2324 res = RegSetValueExA(propkey, "HelpLink", 0, REG_SZ, (LPBYTE)"link", 5);
2325 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
2326
2327 /* HelpLink value exists */
2328 sz = MAX_PATH;
2329 lstrcpyA(buf, "apple");
2330 r = MsiGetProductInfoA(prodcode, INSTALLPROPERTY_HELPLINK, buf, &sz);
2331 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
2332 ok(!lstrcmpA(buf, "link"), "Expected \"link\", got \"%s\"\n", buf);
2333 ok(sz == 4, "Expected 4, got %d\n", sz);
2334
2335 /* pcchBuf is NULL */
2336 r = MsiGetProductInfoA(prodcode, INSTALLPROPERTY_HELPLINK, NULL, NULL);
2337 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
2338
2339 /* lpValueBuf is NULL */
2340 sz = MAX_PATH;
2341 r = MsiGetProductInfoA(prodcode, INSTALLPROPERTY_HELPLINK, NULL, &sz);
2342 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
2343 ok(sz == 4, "Expected 4, got %d\n", sz);
2344
2345 /* lpValueBuf is NULL, pcchValueBuf is too small */
2346 sz = 2;
2347 r = MsiGetProductInfoA(prodcode, INSTALLPROPERTY_HELPLINK, NULL, &sz);
2348 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
2349 ok(sz == 4, "Expected 4, got %d\n", sz);
2350
2351 /* lpValueBuf is NULL, pcchValueBuf is too small */
2352 sz = 2;
2353 lstrcpyA(buf, "apple");
2354 r = MsiGetProductInfoA(prodcode, INSTALLPROPERTY_HELPLINK, buf, &sz);
2355 ok(!lstrcmpA(buf, "apple"), "Expected buf to remain unchanged, got \"%s\"\n", buf);
2356 ok(r == ERROR_MORE_DATA, "Expected ERROR_MORE_DATA, got %d\n", r);
2357 ok(sz == 4, "Expected 4, got %d\n", sz);
2358
2359 /* lpValueBuf is NULL, pcchValueBuf is exactly 4 */
2360 sz = 4;
2361 lstrcpyA(buf, "apple");
2362 r = MsiGetProductInfoA(prodcode, INSTALLPROPERTY_HELPLINK, buf, &sz);
2363 ok(r == ERROR_MORE_DATA, "Expected ERROR_MORE_DATA, got %d\n", r);
2364 ok(!lstrcmpA(buf, "apple"),
2365 "Expected buf to remain unchanged, got \"%s\"\n", buf);
2366 ok(sz == 4, "Expected 4, got %d\n", sz);
2367
2368 res = RegSetValueExA(propkey, "IMadeThis", 0, REG_SZ, (LPBYTE)"random", 7);
2369 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
2370
2371 /* random property not supported by MSI, value exists */
2372 sz = MAX_PATH;
2373 lstrcpyA(buf, "apple");
2374 r = MsiGetProductInfoA(prodcode, "IMadeThis", buf, &sz);
2375 ok(r == ERROR_UNKNOWN_PROPERTY,
2376 "Expected ERROR_UNKNOWN_PROPERTY, got %d\n", r);
2377 ok(!lstrcmpA(buf, "apple"), "Expected \"apple\", got \"%s\"\n", buf);
2378 ok(sz == MAX_PATH, "Expected MAX_PATH, got %d\n", sz);
2379
2380 RegDeleteValueA(propkey, "IMadeThis");
2381 RegDeleteValueA(propkey, "HelpLink");
2382 RegDeleteKeyA(propkey, "");
2383 RegDeleteKeyA(localkey, "");
2384 RegDeleteKeyA(prodkey, "");
2385 RegCloseKey(propkey);
2386 RegCloseKey(localkey);
2387 RegCloseKey(prodkey);
2388
2389 lstrcpyA(keypath, "Software\\Microsoft\\Installer\\Products\\");
2390 lstrcatA(keypath, prod_squashed);
2391
2392 res = RegCreateKeyA(HKEY_CURRENT_USER, keypath, &prodkey);
2393 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
2394
2395 /* user product key exists */
2396 sz = MAX_PATH;
2397 lstrcpyA(buf, "apple");
2398 r = MsiGetProductInfoA(prodcode, INSTALLPROPERTY_HELPLINK, buf, &sz);
2399 ok(r == ERROR_UNKNOWN_PROPERTY,
2400 "Expected ERROR_UNKNOWN_PROPERTY, got %d\n", r);
2401 ok(!lstrcmpA(buf, "apple"), "Expected \"apple\", got \"%s\"\n", buf);
2402 ok(sz == MAX_PATH, "Expected MAX_PATH, got %d\n", sz);
2403
2404 lstrcpyA(keypath, "Software\\Microsoft\\Windows\\CurrentVersion\\Installer\\UserData\\");
2405 lstrcatA(keypath, usersid);
2406 lstrcatA(keypath, "\\Products\\");
2407 lstrcatA(keypath, prod_squashed);
2408
2409 res = RegCreateKeyA(HKEY_LOCAL_MACHINE, keypath, &localkey);
2410 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
2411
2412 /* local user product key exists */
2413 sz = MAX_PATH;
2414 lstrcpyA(buf, "apple");
2415 r = MsiGetProductInfoA(prodcode, INSTALLPROPERTY_HELPLINK, buf, &sz);
2416 ok(r == ERROR_UNKNOWN_PROPERTY,
2417 "Expected ERROR_UNKNOWN_PROPERTY, got %d\n", r);
2418 ok(!lstrcmpA(buf, "apple"), "Expected \"apple\", got \"%s\"\n", buf);
2419 ok(sz == MAX_PATH, "Expected MAX_PATH, got %d\n", sz);
2420
2421 res = RegCreateKeyA(localkey, "InstallProperties", &propkey);
2422 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
2423
2424 /* InstallProperties key exists */
2425 sz = MAX_PATH;
2426 lstrcpyA(buf, "apple");
2427 r = MsiGetProductInfoA(prodcode, INSTALLPROPERTY_HELPLINK, buf, &sz);
2428 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
2429 ok(!lstrcmpA(buf, ""), "Expected \"\", got \"%s\"\n", buf);
2430 ok(sz == 0, "Expected 0, got %d\n", sz);
2431
2432 res = RegSetValueExA(propkey, "HelpLink", 0, REG_SZ, (LPBYTE)"link", 5);
2433 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
2434
2435 /* HelpLink value exists */
2436 sz = MAX_PATH;
2437 lstrcpyA(buf, "apple");
2438 r = MsiGetProductInfoA(prodcode, INSTALLPROPERTY_HELPLINK, buf, &sz);
2439 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
2440 ok(!lstrcmpA(buf, "link"), "Expected \"link\", got \"%s\"\n", buf);
2441 ok(sz == 4, "Expected 4, got %d\n", sz);
2442
2443 RegDeleteValueA(propkey, "HelpLink");
2444 RegDeleteKeyA(propkey, "");
2445 RegDeleteKeyA(localkey, "");
2446 RegDeleteKeyA(prodkey, "");
2447 RegCloseKey(propkey);
2448 RegCloseKey(localkey);
2449 RegCloseKey(prodkey);
2450
2451 lstrcpyA(keypath, "Software\\Classes\\Installer\\Products\\");
2452 lstrcatA(keypath, prod_squashed);
2453
2454 res = RegCreateKeyA(HKEY_LOCAL_MACHINE, keypath, &prodkey);
2455 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
2456
2457 /* classes product key exists */
2458 sz = MAX_PATH;
2459 lstrcpyA(buf, "apple");
2460 r = MsiGetProductInfoA(prodcode, INSTALLPROPERTY_HELPLINK, buf, &sz);
2461 ok(r == ERROR_UNKNOWN_PROPERTY,
2462 "Expected ERROR_UNKNOWN_PROPERTY, got %d\n", r);
2463 ok(!lstrcmpA(buf, "apple"), "Expected \"apple\", got \"%s\"\n", buf);
2464 ok(sz == MAX_PATH, "Expected MAX_PATH, got %d\n", sz);
2465
2466 lstrcpyA(keypath, "Software\\Microsoft\\Windows\\CurrentVersion\\Installer\\UserData\\");
2467 lstrcatA(keypath, usersid);
2468 lstrcatA(keypath, "\\Products\\");
2469 lstrcatA(keypath, prod_squashed);
2470
2471 res = RegCreateKeyA(HKEY_LOCAL_MACHINE, keypath, &localkey);
2472 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
2473
2474 /* local user product key exists */
2475 sz = MAX_PATH;
2476 lstrcpyA(buf, "apple");
2477 r = MsiGetProductInfoA(prodcode, INSTALLPROPERTY_HELPLINK, buf, &sz);
2478 ok(r == ERROR_UNKNOWN_PROPERTY,
2479 "Expected ERROR_UNKNOWN_PROPERTY, got %d\n", r);
2480 ok(!lstrcmpA(buf, "apple"), "Expected \"apple\", got \"%s\"\n", buf);
2481 ok(sz == MAX_PATH, "Expected MAX_PATH, got %d\n", sz);
2482
2483 res = RegCreateKeyA(localkey, "InstallProperties", &propkey);
2484 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
2485
2486 /* InstallProperties key exists */
2487 sz = MAX_PATH;
2488 lstrcpyA(buf, "apple");
2489 r = MsiGetProductInfoA(prodcode, INSTALLPROPERTY_HELPLINK, buf, &sz);
2490 ok(r == ERROR_UNKNOWN_PROPERTY,
2491 "Expected ERROR_UNKNOWN_PROPERTY, got %d\n", r);
2492 ok(!lstrcmpA(buf, "apple"), "Expected \"apple\", got \"%s\"\n", buf);
2493 ok(sz == MAX_PATH, "Expected MAX_PATH, got %d\n", sz);
2494
2495 RegDeleteKeyA(propkey, "");
2496 RegDeleteKeyA(localkey, "");
2497 RegCloseKey(propkey);
2498 RegCloseKey(localkey);
2499
2500 lstrcpyA(keypath, "Software\\Microsoft\\Windows\\CurrentVersion\\Installer\\UserData\\");
2501 lstrcatA(keypath, "S-1-5-18\\\\Products\\");
2502 lstrcatA(keypath, prod_squashed);
2503
2504 res = RegCreateKeyA(HKEY_LOCAL_MACHINE, keypath, &localkey);
2505 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
2506
2507 /* Local System product key exists */
2508 sz = MAX_PATH;
2509 lstrcpyA(buf, "apple");
2510 r = MsiGetProductInfoA(prodcode, INSTALLPROPERTY_HELPLINK, buf, &sz);
2511 ok(r == ERROR_UNKNOWN_PROPERTY,
2512 "Expected ERROR_UNKNOWN_PROPERTY, got %d\n", r);
2513 ok(!lstrcmpA(buf, "apple"), "Expected \"apple\", got \"%s\"\n", buf);
2514 ok(sz == MAX_PATH, "Expected MAX_PATH, got %d\n", sz);
2515
2516 res = RegCreateKeyA(localkey, "InstallProperties", &propkey);
2517 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
2518
2519 /* InstallProperties key exists */
2520 sz = MAX_PATH;
2521 lstrcpyA(buf, "apple");
2522 r = MsiGetProductInfoA(prodcode, INSTALLPROPERTY_HELPLINK, buf, &sz);
2523 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
2524 ok(!lstrcmpA(buf, ""), "Expected \"\", got \"%s\"\n", buf);
2525 ok(sz == 0, "Expected 0, got %d\n", sz);
2526
2527 res = RegSetValueExA(propkey, "HelpLink", 0, REG_SZ, (LPBYTE)"link", 5);
2528 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
2529
2530 /* HelpLink value exists */
2531 sz = MAX_PATH;
2532 lstrcpyA(buf, "apple");
2533 r = MsiGetProductInfoA(prodcode, INSTALLPROPERTY_HELPLINK, buf, &sz);
2534 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
2535 ok(!lstrcmpA(buf, "link"), "Expected \"link\", got \"%s\"\n", buf);
2536 ok(sz == 4, "Expected 4, got %d\n", sz);
2537
2538 res = RegSetValueExA(propkey, "HelpLink", 0, REG_DWORD,
2539 (const BYTE *)&val, sizeof(DWORD));
2540 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
2541
2542 /* HelpLink type is REG_DWORD */
2543 sz = MAX_PATH;
2544 lstrcpyA(buf, "apple");
2545 r = MsiGetProductInfoA(prodcode, INSTALLPROPERTY_HELPLINK, buf, &sz);
2546 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
2547 ok(!lstrcmpA(buf, "42"), "Expected \"42\", got \"%s\"\n", buf);
2548 ok(sz == 2, "Expected 2, got %d\n", sz);
2549
2550 res = RegSetValueExA(propkey, "DisplayName", 0, REG_SZ, (LPBYTE)"name", 5);
2551 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
2552
2553 /* DisplayName value exists */
2554 sz = MAX_PATH;
2555 lstrcpyA(buf, "apple");
2556 r = MsiGetProductInfoA(prodcode, INSTALLPROPERTY_INSTALLEDPRODUCTNAME, buf, &sz);
2557 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
2558 ok(!lstrcmpA(buf, "name"), "Expected \"name\", got \"%s\"\n", buf);
2559 ok(sz == 4, "Expected 4, got %d\n", sz);
2560
2561 res = RegSetValueExA(propkey, "DisplayName", 0, REG_DWORD,
2562 (const BYTE *)&val, sizeof(DWORD));
2563 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
2564
2565 /* DisplayName type is REG_DWORD */
2566 sz = MAX_PATH;
2567 lstrcpyA(buf, "apple");
2568 r = MsiGetProductInfoA(prodcode, INSTALLPROPERTY_INSTALLEDPRODUCTNAME, buf, &sz);
2569 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
2570 ok(!lstrcmpA(buf, "42"), "Expected \"42\", got \"%s\"\n", buf);
2571 ok(sz == 2, "Expected 2, got %d\n", sz);
2572
2573 res = RegSetValueExA(propkey, "DisplayVersion", 0, REG_SZ, (LPBYTE)"1.1.1", 6);
2574 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
2575
2576 /* DisplayVersion value exists */
2577 sz = MAX_PATH;
2578 lstrcpyA(buf, "apple");
2579 r = MsiGetProductInfoA(prodcode, INSTALLPROPERTY_VERSIONSTRING, buf, &sz);
2580 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
2581 ok(!lstrcmpA(buf, "1.1.1"), "Expected \"1.1.1\", got \"%s\"\n", buf);
2582 ok(sz == 5, "Expected 5, got %d\n", sz);
2583
2584 res = RegSetValueExA(propkey, "DisplayVersion", 0,
2585 REG_DWORD, (const BYTE *)&val, sizeof(DWORD));
2586 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
2587
2588 /* DisplayVersion type is REG_DWORD */
2589 sz = MAX_PATH;
2590 lstrcpyA(buf, "apple");
2591 r = MsiGetProductInfoA(prodcode, INSTALLPROPERTY_VERSIONSTRING, buf, &sz);
2592 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
2593 ok(!lstrcmpA(buf, "42"), "Expected \"42\", got \"%s\"\n", buf);
2594 ok(sz == 2, "Expected 2, got %d\n", sz);
2595
2596 res = RegSetValueExA(propkey, "HelpTelephone", 0, REG_SZ, (LPBYTE)"tele", 5);
2597 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
2598
2599 /* HelpTelephone value exists */
2600 sz = MAX_PATH;
2601 lstrcpyA(buf, "apple");
2602 r = MsiGetProductInfoA(prodcode, INSTALLPROPERTY_HELPTELEPHONE, buf, &sz);
2603 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
2604 ok(!lstrcmpA(buf, "tele"), "Expected \"tele\", got \"%s\"\n", buf);
2605 ok(sz == 4, "Expected 4, got %d\n", sz);
2606
2607 res = RegSetValueExA(propkey, "HelpTelephone", 0, REG_DWORD,
2608 (const BYTE *)&val, sizeof(DWORD));
2609 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
2610
2611 /* HelpTelephone type is REG_DWORD */
2612 sz = MAX_PATH;
2613 lstrcpyA(buf, "apple");
2614 r = MsiGetProductInfoA(prodcode, INSTALLPROPERTY_HELPTELEPHONE, buf, &sz);
2615 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
2616 ok(!lstrcmpA(buf, "42"), "Expected \"42\", got \"%s\"\n", buf);
2617 ok(sz == 2, "Expected 2, got %d\n", sz);
2618
2619 res = RegSetValueExA(propkey, "InstallLocation", 0, REG_SZ, (LPBYTE)"loc", 4);
2620 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
2621
2622 /* InstallLocation value exists */
2623 sz = MAX_PATH;
2624 lstrcpyA(buf, "apple");
2625 r = MsiGetProductInfoA(prodcode, INSTALLPROPERTY_INSTALLLOCATION, buf, &sz);
2626 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
2627 ok(!lstrcmpA(buf, "loc"), "Expected \"loc\", got \"%s\"\n", buf);
2628 ok(sz == 3, "Expected 3, got %d\n", sz);
2629
2630 res = RegSetValueExA(propkey, "InstallLocation", 0, REG_DWORD,
2631 (const BYTE *)&val, sizeof(DWORD));
2632 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
2633
2634 /* InstallLocation type is REG_DWORD */
2635 sz = MAX_PATH;
2636 lstrcpyA(buf, "apple");
2637 r = MsiGetProductInfoA(prodcode, INSTALLPROPERTY_INSTALLLOCATION, buf, &sz);
2638 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
2639 ok(!lstrcmpA(buf, "42"), "Expected \"42\", got \"%s\"\n", buf);
2640 ok(sz == 2, "Expected 2, got %d\n", sz);
2641
2642 res = RegSetValueExA(propkey, "InstallSource", 0, REG_SZ, (LPBYTE)"source", 7);
2643 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
2644
2645 /* InstallSource value exists */
2646 sz = MAX_PATH;
2647 lstrcpyA(buf, "apple");
2648 r = MsiGetProductInfoA(prodcode, INSTALLPROPERTY_INSTALLSOURCE, buf, &sz);
2649 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
2650 ok(!lstrcmpA(buf, "source"), "Expected \"source\", got \"%s\"\n", buf);
2651 ok(sz == 6, "Expected 6, got %d\n", sz);
2652
2653 res = RegSetValueExA(propkey, "InstallSource", 0, REG_DWORD,
2654 (const BYTE *)&val, sizeof(DWORD));
2655 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
2656
2657 /* InstallSource type is REG_DWORD */
2658 sz = MAX_PATH;
2659 lstrcpyA(buf, "apple");
2660 r = MsiGetProductInfoA(prodcode, INSTALLPROPERTY_INSTALLSOURCE, buf, &sz);
2661 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
2662 ok(!lstrcmpA(buf, "42"), "Expected \"42\", got \"%s\"\n", buf);
2663 ok(sz == 2, "Expected 2, got %d\n", sz);
2664
2665 res = RegSetValueExA(propkey, "InstallDate", 0, REG_SZ, (LPBYTE)"date", 5);
2666 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
2667
2668 /* InstallDate value exists */
2669 sz = MAX_PATH;
2670 lstrcpyA(buf, "apple");
2671 r = MsiGetProductInfoA(prodcode, INSTALLPROPERTY_INSTALLDATE, buf, &sz);
2672 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
2673 ok(!lstrcmpA(buf, "date"), "Expected \"date\", got \"%s\"\n", buf);
2674 ok(sz == 4, "Expected 4, got %d\n", sz);
2675
2676 res = RegSetValueExA(propkey, "InstallDate", 0, REG_DWORD,
2677 (const BYTE *)&val, sizeof(DWORD));
2678 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
2679
2680 /* InstallDate type is REG_DWORD */
2681 sz = MAX_PATH;
2682 lstrcpyA(buf, "apple");
2683 r = MsiGetProductInfoA(prodcode, INSTALLPROPERTY_INSTALLDATE, buf, &sz);
2684 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
2685 ok(!lstrcmpA(buf, "42"), "Expected \"42\", got \"%s\"\n", buf);
2686 ok(sz == 2, "Expected 2, got %d\n", sz);
2687
2688 res = RegSetValueExA(propkey, "Publisher", 0, REG_SZ, (LPBYTE)"pub", 4);
2689 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
2690
2691 /* Publisher value exists */
2692 sz = MAX_PATH;
2693 lstrcpyA(buf, "apple");
2694 r = MsiGetProductInfoA(prodcode, INSTALLPROPERTY_PUBLISHER, buf, &sz);
2695 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
2696 ok(!lstrcmpA(buf, "pub"), "Expected \"pub\", got \"%s\"\n", buf);
2697 ok(sz == 3, "Expected 3, got %d\n", sz);
2698
2699 res = RegSetValueExA(propkey, "Publisher", 0, REG_DWORD,
2700 (const BYTE *)&val, sizeof(DWORD));
2701 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
2702
2703 /* Publisher type is REG_DWORD */
2704 sz = MAX_PATH;
2705 lstrcpyA(buf, "apple");
2706 r = MsiGetProductInfoA(prodcode, INSTALLPROPERTY_PUBLISHER, buf, &sz);
2707 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
2708 ok(!lstrcmpA(buf, "42"), "Expected \"42\", got \"%s\"\n", buf);
2709 ok(sz == 2, "Expected 2, got %d\n", sz);
2710
2711 res = RegSetValueExA(propkey, "LocalPackage", 0, REG_SZ, (LPBYTE)"pack", 5);
2712 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
2713
2714 /* LocalPackage value exists */
2715 sz = MAX_PATH;
2716 lstrcpyA(buf, "apple");
2717 r = MsiGetProductInfoA(prodcode, INSTALLPROPERTY_LOCALPACKAGE, buf, &sz);
2718 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
2719 ok(!lstrcmpA(buf, "pack"), "Expected \"pack\", got \"%s\"\n", buf);
2720 ok(sz == 4, "Expected 4, got %d\n", sz);
2721
2722 res = RegSetValueExA(propkey, "LocalPackage", 0, REG_DWORD,
2723 (const BYTE *)&val, sizeof(DWORD));
2724 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
2725
2726 /* LocalPackage type is REG_DWORD */
2727 sz = MAX_PATH;
2728 lstrcpyA(buf, "apple");
2729 r = MsiGetProductInfoA(prodcode, INSTALLPROPERTY_LOCALPACKAGE, buf, &sz);
2730 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
2731 ok(!lstrcmpA(buf, "42"), "Expected \"42\", got \"%s\"\n", buf);
2732 ok(sz == 2, "Expected 2, got %d\n", sz);
2733
2734 res = RegSetValueExA(propkey, "UrlInfoAbout", 0, REG_SZ, (LPBYTE)"about", 6);
2735 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
2736
2737 /* UrlInfoAbout value exists */
2738 sz = MAX_PATH;
2739 lstrcpyA(buf, "apple");
2740 r = MsiGetProductInfoA(prodcode, INSTALLPROPERTY_URLINFOABOUT, buf, &sz);
2741 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
2742 ok(!lstrcmpA(buf, "about"), "Expected \"about\", got \"%s\"\n", buf);
2743 ok(sz == 5, "Expected 5, got %d\n", sz);
2744
2745 res = RegSetValueExA(propkey, "UrlInfoAbout", 0, REG_DWORD,
2746 (const BYTE *)&val, sizeof(DWORD));
2747 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
2748
2749 /* UrlInfoAbout type is REG_DWORD */
2750 sz = MAX_PATH;
2751 lstrcpyA(buf, "apple");
2752 r = MsiGetProductInfoA(prodcode, INSTALLPROPERTY_URLINFOABOUT, buf, &sz);
2753 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
2754 ok(!lstrcmpA(buf, "42"), "Expected \"42\", got \"%s\"\n", buf);
2755 ok(sz == 2, "Expected 2, got %d\n", sz);
2756
2757 res = RegSetValueExA(propkey, "UrlUpdateInfo", 0, REG_SZ, (LPBYTE)"info", 5);
2758 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
2759
2760 /* UrlUpdateInfo value exists */
2761 sz = MAX_PATH;
2762 lstrcpyA(buf, "apple");
2763 r = MsiGetProductInfoA(prodcode, INSTALLPROPERTY_URLUPDATEINFO, buf, &sz);
2764 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
2765 ok(!lstrcmpA(buf, "info"), "Expected \"info\", got \"%s\"\n", buf);
2766 ok(sz == 4, "Expected 4, got %d\n", sz);
2767
2768 res = RegSetValueExA(propkey, "UrlUpdateInfo", 0, REG_DWORD,
2769 (const BYTE *)&val, sizeof(DWORD));
2770 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
2771
2772 /* UrlUpdateInfo type is REG_DWORD */
2773 sz = MAX_PATH;
2774 lstrcpyA(buf, "apple");
2775 r = MsiGetProductInfoA(prodcode, INSTALLPROPERTY_URLUPDATEINFO, buf, &sz);
2776 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
2777 ok(!lstrcmpA(buf, "42"), "Expected \"42\", got \"%s\"\n", buf);
2778 ok(sz == 2, "Expected 2, got %d\n", sz);
2779
2780 res = RegSetValueExA(propkey, "VersionMinor", 0, REG_SZ, (LPBYTE)"1", 2);
2781 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
2782
2783 /* VersionMinor value exists */
2784 sz = MAX_PATH;
2785 lstrcpyA(buf, "apple");
2786 r = MsiGetProductInfoA(prodcode, INSTALLPROPERTY_VERSIONMINOR, buf, &sz);
2787 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
2788 ok(!lstrcmpA(buf, "1"), "Expected \"1\", got \"%s\"\n", buf);
2789 ok(sz == 1, "Expected 1, got %d\n", sz);
2790
2791 res = RegSetValueExA(propkey, "VersionMinor", 0, REG_DWORD,
2792 (const BYTE *)&val, sizeof(DWORD));
2793 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
2794
2795 /* VersionMinor type is REG_DWORD */
2796 sz = MAX_PATH;
2797 lstrcpyA(buf, "apple");
2798 r = MsiGetProductInfoA(prodcode, INSTALLPROPERTY_VERSIONMINOR, buf, &sz);
2799 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
2800 ok(!lstrcmpA(buf, "42"), "Expected \"42\", got \"%s\"\n", buf);
2801 ok(sz == 2, "Expected 2, got %d\n", sz);
2802
2803 res = RegSetValueExA(propkey, "VersionMajor", 0, REG_SZ, (LPBYTE)"1", 2);
2804 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
2805
2806 /* VersionMajor value exists */
2807 sz = MAX_PATH;
2808 lstrcpyA(buf, "apple");
2809 r = MsiGetProductInfoA(prodcode, INSTALLPROPERTY_VERSIONMAJOR, buf, &sz);
2810 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
2811 ok(!lstrcmpA(buf, "1"), "Expected \"1\", got \"%s\"\n", buf);
2812 ok(sz == 1, "Expected 1, got %d\n", sz);
2813
2814 res = RegSetValueExA(propkey, "VersionMajor", 0, REG_DWORD,
2815 (const BYTE *)&val, sizeof(DWORD));
2816 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
2817
2818 /* VersionMajor type is REG_DWORD */
2819 sz = MAX_PATH;
2820 lstrcpyA(buf, "apple");
2821 r = MsiGetProductInfoA(prodcode, INSTALLPROPERTY_VERSIONMAJOR, buf, &sz);
2822 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
2823 ok(!lstrcmpA(buf, "42"), "Expected \"42\", got \"%s\"\n", buf);
2824 ok(sz == 2, "Expected 2, got %d\n", sz);
2825
2826 res = RegSetValueExA(propkey, "ProductID", 0, REG_SZ, (LPBYTE)"id", 3);
2827 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
2828
2829 /* ProductID value exists */
2830 sz = MAX_PATH;
2831 lstrcpyA(buf, "apple");
2832 r = MsiGetProductInfoA(prodcode, INSTALLPROPERTY_PRODUCTID, buf, &sz);
2833 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
2834 ok(!lstrcmpA(buf, "id"), "Expected \"id\", got \"%s\"\n", buf);
2835 ok(sz == 2, "Expected 2, got %d\n", sz);
2836
2837 res = RegSetValueExA(propkey, "ProductID", 0, REG_DWORD,
2838 (const BYTE *)&val, sizeof(DWORD));
2839 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
2840
2841 /* ProductID type is REG_DWORD */
2842 sz = MAX_PATH;
2843 lstrcpyA(buf, "apple");
2844 r = MsiGetProductInfoA(prodcode, INSTALLPROPERTY_PRODUCTID, buf, &sz);
2845 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
2846 ok(!lstrcmpA(buf, "42"), "Expected \"42\", got \"%s\"\n", buf);
2847 ok(sz == 2, "Expected 2, got %d\n", sz);
2848
2849 res = RegSetValueExA(propkey, "RegCompany", 0, REG_SZ, (LPBYTE)"comp", 5);
2850 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
2851
2852 /* RegCompany value exists */
2853 sz = MAX_PATH;
2854 lstrcpyA(buf, "apple");
2855 r = MsiGetProductInfoA(prodcode, INSTALLPROPERTY_REGCOMPANY, buf, &sz);
2856 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
2857 ok(!lstrcmpA(buf, "comp"), "Expected \"comp\", got \"%s\"\n", buf);
2858 ok(sz == 4, "Expected 4, got %d\n", sz);
2859
2860 res = RegSetValueExA(propkey, "RegCompany", 0, REG_DWORD,
2861 (const BYTE *)&val, sizeof(DWORD));
2862 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
2863
2864 /* RegCompany type is REG_DWORD */
2865 sz = MAX_PATH;
2866 lstrcpyA(buf, "apple");
2867 r = MsiGetProductInfoA(prodcode, INSTALLPROPERTY_REGCOMPANY, buf, &sz);
2868 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
2869 ok(!lstrcmpA(buf, "42"), "Expected \"42\", got \"%s\"\n", buf);
2870 ok(sz == 2, "Expected 2, got %d\n", sz);
2871
2872 res = RegSetValueExA(propkey, "RegOwner", 0, REG_SZ, (LPBYTE)"own", 4);
2873 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
2874
2875 /* RegOwner value exists */
2876 sz = MAX_PATH;
2877 lstrcpyA(buf, "apple");
2878 r = MsiGetProductInfoA(prodcode, INSTALLPROPERTY_REGOWNER, buf, &sz);
2879 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
2880 ok(!lstrcmpA(buf, "own"), "Expected \"own\", got \"%s\"\n", buf);
2881 ok(sz == 3, "Expected 3, got %d\n", sz);
2882
2883 res = RegSetValueExA(propkey, "RegOwner", 0, REG_DWORD,
2884 (const BYTE *)&val, sizeof(DWORD));
2885 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
2886
2887 /* RegOwner type is REG_DWORD */
2888 sz = MAX_PATH;
2889 lstrcpyA(buf, "apple");
2890 r = MsiGetProductInfoA(prodcode, INSTALLPROPERTY_REGOWNER, buf, &sz);
2891 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
2892 ok(!lstrcmpA(buf, "42"), "Expected \"42\", got \"%s\"\n", buf);
2893 ok(sz == 2, "Expected 2, got %d\n", sz);
2894
2895 res = RegSetValueExA(propkey, "InstanceType", 0, REG_SZ, (LPBYTE)"type", 5);
2896 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
2897
2898 /* InstanceType value exists */
2899 sz = MAX_PATH;
2900 lstrcpyA(buf, "apple");
2901 r = MsiGetProductInfoA(prodcode, INSTALLPROPERTY_INSTANCETYPE, buf, &sz);
2902 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
2903 ok(!lstrcmpA(buf, ""), "Expected \"\", got \"%s\"\n", buf);
2904 ok(sz == 0, "Expected 0, got %d\n", sz);
2905
2906 res = RegSetValueExA(propkey, "InstanceType", 0, REG_DWORD,
2907 (const BYTE *)&val, sizeof(DWORD));
2908 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
2909
2910 /* InstanceType type is REG_DWORD */
2911 sz = MAX_PATH;
2912 lstrcpyA(buf, "apple");
2913 r = MsiGetProductInfoA(prodcode, INSTALLPROPERTY_INSTANCETYPE, buf, &sz);
2914 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
2915 ok(!lstrcmpA(buf, ""), "Expected \"\", got \"%s\"\n", buf);
2916 ok(sz == 0, "Expected 0, got %d\n", sz);
2917
2918 res = RegSetValueExA(prodkey, "InstanceType", 0, REG_SZ, (LPBYTE)"type", 5);
2919 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
2920
2921 /* InstanceType value exists */
2922 sz = MAX_PATH;
2923 lstrcpyA(buf, "apple");
2924 r = MsiGetProductInfoA(prodcode, INSTALLPROPERTY_INSTANCETYPE, buf, &sz);
2925 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
2926 ok(!lstrcmpA(buf, "type"), "Expected \"type\", got \"%s\"\n", buf);
2927 ok(sz == 4, "Expected 4, got %d\n", sz);
2928
2929 res = RegSetValueExA(prodkey, "InstanceType", 0, REG_DWORD,
2930 (const BYTE *)&val, sizeof(DWORD));
2931 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
2932
2933 /* InstanceType type is REG_DWORD */
2934 sz = MAX_PATH;
2935 lstrcpyA(buf, "apple");
2936 r = MsiGetProductInfoA(prodcode, INSTALLPROPERTY_INSTANCETYPE, buf, &sz);
2937 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
2938 ok(!lstrcmpA(buf, "42"), "Expected \"42\", got \"%s\"\n", buf);
2939 ok(sz == 2, "Expected 2, got %d\n", sz);
2940
2941 res = RegSetValueExA(propkey, "Transforms", 0, REG_SZ, (LPBYTE)"tforms", 7);
2942 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
2943
2944 /* Transforms value exists */
2945 sz = MAX_PATH;
2946 lstrcpyA(buf, "apple");
2947 r = MsiGetProductInfoA(prodcode, INSTALLPROPERTY_TRANSFORMS, buf, &sz);
2948 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
2949 ok(!lstrcmpA(buf, ""), "Expected \"\", got \"%s\"\n", buf);
2950 ok(sz == 0, "Expected 0, got %d\n", sz);
2951
2952 res = RegSetValueExA(propkey, "Transforms", 0, REG_DWORD,
2953 (const BYTE *)&val, sizeof(DWORD));
2954 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
2955
2956 /* Transforms type is REG_DWORD */
2957 sz = MAX_PATH;
2958 lstrcpyA(buf, "apple");
2959 r = MsiGetProductInfoA(prodcode, INSTALLPROPERTY_TRANSFORMS, buf, &sz);
2960 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
2961 ok(!lstrcmpA(buf, ""), "Expected \"\", got \"%s\"\n", buf);
2962 ok(sz == 0, "Expected 0, got %d\n", sz);
2963
2964 res = RegSetValueExA(prodkey, "Transforms", 0, REG_SZ, (LPBYTE)"tforms", 7);
2965 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
2966
2967 /* Transforms value exists */
2968 sz = MAX_PATH;
2969 lstrcpyA(buf, "apple");
2970 r = MsiGetProductInfoA(prodcode, INSTALLPROPERTY_TRANSFORMS, buf, &sz);
2971 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
2972 ok(!lstrcmpA(buf, "tforms"), "Expected \"tforms\", got \"%s\"\n", buf);
2973 ok(sz == 6, "Expected 6, got %d\n", sz);
2974
2975 res = RegSetValueExA(prodkey, "Transforms", 0, REG_DWORD,
2976 (const BYTE *)&val, sizeof(DWORD));
2977 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
2978
2979 /* Transforms type is REG_DWORD */
2980 sz = MAX_PATH;
2981 lstrcpyA(buf, "apple");
2982 r = MsiGetProductInfoA(prodcode, INSTALLPROPERTY_TRANSFORMS, buf, &sz);
2983 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
2984 ok(!lstrcmpA(buf, "42"), "Expected \"42\", got \"%s\"\n", buf);
2985 ok(sz == 2, "Expected 2, got %d\n", sz);
2986
2987 res = RegSetValueExA(propkey, "Language", 0, REG_SZ, (LPBYTE)"lang", 5);
2988 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
2989
2990 /* Language value exists */
2991 sz = MAX_PATH;
2992 lstrcpyA(buf, "apple");
2993 r = MsiGetProductInfoA(prodcode, INSTALLPROPERTY_LANGUAGE, buf, &sz);
2994 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
2995 ok(!lstrcmpA(buf, ""), "Expected \"\", got \"%s\"\n", buf);
2996 ok(sz == 0, "Expected 0, got %d\n", sz);
2997
2998 res = RegSetValueExA(propkey, "Language", 0, REG_DWORD,
2999 (const BYTE *)&val, sizeof(DWORD));
3000 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
3001
3002 /* Language type is REG_DWORD */
3003 sz = MAX_PATH;
3004 lstrcpyA(buf, "apple");
3005 r = MsiGetProductInfoA(prodcode, INSTALLPROPERTY_LANGUAGE, buf, &sz);
3006 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
3007 ok(!lstrcmpA(buf, ""), "Expected \"\", got \"%s\"\n", buf);
3008 ok(sz == 0, "Expected 0, got %d\n", sz);
3009
3010 res = RegSetValueExA(prodkey, "Language", 0, REG_SZ, (LPBYTE)"lang", 5);
3011 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
3012
3013 /* Language value exists */
3014 sz = MAX_PATH;
3015 lstrcpyA(buf, "apple");
3016 r = MsiGetProductInfoA(prodcode, INSTALLPROPERTY_LANGUAGE, buf, &sz);
3017 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
3018 ok(!lstrcmpA(buf, "lang"), "Expected \"lang\", got \"%s\"\n", buf);
3019 ok(sz == 4, "Expected 4, got %d\n", sz);
3020
3021 res = RegSetValueExA(prodkey, "Language", 0, REG_DWORD,
3022 (const BYTE *)&val, sizeof(DWORD));
3023 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
3024
3025 /* Language type is REG_DWORD */
3026 sz = MAX_PATH;
3027 lstrcpyA(buf, "apple");
3028 r = MsiGetProductInfoA(prodcode, INSTALLPROPERTY_LANGUAGE, buf, &sz);
3029 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
3030 ok(!lstrcmpA(buf, "42"), "Expected \"42\", got \"%s\"\n", buf);
3031 ok(sz == 2, "Expected 2, got %d\n", sz);
3032
3033 res = RegSetValueExA(propkey, "ProductName", 0, REG_SZ, (LPBYTE)"name", 5);
3034 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
3035
3036 /* ProductName value exists */
3037 sz = MAX_PATH;
3038 lstrcpyA(buf, "apple");
3039 r = MsiGetProductInfoA(prodcode, INSTALLPROPERTY_PRODUCTNAME, buf, &sz);
3040 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
3041 ok(!lstrcmpA(buf, ""), "Expected \"\", got \"%s\"\n", buf);
3042 ok(sz == 0, "Expected 0, got %d\n", sz);
3043
3044 res = RegSetValueExA(propkey, "ProductName", 0, REG_DWORD,
3045 (const BYTE *)&val, sizeof(DWORD));
3046 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
3047
3048 /* ProductName type is REG_DWORD */
3049 sz = MAX_PATH;
3050 lstrcpyA(buf, "apple");
3051 r = MsiGetProductInfoA(prodcode, INSTALLPROPERTY_PRODUCTNAME, buf, &sz);
3052 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
3053 ok(!lstrcmpA(buf, ""), "Expected \"\", got \"%s\"\n", buf);
3054 ok(sz == 0, "Expected 0, got %d\n", sz);
3055
3056 res = RegSetValueExA(prodkey, "ProductName", 0, REG_SZ, (LPBYTE)"name", 5);
3057 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
3058
3059 /* ProductName value exists */
3060 sz = MAX_PATH;
3061 lstrcpyA(buf, "apple");
3062 r = MsiGetProductInfoA(prodcode, INSTALLPROPERTY_PRODUCTNAME, buf, &sz);
3063 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
3064 ok(!lstrcmpA(buf, "name"), "Expected \"name\", got \"%s\"\n", buf);
3065 ok(sz == 4, "Expected 4, got %d\n", sz);
3066
3067 res = RegSetValueExA(prodkey, "ProductName", 0, REG_DWORD,
3068 (const BYTE *)&val, sizeof(DWORD));
3069 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
3070
3071 /* ProductName type is REG_DWORD */
3072 sz = MAX_PATH;
3073 lstrcpyA(buf, "apple");
3074 r = MsiGetProductInfoA(prodcode, INSTALLPROPERTY_PRODUCTNAME, buf, &sz);
3075 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
3076 ok(!lstrcmpA(buf, "42"), "Expected \"42\", got \"%s\"\n", buf);
3077 ok(sz == 2, "Expected 2, got %d\n", sz);
3078
3079 res = RegSetValueExA(propkey, "Assignment", 0, REG_SZ, (LPBYTE)"at", 3);
3080 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
3081
3082 /* Assignment value exists */
3083 sz = MAX_PATH;
3084 lstrcpyA(buf, "apple");
3085 r = MsiGetProductInfoA(prodcode, INSTALLPROPERTY_ASSIGNMENTTYPE, buf, &sz);
3086 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
3087 ok(!lstrcmpA(buf, ""), "Expected \"\", got \"%s\"\n", buf);
3088 ok(sz == 0, "Expected 0, got %d\n", sz);
3089
3090 res = RegSetValueExA(propkey, "Assignment", 0, REG_DWORD,
3091 (const BYTE *)&val, sizeof(DWORD));
3092 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
3093
3094 /* Assignment type is REG_DWORD */
3095 sz = MAX_PATH;
3096 lstrcpyA(buf, "apple");
3097 r = MsiGetProductInfoA(prodcode, INSTALLPROPERTY_ASSIGNMENTTYPE, buf, &sz);
3098 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
3099 ok(!lstrcmpA(buf, ""), "Expected \"\", got \"%s\"\n", buf);
3100 ok(sz == 0, "Expected 0, got %d\n", sz);
3101
3102 res = RegSetValueExA(prodkey, "Assignment", 0, REG_SZ, (LPBYTE)"at", 3);
3103 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
3104
3105 /* Assignment value exists */
3106 sz = MAX_PATH;
3107 lstrcpyA(buf, "apple");
3108 r = MsiGetProductInfoA(prodcode, INSTALLPROPERTY_ASSIGNMENTTYPE, buf, &sz);
3109 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
3110 ok(!lstrcmpA(buf, "at"), "Expected \"at\", got \"%s\"\n", buf);
3111 ok(sz == 2, "Expected 2, got %d\n", sz);
3112
3113 res = RegSetValueExA(prodkey, "Assignment", 0, REG_DWORD,
3114 (const BYTE *)&val, sizeof(DWORD));
3115 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
3116
3117 /* Assignment type is REG_DWORD */
3118 sz = MAX_PATH;
3119 lstrcpyA(buf, "apple");
3120 r = MsiGetProductInfoA(prodcode, INSTALLPROPERTY_ASSIGNMENTTYPE, buf, &sz);
3121 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
3122 ok(!lstrcmpA(buf, "42"), "Expected \"42\", got \"%s\"\n", buf);
3123 ok(sz == 2, "Expected 2, got %d\n", sz);
3124
3125 res = RegSetValueExA(propkey, "PackageCode", 0, REG_SZ, (LPBYTE)"code", 5);
3126 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
3127
3128 /* PackageCode value exists */
3129 sz = MAX_PATH;
3130 lstrcpyA(buf, "apple");
3131 r = MsiGetProductInfoA(prodcode, INSTALLPROPERTY_PACKAGECODE, buf, &sz);
3132 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
3133 ok(!lstrcmpA(buf, ""), "Expected \"\", got \"%s\"\n", buf);
3134 ok(sz == 0, "Expected 0, got %d\n", sz);
3135
3136 res = RegSetValueExA(propkey, "PackageCode", 0, REG_DWORD,
3137 (const BYTE *)&val, sizeof(DWORD));
3138 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
3139
3140 /* PackageCode type is REG_DWORD */
3141 sz = MAX_PATH;
3142 lstrcpyA(buf, "apple");
3143 r = MsiGetProductInfoA(prodcode, INSTALLPROPERTY_PACKAGECODE, buf, &sz);
3144 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
3145 ok(!lstrcmpA(buf, ""), "Expected \"\", got \"%s\"\n", buf);
3146 ok(sz == 0, "Expected 0, got %d\n", sz);
3147
3148 res = RegSetValueExA(prodkey, "PackageCode", 0, REG_SZ, (LPBYTE)"code", 5);
3149 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
3150
3151 /* PackageCode value exists */
3152 sz = MAX_PATH;
3153 lstrcpyA(buf, "apple");
3154 r = MsiGetProductInfoA(prodcode, INSTALLPROPERTY_PACKAGECODE, buf, &sz);
3155 ok(r == ERROR_BAD_CONFIGURATION,
3156 "Expected ERROR_BAD_CONFIGURATION, got %d\n", r);
3157 ok(!lstrcmpA(buf, "code"), "Expected \"code\", got \"%s\"\n", buf);
3158 ok(sz == MAX_PATH, "Expected MAX_PATH, got %d\n", sz);
3159
3160 res = RegSetValueExA(prodkey, "PackageCode", 0, REG_DWORD,
3161 (const BYTE *)&val, sizeof(DWORD));
3162 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
3163
3164 /* PackageCode type is REG_DWORD */
3165 sz = MAX_PATH;
3166 lstrcpyA(buf, "apple");
3167 r = MsiGetProductInfoA(prodcode, INSTALLPROPERTY_PACKAGECODE, buf, &sz);
3168 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
3169 ok(!lstrcmpA(buf, "42"), "Expected \"42\", got \"%s\"\n", buf);
3170 ok(sz == 2, "Expected 2, got %d\n", sz);
3171
3172 res = RegSetValueExA(prodkey, "PackageCode", 0, REG_SZ, (LPBYTE)pack_squashed, 33);
3173 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
3174
3175 /* PackageCode value exists */
3176 sz = MAX_PATH;
3177 lstrcpyA(buf, "apple");
3178 r = MsiGetProductInfoA(prodcode, INSTALLPROPERTY_PACKAGECODE, buf, &sz);
3179 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
3180 ok(!lstrcmpA(buf, packcode), "Expected \"%s\", got \"%s\"\n", packcode, buf);
3181 ok(sz == 38, "Expected 38, got %d\n", sz);
3182
3183 res = RegSetValueExA(propkey, "Version", 0, REG_SZ, (LPBYTE)"ver", 4);
3184 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
3185
3186 /* Version value exists */
3187 sz = MAX_PATH;
3188 lstrcpyA(buf, "apple");
3189 r = MsiGetProductInfoA(prodcode, INSTALLPROPERTY_VERSION, buf, &sz);
3190 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
3191 ok(!lstrcmpA(buf, ""), "Expected \"\", got \"%s\"\n", buf);
3192 ok(sz == 0, "Expected 0, got %d\n", sz);
3193
3194 res = RegSetValueExA(propkey, "Version", 0, REG_DWORD,
3195 (const BYTE *)&val, sizeof(DWORD));
3196 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
3197
3198 /* Version type is REG_DWORD */
3199 sz = MAX_PATH;
3200 lstrcpyA(buf, "apple");
3201 r = MsiGetProductInfoA(prodcode, INSTALLPROPERTY_VERSION, buf, &sz);
3202 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
3203 ok(!lstrcmpA(buf, ""), "Expected \"\", got \"%s\"\n", buf);
3204 ok(sz == 0, "Expected 0, got %d\n", sz);
3205
3206 res = RegSetValueExA(prodkey, "Version", 0, REG_SZ, (LPBYTE)"ver", 4);
3207 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
3208
3209 /* Version value exists */
3210 sz = MAX_PATH;
3211 lstrcpyA(buf, "apple");
3212 r = MsiGetProductInfoA(prodcode, INSTALLPROPERTY_VERSION, buf, &sz);
3213 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
3214 ok(!lstrcmpA(buf, "ver"), "Expected \"ver\", got \"%s\"\n", buf);
3215 ok(sz == 3, "Expected 3, got %d\n", sz);
3216
3217 res = RegSetValueExA(prodkey, "Version", 0, REG_DWORD,
3218 (const BYTE *)&val, sizeof(DWORD));
3219 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
3220
3221 /* Version type is REG_DWORD */
3222 sz = MAX_PATH;
3223 lstrcpyA(buf, "apple");
3224 r = MsiGetProductInfoA(prodcode, INSTALLPROPERTY_VERSION, buf, &sz);
3225 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
3226 ok(!lstrcmpA(buf, "42"), "Expected \"42\", got \"%s\"\n", buf);
3227 ok(sz == 2, "Expected 2, got %d\n", sz);
3228
3229 res = RegSetValueExA(propkey, "ProductIcon", 0, REG_SZ, (LPBYTE)"ico", 4);
3230 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
3231
3232 /* ProductIcon value exists */
3233 sz = MAX_PATH;
3234 lstrcpyA(buf, "apple");
3235 r = MsiGetProductInfoA(prodcode, INSTALLPROPERTY_PRODUCTICON, buf, &sz);
3236 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
3237 ok(!lstrcmpA(buf, ""), "Expected \"\", got \"%s\"\n", buf);
3238 ok(sz == 0, "Expected 0, got %d\n", sz);
3239
3240 res = RegSetValueExA(propkey, "ProductIcon", 0, REG_DWORD,
3241 (const BYTE *)&val, sizeof(DWORD));
3242 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
3243
3244 /* ProductIcon type is REG_DWORD */
3245 sz = MAX_PATH;
3246 lstrcpyA(buf, "apple");
3247 r = MsiGetProductInfoA(prodcode, INSTALLPROPERTY_PRODUCTICON, buf, &sz);
3248 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
3249 ok(!lstrcmpA(buf, ""), "Expected \"\", got \"%s\"\n", buf);
3250 ok(sz == 0, "Expected 0, got %d\n", sz);
3251
3252 res = RegSetValueExA(prodkey, "ProductIcon", 0, REG_SZ, (LPBYTE)"ico", 4);
3253 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
3254
3255 /* ProductIcon value exists */
3256 sz = MAX_PATH;
3257 lstrcpyA(buf, "apple");
3258 r = MsiGetProductInfoA(prodcode, INSTALLPROPERTY_PRODUCTICON, buf, &sz);
3259 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
3260 ok(!lstrcmpA(buf, "ico"), "Expected \"ico\", got \"%s\"\n", buf);
3261 ok(sz == 3, "Expected 3, got %d\n", sz);
3262
3263 res = RegSetValueExA(prodkey, "ProductIcon", 0, REG_DWORD,
3264 (const BYTE *)&val, sizeof(DWORD));
3265 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
3266
3267 /* ProductIcon type is REG_DWORD */
3268 sz = MAX_PATH;
3269 lstrcpyA(buf, "apple");
3270 r = MsiGetProductInfoA(prodcode, INSTALLPROPERTY_PRODUCTICON, buf, &sz);
3271 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
3272 ok(!lstrcmpA(buf, "42"), "Expected \"42\", got \"%s\"\n", buf);
3273 ok(sz == 2, "Expected 2, got %d\n", sz);
3274
3275 res = RegCreateKeyA(prodkey, "SourceList", &source);
3276 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
3277
3278 res = RegSetValueExA(source, "PackageName", 0, REG_SZ, (LPBYTE)"packname", 9);
3279 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
3280
3281 sz = MAX_PATH;
3282 lstrcpyA(buf, "apple");
3283 r = MsiGetProductInfoA(prodcode, INSTALLPROPERTY_PACKAGENAME, buf, &sz);
3284 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
3285 ok(!lstrcmpA(buf, "packname"), "Expected \"packname\", got \"%s\"\n", buf);
3286 ok(sz == 8, "Expected 8, got %d\n", sz);
3287
3288 res = RegSetValueExA(source, "PackageName", 0, REG_DWORD,
3289 (const BYTE *)&val, sizeof(DWORD));
3290 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
3291
3292 /* PackageName type is REG_DWORD */
3293 sz = MAX_PATH;
3294 lstrcpyA(buf, "apple");
3295 r = MsiGetProductInfoA(prodcode, INSTALLPROPERTY_PACKAGENAME, buf, &sz);
3296 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
3297 ok(!lstrcmpA(buf, "42"), "Expected \"42\", got \"%s\"\n", buf);
3298 ok(sz == 2, "Expected 2, got %d\n", sz);
3299
3300 res = RegSetValueExA(propkey, "AuthorizedLUAApp", 0, REG_SZ, (LPBYTE)"auth", 5);
3301 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
3302
3303 /* Authorized value exists */
3304 sz = MAX_PATH;
3305 lstrcpyA(buf, "apple");
3306 r = MsiGetProductInfoA(prodcode, INSTALLPROPERTY_AUTHORIZED_LUA_APP, buf, &sz);
3307 if (r != ERROR_UNKNOWN_PROPERTY)
3308 {
3309 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
3310 ok(!lstrcmpA(buf, ""), "Expected \"\", got \"%s\"\n", buf);
3311 ok(sz == 0, "Expected 0, got %d\n", sz);
3312 }
3313
3314 res = RegSetValueExA(propkey, "AuthorizedLUAApp", 0, REG_DWORD,
3315 (const BYTE *)&val, sizeof(DWORD));
3316 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
3317
3318 /* AuthorizedLUAApp type is REG_DWORD */
3319 sz = MAX_PATH;
3320 lstrcpyA(buf, "apple");
3321 r = MsiGetProductInfoA(prodcode, INSTALLPROPERTY_AUTHORIZED_LUA_APP, buf, &sz);
3322 if (r != ERROR_UNKNOWN_PROPERTY)
3323 {
3324 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
3325 ok(!lstrcmpA(buf, ""), "Expected \"\", got \"%s\"\n", buf);
3326 ok(sz == 0, "Expected 0, got %d\n", sz);
3327 }
3328
3329 res = RegSetValueExA(prodkey, "AuthorizedLUAApp", 0, REG_SZ, (LPBYTE)"auth", 5);
3330 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
3331
3332 /* Authorized value exists */
3333 sz = MAX_PATH;
3334 lstrcpyA(buf, "apple");
3335 r = MsiGetProductInfoA(prodcode, INSTALLPROPERTY_AUTHORIZED_LUA_APP, buf, &sz);
3336 if (r != ERROR_UNKNOWN_PROPERTY)
3337 {
3338 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
3339 ok(!lstrcmpA(buf, "auth"), "Expected \"auth\", got \"%s\"\n", buf);
3340 ok(sz == 4, "Expected 4, got %d\n", sz);
3341 }
3342
3343 res = RegSetValueExA(prodkey, "AuthorizedLUAApp", 0, REG_DWORD,
3344 (const BYTE *)&val, sizeof(DWORD));
3345 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
3346
3347 /* AuthorizedLUAApp type is REG_DWORD */
3348 sz = MAX_PATH;
3349 lstrcpyA(buf, "apple");
3350 r = MsiGetProductInfoA(prodcode, INSTALLPROPERTY_AUTHORIZED_LUA_APP, buf, &sz);
3351 if (r != ERROR_UNKNOWN_PROPERTY)
3352 {
3353 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
3354 ok(!lstrcmpA(buf, "42"), "Expected \"42\", got \"%s\"\n", buf);
3355 ok(sz == 2, "Expected 2, got %d\n", sz);
3356 }
3357
3358 RegDeleteValueA(propkey, "HelpLink");
3359 RegDeleteValueA(propkey, "DisplayName");
3360 RegDeleteValueA(propkey, "DisplayVersion");
3361 RegDeleteValueA(propkey, "HelpTelephone");
3362 RegDeleteValueA(propkey, "InstallLocation");
3363 RegDeleteValueA(propkey, "InstallSource");
3364 RegDeleteValueA(propkey, "InstallDate");
3365 RegDeleteValueA(propkey, "Publisher");
3366 RegDeleteValueA(propkey, "LocalPackage");
3367 RegDeleteValueA(propkey, "UrlInfoAbout");
3368 RegDeleteValueA(propkey, "UrlUpdateInfo");
3369 RegDeleteValueA(propkey, "VersionMinor");
3370 RegDeleteValueA(propkey, "VersionMajor");
3371 RegDeleteValueA(propkey, "ProductID");
3372 RegDeleteValueA(propkey, "RegCompany");
3373 RegDeleteValueA(propkey, "RegOwner");
3374 RegDeleteValueA(propkey, "InstanceType");
3375 RegDeleteValueA(propkey, "Transforms");
3376 RegDeleteValueA(propkey, "Language");
3377 RegDeleteValueA(propkey, "ProductName");
3378 RegDeleteValueA(propkey, "Assignment");
3379 RegDeleteValueA(propkey, "PackageCode");
3380 RegDeleteValueA(propkey, "Version");
3381 RegDeleteValueA(propkey, "ProductIcon");
3382 RegDeleteValueA(propkey, "AuthorizedLUAApp");
3383 RegDeleteKeyA(propkey, "");
3384 RegDeleteKeyA(localkey, "");
3385 RegDeleteValueA(prodkey, "InstanceType");
3386 RegDeleteValueA(prodkey, "Transforms");
3387 RegDeleteValueA(prodkey, "Language");
3388 RegDeleteValueA(prodkey, "ProductName");
3389 RegDeleteValueA(prodkey, "Assignment");
3390 RegDeleteValueA(prodkey, "PackageCode");
3391 RegDeleteValueA(prodkey, "Version");
3392 RegDeleteValueA(prodkey, "ProductIcon");
3393 RegDeleteValueA(prodkey, "AuthorizedLUAApp");
3394 RegDeleteValueA(source, "PackageName");
3395 RegDeleteKeyA(source, "");
3396 RegDeleteKeyA(prodkey, "");
3397 RegCloseKey(propkey);
3398 RegCloseKey(localkey);
3399 RegCloseKey(source);
3400 RegCloseKey(prodkey);
3401 }
3402
3403 static void test_MsiGetProductInfoEx(void)
3404 {
3405 UINT r;
3406 LONG res;
3407 HKEY propkey, userkey;
3408 HKEY prodkey, localkey;
3409 CHAR prodcode[MAX_PATH];
3410 CHAR prod_squashed[MAX_PATH];
3411 CHAR packcode[MAX_PATH];
3412 CHAR pack_squashed[MAX_PATH];
3413 CHAR buf[MAX_PATH];
3414 CHAR keypath[MAX_PATH];
3415 LPSTR usersid;
3416 DWORD sz;
3417
3418 if (!pMsiGetProductInfoExA)
3419 {
3420 skip("MsiGetProductInfoExA is not available\n");
3421 return;
3422 }
3423
3424 create_test_guid(prodcode, prod_squashed);
3425 create_test_guid(packcode, pack_squashed);
3426 get_user_sid(&usersid);
3427
3428 /* NULL szProductCode */
3429 sz = MAX_PATH;
3430 lstrcpyA(buf, "apple");
3431 r = pMsiGetProductInfoExA(NULL, usersid, MSIINSTALLCONTEXT_USERUNMANAGED,
3432 INSTALLPROPERTY_PRODUCTSTATE, buf, &sz);
3433 ok(r == ERROR_INVALID_PARAMETER,
3434 "Expected ERROR_INVALID_PARAMETER, got %d\n", r);
3435 ok(!lstrcmpA(buf, "apple"), "Expected buf to be unchanged, got %s\n", buf);
3436 ok(sz == MAX_PATH, "Expected MAX_PATH, got %d\n", sz);
3437
3438 /* empty szProductCode */
3439 sz = MAX_PATH;
3440 lstrcpyA(buf, "apple");
3441 r = pMsiGetProductInfoExA("", usersid, MSIINSTALLCONTEXT_USERUNMANAGED,
3442 INSTALLPROPERTY_PRODUCTSTATE, buf, &sz);
3443 ok(r == ERROR_INVALID_PARAMETER,
3444 "Expected ERROR_INVALID_PARAMETER, got %d\n", r);
3445 ok(!lstrcmpA(buf, "apple"), "Expected buf to be unchanged, got %s\n", buf);
3446 ok(sz == MAX_PATH, "Expected MAX_PATH, got %d\n", sz);
3447
3448 /* garbage szProductCode */
3449 sz = MAX_PATH;
3450 lstrcpyA(buf, "apple");
3451 r = pMsiGetProductInfoExA("garbage", usersid, MSIINSTALLCONTEXT_USERUNMANAGED,
3452 INSTALLPROPERTY_PRODUCTSTATE, buf, &sz);
3453 ok(r == ERROR_INVALID_PARAMETER,
3454 "Expected ERROR_INVALID_PARAMETER, got %d\n", r);
3455 ok(!lstrcmpA(buf, "apple"), "Expected buf to be unchanged, got %s\n", buf);
3456 ok(sz == MAX_PATH, "Expected MAX_PATH, got %d\n", sz);
3457
3458 /* guid without brackets */
3459 sz = MAX_PATH;
3460 lstrcpyA(buf, "apple");
3461 r = pMsiGetProductInfoExA("6700E8CF-95AB-4D9C-BC2C-15840DEA7A5D", usersid,
3462 MSIINSTALLCONTEXT_USERUNMANAGED,
3463 INSTALLPROPERTY_PRODUCTSTATE, buf, &sz);
3464 ok(r == ERROR_INVALID_PARAMETER,
3465 "Expected ERROR_INVALID_PARAMETER, got %d\n", r);
3466 ok(!lstrcmpA(buf, "apple"), "Expected buf to be unchanged, got %s\n", buf);
3467 ok(sz == MAX_PATH, "Expected MAX_PATH, got %d\n", sz);
3468
3469 /* guid with brackets */
3470 sz = MAX_PATH;
3471 lstrcpyA(buf, "apple");
3472 r = pMsiGetProductInfoExA("{6700E8CF-95AB-4D9C-BC2C-15840DEA7A5D}", 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);
3479
3480 /* szValue is non-NULL while pcchValue is NULL */
3481 lstrcpyA(buf, "apple");
3482 r = pMsiGetProductInfoExA(prodcode, usersid,
3483 MSIINSTALLCONTEXT_USERUNMANAGED,
3484 INSTALLPROPERTY_PRODUCTSTATE, buf, NULL);
3485 ok(r == ERROR_INVALID_PARAMETER,
3486 "Expected ERROR_INVALID_PARAMETER, got %d\n", r);
3487 ok(!lstrcmpA(buf, "apple"), "Expected buf to be unchanged, got %s\n", buf);
3488
3489 /* dwContext is out of range */
3490 sz = MAX_PATH;
3491 lstrcpyA(buf, "apple");
3492 r = pMsiGetProductInfoExA(prodcode, usersid, 42,
3493 INSTALLPROPERTY_PRODUCTSTATE, buf, &sz);
3494 ok(r == ERROR_INVALID_PARAMETER,
3495 "Expected ERROR_INVALID_PARAMETER, got %d\n", r);
3496 ok(!lstrcmpA(buf, "apple"), "Expected buf to be unchanged, got %s\n", buf);
3497 ok(sz == MAX_PATH, "Expected MAX_PATH, got %d\n", sz);
3498
3499 /* szProperty is NULL */
3500 sz = MAX_PATH;
3501 lstrcpyA(buf, "apple");
3502 r = pMsiGetProductInfoExA(prodcode, usersid,
3503 MSIINSTALLCONTEXT_USERUNMANAGED,
3504 NULL, buf, &sz);
3505 ok(r == ERROR_INVALID_PARAMETER,
3506 "Expected ERROR_INVALID_PARAMETER, got %d\n", r);
3507 ok(!lstrcmpA(buf, "apple"), "Expected buf to be unchanged, got %s\n", buf);
3508 ok(sz == MAX_PATH, "Expected MAX_PATH, got %d\n", sz);
3509
3510 /* szProperty is empty */
3511 sz = MAX_PATH;
3512 lstrcpyA(buf, "apple");
3513 r = pMsiGetProductInfoExA(prodcode, usersid,
3514 MSIINSTALLCONTEXT_USERUNMANAGED,
3515 "", buf, &sz);
3516 ok(r == ERROR_INVALID_PARAMETER,
3517 "Expected ERROR_INVALID_PARAMETER, got %d\n", r);
3518 ok(!lstrcmpA(buf, "apple"), "Expected buf to be unchanged, got %s\n", buf);
3519 ok(sz == MAX_PATH, "Expected MAX_PATH, got %d\n", sz);
3520
3521 /* szProperty is not a valid property */
3522 sz = MAX_PATH;
3523 lstrcpyA(buf, "apple");
3524 r = pMsiGetProductInfoExA(prodcode, usersid,
3525 MSIINSTALLCONTEXT_USERUNMANAGED,
3526 "notvalid", buf, &sz);
3527 ok(r == ERROR_UNKNOWN_PRODUCT,
3528 "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r);
3529 ok(!lstrcmpA(buf, "apple"), "Expected buf to be unchanged, got %s\n", buf);
3530 ok(sz == MAX_PATH, "Expected MAX_PATH, got %d\n", sz);
3531
3532 /* same length as guid, but random */
3533 sz = MAX_PATH;
3534 lstrcpyA(buf, "apple");
3535 r = pMsiGetProductInfoExA("A938G02JF-2NF3N93-VN3-2NNF-3KGKALDNF93", usersid,
3536 MSIINSTALLCONTEXT_USERUNMANAGED,
3537 INSTALLPROPERTY_PRODUCTSTATE, buf, &sz);
3538 ok(r == ERROR_INVALID_PARAMETER,
3539 "Expected ERROR_INVALID_PARAMETER, got %d\n", r);
3540 ok(!lstrcmpA(buf, "apple"), "Expected buf to be unchanged, got %s\n", buf);
3541 ok(sz == MAX_PATH, "Expected MAX_PATH, got %d\n", sz);
3542
3543 /* MSIINSTALLCONTEXT_USERUNMANAGED */
3544
3545 lstrcpyA(keypath, "Software\\Microsoft\\Windows\\CurrentVersion\\Installer\\UserData\\");
3546 lstrcatA(keypath, usersid);
3547 lstrcatA(keypath, "\\Products\\");
3548 lstrcatA(keypath, prod_squashed);
3549
3550 res = RegCreateKeyA(HKEY_LOCAL_MACHINE, keypath, &localkey);
3551 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
3552
3553 /* local user product key exists */
3554 sz = MAX_PATH;
3555 lstrcpyA(buf, "apple");
3556 r = pMsiGetProductInfoExA(prodcode, usersid,
3557 MSIINSTALLCONTEXT_USERUNMANAGED,
3558 INSTALLPROPERTY_PRODUCTSTATE, buf, &sz);
3559 ok(r == ERROR_UNKNOWN_PRODUCT,
3560 "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r);
3561 ok(!lstrcmpA(buf, "apple"), "Expected buf to be unchanged, got %s\n", buf);
3562 ok(sz == MAX_PATH, "Expected MAX_PATH, got %d\n", sz);
3563
3564 res = RegCreateKeyA(localkey, "InstallProperties", &propkey);
3565 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
3566
3567 /* InstallProperties key exists */
3568 sz = MAX_PATH;
3569 lstrcpyA(buf, "apple");
3570 r = pMsiGetProductInfoExA(prodcode, usersid,
3571 MSIINSTALLCONTEXT_USERUNMANAGED,
3572 INSTALLPROPERTY_PRODUCTSTATE, buf, &sz);
3573 ok(r == ERROR_UNKNOWN_PRODUCT,
3574 "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r);
3575 ok(!lstrcmpA(buf, "apple"), "Expected buf to be unchanged, got %s\n", buf);
3576 ok(sz == MAX_PATH, "Expected MAX_PATH, got %d\n", sz);
3577
3578 res = RegSetValueExA(propkey, "LocalPackage", 0, REG_SZ, (LPBYTE)"local", 6);
3579 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
3580
3581 /* LocalPackage value exists */
3582 sz = MAX_PATH;
3583 lstrcpyA(buf, "apple");
3584 r = pMsiGetProductInfoExA(prodcode, usersid,
3585 MSIINSTALLCONTEXT_USERUNMANAGED,
3586 INSTALLPROPERTY_PRODUCTSTATE, buf, &sz);
3587 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
3588 ok(!lstrcmpA(buf, "5"), "Expected \"5\", got \"%s\"\n", buf);
3589 ok(sz == 1, "Expected 1, got %d\n", sz);
3590
3591 RegDeleteValueA(propkey, "LocalPackage");
3592
3593 /* LocalPackage value must exist */
3594 sz = MAX_PATH;
3595 lstrcpyA(buf, "apple");
3596 r = pMsiGetProductInfoExA(prodcode, usersid,
3597 MSIINSTALLCONTEXT_USERUNMANAGED,
3598 INSTALLPROPERTY_HELPLINK, buf, &sz);
3599 ok(r == ERROR_UNKNOWN_PRODUCT,
3600 "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r);
3601 ok(!lstrcmpA(buf, "apple"), "Expected buf to be unchanged, got %s\n", buf);
3602 ok(sz == MAX_PATH, "Expected MAX_PATH, got %d\n", sz);
3603
3604 res = RegSetValueExA(propkey, "LocalPackage", 0, REG_SZ, (LPBYTE)"local", 6);
3605 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
3606
3607 /* LocalPackage exists, but HelpLink does not exist */
3608 sz = MAX_PATH;
3609 lstrcpyA(buf, "apple");
3610 r = pMsiGetProductInfoExA(prodcode, usersid,
3611 MSIINSTALLCONTEXT_USERUNMANAGED,
3612 INSTALLPROPERTY_HELPLINK, buf, &sz);
3613 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
3614 ok(!lstrcmpA(buf, ""), "Expected \"\", got \"%s\"\n", buf);
3615 ok(sz == 0, "Expected 0, got %d\n", sz);
3616
3617 res = RegSetValueExA(propkey, "HelpLink", 0, REG_SZ, (LPBYTE)"link", 5);
3618 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
3619
3620 /* HelpLink value exists */
3621 sz = MAX_PATH;
3622 lstrcpyA(buf, "apple");
3623 r = pMsiGetProductInfoExA(prodcode, usersid,
3624 MSIINSTALLCONTEXT_USERUNMANAGED,
3625 INSTALLPROPERTY_HELPLINK, buf, &sz);
3626 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
3627 ok(!lstrcmpA(buf, "link"), "Expected \"link\", got \"%s\"\n", buf);
3628 ok(sz == 4, "Expected 4, got %d\n", sz);
3629
3630 res = RegSetValueExA(propkey, "HelpTelephone", 0, REG_SZ, (LPBYTE)"phone", 6);
3631 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
3632
3633 /* HelpTelephone value exists */
3634 sz = MAX_PATH;
3635 lstrcpyA(buf, "apple");
3636 r = pMsiGetProductInfoExA(prodcode, usersid,
3637 MSIINSTALLCONTEXT_USERUNMANAGED,
3638 INSTALLPROPERTY_HELPTELEPHONE, buf, &sz);
3639 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
3640 ok(!lstrcmpA(buf, "phone"), "Expected \"phone\", got \"%s\"\n", buf);
3641 ok(sz == 5, "Expected 5, got %d\n", sz);
3642
3643 /* szValue and pcchValue are NULL */
3644 r = pMsiGetProductInfoExA(prodcode, usersid,
3645 MSIINSTALLCONTEXT_USERUNMANAGED,
3646 INSTALLPROPERTY_HELPTELEPHONE, NULL, NULL);
3647 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
3648
3649 /* pcchValue is exactly 5 */
3650 sz = 5;
3651 lstrcpyA(buf, "apple");
3652 r = pMsiGetProductInfoExA(prodcode, usersid,
3653 MSIINSTALLCONTEXT_USERUNMANAGED,
3654 INSTALLPROPERTY_HELPTELEPHONE, buf, &sz);
3655 ok(r == ERROR_MORE_DATA,
3656 "Expected ERROR_MORE_DATA, got %d\n", r);
3657 ok(!lstrcmpA(buf, ""), "Expected \"\", got \"%s\"\n", buf);
3658 ok(sz == 10, "Expected 10, got %d\n", sz);
3659
3660 /* szValue is NULL, pcchValue is exactly 5 */
3661 sz = 5;
3662 r = pMsiGetProductInfoExA(prodcode, usersid,
3663 MSIINSTALLCONTEXT_USERUNMANAGED,
3664 INSTALLPROPERTY_HELPTELEPHONE, NULL, &sz);
3665 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
3666 ok(sz == 10, "Expected 10, got %d\n", sz);
3667
3668 /* szValue is NULL, pcchValue is MAX_PATH */
3669 sz = MAX_PATH;
3670 r = pMsiGetProductInfoExA(prodcode, usersid,
3671 MSIINSTALLCONTEXT_USERUNMANAGED,
3672 INSTALLPROPERTY_HELPTELEPHONE, NULL, &sz);
3673 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
3674 ok(sz == 10, "Expected 10, got %d\n", sz);
3675
3676 /* pcchValue is exactly 0 */
3677 sz = 0;
3678 lstrcpyA(buf, "apple");
3679 r = pMsiGetProductInfoExA(prodcode, usersid,
3680 MSIINSTALLCONTEXT_USERUNMANAGED,
3681 INSTALLPROPERTY_HELPTELEPHONE, buf, &sz);
3682 ok(r == ERROR_MORE_DATA,
3683 "Expected ERROR_MORE_DATA, got %d\n", r);
3684 ok(!lstrcmpA(buf, "apple"), "Expected \"apple\", got \"%s\"\n", buf);
3685 ok(sz == 10, "Expected 10, got %d\n", sz);
3686
3687 res = RegSetValueExA(propkey, "notvalid", 0, REG_SZ, (LPBYTE)"invalid", 8);
3688 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
3689
3690 /* szProperty is not a valid property */
3691 sz = MAX_PATH;
3692 lstrcpyA(buf, "apple");
3693 r = pMsiGetProductInfoExA(prodcode, usersid,
3694 MSIINSTALLCONTEXT_USERUNMANAGED,
3695 "notvalid", buf, &sz);
3696 ok(r == ERROR_UNKNOWN_PROPERTY,
3697 "Expected ERROR_UNKNOWN_PROPERTY, got %d\n", r);
3698 ok(!lstrcmpA(buf, "apple"), "Expected buf to be unchanged, got %s\n", buf);
3699 ok(sz == MAX_PATH, "Expected MAX_PATH, got %d\n", sz);
3700
3701 res = RegSetValueExA(propkey, "InstallDate", 0, REG_SZ, (LPBYTE)"date", 5);
3702 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
3703
3704 /* InstallDate value exists */
3705 sz = MAX_PATH;
3706 lstrcpyA(buf, "apple");
3707 r = pMsiGetProductInfoExA(prodcode, usersid,
3708 MSIINSTALLCONTEXT_USERUNMANAGED,
3709 INSTALLPROPERTY_INSTALLDATE, buf, &sz);
3710 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
3711 ok(!lstrcmpA(buf, "date"), "Expected \"date\", got \"%s\"\n", buf);
3712 ok(sz == 4, "Expected 4, got %d\n", sz);
3713
3714 res = RegSetValueExA(propkey, "DisplayName", 0, REG_SZ, (LPBYTE)"name", 5);
3715 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
3716
3717 /* DisplayName value exists */
3718 sz = MAX_PATH;
3719 lstrcpyA(buf, "apple");
3720 r = pMsiGetProductInfoExA(prodcode, usersid,
3721 MSIINSTALLCONTEXT_USERUNMANAGED,
3722 INSTALLPROPERTY_INSTALLEDPRODUCTNAME, buf, &sz);
3723 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
3724 ok(!lstrcmpA(buf, "name"), "Expected \"name\", got \"%s\"\n", buf);
3725 ok(sz == 4, "Expected 4, got %d\n", sz);
3726
3727 res = RegSetValueExA(propkey, "InstallLocation", 0, REG_SZ, (LPBYTE)"loc", 4);
3728 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
3729
3730 /* InstallLocation value exists */
3731 sz = MAX_PATH;
3732 lstrcpyA(buf, "apple");
3733 r = pMsiGetProductInfoExA(prodcode, usersid,
3734 MSIINSTALLCONTEXT_USERUNMANAGED,
3735 INSTALLPROPERTY_INSTALLLOCATION, buf, &sz);
3736 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
3737 ok(!lstrcmpA(buf, "loc"), "Expected \"loc\", got \"%s\"\n", buf);
3738 ok(sz == 3, "Expected 3, got %d\n", sz);
3739
3740 res = RegSetValueExA(propkey, "InstallSource", 0, REG_SZ, (LPBYTE)"source", 7);
3741 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
3742
3743 /* InstallSource value exists */
3744 sz = MAX_PATH;
3745 lstrcpyA(buf, "apple");
3746 r = pMsiGetProductInfoExA(prodcode, usersid,
3747 MSIINSTALLCONTEXT_USERUNMANAGED,
3748 INSTALLPROPERTY_INSTALLSOURCE, buf, &sz);
3749 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
3750 ok(!lstrcmpA(buf, "source"), "Expected \"source\", got \"%s\"\n", buf);
3751 ok(sz == 6, "Expected 6, got %d\n", sz);
3752
3753 res = RegSetValueExA(propkey, "LocalPackage", 0, REG_SZ, (LPBYTE)"local", 6);
3754 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
3755
3756 /* LocalPackage value exists */
3757 sz = MAX_PATH;
3758 lstrcpyA(buf, "apple");
3759 r = pMsiGetProductInfoExA(prodcode, usersid,
3760 MSIINSTALLCONTEXT_USERUNMANAGED,
3761 INSTALLPROPERTY_LOCALPACKAGE, buf, &sz);
3762 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
3763 ok(!lstrcmpA(buf, "local"), "Expected \"local\", got \"%s\"\n", buf);
3764 ok(sz == 5, "Expected 5, got %d\n", sz);
3765
3766 res = RegSetValueExA(propkey, "Publisher", 0, REG_SZ, (LPBYTE)"pub", 4);
3767 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
3768
3769 /* Publisher value exists */
3770 sz = MAX_PATH;
3771 lstrcpyA(buf, "apple");
3772 r = pMsiGetProductInfoExA(prodcode, usersid,
3773 MSIINSTALLCONTEXT_USERUNMANAGED,
3774 INSTALLPROPERTY_PUBLISHER, buf, &sz);
3775 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
3776 ok(!lstrcmpA(buf, "pub"), "Expected \"pub\", got \"%s\"\n", buf);
3777 ok(sz == 3, "Expected 3, got %d\n", sz);
3778
3779 res = RegSetValueExA(propkey, "URLInfoAbout", 0, REG_SZ, (LPBYTE)"about", 6);
3780 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
3781
3782 /* URLInfoAbout value exists */
3783 sz = MAX_PATH;
3784 lstrcpyA(buf, "apple");
3785 r = pMsiGetProductInfoExA(prodcode, usersid,
3786 MSIINSTALLCONTEXT_USERUNMANAGED,
3787 INSTALLPROPERTY_URLINFOABOUT, buf, &sz);
3788 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
3789 ok(!lstrcmpA(buf, "about"), "Expected \"about\", got \"%s\"\n", buf);
3790 ok(sz == 5, "Expected 5, got %d\n", sz);
3791
3792 res = RegSetValueExA(propkey, "URLUpdateInfo", 0, REG_SZ, (LPBYTE)"update", 7);
3793 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
3794
3795 /* URLUpdateInfo value exists */
3796 sz = MAX_PATH;
3797 lstrcpyA(buf, "apple");
3798 r = pMsiGetProductInfoExA(prodcode, usersid,
3799 MSIINSTALLCONTEXT_USERUNMANAGED,
3800 INSTALLPROPERTY_URLUPDATEINFO, buf, &sz);
3801 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
3802 ok(!lstrcmpA(buf, "update"), "Expected \"update\", got \"%s\"\n", buf);
3803 ok(sz == 6, "Expected 6, got %d\n", sz);
3804
3805 res = RegSetValueExA(propkey, "VersionMinor", 0, REG_SZ, (LPBYTE)"2", 2);
3806 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
3807
3808 /* VersionMinor value exists */
3809 sz = MAX_PATH;
3810 lstrcpyA(buf, "apple");
3811 r = pMsiGetProductInfoExA(prodcode, usersid,
3812 MSIINSTALLCONTEXT_USERUNMANAGED,
3813 INSTALLPROPERTY_VERSIONMINOR, buf, &sz);
3814 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
3815 ok(!lstrcmpA(buf, "2"), "Expected \"2\", got \"%s\"\n", buf);
3816 ok(sz == 1, "Expected 1, got %d\n", sz);
3817
3818 res = RegSetValueExA(propkey, "VersionMajor", 0, REG_SZ, (LPBYTE)"3", 2);
3819 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
3820
3821 /* VersionMajor value exists */
3822 sz = MAX_PATH;
3823 lstrcpyA(buf, "apple");
3824 r = pMsiGetProductInfoExA(prodcode, usersid,
3825 MSIINSTALLCONTEXT_USERUNMANAGED,
3826 INSTALLPROPERTY_VERSIONMAJOR, buf, &sz);
3827 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
3828 ok(!lstrcmpA(buf, "3"), "Expected \"3\", got \"%s\"\n", buf);
3829 ok(sz == 1, "Expected 1, got %d\n", sz);
3830
3831 res = RegSetValueExA(propkey, "DisplayVersion", 0, REG_SZ, (LPBYTE)"3.2.1", 6);
3832 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
3833
3834 /* DisplayVersion value exists */
3835 sz = MAX_PATH;
3836 lstrcpyA(buf, "apple");
3837 r = pMsiGetProductInfoExA(prodcode, usersid,
3838 MSIINSTALLCONTEXT_USERUNMANAGED,
3839 INSTALLPROPERTY_VERSIONSTRING, buf, &sz);
3840 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
3841 ok(!lstrcmpA(buf, "3.2.1"), "Expected \"3.2.1\", got \"%s\"\n", buf);
3842 ok(sz == 5, "Expected 5, got %d\n", sz);
3843
3844 res = RegSetValueExA(propkey, "ProductID", 0, REG_SZ, (LPBYTE)"id", 3);
3845 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
3846
3847 /* ProductID value exists */
3848 sz = MAX_PATH;
3849 lstrcpyA(buf, "apple");
3850 r = pMsiGetProductInfoExA(prodcode, usersid,
3851 MSIINSTALLCONTEXT_USERUNMANAGED,
3852 INSTALLPROPERTY_PRODUCTID, buf, &sz);
3853 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
3854 ok(!lstrcmpA(buf, "id"), "Expected \"id\", got \"%s\"\n", buf);
3855 ok(sz == 2, "Expected 2, got %d\n", sz);
3856
3857 res = RegSetValueExA(propkey, "RegCompany", 0, REG_SZ, (LPBYTE)"comp", 5);
3858 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
3859
3860 /* RegCompany value exists */
3861 sz = MAX_PATH;
3862 lstrcpyA(buf, "apple");
3863 r = pMsiGetProductInfoExA(prodcode, usersid,
3864 MSIINSTALLCONTEXT_USERUNMANAGED,
3865 INSTALLPROPERTY_REGCOMPANY, buf, &sz);
3866 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
3867 ok(!lstrcmpA(buf, "comp"), "Expected \"comp\", got \"%s\"\n", buf);
3868 ok(sz == 4, "Expected 4, got %d\n", sz);
3869
3870 res = RegSetValueExA(propkey, "RegOwner", 0, REG_SZ, (LPBYTE)"owner", 6);
3871 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
3872
3873 /* RegOwner value exists */
3874 sz = MAX_PATH;
3875 lstrcpyA(buf, "apple");
3876 r = pMsiGetProductInfoExA(prodcode, usersid,
3877 MSIINSTALLCONTEXT_USERUNMANAGED,
3878 INSTALLPROPERTY_REGOWNER, buf, &sz);
3879 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
3880 ok(!lstrcmpA(buf, "owner"), "Expected \"owner\", got \"%s\"\n", buf);
3881 ok(sz == 5, "Expected 5, got %d\n", sz);
3882
3883 res = RegSetValueExA(propkey, "Transforms", 0, REG_SZ, (LPBYTE)"trans", 6);
3884 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
3885
3886 /* Transforms value exists */
3887 sz = MAX_PATH;
3888 lstrcpyA(buf, "apple");
3889 r = pMsiGetProductInfoExA(prodcode, usersid,
3890 MSIINSTALLCONTEXT_USERUNMANAGED,
3891 INSTALLPROPERTY_TRANSFORMS, buf, &sz);
3892 ok(r == ERROR_UNKNOWN_PRODUCT,
3893 "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r);
3894 ok(!lstrcmpA(buf, "apple"), "Expected buf to be unchanged, got %s\n", buf);
3895 ok(sz == MAX_PATH, "Expected MAX_PATH, got %d\n", sz);
3896
3897 res = RegSetValueExA(propkey, "Language", 0, REG_SZ, (LPBYTE)"lang", 5);
3898 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
3899
3900 /* Language value exists */
3901 sz = MAX_PATH;
3902 lstrcpyA(buf, "apple");
3903 r = pMsiGetProductInfoExA(prodcode, usersid,
3904 MSIINSTALLCONTEXT_USERUNMANAGED,
3905 INSTALLPROPERTY_LANGUAGE, buf, &sz);
3906 ok(r == ERROR_UNKNOWN_PRODUCT,
3907 "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r);
3908 ok(!lstrcmpA(buf, "apple"), "Expected buf to be unchanged, got %s\n", buf);
3909 ok(sz == MAX_PATH, "Expected MAX_PATH, got %d\n", sz);
3910
3911 res = RegSetValueExA(propkey, "ProductName", 0, REG_SZ, (LPBYTE)"name", 5);
3912 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
3913
3914 /* ProductName value exists */
3915 sz = MAX_PATH;
3916 lstrcpyA(buf, "apple");
3917 r = pMsiGetProductInfoExA(prodcode, usersid,
3918 MSIINSTALLCONTEXT_USERUNMANAGED,
3919 INSTALLPROPERTY_PRODUCTNAME, buf, &sz);
3920 ok(r == ERROR_UNKNOWN_PRODUCT,
3921 "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r);
3922 ok(!lstrcmpA(buf, "apple"), "Expected buf to be unchanged, got %s\n", buf);
3923 ok(sz == MAX_PATH, "Expected MAX_PATH, got %d\n", sz);
3924
3925 res = RegSetValueExA(propkey, "AssignmentType", 0, REG_SZ, (LPBYTE)"type", 5);
3926 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
3927
3928 /* FIXME */
3929
3930 /* AssignmentType value exists */
3931 sz = MAX_PATH;
3932 lstrcpyA(buf, "apple");
3933 r = pMsiGetProductInfoExA(prodcode, usersid,
3934 MSIINSTALLCONTEXT_USERUNMANAGED,
3935 INSTALLPROPERTY_ASSIGNMENTTYPE, buf, &sz);
3936 ok(r == ERROR_UNKNOWN_PRODUCT,
3937 "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r);
3938 ok(!lstrcmpA(buf, "apple"), "Expected buf to be unchanged, got %s\n", buf);
3939 ok(sz == MAX_PATH, "Expected MAX_PATH, got %d\n", sz);
3940
3941 res = RegSetValueExA(propkey, "PackageCode", 0, REG_SZ, (LPBYTE)"code", 5);
3942 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
3943
3944 /* PackageCode value exists */
3945 sz = MAX_PATH;
3946 lstrcpyA(buf, "apple");
3947 r = pMsiGetProductInfoExA(prodcode, usersid,
3948 MSIINSTALLCONTEXT_USERUNMANAGED,
3949 INSTALLPROPERTY_PACKAGECODE, buf, &sz);
3950 ok(r == ERROR_UNKNOWN_PRODUCT,
3951 "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r);
3952 ok(!lstrcmpA(buf, "apple"), "Expected buf to be unchanged, got %s\n", buf);
3953 ok(sz == MAX_PATH, "Expected MAX_PATH, got %d\n", sz);
3954
3955 res = RegSetValueExA(propkey, "Version", 0, REG_SZ, (LPBYTE)"ver", 4);
3956 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
3957
3958 /* Version value exists */
3959 sz = MAX_PATH;
3960 lstrcpyA(buf, "apple");
3961 r = pMsiGetProductInfoExA(prodcode, usersid,
3962 MSIINSTALLCONTEXT_USERUNMANAGED,
3963 INSTALLPROPERTY_VERSION, buf, &sz);
3964 ok(r == ERROR_UNKNOWN_PRODUCT,
3965 "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r);
3966 ok(!lstrcmpA(buf, "apple"), "Expected buf to be unchanged, got %s\n", buf);
3967 ok(sz == MAX_PATH, "Expected MAX_PATH, got %d\n", sz);
3968
3969 res = RegSetValueExA(propkey, "ProductIcon", 0, REG_SZ, (LPBYTE)"icon", 5);
3970 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
3971
3972 /* ProductIcon value exists */
3973 sz = MAX_PATH;
3974 lstrcpyA(buf, "apple");
3975 r = pMsiGetProductInfoExA(prodcode, usersid,
3976 MSIINSTALLCONTEXT_USERUNMANAGED,
3977 INSTALLPROPERTY_PRODUCTICON, buf, &sz);
3978 ok(r == ERROR_UNKNOWN_PRODUCT,
3979 "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r);
3980 ok(!lstrcmpA(buf, "apple"), "Expected buf to be unchanged, got %s\n", buf);
3981 ok(sz == MAX_PATH, "Expected MAX_PATH, got %d\n", sz);
3982
3983 res = RegSetValueExA(propkey, "PackageName", 0, REG_SZ, (LPBYTE)"name", 5);
3984 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
3985
3986 /* PackageName value exists */
3987 sz = MAX_PATH;
3988 lstrcpyA(buf, "apple");
3989 r = pMsiGetProductInfoExA(prodcode, usersid,
3990 MSIINSTALLCONTEXT_USERUNMANAGED,
3991 INSTALLPROPERTY_PACKAGENAME, buf, &sz);
3992 ok(r == ERROR_UNKNOWN_PRODUCT,
3993 "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r);
3994 ok(!lstrcmpA(buf, "apple"), "Expected buf to be unchanged, got %s\n", buf);
3995 ok(sz == MAX_PATH, "Expected MAX_PATH, got %d\n", sz);
3996
3997 res = RegSetValueExA(propkey, "AuthorizedLUAApp", 0, REG_SZ, (LPBYTE)"auth", 5);
3998 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
3999
4000 /* AuthorizedLUAApp value exists */
4001 sz = MAX_PATH;
4002 lstrcpyA(buf, "apple");
4003 r = pMsiGetProductInfoExA(prodcode, usersid,
4004 MSIINSTALLCONTEXT_USERUNMANAGED,
4005 INSTALLPROPERTY_AUTHORIZED_LUA_APP, buf, &sz);
4006 ok(r == ERROR_UNKNOWN_PRODUCT,
4007 "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r);
4008 ok(!lstrcmpA(buf, "apple"), "Expected buf to be unchanged, got %s\n", buf);
4009 ok(sz == MAX_PATH, "Expected MAX_PATH, got %d\n", sz);
4010
4011 RegDeleteValueA(propkey, "AuthorizedLUAApp");
4012 RegDeleteValueA(propkey, "PackageName");
4013 RegDeleteValueA(propkey, "ProductIcon");
4014 RegDeleteValueA(propkey, "Version");
4015 RegDeleteValueA(propkey, "PackageCode");
4016 RegDeleteValueA(propkey, "AssignmentType");
4017 RegDeleteValueA(propkey, "ProductName");
4018 RegDeleteValueA(propkey, "Language");
4019 RegDeleteValueA(propkey, "Transforms");
4020 RegDeleteValueA(propkey, "RegOwner");
4021 RegDeleteValueA(propkey, "RegCompany");
4022 RegDeleteValueA(propkey, "ProductID");
4023 RegDeleteValueA(propkey, "DisplayVersion");
4024 RegDeleteValueA(propkey, "VersionMajor");
4025 RegDeleteValueA(propkey, "VersionMinor");
4026 RegDeleteValueA(propkey, "URLUpdateInfo");
4027 RegDeleteValueA(propkey, "URLInfoAbout");
4028 RegDeleteValueA(propkey, "Publisher");
4029 RegDeleteValueA(propkey, "LocalPackage");
4030 RegDeleteValueA(propkey, "InstallSource");
4031 RegDeleteValueA(propkey, "InstallLocation");
4032 RegDeleteValueA(propkey, "DisplayName");
4033 RegDeleteValueA(propkey, "InstallDate");
4034 RegDeleteValueA(propkey, "HelpTelephone");
4035 RegDeleteValueA(propkey, "HelpLink");
4036 RegDeleteValueA(propkey, "LocalPackage");
4037 RegDeleteKeyA(propkey, "");
4038 RegCloseKey(propkey);
4039 RegDeleteKeyA(localkey, "");
4040 RegCloseKey(localkey);
4041
4042 lstrcpyA(keypath, "Software\\Microsoft\\Windows\\CurrentVersion\\Installer\\Managed\\");
4043 lstrcatA(keypath, usersid);
4044 lstrcatA(keypath, "\\Installer\\Products\\");
4045 lstrcatA(keypath, prod_squashed);
4046
4047 res = RegCreateKeyA(HKEY_LOCAL_MACHINE, keypath, &userkey);
4048 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
4049
4050 /* user product key exists */
4051 sz = MAX_PATH;
4052 lstrcpyA(buf, "apple");
4053 r = pMsiGetProductInfoExA(prodcode, usersid,
4054 MSIINSTALLCONTEXT_USERUNMANAGED,
4055 INSTALLPROPERTY_PRODUCTSTATE, buf, &sz);
4056 ok(r == ERROR_UNKNOWN_PRODUCT,
4057 "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r);
4058 ok(!lstrcmpA(buf, "apple"), "Expected buf to be unchanged, got %s\n", buf);
4059 ok(sz == MAX_PATH, "Expected MAX_PATH, got %d\n", sz);
4060
4061 RegDeleteKeyA(userkey, "");
4062 RegCloseKey(userkey);
4063
4064 lstrcpyA(keypath, "Software\\Microsoft\\Installer\\Products\\");
4065 lstrcatA(keypath, prod_squashed);
4066
4067 res = RegCreateKeyA(HKEY_CURRENT_USER, keypath, &prodkey);
4068 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
4069
4070 sz = MAX_PATH;
4071 lstrcpyA(buf, "apple");
4072 r = pMsiGetProductInfoExA(prodcode, usersid,
4073 MSIINSTALLCONTEXT_USERUNMANAGED,
4074 INSTALLPROPERTY_PRODUCTSTATE, buf, &sz);
4075 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
4076 ok(!lstrcmpA(buf, "1"), "Expected \"1\", got \"%s\"\n", buf);
4077 ok(sz == 1, "Expected 1, got %d\n", sz);
4078
4079 res = RegSetValueExA(prodkey, "HelpLink", 0, REG_SZ, (LPBYTE)"link", 5);
4080 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
4081
4082 /* HelpLink value exists */
4083 sz = MAX_PATH;
4084 lstrcpyA(buf, "apple");
4085 r = pMsiGetProductInfoExA(prodcode, usersid,
4086 MSIINSTALLCONTEXT_USERUNMANAGED,
4087 INSTALLPROPERTY_HELPLINK, 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);
4092
4093 res = RegSetValueExA(prodkey, "HelpTelephone", 0, REG_SZ, (LPBYTE)"phone", 6);
4094 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
4095
4096 /* HelpTelephone value exists */
4097 sz = MAX_PATH;
4098 lstrcpyA(buf, "apple");
4099 r = pMsiGetProductInfoExA(prodcode, usersid,
4100 MSIINSTALLCONTEXT_USERUNMANAGED,
4101 INSTALLPROPERTY_HELPTELEPHONE, 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);
4106
4107 res = RegSetValueExA(prodkey, "InstallDate", 0, REG_SZ, (LPBYTE)"date", 5);
4108 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
4109
4110 /* InstallDate value exists */
4111 sz = MAX_PATH;
4112 lstrcpyA(buf, "apple");
4113 r = pMsiGetProductInfoExA(prodcode, usersid,
4114 MSIINSTALLCONTEXT_USERUNMANAGED,
4115 INSTALLPROPERTY_INSTALLDATE, 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);
4120
4121 res = RegSetValueExA(prodkey, "DisplayName", 0, REG_SZ, (LPBYTE)"name", 5);
4122 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
4123
4124 /* DisplayName value exists */
4125 sz = MAX_PATH;
4126 lstrcpyA(buf, "apple");
4127 r = pMsiGetProductInfoExA(prodcode, usersid,
4128 MSIINSTALLCONTEXT_USERUNMANAGED,
4129 INSTALLPROPERTY_INSTALLEDPRODUCTNAME, 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);
4134
4135 res = RegSetValueExA(prodkey, "InstallLocation", 0, REG_SZ, (LPBYTE)"loc", 4);
4136 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
4137
4138 /* InstallLocation value exists */
4139 sz = MAX_PATH;
4140 lstrcpyA(buf, "apple");
4141 r = pMsiGetProductInfoExA(prodcode, usersid,
4142 MSIINSTALLCONTEXT_USERUNMANAGED,
4143 INSTALLPROPERTY_INSTALLLOCATION, 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);
4148
4149 res = RegSetValueExA(prodkey, "InstallSource", 0, REG_SZ, (LPBYTE)"source", 7);
4150 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
4151
4152 /* InstallSource value exists */
4153 sz = MAX_PATH;
4154 lstrcpyA(buf, "apple");
4155 r = pMsiGetProductInfoExA(prodcode, usersid,
4156 MSIINSTALLCONTEXT_USERUNMANAGED,
4157 INSTALLPROPERTY_INSTALLSOURCE, 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);
4162
4163 res = RegSetValueExA(prodkey, "LocalPackage", 0, REG_SZ, (LPBYTE)"local", 6);
4164 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
4165
4166 /* LocalPackage value exists */
4167 sz = MAX_PATH;
4168 lstrcpyA(buf, "apple");
4169 r = pMsiGetProductInfoExA(prodcode, usersid,
4170 MSIINSTALLCONTEXT_USERUNMANAGED,
4171 INSTALLPROPERTY_LOCALPACKAGE, 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);
4176
4177 res = RegSetValueExA(prodkey, "Publisher", 0, REG_SZ, (LPBYTE)"pub", 4);
4178 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
4179
4180 /* Publisher value exists */
4181 sz = MAX_PATH;
4182 lstrcpyA(buf, "apple");
4183 r = pMsiGetProductInfoExA(prodcode, usersid,
4184 MSIINSTALLCONTEXT_USERUNMANAGED,
4185 INSTALLPROPERTY_PUBLISHER, 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);
4190
4191 res = RegSetValueExA(prodkey, "URLInfoAbout", 0, REG_SZ, (LPBYTE)"about", 6);
4192 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
4193
4194 /* URLInfoAbout value exists */
4195 sz = MAX_PATH;
4196 lstrcpyA(buf, "apple");
4197 r = pMsiGetProductInfoExA(prodcode, usersid,
4198 MSIINSTALLCONTEXT_USERUNMANAGED,
4199 INSTALLPROPERTY_URLINFOABOUT, 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);
4204
4205 res = RegSetValueExA(prodkey, "URLUpdateInfo", 0, REG_SZ, (LPBYTE)"update", 7);
4206 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
4207
4208 /* URLUpdateInfo value exists */
4209 sz = MAX_PATH;
4210 lstrcpyA(buf, "apple");
4211 r = pMsiGetProductInfoExA(prodcode, usersid,
4212 MSIINSTALLCONTEXT_USERUNMANAGED,
4213 INSTALLPROPERTY_URLUPDATEINFO, buf, &sz);
4214 ok(r == ERROR_UNKNOWN_PROPERTY,
4215 "Expected ERROR_UNKNOWN_PROPERTY, got %d\n", r);
4216 ok(!lstrcmpA(buf, "apple"), "Expected buf to be unchanged, got %s\n", buf);
4217 ok(sz == MAX_PATH, "Expected MAX_PATH, got %d\n", sz);
4218
4219 res = RegSetValueExA(prodkey, "VersionMinor", 0, REG_SZ, (LPBYTE)"2", 2);
4220 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
4221
4222 /* VersionMinor value exists */
4223 sz = MAX_PATH;
4224 lstrcpyA(buf, "apple");
4225 r = pMsiGetProductInfoExA(prodcode, usersid,
4226 MSIINSTALLCONTEXT_USERUNMANAGED,
4227 INSTALLPROPERTY_VERSIONMINOR, buf, &sz);
4228 ok(r == ERROR_UNKNOWN_PROPERTY,
4229 "Expected ERROR_UNKNOWN_PROPERTY, got %d\n", r);
4230 ok(!lstrcmpA(buf, "apple"), "Expected buf to be unchanged, got %s\n", buf);
4231 ok(sz == MAX_PATH, "Expected MAX_PATH, got %d\n", sz);
4232
4233 res = RegSetValueExA(prodkey, "VersionMajor", 0, REG_SZ, (LPBYTE)"3", 2);
4234 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
4235
4236 /* VersionMajor value exists */
4237 sz = MAX_PATH;
4238 lstrcpyA(buf, "apple");
4239 r = pMsiGetProductInfoExA(prodcode, usersid,
4240 MSIINSTALLCONTEXT_USERUNMANAGED,
4241 INSTALLPROPERTY_VERSIONMAJOR, buf, &sz);
4242 ok(r == ERROR_UNKNOWN_PROPERTY,
4243 "Expected ERROR_UNKNOWN_PROPERTY, got %d\n", r);
4244 ok(!lstrcmpA(buf, "apple"), "Expected buf to be unchanged, got %s\n", buf);
4245 ok(sz == MAX_PATH, "Expected MAX_PATH, got %d\n", sz);
4246
4247 res = RegSetValueExA(prodkey, "DisplayVersion", 0, REG_SZ, (LPBYTE)"3.2.1", 6);
4248 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
4249
4250 /* DisplayVersion value exists */
4251 sz = MAX_PATH;
4252 lstrcpyA(buf, "apple");
4253 r = pMsiGetProductInfoExA(prodcode, usersid,
4254 MSIINSTALLCONTEXT_USERUNMANAGED,
4255 INSTALLPROPERTY_VERSIONSTRING, buf, &sz);
4256 ok(r == ERROR_UNKNOWN_PROPERTY,
4257 "Expected ERROR_UNKNOWN_PROPERTY, got %d\n", r);
4258 ok(!lstrcmpA(buf, "apple"), "Expected buf to be unchanged, got %s\n", buf);
4259 ok(sz == MAX_PATH, "Expected MAX_PATH, got %d\n", sz);
4260
4261 res = RegSetValueExA(prodkey, "ProductID", 0, REG_SZ, (LPBYTE)"id", 3);
4262 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
4263
4264 /* ProductID value exists */
4265 sz = MAX_PATH;
4266 lstrcpyA(buf, "apple");
4267 r = pMsiGetProductInfoExA(prodcode, usersid,
4268 MSIINSTALLCONTEXT_USERUNMANAGED,
4269 INSTALLPROPERTY_PRODUCTID, buf, &sz);
4270 ok(r == ERROR_UNKNOWN_PROPERTY,
4271 "Expected ERROR_UNKNOWN_PROPERTY, got %d\n", r);
4272 ok(!lstrcmpA(buf, "apple"), "Expected buf to be unchanged, got %s\n", buf);
4273 ok(sz == MAX_PATH, "Expected MAX_PATH, got %d\n", sz);
4274
4275 res = RegSetValueExA(prodkey, "RegCompany", 0, REG_SZ, (LPBYTE)"comp", 5);
4276 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
4277
4278 /* RegCompany value exists */
4279 sz = MAX_PATH;
4280 lstrcpyA(buf, "apple");
4281 r = pMsiGetProductInfoExA(prodcode, usersid,
4282 MSIINSTALLCONTEXT_USERUNMANAGED,
4283 INSTALLPROPERTY_REGCOMPANY, buf, &sz);
4284 ok(r == ERROR_UNKNOWN_PROPERTY,
4285 "Expected ERROR_UNKNOWN_PROPERTY, got %d\n", r);
4286 ok(!lstrcmpA(buf, "apple"), "Expected buf to be unchanged, got %s\n", buf);
4287 ok(sz == MAX_PATH, "Expected MAX_PATH, got %d\n", sz);
4288
4289 res = RegSetValueExA(prodkey, "RegOwner", 0, REG_SZ, (LPBYTE)"owner", 6);
4290 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
4291
4292 /* RegOwner value exists */
4293 sz = MAX_PATH;
4294 lstrcpyA(buf, "apple");
4295 r = pMsiGetProductInfoExA(prodcode, usersid,
4296 MSIINSTALLCONTEXT_USERUNMANAGED,
4297 INSTALLPROPERTY_REGOWNER, buf, &sz);
4298 ok(r == ERROR_UNKNOWN_PROPERTY,
4299 "Expected ERROR_UNKNOWN_PROPERTY, got %d\n", r);
4300 ok(!lstrcmpA(buf, "apple"), "Expected buf to be unchanged, got %s\n", buf);
4301 ok(sz == MAX_PATH, "Expected MAX_PATH, got %d\n", sz);
4302
4303 res = RegSetValueExA(prodkey, "Transforms", 0, REG_SZ, (LPBYTE)"trans", 6);
4304 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
4305
4306 /* Transforms value exists */
4307 sz = MAX_PATH;
4308 lstrcpyA(buf, "apple");
4309 r = pMsiGetProductInfoExA(prodcode, usersid,
4310 MSIINSTALLCONTEXT_USERUNMANAGED,
4311 INSTALLPROPERTY_TRANSFORMS, buf, &sz);
4312 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
4313 ok(!lstrcmpA(buf, "trans"), "Expected \"trans\", got \"%s\"\n", buf);
4314 ok(sz == 5, "Expected 5, got %d\n", sz);
4315
4316 res = RegSetValueExA(prodkey, "Language", 0, REG_SZ, (LPBYTE)"lang", 5);
4317 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
4318
4319 /* Language value exists */
4320 sz = MAX_PATH;
4321 lstrcpyA(buf, "apple");
4322 r = pMsiGetProductInfoExA(prodcode, usersid,
4323 MSIINSTALLCONTEXT_USERUNMANAGED,
4324 INSTALLPROPERTY_LANGUAGE, buf, &sz);
4325 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
4326 ok(!lstrcmpA(buf, "lang"), "Expected \"lang\", got \"%s\"\n", buf);
4327 ok(sz == 4, "Expected 4, got %d\n", sz);
4328
4329 res = RegSetValueExA(prodkey, "ProductName", 0, REG_SZ, (LPBYTE)"name", 5);
4330 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
4331
4332 /* ProductName value exists */
4333 sz = MAX_PATH;
4334 lstrcpyA(buf, "apple");
4335 r = pMsiGetProductInfoExA(prodcode, usersid,
4336 MSIINSTALLCONTEXT_USERUNMANAGED,
4337 INSTALLPROPERTY_PRODUCTNAME, buf, &sz);
4338 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
4339 ok(!lstrcmpA(buf, "name"), "Expected \"name\", got \"%s\"\n", buf);
4340 ok(sz == 4, "Expected 4, got %d\n", sz);
4341
4342 res = RegSetValueExA(prodkey, "AssignmentType", 0, REG_SZ, (LPBYTE)"type", 5);
4343 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
4344
4345 /* FIXME */
4346
4347 /* AssignmentType value exists */
4348 sz = MAX_PATH;
4349 lstrcpyA(buf, "apple");
4350 r = pMsiGetProductInfoExA(prodcode, usersid,
4351 MSIINSTALLCONTEXT_USERUNMANAGED,
4352 INSTALLPROPERTY_ASSIGNMENTTYPE, buf, &sz);
4353 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
4354 ok(!lstrcmpA(buf, ""), "Expected \"\", got \"%s\"\n", buf);
4355 ok(sz == 0, "Expected 0, got %d\n", sz);
4356
4357 res = RegSetValueExA(prodkey, "PackageCode", 0, REG_SZ, (LPBYTE)"code", 5);
4358 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
4359
4360 /* FIXME */
4361
4362 /* PackageCode value exists */
4363 sz = MAX_PATH;
4364 lstrcpyA(buf, "apple");
4365 r = pMsiGetProductInfoExA(prodcode, usersid,
4366 MSIINSTALLCONTEXT_USERUNMANAGED,
4367 INSTALLPROPERTY_PACKAGECODE, buf, &sz);
4368 todo_wine
4369 {
4370 ok(r == ERROR_BAD_CONFIGURATION,
4371 "Expected ERROR_BAD_CONFIGURATION, got %d\n", r);
4372 ok(!lstrcmpA(buf, "apple"), "Expected buf to be unchanged, got %s\n", buf);
4373 ok(sz == MAX_PATH, "Expected MAX_PATH, got %d\n", sz);
4374 }
4375
4376 res = RegSetValueExA(prodkey, "Version", 0, REG_SZ, (LPBYTE)"ver", 4);
4377 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
4378
4379 /* Version value exists */
4380 sz = MAX_PATH;
4381 lstrcpyA(buf, "apple");
4382 r = pMsiGetProductInfoExA(prodcode, usersid,
4383 MSIINSTALLCONTEXT_USERUNMANAGED,
4384 INSTALLPROPERTY_VERSION, buf, &sz);
4385 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
4386 ok(!lstrcmpA(buf, "ver"), "Expected \"ver\", got \"%s\"\n", buf);
4387 ok(sz == 3, "Expected 3, got %d\n", sz);
4388
4389 res = RegSetValueExA(prodkey, "ProductIcon", 0, REG_SZ, (LPBYTE)"icon", 5);
4390 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
4391
4392 /* ProductIcon value exists */
4393 sz = MAX_PATH;
4394 lstrcpyA(buf, "apple");
4395 r = pMsiGetProductInfoExA(prodcode, usersid,
4396 MSIINSTALLCONTEXT_USERUNMANAGED,
4397 INSTALLPROPERTY_PRODUCTICON, buf, &sz);
4398 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
4399 ok(!lstrcmpA(buf, "icon"), "Expected \"icon\", got \"%s\"\n", buf);
4400 ok(sz == 4, "Expected 4, got %d\n", sz);
4401
4402 res = RegSetValueExA(prodkey, "PackageName", 0, REG_SZ, (LPBYTE)"name", 5);
4403 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
4404
4405 /* PackageName value exists */
4406 sz = MAX_PATH;
4407 lstrcpyA(buf, "apple");
4408 r = pMsiGetProductInfoExA(prodcode, usersid,
4409 MSIINSTALLCONTEXT_USERUNMANAGED,
4410 INSTALLPROPERTY_PACKAGENAME, buf, &sz);
4411 todo_wine
4412 {
4413 ok(r == ERROR_UNKNOWN_PRODUCT,
4414 "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r);
4415 ok(!lstrcmpA(buf, "apple"), "Expected buf to be unchanged, got %s\n", buf);
4416 ok(sz == MAX_PATH, "Expected MAX_PATH, got %d\n", sz);
4417 }
4418
4419 res = RegSetValueExA(prodkey, "AuthorizedLUAApp", 0, REG_SZ, (LPBYTE)"auth", 5);
4420 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
4421
4422 /* AuthorizedLUAApp value exists */
4423 sz = MAX_PATH;
4424 lstrcpyA(buf, "apple");
4425 r = pMsiGetProductInfoExA(prodcode, usersid,
4426 MSIINSTALLCONTEXT_USERUNMANAGED,
4427 INSTALLPROPERTY_AUTHORIZED_LUA_APP, buf, &sz);
4428 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
4429 ok(!lstrcmpA(buf, "auth"), "Expected \"auth\", got \"%s\"\n", buf);
4430 ok(sz == 4, "Expected 4, got %d\n", sz);
4431
4432 RegDeleteValueA(prodkey, "AuthorizedLUAApp");
4433 RegDeleteValueA(prodkey, "PackageName");
4434 RegDeleteValueA(prodkey, "ProductIcon");
4435 RegDeleteValueA(prodkey, "Version");
4436 RegDeleteValueA(prodkey, "PackageCode");
4437 RegDeleteValueA(prodkey, "AssignmentType");
4438 RegDeleteValueA(prodkey, "ProductName");
4439 RegDeleteValueA(prodkey, "Language");
4440 RegDeleteValueA(prodkey, "Transforms");
4441 RegDeleteValueA(prodkey, "RegOwner");
4442 RegDeleteValueA(prodkey, "RegCompany");
4443 RegDeleteValueA(prodkey, "ProductID");
4444 RegDeleteValueA(prodkey, "DisplayVersion");
4445 RegDeleteValueA(prodkey, "VersionMajor");
4446 RegDeleteValueA(prodkey, "VersionMinor");
4447 RegDeleteValueA(prodkey, "URLUpdateInfo");
4448 RegDeleteValueA(prodkey, "URLInfoAbout");
4449 RegDeleteValueA(prodkey, "Publisher");
4450 RegDeleteValueA(prodkey, "LocalPackage");
4451 RegDeleteValueA(prodkey, "InstallSource");
4452 RegDeleteValueA(prodkey, "InstallLocation");
4453 RegDeleteValueA(prodkey, "DisplayName");
4454 RegDeleteValueA(prodkey, "InstallDate");
4455 RegDeleteValueA(prodkey, "HelpTelephone");
4456 RegDeleteValueA(prodkey, "HelpLink");
4457 RegDeleteValueA(prodkey, "LocalPackage");
4458 RegDeleteKeyA(prodkey, "");
4459 RegCloseKey(prodkey);
4460
4461 /* MSIINSTALLCONTEXT_USERMANAGED */
4462
4463 lstrcpyA(keypath, "Software\\Microsoft\\Windows\\CurrentVersion\\Installer\\UserData\\");
4464 lstrcatA(keypath, usersid);
4465 lstrcatA(keypath, "\\Products\\");
4466 lstrcatA(keypath, prod_squashed);
4467
4468 res = RegCreateKeyA(HKEY_LOCAL_MACHINE, keypath, &localkey);
4469 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
4470
4471 /* local user product key exists */
4472 sz = MAX_PATH;
4473 lstrcpyA(buf, "apple");
4474 r = pMsiGetProductInfoExA(prodcode, usersid,
4475 MSIINSTALLCONTEXT_USERMANAGED,
4476 INSTALLPROPERTY_PRODUCTSTATE, buf, &sz);
4477 ok(r == ERROR_UNKNOWN_PRODUCT,
4478 "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r);
4479 ok(!lstrcmpA(buf, "apple"), "Expected buf to be unchanged, got %s\n", buf);
4480 ok(sz == MAX_PATH, "Expected MAX_PATH, got %d\n", sz);
4481
4482 res = RegCreateKeyA(localkey, "InstallProperties", &propkey);
4483 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
4484
4485 /* InstallProperties key exists */
4486 sz = MAX_PATH;
4487 lstrcpyA(buf, "apple");
4488 r = pMsiGetProductInfoExA(prodcode, usersid,
4489 MSIINSTALLCONTEXT_USERMANAGED,
4490 INSTALLPROPERTY_PRODUCTSTATE, buf, &sz);
4491 ok(r == ERROR_UNKNOWN_PRODUCT,
4492 "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r);
4493 ok(!lstrcmpA(buf, "apple"), "Expected buf to be unchanged, got %s\n", buf);
4494 ok(sz == MAX_PATH, "Expected MAX_PATH, got %d\n", sz);
4495
4496 res = RegSetValueExA(propkey, "ManagedLocalPackage", 0, REG_SZ, (LPBYTE)"local", 6);
4497 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
4498
4499 /* ManagedLocalPackage value exists */
4500 sz = MAX_PATH;
4501 lstrcpyA(buf, "apple");
4502 r = pMsiGetProductInfoExA(prodcode, usersid,
4503 MSIINSTALLCONTEXT_USERMANAGED,
4504 INSTALLPROPERTY_PRODUCTSTATE, buf, &sz);
4505 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
4506 ok(!lstrcmpA(buf, "5"), "Expected \"5\", got \"%s\"\n", buf);
4507 ok(sz == 1, "Expected 1, got %d\n", sz);
4508
4509 res = RegSetValueExA(propkey, "HelpLink", 0, REG_SZ, (LPBYTE)"link", 5);
4510 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
4511
4512 /* HelpLink value exists */
4513 sz = MAX_PATH;
4514 lstrcpyA(buf, "apple");
4515 r = pMsiGetProductInfoExA(prodcode, usersid,
4516 MSIINSTALLCONTEXT_USERMANAGED,
4517 INSTALLPROPERTY_HELPLINK, buf, &sz);
4518 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
4519 ok(!lstrcmpA(buf, "link"), "Expected \"link\", got \"%s\"\n", buf);
4520 ok(sz == 4, "Expected 4, got %d\n", sz);
4521
4522 res = RegSetValueExA(propkey, "HelpTelephone", 0, REG_SZ, (LPBYTE)"phone", 6);
4523 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
4524
4525 /* HelpTelephone value exists */
4526 sz = MAX_PATH;
4527 lstrcpyA(buf, "apple");
4528 r = pMsiGetProductInfoExA(prodcode, usersid,
4529 MSIINSTALLCONTEXT_USERMANAGED,
4530 INSTALLPROPERTY_HELPTELEPHONE, buf, &sz);
4531 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
4532 ok(!lstrcmpA(buf, "phone"), "Expected \"phone\", got \"%s\"\n", buf);
4533 ok(sz == 5, "Expected 5, got %d\n", sz);
4534
4535 res = RegSetValueExA(propkey, "InstallDate", 0, REG_SZ, (LPBYTE)"date", 5);
4536 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
4537
4538 /* InstallDate value exists */
4539 sz = MAX_PATH;
4540 lstrcpyA(buf, "apple");
4541 r = pMsiGetProductInfoExA(prodcode, usersid,
4542 MSIINSTALLCONTEXT_USERMANAGED,
4543 INSTALLPROPERTY_INSTALLDATE, buf, &sz);
4544 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
4545 ok(!lstrcmpA(buf, "date"), "Expected \"date\", got \"%s\"\n", buf);
4546 ok(sz == 4, "Expected 4, got %d\n", sz);
4547
4548 res = RegSetValueExA(propkey, "DisplayName", 0, REG_SZ, (LPBYTE)"name", 5);
4549 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
4550
4551 /* DisplayName value exists */
4552 sz = MAX_PATH;
4553 lstrcpyA(buf, "apple");
4554 r = pMsiGetProductInfoExA(prodcode, usersid,
4555 MSIINSTALLCONTEXT_USERMANAGED,
4556 INSTALLPROPERTY_INSTALLEDPRODUCTNAME, buf, &sz);
4557 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
4558 ok(!lstrcmpA(buf, "name"), "Expected \"name\", got \"%s\"\n", buf);
4559 ok(sz == 4, "Expected 4, got %d\n", sz);
4560
4561 res = RegSetValueExA(propkey, "InstallLocation", 0, REG_SZ, (LPBYTE)"loc", 4);
4562 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
4563
4564 /* InstallLocation value exists */
4565 sz = MAX_PATH;
4566 lstrcpyA(buf, "apple");
4567 r = pMsiGetProductInfoExA(prodcode, usersid,
4568 MSIINSTALLCONTEXT_USERMANAGED,
4569 INSTALLPROPERTY_INSTALLLOCATION, buf, &sz);
4570 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
4571 ok(!lstrcmpA(buf, "loc"), "Expected \"loc\", got \"%s\"\n", buf);
4572 ok(sz == 3, "Expected 3, got %d\n", sz);
4573
4574 res = RegSetValueExA(propkey, "InstallSource", 0, REG_SZ, (LPBYTE)"source", 7);
4575 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
4576
4577 /* InstallSource value exists */
4578 sz = MAX_PATH;
4579 lstrcpyA(buf, "apple");
4580 r = pMsiGetProductInfoExA(prodcode, usersid,
4581 MSIINSTALLCONTEXT_USERMANAGED,
4582 INSTALLPROPERTY_INSTALLSOURCE, buf, &sz);
4583 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
4584 ok(!lstrcmpA(buf, "source"), "Expected \"source\", got \"%s\"\n", buf);
4585 ok(sz == 6, "Expected 6, got %d\n", sz);
4586
4587 res = RegSetValueExA(propkey, "LocalPackage", 0, REG_SZ, (LPBYTE)"local", 6);
4588 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
4589
4590 /* LocalPackage value exists */
4591 sz = MAX_PATH;
4592 lstrcpyA(buf, "apple");
4593 r = pMsiGetProductInfoExA(prodcode, usersid,
4594 MSIINSTALLCONTEXT_USERMANAGED,
4595 INSTALLPROPERTY_LOCALPACKAGE, buf, &sz);
4596 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
4597 ok(!lstrcmpA(buf, "local"), "Expected \"local\", got \"%s\"\n", buf);
4598 ok(sz == 5, "Expected 5, got %d\n", sz);
4599
4600 res = RegSetValueExA(propkey, "Publisher", 0, REG_SZ, (LPBYTE)"pub", 4);
4601 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
4602
4603 /* Publisher value exists */
4604 sz = MAX_PATH;
4605 lstrcpyA(buf, "apple");
4606 r = pMsiGetProductInfoExA(prodcode, usersid,
4607 MSIINSTALLCONTEXT_USERMANAGED,
4608 INSTALLPROPERTY_PUBLISHER, buf, &sz);
4609 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
4610 ok(!lstrcmpA(buf, "pub"), "Expected \"pub\", got \"%s\"\n", buf);
4611 ok(sz == 3, "Expected 3, got %d\n", sz);
4612
4613 res = RegSetValueExA(propkey, "URLInfoAbout", 0, REG_SZ, (LPBYTE)"about", 6);
4614 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
4615
4616 /* URLInfoAbout value exists */
4617 sz = MAX_PATH;
4618 lstrcpyA(buf, "apple");
4619 r = pMsiGetProductInfoExA(prodcode, usersid,
4620 MSIINSTALLCONTEXT_USERMANAGED,
4621 INSTALLPROPERTY_URLINFOABOUT, buf, &sz);
4622 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
4623 ok(!lstrcmpA(buf, "about"), "Expected \"about\", got \"%s\"\n", buf);
4624 ok(sz == 5, "Expected 5, got %d\n", sz);
4625
4626 res = RegSetValueExA(propkey, "URLUpdateInfo", 0, REG_SZ, (LPBYTE)"update", 7);
4627 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
4628
4629 /* URLUpdateInfo value exists */
4630 sz = MAX_PATH;
4631 lstrcpyA(buf, "apple");
4632 r = pMsiGetProductInfoExA(prodcode, usersid,
4633 MSIINSTALLCONTEXT_USERMANAGED,
4634 INSTALLPROPERTY_URLUPDATEINFO, buf, &sz);
4635 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
4636 ok(!lstrcmpA(buf, "update"), "Expected \"update\", got \"%s\"\n", buf);
4637 ok(sz == 6, "Expected 6, got %d\n", sz);
4638
4639 res = RegSetValueExA(propkey, "VersionMinor", 0, REG_SZ, (LPBYTE)"2", 2);
4640 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
4641
4642 /* VersionMinor value exists */
4643 sz = MAX_PATH;
4644 lstrcpyA(buf, "apple");
4645 r = pMsiGetProductInfoExA(prodcode, usersid,
4646 MSIINSTALLCONTEXT_USERMANAGED,
4647 INSTALLPROPERTY_VERSIONMINOR, buf, &sz);
4648 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
4649 ok(!lstrcmpA(buf, "2"), "Expected \"2\", got \"%s\"\n", buf);
4650 ok(sz == 1, "Expected 1, got %d\n", sz);
4651
4652 res = RegSetValueExA(propkey, "VersionMajor", 0, REG_SZ, (LPBYTE)"3", 2);
4653 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
4654
4655 /* VersionMajor value exists */
4656 sz = MAX_PATH;
4657 lstrcpyA(buf, "apple");
4658 r = pMsiGetProductInfoExA(prodcode, usersid,
4659 MSIINSTALLCONTEXT_USERMANAGED,
4660 INSTALLPROPERTY_VERSIONMAJOR, buf, &sz);
4661 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
4662 ok(!lstrcmpA(buf, "3"), "Expected \"3\", got \"%s\"\n", buf);
4663 ok(sz == 1, "Expected 1, got %d\n", sz);
4664
4665 res = RegSetValueExA(propkey, "DisplayVersion", 0, REG_SZ, (LPBYTE)"3.2.1", 6);
4666 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
4667
4668 /* DisplayVersion value exists */
4669 sz = MAX_PATH;
4670 lstrcpyA(buf, "apple");
4671 r = pMsiGetProductInfoExA(prodcode, usersid,
4672 MSIINSTALLCONTEXT_USERMANAGED,
4673 INSTALLPROPERTY_VERSIONSTRING, buf, &sz);
4674 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
4675 ok(!lstrcmpA(buf, "3.2.1"), "Expected \"3.2.1\", got \"%s\"\n", buf);
4676 ok(sz == 5, "Expected 5, got %d\n", sz);
4677
4678 res = RegSetValueExA(propkey, "ProductID", 0, REG_SZ, (LPBYTE)"id", 3);
4679 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
4680
4681 /* ProductID value exists */
4682 sz = MAX_PATH;
4683 lstrcpyA(buf, "apple");
4684 r = pMsiGetProductInfoExA(prodcode, usersid,
4685 MSIINSTALLCONTEXT_USERMANAGED,
4686 INSTALLPROPERTY_PRODUCTID, buf, &sz);
4687 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
4688 ok(!lstrcmpA(buf, "id"), "Expected \"id\", got \"%s\"\n", buf);
4689 ok(sz == 2, "Expected 2, got %d\n", sz);
4690
4691 res = RegSetValueExA(propkey, "RegCompany", 0, REG_SZ, (LPBYTE)"comp", 5);
4692 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
4693
4694 /* RegCompany value exists */
4695 sz = MAX_PATH;
4696 lstrcpyA(buf, "apple");
4697 r = pMsiGetProductInfoExA(prodcode, usersid,
4698 MSIINSTALLCONTEXT_USERMANAGED,
4699 INSTALLPROPERTY_REGCOMPANY, buf, &sz);
4700 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
4701 ok(!lstrcmpA(buf, "comp"), "Expected \"comp\", got \"%s\"\n", buf);
4702 ok(sz == 4, "Expected 4, got %d\n", sz);
4703
4704 res = RegSetValueExA(propkey, "RegOwner", 0, REG_SZ, (LPBYTE)"owner", 6);
4705 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
4706
4707 /* RegOwner value exists */
4708 sz = MAX_PATH;
4709 lstrcpyA(buf, "apple");
4710 r = pMsiGetProductInfoExA(prodcode, usersid,
4711 MSIINSTALLCONTEXT_USERMANAGED,
4712 INSTALLPROPERTY_REGOWNER, buf, &sz);
4713 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
4714 ok(!lstrcmpA(buf, "owner"), "Expected \"owner\", got \"%s\"\n", buf);
4715 ok(sz == 5, "Expected 5, got %d\n", sz);
4716
4717 res = RegSetValueExA(propkey, "Transforms", 0, REG_SZ, (LPBYTE)"trans", 6);
4718 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
4719
4720 /* Transforms value exists */
4721 sz = MAX_PATH;
4722 lstrcpyA(buf, "apple");
4723 r = pMsiGetProductInfoExA(prodcode, usersid,
4724 MSIINSTALLCONTEXT_USERMANAGED,
4725 INSTALLPROPERTY_TRANSFORMS, buf, &sz);
4726 ok(r == ERROR_UNKNOWN_PRODUCT,
4727 "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r);
4728 ok(!lstrcmpA(buf, "apple"), "Expected buf to be unchanged, got %s\n", buf);
4729 ok(sz == MAX_PATH, "Expected MAX_PATH, got %d\n", sz);
4730
4731 res = RegSetValueExA(propkey, "Language", 0, REG_SZ, (LPBYTE)"lang", 5);
4732 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
4733
4734 /* Language value exists */
4735 sz = MAX_PATH;
4736 lstrcpyA(buf, "apple");
4737 r = pMsiGetProductInfoExA(prodcode, usersid,
4738 MSIINSTALLCONTEXT_USERMANAGED,
4739 INSTALLPROPERTY_LANGUAGE, buf, &sz);
4740 ok(r == ERROR_UNKNOWN_PRODUCT,
4741 "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r);
4742 ok(!lstrcmpA(buf, "apple"), "Expected buf to be unchanged, got %s\n", buf);
4743 ok(sz == MAX_PATH, "Expected MAX_PATH, got %d\n", sz);
4744
4745 res = RegSetValueExA(propkey, "ProductName", 0, REG_SZ, (LPBYTE)"name", 5);
4746 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
4747
4748 /* ProductName value exists */
4749 sz = MAX_PATH;
4750 lstrcpyA(buf, "apple");
4751 r = pMsiGetProductInfoExA(prodcode, usersid,
4752 MSIINSTALLCONTEXT_USERMANAGED,
4753 INSTALLPROPERTY_PRODUCTNAME, buf, &sz);
4754 ok(r == ERROR_UNKNOWN_PRODUCT,
4755 "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r);
4756 ok(!lstrcmpA(buf, "apple"), "Expected buf to be unchanged, got %s\n", buf);
4757 ok(sz == MAX_PATH, "Expected MAX_PATH, got %d\n", sz);
4758
4759 res = RegSetValueExA(propkey, "AssignmentType", 0, REG_SZ, (LPBYTE)"type", 5);
4760 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
4761
4762 /* FIXME */
4763
4764 /* AssignmentType value exists */
4765 sz = MAX_PATH;
4766 lstrcpyA(buf, "apple");
4767 r = pMsiGetProductInfoExA(prodcode, usersid,
4768 MSIINSTALLCONTEXT_USERMANAGED,
4769 INSTALLPROPERTY_ASSIGNMENTTYPE, buf, &sz);
4770 ok(r == ERROR_UNKNOWN_PRODUCT,
4771 "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r);
4772 ok(!lstrcmpA(buf, "apple"), "Expected buf to be unchanged, got %s\n", buf);
4773 ok(sz == MAX_PATH, "Expected MAX_PATH, got %d\n", sz);
4774
4775 res = RegSetValueExA(propkey, "PackageCode", 0, REG_SZ, (LPBYTE)"code", 5);
4776 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
4777
4778 /* PackageCode value exists */
4779 sz = MAX_PATH;
4780 lstrcpyA(buf, "apple");
4781 r = pMsiGetProductInfoExA(prodcode, usersid,
4782 MSIINSTALLCONTEXT_USERMANAGED,
4783 INSTALLPROPERTY_PACKAGECODE, buf, &sz);
4784 ok(r == ERROR_UNKNOWN_PRODUCT,
4785 "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r);
4786 ok(!lstrcmpA(buf, "apple"), "Expected buf to be unchanged, got %s\n", buf);
4787 ok(sz == MAX_PATH, "Expected MAX_PATH, got %d\n", sz);
4788
4789 res = RegSetValueExA(propkey, "Version", 0, REG_SZ, (LPBYTE)"ver", 4);
4790 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
4791
4792 /* Version value exists */
4793 sz = MAX_PATH;
4794 lstrcpyA(buf, "apple");
4795 r = pMsiGetProductInfoExA(prodcode, usersid,
4796 MSIINSTALLCONTEXT_USERMANAGED,
4797 INSTALLPROPERTY_VERSION, buf, &sz);
4798 ok(r == ERROR_UNKNOWN_PRODUCT,
4799 "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r);
4800 ok(!lstrcmpA(buf, "apple"), "Expected buf to be unchanged, got %s\n", buf);
4801 ok(sz == MAX_PATH, "Expected MAX_PATH, got %d\n", sz);
4802
4803 res = RegSetValueExA(propkey, "ProductIcon", 0, REG_SZ, (LPBYTE)"icon", 5);
4804 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
4805
4806 /* ProductIcon value exists */
4807 sz = MAX_PATH;
4808 lstrcpyA(buf, "apple");
4809 r = pMsiGetProductInfoExA(prodcode, usersid,
4810 MSIINSTALLCONTEXT_USERMANAGED,
4811 INSTALLPROPERTY_PRODUCTICON, buf, &sz);
4812 ok(r == ERROR_UNKNOWN_PRODUCT,
4813 "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r);
4814 ok(!lstrcmpA(buf, "apple"), "Expected buf to be unchanged, got %s\n", buf);
4815 ok(sz == MAX_PATH, "Expected MAX_PATH, got %d\n", sz);
4816
4817 res = RegSetValueExA(propkey, "PackageName", 0, REG_SZ, (LPBYTE)"name", 5);
4818 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
4819
4820 /* PackageName value exists */
4821 sz = MAX_PATH;
4822 lstrcpyA(buf, "apple");
4823 r = pMsiGetProductInfoExA(prodcode, usersid,
4824 MSIINSTALLCONTEXT_USERMANAGED,
4825 INSTALLPROPERTY_PACKAGENAME, buf, &sz);
4826 ok(r == ERROR_UNKNOWN_PRODUCT,
4827 "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r);
4828 ok(!lstrcmpA(buf, "apple"), "Expected buf to be unchanged, got %s\n", buf);
4829 ok(sz == MAX_PATH, "Expected MAX_PATH, got %d\n", sz);
4830
4831 res = RegSetValueExA(propkey, "AuthorizedLUAApp", 0, REG_SZ, (LPBYTE)"auth", 5);
4832 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
4833
4834 /* AuthorizedLUAApp value exists */
4835 sz = MAX_PATH;
4836 lstrcpyA(buf, "apple");
4837 r = pMsiGetProductInfoExA(prodcode, usersid,
4838 MSIINSTALLCONTEXT_USERMANAGED,
4839 INSTALLPROPERTY_AUTHORIZED_LUA_APP, buf, &sz);
4840 ok(r == ERROR_UNKNOWN_PRODUCT,
4841 "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r);
4842 ok(!lstrcmpA(buf, "apple"), "Expected buf to be unchanged, got %s\n", buf);
4843 ok(sz == MAX_PATH, "Expected MAX_PATH, got %d\n", sz);
4844
4845 RegDeleteValueA(propkey, "AuthorizedLUAApp");
4846 RegDeleteValueA(propkey, "PackageName");
4847 RegDeleteValueA(propkey, "ProductIcon");
4848 RegDeleteValueA(propkey, "Version");
4849 RegDeleteValueA(propkey, "PackageCode");
4850 RegDeleteValueA(propkey, "AssignmentType");
4851 RegDeleteValueA(propkey, "ProductName");
4852 RegDeleteValueA(propkey, "Language");
4853 RegDeleteValueA(propkey, "Transforms");
4854 RegDeleteValueA(propkey, "RegOwner");
4855 RegDeleteValueA(propkey, "RegCompany");
4856 RegDeleteValueA(propkey, "ProductID");
4857 RegDeleteValueA(propkey, "DisplayVersion");
4858 RegDeleteValueA(propkey, "VersionMajor");
4859 RegDeleteValueA(propkey, "VersionMinor");
4860 RegDeleteValueA(propkey, "URLUpdateInfo");
4861 RegDeleteValueA(propkey, "URLInfoAbout");
4862 RegDeleteValueA(propkey, "Publisher");
4863 RegDeleteValueA(propkey, "LocalPackage");
4864 RegDeleteValueA(propkey, "InstallSource");
4865 RegDeleteValueA(propkey, "InstallLocation");
4866 RegDeleteValueA(propkey, "DisplayName");
4867 RegDeleteValueA(propkey, "InstallDate");
4868 RegDeleteValueA(propkey, "HelpTelephone");
4869 RegDeleteValueA(propkey, "HelpLink");
4870 RegDeleteValueA(propkey, "ManagedLocalPackage");
4871 RegDeleteKeyA(propkey, "");
4872 RegCloseKey(propkey);
4873 RegDeleteKeyA(localkey, "");
4874 RegCloseKey(localkey);
4875
4876 lstrcpyA(keypath, "Software\\Microsoft\\Windows\\CurrentVersion\\Installer\\Managed\\");
4877 lstrcatA(keypath, usersid);
4878 lstrcatA(keypath, "\\Installer\\Products\\");
4879 lstrcatA(keypath, prod_squashed);
4880
4881 res = RegCreateKeyA(HKEY_LOCAL_MACHINE, keypath, &userkey);
4882 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
4883
4884 /* user product key exists */
4885 sz = MAX_PATH;
4886 lstrcpyA(buf, "apple");
4887 r = pMsiGetProductInfoExA(prodcode, usersid,
4888 MSIINSTALLCONTEXT_USERMANAGED,
4889 INSTALLPROPERTY_PRODUCTSTATE, buf, &sz);
4890 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
4891 ok(!lstrcmpA(buf, "1"), "Expected \"1\", got \"%s\"\n", buf);
4892 ok(sz == 1, "Expected 1, got %d\n", sz);
4893
4894 RegDeleteKeyA(userkey, "");
4895 RegCloseKey(userkey);
4896
4897 lstrcpyA(keypath, "Software\\Microsoft\\Installer\\Products\\");
4898 lstrcatA(keypath, prod_squashed);
4899
4900 res = RegCreateKeyA(HKEY_CURRENT_USER, keypath, &prodkey);
4901 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
4902
4903 /* current user product key exists */
4904 sz = MAX_PATH;
4905 lstrcpyA(buf, "apple");
4906 r = pMsiGetProductInfoExA(prodcode, usersid,
4907 MSIINSTALLCONTEXT_USERMANAGED,
4908 INSTALLPROPERTY_PRODUCTSTATE, buf, &sz);
4909 ok(r == ERROR_UNKNOWN_PRODUCT,
4910 "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r);
4911 ok(!lstrcmpA(buf, "apple"), "Expected buf to be unchanged, got %s\n", buf);
4912 ok(sz == MAX_PATH, "Expected MAX_PATH, got %d\n", sz);
4913
4914 res = RegSetValueExA(prodkey, "HelpLink", 0, REG_SZ, (LPBYTE)"link", 5);
4915 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
4916
4917 /* HelpLink value exists, user product key does not exist */
4918 sz = MAX_PATH;
4919 lstrcpyA(buf, "apple");
4920 r = pMsiGetProductInfoExA(prodcode, usersid,
4921 MSIINSTALLCONTEXT_USERMANAGED,
4922 INSTALLPROPERTY_HELPLINK, buf, &sz);
4923 ok(r == ERROR_UNKNOWN_PRODUCT,
4924 "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r);
4925 ok(!lstrcmpA(buf, "apple"), "Expected buf to be unchanged, got %s\n", buf);
4926 ok(sz == MAX_PATH, "Expected MAX_PATH, got %d\n", sz);
4927
4928 lstrcpyA(keypath, "Software\\Microsoft\\Windows\\CurrentVersion\\Installer\\Managed\\");
4929 lstrcatA(keypath, usersid);
4930 lstrcatA(keypath, "\\Installer\\Products\\");
4931 lstrcatA(keypath, prod_squashed);
4932
4933 res = RegCreateKeyA(HKEY_LOCAL_MACHINE, keypath, &userkey);
4934 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
4935
4936 res = RegSetValueExA(userkey, "HelpLink", 0, REG_SZ, (LPBYTE)"link", 5);
4937 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
4938
4939 /* HelpLink value exists, user product key does exist */
4940 sz = MAX_PATH;
4941 lstrcpyA(buf, "apple");
4942 r = pMsiGetProductInfoExA(prodcode, usersid,
4943 MSIINSTALLCONTEXT_USERMANAGED,
4944 INSTALLPROPERTY_HELPLINK, 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);
4949
4950 res = RegSetValueExA(userkey, "HelpTelephone", 0, REG_SZ, (LPBYTE)"phone", 6);
4951 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
4952
4953 /* HelpTelephone value exists */
4954 sz = MAX_PATH;
4955 lstrcpyA(buf, "apple");
4956 r = pMsiGetProductInfoExA(prodcode, usersid,
4957 MSIINSTALLCONTEXT_USERMANAGED,
4958 INSTALLPROPERTY_HELPTELEPHONE, 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);
4963
4964 res = RegSetValueExA(userkey, "InstallDate", 0, REG_SZ, (LPBYTE)"date", 5);
4965 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
4966
4967 /* InstallDate value exists */
4968 sz = MAX_PATH;
4969 lstrcpyA(buf, "apple");
4970 r = pMsiGetProductInfoExA(prodcode, usersid,
4971 MSIINSTALLCONTEXT_USERMANAGED,
4972 INSTALLPROPERTY_INSTALLDATE, 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);
4977
4978 res = RegSetValueExA(userkey, "DisplayName", 0, REG_SZ, (LPBYTE)"name", 5);
4979 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
4980
4981 /* DisplayName value exists */
4982 sz = MAX_PATH;
4983 lstrcpyA(buf, "apple");
4984 r = pMsiGetProductInfoExA(prodcode, usersid,
4985 MSIINSTALLCONTEXT_USERMANAGED,
4986 INSTALLPROPERTY_INSTALLEDPRODUCTNAME, 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);
4991
4992 res = RegSetValueExA(userkey, "InstallLocation", 0, REG_SZ, (LPBYTE)"loc", 4);
4993 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
4994
4995 /* InstallLocation value exists */
4996 sz = MAX_PATH;
4997 lstrcpyA(buf, "apple");
4998 r = pMsiGetProductInfoExA(prodcode, usersid,
4999 MSIINSTALLCONTEXT_USERMANAGED,
5000 INSTALLPROPERTY_INSTALLLOCATION, 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);
5005
5006 res = RegSetValueExA(userkey, "InstallSource", 0, REG_SZ, (LPBYTE)"source", 7);
5007 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
5008
5009 /* InstallSource value exists */
5010 sz = MAX_PATH;
5011 lstrcpyA(buf, "apple");
5012 r = pMsiGetProductInfoExA(prodcode, usersid,
5013 MSIINSTALLCONTEXT_USERMANAGED,
5014 INSTALLPROPERTY_INSTALLSOURCE, 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);
5019
5020 res = RegSetValueExA(userkey, "LocalPackage", 0, REG_SZ, (LPBYTE)"local", 6);
5021 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
5022
5023 /* LocalPackage value exists */
5024 sz = MAX_PATH;
5025 lstrcpyA(buf, "apple");
5026 r = pMsiGetProductInfoExA(prodcode, usersid,
5027 MSIINSTALLCONTEXT_USERMANAGED,
5028 INSTALLPROPERTY_LOCALPACKAGE, 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);
5033
5034 res = RegSetValueExA(userkey, "Publisher", 0, REG_SZ, (LPBYTE)"pub", 4);
5035 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
5036
5037 /* Publisher value exists */
5038 sz = MAX_PATH;
5039 lstrcpyA(buf, "apple");
5040 r = pMsiGetProductInfoExA(prodcode, usersid,
5041 MSIINSTALLCONTEXT_USERMANAGED,
5042 INSTALLPROPERTY_PUBLISHER, 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);
5047
5048 res = RegSetValueExA(userkey, "URLInfoAbout", 0, REG_SZ, (LPBYTE)"about", 6);
5049 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
5050
5051 /* URLInfoAbout value exists */
5052 sz = MAX_PATH;
5053 lstrcpyA(buf, "apple");
5054 r = pMsiGetProductInfoExA(prodcode, usersid,
5055 MSIINSTALLCONTEXT_USERMANAGED,
5056 INSTALLPROPERTY_URLINFOABOUT, 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);
5061
5062 res = RegSetValueExA(userkey, "URLUpdateInfo", 0, REG_SZ, (LPBYTE)"update", 7);
5063 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
5064
5065 /* URLUpdateInfo value exists */
5066 sz = MAX_PATH;
5067 lstrcpyA(buf, "apple");
5068 r = pMsiGetProductInfoExA(prodcode, usersid,
5069 MSIINSTALLCONTEXT_USERMANAGED,
5070 INSTALLPROPERTY_URLUPDATEINFO, buf, &sz);
5071 ok(r == ERROR_UNKNOWN_PROPERTY,
5072 "Expected ERROR_UNKNOWN_PROPERTY, got %d\n", r);
5073 ok(!lstrcmpA(buf, "apple"), "Expected buf to be unchanged, got %s\n", buf);
5074 ok(sz == MAX_PATH, "Expected MAX_PATH, got %d\n", sz);
5075
5076 res = RegSetValueExA(userkey, "VersionMinor", 0, REG_SZ, (LPBYTE)"2", 2);
5077 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
5078
5079 /* VersionMinor value exists */
5080 sz = MAX_PATH;
5081 lstrcpyA(buf, "apple");
5082 r = pMsiGetProductInfoExA(prodcode, usersid,
5083 MSIINSTALLCONTEXT_USERMANAGED,
5084 INSTALLPROPERTY_VERSIONMINOR, buf, &sz);
5085 ok(r == ERROR_UNKNOWN_PROPERTY,
5086 "Expected ERROR_UNKNOWN_PROPERTY, got %d\n", r);
5087 ok(!lstrcmpA(buf, "apple"), "Expected buf to be unchanged, got %s\n", buf);
5088 ok(sz == MAX_PATH, "Expected MAX_PATH, got %d\n", sz);
5089
5090 res = RegSetValueExA(userkey, "VersionMajor", 0, REG_SZ, (LPBYTE)"3", 2);
5091 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
5092
5093 /* VersionMajor value exists */
5094 sz = MAX_PATH;
5095 lstrcpyA(buf, "apple");
5096 r = pMsiGetProductInfoExA(prodcode, usersid,
5097 MSIINSTALLCONTEXT_USERMANAGED,
5098 INSTALLPROPERTY_VERSIONMAJOR, buf, &sz);
5099 ok(r == ERROR_UNKNOWN_PROPERTY,
5100 "Expected ERROR_UNKNOWN_PROPERTY, got %d\n", r);
5101 ok(!lstrcmpA(buf, "apple"), "Expected buf to be unchanged, got %s\n", buf);
5102 ok(sz == MAX_PATH, "Expected MAX_PATH, got %d\n", sz);
5103
5104 res = RegSetValueExA(userkey, "DisplayVersion", 0, REG_SZ, (LPBYTE)"3.2.1", 6);
5105 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
5106
5107 /* DisplayVersion value exists */
5108 sz = MAX_PATH;
5109 lstrcpyA(buf, "apple");
5110 r = pMsiGetProductInfoExA(prodcode, usersid,
5111 MSIINSTALLCONTEXT_USERMANAGED,
5112 INSTALLPROPERTY_VERSIONSTRING, buf, &sz);
5113 ok(r == ERROR_UNKNOWN_PROPERTY,
5114 "Expected ERROR_UNKNOWN_PROPERTY, got %d\n", r);
5115 ok(!lstrcmpA(buf, "apple"), "Expected buf to be unchanged, got %s\n", buf);
5116 ok(sz == MAX_PATH, "Expected MAX_PATH, got %d\n", sz);
5117
5118 res = RegSetValueExA(userkey, "ProductID", 0, REG_SZ, (LPBYTE)"id", 3);
5119 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
5120
5121 /* ProductID value exists */
5122 sz = MAX_PATH;
5123 lstrcpyA(buf, "apple");
5124 r = pMsiGetProductInfoExA(prodcode, usersid,
5125 MSIINSTALLCONTEXT_USERMANAGED,
5126 INSTALLPROPERTY_PRODUCTID, buf, &sz);
5127 ok(r == ERROR_UNKNOWN_PROPERTY,
5128 "Expected ERROR_UNKNOWN_PROPERTY, got %d\n", r);
5129 ok(!lstrcmpA(buf, "apple"), "Expected buf to be unchanged, got %s\n", buf);
5130 ok(sz == MAX_PATH, "Expected MAX_PATH, got %d\n", sz);
5131
5132 res = RegSetValueExA(userkey, "RegCompany", 0, REG_SZ, (LPBYTE)"comp", 5);
5133 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
5134
5135 /* RegCompany value exists */
5136 sz = MAX_PATH;
5137 lstrcpyA(buf, "apple");
5138 r = pMsiGetProductInfoExA(prodcode, usersid,
5139 MSIINSTALLCONTEXT_USERMANAGED,
5140 INSTALLPROPERTY_REGCOMPANY, buf, &sz);
5141 ok(r == ERROR_UNKNOWN_PROPERTY,
5142 "Expected ERROR_UNKNOWN_PROPERTY, got %d\n", r);
5143 ok(!lstrcmpA(buf, "apple"), "Expected buf to be unchanged, got %s\n", buf);
5144 ok(sz == MAX_PATH, "Expected MAX_PATH, got %d\n", sz);
5145
5146 res = RegSetValueExA(userkey, "RegOwner", 0, REG_SZ, (LPBYTE)"owner", 6);
5147 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
5148
5149 /* RegOwner value exists */
5150 sz = MAX_PATH;
5151 lstrcpyA(buf, "apple");
5152 r = pMsiGetProductInfoExA(prodcode, usersid,
5153 MSIINSTALLCONTEXT_USERMANAGED,
5154 INSTALLPROPERTY_REGOWNER, buf, &sz);
5155 ok(r == ERROR_UNKNOWN_PROPERTY,
5156 "Expected ERROR_UNKNOWN_PROPERTY, got %d\n", r);
5157 ok(!lstrcmpA(buf, "apple"), "Expected buf to be unchanged, got %s\n", buf);
5158 ok(sz == MAX_PATH, "Expected MAX_PATH, got %d\n", sz);
5159
5160 res = RegSetValueExA(userkey, "Transforms", 0, REG_SZ, (LPBYTE)"trans", 6);
5161 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
5162
5163 /* Transforms value exists */
5164 sz = MAX_PATH;
5165 lstrcpyA(buf, "apple");
5166 r = pMsiGetProductInfoExA(prodcode, usersid,
5167 MSIINSTALLCONTEXT_USERMANAGED,
5168 INSTALLPROPERTY_TRANSFORMS, buf, &sz);
5169 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
5170 ok(!lstrcmpA(buf, "trans"), "Expected \"trans\", got \"%s\"\n", buf);
5171 ok(sz == 5, "Expected 5, got %d\n", sz);
5172
5173 res = RegSetValueExA(userkey, "Language", 0, REG_SZ, (LPBYTE)"lang", 5);
5174 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
5175
5176 /* Language value exists */
5177 sz = MAX_PATH;
5178 lstrcpyA(buf, "apple");
5179 r = pMsiGetProductInfoExA(prodcode, usersid,
5180 MSIINSTALLCONTEXT_USERMANAGED,
5181 INSTALLPROPERTY_LANGUAGE, buf, &sz);
5182 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
5183 ok(!lstrcmpA(buf, "lang"), "Expected \"lang\", got \"%s\"\n", buf);
5184 ok(sz == 4, "Expected 4, got %d\n", sz);
5185
5186 res = RegSetValueExA(userkey, "ProductName", 0, REG_SZ, (LPBYTE)"name", 5);
5187 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
5188
5189 /* ProductName value exists */
5190 sz = MAX_PATH;
5191 lstrcpyA(buf, "apple");
5192 r = pMsiGetProductInfoExA(prodcode, usersid,
5193 MSIINSTALLCONTEXT_USERMANAGED,
5194 INSTALLPROPERTY_PRODUCTNAME, buf, &sz);
5195 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
5196 ok(!lstrcmpA(buf, "name"), "Expected \"name\", got \"%s\"\n", buf);
5197 ok(sz == 4, "Expected 4, got %d\n", sz);
5198
5199 res = RegSetValueExA(userkey, "AssignmentType", 0, REG_SZ, (LPBYTE)"type", 5);
5200 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
5201
5202 /* FIXME */
5203
5204 /* AssignmentType value exists */
5205 sz = MAX_PATH;
5206 lstrcpyA(buf, "apple");
5207 r = pMsiGetProductInfoExA(prodcode, usersid,
5208 MSIINSTALLCONTEXT_USERMANAGED,
5209 INSTALLPROPERTY_ASSIGNMENTTYPE, buf, &sz);
5210 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
5211 ok(!lstrcmpA(buf, ""), "Expected \"\", got \"%s\"\n", buf);
5212 ok(sz == 0, "Expected 0, got %d\n", sz);
5213
5214 res = RegSetValueExA(userkey, "PackageCode", 0, REG_SZ, (LPBYTE)"code", 5);
5215 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
5216
5217 /* FIXME */
5218
5219 /* PackageCode value exists */
5220 sz = MAX_PATH;
5221 lstrcpyA(buf, "apple");
5222 r = pMsiGetProductInfoExA(prodcode, usersid,
5223 MSIINSTALLCONTEXT_USERMANAGED,
5224 INSTALLPROPERTY_PACKAGECODE, buf, &sz);
5225 todo_wine
5226 {
5227 ok(r == ERROR_BAD_CONFIGURATION,
5228 "Expected ERROR_BAD_CONFIGURATION, got %d\n", r);
5229 ok(!lstrcmpA(buf, "apple"), "Expected buf to be unchanged, got %s\n", buf);
5230 ok(sz == MAX_PATH, "Expected MAX_PATH, got %d\n", sz);
5231 }
5232
5233 res = RegSetValueExA(userkey, "Version", 0, REG_SZ, (LPBYTE)"ver", 4);
5234 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
5235
5236 /* Version value exists */
5237 sz = MAX_PATH;
5238 lstrcpyA(buf, "apple");
5239 r = pMsiGetProductInfoExA(prodcode, usersid,
5240 MSIINSTALLCONTEXT_USERMANAGED,
5241 INSTALLPROPERTY_VERSION, buf, &sz);
5242 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
5243 ok(!lstrcmpA(buf, "ver"), "Expected \"ver\", got \"%s\"\n", buf);
5244 ok(sz == 3, "Expected 3, got %d\n", sz);
5245
5246 res = RegSetValueExA(userkey, "ProductIcon", 0, REG_SZ, (LPBYTE)"icon", 5);
5247 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
5248
5249 /* ProductIcon value exists */
5250 sz = MAX_PATH;
5251 lstrcpyA(buf, "apple");
5252 r = pMsiGetProductInfoExA(prodcode, usersid,
5253 MSIINSTALLCONTEXT_USERMANAGED,
5254 INSTALLPROPERTY_PRODUCTICON, buf, &sz);
5255 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
5256 ok(!lstrcmpA(buf, "icon"), "Expected \"icon\", got \"%s\"\n", buf);
5257 ok(sz == 4, "Expected 4, got %d\n", sz);
5258
5259 res = RegSetValueExA(userkey, "PackageName", 0, REG_SZ, (LPBYTE)"name", 5);
5260 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
5261
5262 /* PackageName value exists */
5263 sz = MAX_PATH;
5264 lstrcpyA(buf, "apple");
5265 r = pMsiGetProductInfoExA(prodcode, usersid,
5266 MSIINSTALLCONTEXT_USERMANAGED,
5267 INSTALLPROPERTY_PACKAGENAME, buf, &sz);
5268 todo_wine
5269 {
5270 ok(r == ERROR_UNKNOWN_PRODUCT,
5271 "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r);
5272 ok(!lstrcmpA(buf, "apple"), "Expected buf to be unchanged, got %s\n", buf);
5273 ok(sz == MAX_PATH, "Expected MAX_PATH, got %d\n", sz);
5274 }
5275
5276 res = RegSetValueExA(userkey, "AuthorizedLUAApp", 0, REG_SZ, (LPBYTE)"auth", 5);
5277 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
5278
5279 /* AuthorizedLUAApp value exists */
5280 sz = MAX_PATH;
5281 lstrcpyA(buf, "apple");
5282 r = pMsiGetProductInfoExA(prodcode, usersid,
5283 MSIINSTALLCONTEXT_USERMANAGED,
5284 INSTALLPROPERTY_AUTHORIZED_LUA_APP, buf, &sz);
5285 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
5286 ok(!lstrcmpA(buf, "auth"), "Expected \"auth\", got \"%s\"\n", buf);
5287 ok(sz == 4, "Expected 4, got %d\n", sz);
5288
5289 RegDeleteValueA(userkey, "AuthorizedLUAApp");
5290 RegDeleteValueA(userkey, "PackageName");
5291 RegDeleteValueA(userkey, "ProductIcon");
5292 RegDeleteValueA(userkey, "Version");
5293 RegDeleteValueA(userkey, "PackageCode");
5294 RegDeleteValueA(userkey, "AssignmentType");
5295 RegDeleteValueA(userkey, "ProductName");
5296 RegDeleteValueA(userkey, "Language");
5297 RegDeleteValueA(userkey, "Transforms");
5298 RegDeleteValueA(userkey, "RegOwner");
5299 RegDeleteValueA(userkey, "RegCompany");
5300 RegDeleteValueA(userkey, "ProductID");
5301 RegDeleteValueA(userkey, "DisplayVersion");
5302 RegDeleteValueA(userkey, "VersionMajor");
5303 RegDeleteValueA(userkey, "VersionMinor");
5304 RegDeleteValueA(userkey, "URLUpdateInfo");
5305 RegDeleteValueA(userkey, "URLInfoAbout");
5306 RegDeleteValueA(userkey, "Publisher");
5307 RegDeleteValueA(userkey, "LocalPackage");
5308 RegDeleteValueA(userkey, "InstallSource");
5309 RegDeleteValueA(userkey, "InstallLocation");
5310 RegDeleteValueA(userkey, "DisplayName");
5311 RegDeleteValueA(userkey, "InstallDate");
5312 RegDeleteValueA(userkey, "HelpTelephone");
5313 RegDeleteValueA(userkey, "HelpLink");
5314 RegDeleteKeyA(userkey, "");
5315 RegCloseKey(userkey);
5316 RegDeleteKeyA(prodkey, "");
5317 RegCloseKey(prodkey);
5318
5319 /* MSIINSTALLCONTEXT_MACHINE */
5320
5321 /* szUserSid is non-NULL */
5322 sz = MAX_PATH;
5323 lstrcpyA(buf, "apple");
5324 r = pMsiGetProductInfoExA(prodcode, usersid,
5325 MSIINSTALLCONTEXT_MACHINE,
5326 INSTALLPROPERTY_PRODUCTSTATE, buf, &sz);
5327 ok(r == ERROR_INVALID_PARAMETER,
5328 "Expected ERROR_INVALID_PARAMETER, got %d\n", r);
5329 ok(!lstrcmpA(buf, "apple"), "Expected buf to be unchanged, got %s\n", buf);
5330 ok(sz == MAX_PATH, "Expected MAX_PATH, got %d\n", sz);
5331
5332 lstrcpyA(keypath, "Software\\Microsoft\\Windows\\CurrentVersion\\Installer\\UserData\\S-1-5-18\\Products\\");
5333 lstrcatA(keypath, prod_squashed);
5334
5335 res = RegCreateKeyA(HKEY_LOCAL_MACHINE, keypath, &localkey);
5336 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
5337
5338 /* local system product key exists */
5339 sz = MAX_PATH;
5340 lstrcpyA(buf, "apple");
5341 r = pMsiGetProductInfoExA(prodcode, NULL,
5342 MSIINSTALLCONTEXT_MACHINE,
5343 INSTALLPROPERTY_PRODUCTSTATE, buf, &sz);
5344 ok(r == ERROR_UNKNOWN_PRODUCT,
5345 "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r);
5346 ok(!lstrcmpA(buf, "apple"), "Expected buf to be unchanged, got %s\n", buf);
5347 ok(sz == MAX_PATH, "Expected MAX_PATH, got %d\n", sz);
5348
5349 res = RegCreateKeyA(localkey, "InstallProperties", &propkey);
5350 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
5351
5352 /* InstallProperties key exists */
5353 sz = MAX_PATH;
5354 lstrcpyA(buf, "apple");
5355 r = pMsiGetProductInfoExA(prodcode, NULL,
5356 MSIINSTALLCONTEXT_MACHINE,
5357 INSTALLPROPERTY_PRODUCTSTATE, buf, &sz);
5358 ok(r == ERROR_UNKNOWN_PRODUCT,
5359 "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r);
5360 ok(!lstrcmpA(buf, "apple"), "Expected buf to be unchanged, got %s\n", buf);
5361 ok(sz == MAX_PATH, "Expected MAX_PATH, got %d\n", sz);
5362
5363 res = RegSetValueExA(propkey, "LocalPackage", 0, REG_SZ, (LPBYTE)"local", 6);
5364 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
5365
5366 /* LocalPackage value exists */
5367 sz = MAX_PATH;
5368 lstrcpyA(buf, "apple");
5369 r = pMsiGetProductInfoExA(prodcode, NULL,
5370 MSIINSTALLCONTEXT_MACHINE,
5371 INSTALLPROPERTY_PRODUCTSTATE, buf, &sz);
5372 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
5373 ok(!lstrcmpA(buf, "5"), "Expected \"5\", got \"%s\"\n", buf);
5374 ok(sz == 1, "Expected 1, got %d\n", sz);
5375
5376 res = RegSetValueExA(propkey, "HelpLink", 0, REG_SZ, (LPBYTE)"link", 5);
5377 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
5378
5379 /* HelpLink value exists */
5380 sz = MAX_PATH;
5381 lstrcpyA(buf, "apple");
5382 r = pMsiGetProductInfoExA(prodcode, NULL,
5383 MSIINSTALLCONTEXT_MACHINE,
5384 INSTALLPROPERTY_HELPLINK, buf, &sz);
5385 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
5386 ok(!lstrcmpA(buf, "link"), "Expected \"link\", got \"%s\"\n", buf);
5387 ok(sz == 4, "Expected 4, got %d\n", sz);
5388
5389 res = RegSetValueExA(propkey, "HelpTelephone", 0, REG_SZ, (LPBYTE)"phone", 6);
5390 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
5391
5392 /* HelpTelephone value exists */
5393 sz = MAX_PATH;
5394 lstrcpyA(buf, "apple");
5395 r = pMsiGetProductInfoExA(prodcode, NULL,
5396 MSIINSTALLCONTEXT_MACHINE,
5397 INSTALLPROPERTY_HELPTELEPHONE, buf, &sz);
5398 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
5399 ok(!lstrcmpA(buf, "phone"), "Expected \"phone\", got \"%s\"\n", buf);
5400 ok(sz == 5, "Expected 5, got %d\n", sz);
5401
5402 res = RegSetValueExA(propkey, "InstallDate", 0, REG_SZ, (LPBYTE)"date", 5);
5403 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
5404
5405 /* InstallDate value exists */
5406 sz = MAX_PATH;
5407 lstrcpyA(buf, "apple");
5408 r = pMsiGetProductInfoExA(prodcode, NULL,
5409 MSIINSTALLCONTEXT_MACHINE,
5410 INSTALLPROPERTY_INSTALLDATE, buf, &sz);
5411 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
5412 ok(!lstrcmpA(buf, "date"), "Expected \"date\", got \"%s\"\n", buf);
5413 ok(sz == 4, "Expected 4, got %d\n", sz);
5414
5415 res = RegSetValueExA(propkey, "DisplayName", 0, REG_SZ, (LPBYTE)"name", 5);
5416 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
5417
5418 /* DisplayName value exists */
5419 sz = MAX_PATH;
5420 lstrcpyA(buf, "apple");
5421 r = pMsiGetProductInfoExA(prodcode, NULL,
5422 MSIINSTALLCONTEXT_MACHINE,
5423 INSTALLPROPERTY_INSTALLEDPRODUCTNAME, buf, &sz);
5424 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
5425 ok(!lstrcmpA(buf, "name"), "Expected \"name\", got \"%s\"\n", buf);
5426 ok(sz == 4, "Expected 4, got %d\n", sz);
5427
5428 res = RegSetValueExA(propkey, "InstallLocation", 0, REG_SZ, (LPBYTE)"loc", 4);
5429 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
5430
5431 /* InstallLocation value exists */
5432 sz = MAX_PATH;
5433 lstrcpyA(buf, "apple");
5434 r = pMsiGetProductInfoExA(prodcode, NULL,
5435 MSIINSTALLCONTEXT_MACHINE,
5436 INSTALLPROPERTY_INSTALLLOCATION, buf, &sz);
5437 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
5438 ok(!lstrcmpA(buf, "loc"), "Expected \"loc\", got \"%s\"\n", buf);
5439 ok(sz == 3, "Expected 3, got %d\n", sz);
5440
5441 res = RegSetValueExA(propkey, "InstallSource", 0, REG_SZ, (LPBYTE)"source", 7);
5442 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
5443
5444 /* InstallSource value exists */
5445 sz = MAX_PATH;
5446 lstrcpyA(buf, "apple");
5447 r = pMsiGetProductInfoExA(prodcode, NULL,
5448 MSIINSTALLCONTEXT_MACHINE,
5449 INSTALLPROPERTY_INSTALLSOURCE, buf, &sz);
5450 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
5451 ok(!lstrcmpA(buf, "source"), "Expected \"source\", got \"%s\"\n", buf);
5452 ok(sz == 6, "Expected 6, got %d\n", sz);
5453
5454 res = RegSetValueExA(propkey, "LocalPackage", 0, REG_SZ, (LPBYTE)"local", 6);
5455 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
5456
5457 /* LocalPackage value exists */
5458 sz = MAX_PATH;
5459 lstrcpyA(buf, "apple");
5460 r = pMsiGetProductInfoExA(prodcode, NULL,
5461 MSIINSTALLCONTEXT_MACHINE,
5462 INSTALLPROPERTY_LOCALPACKAGE, buf, &sz);
5463 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
5464 ok(!lstrcmpA(buf, "local"), "Expected \"local\", got \"%s\"\n", buf);
5465 ok(sz == 5, "Expected 5, got %d\n", sz);
5466
5467 res = RegSetValueExA(propkey, "Publisher", 0, REG_SZ, (LPBYTE)"pub", 4);
5468 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
5469
5470 /* Publisher value exists */
5471 sz = MAX_PATH;
5472 lstrcpyA(buf, "apple");
5473 r = pMsiGetProductInfoExA(prodcode, NULL,
5474 MSIINSTALLCONTEXT_MACHINE,
5475 INSTALLPROPERTY_PUBLISHER, buf, &sz);
5476 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
5477 ok(!lstrcmpA(buf, "pub"), "Expected \"pub\", got \"%s\"\n", buf);
5478 ok(sz == 3, "Expected 3, got %d\n", sz);
5479
5480 res = RegSetValueExA(propkey, "URLInfoAbout", 0, REG_SZ, (LPBYTE)"about", 6);
5481 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
5482
5483 /* URLInfoAbout value exists */
5484 sz = MAX_PATH;
5485 lstrcpyA(buf, "apple");
5486 r = pMsiGetProductInfoExA(prodcode, NULL,
5487 MSIINSTALLCONTEXT_MACHINE,
5488 INSTALLPROPERTY_URLINFOABOUT, buf, &sz);
5489 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
5490 ok(!lstrcmpA(buf, "about"), "Expected \"about\", got \"%s\"\n", buf);
5491 ok(sz == 5, "Expected 5, got %d\n", sz);
5492
5493 res = RegSetValueExA(propkey, "URLUpdateInfo", 0, REG_SZ, (LPBYTE)"update", 7);
5494 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
5495
5496 /* URLUpdateInfo value exists */
5497 sz = MAX_PATH;
5498 lstrcpyA(buf, "apple");
5499 r = pMsiGetProductInfoExA(prodcode, NULL,
5500 MSIINSTALLCONTEXT_MACHINE,
5501 INSTALLPROPERTY_URLUPDATEINFO, buf, &sz);
5502 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
5503 ok(!lstrcmpA(buf, "update"), "Expected \"update\", got \"%s\"\n", buf);
5504 ok(sz == 6, "Expected 6, got %d\n", sz);
5505
5506 res = RegSetValueExA(propkey, "VersionMinor", 0, REG_SZ, (LPBYTE)"2", 2);
5507 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
5508
5509 /* VersionMinor value exists */
5510 sz = MAX_PATH;
5511 lstrcpyA(buf, "apple");
5512 r = pMsiGetProductInfoExA(prodcode, NULL,
5513 MSIINSTALLCONTEXT_MACHINE,
5514 INSTALLPROPERTY_VERSIONMINOR, buf, &sz);
5515 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
5516 ok(!lstrcmpA(buf, "2"), "Expected \"2\", got \"%s\"\n", buf);
5517 ok(sz == 1, "Expected 1, got %d\n", sz);
5518
5519 res = RegSetValueExA(propkey, "VersionMajor", 0, REG_SZ, (LPBYTE)"3", 2);
5520 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
5521
5522 /* VersionMajor value exists */
5523 sz = MAX_PATH;
5524 lstrcpyA(buf, "apple");
5525 r = pMsiGetProductInfoExA(prodcode, NULL,
5526 MSIINSTALLCONTEXT_MACHINE,
5527 INSTALLPROPERTY_VERSIONMAJOR, buf, &sz);
5528 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
5529 ok(!lstrcmpA(buf, "3"), "Expected \"3\", got \"%s\"\n", buf);
5530 ok(sz == 1, "Expected 1, got %d\n", sz);
5531
5532 res = RegSetValueExA(propkey, "DisplayVersion", 0, REG_SZ, (LPBYTE)"3.2.1", 6);
5533 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
5534
5535 /* DisplayVersion value exists */
5536 sz = MAX_PATH;
5537 lstrcpyA(buf, "apple");
5538 r = pMsiGetProductInfoExA(prodcode, NULL,
5539 MSIINSTALLCONTEXT_MACHINE,
5540 INSTALLPROPERTY_VERSIONSTRING, buf, &sz);
5541 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
5542 ok(!lstrcmpA(buf, "3.2.1"), "Expected \"3.2.1\", got \"%s\"\n", buf);
5543 ok(sz == 5, "Expected 5, got %d\n", sz);
5544
5545 res = RegSetValueExA(propkey, "ProductID", 0, REG_SZ, (LPBYTE)"id", 3);
5546 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
5547
5548 /* ProductID value exists */
5549 sz = MAX_PATH;
5550 lstrcpyA(buf, "apple");
5551 r = pMsiGetProductInfoExA(prodcode, NULL,
5552 MSIINSTALLCONTEXT_MACHINE,
5553 INSTALLPROPERTY_PRODUCTID, buf, &sz);
5554 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
5555 ok(!lstrcmpA(buf, "id"), "Expected \"id\", got \"%s\"\n", buf);
5556 ok(sz == 2, "Expected 2, got %d\n", sz);
5557
5558 res = RegSetValueExA(propkey, "RegCompany", 0, REG_SZ, (LPBYTE)"comp", 5);
5559 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
5560
5561 /* RegCompany value exists */
5562 sz = MAX_PATH;
5563 lstrcpyA(buf, "apple");
5564 r = pMsiGetProductInfoExA(prodcode, NULL,
5565 MSIINSTALLCONTEXT_MACHINE,
5566 INSTALLPROPERTY_REGCOMPANY, buf, &sz);
5567 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
5568 ok(!lstrcmpA(buf, "comp"), "Expected \"comp\", got \"%s\"\n", buf);
5569 ok(sz == 4, "Expected 4, got %d\n", sz);
5570
5571 res = RegSetValueExA(propkey, "RegOwner", 0, REG_SZ, (LPBYTE)"owner", 6);
5572 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
5573
5574 /* RegOwner value exists */
5575 sz = MAX_PATH;
5576 lstrcpyA(buf, "apple");
5577 r = pMsiGetProductInfoExA(prodcode, NULL,
5578 MSIINSTALLCONTEXT_MACHINE,
5579 INSTALLPROPERTY_REGOWNER, buf, &sz);
5580 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
5581 ok(!lstrcmpA(buf, "owner"), "Expected \"owner\", got \"%s\"\n", buf);
5582 ok(sz == 5, "Expected 5, got %d\n", sz);
5583
5584 res = RegSetValueExA(propkey, "Transforms", 0, REG_SZ, (LPBYTE)"trans", 6);
5585 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
5586
5587 /* Transforms value exists */
5588 sz = MAX_PATH;
5589 lstrcpyA(buf, "apple");
5590 r = pMsiGetProductInfoExA(prodcode, NULL,
5591 MSIINSTALLCONTEXT_MACHINE,
5592 INSTALLPROPERTY_TRANSFORMS, buf, &sz);
5593 ok(r == ERROR_UNKNOWN_PRODUCT,
5594 "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r);
5595 ok(!lstrcmpA(buf, "apple"), "Expected buf to be unchanged, got %s\n", buf);
5596 ok(sz == MAX_PATH, "Expected MAX_PATH, got %d\n", sz);
5597
5598 res = RegSetValueExA(propkey, "Language", 0, REG_SZ, (LPBYTE)"lang", 5);
5599 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
5600
5601 /* Language value exists */
5602 sz = MAX_PATH;
5603 lstrcpyA(buf, "apple");
5604 r = pMsiGetProductInfoExA(prodcode, NULL,
5605 MSIINSTALLCONTEXT_MACHINE,
5606 INSTALLPROPERTY_LANGUAGE, buf, &sz);
5607 ok(r == ERROR_UNKNOWN_PRODUCT,
5608 "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r);
5609 ok(!lstrcmpA(buf, "apple"), "Expected buf to be unchanged, got %s\n", buf);
5610 ok(sz == MAX_PATH, "Expected MAX_PATH, got %d\n", sz);
5611
5612 res = RegSetValueExA(propkey, "ProductName", 0, REG_SZ, (LPBYTE)"name", 5);
5613 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
5614
5615 /* ProductName value exists */
5616 sz = MAX_PATH;
5617 lstrcpyA(buf, "apple");
5618 r = pMsiGetProductInfoExA(prodcode, NULL,
5619 MSIINSTALLCONTEXT_MACHINE,
5620 INSTALLPROPERTY_PRODUCTNAME, buf, &sz);
5621 ok(r == ERROR_UNKNOWN_PRODUCT,
5622 "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r);
5623 ok(!lstrcmpA(buf, "apple"), "Expected buf to be unchanged, got %s\n", buf);
5624 ok(sz == MAX_PATH, "Expected MAX_PATH, got %d\n", sz);
5625
5626 res = RegSetValueExA(propkey, "AssignmentType", 0, REG_SZ, (LPBYTE)"type", 5);
5627 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
5628
5629 /* FIXME */
5630
5631 /* AssignmentType value exists */
5632 sz = MAX_PATH;
5633 lstrcpyA(buf, "apple");
5634 r = pMsiGetProductInfoExA(prodcode, NULL,
5635 MSIINSTALLCONTEXT_MACHINE,
5636 INSTALLPROPERTY_ASSIGNMENTTYPE, buf, &sz);
5637 ok(r == ERROR_UNKNOWN_PRODUCT,
5638 "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r);
5639 ok(!lstrcmpA(buf, "apple"), "Expected buf to be unchanged, got %s\n", buf);
5640 ok(sz == MAX_PATH, "Expected MAX_PATH, got %d\n", sz);
5641
5642 res = RegSetValueExA(propkey, "PackageCode", 0, REG_SZ, (LPBYTE)"code", 5);
5643 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
5644
5645 /* PackageCode value exists */
5646 sz = MAX_PATH;
5647 lstrcpyA(buf, "apple");
5648 r = pMsiGetProductInfoExA(prodcode, NULL,
5649 MSIINSTALLCONTEXT_MACHINE,
5650 INSTALLPROPERTY_PACKAGECODE, buf, &sz);
5651 ok(r == ERROR_UNKNOWN_PRODUCT,
5652 "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r);
5653 ok(!lstrcmpA(buf, "apple"), "Expected buf to be unchanged, got %s\n", buf);
5654 ok(sz == MAX_PATH, "Expected MAX_PATH, got %d\n", sz);
5655
5656 res = RegSetValueExA(propkey, "Version", 0, REG_SZ, (LPBYTE)"ver", 4);
5657 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
5658
5659 /* Version value exists */
5660 sz = MAX_PATH;
5661 lstrcpyA(buf, "apple");
5662 r = pMsiGetProductInfoExA(prodcode, NULL,
5663 MSIINSTALLCONTEXT_MACHINE,
5664 INSTALLPROPERTY_VERSION, buf, &sz);
5665 ok(r == ERROR_UNKNOWN_PRODUCT,
5666 "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r);
5667 ok(!lstrcmpA(buf, "apple"), "Expected buf to be unchanged, got %s\n", buf);
5668 ok(sz == MAX_PATH, "Expected MAX_PATH, got %d\n", sz);
5669
5670 res = RegSetValueExA(propkey, "ProductIcon", 0, REG_SZ, (LPBYTE)"icon", 5);
5671 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
5672
5673 /* ProductIcon value exists */
5674 sz = MAX_PATH;
5675 lstrcpyA(buf, "apple");
5676 r = pMsiGetProductInfoExA(prodcode, NULL,
5677 MSIINSTALLCONTEXT_MACHINE,
5678 INSTALLPROPERTY_PRODUCTICON, buf, &sz);
5679 ok(r == ERROR_UNKNOWN_PRODUCT,
5680 "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r);
5681 ok(!lstrcmpA(buf, "apple"), "Expected buf to be unchanged, got %s\n", buf);
5682 ok(sz == MAX_PATH, "Expected MAX_PATH, got %d\n", sz);
5683
5684 res = RegSetValueExA(propkey, "PackageName", 0, REG_SZ, (LPBYTE)"name", 5);
5685 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
5686
5687 /* PackageName value exists */
5688 sz = MAX_PATH;
5689 lstrcpyA(buf, "apple");
5690 r = pMsiGetProductInfoExA(prodcode, NULL,
5691 MSIINSTALLCONTEXT_MACHINE,
5692 INSTALLPROPERTY_PACKAGENAME, buf, &sz);
5693 ok(r == ERROR_UNKNOWN_PRODUCT,
5694 "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r);
5695 ok(!lstrcmpA(buf, "apple"), "Expected buf to be unchanged, got %s\n", buf);
5696 ok(sz == MAX_PATH, "Expected MAX_PATH, got %d\n", sz);
5697
5698 res = RegSetValueExA(propkey, "AuthorizedLUAApp", 0, REG_SZ, (LPBYTE)"auth", 5);
5699 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
5700
5701 /* AuthorizedLUAApp value exists */
5702 sz = MAX_PATH;
5703 lstrcpyA(buf, "apple");
5704 r = pMsiGetProductInfoExA(prodcode, NULL,
5705 MSIINSTALLCONTEXT_MACHINE,
5706 INSTALLPROPERTY_AUTHORIZED_LUA_APP, buf, &sz);
5707 ok(r == ERROR_UNKNOWN_PRODUCT,
5708 "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r);
5709 ok(!lstrcmpA(buf, "apple"), "Expected buf to be unchanged, got %s\n", buf);
5710 ok(sz == MAX_PATH, "Expected MAX_PATH, got %d\n", sz);
5711
5712 RegDeleteValueA(propkey, "AuthorizedLUAApp");
5713 RegDeleteValueA(propkey, "PackageName");
5714 RegDeleteValueA(propkey, "ProductIcon");
5715 RegDeleteValueA(propkey, "Version");
5716 RegDeleteValueA(propkey, "PackageCode");
5717 RegDeleteValueA(propkey, "AssignmentType");
5718 RegDeleteValueA(propkey, "ProductName");
5719 RegDeleteValueA(propkey, "Language");
5720 RegDeleteValueA(propkey, "Transforms");
5721 RegDeleteValueA(propkey, "RegOwner");
5722 RegDeleteValueA(propkey, "RegCompany");
5723 RegDeleteValueA(propkey, "ProductID");
5724 RegDeleteValueA(propkey, "DisplayVersion");
5725 RegDeleteValueA(propkey, "VersionMajor");
5726 RegDeleteValueA(propkey, "VersionMinor");
5727 RegDeleteValueA(propkey, "URLUpdateInfo");
5728 RegDeleteValueA(propkey, "URLInfoAbout");
5729 RegDeleteValueA(propkey, "Publisher");
5730 RegDeleteValueA(propkey, "LocalPackage");
5731 RegDeleteValueA(propkey, "InstallSource");
5732 RegDeleteValueA(propkey, "InstallLocation");
5733 RegDeleteValueA(propkey, "DisplayName");
5734 RegDeleteValueA(propkey, "InstallDate");
5735 RegDeleteValueA(propkey, "HelpTelephone");
5736 RegDeleteValueA(propkey, "HelpLink");
5737 RegDeleteValueA(propkey, "LocalPackage");
5738 RegDeleteKeyA(propkey, "");
5739 RegCloseKey(propkey);
5740 RegDeleteKeyA(localkey, "");
5741 RegCloseKey(localkey);
5742
5743 lstrcpyA(keypath, "Software\\Classes\\Installer\\Products\\");
5744 lstrcatA(keypath, prod_squashed);
5745
5746 res = RegCreateKeyA(HKEY_LOCAL_MACHINE, keypath, &prodkey);
5747 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
5748
5749 /* local classes product key exists */
5750 sz = MAX_PATH;
5751 lstrcpyA(buf, "apple");
5752 r = pMsiGetProductInfoExA(prodcode, NULL,
5753 MSIINSTALLCONTEXT_MACHINE,
5754 INSTALLPROPERTY_PRODUCTSTATE, buf, &sz);
5755 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
5756 ok(!lstrcmpA(buf, "1"), "Expected \"1\", got \"%s\"\n", buf);
5757 ok(sz == 1, "Expected 1, got %d\n", sz);
5758
5759 res = RegSetValueExA(prodkey, "HelpLink", 0, REG_SZ, (LPBYTE)"link", 5);
5760 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
5761
5762 /* HelpLink value exists */
5763 sz = MAX_PATH;
5764 lstrcpyA(buf, "apple");
5765 r = pMsiGetProductInfoExA(prodcode, NULL,
5766 MSIINSTALLCONTEXT_MACHINE,
5767 INSTALLPROPERTY_HELPLINK, 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);
5772
5773 res = RegSetValueExA(prodkey, "HelpTelephone", 0, REG_SZ, (LPBYTE)"phone", 6);
5774 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
5775
5776 /* HelpTelephone value exists */
5777 sz = MAX_PATH;
5778 lstrcpyA(buf, "apple");
5779 r = pMsiGetProductInfoExA(prodcode, NULL,
5780 MSIINSTALLCONTEXT_MACHINE,
5781 INSTALLPROPERTY_HELPTELEPHONE, 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);
5786
5787 res = RegSetValueExA(prodkey, "InstallDate", 0, REG_SZ, (LPBYTE)"date", 5);
5788 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
5789
5790 /* InstallDate value exists */
5791 sz = MAX_PATH;
5792 lstrcpyA(buf, "apple");
5793 r = pMsiGetProductInfoExA(prodcode, NULL,
5794 MSIINSTALLCONTEXT_MACHINE,
5795 INSTALLPROPERTY_INSTALLDATE, 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);
5800
5801 res = RegSetValueExA(prodkey, "DisplayName", 0, REG_SZ, (LPBYTE)"name", 5);
5802 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
5803
5804 /* DisplayName value exists */
5805 sz = MAX_PATH;
5806 lstrcpyA(buf, "apple");
5807 r = pMsiGetProductInfoExA(prodcode, NULL,
5808 MSIINSTALLCONTEXT_MACHINE,
5809 INSTALLPROPERTY_INSTALLEDPRODUCTNAME, 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);
5814
5815 res = RegSetValueExA(prodkey, "InstallLocation", 0, REG_SZ, (LPBYTE)"loc", 4);
5816 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
5817
5818 /* InstallLocation value exists */
5819 sz = MAX_PATH;
5820 lstrcpyA(buf, "apple");
5821 r = pMsiGetProductInfoExA(prodcode, NULL,
5822 MSIINSTALLCONTEXT_MACHINE,
5823 INSTALLPROPERTY_INSTALLLOCATION, 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);
5828
5829 res = RegSetValueExA(prodkey, "InstallSource", 0, REG_SZ, (LPBYTE)"source", 7);
5830 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
5831
5832 /* InstallSource value exists */
5833 sz = MAX_PATH;
5834 lstrcpyA(buf, "apple");
5835 r = pMsiGetProductInfoExA(prodcode, NULL,
5836 MSIINSTALLCONTEXT_MACHINE,
5837 INSTALLPROPERTY_INSTALLSOURCE, 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);
5842
5843 res = RegSetValueExA(prodkey, "LocalPackage", 0, REG_SZ, (LPBYTE)"local", 6);
5844 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
5845
5846 /* LocalPackage value exists */
5847 sz = MAX_PATH;
5848 lstrcpyA(buf, "apple");
5849 r = pMsiGetProductInfoExA(prodcode, NULL,
5850 MSIINSTALLCONTEXT_MACHINE,
5851 INSTALLPROPERTY_LOCALPACKAGE, 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);
5856
5857 res = RegSetValueExA(prodkey, "Publisher", 0, REG_SZ, (LPBYTE)"pub", 4);
5858 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
5859
5860 /* Publisher value exists */
5861 sz = MAX_PATH;
5862 lstrcpyA(buf, "apple");
5863 r = pMsiGetProductInfoExA(prodcode, NULL,
5864 MSIINSTALLCONTEXT_MACHINE,
5865 INSTALLPROPERTY_PUBLISHER, 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);
5870
5871 res = RegSetValueExA(prodkey, "URLInfoAbout", 0, REG_SZ, (LPBYTE)"about", 6);
5872 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
5873
5874 /* URLInfoAbout value exists */
5875 sz = MAX_PATH;
5876 lstrcpyA(buf, "apple");
5877 r = pMsiGetProductInfoExA(prodcode, NULL,
5878 MSIINSTALLCONTEXT_MACHINE,
5879 INSTALLPROPERTY_URLINFOABOUT, 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);
5884
5885 res = RegSetValueExA(prodkey, "URLUpdateInfo", 0, REG_SZ, (LPBYTE)"update", 7);
5886 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
5887
5888 /* URLUpdateInfo value exists */
5889 sz = MAX_PATH;
5890 lstrcpyA(buf, "apple");
5891 r = pMsiGetProductInfoExA(prodcode, NULL,
5892 MSIINSTALLCONTEXT_MACHINE,
5893 INSTALLPROPERTY_URLUPDATEINFO, buf, &sz);
5894 ok(r == ERROR_UNKNOWN_PROPERTY,
5895 "Expected ERROR_UNKNOWN_PROPERTY, got %d\n", r);
5896 ok(!lstrcmpA(buf, "apple"), "Expected buf to be unchanged, got %s\n", buf);
5897 ok(sz == MAX_PATH, "Expected MAX_PATH, got %d\n", sz);
5898
5899 res = RegSetValueExA(prodkey, "VersionMinor", 0, REG_SZ, (LPBYTE)"2", 2);
5900 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
5901
5902 /* VersionMinor value exists */
5903 sz = MAX_PATH;
5904 lstrcpyA(buf, "apple");
5905 r = pMsiGetProductInfoExA(prodcode, NULL,
5906 MSIINSTALLCONTEXT_MACHINE,
5907 INSTALLPROPERTY_VERSIONMINOR, buf, &sz);
5908 ok(r == ERROR_UNKNOWN_PROPERTY,
5909 "Expected ERROR_UNKNOWN_PROPERTY, got %d\n", r);
5910 ok(!lstrcmpA(buf, "apple"), "Expected buf to be unchanged, got %s\n", buf);
5911 ok(sz == MAX_PATH, "Expected MAX_PATH, got %d\n", sz);
5912
5913 res = RegSetValueExA(prodkey, "VersionMajor", 0, REG_SZ, (LPBYTE)"3", 2);
5914 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
5915
5916 /* VersionMajor value exists */
5917 sz = MAX_PATH;
5918 lstrcpyA(buf, "apple");
5919 r = pMsiGetProductInfoExA(prodcode, NULL,
5920 MSIINSTALLCONTEXT_MACHINE,
5921 INSTALLPROPERTY_VERSIONMAJOR, buf, &sz);
5922 ok(r == ERROR_UNKNOWN_PROPERTY,
5923 "Expected ERROR_UNKNOWN_PROPERTY, got %d\n", r);
5924 ok(!lstrcmpA(buf, "apple"), "Expected buf to be unchanged, got %s\n", buf);
5925 ok(sz == MAX_PATH, "Expected MAX_PATH, got %d\n", sz);
5926
5927 res = RegSetValueExA(prodkey, "DisplayVersion", 0, REG_SZ, (LPBYTE)"3.2.1", 6);
5928 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
5929
5930 /* DisplayVersion value exists */
5931 sz = MAX_PATH;
5932 lstrcpyA(buf, "apple");
5933 r = pMsiGetProductInfoExA(prodcode, NULL,
5934 MSIINSTALLCONTEXT_MACHINE,
5935 INSTALLPROPERTY_VERSIONSTRING, buf, &sz);
5936 ok(r == ERROR_UNKNOWN_PROPERTY,
5937 "Expected ERROR_UNKNOWN_PROPERTY, got %d\n", r);
5938 ok(!lstrcmpA(buf, "apple"), "Expected buf to be unchanged, got %s\n", buf);
5939 ok(sz == MAX_PATH, "Expected MAX_PATH, got %d\n", sz);
5940
5941 res = RegSetValueExA(prodkey, "ProductID", 0, REG_SZ, (LPBYTE)"id", 3);
5942 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
5943
5944 /* ProductID value exists */
5945 sz = MAX_PATH;
5946 lstrcpyA(buf, "apple");
5947 r = pMsiGetProductInfoExA(prodcode, NULL,
5948 MSIINSTALLCONTEXT_MACHINE,
5949 INSTALLPROPERTY_PRODUCTID, buf, &sz);
5950 ok(r == ERROR_UNKNOWN_PROPERTY,
5951 "Expected ERROR_UNKNOWN_PROPERTY, got %d\n", r);
5952 ok(!lstrcmpA(buf, "apple"), "Expected buf to be unchanged, got %s\n", buf);
5953 ok(sz == MAX_PATH, "Expected MAX_PATH, got %d\n", sz);
5954
5955 res = RegSetValueExA(prodkey, "RegCompany", 0, REG_SZ, (LPBYTE)"comp", 5);
5956 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
5957
5958 /* RegCompany value exists */
5959 sz = MAX_PATH;
5960 lstrcpyA(buf, "apple");
5961 r = pMsiGetProductInfoExA(prodcode, NULL,
5962 MSIINSTALLCONTEXT_MACHINE,
5963 INSTALLPROPERTY_REGCOMPANY, buf, &sz);
5964 ok(r == ERROR_UNKNOWN_PROPERTY,
5965 "Expected ERROR_UNKNOWN_PROPERTY, got %d\n", r);
5966 ok(!lstrcmpA(buf, "apple"), "Expected buf to be unchanged, got %s\n", buf);
5967 ok(sz == MAX_PATH, "Expected MAX_PATH, got %d\n", sz);
5968
5969 res = RegSetValueExA(prodkey, "RegOwner", 0, REG_SZ, (LPBYTE)"owner", 6);
5970 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
5971
5972 /* RegOwner value exists */
5973 sz = MAX_PATH;
5974 lstrcpyA(buf, "apple");
5975 r = pMsiGetProductInfoExA(prodcode, NULL,
5976 MSIINSTALLCONTEXT_MACHINE,
5977 INSTALLPROPERTY_REGOWNER, buf, &sz);
5978 ok(r == ERROR_UNKNOWN_PROPERTY,
5979 "Expected ERROR_UNKNOWN_PROPERTY, got %d\n", r);
5980 ok(!lstrcmpA(buf, "apple"), "Expected buf to be unchanged, got %s\n", buf);
5981 ok(sz == MAX_PATH, "Expected MAX_PATH, got %d\n", sz);
5982
5983 res = RegSetValueExA(prodkey, "Transforms", 0, REG_SZ, (LPBYTE)"trans", 6);
5984 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
5985
5986 /* Transforms value exists */
5987 sz = MAX_PATH;
5988 lstrcpyA(buf, "apple");
5989 r = pMsiGetProductInfoExA(prodcode, NULL,
5990 MSIINSTALLCONTEXT_MACHINE,
5991 INSTALLPROPERTY_TRANSFORMS, buf, &sz);
5992 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
5993 ok(!lstrcmpA(buf, "trans"), "Expected \"trans\", got \"%s\"\n", buf);
5994 ok(sz == 5, "Expected 5, got %d\n", sz);
5995
5996 res = RegSetValueExA(prodkey, "Language", 0, REG_SZ, (LPBYTE)"lang", 5);
5997 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
5998
5999 /* Language value exists */
6000 sz = MAX_PATH;
6001 lstrcpyA(buf, "apple");
6002 r = pMsiGetProductInfoExA(prodcode, NULL,
6003 MSIINSTALLCONTEXT_MACHINE,
6004 INSTALLPROPERTY_LANGUAGE, buf, &sz);
6005 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
6006 ok(!lstrcmpA(buf, "lang"), "Expected \"lang\", got \"%s\"\n", buf);
6007 ok(sz == 4, "Expected 4, got %d\n", sz);
6008
6009 res = RegSetValueExA(prodkey, "ProductName", 0, REG_SZ, (LPBYTE)"name", 5);
6010 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
6011
6012 /* ProductName value exists */
6013 sz = MAX_PATH;
6014 lstrcpyA(buf, "apple");
6015 r = pMsiGetProductInfoExA(prodcode, NULL,
6016 MSIINSTALLCONTEXT_MACHINE,
6017 INSTALLPROPERTY_PRODUCTNAME, buf, &sz);
6018 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
6019 ok(!lstrcmpA(buf, "name"), "Expected \"name\", got \"%s\"\n", buf);
6020 ok(sz == 4, "Expected 4, got %d\n", sz);
6021
6022 res = RegSetValueExA(prodkey, "AssignmentType", 0, REG_SZ, (LPBYTE)"type", 5);
6023 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
6024
6025 /* FIXME */
6026
6027 /* AssignmentType value exists */
6028 sz = MAX_PATH;
6029 lstrcpyA(buf, "apple");
6030 r = pMsiGetProductInfoExA(prodcode, NULL,
6031 MSIINSTALLCONTEXT_MACHINE,
6032 INSTALLPROPERTY_ASSIGNMENTTYPE, buf, &sz);
6033 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
6034 ok(!lstrcmpA(buf, ""), "Expected \"\", got \"%s\"\n", buf);
6035 ok(sz == 0, "Expected 0, got %d\n", sz);
6036
6037 res = RegSetValueExA(prodkey, "PackageCode", 0, REG_SZ, (LPBYTE)"code", 5);
6038 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
6039
6040 /* FIXME */
6041
6042 /* PackageCode value exists */
6043 sz = MAX_PATH;
6044 lstrcpyA(buf, "apple");
6045 r = pMsiGetProductInfoExA(prodcode, NULL,
6046 MSIINSTALLCONTEXT_MACHINE,
6047 INSTALLPROPERTY_PACKAGECODE, buf, &sz);
6048 todo_wine
6049 {
6050 ok(r == ERROR_BAD_CONFIGURATION,
6051 "Expected ERROR_BAD_CONFIGURATION, got %d\n", r);
6052 ok(!lstrcmpA(buf, "apple"), "Expected buf to be unchanged, got %s\n", buf);
6053 ok(sz == MAX_PATH, "Expected MAX_PATH, got %d\n", sz);
6054 }
6055
6056 res = RegSetValueExA(prodkey, "Version", 0, REG_SZ, (LPBYTE)"ver", 4);
6057 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
6058
6059 /* Version value exists */
6060 sz = MAX_PATH;
6061 lstrcpyA(buf, "apple");
6062 r = pMsiGetProductInfoExA(prodcode, NULL,
6063 MSIINSTALLCONTEXT_MACHINE,
6064 INSTALLPROPERTY_VERSION, buf, &sz);
6065 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
6066 ok(!lstrcmpA(buf, "ver"), "Expected \"ver\", got \"%s\"\n", buf);
6067 ok(sz == 3, "Expected 3, got %d\n", sz);
6068
6069 res = RegSetValueExA(prodkey, "ProductIcon", 0, REG_SZ, (LPBYTE)"icon", 5);
6070 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
6071
6072 /* ProductIcon value exists */
6073 sz = MAX_PATH;
6074 lstrcpyA(buf, "apple");
6075 r = pMsiGetProductInfoExA(prodcode, NULL,
6076 MSIINSTALLCONTEXT_MACHINE,
6077 INSTALLPROPERTY_PRODUCTICON, buf, &sz);
6078 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
6079 ok(!lstrcmpA(buf, "icon"), "Expected \"icon\", got \"%s\"\n", buf);
6080 ok(sz == 4, "Expected 4, got %d\n", sz);
6081
6082 res = RegSetValueExA(prodkey, "PackageName", 0, REG_SZ, (LPBYTE)"name", 5);
6083 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
6084
6085 /* PackageName value exists */
6086 sz = MAX_PATH;
6087 lstrcpyA(buf, "apple");
6088 r = pMsiGetProductInfoExA(prodcode, NULL,
6089 MSIINSTALLCONTEXT_MACHINE,
6090 INSTALLPROPERTY_PACKAGENAME, buf, &sz);
6091 todo_wine
6092 {
6093 ok(r == ERROR_UNKNOWN_PRODUCT,
6094 "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r);
6095 ok(!lstrcmpA(buf, "apple"), "Expected buf to be unchanged, got %s\n", buf);
6096 ok(sz == MAX_PATH, "Expected MAX_PATH, got %d\n", sz);
6097 }
6098
6099 res = RegSetValueExA(prodkey, "AuthorizedLUAApp", 0, REG_SZ, (LPBYTE)"auth", 5);
6100 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
6101
6102 /* AuthorizedLUAApp value exists */
6103 sz = MAX_PATH;
6104 lstrcpyA(buf, "apple");
6105 r = pMsiGetProductInfoExA(prodcode, NULL,
6106 MSIINSTALLCONTEXT_MACHINE,
6107 INSTALLPROPERTY_AUTHORIZED_LUA_APP, buf, &sz);
6108 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
6109 ok(!lstrcmpA(buf, "auth"), "Expected \"auth\", got \"%s\"\n", buf);
6110 ok(sz == 4, "Expected 4, got %d\n", sz);
6111
6112 RegDeleteValueA(prodkey, "AuthorizedLUAApp");
6113 RegDeleteValueA(prodkey, "PackageName");
6114 RegDeleteValueA(prodkey, "ProductIcon");
6115 RegDeleteValueA(prodkey, "Version");
6116 RegDeleteValueA(prodkey, "PackageCode");
6117 RegDeleteValueA(prodkey, "AssignmentType");
6118 RegDeleteValueA(prodkey, "ProductName");
6119 RegDeleteValueA(prodkey, "Language");
6120 RegDeleteValueA(prodkey, "Transforms");
6121 RegDeleteValueA(prodkey, "RegOwner");
6122 RegDeleteValueA(prodkey, "RegCompany");
6123 RegDeleteValueA(prodkey, "ProductID");
6124 RegDeleteValueA(prodkey, "DisplayVersion");
6125 RegDeleteValueA(prodkey, "VersionMajor");
6126 RegDeleteValueA(prodkey, "VersionMinor");
6127 RegDeleteValueA(prodkey, "URLUpdateInfo");
6128 RegDeleteValueA(prodkey, "URLInfoAbout");
6129 RegDeleteValueA(prodkey, "Publisher");
6130 RegDeleteValueA(prodkey, "LocalPackage");
6131 RegDeleteValueA(prodkey, "InstallSource");
6132 RegDeleteValueA(prodkey, "InstallLocation");
6133 RegDeleteValueA(prodkey, "DisplayName");
6134 RegDeleteValueA(prodkey, "InstallDate");
6135 RegDeleteValueA(prodkey, "HelpTelephone");
6136 RegDeleteValueA(prodkey, "HelpLink");
6137 RegDeleteKeyA(prodkey, "");
6138 RegCloseKey(prodkey);
6139 }
6140
6141 START_TEST(msi)
6142 {
6143 init_functionpointers();
6144
6145 test_usefeature();
6146 test_null();
6147 test_getcomponentpath();
6148 test_MsiGetFileHash();
6149
6150 if (!pConvertSidToStringSidA)
6151 skip("ConvertSidToStringSidA not implemented\n");
6152 else
6153 {
6154 /* These tests rely on get_user_sid that needs ConvertSidToStringSidA */
6155 test_MsiQueryProductState();
6156 test_MsiQueryFeatureState();
6157 test_MsiQueryComponentState();
6158 test_MsiGetComponentPath();
6159 test_MsiGetProductCode();
6160 test_MsiEnumClients();
6161 test_MsiGetProductInfo();
6162 test_MsiGetProductInfoEx();
6163 }
6164
6165 test_MsiGetFileVersion();
6166 }