2 * tests for Microsoft Installer functionality
4 * Copyright 2005 Mike McCormack for CodeWeavers
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
21 #define _WIN32_MSI 300
29 #include "wine/test.h"
31 static BOOL (WINAPI
*pConvertSidToStringSidA
)(PSID
, LPSTR
*);
33 static INSTALLSTATE (WINAPI
*pMsiGetComponentPathA
)
34 (LPCSTR
, LPCSTR
, LPSTR
, DWORD
*);
35 static UINT (WINAPI
*pMsiGetFileHashA
)
36 (LPCSTR
, DWORD
, PMSIFILEHASHINFO
);
37 static UINT (WINAPI
*pMsiGetProductInfoExA
)
38 (LPCSTR
, LPCSTR
, MSIINSTALLCONTEXT
, LPCSTR
, LPSTR
, LPDWORD
);
39 static UINT (WINAPI
*pMsiOpenPackageExA
)
40 (LPCSTR
, DWORD
, MSIHANDLE
*);
41 static UINT (WINAPI
*pMsiOpenPackageExW
)
42 (LPCWSTR
, DWORD
, MSIHANDLE
*);
43 static UINT (WINAPI
*pMsiQueryComponentStateA
)
44 (LPCSTR
, LPCSTR
, MSIINSTALLCONTEXT
, LPCSTR
, INSTALLSTATE
*);
45 static INSTALLSTATE (WINAPI
*pMsiUseFeatureExA
)
46 (LPCSTR
, LPCSTR
,DWORD
, DWORD
);
48 static void init_functionpointers(void)
50 HMODULE hmsi
= GetModuleHandleA("msi.dll");
51 HMODULE hadvapi32
= GetModuleHandleA("advapi32.dll");
53 #define GET_PROC(dll, func) \
54 p ## func = (void *)GetProcAddress(dll, #func); \
56 trace("GetProcAddress(%s) failed\n", #func);
58 GET_PROC(hmsi
, MsiGetComponentPathA
)
59 GET_PROC(hmsi
, MsiGetFileHashA
)
60 GET_PROC(hmsi
, MsiGetProductInfoExA
)
61 GET_PROC(hmsi
, MsiOpenPackageExA
)
62 GET_PROC(hmsi
, MsiOpenPackageExW
)
63 GET_PROC(hmsi
, MsiQueryComponentStateA
)
64 GET_PROC(hmsi
, MsiUseFeatureExA
)
66 GET_PROC(hadvapi32
, ConvertSidToStringSidA
)
71 static void test_usefeature(void)
75 if (!pMsiUseFeatureExA
)
77 skip("MsiUseFeatureExA not implemented\n");
81 r
= MsiQueryFeatureState(NULL
,NULL
);
82 ok( r
== INSTALLSTATE_INVALIDARG
, "wrong return val\n");
84 r
= MsiQueryFeatureState("{9085040-6000-11d3-8cfe-0150048383c9}" ,NULL
);
85 ok( r
== INSTALLSTATE_INVALIDARG
, "wrong return val\n");
87 r
= pMsiUseFeatureExA(NULL
,NULL
,0,0);
88 ok( r
== INSTALLSTATE_INVALIDARG
, "wrong return val\n");
90 r
= pMsiUseFeatureExA(NULL
, "WORDVIEWFiles", -2, 1 );
91 ok( r
== INSTALLSTATE_INVALIDARG
, "wrong return val\n");
93 r
= pMsiUseFeatureExA("{90850409-6000-11d3-8cfe-0150048383c9}",
95 ok( r
== INSTALLSTATE_INVALIDARG
, "wrong return val\n");
97 r
= pMsiUseFeatureExA("{9085040-6000-11d3-8cfe-0150048383c9}",
98 "WORDVIEWFiles", -2, 0 );
99 ok( r
== INSTALLSTATE_INVALIDARG
, "wrong return val\n");
101 r
= pMsiUseFeatureExA("{0085040-6000-11d3-8cfe-0150048383c9}",
102 "WORDVIEWFiles", -2, 0 );
103 ok( r
== INSTALLSTATE_INVALIDARG
, "wrong return val\n");
105 r
= pMsiUseFeatureExA("{90850409-6000-11d3-8cfe-0150048383c9}",
106 "WORDVIEWFiles", -2, 1 );
107 ok( r
== INSTALLSTATE_INVALIDARG
, "wrong return val\n");
110 static void test_null(void)
115 DWORD dwType
, cbData
;
116 LPBYTE lpData
= NULL
;
119 r
= pMsiOpenPackageExW(NULL
, 0, &hpkg
);
120 ok( r
== ERROR_INVALID_PARAMETER
,"wrong error\n");
122 state
= MsiQueryProductStateW(NULL
);
123 ok( state
== INSTALLSTATE_INVALIDARG
, "wrong return\n");
125 r
= MsiEnumFeaturesW(NULL
,0,NULL
,NULL
);
126 ok( r
== ERROR_INVALID_PARAMETER
,"wrong error\n");
128 r
= MsiConfigureFeatureW(NULL
, NULL
, 0);
129 ok( r
== ERROR_INVALID_PARAMETER
, "wrong error\n");
131 r
= MsiConfigureFeatureA("{00000000-0000-0000-0000-000000000000}", NULL
, 0);
132 ok( r
== ERROR_INVALID_PARAMETER
, "wrong error\n");
134 r
= MsiConfigureFeatureA("{00000000-0000-0000-0000-000000000000}", "foo", 0);
135 ok( r
== ERROR_INVALID_PARAMETER
, "wrong error %d\n", r
);
137 r
= MsiConfigureFeatureA("{00000000-0000-0000-0000-000000000000}", "foo", INSTALLSTATE_DEFAULT
);
138 ok( r
== ERROR_UNKNOWN_PRODUCT
, "wrong error %d\n", r
);
140 /* make sure empty string to MsiGetProductInfo is not a handle to default registry value, saving and restoring the
141 * necessary registry values */
143 /* empty product string */
144 r
= RegOpenKeyA(HKEY_LOCAL_MACHINE
, "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall", &hkey
);
145 ok( r
== ERROR_SUCCESS
, "wrong error %d\n", r
);
147 r
= RegQueryValueExA(hkey
, NULL
, 0, &dwType
, lpData
, &cbData
);
148 ok ( r
== ERROR_SUCCESS
|| r
== ERROR_FILE_NOT_FOUND
, "wrong error %d\n", r
);
149 if ( r
== ERROR_SUCCESS
)
151 lpData
= HeapAlloc(GetProcessHeap(), 0, cbData
);
153 skip("Out of memory\n");
156 r
= RegQueryValueExA(hkey
, NULL
, 0, &dwType
, lpData
, &cbData
);
157 ok ( r
== ERROR_SUCCESS
, "wrong error %d\n", r
);
161 r
= RegSetValueA(hkey
, NULL
, REG_SZ
, "test", strlen("test"));
162 ok( r
== ERROR_SUCCESS
, "wrong error %d\n", r
);
164 r
= MsiGetProductInfoA("", "", NULL
, NULL
);
165 ok ( r
== ERROR_INVALID_PARAMETER
, "wrong error %d\n", r
);
169 r
= RegSetValueExA(hkey
, NULL
, 0, dwType
, lpData
, cbData
);
170 ok ( r
== ERROR_SUCCESS
, "wrong error %d\n", r
);
172 HeapFree(GetProcessHeap(), 0, lpData
);
176 r
= RegDeleteValueA(hkey
, NULL
);
177 ok ( r
== ERROR_SUCCESS
, "wrong error %d\n", r
);
180 r
= RegCloseKey(hkey
);
181 ok( r
== ERROR_SUCCESS
, "wrong error %d\n", r
);
183 /* empty attribute */
184 r
= RegCreateKeyA(HKEY_LOCAL_MACHINE
, "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\{F1C3AF50-8B56-4A69-A00C-00773FE42F30}", &hkey
);
185 ok( r
== ERROR_SUCCESS
, "wrong error %d\n", r
);
187 r
= RegSetValueA(hkey
, NULL
, REG_SZ
, "test", strlen("test"));
188 ok( r
== ERROR_SUCCESS
, "wrong error %d\n", r
);
190 r
= MsiGetProductInfoA("{F1C3AF50-8B56-4A69-A00C-00773FE42F30}", "", NULL
, NULL
);
191 ok ( r
== ERROR_UNKNOWN_PROPERTY
, "wrong error %d\n", r
);
193 r
= RegCloseKey(hkey
);
194 ok( r
== ERROR_SUCCESS
, "wrong error %d\n", r
);
196 r
= RegDeleteKeyA(HKEY_LOCAL_MACHINE
, "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\{F1C3AF50-8B56-4A69-A00C-00773FE42F30}");
197 ok( r
== ERROR_SUCCESS
, "wrong error %d\n", r
);
200 static void test_getcomponentpath(void)
206 if(!pMsiGetComponentPathA
)
209 r
= pMsiGetComponentPathA( NULL
, NULL
, NULL
, NULL
);
210 ok( r
== INSTALLSTATE_INVALIDARG
, "wrong return value\n");
212 r
= pMsiGetComponentPathA( "bogus", "bogus", NULL
, NULL
);
213 ok( r
== INSTALLSTATE_INVALIDARG
, "wrong return value\n");
215 r
= pMsiGetComponentPathA( "bogus", "{00000000-0000-0000-000000000000}", NULL
, NULL
);
216 ok( r
== INSTALLSTATE_INVALIDARG
, "wrong return value\n");
220 r
= pMsiGetComponentPathA( "bogus", "{00000000-0000-0000-000000000000}", buffer
, &sz
);
221 ok( r
== INSTALLSTATE_INVALIDARG
, "wrong return value\n");
223 r
= pMsiGetComponentPathA( "{00000000-78E1-11D2-B60F-006097C998E7}",
224 "{00000000-0000-0000-0000-000000000000}", buffer
, &sz
);
225 ok( r
== INSTALLSTATE_UNKNOWN
, "wrong return value\n");
227 r
= pMsiGetComponentPathA( "{00000409-78E1-11D2-B60F-006097C998E7}",
228 "{00000000-0000-0000-0000-00000000}", buffer
, &sz
);
229 ok( r
== INSTALLSTATE_INVALIDARG
, "wrong return value\n");
231 r
= pMsiGetComponentPathA( "{00000409-78E1-11D2-B60F-006097C998E7}",
232 "{029E403D-A86A-1D11-5B5B0006799C897E}", buffer
, &sz
);
233 ok( r
== INSTALLSTATE_INVALIDARG
, "wrong return value\n");
235 r
= pMsiGetComponentPathA( "{00000000-78E1-11D2-B60F-006097C9987e}",
236 "{00000000-A68A-11d1-5B5B-0006799C897E}", buffer
, &sz
);
237 ok( r
== INSTALLSTATE_UNKNOWN
, "wrong return value\n");
240 static void create_file(LPCSTR name
, LPCSTR data
, DWORD size
)
245 file
= CreateFileA(name
, GENERIC_WRITE
, 0, NULL
, CREATE_ALWAYS
, 0, NULL
);
246 ok(file
!= INVALID_HANDLE_VALUE
, "Failure to open file %s\n", name
);
247 WriteFile(file
, data
, strlen(data
), &written
, NULL
);
251 SetFilePointer(file
, size
, NULL
, FILE_BEGIN
);
258 #define HASHSIZE sizeof(MSIFILEHASHINFO)
264 MSIFILEHASHINFO hash
;
269 { 0x98500190, 0xb04fd23c, 0x7d3f96d6, 0x727fe128 },
273 { "C:\\Program Files\\msitest\\caesar\n", 0,
275 { 0x2b566794, 0xfd42181b, 0x2514d6e4, 0x5768b4e2 },
279 { "C:\\Program Files\\msitest\\caesar\n", 500,
281 { 0x58095058, 0x805efeff, 0x10f3483e, 0x0147d653 },
286 static void test_MsiGetFileHash(void)
288 const char name
[] = "msitest.bin";
290 MSIFILEHASHINFO hash
;
293 if (!pMsiGetFileHashA
)
295 skip("MsiGetFileHash not implemented\n");
299 hash
.dwFileHashInfoSize
= sizeof(MSIFILEHASHINFO
);
301 /* szFilePath is NULL */
302 r
= pMsiGetFileHashA(NULL
, 0, &hash
);
303 ok(r
== ERROR_INVALID_PARAMETER
, "Expected ERROR_INVALID_PARAMETER, got %d\n", r
);
305 /* szFilePath is empty */
306 r
= pMsiGetFileHashA("", 0, &hash
);
307 ok(r
== ERROR_PATH_NOT_FOUND
|| r
== ERROR_BAD_PATHNAME
,
308 "Expected ERROR_PATH_NOT_FOUND or ERROR_BAD_PATHNAME, got %d\n", r
);
310 /* szFilePath is nonexistent */
311 r
= pMsiGetFileHashA(name
, 0, &hash
);
312 ok(r
== ERROR_FILE_NOT_FOUND
, "Expected ERROR_FILE_NOT_FOUND, got %d\n", r
);
314 /* dwOptions is non-zero */
315 r
= pMsiGetFileHashA(name
, 1, &hash
);
316 ok(r
== ERROR_INVALID_PARAMETER
, "Expected ERROR_INVALID_PARAMETER, got %d\n", r
);
318 /* pHash.dwFileHashInfoSize is not correct */
319 hash
.dwFileHashInfoSize
= 0;
320 r
= pMsiGetFileHashA(name
, 0, &hash
);
321 ok(r
== ERROR_INVALID_PARAMETER
, "Expected ERROR_INVALID_PARAMETER, got %d\n", r
);
324 r
= pMsiGetFileHashA(name
, 0, NULL
);
325 ok(r
== ERROR_INVALID_PARAMETER
, "Expected ERROR_INVALID_PARAMETER, got %d\n", r
);
327 for (i
= 0; i
< sizeof(hash_data
) / sizeof(hash_data
[0]); i
++)
329 create_file(name
, hash_data
[i
].data
, hash_data
[i
].size
);
331 memset(&hash
, 0, sizeof(MSIFILEHASHINFO
));
332 hash
.dwFileHashInfoSize
= sizeof(MSIFILEHASHINFO
);
334 r
= pMsiGetFileHashA(name
, 0, &hash
);
335 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
336 ok(!memcmp(&hash
, &hash_data
[i
].hash
, HASHSIZE
), "Hash incorrect\n");
342 /* copied from dlls/msi/registry.c */
343 static BOOL
squash_guid(LPCWSTR in
, LPWSTR out
)
348 if (FAILED(CLSIDFromString((LPOLESTR
)in
, &guid
)))
362 out
[17+i
*2] = in
[n
++];
363 out
[16+i
*2] = in
[n
++];
368 out
[17+i
*2] = in
[n
++];
369 out
[16+i
*2] = in
[n
++];
375 static void create_test_guid(LPSTR prodcode
, LPSTR squashed
)
377 WCHAR guidW
[MAX_PATH
];
378 WCHAR squashedW
[MAX_PATH
];
383 hr
= CoCreateGuid(&guid
);
384 ok(hr
== S_OK
, "Expected S_OK, got %d\n", hr
);
386 size
= StringFromGUID2(&guid
, (LPOLESTR
)guidW
, MAX_PATH
);
387 ok(size
== 39, "Expected 39, got %d\n", hr
);
389 WideCharToMultiByte(CP_ACP
, 0, guidW
, size
, prodcode
, MAX_PATH
, NULL
, NULL
);
390 squash_guid(guidW
, squashedW
);
391 WideCharToMultiByte(CP_ACP
, 0, squashedW
, -1, squashed
, MAX_PATH
, NULL
, NULL
);
394 static void get_user_sid(LPSTR
*usersid
)
401 OpenProcessToken(GetCurrentProcess(), TOKEN_QUERY
, &token
);
403 GetTokenInformation(token
, TokenUser
, (void *)buf
, size
, &size
);
404 user
= (PTOKEN_USER
)buf
;
405 pConvertSidToStringSidA(user
->User
.Sid
, usersid
);
408 static void test_MsiQueryProductState(void)
410 CHAR prodcode
[MAX_PATH
];
411 CHAR prod_squashed
[MAX_PATH
];
412 CHAR keypath
[MAX_PATH
*2];
416 HKEY userkey
, localkey
, props
;
420 create_test_guid(prodcode
, prod_squashed
);
421 get_user_sid(&usersid
);
424 state
= MsiQueryProductStateA(NULL
);
425 ok(state
== INSTALLSTATE_INVALIDARG
, "Expected INSTALLSTATE_INVALIDARG, got %d\n", state
);
428 state
= MsiQueryProductStateA("");
429 ok(state
== INSTALLSTATE_INVALIDARG
, "Expected INSTALLSTATE_INVALIDARG, got %d\n", state
);
431 /* garbage prodcode */
432 state
= MsiQueryProductStateA("garbage");
433 ok(state
== INSTALLSTATE_INVALIDARG
, "Expected INSTALLSTATE_INVALIDARG, got %d\n", state
);
435 /* guid without brackets */
436 state
= MsiQueryProductStateA("6700E8CF-95AB-4D9C-BC2C-15840DEA7A5D");
437 ok(state
== INSTALLSTATE_INVALIDARG
, "Expected INSTALLSTATE_INVALIDARG, got %d\n", state
);
439 /* guid with brackets */
440 state
= MsiQueryProductStateA("{6700E8CF-95AB-4D9C-BC2C-15840DEA7A5D}");
441 ok(state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
443 /* same length as guid, but random */
444 state
= MsiQueryProductStateA("A938G02JF-2NF3N93-VN3-2NNF-3KGKALDNF93");
445 ok(state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
447 /* MSIINSTALLCONTEXT_USERUNMANAGED */
449 state
= MsiQueryProductStateA(prodcode
);
450 ok(state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
452 lstrcpyA(keypath
, "Software\\Microsoft\\Installer\\Products\\");
453 lstrcatA(keypath
, prod_squashed
);
455 res
= RegCreateKeyA(HKEY_CURRENT_USER
, keypath
, &userkey
);
456 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
458 /* user product key exists */
459 state
= MsiQueryProductStateA(prodcode
);
460 ok(state
== INSTALLSTATE_ADVERTISED
, "Expected INSTALLSTATE_ADVERTISED, got %d\n", state
);
462 lstrcpyA(keypath
, "Software\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\");
463 lstrcatA(keypath
, prodcode
);
465 res
= RegCreateKeyA(HKEY_LOCAL_MACHINE
, keypath
, &localkey
);
466 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
468 /* local uninstall key exists */
469 state
= MsiQueryProductStateA(prodcode
);
470 ok(state
== INSTALLSTATE_ADVERTISED
, "Expected INSTALLSTATE_ADVERTISED, got %d\n", state
);
473 res
= RegSetValueExA(localkey
, "WindowsInstaller", 0, REG_DWORD
, (const BYTE
*)&data
, sizeof(DWORD
));
474 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
476 /* WindowsInstaller value exists */
477 state
= MsiQueryProductStateA(prodcode
);
478 ok(state
== INSTALLSTATE_ADVERTISED
, "Expected INSTALLSTATE_ADVERTISED, got %d\n", state
);
480 RegDeleteValueA(localkey
, "WindowsInstaller");
481 RegDeleteKeyA(localkey
, "");
483 lstrcpyA(keypath
, "Software\\Microsoft\\Windows\\CurrentVersion\\Installer\\UserData\\");
484 lstrcatA(keypath
, usersid
);
485 lstrcatA(keypath
, "\\Products\\");
486 lstrcatA(keypath
, prod_squashed
);
488 res
= RegCreateKeyA(HKEY_LOCAL_MACHINE
, keypath
, &localkey
);
489 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
491 /* local product key exists */
492 state
= MsiQueryProductStateA(prodcode
);
493 ok(state
== INSTALLSTATE_ADVERTISED
, "Expected INSTALLSTATE_ADVERTISED, got %d\n", state
);
495 res
= RegCreateKeyA(localkey
, "InstallProperties", &props
);
496 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
498 /* install properties key exists */
499 state
= MsiQueryProductStateA(prodcode
);
500 ok(state
== INSTALLSTATE_ADVERTISED
, "Expected INSTALLSTATE_ADVERTISED, got %d\n", state
);
503 res
= RegSetValueExA(props
, "WindowsInstaller", 0, REG_DWORD
, (const BYTE
*)&data
, sizeof(DWORD
));
504 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
506 /* WindowsInstaller value exists */
507 state
= MsiQueryProductStateA(prodcode
);
508 ok(state
== INSTALLSTATE_DEFAULT
, "Expected INSTALLSTATE_DEFAULT, got %d\n", state
);
511 res
= RegSetValueExA(props
, "WindowsInstaller", 0, REG_DWORD
, (const BYTE
*)&data
, sizeof(DWORD
));
512 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
514 /* WindowsInstaller value is not 1 */
515 state
= MsiQueryProductStateA(prodcode
);
516 ok(state
== INSTALLSTATE_DEFAULT
, "Expected INSTALLSTATE_DEFAULT, got %d\n", state
);
518 RegDeleteKeyA(userkey
, "");
520 /* user product key does not exist */
521 state
= MsiQueryProductStateA(prodcode
);
522 ok(state
== INSTALLSTATE_ABSENT
, "Expected INSTALLSTATE_ABSENT, got %d\n", state
);
524 RegDeleteValueA(props
, "WindowsInstaller");
525 RegDeleteKeyA(props
, "");
527 RegDeleteKeyA(localkey
, "");
528 RegCloseKey(localkey
);
529 RegDeleteKeyA(userkey
, "");
530 RegCloseKey(userkey
);
532 /* MSIINSTALLCONTEXT_USERMANAGED */
534 lstrcpyA(keypath
, "Software\\Microsoft\\Windows\\CurrentVersion\\Installer\\Managed\\");
535 lstrcatA(keypath
, usersid
);
536 lstrcatA(keypath
, "\\Installer\\Products\\");
537 lstrcatA(keypath
, prod_squashed
);
539 res
= RegCreateKeyA(HKEY_LOCAL_MACHINE
, keypath
, &prodkey
);
540 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
542 state
= MsiQueryProductStateA(prodcode
);
543 ok(state
== INSTALLSTATE_ADVERTISED
,
544 "Expected INSTALLSTATE_ADVERTISED, got %d\n", state
);
546 lstrcpyA(keypath
, "Software\\Microsoft\\Windows\\CurrentVersion\\Installer\\UserData\\");
547 lstrcatA(keypath
, usersid
);
548 lstrcatA(keypath
, "\\Products\\");
549 lstrcatA(keypath
, prod_squashed
);
551 res
= RegCreateKeyA(HKEY_LOCAL_MACHINE
, keypath
, &localkey
);
552 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
554 state
= MsiQueryProductStateA(prodcode
);
555 ok(state
== INSTALLSTATE_ADVERTISED
,
556 "Expected INSTALLSTATE_ADVERTISED, got %d\n", state
);
558 res
= RegCreateKeyA(localkey
, "InstallProperties", &props
);
559 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
561 state
= MsiQueryProductStateA(prodcode
);
562 ok(state
== INSTALLSTATE_ADVERTISED
,
563 "Expected INSTALLSTATE_ADVERTISED, got %d\n", state
);
566 res
= RegSetValueExA(props
, "WindowsInstaller", 0, REG_DWORD
, (const BYTE
*)&data
, sizeof(DWORD
));
567 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
569 /* WindowsInstaller value exists */
570 state
= MsiQueryProductStateA(prodcode
);
571 ok(state
== INSTALLSTATE_DEFAULT
, "Expected INSTALLSTATE_DEFAULT, got %d\n", state
);
573 RegDeleteValueA(props
, "WindowsInstaller");
574 RegDeleteKeyA(props
, "");
576 RegDeleteKeyA(localkey
, "");
577 RegCloseKey(localkey
);
578 RegDeleteKeyA(prodkey
, "");
579 RegCloseKey(prodkey
);
581 /* MSIINSTALLCONTEXT_MACHINE */
583 lstrcpyA(keypath
, "Software\\Classes\\Installer\\Products\\");
584 lstrcatA(keypath
, prod_squashed
);
586 res
= RegCreateKeyA(HKEY_LOCAL_MACHINE
, keypath
, &prodkey
);
587 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
589 state
= MsiQueryProductStateA(prodcode
);
590 ok(state
== INSTALLSTATE_ADVERTISED
, "Expected INSTALLSTATE_ADVERTISED, got %d\n", state
);
592 lstrcpyA(keypath
, "Software\\Microsoft\\Windows\\CurrentVersion\\Installer\\UserData\\");
593 lstrcatA(keypath
, "S-1-5-18\\Products\\");
594 lstrcatA(keypath
, prod_squashed
);
596 res
= RegCreateKeyA(HKEY_LOCAL_MACHINE
, keypath
, &localkey
);
597 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
599 state
= MsiQueryProductStateA(prodcode
);
600 ok(state
== INSTALLSTATE_ADVERTISED
,
601 "Expected INSTALLSTATE_ADVERTISED, got %d\n", state
);
603 res
= RegCreateKeyA(localkey
, "InstallProperties", &props
);
604 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
606 state
= MsiQueryProductStateA(prodcode
);
607 ok(state
== INSTALLSTATE_ADVERTISED
,
608 "Expected INSTALLSTATE_ADVERTISED, got %d\n", state
);
611 res
= RegSetValueExA(props
, "WindowsInstaller", 0, REG_DWORD
, (const BYTE
*)&data
, sizeof(DWORD
));
612 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
614 /* WindowsInstaller value exists */
615 state
= MsiQueryProductStateA(prodcode
);
616 ok(state
== INSTALLSTATE_DEFAULT
, "Expected INSTALLSTATE_DEFAULT, got %d\n", state
);
618 RegDeleteValueA(props
, "WindowsInstaller");
619 RegDeleteKeyA(props
, "");
621 RegDeleteKeyA(localkey
, "");
622 RegCloseKey(localkey
);
623 RegDeleteKeyA(prodkey
, "");
624 RegCloseKey(prodkey
);
629 static const char table_enc85
[] =
630 "!$%&'()*+,-.0123456789=?@ABCDEFGHIJKLMNO"
631 "PQRSTUVWXYZ[]^_`abcdefghijklmnopqrstuvwx"
635 * Encodes a base85 guid given a GUID pointer
636 * Caller should provide a 21 character buffer for the encoded string.
638 * returns TRUE if successful, FALSE if not
640 static BOOL
encode_base85_guid( GUID
*guid
, LPWSTR str
)
642 unsigned int x
, *p
, i
;
644 p
= (unsigned int*) guid
;
648 *str
++ = table_enc85
[x
%85];
650 *str
++ = table_enc85
[x
%85];
652 *str
++ = table_enc85
[x
%85];
654 *str
++ = table_enc85
[x
%85];
656 *str
++ = table_enc85
[x
%85];
663 static void compose_base85_guid(LPSTR component
, LPSTR comp_base85
, LPSTR squashed
)
665 WCHAR guidW
[MAX_PATH
];
666 WCHAR base85W
[MAX_PATH
];
667 WCHAR squashedW
[MAX_PATH
];
672 hr
= CoCreateGuid(&guid
);
673 ok(hr
== S_OK
, "Expected S_OK, got %d\n", hr
);
675 size
= StringFromGUID2(&guid
, (LPOLESTR
)guidW
, MAX_PATH
);
676 ok(size
== 39, "Expected 39, got %d\n", hr
);
678 WideCharToMultiByte(CP_ACP
, 0, guidW
, size
, component
, MAX_PATH
, NULL
, NULL
);
679 encode_base85_guid(&guid
, base85W
);
680 WideCharToMultiByte(CP_ACP
, 0, base85W
, -1, comp_base85
, MAX_PATH
, NULL
, NULL
);
681 squash_guid(guidW
, squashedW
);
682 WideCharToMultiByte(CP_ACP
, 0, squashedW
, -1, squashed
, MAX_PATH
, NULL
, NULL
);
685 static void test_MsiQueryFeatureState(void)
687 HKEY userkey
, localkey
, compkey
;
688 CHAR prodcode
[MAX_PATH
];
689 CHAR prod_squashed
[MAX_PATH
];
690 CHAR component
[MAX_PATH
];
691 CHAR comp_base85
[MAX_PATH
];
692 CHAR comp_squashed
[MAX_PATH
];
693 CHAR keypath
[MAX_PATH
*2];
698 create_test_guid(prodcode
, prod_squashed
);
699 compose_base85_guid(component
, comp_base85
, comp_squashed
);
700 get_user_sid(&usersid
);
703 state
= MsiQueryFeatureStateA(NULL
, "feature");
704 ok(state
== INSTALLSTATE_INVALIDARG
, "Expected INSTALLSTATE_INVALIDARG, got %d\n", state
);
707 state
= MsiQueryFeatureStateA("", "feature");
708 ok(state
== INSTALLSTATE_INVALIDARG
, "Expected INSTALLSTATE_INVALIDARG, got %d\n", state
);
710 /* garbage prodcode */
711 state
= MsiQueryFeatureStateA("garbage", "feature");
712 ok(state
== INSTALLSTATE_INVALIDARG
, "Expected INSTALLSTATE_INVALIDARG, got %d\n", state
);
714 /* guid without brackets */
715 state
= MsiQueryFeatureStateA("6700E8CF-95AB-4D9C-BC2C-15840DEA7A5D", "feature");
716 ok(state
== INSTALLSTATE_INVALIDARG
, "Expected INSTALLSTATE_INVALIDARG, got %d\n", state
);
718 /* guid with brackets */
719 state
= MsiQueryFeatureStateA("{6700E8CF-95AB-4D9C-BC2C-15840DEA7A5D}", "feature");
720 ok(state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
722 /* same length as guid, but random */
723 state
= MsiQueryFeatureStateA("A938G02JF-2NF3N93-VN3-2NNF-3KGKALDNF93", "feature");
724 ok(state
== INSTALLSTATE_INVALIDARG
, "Expected INSTALLSTATE_INVALIDARG, got %d\n", state
);
727 state
= MsiQueryFeatureStateA(prodcode
, NULL
);
728 ok(state
== INSTALLSTATE_INVALIDARG
, "Expected INSTALLSTATE_INVALIDARG, got %d\n", state
);
730 /* empty szFeature */
731 state
= MsiQueryFeatureStateA(prodcode
, "");
732 ok(state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
734 /* feature key does not exist yet */
735 state
= MsiQueryFeatureStateA(prodcode
, "feature");
736 ok(state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
738 /* MSIINSTALLCONTEXT_USERUNMANAGED */
740 lstrcpyA(keypath
, "Software\\Microsoft\\Installer\\Features\\");
741 lstrcatA(keypath
, prod_squashed
);
743 res
= RegCreateKeyA(HKEY_CURRENT_USER
, keypath
, &userkey
);
744 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
746 /* feature key exists */
747 state
= MsiQueryFeatureStateA(prodcode
, "feature");
748 ok(state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
750 res
= RegSetValueExA(userkey
, "feature", 0, REG_SZ
, (const BYTE
*)"", 2);
751 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
753 /* feature value exists */
754 state
= MsiQueryFeatureStateA(prodcode
, "feature");
755 ok(state
== INSTALLSTATE_ADVERTISED
, "Expected INSTALLSTATE_ADVERTISED, got %d\n", state
);
757 lstrcpyA(keypath
, "Software\\Microsoft\\Windows\\CurrentVersion\\Installer\\UserData\\");
758 lstrcatA(keypath
, usersid
);
759 lstrcatA(keypath
, "\\Products\\");
760 lstrcatA(keypath
, prod_squashed
);
761 lstrcatA(keypath
, "\\Features");
763 res
= RegCreateKeyA(HKEY_LOCAL_MACHINE
, keypath
, &localkey
);
764 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
766 /* userdata features key exists */
767 state
= MsiQueryFeatureStateA(prodcode
, "feature");
768 ok(state
== INSTALLSTATE_ADVERTISED
, "Expected INSTALLSTATE_ADVERTISED, got %d\n", state
);
770 res
= RegSetValueExA(localkey
, "feature", 0, REG_SZ
, (const BYTE
*)"aaaaaaaaaaaaaaaaaaa", 20);
771 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
773 state
= MsiQueryFeatureStateA(prodcode
, "feature");
774 ok(state
== INSTALLSTATE_BADCONFIG
, "Expected INSTALLSTATE_BADCONFIG, got %d\n", state
);
776 res
= RegSetValueExA(localkey
, "feature", 0, REG_SZ
, (const BYTE
*)"aaaaaaaaaaaaaaaaaaaa", 21);
777 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
779 state
= MsiQueryFeatureStateA(prodcode
, "feature");
780 ok(state
== INSTALLSTATE_ADVERTISED
, "Expected INSTALLSTATE_ADVERTISED, got %d\n", state
);
782 res
= RegSetValueExA(localkey
, "feature", 0, REG_SZ
, (const BYTE
*)"aaaaaaaaaaaaaaaaaaaaa", 22);
783 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
785 state
= MsiQueryFeatureStateA(prodcode
, "feature");
786 ok(state
== INSTALLSTATE_ADVERTISED
, "Expected INSTALLSTATE_ADVERTISED, got %d\n", state
);
788 res
= RegSetValueExA(localkey
, "feature", 0, REG_SZ
, (const BYTE
*)comp_base85
, 21);
789 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
791 state
= MsiQueryFeatureStateA(prodcode
, "feature");
792 ok(state
== INSTALLSTATE_ADVERTISED
, "Expected INSTALLSTATE_ADVERTISED, got %d\n", state
);
794 lstrcpyA(keypath
, "Software\\Microsoft\\Windows\\CurrentVersion\\Installer\\UserData\\");
795 lstrcatA(keypath
, usersid
);
796 lstrcatA(keypath
, "\\Components\\");
797 lstrcatA(keypath
, comp_squashed
);
799 res
= RegCreateKeyA(HKEY_LOCAL_MACHINE
, keypath
, &compkey
);
800 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
802 state
= MsiQueryFeatureStateA(prodcode
, "feature");
803 ok(state
== INSTALLSTATE_ADVERTISED
, "Expected INSTALLSTATE_ADVERTISED, got %d\n", state
);
805 res
= RegSetValueExA(compkey
, prod_squashed
, 0, REG_SZ
, (const BYTE
*)"", 1);
806 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
808 state
= MsiQueryFeatureStateA(prodcode
, "feature");
809 ok(state
== INSTALLSTATE_LOCAL
, "Expected INSTALLSTATE_LOCAL, got %d\n", state
);
811 res
= RegSetValueExA(compkey
, prod_squashed
, 0, REG_SZ
, (const BYTE
*)"apple", 1);
812 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
814 state
= MsiQueryFeatureStateA(prodcode
, "feature");
815 ok(state
== INSTALLSTATE_LOCAL
, "Expected INSTALLSTATE_LOCAL, got %d\n", state
);
817 RegDeleteValueA(compkey
, prod_squashed
);
818 RegDeleteKeyA(compkey
, "");
819 RegDeleteValueA(localkey
, "feature");
820 RegDeleteValueA(userkey
, "feature");
821 RegDeleteKeyA(userkey
, "");
822 RegCloseKey(compkey
);
823 RegCloseKey(localkey
);
824 RegCloseKey(userkey
);
826 /* MSIINSTALLCONTEXT_USERMANAGED */
828 lstrcpyA(keypath
, "Software\\Microsoft\\Windows\\CurrentVersion\\Installer\\Managed\\");
829 lstrcatA(keypath
, usersid
);
830 lstrcatA(keypath
, "\\Installer\\Features\\");
831 lstrcatA(keypath
, prod_squashed
);
833 res
= RegCreateKeyA(HKEY_LOCAL_MACHINE
, keypath
, &userkey
);
834 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
836 /* feature key exists */
837 state
= MsiQueryFeatureStateA(prodcode
, "feature");
838 ok(state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
840 res
= RegSetValueExA(userkey
, "feature", 0, REG_SZ
, (const BYTE
*)"", 2);
841 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
843 /* feature value exists */
844 state
= MsiQueryFeatureStateA(prodcode
, "feature");
845 ok(state
== INSTALLSTATE_ADVERTISED
, "Expected INSTALLSTATE_ADVERTISED, got %d\n", state
);
847 lstrcpyA(keypath
, "Software\\Microsoft\\Windows\\CurrentVersion\\Installer\\UserData\\");
848 lstrcatA(keypath
, usersid
);
849 lstrcatA(keypath
, "\\Products\\");
850 lstrcatA(keypath
, prod_squashed
);
851 lstrcatA(keypath
, "\\Features");
853 res
= RegCreateKeyA(HKEY_LOCAL_MACHINE
, keypath
, &localkey
);
854 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
856 /* userdata features key exists */
857 state
= MsiQueryFeatureStateA(prodcode
, "feature");
858 ok(state
== INSTALLSTATE_ADVERTISED
, "Expected INSTALLSTATE_ADVERTISED, got %d\n", state
);
860 res
= RegSetValueExA(localkey
, "feature", 0, REG_SZ
, (const BYTE
*)"aaaaaaaaaaaaaaaaaaa", 20);
861 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
863 state
= MsiQueryFeatureStateA(prodcode
, "feature");
864 ok(state
== INSTALLSTATE_BADCONFIG
, "Expected INSTALLSTATE_BADCONFIG, got %d\n", state
);
866 res
= RegSetValueExA(localkey
, "feature", 0, REG_SZ
, (const BYTE
*)"aaaaaaaaaaaaaaaaaaaa", 21);
867 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
869 state
= MsiQueryFeatureStateA(prodcode
, "feature");
870 ok(state
== INSTALLSTATE_ADVERTISED
, "Expected INSTALLSTATE_ADVERTISED, got %d\n", state
);
872 res
= RegSetValueExA(localkey
, "feature", 0, REG_SZ
, (const BYTE
*)"aaaaaaaaaaaaaaaaaaaaa", 22);
873 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
875 state
= MsiQueryFeatureStateA(prodcode
, "feature");
876 ok(state
== INSTALLSTATE_ADVERTISED
, "Expected INSTALLSTATE_ADVERTISED, got %d\n", state
);
878 res
= RegSetValueExA(localkey
, "feature", 0, REG_SZ
, (const BYTE
*)comp_base85
, 21);
879 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
881 state
= MsiQueryFeatureStateA(prodcode
, "feature");
882 ok(state
== INSTALLSTATE_ADVERTISED
, "Expected INSTALLSTATE_ADVERTISED, got %d\n", state
);
884 lstrcpyA(keypath
, "Software\\Microsoft\\Windows\\CurrentVersion\\Installer\\UserData\\");
885 lstrcatA(keypath
, usersid
);
886 lstrcatA(keypath
, "\\Components\\");
887 lstrcatA(keypath
, comp_squashed
);
889 res
= RegCreateKeyA(HKEY_LOCAL_MACHINE
, keypath
, &compkey
);
890 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
892 state
= MsiQueryFeatureStateA(prodcode
, "feature");
893 ok(state
== INSTALLSTATE_ADVERTISED
, "Expected INSTALLSTATE_ADVERTISED, got %d\n", state
);
895 res
= RegSetValueExA(compkey
, prod_squashed
, 0, REG_SZ
, (const BYTE
*)"", 1);
896 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
898 state
= MsiQueryFeatureStateA(prodcode
, "feature");
899 ok(state
== INSTALLSTATE_LOCAL
, "Expected INSTALLSTATE_LOCAL, got %d\n", state
);
901 res
= RegSetValueExA(compkey
, prod_squashed
, 0, REG_SZ
, (const BYTE
*)"apple", 1);
902 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
904 state
= MsiQueryFeatureStateA(prodcode
, "feature");
905 ok(state
== INSTALLSTATE_LOCAL
, "Expected INSTALLSTATE_LOCAL, got %d\n", state
);
907 RegDeleteValueA(compkey
, prod_squashed
);
908 RegDeleteKeyA(compkey
, "");
909 RegDeleteValueA(localkey
, "feature");
910 RegDeleteValueA(userkey
, "feature");
911 RegDeleteKeyA(userkey
, "");
912 RegCloseKey(compkey
);
913 RegCloseKey(localkey
);
914 RegCloseKey(userkey
);
916 /* MSIINSTALLCONTEXT_MACHINE */
918 lstrcpyA(keypath
, "Software\\Classes\\Installer\\Features\\");
919 lstrcatA(keypath
, prod_squashed
);
921 res
= RegCreateKeyA(HKEY_LOCAL_MACHINE
, keypath
, &userkey
);
922 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
924 /* feature key exists */
925 state
= MsiQueryFeatureStateA(prodcode
, "feature");
926 ok(state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
928 res
= RegSetValueExA(userkey
, "feature", 0, REG_SZ
, (const BYTE
*)"", 2);
929 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
931 /* feature value exists */
932 state
= MsiQueryFeatureStateA(prodcode
, "feature");
933 ok(state
== INSTALLSTATE_ADVERTISED
, "Expected INSTALLSTATE_ADVERTISED, got %d\n", state
);
935 lstrcpyA(keypath
, "Software\\Microsoft\\Windows\\CurrentVersion\\Installer\\UserData\\");
936 lstrcatA(keypath
, "S-1-5-18\\Products\\");
937 lstrcatA(keypath
, prod_squashed
);
938 lstrcatA(keypath
, "\\Features");
940 res
= RegCreateKeyA(HKEY_LOCAL_MACHINE
, keypath
, &localkey
);
941 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
943 /* userdata features key exists */
944 state
= MsiQueryFeatureStateA(prodcode
, "feature");
945 ok(state
== INSTALLSTATE_ADVERTISED
, "Expected INSTALLSTATE_ADVERTISED, got %d\n", state
);
947 res
= RegSetValueExA(localkey
, "feature", 0, REG_SZ
, (const BYTE
*)"aaaaaaaaaaaaaaaaaaa", 20);
948 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
950 state
= MsiQueryFeatureStateA(prodcode
, "feature");
951 ok(state
== INSTALLSTATE_BADCONFIG
, "Expected INSTALLSTATE_BADCONFIG, got %d\n", state
);
953 res
= RegSetValueExA(localkey
, "feature", 0, REG_SZ
, (const BYTE
*)"aaaaaaaaaaaaaaaaaaaa", 21);
954 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
956 state
= MsiQueryFeatureStateA(prodcode
, "feature");
957 ok(state
== INSTALLSTATE_ADVERTISED
, "Expected INSTALLSTATE_ADVERTISED, got %d\n", state
);
959 res
= RegSetValueExA(localkey
, "feature", 0, REG_SZ
, (const BYTE
*)"aaaaaaaaaaaaaaaaaaaaa", 22);
960 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
962 state
= MsiQueryFeatureStateA(prodcode
, "feature");
963 ok(state
== INSTALLSTATE_ADVERTISED
, "Expected INSTALLSTATE_ADVERTISED, got %d\n", state
);
965 res
= RegSetValueExA(localkey
, "feature", 0, REG_SZ
, (const BYTE
*)comp_base85
, 21);
966 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
968 state
= MsiQueryFeatureStateA(prodcode
, "feature");
969 ok(state
== INSTALLSTATE_ADVERTISED
, "Expected INSTALLSTATE_ADVERTISED, got %d\n", state
);
971 lstrcpyA(keypath
, "Software\\Microsoft\\Windows\\CurrentVersion\\Installer\\UserData\\");
972 lstrcatA(keypath
, "S-1-5-18\\Components\\");
973 lstrcatA(keypath
, comp_squashed
);
975 res
= RegCreateKeyA(HKEY_LOCAL_MACHINE
, keypath
, &compkey
);
976 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
978 state
= MsiQueryFeatureStateA(prodcode
, "feature");
979 ok(state
== INSTALLSTATE_ADVERTISED
, "Expected INSTALLSTATE_ADVERTISED, got %d\n", state
);
981 res
= RegSetValueExA(compkey
, prod_squashed
, 0, REG_SZ
, (const BYTE
*)"", 1);
982 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
984 state
= MsiQueryFeatureStateA(prodcode
, "feature");
985 ok(state
== INSTALLSTATE_LOCAL
, "Expected INSTALLSTATE_LOCAL, got %d\n", state
);
987 res
= RegSetValueExA(compkey
, prod_squashed
, 0, REG_SZ
, (const BYTE
*)"apple", 1);
988 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
990 state
= MsiQueryFeatureStateA(prodcode
, "feature");
991 ok(state
== INSTALLSTATE_LOCAL
, "Expected INSTALLSTATE_LOCAL, got %d\n", state
);
993 RegDeleteValueA(compkey
, prod_squashed
);
994 RegDeleteKeyA(compkey
, "");
995 RegDeleteValueA(localkey
, "feature");
996 RegDeleteValueA(userkey
, "feature");
997 RegDeleteKeyA(userkey
, "");
998 RegCloseKey(compkey
);
999 RegCloseKey(localkey
);
1000 RegCloseKey(userkey
);
1003 static void test_MsiQueryComponentState(void)
1005 HKEY compkey
, prodkey
;
1006 CHAR prodcode
[MAX_PATH
];
1007 CHAR prod_squashed
[MAX_PATH
];
1008 CHAR component
[MAX_PATH
];
1009 CHAR comp_base85
[MAX_PATH
];
1010 CHAR comp_squashed
[MAX_PATH
];
1011 CHAR keypath
[MAX_PATH
];
1017 static const INSTALLSTATE MAGIC_ERROR
= 0xdeadbeef;
1019 if (!pMsiQueryComponentStateA
)
1021 skip("MsiQueryComponentStateA not implemented\n");
1025 create_test_guid(prodcode
, prod_squashed
);
1026 compose_base85_guid(component
, comp_base85
, comp_squashed
);
1027 get_user_sid(&usersid
);
1029 /* NULL szProductCode */
1030 state
= MAGIC_ERROR
;
1031 r
= pMsiQueryComponentStateA(NULL
, NULL
, MSIINSTALLCONTEXT_MACHINE
, component
, &state
);
1032 ok(r
== ERROR_INVALID_PARAMETER
, "Expected ERROR_INVALID_PARAMETER, got %d\n", r
);
1033 ok(state
== MAGIC_ERROR
, "Expected 0xdeadbeef, got %d\n", state
);
1035 /* empty szProductCode */
1036 state
= MAGIC_ERROR
;
1037 r
= pMsiQueryComponentStateA("", NULL
, MSIINSTALLCONTEXT_MACHINE
, component
, &state
);
1038 ok(r
== ERROR_INVALID_PARAMETER
, "Expected ERROR_INVALID_PARAMETER, got %d\n", r
);
1039 ok(state
== MAGIC_ERROR
, "Expected 0xdeadbeef, got %d\n", state
);
1041 /* random szProductCode */
1042 state
= MAGIC_ERROR
;
1043 r
= pMsiQueryComponentStateA("random", NULL
, MSIINSTALLCONTEXT_MACHINE
, component
, &state
);
1044 ok(r
== ERROR_INVALID_PARAMETER
, "Expected ERROR_INVALID_PARAMETER, got %d\n", r
);
1045 ok(state
== MAGIC_ERROR
, "Expected 0xdeadbeef, got %d\n", state
);
1047 /* GUID-length szProductCode */
1048 state
= MAGIC_ERROR
;
1049 r
= pMsiQueryComponentStateA("DJANE93KNDNAS-2KN2NR93KMN3LN13=L1N3KDE", NULL
, MSIINSTALLCONTEXT_MACHINE
, component
, &state
);
1050 ok(r
== ERROR_INVALID_PARAMETER
, "Expected ERROR_INVALID_PARAMETER, got %d\n", r
);
1051 ok(state
== MAGIC_ERROR
, "Expected 0xdeadbeef, got %d\n", state
);
1053 /* GUID-length with brackets */
1054 state
= MAGIC_ERROR
;
1055 r
= pMsiQueryComponentStateA("{JANE93KNDNAS-2KN2NR93KMN3LN13=L1N3KD}", NULL
, MSIINSTALLCONTEXT_MACHINE
, component
, &state
);
1056 ok(r
== ERROR_INVALID_PARAMETER
, "Expected ERROR_INVALID_PARAMETER, got %d\n", r
);
1057 ok(state
== MAGIC_ERROR
, "Expected 0xdeadbeef, got %d\n", state
);
1060 state
= MAGIC_ERROR
;
1061 r
= pMsiQueryComponentStateA(prodcode
, NULL
, MSIINSTALLCONTEXT_MACHINE
, component
, &state
);
1062 ok(r
== ERROR_UNKNOWN_PRODUCT
, "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r
);
1063 ok(state
== MAGIC_ERROR
, "Expected 0xdeadbeef, got %d\n", state
);
1065 state
= MAGIC_ERROR
;
1066 r
= pMsiQueryComponentStateA(prodcode
, NULL
, MSIINSTALLCONTEXT_MACHINE
, component
, &state
);
1067 ok(r
== ERROR_UNKNOWN_PRODUCT
, "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r
);
1068 ok(state
== MAGIC_ERROR
, "Expected 0xdeadbeef, got %d\n", state
);
1070 lstrcpyA(keypath
, "Software\\Classes\\Installer\\Products\\");
1071 lstrcatA(keypath
, prod_squashed
);
1073 res
= RegCreateKeyA(HKEY_LOCAL_MACHINE
, keypath
, &prodkey
);
1074 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
1076 state
= MAGIC_ERROR
;
1077 r
= pMsiQueryComponentStateA(prodcode
, NULL
, MSIINSTALLCONTEXT_MACHINE
, component
, &state
);
1078 ok(r
== ERROR_UNKNOWN_COMPONENT
, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r
);
1079 ok(state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
1081 RegDeleteKeyA(prodkey
, "");
1082 RegCloseKey(prodkey
);
1084 /* create local system product key */
1085 lstrcpyA(keypath
, "Software\\Microsoft\\Windows\\CurrentVersion\\Installer\\UserData\\S-1-5-18\\Products\\");
1086 lstrcatA(keypath
, prod_squashed
);
1087 lstrcatA(keypath
, "\\InstallProperties");
1089 res
= RegCreateKeyA(HKEY_LOCAL_MACHINE
, keypath
, &prodkey
);
1090 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
1092 /* local system product key exists */
1093 state
= MAGIC_ERROR
;
1094 r
= pMsiQueryComponentStateA(prodcode
, NULL
, MSIINSTALLCONTEXT_MACHINE
, component
, &state
);
1095 ok(r
== ERROR_UNKNOWN_PRODUCT
, "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r
);
1096 ok(state
== MAGIC_ERROR
, "Expected 0xdeadbeef, got %d\n", state
);
1098 res
= RegSetValueExA(prodkey
, "LocalPackage", 0, REG_SZ
, (const BYTE
*)"msitest.msi", 11);
1099 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
1101 /* LocalPackage value exists */
1102 state
= MAGIC_ERROR
;
1103 r
= pMsiQueryComponentStateA(prodcode
, NULL
, MSIINSTALLCONTEXT_MACHINE
, component
, &state
);
1104 ok(r
== ERROR_UNKNOWN_COMPONENT
, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r
);
1105 ok(state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
1107 lstrcpyA(keypath
, "Software\\Microsoft\\Windows\\CurrentVersion\\Installer\\UserData\\S-1-5-18\\Components\\");
1108 lstrcatA(keypath
, comp_squashed
);
1110 res
= RegCreateKeyA(HKEY_LOCAL_MACHINE
, keypath
, &compkey
);
1111 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
1113 /* component key exists */
1114 state
= MAGIC_ERROR
;
1115 r
= pMsiQueryComponentStateA(prodcode
, NULL
, MSIINSTALLCONTEXT_MACHINE
, component
, &state
);
1116 ok(r
== ERROR_UNKNOWN_COMPONENT
, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r
);
1117 ok(state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
1119 res
= RegSetValueExA(compkey
, prod_squashed
, 0, REG_SZ
, (const BYTE
*)"", 0);
1120 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
1122 /* component\product exists */
1123 state
= MAGIC_ERROR
;
1124 r
= pMsiQueryComponentStateA(prodcode
, NULL
, MSIINSTALLCONTEXT_MACHINE
, component
, &state
);
1125 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
1126 ok(state
== INSTALLSTATE_NOTUSED
, "Expected INSTALLSTATE_NOTUSED, got %d\n", state
);
1128 res
= RegSetValueExA(compkey
, prod_squashed
, 0, REG_SZ
, (const BYTE
*)"hi", 2);
1129 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
1131 state
= MAGIC_ERROR
;
1132 r
= pMsiQueryComponentStateA(prodcode
, NULL
, MSIINSTALLCONTEXT_MACHINE
, component
, &state
);
1133 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
1134 ok(state
== INSTALLSTATE_LOCAL
, "Expected INSTALLSTATE_LOCAL, got %d\n", state
);
1136 RegDeleteValueA(prodkey
, "LocalPackage");
1137 RegDeleteKeyA(prodkey
, "");
1138 RegDeleteValueA(compkey
, prod_squashed
);
1139 RegDeleteKeyA(prodkey
, "");
1140 RegCloseKey(prodkey
);
1141 RegCloseKey(compkey
);
1143 /* MSIINSTALLCONTEXT_USERUNMANAGED */
1145 state
= MAGIC_ERROR
;
1146 r
= pMsiQueryComponentStateA(prodcode
, NULL
, MSIINSTALLCONTEXT_USERUNMANAGED
, component
, &state
);
1147 ok(r
== ERROR_UNKNOWN_PRODUCT
, "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r
);
1148 ok(state
== MAGIC_ERROR
, "Expected 0xdeadbeef, got %d\n", state
);
1150 lstrcpyA(keypath
, "Software\\Microsoft\\Installer\\Products\\");
1151 lstrcatA(keypath
, prod_squashed
);
1153 res
= RegCreateKeyA(HKEY_CURRENT_USER
, keypath
, &prodkey
);
1154 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
1156 state
= MAGIC_ERROR
;
1157 r
= pMsiQueryComponentStateA(prodcode
, NULL
, MSIINSTALLCONTEXT_USERUNMANAGED
, component
, &state
);
1158 ok(r
== ERROR_UNKNOWN_COMPONENT
, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r
);
1159 ok(state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
1161 RegDeleteKeyA(prodkey
, "");
1162 RegCloseKey(prodkey
);
1164 lstrcpyA(keypath
, "Software\\Microsoft\\Windows\\CurrentVersion\\Installer\\UserData\\");
1165 lstrcatA(keypath
, usersid
);
1166 lstrcatA(keypath
, "\\Products\\");
1167 lstrcatA(keypath
, prod_squashed
);
1168 lstrcatA(keypath
, "\\InstallProperties");
1170 res
= RegCreateKeyA(HKEY_LOCAL_MACHINE
, keypath
, &prodkey
);
1171 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
1173 res
= RegSetValueExA(prodkey
, "LocalPackage", 0, REG_SZ
, (const BYTE
*)"msitest.msi", 11);
1174 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
1176 RegCloseKey(prodkey
);
1178 state
= MAGIC_ERROR
;
1179 r
= pMsiQueryComponentStateA(prodcode
, NULL
, MSIINSTALLCONTEXT_USERUNMANAGED
, component
, &state
);
1180 ok(r
== ERROR_UNKNOWN_COMPONENT
, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r
);
1181 ok(state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
1183 lstrcpyA(keypath
, "Software\\Microsoft\\Windows\\CurrentVersion\\Installer\\UserData\\");
1184 lstrcatA(keypath
, usersid
);
1185 lstrcatA(keypath
, "\\Components\\");
1186 lstrcatA(keypath
, comp_squashed
);
1188 res
= RegCreateKeyA(HKEY_LOCAL_MACHINE
, keypath
, &compkey
);
1189 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
1191 /* component key exists */
1192 state
= MAGIC_ERROR
;
1193 r
= pMsiQueryComponentStateA(prodcode
, NULL
, MSIINSTALLCONTEXT_USERUNMANAGED
, component
, &state
);
1194 ok(r
== ERROR_UNKNOWN_COMPONENT
, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r
);
1195 ok(state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
1197 res
= RegSetValueExA(compkey
, prod_squashed
, 0, REG_SZ
, (const BYTE
*)"", 0);
1198 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
1200 /* component\product exists */
1201 state
= MAGIC_ERROR
;
1202 r
= pMsiQueryComponentStateA(prodcode
, NULL
, MSIINSTALLCONTEXT_USERUNMANAGED
, component
, &state
);
1203 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
1204 ok(state
== INSTALLSTATE_NOTUSED
, "Expected INSTALLSTATE_NOTUSED, got %d\n", state
);
1206 res
= RegSetValueExA(compkey
, prod_squashed
, 0, REG_SZ
, (const BYTE
*)"hi", 2);
1207 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
1209 state
= MAGIC_ERROR
;
1210 r
= pMsiQueryComponentStateA(prodcode
, NULL
, MSIINSTALLCONTEXT_USERUNMANAGED
, component
, &state
);
1211 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
1212 ok(state
== INSTALLSTATE_LOCAL
, "Expected INSTALLSTATE_LOCAL, got %d\n", state
);
1214 /* MSIINSTALLCONTEXT_USERMANAGED */
1216 state
= MAGIC_ERROR
;
1217 r
= pMsiQueryComponentStateA(prodcode
, NULL
, MSIINSTALLCONTEXT_USERMANAGED
, component
, &state
);
1218 ok(r
== ERROR_UNKNOWN_PRODUCT
, "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r
);
1219 ok(state
== MAGIC_ERROR
, "Expected 0xdeadbeef, got %d\n", state
);
1221 lstrcpyA(keypath
, "Software\\Microsoft\\Installer\\Products\\");
1222 lstrcatA(keypath
, prod_squashed
);
1224 res
= RegCreateKeyA(HKEY_CURRENT_USER
, keypath
, &prodkey
);
1225 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
1227 state
= MAGIC_ERROR
;
1228 r
= pMsiQueryComponentStateA(prodcode
, NULL
, MSIINSTALLCONTEXT_USERMANAGED
, component
, &state
);
1229 ok(r
== ERROR_UNKNOWN_PRODUCT
, "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r
);
1230 ok(state
== MAGIC_ERROR
, "Expected 0xdeadbeef, got %d\n", state
);
1232 RegDeleteKeyA(prodkey
, "");
1233 RegCloseKey(prodkey
);
1235 lstrcpyA(keypath
, "Software\\Microsoft\\Windows\\CurrentVersion\\Installer\\Managed\\");
1236 lstrcatA(keypath
, usersid
);
1237 lstrcatA(keypath
, "\\Installer\\Products\\");
1238 lstrcatA(keypath
, prod_squashed
);
1240 res
= RegCreateKeyA(HKEY_LOCAL_MACHINE
, keypath
, &prodkey
);
1241 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
1243 state
= MAGIC_ERROR
;
1244 r
= pMsiQueryComponentStateA(prodcode
, NULL
, MSIINSTALLCONTEXT_USERMANAGED
, component
, &state
);
1245 ok(r
== ERROR_UNKNOWN_COMPONENT
, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r
);
1246 ok(state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
1248 RegDeleteKeyA(prodkey
, "");
1249 RegCloseKey(prodkey
);
1251 lstrcpyA(keypath
, "Software\\Microsoft\\Windows\\CurrentVersion\\Installer\\UserData\\");
1252 lstrcatA(keypath
, usersid
);
1253 lstrcatA(keypath
, "\\Products\\");
1254 lstrcatA(keypath
, prod_squashed
);
1255 lstrcatA(keypath
, "\\InstallProperties");
1257 res
= RegOpenKeyA(HKEY_LOCAL_MACHINE
, keypath
, &prodkey
);
1258 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
1260 res
= RegSetValueExA(prodkey
, "ManagedLocalPackage", 0, REG_SZ
, (const BYTE
*)"msitest.msi", 11);
1261 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
1263 state
= MAGIC_ERROR
;
1264 r
= pMsiQueryComponentStateA(prodcode
, NULL
, MSIINSTALLCONTEXT_USERMANAGED
, component
, &state
);
1265 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
1266 ok(state
== INSTALLSTATE_LOCAL
, "Expected INSTALLSTATE_LOCAL, got %d\n", state
);
1268 RegDeleteValueA(prodkey
, "LocalPackage");
1269 RegDeleteValueA(prodkey
, "ManagedLocalPackage");
1270 RegDeleteKeyA(prodkey
, "");
1271 RegDeleteValueA(compkey
, prod_squashed
);
1272 RegDeleteKeyA(compkey
, "");
1273 RegCloseKey(prodkey
);
1274 RegCloseKey(compkey
);
1277 static void test_MsiGetComponentPath(void)
1279 HKEY compkey
, prodkey
, installprop
;
1280 CHAR prodcode
[MAX_PATH
];
1281 CHAR prod_squashed
[MAX_PATH
];
1282 CHAR component
[MAX_PATH
];
1283 CHAR comp_base85
[MAX_PATH
];
1284 CHAR comp_squashed
[MAX_PATH
];
1285 CHAR keypath
[MAX_PATH
];
1286 CHAR path
[MAX_PATH
];
1292 create_test_guid(prodcode
, prod_squashed
);
1293 compose_base85_guid(component
, comp_base85
, comp_squashed
);
1294 get_user_sid(&usersid
);
1296 /* NULL szProduct */
1298 state
= MsiGetComponentPathA(NULL
, component
, path
, &size
);
1299 ok(state
== INSTALLSTATE_INVALIDARG
, "Expected INSTALLSTATE_INVALIDARG, got %d\n", state
);
1300 ok(size
== MAX_PATH
, "Expected size to be unchanged, got %d\n", size
);
1302 /* NULL szComponent */
1304 state
= MsiGetComponentPathA(prodcode
, NULL
, path
, &size
);
1305 ok(state
== INSTALLSTATE_INVALIDARG
, "Expected INSTALLSTATE_INVALIDARG, got %d\n", state
);
1306 ok(size
== MAX_PATH
, "Expected size to be unchanged, got %d\n", size
);
1308 /* NULL lpPathBuf */
1310 state
= MsiGetComponentPathA(prodcode
, component
, NULL
, &size
);
1311 ok(state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
1312 ok(size
== MAX_PATH
, "Expected size to be unchanged, got %d\n", size
);
1316 state
= MsiGetComponentPathA(prodcode
, component
, path
, NULL
);
1317 ok(state
== INSTALLSTATE_INVALIDARG
, "Expected INSTALLSTATE_INVALIDARG, got %d\n", state
);
1318 ok(size
== MAX_PATH
, "Expected size to be unchanged, got %d\n", size
);
1320 /* all params valid */
1322 state
= MsiGetComponentPathA(prodcode
, component
, path
, &size
);
1323 ok(state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
1324 ok(size
== MAX_PATH
, "Expected size to be unchanged, got %d\n", size
);
1326 lstrcpyA(keypath
, "Software\\Microsoft\\Windows\\CurrentVersion\\");
1327 lstrcatA(keypath
, "Installer\\UserData\\S-1-5-18\\Components\\");
1328 lstrcatA(keypath
, comp_squashed
);
1330 res
= RegCreateKeyA(HKEY_LOCAL_MACHINE
, keypath
, &compkey
);
1331 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
1333 /* local system component key exists */
1335 state
= MsiGetComponentPathA(prodcode
, component
, path
, &size
);
1336 ok(state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
1337 ok(size
== MAX_PATH
, "Expected size to be unchanged, got %d\n", size
);
1339 res
= RegSetValueExA(compkey
, prod_squashed
, 0, REG_SZ
, (const BYTE
*)"C:\\imapath", 10);
1340 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
1342 /* product value exists */
1344 state
= MsiGetComponentPathA(prodcode
, component
, path
, &size
);
1345 ok(state
== INSTALLSTATE_ABSENT
, "Expected INSTALLSTATE_ABSENT, got %d\n", state
);
1346 ok(!lstrcmpA(path
, "C:\\imapath"), "Expected C:\\imapath, got %s\n", path
);
1347 ok(size
== 10, "Expected 10, got %d\n", size
);
1349 lstrcpyA(keypath
, "Software\\Microsoft\\Windows\\CurrentVersion\\");
1350 lstrcatA(keypath
, "Installer\\UserData\\S-1-5-18\\Products\\");
1351 lstrcatA(keypath
, prod_squashed
);
1352 lstrcatA(keypath
, "\\InstallProperties");
1354 res
= RegCreateKeyA(HKEY_LOCAL_MACHINE
, keypath
, &installprop
);
1355 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
1358 res
= RegSetValueExA(installprop
, "WindowsInstaller", 0, REG_DWORD
, (const BYTE
*)&val
, sizeof(DWORD
));
1359 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
1361 /* install properties key exists */
1363 state
= MsiGetComponentPathA(prodcode
, component
, path
, &size
);
1364 ok(state
== INSTALLSTATE_ABSENT
, "Expected INSTALLSTATE_ABSENT, got %d\n", state
);
1365 ok(!lstrcmpA(path
, "C:\\imapath"), "Expected C:\\imapath, got %s\n", path
);
1366 ok(size
== 10, "Expected 10, got %d\n", size
);
1368 create_file("C:\\imapath", "C:\\imapath", 11);
1372 state
= MsiGetComponentPathA(prodcode
, component
, path
, &size
);
1373 ok(state
== INSTALLSTATE_LOCAL
, "Expected INSTALLSTATE_LOCAL, got %d\n", state
);
1374 ok(!lstrcmpA(path
, "C:\\imapath"), "Expected C:\\imapath, got %s\n", path
);
1375 ok(size
== 10, "Expected 10, got %d\n", size
);
1377 RegDeleteValueA(compkey
, prod_squashed
);
1378 RegDeleteKeyA(compkey
, "");
1379 RegDeleteValueA(installprop
, "WindowsInstaller");
1380 RegDeleteKeyA(installprop
, "");
1381 RegCloseKey(compkey
);
1382 RegCloseKey(installprop
);
1383 DeleteFileA("C:\\imapath");
1385 lstrcpyA(keypath
, "Software\\Microsoft\\Windows\\CurrentVersion\\");
1386 lstrcatA(keypath
, "Installer\\UserData\\");
1387 lstrcatA(keypath
, usersid
);
1388 lstrcatA(keypath
, "\\Components\\");
1389 lstrcatA(keypath
, comp_squashed
);
1391 res
= RegCreateKeyA(HKEY_LOCAL_MACHINE
, keypath
, &compkey
);
1392 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
1394 /* user managed component key exists */
1396 state
= MsiGetComponentPathA(prodcode
, component
, path
, &size
);
1397 ok(state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
1398 ok(size
== MAX_PATH
, "Expected size to be unchanged, got %d\n", size
);
1400 res
= RegSetValueExA(compkey
, prod_squashed
, 0, REG_SZ
, (const BYTE
*)"C:\\imapath", 10);
1401 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
1403 /* product value exists */
1405 state
= MsiGetComponentPathA(prodcode
, component
, path
, &size
);
1406 ok(state
== INSTALLSTATE_ABSENT
, "Expected INSTALLSTATE_ABSENT, got %d\n", state
);
1407 ok(!lstrcmpA(path
, "C:\\imapath"), "Expected C:\\imapath, got %s\n", path
);
1408 ok(size
== 10, "Expected 10, got %d\n", size
);
1410 lstrcpyA(keypath
, "Software\\Microsoft\\Windows\\CurrentVersion\\");
1411 lstrcatA(keypath
, "Installer\\UserData\\S-1-5-18\\Products\\");
1412 lstrcatA(keypath
, prod_squashed
);
1413 lstrcatA(keypath
, "\\InstallProperties");
1415 res
= RegCreateKeyA(HKEY_LOCAL_MACHINE
, keypath
, &installprop
);
1416 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
1419 res
= RegSetValueExA(installprop
, "WindowsInstaller", 0, REG_DWORD
, (const BYTE
*)&val
, sizeof(DWORD
));
1420 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
1422 /* install properties key exists */
1424 state
= MsiGetComponentPathA(prodcode
, component
, path
, &size
);
1425 ok(state
== INSTALLSTATE_ABSENT
, "Expected INSTALLSTATE_ABSENT, got %d\n", state
);
1426 ok(!lstrcmpA(path
, "C:\\imapath"), "Expected C:\\imapath, got %s\n", path
);
1427 ok(size
== 10, "Expected 10, got %d\n", size
);
1429 create_file("C:\\imapath", "C:\\imapath", 11);
1433 state
= MsiGetComponentPathA(prodcode
, component
, path
, &size
);
1434 ok(state
== INSTALLSTATE_LOCAL
, "Expected INSTALLSTATE_LOCAL, got %d\n", state
);
1435 ok(!lstrcmpA(path
, "C:\\imapath"), "Expected C:\\imapath, got %s\n", path
);
1436 ok(size
== 10, "Expected 10, got %d\n", size
);
1438 RegDeleteValueA(compkey
, prod_squashed
);
1439 RegDeleteKeyA(compkey
, "");
1440 RegDeleteValueA(installprop
, "WindowsInstaller");
1441 RegDeleteKeyA(installprop
, "");
1442 RegCloseKey(compkey
);
1443 RegCloseKey(installprop
);
1444 DeleteFileA("C:\\imapath");
1446 lstrcpyA(keypath
, "Software\\Microsoft\\Windows\\CurrentVersion\\");
1447 lstrcatA(keypath
, "Installer\\Managed\\");
1448 lstrcatA(keypath
, usersid
);
1449 lstrcatA(keypath
, "\\Installer\\Products\\");
1450 lstrcatA(keypath
, prod_squashed
);
1452 res
= RegCreateKeyA(HKEY_LOCAL_MACHINE
, keypath
, &prodkey
);
1453 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
1455 /* user managed product key exists */
1457 state
= MsiGetComponentPathA(prodcode
, component
, path
, &size
);
1458 ok(state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
1459 ok(size
== MAX_PATH
, "Expected size to be unchanged, got %d\n", size
);
1461 lstrcpyA(keypath
, "Software\\Microsoft\\Windows\\CurrentVersion\\");
1462 lstrcatA(keypath
, "Installer\\UserData\\");
1463 lstrcatA(keypath
, usersid
);
1464 lstrcatA(keypath
, "\\Components\\");
1465 lstrcatA(keypath
, comp_squashed
);
1467 res
= RegCreateKeyA(HKEY_LOCAL_MACHINE
, keypath
, &compkey
);
1468 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
1470 /* user managed component key exists */
1472 state
= MsiGetComponentPathA(prodcode
, component
, path
, &size
);
1473 ok(state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
1474 ok(size
== MAX_PATH
, "Expected size to be unchanged, got %d\n", size
);
1476 res
= RegSetValueExA(compkey
, prod_squashed
, 0, REG_SZ
, (const BYTE
*)"C:\\imapath", 10);
1477 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
1479 /* product value exists */
1481 state
= MsiGetComponentPathA(prodcode
, component
, path
, &size
);
1482 ok(state
== INSTALLSTATE_ABSENT
, "Expected INSTALLSTATE_ABSENT, got %d\n", state
);
1483 ok(!lstrcmpA(path
, "C:\\imapath"), "Expected C:\\imapath, got %s\n", path
);
1484 ok(size
== 10, "Expected 10, got %d\n", size
);
1486 lstrcpyA(keypath
, "Software\\Microsoft\\Windows\\CurrentVersion\\");
1487 lstrcatA(keypath
, "Installer\\UserData\\S-1-5-18\\Products\\");
1488 lstrcatA(keypath
, prod_squashed
);
1489 lstrcatA(keypath
, "\\InstallProperties");
1491 res
= RegCreateKeyA(HKEY_LOCAL_MACHINE
, keypath
, &installprop
);
1492 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
1495 res
= RegSetValueExA(installprop
, "WindowsInstaller", 0, REG_DWORD
, (const BYTE
*)&val
, sizeof(DWORD
));
1496 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
1498 /* install properties key exists */
1500 state
= MsiGetComponentPathA(prodcode
, component
, path
, &size
);
1501 ok(state
== INSTALLSTATE_ABSENT
, "Expected INSTALLSTATE_ABSENT, got %d\n", state
);
1502 ok(!lstrcmpA(path
, "C:\\imapath"), "Expected C:\\imapath, got %s\n", path
);
1503 ok(size
== 10, "Expected 10, got %d\n", size
);
1505 create_file("C:\\imapath", "C:\\imapath", 11);
1509 state
= MsiGetComponentPathA(prodcode
, component
, path
, &size
);
1510 ok(state
== INSTALLSTATE_LOCAL
, "Expected INSTALLSTATE_LOCAL, got %d\n", state
);
1511 ok(!lstrcmpA(path
, "C:\\imapath"), "Expected C:\\imapath, got %s\n", path
);
1512 ok(size
== 10, "Expected 10, got %d\n", size
);
1514 RegDeleteValueA(compkey
, prod_squashed
);
1515 RegDeleteKeyA(prodkey
, "");
1516 RegDeleteKeyA(compkey
, "");
1517 RegDeleteValueA(installprop
, "WindowsInstaller");
1518 RegDeleteKeyA(installprop
, "");
1519 RegCloseKey(prodkey
);
1520 RegCloseKey(compkey
);
1521 RegCloseKey(installprop
);
1522 DeleteFileA("C:\\imapath");
1524 lstrcpyA(keypath
, "Software\\Microsoft\\Installer\\Products\\");
1525 lstrcatA(keypath
, prod_squashed
);
1527 res
= RegCreateKeyA(HKEY_CURRENT_USER
, keypath
, &prodkey
);
1528 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
1530 /* user unmanaged product key exists */
1532 state
= MsiGetComponentPathA(prodcode
, component
, path
, &size
);
1533 ok(state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
1534 ok(size
== MAX_PATH
, "Expected size to be unchanged, got %d\n", size
);
1536 lstrcpyA(keypath
, "Software\\Microsoft\\Windows\\CurrentVersion\\");
1537 lstrcatA(keypath
, "Installer\\UserData\\");
1538 lstrcatA(keypath
, usersid
);
1539 lstrcatA(keypath
, "\\Components\\");
1540 lstrcatA(keypath
, comp_squashed
);
1542 res
= RegCreateKeyA(HKEY_LOCAL_MACHINE
, keypath
, &compkey
);
1543 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
1545 /* user unmanaged component key exists */
1547 state
= MsiGetComponentPathA(prodcode
, component
, path
, &size
);
1548 ok(state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
1549 ok(size
== MAX_PATH
, "Expected size to be unchanged, got %d\n", size
);
1551 res
= RegSetValueExA(compkey
, prod_squashed
, 0, REG_SZ
, (const BYTE
*)"C:\\imapath", 10);
1552 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
1554 /* product value exists */
1556 state
= MsiGetComponentPathA(prodcode
, component
, path
, &size
);
1557 ok(state
== INSTALLSTATE_ABSENT
, "Expected INSTALLSTATE_ABSENT, got %d\n", state
);
1558 ok(!lstrcmpA(path
, "C:\\imapath"), "Expected C:\\imapath, got %s\n", path
);
1559 ok(size
== 10, "Expected 10, got %d\n", size
);
1561 create_file("C:\\imapath", "C:\\imapath", 11);
1565 state
= MsiGetComponentPathA(prodcode
, component
, path
, &size
);
1566 ok(state
== INSTALLSTATE_LOCAL
, "Expected INSTALLSTATE_LOCAL, got %d\n", state
);
1567 ok(!lstrcmpA(path
, "C:\\imapath"), "Expected C:\\imapath, got %s\n", path
);
1568 ok(size
== 10, "Expected 10, got %d\n", size
);
1570 RegDeleteValueA(compkey
, prod_squashed
);
1571 RegDeleteKeyA(prodkey
, "");
1572 RegDeleteKeyA(compkey
, "");
1573 RegCloseKey(prodkey
);
1574 RegCloseKey(compkey
);
1575 RegCloseKey(installprop
);
1576 DeleteFileA("C:\\imapath");
1578 lstrcpyA(keypath
, "Software\\Classes\\Installer\\Products\\");
1579 lstrcatA(keypath
, prod_squashed
);
1581 res
= RegCreateKeyA(HKEY_LOCAL_MACHINE
, keypath
, &prodkey
);
1582 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
1584 /* local classes product key exists */
1586 state
= MsiGetComponentPathA(prodcode
, component
, path
, &size
);
1587 ok(state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
1588 ok(size
== MAX_PATH
, "Expected size to be unchanged, got %d\n", size
);
1590 lstrcpyA(keypath
, "Software\\Microsoft\\Windows\\CurrentVersion\\");
1591 lstrcatA(keypath
, "Installer\\UserData\\S-1-5-18\\Components\\");
1592 lstrcatA(keypath
, comp_squashed
);
1594 res
= RegCreateKeyA(HKEY_LOCAL_MACHINE
, keypath
, &compkey
);
1595 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
1597 /* local user component key exists */
1599 state
= MsiGetComponentPathA(prodcode
, component
, path
, &size
);
1600 ok(state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
1601 ok(size
== MAX_PATH
, "Expected size to be unchanged, got %d\n", size
);
1603 res
= RegSetValueExA(compkey
, prod_squashed
, 0, REG_SZ
, (const BYTE
*)"C:\\imapath", 10);
1604 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
1606 /* product value exists */
1608 state
= MsiGetComponentPathA(prodcode
, component
, path
, &size
);
1609 ok(state
== INSTALLSTATE_ABSENT
, "Expected INSTALLSTATE_ABSENT, got %d\n", state
);
1610 ok(!lstrcmpA(path
, "C:\\imapath"), "Expected C:\\imapath, got %s\n", path
);
1611 ok(size
== 10, "Expected 10, got %d\n", size
);
1613 create_file("C:\\imapath", "C:\\imapath", 11);
1617 state
= MsiGetComponentPathA(prodcode
, component
, path
, &size
);
1618 ok(state
== INSTALLSTATE_LOCAL
, "Expected INSTALLSTATE_LOCAL, got %d\n", state
);
1619 ok(!lstrcmpA(path
, "C:\\imapath"), "Expected C:\\imapath, got %s\n", path
);
1620 ok(size
== 10, "Expected 10, got %d\n", size
);
1622 RegDeleteValueA(compkey
, prod_squashed
);
1623 RegDeleteKeyA(prodkey
, "");
1624 RegDeleteKeyA(compkey
, "");
1625 RegCloseKey(prodkey
);
1626 RegCloseKey(compkey
);
1627 DeleteFileA("C:\\imapath");
1630 static void test_MsiGetProductCode(void)
1632 HKEY compkey
, prodkey
;
1633 CHAR prodcode
[MAX_PATH
];
1634 CHAR prod_squashed
[MAX_PATH
];
1635 CHAR prodcode2
[MAX_PATH
];
1636 CHAR prod2_squashed
[MAX_PATH
];
1637 CHAR component
[MAX_PATH
];
1638 CHAR comp_base85
[MAX_PATH
];
1639 CHAR comp_squashed
[MAX_PATH
];
1640 CHAR keypath
[MAX_PATH
];
1641 CHAR product
[MAX_PATH
];
1646 create_test_guid(prodcode
, prod_squashed
);
1647 create_test_guid(prodcode2
, prod2_squashed
);
1648 compose_base85_guid(component
, comp_base85
, comp_squashed
);
1649 get_user_sid(&usersid
);
1651 /* szComponent is NULL */
1652 lstrcpyA(product
, "prod");
1653 r
= MsiGetProductCodeA(NULL
, product
);
1654 ok(r
== ERROR_INVALID_PARAMETER
, "Expected ERROR_INVALID_PARAMETER, got %d\n", r
);
1655 ok(!lstrcmpA(product
, "prod"), "Expected product to be unchanged, got %s\n", product
);
1657 /* szComponent is empty */
1658 lstrcpyA(product
, "prod");
1659 r
= MsiGetProductCodeA("", product
);
1660 ok(r
== ERROR_INVALID_PARAMETER
, "Expected ERROR_INVALID_PARAMETER, got %d\n", r
);
1661 ok(!lstrcmpA(product
, "prod"), "Expected product to be unchanged, got %s\n", product
);
1663 /* garbage szComponent */
1664 lstrcpyA(product
, "prod");
1665 r
= MsiGetProductCodeA("garbage", product
);
1666 ok(r
== ERROR_INVALID_PARAMETER
, "Expected ERROR_INVALID_PARAMETER, got %d\n", r
);
1667 ok(!lstrcmpA(product
, "prod"), "Expected product to be unchanged, got %s\n", product
);
1669 /* guid without brackets */
1670 lstrcpyA(product
, "prod");
1671 r
= MsiGetProductCodeA("6700E8CF-95AB-4D9C-BC2C-15840DEA7A5D", product
);
1672 ok(r
== ERROR_INVALID_PARAMETER
, "Expected ERROR_INVALID_PARAMETER, got %d\n", r
);
1673 ok(!lstrcmpA(product
, "prod"), "Expected product to be unchanged, got %s\n", product
);
1675 /* guid with brackets */
1676 lstrcpyA(product
, "prod");
1677 r
= MsiGetProductCodeA("{6700E8CF-95AB-4D9C-BC2C-15840DEA7A5D}", product
);
1678 ok(r
== ERROR_UNKNOWN_COMPONENT
, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r
);
1679 ok(!lstrcmpA(product
, "prod"), "Expected product to be unchanged, got %s\n", product
);
1681 /* same length as guid, but random */
1682 lstrcpyA(product
, "prod");
1683 r
= MsiGetProductCodeA("A938G02JF-2NF3N93-VN3-2NNF-3KGKALDNF93", product
);
1684 ok(r
== ERROR_INVALID_PARAMETER
, "Expected ERROR_INVALID_PARAMETER, got %d\n", r
);
1685 ok(!lstrcmpA(product
, "prod"), "Expected product to be unchanged, got %s\n", product
);
1687 /* all params correct, szComponent not published */
1688 lstrcpyA(product
, "prod");
1689 r
= MsiGetProductCodeA(component
, product
);
1690 ok(r
== ERROR_UNKNOWN_COMPONENT
, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r
);
1691 ok(!lstrcmpA(product
, "prod"), "Expected product to be unchanged, got %s\n", product
);
1693 lstrcpyA(keypath
, "Software\\Microsoft\\Windows\\CurrentVersion\\");
1694 lstrcatA(keypath
, "Installer\\UserData\\");
1695 lstrcatA(keypath
, usersid
);
1696 lstrcatA(keypath
, "\\Components\\");
1697 lstrcatA(keypath
, comp_squashed
);
1699 res
= RegCreateKeyA(HKEY_LOCAL_MACHINE
, keypath
, &compkey
);
1700 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
1702 /* user unmanaged component key exists */
1703 lstrcpyA(product
, "prod");
1704 r
= MsiGetProductCodeA(component
, product
);
1705 ok(r
== ERROR_UNKNOWN_COMPONENT
, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r
);
1706 ok(!lstrcmpA(product
, "prod"), "Expected product to be unchanged, got %s\n", product
);
1708 res
= RegSetValueExA(compkey
, prod_squashed
, 0, REG_SZ
, (const BYTE
*)"C:\\imapath", 10);
1709 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
1711 /* product value exists */
1712 lstrcpyA(product
, "prod");
1713 r
= MsiGetProductCodeA(component
, product
);
1714 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
1715 ok(!lstrcmpA(product
, prodcode
), "Expected %s, got %s\n", prodcode
, product
);
1717 res
= RegSetValueExA(compkey
, prod2_squashed
, 0, REG_SZ
, (const BYTE
*)"C:\\another", 10);
1718 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
1720 lstrcpyA(keypath
, "Software\\Microsoft\\Windows\\CurrentVersion\\");
1721 lstrcatA(keypath
, "Installer\\Managed\\");
1722 lstrcatA(keypath
, usersid
);
1723 lstrcatA(keypath
, "\\Installer\\Products\\");
1724 lstrcatA(keypath
, prod_squashed
);
1726 res
= RegCreateKeyA(HKEY_LOCAL_MACHINE
, keypath
, &prodkey
);
1727 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
1729 /* user managed product key of first product exists */
1730 lstrcpyA(product
, "prod");
1731 r
= MsiGetProductCodeA(component
, product
);
1732 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
1733 ok(!lstrcmpA(product
, prodcode
), "Expected %s, got %s\n", prodcode
, product
);
1735 RegDeleteKeyA(prodkey
, "");
1736 RegCloseKey(prodkey
);
1738 RegDeleteKeyA(prodkey
, "");
1739 RegCloseKey(prodkey
);
1741 lstrcpyA(keypath
, "Software\\Microsoft\\Installer\\Products\\");
1742 lstrcatA(keypath
, prod_squashed
);
1744 res
= RegCreateKeyA(HKEY_CURRENT_USER
, keypath
, &prodkey
);
1745 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
1747 /* user unmanaged product key exists */
1748 lstrcpyA(product
, "prod");
1749 r
= MsiGetProductCodeA(component
, product
);
1750 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
1751 ok(!lstrcmpA(product
, prodcode
), "Expected %s, got %s\n", prodcode
, product
);
1753 RegDeleteKeyA(prodkey
, "");
1754 RegCloseKey(prodkey
);
1756 lstrcpyA(keypath
, "Software\\Classes\\Installer\\Products\\");
1757 lstrcatA(keypath
, prod_squashed
);
1759 res
= RegCreateKeyA(HKEY_LOCAL_MACHINE
, keypath
, &prodkey
);
1760 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
1762 /* local classes product key exists */
1763 lstrcpyA(product
, "prod");
1764 r
= MsiGetProductCodeA(component
, product
);
1765 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
1766 ok(!lstrcmpA(product
, prodcode
), "Expected %s, got %s\n", prodcode
, product
);
1768 RegDeleteKeyA(prodkey
, "");
1769 RegCloseKey(prodkey
);
1771 lstrcpyA(keypath
, "Software\\Microsoft\\Windows\\CurrentVersion\\");
1772 lstrcatA(keypath
, "Installer\\Managed\\");
1773 lstrcatA(keypath
, usersid
);
1774 lstrcatA(keypath
, "\\Installer\\Products\\");
1775 lstrcatA(keypath
, prod2_squashed
);
1777 res
= RegCreateKeyA(HKEY_LOCAL_MACHINE
, keypath
, &prodkey
);
1778 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
1780 /* user managed product key of second product exists */
1781 lstrcpyA(product
, "prod");
1782 r
= MsiGetProductCodeA(component
, product
);
1783 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
1784 ok(!lstrcmpA(product
, prodcode2
), "Expected %s, got %s\n", prodcode2
, product
);
1786 RegDeleteKeyA(prodkey
, "");
1787 RegCloseKey(prodkey
);
1788 RegDeleteValueA(compkey
, prod_squashed
);
1789 RegDeleteValueA(compkey
, prod2_squashed
);
1790 RegDeleteKeyA(compkey
, "");
1791 RegCloseKey(compkey
);
1793 lstrcpyA(keypath
, "Software\\Microsoft\\Windows\\CurrentVersion\\");
1794 lstrcatA(keypath
, "Installer\\UserData\\S-1-5-18\\Components\\");
1795 lstrcatA(keypath
, comp_squashed
);
1797 res
= RegCreateKeyA(HKEY_LOCAL_MACHINE
, keypath
, &compkey
);
1798 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
1800 /* local user component key exists */
1801 lstrcpyA(product
, "prod");
1802 r
= MsiGetProductCodeA(component
, product
);
1803 ok(r
== ERROR_UNKNOWN_COMPONENT
, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r
);
1804 ok(!lstrcmpA(product
, "prod"), "Expected product to be unchanged, got %s\n", product
);
1806 res
= RegSetValueExA(compkey
, prod_squashed
, 0, REG_SZ
, (const BYTE
*)"C:\\imapath", 10);
1807 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
1809 /* product value exists */
1810 lstrcpyA(product
, "prod");
1811 r
= MsiGetProductCodeA(component
, product
);
1812 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
1813 ok(!lstrcmpA(product
, prodcode
), "Expected %s, got %s\n", prodcode
, product
);
1815 res
= RegSetValueExA(compkey
, prod2_squashed
, 0, REG_SZ
, (const BYTE
*)"C:\\another", 10);
1816 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
1818 lstrcpyA(keypath
, "Software\\Microsoft\\Windows\\CurrentVersion\\");
1819 lstrcatA(keypath
, "Installer\\Managed\\");
1820 lstrcatA(keypath
, usersid
);
1821 lstrcatA(keypath
, "\\Installer\\Products\\");
1822 lstrcatA(keypath
, prod_squashed
);
1824 res
= RegCreateKeyA(HKEY_LOCAL_MACHINE
, keypath
, &prodkey
);
1825 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
1827 /* user managed product key of first product exists */
1828 lstrcpyA(product
, "prod");
1829 r
= MsiGetProductCodeA(component
, product
);
1830 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
1831 ok(!lstrcmpA(product
, prodcode
), "Expected %s, got %s\n", prodcode
, product
);
1833 RegDeleteKeyA(prodkey
, "");
1834 RegCloseKey(prodkey
);
1836 lstrcpyA(keypath
, "Software\\Microsoft\\Installer\\Products\\");
1837 lstrcatA(keypath
, prod_squashed
);
1839 res
= RegCreateKeyA(HKEY_CURRENT_USER
, keypath
, &prodkey
);
1840 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
1842 /* user unmanaged product key exists */
1843 lstrcpyA(product
, "prod");
1844 r
= MsiGetProductCodeA(component
, product
);
1845 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
1846 ok(!lstrcmpA(product
, prodcode
), "Expected %s, got %s\n", prodcode
, product
);
1848 RegDeleteKeyA(prodkey
, "");
1849 RegCloseKey(prodkey
);
1851 lstrcpyA(keypath
, "Software\\Classes\\Installer\\Products\\");
1852 lstrcatA(keypath
, prod_squashed
);
1854 res
= RegCreateKeyA(HKEY_LOCAL_MACHINE
, keypath
, &prodkey
);
1855 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
1857 /* local classes product key exists */
1858 lstrcpyA(product
, "prod");
1859 r
= MsiGetProductCodeA(component
, product
);
1860 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
1861 ok(!lstrcmpA(product
, prodcode
), "Expected %s, got %s\n", prodcode
, product
);
1863 RegDeleteKeyA(prodkey
, "");
1864 RegCloseKey(prodkey
);
1866 lstrcpyA(keypath
, "Software\\Microsoft\\Windows\\CurrentVersion\\");
1867 lstrcatA(keypath
, "Installer\\Managed\\");
1868 lstrcatA(keypath
, usersid
);
1869 lstrcatA(keypath
, "\\Installer\\Products\\");
1870 lstrcatA(keypath
, prod2_squashed
);
1872 res
= RegCreateKeyA(HKEY_LOCAL_MACHINE
, keypath
, &prodkey
);
1873 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
1875 /* user managed product key of second product exists */
1876 lstrcpyA(product
, "prod");
1877 r
= MsiGetProductCodeA(component
, product
);
1878 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
1879 ok(!lstrcmpA(product
, prodcode2
), "Expected %s, got %s\n", prodcode2
, product
);
1881 RegDeleteKeyA(prodkey
, "");
1882 RegCloseKey(prodkey
);
1883 RegDeleteValueA(compkey
, prod_squashed
);
1884 RegDeleteValueA(compkey
, prod2_squashed
);
1885 RegDeleteKeyA(compkey
, "");
1886 RegCloseKey(compkey
);
1889 static void test_MsiEnumClients(void)
1892 CHAR prodcode
[MAX_PATH
];
1893 CHAR prod_squashed
[MAX_PATH
];
1894 CHAR prodcode2
[MAX_PATH
];
1895 CHAR prod2_squashed
[MAX_PATH
];
1896 CHAR component
[MAX_PATH
];
1897 CHAR comp_base85
[MAX_PATH
];
1898 CHAR comp_squashed
[MAX_PATH
];
1899 CHAR product
[MAX_PATH
];
1900 CHAR keypath
[MAX_PATH
];
1905 create_test_guid(prodcode
, prod_squashed
);
1906 create_test_guid(prodcode2
, prod2_squashed
);
1907 compose_base85_guid(component
, comp_base85
, comp_squashed
);
1908 get_user_sid(&usersid
);
1910 /* NULL szComponent */
1912 r
= MsiEnumClientsA(NULL
, 0, product
);
1913 ok(r
== ERROR_INVALID_PARAMETER
, "Expected ERROR_INVALID_PARAMETER, got %d\n", r
);
1914 ok(!lstrcmpA(product
, ""), "Expected product to be unchanged, got %s\n", product
);
1916 /* empty szComponent */
1918 r
= MsiEnumClientsA("", 0, product
);
1919 ok(r
== ERROR_INVALID_PARAMETER
, "Expected ERROR_INVALID_PARAMETER, got %d\n", r
);
1920 ok(!lstrcmpA(product
, ""), "Expected product to be unchanged, got %s\n", product
);
1922 /* NULL lpProductBuf */
1923 r
= MsiEnumClientsA(component
, 0, NULL
);
1924 ok(r
== ERROR_INVALID_PARAMETER
, "Expected ERROR_INVALID_PARAMETER, got %d\n", r
);
1926 /* all params correct, component missing */
1928 r
= MsiEnumClientsA(component
, 0, product
);
1929 ok(r
== ERROR_UNKNOWN_COMPONENT
, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r
);
1930 ok(!lstrcmpA(product
, ""), "Expected product to be unchanged, got %s\n", product
);
1932 lstrcpyA(keypath
, "Software\\Microsoft\\Windows\\CurrentVersion\\");
1933 lstrcatA(keypath
, "Installer\\UserData\\");
1934 lstrcatA(keypath
, usersid
);
1935 lstrcatA(keypath
, "\\Components\\");
1936 lstrcatA(keypath
, comp_squashed
);
1938 res
= RegCreateKeyA(HKEY_LOCAL_MACHINE
, keypath
, &compkey
);
1939 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
1941 /* user unmanaged component key exists */
1943 r
= MsiEnumClientsA(component
, 0, product
);
1944 ok(r
== ERROR_UNKNOWN_COMPONENT
, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r
);
1945 ok(!lstrcmpA(product
, ""), "Expected product to be unchanged, got %s\n", product
);
1947 /* index > 0, no products exist */
1949 r
= MsiEnumClientsA(component
, 1, product
);
1950 ok(r
== ERROR_INVALID_PARAMETER
, "Expected ERROR_INVALID_PARAMETER, got %d\n", r
);
1951 ok(!lstrcmpA(product
, ""), "Expected product to be unchanged, got %s\n", product
);
1953 res
= RegSetValueExA(compkey
, prod_squashed
, 0, REG_SZ
, (const BYTE
*)"C:\\imapath", 10);
1954 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
1956 /* product value exists */
1957 r
= MsiEnumClientsA(component
, 0, product
);
1958 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
1959 ok(!lstrcmpA(product
, prodcode
), "Expected %s, got %s\n", prodcode
, product
);
1961 /* try index 0 again */
1963 r
= MsiEnumClientsA(component
, 0, product
);
1964 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
1965 ok(!lstrcmpA(product
, prodcode
), "Expected %s, got %s\n", prodcode
, product
);
1967 /* try index 1, second product value does not exist */
1969 r
= MsiEnumClientsA(component
, 1, product
);
1970 ok(r
== ERROR_NO_MORE_ITEMS
, "Expected ERROR_NO_MORE_ITEMS, got %d\n", r
);
1971 ok(!lstrcmpA(product
, ""), "Expected product to be unchanged, got %s\n", product
);
1973 res
= RegSetValueExA(compkey
, prod2_squashed
, 0, REG_SZ
, (const BYTE
*)"C:\\another", 10);
1974 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
1976 /* try index 1, second product value does exist */
1978 r
= MsiEnumClientsA(component
, 1, product
);
1981 ok(r
== ERROR_INVALID_PARAMETER
, "Expected ERROR_INVALID_PARAMETER, got %d\n", r
);
1982 ok(!lstrcmpA(product
, ""), "Expected product to be unchanged, got %s\n", product
);
1985 /* start the enumeration over */
1987 r
= MsiEnumClientsA(component
, 0, product
);
1988 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
1989 ok(!lstrcmpA(product
, prodcode
) || !lstrcmpA(product
, prodcode2
),
1990 "Expected %s or %s, got %s\n", prodcode
, prodcode2
, product
);
1992 /* correctly query second product */
1994 r
= MsiEnumClientsA(component
, 1, product
);
1995 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
1996 ok(!lstrcmpA(product
, prodcode
) || !lstrcmpA(product
, prodcode2
),
1997 "Expected %s or %s, got %s\n", prodcode
, prodcode2
, product
);
1999 RegDeleteValueA(compkey
, prod_squashed
);
2000 RegDeleteValueA(compkey
, prod2_squashed
);
2001 RegDeleteKeyA(compkey
, "");
2002 RegCloseKey(compkey
);
2004 lstrcpyA(keypath
, "Software\\Microsoft\\Windows\\CurrentVersion\\");
2005 lstrcatA(keypath
, "Installer\\UserData\\S-1-5-18\\Components\\");
2006 lstrcatA(keypath
, comp_squashed
);
2008 res
= RegCreateKeyA(HKEY_LOCAL_MACHINE
, keypath
, &compkey
);
2009 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
2011 /* user local component key exists */
2013 r
= MsiEnumClientsA(component
, 0, product
);
2014 ok(r
== ERROR_UNKNOWN_COMPONENT
, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r
);
2015 ok(!lstrcmpA(product
, ""), "Expected product to be unchanged, got %s\n", product
);
2017 /* index > 0, no products exist */
2019 r
= MsiEnumClientsA(component
, 1, product
);
2020 ok(r
== ERROR_INVALID_PARAMETER
, "Expected ERROR_INVALID_PARAMETER, got %d\n", r
);
2021 ok(!lstrcmpA(product
, ""), "Expected product to be unchanged, got %s\n", product
);
2023 res
= RegSetValueExA(compkey
, prod_squashed
, 0, REG_SZ
, (const BYTE
*)"C:\\imapath", 10);
2024 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
2026 /* product value exists */
2028 r
= MsiEnumClientsA(component
, 0, product
);
2029 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
2030 ok(!lstrcmpA(product
, prodcode
), "Expected %s, got %s\n", prodcode
, product
);
2032 /* try index 0 again */
2034 r
= MsiEnumClientsA(component
, 0, product
);
2035 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
2037 /* try index 1, second product value does not exist */
2039 r
= MsiEnumClientsA(component
, 1, product
);
2040 ok(r
== ERROR_NO_MORE_ITEMS
, "Expected ERROR_NO_MORE_ITEMS, got %d\n", r
);
2041 ok(!lstrcmpA(product
, ""), "Expected product to be unchanged, got %s\n", product
);
2043 res
= RegSetValueExA(compkey
, prod2_squashed
, 0, REG_SZ
, (const BYTE
*)"C:\\another", 10);
2044 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
2046 /* try index 1, second product value does exist */
2048 r
= MsiEnumClientsA(component
, 1, product
);
2051 ok(r
== ERROR_INVALID_PARAMETER
, "Expected ERROR_INVALID_PARAMETER, got %d\n", r
);
2052 ok(!lstrcmpA(product
, ""), "Expected product to be unchanged, got %s\n", product
);
2055 /* start the enumeration over */
2057 r
= MsiEnumClientsA(component
, 0, product
);
2058 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
2059 ok(!lstrcmpA(product
, prodcode
) || !lstrcmpA(product
, prodcode2
),
2060 "Expected %s or %s, got %s\n", prodcode
, prodcode2
, product
);
2062 /* correctly query second product */
2064 r
= MsiEnumClientsA(component
, 1, product
);
2065 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
2066 ok(!lstrcmpA(product
, prodcode
) || !lstrcmpA(product
, prodcode2
),
2067 "Expected %s or %s, got %s\n", prodcode
, prodcode2
, product
);
2069 RegDeleteValueA(compkey
, prod_squashed
);
2070 RegDeleteValueA(compkey
, prod2_squashed
);
2071 RegDeleteKeyA(compkey
, "");
2072 RegCloseKey(compkey
);
2075 static void get_version_info(LPSTR path
, LPSTR
*vercheck
, LPDWORD verchecksz
,
2076 LPSTR
*langcheck
, LPDWORD langchecksz
)
2079 VS_FIXEDFILEINFO
*ffi
;
2080 DWORD size
= GetFileVersionInfoSizeA(path
, NULL
);
2083 version
= HeapAlloc(GetProcessHeap(), 0, size
);
2084 GetFileVersionInfoA(path
, 0, size
, version
);
2086 VerQueryValueA(version
, "\\", (LPVOID
*)&ffi
, &size
);
2087 *vercheck
= HeapAlloc(GetProcessHeap(), 0, MAX_PATH
);
2088 sprintf(*vercheck
, "%d.%d.%d.%d", HIWORD(ffi
->dwFileVersionMS
),
2089 LOWORD(ffi
->dwFileVersionMS
), HIWORD(ffi
->dwFileVersionLS
),
2090 LOWORD(ffi
->dwFileVersionLS
));
2091 *verchecksz
= lstrlenA(*vercheck
);
2093 VerQueryValue(version
, "\\VarFileInfo\\Translation", (void **)&lang
, &size
);
2094 *langcheck
= HeapAlloc(GetProcessHeap(), 0, MAX_PATH
);
2095 sprintf(*langcheck
, "%d", *lang
);
2096 *langchecksz
= lstrlenA(*langcheck
);
2098 HeapFree(GetProcessHeap(), 0, version
);
2101 static void test_MsiGetFileVersion(void)
2104 DWORD versz
, langsz
;
2105 char version
[MAX_PATH
];
2106 char lang
[MAX_PATH
];
2107 char path
[MAX_PATH
];
2108 LPSTR vercheck
, langcheck
;
2109 DWORD verchecksz
, langchecksz
;
2111 /* NULL szFilePath */
2114 lstrcpyA(version
, "version");
2115 lstrcpyA(lang
, "lang");
2116 r
= MsiGetFileVersionA(NULL
, version
, &versz
, lang
, &langsz
);
2117 ok(r
== ERROR_INVALID_PARAMETER
,
2118 "Expected ERROR_INVALID_PARAMETER, got %d\n", r
);
2119 ok(!lstrcmpA(version
, "version"),
2120 "Expected version to be unchanged, got %s\n", version
);
2121 ok(versz
== MAX_PATH
, "Expected %d, got %d\n", MAX_PATH
, versz
);
2122 ok(!lstrcmpA(lang
, "lang"),
2123 "Expected lang to be unchanged, got %s\n", lang
);
2124 ok(langsz
== MAX_PATH
, "Expected %d, got %d\n", MAX_PATH
, langsz
);
2126 /* empty szFilePath */
2129 lstrcpyA(version
, "version");
2130 lstrcpyA(lang
, "lang");
2131 r
= MsiGetFileVersionA("", version
, &versz
, lang
, &langsz
);
2132 ok(r
== ERROR_FILE_NOT_FOUND
,
2133 "Expected ERROR_FILE_NOT_FOUND, got %d\n", r
);
2134 ok(!lstrcmpA(version
, "version"),
2135 "Expected version to be unchanged, got %s\n", version
);
2136 ok(versz
== MAX_PATH
, "Expected %d, got %d\n", MAX_PATH
, versz
);
2137 ok(!lstrcmpA(lang
, "lang"),
2138 "Expected lang to be unchanged, got %s\n", lang
);
2139 ok(langsz
== MAX_PATH
, "Expected %d, got %d\n", MAX_PATH
, langsz
);
2141 /* nonexistent szFilePath */
2144 lstrcpyA(version
, "version");
2145 lstrcpyA(lang
, "lang");
2146 r
= MsiGetFileVersionA("nonexistent", version
, &versz
, lang
, &langsz
);
2147 ok(r
== ERROR_FILE_NOT_FOUND
,
2148 "Expected ERROR_FILE_NOT_FOUND, got %d\n", r
);
2149 ok(!lstrcmpA(version
, "version"),
2150 "Expected version to be unchanged, got %s\n", version
);
2151 ok(versz
== MAX_PATH
, "Expected %d, got %d\n", MAX_PATH
, versz
);
2152 ok(!lstrcmpA(lang
, "lang"),
2153 "Expected lang to be unchanged, got %s\n", lang
);
2154 ok(langsz
== MAX_PATH
, "Expected %d, got %d\n", MAX_PATH
, langsz
);
2156 /* nonexistent szFilePath, valid lpVersionBuf, NULL pcchVersionBuf */
2159 lstrcpyA(version
, "version");
2160 lstrcpyA(lang
, "lang");
2161 r
= MsiGetFileVersionA("nonexistent", version
, NULL
, lang
, &langsz
);
2162 ok(r
== ERROR_INVALID_PARAMETER
,
2163 "Expected ERROR_INVALID_PARAMETER, got %d\n", r
);
2164 ok(!lstrcmpA(version
, "version"),
2165 "Expected version to be unchanged, got %s\n", version
);
2166 ok(versz
== MAX_PATH
, "Expected %d, got %d\n", MAX_PATH
, versz
);
2167 ok(!lstrcmpA(lang
, "lang"),
2168 "Expected lang to be unchanged, got %s\n", lang
);
2169 ok(langsz
== MAX_PATH
, "Expected %d, got %d\n", MAX_PATH
, langsz
);
2171 /* nonexistent szFilePath, valid lpLangBuf, NULL pcchLangBuf */
2174 lstrcpyA(version
, "version");
2175 lstrcpyA(lang
, "lang");
2176 r
= MsiGetFileVersionA("nonexistent", version
, &versz
, lang
, NULL
);
2177 ok(r
== ERROR_INVALID_PARAMETER
,
2178 "Expected ERROR_INVALID_PARAMETER, got %d\n", r
);
2179 ok(!lstrcmpA(version
, "version"),
2180 "Expected version to be unchanged, got %s\n", version
);
2181 ok(versz
== MAX_PATH
, "Expected %d, got %d\n", MAX_PATH
, versz
);
2182 ok(!lstrcmpA(lang
, "lang"),
2183 "Expected lang to be unchanged, got %s\n", lang
);
2184 ok(langsz
== MAX_PATH
, "Expected %d, got %d\n", MAX_PATH
, langsz
);
2186 /* nonexistent szFilePath, valid lpVersionBuf, pcchVersionBuf is zero */
2189 lstrcpyA(version
, "version");
2190 lstrcpyA(lang
, "lang");
2191 r
= MsiGetFileVersionA("nonexistent", version
, &versz
, lang
, &langsz
);
2192 ok(r
== ERROR_FILE_NOT_FOUND
,
2193 "Expected ERROR_FILE_NOT_FOUND, got %d\n", r
);
2194 ok(!lstrcmpA(version
, "version"),
2195 "Expected version to be unchanged, got %s\n", version
);
2196 ok(versz
== 0, "Expected 0, got %d\n", versz
);
2197 ok(!lstrcmpA(lang
, "lang"),
2198 "Expected lang to be unchanged, got %s\n", lang
);
2199 ok(langsz
== MAX_PATH
, "Expected %d, got %d\n", MAX_PATH
, langsz
);
2201 /* nonexistent szFilePath, valid lpLangBuf, pcchLangBuf is zero */
2204 lstrcpyA(version
, "version");
2205 lstrcpyA(lang
, "lang");
2206 r
= MsiGetFileVersionA("nonexistent", version
, &versz
, lang
, &langsz
);
2207 ok(r
== ERROR_FILE_NOT_FOUND
,
2208 "Expected ERROR_FILE_NOT_FOUND, got %d\n", r
);
2209 ok(!lstrcmpA(version
, "version"),
2210 "Expected version to be unchanged, got %s\n", version
);
2211 ok(versz
== MAX_PATH
, "Expected %d, got %d\n", MAX_PATH
, versz
);
2212 ok(!lstrcmpA(lang
, "lang"),
2213 "Expected lang to be unchanged, got %s\n", lang
);
2214 ok(langsz
== 0, "Expected 0, got %d\n", langsz
);
2216 /* nonexistent szFilePath, rest NULL */
2217 r
= MsiGetFileVersionA("nonexistent", NULL
, NULL
, NULL
, NULL
);
2218 ok(r
== ERROR_FILE_NOT_FOUND
,
2219 "Expected ERROR_FILE_NOT_FOUND, got %d\n", r
);
2221 create_file("ver.txt", "ver.txt", 20);
2223 /* file exists, no version information */
2226 lstrcpyA(version
, "version");
2227 lstrcpyA(lang
, "lang");
2228 r
= MsiGetFileVersionA("ver.txt", version
, &versz
, lang
, &langsz
);
2229 ok(versz
== MAX_PATH
, "Expected %d, got %d\n", MAX_PATH
, versz
);
2230 ok(!lstrcmpA(version
, "version"),
2231 "Expected version to be unchanged, got %s\n", version
);
2232 ok(langsz
== MAX_PATH
, "Expected %d, got %d\n", MAX_PATH
, langsz
);
2233 ok(!lstrcmpA(lang
, "lang"),
2234 "Expected lang to be unchanged, got %s\n", lang
);
2235 ok(r
== ERROR_FILE_INVALID
,
2236 "Expected ERROR_FILE_INVALID, got %d\n", r
);
2238 DeleteFileA("ver.txt");
2240 /* relative path, has version information */
2243 lstrcpyA(version
, "version");
2244 lstrcpyA(lang
, "lang");
2245 r
= MsiGetFileVersionA("kernel32.dll", version
, &versz
, lang
, &langsz
);
2248 ok(r
== ERROR_FILE_NOT_FOUND
,
2249 "Expected ERROR_FILE_NOT_FOUND, got %d\n", r
);
2250 ok(!lstrcmpA(version
, "version"),
2251 "Expected version to be unchanged, got %s\n", version
);
2252 ok(versz
== MAX_PATH
, "Expected %d, got %d\n", MAX_PATH
, versz
);
2253 ok(!lstrcmpA(lang
, "lang"),
2254 "Expected lang to be unchanged, got %s\n", lang
);
2255 ok(langsz
== MAX_PATH
, "Expected %d, got %d\n", MAX_PATH
, langsz
);
2258 GetSystemDirectoryA(path
, MAX_PATH
);
2259 lstrcatA(path
, "\\kernel32.dll");
2261 get_version_info(path
, &vercheck
, &verchecksz
, &langcheck
, &langchecksz
);
2263 /* absolute path, has version information */
2266 lstrcpyA(version
, "version");
2267 lstrcpyA(lang
, "lang");
2268 r
= MsiGetFileVersionA(path
, version
, &versz
, lang
, &langsz
);
2269 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
2270 ok(versz
== verchecksz
, "Expected %d, got %d\n", verchecksz
, versz
);
2271 ok(!lstrcmpA(lang
, langcheck
), "Expected %s, got %s\n", langcheck
, lang
);
2272 ok(langsz
== langchecksz
, "Expected %d, got %d\n", langchecksz
, langsz
);
2273 ok(!lstrcmpA(version
, vercheck
),
2274 "Expected %s, got %s\n", vercheck
, version
);
2276 /* only check version */
2278 lstrcpyA(version
, "version");
2279 r
= MsiGetFileVersionA(path
, version
, &versz
, NULL
, NULL
);
2280 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
2281 ok(versz
== verchecksz
, "Expected %d, got %d\n", verchecksz
, versz
);
2282 ok(!lstrcmpA(version
, vercheck
),
2283 "Expected %s, got %s\n", vercheck
, version
);
2285 /* only check language */
2287 lstrcpyA(lang
, "lang");
2288 r
= MsiGetFileVersionA(path
, NULL
, NULL
, lang
, &langsz
);
2289 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
2290 ok(!lstrcmpA(lang
, langcheck
), "Expected %s, got %s\n", langcheck
, lang
);
2291 ok(langsz
== langchecksz
, "Expected %d, got %d\n", langchecksz
, langsz
);
2293 /* check neither version nor language */
2294 r
= MsiGetFileVersionA(path
, NULL
, NULL
, NULL
, NULL
);
2295 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
2297 /* get pcchVersionBuf */
2299 r
= MsiGetFileVersionA(path
, NULL
, &versz
, NULL
, NULL
);
2300 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
2301 ok(versz
== verchecksz
, "Expected %d, got %d\n", verchecksz
, versz
);
2303 /* get pcchLangBuf */
2305 r
= MsiGetFileVersionA(path
, NULL
, NULL
, NULL
, &langsz
);
2306 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
2307 ok(langsz
== langchecksz
, "Expected %d, got %d\n", langchecksz
, langsz
);
2309 /* pcchVersionBuf not big enough */
2311 lstrcpyA(version
, "version");
2312 r
= MsiGetFileVersionA(path
, version
, &versz
, NULL
, NULL
);
2313 ok(r
== ERROR_MORE_DATA
, "Expected ERROR_MORE_DATA, got %d\n", r
);
2314 ok(!strncmp(version
, vercheck
, 4),
2315 "Expected first 4 characters of %s, got %s\n", vercheck
, version
);
2316 ok(versz
== verchecksz
, "Expected %d, got %d\n", verchecksz
, versz
);
2318 /* pcchLangBuf not big enough */
2320 lstrcpyA(lang
, "lang");
2321 r
= MsiGetFileVersionA(path
, NULL
, NULL
, lang
, &langsz
);
2322 ok(r
== ERROR_MORE_DATA
, "Expected ERROR_MORE_DATA, got %d\n", r
);
2323 ok(!strncmp(lang
, langcheck
, 2),
2324 "Expected first character of %s, got %s\n", langcheck
, lang
);
2325 ok(langsz
== langchecksz
, "Expected %d, got %d\n", langchecksz
, langsz
);
2327 HeapFree(GetProcessHeap(), 0, vercheck
);
2328 HeapFree(GetProcessHeap(), 0, langcheck
);
2331 static void test_MsiGetProductInfo(void)
2335 HKEY propkey
, source
;
2336 HKEY prodkey
, localkey
;
2337 CHAR prodcode
[MAX_PATH
];
2338 CHAR prod_squashed
[MAX_PATH
];
2339 CHAR packcode
[MAX_PATH
];
2340 CHAR pack_squashed
[MAX_PATH
];
2342 CHAR keypath
[MAX_PATH
];
2346 create_test_guid(prodcode
, prod_squashed
);
2347 create_test_guid(packcode
, pack_squashed
);
2348 get_user_sid(&usersid
);
2350 /* NULL szProduct */
2352 lstrcpyA(buf
, "apple");
2353 r
= MsiGetProductInfoA(NULL
, INSTALLPROPERTY_HELPLINK
, buf
, &sz
);
2354 ok(r
== ERROR_INVALID_PARAMETER
,
2355 "Expected ERROR_INVALID_PARAMETER, got %d\n", r
);
2356 ok(!lstrcmpA(buf
, "apple"), "Expected buf to be unchanged, got %s\n", buf
);
2357 ok(sz
== MAX_PATH
, "Expected MAX_PATH, got %d\n", sz
);
2359 /* empty szProduct */
2361 lstrcpyA(buf
, "apple");
2362 r
= MsiGetProductInfoA("", INSTALLPROPERTY_HELPLINK
, buf
, &sz
);
2363 ok(r
== ERROR_INVALID_PARAMETER
,
2364 "Expected ERROR_INVALID_PARAMETER, got %d\n", r
);
2365 ok(!lstrcmpA(buf
, "apple"), "Expected buf to be unchanged, got %s\n", buf
);
2366 ok(sz
== MAX_PATH
, "Expected MAX_PATH, got %d\n", sz
);
2368 /* garbage szProduct */
2370 lstrcpyA(buf
, "apple");
2371 r
= MsiGetProductInfoA("garbage", INSTALLPROPERTY_HELPLINK
, buf
, &sz
);
2372 ok(r
== ERROR_INVALID_PARAMETER
,
2373 "Expected ERROR_INVALID_PARAMETER, got %d\n", r
);
2374 ok(!lstrcmpA(buf
, "apple"), "Expected buf to be unchanged, got %s\n", buf
);
2375 ok(sz
== MAX_PATH
, "Expected MAX_PATH, got %d\n", sz
);
2377 /* guid without brackets */
2379 lstrcpyA(buf
, "apple");
2380 r
= MsiGetProductInfoA("6700E8CF-95AB-4D9C-BC2C-15840DEA7A5D",
2381 INSTALLPROPERTY_HELPLINK
, buf
, &sz
);
2382 ok(r
== ERROR_INVALID_PARAMETER
,
2383 "Expected ERROR_INVALID_PARAMETER, got %d\n", r
);
2384 ok(!lstrcmpA(buf
, "apple"), "Expected buf to be unchanged, got %s\n", buf
);
2385 ok(sz
== MAX_PATH
, "Expected MAX_PATH, got %d\n", sz
);
2387 /* guid with brackets */
2389 lstrcpyA(buf
, "apple");
2390 r
= MsiGetProductInfoA("{6700E8CF-95AB-4D9C-BC2C-15840DEA7A5D}",
2391 INSTALLPROPERTY_HELPLINK
, buf
, &sz
);
2392 ok(r
== ERROR_UNKNOWN_PRODUCT
,
2393 "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r
);
2394 ok(!lstrcmpA(buf
, "apple"), "Expected buf to be unchanged, got %s\n", buf
);
2395 ok(sz
== MAX_PATH
, "Expected MAX_PATH, got %d\n", sz
);
2397 /* same length as guid, but random */
2399 lstrcpyA(buf
, "apple");
2400 r
= MsiGetProductInfoA("A938G02JF-2NF3N93-VN3-2NNF-3KGKALDNF93",
2401 INSTALLPROPERTY_HELPLINK
, buf
, &sz
);
2402 ok(r
== ERROR_INVALID_PARAMETER
,
2403 "Expected ERROR_INVALID_PARAMETER, got %d\n", r
);
2404 ok(!lstrcmpA(buf
, "apple"), "Expected buf to be unchanged, got %s\n", buf
);
2405 ok(sz
== MAX_PATH
, "Expected MAX_PATH, got %d\n", sz
);
2407 /* not installed, NULL szAttribute */
2409 lstrcpyA(buf
, "apple");
2410 r
= MsiGetProductInfoA(prodcode
, NULL
, buf
, &sz
);
2411 ok(r
== ERROR_INVALID_PARAMETER
,
2412 "Expected ERROR_INVALID_PARAMETER, got %d\n", r
);
2413 ok(!lstrcmpA(buf
, "apple"), "Expected buf to be unchanged, got %s\n", buf
);
2414 ok(sz
== MAX_PATH
, "Expected MAX_PATH, got %d\n", sz
);
2416 /* not installed, NULL lpValueBuf */
2418 lstrcpyA(buf
, "apple");
2419 r
= MsiGetProductInfoA(prodcode
, INSTALLPROPERTY_HELPLINK
, NULL
, &sz
);
2420 ok(r
== ERROR_UNKNOWN_PRODUCT
,
2421 "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r
);
2422 ok(!lstrcmpA(buf
, "apple"), "Expected buf to be unchanged, got %s\n", buf
);
2423 ok(sz
== MAX_PATH
, "Expected MAX_PATH, got %d\n", sz
);
2425 /* not installed, NULL pcchValueBuf */
2427 lstrcpyA(buf
, "apple");
2428 r
= MsiGetProductInfoA(prodcode
, INSTALLPROPERTY_HELPLINK
, buf
, NULL
);
2429 ok(r
== ERROR_INVALID_PARAMETER
,
2430 "Expected ERROR_INVALID_PARAMETER, got %d\n", r
);
2431 ok(!lstrcmpA(buf
, "apple"), "Expected buf to be unchanged, got %s\n", buf
);
2432 ok(sz
== MAX_PATH
, "Expected MAX_PATH, got %d\n", sz
);
2434 /* created guid cannot possibly be an installed product code */
2436 lstrcpyA(buf
, "apple");
2437 r
= MsiGetProductInfoA(prodcode
, INSTALLPROPERTY_HELPLINK
, buf
, &sz
);
2438 ok(r
== ERROR_UNKNOWN_PRODUCT
,
2439 "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r
);
2440 ok(!lstrcmpA(buf
, "apple"), "Expected buf to be unchanged, got %s\n", buf
);
2441 ok(sz
== MAX_PATH
, "Expected MAX_PATH, got %d\n", sz
);
2443 lstrcpyA(keypath
, "Software\\Microsoft\\Windows\\CurrentVersion\\Installer\\Managed\\");
2444 lstrcatA(keypath
, usersid
);
2445 lstrcatA(keypath
, "\\Installer\\Products\\");
2446 lstrcatA(keypath
, prod_squashed
);
2448 res
= RegCreateKeyA(HKEY_LOCAL_MACHINE
, keypath
, &prodkey
);
2449 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
2451 /* managed product code exists */
2453 lstrcpyA(buf
, "apple");
2454 r
= MsiGetProductInfoA(prodcode
, INSTALLPROPERTY_HELPLINK
, buf
, &sz
);
2455 ok(r
== ERROR_UNKNOWN_PROPERTY
,
2456 "Expected ERROR_UNKNOWN_PROPERTY, got %d\n", r
);
2457 ok(!lstrcmpA(buf
, "apple"), "Expected buf to be unchanged, got %s\n", buf
);
2458 ok(sz
== MAX_PATH
, "Expected MAX_PATH, got %d\n", sz
);
2460 RegDeleteKeyA(prodkey
, "");
2461 RegCloseKey(prodkey
);
2463 lstrcpyA(keypath
, "Software\\Microsoft\\Windows\\CurrentVersion\\Installer\\UserData\\");
2464 lstrcatA(keypath
, usersid
);
2465 lstrcatA(keypath
, "\\Products\\");
2466 lstrcatA(keypath
, prod_squashed
);
2468 res
= RegCreateKeyA(HKEY_LOCAL_MACHINE
, keypath
, &localkey
);
2469 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
2471 /* local user product code exists */
2473 lstrcpyA(buf
, "apple");
2474 r
= MsiGetProductInfoA(prodcode
, INSTALLPROPERTY_HELPLINK
, buf
, &sz
);
2475 ok(r
== ERROR_UNKNOWN_PRODUCT
,
2476 "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r
);
2477 ok(!lstrcmpA(buf
, "apple"), "Expected buf to be unchanged, got %s\n", buf
);
2478 ok(sz
== MAX_PATH
, "Expected MAX_PATH, got %d\n", sz
);
2480 lstrcpyA(keypath
, "Software\\Microsoft\\Windows\\CurrentVersion\\Installer\\Managed\\");
2481 lstrcatA(keypath
, usersid
);
2482 lstrcatA(keypath
, "\\Installer\\Products\\");
2483 lstrcatA(keypath
, prod_squashed
);
2485 res
= RegCreateKeyA(HKEY_LOCAL_MACHINE
, keypath
, &prodkey
);
2486 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
2488 /* both local and managed product code exist */
2490 lstrcpyA(buf
, "apple");
2491 r
= MsiGetProductInfoA(prodcode
, INSTALLPROPERTY_HELPLINK
, buf
, &sz
);
2492 ok(r
== ERROR_UNKNOWN_PROPERTY
,
2493 "Expected ERROR_UNKNOWN_PROPERTY, got %d\n", r
);
2494 ok(!lstrcmpA(buf
, "apple"), "Expected buf to be unchanged, got %s\n", buf
);
2495 ok(sz
== MAX_PATH
, "Expected MAX_PATH, got %d\n", sz
);
2497 res
= RegCreateKeyA(localkey
, "InstallProperties", &propkey
);
2498 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
2500 /* InstallProperties key exists */
2502 lstrcpyA(buf
, "apple");
2503 r
= MsiGetProductInfoA(prodcode
, INSTALLPROPERTY_HELPLINK
, buf
, &sz
);
2504 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
2505 ok(!lstrcmpA(buf
, ""), "Expected \"\", got \"%s\"\n", buf
);
2506 ok(sz
== 0, "Expected 0, got %d\n", sz
);
2508 res
= RegSetValueExA(propkey
, "HelpLink", 0, REG_SZ
, (LPBYTE
)"link", 5);
2509 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
2511 /* HelpLink value exists */
2513 lstrcpyA(buf
, "apple");
2514 r
= MsiGetProductInfoA(prodcode
, INSTALLPROPERTY_HELPLINK
, buf
, &sz
);
2515 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
2516 ok(!lstrcmpA(buf
, "link"), "Expected \"link\", got \"%s\"\n", buf
);
2517 ok(sz
== 4, "Expected 4, got %d\n", sz
);
2519 /* pcchBuf is NULL */
2520 r
= MsiGetProductInfoA(prodcode
, INSTALLPROPERTY_HELPLINK
, NULL
, NULL
);
2521 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
2523 /* lpValueBuf is NULL */
2525 r
= MsiGetProductInfoA(prodcode
, INSTALLPROPERTY_HELPLINK
, NULL
, &sz
);
2526 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
2527 ok(sz
== 4, "Expected 4, got %d\n", sz
);
2529 /* lpValueBuf is NULL, pcchValueBuf is too small */
2531 r
= MsiGetProductInfoA(prodcode
, INSTALLPROPERTY_HELPLINK
, NULL
, &sz
);
2532 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
2533 ok(sz
== 4, "Expected 4, got %d\n", sz
);
2535 /* lpValueBuf is NULL, pcchValueBuf is too small */
2537 lstrcpyA(buf
, "apple");
2538 r
= MsiGetProductInfoA(prodcode
, INSTALLPROPERTY_HELPLINK
, buf
, &sz
);
2539 ok(!lstrcmpA(buf
, "apple"), "Expected buf to remain unchanged, got \"%s\"\n", buf
);
2540 ok(r
== ERROR_MORE_DATA
, "Expected ERROR_MORE_DATA, got %d\n", r
);
2541 ok(sz
== 4, "Expected 4, got %d\n", sz
);
2543 /* lpValueBuf is NULL, pcchValueBuf is exactly 4 */
2545 lstrcpyA(buf
, "apple");
2546 r
= MsiGetProductInfoA(prodcode
, INSTALLPROPERTY_HELPLINK
, buf
, &sz
);
2547 ok(r
== ERROR_MORE_DATA
, "Expected ERROR_MORE_DATA, got %d\n", r
);
2548 ok(!lstrcmpA(buf
, "apple"),
2549 "Expected buf to remain unchanged, got \"%s\"\n", buf
);
2550 ok(sz
== 4, "Expected 4, got %d\n", sz
);
2552 res
= RegSetValueExA(propkey
, "IMadeThis", 0, REG_SZ
, (LPBYTE
)"random", 7);
2553 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
2555 /* random property not supported by MSI, value exists */
2557 lstrcpyA(buf
, "apple");
2558 r
= MsiGetProductInfoA(prodcode
, "IMadeThis", buf
, &sz
);
2559 ok(r
== ERROR_UNKNOWN_PROPERTY
,
2560 "Expected ERROR_UNKNOWN_PROPERTY, got %d\n", r
);
2561 ok(!lstrcmpA(buf
, "apple"), "Expected \"apple\", got \"%s\"\n", buf
);
2562 ok(sz
== MAX_PATH
, "Expected MAX_PATH, got %d\n", sz
);
2564 RegDeleteValueA(propkey
, "IMadeThis");
2565 RegDeleteValueA(propkey
, "HelpLink");
2566 RegDeleteKeyA(propkey
, "");
2567 RegDeleteKeyA(localkey
, "");
2568 RegDeleteKeyA(prodkey
, "");
2569 RegCloseKey(propkey
);
2570 RegCloseKey(localkey
);
2571 RegCloseKey(prodkey
);
2573 lstrcpyA(keypath
, "Software\\Microsoft\\Installer\\Products\\");
2574 lstrcatA(keypath
, prod_squashed
);
2576 res
= RegCreateKeyA(HKEY_CURRENT_USER
, keypath
, &prodkey
);
2577 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
2579 /* user product key exists */
2581 lstrcpyA(buf
, "apple");
2582 r
= MsiGetProductInfoA(prodcode
, INSTALLPROPERTY_HELPLINK
, buf
, &sz
);
2583 ok(r
== ERROR_UNKNOWN_PROPERTY
,
2584 "Expected ERROR_UNKNOWN_PROPERTY, got %d\n", r
);
2585 ok(!lstrcmpA(buf
, "apple"), "Expected \"apple\", got \"%s\"\n", buf
);
2586 ok(sz
== MAX_PATH
, "Expected MAX_PATH, got %d\n", sz
);
2588 lstrcpyA(keypath
, "Software\\Microsoft\\Windows\\CurrentVersion\\Installer\\UserData\\");
2589 lstrcatA(keypath
, usersid
);
2590 lstrcatA(keypath
, "\\Products\\");
2591 lstrcatA(keypath
, prod_squashed
);
2593 res
= RegCreateKeyA(HKEY_LOCAL_MACHINE
, keypath
, &localkey
);
2594 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
2596 /* local user product key exists */
2598 lstrcpyA(buf
, "apple");
2599 r
= MsiGetProductInfoA(prodcode
, INSTALLPROPERTY_HELPLINK
, buf
, &sz
);
2600 ok(r
== ERROR_UNKNOWN_PROPERTY
,
2601 "Expected ERROR_UNKNOWN_PROPERTY, got %d\n", r
);
2602 ok(!lstrcmpA(buf
, "apple"), "Expected \"apple\", got \"%s\"\n", buf
);
2603 ok(sz
== MAX_PATH
, "Expected MAX_PATH, got %d\n", sz
);
2605 res
= RegCreateKeyA(localkey
, "InstallProperties", &propkey
);
2606 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
2608 /* InstallProperties key exists */
2610 lstrcpyA(buf
, "apple");
2611 r
= MsiGetProductInfoA(prodcode
, INSTALLPROPERTY_HELPLINK
, buf
, &sz
);
2612 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
2613 ok(!lstrcmpA(buf
, ""), "Expected \"\", got \"%s\"\n", buf
);
2614 ok(sz
== 0, "Expected 0, got %d\n", sz
);
2616 res
= RegSetValueExA(propkey
, "HelpLink", 0, REG_SZ
, (LPBYTE
)"link", 5);
2617 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
2619 /* HelpLink value exists */
2621 lstrcpyA(buf
, "apple");
2622 r
= MsiGetProductInfoA(prodcode
, INSTALLPROPERTY_HELPLINK
, buf
, &sz
);
2623 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
2624 ok(!lstrcmpA(buf
, "link"), "Expected \"link\", got \"%s\"\n", buf
);
2625 ok(sz
== 4, "Expected 4, got %d\n", sz
);
2627 RegDeleteValueA(propkey
, "HelpLink");
2628 RegDeleteKeyA(propkey
, "");
2629 RegDeleteKeyA(localkey
, "");
2630 RegDeleteKeyA(prodkey
, "");
2631 RegCloseKey(propkey
);
2632 RegCloseKey(localkey
);
2633 RegCloseKey(prodkey
);
2635 lstrcpyA(keypath
, "Software\\Classes\\Installer\\Products\\");
2636 lstrcatA(keypath
, prod_squashed
);
2638 res
= RegCreateKeyA(HKEY_LOCAL_MACHINE
, keypath
, &prodkey
);
2639 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
2641 /* classes product key exists */
2643 lstrcpyA(buf
, "apple");
2644 r
= MsiGetProductInfoA(prodcode
, INSTALLPROPERTY_HELPLINK
, buf
, &sz
);
2645 ok(r
== ERROR_UNKNOWN_PROPERTY
,
2646 "Expected ERROR_UNKNOWN_PROPERTY, got %d\n", r
);
2647 ok(!lstrcmpA(buf
, "apple"), "Expected \"apple\", got \"%s\"\n", buf
);
2648 ok(sz
== MAX_PATH
, "Expected MAX_PATH, got %d\n", sz
);
2650 lstrcpyA(keypath
, "Software\\Microsoft\\Windows\\CurrentVersion\\Installer\\UserData\\");
2651 lstrcatA(keypath
, usersid
);
2652 lstrcatA(keypath
, "\\Products\\");
2653 lstrcatA(keypath
, prod_squashed
);
2655 res
= RegCreateKeyA(HKEY_LOCAL_MACHINE
, keypath
, &localkey
);
2656 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
2658 /* local user product key exists */
2660 lstrcpyA(buf
, "apple");
2661 r
= MsiGetProductInfoA(prodcode
, INSTALLPROPERTY_HELPLINK
, buf
, &sz
);
2662 ok(r
== ERROR_UNKNOWN_PROPERTY
,
2663 "Expected ERROR_UNKNOWN_PROPERTY, got %d\n", r
);
2664 ok(!lstrcmpA(buf
, "apple"), "Expected \"apple\", got \"%s\"\n", buf
);
2665 ok(sz
== MAX_PATH
, "Expected MAX_PATH, got %d\n", sz
);
2667 res
= RegCreateKeyA(localkey
, "InstallProperties", &propkey
);
2668 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
2670 /* InstallProperties key exists */
2672 lstrcpyA(buf
, "apple");
2673 r
= MsiGetProductInfoA(prodcode
, INSTALLPROPERTY_HELPLINK
, buf
, &sz
);
2674 ok(r
== ERROR_UNKNOWN_PROPERTY
,
2675 "Expected ERROR_UNKNOWN_PROPERTY, got %d\n", r
);
2676 ok(!lstrcmpA(buf
, "apple"), "Expected \"apple\", got \"%s\"\n", buf
);
2677 ok(sz
== MAX_PATH
, "Expected MAX_PATH, got %d\n", sz
);
2679 RegDeleteKeyA(propkey
, "");
2680 RegDeleteKeyA(localkey
, "");
2681 RegCloseKey(propkey
);
2682 RegCloseKey(localkey
);
2684 lstrcpyA(keypath
, "Software\\Microsoft\\Windows\\CurrentVersion\\Installer\\UserData\\");
2685 lstrcatA(keypath
, "S-1-5-18\\\\Products\\");
2686 lstrcatA(keypath
, prod_squashed
);
2688 res
= RegCreateKeyA(HKEY_LOCAL_MACHINE
, keypath
, &localkey
);
2689 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
2691 /* Local System product key exists */
2693 lstrcpyA(buf
, "apple");
2694 r
= MsiGetProductInfoA(prodcode
, INSTALLPROPERTY_HELPLINK
, buf
, &sz
);
2695 ok(r
== ERROR_UNKNOWN_PROPERTY
,
2696 "Expected ERROR_UNKNOWN_PROPERTY, got %d\n", r
);
2697 ok(!lstrcmpA(buf
, "apple"), "Expected \"apple\", got \"%s\"\n", buf
);
2698 ok(sz
== MAX_PATH
, "Expected MAX_PATH, got %d\n", sz
);
2700 res
= RegCreateKeyA(localkey
, "InstallProperties", &propkey
);
2701 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
2703 /* InstallProperties key exists */
2705 lstrcpyA(buf
, "apple");
2706 r
= MsiGetProductInfoA(prodcode
, INSTALLPROPERTY_HELPLINK
, buf
, &sz
);
2707 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
2708 ok(!lstrcmpA(buf
, ""), "Expected \"\", got \"%s\"\n", buf
);
2709 ok(sz
== 0, "Expected 0, got %d\n", sz
);
2711 res
= RegSetValueExA(propkey
, "HelpLink", 0, REG_SZ
, (LPBYTE
)"link", 5);
2712 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
2714 /* HelpLink value exists */
2716 lstrcpyA(buf
, "apple");
2717 r
= MsiGetProductInfoA(prodcode
, INSTALLPROPERTY_HELPLINK
, buf
, &sz
);
2718 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
2719 ok(!lstrcmpA(buf
, "link"), "Expected \"link\", got \"%s\"\n", buf
);
2720 ok(sz
== 4, "Expected 4, got %d\n", sz
);
2722 res
= RegSetValueExA(propkey
, "HelpLink", 0, REG_DWORD
,
2723 (const BYTE
*)&val
, sizeof(DWORD
));
2724 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
2726 /* HelpLink type is REG_DWORD */
2728 lstrcpyA(buf
, "apple");
2729 r
= MsiGetProductInfoA(prodcode
, INSTALLPROPERTY_HELPLINK
, buf
, &sz
);
2730 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
2731 ok(!lstrcmpA(buf
, "42"), "Expected \"42\", got \"%s\"\n", buf
);
2732 ok(sz
== 2, "Expected 2, got %d\n", sz
);
2734 res
= RegSetValueExA(propkey
, "DisplayName", 0, REG_SZ
, (LPBYTE
)"name", 5);
2735 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
2737 /* DisplayName value exists */
2739 lstrcpyA(buf
, "apple");
2740 r
= MsiGetProductInfoA(prodcode
, INSTALLPROPERTY_INSTALLEDPRODUCTNAME
, buf
, &sz
);
2741 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
2742 ok(!lstrcmpA(buf
, "name"), "Expected \"name\", got \"%s\"\n", buf
);
2743 ok(sz
== 4, "Expected 4, got %d\n", sz
);
2745 res
= RegSetValueExA(propkey
, "DisplayName", 0, REG_DWORD
,
2746 (const BYTE
*)&val
, sizeof(DWORD
));
2747 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
2749 /* DisplayName type is REG_DWORD */
2751 lstrcpyA(buf
, "apple");
2752 r
= MsiGetProductInfoA(prodcode
, INSTALLPROPERTY_INSTALLEDPRODUCTNAME
, buf
, &sz
);
2753 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
2754 ok(!lstrcmpA(buf
, "42"), "Expected \"42\", got \"%s\"\n", buf
);
2755 ok(sz
== 2, "Expected 2, got %d\n", sz
);
2757 res
= RegSetValueExA(propkey
, "DisplayVersion", 0, REG_SZ
, (LPBYTE
)"1.1.1", 6);
2758 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
2760 /* DisplayVersion value exists */
2762 lstrcpyA(buf
, "apple");
2763 r
= MsiGetProductInfoA(prodcode
, INSTALLPROPERTY_VERSIONSTRING
, buf
, &sz
);
2764 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
2765 ok(!lstrcmpA(buf
, "1.1.1"), "Expected \"1.1.1\", got \"%s\"\n", buf
);
2766 ok(sz
== 5, "Expected 5, got %d\n", sz
);
2768 res
= RegSetValueExA(propkey
, "DisplayVersion", 0,
2769 REG_DWORD
, (const BYTE
*)&val
, sizeof(DWORD
));
2770 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
2772 /* DisplayVersion type is REG_DWORD */
2774 lstrcpyA(buf
, "apple");
2775 r
= MsiGetProductInfoA(prodcode
, INSTALLPROPERTY_VERSIONSTRING
, buf
, &sz
);
2776 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
2777 ok(!lstrcmpA(buf
, "42"), "Expected \"42\", got \"%s\"\n", buf
);
2778 ok(sz
== 2, "Expected 2, got %d\n", sz
);
2780 res
= RegSetValueExA(propkey
, "HelpTelephone", 0, REG_SZ
, (LPBYTE
)"tele", 5);
2781 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
2783 /* HelpTelephone value exists */
2785 lstrcpyA(buf
, "apple");
2786 r
= MsiGetProductInfoA(prodcode
, INSTALLPROPERTY_HELPTELEPHONE
, buf
, &sz
);
2787 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
2788 ok(!lstrcmpA(buf
, "tele"), "Expected \"tele\", got \"%s\"\n", buf
);
2789 ok(sz
== 4, "Expected 4, got %d\n", sz
);
2791 res
= RegSetValueExA(propkey
, "HelpTelephone", 0, REG_DWORD
,
2792 (const BYTE
*)&val
, sizeof(DWORD
));
2793 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
2795 /* HelpTelephone type is REG_DWORD */
2797 lstrcpyA(buf
, "apple");
2798 r
= MsiGetProductInfoA(prodcode
, INSTALLPROPERTY_HELPTELEPHONE
, buf
, &sz
);
2799 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
2800 ok(!lstrcmpA(buf
, "42"), "Expected \"42\", got \"%s\"\n", buf
);
2801 ok(sz
== 2, "Expected 2, got %d\n", sz
);
2803 res
= RegSetValueExA(propkey
, "InstallLocation", 0, REG_SZ
, (LPBYTE
)"loc", 4);
2804 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
2806 /* InstallLocation value exists */
2808 lstrcpyA(buf
, "apple");
2809 r
= MsiGetProductInfoA(prodcode
, INSTALLPROPERTY_INSTALLLOCATION
, buf
, &sz
);
2810 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
2811 ok(!lstrcmpA(buf
, "loc"), "Expected \"loc\", got \"%s\"\n", buf
);
2812 ok(sz
== 3, "Expected 3, got %d\n", sz
);
2814 res
= RegSetValueExA(propkey
, "InstallLocation", 0, REG_DWORD
,
2815 (const BYTE
*)&val
, sizeof(DWORD
));
2816 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
2818 /* InstallLocation type is REG_DWORD */
2820 lstrcpyA(buf
, "apple");
2821 r
= MsiGetProductInfoA(prodcode
, INSTALLPROPERTY_INSTALLLOCATION
, buf
, &sz
);
2822 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
2823 ok(!lstrcmpA(buf
, "42"), "Expected \"42\", got \"%s\"\n", buf
);
2824 ok(sz
== 2, "Expected 2, got %d\n", sz
);
2826 res
= RegSetValueExA(propkey
, "InstallSource", 0, REG_SZ
, (LPBYTE
)"source", 7);
2827 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
2829 /* InstallSource value exists */
2831 lstrcpyA(buf
, "apple");
2832 r
= MsiGetProductInfoA(prodcode
, INSTALLPROPERTY_INSTALLSOURCE
, buf
, &sz
);
2833 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
2834 ok(!lstrcmpA(buf
, "source"), "Expected \"source\", got \"%s\"\n", buf
);
2835 ok(sz
== 6, "Expected 6, got %d\n", sz
);
2837 res
= RegSetValueExA(propkey
, "InstallSource", 0, REG_DWORD
,
2838 (const BYTE
*)&val
, sizeof(DWORD
));
2839 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
2841 /* InstallSource type is REG_DWORD */
2843 lstrcpyA(buf
, "apple");
2844 r
= MsiGetProductInfoA(prodcode
, INSTALLPROPERTY_INSTALLSOURCE
, buf
, &sz
);
2845 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
2846 ok(!lstrcmpA(buf
, "42"), "Expected \"42\", got \"%s\"\n", buf
);
2847 ok(sz
== 2, "Expected 2, got %d\n", sz
);
2849 res
= RegSetValueExA(propkey
, "InstallDate", 0, REG_SZ
, (LPBYTE
)"date", 5);
2850 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
2852 /* InstallDate value exists */
2854 lstrcpyA(buf
, "apple");
2855 r
= MsiGetProductInfoA(prodcode
, INSTALLPROPERTY_INSTALLDATE
, buf
, &sz
);
2856 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
2857 ok(!lstrcmpA(buf
, "date"), "Expected \"date\", got \"%s\"\n", buf
);
2858 ok(sz
== 4, "Expected 4, got %d\n", sz
);
2860 res
= RegSetValueExA(propkey
, "InstallDate", 0, REG_DWORD
,
2861 (const BYTE
*)&val
, sizeof(DWORD
));
2862 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
2864 /* InstallDate type is REG_DWORD */
2866 lstrcpyA(buf
, "apple");
2867 r
= MsiGetProductInfoA(prodcode
, INSTALLPROPERTY_INSTALLDATE
, buf
, &sz
);
2868 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
2869 ok(!lstrcmpA(buf
, "42"), "Expected \"42\", got \"%s\"\n", buf
);
2870 ok(sz
== 2, "Expected 2, got %d\n", sz
);
2872 res
= RegSetValueExA(propkey
, "Publisher", 0, REG_SZ
, (LPBYTE
)"pub", 4);
2873 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
2875 /* Publisher value exists */
2877 lstrcpyA(buf
, "apple");
2878 r
= MsiGetProductInfoA(prodcode
, INSTALLPROPERTY_PUBLISHER
, buf
, &sz
);
2879 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
2880 ok(!lstrcmpA(buf
, "pub"), "Expected \"pub\", got \"%s\"\n", buf
);
2881 ok(sz
== 3, "Expected 3, got %d\n", sz
);
2883 res
= RegSetValueExA(propkey
, "Publisher", 0, REG_DWORD
,
2884 (const BYTE
*)&val
, sizeof(DWORD
));
2885 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
2887 /* Publisher type is REG_DWORD */
2889 lstrcpyA(buf
, "apple");
2890 r
= MsiGetProductInfoA(prodcode
, INSTALLPROPERTY_PUBLISHER
, buf
, &sz
);
2891 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
2892 ok(!lstrcmpA(buf
, "42"), "Expected \"42\", got \"%s\"\n", buf
);
2893 ok(sz
== 2, "Expected 2, got %d\n", sz
);
2895 res
= RegSetValueExA(propkey
, "LocalPackage", 0, REG_SZ
, (LPBYTE
)"pack", 5);
2896 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
2898 /* LocalPackage value exists */
2900 lstrcpyA(buf
, "apple");
2901 r
= MsiGetProductInfoA(prodcode
, INSTALLPROPERTY_LOCALPACKAGE
, buf
, &sz
);
2902 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
2903 ok(!lstrcmpA(buf
, "pack"), "Expected \"pack\", got \"%s\"\n", buf
);
2904 ok(sz
== 4, "Expected 4, got %d\n", sz
);
2906 res
= RegSetValueExA(propkey
, "LocalPackage", 0, REG_DWORD
,
2907 (const BYTE
*)&val
, sizeof(DWORD
));
2908 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
2910 /* LocalPackage type is REG_DWORD */
2912 lstrcpyA(buf
, "apple");
2913 r
= MsiGetProductInfoA(prodcode
, INSTALLPROPERTY_LOCALPACKAGE
, buf
, &sz
);
2914 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
2915 ok(!lstrcmpA(buf
, "42"), "Expected \"42\", got \"%s\"\n", buf
);
2916 ok(sz
== 2, "Expected 2, got %d\n", sz
);
2918 res
= RegSetValueExA(propkey
, "UrlInfoAbout", 0, REG_SZ
, (LPBYTE
)"about", 6);
2919 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
2921 /* UrlInfoAbout value exists */
2923 lstrcpyA(buf
, "apple");
2924 r
= MsiGetProductInfoA(prodcode
, INSTALLPROPERTY_URLINFOABOUT
, buf
, &sz
);
2925 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
2926 ok(!lstrcmpA(buf
, "about"), "Expected \"about\", got \"%s\"\n", buf
);
2927 ok(sz
== 5, "Expected 5, got %d\n", sz
);
2929 res
= RegSetValueExA(propkey
, "UrlInfoAbout", 0, REG_DWORD
,
2930 (const BYTE
*)&val
, sizeof(DWORD
));
2931 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
2933 /* UrlInfoAbout type is REG_DWORD */
2935 lstrcpyA(buf
, "apple");
2936 r
= MsiGetProductInfoA(prodcode
, INSTALLPROPERTY_URLINFOABOUT
, buf
, &sz
);
2937 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
2938 ok(!lstrcmpA(buf
, "42"), "Expected \"42\", got \"%s\"\n", buf
);
2939 ok(sz
== 2, "Expected 2, got %d\n", sz
);
2941 res
= RegSetValueExA(propkey
, "UrlUpdateInfo", 0, REG_SZ
, (LPBYTE
)"info", 5);
2942 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
2944 /* UrlUpdateInfo value exists */
2946 lstrcpyA(buf
, "apple");
2947 r
= MsiGetProductInfoA(prodcode
, INSTALLPROPERTY_URLUPDATEINFO
, buf
, &sz
);
2948 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
2949 ok(!lstrcmpA(buf
, "info"), "Expected \"info\", got \"%s\"\n", buf
);
2950 ok(sz
== 4, "Expected 4, got %d\n", sz
);
2952 res
= RegSetValueExA(propkey
, "UrlUpdateInfo", 0, REG_DWORD
,
2953 (const BYTE
*)&val
, sizeof(DWORD
));
2954 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
2956 /* UrlUpdateInfo type is REG_DWORD */
2958 lstrcpyA(buf
, "apple");
2959 r
= MsiGetProductInfoA(prodcode
, INSTALLPROPERTY_URLUPDATEINFO
, buf
, &sz
);
2960 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
2961 ok(!lstrcmpA(buf
, "42"), "Expected \"42\", got \"%s\"\n", buf
);
2962 ok(sz
== 2, "Expected 2, got %d\n", sz
);
2964 res
= RegSetValueExA(propkey
, "VersionMinor", 0, REG_SZ
, (LPBYTE
)"1", 2);
2965 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
2967 /* VersionMinor value exists */
2969 lstrcpyA(buf
, "apple");
2970 r
= MsiGetProductInfoA(prodcode
, INSTALLPROPERTY_VERSIONMINOR
, buf
, &sz
);
2971 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
2972 ok(!lstrcmpA(buf
, "1"), "Expected \"1\", got \"%s\"\n", buf
);
2973 ok(sz
== 1, "Expected 1, got %d\n", sz
);
2975 res
= RegSetValueExA(propkey
, "VersionMinor", 0, REG_DWORD
,
2976 (const BYTE
*)&val
, sizeof(DWORD
));
2977 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
2979 /* VersionMinor type is REG_DWORD */
2981 lstrcpyA(buf
, "apple");
2982 r
= MsiGetProductInfoA(prodcode
, INSTALLPROPERTY_VERSIONMINOR
, buf
, &sz
);
2983 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
2984 ok(!lstrcmpA(buf
, "42"), "Expected \"42\", got \"%s\"\n", buf
);
2985 ok(sz
== 2, "Expected 2, got %d\n", sz
);
2987 res
= RegSetValueExA(propkey
, "VersionMajor", 0, REG_SZ
, (LPBYTE
)"1", 2);
2988 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
2990 /* VersionMajor value exists */
2992 lstrcpyA(buf
, "apple");
2993 r
= MsiGetProductInfoA(prodcode
, INSTALLPROPERTY_VERSIONMAJOR
, buf
, &sz
);
2994 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
2995 ok(!lstrcmpA(buf
, "1"), "Expected \"1\", got \"%s\"\n", buf
);
2996 ok(sz
== 1, "Expected 1, got %d\n", sz
);
2998 res
= RegSetValueExA(propkey
, "VersionMajor", 0, REG_DWORD
,
2999 (const BYTE
*)&val
, sizeof(DWORD
));
3000 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
3002 /* VersionMajor type is REG_DWORD */
3004 lstrcpyA(buf
, "apple");
3005 r
= MsiGetProductInfoA(prodcode
, INSTALLPROPERTY_VERSIONMAJOR
, buf
, &sz
);
3006 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3007 ok(!lstrcmpA(buf
, "42"), "Expected \"42\", got \"%s\"\n", buf
);
3008 ok(sz
== 2, "Expected 2, got %d\n", sz
);
3010 res
= RegSetValueExA(propkey
, "ProductID", 0, REG_SZ
, (LPBYTE
)"id", 3);
3011 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
3013 /* ProductID value exists */
3015 lstrcpyA(buf
, "apple");
3016 r
= MsiGetProductInfoA(prodcode
, INSTALLPROPERTY_PRODUCTID
, buf
, &sz
);
3017 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3018 ok(!lstrcmpA(buf
, "id"), "Expected \"id\", got \"%s\"\n", buf
);
3019 ok(sz
== 2, "Expected 2, got %d\n", sz
);
3021 res
= RegSetValueExA(propkey
, "ProductID", 0, REG_DWORD
,
3022 (const BYTE
*)&val
, sizeof(DWORD
));
3023 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
3025 /* ProductID type is REG_DWORD */
3027 lstrcpyA(buf
, "apple");
3028 r
= MsiGetProductInfoA(prodcode
, INSTALLPROPERTY_PRODUCTID
, buf
, &sz
);
3029 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3030 ok(!lstrcmpA(buf
, "42"), "Expected \"42\", got \"%s\"\n", buf
);
3031 ok(sz
== 2, "Expected 2, got %d\n", sz
);
3033 res
= RegSetValueExA(propkey
, "RegCompany", 0, REG_SZ
, (LPBYTE
)"comp", 5);
3034 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
3036 /* RegCompany value exists */
3038 lstrcpyA(buf
, "apple");
3039 r
= MsiGetProductInfoA(prodcode
, INSTALLPROPERTY_REGCOMPANY
, buf
, &sz
);
3040 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3041 ok(!lstrcmpA(buf
, "comp"), "Expected \"comp\", got \"%s\"\n", buf
);
3042 ok(sz
== 4, "Expected 4, got %d\n", sz
);
3044 res
= RegSetValueExA(propkey
, "RegCompany", 0, REG_DWORD
,
3045 (const BYTE
*)&val
, sizeof(DWORD
));
3046 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
3048 /* RegCompany type is REG_DWORD */
3050 lstrcpyA(buf
, "apple");
3051 r
= MsiGetProductInfoA(prodcode
, INSTALLPROPERTY_REGCOMPANY
, buf
, &sz
);
3052 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3053 ok(!lstrcmpA(buf
, "42"), "Expected \"42\", got \"%s\"\n", buf
);
3054 ok(sz
== 2, "Expected 2, got %d\n", sz
);
3056 res
= RegSetValueExA(propkey
, "RegOwner", 0, REG_SZ
, (LPBYTE
)"own", 4);
3057 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
3059 /* RegOwner value exists */
3061 lstrcpyA(buf
, "apple");
3062 r
= MsiGetProductInfoA(prodcode
, INSTALLPROPERTY_REGOWNER
, buf
, &sz
);
3063 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3064 ok(!lstrcmpA(buf
, "own"), "Expected \"own\", got \"%s\"\n", buf
);
3065 ok(sz
== 3, "Expected 3, got %d\n", sz
);
3067 res
= RegSetValueExA(propkey
, "RegOwner", 0, REG_DWORD
,
3068 (const BYTE
*)&val
, sizeof(DWORD
));
3069 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
3071 /* RegOwner type is REG_DWORD */
3073 lstrcpyA(buf
, "apple");
3074 r
= MsiGetProductInfoA(prodcode
, INSTALLPROPERTY_REGOWNER
, buf
, &sz
);
3075 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3076 ok(!lstrcmpA(buf
, "42"), "Expected \"42\", got \"%s\"\n", buf
);
3077 ok(sz
== 2, "Expected 2, got %d\n", sz
);
3079 res
= RegSetValueExA(propkey
, "InstanceType", 0, REG_SZ
, (LPBYTE
)"type", 5);
3080 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
3082 /* InstanceType value exists */
3084 lstrcpyA(buf
, "apple");
3085 r
= MsiGetProductInfoA(prodcode
, INSTALLPROPERTY_INSTANCETYPE
, buf
, &sz
);
3086 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3087 ok(!lstrcmpA(buf
, ""), "Expected \"\", got \"%s\"\n", buf
);
3088 ok(sz
== 0, "Expected 0, got %d\n", sz
);
3090 res
= RegSetValueExA(propkey
, "InstanceType", 0, REG_DWORD
,
3091 (const BYTE
*)&val
, sizeof(DWORD
));
3092 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
3094 /* InstanceType type is REG_DWORD */
3096 lstrcpyA(buf
, "apple");
3097 r
= MsiGetProductInfoA(prodcode
, INSTALLPROPERTY_INSTANCETYPE
, buf
, &sz
);
3098 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3099 ok(!lstrcmpA(buf
, ""), "Expected \"\", got \"%s\"\n", buf
);
3100 ok(sz
== 0, "Expected 0, got %d\n", sz
);
3102 res
= RegSetValueExA(prodkey
, "InstanceType", 0, REG_SZ
, (LPBYTE
)"type", 5);
3103 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
3105 /* InstanceType value exists */
3107 lstrcpyA(buf
, "apple");
3108 r
= MsiGetProductInfoA(prodcode
, INSTALLPROPERTY_INSTANCETYPE
, buf
, &sz
);
3109 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3110 ok(!lstrcmpA(buf
, "type"), "Expected \"type\", got \"%s\"\n", buf
);
3111 ok(sz
== 4, "Expected 4, got %d\n", sz
);
3113 res
= RegSetValueExA(prodkey
, "InstanceType", 0, REG_DWORD
,
3114 (const BYTE
*)&val
, sizeof(DWORD
));
3115 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
3117 /* InstanceType type is REG_DWORD */
3119 lstrcpyA(buf
, "apple");
3120 r
= MsiGetProductInfoA(prodcode
, INSTALLPROPERTY_INSTANCETYPE
, buf
, &sz
);
3121 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3122 ok(!lstrcmpA(buf
, "42"), "Expected \"42\", got \"%s\"\n", buf
);
3123 ok(sz
== 2, "Expected 2, got %d\n", sz
);
3125 res
= RegSetValueExA(propkey
, "Transforms", 0, REG_SZ
, (LPBYTE
)"tforms", 7);
3126 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
3128 /* Transforms value exists */
3130 lstrcpyA(buf
, "apple");
3131 r
= MsiGetProductInfoA(prodcode
, INSTALLPROPERTY_TRANSFORMS
, buf
, &sz
);
3132 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3133 ok(!lstrcmpA(buf
, ""), "Expected \"\", got \"%s\"\n", buf
);
3134 ok(sz
== 0, "Expected 0, got %d\n", sz
);
3136 res
= RegSetValueExA(propkey
, "Transforms", 0, REG_DWORD
,
3137 (const BYTE
*)&val
, sizeof(DWORD
));
3138 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
3140 /* Transforms type is REG_DWORD */
3142 lstrcpyA(buf
, "apple");
3143 r
= MsiGetProductInfoA(prodcode
, INSTALLPROPERTY_TRANSFORMS
, buf
, &sz
);
3144 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3145 ok(!lstrcmpA(buf
, ""), "Expected \"\", got \"%s\"\n", buf
);
3146 ok(sz
== 0, "Expected 0, got %d\n", sz
);
3148 res
= RegSetValueExA(prodkey
, "Transforms", 0, REG_SZ
, (LPBYTE
)"tforms", 7);
3149 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
3151 /* Transforms value exists */
3153 lstrcpyA(buf
, "apple");
3154 r
= MsiGetProductInfoA(prodcode
, INSTALLPROPERTY_TRANSFORMS
, buf
, &sz
);
3155 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3156 ok(!lstrcmpA(buf
, "tforms"), "Expected \"tforms\", got \"%s\"\n", buf
);
3157 ok(sz
== 6, "Expected 6, got %d\n", sz
);
3159 res
= RegSetValueExA(prodkey
, "Transforms", 0, REG_DWORD
,
3160 (const BYTE
*)&val
, sizeof(DWORD
));
3161 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
3163 /* Transforms type is REG_DWORD */
3165 lstrcpyA(buf
, "apple");
3166 r
= MsiGetProductInfoA(prodcode
, INSTALLPROPERTY_TRANSFORMS
, buf
, &sz
);
3167 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3168 ok(!lstrcmpA(buf
, "42"), "Expected \"42\", got \"%s\"\n", buf
);
3169 ok(sz
== 2, "Expected 2, got %d\n", sz
);
3171 res
= RegSetValueExA(propkey
, "Language", 0, REG_SZ
, (LPBYTE
)"lang", 5);
3172 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
3174 /* Language value exists */
3176 lstrcpyA(buf
, "apple");
3177 r
= MsiGetProductInfoA(prodcode
, INSTALLPROPERTY_LANGUAGE
, buf
, &sz
);
3178 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3179 ok(!lstrcmpA(buf
, ""), "Expected \"\", got \"%s\"\n", buf
);
3180 ok(sz
== 0, "Expected 0, got %d\n", sz
);
3182 res
= RegSetValueExA(propkey
, "Language", 0, REG_DWORD
,
3183 (const BYTE
*)&val
, sizeof(DWORD
));
3184 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
3186 /* Language type is REG_DWORD */
3188 lstrcpyA(buf
, "apple");
3189 r
= MsiGetProductInfoA(prodcode
, INSTALLPROPERTY_LANGUAGE
, buf
, &sz
);
3190 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3191 ok(!lstrcmpA(buf
, ""), "Expected \"\", got \"%s\"\n", buf
);
3192 ok(sz
== 0, "Expected 0, got %d\n", sz
);
3194 res
= RegSetValueExA(prodkey
, "Language", 0, REG_SZ
, (LPBYTE
)"lang", 5);
3195 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
3197 /* Language value exists */
3199 lstrcpyA(buf
, "apple");
3200 r
= MsiGetProductInfoA(prodcode
, INSTALLPROPERTY_LANGUAGE
, buf
, &sz
);
3201 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3202 ok(!lstrcmpA(buf
, "lang"), "Expected \"lang\", got \"%s\"\n", buf
);
3203 ok(sz
== 4, "Expected 4, got %d\n", sz
);
3205 res
= RegSetValueExA(prodkey
, "Language", 0, REG_DWORD
,
3206 (const BYTE
*)&val
, sizeof(DWORD
));
3207 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
3209 /* Language type is REG_DWORD */
3211 lstrcpyA(buf
, "apple");
3212 r
= MsiGetProductInfoA(prodcode
, INSTALLPROPERTY_LANGUAGE
, buf
, &sz
);
3213 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3214 ok(!lstrcmpA(buf
, "42"), "Expected \"42\", got \"%s\"\n", buf
);
3215 ok(sz
== 2, "Expected 2, got %d\n", sz
);
3217 res
= RegSetValueExA(propkey
, "ProductName", 0, REG_SZ
, (LPBYTE
)"name", 5);
3218 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
3220 /* ProductName value exists */
3222 lstrcpyA(buf
, "apple");
3223 r
= MsiGetProductInfoA(prodcode
, INSTALLPROPERTY_PRODUCTNAME
, buf
, &sz
);
3224 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3225 ok(!lstrcmpA(buf
, ""), "Expected \"\", got \"%s\"\n", buf
);
3226 ok(sz
== 0, "Expected 0, got %d\n", sz
);
3228 res
= RegSetValueExA(propkey
, "ProductName", 0, REG_DWORD
,
3229 (const BYTE
*)&val
, sizeof(DWORD
));
3230 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
3232 /* ProductName type is REG_DWORD */
3234 lstrcpyA(buf
, "apple");
3235 r
= MsiGetProductInfoA(prodcode
, INSTALLPROPERTY_PRODUCTNAME
, buf
, &sz
);
3236 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3237 ok(!lstrcmpA(buf
, ""), "Expected \"\", got \"%s\"\n", buf
);
3238 ok(sz
== 0, "Expected 0, got %d\n", sz
);
3240 res
= RegSetValueExA(prodkey
, "ProductName", 0, REG_SZ
, (LPBYTE
)"name", 5);
3241 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
3243 /* ProductName value exists */
3245 lstrcpyA(buf
, "apple");
3246 r
= MsiGetProductInfoA(prodcode
, INSTALLPROPERTY_PRODUCTNAME
, buf
, &sz
);
3247 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3248 ok(!lstrcmpA(buf
, "name"), "Expected \"name\", got \"%s\"\n", buf
);
3249 ok(sz
== 4, "Expected 4, got %d\n", sz
);
3251 res
= RegSetValueExA(prodkey
, "ProductName", 0, REG_DWORD
,
3252 (const BYTE
*)&val
, sizeof(DWORD
));
3253 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
3255 /* ProductName type is REG_DWORD */
3257 lstrcpyA(buf
, "apple");
3258 r
= MsiGetProductInfoA(prodcode
, INSTALLPROPERTY_PRODUCTNAME
, buf
, &sz
);
3259 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3260 ok(!lstrcmpA(buf
, "42"), "Expected \"42\", got \"%s\"\n", buf
);
3261 ok(sz
== 2, "Expected 2, got %d\n", sz
);
3263 res
= RegSetValueExA(propkey
, "Assignment", 0, REG_SZ
, (LPBYTE
)"at", 3);
3264 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
3266 /* Assignment value exists */
3268 lstrcpyA(buf
, "apple");
3269 r
= MsiGetProductInfoA(prodcode
, INSTALLPROPERTY_ASSIGNMENTTYPE
, buf
, &sz
);
3270 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3271 ok(!lstrcmpA(buf
, ""), "Expected \"\", got \"%s\"\n", buf
);
3272 ok(sz
== 0, "Expected 0, got %d\n", sz
);
3274 res
= RegSetValueExA(propkey
, "Assignment", 0, REG_DWORD
,
3275 (const BYTE
*)&val
, sizeof(DWORD
));
3276 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
3278 /* Assignment type is REG_DWORD */
3280 lstrcpyA(buf
, "apple");
3281 r
= MsiGetProductInfoA(prodcode
, INSTALLPROPERTY_ASSIGNMENTTYPE
, buf
, &sz
);
3282 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3283 ok(!lstrcmpA(buf
, ""), "Expected \"\", got \"%s\"\n", buf
);
3284 ok(sz
== 0, "Expected 0, got %d\n", sz
);
3286 res
= RegSetValueExA(prodkey
, "Assignment", 0, REG_SZ
, (LPBYTE
)"at", 3);
3287 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
3289 /* Assignment value exists */
3291 lstrcpyA(buf
, "apple");
3292 r
= MsiGetProductInfoA(prodcode
, INSTALLPROPERTY_ASSIGNMENTTYPE
, buf
, &sz
);
3293 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3294 ok(!lstrcmpA(buf
, "at"), "Expected \"at\", got \"%s\"\n", buf
);
3295 ok(sz
== 2, "Expected 2, got %d\n", sz
);
3297 res
= RegSetValueExA(prodkey
, "Assignment", 0, REG_DWORD
,
3298 (const BYTE
*)&val
, sizeof(DWORD
));
3299 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
3301 /* Assignment type is REG_DWORD */
3303 lstrcpyA(buf
, "apple");
3304 r
= MsiGetProductInfoA(prodcode
, INSTALLPROPERTY_ASSIGNMENTTYPE
, buf
, &sz
);
3305 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3306 ok(!lstrcmpA(buf
, "42"), "Expected \"42\", got \"%s\"\n", buf
);
3307 ok(sz
== 2, "Expected 2, got %d\n", sz
);
3309 res
= RegSetValueExA(propkey
, "PackageCode", 0, REG_SZ
, (LPBYTE
)"code", 5);
3310 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
3312 /* PackageCode value exists */
3314 lstrcpyA(buf
, "apple");
3315 r
= MsiGetProductInfoA(prodcode
, INSTALLPROPERTY_PACKAGECODE
, buf
, &sz
);
3316 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3317 ok(!lstrcmpA(buf
, ""), "Expected \"\", got \"%s\"\n", buf
);
3318 ok(sz
== 0, "Expected 0, got %d\n", sz
);
3320 res
= RegSetValueExA(propkey
, "PackageCode", 0, REG_DWORD
,
3321 (const BYTE
*)&val
, sizeof(DWORD
));
3322 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
3324 /* PackageCode type is REG_DWORD */
3326 lstrcpyA(buf
, "apple");
3327 r
= MsiGetProductInfoA(prodcode
, INSTALLPROPERTY_PACKAGECODE
, buf
, &sz
);
3328 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3329 ok(!lstrcmpA(buf
, ""), "Expected \"\", got \"%s\"\n", buf
);
3330 ok(sz
== 0, "Expected 0, got %d\n", sz
);
3332 res
= RegSetValueExA(prodkey
, "PackageCode", 0, REG_SZ
, (LPBYTE
)"code", 5);
3333 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
3335 /* PackageCode value exists */
3337 lstrcpyA(buf
, "apple");
3338 r
= MsiGetProductInfoA(prodcode
, INSTALLPROPERTY_PACKAGECODE
, buf
, &sz
);
3339 ok(r
== ERROR_BAD_CONFIGURATION
,
3340 "Expected ERROR_BAD_CONFIGURATION, got %d\n", r
);
3341 ok(!lstrcmpA(buf
, "code"), "Expected \"code\", got \"%s\"\n", buf
);
3342 ok(sz
== MAX_PATH
, "Expected MAX_PATH, got %d\n", sz
);
3344 res
= RegSetValueExA(prodkey
, "PackageCode", 0, REG_DWORD
,
3345 (const BYTE
*)&val
, sizeof(DWORD
));
3346 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
3348 /* PackageCode type is REG_DWORD */
3350 lstrcpyA(buf
, "apple");
3351 r
= MsiGetProductInfoA(prodcode
, INSTALLPROPERTY_PACKAGECODE
, buf
, &sz
);
3352 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3353 ok(!lstrcmpA(buf
, "42"), "Expected \"42\", got \"%s\"\n", buf
);
3354 ok(sz
== 2, "Expected 2, got %d\n", sz
);
3356 res
= RegSetValueExA(prodkey
, "PackageCode", 0, REG_SZ
, (LPBYTE
)pack_squashed
, 33);
3357 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
3359 /* PackageCode value exists */
3361 lstrcpyA(buf
, "apple");
3362 r
= MsiGetProductInfoA(prodcode
, INSTALLPROPERTY_PACKAGECODE
, buf
, &sz
);
3363 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3364 ok(!lstrcmpA(buf
, packcode
), "Expected \"%s\", got \"%s\"\n", packcode
, buf
);
3365 ok(sz
== 38, "Expected 38, got %d\n", sz
);
3367 res
= RegSetValueExA(propkey
, "Version", 0, REG_SZ
, (LPBYTE
)"ver", 4);
3368 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
3370 /* Version value exists */
3372 lstrcpyA(buf
, "apple");
3373 r
= MsiGetProductInfoA(prodcode
, INSTALLPROPERTY_VERSION
, buf
, &sz
);
3374 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3375 ok(!lstrcmpA(buf
, ""), "Expected \"\", got \"%s\"\n", buf
);
3376 ok(sz
== 0, "Expected 0, got %d\n", sz
);
3378 res
= RegSetValueExA(propkey
, "Version", 0, REG_DWORD
,
3379 (const BYTE
*)&val
, sizeof(DWORD
));
3380 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
3382 /* Version type is REG_DWORD */
3384 lstrcpyA(buf
, "apple");
3385 r
= MsiGetProductInfoA(prodcode
, INSTALLPROPERTY_VERSION
, buf
, &sz
);
3386 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3387 ok(!lstrcmpA(buf
, ""), "Expected \"\", got \"%s\"\n", buf
);
3388 ok(sz
== 0, "Expected 0, got %d\n", sz
);
3390 res
= RegSetValueExA(prodkey
, "Version", 0, REG_SZ
, (LPBYTE
)"ver", 4);
3391 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
3393 /* Version value exists */
3395 lstrcpyA(buf
, "apple");
3396 r
= MsiGetProductInfoA(prodcode
, INSTALLPROPERTY_VERSION
, buf
, &sz
);
3397 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3398 ok(!lstrcmpA(buf
, "ver"), "Expected \"ver\", got \"%s\"\n", buf
);
3399 ok(sz
== 3, "Expected 3, got %d\n", sz
);
3401 res
= RegSetValueExA(prodkey
, "Version", 0, REG_DWORD
,
3402 (const BYTE
*)&val
, sizeof(DWORD
));
3403 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
3405 /* Version type is REG_DWORD */
3407 lstrcpyA(buf
, "apple");
3408 r
= MsiGetProductInfoA(prodcode
, INSTALLPROPERTY_VERSION
, buf
, &sz
);
3409 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3410 ok(!lstrcmpA(buf
, "42"), "Expected \"42\", got \"%s\"\n", buf
);
3411 ok(sz
== 2, "Expected 2, got %d\n", sz
);
3413 res
= RegSetValueExA(propkey
, "ProductIcon", 0, REG_SZ
, (LPBYTE
)"ico", 4);
3414 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
3416 /* ProductIcon value exists */
3418 lstrcpyA(buf
, "apple");
3419 r
= MsiGetProductInfoA(prodcode
, INSTALLPROPERTY_PRODUCTICON
, buf
, &sz
);
3420 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3421 ok(!lstrcmpA(buf
, ""), "Expected \"\", got \"%s\"\n", buf
);
3422 ok(sz
== 0, "Expected 0, got %d\n", sz
);
3424 res
= RegSetValueExA(propkey
, "ProductIcon", 0, REG_DWORD
,
3425 (const BYTE
*)&val
, sizeof(DWORD
));
3426 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
3428 /* ProductIcon type is REG_DWORD */
3430 lstrcpyA(buf
, "apple");
3431 r
= MsiGetProductInfoA(prodcode
, INSTALLPROPERTY_PRODUCTICON
, buf
, &sz
);
3432 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3433 ok(!lstrcmpA(buf
, ""), "Expected \"\", got \"%s\"\n", buf
);
3434 ok(sz
== 0, "Expected 0, got %d\n", sz
);
3436 res
= RegSetValueExA(prodkey
, "ProductIcon", 0, REG_SZ
, (LPBYTE
)"ico", 4);
3437 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
3439 /* ProductIcon value exists */
3441 lstrcpyA(buf
, "apple");
3442 r
= MsiGetProductInfoA(prodcode
, INSTALLPROPERTY_PRODUCTICON
, buf
, &sz
);
3443 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3444 ok(!lstrcmpA(buf
, "ico"), "Expected \"ico\", got \"%s\"\n", buf
);
3445 ok(sz
== 3, "Expected 3, got %d\n", sz
);
3447 res
= RegSetValueExA(prodkey
, "ProductIcon", 0, REG_DWORD
,
3448 (const BYTE
*)&val
, sizeof(DWORD
));
3449 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
3451 /* ProductIcon type is REG_DWORD */
3453 lstrcpyA(buf
, "apple");
3454 r
= MsiGetProductInfoA(prodcode
, INSTALLPROPERTY_PRODUCTICON
, buf
, &sz
);
3455 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3456 ok(!lstrcmpA(buf
, "42"), "Expected \"42\", got \"%s\"\n", buf
);
3457 ok(sz
== 2, "Expected 2, got %d\n", sz
);
3459 res
= RegCreateKeyA(prodkey
, "SourceList", &source
);
3460 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
3462 res
= RegSetValueExA(source
, "PackageName", 0, REG_SZ
, (LPBYTE
)"packname", 9);
3463 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
3466 lstrcpyA(buf
, "apple");
3467 r
= MsiGetProductInfoA(prodcode
, INSTALLPROPERTY_PACKAGENAME
, buf
, &sz
);
3468 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3469 ok(!lstrcmpA(buf
, "packname"), "Expected \"packname\", got \"%s\"\n", buf
);
3470 ok(sz
== 8, "Expected 8, got %d\n", sz
);
3472 res
= RegSetValueExA(source
, "PackageName", 0, REG_DWORD
,
3473 (const BYTE
*)&val
, sizeof(DWORD
));
3474 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
3476 /* PackageName type is REG_DWORD */
3478 lstrcpyA(buf
, "apple");
3479 r
= MsiGetProductInfoA(prodcode
, INSTALLPROPERTY_PACKAGENAME
, buf
, &sz
);
3480 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3481 ok(!lstrcmpA(buf
, "42"), "Expected \"42\", got \"%s\"\n", buf
);
3482 ok(sz
== 2, "Expected 2, got %d\n", sz
);
3484 res
= RegSetValueExA(propkey
, "AuthorizedLUAApp", 0, REG_SZ
, (LPBYTE
)"auth", 5);
3485 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
3487 /* Authorized value exists */
3489 lstrcpyA(buf
, "apple");
3490 r
= MsiGetProductInfoA(prodcode
, INSTALLPROPERTY_AUTHORIZED_LUA_APP
, buf
, &sz
);
3491 if (r
!= ERROR_UNKNOWN_PROPERTY
)
3493 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3494 ok(!lstrcmpA(buf
, ""), "Expected \"\", got \"%s\"\n", buf
);
3495 ok(sz
== 0, "Expected 0, got %d\n", sz
);
3498 res
= RegSetValueExA(propkey
, "AuthorizedLUAApp", 0, REG_DWORD
,
3499 (const BYTE
*)&val
, sizeof(DWORD
));
3500 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
3502 /* AuthorizedLUAApp type is REG_DWORD */
3504 lstrcpyA(buf
, "apple");
3505 r
= MsiGetProductInfoA(prodcode
, INSTALLPROPERTY_AUTHORIZED_LUA_APP
, buf
, &sz
);
3506 if (r
!= ERROR_UNKNOWN_PROPERTY
)
3508 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3509 ok(!lstrcmpA(buf
, ""), "Expected \"\", got \"%s\"\n", buf
);
3510 ok(sz
== 0, "Expected 0, got %d\n", sz
);
3513 res
= RegSetValueExA(prodkey
, "AuthorizedLUAApp", 0, REG_SZ
, (LPBYTE
)"auth", 5);
3514 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
3516 /* Authorized value exists */
3518 lstrcpyA(buf
, "apple");
3519 r
= MsiGetProductInfoA(prodcode
, INSTALLPROPERTY_AUTHORIZED_LUA_APP
, buf
, &sz
);
3520 if (r
!= ERROR_UNKNOWN_PROPERTY
)
3522 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3523 ok(!lstrcmpA(buf
, "auth"), "Expected \"auth\", got \"%s\"\n", buf
);
3524 ok(sz
== 4, "Expected 4, got %d\n", sz
);
3527 res
= RegSetValueExA(prodkey
, "AuthorizedLUAApp", 0, REG_DWORD
,
3528 (const BYTE
*)&val
, sizeof(DWORD
));
3529 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
3531 /* AuthorizedLUAApp type is REG_DWORD */
3533 lstrcpyA(buf
, "apple");
3534 r
= MsiGetProductInfoA(prodcode
, INSTALLPROPERTY_AUTHORIZED_LUA_APP
, buf
, &sz
);
3535 if (r
!= ERROR_UNKNOWN_PROPERTY
)
3537 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3538 ok(!lstrcmpA(buf
, "42"), "Expected \"42\", got \"%s\"\n", buf
);
3539 ok(sz
== 2, "Expected 2, got %d\n", sz
);
3542 RegDeleteValueA(propkey
, "HelpLink");
3543 RegDeleteValueA(propkey
, "DisplayName");
3544 RegDeleteValueA(propkey
, "DisplayVersion");
3545 RegDeleteValueA(propkey
, "HelpTelephone");
3546 RegDeleteValueA(propkey
, "InstallLocation");
3547 RegDeleteValueA(propkey
, "InstallSource");
3548 RegDeleteValueA(propkey
, "InstallDate");
3549 RegDeleteValueA(propkey
, "Publisher");
3550 RegDeleteValueA(propkey
, "LocalPackage");
3551 RegDeleteValueA(propkey
, "UrlInfoAbout");
3552 RegDeleteValueA(propkey
, "UrlUpdateInfo");
3553 RegDeleteValueA(propkey
, "VersionMinor");
3554 RegDeleteValueA(propkey
, "VersionMajor");
3555 RegDeleteValueA(propkey
, "ProductID");
3556 RegDeleteValueA(propkey
, "RegCompany");
3557 RegDeleteValueA(propkey
, "RegOwner");
3558 RegDeleteValueA(propkey
, "InstanceType");
3559 RegDeleteValueA(propkey
, "Transforms");
3560 RegDeleteValueA(propkey
, "Language");
3561 RegDeleteValueA(propkey
, "ProductName");
3562 RegDeleteValueA(propkey
, "Assignment");
3563 RegDeleteValueA(propkey
, "PackageCode");
3564 RegDeleteValueA(propkey
, "Version");
3565 RegDeleteValueA(propkey
, "ProductIcon");
3566 RegDeleteValueA(propkey
, "AuthorizedLUAApp");
3567 RegDeleteKeyA(propkey
, "");
3568 RegDeleteKeyA(localkey
, "");
3569 RegDeleteValueA(prodkey
, "InstanceType");
3570 RegDeleteValueA(prodkey
, "Transforms");
3571 RegDeleteValueA(prodkey
, "Language");
3572 RegDeleteValueA(prodkey
, "ProductName");
3573 RegDeleteValueA(prodkey
, "Assignment");
3574 RegDeleteValueA(prodkey
, "PackageCode");
3575 RegDeleteValueA(prodkey
, "Version");
3576 RegDeleteValueA(prodkey
, "ProductIcon");
3577 RegDeleteValueA(prodkey
, "AuthorizedLUAApp");
3578 RegDeleteValueA(source
, "PackageName");
3579 RegDeleteKeyA(source
, "");
3580 RegDeleteKeyA(prodkey
, "");
3581 RegCloseKey(propkey
);
3582 RegCloseKey(localkey
);
3583 RegCloseKey(source
);
3584 RegCloseKey(prodkey
);
3587 static void test_MsiGetProductInfoEx(void)
3591 HKEY propkey
, userkey
;
3592 HKEY prodkey
, localkey
;
3593 CHAR prodcode
[MAX_PATH
];
3594 CHAR prod_squashed
[MAX_PATH
];
3595 CHAR packcode
[MAX_PATH
];
3596 CHAR pack_squashed
[MAX_PATH
];
3598 CHAR keypath
[MAX_PATH
];
3602 if (!pMsiGetProductInfoExA
)
3604 skip("MsiGetProductInfoExA is not available\n");
3608 create_test_guid(prodcode
, prod_squashed
);
3609 create_test_guid(packcode
, pack_squashed
);
3610 get_user_sid(&usersid
);
3612 /* NULL szProductCode */
3614 lstrcpyA(buf
, "apple");
3615 r
= pMsiGetProductInfoExA(NULL
, usersid
, MSIINSTALLCONTEXT_USERUNMANAGED
,
3616 INSTALLPROPERTY_PRODUCTSTATE
, buf
, &sz
);
3617 ok(r
== ERROR_INVALID_PARAMETER
,
3618 "Expected ERROR_INVALID_PARAMETER, got %d\n", r
);
3619 ok(!lstrcmpA(buf
, "apple"), "Expected buf to be unchanged, got %s\n", buf
);
3620 ok(sz
== MAX_PATH
, "Expected MAX_PATH, got %d\n", sz
);
3622 /* empty szProductCode */
3624 lstrcpyA(buf
, "apple");
3625 r
= pMsiGetProductInfoExA("", usersid
, MSIINSTALLCONTEXT_USERUNMANAGED
,
3626 INSTALLPROPERTY_PRODUCTSTATE
, buf
, &sz
);
3627 ok(r
== ERROR_INVALID_PARAMETER
,
3628 "Expected ERROR_INVALID_PARAMETER, got %d\n", r
);
3629 ok(!lstrcmpA(buf
, "apple"), "Expected buf to be unchanged, got %s\n", buf
);
3630 ok(sz
== MAX_PATH
, "Expected MAX_PATH, got %d\n", sz
);
3632 /* garbage szProductCode */
3634 lstrcpyA(buf
, "apple");
3635 r
= pMsiGetProductInfoExA("garbage", usersid
, MSIINSTALLCONTEXT_USERUNMANAGED
,
3636 INSTALLPROPERTY_PRODUCTSTATE
, buf
, &sz
);
3637 ok(r
== ERROR_INVALID_PARAMETER
,
3638 "Expected ERROR_INVALID_PARAMETER, got %d\n", r
);
3639 ok(!lstrcmpA(buf
, "apple"), "Expected buf to be unchanged, got %s\n", buf
);
3640 ok(sz
== MAX_PATH
, "Expected MAX_PATH, got %d\n", sz
);
3642 /* guid without brackets */
3644 lstrcpyA(buf
, "apple");
3645 r
= pMsiGetProductInfoExA("6700E8CF-95AB-4D9C-BC2C-15840DEA7A5D", usersid
,
3646 MSIINSTALLCONTEXT_USERUNMANAGED
,
3647 INSTALLPROPERTY_PRODUCTSTATE
, buf
, &sz
);
3648 ok(r
== ERROR_INVALID_PARAMETER
,
3649 "Expected ERROR_INVALID_PARAMETER, got %d\n", r
);
3650 ok(!lstrcmpA(buf
, "apple"), "Expected buf to be unchanged, got %s\n", buf
);
3651 ok(sz
== MAX_PATH
, "Expected MAX_PATH, got %d\n", sz
);
3653 /* guid with brackets */
3655 lstrcpyA(buf
, "apple");
3656 r
= pMsiGetProductInfoExA("{6700E8CF-95AB-4D9C-BC2C-15840DEA7A5D}", usersid
,
3657 MSIINSTALLCONTEXT_USERUNMANAGED
,
3658 INSTALLPROPERTY_PRODUCTSTATE
, buf
, &sz
);
3659 ok(r
== ERROR_UNKNOWN_PRODUCT
,
3660 "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r
);
3661 ok(!lstrcmpA(buf
, "apple"), "Expected buf to be unchanged, got %s\n", buf
);
3662 ok(sz
== MAX_PATH
, "Expected MAX_PATH, got %d\n", sz
);
3664 /* szValue is non-NULL while pcchValue is NULL */
3665 lstrcpyA(buf
, "apple");
3666 r
= pMsiGetProductInfoExA(prodcode
, usersid
,
3667 MSIINSTALLCONTEXT_USERUNMANAGED
,
3668 INSTALLPROPERTY_PRODUCTSTATE
, buf
, NULL
);
3669 ok(r
== ERROR_INVALID_PARAMETER
,
3670 "Expected ERROR_INVALID_PARAMETER, got %d\n", r
);
3671 ok(!lstrcmpA(buf
, "apple"), "Expected buf to be unchanged, got %s\n", buf
);
3673 /* dwContext is out of range */
3675 lstrcpyA(buf
, "apple");
3676 r
= pMsiGetProductInfoExA(prodcode
, usersid
, 42,
3677 INSTALLPROPERTY_PRODUCTSTATE
, buf
, &sz
);
3678 ok(r
== ERROR_INVALID_PARAMETER
,
3679 "Expected ERROR_INVALID_PARAMETER, got %d\n", r
);
3680 ok(!lstrcmpA(buf
, "apple"), "Expected buf to be unchanged, got %s\n", buf
);
3681 ok(sz
== MAX_PATH
, "Expected MAX_PATH, got %d\n", sz
);
3683 /* szProperty is NULL */
3685 lstrcpyA(buf
, "apple");
3686 r
= pMsiGetProductInfoExA(prodcode
, usersid
,
3687 MSIINSTALLCONTEXT_USERUNMANAGED
,
3689 ok(r
== ERROR_INVALID_PARAMETER
,
3690 "Expected ERROR_INVALID_PARAMETER, got %d\n", r
);
3691 ok(!lstrcmpA(buf
, "apple"), "Expected buf to be unchanged, got %s\n", buf
);
3692 ok(sz
== MAX_PATH
, "Expected MAX_PATH, got %d\n", sz
);
3694 /* szProperty is empty */
3696 lstrcpyA(buf
, "apple");
3697 r
= pMsiGetProductInfoExA(prodcode
, usersid
,
3698 MSIINSTALLCONTEXT_USERUNMANAGED
,
3700 ok(r
== ERROR_INVALID_PARAMETER
,
3701 "Expected ERROR_INVALID_PARAMETER, got %d\n", r
);
3702 ok(!lstrcmpA(buf
, "apple"), "Expected buf to be unchanged, got %s\n", buf
);
3703 ok(sz
== MAX_PATH
, "Expected MAX_PATH, got %d\n", sz
);
3705 /* szProperty is not a valid property */
3707 lstrcpyA(buf
, "apple");
3708 r
= pMsiGetProductInfoExA(prodcode
, usersid
,
3709 MSIINSTALLCONTEXT_USERUNMANAGED
,
3710 "notvalid", buf
, &sz
);
3711 ok(r
== ERROR_UNKNOWN_PRODUCT
,
3712 "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r
);
3713 ok(!lstrcmpA(buf
, "apple"), "Expected buf to be unchanged, got %s\n", buf
);
3714 ok(sz
== MAX_PATH
, "Expected MAX_PATH, got %d\n", sz
);
3716 /* same length as guid, but random */
3718 lstrcpyA(buf
, "apple");
3719 r
= pMsiGetProductInfoExA("A938G02JF-2NF3N93-VN3-2NNF-3KGKALDNF93", usersid
,
3720 MSIINSTALLCONTEXT_USERUNMANAGED
,
3721 INSTALLPROPERTY_PRODUCTSTATE
, buf
, &sz
);
3722 ok(r
== ERROR_INVALID_PARAMETER
,
3723 "Expected ERROR_INVALID_PARAMETER, got %d\n", r
);
3724 ok(!lstrcmpA(buf
, "apple"), "Expected buf to be unchanged, got %s\n", buf
);
3725 ok(sz
== MAX_PATH
, "Expected MAX_PATH, got %d\n", sz
);
3727 /* MSIINSTALLCONTEXT_USERUNMANAGED */
3729 lstrcpyA(keypath
, "Software\\Microsoft\\Windows\\CurrentVersion\\Installer\\UserData\\");
3730 lstrcatA(keypath
, usersid
);
3731 lstrcatA(keypath
, "\\Products\\");
3732 lstrcatA(keypath
, prod_squashed
);
3734 res
= RegCreateKeyA(HKEY_LOCAL_MACHINE
, keypath
, &localkey
);
3735 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
3737 /* local user product key exists */
3739 lstrcpyA(buf
, "apple");
3740 r
= pMsiGetProductInfoExA(prodcode
, usersid
,
3741 MSIINSTALLCONTEXT_USERUNMANAGED
,
3742 INSTALLPROPERTY_PRODUCTSTATE
, buf
, &sz
);
3743 ok(r
== ERROR_UNKNOWN_PRODUCT
,
3744 "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r
);
3745 ok(!lstrcmpA(buf
, "apple"), "Expected buf to be unchanged, got %s\n", buf
);
3746 ok(sz
== MAX_PATH
, "Expected MAX_PATH, got %d\n", sz
);
3748 res
= RegCreateKeyA(localkey
, "InstallProperties", &propkey
);
3749 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
3751 /* InstallProperties key exists */
3753 lstrcpyA(buf
, "apple");
3754 r
= pMsiGetProductInfoExA(prodcode
, usersid
,
3755 MSIINSTALLCONTEXT_USERUNMANAGED
,
3756 INSTALLPROPERTY_PRODUCTSTATE
, buf
, &sz
);
3757 ok(r
== ERROR_UNKNOWN_PRODUCT
,
3758 "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r
);
3759 ok(!lstrcmpA(buf
, "apple"), "Expected buf to be unchanged, got %s\n", buf
);
3760 ok(sz
== MAX_PATH
, "Expected MAX_PATH, got %d\n", sz
);
3762 res
= RegSetValueExA(propkey
, "LocalPackage", 0, REG_SZ
, (LPBYTE
)"local", 6);
3763 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
3765 /* LocalPackage value exists */
3767 lstrcpyA(buf
, "apple");
3768 r
= pMsiGetProductInfoExA(prodcode
, usersid
,
3769 MSIINSTALLCONTEXT_USERUNMANAGED
,
3770 INSTALLPROPERTY_PRODUCTSTATE
, buf
, &sz
);
3771 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3772 ok(!lstrcmpA(buf
, "5"), "Expected \"5\", got \"%s\"\n", buf
);
3773 ok(sz
== 1, "Expected 1, got %d\n", sz
);
3775 RegDeleteValueA(propkey
, "LocalPackage");
3777 /* LocalPackage value must exist */
3779 lstrcpyA(buf
, "apple");
3780 r
= pMsiGetProductInfoExA(prodcode
, usersid
,
3781 MSIINSTALLCONTEXT_USERUNMANAGED
,
3782 INSTALLPROPERTY_HELPLINK
, buf
, &sz
);
3783 ok(r
== ERROR_UNKNOWN_PRODUCT
,
3784 "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r
);
3785 ok(!lstrcmpA(buf
, "apple"), "Expected buf to be unchanged, got %s\n", buf
);
3786 ok(sz
== MAX_PATH
, "Expected MAX_PATH, got %d\n", sz
);
3788 res
= RegSetValueExA(propkey
, "LocalPackage", 0, REG_SZ
, (LPBYTE
)"local", 6);
3789 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
3791 /* LocalPackage exists, but HelpLink does not exist */
3793 lstrcpyA(buf
, "apple");
3794 r
= pMsiGetProductInfoExA(prodcode
, usersid
,
3795 MSIINSTALLCONTEXT_USERUNMANAGED
,
3796 INSTALLPROPERTY_HELPLINK
, buf
, &sz
);
3797 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3798 ok(!lstrcmpA(buf
, ""), "Expected \"\", got \"%s\"\n", buf
);
3799 ok(sz
== 0, "Expected 0, got %d\n", sz
);
3801 res
= RegSetValueExA(propkey
, "HelpLink", 0, REG_SZ
, (LPBYTE
)"link", 5);
3802 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
3804 /* HelpLink value exists */
3806 lstrcpyA(buf
, "apple");
3807 r
= pMsiGetProductInfoExA(prodcode
, usersid
,
3808 MSIINSTALLCONTEXT_USERUNMANAGED
,
3809 INSTALLPROPERTY_HELPLINK
, buf
, &sz
);
3810 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3811 ok(!lstrcmpA(buf
, "link"), "Expected \"link\", got \"%s\"\n", buf
);
3812 ok(sz
== 4, "Expected 4, got %d\n", sz
);
3814 res
= RegSetValueExA(propkey
, "HelpTelephone", 0, REG_SZ
, (LPBYTE
)"phone", 6);
3815 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
3817 /* HelpTelephone value exists */
3819 lstrcpyA(buf
, "apple");
3820 r
= pMsiGetProductInfoExA(prodcode
, usersid
,
3821 MSIINSTALLCONTEXT_USERUNMANAGED
,
3822 INSTALLPROPERTY_HELPTELEPHONE
, buf
, &sz
);
3823 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3824 ok(!lstrcmpA(buf
, "phone"), "Expected \"phone\", got \"%s\"\n", buf
);
3825 ok(sz
== 5, "Expected 5, got %d\n", sz
);
3827 /* szValue and pcchValue are NULL */
3828 r
= pMsiGetProductInfoExA(prodcode
, usersid
,
3829 MSIINSTALLCONTEXT_USERUNMANAGED
,
3830 INSTALLPROPERTY_HELPTELEPHONE
, NULL
, NULL
);
3831 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3833 /* pcchValue is exactly 5 */
3835 lstrcpyA(buf
, "apple");
3836 r
= pMsiGetProductInfoExA(prodcode
, usersid
,
3837 MSIINSTALLCONTEXT_USERUNMANAGED
,
3838 INSTALLPROPERTY_HELPTELEPHONE
, buf
, &sz
);
3839 ok(r
== ERROR_MORE_DATA
,
3840 "Expected ERROR_MORE_DATA, got %d\n", r
);
3841 ok(!lstrcmpA(buf
, ""), "Expected \"\", got \"%s\"\n", buf
);
3842 ok(sz
== 10, "Expected 10, got %d\n", sz
);
3844 /* szValue is NULL, pcchValue is exactly 5 */
3846 r
= pMsiGetProductInfoExA(prodcode
, usersid
,
3847 MSIINSTALLCONTEXT_USERUNMANAGED
,
3848 INSTALLPROPERTY_HELPTELEPHONE
, NULL
, &sz
);
3849 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3850 ok(sz
== 10, "Expected 10, got %d\n", sz
);
3852 /* szValue is NULL, pcchValue is MAX_PATH */
3854 r
= pMsiGetProductInfoExA(prodcode
, usersid
,
3855 MSIINSTALLCONTEXT_USERUNMANAGED
,
3856 INSTALLPROPERTY_HELPTELEPHONE
, NULL
, &sz
);
3857 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3858 ok(sz
== 10, "Expected 10, got %d\n", sz
);
3860 /* pcchValue is exactly 0 */
3862 lstrcpyA(buf
, "apple");
3863 r
= pMsiGetProductInfoExA(prodcode
, usersid
,
3864 MSIINSTALLCONTEXT_USERUNMANAGED
,
3865 INSTALLPROPERTY_HELPTELEPHONE
, buf
, &sz
);
3866 ok(r
== ERROR_MORE_DATA
,
3867 "Expected ERROR_MORE_DATA, got %d\n", r
);
3868 ok(!lstrcmpA(buf
, "apple"), "Expected \"apple\", got \"%s\"\n", buf
);
3869 ok(sz
== 10, "Expected 10, got %d\n", sz
);
3871 res
= RegSetValueExA(propkey
, "notvalid", 0, REG_SZ
, (LPBYTE
)"invalid", 8);
3872 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
3874 /* szProperty is not a valid property */
3876 lstrcpyA(buf
, "apple");
3877 r
= pMsiGetProductInfoExA(prodcode
, usersid
,
3878 MSIINSTALLCONTEXT_USERUNMANAGED
,
3879 "notvalid", buf
, &sz
);
3880 ok(r
== ERROR_UNKNOWN_PROPERTY
,
3881 "Expected ERROR_UNKNOWN_PROPERTY, got %d\n", r
);
3882 ok(!lstrcmpA(buf
, "apple"), "Expected buf to be unchanged, got %s\n", buf
);
3883 ok(sz
== MAX_PATH
, "Expected MAX_PATH, got %d\n", sz
);
3885 res
= RegSetValueExA(propkey
, "InstallDate", 0, REG_SZ
, (LPBYTE
)"date", 5);
3886 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
3888 /* InstallDate value exists */
3890 lstrcpyA(buf
, "apple");
3891 r
= pMsiGetProductInfoExA(prodcode
, usersid
,
3892 MSIINSTALLCONTEXT_USERUNMANAGED
,
3893 INSTALLPROPERTY_INSTALLDATE
, buf
, &sz
);
3894 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3895 ok(!lstrcmpA(buf
, "date"), "Expected \"date\", got \"%s\"\n", buf
);
3896 ok(sz
== 4, "Expected 4, got %d\n", sz
);
3898 res
= RegSetValueExA(propkey
, "DisplayName", 0, REG_SZ
, (LPBYTE
)"name", 5);
3899 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
3901 /* DisplayName value exists */
3903 lstrcpyA(buf
, "apple");
3904 r
= pMsiGetProductInfoExA(prodcode
, usersid
,
3905 MSIINSTALLCONTEXT_USERUNMANAGED
,
3906 INSTALLPROPERTY_INSTALLEDPRODUCTNAME
, buf
, &sz
);
3907 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3908 ok(!lstrcmpA(buf
, "name"), "Expected \"name\", got \"%s\"\n", buf
);
3909 ok(sz
== 4, "Expected 4, got %d\n", sz
);
3911 res
= RegSetValueExA(propkey
, "InstallLocation", 0, REG_SZ
, (LPBYTE
)"loc", 4);
3912 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
3914 /* InstallLocation value exists */
3916 lstrcpyA(buf
, "apple");
3917 r
= pMsiGetProductInfoExA(prodcode
, usersid
,
3918 MSIINSTALLCONTEXT_USERUNMANAGED
,
3919 INSTALLPROPERTY_INSTALLLOCATION
, buf
, &sz
);
3920 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3921 ok(!lstrcmpA(buf
, "loc"), "Expected \"loc\", got \"%s\"\n", buf
);
3922 ok(sz
== 3, "Expected 3, got %d\n", sz
);
3924 res
= RegSetValueExA(propkey
, "InstallSource", 0, REG_SZ
, (LPBYTE
)"source", 7);
3925 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
3927 /* InstallSource value exists */
3929 lstrcpyA(buf
, "apple");
3930 r
= pMsiGetProductInfoExA(prodcode
, usersid
,
3931 MSIINSTALLCONTEXT_USERUNMANAGED
,
3932 INSTALLPROPERTY_INSTALLSOURCE
, buf
, &sz
);
3933 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3934 ok(!lstrcmpA(buf
, "source"), "Expected \"source\", got \"%s\"\n", buf
);
3935 ok(sz
== 6, "Expected 6, got %d\n", sz
);
3937 res
= RegSetValueExA(propkey
, "LocalPackage", 0, REG_SZ
, (LPBYTE
)"local", 6);
3938 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
3940 /* LocalPackage value exists */
3942 lstrcpyA(buf
, "apple");
3943 r
= pMsiGetProductInfoExA(prodcode
, usersid
,
3944 MSIINSTALLCONTEXT_USERUNMANAGED
,
3945 INSTALLPROPERTY_LOCALPACKAGE
, buf
, &sz
);
3946 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3947 ok(!lstrcmpA(buf
, "local"), "Expected \"local\", got \"%s\"\n", buf
);
3948 ok(sz
== 5, "Expected 5, got %d\n", sz
);
3950 res
= RegSetValueExA(propkey
, "Publisher", 0, REG_SZ
, (LPBYTE
)"pub", 4);
3951 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
3953 /* Publisher value exists */
3955 lstrcpyA(buf
, "apple");
3956 r
= pMsiGetProductInfoExA(prodcode
, usersid
,
3957 MSIINSTALLCONTEXT_USERUNMANAGED
,
3958 INSTALLPROPERTY_PUBLISHER
, buf
, &sz
);
3959 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3960 ok(!lstrcmpA(buf
, "pub"), "Expected \"pub\", got \"%s\"\n", buf
);
3961 ok(sz
== 3, "Expected 3, got %d\n", sz
);
3963 res
= RegSetValueExA(propkey
, "URLInfoAbout", 0, REG_SZ
, (LPBYTE
)"about", 6);
3964 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
3966 /* URLInfoAbout value exists */
3968 lstrcpyA(buf
, "apple");
3969 r
= pMsiGetProductInfoExA(prodcode
, usersid
,
3970 MSIINSTALLCONTEXT_USERUNMANAGED
,
3971 INSTALLPROPERTY_URLINFOABOUT
, buf
, &sz
);
3972 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3973 ok(!lstrcmpA(buf
, "about"), "Expected \"about\", got \"%s\"\n", buf
);
3974 ok(sz
== 5, "Expected 5, got %d\n", sz
);
3976 res
= RegSetValueExA(propkey
, "URLUpdateInfo", 0, REG_SZ
, (LPBYTE
)"update", 7);
3977 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
3979 /* URLUpdateInfo value exists */
3981 lstrcpyA(buf
, "apple");
3982 r
= pMsiGetProductInfoExA(prodcode
, usersid
,
3983 MSIINSTALLCONTEXT_USERUNMANAGED
,
3984 INSTALLPROPERTY_URLUPDATEINFO
, buf
, &sz
);
3985 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3986 ok(!lstrcmpA(buf
, "update"), "Expected \"update\", got \"%s\"\n", buf
);
3987 ok(sz
== 6, "Expected 6, got %d\n", sz
);
3989 res
= RegSetValueExA(propkey
, "VersionMinor", 0, REG_SZ
, (LPBYTE
)"2", 2);
3990 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
3992 /* VersionMinor value exists */
3994 lstrcpyA(buf
, "apple");
3995 r
= pMsiGetProductInfoExA(prodcode
, usersid
,
3996 MSIINSTALLCONTEXT_USERUNMANAGED
,
3997 INSTALLPROPERTY_VERSIONMINOR
, buf
, &sz
);
3998 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3999 ok(!lstrcmpA(buf
, "2"), "Expected \"2\", got \"%s\"\n", buf
);
4000 ok(sz
== 1, "Expected 1, got %d\n", sz
);
4002 res
= RegSetValueExA(propkey
, "VersionMajor", 0, REG_SZ
, (LPBYTE
)"3", 2);
4003 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
4005 /* VersionMajor value exists */
4007 lstrcpyA(buf
, "apple");
4008 r
= pMsiGetProductInfoExA(prodcode
, usersid
,
4009 MSIINSTALLCONTEXT_USERUNMANAGED
,
4010 INSTALLPROPERTY_VERSIONMAJOR
, buf
, &sz
);
4011 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
4012 ok(!lstrcmpA(buf
, "3"), "Expected \"3\", got \"%s\"\n", buf
);
4013 ok(sz
== 1, "Expected 1, got %d\n", sz
);
4015 res
= RegSetValueExA(propkey
, "DisplayVersion", 0, REG_SZ
, (LPBYTE
)"3.2.1", 6);
4016 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
4018 /* DisplayVersion value exists */
4020 lstrcpyA(buf
, "apple");
4021 r
= pMsiGetProductInfoExA(prodcode
, usersid
,
4022 MSIINSTALLCONTEXT_USERUNMANAGED
,
4023 INSTALLPROPERTY_VERSIONSTRING
, buf
, &sz
);
4024 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
4025 ok(!lstrcmpA(buf
, "3.2.1"), "Expected \"3.2.1\", got \"%s\"\n", buf
);
4026 ok(sz
== 5, "Expected 5, got %d\n", sz
);
4028 res
= RegSetValueExA(propkey
, "ProductID", 0, REG_SZ
, (LPBYTE
)"id", 3);
4029 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
4031 /* ProductID value exists */
4033 lstrcpyA(buf
, "apple");
4034 r
= pMsiGetProductInfoExA(prodcode
, usersid
,
4035 MSIINSTALLCONTEXT_USERUNMANAGED
,
4036 INSTALLPROPERTY_PRODUCTID
, buf
, &sz
);
4037 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
4038 ok(!lstrcmpA(buf
, "id"), "Expected \"id\", got \"%s\"\n", buf
);
4039 ok(sz
== 2, "Expected 2, got %d\n", sz
);
4041 res
= RegSetValueExA(propkey
, "RegCompany", 0, REG_SZ
, (LPBYTE
)"comp", 5);
4042 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
4044 /* RegCompany value exists */
4046 lstrcpyA(buf
, "apple");
4047 r
= pMsiGetProductInfoExA(prodcode
, usersid
,
4048 MSIINSTALLCONTEXT_USERUNMANAGED
,
4049 INSTALLPROPERTY_REGCOMPANY
, buf
, &sz
);
4050 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
4051 ok(!lstrcmpA(buf
, "comp"), "Expected \"comp\", got \"%s\"\n", buf
);
4052 ok(sz
== 4, "Expected 4, got %d\n", sz
);
4054 res
= RegSetValueExA(propkey
, "RegOwner", 0, REG_SZ
, (LPBYTE
)"owner", 6);
4055 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
4057 /* RegOwner value exists */
4059 lstrcpyA(buf
, "apple");
4060 r
= pMsiGetProductInfoExA(prodcode
, usersid
,
4061 MSIINSTALLCONTEXT_USERUNMANAGED
,
4062 INSTALLPROPERTY_REGOWNER
, buf
, &sz
);
4063 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
4064 ok(!lstrcmpA(buf
, "owner"), "Expected \"owner\", got \"%s\"\n", buf
);
4065 ok(sz
== 5, "Expected 5, got %d\n", sz
);
4067 res
= RegSetValueExA(propkey
, "Transforms", 0, REG_SZ
, (LPBYTE
)"trans", 6);
4068 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
4070 /* Transforms value exists */
4072 lstrcpyA(buf
, "apple");
4073 r
= pMsiGetProductInfoExA(prodcode
, usersid
,
4074 MSIINSTALLCONTEXT_USERUNMANAGED
,
4075 INSTALLPROPERTY_TRANSFORMS
, buf
, &sz
);
4076 ok(r
== ERROR_UNKNOWN_PRODUCT
,
4077 "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r
);
4078 ok(!lstrcmpA(buf
, "apple"), "Expected buf to be unchanged, got %s\n", buf
);
4079 ok(sz
== MAX_PATH
, "Expected MAX_PATH, got %d\n", sz
);
4081 res
= RegSetValueExA(propkey
, "Language", 0, REG_SZ
, (LPBYTE
)"lang", 5);
4082 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
4084 /* Language value exists */
4086 lstrcpyA(buf
, "apple");
4087 r
= pMsiGetProductInfoExA(prodcode
, usersid
,
4088 MSIINSTALLCONTEXT_USERUNMANAGED
,
4089 INSTALLPROPERTY_LANGUAGE
, buf
, &sz
);
4090 ok(r
== ERROR_UNKNOWN_PRODUCT
,
4091 "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r
);
4092 ok(!lstrcmpA(buf
, "apple"), "Expected buf to be unchanged, got %s\n", buf
);
4093 ok(sz
== MAX_PATH
, "Expected MAX_PATH, got %d\n", sz
);
4095 res
= RegSetValueExA(propkey
, "ProductName", 0, REG_SZ
, (LPBYTE
)"name", 5);
4096 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
4098 /* ProductName value exists */
4100 lstrcpyA(buf
, "apple");
4101 r
= pMsiGetProductInfoExA(prodcode
, usersid
,
4102 MSIINSTALLCONTEXT_USERUNMANAGED
,
4103 INSTALLPROPERTY_PRODUCTNAME
, buf
, &sz
);
4104 ok(r
== ERROR_UNKNOWN_PRODUCT
,
4105 "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r
);
4106 ok(!lstrcmpA(buf
, "apple"), "Expected buf to be unchanged, got %s\n", buf
);
4107 ok(sz
== MAX_PATH
, "Expected MAX_PATH, got %d\n", sz
);
4109 res
= RegSetValueExA(propkey
, "AssignmentType", 0, REG_SZ
, (LPBYTE
)"type", 5);
4110 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
4114 /* AssignmentType value exists */
4116 lstrcpyA(buf
, "apple");
4117 r
= pMsiGetProductInfoExA(prodcode
, usersid
,
4118 MSIINSTALLCONTEXT_USERUNMANAGED
,
4119 INSTALLPROPERTY_ASSIGNMENTTYPE
, buf
, &sz
);
4120 ok(r
== ERROR_UNKNOWN_PRODUCT
,
4121 "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r
);
4122 ok(!lstrcmpA(buf
, "apple"), "Expected buf to be unchanged, got %s\n", buf
);
4123 ok(sz
== MAX_PATH
, "Expected MAX_PATH, got %d\n", sz
);
4125 res
= RegSetValueExA(propkey
, "PackageCode", 0, REG_SZ
, (LPBYTE
)"code", 5);
4126 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
4128 /* PackageCode value exists */
4130 lstrcpyA(buf
, "apple");
4131 r
= pMsiGetProductInfoExA(prodcode
, usersid
,
4132 MSIINSTALLCONTEXT_USERUNMANAGED
,
4133 INSTALLPROPERTY_PACKAGECODE
, buf
, &sz
);
4134 ok(r
== ERROR_UNKNOWN_PRODUCT
,
4135 "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r
);
4136 ok(!lstrcmpA(buf
, "apple"), "Expected buf to be unchanged, got %s\n", buf
);
4137 ok(sz
== MAX_PATH
, "Expected MAX_PATH, got %d\n", sz
);
4139 res
= RegSetValueExA(propkey
, "Version", 0, REG_SZ
, (LPBYTE
)"ver", 4);
4140 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
4142 /* Version value exists */
4144 lstrcpyA(buf
, "apple");
4145 r
= pMsiGetProductInfoExA(prodcode
, usersid
,
4146 MSIINSTALLCONTEXT_USERUNMANAGED
,
4147 INSTALLPROPERTY_VERSION
, buf
, &sz
);
4148 ok(r
== ERROR_UNKNOWN_PRODUCT
,
4149 "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r
);
4150 ok(!lstrcmpA(buf
, "apple"), "Expected buf to be unchanged, got %s\n", buf
);
4151 ok(sz
== MAX_PATH
, "Expected MAX_PATH, got %d\n", sz
);
4153 res
= RegSetValueExA(propkey
, "ProductIcon", 0, REG_SZ
, (LPBYTE
)"icon", 5);
4154 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
4156 /* ProductIcon value exists */
4158 lstrcpyA(buf
, "apple");
4159 r
= pMsiGetProductInfoExA(prodcode
, usersid
,
4160 MSIINSTALLCONTEXT_USERUNMANAGED
,
4161 INSTALLPROPERTY_PRODUCTICON
, buf
, &sz
);
4162 ok(r
== ERROR_UNKNOWN_PRODUCT
,
4163 "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r
);
4164 ok(!lstrcmpA(buf
, "apple"), "Expected buf to be unchanged, got %s\n", buf
);
4165 ok(sz
== MAX_PATH
, "Expected MAX_PATH, got %d\n", sz
);
4167 res
= RegSetValueExA(propkey
, "PackageName", 0, REG_SZ
, (LPBYTE
)"name", 5);
4168 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
4170 /* PackageName value exists */
4172 lstrcpyA(buf
, "apple");
4173 r
= pMsiGetProductInfoExA(prodcode
, usersid
,
4174 MSIINSTALLCONTEXT_USERUNMANAGED
,
4175 INSTALLPROPERTY_PACKAGENAME
, buf
, &sz
);
4176 ok(r
== ERROR_UNKNOWN_PRODUCT
,
4177 "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r
);
4178 ok(!lstrcmpA(buf
, "apple"), "Expected buf to be unchanged, got %s\n", buf
);
4179 ok(sz
== MAX_PATH
, "Expected MAX_PATH, got %d\n", sz
);
4181 res
= RegSetValueExA(propkey
, "AuthorizedLUAApp", 0, REG_SZ
, (LPBYTE
)"auth", 5);
4182 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
4184 /* AuthorizedLUAApp value exists */
4186 lstrcpyA(buf
, "apple");
4187 r
= pMsiGetProductInfoExA(prodcode
, usersid
,
4188 MSIINSTALLCONTEXT_USERUNMANAGED
,
4189 INSTALLPROPERTY_AUTHORIZED_LUA_APP
, buf
, &sz
);
4190 ok(r
== ERROR_UNKNOWN_PRODUCT
,
4191 "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r
);
4192 ok(!lstrcmpA(buf
, "apple"), "Expected buf to be unchanged, got %s\n", buf
);
4193 ok(sz
== MAX_PATH
, "Expected MAX_PATH, got %d\n", sz
);
4195 RegDeleteValueA(propkey
, "AuthorizedLUAApp");
4196 RegDeleteValueA(propkey
, "PackageName");
4197 RegDeleteValueA(propkey
, "ProductIcon");
4198 RegDeleteValueA(propkey
, "Version");
4199 RegDeleteValueA(propkey
, "PackageCode");
4200 RegDeleteValueA(propkey
, "AssignmentType");
4201 RegDeleteValueA(propkey
, "ProductName");
4202 RegDeleteValueA(propkey
, "Language");
4203 RegDeleteValueA(propkey
, "Transforms");
4204 RegDeleteValueA(propkey
, "RegOwner");
4205 RegDeleteValueA(propkey
, "RegCompany");
4206 RegDeleteValueA(propkey
, "ProductID");
4207 RegDeleteValueA(propkey
, "DisplayVersion");
4208 RegDeleteValueA(propkey
, "VersionMajor");
4209 RegDeleteValueA(propkey
, "VersionMinor");
4210 RegDeleteValueA(propkey
, "URLUpdateInfo");
4211 RegDeleteValueA(propkey
, "URLInfoAbout");
4212 RegDeleteValueA(propkey
, "Publisher");
4213 RegDeleteValueA(propkey
, "LocalPackage");
4214 RegDeleteValueA(propkey
, "InstallSource");
4215 RegDeleteValueA(propkey
, "InstallLocation");
4216 RegDeleteValueA(propkey
, "DisplayName");
4217 RegDeleteValueA(propkey
, "InstallDate");
4218 RegDeleteValueA(propkey
, "HelpTelephone");
4219 RegDeleteValueA(propkey
, "HelpLink");
4220 RegDeleteValueA(propkey
, "LocalPackage");
4221 RegDeleteKeyA(propkey
, "");
4222 RegCloseKey(propkey
);
4223 RegDeleteKeyA(localkey
, "");
4224 RegCloseKey(localkey
);
4226 lstrcpyA(keypath
, "Software\\Microsoft\\Windows\\CurrentVersion\\Installer\\Managed\\");
4227 lstrcatA(keypath
, usersid
);
4228 lstrcatA(keypath
, "\\Installer\\Products\\");
4229 lstrcatA(keypath
, prod_squashed
);
4231 res
= RegCreateKeyA(HKEY_LOCAL_MACHINE
, keypath
, &userkey
);
4232 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
4234 /* user product key exists */
4236 lstrcpyA(buf
, "apple");
4237 r
= pMsiGetProductInfoExA(prodcode
, usersid
,
4238 MSIINSTALLCONTEXT_USERUNMANAGED
,
4239 INSTALLPROPERTY_PRODUCTSTATE
, buf
, &sz
);
4240 ok(r
== ERROR_UNKNOWN_PRODUCT
,
4241 "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r
);
4242 ok(!lstrcmpA(buf
, "apple"), "Expected buf to be unchanged, got %s\n", buf
);
4243 ok(sz
== MAX_PATH
, "Expected MAX_PATH, got %d\n", sz
);
4245 RegDeleteKeyA(userkey
, "");
4246 RegCloseKey(userkey
);
4248 lstrcpyA(keypath
, "Software\\Microsoft\\Installer\\Products\\");
4249 lstrcatA(keypath
, prod_squashed
);
4251 res
= RegCreateKeyA(HKEY_CURRENT_USER
, keypath
, &prodkey
);
4252 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
4255 lstrcpyA(buf
, "apple");
4256 r
= pMsiGetProductInfoExA(prodcode
, usersid
,
4257 MSIINSTALLCONTEXT_USERUNMANAGED
,
4258 INSTALLPROPERTY_PRODUCTSTATE
, buf
, &sz
);
4259 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
4260 ok(!lstrcmpA(buf
, "1"), "Expected \"1\", got \"%s\"\n", buf
);
4261 ok(sz
== 1, "Expected 1, got %d\n", sz
);
4263 res
= RegSetValueExA(prodkey
, "HelpLink", 0, REG_SZ
, (LPBYTE
)"link", 5);
4264 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
4266 /* HelpLink value exists */
4268 lstrcpyA(buf
, "apple");
4269 r
= pMsiGetProductInfoExA(prodcode
, usersid
,
4270 MSIINSTALLCONTEXT_USERUNMANAGED
,
4271 INSTALLPROPERTY_HELPLINK
, buf
, &sz
);
4272 ok(r
== ERROR_UNKNOWN_PROPERTY
,
4273 "Expected ERROR_UNKNOWN_PROPERTY, got %d\n", r
);
4274 ok(!lstrcmpA(buf
, "apple"), "Expected buf to be unchanged, got %s\n", buf
);
4275 ok(sz
== MAX_PATH
, "Expected MAX_PATH, got %d\n", sz
);
4277 res
= RegSetValueExA(prodkey
, "HelpTelephone", 0, REG_SZ
, (LPBYTE
)"phone", 6);
4278 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
4280 /* HelpTelephone value exists */
4282 lstrcpyA(buf
, "apple");
4283 r
= pMsiGetProductInfoExA(prodcode
, usersid
,
4284 MSIINSTALLCONTEXT_USERUNMANAGED
,
4285 INSTALLPROPERTY_HELPTELEPHONE
, buf
, &sz
);
4286 ok(r
== ERROR_UNKNOWN_PROPERTY
,
4287 "Expected ERROR_UNKNOWN_PROPERTY, got %d\n", r
);
4288 ok(!lstrcmpA(buf
, "apple"), "Expected buf to be unchanged, got %s\n", buf
);
4289 ok(sz
== MAX_PATH
, "Expected MAX_PATH, got %d\n", sz
);
4291 res
= RegSetValueExA(prodkey
, "InstallDate", 0, REG_SZ
, (LPBYTE
)"date", 5);
4292 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
4294 /* InstallDate value exists */
4296 lstrcpyA(buf
, "apple");
4297 r
= pMsiGetProductInfoExA(prodcode
, usersid
,
4298 MSIINSTALLCONTEXT_USERUNMANAGED
,
4299 INSTALLPROPERTY_INSTALLDATE
, buf
, &sz
);
4300 ok(r
== ERROR_UNKNOWN_PROPERTY
,
4301 "Expected ERROR_UNKNOWN_PROPERTY, got %d\n", r
);
4302 ok(!lstrcmpA(buf
, "apple"), "Expected buf to be unchanged, got %s\n", buf
);
4303 ok(sz
== MAX_PATH
, "Expected MAX_PATH, got %d\n", sz
);
4305 res
= RegSetValueExA(prodkey
, "DisplayName", 0, REG_SZ
, (LPBYTE
)"name", 5);
4306 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
4308 /* DisplayName value exists */
4310 lstrcpyA(buf
, "apple");
4311 r
= pMsiGetProductInfoExA(prodcode
, usersid
,
4312 MSIINSTALLCONTEXT_USERUNMANAGED
,
4313 INSTALLPROPERTY_INSTALLEDPRODUCTNAME
, buf
, &sz
);
4314 ok(r
== ERROR_UNKNOWN_PROPERTY
,
4315 "Expected ERROR_UNKNOWN_PROPERTY, got %d\n", r
);
4316 ok(!lstrcmpA(buf
, "apple"), "Expected buf to be unchanged, got %s\n", buf
);
4317 ok(sz
== MAX_PATH
, "Expected MAX_PATH, got %d\n", sz
);
4319 res
= RegSetValueExA(prodkey
, "InstallLocation", 0, REG_SZ
, (LPBYTE
)"loc", 4);
4320 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
4322 /* InstallLocation value exists */
4324 lstrcpyA(buf
, "apple");
4325 r
= pMsiGetProductInfoExA(prodcode
, usersid
,
4326 MSIINSTALLCONTEXT_USERUNMANAGED
,
4327 INSTALLPROPERTY_INSTALLLOCATION
, buf
, &sz
);
4328 ok(r
== ERROR_UNKNOWN_PROPERTY
,
4329 "Expected ERROR_UNKNOWN_PROPERTY, got %d\n", r
);
4330 ok(!lstrcmpA(buf
, "apple"), "Expected buf to be unchanged, got %s\n", buf
);
4331 ok(sz
== MAX_PATH
, "Expected MAX_PATH, got %d\n", sz
);
4333 res
= RegSetValueExA(prodkey
, "InstallSource", 0, REG_SZ
, (LPBYTE
)"source", 7);
4334 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
4336 /* InstallSource value exists */
4338 lstrcpyA(buf
, "apple");
4339 r
= pMsiGetProductInfoExA(prodcode
, usersid
,
4340 MSIINSTALLCONTEXT_USERUNMANAGED
,
4341 INSTALLPROPERTY_INSTALLSOURCE
, buf
, &sz
);
4342 ok(r
== ERROR_UNKNOWN_PROPERTY
,
4343 "Expected ERROR_UNKNOWN_PROPERTY, got %d\n", r
);
4344 ok(!lstrcmpA(buf
, "apple"), "Expected buf to be unchanged, got %s\n", buf
);
4345 ok(sz
== MAX_PATH
, "Expected MAX_PATH, got %d\n", sz
);
4347 res
= RegSetValueExA(prodkey
, "LocalPackage", 0, REG_SZ
, (LPBYTE
)"local", 6);
4348 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
4350 /* LocalPackage value exists */
4352 lstrcpyA(buf
, "apple");
4353 r
= pMsiGetProductInfoExA(prodcode
, usersid
,
4354 MSIINSTALLCONTEXT_USERUNMANAGED
,
4355 INSTALLPROPERTY_LOCALPACKAGE
, buf
, &sz
);
4356 ok(r
== ERROR_UNKNOWN_PROPERTY
,
4357 "Expected ERROR_UNKNOWN_PROPERTY, got %d\n", r
);
4358 ok(!lstrcmpA(buf
, "apple"), "Expected buf to be unchanged, got %s\n", buf
);
4359 ok(sz
== MAX_PATH
, "Expected MAX_PATH, got %d\n", sz
);
4361 res
= RegSetValueExA(prodkey
, "Publisher", 0, REG_SZ
, (LPBYTE
)"pub", 4);
4362 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
4364 /* Publisher value exists */
4366 lstrcpyA(buf
, "apple");
4367 r
= pMsiGetProductInfoExA(prodcode
, usersid
,
4368 MSIINSTALLCONTEXT_USERUNMANAGED
,
4369 INSTALLPROPERTY_PUBLISHER
, buf
, &sz
);
4370 ok(r
== ERROR_UNKNOWN_PROPERTY
,
4371 "Expected ERROR_UNKNOWN_PROPERTY, got %d\n", r
);
4372 ok(!lstrcmpA(buf
, "apple"), "Expected buf to be unchanged, got %s\n", buf
);
4373 ok(sz
== MAX_PATH
, "Expected MAX_PATH, got %d\n", sz
);
4375 res
= RegSetValueExA(prodkey
, "URLInfoAbout", 0, REG_SZ
, (LPBYTE
)"about", 6);
4376 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
4378 /* URLInfoAbout value exists */
4380 lstrcpyA(buf
, "apple");
4381 r
= pMsiGetProductInfoExA(prodcode
, usersid
,
4382 MSIINSTALLCONTEXT_USERUNMANAGED
,
4383 INSTALLPROPERTY_URLINFOABOUT
, buf
, &sz
);
4384 ok(r
== ERROR_UNKNOWN_PROPERTY
,
4385 "Expected ERROR_UNKNOWN_PROPERTY, got %d\n", r
);
4386 ok(!lstrcmpA(buf
, "apple"), "Expected buf to be unchanged, got %s\n", buf
);
4387 ok(sz
== MAX_PATH
, "Expected MAX_PATH, got %d\n", sz
);
4389 res
= RegSetValueExA(prodkey
, "URLUpdateInfo", 0, REG_SZ
, (LPBYTE
)"update", 7);
4390 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
4392 /* URLUpdateInfo value exists */
4394 lstrcpyA(buf
, "apple");
4395 r
= pMsiGetProductInfoExA(prodcode
, usersid
,
4396 MSIINSTALLCONTEXT_USERUNMANAGED
,
4397 INSTALLPROPERTY_URLUPDATEINFO
, buf
, &sz
);
4398 ok(r
== ERROR_UNKNOWN_PROPERTY
,
4399 "Expected ERROR_UNKNOWN_PROPERTY, got %d\n", r
);
4400 ok(!lstrcmpA(buf
, "apple"), "Expected buf to be unchanged, got %s\n", buf
);
4401 ok(sz
== MAX_PATH
, "Expected MAX_PATH, got %d\n", sz
);
4403 res
= RegSetValueExA(prodkey
, "VersionMinor", 0, REG_SZ
, (LPBYTE
)"2", 2);
4404 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
4406 /* VersionMinor value exists */
4408 lstrcpyA(buf
, "apple");
4409 r
= pMsiGetProductInfoExA(prodcode
, usersid
,
4410 MSIINSTALLCONTEXT_USERUNMANAGED
,
4411 INSTALLPROPERTY_VERSIONMINOR
, buf
, &sz
);
4412 ok(r
== ERROR_UNKNOWN_PROPERTY
,
4413 "Expected ERROR_UNKNOWN_PROPERTY, got %d\n", r
);
4414 ok(!lstrcmpA(buf
, "apple"), "Expected buf to be unchanged, got %s\n", buf
);
4415 ok(sz
== MAX_PATH
, "Expected MAX_PATH, got %d\n", sz
);
4417 res
= RegSetValueExA(prodkey
, "VersionMajor", 0, REG_SZ
, (LPBYTE
)"3", 2);
4418 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
4420 /* VersionMajor value exists */
4422 lstrcpyA(buf
, "apple");
4423 r
= pMsiGetProductInfoExA(prodcode
, usersid
,
4424 MSIINSTALLCONTEXT_USERUNMANAGED
,
4425 INSTALLPROPERTY_VERSIONMAJOR
, buf
, &sz
);
4426 ok(r
== ERROR_UNKNOWN_PROPERTY
,
4427 "Expected ERROR_UNKNOWN_PROPERTY, got %d\n", r
);
4428 ok(!lstrcmpA(buf
, "apple"), "Expected buf to be unchanged, got %s\n", buf
);
4429 ok(sz
== MAX_PATH
, "Expected MAX_PATH, got %d\n", sz
);
4431 res
= RegSetValueExA(prodkey
, "DisplayVersion", 0, REG_SZ
, (LPBYTE
)"3.2.1", 6);
4432 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
4434 /* DisplayVersion value exists */
4436 lstrcpyA(buf
, "apple");
4437 r
= pMsiGetProductInfoExA(prodcode
, usersid
,
4438 MSIINSTALLCONTEXT_USERUNMANAGED
,
4439 INSTALLPROPERTY_VERSIONSTRING
, buf
, &sz
);
4440 ok(r
== ERROR_UNKNOWN_PROPERTY
,
4441 "Expected ERROR_UNKNOWN_PROPERTY, got %d\n", r
);
4442 ok(!lstrcmpA(buf
, "apple"), "Expected buf to be unchanged, got %s\n", buf
);
4443 ok(sz
== MAX_PATH
, "Expected MAX_PATH, got %d\n", sz
);
4445 res
= RegSetValueExA(prodkey
, "ProductID", 0, REG_SZ
, (LPBYTE
)"id", 3);
4446 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
4448 /* ProductID value exists */
4450 lstrcpyA(buf
, "apple");
4451 r
= pMsiGetProductInfoExA(prodcode
, usersid
,
4452 MSIINSTALLCONTEXT_USERUNMANAGED
,
4453 INSTALLPROPERTY_PRODUCTID
, buf
, &sz
);
4454 ok(r
== ERROR_UNKNOWN_PROPERTY
,
4455 "Expected ERROR_UNKNOWN_PROPERTY, got %d\n", r
);
4456 ok(!lstrcmpA(buf
, "apple"), "Expected buf to be unchanged, got %s\n", buf
);
4457 ok(sz
== MAX_PATH
, "Expected MAX_PATH, got %d\n", sz
);
4459 res
= RegSetValueExA(prodkey
, "RegCompany", 0, REG_SZ
, (LPBYTE
)"comp", 5);
4460 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
4462 /* RegCompany value exists */
4464 lstrcpyA(buf
, "apple");
4465 r
= pMsiGetProductInfoExA(prodcode
, usersid
,
4466 MSIINSTALLCONTEXT_USERUNMANAGED
,
4467 INSTALLPROPERTY_REGCOMPANY
, buf
, &sz
);
4468 ok(r
== ERROR_UNKNOWN_PROPERTY
,
4469 "Expected ERROR_UNKNOWN_PROPERTY, got %d\n", r
);
4470 ok(!lstrcmpA(buf
, "apple"), "Expected buf to be unchanged, got %s\n", buf
);
4471 ok(sz
== MAX_PATH
, "Expected MAX_PATH, got %d\n", sz
);
4473 res
= RegSetValueExA(prodkey
, "RegOwner", 0, REG_SZ
, (LPBYTE
)"owner", 6);
4474 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
4476 /* RegOwner value exists */
4478 lstrcpyA(buf
, "apple");
4479 r
= pMsiGetProductInfoExA(prodcode
, usersid
,
4480 MSIINSTALLCONTEXT_USERUNMANAGED
,
4481 INSTALLPROPERTY_REGOWNER
, buf
, &sz
);
4482 ok(r
== ERROR_UNKNOWN_PROPERTY
,
4483 "Expected ERROR_UNKNOWN_PROPERTY, got %d\n", r
);
4484 ok(!lstrcmpA(buf
, "apple"), "Expected buf to be unchanged, got %s\n", buf
);
4485 ok(sz
== MAX_PATH
, "Expected MAX_PATH, got %d\n", sz
);
4487 res
= RegSetValueExA(prodkey
, "Transforms", 0, REG_SZ
, (LPBYTE
)"trans", 6);
4488 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
4490 /* Transforms value exists */
4492 lstrcpyA(buf
, "apple");
4493 r
= pMsiGetProductInfoExA(prodcode
, usersid
,
4494 MSIINSTALLCONTEXT_USERUNMANAGED
,
4495 INSTALLPROPERTY_TRANSFORMS
, buf
, &sz
);
4496 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
4497 ok(!lstrcmpA(buf
, "trans"), "Expected \"trans\", got \"%s\"\n", buf
);
4498 ok(sz
== 5, "Expected 5, got %d\n", sz
);
4500 res
= RegSetValueExA(prodkey
, "Language", 0, REG_SZ
, (LPBYTE
)"lang", 5);
4501 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
4503 /* Language value exists */
4505 lstrcpyA(buf
, "apple");
4506 r
= pMsiGetProductInfoExA(prodcode
, usersid
,
4507 MSIINSTALLCONTEXT_USERUNMANAGED
,
4508 INSTALLPROPERTY_LANGUAGE
, buf
, &sz
);
4509 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
4510 ok(!lstrcmpA(buf
, "lang"), "Expected \"lang\", got \"%s\"\n", buf
);
4511 ok(sz
== 4, "Expected 4, got %d\n", sz
);
4513 res
= RegSetValueExA(prodkey
, "ProductName", 0, REG_SZ
, (LPBYTE
)"name", 5);
4514 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
4516 /* ProductName value exists */
4518 lstrcpyA(buf
, "apple");
4519 r
= pMsiGetProductInfoExA(prodcode
, usersid
,
4520 MSIINSTALLCONTEXT_USERUNMANAGED
,
4521 INSTALLPROPERTY_PRODUCTNAME
, buf
, &sz
);
4522 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
4523 ok(!lstrcmpA(buf
, "name"), "Expected \"name\", got \"%s\"\n", buf
);
4524 ok(sz
== 4, "Expected 4, got %d\n", sz
);
4526 res
= RegSetValueExA(prodkey
, "AssignmentType", 0, REG_SZ
, (LPBYTE
)"type", 5);
4527 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
4531 /* AssignmentType value exists */
4533 lstrcpyA(buf
, "apple");
4534 r
= pMsiGetProductInfoExA(prodcode
, usersid
,
4535 MSIINSTALLCONTEXT_USERUNMANAGED
,
4536 INSTALLPROPERTY_ASSIGNMENTTYPE
, buf
, &sz
);
4537 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
4538 ok(!lstrcmpA(buf
, ""), "Expected \"\", got \"%s\"\n", buf
);
4539 ok(sz
== 0, "Expected 0, got %d\n", sz
);
4541 res
= RegSetValueExA(prodkey
, "PackageCode", 0, REG_SZ
, (LPBYTE
)"code", 5);
4542 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
4546 /* PackageCode value exists */
4548 lstrcpyA(buf
, "apple");
4549 r
= pMsiGetProductInfoExA(prodcode
, usersid
,
4550 MSIINSTALLCONTEXT_USERUNMANAGED
,
4551 INSTALLPROPERTY_PACKAGECODE
, buf
, &sz
);
4554 ok(r
== ERROR_BAD_CONFIGURATION
,
4555 "Expected ERROR_BAD_CONFIGURATION, got %d\n", r
);
4556 ok(!lstrcmpA(buf
, "apple"), "Expected buf to be unchanged, got %s\n", buf
);
4557 ok(sz
== MAX_PATH
, "Expected MAX_PATH, got %d\n", sz
);
4560 res
= RegSetValueExA(prodkey
, "Version", 0, REG_SZ
, (LPBYTE
)"ver", 4);
4561 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
4563 /* Version value exists */
4565 lstrcpyA(buf
, "apple");
4566 r
= pMsiGetProductInfoExA(prodcode
, usersid
,
4567 MSIINSTALLCONTEXT_USERUNMANAGED
,
4568 INSTALLPROPERTY_VERSION
, buf
, &sz
);
4569 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
4570 ok(!lstrcmpA(buf
, "ver"), "Expected \"ver\", got \"%s\"\n", buf
);
4571 ok(sz
== 3, "Expected 3, got %d\n", sz
);
4573 res
= RegSetValueExA(prodkey
, "ProductIcon", 0, REG_SZ
, (LPBYTE
)"icon", 5);
4574 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
4576 /* ProductIcon value exists */
4578 lstrcpyA(buf
, "apple");
4579 r
= pMsiGetProductInfoExA(prodcode
, usersid
,
4580 MSIINSTALLCONTEXT_USERUNMANAGED
,
4581 INSTALLPROPERTY_PRODUCTICON
, buf
, &sz
);
4582 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
4583 ok(!lstrcmpA(buf
, "icon"), "Expected \"icon\", got \"%s\"\n", buf
);
4584 ok(sz
== 4, "Expected 4, got %d\n", sz
);
4586 res
= RegSetValueExA(prodkey
, "PackageName", 0, REG_SZ
, (LPBYTE
)"name", 5);
4587 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
4589 /* PackageName value exists */
4591 lstrcpyA(buf
, "apple");
4592 r
= pMsiGetProductInfoExA(prodcode
, usersid
,
4593 MSIINSTALLCONTEXT_USERUNMANAGED
,
4594 INSTALLPROPERTY_PACKAGENAME
, buf
, &sz
);
4597 ok(r
== ERROR_UNKNOWN_PRODUCT
,
4598 "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r
);
4599 ok(!lstrcmpA(buf
, "apple"), "Expected buf to be unchanged, got %s\n", buf
);
4600 ok(sz
== MAX_PATH
, "Expected MAX_PATH, got %d\n", sz
);
4603 res
= RegSetValueExA(prodkey
, "AuthorizedLUAApp", 0, REG_SZ
, (LPBYTE
)"auth", 5);
4604 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
4606 /* AuthorizedLUAApp value exists */
4608 lstrcpyA(buf
, "apple");
4609 r
= pMsiGetProductInfoExA(prodcode
, usersid
,
4610 MSIINSTALLCONTEXT_USERUNMANAGED
,
4611 INSTALLPROPERTY_AUTHORIZED_LUA_APP
, buf
, &sz
);
4612 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
4613 ok(!lstrcmpA(buf
, "auth"), "Expected \"auth\", got \"%s\"\n", buf
);
4614 ok(sz
== 4, "Expected 4, got %d\n", sz
);
4616 RegDeleteValueA(prodkey
, "AuthorizedLUAApp");
4617 RegDeleteValueA(prodkey
, "PackageName");
4618 RegDeleteValueA(prodkey
, "ProductIcon");
4619 RegDeleteValueA(prodkey
, "Version");
4620 RegDeleteValueA(prodkey
, "PackageCode");
4621 RegDeleteValueA(prodkey
, "AssignmentType");
4622 RegDeleteValueA(prodkey
, "ProductName");
4623 RegDeleteValueA(prodkey
, "Language");
4624 RegDeleteValueA(prodkey
, "Transforms");
4625 RegDeleteValueA(prodkey
, "RegOwner");
4626 RegDeleteValueA(prodkey
, "RegCompany");
4627 RegDeleteValueA(prodkey
, "ProductID");
4628 RegDeleteValueA(prodkey
, "DisplayVersion");
4629 RegDeleteValueA(prodkey
, "VersionMajor");
4630 RegDeleteValueA(prodkey
, "VersionMinor");
4631 RegDeleteValueA(prodkey
, "URLUpdateInfo");
4632 RegDeleteValueA(prodkey
, "URLInfoAbout");
4633 RegDeleteValueA(prodkey
, "Publisher");
4634 RegDeleteValueA(prodkey
, "LocalPackage");
4635 RegDeleteValueA(prodkey
, "InstallSource");
4636 RegDeleteValueA(prodkey
, "InstallLocation");
4637 RegDeleteValueA(prodkey
, "DisplayName");
4638 RegDeleteValueA(prodkey
, "InstallDate");
4639 RegDeleteValueA(prodkey
, "HelpTelephone");
4640 RegDeleteValueA(prodkey
, "HelpLink");
4641 RegDeleteValueA(prodkey
, "LocalPackage");
4642 RegDeleteKeyA(prodkey
, "");
4643 RegCloseKey(prodkey
);
4645 /* MSIINSTALLCONTEXT_USERMANAGED */
4647 lstrcpyA(keypath
, "Software\\Microsoft\\Windows\\CurrentVersion\\Installer\\UserData\\");
4648 lstrcatA(keypath
, usersid
);
4649 lstrcatA(keypath
, "\\Products\\");
4650 lstrcatA(keypath
, prod_squashed
);
4652 res
= RegCreateKeyA(HKEY_LOCAL_MACHINE
, keypath
, &localkey
);
4653 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
4655 /* local user product key exists */
4657 lstrcpyA(buf
, "apple");
4658 r
= pMsiGetProductInfoExA(prodcode
, usersid
,
4659 MSIINSTALLCONTEXT_USERMANAGED
,
4660 INSTALLPROPERTY_PRODUCTSTATE
, buf
, &sz
);
4661 ok(r
== ERROR_UNKNOWN_PRODUCT
,
4662 "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r
);
4663 ok(!lstrcmpA(buf
, "apple"), "Expected buf to be unchanged, got %s\n", buf
);
4664 ok(sz
== MAX_PATH
, "Expected MAX_PATH, got %d\n", sz
);
4666 res
= RegCreateKeyA(localkey
, "InstallProperties", &propkey
);
4667 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
4669 /* InstallProperties key exists */
4671 lstrcpyA(buf
, "apple");
4672 r
= pMsiGetProductInfoExA(prodcode
, usersid
,
4673 MSIINSTALLCONTEXT_USERMANAGED
,
4674 INSTALLPROPERTY_PRODUCTSTATE
, buf
, &sz
);
4675 ok(r
== ERROR_UNKNOWN_PRODUCT
,
4676 "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r
);
4677 ok(!lstrcmpA(buf
, "apple"), "Expected buf to be unchanged, got %s\n", buf
);
4678 ok(sz
== MAX_PATH
, "Expected MAX_PATH, got %d\n", sz
);
4680 res
= RegSetValueExA(propkey
, "ManagedLocalPackage", 0, REG_SZ
, (LPBYTE
)"local", 6);
4681 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
4683 /* ManagedLocalPackage value exists */
4685 lstrcpyA(buf
, "apple");
4686 r
= pMsiGetProductInfoExA(prodcode
, usersid
,
4687 MSIINSTALLCONTEXT_USERMANAGED
,
4688 INSTALLPROPERTY_PRODUCTSTATE
, buf
, &sz
);
4689 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
4690 ok(!lstrcmpA(buf
, "5"), "Expected \"5\", got \"%s\"\n", buf
);
4691 ok(sz
== 1, "Expected 1, got %d\n", sz
);
4693 res
= RegSetValueExA(propkey
, "HelpLink", 0, REG_SZ
, (LPBYTE
)"link", 5);
4694 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
4696 /* HelpLink value exists */
4698 lstrcpyA(buf
, "apple");
4699 r
= pMsiGetProductInfoExA(prodcode
, usersid
,
4700 MSIINSTALLCONTEXT_USERMANAGED
,
4701 INSTALLPROPERTY_HELPLINK
, buf
, &sz
);
4702 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
4703 ok(!lstrcmpA(buf
, "link"), "Expected \"link\", got \"%s\"\n", buf
);
4704 ok(sz
== 4, "Expected 4, got %d\n", sz
);
4706 res
= RegSetValueExA(propkey
, "HelpTelephone", 0, REG_SZ
, (LPBYTE
)"phone", 6);
4707 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
4709 /* HelpTelephone value exists */
4711 lstrcpyA(buf
, "apple");
4712 r
= pMsiGetProductInfoExA(prodcode
, usersid
,
4713 MSIINSTALLCONTEXT_USERMANAGED
,
4714 INSTALLPROPERTY_HELPTELEPHONE
, buf
, &sz
);
4715 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
4716 ok(!lstrcmpA(buf
, "phone"), "Expected \"phone\", got \"%s\"\n", buf
);
4717 ok(sz
== 5, "Expected 5, got %d\n", sz
);
4719 res
= RegSetValueExA(propkey
, "InstallDate", 0, REG_SZ
, (LPBYTE
)"date", 5);
4720 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
4722 /* InstallDate value exists */
4724 lstrcpyA(buf
, "apple");
4725 r
= pMsiGetProductInfoExA(prodcode
, usersid
,
4726 MSIINSTALLCONTEXT_USERMANAGED
,
4727 INSTALLPROPERTY_INSTALLDATE
, buf
, &sz
);
4728 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
4729 ok(!lstrcmpA(buf
, "date"), "Expected \"date\", got \"%s\"\n", buf
);
4730 ok(sz
== 4, "Expected 4, got %d\n", sz
);
4732 res
= RegSetValueExA(propkey
, "DisplayName", 0, REG_SZ
, (LPBYTE
)"name", 5);
4733 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
4735 /* DisplayName value exists */
4737 lstrcpyA(buf
, "apple");
4738 r
= pMsiGetProductInfoExA(prodcode
, usersid
,
4739 MSIINSTALLCONTEXT_USERMANAGED
,
4740 INSTALLPROPERTY_INSTALLEDPRODUCTNAME
, buf
, &sz
);
4741 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
4742 ok(!lstrcmpA(buf
, "name"), "Expected \"name\", got \"%s\"\n", buf
);
4743 ok(sz
== 4, "Expected 4, got %d\n", sz
);
4745 res
= RegSetValueExA(propkey
, "InstallLocation", 0, REG_SZ
, (LPBYTE
)"loc", 4);
4746 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
4748 /* InstallLocation value exists */
4750 lstrcpyA(buf
, "apple");
4751 r
= pMsiGetProductInfoExA(prodcode
, usersid
,
4752 MSIINSTALLCONTEXT_USERMANAGED
,
4753 INSTALLPROPERTY_INSTALLLOCATION
, buf
, &sz
);
4754 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
4755 ok(!lstrcmpA(buf
, "loc"), "Expected \"loc\", got \"%s\"\n", buf
);
4756 ok(sz
== 3, "Expected 3, got %d\n", sz
);
4758 res
= RegSetValueExA(propkey
, "InstallSource", 0, REG_SZ
, (LPBYTE
)"source", 7);
4759 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
4761 /* InstallSource value exists */
4763 lstrcpyA(buf
, "apple");
4764 r
= pMsiGetProductInfoExA(prodcode
, usersid
,
4765 MSIINSTALLCONTEXT_USERMANAGED
,
4766 INSTALLPROPERTY_INSTALLSOURCE
, buf
, &sz
);
4767 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
4768 ok(!lstrcmpA(buf
, "source"), "Expected \"source\", got \"%s\"\n", buf
);
4769 ok(sz
== 6, "Expected 6, got %d\n", sz
);
4771 res
= RegSetValueExA(propkey
, "LocalPackage", 0, REG_SZ
, (LPBYTE
)"local", 6);
4772 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
4774 /* LocalPackage value exists */
4776 lstrcpyA(buf
, "apple");
4777 r
= pMsiGetProductInfoExA(prodcode
, usersid
,
4778 MSIINSTALLCONTEXT_USERMANAGED
,
4779 INSTALLPROPERTY_LOCALPACKAGE
, buf
, &sz
);
4780 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
4781 ok(!lstrcmpA(buf
, "local"), "Expected \"local\", got \"%s\"\n", buf
);
4782 ok(sz
== 5, "Expected 5, got %d\n", sz
);
4784 res
= RegSetValueExA(propkey
, "Publisher", 0, REG_SZ
, (LPBYTE
)"pub", 4);
4785 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
4787 /* Publisher value exists */
4789 lstrcpyA(buf
, "apple");
4790 r
= pMsiGetProductInfoExA(prodcode
, usersid
,
4791 MSIINSTALLCONTEXT_USERMANAGED
,
4792 INSTALLPROPERTY_PUBLISHER
, buf
, &sz
);
4793 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
4794 ok(!lstrcmpA(buf
, "pub"), "Expected \"pub\", got \"%s\"\n", buf
);
4795 ok(sz
== 3, "Expected 3, got %d\n", sz
);
4797 res
= RegSetValueExA(propkey
, "URLInfoAbout", 0, REG_SZ
, (LPBYTE
)"about", 6);
4798 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
4800 /* URLInfoAbout value exists */
4802 lstrcpyA(buf
, "apple");
4803 r
= pMsiGetProductInfoExA(prodcode
, usersid
,
4804 MSIINSTALLCONTEXT_USERMANAGED
,
4805 INSTALLPROPERTY_URLINFOABOUT
, buf
, &sz
);
4806 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
4807 ok(!lstrcmpA(buf
, "about"), "Expected \"about\", got \"%s\"\n", buf
);
4808 ok(sz
== 5, "Expected 5, got %d\n", sz
);
4810 res
= RegSetValueExA(propkey
, "URLUpdateInfo", 0, REG_SZ
, (LPBYTE
)"update", 7);
4811 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
4813 /* URLUpdateInfo value exists */
4815 lstrcpyA(buf
, "apple");
4816 r
= pMsiGetProductInfoExA(prodcode
, usersid
,
4817 MSIINSTALLCONTEXT_USERMANAGED
,
4818 INSTALLPROPERTY_URLUPDATEINFO
, buf
, &sz
);
4819 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
4820 ok(!lstrcmpA(buf
, "update"), "Expected \"update\", got \"%s\"\n", buf
);
4821 ok(sz
== 6, "Expected 6, got %d\n", sz
);
4823 res
= RegSetValueExA(propkey
, "VersionMinor", 0, REG_SZ
, (LPBYTE
)"2", 2);
4824 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
4826 /* VersionMinor value exists */
4828 lstrcpyA(buf
, "apple");
4829 r
= pMsiGetProductInfoExA(prodcode
, usersid
,
4830 MSIINSTALLCONTEXT_USERMANAGED
,
4831 INSTALLPROPERTY_VERSIONMINOR
, buf
, &sz
);
4832 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
4833 ok(!lstrcmpA(buf
, "2"), "Expected \"2\", got \"%s\"\n", buf
);
4834 ok(sz
== 1, "Expected 1, got %d\n", sz
);
4836 res
= RegSetValueExA(propkey
, "VersionMajor", 0, REG_SZ
, (LPBYTE
)"3", 2);
4837 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
4839 /* VersionMajor value exists */
4841 lstrcpyA(buf
, "apple");
4842 r
= pMsiGetProductInfoExA(prodcode
, usersid
,
4843 MSIINSTALLCONTEXT_USERMANAGED
,
4844 INSTALLPROPERTY_VERSIONMAJOR
, buf
, &sz
);
4845 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
4846 ok(!lstrcmpA(buf
, "3"), "Expected \"3\", got \"%s\"\n", buf
);
4847 ok(sz
== 1, "Expected 1, got %d\n", sz
);
4849 res
= RegSetValueExA(propkey
, "DisplayVersion", 0, REG_SZ
, (LPBYTE
)"3.2.1", 6);
4850 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
4852 /* DisplayVersion value exists */
4854 lstrcpyA(buf
, "apple");
4855 r
= pMsiGetProductInfoExA(prodcode
, usersid
,
4856 MSIINSTALLCONTEXT_USERMANAGED
,
4857 INSTALLPROPERTY_VERSIONSTRING
, buf
, &sz
);
4858 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
4859 ok(!lstrcmpA(buf
, "3.2.1"), "Expected \"3.2.1\", got \"%s\"\n", buf
);
4860 ok(sz
== 5, "Expected 5, got %d\n", sz
);
4862 res
= RegSetValueExA(propkey
, "ProductID", 0, REG_SZ
, (LPBYTE
)"id", 3);
4863 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
4865 /* ProductID value exists */
4867 lstrcpyA(buf
, "apple");
4868 r
= pMsiGetProductInfoExA(prodcode
, usersid
,
4869 MSIINSTALLCONTEXT_USERMANAGED
,
4870 INSTALLPROPERTY_PRODUCTID
, buf
, &sz
);
4871 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
4872 ok(!lstrcmpA(buf
, "id"), "Expected \"id\", got \"%s\"\n", buf
);
4873 ok(sz
== 2, "Expected 2, got %d\n", sz
);
4875 res
= RegSetValueExA(propkey
, "RegCompany", 0, REG_SZ
, (LPBYTE
)"comp", 5);
4876 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
4878 /* RegCompany value exists */
4880 lstrcpyA(buf
, "apple");
4881 r
= pMsiGetProductInfoExA(prodcode
, usersid
,
4882 MSIINSTALLCONTEXT_USERMANAGED
,
4883 INSTALLPROPERTY_REGCOMPANY
, buf
, &sz
);
4884 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
4885 ok(!lstrcmpA(buf
, "comp"), "Expected \"comp\", got \"%s\"\n", buf
);
4886 ok(sz
== 4, "Expected 4, got %d\n", sz
);
4888 res
= RegSetValueExA(propkey
, "RegOwner", 0, REG_SZ
, (LPBYTE
)"owner", 6);
4889 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
4891 /* RegOwner value exists */
4893 lstrcpyA(buf
, "apple");
4894 r
= pMsiGetProductInfoExA(prodcode
, usersid
,
4895 MSIINSTALLCONTEXT_USERMANAGED
,
4896 INSTALLPROPERTY_REGOWNER
, buf
, &sz
);
4897 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
4898 ok(!lstrcmpA(buf
, "owner"), "Expected \"owner\", got \"%s\"\n", buf
);
4899 ok(sz
== 5, "Expected 5, got %d\n", sz
);
4901 res
= RegSetValueExA(propkey
, "Transforms", 0, REG_SZ
, (LPBYTE
)"trans", 6);
4902 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
4904 /* Transforms value exists */
4906 lstrcpyA(buf
, "apple");
4907 r
= pMsiGetProductInfoExA(prodcode
, usersid
,
4908 MSIINSTALLCONTEXT_USERMANAGED
,
4909 INSTALLPROPERTY_TRANSFORMS
, buf
, &sz
);
4910 ok(r
== ERROR_UNKNOWN_PRODUCT
,
4911 "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r
);
4912 ok(!lstrcmpA(buf
, "apple"), "Expected buf to be unchanged, got %s\n", buf
);
4913 ok(sz
== MAX_PATH
, "Expected MAX_PATH, got %d\n", sz
);
4915 res
= RegSetValueExA(propkey
, "Language", 0, REG_SZ
, (LPBYTE
)"lang", 5);
4916 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
4918 /* Language value exists */
4920 lstrcpyA(buf
, "apple");
4921 r
= pMsiGetProductInfoExA(prodcode
, usersid
,
4922 MSIINSTALLCONTEXT_USERMANAGED
,
4923 INSTALLPROPERTY_LANGUAGE
, buf
, &sz
);
4924 ok(r
== ERROR_UNKNOWN_PRODUCT
,
4925 "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r
);
4926 ok(!lstrcmpA(buf
, "apple"), "Expected buf to be unchanged, got %s\n", buf
);
4927 ok(sz
== MAX_PATH
, "Expected MAX_PATH, got %d\n", sz
);
4929 res
= RegSetValueExA(propkey
, "ProductName", 0, REG_SZ
, (LPBYTE
)"name", 5);
4930 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
4932 /* ProductName value exists */
4934 lstrcpyA(buf
, "apple");
4935 r
= pMsiGetProductInfoExA(prodcode
, usersid
,
4936 MSIINSTALLCONTEXT_USERMANAGED
,
4937 INSTALLPROPERTY_PRODUCTNAME
, buf
, &sz
);
4938 ok(r
== ERROR_UNKNOWN_PRODUCT
,
4939 "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r
);
4940 ok(!lstrcmpA(buf
, "apple"), "Expected buf to be unchanged, got %s\n", buf
);
4941 ok(sz
== MAX_PATH
, "Expected MAX_PATH, got %d\n", sz
);
4943 res
= RegSetValueExA(propkey
, "AssignmentType", 0, REG_SZ
, (LPBYTE
)"type", 5);
4944 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
4948 /* AssignmentType value exists */
4950 lstrcpyA(buf
, "apple");
4951 r
= pMsiGetProductInfoExA(prodcode
, usersid
,
4952 MSIINSTALLCONTEXT_USERMANAGED
,
4953 INSTALLPROPERTY_ASSIGNMENTTYPE
, buf
, &sz
);
4954 ok(r
== ERROR_UNKNOWN_PRODUCT
,
4955 "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r
);
4956 ok(!lstrcmpA(buf
, "apple"), "Expected buf to be unchanged, got %s\n", buf
);
4957 ok(sz
== MAX_PATH
, "Expected MAX_PATH, got %d\n", sz
);
4959 res
= RegSetValueExA(propkey
, "PackageCode", 0, REG_SZ
, (LPBYTE
)"code", 5);
4960 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
4962 /* PackageCode value exists */
4964 lstrcpyA(buf
, "apple");
4965 r
= pMsiGetProductInfoExA(prodcode
, usersid
,
4966 MSIINSTALLCONTEXT_USERMANAGED
,
4967 INSTALLPROPERTY_PACKAGECODE
, buf
, &sz
);
4968 ok(r
== ERROR_UNKNOWN_PRODUCT
,
4969 "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r
);
4970 ok(!lstrcmpA(buf
, "apple"), "Expected buf to be unchanged, got %s\n", buf
);
4971 ok(sz
== MAX_PATH
, "Expected MAX_PATH, got %d\n", sz
);
4973 res
= RegSetValueExA(propkey
, "Version", 0, REG_SZ
, (LPBYTE
)"ver", 4);
4974 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
4976 /* Version value exists */
4978 lstrcpyA(buf
, "apple");
4979 r
= pMsiGetProductInfoExA(prodcode
, usersid
,
4980 MSIINSTALLCONTEXT_USERMANAGED
,
4981 INSTALLPROPERTY_VERSION
, buf
, &sz
);
4982 ok(r
== ERROR_UNKNOWN_PRODUCT
,
4983 "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r
);
4984 ok(!lstrcmpA(buf
, "apple"), "Expected buf to be unchanged, got %s\n", buf
);
4985 ok(sz
== MAX_PATH
, "Expected MAX_PATH, got %d\n", sz
);
4987 res
= RegSetValueExA(propkey
, "ProductIcon", 0, REG_SZ
, (LPBYTE
)"icon", 5);
4988 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
4990 /* ProductIcon value exists */
4992 lstrcpyA(buf
, "apple");
4993 r
= pMsiGetProductInfoExA(prodcode
, usersid
,
4994 MSIINSTALLCONTEXT_USERMANAGED
,
4995 INSTALLPROPERTY_PRODUCTICON
, buf
, &sz
);
4996 ok(r
== ERROR_UNKNOWN_PRODUCT
,
4997 "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r
);
4998 ok(!lstrcmpA(buf
, "apple"), "Expected buf to be unchanged, got %s\n", buf
);
4999 ok(sz
== MAX_PATH
, "Expected MAX_PATH, got %d\n", sz
);
5001 res
= RegSetValueExA(propkey
, "PackageName", 0, REG_SZ
, (LPBYTE
)"name", 5);
5002 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
5004 /* PackageName value exists */
5006 lstrcpyA(buf
, "apple");
5007 r
= pMsiGetProductInfoExA(prodcode
, usersid
,
5008 MSIINSTALLCONTEXT_USERMANAGED
,
5009 INSTALLPROPERTY_PACKAGENAME
, buf
, &sz
);
5010 ok(r
== ERROR_UNKNOWN_PRODUCT
,
5011 "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r
);
5012 ok(!lstrcmpA(buf
, "apple"), "Expected buf to be unchanged, got %s\n", buf
);
5013 ok(sz
== MAX_PATH
, "Expected MAX_PATH, got %d\n", sz
);
5015 res
= RegSetValueExA(propkey
, "AuthorizedLUAApp", 0, REG_SZ
, (LPBYTE
)"auth", 5);
5016 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
5018 /* AuthorizedLUAApp value exists */
5020 lstrcpyA(buf
, "apple");
5021 r
= pMsiGetProductInfoExA(prodcode
, usersid
,
5022 MSIINSTALLCONTEXT_USERMANAGED
,
5023 INSTALLPROPERTY_AUTHORIZED_LUA_APP
, buf
, &sz
);
5024 ok(r
== ERROR_UNKNOWN_PRODUCT
,
5025 "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r
);
5026 ok(!lstrcmpA(buf
, "apple"), "Expected buf to be unchanged, got %s\n", buf
);
5027 ok(sz
== MAX_PATH
, "Expected MAX_PATH, got %d\n", sz
);
5029 RegDeleteValueA(propkey
, "AuthorizedLUAApp");
5030 RegDeleteValueA(propkey
, "PackageName");
5031 RegDeleteValueA(propkey
, "ProductIcon");
5032 RegDeleteValueA(propkey
, "Version");
5033 RegDeleteValueA(propkey
, "PackageCode");
5034 RegDeleteValueA(propkey
, "AssignmentType");
5035 RegDeleteValueA(propkey
, "ProductName");
5036 RegDeleteValueA(propkey
, "Language");
5037 RegDeleteValueA(propkey
, "Transforms");
5038 RegDeleteValueA(propkey
, "RegOwner");
5039 RegDeleteValueA(propkey
, "RegCompany");
5040 RegDeleteValueA(propkey
, "ProductID");
5041 RegDeleteValueA(propkey
, "DisplayVersion");
5042 RegDeleteValueA(propkey
, "VersionMajor");
5043 RegDeleteValueA(propkey
, "VersionMinor");
5044 RegDeleteValueA(propkey
, "URLUpdateInfo");
5045 RegDeleteValueA(propkey
, "URLInfoAbout");
5046 RegDeleteValueA(propkey
, "Publisher");
5047 RegDeleteValueA(propkey
, "LocalPackage");
5048 RegDeleteValueA(propkey
, "InstallSource");
5049 RegDeleteValueA(propkey
, "InstallLocation");
5050 RegDeleteValueA(propkey
, "DisplayName");
5051 RegDeleteValueA(propkey
, "InstallDate");
5052 RegDeleteValueA(propkey
, "HelpTelephone");
5053 RegDeleteValueA(propkey
, "HelpLink");
5054 RegDeleteValueA(propkey
, "ManagedLocalPackage");
5055 RegDeleteKeyA(propkey
, "");
5056 RegCloseKey(propkey
);
5057 RegDeleteKeyA(localkey
, "");
5058 RegCloseKey(localkey
);
5060 lstrcpyA(keypath
, "Software\\Microsoft\\Windows\\CurrentVersion\\Installer\\Managed\\");
5061 lstrcatA(keypath
, usersid
);
5062 lstrcatA(keypath
, "\\Installer\\Products\\");
5063 lstrcatA(keypath
, prod_squashed
);
5065 res
= RegCreateKeyA(HKEY_LOCAL_MACHINE
, keypath
, &userkey
);
5066 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
5068 /* user product key exists */
5070 lstrcpyA(buf
, "apple");
5071 r
= pMsiGetProductInfoExA(prodcode
, usersid
,
5072 MSIINSTALLCONTEXT_USERMANAGED
,
5073 INSTALLPROPERTY_PRODUCTSTATE
, buf
, &sz
);
5074 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5075 ok(!lstrcmpA(buf
, "1"), "Expected \"1\", got \"%s\"\n", buf
);
5076 ok(sz
== 1, "Expected 1, got %d\n", sz
);
5078 RegDeleteKeyA(userkey
, "");
5079 RegCloseKey(userkey
);
5081 lstrcpyA(keypath
, "Software\\Microsoft\\Installer\\Products\\");
5082 lstrcatA(keypath
, prod_squashed
);
5084 res
= RegCreateKeyA(HKEY_CURRENT_USER
, keypath
, &prodkey
);
5085 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
5087 /* current user product key exists */
5089 lstrcpyA(buf
, "apple");
5090 r
= pMsiGetProductInfoExA(prodcode
, usersid
,
5091 MSIINSTALLCONTEXT_USERMANAGED
,
5092 INSTALLPROPERTY_PRODUCTSTATE
, buf
, &sz
);
5093 ok(r
== ERROR_UNKNOWN_PRODUCT
,
5094 "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r
);
5095 ok(!lstrcmpA(buf
, "apple"), "Expected buf to be unchanged, got %s\n", buf
);
5096 ok(sz
== MAX_PATH
, "Expected MAX_PATH, got %d\n", sz
);
5098 res
= RegSetValueExA(prodkey
, "HelpLink", 0, REG_SZ
, (LPBYTE
)"link", 5);
5099 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
5101 /* HelpLink value exists, user product key does not exist */
5103 lstrcpyA(buf
, "apple");
5104 r
= pMsiGetProductInfoExA(prodcode
, usersid
,
5105 MSIINSTALLCONTEXT_USERMANAGED
,
5106 INSTALLPROPERTY_HELPLINK
, buf
, &sz
);
5107 ok(r
== ERROR_UNKNOWN_PRODUCT
,
5108 "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r
);
5109 ok(!lstrcmpA(buf
, "apple"), "Expected buf to be unchanged, got %s\n", buf
);
5110 ok(sz
== MAX_PATH
, "Expected MAX_PATH, got %d\n", sz
);
5112 lstrcpyA(keypath
, "Software\\Microsoft\\Windows\\CurrentVersion\\Installer\\Managed\\");
5113 lstrcatA(keypath
, usersid
);
5114 lstrcatA(keypath
, "\\Installer\\Products\\");
5115 lstrcatA(keypath
, prod_squashed
);
5117 res
= RegCreateKeyA(HKEY_LOCAL_MACHINE
, keypath
, &userkey
);
5118 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
5120 res
= RegSetValueExA(userkey
, "HelpLink", 0, REG_SZ
, (LPBYTE
)"link", 5);
5121 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
5123 /* HelpLink value exists, user product key does exist */
5125 lstrcpyA(buf
, "apple");
5126 r
= pMsiGetProductInfoExA(prodcode
, usersid
,
5127 MSIINSTALLCONTEXT_USERMANAGED
,
5128 INSTALLPROPERTY_HELPLINK
, buf
, &sz
);
5129 ok(r
== ERROR_UNKNOWN_PROPERTY
,
5130 "Expected ERROR_UNKNOWN_PROPERTY, got %d\n", r
);
5131 ok(!lstrcmpA(buf
, "apple"), "Expected buf to be unchanged, got %s\n", buf
);
5132 ok(sz
== MAX_PATH
, "Expected MAX_PATH, got %d\n", sz
);
5134 res
= RegSetValueExA(userkey
, "HelpTelephone", 0, REG_SZ
, (LPBYTE
)"phone", 6);
5135 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
5137 /* HelpTelephone value exists */
5139 lstrcpyA(buf
, "apple");
5140 r
= pMsiGetProductInfoExA(prodcode
, usersid
,
5141 MSIINSTALLCONTEXT_USERMANAGED
,
5142 INSTALLPROPERTY_HELPTELEPHONE
, buf
, &sz
);
5143 ok(r
== ERROR_UNKNOWN_PROPERTY
,
5144 "Expected ERROR_UNKNOWN_PROPERTY, got %d\n", r
);
5145 ok(!lstrcmpA(buf
, "apple"), "Expected buf to be unchanged, got %s\n", buf
);
5146 ok(sz
== MAX_PATH
, "Expected MAX_PATH, got %d\n", sz
);
5148 res
= RegSetValueExA(userkey
, "InstallDate", 0, REG_SZ
, (LPBYTE
)"date", 5);
5149 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
5151 /* InstallDate value exists */
5153 lstrcpyA(buf
, "apple");
5154 r
= pMsiGetProductInfoExA(prodcode
, usersid
,
5155 MSIINSTALLCONTEXT_USERMANAGED
,
5156 INSTALLPROPERTY_INSTALLDATE
, buf
, &sz
);
5157 ok(r
== ERROR_UNKNOWN_PROPERTY
,
5158 "Expected ERROR_UNKNOWN_PROPERTY, got %d\n", r
);
5159 ok(!lstrcmpA(buf
, "apple"), "Expected buf to be unchanged, got %s\n", buf
);
5160 ok(sz
== MAX_PATH
, "Expected MAX_PATH, got %d\n", sz
);
5162 res
= RegSetValueExA(userkey
, "DisplayName", 0, REG_SZ
, (LPBYTE
)"name", 5);
5163 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
5165 /* DisplayName value exists */
5167 lstrcpyA(buf
, "apple");
5168 r
= pMsiGetProductInfoExA(prodcode
, usersid
,
5169 MSIINSTALLCONTEXT_USERMANAGED
,
5170 INSTALLPROPERTY_INSTALLEDPRODUCTNAME
, buf
, &sz
);
5171 ok(r
== ERROR_UNKNOWN_PROPERTY
,
5172 "Expected ERROR_UNKNOWN_PROPERTY, got %d\n", r
);
5173 ok(!lstrcmpA(buf
, "apple"), "Expected buf to be unchanged, got %s\n", buf
);
5174 ok(sz
== MAX_PATH
, "Expected MAX_PATH, got %d\n", sz
);
5176 res
= RegSetValueExA(userkey
, "InstallLocation", 0, REG_SZ
, (LPBYTE
)"loc", 4);
5177 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
5179 /* InstallLocation value exists */
5181 lstrcpyA(buf
, "apple");
5182 r
= pMsiGetProductInfoExA(prodcode
, usersid
,
5183 MSIINSTALLCONTEXT_USERMANAGED
,
5184 INSTALLPROPERTY_INSTALLLOCATION
, buf
, &sz
);
5185 ok(r
== ERROR_UNKNOWN_PROPERTY
,
5186 "Expected ERROR_UNKNOWN_PROPERTY, got %d\n", r
);
5187 ok(!lstrcmpA(buf
, "apple"), "Expected buf to be unchanged, got %s\n", buf
);
5188 ok(sz
== MAX_PATH
, "Expected MAX_PATH, got %d\n", sz
);
5190 res
= RegSetValueExA(userkey
, "InstallSource", 0, REG_SZ
, (LPBYTE
)"source", 7);
5191 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
5193 /* InstallSource value exists */
5195 lstrcpyA(buf
, "apple");
5196 r
= pMsiGetProductInfoExA(prodcode
, usersid
,
5197 MSIINSTALLCONTEXT_USERMANAGED
,
5198 INSTALLPROPERTY_INSTALLSOURCE
, buf
, &sz
);
5199 ok(r
== ERROR_UNKNOWN_PROPERTY
,
5200 "Expected ERROR_UNKNOWN_PROPERTY, got %d\n", r
);
5201 ok(!lstrcmpA(buf
, "apple"), "Expected buf to be unchanged, got %s\n", buf
);
5202 ok(sz
== MAX_PATH
, "Expected MAX_PATH, got %d\n", sz
);
5204 res
= RegSetValueExA(userkey
, "LocalPackage", 0, REG_SZ
, (LPBYTE
)"local", 6);
5205 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
5207 /* LocalPackage value exists */
5209 lstrcpyA(buf
, "apple");
5210 r
= pMsiGetProductInfoExA(prodcode
, usersid
,
5211 MSIINSTALLCONTEXT_USERMANAGED
,
5212 INSTALLPROPERTY_LOCALPACKAGE
, buf
, &sz
);
5213 ok(r
== ERROR_UNKNOWN_PROPERTY
,
5214 "Expected ERROR_UNKNOWN_PROPERTY, got %d\n", r
);
5215 ok(!lstrcmpA(buf
, "apple"), "Expected buf to be unchanged, got %s\n", buf
);
5216 ok(sz
== MAX_PATH
, "Expected MAX_PATH, got %d\n", sz
);
5218 res
= RegSetValueExA(userkey
, "Publisher", 0, REG_SZ
, (LPBYTE
)"pub", 4);
5219 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
5221 /* Publisher value exists */
5223 lstrcpyA(buf
, "apple");
5224 r
= pMsiGetProductInfoExA(prodcode
, usersid
,
5225 MSIINSTALLCONTEXT_USERMANAGED
,
5226 INSTALLPROPERTY_PUBLISHER
, buf
, &sz
);
5227 ok(r
== ERROR_UNKNOWN_PROPERTY
,
5228 "Expected ERROR_UNKNOWN_PROPERTY, got %d\n", r
);
5229 ok(!lstrcmpA(buf
, "apple"), "Expected buf to be unchanged, got %s\n", buf
);
5230 ok(sz
== MAX_PATH
, "Expected MAX_PATH, got %d\n", sz
);
5232 res
= RegSetValueExA(userkey
, "URLInfoAbout", 0, REG_SZ
, (LPBYTE
)"about", 6);
5233 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
5235 /* URLInfoAbout value exists */
5237 lstrcpyA(buf
, "apple");
5238 r
= pMsiGetProductInfoExA(prodcode
, usersid
,
5239 MSIINSTALLCONTEXT_USERMANAGED
,
5240 INSTALLPROPERTY_URLINFOABOUT
, buf
, &sz
);
5241 ok(r
== ERROR_UNKNOWN_PROPERTY
,
5242 "Expected ERROR_UNKNOWN_PROPERTY, got %d\n", r
);
5243 ok(!lstrcmpA(buf
, "apple"), "Expected buf to be unchanged, got %s\n", buf
);
5244 ok(sz
== MAX_PATH
, "Expected MAX_PATH, got %d\n", sz
);
5246 res
= RegSetValueExA(userkey
, "URLUpdateInfo", 0, REG_SZ
, (LPBYTE
)"update", 7);
5247 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
5249 /* URLUpdateInfo value exists */
5251 lstrcpyA(buf
, "apple");
5252 r
= pMsiGetProductInfoExA(prodcode
, usersid
,
5253 MSIINSTALLCONTEXT_USERMANAGED
,
5254 INSTALLPROPERTY_URLUPDATEINFO
, buf
, &sz
);
5255 ok(r
== ERROR_UNKNOWN_PROPERTY
,
5256 "Expected ERROR_UNKNOWN_PROPERTY, got %d\n", r
);
5257 ok(!lstrcmpA(buf
, "apple"), "Expected buf to be unchanged, got %s\n", buf
);
5258 ok(sz
== MAX_PATH
, "Expected MAX_PATH, got %d\n", sz
);
5260 res
= RegSetValueExA(userkey
, "VersionMinor", 0, REG_SZ
, (LPBYTE
)"2", 2);
5261 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
5263 /* VersionMinor value exists */
5265 lstrcpyA(buf
, "apple");
5266 r
= pMsiGetProductInfoExA(prodcode
, usersid
,
5267 MSIINSTALLCONTEXT_USERMANAGED
,
5268 INSTALLPROPERTY_VERSIONMINOR
, buf
, &sz
);
5269 ok(r
== ERROR_UNKNOWN_PROPERTY
,
5270 "Expected ERROR_UNKNOWN_PROPERTY, got %d\n", r
);
5271 ok(!lstrcmpA(buf
, "apple"), "Expected buf to be unchanged, got %s\n", buf
);
5272 ok(sz
== MAX_PATH
, "Expected MAX_PATH, got %d\n", sz
);
5274 res
= RegSetValueExA(userkey
, "VersionMajor", 0, REG_SZ
, (LPBYTE
)"3", 2);
5275 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
5277 /* VersionMajor value exists */
5279 lstrcpyA(buf
, "apple");
5280 r
= pMsiGetProductInfoExA(prodcode
, usersid
,
5281 MSIINSTALLCONTEXT_USERMANAGED
,
5282 INSTALLPROPERTY_VERSIONMAJOR
, buf
, &sz
);
5283 ok(r
== ERROR_UNKNOWN_PROPERTY
,
5284 "Expected ERROR_UNKNOWN_PROPERTY, got %d\n", r
);
5285 ok(!lstrcmpA(buf
, "apple"), "Expected buf to be unchanged, got %s\n", buf
);
5286 ok(sz
== MAX_PATH
, "Expected MAX_PATH, got %d\n", sz
);
5288 res
= RegSetValueExA(userkey
, "DisplayVersion", 0, REG_SZ
, (LPBYTE
)"3.2.1", 6);
5289 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
5291 /* DisplayVersion value exists */
5293 lstrcpyA(buf
, "apple");
5294 r
= pMsiGetProductInfoExA(prodcode
, usersid
,
5295 MSIINSTALLCONTEXT_USERMANAGED
,
5296 INSTALLPROPERTY_VERSIONSTRING
, buf
, &sz
);
5297 ok(r
== ERROR_UNKNOWN_PROPERTY
,
5298 "Expected ERROR_UNKNOWN_PROPERTY, got %d\n", r
);
5299 ok(!lstrcmpA(buf
, "apple"), "Expected buf to be unchanged, got %s\n", buf
);
5300 ok(sz
== MAX_PATH
, "Expected MAX_PATH, got %d\n", sz
);
5302 res
= RegSetValueExA(userkey
, "ProductID", 0, REG_SZ
, (LPBYTE
)"id", 3);
5303 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
5305 /* ProductID value exists */
5307 lstrcpyA(buf
, "apple");
5308 r
= pMsiGetProductInfoExA(prodcode
, usersid
,
5309 MSIINSTALLCONTEXT_USERMANAGED
,
5310 INSTALLPROPERTY_PRODUCTID
, buf
, &sz
);
5311 ok(r
== ERROR_UNKNOWN_PROPERTY
,
5312 "Expected ERROR_UNKNOWN_PROPERTY, got %d\n", r
);
5313 ok(!lstrcmpA(buf
, "apple"), "Expected buf to be unchanged, got %s\n", buf
);
5314 ok(sz
== MAX_PATH
, "Expected MAX_PATH, got %d\n", sz
);
5316 res
= RegSetValueExA(userkey
, "RegCompany", 0, REG_SZ
, (LPBYTE
)"comp", 5);
5317 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
5319 /* RegCompany value exists */
5321 lstrcpyA(buf
, "apple");
5322 r
= pMsiGetProductInfoExA(prodcode
, usersid
,
5323 MSIINSTALLCONTEXT_USERMANAGED
,
5324 INSTALLPROPERTY_REGCOMPANY
, buf
, &sz
);
5325 ok(r
== ERROR_UNKNOWN_PROPERTY
,
5326 "Expected ERROR_UNKNOWN_PROPERTY, got %d\n", r
);
5327 ok(!lstrcmpA(buf
, "apple"), "Expected buf to be unchanged, got %s\n", buf
);
5328 ok(sz
== MAX_PATH
, "Expected MAX_PATH, got %d\n", sz
);
5330 res
= RegSetValueExA(userkey
, "RegOwner", 0, REG_SZ
, (LPBYTE
)"owner", 6);
5331 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
5333 /* RegOwner value exists */
5335 lstrcpyA(buf
, "apple");
5336 r
= pMsiGetProductInfoExA(prodcode
, usersid
,
5337 MSIINSTALLCONTEXT_USERMANAGED
,
5338 INSTALLPROPERTY_REGOWNER
, buf
, &sz
);
5339 ok(r
== ERROR_UNKNOWN_PROPERTY
,
5340 "Expected ERROR_UNKNOWN_PROPERTY, got %d\n", r
);
5341 ok(!lstrcmpA(buf
, "apple"), "Expected buf to be unchanged, got %s\n", buf
);
5342 ok(sz
== MAX_PATH
, "Expected MAX_PATH, got %d\n", sz
);
5344 res
= RegSetValueExA(userkey
, "Transforms", 0, REG_SZ
, (LPBYTE
)"trans", 6);
5345 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
5347 /* Transforms value exists */
5349 lstrcpyA(buf
, "apple");
5350 r
= pMsiGetProductInfoExA(prodcode
, usersid
,
5351 MSIINSTALLCONTEXT_USERMANAGED
,
5352 INSTALLPROPERTY_TRANSFORMS
, buf
, &sz
);
5353 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5354 ok(!lstrcmpA(buf
, "trans"), "Expected \"trans\", got \"%s\"\n", buf
);
5355 ok(sz
== 5, "Expected 5, got %d\n", sz
);
5357 res
= RegSetValueExA(userkey
, "Language", 0, REG_SZ
, (LPBYTE
)"lang", 5);
5358 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
5360 /* Language value exists */
5362 lstrcpyA(buf
, "apple");
5363 r
= pMsiGetProductInfoExA(prodcode
, usersid
,
5364 MSIINSTALLCONTEXT_USERMANAGED
,
5365 INSTALLPROPERTY_LANGUAGE
, buf
, &sz
);
5366 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5367 ok(!lstrcmpA(buf
, "lang"), "Expected \"lang\", got \"%s\"\n", buf
);
5368 ok(sz
== 4, "Expected 4, got %d\n", sz
);
5370 res
= RegSetValueExA(userkey
, "ProductName", 0, REG_SZ
, (LPBYTE
)"name", 5);
5371 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
5373 /* ProductName value exists */
5375 lstrcpyA(buf
, "apple");
5376 r
= pMsiGetProductInfoExA(prodcode
, usersid
,
5377 MSIINSTALLCONTEXT_USERMANAGED
,
5378 INSTALLPROPERTY_PRODUCTNAME
, buf
, &sz
);
5379 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5380 ok(!lstrcmpA(buf
, "name"), "Expected \"name\", got \"%s\"\n", buf
);
5381 ok(sz
== 4, "Expected 4, got %d\n", sz
);
5383 res
= RegSetValueExA(userkey
, "AssignmentType", 0, REG_SZ
, (LPBYTE
)"type", 5);
5384 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
5388 /* AssignmentType value exists */
5390 lstrcpyA(buf
, "apple");
5391 r
= pMsiGetProductInfoExA(prodcode
, usersid
,
5392 MSIINSTALLCONTEXT_USERMANAGED
,
5393 INSTALLPROPERTY_ASSIGNMENTTYPE
, buf
, &sz
);
5394 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5395 ok(!lstrcmpA(buf
, ""), "Expected \"\", got \"%s\"\n", buf
);
5396 ok(sz
== 0, "Expected 0, got %d\n", sz
);
5398 res
= RegSetValueExA(userkey
, "PackageCode", 0, REG_SZ
, (LPBYTE
)"code", 5);
5399 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
5403 /* PackageCode value exists */
5405 lstrcpyA(buf
, "apple");
5406 r
= pMsiGetProductInfoExA(prodcode
, usersid
,
5407 MSIINSTALLCONTEXT_USERMANAGED
,
5408 INSTALLPROPERTY_PACKAGECODE
, buf
, &sz
);
5411 ok(r
== ERROR_BAD_CONFIGURATION
,
5412 "Expected ERROR_BAD_CONFIGURATION, got %d\n", r
);
5413 ok(!lstrcmpA(buf
, "apple"), "Expected buf to be unchanged, got %s\n", buf
);
5414 ok(sz
== MAX_PATH
, "Expected MAX_PATH, got %d\n", sz
);
5417 res
= RegSetValueExA(userkey
, "Version", 0, REG_SZ
, (LPBYTE
)"ver", 4);
5418 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
5420 /* Version value exists */
5422 lstrcpyA(buf
, "apple");
5423 r
= pMsiGetProductInfoExA(prodcode
, usersid
,
5424 MSIINSTALLCONTEXT_USERMANAGED
,
5425 INSTALLPROPERTY_VERSION
, buf
, &sz
);
5426 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5427 ok(!lstrcmpA(buf
, "ver"), "Expected \"ver\", got \"%s\"\n", buf
);
5428 ok(sz
== 3, "Expected 3, got %d\n", sz
);
5430 res
= RegSetValueExA(userkey
, "ProductIcon", 0, REG_SZ
, (LPBYTE
)"icon", 5);
5431 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
5433 /* ProductIcon value exists */
5435 lstrcpyA(buf
, "apple");
5436 r
= pMsiGetProductInfoExA(prodcode
, usersid
,
5437 MSIINSTALLCONTEXT_USERMANAGED
,
5438 INSTALLPROPERTY_PRODUCTICON
, buf
, &sz
);
5439 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5440 ok(!lstrcmpA(buf
, "icon"), "Expected \"icon\", got \"%s\"\n", buf
);
5441 ok(sz
== 4, "Expected 4, got %d\n", sz
);
5443 res
= RegSetValueExA(userkey
, "PackageName", 0, REG_SZ
, (LPBYTE
)"name", 5);
5444 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
5446 /* PackageName value exists */
5448 lstrcpyA(buf
, "apple");
5449 r
= pMsiGetProductInfoExA(prodcode
, usersid
,
5450 MSIINSTALLCONTEXT_USERMANAGED
,
5451 INSTALLPROPERTY_PACKAGENAME
, buf
, &sz
);
5454 ok(r
== ERROR_UNKNOWN_PRODUCT
,
5455 "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r
);
5456 ok(!lstrcmpA(buf
, "apple"), "Expected buf to be unchanged, got %s\n", buf
);
5457 ok(sz
== MAX_PATH
, "Expected MAX_PATH, got %d\n", sz
);
5460 res
= RegSetValueExA(userkey
, "AuthorizedLUAApp", 0, REG_SZ
, (LPBYTE
)"auth", 5);
5461 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
5463 /* AuthorizedLUAApp value exists */
5465 lstrcpyA(buf
, "apple");
5466 r
= pMsiGetProductInfoExA(prodcode
, usersid
,
5467 MSIINSTALLCONTEXT_USERMANAGED
,
5468 INSTALLPROPERTY_AUTHORIZED_LUA_APP
, buf
, &sz
);
5469 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5470 ok(!lstrcmpA(buf
, "auth"), "Expected \"auth\", got \"%s\"\n", buf
);
5471 ok(sz
== 4, "Expected 4, got %d\n", sz
);
5473 RegDeleteValueA(userkey
, "AuthorizedLUAApp");
5474 RegDeleteValueA(userkey
, "PackageName");
5475 RegDeleteValueA(userkey
, "ProductIcon");
5476 RegDeleteValueA(userkey
, "Version");
5477 RegDeleteValueA(userkey
, "PackageCode");
5478 RegDeleteValueA(userkey
, "AssignmentType");
5479 RegDeleteValueA(userkey
, "ProductName");
5480 RegDeleteValueA(userkey
, "Language");
5481 RegDeleteValueA(userkey
, "Transforms");
5482 RegDeleteValueA(userkey
, "RegOwner");
5483 RegDeleteValueA(userkey
, "RegCompany");
5484 RegDeleteValueA(userkey
, "ProductID");
5485 RegDeleteValueA(userkey
, "DisplayVersion");
5486 RegDeleteValueA(userkey
, "VersionMajor");
5487 RegDeleteValueA(userkey
, "VersionMinor");
5488 RegDeleteValueA(userkey
, "URLUpdateInfo");
5489 RegDeleteValueA(userkey
, "URLInfoAbout");
5490 RegDeleteValueA(userkey
, "Publisher");
5491 RegDeleteValueA(userkey
, "LocalPackage");
5492 RegDeleteValueA(userkey
, "InstallSource");
5493 RegDeleteValueA(userkey
, "InstallLocation");
5494 RegDeleteValueA(userkey
, "DisplayName");
5495 RegDeleteValueA(userkey
, "InstallDate");
5496 RegDeleteValueA(userkey
, "HelpTelephone");
5497 RegDeleteValueA(userkey
, "HelpLink");
5498 RegDeleteKeyA(userkey
, "");
5499 RegCloseKey(userkey
);
5500 RegDeleteKeyA(prodkey
, "");
5501 RegCloseKey(prodkey
);
5503 /* MSIINSTALLCONTEXT_MACHINE */
5505 /* szUserSid is non-NULL */
5507 lstrcpyA(buf
, "apple");
5508 r
= pMsiGetProductInfoExA(prodcode
, usersid
,
5509 MSIINSTALLCONTEXT_MACHINE
,
5510 INSTALLPROPERTY_PRODUCTSTATE
, buf
, &sz
);
5511 ok(r
== ERROR_INVALID_PARAMETER
,
5512 "Expected ERROR_INVALID_PARAMETER, got %d\n", r
);
5513 ok(!lstrcmpA(buf
, "apple"), "Expected buf to be unchanged, got %s\n", buf
);
5514 ok(sz
== MAX_PATH
, "Expected MAX_PATH, got %d\n", sz
);
5516 lstrcpyA(keypath
, "Software\\Microsoft\\Windows\\CurrentVersion\\Installer\\UserData\\S-1-5-18\\Products\\");
5517 lstrcatA(keypath
, prod_squashed
);
5519 res
= RegCreateKeyA(HKEY_LOCAL_MACHINE
, keypath
, &localkey
);
5520 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
5522 /* local system product key exists */
5524 lstrcpyA(buf
, "apple");
5525 r
= pMsiGetProductInfoExA(prodcode
, NULL
,
5526 MSIINSTALLCONTEXT_MACHINE
,
5527 INSTALLPROPERTY_PRODUCTSTATE
, buf
, &sz
);
5528 ok(r
== ERROR_UNKNOWN_PRODUCT
,
5529 "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r
);
5530 ok(!lstrcmpA(buf
, "apple"), "Expected buf to be unchanged, got %s\n", buf
);
5531 ok(sz
== MAX_PATH
, "Expected MAX_PATH, got %d\n", sz
);
5533 res
= RegCreateKeyA(localkey
, "InstallProperties", &propkey
);
5534 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
5536 /* InstallProperties key exists */
5538 lstrcpyA(buf
, "apple");
5539 r
= pMsiGetProductInfoExA(prodcode
, NULL
,
5540 MSIINSTALLCONTEXT_MACHINE
,
5541 INSTALLPROPERTY_PRODUCTSTATE
, buf
, &sz
);
5542 ok(r
== ERROR_UNKNOWN_PRODUCT
,
5543 "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r
);
5544 ok(!lstrcmpA(buf
, "apple"), "Expected buf to be unchanged, got %s\n", buf
);
5545 ok(sz
== MAX_PATH
, "Expected MAX_PATH, got %d\n", sz
);
5547 res
= RegSetValueExA(propkey
, "LocalPackage", 0, REG_SZ
, (LPBYTE
)"local", 6);
5548 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
5550 /* LocalPackage value exists */
5552 lstrcpyA(buf
, "apple");
5553 r
= pMsiGetProductInfoExA(prodcode
, NULL
,
5554 MSIINSTALLCONTEXT_MACHINE
,
5555 INSTALLPROPERTY_PRODUCTSTATE
, buf
, &sz
);
5556 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5557 ok(!lstrcmpA(buf
, "5"), "Expected \"5\", got \"%s\"\n", buf
);
5558 ok(sz
== 1, "Expected 1, got %d\n", sz
);
5560 res
= RegSetValueExA(propkey
, "HelpLink", 0, REG_SZ
, (LPBYTE
)"link", 5);
5561 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
5563 /* HelpLink value exists */
5565 lstrcpyA(buf
, "apple");
5566 r
= pMsiGetProductInfoExA(prodcode
, NULL
,
5567 MSIINSTALLCONTEXT_MACHINE
,
5568 INSTALLPROPERTY_HELPLINK
, buf
, &sz
);
5569 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5570 ok(!lstrcmpA(buf
, "link"), "Expected \"link\", got \"%s\"\n", buf
);
5571 ok(sz
== 4, "Expected 4, got %d\n", sz
);
5573 res
= RegSetValueExA(propkey
, "HelpTelephone", 0, REG_SZ
, (LPBYTE
)"phone", 6);
5574 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
5576 /* HelpTelephone value exists */
5578 lstrcpyA(buf
, "apple");
5579 r
= pMsiGetProductInfoExA(prodcode
, NULL
,
5580 MSIINSTALLCONTEXT_MACHINE
,
5581 INSTALLPROPERTY_HELPTELEPHONE
, buf
, &sz
);
5582 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5583 ok(!lstrcmpA(buf
, "phone"), "Expected \"phone\", got \"%s\"\n", buf
);
5584 ok(sz
== 5, "Expected 5, got %d\n", sz
);
5586 res
= RegSetValueExA(propkey
, "InstallDate", 0, REG_SZ
, (LPBYTE
)"date", 5);
5587 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
5589 /* InstallDate value exists */
5591 lstrcpyA(buf
, "apple");
5592 r
= pMsiGetProductInfoExA(prodcode
, NULL
,
5593 MSIINSTALLCONTEXT_MACHINE
,
5594 INSTALLPROPERTY_INSTALLDATE
, buf
, &sz
);
5595 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5596 ok(!lstrcmpA(buf
, "date"), "Expected \"date\", got \"%s\"\n", buf
);
5597 ok(sz
== 4, "Expected 4, got %d\n", sz
);
5599 res
= RegSetValueExA(propkey
, "DisplayName", 0, REG_SZ
, (LPBYTE
)"name", 5);
5600 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
5602 /* DisplayName value exists */
5604 lstrcpyA(buf
, "apple");
5605 r
= pMsiGetProductInfoExA(prodcode
, NULL
,
5606 MSIINSTALLCONTEXT_MACHINE
,
5607 INSTALLPROPERTY_INSTALLEDPRODUCTNAME
, buf
, &sz
);
5608 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5609 ok(!lstrcmpA(buf
, "name"), "Expected \"name\", got \"%s\"\n", buf
);
5610 ok(sz
== 4, "Expected 4, got %d\n", sz
);
5612 res
= RegSetValueExA(propkey
, "InstallLocation", 0, REG_SZ
, (LPBYTE
)"loc", 4);
5613 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
5615 /* InstallLocation value exists */
5617 lstrcpyA(buf
, "apple");
5618 r
= pMsiGetProductInfoExA(prodcode
, NULL
,
5619 MSIINSTALLCONTEXT_MACHINE
,
5620 INSTALLPROPERTY_INSTALLLOCATION
, buf
, &sz
);
5621 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5622 ok(!lstrcmpA(buf
, "loc"), "Expected \"loc\", got \"%s\"\n", buf
);
5623 ok(sz
== 3, "Expected 3, got %d\n", sz
);
5625 res
= RegSetValueExA(propkey
, "InstallSource", 0, REG_SZ
, (LPBYTE
)"source", 7);
5626 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
5628 /* InstallSource value exists */
5630 lstrcpyA(buf
, "apple");
5631 r
= pMsiGetProductInfoExA(prodcode
, NULL
,
5632 MSIINSTALLCONTEXT_MACHINE
,
5633 INSTALLPROPERTY_INSTALLSOURCE
, buf
, &sz
);
5634 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5635 ok(!lstrcmpA(buf
, "source"), "Expected \"source\", got \"%s\"\n", buf
);
5636 ok(sz
== 6, "Expected 6, got %d\n", sz
);
5638 res
= RegSetValueExA(propkey
, "LocalPackage", 0, REG_SZ
, (LPBYTE
)"local", 6);
5639 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
5641 /* LocalPackage value exists */
5643 lstrcpyA(buf
, "apple");
5644 r
= pMsiGetProductInfoExA(prodcode
, NULL
,
5645 MSIINSTALLCONTEXT_MACHINE
,
5646 INSTALLPROPERTY_LOCALPACKAGE
, buf
, &sz
);
5647 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5648 ok(!lstrcmpA(buf
, "local"), "Expected \"local\", got \"%s\"\n", buf
);
5649 ok(sz
== 5, "Expected 5, got %d\n", sz
);
5651 res
= RegSetValueExA(propkey
, "Publisher", 0, REG_SZ
, (LPBYTE
)"pub", 4);
5652 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
5654 /* Publisher value exists */
5656 lstrcpyA(buf
, "apple");
5657 r
= pMsiGetProductInfoExA(prodcode
, NULL
,
5658 MSIINSTALLCONTEXT_MACHINE
,
5659 INSTALLPROPERTY_PUBLISHER
, buf
, &sz
);
5660 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5661 ok(!lstrcmpA(buf
, "pub"), "Expected \"pub\", got \"%s\"\n", buf
);
5662 ok(sz
== 3, "Expected 3, got %d\n", sz
);
5664 res
= RegSetValueExA(propkey
, "URLInfoAbout", 0, REG_SZ
, (LPBYTE
)"about", 6);
5665 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
5667 /* URLInfoAbout value exists */
5669 lstrcpyA(buf
, "apple");
5670 r
= pMsiGetProductInfoExA(prodcode
, NULL
,
5671 MSIINSTALLCONTEXT_MACHINE
,
5672 INSTALLPROPERTY_URLINFOABOUT
, buf
, &sz
);
5673 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5674 ok(!lstrcmpA(buf
, "about"), "Expected \"about\", got \"%s\"\n", buf
);
5675 ok(sz
== 5, "Expected 5, got %d\n", sz
);
5677 res
= RegSetValueExA(propkey
, "URLUpdateInfo", 0, REG_SZ
, (LPBYTE
)"update", 7);
5678 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
5680 /* URLUpdateInfo value exists */
5682 lstrcpyA(buf
, "apple");
5683 r
= pMsiGetProductInfoExA(prodcode
, NULL
,
5684 MSIINSTALLCONTEXT_MACHINE
,
5685 INSTALLPROPERTY_URLUPDATEINFO
, buf
, &sz
);
5686 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5687 ok(!lstrcmpA(buf
, "update"), "Expected \"update\", got \"%s\"\n", buf
);
5688 ok(sz
== 6, "Expected 6, got %d\n", sz
);
5690 res
= RegSetValueExA(propkey
, "VersionMinor", 0, REG_SZ
, (LPBYTE
)"2", 2);
5691 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
5693 /* VersionMinor value exists */
5695 lstrcpyA(buf
, "apple");
5696 r
= pMsiGetProductInfoExA(prodcode
, NULL
,
5697 MSIINSTALLCONTEXT_MACHINE
,
5698 INSTALLPROPERTY_VERSIONMINOR
, buf
, &sz
);
5699 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5700 ok(!lstrcmpA(buf
, "2"), "Expected \"2\", got \"%s\"\n", buf
);
5701 ok(sz
== 1, "Expected 1, got %d\n", sz
);
5703 res
= RegSetValueExA(propkey
, "VersionMajor", 0, REG_SZ
, (LPBYTE
)"3", 2);
5704 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
5706 /* VersionMajor value exists */
5708 lstrcpyA(buf
, "apple");
5709 r
= pMsiGetProductInfoExA(prodcode
, NULL
,
5710 MSIINSTALLCONTEXT_MACHINE
,
5711 INSTALLPROPERTY_VERSIONMAJOR
, buf
, &sz
);
5712 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5713 ok(!lstrcmpA(buf
, "3"), "Expected \"3\", got \"%s\"\n", buf
);
5714 ok(sz
== 1, "Expected 1, got %d\n", sz
);
5716 res
= RegSetValueExA(propkey
, "DisplayVersion", 0, REG_SZ
, (LPBYTE
)"3.2.1", 6);
5717 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
5719 /* DisplayVersion value exists */
5721 lstrcpyA(buf
, "apple");
5722 r
= pMsiGetProductInfoExA(prodcode
, NULL
,
5723 MSIINSTALLCONTEXT_MACHINE
,
5724 INSTALLPROPERTY_VERSIONSTRING
, buf
, &sz
);
5725 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5726 ok(!lstrcmpA(buf
, "3.2.1"), "Expected \"3.2.1\", got \"%s\"\n", buf
);
5727 ok(sz
== 5, "Expected 5, got %d\n", sz
);
5729 res
= RegSetValueExA(propkey
, "ProductID", 0, REG_SZ
, (LPBYTE
)"id", 3);
5730 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
5732 /* ProductID value exists */
5734 lstrcpyA(buf
, "apple");
5735 r
= pMsiGetProductInfoExA(prodcode
, NULL
,
5736 MSIINSTALLCONTEXT_MACHINE
,
5737 INSTALLPROPERTY_PRODUCTID
, buf
, &sz
);
5738 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5739 ok(!lstrcmpA(buf
, "id"), "Expected \"id\", got \"%s\"\n", buf
);
5740 ok(sz
== 2, "Expected 2, got %d\n", sz
);
5742 res
= RegSetValueExA(propkey
, "RegCompany", 0, REG_SZ
, (LPBYTE
)"comp", 5);
5743 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
5745 /* RegCompany value exists */
5747 lstrcpyA(buf
, "apple");
5748 r
= pMsiGetProductInfoExA(prodcode
, NULL
,
5749 MSIINSTALLCONTEXT_MACHINE
,
5750 INSTALLPROPERTY_REGCOMPANY
, buf
, &sz
);
5751 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5752 ok(!lstrcmpA(buf
, "comp"), "Expected \"comp\", got \"%s\"\n", buf
);
5753 ok(sz
== 4, "Expected 4, got %d\n", sz
);
5755 res
= RegSetValueExA(propkey
, "RegOwner", 0, REG_SZ
, (LPBYTE
)"owner", 6);
5756 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
5758 /* RegOwner value exists */
5760 lstrcpyA(buf
, "apple");
5761 r
= pMsiGetProductInfoExA(prodcode
, NULL
,
5762 MSIINSTALLCONTEXT_MACHINE
,
5763 INSTALLPROPERTY_REGOWNER
, buf
, &sz
);
5764 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5765 ok(!lstrcmpA(buf
, "owner"), "Expected \"owner\", got \"%s\"\n", buf
);
5766 ok(sz
== 5, "Expected 5, got %d\n", sz
);
5768 res
= RegSetValueExA(propkey
, "Transforms", 0, REG_SZ
, (LPBYTE
)"trans", 6);
5769 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
5771 /* Transforms value exists */
5773 lstrcpyA(buf
, "apple");
5774 r
= pMsiGetProductInfoExA(prodcode
, NULL
,
5775 MSIINSTALLCONTEXT_MACHINE
,
5776 INSTALLPROPERTY_TRANSFORMS
, buf
, &sz
);
5777 ok(r
== ERROR_UNKNOWN_PRODUCT
,
5778 "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r
);
5779 ok(!lstrcmpA(buf
, "apple"), "Expected buf to be unchanged, got %s\n", buf
);
5780 ok(sz
== MAX_PATH
, "Expected MAX_PATH, got %d\n", sz
);
5782 res
= RegSetValueExA(propkey
, "Language", 0, REG_SZ
, (LPBYTE
)"lang", 5);
5783 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
5785 /* Language value exists */
5787 lstrcpyA(buf
, "apple");
5788 r
= pMsiGetProductInfoExA(prodcode
, NULL
,
5789 MSIINSTALLCONTEXT_MACHINE
,
5790 INSTALLPROPERTY_LANGUAGE
, buf
, &sz
);
5791 ok(r
== ERROR_UNKNOWN_PRODUCT
,
5792 "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r
);
5793 ok(!lstrcmpA(buf
, "apple"), "Expected buf to be unchanged, got %s\n", buf
);
5794 ok(sz
== MAX_PATH
, "Expected MAX_PATH, got %d\n", sz
);
5796 res
= RegSetValueExA(propkey
, "ProductName", 0, REG_SZ
, (LPBYTE
)"name", 5);
5797 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
5799 /* ProductName value exists */
5801 lstrcpyA(buf
, "apple");
5802 r
= pMsiGetProductInfoExA(prodcode
, NULL
,
5803 MSIINSTALLCONTEXT_MACHINE
,
5804 INSTALLPROPERTY_PRODUCTNAME
, buf
, &sz
);
5805 ok(r
== ERROR_UNKNOWN_PRODUCT
,
5806 "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r
);
5807 ok(!lstrcmpA(buf
, "apple"), "Expected buf to be unchanged, got %s\n", buf
);
5808 ok(sz
== MAX_PATH
, "Expected MAX_PATH, got %d\n", sz
);
5810 res
= RegSetValueExA(propkey
, "AssignmentType", 0, REG_SZ
, (LPBYTE
)"type", 5);
5811 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
5815 /* AssignmentType value exists */
5817 lstrcpyA(buf
, "apple");
5818 r
= pMsiGetProductInfoExA(prodcode
, NULL
,
5819 MSIINSTALLCONTEXT_MACHINE
,
5820 INSTALLPROPERTY_ASSIGNMENTTYPE
, buf
, &sz
);
5821 ok(r
== ERROR_UNKNOWN_PRODUCT
,
5822 "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r
);
5823 ok(!lstrcmpA(buf
, "apple"), "Expected buf to be unchanged, got %s\n", buf
);
5824 ok(sz
== MAX_PATH
, "Expected MAX_PATH, got %d\n", sz
);
5826 res
= RegSetValueExA(propkey
, "PackageCode", 0, REG_SZ
, (LPBYTE
)"code", 5);
5827 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
5829 /* PackageCode value exists */
5831 lstrcpyA(buf
, "apple");
5832 r
= pMsiGetProductInfoExA(prodcode
, NULL
,
5833 MSIINSTALLCONTEXT_MACHINE
,
5834 INSTALLPROPERTY_PACKAGECODE
, buf
, &sz
);
5835 ok(r
== ERROR_UNKNOWN_PRODUCT
,
5836 "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r
);
5837 ok(!lstrcmpA(buf
, "apple"), "Expected buf to be unchanged, got %s\n", buf
);
5838 ok(sz
== MAX_PATH
, "Expected MAX_PATH, got %d\n", sz
);
5840 res
= RegSetValueExA(propkey
, "Version", 0, REG_SZ
, (LPBYTE
)"ver", 4);
5841 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
5843 /* Version value exists */
5845 lstrcpyA(buf
, "apple");
5846 r
= pMsiGetProductInfoExA(prodcode
, NULL
,
5847 MSIINSTALLCONTEXT_MACHINE
,
5848 INSTALLPROPERTY_VERSION
, buf
, &sz
);
5849 ok(r
== ERROR_UNKNOWN_PRODUCT
,
5850 "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r
);
5851 ok(!lstrcmpA(buf
, "apple"), "Expected buf to be unchanged, got %s\n", buf
);
5852 ok(sz
== MAX_PATH
, "Expected MAX_PATH, got %d\n", sz
);
5854 res
= RegSetValueExA(propkey
, "ProductIcon", 0, REG_SZ
, (LPBYTE
)"icon", 5);
5855 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
5857 /* ProductIcon value exists */
5859 lstrcpyA(buf
, "apple");
5860 r
= pMsiGetProductInfoExA(prodcode
, NULL
,
5861 MSIINSTALLCONTEXT_MACHINE
,
5862 INSTALLPROPERTY_PRODUCTICON
, buf
, &sz
);
5863 ok(r
== ERROR_UNKNOWN_PRODUCT
,
5864 "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r
);
5865 ok(!lstrcmpA(buf
, "apple"), "Expected buf to be unchanged, got %s\n", buf
);
5866 ok(sz
== MAX_PATH
, "Expected MAX_PATH, got %d\n", sz
);
5868 res
= RegSetValueExA(propkey
, "PackageName", 0, REG_SZ
, (LPBYTE
)"name", 5);
5869 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
5871 /* PackageName value exists */
5873 lstrcpyA(buf
, "apple");
5874 r
= pMsiGetProductInfoExA(prodcode
, NULL
,
5875 MSIINSTALLCONTEXT_MACHINE
,
5876 INSTALLPROPERTY_PACKAGENAME
, buf
, &sz
);
5877 ok(r
== ERROR_UNKNOWN_PRODUCT
,
5878 "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r
);
5879 ok(!lstrcmpA(buf
, "apple"), "Expected buf to be unchanged, got %s\n", buf
);
5880 ok(sz
== MAX_PATH
, "Expected MAX_PATH, got %d\n", sz
);
5882 res
= RegSetValueExA(propkey
, "AuthorizedLUAApp", 0, REG_SZ
, (LPBYTE
)"auth", 5);
5883 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
5885 /* AuthorizedLUAApp value exists */
5887 lstrcpyA(buf
, "apple");
5888 r
= pMsiGetProductInfoExA(prodcode
, NULL
,
5889 MSIINSTALLCONTEXT_MACHINE
,
5890 INSTALLPROPERTY_AUTHORIZED_LUA_APP
, buf
, &sz
);
5891 ok(r
== ERROR_UNKNOWN_PRODUCT
,
5892 "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r
);
5893 ok(!lstrcmpA(buf
, "apple"), "Expected buf to be unchanged, got %s\n", buf
);
5894 ok(sz
== MAX_PATH
, "Expected MAX_PATH, got %d\n", sz
);
5896 RegDeleteValueA(propkey
, "AuthorizedLUAApp");
5897 RegDeleteValueA(propkey
, "PackageName");
5898 RegDeleteValueA(propkey
, "ProductIcon");
5899 RegDeleteValueA(propkey
, "Version");
5900 RegDeleteValueA(propkey
, "PackageCode");
5901 RegDeleteValueA(propkey
, "AssignmentType");
5902 RegDeleteValueA(propkey
, "ProductName");
5903 RegDeleteValueA(propkey
, "Language");
5904 RegDeleteValueA(propkey
, "Transforms");
5905 RegDeleteValueA(propkey
, "RegOwner");
5906 RegDeleteValueA(propkey
, "RegCompany");
5907 RegDeleteValueA(propkey
, "ProductID");
5908 RegDeleteValueA(propkey
, "DisplayVersion");
5909 RegDeleteValueA(propkey
, "VersionMajor");
5910 RegDeleteValueA(propkey
, "VersionMinor");
5911 RegDeleteValueA(propkey
, "URLUpdateInfo");
5912 RegDeleteValueA(propkey
, "URLInfoAbout");
5913 RegDeleteValueA(propkey
, "Publisher");
5914 RegDeleteValueA(propkey
, "LocalPackage");
5915 RegDeleteValueA(propkey
, "InstallSource");
5916 RegDeleteValueA(propkey
, "InstallLocation");
5917 RegDeleteValueA(propkey
, "DisplayName");
5918 RegDeleteValueA(propkey
, "InstallDate");
5919 RegDeleteValueA(propkey
, "HelpTelephone");
5920 RegDeleteValueA(propkey
, "HelpLink");
5921 RegDeleteValueA(propkey
, "LocalPackage");
5922 RegDeleteKeyA(propkey
, "");
5923 RegCloseKey(propkey
);
5924 RegDeleteKeyA(localkey
, "");
5925 RegCloseKey(localkey
);
5927 lstrcpyA(keypath
, "Software\\Classes\\Installer\\Products\\");
5928 lstrcatA(keypath
, prod_squashed
);
5930 res
= RegCreateKeyA(HKEY_LOCAL_MACHINE
, keypath
, &prodkey
);
5931 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
5933 /* local classes product key exists */
5935 lstrcpyA(buf
, "apple");
5936 r
= pMsiGetProductInfoExA(prodcode
, NULL
,
5937 MSIINSTALLCONTEXT_MACHINE
,
5938 INSTALLPROPERTY_PRODUCTSTATE
, buf
, &sz
);
5939 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5940 ok(!lstrcmpA(buf
, "1"), "Expected \"1\", got \"%s\"\n", buf
);
5941 ok(sz
== 1, "Expected 1, got %d\n", sz
);
5943 res
= RegSetValueExA(prodkey
, "HelpLink", 0, REG_SZ
, (LPBYTE
)"link", 5);
5944 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
5946 /* HelpLink value exists */
5948 lstrcpyA(buf
, "apple");
5949 r
= pMsiGetProductInfoExA(prodcode
, NULL
,
5950 MSIINSTALLCONTEXT_MACHINE
,
5951 INSTALLPROPERTY_HELPLINK
, buf
, &sz
);
5952 ok(r
== ERROR_UNKNOWN_PROPERTY
,
5953 "Expected ERROR_UNKNOWN_PROPERTY, got %d\n", r
);
5954 ok(!lstrcmpA(buf
, "apple"), "Expected buf to be unchanged, got %s\n", buf
);
5955 ok(sz
== MAX_PATH
, "Expected MAX_PATH, got %d\n", sz
);
5957 res
= RegSetValueExA(prodkey
, "HelpTelephone", 0, REG_SZ
, (LPBYTE
)"phone", 6);
5958 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
5960 /* HelpTelephone value exists */
5962 lstrcpyA(buf
, "apple");
5963 r
= pMsiGetProductInfoExA(prodcode
, NULL
,
5964 MSIINSTALLCONTEXT_MACHINE
,
5965 INSTALLPROPERTY_HELPTELEPHONE
, buf
, &sz
);
5966 ok(r
== ERROR_UNKNOWN_PROPERTY
,
5967 "Expected ERROR_UNKNOWN_PROPERTY, got %d\n", r
);
5968 ok(!lstrcmpA(buf
, "apple"), "Expected buf to be unchanged, got %s\n", buf
);
5969 ok(sz
== MAX_PATH
, "Expected MAX_PATH, got %d\n", sz
);
5971 res
= RegSetValueExA(prodkey
, "InstallDate", 0, REG_SZ
, (LPBYTE
)"date", 5);
5972 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
5974 /* InstallDate value exists */
5976 lstrcpyA(buf
, "apple");
5977 r
= pMsiGetProductInfoExA(prodcode
, NULL
,
5978 MSIINSTALLCONTEXT_MACHINE
,
5979 INSTALLPROPERTY_INSTALLDATE
, buf
, &sz
);
5980 ok(r
== ERROR_UNKNOWN_PROPERTY
,
5981 "Expected ERROR_UNKNOWN_PROPERTY, got %d\n", r
);
5982 ok(!lstrcmpA(buf
, "apple"), "Expected buf to be unchanged, got %s\n", buf
);
5983 ok(sz
== MAX_PATH
, "Expected MAX_PATH, got %d\n", sz
);
5985 res
= RegSetValueExA(prodkey
, "DisplayName", 0, REG_SZ
, (LPBYTE
)"name", 5);
5986 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
5988 /* DisplayName value exists */
5990 lstrcpyA(buf
, "apple");
5991 r
= pMsiGetProductInfoExA(prodcode
, NULL
,
5992 MSIINSTALLCONTEXT_MACHINE
,
5993 INSTALLPROPERTY_INSTALLEDPRODUCTNAME
, buf
, &sz
);
5994 ok(r
== ERROR_UNKNOWN_PROPERTY
,
5995 "Expected ERROR_UNKNOWN_PROPERTY, got %d\n", r
);
5996 ok(!lstrcmpA(buf
, "apple"), "Expected buf to be unchanged, got %s\n", buf
);
5997 ok(sz
== MAX_PATH
, "Expected MAX_PATH, got %d\n", sz
);
5999 res
= RegSetValueExA(prodkey
, "InstallLocation", 0, REG_SZ
, (LPBYTE
)"loc", 4);
6000 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
6002 /* InstallLocation value exists */
6004 lstrcpyA(buf
, "apple");
6005 r
= pMsiGetProductInfoExA(prodcode
, NULL
,
6006 MSIINSTALLCONTEXT_MACHINE
,
6007 INSTALLPROPERTY_INSTALLLOCATION
, buf
, &sz
);
6008 ok(r
== ERROR_UNKNOWN_PROPERTY
,
6009 "Expected ERROR_UNKNOWN_PROPERTY, got %d\n", r
);
6010 ok(!lstrcmpA(buf
, "apple"), "Expected buf to be unchanged, got %s\n", buf
);
6011 ok(sz
== MAX_PATH
, "Expected MAX_PATH, got %d\n", sz
);
6013 res
= RegSetValueExA(prodkey
, "InstallSource", 0, REG_SZ
, (LPBYTE
)"source", 7);
6014 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
6016 /* InstallSource value exists */
6018 lstrcpyA(buf
, "apple");
6019 r
= pMsiGetProductInfoExA(prodcode
, NULL
,
6020 MSIINSTALLCONTEXT_MACHINE
,
6021 INSTALLPROPERTY_INSTALLSOURCE
, buf
, &sz
);
6022 ok(r
== ERROR_UNKNOWN_PROPERTY
,
6023 "Expected ERROR_UNKNOWN_PROPERTY, got %d\n", r
);
6024 ok(!lstrcmpA(buf
, "apple"), "Expected buf to be unchanged, got %s\n", buf
);
6025 ok(sz
== MAX_PATH
, "Expected MAX_PATH, got %d\n", sz
);
6027 res
= RegSetValueExA(prodkey
, "LocalPackage", 0, REG_SZ
, (LPBYTE
)"local", 6);
6028 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
6030 /* LocalPackage value exists */
6032 lstrcpyA(buf
, "apple");
6033 r
= pMsiGetProductInfoExA(prodcode
, NULL
,
6034 MSIINSTALLCONTEXT_MACHINE
,
6035 INSTALLPROPERTY_LOCALPACKAGE
, buf
, &sz
);
6036 ok(r
== ERROR_UNKNOWN_PROPERTY
,
6037 "Expected ERROR_UNKNOWN_PROPERTY, got %d\n", r
);
6038 ok(!lstrcmpA(buf
, "apple"), "Expected buf to be unchanged, got %s\n", buf
);
6039 ok(sz
== MAX_PATH
, "Expected MAX_PATH, got %d\n", sz
);
6041 res
= RegSetValueExA(prodkey
, "Publisher", 0, REG_SZ
, (LPBYTE
)"pub", 4);
6042 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
6044 /* Publisher value exists */
6046 lstrcpyA(buf
, "apple");
6047 r
= pMsiGetProductInfoExA(prodcode
, NULL
,
6048 MSIINSTALLCONTEXT_MACHINE
,
6049 INSTALLPROPERTY_PUBLISHER
, buf
, &sz
);
6050 ok(r
== ERROR_UNKNOWN_PROPERTY
,
6051 "Expected ERROR_UNKNOWN_PROPERTY, got %d\n", r
);
6052 ok(!lstrcmpA(buf
, "apple"), "Expected buf to be unchanged, got %s\n", buf
);
6053 ok(sz
== MAX_PATH
, "Expected MAX_PATH, got %d\n", sz
);
6055 res
= RegSetValueExA(prodkey
, "URLInfoAbout", 0, REG_SZ
, (LPBYTE
)"about", 6);
6056 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
6058 /* URLInfoAbout value exists */
6060 lstrcpyA(buf
, "apple");
6061 r
= pMsiGetProductInfoExA(prodcode
, NULL
,
6062 MSIINSTALLCONTEXT_MACHINE
,
6063 INSTALLPROPERTY_URLINFOABOUT
, buf
, &sz
);
6064 ok(r
== ERROR_UNKNOWN_PROPERTY
,
6065 "Expected ERROR_UNKNOWN_PROPERTY, got %d\n", r
);
6066 ok(!lstrcmpA(buf
, "apple"), "Expected buf to be unchanged, got %s\n", buf
);
6067 ok(sz
== MAX_PATH
, "Expected MAX_PATH, got %d\n", sz
);
6069 res
= RegSetValueExA(prodkey
, "URLUpdateInfo", 0, REG_SZ
, (LPBYTE
)"update", 7);
6070 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
6072 /* URLUpdateInfo value exists */
6074 lstrcpyA(buf
, "apple");
6075 r
= pMsiGetProductInfoExA(prodcode
, NULL
,
6076 MSIINSTALLCONTEXT_MACHINE
,
6077 INSTALLPROPERTY_URLUPDATEINFO
, buf
, &sz
);
6078 ok(r
== ERROR_UNKNOWN_PROPERTY
,
6079 "Expected ERROR_UNKNOWN_PROPERTY, got %d\n", r
);
6080 ok(!lstrcmpA(buf
, "apple"), "Expected buf to be unchanged, got %s\n", buf
);
6081 ok(sz
== MAX_PATH
, "Expected MAX_PATH, got %d\n", sz
);
6083 res
= RegSetValueExA(prodkey
, "VersionMinor", 0, REG_SZ
, (LPBYTE
)"2", 2);
6084 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
6086 /* VersionMinor value exists */
6088 lstrcpyA(buf
, "apple");
6089 r
= pMsiGetProductInfoExA(prodcode
, NULL
,
6090 MSIINSTALLCONTEXT_MACHINE
,
6091 INSTALLPROPERTY_VERSIONMINOR
, buf
, &sz
);
6092 ok(r
== ERROR_UNKNOWN_PROPERTY
,
6093 "Expected ERROR_UNKNOWN_PROPERTY, got %d\n", r
);
6094 ok(!lstrcmpA(buf
, "apple"), "Expected buf to be unchanged, got %s\n", buf
);
6095 ok(sz
== MAX_PATH
, "Expected MAX_PATH, got %d\n", sz
);
6097 res
= RegSetValueExA(prodkey
, "VersionMajor", 0, REG_SZ
, (LPBYTE
)"3", 2);
6098 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
6100 /* VersionMajor value exists */
6102 lstrcpyA(buf
, "apple");
6103 r
= pMsiGetProductInfoExA(prodcode
, NULL
,
6104 MSIINSTALLCONTEXT_MACHINE
,
6105 INSTALLPROPERTY_VERSIONMAJOR
, buf
, &sz
);
6106 ok(r
== ERROR_UNKNOWN_PROPERTY
,
6107 "Expected ERROR_UNKNOWN_PROPERTY, got %d\n", r
);
6108 ok(!lstrcmpA(buf
, "apple"), "Expected buf to be unchanged, got %s\n", buf
);
6109 ok(sz
== MAX_PATH
, "Expected MAX_PATH, got %d\n", sz
);
6111 res
= RegSetValueExA(prodkey
, "DisplayVersion", 0, REG_SZ
, (LPBYTE
)"3.2.1", 6);
6112 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
6114 /* DisplayVersion value exists */
6116 lstrcpyA(buf
, "apple");
6117 r
= pMsiGetProductInfoExA(prodcode
, NULL
,
6118 MSIINSTALLCONTEXT_MACHINE
,
6119 INSTALLPROPERTY_VERSIONSTRING
, buf
, &sz
);
6120 ok(r
== ERROR_UNKNOWN_PROPERTY
,
6121 "Expected ERROR_UNKNOWN_PROPERTY, got %d\n", r
);
6122 ok(!lstrcmpA(buf
, "apple"), "Expected buf to be unchanged, got %s\n", buf
);
6123 ok(sz
== MAX_PATH
, "Expected MAX_PATH, got %d\n", sz
);
6125 res
= RegSetValueExA(prodkey
, "ProductID", 0, REG_SZ
, (LPBYTE
)"id", 3);
6126 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
6128 /* ProductID value exists */
6130 lstrcpyA(buf
, "apple");
6131 r
= pMsiGetProductInfoExA(prodcode
, NULL
,
6132 MSIINSTALLCONTEXT_MACHINE
,
6133 INSTALLPROPERTY_PRODUCTID
, buf
, &sz
);
6134 ok(r
== ERROR_UNKNOWN_PROPERTY
,
6135 "Expected ERROR_UNKNOWN_PROPERTY, got %d\n", r
);
6136 ok(!lstrcmpA(buf
, "apple"), "Expected buf to be unchanged, got %s\n", buf
);
6137 ok(sz
== MAX_PATH
, "Expected MAX_PATH, got %d\n", sz
);
6139 res
= RegSetValueExA(prodkey
, "RegCompany", 0, REG_SZ
, (LPBYTE
)"comp", 5);
6140 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
6142 /* RegCompany value exists */
6144 lstrcpyA(buf
, "apple");
6145 r
= pMsiGetProductInfoExA(prodcode
, NULL
,
6146 MSIINSTALLCONTEXT_MACHINE
,
6147 INSTALLPROPERTY_REGCOMPANY
, buf
, &sz
);
6148 ok(r
== ERROR_UNKNOWN_PROPERTY
,
6149 "Expected ERROR_UNKNOWN_PROPERTY, got %d\n", r
);
6150 ok(!lstrcmpA(buf
, "apple"), "Expected buf to be unchanged, got %s\n", buf
);
6151 ok(sz
== MAX_PATH
, "Expected MAX_PATH, got %d\n", sz
);
6153 res
= RegSetValueExA(prodkey
, "RegOwner", 0, REG_SZ
, (LPBYTE
)"owner", 6);
6154 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
6156 /* RegOwner value exists */
6158 lstrcpyA(buf
, "apple");
6159 r
= pMsiGetProductInfoExA(prodcode
, NULL
,
6160 MSIINSTALLCONTEXT_MACHINE
,
6161 INSTALLPROPERTY_REGOWNER
, buf
, &sz
);
6162 ok(r
== ERROR_UNKNOWN_PROPERTY
,
6163 "Expected ERROR_UNKNOWN_PROPERTY, got %d\n", r
);
6164 ok(!lstrcmpA(buf
, "apple"), "Expected buf to be unchanged, got %s\n", buf
);
6165 ok(sz
== MAX_PATH
, "Expected MAX_PATH, got %d\n", sz
);
6167 res
= RegSetValueExA(prodkey
, "Transforms", 0, REG_SZ
, (LPBYTE
)"trans", 6);
6168 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
6170 /* Transforms value exists */
6172 lstrcpyA(buf
, "apple");
6173 r
= pMsiGetProductInfoExA(prodcode
, NULL
,
6174 MSIINSTALLCONTEXT_MACHINE
,
6175 INSTALLPROPERTY_TRANSFORMS
, buf
, &sz
);
6176 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6177 ok(!lstrcmpA(buf
, "trans"), "Expected \"trans\", got \"%s\"\n", buf
);
6178 ok(sz
== 5, "Expected 5, got %d\n", sz
);
6180 res
= RegSetValueExA(prodkey
, "Language", 0, REG_SZ
, (LPBYTE
)"lang", 5);
6181 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
6183 /* Language value exists */
6185 lstrcpyA(buf
, "apple");
6186 r
= pMsiGetProductInfoExA(prodcode
, NULL
,
6187 MSIINSTALLCONTEXT_MACHINE
,
6188 INSTALLPROPERTY_LANGUAGE
, buf
, &sz
);
6189 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6190 ok(!lstrcmpA(buf
, "lang"), "Expected \"lang\", got \"%s\"\n", buf
);
6191 ok(sz
== 4, "Expected 4, got %d\n", sz
);
6193 res
= RegSetValueExA(prodkey
, "ProductName", 0, REG_SZ
, (LPBYTE
)"name", 5);
6194 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
6196 /* ProductName value exists */
6198 lstrcpyA(buf
, "apple");
6199 r
= pMsiGetProductInfoExA(prodcode
, NULL
,
6200 MSIINSTALLCONTEXT_MACHINE
,
6201 INSTALLPROPERTY_PRODUCTNAME
, buf
, &sz
);
6202 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6203 ok(!lstrcmpA(buf
, "name"), "Expected \"name\", got \"%s\"\n", buf
);
6204 ok(sz
== 4, "Expected 4, got %d\n", sz
);
6206 res
= RegSetValueExA(prodkey
, "AssignmentType", 0, REG_SZ
, (LPBYTE
)"type", 5);
6207 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
6211 /* AssignmentType value exists */
6213 lstrcpyA(buf
, "apple");
6214 r
= pMsiGetProductInfoExA(prodcode
, NULL
,
6215 MSIINSTALLCONTEXT_MACHINE
,
6216 INSTALLPROPERTY_ASSIGNMENTTYPE
, buf
, &sz
);
6217 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6218 ok(!lstrcmpA(buf
, ""), "Expected \"\", got \"%s\"\n", buf
);
6219 ok(sz
== 0, "Expected 0, got %d\n", sz
);
6221 res
= RegSetValueExA(prodkey
, "PackageCode", 0, REG_SZ
, (LPBYTE
)"code", 5);
6222 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
6226 /* PackageCode value exists */
6228 lstrcpyA(buf
, "apple");
6229 r
= pMsiGetProductInfoExA(prodcode
, NULL
,
6230 MSIINSTALLCONTEXT_MACHINE
,
6231 INSTALLPROPERTY_PACKAGECODE
, buf
, &sz
);
6234 ok(r
== ERROR_BAD_CONFIGURATION
,
6235 "Expected ERROR_BAD_CONFIGURATION, got %d\n", r
);
6236 ok(!lstrcmpA(buf
, "apple"), "Expected buf to be unchanged, got %s\n", buf
);
6237 ok(sz
== MAX_PATH
, "Expected MAX_PATH, got %d\n", sz
);
6240 res
= RegSetValueExA(prodkey
, "Version", 0, REG_SZ
, (LPBYTE
)"ver", 4);
6241 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
6243 /* Version value exists */
6245 lstrcpyA(buf
, "apple");
6246 r
= pMsiGetProductInfoExA(prodcode
, NULL
,
6247 MSIINSTALLCONTEXT_MACHINE
,
6248 INSTALLPROPERTY_VERSION
, buf
, &sz
);
6249 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6250 ok(!lstrcmpA(buf
, "ver"), "Expected \"ver\", got \"%s\"\n", buf
);
6251 ok(sz
== 3, "Expected 3, got %d\n", sz
);
6253 res
= RegSetValueExA(prodkey
, "ProductIcon", 0, REG_SZ
, (LPBYTE
)"icon", 5);
6254 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
6256 /* ProductIcon value exists */
6258 lstrcpyA(buf
, "apple");
6259 r
= pMsiGetProductInfoExA(prodcode
, NULL
,
6260 MSIINSTALLCONTEXT_MACHINE
,
6261 INSTALLPROPERTY_PRODUCTICON
, buf
, &sz
);
6262 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6263 ok(!lstrcmpA(buf
, "icon"), "Expected \"icon\", got \"%s\"\n", buf
);
6264 ok(sz
== 4, "Expected 4, got %d\n", sz
);
6266 res
= RegSetValueExA(prodkey
, "PackageName", 0, REG_SZ
, (LPBYTE
)"name", 5);
6267 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
6269 /* PackageName value exists */
6271 lstrcpyA(buf
, "apple");
6272 r
= pMsiGetProductInfoExA(prodcode
, NULL
,
6273 MSIINSTALLCONTEXT_MACHINE
,
6274 INSTALLPROPERTY_PACKAGENAME
, buf
, &sz
);
6277 ok(r
== ERROR_UNKNOWN_PRODUCT
,
6278 "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r
);
6279 ok(!lstrcmpA(buf
, "apple"), "Expected buf to be unchanged, got %s\n", buf
);
6280 ok(sz
== MAX_PATH
, "Expected MAX_PATH, got %d\n", sz
);
6283 res
= RegSetValueExA(prodkey
, "AuthorizedLUAApp", 0, REG_SZ
, (LPBYTE
)"auth", 5);
6284 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
6286 /* AuthorizedLUAApp value exists */
6288 lstrcpyA(buf
, "apple");
6289 r
= pMsiGetProductInfoExA(prodcode
, NULL
,
6290 MSIINSTALLCONTEXT_MACHINE
,
6291 INSTALLPROPERTY_AUTHORIZED_LUA_APP
, buf
, &sz
);
6292 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6293 ok(!lstrcmpA(buf
, "auth"), "Expected \"auth\", got \"%s\"\n", buf
);
6294 ok(sz
== 4, "Expected 4, got %d\n", sz
);
6296 RegDeleteValueA(prodkey
, "AuthorizedLUAApp");
6297 RegDeleteValueA(prodkey
, "PackageName");
6298 RegDeleteValueA(prodkey
, "ProductIcon");
6299 RegDeleteValueA(prodkey
, "Version");
6300 RegDeleteValueA(prodkey
, "PackageCode");
6301 RegDeleteValueA(prodkey
, "AssignmentType");
6302 RegDeleteValueA(prodkey
, "ProductName");
6303 RegDeleteValueA(prodkey
, "Language");
6304 RegDeleteValueA(prodkey
, "Transforms");
6305 RegDeleteValueA(prodkey
, "RegOwner");
6306 RegDeleteValueA(prodkey
, "RegCompany");
6307 RegDeleteValueA(prodkey
, "ProductID");
6308 RegDeleteValueA(prodkey
, "DisplayVersion");
6309 RegDeleteValueA(prodkey
, "VersionMajor");
6310 RegDeleteValueA(prodkey
, "VersionMinor");
6311 RegDeleteValueA(prodkey
, "URLUpdateInfo");
6312 RegDeleteValueA(prodkey
, "URLInfoAbout");
6313 RegDeleteValueA(prodkey
, "Publisher");
6314 RegDeleteValueA(prodkey
, "LocalPackage");
6315 RegDeleteValueA(prodkey
, "InstallSource");
6316 RegDeleteValueA(prodkey
, "InstallLocation");
6317 RegDeleteValueA(prodkey
, "DisplayName");
6318 RegDeleteValueA(prodkey
, "InstallDate");
6319 RegDeleteValueA(prodkey
, "HelpTelephone");
6320 RegDeleteValueA(prodkey
, "HelpLink");
6321 RegDeleteKeyA(prodkey
, "");
6322 RegCloseKey(prodkey
);
6325 #define INIT_USERINFO() \
6326 lstrcpyA(user, "apple"); \
6327 lstrcpyA(org, "orange"); \
6328 lstrcpyA(serial, "banana"); \
6329 usersz = orgsz = serialsz = MAX_PATH;
6331 static void test_MsiGetUserInfo(void)
6333 USERINFOSTATE state
;
6334 CHAR user
[MAX_PATH
];
6336 CHAR serial
[MAX_PATH
];
6337 DWORD usersz
, orgsz
, serialsz
;
6338 CHAR keypath
[MAX_PATH
* 2];
6339 CHAR prodcode
[MAX_PATH
];
6340 CHAR prod_squashed
[MAX_PATH
];
6341 HKEY prodkey
, userprod
, props
;
6345 create_test_guid(prodcode
, prod_squashed
);
6346 get_user_sid(&usersid
);
6348 /* NULL szProduct */
6350 state
= MsiGetUserInfoA(NULL
, user
, &usersz
, org
, &orgsz
, serial
, &serialsz
);
6351 ok(state
== USERINFOSTATE_INVALIDARG
,
6352 "Expected USERINFOSTATE_INVALIDARG, got %d\n", state
);
6353 ok(!lstrcmpA(user
, "apple"), "Expected user to be unchanged, got \"%s\"\n", user
);
6354 ok(!lstrcmpA(org
, "orange"), "Expected org to be unchanged, got \"%s\"\n", org
);
6355 ok(!lstrcmpA(serial
, "banana"), "Expected serial to be unchanged, got \"%s\"\n", serial
);
6356 ok(usersz
== MAX_PATH
, "Expected MAX_PATH, got %d\n", usersz
);
6357 ok(orgsz
== MAX_PATH
, "Expected MAX_PATH, got %d\n", orgsz
);
6358 ok(serialsz
== MAX_PATH
, "Expected MAX_PATH, got %d\n", serialsz
);
6360 /* empty szProductCode */
6362 state
= MsiGetUserInfoA("", user
, &usersz
, org
, &orgsz
, serial
, &serialsz
);
6363 ok(state
== USERINFOSTATE_INVALIDARG
,
6364 "Expected USERINFOSTATE_INVALIDARG, got %d\n", state
);
6365 ok(!lstrcmpA(user
, "apple"), "Expected user to be unchanged, got \"%s\"\n", user
);
6366 ok(!lstrcmpA(org
, "orange"), "Expected org to be unchanged, got \"%s\"\n", org
);
6367 ok(!lstrcmpA(serial
, "banana"), "Expected serial to be unchanged, got \"%s\"\n", serial
);
6368 ok(usersz
== MAX_PATH
, "Expected MAX_PATH, got %d\n", usersz
);
6369 ok(orgsz
== MAX_PATH
, "Expected MAX_PATH, got %d\n", orgsz
);
6370 ok(serialsz
== MAX_PATH
, "Expected MAX_PATH, got %d\n", serialsz
);
6372 /* garbage szProductCode */
6374 state
= MsiGetUserInfoA("garbage", user
, &usersz
, org
, &orgsz
, serial
, &serialsz
);
6375 ok(state
== USERINFOSTATE_INVALIDARG
,
6376 "Expected USERINFOSTATE_INVALIDARG, got %d\n", state
);
6377 ok(!lstrcmpA(user
, "apple"), "Expected user to be unchanged, got \"%s\"\n", user
);
6378 ok(!lstrcmpA(org
, "orange"), "Expected org to be unchanged, got \"%s\"\n", org
);
6379 ok(!lstrcmpA(serial
, "banana"), "Expected serial to be unchanged, got \"%s\"\n", serial
);
6380 ok(usersz
== MAX_PATH
, "Expected MAX_PATH, got %d\n", usersz
);
6381 ok(orgsz
== MAX_PATH
, "Expected MAX_PATH, got %d\n", orgsz
);
6382 ok(serialsz
== MAX_PATH
, "Expected MAX_PATH, got %d\n", serialsz
);
6384 /* guid without brackets */
6386 state
= MsiGetUserInfoA("6700E8CF-95AB-4D9C-BC2C-15840DEA7A5D",
6387 user
, &usersz
, org
, &orgsz
, serial
, &serialsz
);
6388 ok(state
== USERINFOSTATE_INVALIDARG
,
6389 "Expected USERINFOSTATE_INVALIDARG, got %d\n", state
);
6390 ok(!lstrcmpA(user
, "apple"), "Expected user to be unchanged, got \"%s\"\n", user
);
6391 ok(!lstrcmpA(org
, "orange"), "Expected org to be unchanged, got \"%s\"\n", org
);
6392 ok(!lstrcmpA(serial
, "banana"), "Expected serial to be unchanged, got \"%s\"\n", serial
);
6393 ok(usersz
== MAX_PATH
, "Expected MAX_PATH, got %d\n", usersz
);
6394 ok(orgsz
== MAX_PATH
, "Expected MAX_PATH, got %d\n", orgsz
);
6395 ok(serialsz
== MAX_PATH
, "Expected MAX_PATH, got %d\n", serialsz
);
6397 /* guid with brackets */
6399 state
= MsiGetUserInfoA("{6700E8CF-95AB-4D9C-BC2C-15840DEA7A5D}",
6400 user
, &usersz
, org
, &orgsz
, serial
, &serialsz
);
6401 ok(state
== USERINFOSTATE_UNKNOWN
,
6402 "Expected USERINFOSTATE_UNKNOWN, got %d\n", state
);
6403 ok(!lstrcmpA(user
, "apple"), "Expected user to be unchanged, got \"%s\"\n", user
);
6404 ok(!lstrcmpA(org
, "orange"), "Expected org to be unchanged, got \"%s\"\n", org
);
6405 ok(!lstrcmpA(serial
, "banana"), "Expected serial to be unchanged, got \"%s\"\n", serial
);
6406 ok(usersz
== MAX_PATH
, "Expected MAX_PATH, got %d\n", usersz
);
6407 ok(orgsz
== MAX_PATH
, "Expected MAX_PATH, got %d\n", orgsz
);
6408 ok(serialsz
== MAX_PATH
, "Expected MAX_PATH, got %d\n", serialsz
);
6410 /* NULL lpUserNameBuf */
6412 state
= MsiGetUserInfoA(prodcode
, NULL
, &usersz
, org
, &orgsz
, serial
, &serialsz
);
6413 ok(state
== USERINFOSTATE_UNKNOWN
,
6414 "Expected USERINFOSTATE_UNKNOWN, got %d\n", state
);
6415 ok(!lstrcmpA(org
, "orange"), "Expected org to be unchanged, got \"%s\"\n", org
);
6416 ok(!lstrcmpA(serial
, "banana"), "Expected serial to be unchanged, got \"%s\"\n", serial
);
6417 ok(usersz
== MAX_PATH
, "Expected MAX_PATH, got %d\n", usersz
);
6418 ok(orgsz
== MAX_PATH
, "Expected MAX_PATH, got %d\n", orgsz
);
6419 ok(serialsz
== MAX_PATH
, "Expected MAX_PATH, got %d\n", serialsz
);
6421 /* NULL pcchUserNameBuf */
6423 state
= MsiGetUserInfoA(prodcode
, user
, NULL
, org
, &orgsz
, serial
, &serialsz
);
6424 ok(state
== USERINFOSTATE_INVALIDARG
,
6425 "Expected USERINFOSTATE_INVALIDARG, got %d\n", state
);
6426 ok(!lstrcmpA(user
, "apple"), "Expected user to be unchanged, got \"%s\"\n", user
);
6427 ok(!lstrcmpA(org
, "orange"), "Expected org to be unchanged, got \"%s\"\n", org
);
6428 ok(!lstrcmpA(serial
, "banana"), "Expected serial to be unchanged, got \"%s\"\n", serial
);
6429 ok(orgsz
== MAX_PATH
, "Expected MAX_PATH, got %d\n", orgsz
);
6430 ok(serialsz
== MAX_PATH
, "Expected MAX_PATH, got %d\n", serialsz
);
6432 /* both lpUserNameBuf and pcchUserNameBuf NULL */
6434 state
= MsiGetUserInfoA(prodcode
, NULL
, NULL
, org
, &orgsz
, serial
, &serialsz
);
6435 ok(state
== USERINFOSTATE_UNKNOWN
,
6436 "Expected USERINFOSTATE_UNKNOWN, got %d\n", state
);
6437 ok(!lstrcmpA(org
, "orange"), "Expected org to be unchanged, got \"%s\"\n", org
);
6438 ok(!lstrcmpA(serial
, "banana"), "Expected serial to be unchanged, got \"%s\"\n", serial
);
6439 ok(orgsz
== MAX_PATH
, "Expected MAX_PATH, got %d\n", orgsz
);
6440 ok(serialsz
== MAX_PATH
, "Expected MAX_PATH, got %d\n", serialsz
);
6442 /* NULL lpOrgNameBuf */
6444 state
= MsiGetUserInfoA(prodcode
, user
, &usersz
, NULL
, &orgsz
, serial
, &serialsz
);
6445 ok(state
== USERINFOSTATE_UNKNOWN
,
6446 "Expected USERINFOSTATE_UNKNOWN, got %d\n", state
);
6447 ok(!lstrcmpA(user
, "apple"), "Expected user to be unchanged, got \"%s\"\n", user
);
6448 ok(!lstrcmpA(serial
, "banana"), "Expected serial to be unchanged, got \"%s\"\n", serial
);
6449 ok(usersz
== MAX_PATH
, "Expected MAX_PATH, got %d\n", usersz
);
6450 ok(orgsz
== MAX_PATH
, "Expected MAX_PATH, got %d\n", orgsz
);
6451 ok(serialsz
== MAX_PATH
, "Expected MAX_PATH, got %d\n", serialsz
);
6453 /* NULL pcchOrgNameBuf */
6455 state
= MsiGetUserInfoA(prodcode
, user
, &usersz
, org
, NULL
, serial
, &serialsz
);
6456 ok(state
== USERINFOSTATE_INVALIDARG
,
6457 "Expected USERINFOSTATE_INVALIDARG, got %d\n", state
);
6458 ok(!lstrcmpA(user
, "apple"), "Expected user to be unchanged, got \"%s\"\n", user
);
6459 ok(!lstrcmpA(org
, "orange"), "Expected org to be unchanged, got \"%s\"\n", org
);
6460 ok(!lstrcmpA(serial
, "banana"), "Expected serial to be unchanged, got \"%s\"\n", serial
);
6461 ok(usersz
== MAX_PATH
, "Expected MAX_PATH, got %d\n", usersz
);
6462 ok(serialsz
== MAX_PATH
, "Expected MAX_PATH, got %d\n", serialsz
);
6464 /* both lpOrgNameBuf and pcchOrgNameBuf NULL */
6466 state
= MsiGetUserInfoA(prodcode
, user
, &usersz
, NULL
, NULL
, serial
, &serialsz
);
6467 ok(state
== USERINFOSTATE_UNKNOWN
,
6468 "Expected USERINFOSTATE_UNKNOWN, got %d\n", state
);
6469 ok(!lstrcmpA(user
, "apple"), "Expected user to be unchanged, got \"%s\"\n", user
);
6470 ok(!lstrcmpA(serial
, "banana"), "Expected serial to be unchanged, got \"%s\"\n", serial
);
6471 ok(usersz
== MAX_PATH
, "Expected MAX_PATH, got %d\n", usersz
);
6472 ok(serialsz
== MAX_PATH
, "Expected MAX_PATH, got %d\n", serialsz
);
6474 /* NULL lpSerialBuf */
6476 state
= MsiGetUserInfoA(prodcode
, user
, &usersz
, org
, &orgsz
, NULL
, &serialsz
);
6477 ok(state
== USERINFOSTATE_UNKNOWN
,
6478 "Expected USERINFOSTATE_UNKNOWN, got %d\n", state
);
6479 ok(!lstrcmpA(user
, "apple"), "Expected user to be unchanged, got \"%s\"\n", user
);
6480 ok(!lstrcmpA(org
, "orange"), "Expected org to be unchanged, got \"%s\"\n", org
);
6481 ok(usersz
== MAX_PATH
, "Expected MAX_PATH, got %d\n", usersz
);
6482 ok(orgsz
== MAX_PATH
, "Expected MAX_PATH, got %d\n", orgsz
);
6483 ok(serialsz
== MAX_PATH
, "Expected MAX_PATH, got %d\n", serialsz
);
6485 /* NULL pcchSerialBuf */
6487 state
= MsiGetUserInfoA(prodcode
, user
, &usersz
, org
, &orgsz
, serial
, NULL
);
6488 ok(state
== USERINFOSTATE_INVALIDARG
,
6489 "Expected USERINFOSTATE_INVALIDARG, got %d\n", state
);
6490 ok(!lstrcmpA(user
, "apple"), "Expected user to be unchanged, got \"%s\"\n", user
);
6491 ok(!lstrcmpA(org
, "orange"), "Expected org to be unchanged, got \"%s\"\n", org
);
6492 ok(!lstrcmpA(serial
, "banana"), "Expected serial to be unchanged, got \"%s\"\n", serial
);
6493 ok(usersz
== MAX_PATH
, "Expected MAX_PATH, got %d\n", usersz
);
6494 ok(orgsz
== MAX_PATH
, "Expected MAX_PATH, got %d\n", orgsz
);
6496 /* both lpSerialBuf and pcchSerialBuf NULL */
6498 state
= MsiGetUserInfoA(prodcode
, user
, &usersz
, org
, &orgsz
, NULL
, NULL
);
6499 ok(state
== USERINFOSTATE_UNKNOWN
,
6500 "Expected USERINFOSTATE_UNKNOWN, got %d\n", state
);
6501 ok(!lstrcmpA(user
, "apple"), "Expected user to be unchanged, got \"%s\"\n", user
);
6502 ok(!lstrcmpA(org
, "orange"), "Expected org to be unchanged, got \"%s\"\n", org
);
6503 ok(usersz
== MAX_PATH
, "Expected MAX_PATH, got %d\n", usersz
);
6504 ok(orgsz
== MAX_PATH
, "Expected MAX_PATH, got %d\n", orgsz
);
6506 /* MSIINSTALLCONTEXT_USERMANAGED */
6508 /* create local system product key */
6509 lstrcpyA(keypath
, "Software\\Microsoft\\Windows\\CurrentVersion\\Installer\\Managed\\");
6510 lstrcatA(keypath
, usersid
);
6511 lstrcatA(keypath
, "\\Installer\\Products\\");
6512 lstrcatA(keypath
, prod_squashed
);
6514 res
= RegCreateKeyA(HKEY_LOCAL_MACHINE
, keypath
, &prodkey
);
6515 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
6517 /* managed product key exists */
6519 state
= MsiGetUserInfoA(prodcode
, user
, &usersz
, org
, &orgsz
, serial
, &serialsz
);
6520 ok(state
== USERINFOSTATE_ABSENT
,
6521 "Expected USERINFOSTATE_ABSENT, got %d\n", state
);
6522 ok(!lstrcmpA(user
, "apple"), "Expected user to be unchanged, got \"%s\"\n", user
);
6523 ok(!lstrcmpA(org
, "orange"), "Expected org to be unchanged, got \"%s\"\n", org
);
6524 ok(!lstrcmpA(serial
, "banana"), "Expected serial to be unchanged, got \"%s\"\n", serial
);
6525 ok(usersz
== MAX_PATH
, "Expected MAX_PATH, got %d\n", usersz
);
6526 ok(orgsz
== MAX_PATH
, "Expected MAX_PATH, got %d\n", orgsz
);
6527 ok(serialsz
== MAX_PATH
, "Expected MAX_PATH, got %d\n", serialsz
);
6529 lstrcpyA(keypath
, "Software\\Microsoft\\Windows\\CurrentVersion\\");
6530 lstrcatA(keypath
, "Installer\\UserData\\");
6531 lstrcatA(keypath
, usersid
);
6532 lstrcatA(keypath
, "\\Products\\");
6533 lstrcatA(keypath
, prod_squashed
);
6535 res
= RegCreateKeyA(HKEY_LOCAL_MACHINE
, keypath
, &userprod
);
6536 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
6538 res
= RegCreateKeyA(userprod
, "InstallProperties", &props
);
6539 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
6541 /* InstallProperties key exists */
6543 state
= MsiGetUserInfoA(prodcode
, user
, &usersz
, org
, &orgsz
, serial
, &serialsz
);
6544 ok(state
== USERINFOSTATE_ABSENT
,
6545 "Expected USERINFOSTATE_ABSENT, got %d\n", state
);
6546 ok(!lstrcmpA(user
, "apple"), "Expected user to be unchanged, got \"%s\"\n", user
);
6547 ok(!lstrcmpA(org
, "orange"), "Expected org to be unchanged, got \"%s\"\n", org
);
6548 ok(!lstrcmpA(serial
, "banana"), "Expected serial to be unchanged, got \"%s\"\n", serial
);
6549 ok(usersz
== MAX_PATH
- 1, "Expected MAX_PATH - 1, got %d\n", usersz
);
6550 ok(orgsz
== MAX_PATH
, "Expected MAX_PATH, got %d\n", orgsz
);
6551 ok(serialsz
== MAX_PATH
, "Expected MAX_PATH, got %d\n", serialsz
);
6553 /* RegOwner doesn't exist, lpUserNameBuf and pcchUserNameBuf are NULL */
6555 state
= MsiGetUserInfoA(prodcode
, NULL
, NULL
, org
, &orgsz
, serial
, &serialsz
);
6556 ok(state
== USERINFOSTATE_ABSENT
,
6557 "Expected USERINFOSTATE_ABSENT, got %d\n", state
);
6558 ok(!lstrcmpA(org
, ""), "Expected empty string, got \"%s\"\n", org
);
6559 ok(!lstrcmpA(serial
, "banana"), "Expected serial to be unchanged, got \"%s\"\n", serial
);
6560 ok(orgsz
== 0, "Expected 0, got %d\n", orgsz
);
6561 ok(serialsz
== MAX_PATH
- 1, "Expected MAX_PATH - 1, got %d\n", serialsz
);
6563 /* RegOwner, RegCompany don't exist, out params are NULL */
6565 state
= MsiGetUserInfoA(prodcode
, NULL
, NULL
, NULL
, NULL
, serial
, &serialsz
);
6566 ok(state
== USERINFOSTATE_ABSENT
,
6567 "Expected USERINFOSTATE_ABSENT, got %d\n", state
);
6568 ok(!lstrcmpA(serial
, "banana"), "Expected serial to be unchanged, got \"%s\"\n", serial
);
6569 ok(serialsz
== MAX_PATH
- 1, "Expected MAX_PATH - 1, got %d\n", serialsz
);
6571 res
= RegSetValueExA(props
, "RegOwner", 0, REG_SZ
, (LPBYTE
)"owner", 6);
6572 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
6574 /* RegOwner value exists */
6576 state
= MsiGetUserInfoA(prodcode
, user
, &usersz
, org
, &orgsz
, serial
, &serialsz
);
6577 ok(state
== USERINFOSTATE_ABSENT
,
6578 "Expected USERINFOSTATE_ABSENT, got %d\n", state
);
6579 ok(!lstrcmpA(user
, "owner"), "Expected \"owner\", got \"%s\"\n", user
);
6580 ok(!lstrcmpA(org
, ""), "Expected empty string, got \"%s\"\n", org
);
6581 ok(!lstrcmpA(serial
, "banana"), "Expected serial to be unchanged, got \"%s\"\n", serial
);
6582 ok(usersz
== 5, "Expected 5, got %d\n", usersz
);
6583 ok(orgsz
== 0, "Expected 0, got %d\n", orgsz
);
6584 ok(serialsz
== MAX_PATH
- 1, "Expected MAX_PATH - 1, got %d\n", serialsz
);
6586 res
= RegSetValueExA(props
, "RegCompany", 0, REG_SZ
, (LPBYTE
)"company", 8);
6587 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
6589 /* RegCompany value exists */
6591 state
= MsiGetUserInfoA(prodcode
, user
, &usersz
, org
, &orgsz
, serial
, &serialsz
);
6592 ok(state
== USERINFOSTATE_ABSENT
,
6593 "Expected USERINFOSTATE_ABSENT, got %d\n", state
);
6594 ok(!lstrcmpA(user
, "owner"), "Expected \"owner\", got \"%s\"\n", user
);
6595 ok(!lstrcmpA(org
, "company"), "Expected \"company\", got \"%s\"\n", org
);
6596 ok(!lstrcmpA(serial
, "banana"), "Expected serial to be unchanged, got \"%s\"\n", serial
);
6597 ok(usersz
== 5, "Expected 5, got %d\n", usersz
);
6598 ok(orgsz
== 7, "Expected 7, got %d\n", orgsz
);
6599 ok(serialsz
== MAX_PATH
- 1, "Expected MAX_PATH - 1, got %d\n", serialsz
);
6601 res
= RegSetValueExA(props
, "ProductID", 0, REG_SZ
, (LPBYTE
)"ID", 3);
6602 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
6604 /* ProductID value exists */
6606 state
= MsiGetUserInfoA(prodcode
, user
, &usersz
, org
, &orgsz
, serial
, &serialsz
);
6607 ok(state
== USERINFOSTATE_PRESENT
,
6608 "Expected USERINFOSTATE_PRESENT, got %d\n", state
);
6609 ok(!lstrcmpA(user
, "owner"), "Expected \"owner\", got \"%s\"\n", user
);
6610 ok(!lstrcmpA(org
, "company"), "Expected \"company\", got \"%s\"\n", org
);
6611 ok(!lstrcmpA(serial
, "ID"), "Expected \"ID\", got \"%s\"\n", serial
);
6612 ok(usersz
== 5, "Expected 5, got %d\n", usersz
);
6613 ok(orgsz
== 7, "Expected 7, got %d\n", orgsz
);
6614 ok(serialsz
== 2, "Expected 2, got %d\n", serialsz
);
6616 /* pcchUserNameBuf is too small */
6619 state
= MsiGetUserInfoA(prodcode
, user
, &usersz
, org
, &orgsz
, serial
, &serialsz
);
6620 ok(state
== USERINFOSTATE_MOREDATA
,
6621 "Expected USERINFOSTATE_MOREDATA, got %d\n", state
);
6622 ok(!lstrcmpA(user
, "apple"), "Expected user to be unchanged, got \"%s\"\n", user
);
6623 ok(!lstrcmpA(org
, "orange"), "Expected org to be unchanged, got \"%s\"\n", org
);
6624 ok(!lstrcmpA(serial
, "banana"), "Expected serial to be unchanged, got \"%s\"\n", serial
);
6625 ok(usersz
== 5, "Expected 5, got %d\n", usersz
);
6626 ok(orgsz
== MAX_PATH
, "Expected MAX_PATH, got %d\n", orgsz
);
6627 ok(serialsz
== MAX_PATH
, "Expected MAX_PATH, got %d\n", serialsz
);
6629 /* pcchUserNameBuf has no room for NULL terminator */
6632 state
= MsiGetUserInfoA(prodcode
, user
, &usersz
, org
, &orgsz
, serial
, &serialsz
);
6633 ok(state
== USERINFOSTATE_MOREDATA
,
6634 "Expected USERINFOSTATE_MOREDATA, got %d\n", state
);
6637 ok(!lstrcmpA(user
, "apple"), "Expected user to be unchanged, got \"%s\"\n", user
);
6639 ok(!lstrcmpA(org
, "orange"), "Expected org to be unchanged, got \"%s\"\n", org
);
6640 ok(!lstrcmpA(serial
, "banana"), "Expected serial to be unchanged, got \"%s\"\n", serial
);
6641 ok(usersz
== 5, "Expected 5, got %d\n", usersz
);
6642 ok(orgsz
== MAX_PATH
, "Expected MAX_PATH, got %d\n", orgsz
);
6643 ok(serialsz
== MAX_PATH
, "Expected MAX_PATH, got %d\n", serialsz
);
6645 /* pcchUserNameBuf is too small, lpUserNameBuf is NULL */
6648 state
= MsiGetUserInfoA(prodcode
, NULL
, &usersz
, org
, &orgsz
, serial
, &serialsz
);
6649 ok(state
== USERINFOSTATE_PRESENT
,
6650 "Expected USERINFOSTATE_PRESENT, got %d\n", state
);
6651 ok(!lstrcmpA(user
, "apple"), "Expected user to be unchanged, got \"%s\"\n", user
);
6652 ok(!lstrcmpA(org
, "company"), "Expected \"company\", got \"%s\"\n", org
);
6653 ok(!lstrcmpA(serial
, "ID"), "Expected \"ID\", got \"%s\"\n", serial
);
6654 ok(usersz
== 5, "Expected 5, got %d\n", usersz
);
6655 ok(orgsz
== 7, "Expected 7, got %d\n", orgsz
);
6656 ok(serialsz
== 2, "Expected 2, got %d\n", serialsz
);
6658 RegDeleteValueA(props
, "ProductID");
6659 RegDeleteValueA(props
, "RegCompany");
6660 RegDeleteValueA(props
, "RegOwner");
6661 RegDeleteKeyA(props
, "");
6663 RegDeleteKeyA(userprod
, "");
6664 RegCloseKey(userprod
);
6665 RegDeleteKeyA(prodkey
, "");
6666 RegCloseKey(prodkey
);
6668 /* MSIINSTALLCONTEXT_USERUNMANAGED */
6670 /* create local system product key */
6671 lstrcpyA(keypath
, "Software\\Microsoft\\Installer\\Products\\");
6672 lstrcatA(keypath
, prod_squashed
);
6674 res
= RegCreateKeyA(HKEY_CURRENT_USER
, keypath
, &prodkey
);
6675 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
6677 /* product key exists */
6679 state
= MsiGetUserInfoA(prodcode
, user
, &usersz
, org
, &orgsz
, serial
, &serialsz
);
6680 ok(state
== USERINFOSTATE_ABSENT
,
6681 "Expected USERINFOSTATE_ABSENT, got %d\n", state
);
6682 ok(!lstrcmpA(user
, "apple"), "Expected user to be unchanged, got \"%s\"\n", user
);
6683 ok(!lstrcmpA(org
, "orange"), "Expected org to be unchanged, got \"%s\"\n", org
);
6684 ok(!lstrcmpA(serial
, "banana"), "Expected serial to be unchanged, got \"%s\"\n", serial
);
6685 ok(usersz
== MAX_PATH
, "Expected MAX_PATH, got %d\n", usersz
);
6686 ok(orgsz
== MAX_PATH
, "Expected MAX_PATH, got %d\n", orgsz
);
6687 ok(serialsz
== MAX_PATH
, "Expected MAX_PATH, got %d\n", serialsz
);
6689 lstrcpyA(keypath
, "Software\\Microsoft\\Windows\\CurrentVersion\\");
6690 lstrcatA(keypath
, "Installer\\UserData\\");
6691 lstrcatA(keypath
, usersid
);
6692 lstrcatA(keypath
, "\\Products\\");
6693 lstrcatA(keypath
, prod_squashed
);
6695 res
= RegCreateKeyA(HKEY_LOCAL_MACHINE
, keypath
, &userprod
);
6696 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
6698 res
= RegCreateKeyA(userprod
, "InstallProperties", &props
);
6699 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
6701 /* InstallProperties key exists */
6703 state
= MsiGetUserInfoA(prodcode
, user
, &usersz
, org
, &orgsz
, serial
, &serialsz
);
6704 ok(state
== USERINFOSTATE_ABSENT
,
6705 "Expected USERINFOSTATE_ABSENT, got %d\n", state
);
6706 ok(!lstrcmpA(user
, "apple"), "Expected user to be unchanged, got \"%s\"\n", user
);
6707 ok(!lstrcmpA(org
, "orange"), "Expected org to be unchanged, got \"%s\"\n", org
);
6708 ok(!lstrcmpA(serial
, "banana"), "Expected serial to be unchanged, got \"%s\"\n", serial
);
6709 ok(usersz
== MAX_PATH
- 1, "Expected MAX_PATH - 1, got %d\n", usersz
);
6710 ok(orgsz
== MAX_PATH
, "Expected MAX_PATH, got %d\n", orgsz
);
6711 ok(serialsz
== MAX_PATH
, "Expected MAX_PATH, got %d\n", serialsz
);
6713 /* RegOwner doesn't exist, lpUserNameBuf and pcchUserNameBuf are NULL */
6715 state
= MsiGetUserInfoA(prodcode
, NULL
, NULL
, org
, &orgsz
, serial
, &serialsz
);
6716 ok(state
== USERINFOSTATE_ABSENT
,
6717 "Expected USERINFOSTATE_ABSENT, got %d\n", state
);
6718 ok(!lstrcmpA(org
, ""), "Expected empty string, got \"%s\"\n", org
);
6719 ok(!lstrcmpA(serial
, "banana"), "Expected serial to be unchanged, got \"%s\"\n", serial
);
6720 ok(orgsz
== 0, "Expected 0, got %d\n", orgsz
);
6721 ok(serialsz
== MAX_PATH
- 1, "Expected MAX_PATH - 1, got %d\n", serialsz
);
6723 /* RegOwner, RegCompany don't exist, out params are NULL */
6725 state
= MsiGetUserInfoA(prodcode
, NULL
, NULL
, NULL
, NULL
, serial
, &serialsz
);
6726 ok(state
== USERINFOSTATE_ABSENT
,
6727 "Expected USERINFOSTATE_ABSENT, got %d\n", state
);
6728 ok(!lstrcmpA(serial
, "banana"), "Expected serial to be unchanged, got \"%s\"\n", serial
);
6729 ok(serialsz
== MAX_PATH
- 1, "Expected MAX_PATH - 1, got %d\n", serialsz
);
6731 res
= RegSetValueExA(props
, "RegOwner", 0, REG_SZ
, (LPBYTE
)"owner", 6);
6732 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
6734 /* RegOwner value exists */
6736 state
= MsiGetUserInfoA(prodcode
, user
, &usersz
, org
, &orgsz
, serial
, &serialsz
);
6737 ok(state
== USERINFOSTATE_ABSENT
,
6738 "Expected USERINFOSTATE_ABSENT, got %d\n", state
);
6739 ok(!lstrcmpA(user
, "owner"), "Expected \"owner\", got \"%s\"\n", user
);
6740 ok(!lstrcmpA(org
, ""), "Expected empty string, got \"%s\"\n", org
);
6741 ok(!lstrcmpA(serial
, "banana"), "Expected serial to be unchanged, got \"%s\"\n", serial
);
6742 ok(usersz
== 5, "Expected 5, got %d\n", usersz
);
6743 ok(orgsz
== 0, "Expected 0, got %d\n", orgsz
);
6744 ok(serialsz
== MAX_PATH
- 1, "Expected MAX_PATH - 1, got %d\n", serialsz
);
6746 res
= RegSetValueExA(props
, "RegCompany", 0, REG_SZ
, (LPBYTE
)"company", 8);
6747 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
6749 /* RegCompany value exists */
6751 state
= MsiGetUserInfoA(prodcode
, user
, &usersz
, org
, &orgsz
, serial
, &serialsz
);
6752 ok(state
== USERINFOSTATE_ABSENT
,
6753 "Expected USERINFOSTATE_ABSENT, got %d\n", state
);
6754 ok(!lstrcmpA(user
, "owner"), "Expected \"owner\", got \"%s\"\n", user
);
6755 ok(!lstrcmpA(org
, "company"), "Expected \"company\", got \"%s\"\n", org
);
6756 ok(!lstrcmpA(serial
, "banana"), "Expected serial to be unchanged, got \"%s\"\n", serial
);
6757 ok(usersz
== 5, "Expected 5, got %d\n", usersz
);
6758 ok(orgsz
== 7, "Expected 7, got %d\n", orgsz
);
6759 ok(serialsz
== MAX_PATH
- 1, "Expected MAX_PATH - 1, got %d\n", serialsz
);
6761 res
= RegSetValueExA(props
, "ProductID", 0, REG_SZ
, (LPBYTE
)"ID", 3);
6762 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
6764 /* ProductID value exists */
6766 state
= MsiGetUserInfoA(prodcode
, user
, &usersz
, org
, &orgsz
, serial
, &serialsz
);
6767 ok(state
== USERINFOSTATE_PRESENT
,
6768 "Expected USERINFOSTATE_PRESENT, got %d\n", state
);
6769 ok(!lstrcmpA(user
, "owner"), "Expected \"owner\", got \"%s\"\n", user
);
6770 ok(!lstrcmpA(org
, "company"), "Expected \"company\", got \"%s\"\n", org
);
6771 ok(!lstrcmpA(serial
, "ID"), "Expected \"ID\", got \"%s\"\n", serial
);
6772 ok(usersz
== 5, "Expected 5, got %d\n", usersz
);
6773 ok(orgsz
== 7, "Expected 7, got %d\n", orgsz
);
6774 ok(serialsz
== 2, "Expected 2, got %d\n", serialsz
);
6776 RegDeleteValueA(props
, "ProductID");
6777 RegDeleteValueA(props
, "RegCompany");
6778 RegDeleteValueA(props
, "RegOwner");
6779 RegDeleteKeyA(props
, "");
6781 RegDeleteKeyA(userprod
, "");
6782 RegCloseKey(userprod
);
6783 RegDeleteKeyA(prodkey
, "");
6784 RegCloseKey(prodkey
);
6786 /* MSIINSTALLCONTEXT_MACHINE */
6788 /* create local system product key */
6789 lstrcpyA(keypath
, "Software\\Classes\\Installer\\Products\\");
6790 lstrcatA(keypath
, prod_squashed
);
6792 res
= RegCreateKeyA(HKEY_LOCAL_MACHINE
, keypath
, &prodkey
);
6793 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
6795 /* product key exists */
6797 state
= MsiGetUserInfoA(prodcode
, user
, &usersz
, org
, &orgsz
, serial
, &serialsz
);
6798 ok(state
== USERINFOSTATE_ABSENT
,
6799 "Expected USERINFOSTATE_ABSENT, got %d\n", state
);
6800 ok(!lstrcmpA(user
, "apple"), "Expected user to be unchanged, got \"%s\"\n", user
);
6801 ok(!lstrcmpA(org
, "orange"), "Expected org to be unchanged, got \"%s\"\n", org
);
6802 ok(!lstrcmpA(serial
, "banana"), "Expected serial to be unchanged, got \"%s\"\n", serial
);
6803 ok(usersz
== MAX_PATH
, "Expected MAX_PATH, got %d\n", usersz
);
6804 ok(orgsz
== MAX_PATH
, "Expected MAX_PATH, got %d\n", orgsz
);
6805 ok(serialsz
== MAX_PATH
, "Expected MAX_PATH, got %d\n", serialsz
);
6807 lstrcpyA(keypath
, "Software\\Microsoft\\Windows\\CurrentVersion\\");
6808 lstrcatA(keypath
, "Installer\\UserData\\S-1-5-18");
6809 lstrcatA(keypath
, "\\Products\\");
6810 lstrcatA(keypath
, prod_squashed
);
6812 res
= RegCreateKeyA(HKEY_LOCAL_MACHINE
, keypath
, &userprod
);
6813 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
6815 res
= RegCreateKeyA(userprod
, "InstallProperties", &props
);
6816 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
6818 /* InstallProperties key exists */
6820 state
= MsiGetUserInfoA(prodcode
, user
, &usersz
, org
, &orgsz
, serial
, &serialsz
);
6821 ok(state
== USERINFOSTATE_ABSENT
,
6822 "Expected USERINFOSTATE_ABSENT, got %d\n", state
);
6823 ok(!lstrcmpA(user
, "apple"), "Expected user to be unchanged, got \"%s\"\n", user
);
6824 ok(!lstrcmpA(org
, "orange"), "Expected org to be unchanged, got \"%s\"\n", org
);
6825 ok(!lstrcmpA(serial
, "banana"), "Expected serial to be unchanged, got \"%s\"\n", serial
);
6826 ok(usersz
== MAX_PATH
- 1, "Expected MAX_PATH - 1, got %d\n", usersz
);
6827 ok(orgsz
== MAX_PATH
, "Expected MAX_PATH, got %d\n", orgsz
);
6828 ok(serialsz
== MAX_PATH
, "Expected MAX_PATH, got %d\n", serialsz
);
6830 /* RegOwner doesn't exist, lpUserNameBuf and pcchUserNameBuf are NULL */
6832 state
= MsiGetUserInfoA(prodcode
, NULL
, NULL
, org
, &orgsz
, serial
, &serialsz
);
6833 ok(state
== USERINFOSTATE_ABSENT
,
6834 "Expected USERINFOSTATE_ABSENT, got %d\n", state
);
6835 ok(!lstrcmpA(org
, ""), "Expected empty string, got \"%s\"\n", org
);
6836 ok(!lstrcmpA(serial
, "banana"), "Expected serial to be unchanged, got \"%s\"\n", serial
);
6837 ok(orgsz
== 0, "Expected 0, got %d\n", orgsz
);
6838 ok(serialsz
== MAX_PATH
- 1, "Expected MAX_PATH - 1, got %d\n", serialsz
);
6840 /* RegOwner, RegCompany don't exist, out params are NULL */
6842 state
= MsiGetUserInfoA(prodcode
, NULL
, NULL
, NULL
, NULL
, serial
, &serialsz
);
6843 ok(state
== USERINFOSTATE_ABSENT
,
6844 "Expected USERINFOSTATE_ABSENT, got %d\n", state
);
6845 ok(!lstrcmpA(serial
, "banana"), "Expected serial to be unchanged, got \"%s\"\n", serial
);
6846 ok(serialsz
== MAX_PATH
- 1, "Expected MAX_PATH - 1, got %d\n", serialsz
);
6848 res
= RegSetValueExA(props
, "RegOwner", 0, REG_SZ
, (LPBYTE
)"owner", 6);
6849 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
6851 /* RegOwner value exists */
6853 state
= MsiGetUserInfoA(prodcode
, user
, &usersz
, org
, &orgsz
, serial
, &serialsz
);
6854 ok(state
== USERINFOSTATE_ABSENT
,
6855 "Expected USERINFOSTATE_ABSENT, got %d\n", state
);
6856 ok(!lstrcmpA(user
, "owner"), "Expected \"owner\", got \"%s\"\n", user
);
6857 ok(!lstrcmpA(org
, ""), "Expected empty string, got \"%s\"\n", org
);
6858 ok(!lstrcmpA(serial
, "banana"), "Expected serial to be unchanged, got \"%s\"\n", serial
);
6859 ok(usersz
== 5, "Expected 5, got %d\n", usersz
);
6860 ok(orgsz
== 0, "Expected 0, got %d\n", orgsz
);
6861 ok(serialsz
== MAX_PATH
- 1, "Expected MAX_PATH - 1, got %d\n", serialsz
);
6863 res
= RegSetValueExA(props
, "RegCompany", 0, REG_SZ
, (LPBYTE
)"company", 8);
6864 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
6866 /* RegCompany value exists */
6868 state
= MsiGetUserInfoA(prodcode
, user
, &usersz
, org
, &orgsz
, serial
, &serialsz
);
6869 ok(state
== USERINFOSTATE_ABSENT
,
6870 "Expected USERINFOSTATE_ABSENT, got %d\n", state
);
6871 ok(!lstrcmpA(user
, "owner"), "Expected \"owner\", got \"%s\"\n", user
);
6872 ok(!lstrcmpA(org
, "company"), "Expected \"company\", got \"%s\"\n", org
);
6873 ok(!lstrcmpA(serial
, "banana"), "Expected serial to be unchanged, got \"%s\"\n", serial
);
6874 ok(usersz
== 5, "Expected 5, got %d\n", usersz
);
6875 ok(orgsz
== 7, "Expected 7, got %d\n", orgsz
);
6876 ok(serialsz
== MAX_PATH
- 1, "Expected MAX_PATH - 1, got %d\n", serialsz
);
6878 res
= RegSetValueExA(props
, "ProductID", 0, REG_SZ
, (LPBYTE
)"ID", 3);
6879 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
6881 /* ProductID value exists */
6883 state
= MsiGetUserInfoA(prodcode
, user
, &usersz
, org
, &orgsz
, serial
, &serialsz
);
6884 ok(state
== USERINFOSTATE_PRESENT
,
6885 "Expected USERINFOSTATE_PRESENT, got %d\n", state
);
6886 ok(!lstrcmpA(user
, "owner"), "Expected \"owner\", got \"%s\"\n", user
);
6887 ok(!lstrcmpA(org
, "company"), "Expected \"company\", got \"%s\"\n", org
);
6888 ok(!lstrcmpA(serial
, "ID"), "Expected \"ID\", got \"%s\"\n", serial
);
6889 ok(usersz
== 5, "Expected 5, got %d\n", usersz
);
6890 ok(orgsz
== 7, "Expected 7, got %d\n", orgsz
);
6891 ok(serialsz
== 2, "Expected 2, got %d\n", serialsz
);
6893 RegDeleteValueA(props
, "ProductID");
6894 RegDeleteValueA(props
, "RegCompany");
6895 RegDeleteValueA(props
, "RegOwner");
6896 RegDeleteKeyA(props
, "");
6898 RegDeleteKeyA(userprod
, "");
6899 RegCloseKey(userprod
);
6900 RegDeleteKeyA(prodkey
, "");
6901 RegCloseKey(prodkey
);
6906 init_functionpointers();
6910 test_getcomponentpath();
6911 test_MsiGetFileHash();
6913 if (!pConvertSidToStringSidA
)
6914 skip("ConvertSidToStringSidA not implemented\n");
6917 /* These tests rely on get_user_sid that needs ConvertSidToStringSidA */
6918 test_MsiQueryProductState();
6919 test_MsiQueryFeatureState();
6920 test_MsiQueryComponentState();
6921 test_MsiGetComponentPath();
6922 test_MsiGetProductCode();
6923 test_MsiEnumClients();
6924 test_MsiGetProductInfo();
6925 test_MsiGetProductInfoEx();
6926 test_MsiGetUserInfo();
6929 test_MsiGetFileVersion();