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
30 #include "wine/test.h"
32 static const char msifile
[] = "winetest.msi";
34 static BOOL (WINAPI
*pConvertSidToStringSidA
)(PSID
, LPSTR
*);
36 static INSTALLSTATE (WINAPI
*pMsiGetComponentPathA
)
37 (LPCSTR
, LPCSTR
, LPSTR
, DWORD
*);
38 static UINT (WINAPI
*pMsiGetFileHashA
)
39 (LPCSTR
, DWORD
, PMSIFILEHASHINFO
);
40 static UINT (WINAPI
*pMsiGetProductInfoExA
)
41 (LPCSTR
, LPCSTR
, MSIINSTALLCONTEXT
, LPCSTR
, LPSTR
, LPDWORD
);
42 static UINT (WINAPI
*pMsiOpenPackageExA
)
43 (LPCSTR
, DWORD
, MSIHANDLE
*);
44 static UINT (WINAPI
*pMsiOpenPackageExW
)
45 (LPCWSTR
, DWORD
, MSIHANDLE
*);
46 static UINT (WINAPI
*pMsiQueryComponentStateA
)
47 (LPCSTR
, LPCSTR
, MSIINSTALLCONTEXT
, LPCSTR
, INSTALLSTATE
*);
48 static INSTALLSTATE (WINAPI
*pMsiUseFeatureExA
)
49 (LPCSTR
, LPCSTR
,DWORD
, DWORD
);
51 static void init_functionpointers(void)
53 HMODULE hmsi
= GetModuleHandleA("msi.dll");
54 HMODULE hadvapi32
= GetModuleHandleA("advapi32.dll");
56 #define GET_PROC(dll, func) \
57 p ## func = (void *)GetProcAddress(dll, #func); \
59 trace("GetProcAddress(%s) failed\n", #func);
61 GET_PROC(hmsi
, MsiGetComponentPathA
)
62 GET_PROC(hmsi
, MsiGetFileHashA
)
63 GET_PROC(hmsi
, MsiGetProductInfoExA
)
64 GET_PROC(hmsi
, MsiOpenPackageExA
)
65 GET_PROC(hmsi
, MsiOpenPackageExW
)
66 GET_PROC(hmsi
, MsiQueryComponentStateA
)
67 GET_PROC(hmsi
, MsiUseFeatureExA
)
69 GET_PROC(hadvapi32
, ConvertSidToStringSidA
)
74 static UINT
run_query(MSIHANDLE hdb
, const char *query
)
79 r
= MsiDatabaseOpenView(hdb
, query
, &hview
);
80 if (r
!= ERROR_SUCCESS
)
83 r
= MsiViewExecute(hview
, 0);
84 if (r
== ERROR_SUCCESS
)
85 r
= MsiViewClose(hview
);
86 MsiCloseHandle(hview
);
90 static UINT
set_summary_info(MSIHANDLE hdb
, LPSTR prodcode
)
95 /* build summary info */
96 res
= MsiGetSummaryInformation(hdb
, NULL
, 7, &suminfo
);
97 ok(res
== ERROR_SUCCESS
, "Failed to open summaryinfo\n");
99 res
= MsiSummaryInfoSetProperty(suminfo
, 2, VT_LPSTR
, 0, NULL
,
100 "Installation Database");
101 ok(res
== ERROR_SUCCESS
, "Failed to set summary info\n");
103 res
= MsiSummaryInfoSetProperty(suminfo
, 3, VT_LPSTR
, 0, NULL
,
104 "Installation Database");
105 ok(res
== ERROR_SUCCESS
, "Failed to set summary info\n");
107 res
= MsiSummaryInfoSetProperty(suminfo
, 4, VT_LPSTR
, 0, NULL
,
109 ok(res
== ERROR_SUCCESS
, "Failed to set summary info\n");
111 res
= MsiSummaryInfoSetProperty(suminfo
, 7, VT_LPSTR
, 0, NULL
,
113 ok(res
== ERROR_SUCCESS
, "Failed to set summary info\n");
115 res
= MsiSummaryInfoSetProperty(suminfo
, PID_REVNUMBER
, VT_LPSTR
, 0, NULL
,
116 "{A2078D65-94D6-4205-8DEE-F68D6FD622AA}");
117 ok(res
== ERROR_SUCCESS
, "Failed to set summary info\n");
119 res
= MsiSummaryInfoSetProperty(suminfo
, 14, VT_I4
, 100, NULL
, NULL
);
120 ok(res
== ERROR_SUCCESS
, "Failed to set summary info\n");
122 res
= MsiSummaryInfoSetProperty(suminfo
, 15, VT_I4
, 0, NULL
, NULL
);
123 ok(res
== ERROR_SUCCESS
, "Failed to set summary info\n");
125 res
= MsiSummaryInfoPersist(suminfo
);
126 ok(res
== ERROR_SUCCESS
, "Failed to make summary info persist\n");
128 res
= MsiCloseHandle(suminfo
);
129 ok(res
== ERROR_SUCCESS
, "Failed to close suminfo\n");
134 static MSIHANDLE
create_package_db(LPSTR prodcode
)
137 CHAR query
[MAX_PATH
];
142 /* create an empty database */
143 res
= MsiOpenDatabase(msifile
, MSIDBOPEN_CREATE
, &hdb
);
144 ok( res
== ERROR_SUCCESS
, "Failed to create database\n" );
145 if (res
!= ERROR_SUCCESS
)
148 res
= MsiDatabaseCommit(hdb
);
149 ok(res
== ERROR_SUCCESS
, "Failed to commit database\n");
151 set_summary_info(hdb
, prodcode
);
154 "CREATE TABLE `Directory` ( "
155 "`Directory` CHAR(255) NOT NULL, "
156 "`Directory_Parent` CHAR(255), "
157 "`DefaultDir` CHAR(255) NOT NULL "
158 "PRIMARY KEY `Directory`)");
159 ok(res
== ERROR_SUCCESS
, "Failed to create directory table\n");
162 "CREATE TABLE `Property` ( "
163 "`Property` CHAR(72) NOT NULL, "
165 "PRIMARY KEY `Property`)");
166 ok(res
== ERROR_SUCCESS
, "Failed to create directory table\n");
168 sprintf(query
, "INSERT INTO `Property` "
169 "(`Property`, `Value`) "
170 "VALUES( 'ProductCode', '%s' )", prodcode
);
171 res
= run_query(hdb
, query
);
172 ok(res
== ERROR_SUCCESS
, "Failed\n");
174 res
= MsiDatabaseCommit(hdb
);
175 ok(res
== ERROR_SUCCESS
, "Failed to commit database\n");
180 static void test_usefeature(void)
184 if (!pMsiUseFeatureExA
)
186 skip("MsiUseFeatureExA not implemented\n");
190 r
= MsiQueryFeatureState(NULL
,NULL
);
191 ok( r
== INSTALLSTATE_INVALIDARG
, "wrong return val\n");
193 r
= MsiQueryFeatureState("{9085040-6000-11d3-8cfe-0150048383c9}" ,NULL
);
194 ok( r
== INSTALLSTATE_INVALIDARG
, "wrong return val\n");
196 r
= pMsiUseFeatureExA(NULL
,NULL
,0,0);
197 ok( r
== INSTALLSTATE_INVALIDARG
, "wrong return val\n");
199 r
= pMsiUseFeatureExA(NULL
, "WORDVIEWFiles", -2, 1 );
200 ok( r
== INSTALLSTATE_INVALIDARG
, "wrong return val\n");
202 r
= pMsiUseFeatureExA("{90850409-6000-11d3-8cfe-0150048383c9}",
204 ok( r
== INSTALLSTATE_INVALIDARG
, "wrong return val\n");
206 r
= pMsiUseFeatureExA("{9085040-6000-11d3-8cfe-0150048383c9}",
207 "WORDVIEWFiles", -2, 0 );
208 ok( r
== INSTALLSTATE_INVALIDARG
, "wrong return val\n");
210 r
= pMsiUseFeatureExA("{0085040-6000-11d3-8cfe-0150048383c9}",
211 "WORDVIEWFiles", -2, 0 );
212 ok( r
== INSTALLSTATE_INVALIDARG
, "wrong return val\n");
214 r
= pMsiUseFeatureExA("{90850409-6000-11d3-8cfe-0150048383c9}",
215 "WORDVIEWFiles", -2, 1 );
216 ok( r
== INSTALLSTATE_INVALIDARG
, "wrong return val\n");
219 static void test_null(void)
224 DWORD dwType
, cbData
;
225 LPBYTE lpData
= NULL
;
228 r
= pMsiOpenPackageExW(NULL
, 0, &hpkg
);
229 ok( r
== ERROR_INVALID_PARAMETER
,"wrong error\n");
231 state
= MsiQueryProductStateW(NULL
);
232 ok( state
== INSTALLSTATE_INVALIDARG
, "wrong return\n");
234 r
= MsiEnumFeaturesW(NULL
,0,NULL
,NULL
);
235 ok( r
== ERROR_INVALID_PARAMETER
,"wrong error\n");
237 r
= MsiConfigureFeatureW(NULL
, NULL
, 0);
238 ok( r
== ERROR_INVALID_PARAMETER
, "wrong error\n");
240 r
= MsiConfigureFeatureA("{00000000-0000-0000-0000-000000000000}", NULL
, 0);
241 ok( r
== ERROR_INVALID_PARAMETER
, "wrong error\n");
243 r
= MsiConfigureFeatureA("{00000000-0000-0000-0000-000000000000}", "foo", 0);
244 ok( r
== ERROR_INVALID_PARAMETER
, "wrong error %d\n", r
);
246 r
= MsiConfigureFeatureA("{00000000-0000-0000-0000-000000000000}", "foo", INSTALLSTATE_DEFAULT
);
247 ok( r
== ERROR_UNKNOWN_PRODUCT
, "wrong error %d\n", r
);
249 /* make sure empty string to MsiGetProductInfo is not a handle to default registry value, saving and restoring the
250 * necessary registry values */
252 /* empty product string */
253 r
= RegOpenKeyA(HKEY_LOCAL_MACHINE
, "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall", &hkey
);
254 ok( r
== ERROR_SUCCESS
, "wrong error %d\n", r
);
256 r
= RegQueryValueExA(hkey
, NULL
, 0, &dwType
, lpData
, &cbData
);
257 ok ( r
== ERROR_SUCCESS
|| r
== ERROR_FILE_NOT_FOUND
, "wrong error %d\n", r
);
258 if ( r
== ERROR_SUCCESS
)
260 lpData
= HeapAlloc(GetProcessHeap(), 0, cbData
);
262 skip("Out of memory\n");
265 r
= RegQueryValueExA(hkey
, NULL
, 0, &dwType
, lpData
, &cbData
);
266 ok ( r
== ERROR_SUCCESS
, "wrong error %d\n", r
);
270 r
= RegSetValueA(hkey
, NULL
, REG_SZ
, "test", strlen("test"));
271 ok( r
== ERROR_SUCCESS
, "wrong error %d\n", r
);
273 r
= MsiGetProductInfoA("", "", NULL
, NULL
);
274 ok ( r
== ERROR_INVALID_PARAMETER
, "wrong error %d\n", r
);
278 r
= RegSetValueExA(hkey
, NULL
, 0, dwType
, lpData
, cbData
);
279 ok ( r
== ERROR_SUCCESS
, "wrong error %d\n", r
);
281 HeapFree(GetProcessHeap(), 0, lpData
);
285 r
= RegDeleteValueA(hkey
, NULL
);
286 ok ( r
== ERROR_SUCCESS
, "wrong error %d\n", r
);
289 r
= RegCloseKey(hkey
);
290 ok( r
== ERROR_SUCCESS
, "wrong error %d\n", r
);
292 /* empty attribute */
293 r
= RegCreateKeyA(HKEY_LOCAL_MACHINE
, "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\{F1C3AF50-8B56-4A69-A00C-00773FE42F30}", &hkey
);
294 ok( r
== ERROR_SUCCESS
, "wrong error %d\n", r
);
296 r
= RegSetValueA(hkey
, NULL
, REG_SZ
, "test", strlen("test"));
297 ok( r
== ERROR_SUCCESS
, "wrong error %d\n", r
);
299 r
= MsiGetProductInfoA("{F1C3AF50-8B56-4A69-A00C-00773FE42F30}", "", NULL
, NULL
);
300 ok ( r
== ERROR_UNKNOWN_PROPERTY
, "wrong error %d\n", r
);
302 r
= RegCloseKey(hkey
);
303 ok( r
== ERROR_SUCCESS
, "wrong error %d\n", r
);
305 r
= RegDeleteKeyA(HKEY_LOCAL_MACHINE
, "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\{F1C3AF50-8B56-4A69-A00C-00773FE42F30}");
306 ok( r
== ERROR_SUCCESS
, "wrong error %d\n", r
);
309 static void test_getcomponentpath(void)
315 if(!pMsiGetComponentPathA
)
318 r
= pMsiGetComponentPathA( NULL
, NULL
, NULL
, NULL
);
319 ok( r
== INSTALLSTATE_INVALIDARG
, "wrong return value\n");
321 r
= pMsiGetComponentPathA( "bogus", "bogus", NULL
, NULL
);
322 ok( r
== INSTALLSTATE_INVALIDARG
, "wrong return value\n");
324 r
= pMsiGetComponentPathA( "bogus", "{00000000-0000-0000-000000000000}", NULL
, NULL
);
325 ok( r
== INSTALLSTATE_INVALIDARG
, "wrong return value\n");
329 r
= pMsiGetComponentPathA( "bogus", "{00000000-0000-0000-000000000000}", buffer
, &sz
);
330 ok( r
== INSTALLSTATE_INVALIDARG
, "wrong return value\n");
332 r
= pMsiGetComponentPathA( "{00000000-78E1-11D2-B60F-006097C998E7}",
333 "{00000000-0000-0000-0000-000000000000}", buffer
, &sz
);
334 ok( r
== INSTALLSTATE_UNKNOWN
, "wrong return value\n");
336 r
= pMsiGetComponentPathA( "{00000409-78E1-11D2-B60F-006097C998E7}",
337 "{00000000-0000-0000-0000-00000000}", buffer
, &sz
);
338 ok( r
== INSTALLSTATE_INVALIDARG
, "wrong return value\n");
340 r
= pMsiGetComponentPathA( "{00000409-78E1-11D2-B60F-006097C998E7}",
341 "{029E403D-A86A-1D11-5B5B0006799C897E}", buffer
, &sz
);
342 ok( r
== INSTALLSTATE_INVALIDARG
, "wrong return value\n");
344 r
= pMsiGetComponentPathA( "{00000000-78E1-11D2-B60F-006097C9987e}",
345 "{00000000-A68A-11d1-5B5B-0006799C897E}", buffer
, &sz
);
346 ok( r
== INSTALLSTATE_UNKNOWN
, "wrong return value\n");
349 static void create_file(LPCSTR name
, LPCSTR data
, DWORD size
)
354 file
= CreateFileA(name
, GENERIC_WRITE
, 0, NULL
, CREATE_ALWAYS
, 0, NULL
);
355 ok(file
!= INVALID_HANDLE_VALUE
, "Failure to open file %s\n", name
);
356 WriteFile(file
, data
, strlen(data
), &written
, NULL
);
360 SetFilePointer(file
, size
, NULL
, FILE_BEGIN
);
367 #define HASHSIZE sizeof(MSIFILEHASHINFO)
373 MSIFILEHASHINFO hash
;
378 { 0x98500190, 0xb04fd23c, 0x7d3f96d6, 0x727fe128 },
382 { "C:\\Program Files\\msitest\\caesar\n", 0,
384 { 0x2b566794, 0xfd42181b, 0x2514d6e4, 0x5768b4e2 },
388 { "C:\\Program Files\\msitest\\caesar\n", 500,
390 { 0x58095058, 0x805efeff, 0x10f3483e, 0x0147d653 },
395 static void test_MsiGetFileHash(void)
397 const char name
[] = "msitest.bin";
399 MSIFILEHASHINFO hash
;
402 if (!pMsiGetFileHashA
)
404 skip("MsiGetFileHash not implemented\n");
408 hash
.dwFileHashInfoSize
= sizeof(MSIFILEHASHINFO
);
410 /* szFilePath is NULL */
411 r
= pMsiGetFileHashA(NULL
, 0, &hash
);
412 ok(r
== ERROR_INVALID_PARAMETER
, "Expected ERROR_INVALID_PARAMETER, got %d\n", r
);
414 /* szFilePath is empty */
415 r
= pMsiGetFileHashA("", 0, &hash
);
416 ok(r
== ERROR_PATH_NOT_FOUND
|| r
== ERROR_BAD_PATHNAME
,
417 "Expected ERROR_PATH_NOT_FOUND or ERROR_BAD_PATHNAME, got %d\n", r
);
419 /* szFilePath is nonexistent */
420 r
= pMsiGetFileHashA(name
, 0, &hash
);
421 ok(r
== ERROR_FILE_NOT_FOUND
, "Expected ERROR_FILE_NOT_FOUND, got %d\n", r
);
423 /* dwOptions is non-zero */
424 r
= pMsiGetFileHashA(name
, 1, &hash
);
425 ok(r
== ERROR_INVALID_PARAMETER
, "Expected ERROR_INVALID_PARAMETER, got %d\n", r
);
427 /* pHash.dwFileHashInfoSize is not correct */
428 hash
.dwFileHashInfoSize
= 0;
429 r
= pMsiGetFileHashA(name
, 0, &hash
);
430 ok(r
== ERROR_INVALID_PARAMETER
, "Expected ERROR_INVALID_PARAMETER, got %d\n", r
);
433 r
= pMsiGetFileHashA(name
, 0, NULL
);
434 ok(r
== ERROR_INVALID_PARAMETER
, "Expected ERROR_INVALID_PARAMETER, got %d\n", r
);
436 for (i
= 0; i
< sizeof(hash_data
) / sizeof(hash_data
[0]); i
++)
438 create_file(name
, hash_data
[i
].data
, hash_data
[i
].size
);
440 memset(&hash
, 0, sizeof(MSIFILEHASHINFO
));
441 hash
.dwFileHashInfoSize
= sizeof(MSIFILEHASHINFO
);
443 r
= pMsiGetFileHashA(name
, 0, &hash
);
444 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
445 ok(!memcmp(&hash
, &hash_data
[i
].hash
, HASHSIZE
), "Hash incorrect\n");
451 /* copied from dlls/msi/registry.c */
452 static BOOL
squash_guid(LPCWSTR in
, LPWSTR out
)
457 if (FAILED(CLSIDFromString((LPOLESTR
)in
, &guid
)))
471 out
[17+i
*2] = in
[n
++];
472 out
[16+i
*2] = in
[n
++];
477 out
[17+i
*2] = in
[n
++];
478 out
[16+i
*2] = in
[n
++];
484 static void create_test_guid(LPSTR prodcode
, LPSTR squashed
)
486 WCHAR guidW
[MAX_PATH
];
487 WCHAR squashedW
[MAX_PATH
];
492 hr
= CoCreateGuid(&guid
);
493 ok(hr
== S_OK
, "Expected S_OK, got %d\n", hr
);
495 size
= StringFromGUID2(&guid
, (LPOLESTR
)guidW
, MAX_PATH
);
496 ok(size
== 39, "Expected 39, got %d\n", hr
);
498 WideCharToMultiByte(CP_ACP
, 0, guidW
, size
, prodcode
, MAX_PATH
, NULL
, NULL
);
499 squash_guid(guidW
, squashedW
);
500 WideCharToMultiByte(CP_ACP
, 0, squashedW
, -1, squashed
, MAX_PATH
, NULL
, NULL
);
503 static void get_user_sid(LPSTR
*usersid
)
510 OpenProcessToken(GetCurrentProcess(), TOKEN_QUERY
, &token
);
512 GetTokenInformation(token
, TokenUser
, (void *)buf
, size
, &size
);
513 user
= (PTOKEN_USER
)buf
;
514 pConvertSidToStringSidA(user
->User
.Sid
, usersid
);
517 static void test_MsiQueryProductState(void)
519 CHAR prodcode
[MAX_PATH
];
520 CHAR prod_squashed
[MAX_PATH
];
521 CHAR keypath
[MAX_PATH
*2];
525 HKEY userkey
, localkey
, props
;
529 create_test_guid(prodcode
, prod_squashed
);
530 get_user_sid(&usersid
);
533 state
= MsiQueryProductStateA(NULL
);
534 ok(state
== INSTALLSTATE_INVALIDARG
, "Expected INSTALLSTATE_INVALIDARG, got %d\n", state
);
537 state
= MsiQueryProductStateA("");
538 ok(state
== INSTALLSTATE_INVALIDARG
, "Expected INSTALLSTATE_INVALIDARG, got %d\n", state
);
540 /* garbage prodcode */
541 state
= MsiQueryProductStateA("garbage");
542 ok(state
== INSTALLSTATE_INVALIDARG
, "Expected INSTALLSTATE_INVALIDARG, got %d\n", state
);
544 /* guid without brackets */
545 state
= MsiQueryProductStateA("6700E8CF-95AB-4D9C-BC2C-15840DEA7A5D");
546 ok(state
== INSTALLSTATE_INVALIDARG
, "Expected INSTALLSTATE_INVALIDARG, got %d\n", state
);
548 /* guid with brackets */
549 state
= MsiQueryProductStateA("{6700E8CF-95AB-4D9C-BC2C-15840DEA7A5D}");
550 ok(state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
552 /* same length as guid, but random */
553 state
= MsiQueryProductStateA("A938G02JF-2NF3N93-VN3-2NNF-3KGKALDNF93");
554 ok(state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
556 /* MSIINSTALLCONTEXT_USERUNMANAGED */
558 state
= MsiQueryProductStateA(prodcode
);
559 ok(state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
561 lstrcpyA(keypath
, "Software\\Microsoft\\Installer\\Products\\");
562 lstrcatA(keypath
, prod_squashed
);
564 res
= RegCreateKeyA(HKEY_CURRENT_USER
, keypath
, &userkey
);
565 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
567 /* user product key exists */
568 state
= MsiQueryProductStateA(prodcode
);
569 ok(state
== INSTALLSTATE_ADVERTISED
, "Expected INSTALLSTATE_ADVERTISED, got %d\n", state
);
571 lstrcpyA(keypath
, "Software\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\");
572 lstrcatA(keypath
, prodcode
);
574 res
= RegCreateKeyA(HKEY_LOCAL_MACHINE
, keypath
, &localkey
);
575 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
577 /* local uninstall key exists */
578 state
= MsiQueryProductStateA(prodcode
);
579 ok(state
== INSTALLSTATE_ADVERTISED
, "Expected INSTALLSTATE_ADVERTISED, got %d\n", state
);
582 res
= RegSetValueExA(localkey
, "WindowsInstaller", 0, REG_DWORD
, (const BYTE
*)&data
, sizeof(DWORD
));
583 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
585 /* WindowsInstaller value exists */
586 state
= MsiQueryProductStateA(prodcode
);
587 ok(state
== INSTALLSTATE_ADVERTISED
, "Expected INSTALLSTATE_ADVERTISED, got %d\n", state
);
589 RegDeleteValueA(localkey
, "WindowsInstaller");
590 RegDeleteKeyA(localkey
, "");
592 lstrcpyA(keypath
, "Software\\Microsoft\\Windows\\CurrentVersion\\Installer\\UserData\\");
593 lstrcatA(keypath
, usersid
);
594 lstrcatA(keypath
, "\\Products\\");
595 lstrcatA(keypath
, prod_squashed
);
597 res
= RegCreateKeyA(HKEY_LOCAL_MACHINE
, keypath
, &localkey
);
598 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
600 /* local product key exists */
601 state
= MsiQueryProductStateA(prodcode
);
602 ok(state
== INSTALLSTATE_ADVERTISED
, "Expected INSTALLSTATE_ADVERTISED, got %d\n", state
);
604 res
= RegCreateKeyA(localkey
, "InstallProperties", &props
);
605 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
607 /* install properties key exists */
608 state
= MsiQueryProductStateA(prodcode
);
609 ok(state
== INSTALLSTATE_ADVERTISED
, "Expected INSTALLSTATE_ADVERTISED, got %d\n", state
);
612 res
= RegSetValueExA(props
, "WindowsInstaller", 0, REG_DWORD
, (const BYTE
*)&data
, sizeof(DWORD
));
613 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
615 /* WindowsInstaller value exists */
616 state
= MsiQueryProductStateA(prodcode
);
617 ok(state
== INSTALLSTATE_DEFAULT
, "Expected INSTALLSTATE_DEFAULT, got %d\n", state
);
620 res
= RegSetValueExA(props
, "WindowsInstaller", 0, REG_DWORD
, (const BYTE
*)&data
, sizeof(DWORD
));
621 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
623 /* WindowsInstaller value is not 1 */
624 state
= MsiQueryProductStateA(prodcode
);
625 ok(state
== INSTALLSTATE_DEFAULT
, "Expected INSTALLSTATE_DEFAULT, got %d\n", state
);
627 RegDeleteKeyA(userkey
, "");
629 /* user product key does not exist */
630 state
= MsiQueryProductStateA(prodcode
);
631 ok(state
== INSTALLSTATE_ABSENT
, "Expected INSTALLSTATE_ABSENT, got %d\n", state
);
633 RegDeleteValueA(props
, "WindowsInstaller");
634 RegDeleteKeyA(props
, "");
636 RegDeleteKeyA(localkey
, "");
637 RegCloseKey(localkey
);
638 RegDeleteKeyA(userkey
, "");
639 RegCloseKey(userkey
);
641 /* MSIINSTALLCONTEXT_USERMANAGED */
643 lstrcpyA(keypath
, "Software\\Microsoft\\Windows\\CurrentVersion\\Installer\\Managed\\");
644 lstrcatA(keypath
, usersid
);
645 lstrcatA(keypath
, "\\Installer\\Products\\");
646 lstrcatA(keypath
, prod_squashed
);
648 res
= RegCreateKeyA(HKEY_LOCAL_MACHINE
, keypath
, &prodkey
);
649 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
651 state
= MsiQueryProductStateA(prodcode
);
652 ok(state
== INSTALLSTATE_ADVERTISED
,
653 "Expected INSTALLSTATE_ADVERTISED, got %d\n", state
);
655 lstrcpyA(keypath
, "Software\\Microsoft\\Windows\\CurrentVersion\\Installer\\UserData\\");
656 lstrcatA(keypath
, usersid
);
657 lstrcatA(keypath
, "\\Products\\");
658 lstrcatA(keypath
, prod_squashed
);
660 res
= RegCreateKeyA(HKEY_LOCAL_MACHINE
, keypath
, &localkey
);
661 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
663 state
= MsiQueryProductStateA(prodcode
);
664 ok(state
== INSTALLSTATE_ADVERTISED
,
665 "Expected INSTALLSTATE_ADVERTISED, got %d\n", state
);
667 res
= RegCreateKeyA(localkey
, "InstallProperties", &props
);
668 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
670 state
= MsiQueryProductStateA(prodcode
);
671 ok(state
== INSTALLSTATE_ADVERTISED
,
672 "Expected INSTALLSTATE_ADVERTISED, got %d\n", state
);
675 res
= RegSetValueExA(props
, "WindowsInstaller", 0, REG_DWORD
, (const BYTE
*)&data
, sizeof(DWORD
));
676 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
678 /* WindowsInstaller value exists */
679 state
= MsiQueryProductStateA(prodcode
);
680 ok(state
== INSTALLSTATE_DEFAULT
, "Expected INSTALLSTATE_DEFAULT, got %d\n", state
);
682 RegDeleteValueA(props
, "WindowsInstaller");
683 RegDeleteKeyA(props
, "");
685 RegDeleteKeyA(localkey
, "");
686 RegCloseKey(localkey
);
687 RegDeleteKeyA(prodkey
, "");
688 RegCloseKey(prodkey
);
690 /* MSIINSTALLCONTEXT_MACHINE */
692 lstrcpyA(keypath
, "Software\\Classes\\Installer\\Products\\");
693 lstrcatA(keypath
, prod_squashed
);
695 res
= RegCreateKeyA(HKEY_LOCAL_MACHINE
, keypath
, &prodkey
);
696 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
698 state
= MsiQueryProductStateA(prodcode
);
699 ok(state
== INSTALLSTATE_ADVERTISED
, "Expected INSTALLSTATE_ADVERTISED, got %d\n", state
);
701 lstrcpyA(keypath
, "Software\\Microsoft\\Windows\\CurrentVersion\\Installer\\UserData\\");
702 lstrcatA(keypath
, "S-1-5-18\\Products\\");
703 lstrcatA(keypath
, prod_squashed
);
705 res
= RegCreateKeyA(HKEY_LOCAL_MACHINE
, keypath
, &localkey
);
706 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
708 state
= MsiQueryProductStateA(prodcode
);
709 ok(state
== INSTALLSTATE_ADVERTISED
,
710 "Expected INSTALLSTATE_ADVERTISED, got %d\n", state
);
712 res
= RegCreateKeyA(localkey
, "InstallProperties", &props
);
713 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
715 state
= MsiQueryProductStateA(prodcode
);
716 ok(state
== INSTALLSTATE_ADVERTISED
,
717 "Expected INSTALLSTATE_ADVERTISED, got %d\n", state
);
720 res
= RegSetValueExA(props
, "WindowsInstaller", 0, REG_DWORD
, (const BYTE
*)&data
, sizeof(DWORD
));
721 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
723 /* WindowsInstaller value exists */
724 state
= MsiQueryProductStateA(prodcode
);
725 ok(state
== INSTALLSTATE_DEFAULT
, "Expected INSTALLSTATE_DEFAULT, got %d\n", state
);
727 RegDeleteValueA(props
, "WindowsInstaller");
728 RegDeleteKeyA(props
, "");
730 RegDeleteKeyA(localkey
, "");
731 RegCloseKey(localkey
);
732 RegDeleteKeyA(prodkey
, "");
733 RegCloseKey(prodkey
);
738 static const char table_enc85
[] =
739 "!$%&'()*+,-.0123456789=?@ABCDEFGHIJKLMNO"
740 "PQRSTUVWXYZ[]^_`abcdefghijklmnopqrstuvwx"
744 * Encodes a base85 guid given a GUID pointer
745 * Caller should provide a 21 character buffer for the encoded string.
747 * returns TRUE if successful, FALSE if not
749 static BOOL
encode_base85_guid( GUID
*guid
, LPWSTR str
)
751 unsigned int x
, *p
, i
;
753 p
= (unsigned int*) guid
;
757 *str
++ = table_enc85
[x
%85];
759 *str
++ = table_enc85
[x
%85];
761 *str
++ = table_enc85
[x
%85];
763 *str
++ = table_enc85
[x
%85];
765 *str
++ = table_enc85
[x
%85];
772 static void compose_base85_guid(LPSTR component
, LPSTR comp_base85
, LPSTR squashed
)
774 WCHAR guidW
[MAX_PATH
];
775 WCHAR base85W
[MAX_PATH
];
776 WCHAR squashedW
[MAX_PATH
];
781 hr
= CoCreateGuid(&guid
);
782 ok(hr
== S_OK
, "Expected S_OK, got %d\n", hr
);
784 size
= StringFromGUID2(&guid
, (LPOLESTR
)guidW
, MAX_PATH
);
785 ok(size
== 39, "Expected 39, got %d\n", hr
);
787 WideCharToMultiByte(CP_ACP
, 0, guidW
, size
, component
, MAX_PATH
, NULL
, NULL
);
788 encode_base85_guid(&guid
, base85W
);
789 WideCharToMultiByte(CP_ACP
, 0, base85W
, -1, comp_base85
, MAX_PATH
, NULL
, NULL
);
790 squash_guid(guidW
, squashedW
);
791 WideCharToMultiByte(CP_ACP
, 0, squashedW
, -1, squashed
, MAX_PATH
, NULL
, NULL
);
794 static void test_MsiQueryFeatureState(void)
796 HKEY userkey
, localkey
, compkey
;
797 CHAR prodcode
[MAX_PATH
];
798 CHAR prod_squashed
[MAX_PATH
];
799 CHAR component
[MAX_PATH
];
800 CHAR comp_base85
[MAX_PATH
];
801 CHAR comp_squashed
[MAX_PATH
];
802 CHAR keypath
[MAX_PATH
*2];
807 create_test_guid(prodcode
, prod_squashed
);
808 compose_base85_guid(component
, comp_base85
, comp_squashed
);
809 get_user_sid(&usersid
);
812 state
= MsiQueryFeatureStateA(NULL
, "feature");
813 ok(state
== INSTALLSTATE_INVALIDARG
, "Expected INSTALLSTATE_INVALIDARG, got %d\n", state
);
816 state
= MsiQueryFeatureStateA("", "feature");
817 ok(state
== INSTALLSTATE_INVALIDARG
, "Expected INSTALLSTATE_INVALIDARG, got %d\n", state
);
819 /* garbage prodcode */
820 state
= MsiQueryFeatureStateA("garbage", "feature");
821 ok(state
== INSTALLSTATE_INVALIDARG
, "Expected INSTALLSTATE_INVALIDARG, got %d\n", state
);
823 /* guid without brackets */
824 state
= MsiQueryFeatureStateA("6700E8CF-95AB-4D9C-BC2C-15840DEA7A5D", "feature");
825 ok(state
== INSTALLSTATE_INVALIDARG
, "Expected INSTALLSTATE_INVALIDARG, got %d\n", state
);
827 /* guid with brackets */
828 state
= MsiQueryFeatureStateA("{6700E8CF-95AB-4D9C-BC2C-15840DEA7A5D}", "feature");
829 ok(state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
831 /* same length as guid, but random */
832 state
= MsiQueryFeatureStateA("A938G02JF-2NF3N93-VN3-2NNF-3KGKALDNF93", "feature");
833 ok(state
== INSTALLSTATE_INVALIDARG
, "Expected INSTALLSTATE_INVALIDARG, got %d\n", state
);
836 state
= MsiQueryFeatureStateA(prodcode
, NULL
);
837 ok(state
== INSTALLSTATE_INVALIDARG
, "Expected INSTALLSTATE_INVALIDARG, got %d\n", state
);
839 /* empty szFeature */
840 state
= MsiQueryFeatureStateA(prodcode
, "");
841 ok(state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
843 /* feature key does not exist yet */
844 state
= MsiQueryFeatureStateA(prodcode
, "feature");
845 ok(state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
847 /* MSIINSTALLCONTEXT_USERUNMANAGED */
849 lstrcpyA(keypath
, "Software\\Microsoft\\Installer\\Features\\");
850 lstrcatA(keypath
, prod_squashed
);
852 res
= RegCreateKeyA(HKEY_CURRENT_USER
, keypath
, &userkey
);
853 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
855 /* feature key exists */
856 state
= MsiQueryFeatureStateA(prodcode
, "feature");
857 ok(state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
859 res
= RegSetValueExA(userkey
, "feature", 0, REG_SZ
, (const BYTE
*)"", 2);
860 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
862 /* feature value exists */
863 state
= MsiQueryFeatureStateA(prodcode
, "feature");
864 ok(state
== INSTALLSTATE_ADVERTISED
, "Expected INSTALLSTATE_ADVERTISED, got %d\n", state
);
866 lstrcpyA(keypath
, "Software\\Microsoft\\Windows\\CurrentVersion\\Installer\\UserData\\");
867 lstrcatA(keypath
, usersid
);
868 lstrcatA(keypath
, "\\Products\\");
869 lstrcatA(keypath
, prod_squashed
);
870 lstrcatA(keypath
, "\\Features");
872 res
= RegCreateKeyA(HKEY_LOCAL_MACHINE
, keypath
, &localkey
);
873 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
875 /* userdata features key exists */
876 state
= MsiQueryFeatureStateA(prodcode
, "feature");
877 ok(state
== INSTALLSTATE_ADVERTISED
, "Expected INSTALLSTATE_ADVERTISED, got %d\n", state
);
879 res
= RegSetValueExA(localkey
, "feature", 0, REG_SZ
, (const BYTE
*)"aaaaaaaaaaaaaaaaaaa", 20);
880 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
882 state
= MsiQueryFeatureStateA(prodcode
, "feature");
883 ok(state
== INSTALLSTATE_BADCONFIG
, "Expected INSTALLSTATE_BADCONFIG, got %d\n", state
);
885 res
= RegSetValueExA(localkey
, "feature", 0, REG_SZ
, (const BYTE
*)"aaaaaaaaaaaaaaaaaaaa", 21);
886 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
888 state
= MsiQueryFeatureStateA(prodcode
, "feature");
889 ok(state
== INSTALLSTATE_ADVERTISED
, "Expected INSTALLSTATE_ADVERTISED, got %d\n", state
);
891 res
= RegSetValueExA(localkey
, "feature", 0, REG_SZ
, (const BYTE
*)"aaaaaaaaaaaaaaaaaaaaa", 22);
892 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
894 state
= MsiQueryFeatureStateA(prodcode
, "feature");
895 ok(state
== INSTALLSTATE_ADVERTISED
, "Expected INSTALLSTATE_ADVERTISED, got %d\n", state
);
897 res
= RegSetValueExA(localkey
, "feature", 0, REG_SZ
, (const BYTE
*)comp_base85
, 21);
898 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
900 state
= MsiQueryFeatureStateA(prodcode
, "feature");
901 ok(state
== INSTALLSTATE_ADVERTISED
, "Expected INSTALLSTATE_ADVERTISED, got %d\n", state
);
903 lstrcpyA(keypath
, "Software\\Microsoft\\Windows\\CurrentVersion\\Installer\\UserData\\");
904 lstrcatA(keypath
, usersid
);
905 lstrcatA(keypath
, "\\Components\\");
906 lstrcatA(keypath
, comp_squashed
);
908 res
= RegCreateKeyA(HKEY_LOCAL_MACHINE
, keypath
, &compkey
);
909 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
911 state
= MsiQueryFeatureStateA(prodcode
, "feature");
912 ok(state
== INSTALLSTATE_ADVERTISED
, "Expected INSTALLSTATE_ADVERTISED, got %d\n", state
);
914 res
= RegSetValueExA(compkey
, prod_squashed
, 0, REG_SZ
, (const BYTE
*)"", 1);
915 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
917 state
= MsiQueryFeatureStateA(prodcode
, "feature");
918 ok(state
== INSTALLSTATE_LOCAL
, "Expected INSTALLSTATE_LOCAL, got %d\n", state
);
920 res
= RegSetValueExA(compkey
, prod_squashed
, 0, REG_SZ
, (const BYTE
*)"apple", 1);
921 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
923 /* INSTALLSTATE_LOCAL */
924 state
= MsiQueryFeatureStateA(prodcode
, "feature");
925 ok(state
== INSTALLSTATE_LOCAL
, "Expected INSTALLSTATE_LOCAL, got %d\n", state
);
927 res
= RegSetValueExA(compkey
, prod_squashed
, 0, REG_SZ
, (const BYTE
*)"01\\", 4);
928 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
930 /* INSTALLSTATE_SOURCE */
931 state
= MsiQueryFeatureStateA(prodcode
, "feature");
932 ok(state
== INSTALLSTATE_SOURCE
, "Expected INSTALLSTATE_SOURCE, got %d\n", state
);
934 res
= RegSetValueExA(compkey
, prod_squashed
, 0, REG_SZ
, (const BYTE
*)"01", 3);
935 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
937 /* bad INSTALLSTATE_SOURCE */
938 state
= MsiQueryFeatureStateA(prodcode
, "feature");
939 ok(state
== INSTALLSTATE_LOCAL
, "Expected INSTALLSTATE_LOCAL, got %d\n", state
);
941 res
= RegSetValueExA(compkey
, prod_squashed
, 0, REG_SZ
, (const BYTE
*)"01a", 4);
942 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
944 /* INSTALLSTATE_SOURCE */
945 state
= MsiQueryFeatureStateA(prodcode
, "feature");
946 ok(state
== INSTALLSTATE_SOURCE
, "Expected INSTALLSTATE_SOURCE, got %d\n", state
);
948 res
= RegSetValueExA(compkey
, prod_squashed
, 0, REG_SZ
, (const BYTE
*)"01", 3);
949 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
951 /* bad INSTALLSTATE_SOURCE */
952 state
= MsiQueryFeatureStateA(prodcode
, "feature");
953 ok(state
== INSTALLSTATE_LOCAL
, "Expected INSTALLSTATE_LOCAL, got %d\n", state
);
955 RegDeleteValueA(compkey
, prod_squashed
);
956 RegDeleteKeyA(compkey
, "");
957 RegDeleteValueA(localkey
, "feature");
958 RegDeleteValueA(userkey
, "feature");
959 RegDeleteKeyA(userkey
, "");
960 RegCloseKey(compkey
);
961 RegCloseKey(localkey
);
962 RegCloseKey(userkey
);
964 /* MSIINSTALLCONTEXT_USERMANAGED */
966 lstrcpyA(keypath
, "Software\\Microsoft\\Windows\\CurrentVersion\\Installer\\Managed\\");
967 lstrcatA(keypath
, usersid
);
968 lstrcatA(keypath
, "\\Installer\\Features\\");
969 lstrcatA(keypath
, prod_squashed
);
971 res
= RegCreateKeyA(HKEY_LOCAL_MACHINE
, keypath
, &userkey
);
972 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
974 /* feature key exists */
975 state
= MsiQueryFeatureStateA(prodcode
, "feature");
976 ok(state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
978 res
= RegSetValueExA(userkey
, "feature", 0, REG_SZ
, (const BYTE
*)"", 2);
979 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
981 /* feature value exists */
982 state
= MsiQueryFeatureStateA(prodcode
, "feature");
983 ok(state
== INSTALLSTATE_ADVERTISED
, "Expected INSTALLSTATE_ADVERTISED, got %d\n", state
);
985 lstrcpyA(keypath
, "Software\\Microsoft\\Windows\\CurrentVersion\\Installer\\UserData\\");
986 lstrcatA(keypath
, usersid
);
987 lstrcatA(keypath
, "\\Products\\");
988 lstrcatA(keypath
, prod_squashed
);
989 lstrcatA(keypath
, "\\Features");
991 res
= RegCreateKeyA(HKEY_LOCAL_MACHINE
, keypath
, &localkey
);
992 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
994 /* userdata features key exists */
995 state
= MsiQueryFeatureStateA(prodcode
, "feature");
996 ok(state
== INSTALLSTATE_ADVERTISED
, "Expected INSTALLSTATE_ADVERTISED, got %d\n", state
);
998 res
= RegSetValueExA(localkey
, "feature", 0, REG_SZ
, (const BYTE
*)"aaaaaaaaaaaaaaaaaaa", 20);
999 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
1001 state
= MsiQueryFeatureStateA(prodcode
, "feature");
1002 ok(state
== INSTALLSTATE_BADCONFIG
, "Expected INSTALLSTATE_BADCONFIG, got %d\n", state
);
1004 res
= RegSetValueExA(localkey
, "feature", 0, REG_SZ
, (const BYTE
*)"aaaaaaaaaaaaaaaaaaaa", 21);
1005 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
1007 state
= MsiQueryFeatureStateA(prodcode
, "feature");
1008 ok(state
== INSTALLSTATE_ADVERTISED
, "Expected INSTALLSTATE_ADVERTISED, got %d\n", state
);
1010 res
= RegSetValueExA(localkey
, "feature", 0, REG_SZ
, (const BYTE
*)"aaaaaaaaaaaaaaaaaaaaa", 22);
1011 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
1013 state
= MsiQueryFeatureStateA(prodcode
, "feature");
1014 ok(state
== INSTALLSTATE_ADVERTISED
, "Expected INSTALLSTATE_ADVERTISED, got %d\n", state
);
1016 res
= RegSetValueExA(localkey
, "feature", 0, REG_SZ
, (const BYTE
*)comp_base85
, 21);
1017 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
1019 state
= MsiQueryFeatureStateA(prodcode
, "feature");
1020 ok(state
== INSTALLSTATE_ADVERTISED
, "Expected INSTALLSTATE_ADVERTISED, got %d\n", state
);
1022 lstrcpyA(keypath
, "Software\\Microsoft\\Windows\\CurrentVersion\\Installer\\UserData\\");
1023 lstrcatA(keypath
, usersid
);
1024 lstrcatA(keypath
, "\\Components\\");
1025 lstrcatA(keypath
, comp_squashed
);
1027 res
= RegCreateKeyA(HKEY_LOCAL_MACHINE
, keypath
, &compkey
);
1028 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
1030 state
= MsiQueryFeatureStateA(prodcode
, "feature");
1031 ok(state
== INSTALLSTATE_ADVERTISED
, "Expected INSTALLSTATE_ADVERTISED, got %d\n", state
);
1033 res
= RegSetValueExA(compkey
, prod_squashed
, 0, REG_SZ
, (const BYTE
*)"", 1);
1034 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
1036 state
= MsiQueryFeatureStateA(prodcode
, "feature");
1037 ok(state
== INSTALLSTATE_LOCAL
, "Expected INSTALLSTATE_LOCAL, got %d\n", state
);
1039 res
= RegSetValueExA(compkey
, prod_squashed
, 0, REG_SZ
, (const BYTE
*)"apple", 1);
1040 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
1042 state
= MsiQueryFeatureStateA(prodcode
, "feature");
1043 ok(state
== INSTALLSTATE_LOCAL
, "Expected INSTALLSTATE_LOCAL, got %d\n", state
);
1045 RegDeleteValueA(compkey
, prod_squashed
);
1046 RegDeleteKeyA(compkey
, "");
1047 RegDeleteValueA(localkey
, "feature");
1048 RegDeleteValueA(userkey
, "feature");
1049 RegDeleteKeyA(userkey
, "");
1050 RegCloseKey(compkey
);
1051 RegCloseKey(localkey
);
1052 RegCloseKey(userkey
);
1054 /* MSIINSTALLCONTEXT_MACHINE */
1056 lstrcpyA(keypath
, "Software\\Classes\\Installer\\Features\\");
1057 lstrcatA(keypath
, prod_squashed
);
1059 res
= RegCreateKeyA(HKEY_LOCAL_MACHINE
, keypath
, &userkey
);
1060 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
1062 /* feature key exists */
1063 state
= MsiQueryFeatureStateA(prodcode
, "feature");
1064 ok(state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
1066 res
= RegSetValueExA(userkey
, "feature", 0, REG_SZ
, (const BYTE
*)"", 2);
1067 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
1069 /* feature value exists */
1070 state
= MsiQueryFeatureStateA(prodcode
, "feature");
1071 ok(state
== INSTALLSTATE_ADVERTISED
, "Expected INSTALLSTATE_ADVERTISED, got %d\n", state
);
1073 lstrcpyA(keypath
, "Software\\Microsoft\\Windows\\CurrentVersion\\Installer\\UserData\\");
1074 lstrcatA(keypath
, "S-1-5-18\\Products\\");
1075 lstrcatA(keypath
, prod_squashed
);
1076 lstrcatA(keypath
, "\\Features");
1078 res
= RegCreateKeyA(HKEY_LOCAL_MACHINE
, keypath
, &localkey
);
1079 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
1081 /* userdata features key exists */
1082 state
= MsiQueryFeatureStateA(prodcode
, "feature");
1083 ok(state
== INSTALLSTATE_ADVERTISED
, "Expected INSTALLSTATE_ADVERTISED, got %d\n", state
);
1085 res
= RegSetValueExA(localkey
, "feature", 0, REG_SZ
, (const BYTE
*)"aaaaaaaaaaaaaaaaaaa", 20);
1086 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
1088 state
= MsiQueryFeatureStateA(prodcode
, "feature");
1089 ok(state
== INSTALLSTATE_BADCONFIG
, "Expected INSTALLSTATE_BADCONFIG, got %d\n", state
);
1091 res
= RegSetValueExA(localkey
, "feature", 0, REG_SZ
, (const BYTE
*)"aaaaaaaaaaaaaaaaaaaa", 21);
1092 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
1094 state
= MsiQueryFeatureStateA(prodcode
, "feature");
1095 ok(state
== INSTALLSTATE_ADVERTISED
, "Expected INSTALLSTATE_ADVERTISED, got %d\n", state
);
1097 res
= RegSetValueExA(localkey
, "feature", 0, REG_SZ
, (const BYTE
*)"aaaaaaaaaaaaaaaaaaaaa", 22);
1098 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
1100 state
= MsiQueryFeatureStateA(prodcode
, "feature");
1101 ok(state
== INSTALLSTATE_ADVERTISED
, "Expected INSTALLSTATE_ADVERTISED, got %d\n", state
);
1103 res
= RegSetValueExA(localkey
, "feature", 0, REG_SZ
, (const BYTE
*)comp_base85
, 21);
1104 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
1106 state
= MsiQueryFeatureStateA(prodcode
, "feature");
1107 ok(state
== INSTALLSTATE_ADVERTISED
, "Expected INSTALLSTATE_ADVERTISED, got %d\n", state
);
1109 lstrcpyA(keypath
, "Software\\Microsoft\\Windows\\CurrentVersion\\Installer\\UserData\\");
1110 lstrcatA(keypath
, "S-1-5-18\\Components\\");
1111 lstrcatA(keypath
, comp_squashed
);
1113 res
= RegCreateKeyA(HKEY_LOCAL_MACHINE
, keypath
, &compkey
);
1114 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
1116 state
= MsiQueryFeatureStateA(prodcode
, "feature");
1117 ok(state
== INSTALLSTATE_ADVERTISED
, "Expected INSTALLSTATE_ADVERTISED, got %d\n", state
);
1119 res
= RegSetValueExA(compkey
, prod_squashed
, 0, REG_SZ
, (const BYTE
*)"", 1);
1120 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
1122 state
= MsiQueryFeatureStateA(prodcode
, "feature");
1123 ok(state
== INSTALLSTATE_LOCAL
, "Expected INSTALLSTATE_LOCAL, got %d\n", state
);
1125 res
= RegSetValueExA(compkey
, prod_squashed
, 0, REG_SZ
, (const BYTE
*)"apple", 1);
1126 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
1128 state
= MsiQueryFeatureStateA(prodcode
, "feature");
1129 ok(state
== INSTALLSTATE_LOCAL
, "Expected INSTALLSTATE_LOCAL, got %d\n", state
);
1131 RegDeleteValueA(compkey
, prod_squashed
);
1132 RegDeleteKeyA(compkey
, "");
1133 RegDeleteValueA(localkey
, "feature");
1134 RegDeleteValueA(userkey
, "feature");
1135 RegDeleteKeyA(userkey
, "");
1136 RegCloseKey(compkey
);
1137 RegCloseKey(localkey
);
1138 RegCloseKey(userkey
);
1141 static void test_MsiQueryComponentState(void)
1143 HKEY compkey
, prodkey
;
1144 CHAR prodcode
[MAX_PATH
];
1145 CHAR prod_squashed
[MAX_PATH
];
1146 CHAR component
[MAX_PATH
];
1147 CHAR comp_base85
[MAX_PATH
];
1148 CHAR comp_squashed
[MAX_PATH
];
1149 CHAR keypath
[MAX_PATH
];
1155 static const INSTALLSTATE MAGIC_ERROR
= 0xdeadbeef;
1157 if (!pMsiQueryComponentStateA
)
1159 skip("MsiQueryComponentStateA not implemented\n");
1163 create_test_guid(prodcode
, prod_squashed
);
1164 compose_base85_guid(component
, comp_base85
, comp_squashed
);
1165 get_user_sid(&usersid
);
1167 /* NULL szProductCode */
1168 state
= MAGIC_ERROR
;
1169 r
= pMsiQueryComponentStateA(NULL
, NULL
, MSIINSTALLCONTEXT_MACHINE
, component
, &state
);
1170 ok(r
== ERROR_INVALID_PARAMETER
, "Expected ERROR_INVALID_PARAMETER, got %d\n", r
);
1171 ok(state
== MAGIC_ERROR
, "Expected 0xdeadbeef, got %d\n", state
);
1173 /* empty szProductCode */
1174 state
= MAGIC_ERROR
;
1175 r
= pMsiQueryComponentStateA("", NULL
, MSIINSTALLCONTEXT_MACHINE
, component
, &state
);
1176 ok(r
== ERROR_INVALID_PARAMETER
, "Expected ERROR_INVALID_PARAMETER, got %d\n", r
);
1177 ok(state
== MAGIC_ERROR
, "Expected 0xdeadbeef, got %d\n", state
);
1179 /* random szProductCode */
1180 state
= MAGIC_ERROR
;
1181 r
= pMsiQueryComponentStateA("random", NULL
, MSIINSTALLCONTEXT_MACHINE
, component
, &state
);
1182 ok(r
== ERROR_INVALID_PARAMETER
, "Expected ERROR_INVALID_PARAMETER, got %d\n", r
);
1183 ok(state
== MAGIC_ERROR
, "Expected 0xdeadbeef, got %d\n", state
);
1185 /* GUID-length szProductCode */
1186 state
= MAGIC_ERROR
;
1187 r
= pMsiQueryComponentStateA("DJANE93KNDNAS-2KN2NR93KMN3LN13=L1N3KDE", NULL
, MSIINSTALLCONTEXT_MACHINE
, component
, &state
);
1188 ok(r
== ERROR_INVALID_PARAMETER
, "Expected ERROR_INVALID_PARAMETER, got %d\n", r
);
1189 ok(state
== MAGIC_ERROR
, "Expected 0xdeadbeef, got %d\n", state
);
1191 /* GUID-length with brackets */
1192 state
= MAGIC_ERROR
;
1193 r
= pMsiQueryComponentStateA("{JANE93KNDNAS-2KN2NR93KMN3LN13=L1N3KD}", NULL
, MSIINSTALLCONTEXT_MACHINE
, component
, &state
);
1194 ok(r
== ERROR_INVALID_PARAMETER
, "Expected ERROR_INVALID_PARAMETER, got %d\n", r
);
1195 ok(state
== MAGIC_ERROR
, "Expected 0xdeadbeef, got %d\n", state
);
1198 state
= MAGIC_ERROR
;
1199 r
= pMsiQueryComponentStateA(prodcode
, NULL
, MSIINSTALLCONTEXT_MACHINE
, component
, &state
);
1200 ok(r
== ERROR_UNKNOWN_PRODUCT
, "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r
);
1201 ok(state
== MAGIC_ERROR
, "Expected 0xdeadbeef, got %d\n", state
);
1203 state
= MAGIC_ERROR
;
1204 r
= pMsiQueryComponentStateA(prodcode
, NULL
, MSIINSTALLCONTEXT_MACHINE
, component
, &state
);
1205 ok(r
== ERROR_UNKNOWN_PRODUCT
, "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r
);
1206 ok(state
== MAGIC_ERROR
, "Expected 0xdeadbeef, got %d\n", state
);
1208 lstrcpyA(keypath
, "Software\\Classes\\Installer\\Products\\");
1209 lstrcatA(keypath
, prod_squashed
);
1211 res
= RegCreateKeyA(HKEY_LOCAL_MACHINE
, keypath
, &prodkey
);
1212 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
1214 state
= MAGIC_ERROR
;
1215 r
= pMsiQueryComponentStateA(prodcode
, NULL
, MSIINSTALLCONTEXT_MACHINE
, component
, &state
);
1216 ok(r
== ERROR_UNKNOWN_COMPONENT
, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r
);
1217 ok(state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
1219 RegDeleteKeyA(prodkey
, "");
1220 RegCloseKey(prodkey
);
1222 /* create local system product key */
1223 lstrcpyA(keypath
, "Software\\Microsoft\\Windows\\CurrentVersion\\Installer\\UserData\\S-1-5-18\\Products\\");
1224 lstrcatA(keypath
, prod_squashed
);
1225 lstrcatA(keypath
, "\\InstallProperties");
1227 res
= RegCreateKeyA(HKEY_LOCAL_MACHINE
, keypath
, &prodkey
);
1228 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
1230 /* local system product key exists */
1231 state
= MAGIC_ERROR
;
1232 r
= pMsiQueryComponentStateA(prodcode
, NULL
, MSIINSTALLCONTEXT_MACHINE
, component
, &state
);
1233 ok(r
== ERROR_UNKNOWN_PRODUCT
, "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r
);
1234 ok(state
== MAGIC_ERROR
, "Expected 0xdeadbeef, got %d\n", state
);
1236 res
= RegSetValueExA(prodkey
, "LocalPackage", 0, REG_SZ
, (const BYTE
*)"msitest.msi", 11);
1237 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
1239 /* LocalPackage value exists */
1240 state
= MAGIC_ERROR
;
1241 r
= pMsiQueryComponentStateA(prodcode
, NULL
, MSIINSTALLCONTEXT_MACHINE
, component
, &state
);
1242 ok(r
== ERROR_UNKNOWN_COMPONENT
, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r
);
1243 ok(state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
1245 lstrcpyA(keypath
, "Software\\Microsoft\\Windows\\CurrentVersion\\Installer\\UserData\\S-1-5-18\\Components\\");
1246 lstrcatA(keypath
, comp_squashed
);
1248 res
= RegCreateKeyA(HKEY_LOCAL_MACHINE
, keypath
, &compkey
);
1249 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
1251 /* component key exists */
1252 state
= MAGIC_ERROR
;
1253 r
= pMsiQueryComponentStateA(prodcode
, NULL
, MSIINSTALLCONTEXT_MACHINE
, component
, &state
);
1254 ok(r
== ERROR_UNKNOWN_COMPONENT
, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r
);
1255 ok(state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
1257 res
= RegSetValueExA(compkey
, prod_squashed
, 0, REG_SZ
, (const BYTE
*)"", 0);
1258 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
1260 /* component\product exists */
1261 state
= MAGIC_ERROR
;
1262 r
= pMsiQueryComponentStateA(prodcode
, NULL
, MSIINSTALLCONTEXT_MACHINE
, component
, &state
);
1263 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
1264 ok(state
== INSTALLSTATE_NOTUSED
, "Expected INSTALLSTATE_NOTUSED, got %d\n", state
);
1266 res
= RegSetValueExA(compkey
, prod_squashed
, 0, REG_SZ
, (const BYTE
*)"hi", 2);
1267 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
1269 /* INSTALLSTATE_LOCAL */
1270 state
= MAGIC_ERROR
;
1271 r
= pMsiQueryComponentStateA(prodcode
, NULL
, MSIINSTALLCONTEXT_MACHINE
, component
, &state
);
1272 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
1273 ok(state
== INSTALLSTATE_LOCAL
, "Expected INSTALLSTATE_LOCAL, got %d\n", state
);
1275 res
= RegSetValueExA(compkey
, prod_squashed
, 0, REG_SZ
, (const BYTE
*)"01\\", 4);
1276 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
1278 /* INSTALLSTATE_SOURCE */
1279 state
= MAGIC_ERROR
;
1280 r
= pMsiQueryComponentStateA(prodcode
, NULL
, MSIINSTALLCONTEXT_MACHINE
, component
, &state
);
1281 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
1282 ok(state
== INSTALLSTATE_SOURCE
, "Expected INSTALLSTATE_SOURCE, got %d\n", state
);
1284 res
= RegSetValueExA(compkey
, prod_squashed
, 0, REG_SZ
, (const BYTE
*)"01", 3);
1285 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
1287 /* bad INSTALLSTATE_SOURCE */
1288 state
= MAGIC_ERROR
;
1289 r
= pMsiQueryComponentStateA(prodcode
, NULL
, MSIINSTALLCONTEXT_MACHINE
, component
, &state
);
1290 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
1291 ok(state
== INSTALLSTATE_LOCAL
, "Expected INSTALLSTATE_LOCAL, got %d\n", state
);
1293 res
= RegSetValueExA(compkey
, prod_squashed
, 0, REG_SZ
, (const BYTE
*)"01a", 4);
1294 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
1296 /* INSTALLSTATE_SOURCE */
1297 state
= MAGIC_ERROR
;
1298 r
= pMsiQueryComponentStateA(prodcode
, NULL
, MSIINSTALLCONTEXT_MACHINE
, component
, &state
);
1299 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
1300 ok(state
== INSTALLSTATE_SOURCE
, "Expected INSTALLSTATE_SOURCE, got %d\n", state
);
1302 res
= RegSetValueExA(compkey
, prod_squashed
, 0, REG_SZ
, (const BYTE
*)"01", 3);
1303 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
1305 /* bad INSTALLSTATE_SOURCE */
1306 state
= MAGIC_ERROR
;
1307 r
= pMsiQueryComponentStateA(prodcode
, NULL
, MSIINSTALLCONTEXT_MACHINE
, component
, &state
);
1308 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
1309 ok(state
== INSTALLSTATE_LOCAL
, "Expected INSTALLSTATE_LOCAL, got %d\n", state
);
1311 RegDeleteValueA(prodkey
, "LocalPackage");
1312 RegDeleteKeyA(prodkey
, "");
1313 RegDeleteValueA(compkey
, prod_squashed
);
1314 RegDeleteKeyA(prodkey
, "");
1315 RegCloseKey(prodkey
);
1316 RegCloseKey(compkey
);
1318 /* MSIINSTALLCONTEXT_USERUNMANAGED */
1320 state
= MAGIC_ERROR
;
1321 r
= pMsiQueryComponentStateA(prodcode
, NULL
, MSIINSTALLCONTEXT_USERUNMANAGED
, component
, &state
);
1322 ok(r
== ERROR_UNKNOWN_PRODUCT
, "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r
);
1323 ok(state
== MAGIC_ERROR
, "Expected 0xdeadbeef, got %d\n", state
);
1325 lstrcpyA(keypath
, "Software\\Microsoft\\Installer\\Products\\");
1326 lstrcatA(keypath
, prod_squashed
);
1328 res
= RegCreateKeyA(HKEY_CURRENT_USER
, keypath
, &prodkey
);
1329 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
1331 state
= MAGIC_ERROR
;
1332 r
= pMsiQueryComponentStateA(prodcode
, NULL
, MSIINSTALLCONTEXT_USERUNMANAGED
, component
, &state
);
1333 ok(r
== ERROR_UNKNOWN_COMPONENT
, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r
);
1334 ok(state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
1336 RegDeleteKeyA(prodkey
, "");
1337 RegCloseKey(prodkey
);
1339 lstrcpyA(keypath
, "Software\\Microsoft\\Windows\\CurrentVersion\\Installer\\UserData\\");
1340 lstrcatA(keypath
, usersid
);
1341 lstrcatA(keypath
, "\\Products\\");
1342 lstrcatA(keypath
, prod_squashed
);
1343 lstrcatA(keypath
, "\\InstallProperties");
1345 res
= RegCreateKeyA(HKEY_LOCAL_MACHINE
, keypath
, &prodkey
);
1346 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
1348 res
= RegSetValueExA(prodkey
, "LocalPackage", 0, REG_SZ
, (const BYTE
*)"msitest.msi", 11);
1349 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
1351 RegCloseKey(prodkey
);
1353 state
= MAGIC_ERROR
;
1354 r
= pMsiQueryComponentStateA(prodcode
, NULL
, MSIINSTALLCONTEXT_USERUNMANAGED
, component
, &state
);
1355 ok(r
== ERROR_UNKNOWN_COMPONENT
, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r
);
1356 ok(state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
1358 lstrcpyA(keypath
, "Software\\Microsoft\\Windows\\CurrentVersion\\Installer\\UserData\\");
1359 lstrcatA(keypath
, usersid
);
1360 lstrcatA(keypath
, "\\Components\\");
1361 lstrcatA(keypath
, comp_squashed
);
1363 res
= RegCreateKeyA(HKEY_LOCAL_MACHINE
, keypath
, &compkey
);
1364 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
1366 /* component key exists */
1367 state
= MAGIC_ERROR
;
1368 r
= pMsiQueryComponentStateA(prodcode
, NULL
, MSIINSTALLCONTEXT_USERUNMANAGED
, component
, &state
);
1369 ok(r
== ERROR_UNKNOWN_COMPONENT
, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r
);
1370 ok(state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
1372 res
= RegSetValueExA(compkey
, prod_squashed
, 0, REG_SZ
, (const BYTE
*)"", 0);
1373 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
1375 /* component\product exists */
1376 state
= MAGIC_ERROR
;
1377 r
= pMsiQueryComponentStateA(prodcode
, NULL
, MSIINSTALLCONTEXT_USERUNMANAGED
, component
, &state
);
1378 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
1379 ok(state
== INSTALLSTATE_NOTUSED
, "Expected INSTALLSTATE_NOTUSED, got %d\n", state
);
1381 res
= RegSetValueExA(compkey
, prod_squashed
, 0, REG_SZ
, (const BYTE
*)"hi", 2);
1382 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
1384 state
= MAGIC_ERROR
;
1385 r
= pMsiQueryComponentStateA(prodcode
, NULL
, MSIINSTALLCONTEXT_USERUNMANAGED
, component
, &state
);
1386 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
1387 ok(state
== INSTALLSTATE_LOCAL
, "Expected INSTALLSTATE_LOCAL, got %d\n", state
);
1389 /* MSIINSTALLCONTEXT_USERMANAGED */
1391 state
= MAGIC_ERROR
;
1392 r
= pMsiQueryComponentStateA(prodcode
, NULL
, MSIINSTALLCONTEXT_USERMANAGED
, component
, &state
);
1393 ok(r
== ERROR_UNKNOWN_PRODUCT
, "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r
);
1394 ok(state
== MAGIC_ERROR
, "Expected 0xdeadbeef, got %d\n", state
);
1396 lstrcpyA(keypath
, "Software\\Microsoft\\Installer\\Products\\");
1397 lstrcatA(keypath
, prod_squashed
);
1399 res
= RegCreateKeyA(HKEY_CURRENT_USER
, keypath
, &prodkey
);
1400 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
1402 state
= MAGIC_ERROR
;
1403 r
= pMsiQueryComponentStateA(prodcode
, NULL
, MSIINSTALLCONTEXT_USERMANAGED
, component
, &state
);
1404 ok(r
== ERROR_UNKNOWN_PRODUCT
, "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r
);
1405 ok(state
== MAGIC_ERROR
, "Expected 0xdeadbeef, got %d\n", state
);
1407 RegDeleteKeyA(prodkey
, "");
1408 RegCloseKey(prodkey
);
1410 lstrcpyA(keypath
, "Software\\Microsoft\\Windows\\CurrentVersion\\Installer\\Managed\\");
1411 lstrcatA(keypath
, usersid
);
1412 lstrcatA(keypath
, "\\Installer\\Products\\");
1413 lstrcatA(keypath
, prod_squashed
);
1415 res
= RegCreateKeyA(HKEY_LOCAL_MACHINE
, keypath
, &prodkey
);
1416 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
1418 state
= MAGIC_ERROR
;
1419 r
= pMsiQueryComponentStateA(prodcode
, NULL
, MSIINSTALLCONTEXT_USERMANAGED
, component
, &state
);
1420 ok(r
== ERROR_UNKNOWN_COMPONENT
, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r
);
1421 ok(state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
1423 RegDeleteKeyA(prodkey
, "");
1424 RegCloseKey(prodkey
);
1426 lstrcpyA(keypath
, "Software\\Microsoft\\Windows\\CurrentVersion\\Installer\\UserData\\");
1427 lstrcatA(keypath
, usersid
);
1428 lstrcatA(keypath
, "\\Products\\");
1429 lstrcatA(keypath
, prod_squashed
);
1430 lstrcatA(keypath
, "\\InstallProperties");
1432 res
= RegOpenKeyA(HKEY_LOCAL_MACHINE
, keypath
, &prodkey
);
1433 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
1435 res
= RegSetValueExA(prodkey
, "ManagedLocalPackage", 0, REG_SZ
, (const BYTE
*)"msitest.msi", 11);
1436 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
1438 state
= MAGIC_ERROR
;
1439 r
= pMsiQueryComponentStateA(prodcode
, NULL
, MSIINSTALLCONTEXT_USERMANAGED
, component
, &state
);
1440 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
1441 ok(state
== INSTALLSTATE_LOCAL
, "Expected INSTALLSTATE_LOCAL, got %d\n", state
);
1443 RegDeleteValueA(prodkey
, "LocalPackage");
1444 RegDeleteValueA(prodkey
, "ManagedLocalPackage");
1445 RegDeleteKeyA(prodkey
, "");
1446 RegDeleteValueA(compkey
, prod_squashed
);
1447 RegDeleteKeyA(compkey
, "");
1448 RegCloseKey(prodkey
);
1449 RegCloseKey(compkey
);
1452 static void test_MsiGetComponentPath(void)
1454 HKEY compkey
, prodkey
, installprop
;
1455 CHAR prodcode
[MAX_PATH
];
1456 CHAR prod_squashed
[MAX_PATH
];
1457 CHAR component
[MAX_PATH
];
1458 CHAR comp_base85
[MAX_PATH
];
1459 CHAR comp_squashed
[MAX_PATH
];
1460 CHAR keypath
[MAX_PATH
];
1461 CHAR path
[MAX_PATH
];
1467 create_test_guid(prodcode
, prod_squashed
);
1468 compose_base85_guid(component
, comp_base85
, comp_squashed
);
1469 get_user_sid(&usersid
);
1471 /* NULL szProduct */
1473 state
= MsiGetComponentPathA(NULL
, component
, path
, &size
);
1474 ok(state
== INSTALLSTATE_INVALIDARG
, "Expected INSTALLSTATE_INVALIDARG, got %d\n", state
);
1475 ok(size
== MAX_PATH
, "Expected size to be unchanged, got %d\n", size
);
1477 /* NULL szComponent */
1479 state
= MsiGetComponentPathA(prodcode
, NULL
, path
, &size
);
1480 ok(state
== INSTALLSTATE_INVALIDARG
, "Expected INSTALLSTATE_INVALIDARG, got %d\n", state
);
1481 ok(size
== MAX_PATH
, "Expected size to be unchanged, got %d\n", size
);
1483 /* NULL lpPathBuf */
1485 state
= MsiGetComponentPathA(prodcode
, component
, NULL
, &size
);
1486 ok(state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
1487 ok(size
== MAX_PATH
, "Expected size to be unchanged, got %d\n", size
);
1491 state
= MsiGetComponentPathA(prodcode
, component
, path
, NULL
);
1492 ok(state
== INSTALLSTATE_INVALIDARG
, "Expected INSTALLSTATE_INVALIDARG, got %d\n", state
);
1493 ok(size
== MAX_PATH
, "Expected size to be unchanged, got %d\n", size
);
1495 /* all params valid */
1497 state
= MsiGetComponentPathA(prodcode
, component
, path
, &size
);
1498 ok(state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
1499 ok(size
== MAX_PATH
, "Expected size to be unchanged, got %d\n", size
);
1501 lstrcpyA(keypath
, "Software\\Microsoft\\Windows\\CurrentVersion\\");
1502 lstrcatA(keypath
, "Installer\\UserData\\S-1-5-18\\Components\\");
1503 lstrcatA(keypath
, comp_squashed
);
1505 res
= RegCreateKeyA(HKEY_LOCAL_MACHINE
, keypath
, &compkey
);
1506 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
1508 /* local system component key exists */
1510 state
= MsiGetComponentPathA(prodcode
, component
, path
, &size
);
1511 ok(state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
1512 ok(size
== MAX_PATH
, "Expected size to be unchanged, got %d\n", size
);
1514 res
= RegSetValueExA(compkey
, prod_squashed
, 0, REG_SZ
, (const BYTE
*)"C:\\imapath", 10);
1515 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
1517 /* product value exists */
1519 state
= MsiGetComponentPathA(prodcode
, component
, path
, &size
);
1520 ok(state
== INSTALLSTATE_ABSENT
, "Expected INSTALLSTATE_ABSENT, got %d\n", state
);
1521 ok(!lstrcmpA(path
, "C:\\imapath"), "Expected C:\\imapath, got %s\n", path
);
1522 ok(size
== 10, "Expected 10, got %d\n", size
);
1524 lstrcpyA(keypath
, "Software\\Microsoft\\Windows\\CurrentVersion\\");
1525 lstrcatA(keypath
, "Installer\\UserData\\S-1-5-18\\Products\\");
1526 lstrcatA(keypath
, prod_squashed
);
1527 lstrcatA(keypath
, "\\InstallProperties");
1529 res
= RegCreateKeyA(HKEY_LOCAL_MACHINE
, keypath
, &installprop
);
1530 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
1533 res
= RegSetValueExA(installprop
, "WindowsInstaller", 0, REG_DWORD
, (const BYTE
*)&val
, sizeof(DWORD
));
1534 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
1536 /* install properties key exists */
1538 state
= MsiGetComponentPathA(prodcode
, component
, path
, &size
);
1539 ok(state
== INSTALLSTATE_ABSENT
, "Expected INSTALLSTATE_ABSENT, got %d\n", state
);
1540 ok(!lstrcmpA(path
, "C:\\imapath"), "Expected C:\\imapath, got %s\n", path
);
1541 ok(size
== 10, "Expected 10, got %d\n", size
);
1543 create_file("C:\\imapath", "C:\\imapath", 11);
1547 state
= MsiGetComponentPathA(prodcode
, component
, path
, &size
);
1548 ok(state
== INSTALLSTATE_LOCAL
, "Expected INSTALLSTATE_LOCAL, got %d\n", state
);
1549 ok(!lstrcmpA(path
, "C:\\imapath"), "Expected C:\\imapath, got %s\n", path
);
1550 ok(size
== 10, "Expected 10, got %d\n", size
);
1552 RegDeleteValueA(compkey
, prod_squashed
);
1553 RegDeleteKeyA(compkey
, "");
1554 RegDeleteValueA(installprop
, "WindowsInstaller");
1555 RegDeleteKeyA(installprop
, "");
1556 RegCloseKey(compkey
);
1557 RegCloseKey(installprop
);
1558 DeleteFileA("C:\\imapath");
1560 lstrcpyA(keypath
, "Software\\Microsoft\\Windows\\CurrentVersion\\");
1561 lstrcatA(keypath
, "Installer\\UserData\\");
1562 lstrcatA(keypath
, usersid
);
1563 lstrcatA(keypath
, "\\Components\\");
1564 lstrcatA(keypath
, comp_squashed
);
1566 res
= RegCreateKeyA(HKEY_LOCAL_MACHINE
, keypath
, &compkey
);
1567 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
1569 /* user managed component key exists */
1571 state
= MsiGetComponentPathA(prodcode
, component
, path
, &size
);
1572 ok(state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
1573 ok(size
== MAX_PATH
, "Expected size to be unchanged, got %d\n", size
);
1575 res
= RegSetValueExA(compkey
, prod_squashed
, 0, REG_SZ
, (const BYTE
*)"C:\\imapath", 10);
1576 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
1578 /* product value exists */
1580 state
= MsiGetComponentPathA(prodcode
, component
, path
, &size
);
1581 ok(state
== INSTALLSTATE_ABSENT
, "Expected INSTALLSTATE_ABSENT, got %d\n", state
);
1582 ok(!lstrcmpA(path
, "C:\\imapath"), "Expected C:\\imapath, got %s\n", path
);
1583 ok(size
== 10, "Expected 10, got %d\n", size
);
1585 lstrcpyA(keypath
, "Software\\Microsoft\\Windows\\CurrentVersion\\");
1586 lstrcatA(keypath
, "Installer\\UserData\\S-1-5-18\\Products\\");
1587 lstrcatA(keypath
, prod_squashed
);
1588 lstrcatA(keypath
, "\\InstallProperties");
1590 res
= RegCreateKeyA(HKEY_LOCAL_MACHINE
, keypath
, &installprop
);
1591 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
1594 res
= RegSetValueExA(installprop
, "WindowsInstaller", 0, REG_DWORD
, (const BYTE
*)&val
, sizeof(DWORD
));
1595 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
1597 /* install properties key exists */
1599 state
= MsiGetComponentPathA(prodcode
, component
, path
, &size
);
1600 ok(state
== INSTALLSTATE_ABSENT
, "Expected INSTALLSTATE_ABSENT, got %d\n", state
);
1601 ok(!lstrcmpA(path
, "C:\\imapath"), "Expected C:\\imapath, got %s\n", path
);
1602 ok(size
== 10, "Expected 10, got %d\n", size
);
1604 create_file("C:\\imapath", "C:\\imapath", 11);
1608 state
= MsiGetComponentPathA(prodcode
, component
, path
, &size
);
1609 ok(state
== INSTALLSTATE_LOCAL
, "Expected INSTALLSTATE_LOCAL, 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 RegDeleteValueA(compkey
, prod_squashed
);
1614 RegDeleteKeyA(compkey
, "");
1615 RegDeleteValueA(installprop
, "WindowsInstaller");
1616 RegDeleteKeyA(installprop
, "");
1617 RegCloseKey(compkey
);
1618 RegCloseKey(installprop
);
1619 DeleteFileA("C:\\imapath");
1621 lstrcpyA(keypath
, "Software\\Microsoft\\Windows\\CurrentVersion\\");
1622 lstrcatA(keypath
, "Installer\\Managed\\");
1623 lstrcatA(keypath
, usersid
);
1624 lstrcatA(keypath
, "\\Installer\\Products\\");
1625 lstrcatA(keypath
, prod_squashed
);
1627 res
= RegCreateKeyA(HKEY_LOCAL_MACHINE
, keypath
, &prodkey
);
1628 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
1630 /* user managed product key exists */
1632 state
= MsiGetComponentPathA(prodcode
, component
, path
, &size
);
1633 ok(state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
1634 ok(size
== MAX_PATH
, "Expected size to be unchanged, got %d\n", size
);
1636 lstrcpyA(keypath
, "Software\\Microsoft\\Windows\\CurrentVersion\\");
1637 lstrcatA(keypath
, "Installer\\UserData\\");
1638 lstrcatA(keypath
, usersid
);
1639 lstrcatA(keypath
, "\\Components\\");
1640 lstrcatA(keypath
, comp_squashed
);
1642 res
= RegCreateKeyA(HKEY_LOCAL_MACHINE
, keypath
, &compkey
);
1643 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
1645 /* user managed component key exists */
1647 state
= MsiGetComponentPathA(prodcode
, component
, path
, &size
);
1648 ok(state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
1649 ok(size
== MAX_PATH
, "Expected size to be unchanged, got %d\n", size
);
1651 res
= RegSetValueExA(compkey
, prod_squashed
, 0, REG_SZ
, (const BYTE
*)"C:\\imapath", 10);
1652 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
1654 /* product value exists */
1656 state
= MsiGetComponentPathA(prodcode
, component
, path
, &size
);
1657 ok(state
== INSTALLSTATE_ABSENT
, "Expected INSTALLSTATE_ABSENT, got %d\n", state
);
1658 ok(!lstrcmpA(path
, "C:\\imapath"), "Expected C:\\imapath, got %s\n", path
);
1659 ok(size
== 10, "Expected 10, got %d\n", size
);
1661 lstrcpyA(keypath
, "Software\\Microsoft\\Windows\\CurrentVersion\\");
1662 lstrcatA(keypath
, "Installer\\UserData\\S-1-5-18\\Products\\");
1663 lstrcatA(keypath
, prod_squashed
);
1664 lstrcatA(keypath
, "\\InstallProperties");
1666 res
= RegCreateKeyA(HKEY_LOCAL_MACHINE
, keypath
, &installprop
);
1667 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
1670 res
= RegSetValueExA(installprop
, "WindowsInstaller", 0, REG_DWORD
, (const BYTE
*)&val
, sizeof(DWORD
));
1671 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
1673 /* install properties key exists */
1675 state
= MsiGetComponentPathA(prodcode
, component
, path
, &size
);
1676 ok(state
== INSTALLSTATE_ABSENT
, "Expected INSTALLSTATE_ABSENT, got %d\n", state
);
1677 ok(!lstrcmpA(path
, "C:\\imapath"), "Expected C:\\imapath, got %s\n", path
);
1678 ok(size
== 10, "Expected 10, got %d\n", size
);
1680 create_file("C:\\imapath", "C:\\imapath", 11);
1684 state
= MsiGetComponentPathA(prodcode
, component
, path
, &size
);
1685 ok(state
== INSTALLSTATE_LOCAL
, "Expected INSTALLSTATE_LOCAL, got %d\n", state
);
1686 ok(!lstrcmpA(path
, "C:\\imapath"), "Expected C:\\imapath, got %s\n", path
);
1687 ok(size
== 10, "Expected 10, got %d\n", size
);
1689 RegDeleteValueA(compkey
, prod_squashed
);
1690 RegDeleteKeyA(prodkey
, "");
1691 RegDeleteKeyA(compkey
, "");
1692 RegDeleteValueA(installprop
, "WindowsInstaller");
1693 RegDeleteKeyA(installprop
, "");
1694 RegCloseKey(prodkey
);
1695 RegCloseKey(compkey
);
1696 RegCloseKey(installprop
);
1697 DeleteFileA("C:\\imapath");
1699 lstrcpyA(keypath
, "Software\\Microsoft\\Installer\\Products\\");
1700 lstrcatA(keypath
, prod_squashed
);
1702 res
= RegCreateKeyA(HKEY_CURRENT_USER
, keypath
, &prodkey
);
1703 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
1705 /* user unmanaged product key exists */
1707 state
= MsiGetComponentPathA(prodcode
, component
, path
, &size
);
1708 ok(state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
1709 ok(size
== MAX_PATH
, "Expected size to be unchanged, got %d\n", size
);
1711 lstrcpyA(keypath
, "Software\\Microsoft\\Windows\\CurrentVersion\\");
1712 lstrcatA(keypath
, "Installer\\UserData\\");
1713 lstrcatA(keypath
, usersid
);
1714 lstrcatA(keypath
, "\\Components\\");
1715 lstrcatA(keypath
, comp_squashed
);
1717 res
= RegCreateKeyA(HKEY_LOCAL_MACHINE
, keypath
, &compkey
);
1718 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
1720 /* user unmanaged component key exists */
1722 state
= MsiGetComponentPathA(prodcode
, component
, path
, &size
);
1723 ok(state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
1724 ok(size
== MAX_PATH
, "Expected size to be unchanged, got %d\n", size
);
1726 res
= RegSetValueExA(compkey
, prod_squashed
, 0, REG_SZ
, (const BYTE
*)"C:\\imapath", 10);
1727 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
1729 /* product value exists */
1731 state
= MsiGetComponentPathA(prodcode
, component
, path
, &size
);
1732 ok(state
== INSTALLSTATE_ABSENT
, "Expected INSTALLSTATE_ABSENT, got %d\n", state
);
1733 ok(!lstrcmpA(path
, "C:\\imapath"), "Expected C:\\imapath, got %s\n", path
);
1734 ok(size
== 10, "Expected 10, got %d\n", size
);
1736 create_file("C:\\imapath", "C:\\imapath", 11);
1740 state
= MsiGetComponentPathA(prodcode
, component
, path
, &size
);
1741 ok(state
== INSTALLSTATE_LOCAL
, "Expected INSTALLSTATE_LOCAL, got %d\n", state
);
1742 ok(!lstrcmpA(path
, "C:\\imapath"), "Expected C:\\imapath, got %s\n", path
);
1743 ok(size
== 10, "Expected 10, got %d\n", size
);
1745 RegDeleteValueA(compkey
, prod_squashed
);
1746 RegDeleteKeyA(prodkey
, "");
1747 RegDeleteKeyA(compkey
, "");
1748 RegCloseKey(prodkey
);
1749 RegCloseKey(compkey
);
1750 RegCloseKey(installprop
);
1751 DeleteFileA("C:\\imapath");
1753 lstrcpyA(keypath
, "Software\\Classes\\Installer\\Products\\");
1754 lstrcatA(keypath
, prod_squashed
);
1756 res
= RegCreateKeyA(HKEY_LOCAL_MACHINE
, keypath
, &prodkey
);
1757 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
1759 /* local classes product key exists */
1761 state
= MsiGetComponentPathA(prodcode
, component
, path
, &size
);
1762 ok(state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
1763 ok(size
== MAX_PATH
, "Expected size to be unchanged, got %d\n", size
);
1765 lstrcpyA(keypath
, "Software\\Microsoft\\Windows\\CurrentVersion\\");
1766 lstrcatA(keypath
, "Installer\\UserData\\S-1-5-18\\Components\\");
1767 lstrcatA(keypath
, comp_squashed
);
1769 res
= RegCreateKeyA(HKEY_LOCAL_MACHINE
, keypath
, &compkey
);
1770 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
1772 /* local user component key exists */
1774 state
= MsiGetComponentPathA(prodcode
, component
, path
, &size
);
1775 ok(state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
1776 ok(size
== MAX_PATH
, "Expected size to be unchanged, got %d\n", size
);
1778 res
= RegSetValueExA(compkey
, prod_squashed
, 0, REG_SZ
, (const BYTE
*)"C:\\imapath", 10);
1779 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
1781 /* product value exists */
1783 state
= MsiGetComponentPathA(prodcode
, component
, path
, &size
);
1784 ok(state
== INSTALLSTATE_ABSENT
, "Expected INSTALLSTATE_ABSENT, got %d\n", state
);
1785 ok(!lstrcmpA(path
, "C:\\imapath"), "Expected C:\\imapath, got %s\n", path
);
1786 ok(size
== 10, "Expected 10, got %d\n", size
);
1788 create_file("C:\\imapath", "C:\\imapath", 11);
1792 state
= MsiGetComponentPathA(prodcode
, component
, path
, &size
);
1793 ok(state
== INSTALLSTATE_LOCAL
, "Expected INSTALLSTATE_LOCAL, got %d\n", state
);
1794 ok(!lstrcmpA(path
, "C:\\imapath"), "Expected C:\\imapath, got %s\n", path
);
1795 ok(size
== 10, "Expected 10, got %d\n", size
);
1797 RegDeleteValueA(compkey
, prod_squashed
);
1798 RegDeleteKeyA(prodkey
, "");
1799 RegDeleteKeyA(compkey
, "");
1800 RegCloseKey(prodkey
);
1801 RegCloseKey(compkey
);
1802 DeleteFileA("C:\\imapath");
1805 static void test_MsiGetProductCode(void)
1807 HKEY compkey
, prodkey
;
1808 CHAR prodcode
[MAX_PATH
];
1809 CHAR prod_squashed
[MAX_PATH
];
1810 CHAR prodcode2
[MAX_PATH
];
1811 CHAR prod2_squashed
[MAX_PATH
];
1812 CHAR component
[MAX_PATH
];
1813 CHAR comp_base85
[MAX_PATH
];
1814 CHAR comp_squashed
[MAX_PATH
];
1815 CHAR keypath
[MAX_PATH
];
1816 CHAR product
[MAX_PATH
];
1821 create_test_guid(prodcode
, prod_squashed
);
1822 create_test_guid(prodcode2
, prod2_squashed
);
1823 compose_base85_guid(component
, comp_base85
, comp_squashed
);
1824 get_user_sid(&usersid
);
1826 /* szComponent is NULL */
1827 lstrcpyA(product
, "prod");
1828 r
= MsiGetProductCodeA(NULL
, product
);
1829 ok(r
== ERROR_INVALID_PARAMETER
, "Expected ERROR_INVALID_PARAMETER, got %d\n", r
);
1830 ok(!lstrcmpA(product
, "prod"), "Expected product to be unchanged, got %s\n", product
);
1832 /* szComponent is empty */
1833 lstrcpyA(product
, "prod");
1834 r
= MsiGetProductCodeA("", product
);
1835 ok(r
== ERROR_INVALID_PARAMETER
, "Expected ERROR_INVALID_PARAMETER, got %d\n", r
);
1836 ok(!lstrcmpA(product
, "prod"), "Expected product to be unchanged, got %s\n", product
);
1838 /* garbage szComponent */
1839 lstrcpyA(product
, "prod");
1840 r
= MsiGetProductCodeA("garbage", product
);
1841 ok(r
== ERROR_INVALID_PARAMETER
, "Expected ERROR_INVALID_PARAMETER, got %d\n", r
);
1842 ok(!lstrcmpA(product
, "prod"), "Expected product to be unchanged, got %s\n", product
);
1844 /* guid without brackets */
1845 lstrcpyA(product
, "prod");
1846 r
= MsiGetProductCodeA("6700E8CF-95AB-4D9C-BC2C-15840DEA7A5D", product
);
1847 ok(r
== ERROR_INVALID_PARAMETER
, "Expected ERROR_INVALID_PARAMETER, got %d\n", r
);
1848 ok(!lstrcmpA(product
, "prod"), "Expected product to be unchanged, got %s\n", product
);
1850 /* guid with brackets */
1851 lstrcpyA(product
, "prod");
1852 r
= MsiGetProductCodeA("{6700E8CF-95AB-4D9C-BC2C-15840DEA7A5D}", product
);
1853 ok(r
== ERROR_UNKNOWN_COMPONENT
, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r
);
1854 ok(!lstrcmpA(product
, "prod"), "Expected product to be unchanged, got %s\n", product
);
1856 /* same length as guid, but random */
1857 lstrcpyA(product
, "prod");
1858 r
= MsiGetProductCodeA("A938G02JF-2NF3N93-VN3-2NNF-3KGKALDNF93", product
);
1859 ok(r
== ERROR_INVALID_PARAMETER
, "Expected ERROR_INVALID_PARAMETER, got %d\n", r
);
1860 ok(!lstrcmpA(product
, "prod"), "Expected product to be unchanged, got %s\n", product
);
1862 /* all params correct, szComponent not published */
1863 lstrcpyA(product
, "prod");
1864 r
= MsiGetProductCodeA(component
, product
);
1865 ok(r
== ERROR_UNKNOWN_COMPONENT
, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r
);
1866 ok(!lstrcmpA(product
, "prod"), "Expected product to be unchanged, got %s\n", product
);
1868 lstrcpyA(keypath
, "Software\\Microsoft\\Windows\\CurrentVersion\\");
1869 lstrcatA(keypath
, "Installer\\UserData\\");
1870 lstrcatA(keypath
, usersid
);
1871 lstrcatA(keypath
, "\\Components\\");
1872 lstrcatA(keypath
, comp_squashed
);
1874 res
= RegCreateKeyA(HKEY_LOCAL_MACHINE
, keypath
, &compkey
);
1875 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
1877 /* user unmanaged component key exists */
1878 lstrcpyA(product
, "prod");
1879 r
= MsiGetProductCodeA(component
, product
);
1880 ok(r
== ERROR_UNKNOWN_COMPONENT
, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r
);
1881 ok(!lstrcmpA(product
, "prod"), "Expected product to be unchanged, got %s\n", product
);
1883 res
= RegSetValueExA(compkey
, prod_squashed
, 0, REG_SZ
, (const BYTE
*)"C:\\imapath", 10);
1884 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
1886 /* product value exists */
1887 lstrcpyA(product
, "prod");
1888 r
= MsiGetProductCodeA(component
, product
);
1889 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
1890 ok(!lstrcmpA(product
, prodcode
), "Expected %s, got %s\n", prodcode
, product
);
1892 res
= RegSetValueExA(compkey
, prod2_squashed
, 0, REG_SZ
, (const BYTE
*)"C:\\another", 10);
1893 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
1895 lstrcpyA(keypath
, "Software\\Microsoft\\Windows\\CurrentVersion\\");
1896 lstrcatA(keypath
, "Installer\\Managed\\");
1897 lstrcatA(keypath
, usersid
);
1898 lstrcatA(keypath
, "\\Installer\\Products\\");
1899 lstrcatA(keypath
, prod_squashed
);
1901 res
= RegCreateKeyA(HKEY_LOCAL_MACHINE
, keypath
, &prodkey
);
1902 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
1904 /* user managed product key of first product exists */
1905 lstrcpyA(product
, "prod");
1906 r
= MsiGetProductCodeA(component
, product
);
1907 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
1908 ok(!lstrcmpA(product
, prodcode
), "Expected %s, got %s\n", prodcode
, product
);
1910 RegDeleteKeyA(prodkey
, "");
1911 RegCloseKey(prodkey
);
1913 RegDeleteKeyA(prodkey
, "");
1914 RegCloseKey(prodkey
);
1916 lstrcpyA(keypath
, "Software\\Microsoft\\Installer\\Products\\");
1917 lstrcatA(keypath
, prod_squashed
);
1919 res
= RegCreateKeyA(HKEY_CURRENT_USER
, keypath
, &prodkey
);
1920 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
1922 /* user unmanaged product key exists */
1923 lstrcpyA(product
, "prod");
1924 r
= MsiGetProductCodeA(component
, product
);
1925 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
1926 ok(!lstrcmpA(product
, prodcode
), "Expected %s, got %s\n", prodcode
, product
);
1928 RegDeleteKeyA(prodkey
, "");
1929 RegCloseKey(prodkey
);
1931 lstrcpyA(keypath
, "Software\\Classes\\Installer\\Products\\");
1932 lstrcatA(keypath
, prod_squashed
);
1934 res
= RegCreateKeyA(HKEY_LOCAL_MACHINE
, keypath
, &prodkey
);
1935 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
1937 /* local classes product key exists */
1938 lstrcpyA(product
, "prod");
1939 r
= MsiGetProductCodeA(component
, product
);
1940 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
1941 ok(!lstrcmpA(product
, prodcode
), "Expected %s, got %s\n", prodcode
, product
);
1943 RegDeleteKeyA(prodkey
, "");
1944 RegCloseKey(prodkey
);
1946 lstrcpyA(keypath
, "Software\\Microsoft\\Windows\\CurrentVersion\\");
1947 lstrcatA(keypath
, "Installer\\Managed\\");
1948 lstrcatA(keypath
, usersid
);
1949 lstrcatA(keypath
, "\\Installer\\Products\\");
1950 lstrcatA(keypath
, prod2_squashed
);
1952 res
= RegCreateKeyA(HKEY_LOCAL_MACHINE
, keypath
, &prodkey
);
1953 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
1955 /* user managed product key of second product exists */
1956 lstrcpyA(product
, "prod");
1957 r
= MsiGetProductCodeA(component
, product
);
1958 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
1959 ok(!lstrcmpA(product
, prodcode2
), "Expected %s, got %s\n", prodcode2
, product
);
1961 RegDeleteKeyA(prodkey
, "");
1962 RegCloseKey(prodkey
);
1963 RegDeleteValueA(compkey
, prod_squashed
);
1964 RegDeleteValueA(compkey
, prod2_squashed
);
1965 RegDeleteKeyA(compkey
, "");
1966 RegCloseKey(compkey
);
1968 lstrcpyA(keypath
, "Software\\Microsoft\\Windows\\CurrentVersion\\");
1969 lstrcatA(keypath
, "Installer\\UserData\\S-1-5-18\\Components\\");
1970 lstrcatA(keypath
, comp_squashed
);
1972 res
= RegCreateKeyA(HKEY_LOCAL_MACHINE
, keypath
, &compkey
);
1973 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
1975 /* local user component key exists */
1976 lstrcpyA(product
, "prod");
1977 r
= MsiGetProductCodeA(component
, product
);
1978 ok(r
== ERROR_UNKNOWN_COMPONENT
, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r
);
1979 ok(!lstrcmpA(product
, "prod"), "Expected product to be unchanged, got %s\n", product
);
1981 res
= RegSetValueExA(compkey
, prod_squashed
, 0, REG_SZ
, (const BYTE
*)"C:\\imapath", 10);
1982 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
1984 /* product value exists */
1985 lstrcpyA(product
, "prod");
1986 r
= MsiGetProductCodeA(component
, product
);
1987 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
1988 ok(!lstrcmpA(product
, prodcode
), "Expected %s, got %s\n", prodcode
, product
);
1990 res
= RegSetValueExA(compkey
, prod2_squashed
, 0, REG_SZ
, (const BYTE
*)"C:\\another", 10);
1991 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
1993 lstrcpyA(keypath
, "Software\\Microsoft\\Windows\\CurrentVersion\\");
1994 lstrcatA(keypath
, "Installer\\Managed\\");
1995 lstrcatA(keypath
, usersid
);
1996 lstrcatA(keypath
, "\\Installer\\Products\\");
1997 lstrcatA(keypath
, prod_squashed
);
1999 res
= RegCreateKeyA(HKEY_LOCAL_MACHINE
, keypath
, &prodkey
);
2000 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
2002 /* user managed product key of first product exists */
2003 lstrcpyA(product
, "prod");
2004 r
= MsiGetProductCodeA(component
, product
);
2005 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
2006 ok(!lstrcmpA(product
, prodcode
), "Expected %s, got %s\n", prodcode
, product
);
2008 RegDeleteKeyA(prodkey
, "");
2009 RegCloseKey(prodkey
);
2011 lstrcpyA(keypath
, "Software\\Microsoft\\Installer\\Products\\");
2012 lstrcatA(keypath
, prod_squashed
);
2014 res
= RegCreateKeyA(HKEY_CURRENT_USER
, keypath
, &prodkey
);
2015 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
2017 /* user unmanaged product key exists */
2018 lstrcpyA(product
, "prod");
2019 r
= MsiGetProductCodeA(component
, product
);
2020 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
2021 ok(!lstrcmpA(product
, prodcode
), "Expected %s, got %s\n", prodcode
, product
);
2023 RegDeleteKeyA(prodkey
, "");
2024 RegCloseKey(prodkey
);
2026 lstrcpyA(keypath
, "Software\\Classes\\Installer\\Products\\");
2027 lstrcatA(keypath
, prod_squashed
);
2029 res
= RegCreateKeyA(HKEY_LOCAL_MACHINE
, keypath
, &prodkey
);
2030 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
2032 /* local classes product key exists */
2033 lstrcpyA(product
, "prod");
2034 r
= MsiGetProductCodeA(component
, product
);
2035 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
2036 ok(!lstrcmpA(product
, prodcode
), "Expected %s, got %s\n", prodcode
, product
);
2038 RegDeleteKeyA(prodkey
, "");
2039 RegCloseKey(prodkey
);
2041 lstrcpyA(keypath
, "Software\\Microsoft\\Windows\\CurrentVersion\\");
2042 lstrcatA(keypath
, "Installer\\Managed\\");
2043 lstrcatA(keypath
, usersid
);
2044 lstrcatA(keypath
, "\\Installer\\Products\\");
2045 lstrcatA(keypath
, prod2_squashed
);
2047 res
= RegCreateKeyA(HKEY_LOCAL_MACHINE
, keypath
, &prodkey
);
2048 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
2050 /* user managed product key of second product exists */
2051 lstrcpyA(product
, "prod");
2052 r
= MsiGetProductCodeA(component
, product
);
2053 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
2054 ok(!lstrcmpA(product
, prodcode2
), "Expected %s, got %s\n", prodcode2
, product
);
2056 RegDeleteKeyA(prodkey
, "");
2057 RegCloseKey(prodkey
);
2058 RegDeleteValueA(compkey
, prod_squashed
);
2059 RegDeleteValueA(compkey
, prod2_squashed
);
2060 RegDeleteKeyA(compkey
, "");
2061 RegCloseKey(compkey
);
2064 static void test_MsiEnumClients(void)
2067 CHAR prodcode
[MAX_PATH
];
2068 CHAR prod_squashed
[MAX_PATH
];
2069 CHAR prodcode2
[MAX_PATH
];
2070 CHAR prod2_squashed
[MAX_PATH
];
2071 CHAR component
[MAX_PATH
];
2072 CHAR comp_base85
[MAX_PATH
];
2073 CHAR comp_squashed
[MAX_PATH
];
2074 CHAR product
[MAX_PATH
];
2075 CHAR keypath
[MAX_PATH
];
2080 create_test_guid(prodcode
, prod_squashed
);
2081 create_test_guid(prodcode2
, prod2_squashed
);
2082 compose_base85_guid(component
, comp_base85
, comp_squashed
);
2083 get_user_sid(&usersid
);
2085 /* NULL szComponent */
2087 r
= MsiEnumClientsA(NULL
, 0, product
);
2088 ok(r
== ERROR_INVALID_PARAMETER
, "Expected ERROR_INVALID_PARAMETER, got %d\n", r
);
2089 ok(!lstrcmpA(product
, ""), "Expected product to be unchanged, got %s\n", product
);
2091 /* empty szComponent */
2093 r
= MsiEnumClientsA("", 0, product
);
2094 ok(r
== ERROR_INVALID_PARAMETER
, "Expected ERROR_INVALID_PARAMETER, got %d\n", r
);
2095 ok(!lstrcmpA(product
, ""), "Expected product to be unchanged, got %s\n", product
);
2097 /* NULL lpProductBuf */
2098 r
= MsiEnumClientsA(component
, 0, NULL
);
2099 ok(r
== ERROR_INVALID_PARAMETER
, "Expected ERROR_INVALID_PARAMETER, got %d\n", r
);
2101 /* all params correct, component missing */
2103 r
= MsiEnumClientsA(component
, 0, product
);
2104 ok(r
== ERROR_UNKNOWN_COMPONENT
, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r
);
2105 ok(!lstrcmpA(product
, ""), "Expected product to be unchanged, got %s\n", product
);
2107 lstrcpyA(keypath
, "Software\\Microsoft\\Windows\\CurrentVersion\\");
2108 lstrcatA(keypath
, "Installer\\UserData\\");
2109 lstrcatA(keypath
, usersid
);
2110 lstrcatA(keypath
, "\\Components\\");
2111 lstrcatA(keypath
, comp_squashed
);
2113 res
= RegCreateKeyA(HKEY_LOCAL_MACHINE
, keypath
, &compkey
);
2114 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
2116 /* user unmanaged component key exists */
2118 r
= MsiEnumClientsA(component
, 0, product
);
2119 ok(r
== ERROR_UNKNOWN_COMPONENT
, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r
);
2120 ok(!lstrcmpA(product
, ""), "Expected product to be unchanged, got %s\n", product
);
2122 /* index > 0, no products exist */
2124 r
= MsiEnumClientsA(component
, 1, product
);
2125 ok(r
== ERROR_INVALID_PARAMETER
, "Expected ERROR_INVALID_PARAMETER, got %d\n", r
);
2126 ok(!lstrcmpA(product
, ""), "Expected product to be unchanged, got %s\n", product
);
2128 res
= RegSetValueExA(compkey
, prod_squashed
, 0, REG_SZ
, (const BYTE
*)"C:\\imapath", 10);
2129 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
2131 /* product value exists */
2132 r
= MsiEnumClientsA(component
, 0, product
);
2133 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
2134 ok(!lstrcmpA(product
, prodcode
), "Expected %s, got %s\n", prodcode
, product
);
2136 /* try index 0 again */
2138 r
= MsiEnumClientsA(component
, 0, product
);
2139 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
2140 ok(!lstrcmpA(product
, prodcode
), "Expected %s, got %s\n", prodcode
, product
);
2142 /* try index 1, second product value does not exist */
2144 r
= MsiEnumClientsA(component
, 1, product
);
2145 ok(r
== ERROR_NO_MORE_ITEMS
, "Expected ERROR_NO_MORE_ITEMS, got %d\n", r
);
2146 ok(!lstrcmpA(product
, ""), "Expected product to be unchanged, got %s\n", product
);
2148 res
= RegSetValueExA(compkey
, prod2_squashed
, 0, REG_SZ
, (const BYTE
*)"C:\\another", 10);
2149 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
2151 /* try index 1, second product value does exist */
2153 r
= MsiEnumClientsA(component
, 1, product
);
2156 ok(r
== ERROR_INVALID_PARAMETER
, "Expected ERROR_INVALID_PARAMETER, got %d\n", r
);
2157 ok(!lstrcmpA(product
, ""), "Expected product to be unchanged, got %s\n", product
);
2160 /* start the enumeration over */
2162 r
= MsiEnumClientsA(component
, 0, product
);
2163 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
2164 ok(!lstrcmpA(product
, prodcode
) || !lstrcmpA(product
, prodcode2
),
2165 "Expected %s or %s, got %s\n", prodcode
, prodcode2
, product
);
2167 /* correctly query second product */
2169 r
= MsiEnumClientsA(component
, 1, product
);
2170 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
2171 ok(!lstrcmpA(product
, prodcode
) || !lstrcmpA(product
, prodcode2
),
2172 "Expected %s or %s, got %s\n", prodcode
, prodcode2
, product
);
2174 RegDeleteValueA(compkey
, prod_squashed
);
2175 RegDeleteValueA(compkey
, prod2_squashed
);
2176 RegDeleteKeyA(compkey
, "");
2177 RegCloseKey(compkey
);
2179 lstrcpyA(keypath
, "Software\\Microsoft\\Windows\\CurrentVersion\\");
2180 lstrcatA(keypath
, "Installer\\UserData\\S-1-5-18\\Components\\");
2181 lstrcatA(keypath
, comp_squashed
);
2183 res
= RegCreateKeyA(HKEY_LOCAL_MACHINE
, keypath
, &compkey
);
2184 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
2186 /* user local component key exists */
2188 r
= MsiEnumClientsA(component
, 0, product
);
2189 ok(r
== ERROR_UNKNOWN_COMPONENT
, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r
);
2190 ok(!lstrcmpA(product
, ""), "Expected product to be unchanged, got %s\n", product
);
2192 /* index > 0, no products exist */
2194 r
= MsiEnumClientsA(component
, 1, product
);
2195 ok(r
== ERROR_INVALID_PARAMETER
, "Expected ERROR_INVALID_PARAMETER, got %d\n", r
);
2196 ok(!lstrcmpA(product
, ""), "Expected product to be unchanged, got %s\n", product
);
2198 res
= RegSetValueExA(compkey
, prod_squashed
, 0, REG_SZ
, (const BYTE
*)"C:\\imapath", 10);
2199 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
2201 /* product value exists */
2203 r
= MsiEnumClientsA(component
, 0, product
);
2204 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
2205 ok(!lstrcmpA(product
, prodcode
), "Expected %s, got %s\n", prodcode
, product
);
2207 /* try index 0 again */
2209 r
= MsiEnumClientsA(component
, 0, product
);
2210 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
2212 /* try index 1, second product value does not exist */
2214 r
= MsiEnumClientsA(component
, 1, product
);
2215 ok(r
== ERROR_NO_MORE_ITEMS
, "Expected ERROR_NO_MORE_ITEMS, got %d\n", r
);
2216 ok(!lstrcmpA(product
, ""), "Expected product to be unchanged, got %s\n", product
);
2218 res
= RegSetValueExA(compkey
, prod2_squashed
, 0, REG_SZ
, (const BYTE
*)"C:\\another", 10);
2219 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
2221 /* try index 1, second product value does exist */
2223 r
= MsiEnumClientsA(component
, 1, product
);
2226 ok(r
== ERROR_INVALID_PARAMETER
, "Expected ERROR_INVALID_PARAMETER, got %d\n", r
);
2227 ok(!lstrcmpA(product
, ""), "Expected product to be unchanged, got %s\n", product
);
2230 /* start the enumeration over */
2232 r
= MsiEnumClientsA(component
, 0, product
);
2233 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
2234 ok(!lstrcmpA(product
, prodcode
) || !lstrcmpA(product
, prodcode2
),
2235 "Expected %s or %s, got %s\n", prodcode
, prodcode2
, product
);
2237 /* correctly query second product */
2239 r
= MsiEnumClientsA(component
, 1, product
);
2240 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
2241 ok(!lstrcmpA(product
, prodcode
) || !lstrcmpA(product
, prodcode2
),
2242 "Expected %s or %s, got %s\n", prodcode
, prodcode2
, product
);
2244 RegDeleteValueA(compkey
, prod_squashed
);
2245 RegDeleteValueA(compkey
, prod2_squashed
);
2246 RegDeleteKeyA(compkey
, "");
2247 RegCloseKey(compkey
);
2250 static void get_version_info(LPSTR path
, LPSTR
*vercheck
, LPDWORD verchecksz
,
2251 LPSTR
*langcheck
, LPDWORD langchecksz
)
2254 VS_FIXEDFILEINFO
*ffi
;
2255 DWORD size
= GetFileVersionInfoSizeA(path
, NULL
);
2258 version
= HeapAlloc(GetProcessHeap(), 0, size
);
2259 GetFileVersionInfoA(path
, 0, size
, version
);
2261 VerQueryValueA(version
, "\\", (LPVOID
*)&ffi
, &size
);
2262 *vercheck
= HeapAlloc(GetProcessHeap(), 0, MAX_PATH
);
2263 sprintf(*vercheck
, "%d.%d.%d.%d", HIWORD(ffi
->dwFileVersionMS
),
2264 LOWORD(ffi
->dwFileVersionMS
), HIWORD(ffi
->dwFileVersionLS
),
2265 LOWORD(ffi
->dwFileVersionLS
));
2266 *verchecksz
= lstrlenA(*vercheck
);
2268 VerQueryValue(version
, "\\VarFileInfo\\Translation", (void **)&lang
, &size
);
2269 *langcheck
= HeapAlloc(GetProcessHeap(), 0, MAX_PATH
);
2270 sprintf(*langcheck
, "%d", *lang
);
2271 *langchecksz
= lstrlenA(*langcheck
);
2273 HeapFree(GetProcessHeap(), 0, version
);
2276 static void test_MsiGetFileVersion(void)
2279 DWORD versz
, langsz
;
2280 char version
[MAX_PATH
];
2281 char lang
[MAX_PATH
];
2282 char path
[MAX_PATH
];
2283 LPSTR vercheck
, langcheck
;
2284 DWORD verchecksz
, langchecksz
;
2286 /* NULL szFilePath */
2289 lstrcpyA(version
, "version");
2290 lstrcpyA(lang
, "lang");
2291 r
= MsiGetFileVersionA(NULL
, version
, &versz
, lang
, &langsz
);
2292 ok(r
== ERROR_INVALID_PARAMETER
,
2293 "Expected ERROR_INVALID_PARAMETER, got %d\n", r
);
2294 ok(!lstrcmpA(version
, "version"),
2295 "Expected version to be unchanged, got %s\n", version
);
2296 ok(versz
== MAX_PATH
, "Expected %d, got %d\n", MAX_PATH
, versz
);
2297 ok(!lstrcmpA(lang
, "lang"),
2298 "Expected lang to be unchanged, got %s\n", lang
);
2299 ok(langsz
== MAX_PATH
, "Expected %d, got %d\n", MAX_PATH
, langsz
);
2301 /* empty szFilePath */
2304 lstrcpyA(version
, "version");
2305 lstrcpyA(lang
, "lang");
2306 r
= MsiGetFileVersionA("", version
, &versz
, lang
, &langsz
);
2307 ok(r
== ERROR_FILE_NOT_FOUND
,
2308 "Expected ERROR_FILE_NOT_FOUND, got %d\n", r
);
2309 ok(!lstrcmpA(version
, "version"),
2310 "Expected version to be unchanged, got %s\n", version
);
2311 ok(versz
== MAX_PATH
, "Expected %d, got %d\n", MAX_PATH
, versz
);
2312 ok(!lstrcmpA(lang
, "lang"),
2313 "Expected lang to be unchanged, got %s\n", lang
);
2314 ok(langsz
== MAX_PATH
, "Expected %d, got %d\n", MAX_PATH
, langsz
);
2316 /* nonexistent szFilePath */
2319 lstrcpyA(version
, "version");
2320 lstrcpyA(lang
, "lang");
2321 r
= MsiGetFileVersionA("nonexistent", version
, &versz
, lang
, &langsz
);
2322 ok(r
== ERROR_FILE_NOT_FOUND
,
2323 "Expected ERROR_FILE_NOT_FOUND, got %d\n", r
);
2324 ok(!lstrcmpA(version
, "version"),
2325 "Expected version to be unchanged, got %s\n", version
);
2326 ok(versz
== MAX_PATH
, "Expected %d, got %d\n", MAX_PATH
, versz
);
2327 ok(!lstrcmpA(lang
, "lang"),
2328 "Expected lang to be unchanged, got %s\n", lang
);
2329 ok(langsz
== MAX_PATH
, "Expected %d, got %d\n", MAX_PATH
, langsz
);
2331 /* nonexistent szFilePath, valid lpVersionBuf, NULL pcchVersionBuf */
2334 lstrcpyA(version
, "version");
2335 lstrcpyA(lang
, "lang");
2336 r
= MsiGetFileVersionA("nonexistent", version
, NULL
, lang
, &langsz
);
2337 ok(r
== ERROR_INVALID_PARAMETER
,
2338 "Expected ERROR_INVALID_PARAMETER, got %d\n", r
);
2339 ok(!lstrcmpA(version
, "version"),
2340 "Expected version to be unchanged, got %s\n", version
);
2341 ok(versz
== MAX_PATH
, "Expected %d, got %d\n", MAX_PATH
, versz
);
2342 ok(!lstrcmpA(lang
, "lang"),
2343 "Expected lang to be unchanged, got %s\n", lang
);
2344 ok(langsz
== MAX_PATH
, "Expected %d, got %d\n", MAX_PATH
, langsz
);
2346 /* nonexistent szFilePath, valid lpLangBuf, NULL pcchLangBuf */
2349 lstrcpyA(version
, "version");
2350 lstrcpyA(lang
, "lang");
2351 r
= MsiGetFileVersionA("nonexistent", version
, &versz
, lang
, NULL
);
2352 ok(r
== ERROR_INVALID_PARAMETER
,
2353 "Expected ERROR_INVALID_PARAMETER, got %d\n", r
);
2354 ok(!lstrcmpA(version
, "version"),
2355 "Expected version to be unchanged, got %s\n", version
);
2356 ok(versz
== MAX_PATH
, "Expected %d, got %d\n", MAX_PATH
, versz
);
2357 ok(!lstrcmpA(lang
, "lang"),
2358 "Expected lang to be unchanged, got %s\n", lang
);
2359 ok(langsz
== MAX_PATH
, "Expected %d, got %d\n", MAX_PATH
, langsz
);
2361 /* nonexistent szFilePath, valid lpVersionBuf, pcchVersionBuf is zero */
2364 lstrcpyA(version
, "version");
2365 lstrcpyA(lang
, "lang");
2366 r
= MsiGetFileVersionA("nonexistent", version
, &versz
, lang
, &langsz
);
2367 ok(r
== ERROR_FILE_NOT_FOUND
,
2368 "Expected ERROR_FILE_NOT_FOUND, got %d\n", r
);
2369 ok(!lstrcmpA(version
, "version"),
2370 "Expected version to be unchanged, got %s\n", version
);
2371 ok(versz
== 0, "Expected 0, got %d\n", versz
);
2372 ok(!lstrcmpA(lang
, "lang"),
2373 "Expected lang to be unchanged, got %s\n", lang
);
2374 ok(langsz
== MAX_PATH
, "Expected %d, got %d\n", MAX_PATH
, langsz
);
2376 /* nonexistent szFilePath, valid lpLangBuf, pcchLangBuf is zero */
2379 lstrcpyA(version
, "version");
2380 lstrcpyA(lang
, "lang");
2381 r
= MsiGetFileVersionA("nonexistent", version
, &versz
, lang
, &langsz
);
2382 ok(r
== ERROR_FILE_NOT_FOUND
,
2383 "Expected ERROR_FILE_NOT_FOUND, got %d\n", r
);
2384 ok(!lstrcmpA(version
, "version"),
2385 "Expected version to be unchanged, got %s\n", version
);
2386 ok(versz
== MAX_PATH
, "Expected %d, got %d\n", MAX_PATH
, versz
);
2387 ok(!lstrcmpA(lang
, "lang"),
2388 "Expected lang to be unchanged, got %s\n", lang
);
2389 ok(langsz
== 0, "Expected 0, got %d\n", langsz
);
2391 /* nonexistent szFilePath, rest NULL */
2392 r
= MsiGetFileVersionA("nonexistent", NULL
, NULL
, NULL
, NULL
);
2393 ok(r
== ERROR_FILE_NOT_FOUND
,
2394 "Expected ERROR_FILE_NOT_FOUND, got %d\n", r
);
2396 create_file("ver.txt", "ver.txt", 20);
2398 /* file exists, no version information */
2401 lstrcpyA(version
, "version");
2402 lstrcpyA(lang
, "lang");
2403 r
= MsiGetFileVersionA("ver.txt", version
, &versz
, lang
, &langsz
);
2404 ok(versz
== MAX_PATH
, "Expected %d, got %d\n", MAX_PATH
, versz
);
2405 ok(!lstrcmpA(version
, "version"),
2406 "Expected version to be unchanged, got %s\n", version
);
2407 ok(langsz
== MAX_PATH
, "Expected %d, got %d\n", MAX_PATH
, langsz
);
2408 ok(!lstrcmpA(lang
, "lang"),
2409 "Expected lang to be unchanged, got %s\n", lang
);
2410 ok(r
== ERROR_FILE_INVALID
,
2411 "Expected ERROR_FILE_INVALID, got %d\n", r
);
2413 DeleteFileA("ver.txt");
2415 /* relative path, has version information */
2418 lstrcpyA(version
, "version");
2419 lstrcpyA(lang
, "lang");
2420 r
= MsiGetFileVersionA("kernel32.dll", version
, &versz
, lang
, &langsz
);
2423 ok(r
== ERROR_FILE_NOT_FOUND
,
2424 "Expected ERROR_FILE_NOT_FOUND, got %d\n", r
);
2425 ok(!lstrcmpA(version
, "version"),
2426 "Expected version to be unchanged, got %s\n", version
);
2427 ok(versz
== MAX_PATH
, "Expected %d, got %d\n", MAX_PATH
, versz
);
2428 ok(!lstrcmpA(lang
, "lang"),
2429 "Expected lang to be unchanged, got %s\n", lang
);
2430 ok(langsz
== MAX_PATH
, "Expected %d, got %d\n", MAX_PATH
, langsz
);
2433 GetSystemDirectoryA(path
, MAX_PATH
);
2434 lstrcatA(path
, "\\kernel32.dll");
2436 get_version_info(path
, &vercheck
, &verchecksz
, &langcheck
, &langchecksz
);
2438 /* absolute path, has version information */
2441 lstrcpyA(version
, "version");
2442 lstrcpyA(lang
, "lang");
2443 r
= MsiGetFileVersionA(path
, version
, &versz
, lang
, &langsz
);
2444 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
2445 ok(versz
== verchecksz
, "Expected %d, got %d\n", verchecksz
, versz
);
2446 ok(!lstrcmpA(lang
, langcheck
), "Expected %s, got %s\n", langcheck
, lang
);
2447 ok(langsz
== langchecksz
, "Expected %d, got %d\n", langchecksz
, langsz
);
2448 ok(!lstrcmpA(version
, vercheck
),
2449 "Expected %s, got %s\n", vercheck
, version
);
2451 /* only check version */
2453 lstrcpyA(version
, "version");
2454 r
= MsiGetFileVersionA(path
, version
, &versz
, NULL
, NULL
);
2455 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
2456 ok(versz
== verchecksz
, "Expected %d, got %d\n", verchecksz
, versz
);
2457 ok(!lstrcmpA(version
, vercheck
),
2458 "Expected %s, got %s\n", vercheck
, version
);
2460 /* only check language */
2462 lstrcpyA(lang
, "lang");
2463 r
= MsiGetFileVersionA(path
, NULL
, NULL
, lang
, &langsz
);
2464 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
2465 ok(!lstrcmpA(lang
, langcheck
), "Expected %s, got %s\n", langcheck
, lang
);
2466 ok(langsz
== langchecksz
, "Expected %d, got %d\n", langchecksz
, langsz
);
2468 /* check neither version nor language */
2469 r
= MsiGetFileVersionA(path
, NULL
, NULL
, NULL
, NULL
);
2470 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
2472 /* get pcchVersionBuf */
2474 r
= MsiGetFileVersionA(path
, NULL
, &versz
, NULL
, NULL
);
2475 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
2476 ok(versz
== verchecksz
, "Expected %d, got %d\n", verchecksz
, versz
);
2478 /* get pcchLangBuf */
2480 r
= MsiGetFileVersionA(path
, NULL
, NULL
, NULL
, &langsz
);
2481 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
2482 ok(langsz
== langchecksz
, "Expected %d, got %d\n", langchecksz
, langsz
);
2484 /* pcchVersionBuf not big enough */
2486 lstrcpyA(version
, "version");
2487 r
= MsiGetFileVersionA(path
, version
, &versz
, NULL
, NULL
);
2488 ok(r
== ERROR_MORE_DATA
, "Expected ERROR_MORE_DATA, got %d\n", r
);
2489 ok(!strncmp(version
, vercheck
, 4),
2490 "Expected first 4 characters of %s, got %s\n", vercheck
, version
);
2491 ok(versz
== verchecksz
, "Expected %d, got %d\n", verchecksz
, versz
);
2493 /* pcchLangBuf not big enough */
2495 lstrcpyA(lang
, "lang");
2496 r
= MsiGetFileVersionA(path
, NULL
, NULL
, lang
, &langsz
);
2497 ok(r
== ERROR_MORE_DATA
, "Expected ERROR_MORE_DATA, got %d\n", r
);
2498 ok(!strncmp(lang
, langcheck
, 2),
2499 "Expected first character of %s, got %s\n", langcheck
, lang
);
2500 ok(langsz
== langchecksz
, "Expected %d, got %d\n", langchecksz
, langsz
);
2502 HeapFree(GetProcessHeap(), 0, vercheck
);
2503 HeapFree(GetProcessHeap(), 0, langcheck
);
2506 static void test_MsiGetProductInfo(void)
2510 HKEY propkey
, source
;
2511 HKEY prodkey
, localkey
;
2512 CHAR prodcode
[MAX_PATH
];
2513 CHAR prod_squashed
[MAX_PATH
];
2514 CHAR packcode
[MAX_PATH
];
2515 CHAR pack_squashed
[MAX_PATH
];
2517 CHAR keypath
[MAX_PATH
];
2521 create_test_guid(prodcode
, prod_squashed
);
2522 create_test_guid(packcode
, pack_squashed
);
2523 get_user_sid(&usersid
);
2525 /* NULL szProduct */
2527 lstrcpyA(buf
, "apple");
2528 r
= MsiGetProductInfoA(NULL
, INSTALLPROPERTY_HELPLINK
, buf
, &sz
);
2529 ok(r
== ERROR_INVALID_PARAMETER
,
2530 "Expected ERROR_INVALID_PARAMETER, got %d\n", r
);
2531 ok(!lstrcmpA(buf
, "apple"), "Expected buf to be unchanged, got %s\n", buf
);
2532 ok(sz
== MAX_PATH
, "Expected MAX_PATH, got %d\n", sz
);
2534 /* empty szProduct */
2536 lstrcpyA(buf
, "apple");
2537 r
= MsiGetProductInfoA("", INSTALLPROPERTY_HELPLINK
, buf
, &sz
);
2538 ok(r
== ERROR_INVALID_PARAMETER
,
2539 "Expected ERROR_INVALID_PARAMETER, got %d\n", r
);
2540 ok(!lstrcmpA(buf
, "apple"), "Expected buf to be unchanged, got %s\n", buf
);
2541 ok(sz
== MAX_PATH
, "Expected MAX_PATH, got %d\n", sz
);
2543 /* garbage szProduct */
2545 lstrcpyA(buf
, "apple");
2546 r
= MsiGetProductInfoA("garbage", INSTALLPROPERTY_HELPLINK
, buf
, &sz
);
2547 ok(r
== ERROR_INVALID_PARAMETER
,
2548 "Expected ERROR_INVALID_PARAMETER, got %d\n", r
);
2549 ok(!lstrcmpA(buf
, "apple"), "Expected buf to be unchanged, got %s\n", buf
);
2550 ok(sz
== MAX_PATH
, "Expected MAX_PATH, got %d\n", sz
);
2552 /* guid without brackets */
2554 lstrcpyA(buf
, "apple");
2555 r
= MsiGetProductInfoA("6700E8CF-95AB-4D9C-BC2C-15840DEA7A5D",
2556 INSTALLPROPERTY_HELPLINK
, buf
, &sz
);
2557 ok(r
== ERROR_INVALID_PARAMETER
,
2558 "Expected ERROR_INVALID_PARAMETER, got %d\n", r
);
2559 ok(!lstrcmpA(buf
, "apple"), "Expected buf to be unchanged, got %s\n", buf
);
2560 ok(sz
== MAX_PATH
, "Expected MAX_PATH, got %d\n", sz
);
2562 /* guid with brackets */
2564 lstrcpyA(buf
, "apple");
2565 r
= MsiGetProductInfoA("{6700E8CF-95AB-4D9C-BC2C-15840DEA7A5D}",
2566 INSTALLPROPERTY_HELPLINK
, buf
, &sz
);
2567 ok(r
== ERROR_UNKNOWN_PRODUCT
,
2568 "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r
);
2569 ok(!lstrcmpA(buf
, "apple"), "Expected buf to be unchanged, got %s\n", buf
);
2570 ok(sz
== MAX_PATH
, "Expected MAX_PATH, got %d\n", sz
);
2572 /* same length as guid, but random */
2574 lstrcpyA(buf
, "apple");
2575 r
= MsiGetProductInfoA("A938G02JF-2NF3N93-VN3-2NNF-3KGKALDNF93",
2576 INSTALLPROPERTY_HELPLINK
, buf
, &sz
);
2577 ok(r
== ERROR_INVALID_PARAMETER
,
2578 "Expected ERROR_INVALID_PARAMETER, got %d\n", r
);
2579 ok(!lstrcmpA(buf
, "apple"), "Expected buf to be unchanged, got %s\n", buf
);
2580 ok(sz
== MAX_PATH
, "Expected MAX_PATH, got %d\n", sz
);
2582 /* not installed, NULL szAttribute */
2584 lstrcpyA(buf
, "apple");
2585 r
= MsiGetProductInfoA(prodcode
, NULL
, buf
, &sz
);
2586 ok(r
== ERROR_INVALID_PARAMETER
,
2587 "Expected ERROR_INVALID_PARAMETER, got %d\n", r
);
2588 ok(!lstrcmpA(buf
, "apple"), "Expected buf to be unchanged, got %s\n", buf
);
2589 ok(sz
== MAX_PATH
, "Expected MAX_PATH, got %d\n", sz
);
2591 /* not installed, NULL lpValueBuf */
2593 lstrcpyA(buf
, "apple");
2594 r
= MsiGetProductInfoA(prodcode
, INSTALLPROPERTY_HELPLINK
, NULL
, &sz
);
2595 ok(r
== ERROR_UNKNOWN_PRODUCT
,
2596 "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r
);
2597 ok(!lstrcmpA(buf
, "apple"), "Expected buf to be unchanged, got %s\n", buf
);
2598 ok(sz
== MAX_PATH
, "Expected MAX_PATH, got %d\n", sz
);
2600 /* not installed, NULL pcchValueBuf */
2602 lstrcpyA(buf
, "apple");
2603 r
= MsiGetProductInfoA(prodcode
, INSTALLPROPERTY_HELPLINK
, buf
, NULL
);
2604 ok(r
== ERROR_INVALID_PARAMETER
,
2605 "Expected ERROR_INVALID_PARAMETER, got %d\n", r
);
2606 ok(!lstrcmpA(buf
, "apple"), "Expected buf to be unchanged, got %s\n", buf
);
2607 ok(sz
== MAX_PATH
, "Expected MAX_PATH, got %d\n", sz
);
2609 /* created guid cannot possibly be an installed product code */
2611 lstrcpyA(buf
, "apple");
2612 r
= MsiGetProductInfoA(prodcode
, INSTALLPROPERTY_HELPLINK
, buf
, &sz
);
2613 ok(r
== ERROR_UNKNOWN_PRODUCT
,
2614 "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r
);
2615 ok(!lstrcmpA(buf
, "apple"), "Expected buf to be unchanged, got %s\n", buf
);
2616 ok(sz
== MAX_PATH
, "Expected MAX_PATH, got %d\n", sz
);
2618 lstrcpyA(keypath
, "Software\\Microsoft\\Windows\\CurrentVersion\\Installer\\Managed\\");
2619 lstrcatA(keypath
, usersid
);
2620 lstrcatA(keypath
, "\\Installer\\Products\\");
2621 lstrcatA(keypath
, prod_squashed
);
2623 res
= RegCreateKeyA(HKEY_LOCAL_MACHINE
, keypath
, &prodkey
);
2624 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
2626 /* managed product code exists */
2628 lstrcpyA(buf
, "apple");
2629 r
= MsiGetProductInfoA(prodcode
, INSTALLPROPERTY_HELPLINK
, buf
, &sz
);
2630 ok(r
== ERROR_UNKNOWN_PROPERTY
,
2631 "Expected ERROR_UNKNOWN_PROPERTY, got %d\n", r
);
2632 ok(!lstrcmpA(buf
, "apple"), "Expected buf to be unchanged, got %s\n", buf
);
2633 ok(sz
== MAX_PATH
, "Expected MAX_PATH, got %d\n", sz
);
2635 RegDeleteKeyA(prodkey
, "");
2636 RegCloseKey(prodkey
);
2638 lstrcpyA(keypath
, "Software\\Microsoft\\Windows\\CurrentVersion\\Installer\\UserData\\");
2639 lstrcatA(keypath
, usersid
);
2640 lstrcatA(keypath
, "\\Products\\");
2641 lstrcatA(keypath
, prod_squashed
);
2643 res
= RegCreateKeyA(HKEY_LOCAL_MACHINE
, keypath
, &localkey
);
2644 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
2646 /* local user product code exists */
2648 lstrcpyA(buf
, "apple");
2649 r
= MsiGetProductInfoA(prodcode
, INSTALLPROPERTY_HELPLINK
, buf
, &sz
);
2650 ok(r
== ERROR_UNKNOWN_PRODUCT
,
2651 "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r
);
2652 ok(!lstrcmpA(buf
, "apple"), "Expected buf to be unchanged, got %s\n", buf
);
2653 ok(sz
== MAX_PATH
, "Expected MAX_PATH, got %d\n", sz
);
2655 lstrcpyA(keypath
, "Software\\Microsoft\\Windows\\CurrentVersion\\Installer\\Managed\\");
2656 lstrcatA(keypath
, usersid
);
2657 lstrcatA(keypath
, "\\Installer\\Products\\");
2658 lstrcatA(keypath
, prod_squashed
);
2660 res
= RegCreateKeyA(HKEY_LOCAL_MACHINE
, keypath
, &prodkey
);
2661 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
2663 /* both local and managed product code exist */
2665 lstrcpyA(buf
, "apple");
2666 r
= MsiGetProductInfoA(prodcode
, INSTALLPROPERTY_HELPLINK
, buf
, &sz
);
2667 ok(r
== ERROR_UNKNOWN_PROPERTY
,
2668 "Expected ERROR_UNKNOWN_PROPERTY, got %d\n", r
);
2669 ok(!lstrcmpA(buf
, "apple"), "Expected buf to be unchanged, got %s\n", buf
);
2670 ok(sz
== MAX_PATH
, "Expected MAX_PATH, got %d\n", sz
);
2672 res
= RegCreateKeyA(localkey
, "InstallProperties", &propkey
);
2673 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
2675 /* InstallProperties key exists */
2677 lstrcpyA(buf
, "apple");
2678 r
= MsiGetProductInfoA(prodcode
, INSTALLPROPERTY_HELPLINK
, buf
, &sz
);
2679 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
2680 ok(!lstrcmpA(buf
, ""), "Expected \"\", got \"%s\"\n", buf
);
2681 ok(sz
== 0, "Expected 0, got %d\n", sz
);
2683 res
= RegSetValueExA(propkey
, "HelpLink", 0, REG_SZ
, (LPBYTE
)"link", 5);
2684 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
2686 /* HelpLink value exists */
2688 lstrcpyA(buf
, "apple");
2689 r
= MsiGetProductInfoA(prodcode
, INSTALLPROPERTY_HELPLINK
, buf
, &sz
);
2690 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
2691 ok(!lstrcmpA(buf
, "link"), "Expected \"link\", got \"%s\"\n", buf
);
2692 ok(sz
== 4, "Expected 4, got %d\n", sz
);
2694 /* pcchBuf is NULL */
2695 r
= MsiGetProductInfoA(prodcode
, INSTALLPROPERTY_HELPLINK
, NULL
, NULL
);
2696 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
2698 /* lpValueBuf is NULL */
2700 r
= MsiGetProductInfoA(prodcode
, INSTALLPROPERTY_HELPLINK
, NULL
, &sz
);
2701 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
2702 ok(sz
== 4, "Expected 4, got %d\n", sz
);
2704 /* lpValueBuf is NULL, pcchValueBuf is too small */
2706 r
= MsiGetProductInfoA(prodcode
, INSTALLPROPERTY_HELPLINK
, NULL
, &sz
);
2707 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
2708 ok(sz
== 4, "Expected 4, got %d\n", sz
);
2710 /* lpValueBuf is NULL, pcchValueBuf is too small */
2712 lstrcpyA(buf
, "apple");
2713 r
= MsiGetProductInfoA(prodcode
, INSTALLPROPERTY_HELPLINK
, buf
, &sz
);
2714 ok(!lstrcmpA(buf
, "apple"), "Expected buf to remain unchanged, got \"%s\"\n", buf
);
2715 ok(r
== ERROR_MORE_DATA
, "Expected ERROR_MORE_DATA, got %d\n", r
);
2716 ok(sz
== 4, "Expected 4, got %d\n", sz
);
2718 /* lpValueBuf is NULL, pcchValueBuf is exactly 4 */
2720 lstrcpyA(buf
, "apple");
2721 r
= MsiGetProductInfoA(prodcode
, INSTALLPROPERTY_HELPLINK
, buf
, &sz
);
2722 ok(r
== ERROR_MORE_DATA
, "Expected ERROR_MORE_DATA, got %d\n", r
);
2723 ok(!lstrcmpA(buf
, "apple"),
2724 "Expected buf to remain unchanged, got \"%s\"\n", buf
);
2725 ok(sz
== 4, "Expected 4, got %d\n", sz
);
2727 res
= RegSetValueExA(propkey
, "IMadeThis", 0, REG_SZ
, (LPBYTE
)"random", 7);
2728 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
2730 /* random property not supported by MSI, value exists */
2732 lstrcpyA(buf
, "apple");
2733 r
= MsiGetProductInfoA(prodcode
, "IMadeThis", buf
, &sz
);
2734 ok(r
== ERROR_UNKNOWN_PROPERTY
,
2735 "Expected ERROR_UNKNOWN_PROPERTY, got %d\n", r
);
2736 ok(!lstrcmpA(buf
, "apple"), "Expected \"apple\", got \"%s\"\n", buf
);
2737 ok(sz
== MAX_PATH
, "Expected MAX_PATH, got %d\n", sz
);
2739 RegDeleteValueA(propkey
, "IMadeThis");
2740 RegDeleteValueA(propkey
, "HelpLink");
2741 RegDeleteKeyA(propkey
, "");
2742 RegDeleteKeyA(localkey
, "");
2743 RegDeleteKeyA(prodkey
, "");
2744 RegCloseKey(propkey
);
2745 RegCloseKey(localkey
);
2746 RegCloseKey(prodkey
);
2748 lstrcpyA(keypath
, "Software\\Microsoft\\Installer\\Products\\");
2749 lstrcatA(keypath
, prod_squashed
);
2751 res
= RegCreateKeyA(HKEY_CURRENT_USER
, keypath
, &prodkey
);
2752 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
2754 /* user product key exists */
2756 lstrcpyA(buf
, "apple");
2757 r
= MsiGetProductInfoA(prodcode
, INSTALLPROPERTY_HELPLINK
, buf
, &sz
);
2758 ok(r
== ERROR_UNKNOWN_PROPERTY
,
2759 "Expected ERROR_UNKNOWN_PROPERTY, got %d\n", r
);
2760 ok(!lstrcmpA(buf
, "apple"), "Expected \"apple\", got \"%s\"\n", buf
);
2761 ok(sz
== MAX_PATH
, "Expected MAX_PATH, got %d\n", sz
);
2763 lstrcpyA(keypath
, "Software\\Microsoft\\Windows\\CurrentVersion\\Installer\\UserData\\");
2764 lstrcatA(keypath
, usersid
);
2765 lstrcatA(keypath
, "\\Products\\");
2766 lstrcatA(keypath
, prod_squashed
);
2768 res
= RegCreateKeyA(HKEY_LOCAL_MACHINE
, keypath
, &localkey
);
2769 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
2771 /* local user product key exists */
2773 lstrcpyA(buf
, "apple");
2774 r
= MsiGetProductInfoA(prodcode
, INSTALLPROPERTY_HELPLINK
, buf
, &sz
);
2775 ok(r
== ERROR_UNKNOWN_PROPERTY
,
2776 "Expected ERROR_UNKNOWN_PROPERTY, got %d\n", r
);
2777 ok(!lstrcmpA(buf
, "apple"), "Expected \"apple\", got \"%s\"\n", buf
);
2778 ok(sz
== MAX_PATH
, "Expected MAX_PATH, got %d\n", sz
);
2780 res
= RegCreateKeyA(localkey
, "InstallProperties", &propkey
);
2781 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
2783 /* InstallProperties key exists */
2785 lstrcpyA(buf
, "apple");
2786 r
= MsiGetProductInfoA(prodcode
, INSTALLPROPERTY_HELPLINK
, buf
, &sz
);
2787 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
2788 ok(!lstrcmpA(buf
, ""), "Expected \"\", got \"%s\"\n", buf
);
2789 ok(sz
== 0, "Expected 0, got %d\n", sz
);
2791 res
= RegSetValueExA(propkey
, "HelpLink", 0, REG_SZ
, (LPBYTE
)"link", 5);
2792 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
2794 /* HelpLink value exists */
2796 lstrcpyA(buf
, "apple");
2797 r
= MsiGetProductInfoA(prodcode
, INSTALLPROPERTY_HELPLINK
, buf
, &sz
);
2798 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
2799 ok(!lstrcmpA(buf
, "link"), "Expected \"link\", got \"%s\"\n", buf
);
2800 ok(sz
== 4, "Expected 4, got %d\n", sz
);
2802 RegDeleteValueA(propkey
, "HelpLink");
2803 RegDeleteKeyA(propkey
, "");
2804 RegDeleteKeyA(localkey
, "");
2805 RegDeleteKeyA(prodkey
, "");
2806 RegCloseKey(propkey
);
2807 RegCloseKey(localkey
);
2808 RegCloseKey(prodkey
);
2810 lstrcpyA(keypath
, "Software\\Classes\\Installer\\Products\\");
2811 lstrcatA(keypath
, prod_squashed
);
2813 res
= RegCreateKeyA(HKEY_LOCAL_MACHINE
, keypath
, &prodkey
);
2814 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
2816 /* classes product key exists */
2818 lstrcpyA(buf
, "apple");
2819 r
= MsiGetProductInfoA(prodcode
, INSTALLPROPERTY_HELPLINK
, buf
, &sz
);
2820 ok(r
== ERROR_UNKNOWN_PROPERTY
,
2821 "Expected ERROR_UNKNOWN_PROPERTY, got %d\n", r
);
2822 ok(!lstrcmpA(buf
, "apple"), "Expected \"apple\", got \"%s\"\n", buf
);
2823 ok(sz
== MAX_PATH
, "Expected MAX_PATH, got %d\n", sz
);
2825 lstrcpyA(keypath
, "Software\\Microsoft\\Windows\\CurrentVersion\\Installer\\UserData\\");
2826 lstrcatA(keypath
, usersid
);
2827 lstrcatA(keypath
, "\\Products\\");
2828 lstrcatA(keypath
, prod_squashed
);
2830 res
= RegCreateKeyA(HKEY_LOCAL_MACHINE
, keypath
, &localkey
);
2831 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
2833 /* local user product key exists */
2835 lstrcpyA(buf
, "apple");
2836 r
= MsiGetProductInfoA(prodcode
, INSTALLPROPERTY_HELPLINK
, buf
, &sz
);
2837 ok(r
== ERROR_UNKNOWN_PROPERTY
,
2838 "Expected ERROR_UNKNOWN_PROPERTY, got %d\n", r
);
2839 ok(!lstrcmpA(buf
, "apple"), "Expected \"apple\", got \"%s\"\n", buf
);
2840 ok(sz
== MAX_PATH
, "Expected MAX_PATH, got %d\n", sz
);
2842 res
= RegCreateKeyA(localkey
, "InstallProperties", &propkey
);
2843 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
2845 /* InstallProperties key exists */
2847 lstrcpyA(buf
, "apple");
2848 r
= MsiGetProductInfoA(prodcode
, INSTALLPROPERTY_HELPLINK
, buf
, &sz
);
2849 ok(r
== ERROR_UNKNOWN_PROPERTY
,
2850 "Expected ERROR_UNKNOWN_PROPERTY, got %d\n", r
);
2851 ok(!lstrcmpA(buf
, "apple"), "Expected \"apple\", got \"%s\"\n", buf
);
2852 ok(sz
== MAX_PATH
, "Expected MAX_PATH, got %d\n", sz
);
2854 RegDeleteKeyA(propkey
, "");
2855 RegDeleteKeyA(localkey
, "");
2856 RegCloseKey(propkey
);
2857 RegCloseKey(localkey
);
2859 lstrcpyA(keypath
, "Software\\Microsoft\\Windows\\CurrentVersion\\Installer\\UserData\\");
2860 lstrcatA(keypath
, "S-1-5-18\\\\Products\\");
2861 lstrcatA(keypath
, prod_squashed
);
2863 res
= RegCreateKeyA(HKEY_LOCAL_MACHINE
, keypath
, &localkey
);
2864 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
2866 /* Local System product key exists */
2868 lstrcpyA(buf
, "apple");
2869 r
= MsiGetProductInfoA(prodcode
, INSTALLPROPERTY_HELPLINK
, buf
, &sz
);
2870 ok(r
== ERROR_UNKNOWN_PROPERTY
,
2871 "Expected ERROR_UNKNOWN_PROPERTY, got %d\n", r
);
2872 ok(!lstrcmpA(buf
, "apple"), "Expected \"apple\", got \"%s\"\n", buf
);
2873 ok(sz
== MAX_PATH
, "Expected MAX_PATH, got %d\n", sz
);
2875 res
= RegCreateKeyA(localkey
, "InstallProperties", &propkey
);
2876 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
2878 /* InstallProperties key exists */
2880 lstrcpyA(buf
, "apple");
2881 r
= MsiGetProductInfoA(prodcode
, INSTALLPROPERTY_HELPLINK
, buf
, &sz
);
2882 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
2883 ok(!lstrcmpA(buf
, ""), "Expected \"\", got \"%s\"\n", buf
);
2884 ok(sz
== 0, "Expected 0, got %d\n", sz
);
2886 res
= RegSetValueExA(propkey
, "HelpLink", 0, REG_SZ
, (LPBYTE
)"link", 5);
2887 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
2889 /* HelpLink value exists */
2891 lstrcpyA(buf
, "apple");
2892 r
= MsiGetProductInfoA(prodcode
, INSTALLPROPERTY_HELPLINK
, buf
, &sz
);
2893 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
2894 ok(!lstrcmpA(buf
, "link"), "Expected \"link\", got \"%s\"\n", buf
);
2895 ok(sz
== 4, "Expected 4, got %d\n", sz
);
2897 res
= RegSetValueExA(propkey
, "HelpLink", 0, REG_DWORD
,
2898 (const BYTE
*)&val
, sizeof(DWORD
));
2899 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
2901 /* HelpLink type is REG_DWORD */
2903 lstrcpyA(buf
, "apple");
2904 r
= MsiGetProductInfoA(prodcode
, INSTALLPROPERTY_HELPLINK
, buf
, &sz
);
2905 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
2906 ok(!lstrcmpA(buf
, "42"), "Expected \"42\", got \"%s\"\n", buf
);
2907 ok(sz
== 2, "Expected 2, got %d\n", sz
);
2909 res
= RegSetValueExA(propkey
, "DisplayName", 0, REG_SZ
, (LPBYTE
)"name", 5);
2910 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
2912 /* DisplayName value exists */
2914 lstrcpyA(buf
, "apple");
2915 r
= MsiGetProductInfoA(prodcode
, INSTALLPROPERTY_INSTALLEDPRODUCTNAME
, buf
, &sz
);
2916 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
2917 ok(!lstrcmpA(buf
, "name"), "Expected \"name\", got \"%s\"\n", buf
);
2918 ok(sz
== 4, "Expected 4, got %d\n", sz
);
2920 res
= RegSetValueExA(propkey
, "DisplayName", 0, REG_DWORD
,
2921 (const BYTE
*)&val
, sizeof(DWORD
));
2922 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
2924 /* DisplayName type is REG_DWORD */
2926 lstrcpyA(buf
, "apple");
2927 r
= MsiGetProductInfoA(prodcode
, INSTALLPROPERTY_INSTALLEDPRODUCTNAME
, buf
, &sz
);
2928 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
2929 ok(!lstrcmpA(buf
, "42"), "Expected \"42\", got \"%s\"\n", buf
);
2930 ok(sz
== 2, "Expected 2, got %d\n", sz
);
2932 res
= RegSetValueExA(propkey
, "DisplayVersion", 0, REG_SZ
, (LPBYTE
)"1.1.1", 6);
2933 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
2935 /* DisplayVersion value exists */
2937 lstrcpyA(buf
, "apple");
2938 r
= MsiGetProductInfoA(prodcode
, INSTALLPROPERTY_VERSIONSTRING
, buf
, &sz
);
2939 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
2940 ok(!lstrcmpA(buf
, "1.1.1"), "Expected \"1.1.1\", got \"%s\"\n", buf
);
2941 ok(sz
== 5, "Expected 5, got %d\n", sz
);
2943 res
= RegSetValueExA(propkey
, "DisplayVersion", 0,
2944 REG_DWORD
, (const BYTE
*)&val
, sizeof(DWORD
));
2945 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
2947 /* DisplayVersion type is REG_DWORD */
2949 lstrcpyA(buf
, "apple");
2950 r
= MsiGetProductInfoA(prodcode
, INSTALLPROPERTY_VERSIONSTRING
, buf
, &sz
);
2951 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
2952 ok(!lstrcmpA(buf
, "42"), "Expected \"42\", got \"%s\"\n", buf
);
2953 ok(sz
== 2, "Expected 2, got %d\n", sz
);
2955 res
= RegSetValueExA(propkey
, "HelpTelephone", 0, REG_SZ
, (LPBYTE
)"tele", 5);
2956 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
2958 /* HelpTelephone value exists */
2960 lstrcpyA(buf
, "apple");
2961 r
= MsiGetProductInfoA(prodcode
, INSTALLPROPERTY_HELPTELEPHONE
, buf
, &sz
);
2962 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
2963 ok(!lstrcmpA(buf
, "tele"), "Expected \"tele\", got \"%s\"\n", buf
);
2964 ok(sz
== 4, "Expected 4, got %d\n", sz
);
2966 res
= RegSetValueExA(propkey
, "HelpTelephone", 0, REG_DWORD
,
2967 (const BYTE
*)&val
, sizeof(DWORD
));
2968 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
2970 /* HelpTelephone type is REG_DWORD */
2972 lstrcpyA(buf
, "apple");
2973 r
= MsiGetProductInfoA(prodcode
, INSTALLPROPERTY_HELPTELEPHONE
, buf
, &sz
);
2974 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
2975 ok(!lstrcmpA(buf
, "42"), "Expected \"42\", got \"%s\"\n", buf
);
2976 ok(sz
== 2, "Expected 2, got %d\n", sz
);
2978 res
= RegSetValueExA(propkey
, "InstallLocation", 0, REG_SZ
, (LPBYTE
)"loc", 4);
2979 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
2981 /* InstallLocation value exists */
2983 lstrcpyA(buf
, "apple");
2984 r
= MsiGetProductInfoA(prodcode
, INSTALLPROPERTY_INSTALLLOCATION
, buf
, &sz
);
2985 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
2986 ok(!lstrcmpA(buf
, "loc"), "Expected \"loc\", got \"%s\"\n", buf
);
2987 ok(sz
== 3, "Expected 3, got %d\n", sz
);
2989 res
= RegSetValueExA(propkey
, "InstallLocation", 0, REG_DWORD
,
2990 (const BYTE
*)&val
, sizeof(DWORD
));
2991 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
2993 /* InstallLocation type is REG_DWORD */
2995 lstrcpyA(buf
, "apple");
2996 r
= MsiGetProductInfoA(prodcode
, INSTALLPROPERTY_INSTALLLOCATION
, buf
, &sz
);
2997 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
2998 ok(!lstrcmpA(buf
, "42"), "Expected \"42\", got \"%s\"\n", buf
);
2999 ok(sz
== 2, "Expected 2, got %d\n", sz
);
3001 res
= RegSetValueExA(propkey
, "InstallSource", 0, REG_SZ
, (LPBYTE
)"source", 7);
3002 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
3004 /* InstallSource value exists */
3006 lstrcpyA(buf
, "apple");
3007 r
= MsiGetProductInfoA(prodcode
, INSTALLPROPERTY_INSTALLSOURCE
, buf
, &sz
);
3008 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3009 ok(!lstrcmpA(buf
, "source"), "Expected \"source\", got \"%s\"\n", buf
);
3010 ok(sz
== 6, "Expected 6, got %d\n", sz
);
3012 res
= RegSetValueExA(propkey
, "InstallSource", 0, REG_DWORD
,
3013 (const BYTE
*)&val
, sizeof(DWORD
));
3014 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
3016 /* InstallSource type is REG_DWORD */
3018 lstrcpyA(buf
, "apple");
3019 r
= MsiGetProductInfoA(prodcode
, INSTALLPROPERTY_INSTALLSOURCE
, buf
, &sz
);
3020 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3021 ok(!lstrcmpA(buf
, "42"), "Expected \"42\", got \"%s\"\n", buf
);
3022 ok(sz
== 2, "Expected 2, got %d\n", sz
);
3024 res
= RegSetValueExA(propkey
, "InstallDate", 0, REG_SZ
, (LPBYTE
)"date", 5);
3025 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
3027 /* InstallDate value exists */
3029 lstrcpyA(buf
, "apple");
3030 r
= MsiGetProductInfoA(prodcode
, INSTALLPROPERTY_INSTALLDATE
, buf
, &sz
);
3031 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3032 ok(!lstrcmpA(buf
, "date"), "Expected \"date\", got \"%s\"\n", buf
);
3033 ok(sz
== 4, "Expected 4, got %d\n", sz
);
3035 res
= RegSetValueExA(propkey
, "InstallDate", 0, REG_DWORD
,
3036 (const BYTE
*)&val
, sizeof(DWORD
));
3037 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
3039 /* InstallDate type is REG_DWORD */
3041 lstrcpyA(buf
, "apple");
3042 r
= MsiGetProductInfoA(prodcode
, INSTALLPROPERTY_INSTALLDATE
, buf
, &sz
);
3043 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3044 ok(!lstrcmpA(buf
, "42"), "Expected \"42\", got \"%s\"\n", buf
);
3045 ok(sz
== 2, "Expected 2, got %d\n", sz
);
3047 res
= RegSetValueExA(propkey
, "Publisher", 0, REG_SZ
, (LPBYTE
)"pub", 4);
3048 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
3050 /* Publisher value exists */
3052 lstrcpyA(buf
, "apple");
3053 r
= MsiGetProductInfoA(prodcode
, INSTALLPROPERTY_PUBLISHER
, buf
, &sz
);
3054 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3055 ok(!lstrcmpA(buf
, "pub"), "Expected \"pub\", got \"%s\"\n", buf
);
3056 ok(sz
== 3, "Expected 3, got %d\n", sz
);
3058 res
= RegSetValueExA(propkey
, "Publisher", 0, REG_DWORD
,
3059 (const BYTE
*)&val
, sizeof(DWORD
));
3060 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
3062 /* Publisher type is REG_DWORD */
3064 lstrcpyA(buf
, "apple");
3065 r
= MsiGetProductInfoA(prodcode
, INSTALLPROPERTY_PUBLISHER
, buf
, &sz
);
3066 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3067 ok(!lstrcmpA(buf
, "42"), "Expected \"42\", got \"%s\"\n", buf
);
3068 ok(sz
== 2, "Expected 2, got %d\n", sz
);
3070 res
= RegSetValueExA(propkey
, "LocalPackage", 0, REG_SZ
, (LPBYTE
)"pack", 5);
3071 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
3073 /* LocalPackage value exists */
3075 lstrcpyA(buf
, "apple");
3076 r
= MsiGetProductInfoA(prodcode
, INSTALLPROPERTY_LOCALPACKAGE
, buf
, &sz
);
3077 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3078 ok(!lstrcmpA(buf
, "pack"), "Expected \"pack\", got \"%s\"\n", buf
);
3079 ok(sz
== 4, "Expected 4, got %d\n", sz
);
3081 res
= RegSetValueExA(propkey
, "LocalPackage", 0, REG_DWORD
,
3082 (const BYTE
*)&val
, sizeof(DWORD
));
3083 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
3085 /* LocalPackage type is REG_DWORD */
3087 lstrcpyA(buf
, "apple");
3088 r
= MsiGetProductInfoA(prodcode
, INSTALLPROPERTY_LOCALPACKAGE
, buf
, &sz
);
3089 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3090 ok(!lstrcmpA(buf
, "42"), "Expected \"42\", got \"%s\"\n", buf
);
3091 ok(sz
== 2, "Expected 2, got %d\n", sz
);
3093 res
= RegSetValueExA(propkey
, "UrlInfoAbout", 0, REG_SZ
, (LPBYTE
)"about", 6);
3094 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
3096 /* UrlInfoAbout value exists */
3098 lstrcpyA(buf
, "apple");
3099 r
= MsiGetProductInfoA(prodcode
, INSTALLPROPERTY_URLINFOABOUT
, buf
, &sz
);
3100 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3101 ok(!lstrcmpA(buf
, "about"), "Expected \"about\", got \"%s\"\n", buf
);
3102 ok(sz
== 5, "Expected 5, got %d\n", sz
);
3104 res
= RegSetValueExA(propkey
, "UrlInfoAbout", 0, REG_DWORD
,
3105 (const BYTE
*)&val
, sizeof(DWORD
));
3106 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
3108 /* UrlInfoAbout type is REG_DWORD */
3110 lstrcpyA(buf
, "apple");
3111 r
= MsiGetProductInfoA(prodcode
, INSTALLPROPERTY_URLINFOABOUT
, buf
, &sz
);
3112 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3113 ok(!lstrcmpA(buf
, "42"), "Expected \"42\", got \"%s\"\n", buf
);
3114 ok(sz
== 2, "Expected 2, got %d\n", sz
);
3116 res
= RegSetValueExA(propkey
, "UrlUpdateInfo", 0, REG_SZ
, (LPBYTE
)"info", 5);
3117 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
3119 /* UrlUpdateInfo value exists */
3121 lstrcpyA(buf
, "apple");
3122 r
= MsiGetProductInfoA(prodcode
, INSTALLPROPERTY_URLUPDATEINFO
, buf
, &sz
);
3123 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3124 ok(!lstrcmpA(buf
, "info"), "Expected \"info\", got \"%s\"\n", buf
);
3125 ok(sz
== 4, "Expected 4, got %d\n", sz
);
3127 res
= RegSetValueExA(propkey
, "UrlUpdateInfo", 0, REG_DWORD
,
3128 (const BYTE
*)&val
, sizeof(DWORD
));
3129 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
3131 /* UrlUpdateInfo type is REG_DWORD */
3133 lstrcpyA(buf
, "apple");
3134 r
= MsiGetProductInfoA(prodcode
, INSTALLPROPERTY_URLUPDATEINFO
, buf
, &sz
);
3135 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3136 ok(!lstrcmpA(buf
, "42"), "Expected \"42\", got \"%s\"\n", buf
);
3137 ok(sz
== 2, "Expected 2, got %d\n", sz
);
3139 res
= RegSetValueExA(propkey
, "VersionMinor", 0, REG_SZ
, (LPBYTE
)"1", 2);
3140 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
3142 /* VersionMinor value exists */
3144 lstrcpyA(buf
, "apple");
3145 r
= MsiGetProductInfoA(prodcode
, INSTALLPROPERTY_VERSIONMINOR
, buf
, &sz
);
3146 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3147 ok(!lstrcmpA(buf
, "1"), "Expected \"1\", got \"%s\"\n", buf
);
3148 ok(sz
== 1, "Expected 1, got %d\n", sz
);
3150 res
= RegSetValueExA(propkey
, "VersionMinor", 0, REG_DWORD
,
3151 (const BYTE
*)&val
, sizeof(DWORD
));
3152 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
3154 /* VersionMinor type is REG_DWORD */
3156 lstrcpyA(buf
, "apple");
3157 r
= MsiGetProductInfoA(prodcode
, INSTALLPROPERTY_VERSIONMINOR
, buf
, &sz
);
3158 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3159 ok(!lstrcmpA(buf
, "42"), "Expected \"42\", got \"%s\"\n", buf
);
3160 ok(sz
== 2, "Expected 2, got %d\n", sz
);
3162 res
= RegSetValueExA(propkey
, "VersionMajor", 0, REG_SZ
, (LPBYTE
)"1", 2);
3163 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
3165 /* VersionMajor value exists */
3167 lstrcpyA(buf
, "apple");
3168 r
= MsiGetProductInfoA(prodcode
, INSTALLPROPERTY_VERSIONMAJOR
, buf
, &sz
);
3169 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3170 ok(!lstrcmpA(buf
, "1"), "Expected \"1\", got \"%s\"\n", buf
);
3171 ok(sz
== 1, "Expected 1, got %d\n", sz
);
3173 res
= RegSetValueExA(propkey
, "VersionMajor", 0, REG_DWORD
,
3174 (const BYTE
*)&val
, sizeof(DWORD
));
3175 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
3177 /* VersionMajor type is REG_DWORD */
3179 lstrcpyA(buf
, "apple");
3180 r
= MsiGetProductInfoA(prodcode
, INSTALLPROPERTY_VERSIONMAJOR
, buf
, &sz
);
3181 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3182 ok(!lstrcmpA(buf
, "42"), "Expected \"42\", got \"%s\"\n", buf
);
3183 ok(sz
== 2, "Expected 2, got %d\n", sz
);
3185 res
= RegSetValueExA(propkey
, "ProductID", 0, REG_SZ
, (LPBYTE
)"id", 3);
3186 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
3188 /* ProductID value exists */
3190 lstrcpyA(buf
, "apple");
3191 r
= MsiGetProductInfoA(prodcode
, INSTALLPROPERTY_PRODUCTID
, buf
, &sz
);
3192 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3193 ok(!lstrcmpA(buf
, "id"), "Expected \"id\", got \"%s\"\n", buf
);
3194 ok(sz
== 2, "Expected 2, got %d\n", sz
);
3196 res
= RegSetValueExA(propkey
, "ProductID", 0, REG_DWORD
,
3197 (const BYTE
*)&val
, sizeof(DWORD
));
3198 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
3200 /* ProductID type is REG_DWORD */
3202 lstrcpyA(buf
, "apple");
3203 r
= MsiGetProductInfoA(prodcode
, INSTALLPROPERTY_PRODUCTID
, buf
, &sz
);
3204 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3205 ok(!lstrcmpA(buf
, "42"), "Expected \"42\", got \"%s\"\n", buf
);
3206 ok(sz
== 2, "Expected 2, got %d\n", sz
);
3208 res
= RegSetValueExA(propkey
, "RegCompany", 0, REG_SZ
, (LPBYTE
)"comp", 5);
3209 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
3211 /* RegCompany value exists */
3213 lstrcpyA(buf
, "apple");
3214 r
= MsiGetProductInfoA(prodcode
, INSTALLPROPERTY_REGCOMPANY
, buf
, &sz
);
3215 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3216 ok(!lstrcmpA(buf
, "comp"), "Expected \"comp\", got \"%s\"\n", buf
);
3217 ok(sz
== 4, "Expected 4, got %d\n", sz
);
3219 res
= RegSetValueExA(propkey
, "RegCompany", 0, REG_DWORD
,
3220 (const BYTE
*)&val
, sizeof(DWORD
));
3221 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
3223 /* RegCompany type is REG_DWORD */
3225 lstrcpyA(buf
, "apple");
3226 r
= MsiGetProductInfoA(prodcode
, INSTALLPROPERTY_REGCOMPANY
, buf
, &sz
);
3227 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3228 ok(!lstrcmpA(buf
, "42"), "Expected \"42\", got \"%s\"\n", buf
);
3229 ok(sz
== 2, "Expected 2, got %d\n", sz
);
3231 res
= RegSetValueExA(propkey
, "RegOwner", 0, REG_SZ
, (LPBYTE
)"own", 4);
3232 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
3234 /* RegOwner value exists */
3236 lstrcpyA(buf
, "apple");
3237 r
= MsiGetProductInfoA(prodcode
, INSTALLPROPERTY_REGOWNER
, buf
, &sz
);
3238 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3239 ok(!lstrcmpA(buf
, "own"), "Expected \"own\", got \"%s\"\n", buf
);
3240 ok(sz
== 3, "Expected 3, got %d\n", sz
);
3242 res
= RegSetValueExA(propkey
, "RegOwner", 0, REG_DWORD
,
3243 (const BYTE
*)&val
, sizeof(DWORD
));
3244 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
3246 /* RegOwner type is REG_DWORD */
3248 lstrcpyA(buf
, "apple");
3249 r
= MsiGetProductInfoA(prodcode
, INSTALLPROPERTY_REGOWNER
, buf
, &sz
);
3250 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3251 ok(!lstrcmpA(buf
, "42"), "Expected \"42\", got \"%s\"\n", buf
);
3252 ok(sz
== 2, "Expected 2, got %d\n", sz
);
3254 res
= RegSetValueExA(propkey
, "InstanceType", 0, REG_SZ
, (LPBYTE
)"type", 5);
3255 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
3257 /* InstanceType value exists */
3259 lstrcpyA(buf
, "apple");
3260 r
= MsiGetProductInfoA(prodcode
, INSTALLPROPERTY_INSTANCETYPE
, buf
, &sz
);
3261 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3262 ok(!lstrcmpA(buf
, ""), "Expected \"\", got \"%s\"\n", buf
);
3263 ok(sz
== 0, "Expected 0, got %d\n", sz
);
3265 res
= RegSetValueExA(propkey
, "InstanceType", 0, REG_DWORD
,
3266 (const BYTE
*)&val
, sizeof(DWORD
));
3267 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
3269 /* InstanceType type is REG_DWORD */
3271 lstrcpyA(buf
, "apple");
3272 r
= MsiGetProductInfoA(prodcode
, INSTALLPROPERTY_INSTANCETYPE
, buf
, &sz
);
3273 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3274 ok(!lstrcmpA(buf
, ""), "Expected \"\", got \"%s\"\n", buf
);
3275 ok(sz
== 0, "Expected 0, got %d\n", sz
);
3277 res
= RegSetValueExA(prodkey
, "InstanceType", 0, REG_SZ
, (LPBYTE
)"type", 5);
3278 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
3280 /* InstanceType value exists */
3282 lstrcpyA(buf
, "apple");
3283 r
= MsiGetProductInfoA(prodcode
, INSTALLPROPERTY_INSTANCETYPE
, buf
, &sz
);
3284 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3285 ok(!lstrcmpA(buf
, "type"), "Expected \"type\", got \"%s\"\n", buf
);
3286 ok(sz
== 4, "Expected 4, got %d\n", sz
);
3288 res
= RegSetValueExA(prodkey
, "InstanceType", 0, REG_DWORD
,
3289 (const BYTE
*)&val
, sizeof(DWORD
));
3290 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
3292 /* InstanceType type is REG_DWORD */
3294 lstrcpyA(buf
, "apple");
3295 r
= MsiGetProductInfoA(prodcode
, INSTALLPROPERTY_INSTANCETYPE
, buf
, &sz
);
3296 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3297 ok(!lstrcmpA(buf
, "42"), "Expected \"42\", got \"%s\"\n", buf
);
3298 ok(sz
== 2, "Expected 2, got %d\n", sz
);
3300 res
= RegSetValueExA(propkey
, "Transforms", 0, REG_SZ
, (LPBYTE
)"tforms", 7);
3301 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
3303 /* Transforms value exists */
3305 lstrcpyA(buf
, "apple");
3306 r
= MsiGetProductInfoA(prodcode
, INSTALLPROPERTY_TRANSFORMS
, buf
, &sz
);
3307 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3308 ok(!lstrcmpA(buf
, ""), "Expected \"\", got \"%s\"\n", buf
);
3309 ok(sz
== 0, "Expected 0, got %d\n", sz
);
3311 res
= RegSetValueExA(propkey
, "Transforms", 0, REG_DWORD
,
3312 (const BYTE
*)&val
, sizeof(DWORD
));
3313 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
3315 /* Transforms type is REG_DWORD */
3317 lstrcpyA(buf
, "apple");
3318 r
= MsiGetProductInfoA(prodcode
, INSTALLPROPERTY_TRANSFORMS
, buf
, &sz
);
3319 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3320 ok(!lstrcmpA(buf
, ""), "Expected \"\", got \"%s\"\n", buf
);
3321 ok(sz
== 0, "Expected 0, got %d\n", sz
);
3323 res
= RegSetValueExA(prodkey
, "Transforms", 0, REG_SZ
, (LPBYTE
)"tforms", 7);
3324 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
3326 /* Transforms value exists */
3328 lstrcpyA(buf
, "apple");
3329 r
= MsiGetProductInfoA(prodcode
, INSTALLPROPERTY_TRANSFORMS
, buf
, &sz
);
3330 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3331 ok(!lstrcmpA(buf
, "tforms"), "Expected \"tforms\", got \"%s\"\n", buf
);
3332 ok(sz
== 6, "Expected 6, got %d\n", sz
);
3334 res
= RegSetValueExA(prodkey
, "Transforms", 0, REG_DWORD
,
3335 (const BYTE
*)&val
, sizeof(DWORD
));
3336 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
3338 /* Transforms type is REG_DWORD */
3340 lstrcpyA(buf
, "apple");
3341 r
= MsiGetProductInfoA(prodcode
, INSTALLPROPERTY_TRANSFORMS
, buf
, &sz
);
3342 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3343 ok(!lstrcmpA(buf
, "42"), "Expected \"42\", got \"%s\"\n", buf
);
3344 ok(sz
== 2, "Expected 2, got %d\n", sz
);
3346 res
= RegSetValueExA(propkey
, "Language", 0, REG_SZ
, (LPBYTE
)"lang", 5);
3347 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
3349 /* Language value exists */
3351 lstrcpyA(buf
, "apple");
3352 r
= MsiGetProductInfoA(prodcode
, INSTALLPROPERTY_LANGUAGE
, buf
, &sz
);
3353 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3354 ok(!lstrcmpA(buf
, ""), "Expected \"\", got \"%s\"\n", buf
);
3355 ok(sz
== 0, "Expected 0, got %d\n", sz
);
3357 res
= RegSetValueExA(propkey
, "Language", 0, REG_DWORD
,
3358 (const BYTE
*)&val
, sizeof(DWORD
));
3359 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
3361 /* Language type is REG_DWORD */
3363 lstrcpyA(buf
, "apple");
3364 r
= MsiGetProductInfoA(prodcode
, INSTALLPROPERTY_LANGUAGE
, buf
, &sz
);
3365 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3366 ok(!lstrcmpA(buf
, ""), "Expected \"\", got \"%s\"\n", buf
);
3367 ok(sz
== 0, "Expected 0, got %d\n", sz
);
3369 res
= RegSetValueExA(prodkey
, "Language", 0, REG_SZ
, (LPBYTE
)"lang", 5);
3370 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
3372 /* Language value exists */
3374 lstrcpyA(buf
, "apple");
3375 r
= MsiGetProductInfoA(prodcode
, INSTALLPROPERTY_LANGUAGE
, buf
, &sz
);
3376 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3377 ok(!lstrcmpA(buf
, "lang"), "Expected \"lang\", got \"%s\"\n", buf
);
3378 ok(sz
== 4, "Expected 4, got %d\n", sz
);
3380 res
= RegSetValueExA(prodkey
, "Language", 0, REG_DWORD
,
3381 (const BYTE
*)&val
, sizeof(DWORD
));
3382 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
3384 /* Language type is REG_DWORD */
3386 lstrcpyA(buf
, "apple");
3387 r
= MsiGetProductInfoA(prodcode
, INSTALLPROPERTY_LANGUAGE
, buf
, &sz
);
3388 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3389 ok(!lstrcmpA(buf
, "42"), "Expected \"42\", got \"%s\"\n", buf
);
3390 ok(sz
== 2, "Expected 2, got %d\n", sz
);
3392 res
= RegSetValueExA(propkey
, "ProductName", 0, REG_SZ
, (LPBYTE
)"name", 5);
3393 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
3395 /* ProductName value exists */
3397 lstrcpyA(buf
, "apple");
3398 r
= MsiGetProductInfoA(prodcode
, INSTALLPROPERTY_PRODUCTNAME
, buf
, &sz
);
3399 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3400 ok(!lstrcmpA(buf
, ""), "Expected \"\", got \"%s\"\n", buf
);
3401 ok(sz
== 0, "Expected 0, got %d\n", sz
);
3403 res
= RegSetValueExA(propkey
, "ProductName", 0, REG_DWORD
,
3404 (const BYTE
*)&val
, sizeof(DWORD
));
3405 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
3407 /* ProductName type is REG_DWORD */
3409 lstrcpyA(buf
, "apple");
3410 r
= MsiGetProductInfoA(prodcode
, INSTALLPROPERTY_PRODUCTNAME
, buf
, &sz
);
3411 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3412 ok(!lstrcmpA(buf
, ""), "Expected \"\", got \"%s\"\n", buf
);
3413 ok(sz
== 0, "Expected 0, got %d\n", sz
);
3415 res
= RegSetValueExA(prodkey
, "ProductName", 0, REG_SZ
, (LPBYTE
)"name", 5);
3416 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
3418 /* ProductName value exists */
3420 lstrcpyA(buf
, "apple");
3421 r
= MsiGetProductInfoA(prodcode
, INSTALLPROPERTY_PRODUCTNAME
, buf
, &sz
);
3422 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3423 ok(!lstrcmpA(buf
, "name"), "Expected \"name\", got \"%s\"\n", buf
);
3424 ok(sz
== 4, "Expected 4, got %d\n", sz
);
3426 res
= RegSetValueExA(prodkey
, "ProductName", 0, REG_DWORD
,
3427 (const BYTE
*)&val
, sizeof(DWORD
));
3428 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
3430 /* ProductName type is REG_DWORD */
3432 lstrcpyA(buf
, "apple");
3433 r
= MsiGetProductInfoA(prodcode
, INSTALLPROPERTY_PRODUCTNAME
, buf
, &sz
);
3434 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3435 ok(!lstrcmpA(buf
, "42"), "Expected \"42\", got \"%s\"\n", buf
);
3436 ok(sz
== 2, "Expected 2, got %d\n", sz
);
3438 res
= RegSetValueExA(propkey
, "Assignment", 0, REG_SZ
, (LPBYTE
)"at", 3);
3439 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
3441 /* Assignment value exists */
3443 lstrcpyA(buf
, "apple");
3444 r
= MsiGetProductInfoA(prodcode
, INSTALLPROPERTY_ASSIGNMENTTYPE
, buf
, &sz
);
3445 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3446 ok(!lstrcmpA(buf
, ""), "Expected \"\", got \"%s\"\n", buf
);
3447 ok(sz
== 0, "Expected 0, got %d\n", sz
);
3449 res
= RegSetValueExA(propkey
, "Assignment", 0, REG_DWORD
,
3450 (const BYTE
*)&val
, sizeof(DWORD
));
3451 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
3453 /* Assignment type is REG_DWORD */
3455 lstrcpyA(buf
, "apple");
3456 r
= MsiGetProductInfoA(prodcode
, INSTALLPROPERTY_ASSIGNMENTTYPE
, buf
, &sz
);
3457 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3458 ok(!lstrcmpA(buf
, ""), "Expected \"\", got \"%s\"\n", buf
);
3459 ok(sz
== 0, "Expected 0, got %d\n", sz
);
3461 res
= RegSetValueExA(prodkey
, "Assignment", 0, REG_SZ
, (LPBYTE
)"at", 3);
3462 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
3464 /* Assignment value exists */
3466 lstrcpyA(buf
, "apple");
3467 r
= MsiGetProductInfoA(prodcode
, INSTALLPROPERTY_ASSIGNMENTTYPE
, buf
, &sz
);
3468 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3469 ok(!lstrcmpA(buf
, "at"), "Expected \"at\", got \"%s\"\n", buf
);
3470 ok(sz
== 2, "Expected 2, got %d\n", sz
);
3472 res
= RegSetValueExA(prodkey
, "Assignment", 0, REG_DWORD
,
3473 (const BYTE
*)&val
, sizeof(DWORD
));
3474 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
3476 /* Assignment type is REG_DWORD */
3478 lstrcpyA(buf
, "apple");
3479 r
= MsiGetProductInfoA(prodcode
, INSTALLPROPERTY_ASSIGNMENTTYPE
, 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
, "PackageCode", 0, REG_SZ
, (LPBYTE
)"code", 5);
3485 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
3487 /* PackageCode value exists */
3489 lstrcpyA(buf
, "apple");
3490 r
= MsiGetProductInfoA(prodcode
, INSTALLPROPERTY_PACKAGECODE
, buf
, &sz
);
3491 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3492 ok(!lstrcmpA(buf
, ""), "Expected \"\", got \"%s\"\n", buf
);
3493 ok(sz
== 0, "Expected 0, got %d\n", sz
);
3495 res
= RegSetValueExA(propkey
, "PackageCode", 0, REG_DWORD
,
3496 (const BYTE
*)&val
, sizeof(DWORD
));
3497 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
3499 /* PackageCode type is REG_DWORD */
3501 lstrcpyA(buf
, "apple");
3502 r
= MsiGetProductInfoA(prodcode
, INSTALLPROPERTY_PACKAGECODE
, buf
, &sz
);
3503 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3504 ok(!lstrcmpA(buf
, ""), "Expected \"\", got \"%s\"\n", buf
);
3505 ok(sz
== 0, "Expected 0, got %d\n", sz
);
3507 res
= RegSetValueExA(prodkey
, "PackageCode", 0, REG_SZ
, (LPBYTE
)"code", 5);
3508 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
3510 /* PackageCode value exists */
3512 lstrcpyA(buf
, "apple");
3513 r
= MsiGetProductInfoA(prodcode
, INSTALLPROPERTY_PACKAGECODE
, buf
, &sz
);
3514 ok(r
== ERROR_BAD_CONFIGURATION
,
3515 "Expected ERROR_BAD_CONFIGURATION, got %d\n", r
);
3516 ok(!lstrcmpA(buf
, "code"), "Expected \"code\", got \"%s\"\n", buf
);
3517 ok(sz
== MAX_PATH
, "Expected MAX_PATH, got %d\n", sz
);
3519 res
= RegSetValueExA(prodkey
, "PackageCode", 0, REG_DWORD
,
3520 (const BYTE
*)&val
, sizeof(DWORD
));
3521 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
3523 /* PackageCode type is REG_DWORD */
3525 lstrcpyA(buf
, "apple");
3526 r
= MsiGetProductInfoA(prodcode
, INSTALLPROPERTY_PACKAGECODE
, buf
, &sz
);
3527 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3528 ok(!lstrcmpA(buf
, "42"), "Expected \"42\", got \"%s\"\n", buf
);
3529 ok(sz
== 2, "Expected 2, got %d\n", sz
);
3531 res
= RegSetValueExA(prodkey
, "PackageCode", 0, REG_SZ
, (LPBYTE
)pack_squashed
, 33);
3532 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
3534 /* PackageCode value exists */
3536 lstrcpyA(buf
, "apple");
3537 r
= MsiGetProductInfoA(prodcode
, INSTALLPROPERTY_PACKAGECODE
, buf
, &sz
);
3538 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3539 ok(!lstrcmpA(buf
, packcode
), "Expected \"%s\", got \"%s\"\n", packcode
, buf
);
3540 ok(sz
== 38, "Expected 38, got %d\n", sz
);
3542 res
= RegSetValueExA(propkey
, "Version", 0, REG_SZ
, (LPBYTE
)"ver", 4);
3543 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
3545 /* Version value exists */
3547 lstrcpyA(buf
, "apple");
3548 r
= MsiGetProductInfoA(prodcode
, INSTALLPROPERTY_VERSION
, buf
, &sz
);
3549 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3550 ok(!lstrcmpA(buf
, ""), "Expected \"\", got \"%s\"\n", buf
);
3551 ok(sz
== 0, "Expected 0, got %d\n", sz
);
3553 res
= RegSetValueExA(propkey
, "Version", 0, REG_DWORD
,
3554 (const BYTE
*)&val
, sizeof(DWORD
));
3555 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
3557 /* Version type is REG_DWORD */
3559 lstrcpyA(buf
, "apple");
3560 r
= MsiGetProductInfoA(prodcode
, INSTALLPROPERTY_VERSION
, buf
, &sz
);
3561 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3562 ok(!lstrcmpA(buf
, ""), "Expected \"\", got \"%s\"\n", buf
);
3563 ok(sz
== 0, "Expected 0, got %d\n", sz
);
3565 res
= RegSetValueExA(prodkey
, "Version", 0, REG_SZ
, (LPBYTE
)"ver", 4);
3566 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
3568 /* Version value exists */
3570 lstrcpyA(buf
, "apple");
3571 r
= MsiGetProductInfoA(prodcode
, INSTALLPROPERTY_VERSION
, buf
, &sz
);
3572 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3573 ok(!lstrcmpA(buf
, "ver"), "Expected \"ver\", got \"%s\"\n", buf
);
3574 ok(sz
== 3, "Expected 3, got %d\n", sz
);
3576 res
= RegSetValueExA(prodkey
, "Version", 0, REG_DWORD
,
3577 (const BYTE
*)&val
, sizeof(DWORD
));
3578 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
3580 /* Version type is REG_DWORD */
3582 lstrcpyA(buf
, "apple");
3583 r
= MsiGetProductInfoA(prodcode
, INSTALLPROPERTY_VERSION
, buf
, &sz
);
3584 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3585 ok(!lstrcmpA(buf
, "42"), "Expected \"42\", got \"%s\"\n", buf
);
3586 ok(sz
== 2, "Expected 2, got %d\n", sz
);
3588 res
= RegSetValueExA(propkey
, "ProductIcon", 0, REG_SZ
, (LPBYTE
)"ico", 4);
3589 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
3591 /* ProductIcon value exists */
3593 lstrcpyA(buf
, "apple");
3594 r
= MsiGetProductInfoA(prodcode
, INSTALLPROPERTY_PRODUCTICON
, buf
, &sz
);
3595 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3596 ok(!lstrcmpA(buf
, ""), "Expected \"\", got \"%s\"\n", buf
);
3597 ok(sz
== 0, "Expected 0, got %d\n", sz
);
3599 res
= RegSetValueExA(propkey
, "ProductIcon", 0, REG_DWORD
,
3600 (const BYTE
*)&val
, sizeof(DWORD
));
3601 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
3603 /* ProductIcon type is REG_DWORD */
3605 lstrcpyA(buf
, "apple");
3606 r
= MsiGetProductInfoA(prodcode
, INSTALLPROPERTY_PRODUCTICON
, buf
, &sz
);
3607 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3608 ok(!lstrcmpA(buf
, ""), "Expected \"\", got \"%s\"\n", buf
);
3609 ok(sz
== 0, "Expected 0, got %d\n", sz
);
3611 res
= RegSetValueExA(prodkey
, "ProductIcon", 0, REG_SZ
, (LPBYTE
)"ico", 4);
3612 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
3614 /* ProductIcon value exists */
3616 lstrcpyA(buf
, "apple");
3617 r
= MsiGetProductInfoA(prodcode
, INSTALLPROPERTY_PRODUCTICON
, buf
, &sz
);
3618 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3619 ok(!lstrcmpA(buf
, "ico"), "Expected \"ico\", got \"%s\"\n", buf
);
3620 ok(sz
== 3, "Expected 3, got %d\n", sz
);
3622 res
= RegSetValueExA(prodkey
, "ProductIcon", 0, REG_DWORD
,
3623 (const BYTE
*)&val
, sizeof(DWORD
));
3624 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
3626 /* ProductIcon type is REG_DWORD */
3628 lstrcpyA(buf
, "apple");
3629 r
= MsiGetProductInfoA(prodcode
, INSTALLPROPERTY_PRODUCTICON
, buf
, &sz
);
3630 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3631 ok(!lstrcmpA(buf
, "42"), "Expected \"42\", got \"%s\"\n", buf
);
3632 ok(sz
== 2, "Expected 2, got %d\n", sz
);
3634 res
= RegCreateKeyA(prodkey
, "SourceList", &source
);
3635 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
3637 res
= RegSetValueExA(source
, "PackageName", 0, REG_SZ
, (LPBYTE
)"packname", 9);
3638 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
3641 lstrcpyA(buf
, "apple");
3642 r
= MsiGetProductInfoA(prodcode
, INSTALLPROPERTY_PACKAGENAME
, buf
, &sz
);
3643 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3644 ok(!lstrcmpA(buf
, "packname"), "Expected \"packname\", got \"%s\"\n", buf
);
3645 ok(sz
== 8, "Expected 8, got %d\n", sz
);
3647 res
= RegSetValueExA(source
, "PackageName", 0, REG_DWORD
,
3648 (const BYTE
*)&val
, sizeof(DWORD
));
3649 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
3651 /* PackageName type is REG_DWORD */
3653 lstrcpyA(buf
, "apple");
3654 r
= MsiGetProductInfoA(prodcode
, INSTALLPROPERTY_PACKAGENAME
, buf
, &sz
);
3655 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3656 ok(!lstrcmpA(buf
, "42"), "Expected \"42\", got \"%s\"\n", buf
);
3657 ok(sz
== 2, "Expected 2, got %d\n", sz
);
3659 res
= RegSetValueExA(propkey
, "AuthorizedLUAApp", 0, REG_SZ
, (LPBYTE
)"auth", 5);
3660 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
3662 /* Authorized value exists */
3664 lstrcpyA(buf
, "apple");
3665 r
= MsiGetProductInfoA(prodcode
, INSTALLPROPERTY_AUTHORIZED_LUA_APP
, buf
, &sz
);
3666 if (r
!= ERROR_UNKNOWN_PROPERTY
)
3668 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3669 ok(!lstrcmpA(buf
, ""), "Expected \"\", got \"%s\"\n", buf
);
3670 ok(sz
== 0, "Expected 0, got %d\n", sz
);
3673 res
= RegSetValueExA(propkey
, "AuthorizedLUAApp", 0, REG_DWORD
,
3674 (const BYTE
*)&val
, sizeof(DWORD
));
3675 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
3677 /* AuthorizedLUAApp type is REG_DWORD */
3679 lstrcpyA(buf
, "apple");
3680 r
= MsiGetProductInfoA(prodcode
, INSTALLPROPERTY_AUTHORIZED_LUA_APP
, buf
, &sz
);
3681 if (r
!= ERROR_UNKNOWN_PROPERTY
)
3683 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3684 ok(!lstrcmpA(buf
, ""), "Expected \"\", got \"%s\"\n", buf
);
3685 ok(sz
== 0, "Expected 0, got %d\n", sz
);
3688 res
= RegSetValueExA(prodkey
, "AuthorizedLUAApp", 0, REG_SZ
, (LPBYTE
)"auth", 5);
3689 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
3691 /* Authorized value exists */
3693 lstrcpyA(buf
, "apple");
3694 r
= MsiGetProductInfoA(prodcode
, INSTALLPROPERTY_AUTHORIZED_LUA_APP
, buf
, &sz
);
3695 if (r
!= ERROR_UNKNOWN_PROPERTY
)
3697 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3698 ok(!lstrcmpA(buf
, "auth"), "Expected \"auth\", got \"%s\"\n", buf
);
3699 ok(sz
== 4, "Expected 4, got %d\n", sz
);
3702 res
= RegSetValueExA(prodkey
, "AuthorizedLUAApp", 0, REG_DWORD
,
3703 (const BYTE
*)&val
, sizeof(DWORD
));
3704 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
3706 /* AuthorizedLUAApp type is REG_DWORD */
3708 lstrcpyA(buf
, "apple");
3709 r
= MsiGetProductInfoA(prodcode
, INSTALLPROPERTY_AUTHORIZED_LUA_APP
, buf
, &sz
);
3710 if (r
!= ERROR_UNKNOWN_PROPERTY
)
3712 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3713 ok(!lstrcmpA(buf
, "42"), "Expected \"42\", got \"%s\"\n", buf
);
3714 ok(sz
== 2, "Expected 2, got %d\n", sz
);
3717 RegDeleteValueA(propkey
, "HelpLink");
3718 RegDeleteValueA(propkey
, "DisplayName");
3719 RegDeleteValueA(propkey
, "DisplayVersion");
3720 RegDeleteValueA(propkey
, "HelpTelephone");
3721 RegDeleteValueA(propkey
, "InstallLocation");
3722 RegDeleteValueA(propkey
, "InstallSource");
3723 RegDeleteValueA(propkey
, "InstallDate");
3724 RegDeleteValueA(propkey
, "Publisher");
3725 RegDeleteValueA(propkey
, "LocalPackage");
3726 RegDeleteValueA(propkey
, "UrlInfoAbout");
3727 RegDeleteValueA(propkey
, "UrlUpdateInfo");
3728 RegDeleteValueA(propkey
, "VersionMinor");
3729 RegDeleteValueA(propkey
, "VersionMajor");
3730 RegDeleteValueA(propkey
, "ProductID");
3731 RegDeleteValueA(propkey
, "RegCompany");
3732 RegDeleteValueA(propkey
, "RegOwner");
3733 RegDeleteValueA(propkey
, "InstanceType");
3734 RegDeleteValueA(propkey
, "Transforms");
3735 RegDeleteValueA(propkey
, "Language");
3736 RegDeleteValueA(propkey
, "ProductName");
3737 RegDeleteValueA(propkey
, "Assignment");
3738 RegDeleteValueA(propkey
, "PackageCode");
3739 RegDeleteValueA(propkey
, "Version");
3740 RegDeleteValueA(propkey
, "ProductIcon");
3741 RegDeleteValueA(propkey
, "AuthorizedLUAApp");
3742 RegDeleteKeyA(propkey
, "");
3743 RegDeleteKeyA(localkey
, "");
3744 RegDeleteValueA(prodkey
, "InstanceType");
3745 RegDeleteValueA(prodkey
, "Transforms");
3746 RegDeleteValueA(prodkey
, "Language");
3747 RegDeleteValueA(prodkey
, "ProductName");
3748 RegDeleteValueA(prodkey
, "Assignment");
3749 RegDeleteValueA(prodkey
, "PackageCode");
3750 RegDeleteValueA(prodkey
, "Version");
3751 RegDeleteValueA(prodkey
, "ProductIcon");
3752 RegDeleteValueA(prodkey
, "AuthorizedLUAApp");
3753 RegDeleteValueA(source
, "PackageName");
3754 RegDeleteKeyA(source
, "");
3755 RegDeleteKeyA(prodkey
, "");
3756 RegCloseKey(propkey
);
3757 RegCloseKey(localkey
);
3758 RegCloseKey(source
);
3759 RegCloseKey(prodkey
);
3762 static void test_MsiGetProductInfoEx(void)
3766 HKEY propkey
, userkey
;
3767 HKEY prodkey
, localkey
;
3768 CHAR prodcode
[MAX_PATH
];
3769 CHAR prod_squashed
[MAX_PATH
];
3770 CHAR packcode
[MAX_PATH
];
3771 CHAR pack_squashed
[MAX_PATH
];
3773 CHAR keypath
[MAX_PATH
];
3777 if (!pMsiGetProductInfoExA
)
3779 skip("MsiGetProductInfoExA is not available\n");
3783 create_test_guid(prodcode
, prod_squashed
);
3784 create_test_guid(packcode
, pack_squashed
);
3785 get_user_sid(&usersid
);
3787 /* NULL szProductCode */
3789 lstrcpyA(buf
, "apple");
3790 r
= pMsiGetProductInfoExA(NULL
, usersid
, MSIINSTALLCONTEXT_USERUNMANAGED
,
3791 INSTALLPROPERTY_PRODUCTSTATE
, buf
, &sz
);
3792 ok(r
== ERROR_INVALID_PARAMETER
,
3793 "Expected ERROR_INVALID_PARAMETER, got %d\n", r
);
3794 ok(!lstrcmpA(buf
, "apple"), "Expected buf to be unchanged, got %s\n", buf
);
3795 ok(sz
== MAX_PATH
, "Expected MAX_PATH, got %d\n", sz
);
3797 /* empty szProductCode */
3799 lstrcpyA(buf
, "apple");
3800 r
= pMsiGetProductInfoExA("", usersid
, MSIINSTALLCONTEXT_USERUNMANAGED
,
3801 INSTALLPROPERTY_PRODUCTSTATE
, buf
, &sz
);
3802 ok(r
== ERROR_INVALID_PARAMETER
,
3803 "Expected ERROR_INVALID_PARAMETER, got %d\n", r
);
3804 ok(!lstrcmpA(buf
, "apple"), "Expected buf to be unchanged, got %s\n", buf
);
3805 ok(sz
== MAX_PATH
, "Expected MAX_PATH, got %d\n", sz
);
3807 /* garbage szProductCode */
3809 lstrcpyA(buf
, "apple");
3810 r
= pMsiGetProductInfoExA("garbage", usersid
, MSIINSTALLCONTEXT_USERUNMANAGED
,
3811 INSTALLPROPERTY_PRODUCTSTATE
, buf
, &sz
);
3812 ok(r
== ERROR_INVALID_PARAMETER
,
3813 "Expected ERROR_INVALID_PARAMETER, got %d\n", r
);
3814 ok(!lstrcmpA(buf
, "apple"), "Expected buf to be unchanged, got %s\n", buf
);
3815 ok(sz
== MAX_PATH
, "Expected MAX_PATH, got %d\n", sz
);
3817 /* guid without brackets */
3819 lstrcpyA(buf
, "apple");
3820 r
= pMsiGetProductInfoExA("6700E8CF-95AB-4D9C-BC2C-15840DEA7A5D", usersid
,
3821 MSIINSTALLCONTEXT_USERUNMANAGED
,
3822 INSTALLPROPERTY_PRODUCTSTATE
, buf
, &sz
);
3823 ok(r
== ERROR_INVALID_PARAMETER
,
3824 "Expected ERROR_INVALID_PARAMETER, got %d\n", r
);
3825 ok(!lstrcmpA(buf
, "apple"), "Expected buf to be unchanged, got %s\n", buf
);
3826 ok(sz
== MAX_PATH
, "Expected MAX_PATH, got %d\n", sz
);
3828 /* guid with brackets */
3830 lstrcpyA(buf
, "apple");
3831 r
= pMsiGetProductInfoExA("{6700E8CF-95AB-4D9C-BC2C-15840DEA7A5D}", usersid
,
3832 MSIINSTALLCONTEXT_USERUNMANAGED
,
3833 INSTALLPROPERTY_PRODUCTSTATE
, buf
, &sz
);
3834 ok(r
== ERROR_UNKNOWN_PRODUCT
,
3835 "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r
);
3836 ok(!lstrcmpA(buf
, "apple"), "Expected buf to be unchanged, got %s\n", buf
);
3837 ok(sz
== MAX_PATH
, "Expected MAX_PATH, got %d\n", sz
);
3839 /* szValue is non-NULL while pcchValue is NULL */
3840 lstrcpyA(buf
, "apple");
3841 r
= pMsiGetProductInfoExA(prodcode
, usersid
,
3842 MSIINSTALLCONTEXT_USERUNMANAGED
,
3843 INSTALLPROPERTY_PRODUCTSTATE
, buf
, NULL
);
3844 ok(r
== ERROR_INVALID_PARAMETER
,
3845 "Expected ERROR_INVALID_PARAMETER, got %d\n", r
);
3846 ok(!lstrcmpA(buf
, "apple"), "Expected buf to be unchanged, got %s\n", buf
);
3848 /* dwContext is out of range */
3850 lstrcpyA(buf
, "apple");
3851 r
= pMsiGetProductInfoExA(prodcode
, usersid
, 42,
3852 INSTALLPROPERTY_PRODUCTSTATE
, buf
, &sz
);
3853 ok(r
== ERROR_INVALID_PARAMETER
,
3854 "Expected ERROR_INVALID_PARAMETER, got %d\n", r
);
3855 ok(!lstrcmpA(buf
, "apple"), "Expected buf to be unchanged, got %s\n", buf
);
3856 ok(sz
== MAX_PATH
, "Expected MAX_PATH, got %d\n", sz
);
3858 /* szProperty is NULL */
3860 lstrcpyA(buf
, "apple");
3861 r
= pMsiGetProductInfoExA(prodcode
, usersid
,
3862 MSIINSTALLCONTEXT_USERUNMANAGED
,
3864 ok(r
== ERROR_INVALID_PARAMETER
,
3865 "Expected ERROR_INVALID_PARAMETER, got %d\n", r
);
3866 ok(!lstrcmpA(buf
, "apple"), "Expected buf to be unchanged, got %s\n", buf
);
3867 ok(sz
== MAX_PATH
, "Expected MAX_PATH, got %d\n", sz
);
3869 /* szProperty is empty */
3871 lstrcpyA(buf
, "apple");
3872 r
= pMsiGetProductInfoExA(prodcode
, usersid
,
3873 MSIINSTALLCONTEXT_USERUNMANAGED
,
3875 ok(r
== ERROR_INVALID_PARAMETER
,
3876 "Expected ERROR_INVALID_PARAMETER, got %d\n", r
);
3877 ok(!lstrcmpA(buf
, "apple"), "Expected buf to be unchanged, got %s\n", buf
);
3878 ok(sz
== MAX_PATH
, "Expected MAX_PATH, got %d\n", sz
);
3880 /* szProperty is not a valid property */
3882 lstrcpyA(buf
, "apple");
3883 r
= pMsiGetProductInfoExA(prodcode
, usersid
,
3884 MSIINSTALLCONTEXT_USERUNMANAGED
,
3885 "notvalid", buf
, &sz
);
3886 ok(r
== ERROR_UNKNOWN_PRODUCT
,
3887 "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r
);
3888 ok(!lstrcmpA(buf
, "apple"), "Expected buf to be unchanged, got %s\n", buf
);
3889 ok(sz
== MAX_PATH
, "Expected MAX_PATH, got %d\n", sz
);
3891 /* same length as guid, but random */
3893 lstrcpyA(buf
, "apple");
3894 r
= pMsiGetProductInfoExA("A938G02JF-2NF3N93-VN3-2NNF-3KGKALDNF93", usersid
,
3895 MSIINSTALLCONTEXT_USERUNMANAGED
,
3896 INSTALLPROPERTY_PRODUCTSTATE
, buf
, &sz
);
3897 ok(r
== ERROR_INVALID_PARAMETER
,
3898 "Expected ERROR_INVALID_PARAMETER, got %d\n", r
);
3899 ok(!lstrcmpA(buf
, "apple"), "Expected buf to be unchanged, got %s\n", buf
);
3900 ok(sz
== MAX_PATH
, "Expected MAX_PATH, got %d\n", sz
);
3902 /* MSIINSTALLCONTEXT_USERUNMANAGED */
3904 lstrcpyA(keypath
, "Software\\Microsoft\\Windows\\CurrentVersion\\Installer\\UserData\\");
3905 lstrcatA(keypath
, usersid
);
3906 lstrcatA(keypath
, "\\Products\\");
3907 lstrcatA(keypath
, prod_squashed
);
3909 res
= RegCreateKeyA(HKEY_LOCAL_MACHINE
, keypath
, &localkey
);
3910 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
3912 /* local user product key exists */
3914 lstrcpyA(buf
, "apple");
3915 r
= pMsiGetProductInfoExA(prodcode
, usersid
,
3916 MSIINSTALLCONTEXT_USERUNMANAGED
,
3917 INSTALLPROPERTY_PRODUCTSTATE
, buf
, &sz
);
3918 ok(r
== ERROR_UNKNOWN_PRODUCT
,
3919 "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r
);
3920 ok(!lstrcmpA(buf
, "apple"), "Expected buf to be unchanged, got %s\n", buf
);
3921 ok(sz
== MAX_PATH
, "Expected MAX_PATH, got %d\n", sz
);
3923 res
= RegCreateKeyA(localkey
, "InstallProperties", &propkey
);
3924 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
3926 /* InstallProperties key exists */
3928 lstrcpyA(buf
, "apple");
3929 r
= pMsiGetProductInfoExA(prodcode
, usersid
,
3930 MSIINSTALLCONTEXT_USERUNMANAGED
,
3931 INSTALLPROPERTY_PRODUCTSTATE
, buf
, &sz
);
3932 ok(r
== ERROR_UNKNOWN_PRODUCT
,
3933 "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r
);
3934 ok(!lstrcmpA(buf
, "apple"), "Expected buf to be unchanged, got %s\n", buf
);
3935 ok(sz
== MAX_PATH
, "Expected MAX_PATH, 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_PRODUCTSTATE
, buf
, &sz
);
3946 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3947 ok(!lstrcmpA(buf
, "5"), "Expected \"5\", got \"%s\"\n", buf
);
3948 ok(sz
== 1, "Expected 1, got %d\n", sz
);
3950 RegDeleteValueA(propkey
, "LocalPackage");
3952 /* LocalPackage value must exist */
3954 lstrcpyA(buf
, "apple");
3955 r
= pMsiGetProductInfoExA(prodcode
, usersid
,
3956 MSIINSTALLCONTEXT_USERUNMANAGED
,
3957 INSTALLPROPERTY_HELPLINK
, buf
, &sz
);
3958 ok(r
== ERROR_UNKNOWN_PRODUCT
,
3959 "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r
);
3960 ok(!lstrcmpA(buf
, "apple"), "Expected buf to be unchanged, got %s\n", buf
);
3961 ok(sz
== MAX_PATH
, "Expected MAX_PATH, got %d\n", sz
);
3963 res
= RegSetValueExA(propkey
, "LocalPackage", 0, REG_SZ
, (LPBYTE
)"local", 6);
3964 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
3966 /* LocalPackage exists, but HelpLink does not exist */
3968 lstrcpyA(buf
, "apple");
3969 r
= pMsiGetProductInfoExA(prodcode
, usersid
,
3970 MSIINSTALLCONTEXT_USERUNMANAGED
,
3971 INSTALLPROPERTY_HELPLINK
, buf
, &sz
);
3972 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3973 ok(!lstrcmpA(buf
, ""), "Expected \"\", got \"%s\"\n", buf
);
3974 ok(sz
== 0, "Expected 0, got %d\n", sz
);
3976 res
= RegSetValueExA(propkey
, "HelpLink", 0, REG_SZ
, (LPBYTE
)"link", 5);
3977 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
3979 /* HelpLink value exists */
3981 lstrcpyA(buf
, "apple");
3982 r
= pMsiGetProductInfoExA(prodcode
, usersid
,
3983 MSIINSTALLCONTEXT_USERUNMANAGED
,
3984 INSTALLPROPERTY_HELPLINK
, buf
, &sz
);
3985 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3986 ok(!lstrcmpA(buf
, "link"), "Expected \"link\", got \"%s\"\n", buf
);
3987 ok(sz
== 4, "Expected 4, got %d\n", sz
);
3989 res
= RegSetValueExA(propkey
, "HelpTelephone", 0, REG_SZ
, (LPBYTE
)"phone", 6);
3990 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
3992 /* HelpTelephone value exists */
3994 lstrcpyA(buf
, "apple");
3995 r
= pMsiGetProductInfoExA(prodcode
, usersid
,
3996 MSIINSTALLCONTEXT_USERUNMANAGED
,
3997 INSTALLPROPERTY_HELPTELEPHONE
, buf
, &sz
);
3998 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3999 ok(!lstrcmpA(buf
, "phone"), "Expected \"phone\", got \"%s\"\n", buf
);
4000 ok(sz
== 5, "Expected 5, got %d\n", sz
);
4002 /* szValue and pcchValue are NULL */
4003 r
= pMsiGetProductInfoExA(prodcode
, usersid
,
4004 MSIINSTALLCONTEXT_USERUNMANAGED
,
4005 INSTALLPROPERTY_HELPTELEPHONE
, NULL
, NULL
);
4006 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
4008 /* pcchValue is exactly 5 */
4010 lstrcpyA(buf
, "apple");
4011 r
= pMsiGetProductInfoExA(prodcode
, usersid
,
4012 MSIINSTALLCONTEXT_USERUNMANAGED
,
4013 INSTALLPROPERTY_HELPTELEPHONE
, buf
, &sz
);
4014 ok(r
== ERROR_MORE_DATA
,
4015 "Expected ERROR_MORE_DATA, got %d\n", r
);
4016 ok(!lstrcmpA(buf
, ""), "Expected \"\", got \"%s\"\n", buf
);
4017 ok(sz
== 10, "Expected 10, got %d\n", sz
);
4019 /* szValue is NULL, pcchValue is exactly 5 */
4021 r
= pMsiGetProductInfoExA(prodcode
, usersid
,
4022 MSIINSTALLCONTEXT_USERUNMANAGED
,
4023 INSTALLPROPERTY_HELPTELEPHONE
, NULL
, &sz
);
4024 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
4025 ok(sz
== 10, "Expected 10, got %d\n", sz
);
4027 /* szValue is NULL, pcchValue is MAX_PATH */
4029 r
= pMsiGetProductInfoExA(prodcode
, usersid
,
4030 MSIINSTALLCONTEXT_USERUNMANAGED
,
4031 INSTALLPROPERTY_HELPTELEPHONE
, NULL
, &sz
);
4032 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
4033 ok(sz
== 10, "Expected 10, got %d\n", sz
);
4035 /* pcchValue is exactly 0 */
4037 lstrcpyA(buf
, "apple");
4038 r
= pMsiGetProductInfoExA(prodcode
, usersid
,
4039 MSIINSTALLCONTEXT_USERUNMANAGED
,
4040 INSTALLPROPERTY_HELPTELEPHONE
, buf
, &sz
);
4041 ok(r
== ERROR_MORE_DATA
,
4042 "Expected ERROR_MORE_DATA, got %d\n", r
);
4043 ok(!lstrcmpA(buf
, "apple"), "Expected \"apple\", got \"%s\"\n", buf
);
4044 ok(sz
== 10, "Expected 10, got %d\n", sz
);
4046 res
= RegSetValueExA(propkey
, "notvalid", 0, REG_SZ
, (LPBYTE
)"invalid", 8);
4047 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
4049 /* szProperty is not a valid property */
4051 lstrcpyA(buf
, "apple");
4052 r
= pMsiGetProductInfoExA(prodcode
, usersid
,
4053 MSIINSTALLCONTEXT_USERUNMANAGED
,
4054 "notvalid", buf
, &sz
);
4055 ok(r
== ERROR_UNKNOWN_PROPERTY
,
4056 "Expected ERROR_UNKNOWN_PROPERTY, got %d\n", r
);
4057 ok(!lstrcmpA(buf
, "apple"), "Expected buf to be unchanged, got %s\n", buf
);
4058 ok(sz
== MAX_PATH
, "Expected MAX_PATH, got %d\n", sz
);
4060 res
= RegSetValueExA(propkey
, "InstallDate", 0, REG_SZ
, (LPBYTE
)"date", 5);
4061 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
4063 /* InstallDate value exists */
4065 lstrcpyA(buf
, "apple");
4066 r
= pMsiGetProductInfoExA(prodcode
, usersid
,
4067 MSIINSTALLCONTEXT_USERUNMANAGED
,
4068 INSTALLPROPERTY_INSTALLDATE
, buf
, &sz
);
4069 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
4070 ok(!lstrcmpA(buf
, "date"), "Expected \"date\", got \"%s\"\n", buf
);
4071 ok(sz
== 4, "Expected 4, got %d\n", sz
);
4073 res
= RegSetValueExA(propkey
, "DisplayName", 0, REG_SZ
, (LPBYTE
)"name", 5);
4074 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
4076 /* DisplayName value exists */
4078 lstrcpyA(buf
, "apple");
4079 r
= pMsiGetProductInfoExA(prodcode
, usersid
,
4080 MSIINSTALLCONTEXT_USERUNMANAGED
,
4081 INSTALLPROPERTY_INSTALLEDPRODUCTNAME
, buf
, &sz
);
4082 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
4083 ok(!lstrcmpA(buf
, "name"), "Expected \"name\", got \"%s\"\n", buf
);
4084 ok(sz
== 4, "Expected 4, got %d\n", sz
);
4086 res
= RegSetValueExA(propkey
, "InstallLocation", 0, REG_SZ
, (LPBYTE
)"loc", 4);
4087 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
4089 /* InstallLocation value exists */
4091 lstrcpyA(buf
, "apple");
4092 r
= pMsiGetProductInfoExA(prodcode
, usersid
,
4093 MSIINSTALLCONTEXT_USERUNMANAGED
,
4094 INSTALLPROPERTY_INSTALLLOCATION
, buf
, &sz
);
4095 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
4096 ok(!lstrcmpA(buf
, "loc"), "Expected \"loc\", got \"%s\"\n", buf
);
4097 ok(sz
== 3, "Expected 3, got %d\n", sz
);
4099 res
= RegSetValueExA(propkey
, "InstallSource", 0, REG_SZ
, (LPBYTE
)"source", 7);
4100 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
4102 /* InstallSource value exists */
4104 lstrcpyA(buf
, "apple");
4105 r
= pMsiGetProductInfoExA(prodcode
, usersid
,
4106 MSIINSTALLCONTEXT_USERUNMANAGED
,
4107 INSTALLPROPERTY_INSTALLSOURCE
, buf
, &sz
);
4108 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
4109 ok(!lstrcmpA(buf
, "source"), "Expected \"source\", got \"%s\"\n", buf
);
4110 ok(sz
== 6, "Expected 6, got %d\n", sz
);
4112 res
= RegSetValueExA(propkey
, "LocalPackage", 0, REG_SZ
, (LPBYTE
)"local", 6);
4113 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
4115 /* LocalPackage value exists */
4117 lstrcpyA(buf
, "apple");
4118 r
= pMsiGetProductInfoExA(prodcode
, usersid
,
4119 MSIINSTALLCONTEXT_USERUNMANAGED
,
4120 INSTALLPROPERTY_LOCALPACKAGE
, buf
, &sz
);
4121 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
4122 ok(!lstrcmpA(buf
, "local"), "Expected \"local\", got \"%s\"\n", buf
);
4123 ok(sz
== 5, "Expected 5, got %d\n", sz
);
4125 res
= RegSetValueExA(propkey
, "Publisher", 0, REG_SZ
, (LPBYTE
)"pub", 4);
4126 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
4128 /* Publisher value exists */
4130 lstrcpyA(buf
, "apple");
4131 r
= pMsiGetProductInfoExA(prodcode
, usersid
,
4132 MSIINSTALLCONTEXT_USERUNMANAGED
,
4133 INSTALLPROPERTY_PUBLISHER
, buf
, &sz
);
4134 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
4135 ok(!lstrcmpA(buf
, "pub"), "Expected \"pub\", got \"%s\"\n", buf
);
4136 ok(sz
== 3, "Expected 3, got %d\n", sz
);
4138 res
= RegSetValueExA(propkey
, "URLInfoAbout", 0, REG_SZ
, (LPBYTE
)"about", 6);
4139 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
4141 /* URLInfoAbout value exists */
4143 lstrcpyA(buf
, "apple");
4144 r
= pMsiGetProductInfoExA(prodcode
, usersid
,
4145 MSIINSTALLCONTEXT_USERUNMANAGED
,
4146 INSTALLPROPERTY_URLINFOABOUT
, buf
, &sz
);
4147 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
4148 ok(!lstrcmpA(buf
, "about"), "Expected \"about\", got \"%s\"\n", buf
);
4149 ok(sz
== 5, "Expected 5, got %d\n", sz
);
4151 res
= RegSetValueExA(propkey
, "URLUpdateInfo", 0, REG_SZ
, (LPBYTE
)"update", 7);
4152 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
4154 /* URLUpdateInfo value exists */
4156 lstrcpyA(buf
, "apple");
4157 r
= pMsiGetProductInfoExA(prodcode
, usersid
,
4158 MSIINSTALLCONTEXT_USERUNMANAGED
,
4159 INSTALLPROPERTY_URLUPDATEINFO
, buf
, &sz
);
4160 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
4161 ok(!lstrcmpA(buf
, "update"), "Expected \"update\", got \"%s\"\n", buf
);
4162 ok(sz
== 6, "Expected 6, got %d\n", sz
);
4164 res
= RegSetValueExA(propkey
, "VersionMinor", 0, REG_SZ
, (LPBYTE
)"2", 2);
4165 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
4167 /* VersionMinor value exists */
4169 lstrcpyA(buf
, "apple");
4170 r
= pMsiGetProductInfoExA(prodcode
, usersid
,
4171 MSIINSTALLCONTEXT_USERUNMANAGED
,
4172 INSTALLPROPERTY_VERSIONMINOR
, buf
, &sz
);
4173 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
4174 ok(!lstrcmpA(buf
, "2"), "Expected \"2\", got \"%s\"\n", buf
);
4175 ok(sz
== 1, "Expected 1, got %d\n", sz
);
4177 res
= RegSetValueExA(propkey
, "VersionMajor", 0, REG_SZ
, (LPBYTE
)"3", 2);
4178 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
4180 /* VersionMajor value exists */
4182 lstrcpyA(buf
, "apple");
4183 r
= pMsiGetProductInfoExA(prodcode
, usersid
,
4184 MSIINSTALLCONTEXT_USERUNMANAGED
,
4185 INSTALLPROPERTY_VERSIONMAJOR
, buf
, &sz
);
4186 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
4187 ok(!lstrcmpA(buf
, "3"), "Expected \"3\", got \"%s\"\n", buf
);
4188 ok(sz
== 1, "Expected 1, got %d\n", sz
);
4190 res
= RegSetValueExA(propkey
, "DisplayVersion", 0, REG_SZ
, (LPBYTE
)"3.2.1", 6);
4191 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
4193 /* DisplayVersion value exists */
4195 lstrcpyA(buf
, "apple");
4196 r
= pMsiGetProductInfoExA(prodcode
, usersid
,
4197 MSIINSTALLCONTEXT_USERUNMANAGED
,
4198 INSTALLPROPERTY_VERSIONSTRING
, buf
, &sz
);
4199 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
4200 ok(!lstrcmpA(buf
, "3.2.1"), "Expected \"3.2.1\", got \"%s\"\n", buf
);
4201 ok(sz
== 5, "Expected 5, got %d\n", sz
);
4203 res
= RegSetValueExA(propkey
, "ProductID", 0, REG_SZ
, (LPBYTE
)"id", 3);
4204 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
4206 /* ProductID value exists */
4208 lstrcpyA(buf
, "apple");
4209 r
= pMsiGetProductInfoExA(prodcode
, usersid
,
4210 MSIINSTALLCONTEXT_USERUNMANAGED
,
4211 INSTALLPROPERTY_PRODUCTID
, buf
, &sz
);
4212 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
4213 ok(!lstrcmpA(buf
, "id"), "Expected \"id\", got \"%s\"\n", buf
);
4214 ok(sz
== 2, "Expected 2, got %d\n", sz
);
4216 res
= RegSetValueExA(propkey
, "RegCompany", 0, REG_SZ
, (LPBYTE
)"comp", 5);
4217 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
4219 /* RegCompany value exists */
4221 lstrcpyA(buf
, "apple");
4222 r
= pMsiGetProductInfoExA(prodcode
, usersid
,
4223 MSIINSTALLCONTEXT_USERUNMANAGED
,
4224 INSTALLPROPERTY_REGCOMPANY
, buf
, &sz
);
4225 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
4226 ok(!lstrcmpA(buf
, "comp"), "Expected \"comp\", got \"%s\"\n", buf
);
4227 ok(sz
== 4, "Expected 4, got %d\n", sz
);
4229 res
= RegSetValueExA(propkey
, "RegOwner", 0, REG_SZ
, (LPBYTE
)"owner", 6);
4230 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
4232 /* RegOwner value exists */
4234 lstrcpyA(buf
, "apple");
4235 r
= pMsiGetProductInfoExA(prodcode
, usersid
,
4236 MSIINSTALLCONTEXT_USERUNMANAGED
,
4237 INSTALLPROPERTY_REGOWNER
, buf
, &sz
);
4238 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
4239 ok(!lstrcmpA(buf
, "owner"), "Expected \"owner\", got \"%s\"\n", buf
);
4240 ok(sz
== 5, "Expected 5, got %d\n", sz
);
4242 res
= RegSetValueExA(propkey
, "Transforms", 0, REG_SZ
, (LPBYTE
)"trans", 6);
4243 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
4245 /* Transforms value exists */
4247 lstrcpyA(buf
, "apple");
4248 r
= pMsiGetProductInfoExA(prodcode
, usersid
,
4249 MSIINSTALLCONTEXT_USERUNMANAGED
,
4250 INSTALLPROPERTY_TRANSFORMS
, buf
, &sz
);
4251 ok(r
== ERROR_UNKNOWN_PRODUCT
,
4252 "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r
);
4253 ok(!lstrcmpA(buf
, "apple"), "Expected buf to be unchanged, got %s\n", buf
);
4254 ok(sz
== MAX_PATH
, "Expected MAX_PATH, got %d\n", sz
);
4256 res
= RegSetValueExA(propkey
, "Language", 0, REG_SZ
, (LPBYTE
)"lang", 5);
4257 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
4259 /* Language value exists */
4261 lstrcpyA(buf
, "apple");
4262 r
= pMsiGetProductInfoExA(prodcode
, usersid
,
4263 MSIINSTALLCONTEXT_USERUNMANAGED
,
4264 INSTALLPROPERTY_LANGUAGE
, buf
, &sz
);
4265 ok(r
== ERROR_UNKNOWN_PRODUCT
,
4266 "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r
);
4267 ok(!lstrcmpA(buf
, "apple"), "Expected buf to be unchanged, got %s\n", buf
);
4268 ok(sz
== MAX_PATH
, "Expected MAX_PATH, got %d\n", sz
);
4270 res
= RegSetValueExA(propkey
, "ProductName", 0, REG_SZ
, (LPBYTE
)"name", 5);
4271 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
4273 /* ProductName value exists */
4275 lstrcpyA(buf
, "apple");
4276 r
= pMsiGetProductInfoExA(prodcode
, usersid
,
4277 MSIINSTALLCONTEXT_USERUNMANAGED
,
4278 INSTALLPROPERTY_PRODUCTNAME
, buf
, &sz
);
4279 ok(r
== ERROR_UNKNOWN_PRODUCT
,
4280 "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r
);
4281 ok(!lstrcmpA(buf
, "apple"), "Expected buf to be unchanged, got %s\n", buf
);
4282 ok(sz
== MAX_PATH
, "Expected MAX_PATH, got %d\n", sz
);
4284 res
= RegSetValueExA(propkey
, "AssignmentType", 0, REG_SZ
, (LPBYTE
)"type", 5);
4285 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
4289 /* AssignmentType value exists */
4291 lstrcpyA(buf
, "apple");
4292 r
= pMsiGetProductInfoExA(prodcode
, usersid
,
4293 MSIINSTALLCONTEXT_USERUNMANAGED
,
4294 INSTALLPROPERTY_ASSIGNMENTTYPE
, buf
, &sz
);
4295 ok(r
== ERROR_UNKNOWN_PRODUCT
,
4296 "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r
);
4297 ok(!lstrcmpA(buf
, "apple"), "Expected buf to be unchanged, got %s\n", buf
);
4298 ok(sz
== MAX_PATH
, "Expected MAX_PATH, got %d\n", sz
);
4300 res
= RegSetValueExA(propkey
, "PackageCode", 0, REG_SZ
, (LPBYTE
)"code", 5);
4301 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
4303 /* PackageCode value exists */
4305 lstrcpyA(buf
, "apple");
4306 r
= pMsiGetProductInfoExA(prodcode
, usersid
,
4307 MSIINSTALLCONTEXT_USERUNMANAGED
,
4308 INSTALLPROPERTY_PACKAGECODE
, buf
, &sz
);
4309 ok(r
== ERROR_UNKNOWN_PRODUCT
,
4310 "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r
);
4311 ok(!lstrcmpA(buf
, "apple"), "Expected buf to be unchanged, got %s\n", buf
);
4312 ok(sz
== MAX_PATH
, "Expected MAX_PATH, got %d\n", sz
);
4314 res
= RegSetValueExA(propkey
, "Version", 0, REG_SZ
, (LPBYTE
)"ver", 4);
4315 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
4317 /* Version value exists */
4319 lstrcpyA(buf
, "apple");
4320 r
= pMsiGetProductInfoExA(prodcode
, usersid
,
4321 MSIINSTALLCONTEXT_USERUNMANAGED
,
4322 INSTALLPROPERTY_VERSION
, buf
, &sz
);
4323 ok(r
== ERROR_UNKNOWN_PRODUCT
,
4324 "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r
);
4325 ok(!lstrcmpA(buf
, "apple"), "Expected buf to be unchanged, got %s\n", buf
);
4326 ok(sz
== MAX_PATH
, "Expected MAX_PATH, got %d\n", sz
);
4328 res
= RegSetValueExA(propkey
, "ProductIcon", 0, REG_SZ
, (LPBYTE
)"icon", 5);
4329 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
4331 /* ProductIcon value exists */
4333 lstrcpyA(buf
, "apple");
4334 r
= pMsiGetProductInfoExA(prodcode
, usersid
,
4335 MSIINSTALLCONTEXT_USERUNMANAGED
,
4336 INSTALLPROPERTY_PRODUCTICON
, buf
, &sz
);
4337 ok(r
== ERROR_UNKNOWN_PRODUCT
,
4338 "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r
);
4339 ok(!lstrcmpA(buf
, "apple"), "Expected buf to be unchanged, got %s\n", buf
);
4340 ok(sz
== MAX_PATH
, "Expected MAX_PATH, got %d\n", sz
);
4342 res
= RegSetValueExA(propkey
, "PackageName", 0, REG_SZ
, (LPBYTE
)"name", 5);
4343 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
4345 /* PackageName value exists */
4347 lstrcpyA(buf
, "apple");
4348 r
= pMsiGetProductInfoExA(prodcode
, usersid
,
4349 MSIINSTALLCONTEXT_USERUNMANAGED
,
4350 INSTALLPROPERTY_PACKAGENAME
, buf
, &sz
);
4351 ok(r
== ERROR_UNKNOWN_PRODUCT
,
4352 "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r
);
4353 ok(!lstrcmpA(buf
, "apple"), "Expected buf to be unchanged, got %s\n", buf
);
4354 ok(sz
== MAX_PATH
, "Expected MAX_PATH, got %d\n", sz
);
4356 res
= RegSetValueExA(propkey
, "AuthorizedLUAApp", 0, REG_SZ
, (LPBYTE
)"auth", 5);
4357 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
4359 /* AuthorizedLUAApp value exists */
4361 lstrcpyA(buf
, "apple");
4362 r
= pMsiGetProductInfoExA(prodcode
, usersid
,
4363 MSIINSTALLCONTEXT_USERUNMANAGED
,
4364 INSTALLPROPERTY_AUTHORIZED_LUA_APP
, buf
, &sz
);
4365 ok(r
== ERROR_UNKNOWN_PRODUCT
,
4366 "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r
);
4367 ok(!lstrcmpA(buf
, "apple"), "Expected buf to be unchanged, got %s\n", buf
);
4368 ok(sz
== MAX_PATH
, "Expected MAX_PATH, got %d\n", sz
);
4370 RegDeleteValueA(propkey
, "AuthorizedLUAApp");
4371 RegDeleteValueA(propkey
, "PackageName");
4372 RegDeleteValueA(propkey
, "ProductIcon");
4373 RegDeleteValueA(propkey
, "Version");
4374 RegDeleteValueA(propkey
, "PackageCode");
4375 RegDeleteValueA(propkey
, "AssignmentType");
4376 RegDeleteValueA(propkey
, "ProductName");
4377 RegDeleteValueA(propkey
, "Language");
4378 RegDeleteValueA(propkey
, "Transforms");
4379 RegDeleteValueA(propkey
, "RegOwner");
4380 RegDeleteValueA(propkey
, "RegCompany");
4381 RegDeleteValueA(propkey
, "ProductID");
4382 RegDeleteValueA(propkey
, "DisplayVersion");
4383 RegDeleteValueA(propkey
, "VersionMajor");
4384 RegDeleteValueA(propkey
, "VersionMinor");
4385 RegDeleteValueA(propkey
, "URLUpdateInfo");
4386 RegDeleteValueA(propkey
, "URLInfoAbout");
4387 RegDeleteValueA(propkey
, "Publisher");
4388 RegDeleteValueA(propkey
, "LocalPackage");
4389 RegDeleteValueA(propkey
, "InstallSource");
4390 RegDeleteValueA(propkey
, "InstallLocation");
4391 RegDeleteValueA(propkey
, "DisplayName");
4392 RegDeleteValueA(propkey
, "InstallDate");
4393 RegDeleteValueA(propkey
, "HelpTelephone");
4394 RegDeleteValueA(propkey
, "HelpLink");
4395 RegDeleteValueA(propkey
, "LocalPackage");
4396 RegDeleteKeyA(propkey
, "");
4397 RegCloseKey(propkey
);
4398 RegDeleteKeyA(localkey
, "");
4399 RegCloseKey(localkey
);
4401 lstrcpyA(keypath
, "Software\\Microsoft\\Windows\\CurrentVersion\\Installer\\Managed\\");
4402 lstrcatA(keypath
, usersid
);
4403 lstrcatA(keypath
, "\\Installer\\Products\\");
4404 lstrcatA(keypath
, prod_squashed
);
4406 res
= RegCreateKeyA(HKEY_LOCAL_MACHINE
, keypath
, &userkey
);
4407 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
4409 /* user product key exists */
4411 lstrcpyA(buf
, "apple");
4412 r
= pMsiGetProductInfoExA(prodcode
, usersid
,
4413 MSIINSTALLCONTEXT_USERUNMANAGED
,
4414 INSTALLPROPERTY_PRODUCTSTATE
, buf
, &sz
);
4415 ok(r
== ERROR_UNKNOWN_PRODUCT
,
4416 "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r
);
4417 ok(!lstrcmpA(buf
, "apple"), "Expected buf to be unchanged, got %s\n", buf
);
4418 ok(sz
== MAX_PATH
, "Expected MAX_PATH, got %d\n", sz
);
4420 RegDeleteKeyA(userkey
, "");
4421 RegCloseKey(userkey
);
4423 lstrcpyA(keypath
, "Software\\Microsoft\\Installer\\Products\\");
4424 lstrcatA(keypath
, prod_squashed
);
4426 res
= RegCreateKeyA(HKEY_CURRENT_USER
, keypath
, &prodkey
);
4427 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
4430 lstrcpyA(buf
, "apple");
4431 r
= pMsiGetProductInfoExA(prodcode
, usersid
,
4432 MSIINSTALLCONTEXT_USERUNMANAGED
,
4433 INSTALLPROPERTY_PRODUCTSTATE
, buf
, &sz
);
4434 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
4435 ok(!lstrcmpA(buf
, "1"), "Expected \"1\", got \"%s\"\n", buf
);
4436 ok(sz
== 1, "Expected 1, got %d\n", sz
);
4438 res
= RegSetValueExA(prodkey
, "HelpLink", 0, REG_SZ
, (LPBYTE
)"link", 5);
4439 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
4441 /* HelpLink value exists */
4443 lstrcpyA(buf
, "apple");
4444 r
= pMsiGetProductInfoExA(prodcode
, usersid
,
4445 MSIINSTALLCONTEXT_USERUNMANAGED
,
4446 INSTALLPROPERTY_HELPLINK
, buf
, &sz
);
4447 ok(r
== ERROR_UNKNOWN_PROPERTY
,
4448 "Expected ERROR_UNKNOWN_PROPERTY, got %d\n", r
);
4449 ok(!lstrcmpA(buf
, "apple"), "Expected buf to be unchanged, got %s\n", buf
);
4450 ok(sz
== MAX_PATH
, "Expected MAX_PATH, got %d\n", sz
);
4452 res
= RegSetValueExA(prodkey
, "HelpTelephone", 0, REG_SZ
, (LPBYTE
)"phone", 6);
4453 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
4455 /* HelpTelephone value exists */
4457 lstrcpyA(buf
, "apple");
4458 r
= pMsiGetProductInfoExA(prodcode
, usersid
,
4459 MSIINSTALLCONTEXT_USERUNMANAGED
,
4460 INSTALLPROPERTY_HELPTELEPHONE
, buf
, &sz
);
4461 ok(r
== ERROR_UNKNOWN_PROPERTY
,
4462 "Expected ERROR_UNKNOWN_PROPERTY, got %d\n", r
);
4463 ok(!lstrcmpA(buf
, "apple"), "Expected buf to be unchanged, got %s\n", buf
);
4464 ok(sz
== MAX_PATH
, "Expected MAX_PATH, got %d\n", sz
);
4466 res
= RegSetValueExA(prodkey
, "InstallDate", 0, REG_SZ
, (LPBYTE
)"date", 5);
4467 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
4469 /* InstallDate value exists */
4471 lstrcpyA(buf
, "apple");
4472 r
= pMsiGetProductInfoExA(prodcode
, usersid
,
4473 MSIINSTALLCONTEXT_USERUNMANAGED
,
4474 INSTALLPROPERTY_INSTALLDATE
, buf
, &sz
);
4475 ok(r
== ERROR_UNKNOWN_PROPERTY
,
4476 "Expected ERROR_UNKNOWN_PROPERTY, got %d\n", r
);
4477 ok(!lstrcmpA(buf
, "apple"), "Expected buf to be unchanged, got %s\n", buf
);
4478 ok(sz
== MAX_PATH
, "Expected MAX_PATH, got %d\n", sz
);
4480 res
= RegSetValueExA(prodkey
, "DisplayName", 0, REG_SZ
, (LPBYTE
)"name", 5);
4481 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
4483 /* DisplayName value exists */
4485 lstrcpyA(buf
, "apple");
4486 r
= pMsiGetProductInfoExA(prodcode
, usersid
,
4487 MSIINSTALLCONTEXT_USERUNMANAGED
,
4488 INSTALLPROPERTY_INSTALLEDPRODUCTNAME
, buf
, &sz
);
4489 ok(r
== ERROR_UNKNOWN_PROPERTY
,
4490 "Expected ERROR_UNKNOWN_PROPERTY, got %d\n", r
);
4491 ok(!lstrcmpA(buf
, "apple"), "Expected buf to be unchanged, got %s\n", buf
);
4492 ok(sz
== MAX_PATH
, "Expected MAX_PATH, got %d\n", sz
);
4494 res
= RegSetValueExA(prodkey
, "InstallLocation", 0, REG_SZ
, (LPBYTE
)"loc", 4);
4495 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
4497 /* InstallLocation value exists */
4499 lstrcpyA(buf
, "apple");
4500 r
= pMsiGetProductInfoExA(prodcode
, usersid
,
4501 MSIINSTALLCONTEXT_USERUNMANAGED
,
4502 INSTALLPROPERTY_INSTALLLOCATION
, buf
, &sz
);
4503 ok(r
== ERROR_UNKNOWN_PROPERTY
,
4504 "Expected ERROR_UNKNOWN_PROPERTY, got %d\n", r
);
4505 ok(!lstrcmpA(buf
, "apple"), "Expected buf to be unchanged, got %s\n", buf
);
4506 ok(sz
== MAX_PATH
, "Expected MAX_PATH, got %d\n", sz
);
4508 res
= RegSetValueExA(prodkey
, "InstallSource", 0, REG_SZ
, (LPBYTE
)"source", 7);
4509 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
4511 /* InstallSource value exists */
4513 lstrcpyA(buf
, "apple");
4514 r
= pMsiGetProductInfoExA(prodcode
, usersid
,
4515 MSIINSTALLCONTEXT_USERUNMANAGED
,
4516 INSTALLPROPERTY_INSTALLSOURCE
, buf
, &sz
);
4517 ok(r
== ERROR_UNKNOWN_PROPERTY
,
4518 "Expected ERROR_UNKNOWN_PROPERTY, got %d\n", r
);
4519 ok(!lstrcmpA(buf
, "apple"), "Expected buf to be unchanged, got %s\n", buf
);
4520 ok(sz
== MAX_PATH
, "Expected MAX_PATH, got %d\n", sz
);
4522 res
= RegSetValueExA(prodkey
, "LocalPackage", 0, REG_SZ
, (LPBYTE
)"local", 6);
4523 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
4525 /* LocalPackage value exists */
4527 lstrcpyA(buf
, "apple");
4528 r
= pMsiGetProductInfoExA(prodcode
, usersid
,
4529 MSIINSTALLCONTEXT_USERUNMANAGED
,
4530 INSTALLPROPERTY_LOCALPACKAGE
, buf
, &sz
);
4531 ok(r
== ERROR_UNKNOWN_PROPERTY
,
4532 "Expected ERROR_UNKNOWN_PROPERTY, got %d\n", r
);
4533 ok(!lstrcmpA(buf
, "apple"), "Expected buf to be unchanged, got %s\n", buf
);
4534 ok(sz
== MAX_PATH
, "Expected MAX_PATH, got %d\n", sz
);
4536 res
= RegSetValueExA(prodkey
, "Publisher", 0, REG_SZ
, (LPBYTE
)"pub", 4);
4537 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
4539 /* Publisher value exists */
4541 lstrcpyA(buf
, "apple");
4542 r
= pMsiGetProductInfoExA(prodcode
, usersid
,
4543 MSIINSTALLCONTEXT_USERUNMANAGED
,
4544 INSTALLPROPERTY_PUBLISHER
, buf
, &sz
);
4545 ok(r
== ERROR_UNKNOWN_PROPERTY
,
4546 "Expected ERROR_UNKNOWN_PROPERTY, got %d\n", r
);
4547 ok(!lstrcmpA(buf
, "apple"), "Expected buf to be unchanged, got %s\n", buf
);
4548 ok(sz
== MAX_PATH
, "Expected MAX_PATH, got %d\n", sz
);
4550 res
= RegSetValueExA(prodkey
, "URLInfoAbout", 0, REG_SZ
, (LPBYTE
)"about", 6);
4551 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
4553 /* URLInfoAbout value exists */
4555 lstrcpyA(buf
, "apple");
4556 r
= pMsiGetProductInfoExA(prodcode
, usersid
,
4557 MSIINSTALLCONTEXT_USERUNMANAGED
,
4558 INSTALLPROPERTY_URLINFOABOUT
, buf
, &sz
);
4559 ok(r
== ERROR_UNKNOWN_PROPERTY
,
4560 "Expected ERROR_UNKNOWN_PROPERTY, got %d\n", r
);
4561 ok(!lstrcmpA(buf
, "apple"), "Expected buf to be unchanged, got %s\n", buf
);
4562 ok(sz
== MAX_PATH
, "Expected MAX_PATH, got %d\n", sz
);
4564 res
= RegSetValueExA(prodkey
, "URLUpdateInfo", 0, REG_SZ
, (LPBYTE
)"update", 7);
4565 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
4567 /* URLUpdateInfo value exists */
4569 lstrcpyA(buf
, "apple");
4570 r
= pMsiGetProductInfoExA(prodcode
, usersid
,
4571 MSIINSTALLCONTEXT_USERUNMANAGED
,
4572 INSTALLPROPERTY_URLUPDATEINFO
, buf
, &sz
);
4573 ok(r
== ERROR_UNKNOWN_PROPERTY
,
4574 "Expected ERROR_UNKNOWN_PROPERTY, got %d\n", r
);
4575 ok(!lstrcmpA(buf
, "apple"), "Expected buf to be unchanged, got %s\n", buf
);
4576 ok(sz
== MAX_PATH
, "Expected MAX_PATH, got %d\n", sz
);
4578 res
= RegSetValueExA(prodkey
, "VersionMinor", 0, REG_SZ
, (LPBYTE
)"2", 2);
4579 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
4581 /* VersionMinor value exists */
4583 lstrcpyA(buf
, "apple");
4584 r
= pMsiGetProductInfoExA(prodcode
, usersid
,
4585 MSIINSTALLCONTEXT_USERUNMANAGED
,
4586 INSTALLPROPERTY_VERSIONMINOR
, buf
, &sz
);
4587 ok(r
== ERROR_UNKNOWN_PROPERTY
,
4588 "Expected ERROR_UNKNOWN_PROPERTY, got %d\n", r
);
4589 ok(!lstrcmpA(buf
, "apple"), "Expected buf to be unchanged, got %s\n", buf
);
4590 ok(sz
== MAX_PATH
, "Expected MAX_PATH, got %d\n", sz
);
4592 res
= RegSetValueExA(prodkey
, "VersionMajor", 0, REG_SZ
, (LPBYTE
)"3", 2);
4593 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
4595 /* VersionMajor value exists */
4597 lstrcpyA(buf
, "apple");
4598 r
= pMsiGetProductInfoExA(prodcode
, usersid
,
4599 MSIINSTALLCONTEXT_USERUNMANAGED
,
4600 INSTALLPROPERTY_VERSIONMAJOR
, buf
, &sz
);
4601 ok(r
== ERROR_UNKNOWN_PROPERTY
,
4602 "Expected ERROR_UNKNOWN_PROPERTY, got %d\n", r
);
4603 ok(!lstrcmpA(buf
, "apple"), "Expected buf to be unchanged, got %s\n", buf
);
4604 ok(sz
== MAX_PATH
, "Expected MAX_PATH, got %d\n", sz
);
4606 res
= RegSetValueExA(prodkey
, "DisplayVersion", 0, REG_SZ
, (LPBYTE
)"3.2.1", 6);
4607 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
4609 /* DisplayVersion value exists */
4611 lstrcpyA(buf
, "apple");
4612 r
= pMsiGetProductInfoExA(prodcode
, usersid
,
4613 MSIINSTALLCONTEXT_USERUNMANAGED
,
4614 INSTALLPROPERTY_VERSIONSTRING
, buf
, &sz
);
4615 ok(r
== ERROR_UNKNOWN_PROPERTY
,
4616 "Expected ERROR_UNKNOWN_PROPERTY, got %d\n", r
);
4617 ok(!lstrcmpA(buf
, "apple"), "Expected buf to be unchanged, got %s\n", buf
);
4618 ok(sz
== MAX_PATH
, "Expected MAX_PATH, got %d\n", sz
);
4620 res
= RegSetValueExA(prodkey
, "ProductID", 0, REG_SZ
, (LPBYTE
)"id", 3);
4621 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
4623 /* ProductID value exists */
4625 lstrcpyA(buf
, "apple");
4626 r
= pMsiGetProductInfoExA(prodcode
, usersid
,
4627 MSIINSTALLCONTEXT_USERUNMANAGED
,
4628 INSTALLPROPERTY_PRODUCTID
, buf
, &sz
);
4629 ok(r
== ERROR_UNKNOWN_PROPERTY
,
4630 "Expected ERROR_UNKNOWN_PROPERTY, got %d\n", r
);
4631 ok(!lstrcmpA(buf
, "apple"), "Expected buf to be unchanged, got %s\n", buf
);
4632 ok(sz
== MAX_PATH
, "Expected MAX_PATH, got %d\n", sz
);
4634 res
= RegSetValueExA(prodkey
, "RegCompany", 0, REG_SZ
, (LPBYTE
)"comp", 5);
4635 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
4637 /* RegCompany value exists */
4639 lstrcpyA(buf
, "apple");
4640 r
= pMsiGetProductInfoExA(prodcode
, usersid
,
4641 MSIINSTALLCONTEXT_USERUNMANAGED
,
4642 INSTALLPROPERTY_REGCOMPANY
, buf
, &sz
);
4643 ok(r
== ERROR_UNKNOWN_PROPERTY
,
4644 "Expected ERROR_UNKNOWN_PROPERTY, got %d\n", r
);
4645 ok(!lstrcmpA(buf
, "apple"), "Expected buf to be unchanged, got %s\n", buf
);
4646 ok(sz
== MAX_PATH
, "Expected MAX_PATH, got %d\n", sz
);
4648 res
= RegSetValueExA(prodkey
, "RegOwner", 0, REG_SZ
, (LPBYTE
)"owner", 6);
4649 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
4651 /* RegOwner value exists */
4653 lstrcpyA(buf
, "apple");
4654 r
= pMsiGetProductInfoExA(prodcode
, usersid
,
4655 MSIINSTALLCONTEXT_USERUNMANAGED
,
4656 INSTALLPROPERTY_REGOWNER
, buf
, &sz
);
4657 ok(r
== ERROR_UNKNOWN_PROPERTY
,
4658 "Expected ERROR_UNKNOWN_PROPERTY, got %d\n", r
);
4659 ok(!lstrcmpA(buf
, "apple"), "Expected buf to be unchanged, got %s\n", buf
);
4660 ok(sz
== MAX_PATH
, "Expected MAX_PATH, got %d\n", sz
);
4662 res
= RegSetValueExA(prodkey
, "Transforms", 0, REG_SZ
, (LPBYTE
)"trans", 6);
4663 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
4665 /* Transforms value exists */
4667 lstrcpyA(buf
, "apple");
4668 r
= pMsiGetProductInfoExA(prodcode
, usersid
,
4669 MSIINSTALLCONTEXT_USERUNMANAGED
,
4670 INSTALLPROPERTY_TRANSFORMS
, buf
, &sz
);
4671 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
4672 ok(!lstrcmpA(buf
, "trans"), "Expected \"trans\", got \"%s\"\n", buf
);
4673 ok(sz
== 5, "Expected 5, got %d\n", sz
);
4675 res
= RegSetValueExA(prodkey
, "Language", 0, REG_SZ
, (LPBYTE
)"lang", 5);
4676 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
4678 /* Language value exists */
4680 lstrcpyA(buf
, "apple");
4681 r
= pMsiGetProductInfoExA(prodcode
, usersid
,
4682 MSIINSTALLCONTEXT_USERUNMANAGED
,
4683 INSTALLPROPERTY_LANGUAGE
, buf
, &sz
);
4684 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
4685 ok(!lstrcmpA(buf
, "lang"), "Expected \"lang\", got \"%s\"\n", buf
);
4686 ok(sz
== 4, "Expected 4, got %d\n", sz
);
4688 res
= RegSetValueExA(prodkey
, "ProductName", 0, REG_SZ
, (LPBYTE
)"name", 5);
4689 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
4691 /* ProductName value exists */
4693 lstrcpyA(buf
, "apple");
4694 r
= pMsiGetProductInfoExA(prodcode
, usersid
,
4695 MSIINSTALLCONTEXT_USERUNMANAGED
,
4696 INSTALLPROPERTY_PRODUCTNAME
, buf
, &sz
);
4697 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
4698 ok(!lstrcmpA(buf
, "name"), "Expected \"name\", got \"%s\"\n", buf
);
4699 ok(sz
== 4, "Expected 4, got %d\n", sz
);
4701 res
= RegSetValueExA(prodkey
, "AssignmentType", 0, REG_SZ
, (LPBYTE
)"type", 5);
4702 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
4706 /* AssignmentType value exists */
4708 lstrcpyA(buf
, "apple");
4709 r
= pMsiGetProductInfoExA(prodcode
, usersid
,
4710 MSIINSTALLCONTEXT_USERUNMANAGED
,
4711 INSTALLPROPERTY_ASSIGNMENTTYPE
, buf
, &sz
);
4712 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
4713 ok(!lstrcmpA(buf
, ""), "Expected \"\", got \"%s\"\n", buf
);
4714 ok(sz
== 0, "Expected 0, got %d\n", sz
);
4716 res
= RegSetValueExA(prodkey
, "PackageCode", 0, REG_SZ
, (LPBYTE
)"code", 5);
4717 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
4721 /* PackageCode value exists */
4723 lstrcpyA(buf
, "apple");
4724 r
= pMsiGetProductInfoExA(prodcode
, usersid
,
4725 MSIINSTALLCONTEXT_USERUNMANAGED
,
4726 INSTALLPROPERTY_PACKAGECODE
, buf
, &sz
);
4729 ok(r
== ERROR_BAD_CONFIGURATION
,
4730 "Expected ERROR_BAD_CONFIGURATION, got %d\n", r
);
4731 ok(!lstrcmpA(buf
, "apple"), "Expected buf to be unchanged, got %s\n", buf
);
4732 ok(sz
== MAX_PATH
, "Expected MAX_PATH, got %d\n", sz
);
4735 res
= RegSetValueExA(prodkey
, "Version", 0, REG_SZ
, (LPBYTE
)"ver", 4);
4736 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
4738 /* Version value exists */
4740 lstrcpyA(buf
, "apple");
4741 r
= pMsiGetProductInfoExA(prodcode
, usersid
,
4742 MSIINSTALLCONTEXT_USERUNMANAGED
,
4743 INSTALLPROPERTY_VERSION
, buf
, &sz
);
4744 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
4745 ok(!lstrcmpA(buf
, "ver"), "Expected \"ver\", got \"%s\"\n", buf
);
4746 ok(sz
== 3, "Expected 3, got %d\n", sz
);
4748 res
= RegSetValueExA(prodkey
, "ProductIcon", 0, REG_SZ
, (LPBYTE
)"icon", 5);
4749 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
4751 /* ProductIcon value exists */
4753 lstrcpyA(buf
, "apple");
4754 r
= pMsiGetProductInfoExA(prodcode
, usersid
,
4755 MSIINSTALLCONTEXT_USERUNMANAGED
,
4756 INSTALLPROPERTY_PRODUCTICON
, buf
, &sz
);
4757 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
4758 ok(!lstrcmpA(buf
, "icon"), "Expected \"icon\", got \"%s\"\n", buf
);
4759 ok(sz
== 4, "Expected 4, got %d\n", sz
);
4761 res
= RegSetValueExA(prodkey
, "PackageName", 0, REG_SZ
, (LPBYTE
)"name", 5);
4762 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
4764 /* PackageName value exists */
4766 lstrcpyA(buf
, "apple");
4767 r
= pMsiGetProductInfoExA(prodcode
, usersid
,
4768 MSIINSTALLCONTEXT_USERUNMANAGED
,
4769 INSTALLPROPERTY_PACKAGENAME
, buf
, &sz
);
4772 ok(r
== ERROR_UNKNOWN_PRODUCT
,
4773 "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r
);
4774 ok(!lstrcmpA(buf
, "apple"), "Expected buf to be unchanged, got %s\n", buf
);
4775 ok(sz
== MAX_PATH
, "Expected MAX_PATH, got %d\n", sz
);
4778 res
= RegSetValueExA(prodkey
, "AuthorizedLUAApp", 0, REG_SZ
, (LPBYTE
)"auth", 5);
4779 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
4781 /* AuthorizedLUAApp value exists */
4783 lstrcpyA(buf
, "apple");
4784 r
= pMsiGetProductInfoExA(prodcode
, usersid
,
4785 MSIINSTALLCONTEXT_USERUNMANAGED
,
4786 INSTALLPROPERTY_AUTHORIZED_LUA_APP
, buf
, &sz
);
4787 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
4788 ok(!lstrcmpA(buf
, "auth"), "Expected \"auth\", got \"%s\"\n", buf
);
4789 ok(sz
== 4, "Expected 4, got %d\n", sz
);
4791 RegDeleteValueA(prodkey
, "AuthorizedLUAApp");
4792 RegDeleteValueA(prodkey
, "PackageName");
4793 RegDeleteValueA(prodkey
, "ProductIcon");
4794 RegDeleteValueA(prodkey
, "Version");
4795 RegDeleteValueA(prodkey
, "PackageCode");
4796 RegDeleteValueA(prodkey
, "AssignmentType");
4797 RegDeleteValueA(prodkey
, "ProductName");
4798 RegDeleteValueA(prodkey
, "Language");
4799 RegDeleteValueA(prodkey
, "Transforms");
4800 RegDeleteValueA(prodkey
, "RegOwner");
4801 RegDeleteValueA(prodkey
, "RegCompany");
4802 RegDeleteValueA(prodkey
, "ProductID");
4803 RegDeleteValueA(prodkey
, "DisplayVersion");
4804 RegDeleteValueA(prodkey
, "VersionMajor");
4805 RegDeleteValueA(prodkey
, "VersionMinor");
4806 RegDeleteValueA(prodkey
, "URLUpdateInfo");
4807 RegDeleteValueA(prodkey
, "URLInfoAbout");
4808 RegDeleteValueA(prodkey
, "Publisher");
4809 RegDeleteValueA(prodkey
, "LocalPackage");
4810 RegDeleteValueA(prodkey
, "InstallSource");
4811 RegDeleteValueA(prodkey
, "InstallLocation");
4812 RegDeleteValueA(prodkey
, "DisplayName");
4813 RegDeleteValueA(prodkey
, "InstallDate");
4814 RegDeleteValueA(prodkey
, "HelpTelephone");
4815 RegDeleteValueA(prodkey
, "HelpLink");
4816 RegDeleteValueA(prodkey
, "LocalPackage");
4817 RegDeleteKeyA(prodkey
, "");
4818 RegCloseKey(prodkey
);
4820 /* MSIINSTALLCONTEXT_USERMANAGED */
4822 lstrcpyA(keypath
, "Software\\Microsoft\\Windows\\CurrentVersion\\Installer\\UserData\\");
4823 lstrcatA(keypath
, usersid
);
4824 lstrcatA(keypath
, "\\Products\\");
4825 lstrcatA(keypath
, prod_squashed
);
4827 res
= RegCreateKeyA(HKEY_LOCAL_MACHINE
, keypath
, &localkey
);
4828 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
4830 /* local user product key exists */
4832 lstrcpyA(buf
, "apple");
4833 r
= pMsiGetProductInfoExA(prodcode
, usersid
,
4834 MSIINSTALLCONTEXT_USERMANAGED
,
4835 INSTALLPROPERTY_PRODUCTSTATE
, buf
, &sz
);
4836 ok(r
== ERROR_UNKNOWN_PRODUCT
,
4837 "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r
);
4838 ok(!lstrcmpA(buf
, "apple"), "Expected buf to be unchanged, got %s\n", buf
);
4839 ok(sz
== MAX_PATH
, "Expected MAX_PATH, got %d\n", sz
);
4841 res
= RegCreateKeyA(localkey
, "InstallProperties", &propkey
);
4842 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
4844 /* InstallProperties key exists */
4846 lstrcpyA(buf
, "apple");
4847 r
= pMsiGetProductInfoExA(prodcode
, usersid
,
4848 MSIINSTALLCONTEXT_USERMANAGED
,
4849 INSTALLPROPERTY_PRODUCTSTATE
, buf
, &sz
);
4850 ok(r
== ERROR_UNKNOWN_PRODUCT
,
4851 "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r
);
4852 ok(!lstrcmpA(buf
, "apple"), "Expected buf to be unchanged, got %s\n", buf
);
4853 ok(sz
== MAX_PATH
, "Expected MAX_PATH, got %d\n", sz
);
4855 res
= RegSetValueExA(propkey
, "ManagedLocalPackage", 0, REG_SZ
, (LPBYTE
)"local", 6);
4856 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
4858 /* ManagedLocalPackage value exists */
4860 lstrcpyA(buf
, "apple");
4861 r
= pMsiGetProductInfoExA(prodcode
, usersid
,
4862 MSIINSTALLCONTEXT_USERMANAGED
,
4863 INSTALLPROPERTY_PRODUCTSTATE
, buf
, &sz
);
4864 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
4865 ok(!lstrcmpA(buf
, "5"), "Expected \"5\", got \"%s\"\n", buf
);
4866 ok(sz
== 1, "Expected 1, got %d\n", sz
);
4868 res
= RegSetValueExA(propkey
, "HelpLink", 0, REG_SZ
, (LPBYTE
)"link", 5);
4869 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
4871 /* HelpLink value exists */
4873 lstrcpyA(buf
, "apple");
4874 r
= pMsiGetProductInfoExA(prodcode
, usersid
,
4875 MSIINSTALLCONTEXT_USERMANAGED
,
4876 INSTALLPROPERTY_HELPLINK
, buf
, &sz
);
4877 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
4878 ok(!lstrcmpA(buf
, "link"), "Expected \"link\", got \"%s\"\n", buf
);
4879 ok(sz
== 4, "Expected 4, got %d\n", sz
);
4881 res
= RegSetValueExA(propkey
, "HelpTelephone", 0, REG_SZ
, (LPBYTE
)"phone", 6);
4882 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
4884 /* HelpTelephone value exists */
4886 lstrcpyA(buf
, "apple");
4887 r
= pMsiGetProductInfoExA(prodcode
, usersid
,
4888 MSIINSTALLCONTEXT_USERMANAGED
,
4889 INSTALLPROPERTY_HELPTELEPHONE
, buf
, &sz
);
4890 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
4891 ok(!lstrcmpA(buf
, "phone"), "Expected \"phone\", got \"%s\"\n", buf
);
4892 ok(sz
== 5, "Expected 5, got %d\n", sz
);
4894 res
= RegSetValueExA(propkey
, "InstallDate", 0, REG_SZ
, (LPBYTE
)"date", 5);
4895 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
4897 /* InstallDate value exists */
4899 lstrcpyA(buf
, "apple");
4900 r
= pMsiGetProductInfoExA(prodcode
, usersid
,
4901 MSIINSTALLCONTEXT_USERMANAGED
,
4902 INSTALLPROPERTY_INSTALLDATE
, buf
, &sz
);
4903 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
4904 ok(!lstrcmpA(buf
, "date"), "Expected \"date\", got \"%s\"\n", buf
);
4905 ok(sz
== 4, "Expected 4, got %d\n", sz
);
4907 res
= RegSetValueExA(propkey
, "DisplayName", 0, REG_SZ
, (LPBYTE
)"name", 5);
4908 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
4910 /* DisplayName value exists */
4912 lstrcpyA(buf
, "apple");
4913 r
= pMsiGetProductInfoExA(prodcode
, usersid
,
4914 MSIINSTALLCONTEXT_USERMANAGED
,
4915 INSTALLPROPERTY_INSTALLEDPRODUCTNAME
, buf
, &sz
);
4916 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
4917 ok(!lstrcmpA(buf
, "name"), "Expected \"name\", got \"%s\"\n", buf
);
4918 ok(sz
== 4, "Expected 4, got %d\n", sz
);
4920 res
= RegSetValueExA(propkey
, "InstallLocation", 0, REG_SZ
, (LPBYTE
)"loc", 4);
4921 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
4923 /* InstallLocation value exists */
4925 lstrcpyA(buf
, "apple");
4926 r
= pMsiGetProductInfoExA(prodcode
, usersid
,
4927 MSIINSTALLCONTEXT_USERMANAGED
,
4928 INSTALLPROPERTY_INSTALLLOCATION
, buf
, &sz
);
4929 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
4930 ok(!lstrcmpA(buf
, "loc"), "Expected \"loc\", got \"%s\"\n", buf
);
4931 ok(sz
== 3, "Expected 3, got %d\n", sz
);
4933 res
= RegSetValueExA(propkey
, "InstallSource", 0, REG_SZ
, (LPBYTE
)"source", 7);
4934 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
4936 /* InstallSource value exists */
4938 lstrcpyA(buf
, "apple");
4939 r
= pMsiGetProductInfoExA(prodcode
, usersid
,
4940 MSIINSTALLCONTEXT_USERMANAGED
,
4941 INSTALLPROPERTY_INSTALLSOURCE
, buf
, &sz
);
4942 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
4943 ok(!lstrcmpA(buf
, "source"), "Expected \"source\", got \"%s\"\n", buf
);
4944 ok(sz
== 6, "Expected 6, got %d\n", sz
);
4946 res
= RegSetValueExA(propkey
, "LocalPackage", 0, REG_SZ
, (LPBYTE
)"local", 6);
4947 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
4949 /* LocalPackage value exists */
4951 lstrcpyA(buf
, "apple");
4952 r
= pMsiGetProductInfoExA(prodcode
, usersid
,
4953 MSIINSTALLCONTEXT_USERMANAGED
,
4954 INSTALLPROPERTY_LOCALPACKAGE
, buf
, &sz
);
4955 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
4956 ok(!lstrcmpA(buf
, "local"), "Expected \"local\", got \"%s\"\n", buf
);
4957 ok(sz
== 5, "Expected 5, got %d\n", sz
);
4959 res
= RegSetValueExA(propkey
, "Publisher", 0, REG_SZ
, (LPBYTE
)"pub", 4);
4960 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
4962 /* Publisher value exists */
4964 lstrcpyA(buf
, "apple");
4965 r
= pMsiGetProductInfoExA(prodcode
, usersid
,
4966 MSIINSTALLCONTEXT_USERMANAGED
,
4967 INSTALLPROPERTY_PUBLISHER
, buf
, &sz
);
4968 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
4969 ok(!lstrcmpA(buf
, "pub"), "Expected \"pub\", got \"%s\"\n", buf
);
4970 ok(sz
== 3, "Expected 3, got %d\n", sz
);
4972 res
= RegSetValueExA(propkey
, "URLInfoAbout", 0, REG_SZ
, (LPBYTE
)"about", 6);
4973 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
4975 /* URLInfoAbout value exists */
4977 lstrcpyA(buf
, "apple");
4978 r
= pMsiGetProductInfoExA(prodcode
, usersid
,
4979 MSIINSTALLCONTEXT_USERMANAGED
,
4980 INSTALLPROPERTY_URLINFOABOUT
, buf
, &sz
);
4981 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
4982 ok(!lstrcmpA(buf
, "about"), "Expected \"about\", got \"%s\"\n", buf
);
4983 ok(sz
== 5, "Expected 5, got %d\n", sz
);
4985 res
= RegSetValueExA(propkey
, "URLUpdateInfo", 0, REG_SZ
, (LPBYTE
)"update", 7);
4986 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
4988 /* URLUpdateInfo value exists */
4990 lstrcpyA(buf
, "apple");
4991 r
= pMsiGetProductInfoExA(prodcode
, usersid
,
4992 MSIINSTALLCONTEXT_USERMANAGED
,
4993 INSTALLPROPERTY_URLUPDATEINFO
, buf
, &sz
);
4994 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
4995 ok(!lstrcmpA(buf
, "update"), "Expected \"update\", got \"%s\"\n", buf
);
4996 ok(sz
== 6, "Expected 6, got %d\n", sz
);
4998 res
= RegSetValueExA(propkey
, "VersionMinor", 0, REG_SZ
, (LPBYTE
)"2", 2);
4999 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
5001 /* VersionMinor value exists */
5003 lstrcpyA(buf
, "apple");
5004 r
= pMsiGetProductInfoExA(prodcode
, usersid
,
5005 MSIINSTALLCONTEXT_USERMANAGED
,
5006 INSTALLPROPERTY_VERSIONMINOR
, buf
, &sz
);
5007 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5008 ok(!lstrcmpA(buf
, "2"), "Expected \"2\", got \"%s\"\n", buf
);
5009 ok(sz
== 1, "Expected 1, got %d\n", sz
);
5011 res
= RegSetValueExA(propkey
, "VersionMajor", 0, REG_SZ
, (LPBYTE
)"3", 2);
5012 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
5014 /* VersionMajor value exists */
5016 lstrcpyA(buf
, "apple");
5017 r
= pMsiGetProductInfoExA(prodcode
, usersid
,
5018 MSIINSTALLCONTEXT_USERMANAGED
,
5019 INSTALLPROPERTY_VERSIONMAJOR
, buf
, &sz
);
5020 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5021 ok(!lstrcmpA(buf
, "3"), "Expected \"3\", got \"%s\"\n", buf
);
5022 ok(sz
== 1, "Expected 1, got %d\n", sz
);
5024 res
= RegSetValueExA(propkey
, "DisplayVersion", 0, REG_SZ
, (LPBYTE
)"3.2.1", 6);
5025 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
5027 /* DisplayVersion value exists */
5029 lstrcpyA(buf
, "apple");
5030 r
= pMsiGetProductInfoExA(prodcode
, usersid
,
5031 MSIINSTALLCONTEXT_USERMANAGED
,
5032 INSTALLPROPERTY_VERSIONSTRING
, buf
, &sz
);
5033 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5034 ok(!lstrcmpA(buf
, "3.2.1"), "Expected \"3.2.1\", got \"%s\"\n", buf
);
5035 ok(sz
== 5, "Expected 5, got %d\n", sz
);
5037 res
= RegSetValueExA(propkey
, "ProductID", 0, REG_SZ
, (LPBYTE
)"id", 3);
5038 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
5040 /* ProductID value exists */
5042 lstrcpyA(buf
, "apple");
5043 r
= pMsiGetProductInfoExA(prodcode
, usersid
,
5044 MSIINSTALLCONTEXT_USERMANAGED
,
5045 INSTALLPROPERTY_PRODUCTID
, buf
, &sz
);
5046 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5047 ok(!lstrcmpA(buf
, "id"), "Expected \"id\", got \"%s\"\n", buf
);
5048 ok(sz
== 2, "Expected 2, got %d\n", sz
);
5050 res
= RegSetValueExA(propkey
, "RegCompany", 0, REG_SZ
, (LPBYTE
)"comp", 5);
5051 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
5053 /* RegCompany value exists */
5055 lstrcpyA(buf
, "apple");
5056 r
= pMsiGetProductInfoExA(prodcode
, usersid
,
5057 MSIINSTALLCONTEXT_USERMANAGED
,
5058 INSTALLPROPERTY_REGCOMPANY
, buf
, &sz
);
5059 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5060 ok(!lstrcmpA(buf
, "comp"), "Expected \"comp\", got \"%s\"\n", buf
);
5061 ok(sz
== 4, "Expected 4, got %d\n", sz
);
5063 res
= RegSetValueExA(propkey
, "RegOwner", 0, REG_SZ
, (LPBYTE
)"owner", 6);
5064 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
5066 /* RegOwner value exists */
5068 lstrcpyA(buf
, "apple");
5069 r
= pMsiGetProductInfoExA(prodcode
, usersid
,
5070 MSIINSTALLCONTEXT_USERMANAGED
,
5071 INSTALLPROPERTY_REGOWNER
, buf
, &sz
);
5072 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5073 ok(!lstrcmpA(buf
, "owner"), "Expected \"owner\", got \"%s\"\n", buf
);
5074 ok(sz
== 5, "Expected 5, got %d\n", sz
);
5076 res
= RegSetValueExA(propkey
, "Transforms", 0, REG_SZ
, (LPBYTE
)"trans", 6);
5077 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
5079 /* Transforms value exists */
5081 lstrcpyA(buf
, "apple");
5082 r
= pMsiGetProductInfoExA(prodcode
, usersid
,
5083 MSIINSTALLCONTEXT_USERMANAGED
,
5084 INSTALLPROPERTY_TRANSFORMS
, buf
, &sz
);
5085 ok(r
== ERROR_UNKNOWN_PRODUCT
,
5086 "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r
);
5087 ok(!lstrcmpA(buf
, "apple"), "Expected buf to be unchanged, got %s\n", buf
);
5088 ok(sz
== MAX_PATH
, "Expected MAX_PATH, got %d\n", sz
);
5090 res
= RegSetValueExA(propkey
, "Language", 0, REG_SZ
, (LPBYTE
)"lang", 5);
5091 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
5093 /* Language value exists */
5095 lstrcpyA(buf
, "apple");
5096 r
= pMsiGetProductInfoExA(prodcode
, usersid
,
5097 MSIINSTALLCONTEXT_USERMANAGED
,
5098 INSTALLPROPERTY_LANGUAGE
, buf
, &sz
);
5099 ok(r
== ERROR_UNKNOWN_PRODUCT
,
5100 "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r
);
5101 ok(!lstrcmpA(buf
, "apple"), "Expected buf to be unchanged, got %s\n", buf
);
5102 ok(sz
== MAX_PATH
, "Expected MAX_PATH, got %d\n", sz
);
5104 res
= RegSetValueExA(propkey
, "ProductName", 0, REG_SZ
, (LPBYTE
)"name", 5);
5105 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
5107 /* ProductName value exists */
5109 lstrcpyA(buf
, "apple");
5110 r
= pMsiGetProductInfoExA(prodcode
, usersid
,
5111 MSIINSTALLCONTEXT_USERMANAGED
,
5112 INSTALLPROPERTY_PRODUCTNAME
, buf
, &sz
);
5113 ok(r
== ERROR_UNKNOWN_PRODUCT
,
5114 "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r
);
5115 ok(!lstrcmpA(buf
, "apple"), "Expected buf to be unchanged, got %s\n", buf
);
5116 ok(sz
== MAX_PATH
, "Expected MAX_PATH, got %d\n", sz
);
5118 res
= RegSetValueExA(propkey
, "AssignmentType", 0, REG_SZ
, (LPBYTE
)"type", 5);
5119 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
5123 /* AssignmentType value exists */
5125 lstrcpyA(buf
, "apple");
5126 r
= pMsiGetProductInfoExA(prodcode
, usersid
,
5127 MSIINSTALLCONTEXT_USERMANAGED
,
5128 INSTALLPROPERTY_ASSIGNMENTTYPE
, buf
, &sz
);
5129 ok(r
== ERROR_UNKNOWN_PRODUCT
,
5130 "Expected ERROR_UNKNOWN_PRODUCT, 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(propkey
, "PackageCode", 0, REG_SZ
, (LPBYTE
)"code", 5);
5135 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
5137 /* PackageCode value exists */
5139 lstrcpyA(buf
, "apple");
5140 r
= pMsiGetProductInfoExA(prodcode
, usersid
,
5141 MSIINSTALLCONTEXT_USERMANAGED
,
5142 INSTALLPROPERTY_PACKAGECODE
, buf
, &sz
);
5143 ok(r
== ERROR_UNKNOWN_PRODUCT
,
5144 "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r
);
5145 ok(!lstrcmpA(buf
, "apple"), "Expected buf to be unchanged, got %s\n", buf
);
5146 ok(sz
== MAX_PATH
, "Expected MAX_PATH, got %d\n", sz
);
5148 res
= RegSetValueExA(propkey
, "Version", 0, REG_SZ
, (LPBYTE
)"ver", 4);
5149 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
5151 /* Version value exists */
5153 lstrcpyA(buf
, "apple");
5154 r
= pMsiGetProductInfoExA(prodcode
, usersid
,
5155 MSIINSTALLCONTEXT_USERMANAGED
,
5156 INSTALLPROPERTY_VERSION
, buf
, &sz
);
5157 ok(r
== ERROR_UNKNOWN_PRODUCT
,
5158 "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r
);
5159 ok(!lstrcmpA(buf
, "apple"), "Expected buf to be unchanged, got %s\n", buf
);
5160 ok(sz
== MAX_PATH
, "Expected MAX_PATH, got %d\n", sz
);
5162 res
= RegSetValueExA(propkey
, "ProductIcon", 0, REG_SZ
, (LPBYTE
)"icon", 5);
5163 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
5165 /* ProductIcon value exists */
5167 lstrcpyA(buf
, "apple");
5168 r
= pMsiGetProductInfoExA(prodcode
, usersid
,
5169 MSIINSTALLCONTEXT_USERMANAGED
,
5170 INSTALLPROPERTY_PRODUCTICON
, buf
, &sz
);
5171 ok(r
== ERROR_UNKNOWN_PRODUCT
,
5172 "Expected ERROR_UNKNOWN_PRODUCT, 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(propkey
, "PackageName", 0, REG_SZ
, (LPBYTE
)"name", 5);
5177 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
5179 /* PackageName value exists */
5181 lstrcpyA(buf
, "apple");
5182 r
= pMsiGetProductInfoExA(prodcode
, usersid
,
5183 MSIINSTALLCONTEXT_USERMANAGED
,
5184 INSTALLPROPERTY_PACKAGENAME
, buf
, &sz
);
5185 ok(r
== ERROR_UNKNOWN_PRODUCT
,
5186 "Expected ERROR_UNKNOWN_PRODUCT, 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(propkey
, "AuthorizedLUAApp", 0, REG_SZ
, (LPBYTE
)"auth", 5);
5191 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
5193 /* AuthorizedLUAApp value exists */
5195 lstrcpyA(buf
, "apple");
5196 r
= pMsiGetProductInfoExA(prodcode
, usersid
,
5197 MSIINSTALLCONTEXT_USERMANAGED
,
5198 INSTALLPROPERTY_AUTHORIZED_LUA_APP
, buf
, &sz
);
5199 ok(r
== ERROR_UNKNOWN_PRODUCT
,
5200 "Expected ERROR_UNKNOWN_PRODUCT, 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 RegDeleteValueA(propkey
, "AuthorizedLUAApp");
5205 RegDeleteValueA(propkey
, "PackageName");
5206 RegDeleteValueA(propkey
, "ProductIcon");
5207 RegDeleteValueA(propkey
, "Version");
5208 RegDeleteValueA(propkey
, "PackageCode");
5209 RegDeleteValueA(propkey
, "AssignmentType");
5210 RegDeleteValueA(propkey
, "ProductName");
5211 RegDeleteValueA(propkey
, "Language");
5212 RegDeleteValueA(propkey
, "Transforms");
5213 RegDeleteValueA(propkey
, "RegOwner");
5214 RegDeleteValueA(propkey
, "RegCompany");
5215 RegDeleteValueA(propkey
, "ProductID");
5216 RegDeleteValueA(propkey
, "DisplayVersion");
5217 RegDeleteValueA(propkey
, "VersionMajor");
5218 RegDeleteValueA(propkey
, "VersionMinor");
5219 RegDeleteValueA(propkey
, "URLUpdateInfo");
5220 RegDeleteValueA(propkey
, "URLInfoAbout");
5221 RegDeleteValueA(propkey
, "Publisher");
5222 RegDeleteValueA(propkey
, "LocalPackage");
5223 RegDeleteValueA(propkey
, "InstallSource");
5224 RegDeleteValueA(propkey
, "InstallLocation");
5225 RegDeleteValueA(propkey
, "DisplayName");
5226 RegDeleteValueA(propkey
, "InstallDate");
5227 RegDeleteValueA(propkey
, "HelpTelephone");
5228 RegDeleteValueA(propkey
, "HelpLink");
5229 RegDeleteValueA(propkey
, "ManagedLocalPackage");
5230 RegDeleteKeyA(propkey
, "");
5231 RegCloseKey(propkey
);
5232 RegDeleteKeyA(localkey
, "");
5233 RegCloseKey(localkey
);
5235 lstrcpyA(keypath
, "Software\\Microsoft\\Windows\\CurrentVersion\\Installer\\Managed\\");
5236 lstrcatA(keypath
, usersid
);
5237 lstrcatA(keypath
, "\\Installer\\Products\\");
5238 lstrcatA(keypath
, prod_squashed
);
5240 res
= RegCreateKeyA(HKEY_LOCAL_MACHINE
, keypath
, &userkey
);
5241 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
5243 /* user product key exists */
5245 lstrcpyA(buf
, "apple");
5246 r
= pMsiGetProductInfoExA(prodcode
, usersid
,
5247 MSIINSTALLCONTEXT_USERMANAGED
,
5248 INSTALLPROPERTY_PRODUCTSTATE
, buf
, &sz
);
5249 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5250 ok(!lstrcmpA(buf
, "1"), "Expected \"1\", got \"%s\"\n", buf
);
5251 ok(sz
== 1, "Expected 1, got %d\n", sz
);
5253 RegDeleteKeyA(userkey
, "");
5254 RegCloseKey(userkey
);
5256 lstrcpyA(keypath
, "Software\\Microsoft\\Installer\\Products\\");
5257 lstrcatA(keypath
, prod_squashed
);
5259 res
= RegCreateKeyA(HKEY_CURRENT_USER
, keypath
, &prodkey
);
5260 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
5262 /* current user product key exists */
5264 lstrcpyA(buf
, "apple");
5265 r
= pMsiGetProductInfoExA(prodcode
, usersid
,
5266 MSIINSTALLCONTEXT_USERMANAGED
,
5267 INSTALLPROPERTY_PRODUCTSTATE
, buf
, &sz
);
5268 ok(r
== ERROR_UNKNOWN_PRODUCT
,
5269 "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r
);
5270 ok(!lstrcmpA(buf
, "apple"), "Expected buf to be unchanged, got %s\n", buf
);
5271 ok(sz
== MAX_PATH
, "Expected MAX_PATH, got %d\n", sz
);
5273 res
= RegSetValueExA(prodkey
, "HelpLink", 0, REG_SZ
, (LPBYTE
)"link", 5);
5274 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
5276 /* HelpLink value exists, user product key does not exist */
5278 lstrcpyA(buf
, "apple");
5279 r
= pMsiGetProductInfoExA(prodcode
, usersid
,
5280 MSIINSTALLCONTEXT_USERMANAGED
,
5281 INSTALLPROPERTY_HELPLINK
, buf
, &sz
);
5282 ok(r
== ERROR_UNKNOWN_PRODUCT
,
5283 "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r
);
5284 ok(!lstrcmpA(buf
, "apple"), "Expected buf to be unchanged, got %s\n", buf
);
5285 ok(sz
== MAX_PATH
, "Expected MAX_PATH, got %d\n", sz
);
5287 lstrcpyA(keypath
, "Software\\Microsoft\\Windows\\CurrentVersion\\Installer\\Managed\\");
5288 lstrcatA(keypath
, usersid
);
5289 lstrcatA(keypath
, "\\Installer\\Products\\");
5290 lstrcatA(keypath
, prod_squashed
);
5292 res
= RegCreateKeyA(HKEY_LOCAL_MACHINE
, keypath
, &userkey
);
5293 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
5295 res
= RegSetValueExA(userkey
, "HelpLink", 0, REG_SZ
, (LPBYTE
)"link", 5);
5296 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
5298 /* HelpLink value exists, user product key does exist */
5300 lstrcpyA(buf
, "apple");
5301 r
= pMsiGetProductInfoExA(prodcode
, usersid
,
5302 MSIINSTALLCONTEXT_USERMANAGED
,
5303 INSTALLPROPERTY_HELPLINK
, buf
, &sz
);
5304 ok(r
== ERROR_UNKNOWN_PROPERTY
,
5305 "Expected ERROR_UNKNOWN_PROPERTY, got %d\n", r
);
5306 ok(!lstrcmpA(buf
, "apple"), "Expected buf to be unchanged, got %s\n", buf
);
5307 ok(sz
== MAX_PATH
, "Expected MAX_PATH, got %d\n", sz
);
5309 res
= RegSetValueExA(userkey
, "HelpTelephone", 0, REG_SZ
, (LPBYTE
)"phone", 6);
5310 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
5312 /* HelpTelephone value exists */
5314 lstrcpyA(buf
, "apple");
5315 r
= pMsiGetProductInfoExA(prodcode
, usersid
,
5316 MSIINSTALLCONTEXT_USERMANAGED
,
5317 INSTALLPROPERTY_HELPTELEPHONE
, buf
, &sz
);
5318 ok(r
== ERROR_UNKNOWN_PROPERTY
,
5319 "Expected ERROR_UNKNOWN_PROPERTY, got %d\n", r
);
5320 ok(!lstrcmpA(buf
, "apple"), "Expected buf to be unchanged, got %s\n", buf
);
5321 ok(sz
== MAX_PATH
, "Expected MAX_PATH, got %d\n", sz
);
5323 res
= RegSetValueExA(userkey
, "InstallDate", 0, REG_SZ
, (LPBYTE
)"date", 5);
5324 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
5326 /* InstallDate value exists */
5328 lstrcpyA(buf
, "apple");
5329 r
= pMsiGetProductInfoExA(prodcode
, usersid
,
5330 MSIINSTALLCONTEXT_USERMANAGED
,
5331 INSTALLPROPERTY_INSTALLDATE
, buf
, &sz
);
5332 ok(r
== ERROR_UNKNOWN_PROPERTY
,
5333 "Expected ERROR_UNKNOWN_PROPERTY, got %d\n", r
);
5334 ok(!lstrcmpA(buf
, "apple"), "Expected buf to be unchanged, got %s\n", buf
);
5335 ok(sz
== MAX_PATH
, "Expected MAX_PATH, got %d\n", sz
);
5337 res
= RegSetValueExA(userkey
, "DisplayName", 0, REG_SZ
, (LPBYTE
)"name", 5);
5338 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
5340 /* DisplayName value exists */
5342 lstrcpyA(buf
, "apple");
5343 r
= pMsiGetProductInfoExA(prodcode
, usersid
,
5344 MSIINSTALLCONTEXT_USERMANAGED
,
5345 INSTALLPROPERTY_INSTALLEDPRODUCTNAME
, buf
, &sz
);
5346 ok(r
== ERROR_UNKNOWN_PROPERTY
,
5347 "Expected ERROR_UNKNOWN_PROPERTY, got %d\n", r
);
5348 ok(!lstrcmpA(buf
, "apple"), "Expected buf to be unchanged, got %s\n", buf
);
5349 ok(sz
== MAX_PATH
, "Expected MAX_PATH, got %d\n", sz
);
5351 res
= RegSetValueExA(userkey
, "InstallLocation", 0, REG_SZ
, (LPBYTE
)"loc", 4);
5352 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
5354 /* InstallLocation value exists */
5356 lstrcpyA(buf
, "apple");
5357 r
= pMsiGetProductInfoExA(prodcode
, usersid
,
5358 MSIINSTALLCONTEXT_USERMANAGED
,
5359 INSTALLPROPERTY_INSTALLLOCATION
, buf
, &sz
);
5360 ok(r
== ERROR_UNKNOWN_PROPERTY
,
5361 "Expected ERROR_UNKNOWN_PROPERTY, got %d\n", r
);
5362 ok(!lstrcmpA(buf
, "apple"), "Expected buf to be unchanged, got %s\n", buf
);
5363 ok(sz
== MAX_PATH
, "Expected MAX_PATH, got %d\n", sz
);
5365 res
= RegSetValueExA(userkey
, "InstallSource", 0, REG_SZ
, (LPBYTE
)"source", 7);
5366 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
5368 /* InstallSource value exists */
5370 lstrcpyA(buf
, "apple");
5371 r
= pMsiGetProductInfoExA(prodcode
, usersid
,
5372 MSIINSTALLCONTEXT_USERMANAGED
,
5373 INSTALLPROPERTY_INSTALLSOURCE
, buf
, &sz
);
5374 ok(r
== ERROR_UNKNOWN_PROPERTY
,
5375 "Expected ERROR_UNKNOWN_PROPERTY, got %d\n", r
);
5376 ok(!lstrcmpA(buf
, "apple"), "Expected buf to be unchanged, got %s\n", buf
);
5377 ok(sz
== MAX_PATH
, "Expected MAX_PATH, got %d\n", sz
);
5379 res
= RegSetValueExA(userkey
, "LocalPackage", 0, REG_SZ
, (LPBYTE
)"local", 6);
5380 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
5382 /* LocalPackage value exists */
5384 lstrcpyA(buf
, "apple");
5385 r
= pMsiGetProductInfoExA(prodcode
, usersid
,
5386 MSIINSTALLCONTEXT_USERMANAGED
,
5387 INSTALLPROPERTY_LOCALPACKAGE
, buf
, &sz
);
5388 ok(r
== ERROR_UNKNOWN_PROPERTY
,
5389 "Expected ERROR_UNKNOWN_PROPERTY, got %d\n", r
);
5390 ok(!lstrcmpA(buf
, "apple"), "Expected buf to be unchanged, got %s\n", buf
);
5391 ok(sz
== MAX_PATH
, "Expected MAX_PATH, got %d\n", sz
);
5393 res
= RegSetValueExA(userkey
, "Publisher", 0, REG_SZ
, (LPBYTE
)"pub", 4);
5394 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
5396 /* Publisher value exists */
5398 lstrcpyA(buf
, "apple");
5399 r
= pMsiGetProductInfoExA(prodcode
, usersid
,
5400 MSIINSTALLCONTEXT_USERMANAGED
,
5401 INSTALLPROPERTY_PUBLISHER
, buf
, &sz
);
5402 ok(r
== ERROR_UNKNOWN_PROPERTY
,
5403 "Expected ERROR_UNKNOWN_PROPERTY, got %d\n", r
);
5404 ok(!lstrcmpA(buf
, "apple"), "Expected buf to be unchanged, got %s\n", buf
);
5405 ok(sz
== MAX_PATH
, "Expected MAX_PATH, got %d\n", sz
);
5407 res
= RegSetValueExA(userkey
, "URLInfoAbout", 0, REG_SZ
, (LPBYTE
)"about", 6);
5408 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
5410 /* URLInfoAbout value exists */
5412 lstrcpyA(buf
, "apple");
5413 r
= pMsiGetProductInfoExA(prodcode
, usersid
,
5414 MSIINSTALLCONTEXT_USERMANAGED
,
5415 INSTALLPROPERTY_URLINFOABOUT
, buf
, &sz
);
5416 ok(r
== ERROR_UNKNOWN_PROPERTY
,
5417 "Expected ERROR_UNKNOWN_PROPERTY, got %d\n", r
);
5418 ok(!lstrcmpA(buf
, "apple"), "Expected buf to be unchanged, got %s\n", buf
);
5419 ok(sz
== MAX_PATH
, "Expected MAX_PATH, got %d\n", sz
);
5421 res
= RegSetValueExA(userkey
, "URLUpdateInfo", 0, REG_SZ
, (LPBYTE
)"update", 7);
5422 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
5424 /* URLUpdateInfo value exists */
5426 lstrcpyA(buf
, "apple");
5427 r
= pMsiGetProductInfoExA(prodcode
, usersid
,
5428 MSIINSTALLCONTEXT_USERMANAGED
,
5429 INSTALLPROPERTY_URLUPDATEINFO
, buf
, &sz
);
5430 ok(r
== ERROR_UNKNOWN_PROPERTY
,
5431 "Expected ERROR_UNKNOWN_PROPERTY, got %d\n", r
);
5432 ok(!lstrcmpA(buf
, "apple"), "Expected buf to be unchanged, got %s\n", buf
);
5433 ok(sz
== MAX_PATH
, "Expected MAX_PATH, got %d\n", sz
);
5435 res
= RegSetValueExA(userkey
, "VersionMinor", 0, REG_SZ
, (LPBYTE
)"2", 2);
5436 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
5438 /* VersionMinor value exists */
5440 lstrcpyA(buf
, "apple");
5441 r
= pMsiGetProductInfoExA(prodcode
, usersid
,
5442 MSIINSTALLCONTEXT_USERMANAGED
,
5443 INSTALLPROPERTY_VERSIONMINOR
, buf
, &sz
);
5444 ok(r
== ERROR_UNKNOWN_PROPERTY
,
5445 "Expected ERROR_UNKNOWN_PROPERTY, got %d\n", r
);
5446 ok(!lstrcmpA(buf
, "apple"), "Expected buf to be unchanged, got %s\n", buf
);
5447 ok(sz
== MAX_PATH
, "Expected MAX_PATH, got %d\n", sz
);
5449 res
= RegSetValueExA(userkey
, "VersionMajor", 0, REG_SZ
, (LPBYTE
)"3", 2);
5450 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
5452 /* VersionMajor value exists */
5454 lstrcpyA(buf
, "apple");
5455 r
= pMsiGetProductInfoExA(prodcode
, usersid
,
5456 MSIINSTALLCONTEXT_USERMANAGED
,
5457 INSTALLPROPERTY_VERSIONMAJOR
, buf
, &sz
);
5458 ok(r
== ERROR_UNKNOWN_PROPERTY
,
5459 "Expected ERROR_UNKNOWN_PROPERTY, got %d\n", r
);
5460 ok(!lstrcmpA(buf
, "apple"), "Expected buf to be unchanged, got %s\n", buf
);
5461 ok(sz
== MAX_PATH
, "Expected MAX_PATH, got %d\n", sz
);
5463 res
= RegSetValueExA(userkey
, "DisplayVersion", 0, REG_SZ
, (LPBYTE
)"3.2.1", 6);
5464 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
5466 /* DisplayVersion value exists */
5468 lstrcpyA(buf
, "apple");
5469 r
= pMsiGetProductInfoExA(prodcode
, usersid
,
5470 MSIINSTALLCONTEXT_USERMANAGED
,
5471 INSTALLPROPERTY_VERSIONSTRING
, buf
, &sz
);
5472 ok(r
== ERROR_UNKNOWN_PROPERTY
,
5473 "Expected ERROR_UNKNOWN_PROPERTY, got %d\n", r
);
5474 ok(!lstrcmpA(buf
, "apple"), "Expected buf to be unchanged, got %s\n", buf
);
5475 ok(sz
== MAX_PATH
, "Expected MAX_PATH, got %d\n", sz
);
5477 res
= RegSetValueExA(userkey
, "ProductID", 0, REG_SZ
, (LPBYTE
)"id", 3);
5478 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
5480 /* ProductID value exists */
5482 lstrcpyA(buf
, "apple");
5483 r
= pMsiGetProductInfoExA(prodcode
, usersid
,
5484 MSIINSTALLCONTEXT_USERMANAGED
,
5485 INSTALLPROPERTY_PRODUCTID
, buf
, &sz
);
5486 ok(r
== ERROR_UNKNOWN_PROPERTY
,
5487 "Expected ERROR_UNKNOWN_PROPERTY, got %d\n", r
);
5488 ok(!lstrcmpA(buf
, "apple"), "Expected buf to be unchanged, got %s\n", buf
);
5489 ok(sz
== MAX_PATH
, "Expected MAX_PATH, got %d\n", sz
);
5491 res
= RegSetValueExA(userkey
, "RegCompany", 0, REG_SZ
, (LPBYTE
)"comp", 5);
5492 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
5494 /* RegCompany value exists */
5496 lstrcpyA(buf
, "apple");
5497 r
= pMsiGetProductInfoExA(prodcode
, usersid
,
5498 MSIINSTALLCONTEXT_USERMANAGED
,
5499 INSTALLPROPERTY_REGCOMPANY
, buf
, &sz
);
5500 ok(r
== ERROR_UNKNOWN_PROPERTY
,
5501 "Expected ERROR_UNKNOWN_PROPERTY, got %d\n", r
);
5502 ok(!lstrcmpA(buf
, "apple"), "Expected buf to be unchanged, got %s\n", buf
);
5503 ok(sz
== MAX_PATH
, "Expected MAX_PATH, got %d\n", sz
);
5505 res
= RegSetValueExA(userkey
, "RegOwner", 0, REG_SZ
, (LPBYTE
)"owner", 6);
5506 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
5508 /* RegOwner value exists */
5510 lstrcpyA(buf
, "apple");
5511 r
= pMsiGetProductInfoExA(prodcode
, usersid
,
5512 MSIINSTALLCONTEXT_USERMANAGED
,
5513 INSTALLPROPERTY_REGOWNER
, buf
, &sz
);
5514 ok(r
== ERROR_UNKNOWN_PROPERTY
,
5515 "Expected ERROR_UNKNOWN_PROPERTY, got %d\n", r
);
5516 ok(!lstrcmpA(buf
, "apple"), "Expected buf to be unchanged, got %s\n", buf
);
5517 ok(sz
== MAX_PATH
, "Expected MAX_PATH, got %d\n", sz
);
5519 res
= RegSetValueExA(userkey
, "Transforms", 0, REG_SZ
, (LPBYTE
)"trans", 6);
5520 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
5522 /* Transforms value exists */
5524 lstrcpyA(buf
, "apple");
5525 r
= pMsiGetProductInfoExA(prodcode
, usersid
,
5526 MSIINSTALLCONTEXT_USERMANAGED
,
5527 INSTALLPROPERTY_TRANSFORMS
, buf
, &sz
);
5528 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5529 ok(!lstrcmpA(buf
, "trans"), "Expected \"trans\", got \"%s\"\n", buf
);
5530 ok(sz
== 5, "Expected 5, got %d\n", sz
);
5532 res
= RegSetValueExA(userkey
, "Language", 0, REG_SZ
, (LPBYTE
)"lang", 5);
5533 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
5535 /* Language value exists */
5537 lstrcpyA(buf
, "apple");
5538 r
= pMsiGetProductInfoExA(prodcode
, usersid
,
5539 MSIINSTALLCONTEXT_USERMANAGED
,
5540 INSTALLPROPERTY_LANGUAGE
, buf
, &sz
);
5541 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5542 ok(!lstrcmpA(buf
, "lang"), "Expected \"lang\", got \"%s\"\n", buf
);
5543 ok(sz
== 4, "Expected 4, got %d\n", sz
);
5545 res
= RegSetValueExA(userkey
, "ProductName", 0, REG_SZ
, (LPBYTE
)"name", 5);
5546 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
5548 /* ProductName value exists */
5550 lstrcpyA(buf
, "apple");
5551 r
= pMsiGetProductInfoExA(prodcode
, usersid
,
5552 MSIINSTALLCONTEXT_USERMANAGED
,
5553 INSTALLPROPERTY_PRODUCTNAME
, buf
, &sz
);
5554 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5555 ok(!lstrcmpA(buf
, "name"), "Expected \"name\", got \"%s\"\n", buf
);
5556 ok(sz
== 4, "Expected 4, got %d\n", sz
);
5558 res
= RegSetValueExA(userkey
, "AssignmentType", 0, REG_SZ
, (LPBYTE
)"type", 5);
5559 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
5563 /* AssignmentType value exists */
5565 lstrcpyA(buf
, "apple");
5566 r
= pMsiGetProductInfoExA(prodcode
, usersid
,
5567 MSIINSTALLCONTEXT_USERMANAGED
,
5568 INSTALLPROPERTY_ASSIGNMENTTYPE
, buf
, &sz
);
5569 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5570 ok(!lstrcmpA(buf
, ""), "Expected \"\", got \"%s\"\n", buf
);
5571 ok(sz
== 0, "Expected 0, got %d\n", sz
);
5573 res
= RegSetValueExA(userkey
, "PackageCode", 0, REG_SZ
, (LPBYTE
)"code", 5);
5574 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
5578 /* PackageCode value exists */
5580 lstrcpyA(buf
, "apple");
5581 r
= pMsiGetProductInfoExA(prodcode
, usersid
,
5582 MSIINSTALLCONTEXT_USERMANAGED
,
5583 INSTALLPROPERTY_PACKAGECODE
, buf
, &sz
);
5586 ok(r
== ERROR_BAD_CONFIGURATION
,
5587 "Expected ERROR_BAD_CONFIGURATION, got %d\n", r
);
5588 ok(!lstrcmpA(buf
, "apple"), "Expected buf to be unchanged, got %s\n", buf
);
5589 ok(sz
== MAX_PATH
, "Expected MAX_PATH, got %d\n", sz
);
5592 res
= RegSetValueExA(userkey
, "Version", 0, REG_SZ
, (LPBYTE
)"ver", 4);
5593 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
5595 /* Version value exists */
5597 lstrcpyA(buf
, "apple");
5598 r
= pMsiGetProductInfoExA(prodcode
, usersid
,
5599 MSIINSTALLCONTEXT_USERMANAGED
,
5600 INSTALLPROPERTY_VERSION
, buf
, &sz
);
5601 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5602 ok(!lstrcmpA(buf
, "ver"), "Expected \"ver\", got \"%s\"\n", buf
);
5603 ok(sz
== 3, "Expected 3, got %d\n", sz
);
5605 res
= RegSetValueExA(userkey
, "ProductIcon", 0, REG_SZ
, (LPBYTE
)"icon", 5);
5606 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
5608 /* ProductIcon value exists */
5610 lstrcpyA(buf
, "apple");
5611 r
= pMsiGetProductInfoExA(prodcode
, usersid
,
5612 MSIINSTALLCONTEXT_USERMANAGED
,
5613 INSTALLPROPERTY_PRODUCTICON
, buf
, &sz
);
5614 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5615 ok(!lstrcmpA(buf
, "icon"), "Expected \"icon\", got \"%s\"\n", buf
);
5616 ok(sz
== 4, "Expected 4, got %d\n", sz
);
5618 res
= RegSetValueExA(userkey
, "PackageName", 0, REG_SZ
, (LPBYTE
)"name", 5);
5619 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
5621 /* PackageName value exists */
5623 lstrcpyA(buf
, "apple");
5624 r
= pMsiGetProductInfoExA(prodcode
, usersid
,
5625 MSIINSTALLCONTEXT_USERMANAGED
,
5626 INSTALLPROPERTY_PACKAGENAME
, buf
, &sz
);
5629 ok(r
== ERROR_UNKNOWN_PRODUCT
,
5630 "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r
);
5631 ok(!lstrcmpA(buf
, "apple"), "Expected buf to be unchanged, got %s\n", buf
);
5632 ok(sz
== MAX_PATH
, "Expected MAX_PATH, got %d\n", sz
);
5635 res
= RegSetValueExA(userkey
, "AuthorizedLUAApp", 0, REG_SZ
, (LPBYTE
)"auth", 5);
5636 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
5638 /* AuthorizedLUAApp value exists */
5640 lstrcpyA(buf
, "apple");
5641 r
= pMsiGetProductInfoExA(prodcode
, usersid
,
5642 MSIINSTALLCONTEXT_USERMANAGED
,
5643 INSTALLPROPERTY_AUTHORIZED_LUA_APP
, buf
, &sz
);
5644 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5645 ok(!lstrcmpA(buf
, "auth"), "Expected \"auth\", got \"%s\"\n", buf
);
5646 ok(sz
== 4, "Expected 4, got %d\n", sz
);
5648 RegDeleteValueA(userkey
, "AuthorizedLUAApp");
5649 RegDeleteValueA(userkey
, "PackageName");
5650 RegDeleteValueA(userkey
, "ProductIcon");
5651 RegDeleteValueA(userkey
, "Version");
5652 RegDeleteValueA(userkey
, "PackageCode");
5653 RegDeleteValueA(userkey
, "AssignmentType");
5654 RegDeleteValueA(userkey
, "ProductName");
5655 RegDeleteValueA(userkey
, "Language");
5656 RegDeleteValueA(userkey
, "Transforms");
5657 RegDeleteValueA(userkey
, "RegOwner");
5658 RegDeleteValueA(userkey
, "RegCompany");
5659 RegDeleteValueA(userkey
, "ProductID");
5660 RegDeleteValueA(userkey
, "DisplayVersion");
5661 RegDeleteValueA(userkey
, "VersionMajor");
5662 RegDeleteValueA(userkey
, "VersionMinor");
5663 RegDeleteValueA(userkey
, "URLUpdateInfo");
5664 RegDeleteValueA(userkey
, "URLInfoAbout");
5665 RegDeleteValueA(userkey
, "Publisher");
5666 RegDeleteValueA(userkey
, "LocalPackage");
5667 RegDeleteValueA(userkey
, "InstallSource");
5668 RegDeleteValueA(userkey
, "InstallLocation");
5669 RegDeleteValueA(userkey
, "DisplayName");
5670 RegDeleteValueA(userkey
, "InstallDate");
5671 RegDeleteValueA(userkey
, "HelpTelephone");
5672 RegDeleteValueA(userkey
, "HelpLink");
5673 RegDeleteKeyA(userkey
, "");
5674 RegCloseKey(userkey
);
5675 RegDeleteKeyA(prodkey
, "");
5676 RegCloseKey(prodkey
);
5678 /* MSIINSTALLCONTEXT_MACHINE */
5680 /* szUserSid is non-NULL */
5682 lstrcpyA(buf
, "apple");
5683 r
= pMsiGetProductInfoExA(prodcode
, usersid
,
5684 MSIINSTALLCONTEXT_MACHINE
,
5685 INSTALLPROPERTY_PRODUCTSTATE
, buf
, &sz
);
5686 ok(r
== ERROR_INVALID_PARAMETER
,
5687 "Expected ERROR_INVALID_PARAMETER, got %d\n", r
);
5688 ok(!lstrcmpA(buf
, "apple"), "Expected buf to be unchanged, got %s\n", buf
);
5689 ok(sz
== MAX_PATH
, "Expected MAX_PATH, got %d\n", sz
);
5691 lstrcpyA(keypath
, "Software\\Microsoft\\Windows\\CurrentVersion\\Installer\\UserData\\S-1-5-18\\Products\\");
5692 lstrcatA(keypath
, prod_squashed
);
5694 res
= RegCreateKeyA(HKEY_LOCAL_MACHINE
, keypath
, &localkey
);
5695 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
5697 /* local system product key exists */
5699 lstrcpyA(buf
, "apple");
5700 r
= pMsiGetProductInfoExA(prodcode
, NULL
,
5701 MSIINSTALLCONTEXT_MACHINE
,
5702 INSTALLPROPERTY_PRODUCTSTATE
, buf
, &sz
);
5703 ok(r
== ERROR_UNKNOWN_PRODUCT
,
5704 "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r
);
5705 ok(!lstrcmpA(buf
, "apple"), "Expected buf to be unchanged, got %s\n", buf
);
5706 ok(sz
== MAX_PATH
, "Expected MAX_PATH, got %d\n", sz
);
5708 res
= RegCreateKeyA(localkey
, "InstallProperties", &propkey
);
5709 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
5711 /* InstallProperties key exists */
5713 lstrcpyA(buf
, "apple");
5714 r
= pMsiGetProductInfoExA(prodcode
, NULL
,
5715 MSIINSTALLCONTEXT_MACHINE
,
5716 INSTALLPROPERTY_PRODUCTSTATE
, buf
, &sz
);
5717 ok(r
== ERROR_UNKNOWN_PRODUCT
,
5718 "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r
);
5719 ok(!lstrcmpA(buf
, "apple"), "Expected buf to be unchanged, got %s\n", buf
);
5720 ok(sz
== MAX_PATH
, "Expected MAX_PATH, got %d\n", sz
);
5722 res
= RegSetValueExA(propkey
, "LocalPackage", 0, REG_SZ
, (LPBYTE
)"local", 6);
5723 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
5725 /* LocalPackage value exists */
5727 lstrcpyA(buf
, "apple");
5728 r
= pMsiGetProductInfoExA(prodcode
, NULL
,
5729 MSIINSTALLCONTEXT_MACHINE
,
5730 INSTALLPROPERTY_PRODUCTSTATE
, buf
, &sz
);
5731 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5732 ok(!lstrcmpA(buf
, "5"), "Expected \"5\", got \"%s\"\n", buf
);
5733 ok(sz
== 1, "Expected 1, got %d\n", sz
);
5735 res
= RegSetValueExA(propkey
, "HelpLink", 0, REG_SZ
, (LPBYTE
)"link", 5);
5736 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
5738 /* HelpLink value exists */
5740 lstrcpyA(buf
, "apple");
5741 r
= pMsiGetProductInfoExA(prodcode
, NULL
,
5742 MSIINSTALLCONTEXT_MACHINE
,
5743 INSTALLPROPERTY_HELPLINK
, buf
, &sz
);
5744 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5745 ok(!lstrcmpA(buf
, "link"), "Expected \"link\", got \"%s\"\n", buf
);
5746 ok(sz
== 4, "Expected 4, got %d\n", sz
);
5748 res
= RegSetValueExA(propkey
, "HelpTelephone", 0, REG_SZ
, (LPBYTE
)"phone", 6);
5749 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
5751 /* HelpTelephone value exists */
5753 lstrcpyA(buf
, "apple");
5754 r
= pMsiGetProductInfoExA(prodcode
, NULL
,
5755 MSIINSTALLCONTEXT_MACHINE
,
5756 INSTALLPROPERTY_HELPTELEPHONE
, buf
, &sz
);
5757 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5758 ok(!lstrcmpA(buf
, "phone"), "Expected \"phone\", got \"%s\"\n", buf
);
5759 ok(sz
== 5, "Expected 5, got %d\n", sz
);
5761 res
= RegSetValueExA(propkey
, "InstallDate", 0, REG_SZ
, (LPBYTE
)"date", 5);
5762 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
5764 /* InstallDate value exists */
5766 lstrcpyA(buf
, "apple");
5767 r
= pMsiGetProductInfoExA(prodcode
, NULL
,
5768 MSIINSTALLCONTEXT_MACHINE
,
5769 INSTALLPROPERTY_INSTALLDATE
, buf
, &sz
);
5770 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5771 ok(!lstrcmpA(buf
, "date"), "Expected \"date\", got \"%s\"\n", buf
);
5772 ok(sz
== 4, "Expected 4, got %d\n", sz
);
5774 res
= RegSetValueExA(propkey
, "DisplayName", 0, REG_SZ
, (LPBYTE
)"name", 5);
5775 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
5777 /* DisplayName value exists */
5779 lstrcpyA(buf
, "apple");
5780 r
= pMsiGetProductInfoExA(prodcode
, NULL
,
5781 MSIINSTALLCONTEXT_MACHINE
,
5782 INSTALLPROPERTY_INSTALLEDPRODUCTNAME
, buf
, &sz
);
5783 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5784 ok(!lstrcmpA(buf
, "name"), "Expected \"name\", got \"%s\"\n", buf
);
5785 ok(sz
== 4, "Expected 4, got %d\n", sz
);
5787 res
= RegSetValueExA(propkey
, "InstallLocation", 0, REG_SZ
, (LPBYTE
)"loc", 4);
5788 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
5790 /* InstallLocation value exists */
5792 lstrcpyA(buf
, "apple");
5793 r
= pMsiGetProductInfoExA(prodcode
, NULL
,
5794 MSIINSTALLCONTEXT_MACHINE
,
5795 INSTALLPROPERTY_INSTALLLOCATION
, buf
, &sz
);
5796 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5797 ok(!lstrcmpA(buf
, "loc"), "Expected \"loc\", got \"%s\"\n", buf
);
5798 ok(sz
== 3, "Expected 3, got %d\n", sz
);
5800 res
= RegSetValueExA(propkey
, "InstallSource", 0, REG_SZ
, (LPBYTE
)"source", 7);
5801 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
5803 /* InstallSource value exists */
5805 lstrcpyA(buf
, "apple");
5806 r
= pMsiGetProductInfoExA(prodcode
, NULL
,
5807 MSIINSTALLCONTEXT_MACHINE
,
5808 INSTALLPROPERTY_INSTALLSOURCE
, buf
, &sz
);
5809 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5810 ok(!lstrcmpA(buf
, "source"), "Expected \"source\", got \"%s\"\n", buf
);
5811 ok(sz
== 6, "Expected 6, got %d\n", sz
);
5813 res
= RegSetValueExA(propkey
, "LocalPackage", 0, REG_SZ
, (LPBYTE
)"local", 6);
5814 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
5816 /* LocalPackage value exists */
5818 lstrcpyA(buf
, "apple");
5819 r
= pMsiGetProductInfoExA(prodcode
, NULL
,
5820 MSIINSTALLCONTEXT_MACHINE
,
5821 INSTALLPROPERTY_LOCALPACKAGE
, buf
, &sz
);
5822 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5823 ok(!lstrcmpA(buf
, "local"), "Expected \"local\", got \"%s\"\n", buf
);
5824 ok(sz
== 5, "Expected 5, got %d\n", sz
);
5826 res
= RegSetValueExA(propkey
, "Publisher", 0, REG_SZ
, (LPBYTE
)"pub", 4);
5827 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
5829 /* Publisher value exists */
5831 lstrcpyA(buf
, "apple");
5832 r
= pMsiGetProductInfoExA(prodcode
, NULL
,
5833 MSIINSTALLCONTEXT_MACHINE
,
5834 INSTALLPROPERTY_PUBLISHER
, buf
, &sz
);
5835 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5836 ok(!lstrcmpA(buf
, "pub"), "Expected \"pub\", got \"%s\"\n", buf
);
5837 ok(sz
== 3, "Expected 3, got %d\n", sz
);
5839 res
= RegSetValueExA(propkey
, "URLInfoAbout", 0, REG_SZ
, (LPBYTE
)"about", 6);
5840 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
5842 /* URLInfoAbout value exists */
5844 lstrcpyA(buf
, "apple");
5845 r
= pMsiGetProductInfoExA(prodcode
, NULL
,
5846 MSIINSTALLCONTEXT_MACHINE
,
5847 INSTALLPROPERTY_URLINFOABOUT
, buf
, &sz
);
5848 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5849 ok(!lstrcmpA(buf
, "about"), "Expected \"about\", got \"%s\"\n", buf
);
5850 ok(sz
== 5, "Expected 5, got %d\n", sz
);
5852 res
= RegSetValueExA(propkey
, "URLUpdateInfo", 0, REG_SZ
, (LPBYTE
)"update", 7);
5853 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
5855 /* URLUpdateInfo value exists */
5857 lstrcpyA(buf
, "apple");
5858 r
= pMsiGetProductInfoExA(prodcode
, NULL
,
5859 MSIINSTALLCONTEXT_MACHINE
,
5860 INSTALLPROPERTY_URLUPDATEINFO
, buf
, &sz
);
5861 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5862 ok(!lstrcmpA(buf
, "update"), "Expected \"update\", got \"%s\"\n", buf
);
5863 ok(sz
== 6, "Expected 6, got %d\n", sz
);
5865 res
= RegSetValueExA(propkey
, "VersionMinor", 0, REG_SZ
, (LPBYTE
)"2", 2);
5866 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
5868 /* VersionMinor value exists */
5870 lstrcpyA(buf
, "apple");
5871 r
= pMsiGetProductInfoExA(prodcode
, NULL
,
5872 MSIINSTALLCONTEXT_MACHINE
,
5873 INSTALLPROPERTY_VERSIONMINOR
, buf
, &sz
);
5874 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5875 ok(!lstrcmpA(buf
, "2"), "Expected \"2\", got \"%s\"\n", buf
);
5876 ok(sz
== 1, "Expected 1, got %d\n", sz
);
5878 res
= RegSetValueExA(propkey
, "VersionMajor", 0, REG_SZ
, (LPBYTE
)"3", 2);
5879 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
5881 /* VersionMajor value exists */
5883 lstrcpyA(buf
, "apple");
5884 r
= pMsiGetProductInfoExA(prodcode
, NULL
,
5885 MSIINSTALLCONTEXT_MACHINE
,
5886 INSTALLPROPERTY_VERSIONMAJOR
, buf
, &sz
);
5887 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5888 ok(!lstrcmpA(buf
, "3"), "Expected \"3\", got \"%s\"\n", buf
);
5889 ok(sz
== 1, "Expected 1, got %d\n", sz
);
5891 res
= RegSetValueExA(propkey
, "DisplayVersion", 0, REG_SZ
, (LPBYTE
)"3.2.1", 6);
5892 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
5894 /* DisplayVersion value exists */
5896 lstrcpyA(buf
, "apple");
5897 r
= pMsiGetProductInfoExA(prodcode
, NULL
,
5898 MSIINSTALLCONTEXT_MACHINE
,
5899 INSTALLPROPERTY_VERSIONSTRING
, buf
, &sz
);
5900 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5901 ok(!lstrcmpA(buf
, "3.2.1"), "Expected \"3.2.1\", got \"%s\"\n", buf
);
5902 ok(sz
== 5, "Expected 5, got %d\n", sz
);
5904 res
= RegSetValueExA(propkey
, "ProductID", 0, REG_SZ
, (LPBYTE
)"id", 3);
5905 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
5907 /* ProductID value exists */
5909 lstrcpyA(buf
, "apple");
5910 r
= pMsiGetProductInfoExA(prodcode
, NULL
,
5911 MSIINSTALLCONTEXT_MACHINE
,
5912 INSTALLPROPERTY_PRODUCTID
, buf
, &sz
);
5913 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5914 ok(!lstrcmpA(buf
, "id"), "Expected \"id\", got \"%s\"\n", buf
);
5915 ok(sz
== 2, "Expected 2, got %d\n", sz
);
5917 res
= RegSetValueExA(propkey
, "RegCompany", 0, REG_SZ
, (LPBYTE
)"comp", 5);
5918 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
5920 /* RegCompany value exists */
5922 lstrcpyA(buf
, "apple");
5923 r
= pMsiGetProductInfoExA(prodcode
, NULL
,
5924 MSIINSTALLCONTEXT_MACHINE
,
5925 INSTALLPROPERTY_REGCOMPANY
, buf
, &sz
);
5926 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5927 ok(!lstrcmpA(buf
, "comp"), "Expected \"comp\", got \"%s\"\n", buf
);
5928 ok(sz
== 4, "Expected 4, got %d\n", sz
);
5930 res
= RegSetValueExA(propkey
, "RegOwner", 0, REG_SZ
, (LPBYTE
)"owner", 6);
5931 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
5933 /* RegOwner value exists */
5935 lstrcpyA(buf
, "apple");
5936 r
= pMsiGetProductInfoExA(prodcode
, NULL
,
5937 MSIINSTALLCONTEXT_MACHINE
,
5938 INSTALLPROPERTY_REGOWNER
, buf
, &sz
);
5939 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5940 ok(!lstrcmpA(buf
, "owner"), "Expected \"owner\", got \"%s\"\n", buf
);
5941 ok(sz
== 5, "Expected 5, got %d\n", sz
);
5943 res
= RegSetValueExA(propkey
, "Transforms", 0, REG_SZ
, (LPBYTE
)"trans", 6);
5944 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
5946 /* Transforms value exists */
5948 lstrcpyA(buf
, "apple");
5949 r
= pMsiGetProductInfoExA(prodcode
, NULL
,
5950 MSIINSTALLCONTEXT_MACHINE
,
5951 INSTALLPROPERTY_TRANSFORMS
, buf
, &sz
);
5952 ok(r
== ERROR_UNKNOWN_PRODUCT
,
5953 "Expected ERROR_UNKNOWN_PRODUCT, 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(propkey
, "Language", 0, REG_SZ
, (LPBYTE
)"lang", 5);
5958 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
5960 /* Language value exists */
5962 lstrcpyA(buf
, "apple");
5963 r
= pMsiGetProductInfoExA(prodcode
, NULL
,
5964 MSIINSTALLCONTEXT_MACHINE
,
5965 INSTALLPROPERTY_LANGUAGE
, buf
, &sz
);
5966 ok(r
== ERROR_UNKNOWN_PRODUCT
,
5967 "Expected ERROR_UNKNOWN_PRODUCT, 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(propkey
, "ProductName", 0, REG_SZ
, (LPBYTE
)"name", 5);
5972 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
5974 /* ProductName value exists */
5976 lstrcpyA(buf
, "apple");
5977 r
= pMsiGetProductInfoExA(prodcode
, NULL
,
5978 MSIINSTALLCONTEXT_MACHINE
,
5979 INSTALLPROPERTY_PRODUCTNAME
, buf
, &sz
);
5980 ok(r
== ERROR_UNKNOWN_PRODUCT
,
5981 "Expected ERROR_UNKNOWN_PRODUCT, 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(propkey
, "AssignmentType", 0, REG_SZ
, (LPBYTE
)"type", 5);
5986 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
5990 /* AssignmentType value exists */
5992 lstrcpyA(buf
, "apple");
5993 r
= pMsiGetProductInfoExA(prodcode
, NULL
,
5994 MSIINSTALLCONTEXT_MACHINE
,
5995 INSTALLPROPERTY_ASSIGNMENTTYPE
, buf
, &sz
);
5996 ok(r
== ERROR_UNKNOWN_PRODUCT
,
5997 "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r
);
5998 ok(!lstrcmpA(buf
, "apple"), "Expected buf to be unchanged, got %s\n", buf
);
5999 ok(sz
== MAX_PATH
, "Expected MAX_PATH, got %d\n", sz
);
6001 res
= RegSetValueExA(propkey
, "PackageCode", 0, REG_SZ
, (LPBYTE
)"code", 5);
6002 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
6004 /* PackageCode value exists */
6006 lstrcpyA(buf
, "apple");
6007 r
= pMsiGetProductInfoExA(prodcode
, NULL
,
6008 MSIINSTALLCONTEXT_MACHINE
,
6009 INSTALLPROPERTY_PACKAGECODE
, buf
, &sz
);
6010 ok(r
== ERROR_UNKNOWN_PRODUCT
,
6011 "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r
);
6012 ok(!lstrcmpA(buf
, "apple"), "Expected buf to be unchanged, got %s\n", buf
);
6013 ok(sz
== MAX_PATH
, "Expected MAX_PATH, got %d\n", sz
);
6015 res
= RegSetValueExA(propkey
, "Version", 0, REG_SZ
, (LPBYTE
)"ver", 4);
6016 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
6018 /* Version value exists */
6020 lstrcpyA(buf
, "apple");
6021 r
= pMsiGetProductInfoExA(prodcode
, NULL
,
6022 MSIINSTALLCONTEXT_MACHINE
,
6023 INSTALLPROPERTY_VERSION
, buf
, &sz
);
6024 ok(r
== ERROR_UNKNOWN_PRODUCT
,
6025 "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r
);
6026 ok(!lstrcmpA(buf
, "apple"), "Expected buf to be unchanged, got %s\n", buf
);
6027 ok(sz
== MAX_PATH
, "Expected MAX_PATH, got %d\n", sz
);
6029 res
= RegSetValueExA(propkey
, "ProductIcon", 0, REG_SZ
, (LPBYTE
)"icon", 5);
6030 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
6032 /* ProductIcon value exists */
6034 lstrcpyA(buf
, "apple");
6035 r
= pMsiGetProductInfoExA(prodcode
, NULL
,
6036 MSIINSTALLCONTEXT_MACHINE
,
6037 INSTALLPROPERTY_PRODUCTICON
, buf
, &sz
);
6038 ok(r
== ERROR_UNKNOWN_PRODUCT
,
6039 "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r
);
6040 ok(!lstrcmpA(buf
, "apple"), "Expected buf to be unchanged, got %s\n", buf
);
6041 ok(sz
== MAX_PATH
, "Expected MAX_PATH, got %d\n", sz
);
6043 res
= RegSetValueExA(propkey
, "PackageName", 0, REG_SZ
, (LPBYTE
)"name", 5);
6044 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
6046 /* PackageName value exists */
6048 lstrcpyA(buf
, "apple");
6049 r
= pMsiGetProductInfoExA(prodcode
, NULL
,
6050 MSIINSTALLCONTEXT_MACHINE
,
6051 INSTALLPROPERTY_PACKAGENAME
, buf
, &sz
);
6052 ok(r
== ERROR_UNKNOWN_PRODUCT
,
6053 "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r
);
6054 ok(!lstrcmpA(buf
, "apple"), "Expected buf to be unchanged, got %s\n", buf
);
6055 ok(sz
== MAX_PATH
, "Expected MAX_PATH, got %d\n", sz
);
6057 res
= RegSetValueExA(propkey
, "AuthorizedLUAApp", 0, REG_SZ
, (LPBYTE
)"auth", 5);
6058 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
6060 /* AuthorizedLUAApp value exists */
6062 lstrcpyA(buf
, "apple");
6063 r
= pMsiGetProductInfoExA(prodcode
, NULL
,
6064 MSIINSTALLCONTEXT_MACHINE
,
6065 INSTALLPROPERTY_AUTHORIZED_LUA_APP
, buf
, &sz
);
6066 ok(r
== ERROR_UNKNOWN_PRODUCT
,
6067 "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r
);
6068 ok(!lstrcmpA(buf
, "apple"), "Expected buf to be unchanged, got %s\n", buf
);
6069 ok(sz
== MAX_PATH
, "Expected MAX_PATH, got %d\n", sz
);
6071 RegDeleteValueA(propkey
, "AuthorizedLUAApp");
6072 RegDeleteValueA(propkey
, "PackageName");
6073 RegDeleteValueA(propkey
, "ProductIcon");
6074 RegDeleteValueA(propkey
, "Version");
6075 RegDeleteValueA(propkey
, "PackageCode");
6076 RegDeleteValueA(propkey
, "AssignmentType");
6077 RegDeleteValueA(propkey
, "ProductName");
6078 RegDeleteValueA(propkey
, "Language");
6079 RegDeleteValueA(propkey
, "Transforms");
6080 RegDeleteValueA(propkey
, "RegOwner");
6081 RegDeleteValueA(propkey
, "RegCompany");
6082 RegDeleteValueA(propkey
, "ProductID");
6083 RegDeleteValueA(propkey
, "DisplayVersion");
6084 RegDeleteValueA(propkey
, "VersionMajor");
6085 RegDeleteValueA(propkey
, "VersionMinor");
6086 RegDeleteValueA(propkey
, "URLUpdateInfo");
6087 RegDeleteValueA(propkey
, "URLInfoAbout");
6088 RegDeleteValueA(propkey
, "Publisher");
6089 RegDeleteValueA(propkey
, "LocalPackage");
6090 RegDeleteValueA(propkey
, "InstallSource");
6091 RegDeleteValueA(propkey
, "InstallLocation");
6092 RegDeleteValueA(propkey
, "DisplayName");
6093 RegDeleteValueA(propkey
, "InstallDate");
6094 RegDeleteValueA(propkey
, "HelpTelephone");
6095 RegDeleteValueA(propkey
, "HelpLink");
6096 RegDeleteValueA(propkey
, "LocalPackage");
6097 RegDeleteKeyA(propkey
, "");
6098 RegCloseKey(propkey
);
6099 RegDeleteKeyA(localkey
, "");
6100 RegCloseKey(localkey
);
6102 lstrcpyA(keypath
, "Software\\Classes\\Installer\\Products\\");
6103 lstrcatA(keypath
, prod_squashed
);
6105 res
= RegCreateKeyA(HKEY_LOCAL_MACHINE
, keypath
, &prodkey
);
6106 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
6108 /* local classes product key exists */
6110 lstrcpyA(buf
, "apple");
6111 r
= pMsiGetProductInfoExA(prodcode
, NULL
,
6112 MSIINSTALLCONTEXT_MACHINE
,
6113 INSTALLPROPERTY_PRODUCTSTATE
, buf
, &sz
);
6114 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6115 ok(!lstrcmpA(buf
, "1"), "Expected \"1\", got \"%s\"\n", buf
);
6116 ok(sz
== 1, "Expected 1, got %d\n", sz
);
6118 res
= RegSetValueExA(prodkey
, "HelpLink", 0, REG_SZ
, (LPBYTE
)"link", 5);
6119 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
6121 /* HelpLink value exists */
6123 lstrcpyA(buf
, "apple");
6124 r
= pMsiGetProductInfoExA(prodcode
, NULL
,
6125 MSIINSTALLCONTEXT_MACHINE
,
6126 INSTALLPROPERTY_HELPLINK
, buf
, &sz
);
6127 ok(r
== ERROR_UNKNOWN_PROPERTY
,
6128 "Expected ERROR_UNKNOWN_PROPERTY, got %d\n", r
);
6129 ok(!lstrcmpA(buf
, "apple"), "Expected buf to be unchanged, got %s\n", buf
);
6130 ok(sz
== MAX_PATH
, "Expected MAX_PATH, got %d\n", sz
);
6132 res
= RegSetValueExA(prodkey
, "HelpTelephone", 0, REG_SZ
, (LPBYTE
)"phone", 6);
6133 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
6135 /* HelpTelephone value exists */
6137 lstrcpyA(buf
, "apple");
6138 r
= pMsiGetProductInfoExA(prodcode
, NULL
,
6139 MSIINSTALLCONTEXT_MACHINE
,
6140 INSTALLPROPERTY_HELPTELEPHONE
, buf
, &sz
);
6141 ok(r
== ERROR_UNKNOWN_PROPERTY
,
6142 "Expected ERROR_UNKNOWN_PROPERTY, got %d\n", r
);
6143 ok(!lstrcmpA(buf
, "apple"), "Expected buf to be unchanged, got %s\n", buf
);
6144 ok(sz
== MAX_PATH
, "Expected MAX_PATH, got %d\n", sz
);
6146 res
= RegSetValueExA(prodkey
, "InstallDate", 0, REG_SZ
, (LPBYTE
)"date", 5);
6147 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
6149 /* InstallDate value exists */
6151 lstrcpyA(buf
, "apple");
6152 r
= pMsiGetProductInfoExA(prodcode
, NULL
,
6153 MSIINSTALLCONTEXT_MACHINE
,
6154 INSTALLPROPERTY_INSTALLDATE
, buf
, &sz
);
6155 ok(r
== ERROR_UNKNOWN_PROPERTY
,
6156 "Expected ERROR_UNKNOWN_PROPERTY, got %d\n", r
);
6157 ok(!lstrcmpA(buf
, "apple"), "Expected buf to be unchanged, got %s\n", buf
);
6158 ok(sz
== MAX_PATH
, "Expected MAX_PATH, got %d\n", sz
);
6160 res
= RegSetValueExA(prodkey
, "DisplayName", 0, REG_SZ
, (LPBYTE
)"name", 5);
6161 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
6163 /* DisplayName value exists */
6165 lstrcpyA(buf
, "apple");
6166 r
= pMsiGetProductInfoExA(prodcode
, NULL
,
6167 MSIINSTALLCONTEXT_MACHINE
,
6168 INSTALLPROPERTY_INSTALLEDPRODUCTNAME
, buf
, &sz
);
6169 ok(r
== ERROR_UNKNOWN_PROPERTY
,
6170 "Expected ERROR_UNKNOWN_PROPERTY, got %d\n", r
);
6171 ok(!lstrcmpA(buf
, "apple"), "Expected buf to be unchanged, got %s\n", buf
);
6172 ok(sz
== MAX_PATH
, "Expected MAX_PATH, got %d\n", sz
);
6174 res
= RegSetValueExA(prodkey
, "InstallLocation", 0, REG_SZ
, (LPBYTE
)"loc", 4);
6175 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
6177 /* InstallLocation value exists */
6179 lstrcpyA(buf
, "apple");
6180 r
= pMsiGetProductInfoExA(prodcode
, NULL
,
6181 MSIINSTALLCONTEXT_MACHINE
,
6182 INSTALLPROPERTY_INSTALLLOCATION
, buf
, &sz
);
6183 ok(r
== ERROR_UNKNOWN_PROPERTY
,
6184 "Expected ERROR_UNKNOWN_PROPERTY, got %d\n", r
);
6185 ok(!lstrcmpA(buf
, "apple"), "Expected buf to be unchanged, got %s\n", buf
);
6186 ok(sz
== MAX_PATH
, "Expected MAX_PATH, got %d\n", sz
);
6188 res
= RegSetValueExA(prodkey
, "InstallSource", 0, REG_SZ
, (LPBYTE
)"source", 7);
6189 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
6191 /* InstallSource value exists */
6193 lstrcpyA(buf
, "apple");
6194 r
= pMsiGetProductInfoExA(prodcode
, NULL
,
6195 MSIINSTALLCONTEXT_MACHINE
,
6196 INSTALLPROPERTY_INSTALLSOURCE
, buf
, &sz
);
6197 ok(r
== ERROR_UNKNOWN_PROPERTY
,
6198 "Expected ERROR_UNKNOWN_PROPERTY, got %d\n", r
);
6199 ok(!lstrcmpA(buf
, "apple"), "Expected buf to be unchanged, got %s\n", buf
);
6200 ok(sz
== MAX_PATH
, "Expected MAX_PATH, got %d\n", sz
);
6202 res
= RegSetValueExA(prodkey
, "LocalPackage", 0, REG_SZ
, (LPBYTE
)"local", 6);
6203 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
6205 /* LocalPackage value exists */
6207 lstrcpyA(buf
, "apple");
6208 r
= pMsiGetProductInfoExA(prodcode
, NULL
,
6209 MSIINSTALLCONTEXT_MACHINE
,
6210 INSTALLPROPERTY_LOCALPACKAGE
, buf
, &sz
);
6211 ok(r
== ERROR_UNKNOWN_PROPERTY
,
6212 "Expected ERROR_UNKNOWN_PROPERTY, got %d\n", r
);
6213 ok(!lstrcmpA(buf
, "apple"), "Expected buf to be unchanged, got %s\n", buf
);
6214 ok(sz
== MAX_PATH
, "Expected MAX_PATH, got %d\n", sz
);
6216 res
= RegSetValueExA(prodkey
, "Publisher", 0, REG_SZ
, (LPBYTE
)"pub", 4);
6217 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
6219 /* Publisher value exists */
6221 lstrcpyA(buf
, "apple");
6222 r
= pMsiGetProductInfoExA(prodcode
, NULL
,
6223 MSIINSTALLCONTEXT_MACHINE
,
6224 INSTALLPROPERTY_PUBLISHER
, buf
, &sz
);
6225 ok(r
== ERROR_UNKNOWN_PROPERTY
,
6226 "Expected ERROR_UNKNOWN_PROPERTY, got %d\n", r
);
6227 ok(!lstrcmpA(buf
, "apple"), "Expected buf to be unchanged, got %s\n", buf
);
6228 ok(sz
== MAX_PATH
, "Expected MAX_PATH, got %d\n", sz
);
6230 res
= RegSetValueExA(prodkey
, "URLInfoAbout", 0, REG_SZ
, (LPBYTE
)"about", 6);
6231 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
6233 /* URLInfoAbout value exists */
6235 lstrcpyA(buf
, "apple");
6236 r
= pMsiGetProductInfoExA(prodcode
, NULL
,
6237 MSIINSTALLCONTEXT_MACHINE
,
6238 INSTALLPROPERTY_URLINFOABOUT
, buf
, &sz
);
6239 ok(r
== ERROR_UNKNOWN_PROPERTY
,
6240 "Expected ERROR_UNKNOWN_PROPERTY, got %d\n", r
);
6241 ok(!lstrcmpA(buf
, "apple"), "Expected buf to be unchanged, got %s\n", buf
);
6242 ok(sz
== MAX_PATH
, "Expected MAX_PATH, got %d\n", sz
);
6244 res
= RegSetValueExA(prodkey
, "URLUpdateInfo", 0, REG_SZ
, (LPBYTE
)"update", 7);
6245 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
6247 /* URLUpdateInfo value exists */
6249 lstrcpyA(buf
, "apple");
6250 r
= pMsiGetProductInfoExA(prodcode
, NULL
,
6251 MSIINSTALLCONTEXT_MACHINE
,
6252 INSTALLPROPERTY_URLUPDATEINFO
, buf
, &sz
);
6253 ok(r
== ERROR_UNKNOWN_PROPERTY
,
6254 "Expected ERROR_UNKNOWN_PROPERTY, got %d\n", r
);
6255 ok(!lstrcmpA(buf
, "apple"), "Expected buf to be unchanged, got %s\n", buf
);
6256 ok(sz
== MAX_PATH
, "Expected MAX_PATH, got %d\n", sz
);
6258 res
= RegSetValueExA(prodkey
, "VersionMinor", 0, REG_SZ
, (LPBYTE
)"2", 2);
6259 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
6261 /* VersionMinor value exists */
6263 lstrcpyA(buf
, "apple");
6264 r
= pMsiGetProductInfoExA(prodcode
, NULL
,
6265 MSIINSTALLCONTEXT_MACHINE
,
6266 INSTALLPROPERTY_VERSIONMINOR
, buf
, &sz
);
6267 ok(r
== ERROR_UNKNOWN_PROPERTY
,
6268 "Expected ERROR_UNKNOWN_PROPERTY, got %d\n", r
);
6269 ok(!lstrcmpA(buf
, "apple"), "Expected buf to be unchanged, got %s\n", buf
);
6270 ok(sz
== MAX_PATH
, "Expected MAX_PATH, got %d\n", sz
);
6272 res
= RegSetValueExA(prodkey
, "VersionMajor", 0, REG_SZ
, (LPBYTE
)"3", 2);
6273 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
6275 /* VersionMajor value exists */
6277 lstrcpyA(buf
, "apple");
6278 r
= pMsiGetProductInfoExA(prodcode
, NULL
,
6279 MSIINSTALLCONTEXT_MACHINE
,
6280 INSTALLPROPERTY_VERSIONMAJOR
, buf
, &sz
);
6281 ok(r
== ERROR_UNKNOWN_PROPERTY
,
6282 "Expected ERROR_UNKNOWN_PROPERTY, got %d\n", r
);
6283 ok(!lstrcmpA(buf
, "apple"), "Expected buf to be unchanged, got %s\n", buf
);
6284 ok(sz
== MAX_PATH
, "Expected MAX_PATH, got %d\n", sz
);
6286 res
= RegSetValueExA(prodkey
, "DisplayVersion", 0, REG_SZ
, (LPBYTE
)"3.2.1", 6);
6287 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
6289 /* DisplayVersion value exists */
6291 lstrcpyA(buf
, "apple");
6292 r
= pMsiGetProductInfoExA(prodcode
, NULL
,
6293 MSIINSTALLCONTEXT_MACHINE
,
6294 INSTALLPROPERTY_VERSIONSTRING
, buf
, &sz
);
6295 ok(r
== ERROR_UNKNOWN_PROPERTY
,
6296 "Expected ERROR_UNKNOWN_PROPERTY, got %d\n", r
);
6297 ok(!lstrcmpA(buf
, "apple"), "Expected buf to be unchanged, got %s\n", buf
);
6298 ok(sz
== MAX_PATH
, "Expected MAX_PATH, got %d\n", sz
);
6300 res
= RegSetValueExA(prodkey
, "ProductID", 0, REG_SZ
, (LPBYTE
)"id", 3);
6301 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
6303 /* ProductID value exists */
6305 lstrcpyA(buf
, "apple");
6306 r
= pMsiGetProductInfoExA(prodcode
, NULL
,
6307 MSIINSTALLCONTEXT_MACHINE
,
6308 INSTALLPROPERTY_PRODUCTID
, buf
, &sz
);
6309 ok(r
== ERROR_UNKNOWN_PROPERTY
,
6310 "Expected ERROR_UNKNOWN_PROPERTY, got %d\n", r
);
6311 ok(!lstrcmpA(buf
, "apple"), "Expected buf to be unchanged, got %s\n", buf
);
6312 ok(sz
== MAX_PATH
, "Expected MAX_PATH, got %d\n", sz
);
6314 res
= RegSetValueExA(prodkey
, "RegCompany", 0, REG_SZ
, (LPBYTE
)"comp", 5);
6315 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
6317 /* RegCompany value exists */
6319 lstrcpyA(buf
, "apple");
6320 r
= pMsiGetProductInfoExA(prodcode
, NULL
,
6321 MSIINSTALLCONTEXT_MACHINE
,
6322 INSTALLPROPERTY_REGCOMPANY
, buf
, &sz
);
6323 ok(r
== ERROR_UNKNOWN_PROPERTY
,
6324 "Expected ERROR_UNKNOWN_PROPERTY, got %d\n", r
);
6325 ok(!lstrcmpA(buf
, "apple"), "Expected buf to be unchanged, got %s\n", buf
);
6326 ok(sz
== MAX_PATH
, "Expected MAX_PATH, got %d\n", sz
);
6328 res
= RegSetValueExA(prodkey
, "RegOwner", 0, REG_SZ
, (LPBYTE
)"owner", 6);
6329 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
6331 /* RegOwner value exists */
6333 lstrcpyA(buf
, "apple");
6334 r
= pMsiGetProductInfoExA(prodcode
, NULL
,
6335 MSIINSTALLCONTEXT_MACHINE
,
6336 INSTALLPROPERTY_REGOWNER
, buf
, &sz
);
6337 ok(r
== ERROR_UNKNOWN_PROPERTY
,
6338 "Expected ERROR_UNKNOWN_PROPERTY, got %d\n", r
);
6339 ok(!lstrcmpA(buf
, "apple"), "Expected buf to be unchanged, got %s\n", buf
);
6340 ok(sz
== MAX_PATH
, "Expected MAX_PATH, got %d\n", sz
);
6342 res
= RegSetValueExA(prodkey
, "Transforms", 0, REG_SZ
, (LPBYTE
)"trans", 6);
6343 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
6345 /* Transforms value exists */
6347 lstrcpyA(buf
, "apple");
6348 r
= pMsiGetProductInfoExA(prodcode
, NULL
,
6349 MSIINSTALLCONTEXT_MACHINE
,
6350 INSTALLPROPERTY_TRANSFORMS
, buf
, &sz
);
6351 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6352 ok(!lstrcmpA(buf
, "trans"), "Expected \"trans\", got \"%s\"\n", buf
);
6353 ok(sz
== 5, "Expected 5, got %d\n", sz
);
6355 res
= RegSetValueExA(prodkey
, "Language", 0, REG_SZ
, (LPBYTE
)"lang", 5);
6356 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
6358 /* Language value exists */
6360 lstrcpyA(buf
, "apple");
6361 r
= pMsiGetProductInfoExA(prodcode
, NULL
,
6362 MSIINSTALLCONTEXT_MACHINE
,
6363 INSTALLPROPERTY_LANGUAGE
, buf
, &sz
);
6364 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6365 ok(!lstrcmpA(buf
, "lang"), "Expected \"lang\", got \"%s\"\n", buf
);
6366 ok(sz
== 4, "Expected 4, got %d\n", sz
);
6368 res
= RegSetValueExA(prodkey
, "ProductName", 0, REG_SZ
, (LPBYTE
)"name", 5);
6369 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
6371 /* ProductName value exists */
6373 lstrcpyA(buf
, "apple");
6374 r
= pMsiGetProductInfoExA(prodcode
, NULL
,
6375 MSIINSTALLCONTEXT_MACHINE
,
6376 INSTALLPROPERTY_PRODUCTNAME
, buf
, &sz
);
6377 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6378 ok(!lstrcmpA(buf
, "name"), "Expected \"name\", got \"%s\"\n", buf
);
6379 ok(sz
== 4, "Expected 4, got %d\n", sz
);
6381 res
= RegSetValueExA(prodkey
, "AssignmentType", 0, REG_SZ
, (LPBYTE
)"type", 5);
6382 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
6386 /* AssignmentType value exists */
6388 lstrcpyA(buf
, "apple");
6389 r
= pMsiGetProductInfoExA(prodcode
, NULL
,
6390 MSIINSTALLCONTEXT_MACHINE
,
6391 INSTALLPROPERTY_ASSIGNMENTTYPE
, buf
, &sz
);
6392 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6393 ok(!lstrcmpA(buf
, ""), "Expected \"\", got \"%s\"\n", buf
);
6394 ok(sz
== 0, "Expected 0, got %d\n", sz
);
6396 res
= RegSetValueExA(prodkey
, "PackageCode", 0, REG_SZ
, (LPBYTE
)"code", 5);
6397 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
6401 /* PackageCode value exists */
6403 lstrcpyA(buf
, "apple");
6404 r
= pMsiGetProductInfoExA(prodcode
, NULL
,
6405 MSIINSTALLCONTEXT_MACHINE
,
6406 INSTALLPROPERTY_PACKAGECODE
, buf
, &sz
);
6409 ok(r
== ERROR_BAD_CONFIGURATION
,
6410 "Expected ERROR_BAD_CONFIGURATION, got %d\n", r
);
6411 ok(!lstrcmpA(buf
, "apple"), "Expected buf to be unchanged, got %s\n", buf
);
6412 ok(sz
== MAX_PATH
, "Expected MAX_PATH, got %d\n", sz
);
6415 res
= RegSetValueExA(prodkey
, "Version", 0, REG_SZ
, (LPBYTE
)"ver", 4);
6416 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
6418 /* Version value exists */
6420 lstrcpyA(buf
, "apple");
6421 r
= pMsiGetProductInfoExA(prodcode
, NULL
,
6422 MSIINSTALLCONTEXT_MACHINE
,
6423 INSTALLPROPERTY_VERSION
, buf
, &sz
);
6424 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6425 ok(!lstrcmpA(buf
, "ver"), "Expected \"ver\", got \"%s\"\n", buf
);
6426 ok(sz
== 3, "Expected 3, got %d\n", sz
);
6428 res
= RegSetValueExA(prodkey
, "ProductIcon", 0, REG_SZ
, (LPBYTE
)"icon", 5);
6429 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
6431 /* ProductIcon value exists */
6433 lstrcpyA(buf
, "apple");
6434 r
= pMsiGetProductInfoExA(prodcode
, NULL
,
6435 MSIINSTALLCONTEXT_MACHINE
,
6436 INSTALLPROPERTY_PRODUCTICON
, buf
, &sz
);
6437 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6438 ok(!lstrcmpA(buf
, "icon"), "Expected \"icon\", got \"%s\"\n", buf
);
6439 ok(sz
== 4, "Expected 4, got %d\n", sz
);
6441 res
= RegSetValueExA(prodkey
, "PackageName", 0, REG_SZ
, (LPBYTE
)"name", 5);
6442 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
6444 /* PackageName value exists */
6446 lstrcpyA(buf
, "apple");
6447 r
= pMsiGetProductInfoExA(prodcode
, NULL
,
6448 MSIINSTALLCONTEXT_MACHINE
,
6449 INSTALLPROPERTY_PACKAGENAME
, buf
, &sz
);
6452 ok(r
== ERROR_UNKNOWN_PRODUCT
,
6453 "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r
);
6454 ok(!lstrcmpA(buf
, "apple"), "Expected buf to be unchanged, got %s\n", buf
);
6455 ok(sz
== MAX_PATH
, "Expected MAX_PATH, got %d\n", sz
);
6458 res
= RegSetValueExA(prodkey
, "AuthorizedLUAApp", 0, REG_SZ
, (LPBYTE
)"auth", 5);
6459 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
6461 /* AuthorizedLUAApp value exists */
6463 lstrcpyA(buf
, "apple");
6464 r
= pMsiGetProductInfoExA(prodcode
, NULL
,
6465 MSIINSTALLCONTEXT_MACHINE
,
6466 INSTALLPROPERTY_AUTHORIZED_LUA_APP
, buf
, &sz
);
6467 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6468 ok(!lstrcmpA(buf
, "auth"), "Expected \"auth\", got \"%s\"\n", buf
);
6469 ok(sz
== 4, "Expected 4, got %d\n", sz
);
6471 RegDeleteValueA(prodkey
, "AuthorizedLUAApp");
6472 RegDeleteValueA(prodkey
, "PackageName");
6473 RegDeleteValueA(prodkey
, "ProductIcon");
6474 RegDeleteValueA(prodkey
, "Version");
6475 RegDeleteValueA(prodkey
, "PackageCode");
6476 RegDeleteValueA(prodkey
, "AssignmentType");
6477 RegDeleteValueA(prodkey
, "ProductName");
6478 RegDeleteValueA(prodkey
, "Language");
6479 RegDeleteValueA(prodkey
, "Transforms");
6480 RegDeleteValueA(prodkey
, "RegOwner");
6481 RegDeleteValueA(prodkey
, "RegCompany");
6482 RegDeleteValueA(prodkey
, "ProductID");
6483 RegDeleteValueA(prodkey
, "DisplayVersion");
6484 RegDeleteValueA(prodkey
, "VersionMajor");
6485 RegDeleteValueA(prodkey
, "VersionMinor");
6486 RegDeleteValueA(prodkey
, "URLUpdateInfo");
6487 RegDeleteValueA(prodkey
, "URLInfoAbout");
6488 RegDeleteValueA(prodkey
, "Publisher");
6489 RegDeleteValueA(prodkey
, "LocalPackage");
6490 RegDeleteValueA(prodkey
, "InstallSource");
6491 RegDeleteValueA(prodkey
, "InstallLocation");
6492 RegDeleteValueA(prodkey
, "DisplayName");
6493 RegDeleteValueA(prodkey
, "InstallDate");
6494 RegDeleteValueA(prodkey
, "HelpTelephone");
6495 RegDeleteValueA(prodkey
, "HelpLink");
6496 RegDeleteKeyA(prodkey
, "");
6497 RegCloseKey(prodkey
);
6500 #define INIT_USERINFO() \
6501 lstrcpyA(user, "apple"); \
6502 lstrcpyA(org, "orange"); \
6503 lstrcpyA(serial, "banana"); \
6504 usersz = orgsz = serialsz = MAX_PATH;
6506 static void test_MsiGetUserInfo(void)
6508 USERINFOSTATE state
;
6509 CHAR user
[MAX_PATH
];
6511 CHAR serial
[MAX_PATH
];
6512 DWORD usersz
, orgsz
, serialsz
;
6513 CHAR keypath
[MAX_PATH
* 2];
6514 CHAR prodcode
[MAX_PATH
];
6515 CHAR prod_squashed
[MAX_PATH
];
6516 HKEY prodkey
, userprod
, props
;
6520 create_test_guid(prodcode
, prod_squashed
);
6521 get_user_sid(&usersid
);
6523 /* NULL szProduct */
6525 state
= MsiGetUserInfoA(NULL
, user
, &usersz
, org
, &orgsz
, serial
, &serialsz
);
6526 ok(state
== USERINFOSTATE_INVALIDARG
,
6527 "Expected USERINFOSTATE_INVALIDARG, got %d\n", state
);
6528 ok(!lstrcmpA(user
, "apple"), "Expected user to be unchanged, got \"%s\"\n", user
);
6529 ok(!lstrcmpA(org
, "orange"), "Expected org to be unchanged, got \"%s\"\n", org
);
6530 ok(!lstrcmpA(serial
, "banana"), "Expected serial to be unchanged, got \"%s\"\n", serial
);
6531 ok(usersz
== MAX_PATH
, "Expected MAX_PATH, got %d\n", usersz
);
6532 ok(orgsz
== MAX_PATH
, "Expected MAX_PATH, got %d\n", orgsz
);
6533 ok(serialsz
== MAX_PATH
, "Expected MAX_PATH, got %d\n", serialsz
);
6535 /* empty szProductCode */
6537 state
= MsiGetUserInfoA("", user
, &usersz
, org
, &orgsz
, serial
, &serialsz
);
6538 ok(state
== USERINFOSTATE_INVALIDARG
,
6539 "Expected USERINFOSTATE_INVALIDARG, got %d\n", state
);
6540 ok(!lstrcmpA(user
, "apple"), "Expected user to be unchanged, got \"%s\"\n", user
);
6541 ok(!lstrcmpA(org
, "orange"), "Expected org to be unchanged, got \"%s\"\n", org
);
6542 ok(!lstrcmpA(serial
, "banana"), "Expected serial to be unchanged, got \"%s\"\n", serial
);
6543 ok(usersz
== MAX_PATH
, "Expected MAX_PATH, got %d\n", usersz
);
6544 ok(orgsz
== MAX_PATH
, "Expected MAX_PATH, got %d\n", orgsz
);
6545 ok(serialsz
== MAX_PATH
, "Expected MAX_PATH, got %d\n", serialsz
);
6547 /* garbage szProductCode */
6549 state
= MsiGetUserInfoA("garbage", user
, &usersz
, org
, &orgsz
, serial
, &serialsz
);
6550 ok(state
== USERINFOSTATE_INVALIDARG
,
6551 "Expected USERINFOSTATE_INVALIDARG, got %d\n", state
);
6552 ok(!lstrcmpA(user
, "apple"), "Expected user to be unchanged, got \"%s\"\n", user
);
6553 ok(!lstrcmpA(org
, "orange"), "Expected org to be unchanged, got \"%s\"\n", org
);
6554 ok(!lstrcmpA(serial
, "banana"), "Expected serial to be unchanged, got \"%s\"\n", serial
);
6555 ok(usersz
== MAX_PATH
, "Expected MAX_PATH, got %d\n", usersz
);
6556 ok(orgsz
== MAX_PATH
, "Expected MAX_PATH, got %d\n", orgsz
);
6557 ok(serialsz
== MAX_PATH
, "Expected MAX_PATH, got %d\n", serialsz
);
6559 /* guid without brackets */
6561 state
= MsiGetUserInfoA("6700E8CF-95AB-4D9C-BC2C-15840DEA7A5D",
6562 user
, &usersz
, org
, &orgsz
, serial
, &serialsz
);
6563 ok(state
== USERINFOSTATE_INVALIDARG
,
6564 "Expected USERINFOSTATE_INVALIDARG, got %d\n", state
);
6565 ok(!lstrcmpA(user
, "apple"), "Expected user to be unchanged, got \"%s\"\n", user
);
6566 ok(!lstrcmpA(org
, "orange"), "Expected org to be unchanged, got \"%s\"\n", org
);
6567 ok(!lstrcmpA(serial
, "banana"), "Expected serial to be unchanged, got \"%s\"\n", serial
);
6568 ok(usersz
== MAX_PATH
, "Expected MAX_PATH, got %d\n", usersz
);
6569 ok(orgsz
== MAX_PATH
, "Expected MAX_PATH, got %d\n", orgsz
);
6570 ok(serialsz
== MAX_PATH
, "Expected MAX_PATH, got %d\n", serialsz
);
6572 /* guid with brackets */
6574 state
= MsiGetUserInfoA("{6700E8CF-95AB-4D9C-BC2C-15840DEA7A5D}",
6575 user
, &usersz
, org
, &orgsz
, serial
, &serialsz
);
6576 ok(state
== USERINFOSTATE_UNKNOWN
,
6577 "Expected USERINFOSTATE_UNKNOWN, got %d\n", state
);
6578 ok(!lstrcmpA(user
, "apple"), "Expected user to be unchanged, got \"%s\"\n", user
);
6579 ok(!lstrcmpA(org
, "orange"), "Expected org to be unchanged, got \"%s\"\n", org
);
6580 ok(!lstrcmpA(serial
, "banana"), "Expected serial to be unchanged, got \"%s\"\n", serial
);
6581 ok(usersz
== MAX_PATH
, "Expected MAX_PATH, got %d\n", usersz
);
6582 ok(orgsz
== MAX_PATH
, "Expected MAX_PATH, got %d\n", orgsz
);
6583 ok(serialsz
== MAX_PATH
, "Expected MAX_PATH, got %d\n", serialsz
);
6585 /* NULL lpUserNameBuf */
6587 state
= MsiGetUserInfoA(prodcode
, NULL
, &usersz
, org
, &orgsz
, serial
, &serialsz
);
6588 ok(state
== USERINFOSTATE_UNKNOWN
,
6589 "Expected USERINFOSTATE_UNKNOWN, got %d\n", state
);
6590 ok(!lstrcmpA(org
, "orange"), "Expected org to be unchanged, got \"%s\"\n", org
);
6591 ok(!lstrcmpA(serial
, "banana"), "Expected serial to be unchanged, got \"%s\"\n", serial
);
6592 ok(usersz
== MAX_PATH
, "Expected MAX_PATH, got %d\n", usersz
);
6593 ok(orgsz
== MAX_PATH
, "Expected MAX_PATH, got %d\n", orgsz
);
6594 ok(serialsz
== MAX_PATH
, "Expected MAX_PATH, got %d\n", serialsz
);
6596 /* NULL pcchUserNameBuf */
6598 state
= MsiGetUserInfoA(prodcode
, user
, NULL
, org
, &orgsz
, serial
, &serialsz
);
6599 ok(state
== USERINFOSTATE_INVALIDARG
,
6600 "Expected USERINFOSTATE_INVALIDARG, got %d\n", state
);
6601 ok(!lstrcmpA(user
, "apple"), "Expected user to be unchanged, got \"%s\"\n", user
);
6602 ok(!lstrcmpA(org
, "orange"), "Expected org to be unchanged, got \"%s\"\n", org
);
6603 ok(!lstrcmpA(serial
, "banana"), "Expected serial to be unchanged, got \"%s\"\n", serial
);
6604 ok(orgsz
== MAX_PATH
, "Expected MAX_PATH, got %d\n", orgsz
);
6605 ok(serialsz
== MAX_PATH
, "Expected MAX_PATH, got %d\n", serialsz
);
6607 /* both lpUserNameBuf and pcchUserNameBuf NULL */
6609 state
= MsiGetUserInfoA(prodcode
, NULL
, NULL
, org
, &orgsz
, serial
, &serialsz
);
6610 ok(state
== USERINFOSTATE_UNKNOWN
,
6611 "Expected USERINFOSTATE_UNKNOWN, got %d\n", state
);
6612 ok(!lstrcmpA(org
, "orange"), "Expected org to be unchanged, got \"%s\"\n", org
);
6613 ok(!lstrcmpA(serial
, "banana"), "Expected serial to be unchanged, got \"%s\"\n", serial
);
6614 ok(orgsz
== MAX_PATH
, "Expected MAX_PATH, got %d\n", orgsz
);
6615 ok(serialsz
== MAX_PATH
, "Expected MAX_PATH, got %d\n", serialsz
);
6617 /* NULL lpOrgNameBuf */
6619 state
= MsiGetUserInfoA(prodcode
, user
, &usersz
, NULL
, &orgsz
, serial
, &serialsz
);
6620 ok(state
== USERINFOSTATE_UNKNOWN
,
6621 "Expected USERINFOSTATE_UNKNOWN, got %d\n", state
);
6622 ok(!lstrcmpA(user
, "apple"), "Expected user to be unchanged, got \"%s\"\n", user
);
6623 ok(!lstrcmpA(serial
, "banana"), "Expected serial to be unchanged, got \"%s\"\n", serial
);
6624 ok(usersz
== MAX_PATH
, "Expected MAX_PATH, got %d\n", usersz
);
6625 ok(orgsz
== MAX_PATH
, "Expected MAX_PATH, got %d\n", orgsz
);
6626 ok(serialsz
== MAX_PATH
, "Expected MAX_PATH, got %d\n", serialsz
);
6628 /* NULL pcchOrgNameBuf */
6630 state
= MsiGetUserInfoA(prodcode
, user
, &usersz
, org
, NULL
, serial
, &serialsz
);
6631 ok(state
== USERINFOSTATE_INVALIDARG
,
6632 "Expected USERINFOSTATE_INVALIDARG, got %d\n", state
);
6633 ok(!lstrcmpA(user
, "apple"), "Expected user to be unchanged, got \"%s\"\n", user
);
6634 ok(!lstrcmpA(org
, "orange"), "Expected org to be unchanged, got \"%s\"\n", org
);
6635 ok(!lstrcmpA(serial
, "banana"), "Expected serial to be unchanged, got \"%s\"\n", serial
);
6636 ok(usersz
== MAX_PATH
, "Expected MAX_PATH, got %d\n", usersz
);
6637 ok(serialsz
== MAX_PATH
, "Expected MAX_PATH, got %d\n", serialsz
);
6639 /* both lpOrgNameBuf and pcchOrgNameBuf NULL */
6641 state
= MsiGetUserInfoA(prodcode
, user
, &usersz
, NULL
, NULL
, serial
, &serialsz
);
6642 ok(state
== USERINFOSTATE_UNKNOWN
,
6643 "Expected USERINFOSTATE_UNKNOWN, got %d\n", state
);
6644 ok(!lstrcmpA(user
, "apple"), "Expected user to be unchanged, got \"%s\"\n", user
);
6645 ok(!lstrcmpA(serial
, "banana"), "Expected serial to be unchanged, got \"%s\"\n", serial
);
6646 ok(usersz
== MAX_PATH
, "Expected MAX_PATH, got %d\n", usersz
);
6647 ok(serialsz
== MAX_PATH
, "Expected MAX_PATH, got %d\n", serialsz
);
6649 /* NULL lpSerialBuf */
6651 state
= MsiGetUserInfoA(prodcode
, user
, &usersz
, org
, &orgsz
, NULL
, &serialsz
);
6652 ok(state
== USERINFOSTATE_UNKNOWN
,
6653 "Expected USERINFOSTATE_UNKNOWN, got %d\n", state
);
6654 ok(!lstrcmpA(user
, "apple"), "Expected user to be unchanged, got \"%s\"\n", user
);
6655 ok(!lstrcmpA(org
, "orange"), "Expected org to be unchanged, got \"%s\"\n", org
);
6656 ok(usersz
== MAX_PATH
, "Expected MAX_PATH, got %d\n", usersz
);
6657 ok(orgsz
== MAX_PATH
, "Expected MAX_PATH, got %d\n", orgsz
);
6658 ok(serialsz
== MAX_PATH
, "Expected MAX_PATH, got %d\n", serialsz
);
6660 /* NULL pcchSerialBuf */
6662 state
= MsiGetUserInfoA(prodcode
, user
, &usersz
, org
, &orgsz
, serial
, NULL
);
6663 ok(state
== USERINFOSTATE_INVALIDARG
,
6664 "Expected USERINFOSTATE_INVALIDARG, got %d\n", state
);
6665 ok(!lstrcmpA(user
, "apple"), "Expected user to be unchanged, got \"%s\"\n", user
);
6666 ok(!lstrcmpA(org
, "orange"), "Expected org to be unchanged, got \"%s\"\n", org
);
6667 ok(!lstrcmpA(serial
, "banana"), "Expected serial to be unchanged, got \"%s\"\n", serial
);
6668 ok(usersz
== MAX_PATH
, "Expected MAX_PATH, got %d\n", usersz
);
6669 ok(orgsz
== MAX_PATH
, "Expected MAX_PATH, got %d\n", orgsz
);
6671 /* both lpSerialBuf and pcchSerialBuf NULL */
6673 state
= MsiGetUserInfoA(prodcode
, user
, &usersz
, org
, &orgsz
, NULL
, NULL
);
6674 ok(state
== USERINFOSTATE_UNKNOWN
,
6675 "Expected USERINFOSTATE_UNKNOWN, got %d\n", state
);
6676 ok(!lstrcmpA(user
, "apple"), "Expected user to be unchanged, got \"%s\"\n", user
);
6677 ok(!lstrcmpA(org
, "orange"), "Expected org to be unchanged, got \"%s\"\n", org
);
6678 ok(usersz
== MAX_PATH
, "Expected MAX_PATH, got %d\n", usersz
);
6679 ok(orgsz
== MAX_PATH
, "Expected MAX_PATH, got %d\n", orgsz
);
6681 /* MSIINSTALLCONTEXT_USERMANAGED */
6683 /* create local system product key */
6684 lstrcpyA(keypath
, "Software\\Microsoft\\Windows\\CurrentVersion\\Installer\\Managed\\");
6685 lstrcatA(keypath
, usersid
);
6686 lstrcatA(keypath
, "\\Installer\\Products\\");
6687 lstrcatA(keypath
, prod_squashed
);
6689 res
= RegCreateKeyA(HKEY_LOCAL_MACHINE
, keypath
, &prodkey
);
6690 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
6692 /* managed product key exists */
6694 state
= MsiGetUserInfoA(prodcode
, user
, &usersz
, org
, &orgsz
, serial
, &serialsz
);
6695 ok(state
== USERINFOSTATE_ABSENT
,
6696 "Expected USERINFOSTATE_ABSENT, got %d\n", state
);
6697 ok(!lstrcmpA(user
, "apple"), "Expected user to be unchanged, got \"%s\"\n", user
);
6698 ok(!lstrcmpA(org
, "orange"), "Expected org to be unchanged, got \"%s\"\n", org
);
6699 ok(!lstrcmpA(serial
, "banana"), "Expected serial to be unchanged, got \"%s\"\n", serial
);
6700 ok(usersz
== MAX_PATH
, "Expected MAX_PATH, got %d\n", usersz
);
6701 ok(orgsz
== MAX_PATH
, "Expected MAX_PATH, got %d\n", orgsz
);
6702 ok(serialsz
== MAX_PATH
, "Expected MAX_PATH, got %d\n", serialsz
);
6704 lstrcpyA(keypath
, "Software\\Microsoft\\Windows\\CurrentVersion\\");
6705 lstrcatA(keypath
, "Installer\\UserData\\");
6706 lstrcatA(keypath
, usersid
);
6707 lstrcatA(keypath
, "\\Products\\");
6708 lstrcatA(keypath
, prod_squashed
);
6710 res
= RegCreateKeyA(HKEY_LOCAL_MACHINE
, keypath
, &userprod
);
6711 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
6713 res
= RegCreateKeyA(userprod
, "InstallProperties", &props
);
6714 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
6716 /* InstallProperties key exists */
6718 state
= MsiGetUserInfoA(prodcode
, user
, &usersz
, org
, &orgsz
, serial
, &serialsz
);
6719 ok(state
== USERINFOSTATE_ABSENT
,
6720 "Expected USERINFOSTATE_ABSENT, got %d\n", state
);
6721 ok(!lstrcmpA(user
, "apple"), "Expected user to be unchanged, got \"%s\"\n", user
);
6722 ok(!lstrcmpA(org
, "orange"), "Expected org to be unchanged, got \"%s\"\n", org
);
6723 ok(!lstrcmpA(serial
, "banana"), "Expected serial to be unchanged, got \"%s\"\n", serial
);
6724 ok(usersz
== MAX_PATH
- 1, "Expected MAX_PATH - 1, got %d\n", usersz
);
6725 ok(orgsz
== MAX_PATH
, "Expected MAX_PATH, got %d\n", orgsz
);
6726 ok(serialsz
== MAX_PATH
, "Expected MAX_PATH, got %d\n", serialsz
);
6728 /* RegOwner doesn't exist, lpUserNameBuf and pcchUserNameBuf are NULL */
6730 state
= MsiGetUserInfoA(prodcode
, NULL
, NULL
, org
, &orgsz
, serial
, &serialsz
);
6731 ok(state
== USERINFOSTATE_ABSENT
,
6732 "Expected USERINFOSTATE_ABSENT, got %d\n", state
);
6733 ok(!lstrcmpA(org
, ""), "Expected empty string, got \"%s\"\n", org
);
6734 ok(!lstrcmpA(serial
, "banana"), "Expected serial to be unchanged, got \"%s\"\n", serial
);
6735 ok(orgsz
== 0, "Expected 0, got %d\n", orgsz
);
6736 ok(serialsz
== MAX_PATH
- 1, "Expected MAX_PATH - 1, got %d\n", serialsz
);
6738 /* RegOwner, RegCompany don't exist, out params are NULL */
6740 state
= MsiGetUserInfoA(prodcode
, NULL
, NULL
, NULL
, NULL
, serial
, &serialsz
);
6741 ok(state
== USERINFOSTATE_ABSENT
,
6742 "Expected USERINFOSTATE_ABSENT, got %d\n", state
);
6743 ok(!lstrcmpA(serial
, "banana"), "Expected serial to be unchanged, got \"%s\"\n", serial
);
6744 ok(serialsz
== MAX_PATH
- 1, "Expected MAX_PATH - 1, got %d\n", serialsz
);
6746 res
= RegSetValueExA(props
, "RegOwner", 0, REG_SZ
, (LPBYTE
)"owner", 6);
6747 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
6749 /* RegOwner 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
, ""), "Expected empty string, 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
== 0, "Expected 0, got %d\n", orgsz
);
6759 ok(serialsz
== MAX_PATH
- 1, "Expected MAX_PATH - 1, got %d\n", serialsz
);
6761 res
= RegSetValueExA(props
, "RegCompany", 0, REG_SZ
, (LPBYTE
)"company", 8);
6762 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
6764 /* RegCompany value exists */
6766 state
= MsiGetUserInfoA(prodcode
, user
, &usersz
, org
, &orgsz
, serial
, &serialsz
);
6767 ok(state
== USERINFOSTATE_ABSENT
,
6768 "Expected USERINFOSTATE_ABSENT, 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
, "banana"), "Expected serial to be unchanged, 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
== MAX_PATH
- 1, "Expected MAX_PATH - 1, got %d\n", serialsz
);
6776 res
= RegSetValueExA(props
, "ProductID", 0, REG_SZ
, (LPBYTE
)"ID", 3);
6777 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
6779 /* ProductID value exists */
6781 state
= MsiGetUserInfoA(prodcode
, user
, &usersz
, org
, &orgsz
, serial
, &serialsz
);
6782 ok(state
== USERINFOSTATE_PRESENT
,
6783 "Expected USERINFOSTATE_PRESENT, got %d\n", state
);
6784 ok(!lstrcmpA(user
, "owner"), "Expected \"owner\", got \"%s\"\n", user
);
6785 ok(!lstrcmpA(org
, "company"), "Expected \"company\", got \"%s\"\n", org
);
6786 ok(!lstrcmpA(serial
, "ID"), "Expected \"ID\", got \"%s\"\n", serial
);
6787 ok(usersz
== 5, "Expected 5, got %d\n", usersz
);
6788 ok(orgsz
== 7, "Expected 7, got %d\n", orgsz
);
6789 ok(serialsz
== 2, "Expected 2, got %d\n", serialsz
);
6791 /* pcchUserNameBuf is too small */
6794 state
= MsiGetUserInfoA(prodcode
, user
, &usersz
, org
, &orgsz
, serial
, &serialsz
);
6795 ok(state
== USERINFOSTATE_MOREDATA
,
6796 "Expected USERINFOSTATE_MOREDATA, got %d\n", state
);
6797 ok(!lstrcmpA(user
, "apple"), "Expected user to be unchanged, got \"%s\"\n", user
);
6798 ok(!lstrcmpA(org
, "orange"), "Expected org to be unchanged, got \"%s\"\n", org
);
6799 ok(!lstrcmpA(serial
, "banana"), "Expected serial to be unchanged, got \"%s\"\n", serial
);
6800 ok(usersz
== 5, "Expected 5, got %d\n", usersz
);
6801 ok(orgsz
== MAX_PATH
, "Expected MAX_PATH, got %d\n", orgsz
);
6802 ok(serialsz
== MAX_PATH
, "Expected MAX_PATH, got %d\n", serialsz
);
6804 /* pcchUserNameBuf has no room for NULL terminator */
6807 state
= MsiGetUserInfoA(prodcode
, user
, &usersz
, org
, &orgsz
, serial
, &serialsz
);
6808 ok(state
== USERINFOSTATE_MOREDATA
,
6809 "Expected USERINFOSTATE_MOREDATA, got %d\n", state
);
6812 ok(!lstrcmpA(user
, "apple"), "Expected user to be unchanged, got \"%s\"\n", user
);
6814 ok(!lstrcmpA(org
, "orange"), "Expected org to be unchanged, got \"%s\"\n", org
);
6815 ok(!lstrcmpA(serial
, "banana"), "Expected serial to be unchanged, got \"%s\"\n", serial
);
6816 ok(usersz
== 5, "Expected 5, got %d\n", usersz
);
6817 ok(orgsz
== MAX_PATH
, "Expected MAX_PATH, got %d\n", orgsz
);
6818 ok(serialsz
== MAX_PATH
, "Expected MAX_PATH, got %d\n", serialsz
);
6820 /* pcchUserNameBuf is too small, lpUserNameBuf is NULL */
6823 state
= MsiGetUserInfoA(prodcode
, NULL
, &usersz
, org
, &orgsz
, serial
, &serialsz
);
6824 ok(state
== USERINFOSTATE_PRESENT
,
6825 "Expected USERINFOSTATE_PRESENT, got %d\n", state
);
6826 ok(!lstrcmpA(user
, "apple"), "Expected user to be unchanged, got \"%s\"\n", user
);
6827 ok(!lstrcmpA(org
, "company"), "Expected \"company\", got \"%s\"\n", org
);
6828 ok(!lstrcmpA(serial
, "ID"), "Expected \"ID\", got \"%s\"\n", serial
);
6829 ok(usersz
== 5, "Expected 5, got %d\n", usersz
);
6830 ok(orgsz
== 7, "Expected 7, got %d\n", orgsz
);
6831 ok(serialsz
== 2, "Expected 2, got %d\n", serialsz
);
6833 RegDeleteValueA(props
, "ProductID");
6834 RegDeleteValueA(props
, "RegCompany");
6835 RegDeleteValueA(props
, "RegOwner");
6836 RegDeleteKeyA(props
, "");
6838 RegDeleteKeyA(userprod
, "");
6839 RegCloseKey(userprod
);
6840 RegDeleteKeyA(prodkey
, "");
6841 RegCloseKey(prodkey
);
6843 /* MSIINSTALLCONTEXT_USERUNMANAGED */
6845 /* create local system product key */
6846 lstrcpyA(keypath
, "Software\\Microsoft\\Installer\\Products\\");
6847 lstrcatA(keypath
, prod_squashed
);
6849 res
= RegCreateKeyA(HKEY_CURRENT_USER
, keypath
, &prodkey
);
6850 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
6852 /* product key exists */
6854 state
= MsiGetUserInfoA(prodcode
, user
, &usersz
, org
, &orgsz
, serial
, &serialsz
);
6855 ok(state
== USERINFOSTATE_ABSENT
,
6856 "Expected USERINFOSTATE_ABSENT, got %d\n", state
);
6857 ok(!lstrcmpA(user
, "apple"), "Expected user to be unchanged, got \"%s\"\n", user
);
6858 ok(!lstrcmpA(org
, "orange"), "Expected org to be unchanged, got \"%s\"\n", org
);
6859 ok(!lstrcmpA(serial
, "banana"), "Expected serial to be unchanged, got \"%s\"\n", serial
);
6860 ok(usersz
== MAX_PATH
, "Expected MAX_PATH, got %d\n", usersz
);
6861 ok(orgsz
== MAX_PATH
, "Expected MAX_PATH, got %d\n", orgsz
);
6862 ok(serialsz
== MAX_PATH
, "Expected MAX_PATH, got %d\n", serialsz
);
6864 lstrcpyA(keypath
, "Software\\Microsoft\\Windows\\CurrentVersion\\");
6865 lstrcatA(keypath
, "Installer\\UserData\\");
6866 lstrcatA(keypath
, usersid
);
6867 lstrcatA(keypath
, "\\Products\\");
6868 lstrcatA(keypath
, prod_squashed
);
6870 res
= RegCreateKeyA(HKEY_LOCAL_MACHINE
, keypath
, &userprod
);
6871 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
6873 res
= RegCreateKeyA(userprod
, "InstallProperties", &props
);
6874 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
6876 /* InstallProperties key exists */
6878 state
= MsiGetUserInfoA(prodcode
, user
, &usersz
, org
, &orgsz
, serial
, &serialsz
);
6879 ok(state
== USERINFOSTATE_ABSENT
,
6880 "Expected USERINFOSTATE_ABSENT, got %d\n", state
);
6881 ok(!lstrcmpA(user
, "apple"), "Expected user to be unchanged, got \"%s\"\n", user
);
6882 ok(!lstrcmpA(org
, "orange"), "Expected org to be unchanged, got \"%s\"\n", org
);
6883 ok(!lstrcmpA(serial
, "banana"), "Expected serial to be unchanged, got \"%s\"\n", serial
);
6884 ok(usersz
== MAX_PATH
- 1, "Expected MAX_PATH - 1, got %d\n", usersz
);
6885 ok(orgsz
== MAX_PATH
, "Expected MAX_PATH, got %d\n", orgsz
);
6886 ok(serialsz
== MAX_PATH
, "Expected MAX_PATH, got %d\n", serialsz
);
6888 /* RegOwner doesn't exist, lpUserNameBuf and pcchUserNameBuf are NULL */
6890 state
= MsiGetUserInfoA(prodcode
, NULL
, NULL
, org
, &orgsz
, serial
, &serialsz
);
6891 ok(state
== USERINFOSTATE_ABSENT
,
6892 "Expected USERINFOSTATE_ABSENT, got %d\n", state
);
6893 ok(!lstrcmpA(org
, ""), "Expected empty string, got \"%s\"\n", org
);
6894 ok(!lstrcmpA(serial
, "banana"), "Expected serial to be unchanged, got \"%s\"\n", serial
);
6895 ok(orgsz
== 0, "Expected 0, got %d\n", orgsz
);
6896 ok(serialsz
== MAX_PATH
- 1, "Expected MAX_PATH - 1, got %d\n", serialsz
);
6898 /* RegOwner, RegCompany don't exist, out params are NULL */
6900 state
= MsiGetUserInfoA(prodcode
, NULL
, NULL
, NULL
, NULL
, serial
, &serialsz
);
6901 ok(state
== USERINFOSTATE_ABSENT
,
6902 "Expected USERINFOSTATE_ABSENT, got %d\n", state
);
6903 ok(!lstrcmpA(serial
, "banana"), "Expected serial to be unchanged, got \"%s\"\n", serial
);
6904 ok(serialsz
== MAX_PATH
- 1, "Expected MAX_PATH - 1, got %d\n", serialsz
);
6906 res
= RegSetValueExA(props
, "RegOwner", 0, REG_SZ
, (LPBYTE
)"owner", 6);
6907 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
6909 /* RegOwner value exists */
6911 state
= MsiGetUserInfoA(prodcode
, user
, &usersz
, org
, &orgsz
, serial
, &serialsz
);
6912 ok(state
== USERINFOSTATE_ABSENT
,
6913 "Expected USERINFOSTATE_ABSENT, got %d\n", state
);
6914 ok(!lstrcmpA(user
, "owner"), "Expected \"owner\", got \"%s\"\n", user
);
6915 ok(!lstrcmpA(org
, ""), "Expected empty string, got \"%s\"\n", org
);
6916 ok(!lstrcmpA(serial
, "banana"), "Expected serial to be unchanged, got \"%s\"\n", serial
);
6917 ok(usersz
== 5, "Expected 5, got %d\n", usersz
);
6918 ok(orgsz
== 0, "Expected 0, got %d\n", orgsz
);
6919 ok(serialsz
== MAX_PATH
- 1, "Expected MAX_PATH - 1, got %d\n", serialsz
);
6921 res
= RegSetValueExA(props
, "RegCompany", 0, REG_SZ
, (LPBYTE
)"company", 8);
6922 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
6924 /* RegCompany value exists */
6926 state
= MsiGetUserInfoA(prodcode
, user
, &usersz
, org
, &orgsz
, serial
, &serialsz
);
6927 ok(state
== USERINFOSTATE_ABSENT
,
6928 "Expected USERINFOSTATE_ABSENT, got %d\n", state
);
6929 ok(!lstrcmpA(user
, "owner"), "Expected \"owner\", got \"%s\"\n", user
);
6930 ok(!lstrcmpA(org
, "company"), "Expected \"company\", got \"%s\"\n", org
);
6931 ok(!lstrcmpA(serial
, "banana"), "Expected serial to be unchanged, got \"%s\"\n", serial
);
6932 ok(usersz
== 5, "Expected 5, got %d\n", usersz
);
6933 ok(orgsz
== 7, "Expected 7, got %d\n", orgsz
);
6934 ok(serialsz
== MAX_PATH
- 1, "Expected MAX_PATH - 1, got %d\n", serialsz
);
6936 res
= RegSetValueExA(props
, "ProductID", 0, REG_SZ
, (LPBYTE
)"ID", 3);
6937 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
6939 /* ProductID value exists */
6941 state
= MsiGetUserInfoA(prodcode
, user
, &usersz
, org
, &orgsz
, serial
, &serialsz
);
6942 ok(state
== USERINFOSTATE_PRESENT
,
6943 "Expected USERINFOSTATE_PRESENT, got %d\n", state
);
6944 ok(!lstrcmpA(user
, "owner"), "Expected \"owner\", got \"%s\"\n", user
);
6945 ok(!lstrcmpA(org
, "company"), "Expected \"company\", got \"%s\"\n", org
);
6946 ok(!lstrcmpA(serial
, "ID"), "Expected \"ID\", got \"%s\"\n", serial
);
6947 ok(usersz
== 5, "Expected 5, got %d\n", usersz
);
6948 ok(orgsz
== 7, "Expected 7, got %d\n", orgsz
);
6949 ok(serialsz
== 2, "Expected 2, got %d\n", serialsz
);
6951 RegDeleteValueA(props
, "ProductID");
6952 RegDeleteValueA(props
, "RegCompany");
6953 RegDeleteValueA(props
, "RegOwner");
6954 RegDeleteKeyA(props
, "");
6956 RegDeleteKeyA(userprod
, "");
6957 RegCloseKey(userprod
);
6958 RegDeleteKeyA(prodkey
, "");
6959 RegCloseKey(prodkey
);
6961 /* MSIINSTALLCONTEXT_MACHINE */
6963 /* create local system product key */
6964 lstrcpyA(keypath
, "Software\\Classes\\Installer\\Products\\");
6965 lstrcatA(keypath
, prod_squashed
);
6967 res
= RegCreateKeyA(HKEY_LOCAL_MACHINE
, keypath
, &prodkey
);
6968 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
6970 /* product key exists */
6972 state
= MsiGetUserInfoA(prodcode
, user
, &usersz
, org
, &orgsz
, serial
, &serialsz
);
6973 ok(state
== USERINFOSTATE_ABSENT
,
6974 "Expected USERINFOSTATE_ABSENT, got %d\n", state
);
6975 ok(!lstrcmpA(user
, "apple"), "Expected user to be unchanged, got \"%s\"\n", user
);
6976 ok(!lstrcmpA(org
, "orange"), "Expected org to be unchanged, got \"%s\"\n", org
);
6977 ok(!lstrcmpA(serial
, "banana"), "Expected serial to be unchanged, got \"%s\"\n", serial
);
6978 ok(usersz
== MAX_PATH
, "Expected MAX_PATH, got %d\n", usersz
);
6979 ok(orgsz
== MAX_PATH
, "Expected MAX_PATH, got %d\n", orgsz
);
6980 ok(serialsz
== MAX_PATH
, "Expected MAX_PATH, got %d\n", serialsz
);
6982 lstrcpyA(keypath
, "Software\\Microsoft\\Windows\\CurrentVersion\\");
6983 lstrcatA(keypath
, "Installer\\UserData\\S-1-5-18");
6984 lstrcatA(keypath
, "\\Products\\");
6985 lstrcatA(keypath
, prod_squashed
);
6987 res
= RegCreateKeyA(HKEY_LOCAL_MACHINE
, keypath
, &userprod
);
6988 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
6990 res
= RegCreateKeyA(userprod
, "InstallProperties", &props
);
6991 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
6993 /* InstallProperties key exists */
6995 state
= MsiGetUserInfoA(prodcode
, user
, &usersz
, org
, &orgsz
, serial
, &serialsz
);
6996 ok(state
== USERINFOSTATE_ABSENT
,
6997 "Expected USERINFOSTATE_ABSENT, got %d\n", state
);
6998 ok(!lstrcmpA(user
, "apple"), "Expected user to be unchanged, got \"%s\"\n", user
);
6999 ok(!lstrcmpA(org
, "orange"), "Expected org to be unchanged, got \"%s\"\n", org
);
7000 ok(!lstrcmpA(serial
, "banana"), "Expected serial to be unchanged, got \"%s\"\n", serial
);
7001 ok(usersz
== MAX_PATH
- 1, "Expected MAX_PATH - 1, got %d\n", usersz
);
7002 ok(orgsz
== MAX_PATH
, "Expected MAX_PATH, got %d\n", orgsz
);
7003 ok(serialsz
== MAX_PATH
, "Expected MAX_PATH, got %d\n", serialsz
);
7005 /* RegOwner doesn't exist, lpUserNameBuf and pcchUserNameBuf are NULL */
7007 state
= MsiGetUserInfoA(prodcode
, NULL
, NULL
, org
, &orgsz
, serial
, &serialsz
);
7008 ok(state
== USERINFOSTATE_ABSENT
,
7009 "Expected USERINFOSTATE_ABSENT, got %d\n", state
);
7010 ok(!lstrcmpA(org
, ""), "Expected empty string, got \"%s\"\n", org
);
7011 ok(!lstrcmpA(serial
, "banana"), "Expected serial to be unchanged, got \"%s\"\n", serial
);
7012 ok(orgsz
== 0, "Expected 0, got %d\n", orgsz
);
7013 ok(serialsz
== MAX_PATH
- 1, "Expected MAX_PATH - 1, got %d\n", serialsz
);
7015 /* RegOwner, RegCompany don't exist, out params are NULL */
7017 state
= MsiGetUserInfoA(prodcode
, NULL
, NULL
, NULL
, NULL
, serial
, &serialsz
);
7018 ok(state
== USERINFOSTATE_ABSENT
,
7019 "Expected USERINFOSTATE_ABSENT, got %d\n", state
);
7020 ok(!lstrcmpA(serial
, "banana"), "Expected serial to be unchanged, got \"%s\"\n", serial
);
7021 ok(serialsz
== MAX_PATH
- 1, "Expected MAX_PATH - 1, got %d\n", serialsz
);
7023 res
= RegSetValueExA(props
, "RegOwner", 0, REG_SZ
, (LPBYTE
)"owner", 6);
7024 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
7026 /* RegOwner value exists */
7028 state
= MsiGetUserInfoA(prodcode
, user
, &usersz
, org
, &orgsz
, serial
, &serialsz
);
7029 ok(state
== USERINFOSTATE_ABSENT
,
7030 "Expected USERINFOSTATE_ABSENT, got %d\n", state
);
7031 ok(!lstrcmpA(user
, "owner"), "Expected \"owner\", got \"%s\"\n", user
);
7032 ok(!lstrcmpA(org
, ""), "Expected empty string, got \"%s\"\n", org
);
7033 ok(!lstrcmpA(serial
, "banana"), "Expected serial to be unchanged, got \"%s\"\n", serial
);
7034 ok(usersz
== 5, "Expected 5, got %d\n", usersz
);
7035 ok(orgsz
== 0, "Expected 0, got %d\n", orgsz
);
7036 ok(serialsz
== MAX_PATH
- 1, "Expected MAX_PATH - 1, got %d\n", serialsz
);
7038 res
= RegSetValueExA(props
, "RegCompany", 0, REG_SZ
, (LPBYTE
)"company", 8);
7039 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
7041 /* RegCompany value exists */
7043 state
= MsiGetUserInfoA(prodcode
, user
, &usersz
, org
, &orgsz
, serial
, &serialsz
);
7044 ok(state
== USERINFOSTATE_ABSENT
,
7045 "Expected USERINFOSTATE_ABSENT, got %d\n", state
);
7046 ok(!lstrcmpA(user
, "owner"), "Expected \"owner\", got \"%s\"\n", user
);
7047 ok(!lstrcmpA(org
, "company"), "Expected \"company\", got \"%s\"\n", org
);
7048 ok(!lstrcmpA(serial
, "banana"), "Expected serial to be unchanged, got \"%s\"\n", serial
);
7049 ok(usersz
== 5, "Expected 5, got %d\n", usersz
);
7050 ok(orgsz
== 7, "Expected 7, got %d\n", orgsz
);
7051 ok(serialsz
== MAX_PATH
- 1, "Expected MAX_PATH - 1, got %d\n", serialsz
);
7053 res
= RegSetValueExA(props
, "ProductID", 0, REG_SZ
, (LPBYTE
)"ID", 3);
7054 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
7056 /* ProductID value exists */
7058 state
= MsiGetUserInfoA(prodcode
, user
, &usersz
, org
, &orgsz
, serial
, &serialsz
);
7059 ok(state
== USERINFOSTATE_PRESENT
,
7060 "Expected USERINFOSTATE_PRESENT, got %d\n", state
);
7061 ok(!lstrcmpA(user
, "owner"), "Expected \"owner\", got \"%s\"\n", user
);
7062 ok(!lstrcmpA(org
, "company"), "Expected \"company\", got \"%s\"\n", org
);
7063 ok(!lstrcmpA(serial
, "ID"), "Expected \"ID\", got \"%s\"\n", serial
);
7064 ok(usersz
== 5, "Expected 5, got %d\n", usersz
);
7065 ok(orgsz
== 7, "Expected 7, got %d\n", orgsz
);
7066 ok(serialsz
== 2, "Expected 2, got %d\n", serialsz
);
7068 RegDeleteValueA(props
, "ProductID");
7069 RegDeleteValueA(props
, "RegCompany");
7070 RegDeleteValueA(props
, "RegOwner");
7071 RegDeleteKeyA(props
, "");
7073 RegDeleteKeyA(userprod
, "");
7074 RegCloseKey(userprod
);
7075 RegDeleteKeyA(prodkey
, "");
7076 RegCloseKey(prodkey
);
7079 static void test_MsiOpenProduct(void)
7081 MSIHANDLE hprod
, hdb
;
7083 CHAR path
[MAX_PATH
];
7084 CHAR keypath
[MAX_PATH
*2];
7085 CHAR prodcode
[MAX_PATH
];
7086 CHAR prod_squashed
[MAX_PATH
];
7087 HKEY prodkey
, userkey
, props
;
7093 GetCurrentDirectoryA(MAX_PATH
, path
);
7094 lstrcatA(path
, "\\");
7096 create_test_guid(prodcode
, prod_squashed
);
7097 get_user_sid(&usersid
);
7099 hdb
= create_package_db(prodcode
);
7100 MsiCloseHandle(hdb
);
7102 /* NULL szProduct */
7104 r
= MsiOpenProductA(NULL
, &hprod
);
7105 ok(r
== ERROR_INVALID_PARAMETER
,
7106 "Expected ERROR_INVALID_PARAMETER, got %d\n", r
);
7107 ok(hprod
== 0xdeadbeef, "Expected hprod to be unchanged\n");
7109 /* empty szProduct */
7111 r
= MsiOpenProductA("", &hprod
);
7112 ok(r
== ERROR_INVALID_PARAMETER
,
7113 "Expected ERROR_INVALID_PARAMETER, got %d\n", r
);
7114 ok(hprod
== 0xdeadbeef, "Expected hprod to be unchanged\n");
7116 /* garbage szProduct */
7118 r
= MsiOpenProductA("garbage", &hprod
);
7119 ok(r
== ERROR_INVALID_PARAMETER
,
7120 "Expected ERROR_INVALID_PARAMETER, got %d\n", r
);
7121 ok(hprod
== 0xdeadbeef, "Expected hprod to be unchanged\n");
7123 /* guid without brackets */
7125 r
= MsiOpenProductA("6700E8CF-95AB-4D9C-BC2C-15840DEA7A5D", &hprod
);
7126 ok(r
== ERROR_INVALID_PARAMETER
,
7127 "Expected ERROR_INVALID_PARAMETER, got %d\n", r
);
7128 ok(hprod
== 0xdeadbeef, "Expected hprod to be unchanged\n");
7130 /* guid with brackets */
7132 r
= MsiOpenProductA("{6700E8CF-95AB-4D9C-BC2C-15840DEA7A5D}", &hprod
);
7133 ok(r
== ERROR_UNKNOWN_PRODUCT
,
7134 "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r
);
7135 ok(hprod
== 0xdeadbeef, "Expected hprod to be unchanged\n");
7137 /* same length as guid, but random */
7139 r
= MsiOpenProductA("A938G02JF-2NF3N93-VN3-2NNF-3KGKALDNF93", &hprod
);
7140 ok(r
== ERROR_INVALID_PARAMETER
,
7141 "Expected ERROR_INVALID_PARAMETER, got %d\n", r
);
7142 ok(hprod
== 0xdeadbeef, "Expected hprod to be unchanged\n");
7144 /* hProduct is NULL */
7146 r
= MsiOpenProductA(prodcode
, NULL
);
7147 ok(r
== ERROR_INVALID_PARAMETER
,
7148 "Expected ERROR_INVALID_PARAMETER, got %d\n", r
);
7149 ok(hprod
== 0xdeadbeef, "Expected hprod to be unchanged\n");
7151 /* MSIINSTALLCONTEXT_USERMANAGED */
7153 lstrcpyA(keypath
, "Software\\Microsoft\\Windows\\CurrentVersion\\");
7154 lstrcatA(keypath
, "Installer\\Managed\\");
7155 lstrcatA(keypath
, usersid
);
7156 lstrcatA(keypath
, "\\Installer\\Products\\");
7157 lstrcatA(keypath
, prod_squashed
);
7159 res
= RegCreateKeyA(HKEY_LOCAL_MACHINE
, keypath
, &prodkey
);
7160 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
7162 /* managed product key exists */
7164 r
= MsiOpenProductA(prodcode
, &hprod
);
7165 ok(r
== ERROR_UNKNOWN_PRODUCT
,
7166 "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r
);
7167 ok(hprod
== 0xdeadbeef, "Expected hprod to be unchanged\n");
7169 lstrcpyA(keypath
, "Software\\Microsoft\\Windows\\CurrentVersion\\");
7170 lstrcatA(keypath
, "Installer\\UserData\\");
7171 lstrcatA(keypath
, usersid
);
7172 lstrcatA(keypath
, "\\Products\\");
7173 lstrcatA(keypath
, prod_squashed
);
7175 res
= RegCreateKeyA(HKEY_LOCAL_MACHINE
, keypath
, &userkey
);
7176 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
7178 /* user product key exists */
7180 r
= MsiOpenProductA(prodcode
, &hprod
);
7181 ok(r
== ERROR_UNKNOWN_PRODUCT
,
7182 "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r
);
7183 ok(hprod
== 0xdeadbeef, "Expected hprod to be unchanged\n");
7185 res
= RegCreateKeyA(userkey
, "InstallProperties", &props
);
7186 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
7188 /* InstallProperties key exists */
7190 r
= MsiOpenProductA(prodcode
, &hprod
);
7191 ok(r
== ERROR_UNKNOWN_PRODUCT
,
7192 "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r
);
7193 ok(hprod
== 0xdeadbeef, "Expected hprod to be unchanged\n");
7195 lstrcpyA(val
, path
);
7196 lstrcatA(val
, "\\winetest.msi");
7197 res
= RegSetValueExA(props
, "ManagedLocalPackage", 0, REG_SZ
,
7198 (const BYTE
*)val
, lstrlenA(val
) + 1);
7199 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
7201 /* ManagedLocalPackage value exists */
7203 r
= MsiOpenProductA(prodcode
, &hprod
);
7204 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
7205 ok(hprod
!= 0 && hprod
!= 0xdeadbeef, "Expected a valid product handle\n");
7208 r
= MsiGetPropertyA(hprod
, "ProductCode", val
, &size
);
7209 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
7210 ok(!lstrcmpA(val
, prodcode
), "Expected \"%s\", got \"%s\"\n", prodcode
, val
);
7211 ok(size
== lstrlenA(prodcode
), "Expected %d, got %d\n", lstrlenA(prodcode
), size
);
7213 MsiCloseHandle(hprod
);
7215 RegDeleteValueA(props
, "ManagedLocalPackage");
7216 RegDeleteKeyA(props
, "");
7218 RegDeleteKeyA(userkey
, "");
7219 RegCloseKey(userkey
);
7220 RegDeleteKeyA(prodkey
, "");
7221 RegCloseKey(prodkey
);
7223 /* MSIINSTALLCONTEXT_USERUNMANAGED */
7225 lstrcpyA(keypath
, "Software\\Microsoft\\Installer\\Products\\");
7226 lstrcatA(keypath
, prod_squashed
);
7228 res
= RegCreateKeyA(HKEY_CURRENT_USER
, keypath
, &prodkey
);
7229 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
7231 /* unmanaged product key exists */
7233 r
= MsiOpenProductA(prodcode
, &hprod
);
7234 ok(r
== ERROR_UNKNOWN_PRODUCT
,
7235 "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r
);
7236 ok(hprod
== 0xdeadbeef, "Expected hprod to be unchanged\n");
7238 lstrcpyA(keypath
, "Software\\Microsoft\\Windows\\CurrentVersion\\");
7239 lstrcatA(keypath
, "Installer\\UserData\\");
7240 lstrcatA(keypath
, usersid
);
7241 lstrcatA(keypath
, "\\Products\\");
7242 lstrcatA(keypath
, prod_squashed
);
7244 res
= RegCreateKeyA(HKEY_LOCAL_MACHINE
, keypath
, &userkey
);
7245 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
7247 /* user product key exists */
7249 r
= MsiOpenProductA(prodcode
, &hprod
);
7250 ok(r
== ERROR_UNKNOWN_PRODUCT
,
7251 "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r
);
7252 ok(hprod
== 0xdeadbeef, "Expected hprod to be unchanged\n");
7254 res
= RegCreateKeyA(userkey
, "InstallProperties", &props
);
7255 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
7257 /* InstallProperties key exists */
7259 r
= MsiOpenProductA(prodcode
, &hprod
);
7260 ok(r
== ERROR_UNKNOWN_PRODUCT
,
7261 "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r
);
7262 ok(hprod
== 0xdeadbeef, "Expected hprod to be unchanged\n");
7264 lstrcpyA(val
, path
);
7265 lstrcatA(val
, "\\winetest.msi");
7266 res
= RegSetValueExA(props
, "LocalPackage", 0, REG_SZ
,
7267 (const BYTE
*)val
, lstrlenA(val
) + 1);
7268 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
7270 /* LocalPackage value exists */
7272 r
= MsiOpenProductA(prodcode
, &hprod
);
7273 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
7274 ok(hprod
!= 0 && hprod
!= 0xdeadbeef, "Expected a valid product handle\n");
7277 r
= MsiGetPropertyA(hprod
, "ProductCode", val
, &size
);
7278 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
7279 ok(!lstrcmpA(val
, prodcode
), "Expected \"%s\", got \"%s\"\n", prodcode
, val
);
7280 ok(size
== lstrlenA(prodcode
), "Expected %d, got %d\n", lstrlenA(prodcode
), size
);
7282 MsiCloseHandle(hprod
);
7284 RegDeleteValueA(props
, "LocalPackage");
7285 RegDeleteKeyA(props
, "");
7287 RegDeleteKeyA(userkey
, "");
7288 RegCloseKey(userkey
);
7289 RegDeleteKeyA(prodkey
, "");
7290 RegCloseKey(prodkey
);
7292 /* MSIINSTALLCONTEXT_MACHINE */
7294 lstrcpyA(keypath
, "Software\\Classes\\Installer\\Products\\");
7295 lstrcatA(keypath
, prod_squashed
);
7297 res
= RegCreateKeyA(HKEY_LOCAL_MACHINE
, keypath
, &prodkey
);
7298 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
7300 /* managed product key exists */
7302 r
= MsiOpenProductA(prodcode
, &hprod
);
7303 ok(r
== ERROR_UNKNOWN_PRODUCT
,
7304 "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r
);
7305 ok(hprod
== 0xdeadbeef, "Expected hprod to be unchanged\n");
7307 lstrcpyA(keypath
, "Software\\Microsoft\\Windows\\CurrentVersion\\");
7308 lstrcatA(keypath
, "Installer\\UserData\\S-1-5-18\\Products\\");
7309 lstrcatA(keypath
, prod_squashed
);
7311 res
= RegCreateKeyA(HKEY_LOCAL_MACHINE
, keypath
, &userkey
);
7312 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
7314 /* user product key exists */
7316 r
= MsiOpenProductA(prodcode
, &hprod
);
7317 ok(r
== ERROR_UNKNOWN_PRODUCT
,
7318 "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r
);
7319 ok(hprod
== 0xdeadbeef, "Expected hprod to be unchanged\n");
7321 res
= RegCreateKeyA(userkey
, "InstallProperties", &props
);
7322 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
7324 /* InstallProperties key exists */
7326 r
= MsiOpenProductA(prodcode
, &hprod
);
7327 ok(r
== ERROR_UNKNOWN_PRODUCT
,
7328 "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r
);
7329 ok(hprod
== 0xdeadbeef, "Expected hprod to be unchanged\n");
7331 lstrcpyA(val
, path
);
7332 lstrcatA(val
, "\\winetest.msi");
7333 res
= RegSetValueExA(props
, "LocalPackage", 0, REG_SZ
,
7334 (const BYTE
*)val
, lstrlenA(val
) + 1);
7335 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
7337 /* LocalPackage value exists */
7339 r
= MsiOpenProductA(prodcode
, &hprod
);
7340 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
7341 ok(hprod
!= 0 && hprod
!= 0xdeadbeef, "Expected a valid product handle\n");
7344 r
= MsiGetPropertyA(hprod
, "ProductCode", val
, &size
);
7345 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
7346 ok(!lstrcmpA(val
, prodcode
), "Expected \"%s\", got \"%s\"\n", prodcode
, val
);
7347 ok(size
== lstrlenA(prodcode
), "Expected %d, got %d\n", lstrlenA(prodcode
), size
);
7349 MsiCloseHandle(hprod
);
7351 res
= RegSetValueExA(props
, "LocalPackage", 0, REG_SZ
,
7352 (const BYTE
*)"winetest.msi", 13);
7353 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
7355 /* LocalPackage has just the package name */
7357 r
= MsiOpenProductA(prodcode
, &hprod
);
7358 ok(r
== ERROR_INSTALL_PACKAGE_OPEN_FAILED
,
7359 "Expected ERROR_INSTALL_PACKAGE_OPEN_FAILED, got %d\n", r
);
7360 ok(hprod
== 0xdeadbeef, "Expected hprod to be unchanged\n");
7362 lstrcpyA(val
, path
);
7363 lstrcatA(val
, "\\winetest.msi");
7364 res
= RegSetValueExA(props
, "LocalPackage", 0, REG_SZ
,
7365 (const BYTE
*)val
, lstrlenA(val
) + 1);
7366 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
7368 DeleteFileA(msifile
);
7370 /* local package does not exist */
7372 r
= MsiOpenProductA(prodcode
, &hprod
);
7373 ok(r
== ERROR_UNKNOWN_PRODUCT
,
7374 "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r
);
7375 ok(hprod
== 0xdeadbeef, "Expected hprod to be unchanged\n");
7377 RegDeleteValueA(props
, "LocalPackage");
7378 RegDeleteKeyA(props
, "");
7380 RegDeleteKeyA(userkey
, "");
7381 RegCloseKey(userkey
);
7382 RegDeleteKeyA(prodkey
, "");
7383 RegCloseKey(prodkey
);
7385 DeleteFileA(msifile
);
7390 init_functionpointers();
7394 test_getcomponentpath();
7395 test_MsiGetFileHash();
7397 if (!pConvertSidToStringSidA
)
7398 skip("ConvertSidToStringSidA not implemented\n");
7401 /* These tests rely on get_user_sid that needs ConvertSidToStringSidA */
7402 test_MsiQueryProductState();
7403 test_MsiQueryFeatureState();
7404 test_MsiQueryComponentState();
7405 test_MsiGetComponentPath();
7406 test_MsiGetProductCode();
7407 test_MsiEnumClients();
7408 test_MsiGetProductInfo();
7409 test_MsiGetProductInfoEx();
7410 test_MsiGetUserInfo();
7411 test_MsiOpenProduct();
7414 test_MsiGetFileVersion();