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