2 * Tests for MSI Source functions
4 * Copyright (C) 2006 James Hawkins
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
31 #include "wine/test.h"
33 static BOOL (WINAPI
*pConvertSidToStringSidA
)(PSID
, LPSTR
*);
34 static UINT (WINAPI
*pMsiSourceListAddMediaDiskA
)
35 (LPCSTR
, LPCSTR
, MSIINSTALLCONTEXT
, DWORD
, DWORD
, LPCSTR
, LPCSTR
);
36 static UINT (WINAPI
*pMsiSourceListAddSourceExA
)
37 (LPCSTR
, LPCSTR
, MSIINSTALLCONTEXT
, DWORD
, LPCSTR
, DWORD
);
38 static UINT (WINAPI
*pMsiSourceListEnumMediaDisksA
)
39 (LPCSTR
, LPCSTR
, MSIINSTALLCONTEXT
, DWORD
, DWORD
, LPWORD
, LPSTR
,
40 LPDWORD
, LPSTR
, LPDWORD
);
41 static UINT (WINAPI
*pMsiSourceListEnumSourcesA
)
42 (LPCSTR
, LPCSTR
, MSIINSTALLCONTEXT
, DWORD
, DWORD
, LPSTR
, LPDWORD
);
43 static UINT (WINAPI
*pMsiSourceListGetInfoA
)
44 (LPCSTR
, LPCSTR
, MSIINSTALLCONTEXT
, DWORD
, LPCSTR
, LPSTR
, LPDWORD
);
45 static UINT (WINAPI
*pMsiSourceListSetInfoA
)
46 (LPCSTR
, LPCSTR
, MSIINSTALLCONTEXT
, DWORD
,LPCSTR
, LPCSTR
);
47 static UINT (WINAPI
*pMsiSourceListAddSourceA
)
48 (LPCSTR
, LPCSTR
, DWORD
, LPCSTR
);
50 static void init_functionpointers(void)
52 HMODULE hmsi
= GetModuleHandleA("msi.dll");
53 HMODULE hadvapi32
= GetModuleHandleA("advapi32.dll");
55 #define GET_PROC(dll, func) \
56 p ## func = (void *)GetProcAddress(dll, #func); \
58 trace("GetProcAddress(%s) failed\n", #func);
60 GET_PROC(hmsi
, MsiSourceListAddMediaDiskA
)
61 GET_PROC(hmsi
, MsiSourceListAddSourceExA
)
62 GET_PROC(hmsi
, MsiSourceListEnumMediaDisksA
)
63 GET_PROC(hmsi
, MsiSourceListEnumSourcesA
)
64 GET_PROC(hmsi
, MsiSourceListGetInfoA
)
65 GET_PROC(hmsi
, MsiSourceListSetInfoA
)
66 GET_PROC(hmsi
, MsiSourceListAddSourceA
)
68 GET_PROC(hadvapi32
, ConvertSidToStringSidA
)
73 /* copied from dlls/msi/registry.c */
74 static BOOL
squash_guid(LPCWSTR in
, LPWSTR out
)
79 if (FAILED(CLSIDFromString((LPOLESTR
)in
, &guid
)))
93 out
[17+i
*2] = in
[n
++];
94 out
[16+i
*2] = in
[n
++];
99 out
[17+i
*2] = in
[n
++];
100 out
[16+i
*2] = in
[n
++];
106 static void create_test_guid(LPSTR prodcode
, LPSTR squashed
)
108 WCHAR guidW
[MAX_PATH
];
109 WCHAR squashedW
[MAX_PATH
];
114 hr
= CoCreateGuid(&guid
);
115 ok(hr
== S_OK
, "Expected S_OK, got %d\n", hr
);
117 size
= StringFromGUID2(&guid
, (LPOLESTR
)guidW
, MAX_PATH
);
118 ok(size
== 39, "Expected 39, got %d\n", hr
);
120 WideCharToMultiByte(CP_ACP
, 0, guidW
, size
, prodcode
, MAX_PATH
, NULL
, NULL
);
121 squash_guid(guidW
, squashedW
);
122 WideCharToMultiByte(CP_ACP
, 0, squashedW
, -1, squashed
, MAX_PATH
, NULL
, NULL
);
125 static void get_user_sid(LPSTR
*usersid
)
132 OpenProcessToken(GetCurrentProcess(), TOKEN_QUERY
, &token
);
134 GetTokenInformation(token
, TokenUser
, (void *)buf
, size
, &size
);
135 user
= (PTOKEN_USER
)buf
;
136 pConvertSidToStringSidA(user
->User
.Sid
, usersid
);
139 static void check_reg_str(HKEY prodkey
, LPCSTR name
, LPCSTR expected
, BOOL bcase
, DWORD line
)
147 res
= RegQueryValueExA(prodkey
, name
, NULL
, &type
, (LPBYTE
)val
, &size
);
149 if (res
!= ERROR_SUCCESS
|| (type
!= REG_SZ
&& type
!= REG_EXPAND_SZ
))
151 ok_(__FILE__
, line
)(FALSE
, "Key doesn't exist or wrong type\n");
156 ok_(__FILE__
, line
)(lstrlenA(val
) == 0, "Expected empty string, got %s\n", val
);
160 ok_(__FILE__
, line
)(!lstrcmpA(val
, expected
), "Expected %s, got %s\n", expected
, val
);
162 ok_(__FILE__
, line
)(!lstrcmpiA(val
, expected
), "Expected %s, got %s\n", expected
, val
);
166 #define CHECK_REG_STR(prodkey, name, expected) \
167 check_reg_str(prodkey, name, expected, TRUE, __LINE__);
169 static void test_MsiSourceListGetInfo(void)
171 CHAR prodcode
[MAX_PATH
];
172 CHAR prod_squashed
[MAX_PATH
];
173 CHAR keypath
[MAX_PATH
*2];
174 CHAR value
[MAX_PATH
];
179 HKEY userkey
, hkey
, media
;
182 if (!pMsiSourceListGetInfoA
)
184 skip("Skipping MsiSourceListGetInfoA tests\n");
188 create_test_guid(prodcode
, prod_squashed
);
189 get_user_sid(&usersid
);
191 /* NULL szProductCodeOrPatchCode */
192 r
= pMsiSourceListGetInfoA(NULL
, usersid
, MSIINSTALLCONTEXT_USERUNMANAGED
,
193 MSICODE_PRODUCT
, INSTALLPROPERTY_PACKAGENAME
, NULL
, NULL
);
194 ok(r
== ERROR_INVALID_PARAMETER
, "Expected ERROR_INVALID_PARAMETER, got %d\n", r
);
196 /* empty szProductCodeOrPatchCode */
197 r
= pMsiSourceListGetInfoA("", usersid
, MSIINSTALLCONTEXT_USERUNMANAGED
,
198 MSICODE_PRODUCT
, INSTALLPROPERTY_PACKAGENAME
, NULL
, NULL
);
199 ok(r
== ERROR_INVALID_PARAMETER
, "Expected ERROR_INVALID_PARAMETER, got %d\n", r
);
201 /* garbage szProductCodeOrPatchCode */
202 r
= pMsiSourceListGetInfoA("garbage", usersid
, MSIINSTALLCONTEXT_USERUNMANAGED
,
203 MSICODE_PRODUCT
, INSTALLPROPERTY_PACKAGENAME
, NULL
, NULL
);
204 ok(r
== ERROR_INVALID_PARAMETER
, "Expected ERROR_INVALID_PARAMETER, got %d\n", r
);
206 /* szProductCodeOrPatchCode */
207 r
= pMsiSourceListGetInfoA("garbage", usersid
, MSIINSTALLCONTEXT_USERUNMANAGED
,
208 MSICODE_PRODUCT
, INSTALLPROPERTY_PACKAGENAME
, NULL
, NULL
);
209 ok(r
== ERROR_INVALID_PARAMETER
, "Expected ERROR_INVALID_PARAMETER, got %d\n", r
);
211 /* guid without brackets */
212 r
= pMsiSourceListGetInfoA("51CD2AD5-0482-4C46-8DDD-0ED1022AA1AA", usersid
, MSIINSTALLCONTEXT_USERUNMANAGED
,
213 MSICODE_PRODUCT
, INSTALLPROPERTY_PACKAGENAME
, NULL
, NULL
);
214 ok(r
== ERROR_INVALID_PARAMETER
, "Expected ERROR_INVALID_PARAMETER, got %d\n", r
);
216 /* guid with brackets */
217 r
= pMsiSourceListGetInfoA("{51CD2AD5-0482-4C46-8DDD-0ED1022AA1AA}", usersid
, MSIINSTALLCONTEXT_USERUNMANAGED
,
218 MSICODE_PRODUCT
, INSTALLPROPERTY_PACKAGENAME
, NULL
, NULL
);
219 ok(r
== ERROR_UNKNOWN_PRODUCT
, "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r
);
221 /* same length as guid, but random */
222 r
= pMsiSourceListGetInfoA("ADKD-2KSDFF2-DKK1KNFJASD9GLKWME-1I3KAD", usersid
, MSIINSTALLCONTEXT_USERUNMANAGED
,
223 MSICODE_PRODUCT
, INSTALLPROPERTY_PACKAGENAME
, NULL
, NULL
);
224 ok(r
== ERROR_INVALID_PARAMETER
, "Expected ERROR_INVALID_PARAMETER, got %d\n", r
);
226 /* invalid context */
227 r
= pMsiSourceListGetInfoA(prodcode
, usersid
, MSIINSTALLCONTEXT_NONE
,
228 MSICODE_PRODUCT
, INSTALLPROPERTY_PACKAGENAME
, NULL
, NULL
);
229 ok(r
== ERROR_INVALID_PARAMETER
, "Expected ERROR_INVALID_PARAMETER, got %d\n", r
);
231 /* another invalid context */
232 r
= pMsiSourceListGetInfoA(prodcode
, usersid
, MSIINSTALLCONTEXT_ALLUSERMANAGED
,
233 MSICODE_PRODUCT
, INSTALLPROPERTY_PACKAGENAME
, NULL
, NULL
);
234 ok(r
== ERROR_INVALID_PARAMETER
, "Expected ERROR_INVALID_PARAMETER, got %d\n", r
);
236 /* yet another invalid context */
237 r
= pMsiSourceListGetInfoA(prodcode
, usersid
, MSIINSTALLCONTEXT_ALL
,
238 MSICODE_PRODUCT
, INSTALLPROPERTY_PACKAGENAME
, NULL
, NULL
);
239 ok(r
== ERROR_INVALID_PARAMETER
, "Expected ERROR_INVALID_PARAMETER, got %d\n", r
);
241 /* mix two valid contexts */
242 r
= pMsiSourceListGetInfoA(prodcode
, usersid
, MSIINSTALLCONTEXT_USERMANAGED
| MSIINSTALLCONTEXT_USERUNMANAGED
,
243 MSICODE_PRODUCT
, INSTALLPROPERTY_PACKAGENAME
, NULL
, NULL
);
244 ok(r
== ERROR_INVALID_PARAMETER
, "Expected ERROR_INVALID_PARAMETER, got %d\n", r
);
247 r
= pMsiSourceListGetInfoA(prodcode
, usersid
, MSIINSTALLCONTEXT_USERUNMANAGED
,
248 4, INSTALLPROPERTY_PACKAGENAME
, NULL
, NULL
);
249 ok(r
== ERROR_UNKNOWN_PRODUCT
, "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r
);
252 r
= pMsiSourceListGetInfoA(prodcode
, usersid
, MSIINSTALLCONTEXT_USERUNMANAGED
,
253 MSICODE_PRODUCT
, NULL
, NULL
, NULL
);
254 ok(r
== ERROR_INVALID_PARAMETER
, "Expected ERROR_INVALID_PARAMETER, got %d\n", r
);
257 r
= pMsiSourceListGetInfoA(prodcode
, usersid
, MSIINSTALLCONTEXT_USERUNMANAGED
,
258 MSICODE_PRODUCT
, "", NULL
, NULL
);
259 ok(r
== ERROR_UNKNOWN_PRODUCT
, "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r
);
261 /* value is non-NULL while size is NULL */
262 r
= pMsiSourceListGetInfoA(prodcode
, usersid
, MSIINSTALLCONTEXT_USERUNMANAGED
,
263 MSICODE_PRODUCT
, INSTALLPROPERTY_PACKAGENAME
, value
, NULL
);
264 ok(r
== ERROR_INVALID_PARAMETER
, "Expected ERROR_INVALID_PARAMETER, got %d\n", r
);
266 /* size is non-NULL while value is NULL */
267 r
= pMsiSourceListGetInfoA(prodcode
, usersid
, MSIINSTALLCONTEXT_USERUNMANAGED
,
268 MSICODE_PRODUCT
, INSTALLPROPERTY_PACKAGENAME
, NULL
, &size
);
269 ok(r
== ERROR_UNKNOWN_PRODUCT
, "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r
);
271 lstrcpyA(keypath
, "Software\\Microsoft\\Installer\\Products\\");
272 lstrcatA(keypath
, prod_squashed
);
274 res
= RegCreateKeyA(HKEY_CURRENT_USER
, keypath
, &userkey
);
275 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
277 /* user product key exists */
278 r
= pMsiSourceListGetInfoA(prodcode
, usersid
, MSIINSTALLCONTEXT_USERUNMANAGED
,
279 MSICODE_PRODUCT
, INSTALLPROPERTY_PACKAGENAME
, NULL
, &size
);
280 ok(r
== ERROR_BAD_CONFIGURATION
, "Expected ERROR_BAD_CONFIGURATION, got %d\n", r
);
282 res
= RegCreateKeyA(userkey
, "SourceList", &hkey
);
283 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
285 /* SourceList key exists */
287 r
= pMsiSourceListGetInfoA(prodcode
, usersid
, MSIINSTALLCONTEXT_USERUNMANAGED
,
288 MSICODE_PRODUCT
, INSTALLPROPERTY_PACKAGENAME
, NULL
, &size
);
289 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
290 ok(size
== 0, "Expected 0, got %d\n", size
);
292 data
= "msitest.msi";
293 res
= RegSetValueExA(hkey
, "PackageName", 0, REG_SZ
, (const BYTE
*)data
, lstrlenA(data
) + 1);
294 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
296 /* PackageName value exists */
298 r
= pMsiSourceListGetInfoA(prodcode
, usersid
, MSIINSTALLCONTEXT_USERUNMANAGED
,
299 MSICODE_PRODUCT
, INSTALLPROPERTY_PACKAGENAME
, NULL
, &size
);
300 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
301 ok(size
== 11, "Expected 11, got %d\n", size
);
303 /* read the value, don't change size */
304 lstrcpyA(value
, "aaa");
305 r
= pMsiSourceListGetInfoA(prodcode
, usersid
, MSIINSTALLCONTEXT_USERUNMANAGED
,
306 MSICODE_PRODUCT
, INSTALLPROPERTY_PACKAGENAME
, value
, &size
);
307 ok(r
== ERROR_MORE_DATA
, "Expected ERROR_MORE_DATA, got %d\n", r
);
308 ok(!lstrcmpA(value
, "aaa"), "Expected 'aaa', got %s\n", value
);
309 ok(size
== 11, "Expected 11, got %d\n", size
);
311 /* read the value, fix size */
313 r
= pMsiSourceListGetInfoA(prodcode
, usersid
, MSIINSTALLCONTEXT_USERUNMANAGED
,
314 MSICODE_PRODUCT
, INSTALLPROPERTY_PACKAGENAME
, value
, &size
);
315 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
316 ok(!lstrcmpA(value
, "msitest.msi"), "Expected 'msitest.msi', got %s\n", value
);
317 ok(size
== 11, "Expected 11, got %d\n", size
);
319 /* empty property now that product key exists */
321 r
= pMsiSourceListGetInfoA(prodcode
, usersid
, MSIINSTALLCONTEXT_USERUNMANAGED
,
322 MSICODE_PRODUCT
, "", NULL
, &size
);
323 ok(r
== ERROR_UNKNOWN_PROPERTY
, "Expected ERROR_UNKNOWN_PROPERTY, got %d\n", r
);
324 ok(size
== 0xdeadbeef, "Expected 0xdeadbeef, got %d\n", size
);
326 /* nonexistent property now that product key exists */
328 r
= pMsiSourceListGetInfoA(prodcode
, usersid
, MSIINSTALLCONTEXT_USERUNMANAGED
,
329 MSICODE_PRODUCT
, "nonexistent", NULL
, &size
);
330 ok(r
== ERROR_UNKNOWN_PROPERTY
, "Expected ERROR_UNKNOWN_PROPERTY, got %d\n", r
);
331 ok(size
== 0xdeadbeef, "Expected 0xdeadbeef, got %d\n", size
);
334 res
= RegSetValueExA(hkey
, "nonexistent", 0, REG_SZ
, (const BYTE
*)data
, lstrlenA(data
) + 1);
335 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
337 /* nonexistent property now that nonexistent value exists */
339 r
= pMsiSourceListGetInfoA(prodcode
, usersid
, MSIINSTALLCONTEXT_USERUNMANAGED
,
340 MSICODE_PRODUCT
, "nonexistent", NULL
, &size
);
341 ok(r
== ERROR_UNKNOWN_PROPERTY
, "Expected ERROR_UNKNOWN_PROPERTY, got %d\n", r
);
342 ok(size
== 0xdeadbeef, "Expected 0xdeadbeef, got %d\n", size
);
344 /* invalid option now that product key exists */
346 r
= pMsiSourceListGetInfoA(prodcode
, usersid
, MSIINSTALLCONTEXT_USERUNMANAGED
,
347 4, INSTALLPROPERTY_PACKAGENAME
, NULL
, &size
);
348 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
349 ok(size
== 11, "Expected 11, got %d\n", size
);
351 /* INSTALLPROPERTY_MEDIAPACKAGEPATH, media key does not exist */
353 lstrcpyA(value
, "aaa");
354 r
= pMsiSourceListGetInfoA(prodcode
, usersid
, MSIINSTALLCONTEXT_USERUNMANAGED
,
355 MSICODE_PRODUCT
, INSTALLPROPERTY_MEDIAPACKAGEPATH
,
357 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
358 ok(!lstrcmpA(value
, ""), "Expected \"\", got \"%s\"\n", value
);
359 ok(size
== 0, "Expected 0, got %d\n", size
);
361 res
= RegCreateKeyA(hkey
, "Media", &media
);
362 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
365 res
= RegSetValueExA(media
, "MediaPackage", 0, REG_SZ
,
366 (const BYTE
*)data
, lstrlenA(data
) + 1);
367 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
369 /* INSTALLPROPERTY_MEDIAPACKAGEPATH */
371 r
= pMsiSourceListGetInfoA(prodcode
, usersid
, MSIINSTALLCONTEXT_USERUNMANAGED
,
372 MSICODE_PRODUCT
, INSTALLPROPERTY_MEDIAPACKAGEPATH
,
374 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
375 ok(!lstrcmpA(value
, "path"), "Expected \"path\", got \"%s\"\n", value
);
376 ok(size
== 4, "Expected 4, got %d\n", size
);
378 /* INSTALLPROPERTY_DISKPROMPT */
380 res
= RegSetValueExA(media
, "DiskPrompt", 0, REG_SZ
,
381 (const BYTE
*)data
, lstrlenA(data
) + 1);
382 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
385 r
= pMsiSourceListGetInfoA(prodcode
, usersid
, MSIINSTALLCONTEXT_USERUNMANAGED
,
386 MSICODE_PRODUCT
, INSTALLPROPERTY_DISKPROMPT
,
388 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
389 ok(!lstrcmpA(value
, "prompt"), "Expected \"prompt\", got \"%s\"\n", value
);
390 ok(size
== 6, "Expected 6, got %d\n", size
);
393 res
= RegSetValueExA(hkey
, "LastUsedSource", 0, REG_SZ
,
394 (const BYTE
*)data
, lstrlenA(data
) + 1);
395 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
397 /* INSTALLPROPERTY_LASTUSEDSOURCE, source is empty */
399 r
= pMsiSourceListGetInfoA(prodcode
, usersid
, MSIINSTALLCONTEXT_USERUNMANAGED
,
400 MSICODE_PRODUCT
, INSTALLPROPERTY_LASTUSEDSOURCE
,
402 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
403 ok(!lstrcmpA(value
, ""), "Expected \"\", got \"%s\"\n", value
);
404 ok(size
== 0, "Expected 0, got %d\n", size
);
407 res
= RegSetValueExA(hkey
, "LastUsedSource", 0, REG_SZ
,
408 (const BYTE
*)data
, lstrlenA(data
) + 1);
409 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
411 /* INSTALLPROPERTY_LASTUSEDSOURCE */
413 r
= pMsiSourceListGetInfoA(prodcode
, usersid
, MSIINSTALLCONTEXT_USERUNMANAGED
,
414 MSICODE_PRODUCT
, INSTALLPROPERTY_LASTUSEDSOURCE
,
416 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
417 ok(!lstrcmpA(value
, "source"), "Expected \"source\", got \"%s\"\n", value
);
418 ok(size
== 6, "Expected 6, got %d\n", size
);
420 /* INSTALLPROPERTY_LASTUSEDSOURCE, size is too short */
422 lstrcpyA(value
, "aaa");
423 r
= pMsiSourceListGetInfoA(prodcode
, usersid
, MSIINSTALLCONTEXT_USERUNMANAGED
,
424 MSICODE_PRODUCT
, INSTALLPROPERTY_LASTUSEDSOURCE
,
426 ok(r
== ERROR_MORE_DATA
, "Expected ERROR_MORE_DATA, got %d\n", r
);
427 ok(!lstrcmpA(value
, "aaa"), "Expected value to be unchanged, got \"%s\"\n", value
);
428 ok(size
== 6, "Expected 6, got %d\n", size
);
430 /* INSTALLPROPERTY_LASTUSEDSOURCE, size is exactly 6 */
432 lstrcpyA(value
, "aaa");
433 r
= pMsiSourceListGetInfoA(prodcode
, usersid
, MSIINSTALLCONTEXT_USERUNMANAGED
,
434 MSICODE_PRODUCT
, INSTALLPROPERTY_LASTUSEDSOURCE
,
436 ok(r
== ERROR_MORE_DATA
, "Expected ERROR_MORE_DATA, got %d\n", r
);
437 ok(!lstrcmpA(value
, "aaa"), "Expected value to be unchanged, got \"%s\"\n", value
);
438 ok(size
== 6, "Expected 6, got %d\n", size
);
441 res
= RegSetValueExA(hkey
, "LastUsedSource", 0, REG_SZ
,
442 (const BYTE
*)data
, lstrlenA(data
) + 1);
443 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
445 /* INSTALLPROPERTY_LASTUSEDSOURCE, one semi-colon */
447 r
= pMsiSourceListGetInfoA(prodcode
, usersid
, MSIINSTALLCONTEXT_USERUNMANAGED
,
448 MSICODE_PRODUCT
, INSTALLPROPERTY_LASTUSEDSOURCE
,
450 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
451 ok(!lstrcmpA(value
, "source"), "Expected \"source\", got \"%s\"\n", value
);
452 ok(size
== 6, "Expected 6, got %d\n", size
);
455 res
= RegSetValueExA(hkey
, "LastUsedSource", 0, REG_SZ
,
456 (const BYTE
*)data
, lstrlenA(data
) + 1);
457 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
459 /* INSTALLPROPERTY_LASTUSEDSOURCE, one colon */
461 r
= pMsiSourceListGetInfoA(prodcode
, usersid
, MSIINSTALLCONTEXT_USERUNMANAGED
,
462 MSICODE_PRODUCT
, INSTALLPROPERTY_LASTUSEDSOURCE
,
464 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
465 ok(!lstrcmpA(value
, "a:source"), "Expected \"a:source\", got \"%s\"\n", value
);
466 ok(size
== 8, "Expected 8, got %d\n", size
);
468 /* INSTALLPROPERTY_LASTUSEDTYPE, invalid source format */
470 r
= pMsiSourceListGetInfoA(prodcode
, usersid
, MSIINSTALLCONTEXT_USERUNMANAGED
,
471 MSICODE_PRODUCT
, INSTALLPROPERTY_LASTUSEDTYPE
,
473 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
474 ok(!lstrcmpA(value
, ""), "Expected \"\", got \"%s\"\n", value
);
475 ok(size
== 0, "Expected 0, got %d\n", size
);
478 res
= RegSetValueExA(hkey
, "LastUsedSource", 0, REG_SZ
,
479 (const BYTE
*)data
, lstrlenA(data
) + 1);
480 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
482 /* INSTALLPROPERTY_LASTUSEDTYPE, invalid source format */
484 r
= pMsiSourceListGetInfoA(prodcode
, usersid
, MSIINSTALLCONTEXT_USERUNMANAGED
,
485 MSICODE_PRODUCT
, INSTALLPROPERTY_LASTUSEDTYPE
,
487 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
488 ok(!lstrcmpA(value
, ""), "Expected \"\", got \"%s\"\n", value
);
489 ok(size
== 0, "Expected 0, got %d\n", size
);
492 res
= RegSetValueExA(hkey
, "LastUsedSource", 0, REG_SZ
,
493 (const BYTE
*)data
, lstrlenA(data
) + 1);
494 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
496 /* INSTALLPROPERTY_LASTUSEDTYPE */
498 r
= pMsiSourceListGetInfoA(prodcode
, usersid
, MSIINSTALLCONTEXT_USERUNMANAGED
,
499 MSICODE_PRODUCT
, INSTALLPROPERTY_LASTUSEDTYPE
,
501 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
502 ok(!lstrcmpA(value
, "n"), "Expected \"n\", got \"%s\"\n", value
);
503 ok(size
== 1, "Expected 1, got %d\n", size
);
506 res
= RegSetValueExA(hkey
, "LastUsedSource", 0, REG_SZ
,
507 (const BYTE
*)data
, lstrlenA(data
) + 1);
508 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
510 /* INSTALLPROPERTY_LASTUSEDTYPE */
512 r
= pMsiSourceListGetInfoA(prodcode
, usersid
, MSIINSTALLCONTEXT_USERUNMANAGED
,
513 MSICODE_PRODUCT
, INSTALLPROPERTY_LASTUSEDTYPE
,
515 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
516 ok(!lstrcmpA(value
, "n"), "Expected \"n\", got \"%s\"\n", value
);
517 ok(size
== 1, "Expected 1, got %d\n", size
);
520 res
= RegSetValueExA(hkey
, "LastUsedSource", 0, REG_SZ
,
521 (const BYTE
*)data
, lstrlenA(data
) + 1);
522 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
524 /* INSTALLPROPERTY_LASTUSEDTYPE */
526 r
= pMsiSourceListGetInfoA(prodcode
, usersid
, MSIINSTALLCONTEXT_USERUNMANAGED
,
527 MSICODE_PRODUCT
, INSTALLPROPERTY_LASTUSEDTYPE
,
529 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
530 ok(!lstrcmpA(value
, "m"), "Expected \"m\", got \"%s\"\n", value
);
531 ok(size
== 1, "Expected 1, got %d\n", size
);
534 res
= RegSetValueExA(hkey
, "LastUsedSource", 0, REG_SZ
,
535 (const BYTE
*)data
, lstrlenA(data
) + 1);
536 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
538 /* INSTALLPROPERTY_LASTUSEDTYPE */
540 r
= pMsiSourceListGetInfoA(prodcode
, usersid
, MSIINSTALLCONTEXT_USERUNMANAGED
,
541 MSICODE_PRODUCT
, INSTALLPROPERTY_LASTUSEDTYPE
,
543 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
544 ok(!lstrcmpA(value
, "u"), "Expected \"u\", got \"%s\"\n", value
);
545 ok(size
== 1, "Expected 1, got %d\n", size
);
547 RegDeleteValueA(media
, "MediaPackage");
548 RegDeleteValueA(media
, "DiskPrompt");
549 RegDeleteKeyA(media
, "");
550 RegDeleteValueA(hkey
, "LastUsedSource");
551 RegDeleteValueA(hkey
, "nonexistent");
552 RegDeleteValueA(hkey
, "PackageName");
553 RegDeleteKeyA(hkey
, "");
554 RegDeleteKeyA(userkey
, "");
556 RegCloseKey(userkey
);
560 r
= pMsiSourceListGetInfoA(prodcode
, usersid
, MSIINSTALLCONTEXT_USERUNMANAGED
,
561 MSICODE_PATCH
, INSTALLPROPERTY_PACKAGENAME
, NULL
, &size
);
562 ok(r
== ERROR_UNKNOWN_PATCH
, "Expected ERROR_UNKNOWN_PATCH, got %d\n", r
);
563 ok(size
== 0xdeadbeef, "Expected 0xdeadbeef, got %d\n", size
);
565 lstrcpyA(keypath
, "Software\\Microsoft\\Installer\\Patches\\");
566 lstrcatA(keypath
, prod_squashed
);
568 res
= RegCreateKeyA(HKEY_CURRENT_USER
, keypath
, &userkey
);
569 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
572 * NOTE: using prodcode guid, but it really doesn't matter
575 r
= pMsiSourceListGetInfoA(prodcode
, usersid
, MSIINSTALLCONTEXT_USERUNMANAGED
,
576 MSICODE_PATCH
, INSTALLPROPERTY_PACKAGENAME
, NULL
, &size
);
577 ok(r
== ERROR_BAD_CONFIGURATION
, "Expected ERROR_BAD_CONFIGURATION, got %d\n", r
);
578 ok(size
== 0xdeadbeef, "Expected 0xdeadbeef, got %d\n", size
);
580 res
= RegCreateKeyA(userkey
, "SourceList", &hkey
);
581 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
583 /* SourceList key exists */
585 r
= pMsiSourceListGetInfoA(prodcode
, usersid
, MSIINSTALLCONTEXT_USERUNMANAGED
,
586 MSICODE_PATCH
, INSTALLPROPERTY_PACKAGENAME
, NULL
, &size
);
587 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
588 ok(size
== 0, "Expected 0, got %d\n", size
);
590 RegDeleteKeyA(hkey
, "");
591 RegDeleteKeyA(userkey
, "");
593 RegCloseKey(userkey
);
596 static void test_MsiSourceListAddSourceEx(void)
598 CHAR prodcode
[MAX_PATH
];
599 CHAR prod_squashed
[MAX_PATH
];
600 CHAR keypath
[MAX_PATH
*2];
601 CHAR value
[MAX_PATH
];
605 HKEY prodkey
, userkey
, hkey
;
609 if (!pMsiSourceListAddSourceExA
)
611 skip("Skipping MsiSourceListAddSourceExA tests\n");
615 create_test_guid(prodcode
, prod_squashed
);
616 get_user_sid(&usersid
);
618 /* GetLastError is not set by the function */
620 /* NULL szProductCodeOrPatchCode */
621 r
= pMsiSourceListAddSourceExA(NULL
, usersid
, MSIINSTALLCONTEXT_USERUNMANAGED
,
622 MSICODE_PRODUCT
| MSISOURCETYPE_URL
, "C:\\source", 0);
623 ok(r
== ERROR_INVALID_PARAMETER
, "Expected ERROR_INVALID_PARAMETER, got %d\n", r
);
625 /* empty szProductCodeOrPatchCode */
626 r
= pMsiSourceListAddSourceExA("", usersid
, MSIINSTALLCONTEXT_USERUNMANAGED
,
627 MSICODE_PRODUCT
| MSISOURCETYPE_URL
, "C:\\source", 0);
628 ok(r
== ERROR_INVALID_PARAMETER
, "Expected ERROR_INVALID_PARAMETER, got %d\n", r
);
630 /* garbage szProductCodeOrPatchCode */
631 r
= pMsiSourceListAddSourceExA("garbage", usersid
, MSIINSTALLCONTEXT_USERUNMANAGED
,
632 MSICODE_PRODUCT
| MSISOURCETYPE_URL
, "C:\\source", 0);
633 ok(r
== ERROR_INVALID_PARAMETER
, "Expected ERROR_INVALID_PARAMETER, got %d\n", r
);
635 /* guid without brackets */
636 r
= pMsiSourceListAddSourceExA("51CD2AD5-0482-4C46-8DDD-0ED1022AA1AA", usersid
,
637 MSIINSTALLCONTEXT_USERUNMANAGED
,
638 MSICODE_PRODUCT
| MSISOURCETYPE_URL
, "C:\\source", 0);
639 ok(r
== ERROR_INVALID_PARAMETER
, "Expected ERROR_INVALID_PARAMETER, got %d\n", r
);
641 /* guid with brackets */
642 r
= pMsiSourceListAddSourceExA("{51CD2AD5-0482-4C46-8DDD-0ED1022AA1AA}", usersid
,
643 MSIINSTALLCONTEXT_USERUNMANAGED
,
644 MSICODE_PRODUCT
| MSISOURCETYPE_URL
, "C:\\source", 0);
645 ok(r
== ERROR_UNKNOWN_PRODUCT
, "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r
);
647 /* MSIINSTALLCONTEXT_USERUNMANAGED */
649 r
= pMsiSourceListAddSourceExA(prodcode
, usersid
,
650 MSIINSTALLCONTEXT_USERUNMANAGED
,
651 MSICODE_PRODUCT
| MSISOURCETYPE_URL
, "C:\\source", 0);
652 ok(r
== ERROR_UNKNOWN_PRODUCT
, "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r
);
654 lstrcpyA(keypath
, "Software\\Microsoft\\Installer\\Products\\");
655 lstrcatA(keypath
, prod_squashed
);
657 res
= RegCreateKeyA(HKEY_CURRENT_USER
, keypath
, &userkey
);
658 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
660 /* user product key exists */
661 r
= pMsiSourceListAddSourceExA(prodcode
, usersid
,
662 MSIINSTALLCONTEXT_USERUNMANAGED
,
663 MSICODE_PRODUCT
| MSISOURCETYPE_URL
, "C:\\source", 0);
664 ok(r
== ERROR_BAD_CONFIGURATION
, "Expected ERROR_BAD_CONFIGURATION, got %d\n", r
);
666 res
= RegCreateKeyA(userkey
, "SourceList", &url
);
667 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
670 /* SourceList key exists */
671 r
= pMsiSourceListAddSourceExA(prodcode
, usersid
,
672 MSIINSTALLCONTEXT_USERUNMANAGED
,
673 MSICODE_PRODUCT
| MSISOURCETYPE_URL
, "C:\\source", 0);
674 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
676 res
= RegOpenKeyA(userkey
, "SourceList\\URL", &url
);
677 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
680 res
= RegQueryValueExA(url
, "1", NULL
, NULL
, (LPBYTE
)value
, &size
);
681 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
682 ok(!lstrcmpA(value
, "C:\\source/"), "Expected 'C:\\source/', got %s\n", value
);
683 ok(size
== 11, "Expected 11, got %d\n", size
);
685 /* add another source, index 0 */
686 r
= pMsiSourceListAddSourceExA(prodcode
, usersid
,
687 MSIINSTALLCONTEXT_USERUNMANAGED
,
688 MSICODE_PRODUCT
| MSISOURCETYPE_URL
, "another", 0);
689 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
692 res
= RegQueryValueExA(url
, "1", NULL
, NULL
, (LPBYTE
)value
, &size
);
693 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
694 ok(!lstrcmpA(value
, "C:\\source/"), "Expected 'C:\\source/', got %s\n", value
);
695 ok(size
== 11, "Expected 11, got %d\n", size
);
698 res
= RegQueryValueExA(url
, "2", NULL
, NULL
, (LPBYTE
)value
, &size
);
699 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
700 ok(!lstrcmpA(value
, "another/"), "Expected 'another/', got %s\n", value
);
701 ok(size
== 9, "Expected 9, got %d\n", size
);
703 /* add another source, index 1 */
704 r
= pMsiSourceListAddSourceExA(prodcode
, usersid
,
705 MSIINSTALLCONTEXT_USERUNMANAGED
,
706 MSICODE_PRODUCT
| MSISOURCETYPE_URL
, "third/", 1);
707 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
710 res
= RegQueryValueExA(url
, "1", NULL
, NULL
, (LPBYTE
)value
, &size
);
711 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
712 ok(!lstrcmpA(value
, "third/"), "Expected 'third/', got %s\n", value
);
713 ok(size
== 7, "Expected 7, got %d\n", size
);
716 res
= RegQueryValueExA(url
, "2", NULL
, NULL
, (LPBYTE
)value
, &size
);
717 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
718 ok(!lstrcmpA(value
, "C:\\source/"), "Expected 'C:\\source/', got %s\n", value
);
719 ok(size
== 11, "Expected 11, got %d\n", size
);
722 res
= RegQueryValueExA(url
, "3", NULL
, NULL
, (LPBYTE
)value
, &size
);
723 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
724 ok(!lstrcmpA(value
, "another/"), "Expected 'another/', got %s\n", value
);
725 ok(size
== 9, "Expected 9, got %d\n", size
);
727 /* add another source, index > N */
728 r
= pMsiSourceListAddSourceExA(prodcode
, usersid
,
729 MSIINSTALLCONTEXT_USERUNMANAGED
,
730 MSICODE_PRODUCT
| MSISOURCETYPE_URL
, "last/", 5);
731 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
734 res
= RegQueryValueExA(url
, "1", NULL
, NULL
, (LPBYTE
)value
, &size
);
735 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
736 ok(!lstrcmpA(value
, "third/"), "Expected 'third/', got %s\n", value
);
737 ok(size
== 7, "Expected 7, got %d\n", size
);
740 res
= RegQueryValueExA(url
, "2", NULL
, NULL
, (LPBYTE
)value
, &size
);
741 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
742 ok(!lstrcmpA(value
, "C:\\source/"), "Expected 'C:\\source/', got %s\n", value
);
743 ok(size
== 11, "Expected 11, got %d\n", size
);
746 res
= RegQueryValueExA(url
, "3", NULL
, NULL
, (LPBYTE
)value
, &size
);
747 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
748 ok(!lstrcmpA(value
, "another/"), "Expected 'another/', got %s\n", value
);
749 ok(size
== 9, "Expected 9, got %d\n", size
);
752 res
= RegQueryValueExA(url
, "4", NULL
, NULL
, (LPBYTE
)value
, &size
);
753 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
754 ok(!lstrcmpA(value
, "last/"), "Expected 'last/', got %s\n", value
);
755 ok(size
== 6, "Expected 6, got %d\n", size
);
757 /* just MSISOURCETYPE_NETWORK */
758 r
= pMsiSourceListAddSourceExA(prodcode
, usersid
,
759 MSIINSTALLCONTEXT_USERUNMANAGED
,
760 MSISOURCETYPE_NETWORK
, "source", 0);
761 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
763 res
= RegOpenKeyA(userkey
, "SourceList\\Net", &net
);
764 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
767 res
= RegQueryValueExA(net
, "1", NULL
, NULL
, (LPBYTE
)value
, &size
);
768 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
769 ok(!lstrcmpA(value
, "source\\"), "Expected 'source\\', got %s\n", value
);
770 ok(size
== 8, "Expected 8, got %d\n", size
);
772 /* just MSISOURCETYPE_URL */
773 r
= pMsiSourceListAddSourceExA(prodcode
, usersid
,
774 MSIINSTALLCONTEXT_USERUNMANAGED
,
775 MSISOURCETYPE_URL
, "source", 0);
776 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
779 res
= RegQueryValueExA(url
, "1", NULL
, NULL
, (LPBYTE
)value
, &size
);
780 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
781 ok(!lstrcmpA(value
, "third/"), "Expected 'third/', got %s\n", value
);
782 ok(size
== 7, "Expected 7, got %d\n", size
);
785 res
= RegQueryValueExA(url
, "2", NULL
, NULL
, (LPBYTE
)value
, &size
);
786 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
787 ok(!lstrcmpA(value
, "C:\\source/"), "Expected 'C:\\source/', got %s\n", value
);
788 ok(size
== 11, "Expected 11, got %d\n", size
);
791 res
= RegQueryValueExA(url
, "3", NULL
, NULL
, (LPBYTE
)value
, &size
);
792 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
793 ok(!lstrcmpA(value
, "another/"), "Expected 'another/', got %s\n", value
);
794 ok(size
== 9, "Expected 9, got %d\n", size
);
797 res
= RegQueryValueExA(url
, "4", NULL
, NULL
, (LPBYTE
)value
, &size
);
798 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
799 ok(!lstrcmpA(value
, "last/"), "Expected 'last/', got %s\n", value
);
800 ok(size
== 6, "Expected 6, got %d\n", size
);
803 res
= RegQueryValueExA(url
, "5", NULL
, NULL
, (LPBYTE
)value
, &size
);
804 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
805 ok(!lstrcmpA(value
, "source/"), "Expected 'source/', got %s\n", value
);
806 ok(size
== 8, "Expected 8, got %d\n", size
);
809 r
= pMsiSourceListAddSourceExA(prodcode
, NULL
,
810 MSIINSTALLCONTEXT_USERUNMANAGED
,
811 MSISOURCETYPE_NETWORK
, "nousersid", 0);
812 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
815 res
= RegQueryValueExA(net
, "1", NULL
, NULL
, (LPBYTE
)value
, &size
);
816 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
817 ok(!lstrcmpA(value
, "source\\"), "Expected 'source\\', got %s\n", value
);
818 ok(size
== 8, "Expected 8, got %d\n", size
);
821 res
= RegQueryValueExA(net
, "2", NULL
, NULL
, (LPBYTE
)value
, &size
);
822 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
823 ok(!lstrcmpA(value
, "nousersid\\"), "Expected 'nousersid\\', got %s\n", value
);
824 ok(size
== 11, "Expected 11, got %d\n", size
);
826 /* invalid options, must have source type */
827 r
= pMsiSourceListAddSourceExA(prodcode
, usersid
,
828 MSIINSTALLCONTEXT_USERUNMANAGED
,
829 MSICODE_PRODUCT
, "source", 0);
830 ok(r
== ERROR_INVALID_PARAMETER
, "Expected ERROR_INVALID_PARAMETER, got %d\n", r
);
832 r
= pMsiSourceListAddSourceExA(prodcode
, usersid
,
833 MSIINSTALLCONTEXT_USERUNMANAGED
,
834 MSICODE_PATCH
, "source", 0);
835 ok(r
== ERROR_INVALID_PARAMETER
, "Expected ERROR_INVALID_PARAMETER, got %d\n", r
);
838 r
= pMsiSourceListAddSourceExA(prodcode
, usersid
,
839 MSIINSTALLCONTEXT_USERUNMANAGED
,
840 MSISOURCETYPE_URL
, NULL
, 1);
841 ok(r
== ERROR_INVALID_PARAMETER
, "Expected ERROR_INVALID_PARAMETER, got %d\n", r
);
844 r
= pMsiSourceListAddSourceExA(prodcode
, usersid
,
845 MSIINSTALLCONTEXT_USERUNMANAGED
,
846 MSISOURCETYPE_URL
, "", 1);
847 ok(r
== ERROR_INVALID_PARAMETER
, "Expected ERROR_INVALID_PARAMETER, got %d\n", r
);
849 /* MSIINSTALLCONTEXT_USERMANAGED, non-NULL szUserSid */
851 r
= pMsiSourceListAddSourceExA(prodcode
, usersid
,
852 MSIINSTALLCONTEXT_USERMANAGED
,
853 MSICODE_PRODUCT
| MSISOURCETYPE_URL
, "C:\\source", 0);
854 ok(r
== ERROR_UNKNOWN_PRODUCT
, "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r
);
856 lstrcpyA(keypath
, "Software\\Microsoft\\Windows\\CurrentVersion\\Installer\\Managed\\");
857 lstrcatA(keypath
, usersid
);
858 lstrcatA(keypath
, "\\Installer\\Products\\");
859 lstrcatA(keypath
, prod_squashed
);
861 res
= RegCreateKeyA(HKEY_LOCAL_MACHINE
, keypath
, &prodkey
);
862 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
864 /* product key exists */
865 r
= pMsiSourceListAddSourceExA(prodcode
, usersid
,
866 MSIINSTALLCONTEXT_USERMANAGED
,
867 MSICODE_PRODUCT
| MSISOURCETYPE_URL
, "C:\\source", 0);
868 ok(r
== ERROR_BAD_CONFIGURATION
, "Expected ERROR_BAD_CONFIGURATION, got %d\n", r
);
870 res
= RegCreateKeyA(prodkey
, "SourceList", &hkey
);
871 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
874 /* SourceList exists */
875 r
= pMsiSourceListAddSourceExA(prodcode
, usersid
,
876 MSIINSTALLCONTEXT_USERMANAGED
,
877 MSICODE_PRODUCT
| MSISOURCETYPE_URL
, "C:\\source", 0);
878 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
880 res
= RegOpenKeyA(prodkey
, "SourceList\\URL", &url
);
881 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
884 res
= RegQueryValueExA(url
, "1", NULL
, NULL
, (LPBYTE
)value
, &size
);
885 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
886 ok(!lstrcmpA(value
, "C:\\source/"), "Expected 'C:\\source/', got %s\n", value
);
887 ok(size
== 11, "Expected 11, got %d\n", size
);
891 /* MSIINSTALLCONTEXT_USERMANAGED, NULL szUserSid */
893 r
= pMsiSourceListAddSourceExA(prodcode
, NULL
,
894 MSIINSTALLCONTEXT_USERMANAGED
,
895 MSICODE_PRODUCT
| MSISOURCETYPE_URL
, "another", 0);
896 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
898 res
= RegOpenKeyA(prodkey
, "SourceList\\URL", &url
);
899 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
902 res
= RegQueryValueExA(url
, "1", NULL
, NULL
, (LPBYTE
)value
, &size
);
903 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
904 ok(!lstrcmpA(value
, "C:\\source/"), "Expected 'C:\\source/', got %s\n", value
);
905 ok(size
== 11, "Expected 11, got %d\n", size
);
908 res
= RegQueryValueExA(url
, "2", NULL
, NULL
, (LPBYTE
)value
, &size
);
909 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
910 ok(!lstrcmpA(value
, "another/"), "Expected 'another/', got %s\n", value
);
911 ok(size
== 9, "Expected 9, got %d\n", size
);
914 RegCloseKey(prodkey
);
916 /* MSIINSTALLCONTEXT_MACHINE */
918 /* szUserSid must be NULL for MSIINSTALLCONTEXT_MACHINE */
919 r
= pMsiSourceListAddSourceExA(prodcode
, usersid
,
920 MSIINSTALLCONTEXT_MACHINE
,
921 MSICODE_PRODUCT
| MSISOURCETYPE_URL
, "C:\\source", 0);
922 ok(r
== ERROR_INVALID_PARAMETER
, "Expected ERROR_INVALID_PARAMETER, got %d\n", r
);
924 r
= pMsiSourceListAddSourceExA(prodcode
, NULL
,
925 MSIINSTALLCONTEXT_MACHINE
,
926 MSICODE_PRODUCT
| MSISOURCETYPE_URL
, "C:\\source", 0);
927 ok(r
== ERROR_UNKNOWN_PRODUCT
, "Expected ERROR_INVALID_PARAMETER, got %d\n", r
);
929 lstrcpyA(keypath
, "Software\\Classes\\Installer\\Products\\");
930 lstrcatA(keypath
, prod_squashed
);
932 res
= RegCreateKeyA(HKEY_LOCAL_MACHINE
, keypath
, &prodkey
);
933 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
935 /* product key exists */
936 r
= pMsiSourceListAddSourceExA(prodcode
, NULL
,
937 MSIINSTALLCONTEXT_MACHINE
,
938 MSICODE_PRODUCT
| MSISOURCETYPE_URL
, "C:\\source", 0);
939 ok(r
== ERROR_BAD_CONFIGURATION
, "Expected ERROR_BAD_CONFIGURATION, got %d\n", r
);
941 res
= RegCreateKeyA(prodkey
, "SourceList", &hkey
);
942 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
945 /* SourceList exists */
946 r
= pMsiSourceListAddSourceExA(prodcode
, NULL
,
947 MSIINSTALLCONTEXT_MACHINE
,
948 MSICODE_PRODUCT
| MSISOURCETYPE_URL
, "C:\\source", 0);
949 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
951 res
= RegOpenKeyA(prodkey
, "SourceList\\URL", &url
);
952 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
955 res
= RegQueryValueExA(url
, "1", NULL
, NULL
, (LPBYTE
)value
, &size
);
956 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
957 ok(!lstrcmpA(value
, "C:\\source/"), "Expected 'C:\\source/', got %s\n", value
);
958 ok(size
== 11, "Expected 11, got %d\n", size
);
961 RegCloseKey(prodkey
);
962 HeapFree(GetProcessHeap(), 0, usersid
);
965 static void test_MsiSourceListEnumSources(void)
967 CHAR prodcode
[MAX_PATH
];
968 CHAR prod_squashed
[MAX_PATH
];
969 CHAR keypath
[MAX_PATH
*2];
970 CHAR value
[MAX_PATH
];
974 HKEY prodkey
, userkey
;
975 HKEY url
, net
, source
;
978 if (!pMsiSourceListEnumSourcesA
)
980 skip("MsiSourceListEnumSourcesA is not available\n");
984 create_test_guid(prodcode
, prod_squashed
);
985 get_user_sid(&usersid
);
987 /* GetLastError is not set by the function */
989 /* NULL szProductCodeOrPatchCode */
991 r
= pMsiSourceListEnumSourcesA(NULL
, usersid
, MSIINSTALLCONTEXT_USERUNMANAGED
,
992 MSICODE_PRODUCT
| MSISOURCETYPE_NETWORK
, 0, value
, &size
);
993 ok(r
== ERROR_INVALID_PARAMETER
, "Expected ERROR_INVALID_PARAMETER, got %d\n", r
);
994 ok(size
== 0xdeadbeef, "Expected 0xdeadbeef, got %d\n", size
);
996 /* empty szProductCodeOrPatchCode */
998 r
= pMsiSourceListEnumSourcesA("", usersid
, MSIINSTALLCONTEXT_USERUNMANAGED
,
999 MSICODE_PRODUCT
| MSISOURCETYPE_NETWORK
, 0, value
, &size
);
1000 ok(r
== ERROR_INVALID_PARAMETER
, "Expected ERROR_INVALID_PARAMETER, got %d\n", r
);
1001 ok(size
== 0xdeadbeef, "Expected 0xdeadbeef, got %d\n", size
);
1003 /* garbage szProductCodeOrPatchCode */
1005 r
= pMsiSourceListEnumSourcesA("garbage", usersid
, MSIINSTALLCONTEXT_USERUNMANAGED
,
1006 MSICODE_PRODUCT
| MSISOURCETYPE_NETWORK
, 0, value
, &size
);
1007 ok(r
== ERROR_INVALID_PARAMETER
, "Expected ERROR_INVALID_PARAMETER, got %d\n", r
);
1008 ok(size
== 0xdeadbeef, "Expected 0xdeadbeef, got %d\n", size
);
1010 /* guid without brackets */
1012 r
= pMsiSourceListEnumSourcesA("51CD2AD5-0482-4C46-8DDD-0ED1022AA1AA",
1013 usersid
, MSIINSTALLCONTEXT_USERUNMANAGED
,
1014 MSICODE_PRODUCT
| MSISOURCETYPE_NETWORK
, 0, value
, &size
);
1015 ok(r
== ERROR_INVALID_PARAMETER
, "Expected ERROR_INVALID_PARAMETER, got %d\n", r
);
1016 ok(size
== 0xdeadbeef, "Expected 0xdeadbeef, got %d\n", size
);
1018 /* guid with brackets */
1020 r
= pMsiSourceListEnumSourcesA("{51CD2AD5-0482-4C46-8DDD-0ED1022AA1AA}",
1021 usersid
, MSIINSTALLCONTEXT_USERUNMANAGED
,
1022 MSICODE_PRODUCT
| MSISOURCETYPE_NETWORK
, 0, value
, &size
);
1023 ok(r
== ERROR_UNKNOWN_PRODUCT
, "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r
);
1024 ok(size
== 0xdeadbeef, "Expected 0xdeadbeef, got %d\n", size
);
1026 /* MSIINSTALLCONTEXT_USERUNMANAGED */
1029 lstrcpyA(value
, "aaa");
1030 r
= pMsiSourceListEnumSourcesA(prodcode
, usersid
,
1031 MSIINSTALLCONTEXT_USERUNMANAGED
,
1032 MSICODE_PRODUCT
| MSISOURCETYPE_URL
, 0, value
, &size
);
1033 ok(r
== ERROR_UNKNOWN_PRODUCT
, "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r
);
1034 ok(!lstrcmpA(value
, "aaa"), "Expected value to be unchanged, got %s\n", value
);
1035 ok(size
== MAX_PATH
, "Expected MAX_PATH, got %d\n", size
);
1037 lstrcpyA(keypath
, "Software\\Microsoft\\Installer\\Products\\");
1038 lstrcatA(keypath
, prod_squashed
);
1040 res
= RegCreateKeyA(HKEY_CURRENT_USER
, keypath
, &userkey
);
1041 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
1043 /* user product key exists */
1045 lstrcpyA(value
, "aaa");
1046 r
= pMsiSourceListEnumSourcesA(prodcode
, usersid
,
1047 MSIINSTALLCONTEXT_USERUNMANAGED
,
1048 MSICODE_PRODUCT
| MSISOURCETYPE_URL
, 0, value
, &size
);
1049 ok(r
== ERROR_BAD_CONFIGURATION
, "Expected ERROR_BAD_CONFIGURATION, got %d\n", r
);
1050 ok(!lstrcmpA(value
, "aaa"), "Expected value to be unchanged, got %s\n", value
);
1051 ok(size
== MAX_PATH
, "Expected MAX_PATH, got %d\n", size
);
1053 res
= RegCreateKeyA(userkey
, "SourceList", &source
);
1054 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
1056 /* SourceList key exists */
1058 lstrcpyA(value
, "aaa");
1059 r
= pMsiSourceListEnumSourcesA(prodcode
, usersid
,
1060 MSIINSTALLCONTEXT_USERUNMANAGED
,
1061 MSICODE_PRODUCT
| MSISOURCETYPE_URL
, 0, value
, &size
);
1062 ok(r
== ERROR_NO_MORE_ITEMS
, "Expected ERROR_NO_MORE_ITEMS, got %d\n", r
);
1063 ok(!lstrcmpA(value
, "aaa"), "Expected value to be unchanged, got %s\n", value
);
1064 ok(size
== MAX_PATH
, "Expected MAX_PATH, got %d\n", size
);
1066 res
= RegCreateKeyA(source
, "URL", &url
);
1067 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
1069 /* URL key exists */
1071 lstrcpyA(value
, "aaa");
1072 r
= pMsiSourceListEnumSourcesA(prodcode
, usersid
,
1073 MSIINSTALLCONTEXT_USERUNMANAGED
,
1074 MSICODE_PRODUCT
| MSISOURCETYPE_URL
, 0, value
, &size
);
1075 ok(r
== ERROR_NO_MORE_ITEMS
, "Expected ERROR_NO_MORE_ITEMS, got %d\n", r
);
1076 ok(!lstrcmpA(value
, "aaa"), "Expected value to be unchanged, got %s\n", value
);
1077 ok(size
== MAX_PATH
, "Expected MAX_PATH, got %d\n", size
);
1079 res
= RegSetValueExA(url
, "1", 0, REG_SZ
, (LPBYTE
)"first", 6);
1080 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
1082 res
= RegSetValueExA(url
, "2", 0, REG_SZ
, (LPBYTE
)"second", 7);
1083 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
1085 res
= RegSetValueExA(url
, "4", 0, REG_SZ
, (LPBYTE
)"fourth", 7);
1086 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
1090 lstrcpyA(value
, "aaa");
1091 r
= pMsiSourceListEnumSourcesA(prodcode
, usersid
,
1092 MSIINSTALLCONTEXT_USERUNMANAGED
,
1093 MSICODE_PRODUCT
| MSISOURCETYPE_URL
, 0, value
, &size
);
1094 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
1095 ok(!lstrcmpA(value
, "first"), "Expected \"first\", got %s\n", value
);
1096 ok(size
== 5, "Expected 5, got %d\n", size
);
1098 /* try index 0 again */
1100 lstrcpyA(value
, "aaa");
1101 r
= pMsiSourceListEnumSourcesA(prodcode
, usersid
,
1102 MSIINSTALLCONTEXT_USERUNMANAGED
,
1103 MSICODE_PRODUCT
| MSISOURCETYPE_URL
, 0, value
, &size
);
1104 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
1105 ok(!lstrcmpA(value
, "first"), "Expected \"first\", got %s\n", value
);
1106 ok(size
== 5, "Expected 5, got %d\n", size
);
1108 /* both szSource and pcchSource are NULL, index 0 */
1109 r
= pMsiSourceListEnumSourcesA(prodcode
, usersid
,
1110 MSIINSTALLCONTEXT_USERUNMANAGED
,
1111 MSICODE_PRODUCT
| MSISOURCETYPE_URL
, 0, NULL
, NULL
);
1112 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
1114 /* both szSource and pcchSource are NULL, index 1 */
1115 r
= pMsiSourceListEnumSourcesA(prodcode
, usersid
,
1116 MSIINSTALLCONTEXT_USERUNMANAGED
,
1117 MSICODE_PRODUCT
| MSISOURCETYPE_URL
, 1, NULL
, NULL
);
1118 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
1120 /* size is exactly 5 */
1122 lstrcpyA(value
, "aaa");
1123 r
= pMsiSourceListEnumSourcesA(prodcode
, usersid
,
1124 MSIINSTALLCONTEXT_USERUNMANAGED
,
1125 MSICODE_PRODUCT
| MSISOURCETYPE_URL
, 0, value
, &size
);
1126 ok(r
== ERROR_MORE_DATA
, "Expected ERROR_MORE_DATA, got %d\n", r
);
1127 ok(!lstrcmpA(value
, "aaa"), "Expected \"aaa\", got %s\n", value
);
1128 ok(size
== 5, "Expected 5, got %d\n", size
);
1130 /* szSource is non-NULL while pcchSource is NULL */
1131 lstrcpyA(value
, "aaa");
1132 r
= pMsiSourceListEnumSourcesA(prodcode
, usersid
,
1133 MSIINSTALLCONTEXT_USERUNMANAGED
,
1134 MSICODE_PRODUCT
| MSISOURCETYPE_URL
, 0, value
, NULL
);
1135 ok(r
== ERROR_INVALID_PARAMETER
, "Expected ERROR_INVALID_PARAMETER, got %d\n", r
);
1136 ok(!lstrcmpA(value
, "aaa"), "Expected \"aaa\", got %s\n", value
);
1138 /* try index 1 after failure */
1140 lstrcpyA(value
, "aaa");
1141 r
= pMsiSourceListEnumSourcesA(prodcode
, usersid
,
1142 MSIINSTALLCONTEXT_USERUNMANAGED
,
1143 MSICODE_PRODUCT
| MSISOURCETYPE_URL
, 1, value
, &size
);
1144 ok(r
== ERROR_INVALID_PARAMETER
,
1145 "Expected ERROR_INVALID_PARAMETER, got %d\n", r
);
1146 ok(!lstrcmpA(value
, "aaa"), "Expected \"aaa\", got %s\n", value
);
1147 ok(size
== MAX_PATH
, "Expected MAX_PATH, got %d\n", size
);
1149 /* reset the enumeration */
1151 lstrcpyA(value
, "aaa");
1152 r
= pMsiSourceListEnumSourcesA(prodcode
, usersid
,
1153 MSIINSTALLCONTEXT_USERUNMANAGED
,
1154 MSICODE_PRODUCT
| MSISOURCETYPE_URL
, 0, value
, &size
);
1155 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
1156 ok(!lstrcmpA(value
, "first"), "Expected \"first\", got %s\n", value
);
1157 ok(size
== 5, "Expected 5, got %d\n", size
);
1161 lstrcpyA(value
, "aaa");
1162 r
= pMsiSourceListEnumSourcesA(prodcode
, usersid
,
1163 MSIINSTALLCONTEXT_USERUNMANAGED
,
1164 MSICODE_PRODUCT
| MSISOURCETYPE_URL
, 1, value
, &size
);
1165 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
1166 ok(!lstrcmpA(value
, "second"), "Expected \"second\", got %s\n", value
);
1167 ok(size
== 6, "Expected 6, got %d\n", size
);
1169 /* try index 1 again */
1171 lstrcpyA(value
, "aaa");
1172 r
= pMsiSourceListEnumSourcesA(prodcode
, usersid
,
1173 MSIINSTALLCONTEXT_USERUNMANAGED
,
1174 MSICODE_PRODUCT
| MSISOURCETYPE_URL
, 1, value
, &size
);
1175 ok(r
== ERROR_INVALID_PARAMETER
,
1176 "Expected ERROR_INVALID_PARAMETER, got %d\n", r
);
1177 ok(!lstrcmpA(value
, "aaa"), "Expected value to be unchanged, got %s\n", value
);
1178 ok(size
== MAX_PATH
, "Expected MAX_PATH, got %d\n", size
);
1182 lstrcpyA(value
, "aaa");
1183 r
= pMsiSourceListEnumSourcesA(prodcode
, usersid
,
1184 MSIINSTALLCONTEXT_USERUNMANAGED
,
1185 MSICODE_PRODUCT
| MSISOURCETYPE_URL
, 2, value
, &size
);
1186 ok(r
== ERROR_NO_MORE_ITEMS
, "Expected ERROR_NO_MORE_ITEMS, got %d\n", r
);
1187 ok(!lstrcmpA(value
, "aaa"), "Expected value to be unchanged, got %s\n", value
);
1188 ok(size
== MAX_PATH
, "Expected MAX_PATH, got %d\n", size
);
1192 lstrcpyA(value
, "aaa");
1193 r
= pMsiSourceListEnumSourcesA(prodcode
, usersid
,
1194 MSIINSTALLCONTEXT_USERUNMANAGED
,
1195 MSICODE_PRODUCT
| MSISOURCETYPE_URL
, -1, value
, &size
);
1196 ok(r
== ERROR_INVALID_PARAMETER
,
1197 "Expected ERROR_INVALID_PARAMETER, got %d\n", r
);
1198 ok(!lstrcmpA(value
, "aaa"), "Expected value to be unchanged, got %s\n", value
);
1199 ok(size
== MAX_PATH
, "Expected MAX_PATH, got %d\n", size
);
1201 /* NULL szUserSid */
1203 lstrcpyA(value
, "aaa");
1204 r
= pMsiSourceListEnumSourcesA(prodcode
, NULL
,
1205 MSIINSTALLCONTEXT_USERUNMANAGED
,
1206 MSICODE_PRODUCT
| MSISOURCETYPE_URL
, 0, value
, &size
);
1207 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
1208 ok(!lstrcmpA(value
, "first"), "Expected \"first\", got %s\n", value
);
1209 ok(size
== 5, "Expected 5, got %d\n", size
);
1211 /* invalid dwOptions, must be one of MSICODE_ and MSISOURCETYPE_ */
1213 lstrcpyA(value
, "aaa");
1214 r
= pMsiSourceListEnumSourcesA(prodcode
, NULL
,
1215 MSIINSTALLCONTEXT_USERUNMANAGED
,
1216 MSICODE_PRODUCT
, 0, value
, &size
);
1217 ok(r
== ERROR_INVALID_PARAMETER
, "Expected ERROR_INVALID_PARAMETER, got %d\n", r
);
1218 ok(!lstrcmpA(value
, "aaa"), "Expected value to be unchanged, got %s\n", value
);
1219 ok(size
== MAX_PATH
, "Expected MAX_PATH, got %d\n", size
);
1221 /* invalid dwOptions, must be one of MSICODE_ and MSISOURCETYPE_ */
1223 lstrcpyA(value
, "aaa");
1224 r
= pMsiSourceListEnumSourcesA(prodcode
, NULL
,
1225 MSIINSTALLCONTEXT_USERUNMANAGED
,
1226 MSICODE_PATCH
, 0, value
, &size
);
1227 ok(r
== ERROR_INVALID_PARAMETER
, "Expected ERROR_INVALID_PARAMETER, got %d\n", r
);
1228 ok(!lstrcmpA(value
, "aaa"), "Expected value to be unchanged, got %s\n", value
);
1229 ok(size
== MAX_PATH
, "Expected MAX_PATH, got %d\n", size
);
1231 /* invalid dwOptions, must be one of MSICODE_ and MSISOURCETYPE_ */
1233 lstrcpyA(value
, "aaa");
1234 r
= pMsiSourceListEnumSourcesA(prodcode
, NULL
,
1235 MSIINSTALLCONTEXT_USERUNMANAGED
,
1236 MSICODE_PRODUCT
| MSICODE_PATCH
| MSISOURCETYPE_URL
,
1238 ok(r
== ERROR_UNKNOWN_PATCH
, "Expected ERROR_SUCCESS, got %d\n", r
);
1239 ok(!lstrcmpA(value
, "aaa"), "Expected value to be unchanged, got %s\n", value
);
1240 ok(size
== MAX_PATH
, "Expected MAX_PATH, got %d\n", size
);
1242 /* invalid dwOptions, must be one of MSICODE_ and MSISOURCETYPE_ */
1244 lstrcpyA(value
, "aaa");
1245 r
= pMsiSourceListEnumSourcesA(prodcode
, NULL
,
1246 MSIINSTALLCONTEXT_USERUNMANAGED
,
1247 MSICODE_PRODUCT
| MSISOURCETYPE_NETWORK
| MSISOURCETYPE_URL
,
1249 ok(r
== ERROR_INVALID_PARAMETER
, "Expected ERROR_INVALID_PARAMETER, got %d\n", r
);
1250 ok(!lstrcmpA(value
, "aaa"), "Expected value to be unchanged, got %s\n", value
);
1251 ok(size
== MAX_PATH
, "Expected MAX_PATH, got %d\n", size
);
1253 RegDeleteValueA(url
, "1");
1254 RegDeleteValueA(url
, "2");
1255 RegDeleteValueA(url
, "4");
1256 RegDeleteKeyA(url
, "");
1259 /* SourceList key exists */
1261 lstrcpyA(value
, "aaa");
1262 r
= pMsiSourceListEnumSourcesA(prodcode
, usersid
,
1263 MSIINSTALLCONTEXT_USERUNMANAGED
,
1264 MSICODE_PRODUCT
| MSISOURCETYPE_NETWORK
, 0, value
, &size
);
1265 ok(r
== ERROR_NO_MORE_ITEMS
, "Expected ERROR_NO_MORE_ITEMS, got %d\n", r
);
1266 ok(!lstrcmpA(value
, "aaa"), "Expected value to be unchanged, got %s\n", value
);
1267 ok(size
== MAX_PATH
, "Expected MAX_PATH, got %d\n", size
);
1269 res
= RegCreateKeyA(source
, "Net", &net
);
1270 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
1272 /* Net key exists */
1274 lstrcpyA(value
, "aaa");
1275 r
= pMsiSourceListEnumSourcesA(prodcode
, usersid
,
1276 MSIINSTALLCONTEXT_USERUNMANAGED
,
1277 MSICODE_PRODUCT
| MSISOURCETYPE_NETWORK
, 0, value
, &size
);
1278 ok(r
== ERROR_NO_MORE_ITEMS
, "Expected ERROR_NO_MORE_ITEMS, got %d\n", r
);
1279 ok(!lstrcmpA(value
, "aaa"), "Expected value to be unchanged, got %s\n", value
);
1280 ok(size
== MAX_PATH
, "Expected MAX_PATH, got %d\n", size
);
1282 res
= RegSetValueExA(net
, "1", 0, REG_SZ
, (LPBYTE
)"first", 6);
1283 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
1287 lstrcpyA(value
, "aaa");
1288 r
= pMsiSourceListEnumSourcesA(prodcode
, usersid
,
1289 MSIINSTALLCONTEXT_USERUNMANAGED
,
1290 MSICODE_PRODUCT
| MSISOURCETYPE_NETWORK
, 0, value
, &size
);
1291 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
1292 ok(!lstrcmpA(value
, "first"), "Expected \"first\", got %s\n", value
);
1293 ok(size
== 5, "Expected 5, got %d\n", size
);
1295 RegDeleteValueA(net
, "1");
1296 RegDeleteKeyA(net
, "");
1298 RegDeleteKeyA(source
, "");
1299 RegCloseKey(source
);
1300 RegDeleteKeyA(userkey
, "");
1301 RegCloseKey(userkey
);
1303 /* MSIINSTALLCONTEXT_USERMANAGED */
1306 lstrcpyA(value
, "aaa");
1307 r
= pMsiSourceListEnumSourcesA(prodcode
, usersid
,
1308 MSIINSTALLCONTEXT_USERMANAGED
,
1309 MSICODE_PRODUCT
| MSISOURCETYPE_URL
, 0, value
, &size
);
1310 ok(r
== ERROR_UNKNOWN_PRODUCT
, "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r
);
1311 ok(!lstrcmpA(value
, "aaa"), "Expected value to be unchanged, got %s\n", value
);
1312 ok(size
== MAX_PATH
, "Expected MAX_PATH, got %d\n", size
);
1314 lstrcpyA(keypath
, "Software\\Microsoft\\Windows\\CurrentVersion\\Installer\\Managed\\");
1315 lstrcatA(keypath
, usersid
);
1316 lstrcatA(keypath
, "\\Installer\\Products\\");
1317 lstrcatA(keypath
, prod_squashed
);
1319 res
= RegCreateKeyA(HKEY_LOCAL_MACHINE
, keypath
, &userkey
);
1320 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
1322 /* user product key exists */
1324 lstrcpyA(value
, "aaa");
1325 r
= pMsiSourceListEnumSourcesA(prodcode
, usersid
,
1326 MSIINSTALLCONTEXT_USERMANAGED
,
1327 MSICODE_PRODUCT
| MSISOURCETYPE_URL
, 0, value
, &size
);
1328 ok(r
== ERROR_BAD_CONFIGURATION
, "Expected ERROR_BAD_CONFIGURATION, got %d\n", r
);
1329 ok(!lstrcmpA(value
, "aaa"), "Expected value to be unchanged, got %s\n", value
);
1330 ok(size
== MAX_PATH
, "Expected MAX_PATH, got %d\n", size
);
1332 res
= RegCreateKeyA(userkey
, "SourceList", &source
);
1333 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
1335 /* SourceList key exists */
1337 lstrcpyA(value
, "aaa");
1338 r
= pMsiSourceListEnumSourcesA(prodcode
, usersid
,
1339 MSIINSTALLCONTEXT_USERMANAGED
,
1340 MSICODE_PRODUCT
| MSISOURCETYPE_URL
, 0, value
, &size
);
1341 ok(r
== ERROR_NO_MORE_ITEMS
, "Expected ERROR_NO_MORE_ITEMS, got %d\n", r
);
1342 ok(!lstrcmpA(value
, "aaa"), "Expected value to be unchanged, got %s\n", value
);
1343 ok(size
== MAX_PATH
, "Expected MAX_PATH, got %d\n", size
);
1345 res
= RegCreateKeyA(source
, "URL", &url
);
1346 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
1348 /* URL key exists */
1350 lstrcpyA(value
, "aaa");
1351 r
= pMsiSourceListEnumSourcesA(prodcode
, usersid
,
1352 MSIINSTALLCONTEXT_USERMANAGED
,
1353 MSICODE_PRODUCT
| MSISOURCETYPE_URL
, 0, value
, &size
);
1354 ok(r
== ERROR_NO_MORE_ITEMS
, "Expected ERROR_NO_MORE_ITEMS, got %d\n", r
);
1355 ok(!lstrcmpA(value
, "aaa"), "Expected value to be unchanged, got %s\n", value
);
1356 ok(size
== MAX_PATH
, "Expected MAX_PATH, got %d\n", size
);
1358 res
= RegSetValueExA(url
, "1", 0, REG_SZ
, (LPBYTE
)"first", 6);
1359 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
1363 lstrcpyA(value
, "aaa");
1364 r
= pMsiSourceListEnumSourcesA(prodcode
, usersid
,
1365 MSIINSTALLCONTEXT_USERMANAGED
,
1366 MSICODE_PRODUCT
| MSISOURCETYPE_URL
, 0, value
, &size
);
1367 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
1368 ok(!lstrcmpA(value
, "first"), "Expected \"first\", got %s\n", value
);
1369 ok(size
== 5, "Expected 5, got %d\n", size
);
1371 /* NULL szUserSid */
1373 lstrcpyA(value
, "aaa");
1374 r
= pMsiSourceListEnumSourcesA(prodcode
, NULL
,
1375 MSIINSTALLCONTEXT_USERMANAGED
,
1376 MSICODE_PRODUCT
| MSISOURCETYPE_URL
, 0, value
, &size
);
1377 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
1378 ok(!lstrcmpA(value
, "first"), "Expected \"first\", got %s\n", value
);
1379 ok(size
== 5, "Expected 5, got %d\n", size
);
1381 RegDeleteValueA(url
, "1");
1382 RegDeleteKeyA(url
, "");
1385 /* SourceList key exists */
1387 lstrcpyA(value
, "aaa");
1388 r
= pMsiSourceListEnumSourcesA(prodcode
, usersid
,
1389 MSIINSTALLCONTEXT_USERMANAGED
,
1390 MSICODE_PRODUCT
| MSISOURCETYPE_NETWORK
, 0, value
, &size
);
1391 ok(r
== ERROR_NO_MORE_ITEMS
, "Expected ERROR_NO_MORE_ITEMS, got %d\n", r
);
1392 ok(!lstrcmpA(value
, "aaa"), "Expected value to be unchanged, got %s\n", value
);
1393 ok(size
== MAX_PATH
, "Expected MAX_PATH, got %d\n", size
);
1395 res
= RegCreateKeyA(source
, "Net", &net
);
1396 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
1398 /* Net key exists */
1400 lstrcpyA(value
, "aaa");
1401 r
= pMsiSourceListEnumSourcesA(prodcode
, usersid
,
1402 MSIINSTALLCONTEXT_USERMANAGED
,
1403 MSICODE_PRODUCT
| MSISOURCETYPE_NETWORK
, 0, value
, &size
);
1404 ok(r
== ERROR_NO_MORE_ITEMS
, "Expected ERROR_NO_MORE_ITEMS, got %d\n", r
);
1405 ok(!lstrcmpA(value
, "aaa"), "Expected value to be unchanged, got %s\n", value
);
1406 ok(size
== MAX_PATH
, "Expected MAX_PATH, got %d\n", size
);
1408 res
= RegSetValueExA(net
, "1", 0, REG_SZ
, (LPBYTE
)"first", 6);
1409 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
1413 lstrcpyA(value
, "aaa");
1414 r
= pMsiSourceListEnumSourcesA(prodcode
, usersid
,
1415 MSIINSTALLCONTEXT_USERMANAGED
,
1416 MSICODE_PRODUCT
| MSISOURCETYPE_NETWORK
, 0, value
, &size
);
1417 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
1418 ok(!lstrcmpA(value
, "first"), "Expected \"first\", got %s\n", value
);
1419 ok(size
== 5, "Expected 5, got %d\n", size
);
1421 RegDeleteValueA(net
, "1");
1422 RegDeleteKeyA(net
, "");
1424 RegDeleteKeyA(source
, "");
1425 RegCloseKey(source
);
1426 RegDeleteKeyA(userkey
, "");
1427 RegCloseKey(userkey
);
1429 /* MSIINSTALLCONTEXT_MACHINE */
1431 /* szUserSid is non-NULL */
1433 lstrcpyA(value
, "aaa");
1434 r
= pMsiSourceListEnumSourcesA(prodcode
, usersid
,
1435 MSIINSTALLCONTEXT_MACHINE
,
1436 MSICODE_PRODUCT
| MSISOURCETYPE_URL
, 0, value
, &size
);
1437 ok(r
== ERROR_INVALID_PARAMETER
, "Expected ERROR_INVALID_PARAMETER, got %d\n", r
);
1438 ok(!lstrcmpA(value
, "aaa"), "Expected value to be unchanged, got %s\n", value
);
1439 ok(size
== MAX_PATH
, "Expected MAX_PATH, got %d\n", size
);
1441 /* szUserSid is non-NULL */
1443 lstrcpyA(value
, "aaa");
1444 r
= pMsiSourceListEnumSourcesA(prodcode
, NULL
,
1445 MSIINSTALLCONTEXT_MACHINE
,
1446 MSICODE_PRODUCT
| MSISOURCETYPE_URL
, 0, value
, &size
);
1447 ok(r
== ERROR_UNKNOWN_PRODUCT
, "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r
);
1448 ok(!lstrcmpA(value
, "aaa"), "Expected value to be unchanged, got %s\n", value
);
1449 ok(size
== MAX_PATH
, "Expected MAX_PATH, got %d\n", size
);
1451 lstrcpyA(keypath
, "Software\\Classes\\Installer\\Products\\");
1452 lstrcatA(keypath
, prod_squashed
);
1454 res
= RegCreateKeyA(HKEY_LOCAL_MACHINE
, keypath
, &prodkey
);
1455 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
1457 /* user product key exists */
1459 lstrcpyA(value
, "aaa");
1460 r
= pMsiSourceListEnumSourcesA(prodcode
, NULL
,
1461 MSIINSTALLCONTEXT_MACHINE
,
1462 MSICODE_PRODUCT
| MSISOURCETYPE_URL
, 0, value
, &size
);
1463 ok(r
== ERROR_BAD_CONFIGURATION
, "Expected ERROR_BAD_CONFIGURATION, got %d\n", r
);
1464 ok(!lstrcmpA(value
, "aaa"), "Expected value to be unchanged, got %s\n", value
);
1465 ok(size
== MAX_PATH
, "Expected MAX_PATH, got %d\n", size
);
1467 res
= RegCreateKeyA(prodkey
, "SourceList", &source
);
1468 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
1470 /* SourceList key exists */
1472 lstrcpyA(value
, "aaa");
1473 r
= pMsiSourceListEnumSourcesA(prodcode
, NULL
,
1474 MSIINSTALLCONTEXT_MACHINE
,
1475 MSICODE_PRODUCT
| MSISOURCETYPE_URL
, 0, value
, &size
);
1476 ok(r
== ERROR_NO_MORE_ITEMS
, "Expected ERROR_NO_MORE_ITEMS, got %d\n", r
);
1477 ok(!lstrcmpA(value
, "aaa"), "Expected value to be unchanged, got %s\n", value
);
1478 ok(size
== MAX_PATH
, "Expected MAX_PATH, got %d\n", size
);
1480 res
= RegCreateKeyA(source
, "URL", &url
);
1481 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
1483 /* URL key exists */
1485 lstrcpyA(value
, "aaa");
1486 r
= pMsiSourceListEnumSourcesA(prodcode
, NULL
,
1487 MSIINSTALLCONTEXT_MACHINE
,
1488 MSICODE_PRODUCT
| MSISOURCETYPE_URL
, 0, value
, &size
);
1489 ok(r
== ERROR_NO_MORE_ITEMS
, "Expected ERROR_NO_MORE_ITEMS, got %d\n", r
);
1490 ok(!lstrcmpA(value
, "aaa"), "Expected value to be unchanged, got %s\n", value
);
1491 ok(size
== MAX_PATH
, "Expected MAX_PATH, got %d\n", size
);
1493 res
= RegSetValueExA(url
, "1", 0, REG_SZ
, (LPBYTE
)"first", 6);
1494 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
1498 lstrcpyA(value
, "aaa");
1499 r
= pMsiSourceListEnumSourcesA(prodcode
, NULL
,
1500 MSIINSTALLCONTEXT_MACHINE
,
1501 MSICODE_PRODUCT
| MSISOURCETYPE_URL
, 0, value
, &size
);
1502 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
1503 ok(!lstrcmpA(value
, "first"), "Expected \"first\", got %s\n", value
);
1504 ok(size
== 5, "Expected 5, got %d\n", size
);
1506 /* NULL szUserSid */
1508 lstrcpyA(value
, "aaa");
1509 r
= pMsiSourceListEnumSourcesA(prodcode
, NULL
,
1510 MSIINSTALLCONTEXT_MACHINE
,
1511 MSICODE_PRODUCT
| MSISOURCETYPE_URL
, 0, value
, &size
);
1512 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
1513 ok(!lstrcmpA(value
, "first"), "Expected \"first\", got %s\n", value
);
1514 ok(size
== 5, "Expected 5, got %d\n", size
);
1516 RegDeleteValueA(url
, "1");
1517 RegDeleteKeyA(url
, "");
1520 /* SourceList key exists */
1522 lstrcpyA(value
, "aaa");
1523 r
= pMsiSourceListEnumSourcesA(prodcode
, NULL
,
1524 MSIINSTALLCONTEXT_MACHINE
,
1525 MSICODE_PRODUCT
| MSISOURCETYPE_NETWORK
, 0, value
, &size
);
1526 ok(r
== ERROR_NO_MORE_ITEMS
, "Expected ERROR_NO_MORE_ITEMS, got %d\n", r
);
1527 ok(!lstrcmpA(value
, "aaa"), "Expected value to be unchanged, got %s\n", value
);
1528 ok(size
== MAX_PATH
, "Expected MAX_PATH, got %d\n", size
);
1530 res
= RegCreateKeyA(source
, "Net", &net
);
1531 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
1533 /* Net key exists */
1535 lstrcpyA(value
, "aaa");
1536 r
= pMsiSourceListEnumSourcesA(prodcode
, NULL
,
1537 MSIINSTALLCONTEXT_MACHINE
,
1538 MSICODE_PRODUCT
| MSISOURCETYPE_NETWORK
, 0, value
, &size
);
1539 ok(r
== ERROR_NO_MORE_ITEMS
, "Expected ERROR_NO_MORE_ITEMS, got %d\n", r
);
1540 ok(!lstrcmpA(value
, "aaa"), "Expected value to be unchanged, got %s\n", value
);
1541 ok(size
== MAX_PATH
, "Expected MAX_PATH, got %d\n", size
);
1543 res
= RegSetValueExA(net
, "1", 0, REG_SZ
, (LPBYTE
)"first", 6);
1544 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
1548 lstrcpyA(value
, "aaa");
1549 r
= pMsiSourceListEnumSourcesA(prodcode
, NULL
,
1550 MSIINSTALLCONTEXT_MACHINE
,
1551 MSICODE_PRODUCT
| MSISOURCETYPE_NETWORK
, 0, value
, &size
);
1552 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
1553 ok(!lstrcmpA(value
, "first"), "Expected \"first\", got %s\n", value
);
1554 ok(size
== 5, "Expected 5, got %d\n", size
);
1556 RegDeleteValueA(net
, "1");
1557 RegDeleteKeyA(net
, "");
1559 RegDeleteKeyA(source
, "");
1560 RegCloseKey(source
);
1561 RegDeleteKeyA(prodkey
, "");
1562 RegCloseKey(prodkey
);
1565 static void test_MsiSourceListSetInfo(void)
1567 CHAR prodcode
[MAX_PATH
];
1568 CHAR prod_squashed
[MAX_PATH
];
1569 CHAR keypath
[MAX_PATH
*2];
1570 HKEY prodkey
, userkey
;
1571 HKEY net
, url
, media
, source
;
1576 if (!pMsiSourceListSetInfoA
)
1578 skip("MsiSourceListSetInfoA is not available\n");
1582 create_test_guid(prodcode
, prod_squashed
);
1583 get_user_sid(&usersid
);
1585 /* GetLastError is not set by the function */
1587 /* NULL szProductCodeOrPatchCode */
1588 r
= pMsiSourceListSetInfoA(NULL
, usersid
, MSIINSTALLCONTEXT_USERUNMANAGED
,
1589 MSICODE_PRODUCT
| MSISOURCETYPE_NETWORK
,
1590 INSTALLPROPERTY_MEDIAPACKAGEPATH
, "path");
1591 ok(r
== ERROR_INVALID_PARAMETER
,
1592 "Expected ERROR_INVALID_PARAMETER, got %d\n", r
);
1594 /* empty szProductCodeOrPatchCode */
1595 r
= pMsiSourceListSetInfoA("", usersid
, MSIINSTALLCONTEXT_USERUNMANAGED
,
1596 MSICODE_PRODUCT
| MSISOURCETYPE_NETWORK
,
1597 INSTALLPROPERTY_MEDIAPACKAGEPATH
, "path");
1598 ok(r
== ERROR_INVALID_PARAMETER
,
1599 "Expected ERROR_INVALID_PARAMETER, got %d\n", r
);
1601 /* garbage szProductCodeOrPatchCode */
1602 r
= pMsiSourceListSetInfoA("garbage", usersid
,
1603 MSIINSTALLCONTEXT_USERUNMANAGED
,
1604 MSICODE_PRODUCT
| MSISOURCETYPE_NETWORK
,
1605 INSTALLPROPERTY_MEDIAPACKAGEPATH
, "path");
1606 ok(r
== ERROR_INVALID_PARAMETER
,
1607 "Expected ERROR_INVALID_PARAMETER, got %d\n", r
);
1609 /* guid without brackets */
1610 r
= pMsiSourceListSetInfoA("51CD2AD5-0482-4C46-8DDD-0ED1022AA1AA",
1611 usersid
, MSIINSTALLCONTEXT_USERUNMANAGED
,
1612 MSICODE_PRODUCT
| MSISOURCETYPE_NETWORK
,
1613 INSTALLPROPERTY_MEDIAPACKAGEPATH
, "path");
1614 ok(r
== ERROR_INVALID_PARAMETER
,
1615 "Expected ERROR_INVALID_PARAMETER, got %d\n", r
);
1617 /* guid with brackets */
1618 r
= pMsiSourceListSetInfoA("{51CD2AD5-0482-4C46-8DDD-0ED1022AA1AA}",
1619 usersid
, MSIINSTALLCONTEXT_USERUNMANAGED
,
1620 MSICODE_PRODUCT
| MSISOURCETYPE_NETWORK
,
1621 INSTALLPROPERTY_MEDIAPACKAGEPATH
, "path");
1622 ok(r
== ERROR_UNKNOWN_PRODUCT
,
1623 "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r
);
1625 /* dwOptions is MSICODE_PRODUCT */
1626 r
= pMsiSourceListSetInfoA(prodcode
, usersid
,
1627 MSIINSTALLCONTEXT_USERUNMANAGED
, MSICODE_PRODUCT
,
1628 INSTALLPROPERTY_MEDIAPACKAGEPATH
, "path");
1629 ok(r
== ERROR_UNKNOWN_PRODUCT
,
1630 "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r
);
1632 /* dwOptions is MSICODE_PATCH */
1633 r
= pMsiSourceListSetInfoA(prodcode
, usersid
,
1634 MSIINSTALLCONTEXT_USERUNMANAGED
, MSICODE_PATCH
,
1635 INSTALLPROPERTY_MEDIAPACKAGEPATH
, "path");
1636 ok(r
== ERROR_UNKNOWN_PATCH
, "Expected ERROR_UNKNOWN_PATCH, got %d\n", r
);
1638 /* dwOptions is both MSICODE_PRODUCT and MSICODE_PATCH */
1639 r
= pMsiSourceListSetInfoA(prodcode
, usersid
,
1640 MSIINSTALLCONTEXT_USERUNMANAGED
,
1641 MSICODE_PRODUCT
| MSICODE_PATCH
| MSISOURCETYPE_URL
,
1642 INSTALLPROPERTY_MEDIAPACKAGEPATH
, "path");
1643 ok(r
== ERROR_UNKNOWN_PATCH
, "Expected ERROR_UNKNOWN_PATCH, got %d\n", r
);
1645 /* dwOptions has both MSISOURCETYPE_NETWORK and MSISOURCETYPE_URL */
1646 r
= pMsiSourceListSetInfoA(prodcode
, NULL
,
1647 MSIINSTALLCONTEXT_USERUNMANAGED
,
1648 MSICODE_PRODUCT
| MSISOURCETYPE_NETWORK
| MSISOURCETYPE_URL
,
1649 INSTALLPROPERTY_MEDIAPACKAGEPATH
, "path");
1650 ok(r
== ERROR_UNKNOWN_PRODUCT
,
1651 "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r
);
1653 /* LastUsedSource and dwOptions has both
1654 * MSISOURCETYPE_NETWORK and MSISOURCETYPE_URL
1656 r
= pMsiSourceListSetInfoA(prodcode
, NULL
,
1657 MSIINSTALLCONTEXT_USERUNMANAGED
,
1658 MSICODE_PRODUCT
| MSISOURCETYPE_NETWORK
| MSISOURCETYPE_URL
,
1659 INSTALLPROPERTY_LASTUSEDSOURCE
, "path");
1660 ok(r
== ERROR_UNKNOWN_PRODUCT
,
1661 "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r
);
1663 /* LastUsedSource and dwOptions has no source type */
1664 r
= pMsiSourceListSetInfoA(prodcode
, NULL
,
1665 MSIINSTALLCONTEXT_USERUNMANAGED
, MSICODE_PRODUCT
,
1666 INSTALLPROPERTY_LASTUSEDSOURCE
, "path");
1667 ok(r
== ERROR_UNKNOWN_PRODUCT
,
1668 "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r
);
1670 /* MSIINSTALLCONTEXT_USERUNMANAGED */
1672 lstrcpyA(keypath
, "Software\\Microsoft\\Installer\\Products\\");
1673 lstrcatA(keypath
, prod_squashed
);
1675 res
= RegCreateKeyA(HKEY_CURRENT_USER
, keypath
, &userkey
);
1676 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
1678 /* user product key exists */
1679 r
= pMsiSourceListSetInfoA(prodcode
, NULL
,
1680 MSIINSTALLCONTEXT_USERUNMANAGED
, MSICODE_PRODUCT
,
1681 INSTALLPROPERTY_MEDIAPACKAGEPATH
, "path");
1682 ok(r
== ERROR_BAD_CONFIGURATION
,
1683 "Expected ERROR_BAD_CONFIGURATION, got %d\n", r
);
1685 res
= RegCreateKeyA(userkey
, "SourceList", &source
);
1686 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
1688 /* SourceList key exists, no source type */
1689 r
= pMsiSourceListSetInfoA(prodcode
, NULL
,
1690 MSIINSTALLCONTEXT_USERUNMANAGED
, MSICODE_PRODUCT
,
1691 INSTALLPROPERTY_MEDIAPACKAGEPATH
, "path");
1692 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
1694 /* Media key is created by MsiSourceListSetInfo */
1695 res
= RegOpenKeyA(source
, "Media", &media
);
1696 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
1697 CHECK_REG_STR(media
, "MediaPackage", "path");
1699 /* set the info again */
1700 r
= pMsiSourceListSetInfoA(prodcode
, NULL
,
1701 MSIINSTALLCONTEXT_USERUNMANAGED
, MSICODE_PRODUCT
,
1702 INSTALLPROPERTY_MEDIAPACKAGEPATH
, "path2");
1703 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
1704 CHECK_REG_STR(media
, "MediaPackage", "path2");
1706 /* NULL szProperty */
1707 r
= pMsiSourceListSetInfoA(prodcode
, NULL
,
1708 MSIINSTALLCONTEXT_USERUNMANAGED
, MSICODE_PRODUCT
,
1710 ok(r
== ERROR_INVALID_PARAMETER
,
1711 "Expected ERROR_INVALID_PARAMETER, got %d\n", r
);
1713 /* empty szProperty */
1714 r
= pMsiSourceListSetInfoA(prodcode
, NULL
,
1715 MSIINSTALLCONTEXT_USERUNMANAGED
, MSICODE_PRODUCT
,
1717 ok(r
== ERROR_UNKNOWN_PROPERTY
,
1718 "Expected ERROR_UNKNOWN_PROPERTY, got %d\n", r
);
1721 r
= pMsiSourceListSetInfoA(prodcode
, NULL
,
1722 MSIINSTALLCONTEXT_USERUNMANAGED
, MSICODE_PRODUCT
,
1723 INSTALLPROPERTY_MEDIAPACKAGEPATH
, NULL
);
1724 ok(r
== ERROR_UNKNOWN_PROPERTY
,
1725 "Expected ERROR_UNKNOWN_PROPERTY, got %d\n", r
);
1728 r
= pMsiSourceListSetInfoA(prodcode
, NULL
,
1729 MSIINSTALLCONTEXT_USERUNMANAGED
, MSICODE_PRODUCT
,
1730 INSTALLPROPERTY_MEDIAPACKAGEPATH
, "");
1731 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
1732 CHECK_REG_STR(media
, "MediaPackage", "");
1734 /* INSTALLPROPERTY_MEDIAPACKAGEPATH, MSISOURCETYPE_NETWORK */
1735 r
= pMsiSourceListSetInfoA(prodcode
, NULL
,
1736 MSIINSTALLCONTEXT_USERUNMANAGED
,
1737 MSICODE_PRODUCT
| MSISOURCETYPE_NETWORK
,
1738 INSTALLPROPERTY_MEDIAPACKAGEPATH
, "path");
1739 ok(r
== ERROR_INVALID_PARAMETER
,
1740 "Expected ERROR_INVALID_PARAMETER, got %d\n", r
);
1742 /* INSTALLPROPERTY_MEDIAPACKAGEPATH, MSISOURCETYPE_URL */
1743 r
= pMsiSourceListSetInfoA(prodcode
, NULL
,
1744 MSIINSTALLCONTEXT_USERUNMANAGED
,
1745 MSICODE_PRODUCT
| MSISOURCETYPE_URL
,
1746 INSTALLPROPERTY_MEDIAPACKAGEPATH
, "path");
1747 ok(r
== ERROR_INVALID_PARAMETER
,
1748 "Expected ERROR_INVALID_PARAMETER, got %d\n", r
);
1750 /* INSTALLPROPERTY_DISKPROMPT */
1751 r
= pMsiSourceListSetInfoA(prodcode
, NULL
,
1752 MSIINSTALLCONTEXT_USERUNMANAGED
, MSICODE_PRODUCT
,
1753 INSTALLPROPERTY_DISKPROMPT
, "prompt");
1754 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
1755 CHECK_REG_STR(media
, "DiskPrompt", "prompt");
1757 /* INSTALLPROPERTY_DISKPROMPT, MSISOURCETYPE_NETWORK */
1758 r
= pMsiSourceListSetInfoA(prodcode
, NULL
,
1759 MSIINSTALLCONTEXT_USERUNMANAGED
,
1760 MSICODE_PRODUCT
| MSISOURCETYPE_NETWORK
,
1761 INSTALLPROPERTY_DISKPROMPT
, "prompt");
1762 ok(r
== ERROR_INVALID_PARAMETER
,
1763 "Expected ERROR_INVALID_PARAMETER, got %d\n", r
);
1765 /* INSTALLPROPERTY_DISKPROMPT, MSISOURCETYPE_URL */
1766 r
= pMsiSourceListSetInfoA(prodcode
, NULL
,
1767 MSIINSTALLCONTEXT_USERUNMANAGED
,
1768 MSICODE_PRODUCT
| MSISOURCETYPE_URL
,
1769 INSTALLPROPERTY_DISKPROMPT
, "prompt");
1770 ok(r
== ERROR_INVALID_PARAMETER
,
1771 "Expected ERROR_INVALID_PARAMETER, got %d\n", r
);
1773 /* INSTALLPROPERTY_LASTUSEDSOURCE */
1774 r
= pMsiSourceListSetInfoA(prodcode
, NULL
,
1775 MSIINSTALLCONTEXT_USERUNMANAGED
, MSICODE_PRODUCT
,
1776 INSTALLPROPERTY_LASTUSEDSOURCE
, "source");
1777 ok(r
== ERROR_INVALID_PARAMETER
,
1778 "Expected ERROR_INVALID_PARAMETER, got %d\n", r
);
1780 /* INSTALLPROPERTY_LASTUSEDSOURCE, MSISOURCETYPE_NETWORK */
1781 r
= pMsiSourceListSetInfoA(prodcode
, NULL
,
1782 MSIINSTALLCONTEXT_USERUNMANAGED
,
1783 MSICODE_PRODUCT
| MSISOURCETYPE_NETWORK
,
1784 INSTALLPROPERTY_LASTUSEDSOURCE
, "source");
1785 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
1787 /* Net key is created by MsiSourceListSetInfo */
1788 res
= RegOpenKeyA(source
, "Net", &net
);
1789 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
1790 CHECK_REG_STR(net
, "1", "source\\")
1791 CHECK_REG_STR(source
, "LastUsedSource", "n;1;source");
1793 /* source has forward slash */
1794 r
= pMsiSourceListSetInfoA(prodcode
, NULL
,
1795 MSIINSTALLCONTEXT_USERUNMANAGED
,
1796 MSICODE_PRODUCT
| MSISOURCETYPE_NETWORK
,
1797 INSTALLPROPERTY_LASTUSEDSOURCE
, "source/");
1798 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
1799 CHECK_REG_STR(net
, "1", "source\\");
1800 CHECK_REG_STR(net
, "2", "source/\\");
1801 CHECK_REG_STR(source
, "LastUsedSource", "n;2;source/");
1803 /* INSTALLPROPERTY_LASTUSEDSOURCE, MSISOURCETYPE_URL */
1804 r
= pMsiSourceListSetInfoA(prodcode
, NULL
,
1805 MSIINSTALLCONTEXT_USERUNMANAGED
,
1806 MSICODE_PRODUCT
| MSISOURCETYPE_URL
,
1807 INSTALLPROPERTY_LASTUSEDSOURCE
, "source");
1808 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
1810 /* URL key is created by MsiSourceListSetInfo */
1811 res
= RegOpenKeyA(source
, "URL", &url
);
1812 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
1813 CHECK_REG_STR(url
, "1", "source/");
1814 CHECK_REG_STR(source
, "LastUsedSource", "u;1;source");
1816 /* source has backslash */
1817 r
= pMsiSourceListSetInfoA(prodcode
, NULL
,
1818 MSIINSTALLCONTEXT_USERUNMANAGED
,
1819 MSICODE_PRODUCT
| MSISOURCETYPE_URL
,
1820 INSTALLPROPERTY_LASTUSEDSOURCE
, "source\\");
1821 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
1822 CHECK_REG_STR(url
, "1", "source/");
1823 CHECK_REG_STR(url
, "2", "source\\/");
1824 CHECK_REG_STR(source
, "LastUsedSource", "u;2;source\\");
1826 /* INSTALLPROPERTY_LASTUSEDSOURCE, MSISOURCETYPE_MEDIA */
1827 r
= pMsiSourceListSetInfoA(prodcode
, NULL
,
1828 MSIINSTALLCONTEXT_USERUNMANAGED
,
1829 MSICODE_PRODUCT
| MSISOURCETYPE_MEDIA
,
1830 INSTALLPROPERTY_LASTUSEDSOURCE
, "source");
1831 ok(r
== ERROR_INVALID_PARAMETER
,
1832 "Expected ERROR_INVALID_PARAMETER, got %d\n", r
);
1834 /* INSTALLPROPERTY_PACKAGENAME */
1835 r
= pMsiSourceListSetInfoA(prodcode
, NULL
,
1836 MSIINSTALLCONTEXT_USERUNMANAGED
, MSICODE_PRODUCT
,
1837 INSTALLPROPERTY_PACKAGENAME
, "name");
1838 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
1839 CHECK_REG_STR(source
, "PackageName", "name");
1841 /* INSTALLPROPERTY_PACKAGENAME, MSISOURCETYPE_NETWORK */
1842 r
= pMsiSourceListSetInfoA(prodcode
, NULL
,
1843 MSIINSTALLCONTEXT_USERUNMANAGED
,
1844 MSICODE_PRODUCT
| MSISOURCETYPE_NETWORK
,
1845 INSTALLPROPERTY_PACKAGENAME
, "name");
1846 ok(r
== ERROR_INVALID_PARAMETER
,
1847 "Expected ERROR_INVALID_PARAMETER, got %d\n", r
);
1849 /* INSTALLPROPERTY_PACKAGENAME, MSISOURCETYPE_URL */
1850 r
= pMsiSourceListSetInfoA(prodcode
, NULL
,
1851 MSIINSTALLCONTEXT_USERUNMANAGED
,
1852 MSICODE_PRODUCT
| MSISOURCETYPE_URL
,
1853 INSTALLPROPERTY_PACKAGENAME
, "name");
1854 ok(r
== ERROR_INVALID_PARAMETER
,
1855 "Expected ERROR_INVALID_PARAMETER, got %d\n", r
);
1857 /* INSTALLPROPERTY_LASTUSEDTYPE */
1858 r
= pMsiSourceListSetInfoA(prodcode
, NULL
,
1859 MSIINSTALLCONTEXT_USERUNMANAGED
, MSICODE_PRODUCT
,
1860 INSTALLPROPERTY_LASTUSEDTYPE
, "type");
1861 ok(r
== ERROR_UNKNOWN_PROPERTY
,
1862 "Expected ERROR_UNKNOWN_PROPERTY, got %d\n", r
);
1864 /* definitely unknown property */
1865 r
= pMsiSourceListSetInfoA(prodcode
, NULL
,
1866 MSIINSTALLCONTEXT_USERUNMANAGED
, MSICODE_PRODUCT
,
1868 ok(r
== ERROR_UNKNOWN_PROPERTY
,
1869 "Expected ERROR_UNKNOWN_PROPERTY, got %d\n", r
);
1871 RegDeleteValueA(net
, "1");
1872 RegDeleteKeyA(net
, "");
1874 RegDeleteValueA(url
, "1");
1875 RegDeleteKeyA(url
, "");
1877 RegDeleteValueA(media
, "MediaPackage");
1878 RegDeleteValueA(media
, "DiskPrompt");
1879 RegDeleteKeyA(media
, "");
1881 RegDeleteValueA(source
, "PackageName");
1882 RegDeleteKeyA(source
, "");
1883 RegCloseKey(source
);
1884 RegDeleteKeyA(userkey
, "");
1885 RegCloseKey(userkey
);
1887 /* MSIINSTALLCONTEXT_USERMANAGED */
1889 lstrcpyA(keypath
, "Software\\Microsoft\\Windows\\CurrentVersion\\Installer\\Managed\\");
1890 lstrcatA(keypath
, usersid
);
1891 lstrcatA(keypath
, "\\Installer\\Products\\");
1892 lstrcatA(keypath
, prod_squashed
);
1894 res
= RegCreateKeyA(HKEY_LOCAL_MACHINE
, keypath
, &userkey
);
1895 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
1897 /* user product key exists */
1898 r
= pMsiSourceListSetInfoA(prodcode
, NULL
,
1899 MSIINSTALLCONTEXT_USERMANAGED
, MSICODE_PRODUCT
,
1900 INSTALLPROPERTY_MEDIAPACKAGEPATH
, "path");
1901 ok(r
== ERROR_BAD_CONFIGURATION
,
1902 "Expected ERROR_BAD_CONFIGURATION, got %d\n", r
);
1904 res
= RegCreateKeyA(userkey
, "SourceList", &source
);
1905 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
1907 /* SourceList key exists, no source type */
1908 r
= pMsiSourceListSetInfoA(prodcode
, NULL
,
1909 MSIINSTALLCONTEXT_USERMANAGED
, MSICODE_PRODUCT
,
1910 INSTALLPROPERTY_MEDIAPACKAGEPATH
, "path");
1911 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
1913 /* Media key is created by MsiSourceListSetInfo */
1914 res
= RegOpenKeyA(source
, "Media", &media
);
1915 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
1916 CHECK_REG_STR(media
, "MediaPackage", "path");
1918 RegDeleteValueA(media
, "MediaPackage");
1919 RegDeleteKeyA(media
, "");
1921 RegDeleteKeyA(source
, "");
1922 RegCloseKey(source
);
1923 RegDeleteKeyA(userkey
, "");
1924 RegCloseKey(userkey
);
1926 /* MSIINSTALLCONTEXT_MACHINE */
1928 lstrcpyA(keypath
, "Software\\Classes\\Installer\\Products\\");
1929 lstrcatA(keypath
, prod_squashed
);
1931 res
= RegCreateKeyA(HKEY_LOCAL_MACHINE
, keypath
, &prodkey
);
1932 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
1934 /* user product key exists */
1935 r
= pMsiSourceListSetInfoA(prodcode
, NULL
,
1936 MSIINSTALLCONTEXT_MACHINE
, MSICODE_PRODUCT
,
1937 INSTALLPROPERTY_MEDIAPACKAGEPATH
, "path");
1938 ok(r
== ERROR_BAD_CONFIGURATION
,
1939 "Expected ERROR_BAD_CONFIGURATION, got %d\n", r
);
1941 res
= RegCreateKeyA(prodkey
, "SourceList", &source
);
1942 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
1944 /* SourceList key exists, no source type */
1945 r
= pMsiSourceListSetInfoA(prodcode
, NULL
,
1946 MSIINSTALLCONTEXT_MACHINE
, MSICODE_PRODUCT
,
1947 INSTALLPROPERTY_MEDIAPACKAGEPATH
, "path");
1948 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
1950 /* Media key is created by MsiSourceListSetInfo */
1951 res
= RegOpenKeyA(source
, "Media", &media
);
1952 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
1953 CHECK_REG_STR(media
, "MediaPackage", "path");
1955 /* szUserSid is non-NULL */
1956 r
= pMsiSourceListSetInfoA(prodcode
, usersid
,
1957 MSIINSTALLCONTEXT_MACHINE
, MSICODE_PRODUCT
,
1958 INSTALLPROPERTY_MEDIAPACKAGEPATH
, "path");
1959 ok(r
== ERROR_INVALID_PARAMETER
,
1960 "Expected ERROR_INVALID_PARAMETER, got %d\n", r
);
1962 RegDeleteValueA(media
, "MediaPackage");
1963 RegDeleteKeyA(media
, "");
1965 RegDeleteKeyA(source
, "");
1966 RegCloseKey(source
);
1967 RegDeleteKeyA(prodkey
, "");
1968 RegCloseKey(prodkey
);
1971 static void test_MsiSourceListAddMediaDisk(void)
1973 CHAR prodcode
[MAX_PATH
];
1974 CHAR prod_squashed
[MAX_PATH
];
1975 CHAR keypath
[MAX_PATH
*2];
1976 HKEY prodkey
, userkey
;
1982 if (!pMsiSourceListAddMediaDiskA
)
1984 skip("MsiSourceListAddMediaDiskA is not available\n");
1988 create_test_guid(prodcode
, prod_squashed
);
1989 get_user_sid(&usersid
);
1991 /* GetLastError is not set by the function */
1993 /* NULL szProductCodeOrPatchCode */
1994 r
= pMsiSourceListAddMediaDiskA(NULL
, usersid
, MSIINSTALLCONTEXT_USERUNMANAGED
,
1995 MSICODE_PRODUCT
, 1, "label", "prompt");
1996 ok(r
== ERROR_INVALID_PARAMETER
,
1997 "Expected ERROR_INVALID_PARAMETER, got %d\n", r
);
1999 /* empty szProductCodeOrPatchCode */
2000 r
= pMsiSourceListAddMediaDiskA("", usersid
, MSIINSTALLCONTEXT_USERUNMANAGED
,
2001 MSICODE_PRODUCT
, 1, "label", "prompt");
2002 ok(r
== ERROR_INVALID_PARAMETER
,
2003 "Expected ERROR_INVALID_PARAMETER, got %d\n", r
);
2005 /* garbage szProductCodeOrPatchCode */
2006 r
= pMsiSourceListAddMediaDiskA("garbage", usersid
, MSIINSTALLCONTEXT_USERUNMANAGED
,
2007 MSICODE_PRODUCT
, 1, "label", "prompt");
2008 ok(r
== ERROR_INVALID_PARAMETER
,
2009 "Expected ERROR_INVALID_PARAMETER, got %d\n", r
);
2011 /* guid without brackets */
2012 r
= pMsiSourceListAddMediaDiskA("51CD2AD5-0482-4C46-8DDD-0ED1022AA1AA",
2013 usersid
, MSIINSTALLCONTEXT_USERUNMANAGED
,
2014 MSICODE_PRODUCT
, 1, "label", "prompt");
2015 ok(r
== ERROR_INVALID_PARAMETER
,
2016 "Expected ERROR_INVALID_PARAMETER, got %d\n", r
);
2018 /* guid with brackets */
2019 r
= pMsiSourceListAddMediaDiskA("{51CD2AD5-0482-4C46-8DDD-0ED1022AA1AA}",
2020 usersid
, MSIINSTALLCONTEXT_USERUNMANAGED
,
2021 MSICODE_PRODUCT
, 1, "label", "prompt");
2022 ok(r
== ERROR_UNKNOWN_PRODUCT
,
2023 "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r
);
2025 /* dwOptions has MSISOURCETYPE_NETWORK */
2026 r
= pMsiSourceListAddMediaDiskA("{51CD2AD5-0482-4C46-8DDD-0ED1022AA1AA}",
2027 usersid
, MSIINSTALLCONTEXT_USERUNMANAGED
,
2028 MSICODE_PRODUCT
| MSISOURCETYPE_NETWORK
,
2029 1, "label", "prompt");
2030 ok(r
== ERROR_INVALID_PARAMETER
,
2031 "Expected ERROR_INVALID_PARAMETER, got %d\n", r
);
2033 /* dwOptions has MSISOURCETYPE_URL */
2034 r
= pMsiSourceListAddMediaDiskA("{51CD2AD5-0482-4C46-8DDD-0ED1022AA1AA}",
2035 usersid
, MSIINSTALLCONTEXT_USERUNMANAGED
,
2036 MSICODE_PRODUCT
| MSISOURCETYPE_URL
,
2037 1, "label", "prompt");
2038 ok(r
== ERROR_INVALID_PARAMETER
,
2039 "Expected ERROR_INVALID_PARAMETER, got %d\n", r
);
2041 /* dwOptions has MSISOURCETYPE_MEDIA */
2042 r
= pMsiSourceListAddMediaDiskA("{51CD2AD5-0482-4C46-8DDD-0ED1022AA1AA}",
2043 usersid
, MSIINSTALLCONTEXT_USERUNMANAGED
,
2044 MSICODE_PRODUCT
| MSISOURCETYPE_MEDIA
,
2045 1, "label", "prompt");
2046 ok(r
== ERROR_INVALID_PARAMETER
,
2047 "Expected ERROR_INVALID_PARAMETER, got %d\n", r
);
2049 /* MSIINSTALLCONTEXT_USERUNMANAGED */
2051 lstrcpyA(keypath
, "Software\\Microsoft\\Installer\\Products\\");
2052 lstrcatA(keypath
, prod_squashed
);
2054 res
= RegCreateKeyA(HKEY_CURRENT_USER
, keypath
, &userkey
);
2055 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
2057 /* user product key exists */
2058 r
= pMsiSourceListAddMediaDiskA(prodcode
, usersid
,
2059 MSIINSTALLCONTEXT_USERUNMANAGED
,
2060 MSICODE_PRODUCT
, 1, "label", "prompt");
2061 ok(r
== ERROR_BAD_CONFIGURATION
,
2062 "Expected ERROR_BAD_CONFIGURATION, got %d\n", r
);
2064 res
= RegCreateKeyA(userkey
, "SourceList", &source
);
2065 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
2067 /* SourceList key exists */
2068 r
= pMsiSourceListAddMediaDiskA(prodcode
, usersid
,
2069 MSIINSTALLCONTEXT_USERUNMANAGED
,
2070 MSICODE_PRODUCT
, 1, "label", "prompt");
2071 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
2073 /* Media subkey is created by MsiSourceListAddMediaDisk */
2074 res
= RegOpenKeyA(source
, "Media", &media
);
2075 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
2077 CHECK_REG_STR(media
, "1", "label;prompt");
2079 /* dwDiskId is random */
2080 r
= pMsiSourceListAddMediaDiskA(prodcode
, usersid
,
2081 MSIINSTALLCONTEXT_USERUNMANAGED
,
2082 MSICODE_PRODUCT
, 42, "label42", "prompt42");
2083 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
2085 CHECK_REG_STR(media
, "1", "label;prompt");
2086 CHECK_REG_STR(media
, "42", "label42;prompt42");
2089 r
= pMsiSourceListAddMediaDiskA(prodcode
, usersid
,
2090 MSIINSTALLCONTEXT_USERUNMANAGED
,
2091 MSICODE_PRODUCT
, 0, "label0", "prompt0");
2092 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
2094 CHECK_REG_STR(media
, "0", "label0;prompt0");
2095 CHECK_REG_STR(media
, "1", "label;prompt");
2096 CHECK_REG_STR(media
, "42", "label42;prompt42");
2098 /* dwDiskId is < 0 */
2099 r
= pMsiSourceListAddMediaDiskA(prodcode
, usersid
,
2100 MSIINSTALLCONTEXT_USERUNMANAGED
,
2101 MSICODE_PRODUCT
, -1, "label-1", "prompt-1");
2102 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
2104 CHECK_REG_STR(media
, "-1", "label-1;prompt-1");
2105 CHECK_REG_STR(media
, "0", "label0;prompt0");
2106 CHECK_REG_STR(media
, "1", "label;prompt");
2107 CHECK_REG_STR(media
, "42", "label42;prompt42");
2109 /* update dwDiskId 1 */
2110 r
= pMsiSourceListAddMediaDiskA(prodcode
, usersid
,
2111 MSIINSTALLCONTEXT_USERUNMANAGED
,
2112 MSICODE_PRODUCT
, 1, "newlabel", "newprompt");
2113 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
2115 CHECK_REG_STR(media
, "-1", "label-1;prompt-1");
2116 CHECK_REG_STR(media
, "0", "label0;prompt0");
2117 CHECK_REG_STR(media
, "1", "newlabel;newprompt");
2118 CHECK_REG_STR(media
, "42", "label42;prompt42");
2120 /* update dwDiskId 1, szPrompt is NULL */
2121 r
= pMsiSourceListAddMediaDiskA(prodcode
, usersid
,
2122 MSIINSTALLCONTEXT_USERUNMANAGED
,
2123 MSICODE_PRODUCT
, 1, "etiqueta", NULL
);
2124 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
2126 CHECK_REG_STR(media
, "-1", "label-1;prompt-1");
2127 CHECK_REG_STR(media
, "0", "label0;prompt0");
2128 CHECK_REG_STR(media
, "1", "etiqueta;");
2129 CHECK_REG_STR(media
, "42", "label42;prompt42");
2131 /* update dwDiskId 1, szPrompt is empty */
2132 r
= pMsiSourceListAddMediaDiskA(prodcode
, usersid
,
2133 MSIINSTALLCONTEXT_USERUNMANAGED
,
2134 MSICODE_PRODUCT
, 1, "etikett", "");
2135 ok(r
== ERROR_INVALID_PARAMETER
,
2136 "Expected ERROR_INVALID_PARAMETER, got %d\n", r
);
2138 /* update dwDiskId 1, szVolumeLable is NULL */
2139 r
= pMsiSourceListAddMediaDiskA(prodcode
, usersid
,
2140 MSIINSTALLCONTEXT_USERUNMANAGED
,
2141 MSICODE_PRODUCT
, 1, NULL
, "provocar");
2142 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
2144 CHECK_REG_STR(media
, "-1", "label-1;prompt-1");
2145 CHECK_REG_STR(media
, "0", "label0;prompt0");
2146 CHECK_REG_STR(media
, "1", ";provocar");
2147 CHECK_REG_STR(media
, "42", "label42;prompt42");
2149 /* update dwDiskId 1, szVolumeLable is empty */
2150 r
= pMsiSourceListAddMediaDiskA(prodcode
, usersid
,
2151 MSIINSTALLCONTEXT_USERUNMANAGED
,
2152 MSICODE_PRODUCT
, 1, "", "provoquer");
2153 ok(r
== ERROR_INVALID_PARAMETER
,
2154 "Expected ERROR_INVALID_PARAMETER, got %d\n", r
);
2156 /* szUserSid is NULL */
2157 r
= pMsiSourceListAddMediaDiskA(prodcode
, NULL
,
2158 MSIINSTALLCONTEXT_USERUNMANAGED
,
2159 MSICODE_PRODUCT
, 1, NULL
, "provoquer");
2160 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
2162 CHECK_REG_STR(media
, "-1", "label-1;prompt-1");
2163 CHECK_REG_STR(media
, "0", "label0;prompt0");
2164 CHECK_REG_STR(media
, "1", ";provoquer");
2165 CHECK_REG_STR(media
, "42", "label42;prompt42");
2167 RegDeleteValueA(media
, "-1");
2168 RegDeleteValueA(media
, "0");
2169 RegDeleteValueA(media
, "1");
2170 RegDeleteValueA(media
, "42");
2171 RegDeleteKeyA(media
, "");
2173 RegDeleteKeyA(source
, "");
2174 RegCloseKey(source
);
2175 RegDeleteKeyA(userkey
, "");
2176 RegCloseKey(userkey
);
2178 /* MSIINSTALLCONTEXT_USERMANAGED */
2180 lstrcpyA(keypath
, "Software\\Microsoft\\Windows\\CurrentVersion\\Installer\\Managed\\");
2181 lstrcatA(keypath
, usersid
);
2182 lstrcatA(keypath
, "\\Installer\\Products\\");
2183 lstrcatA(keypath
, prod_squashed
);
2185 res
= RegCreateKeyA(HKEY_LOCAL_MACHINE
, keypath
, &userkey
);
2186 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
2188 /* user product key exists */
2189 r
= pMsiSourceListAddMediaDiskA(prodcode
, usersid
,
2190 MSIINSTALLCONTEXT_USERMANAGED
,
2191 MSICODE_PRODUCT
, 1, "label", "prompt");
2192 ok(r
== ERROR_BAD_CONFIGURATION
,
2193 "Expected ERROR_BAD_CONFIGURATION, got %d\n", r
);
2195 res
= RegCreateKeyA(userkey
, "SourceList", &source
);
2196 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
2198 /* SourceList key exists */
2199 r
= pMsiSourceListAddMediaDiskA(prodcode
, usersid
,
2200 MSIINSTALLCONTEXT_USERMANAGED
,
2201 MSICODE_PRODUCT
, 1, "label", "prompt");
2202 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
2204 /* Media subkey is created by MsiSourceListAddMediaDisk */
2205 res
= RegOpenKeyA(source
, "Media", &media
);
2206 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
2208 CHECK_REG_STR(media
, "1", "label;prompt");
2210 RegDeleteValueA(media
, "1");
2211 RegDeleteKeyA(media
, "");
2213 RegDeleteKeyA(source
, "");
2214 RegCloseKey(source
);
2215 RegDeleteKeyA(userkey
, "");
2216 RegCloseKey(userkey
);
2218 /* MSIINSTALLCONTEXT_MACHINE */
2220 lstrcpyA(keypath
, "Software\\Classes\\Installer\\Products\\");
2221 lstrcatA(keypath
, prod_squashed
);
2223 res
= RegCreateKeyA(HKEY_LOCAL_MACHINE
, keypath
, &prodkey
);
2224 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
2226 /* machine product key exists */
2227 r
= pMsiSourceListAddMediaDiskA(prodcode
, NULL
,
2228 MSIINSTALLCONTEXT_MACHINE
,
2229 MSICODE_PRODUCT
, 1, "label", "prompt");
2230 ok(r
== ERROR_BAD_CONFIGURATION
,
2231 "Expected ERROR_BAD_CONFIGURATION, got %d\n", r
);
2233 res
= RegCreateKeyA(prodkey
, "SourceList", &source
);
2234 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
2236 /* SourceList key exists */
2237 r
= pMsiSourceListAddMediaDiskA(prodcode
, NULL
,
2238 MSIINSTALLCONTEXT_MACHINE
,
2239 MSICODE_PRODUCT
, 1, "label", "prompt");
2240 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
2242 /* Media subkey is created by MsiSourceListAddMediaDisk */
2243 res
= RegOpenKeyA(source
, "Media", &media
);
2244 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
2246 CHECK_REG_STR(media
, "1", "label;prompt");
2248 /* szUserSid is non-NULL */
2249 r
= pMsiSourceListAddMediaDiskA(prodcode
, usersid
,
2250 MSIINSTALLCONTEXT_MACHINE
,
2251 MSICODE_PRODUCT
, 1, "label", "prompt");
2252 ok(r
== ERROR_INVALID_PARAMETER
,
2253 "Expected ERROR_INVALID_PARAMETER, got %d\n", r
);
2255 RegDeleteValueA(media
, "1");
2256 RegDeleteKeyA(media
, "");
2258 RegDeleteKeyA(source
, "");
2259 RegCloseKey(source
);
2260 RegDeleteKeyA(prodkey
, "");
2261 RegCloseKey(prodkey
);
2264 static void test_MsiSourceListEnumMediaDisks(void)
2266 CHAR prodcode
[MAX_PATH
];
2267 CHAR prod_squashed
[MAX_PATH
];
2268 CHAR keypath
[MAX_PATH
*2];
2269 CHAR label
[MAX_PATH
];
2270 CHAR prompt
[MAX_PATH
];
2271 HKEY prodkey
, userkey
;
2273 DWORD labelsz
, promptsz
;
2280 if (!pMsiSourceListEnumMediaDisksA
)
2282 skip("MsiSourceListEnumMediaDisksA is not available\n");
2286 create_test_guid(prodcode
, prod_squashed
);
2287 get_user_sid(&usersid
);
2289 /* GetLastError is not set by the function */
2291 /* NULL szProductCodeOrPatchCode */
2292 r
= pMsiSourceListEnumMediaDisksA(NULL
, usersid
, MSIINSTALLCONTEXT_USERUNMANAGED
,
2293 MSICODE_PRODUCT
, 0, &id
, label
, &labelsz
,
2295 ok(r
== ERROR_INVALID_PARAMETER
,
2296 "Expected ERROR_INVALID_PARAMETER, got %d\n", r
);
2298 /* empty szProductCodeOrPatchCode */
2299 r
= pMsiSourceListEnumMediaDisksA("", usersid
, MSIINSTALLCONTEXT_USERUNMANAGED
,
2300 MSICODE_PRODUCT
, 0, &id
, label
, &labelsz
,
2302 ok(r
== ERROR_INVALID_PARAMETER
,
2303 "Expected ERROR_INVALID_PARAMETER, got %d\n", r
);
2305 /* garbage szProductCodeOrPatchCode */
2306 r
= pMsiSourceListEnumMediaDisksA("garbage", usersid
, MSIINSTALLCONTEXT_USERUNMANAGED
,
2307 MSICODE_PRODUCT
, 0, &id
, label
, &labelsz
,
2309 ok(r
== ERROR_INVALID_PARAMETER
,
2310 "Expected ERROR_INVALID_PARAMETER, got %d\n", r
);
2312 /* guid without brackets */
2313 r
= pMsiSourceListEnumMediaDisksA("51CD2AD5-0482-4C46-8DDD-0ED1022AA1AA",
2314 usersid
, MSIINSTALLCONTEXT_USERUNMANAGED
,
2315 MSICODE_PRODUCT
, 0, &id
, label
, &labelsz
,
2317 ok(r
== ERROR_INVALID_PARAMETER
,
2318 "Expected ERROR_INVALID_PARAMETER, got %d\n", r
);
2320 /* guid with brackets */
2321 r
= pMsiSourceListEnumMediaDisksA("{51CD2AD5-0482-4C46-8DDD-0ED1022AA1AA}",
2322 usersid
, MSIINSTALLCONTEXT_USERUNMANAGED
,
2323 MSICODE_PRODUCT
, 0, &id
, label
, &labelsz
,
2325 ok(r
== ERROR_UNKNOWN_PRODUCT
,
2326 "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r
);
2328 /* dwOptions has MSISOURCETYPE_NETWORK */
2329 r
= pMsiSourceListEnumMediaDisksA(prodcode
, usersid
, MSIINSTALLCONTEXT_USERUNMANAGED
,
2330 MSICODE_PRODUCT
| MSISOURCETYPE_NETWORK
,
2331 0, &id
, label
, &labelsz
,
2333 ok(r
== ERROR_INVALID_PARAMETER
,
2334 "Expected ERROR_INVALID_PARAMETER, got %d\n", r
);
2336 /* dwOptions has MSISOURCETYPE_URL */
2337 r
= pMsiSourceListEnumMediaDisksA(prodcode
, usersid
, MSIINSTALLCONTEXT_USERUNMANAGED
,
2338 MSICODE_PRODUCT
| MSISOURCETYPE_URL
,
2339 0, &id
, label
, &labelsz
,
2341 ok(r
== ERROR_INVALID_PARAMETER
,
2342 "Expected ERROR_INVALID_PARAMETER, got %d\n", r
);
2344 /* dwIndex is non-zero */
2345 r
= pMsiSourceListEnumMediaDisksA(prodcode
, usersid
, MSIINSTALLCONTEXT_USERUNMANAGED
,
2346 MSICODE_PRODUCT
, 1, &id
, label
, &labelsz
,
2348 ok(r
== ERROR_INVALID_PARAMETER
,
2349 "Expected ERROR_INVALID_PARAMETER, got %d\n", r
);
2351 /* MSIINSTALLCONTEXT_USERUNMANAGED */
2353 lstrcpyA(keypath
, "Software\\Microsoft\\Installer\\Products\\");
2354 lstrcatA(keypath
, prod_squashed
);
2356 res
= RegCreateKeyA(HKEY_CURRENT_USER
, keypath
, &userkey
);
2357 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
2359 /* user product key exists */
2360 r
= pMsiSourceListEnumMediaDisksA(prodcode
, usersid
, MSIINSTALLCONTEXT_USERUNMANAGED
,
2361 MSICODE_PRODUCT
, 0, &id
, label
, &labelsz
,
2363 ok(r
== ERROR_BAD_CONFIGURATION
,
2364 "Expected ERROR_BAD_CONFIGURATION, got %d\n", r
);
2366 res
= RegCreateKeyA(userkey
, "SourceList", &source
);
2367 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
2369 /* SourceList key exists */
2371 lstrcpyA(label
, "aaa");
2372 labelsz
= 0xdeadbeef;
2373 lstrcpyA(prompt
, "bbb");
2374 promptsz
= 0xdeadbeef;
2375 r
= pMsiSourceListEnumMediaDisksA(prodcode
, usersid
, MSIINSTALLCONTEXT_USERUNMANAGED
,
2376 MSICODE_PRODUCT
, 0, &id
, label
, &labelsz
,
2378 ok(r
== ERROR_NO_MORE_ITEMS
,
2379 "Expected ERROR_NO_MORE_ITEMS, got %d\n", r
);
2380 ok(id
== 0xbeef, "Expected 0xbeef, got %d\n", id
);
2381 ok(!lstrcmpA(label
, "aaa"), "Expected \"aaa\", got \"%s\"\n", label
);
2382 ok(labelsz
== 0xdeadbeef, "Expected 0xdeadbeef, got %d\n", labelsz
);
2383 ok(!lstrcmpA(prompt
, "bbb"), "Expected \"bbb\", got \"%s\"\n", prompt
);
2384 ok(promptsz
== 0xdeadbeef, "Expected 0xdeadbeef, got %d\n", promptsz
);
2386 res
= RegCreateKeyA(source
, "Media", &media
);
2387 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
2389 /* Media key exists */
2391 lstrcpyA(label
, "aaa");
2392 labelsz
= 0xdeadbeef;
2393 lstrcpyA(prompt
, "bbb");
2394 promptsz
= 0xdeadbeef;
2395 r
= pMsiSourceListEnumMediaDisksA(prodcode
, usersid
, MSIINSTALLCONTEXT_USERUNMANAGED
,
2396 MSICODE_PRODUCT
, 0, &id
, label
, &labelsz
,
2398 ok(r
== ERROR_NO_MORE_ITEMS
,
2399 "Expected ERROR_NO_MORE_ITEMS, got %d\n", r
);
2400 ok(id
== 0xbeef, "Expected 0xbeef, got %d\n", id
);
2401 ok(!lstrcmpA(label
, "aaa"), "Expected \"aaa\", got \"%s\"\n", label
);
2402 ok(labelsz
== 0xdeadbeef, "Expected 0xdeadbeef, got %d\n", labelsz
);
2403 ok(!lstrcmpA(prompt
, "bbb"), "Expected \"bbb\", got \"%s\"\n", prompt
);
2404 ok(promptsz
== 0xdeadbeef, "Expected 0xdeadbeef, got %d\n", promptsz
);
2406 res
= RegSetValueExA(media
, "1", 0, REG_SZ
, (LPBYTE
)"label;prompt", 13);
2407 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
2411 lstrcpyA(label
, "aaa");
2413 lstrcpyA(prompt
, "bbb");
2414 promptsz
= MAX_PATH
;
2415 r
= pMsiSourceListEnumMediaDisksA(prodcode
, usersid
, MSIINSTALLCONTEXT_USERUNMANAGED
,
2416 MSICODE_PRODUCT
, 0, &id
, label
, &labelsz
,
2418 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
2419 ok(id
== 1, "Expected 1, got %d\n", id
);
2420 ok(!lstrcmpA(label
, "label"), "Expected \"label\", got \"%s\"\n", label
);
2421 ok(labelsz
== 5, "Expected 5, got %d\n", labelsz
);
2422 ok(!lstrcmpA(prompt
, "prompt"), "Expected \"prompt\", got \"%s\"\n", prompt
);
2423 ok(promptsz
== 6, "Expected 6, got %d\n", promptsz
);
2425 res
= RegSetValueExA(media
, "2", 0, REG_SZ
, (LPBYTE
)"one;two", 8);
2426 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
2428 /* now disk 2 exists, get the sizes */
2431 promptsz
= MAX_PATH
;
2432 r
= pMsiSourceListEnumMediaDisksA(prodcode
, usersid
, MSIINSTALLCONTEXT_USERUNMANAGED
,
2433 MSICODE_PRODUCT
, 1, &id
, NULL
, &labelsz
,
2435 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
2436 ok(id
== 2, "Expected 2, got %d\n", id
);
2437 ok(labelsz
== 3, "Expected 3, got %d\n", labelsz
);
2438 ok(promptsz
== 3, "Expected 3, got %d\n", promptsz
);
2440 /* now fill in the values */
2442 lstrcpyA(label
, "aaa");
2444 lstrcpyA(prompt
, "bbb");
2445 promptsz
= MAX_PATH
;
2446 r
= pMsiSourceListEnumMediaDisksA(prodcode
, usersid
, MSIINSTALLCONTEXT_USERUNMANAGED
,
2447 MSICODE_PRODUCT
, 1, &id
, label
, &labelsz
,
2449 ok(r
== ERROR_INVALID_PARAMETER
,
2450 "Expected ERROR_INVALID_PARAMETER, got %d\n", r
);
2451 ok(id
== 0xbeef, "Expected 0xbeef, got %d\n", id
);
2452 ok(!lstrcmpA(label
, "aaa"), "Expected \"aaa\", got \"%s\"\n", label
);
2453 ok(labelsz
== MAX_PATH
, "Expected MAX_PATH, got %d\n", labelsz
);
2454 ok(!lstrcmpA(prompt
, "bbb"), "Expected \"bbb\", got \"%s\"\n", prompt
);
2455 ok(promptsz
== MAX_PATH
, "Expected MAX_PATH, got %d\n", promptsz
);
2457 res
= RegSetValueExA(media
, "4", 0, REG_SZ
, (LPBYTE
)"three;four", 11);
2458 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
2460 /* disks 1, 2, 4 exist, reset the enumeration */
2462 lstrcpyA(label
, "aaa");
2464 lstrcpyA(prompt
, "bbb");
2465 promptsz
= MAX_PATH
;
2466 r
= pMsiSourceListEnumMediaDisksA(prodcode
, usersid
, MSIINSTALLCONTEXT_USERUNMANAGED
,
2467 MSICODE_PRODUCT
, 0, &id
, label
, &labelsz
,
2469 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
2470 ok(id
== 1, "Expected 1, got %d\n", id
);
2471 ok(!lstrcmpA(label
, "label"), "Expected \"label\", got \"%s\"\n", label
);
2472 ok(labelsz
== 5, "Expected 5, got %d\n", labelsz
);
2473 ok(!lstrcmpA(prompt
, "prompt"), "Expected \"prompt\", got \"%s\"\n", prompt
);
2474 ok(promptsz
== 6, "Expected 6, got %d\n", promptsz
);
2476 /* disks 1, 2, 4 exist, index 1 */
2478 lstrcpyA(label
, "aaa");
2480 lstrcpyA(prompt
, "bbb");
2481 promptsz
= MAX_PATH
;
2482 r
= pMsiSourceListEnumMediaDisksA(prodcode
, usersid
, MSIINSTALLCONTEXT_USERUNMANAGED
,
2483 MSICODE_PRODUCT
, 1, &id
, label
, &labelsz
,
2485 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
2486 ok(id
== 2, "Expected 2, got %d\n", id
);
2487 ok(!lstrcmpA(label
, "one"), "Expected \"one\", got \"%s\"\n", label
);
2488 ok(labelsz
== 3, "Expected 3, got %d\n", labelsz
);
2489 ok(!lstrcmpA(prompt
, "two"), "Expected \"two\", got \"%s\"\n", prompt
);
2490 ok(promptsz
== 3, "Expected 3, got %d\n", promptsz
);
2492 /* disks 1, 2, 4 exist, index 2 */
2494 lstrcpyA(label
, "aaa");
2496 lstrcpyA(prompt
, "bbb");
2497 promptsz
= MAX_PATH
;
2498 r
= pMsiSourceListEnumMediaDisksA(prodcode
, usersid
, MSIINSTALLCONTEXT_USERUNMANAGED
,
2499 MSICODE_PRODUCT
, 2, &id
, label
, &labelsz
,
2501 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
2502 ok(id
== 4, "Expected 4, got %d\n", id
);
2503 ok(!lstrcmpA(label
, "three"), "Expected \"three\", got \"%s\"\n", label
);
2504 ok(labelsz
== 5, "Expected 5, got %d\n", labelsz
);
2505 ok(!lstrcmpA(prompt
, "four"), "Expected \"four\", got \"%s\"\n", prompt
);
2506 ok(promptsz
== 4, "Expected 4, got %d\n", promptsz
);
2508 /* disks 1, 2, 4 exist, index 3, invalid */
2510 lstrcpyA(label
, "aaa");
2512 lstrcpyA(prompt
, "bbb");
2513 promptsz
= MAX_PATH
;
2514 r
= pMsiSourceListEnumMediaDisksA(prodcode
, usersid
, MSIINSTALLCONTEXT_USERUNMANAGED
,
2515 MSICODE_PRODUCT
, 3, &id
, label
, &labelsz
,
2517 ok(r
== ERROR_NO_MORE_ITEMS
,
2518 "Expected ERROR_NO_MORE_ITEMS, got %d\n", r
);
2519 ok(id
== 0xbeef, "Expected 0xbeef, got %d\n", id
);
2520 ok(!lstrcmpA(label
, "aaa"), "Expected \"aaa\", got \"%s\"\n", label
);
2521 ok(labelsz
== MAX_PATH
, "Expected MAX_PATH, got %d\n", labelsz
);
2522 ok(!lstrcmpA(prompt
, "bbb"), "Expected \"bbb\", got \"%s\"\n", prompt
);
2523 ok(promptsz
== MAX_PATH
, "Expected MAX_PATH, got %d\n", promptsz
);
2525 /* disks 1, 2, 4 exist, reset the enumeration */
2527 lstrcpyA(label
, "aaa");
2529 lstrcpyA(prompt
, "bbb");
2530 promptsz
= MAX_PATH
;
2531 r
= pMsiSourceListEnumMediaDisksA(prodcode
, usersid
, MSIINSTALLCONTEXT_USERUNMANAGED
,
2532 MSICODE_PRODUCT
, 0, &id
, label
, &labelsz
,
2534 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
2535 ok(id
== 1, "Expected 1, got %d\n", id
);
2536 ok(!lstrcmpA(label
, "label"), "Expected \"label\", got \"%s\"\n", label
);
2537 ok(labelsz
== 5, "Expected 5, got %d\n", labelsz
);
2538 ok(!lstrcmpA(prompt
, "prompt"), "Expected \"prompt\", got \"%s\"\n", prompt
);
2539 ok(promptsz
== 6, "Expected 6, got %d\n", promptsz
);
2541 /* try index 0 again */
2543 lstrcpyA(label
, "aaa");
2545 lstrcpyA(prompt
, "bbb");
2546 promptsz
= MAX_PATH
;
2547 r
= pMsiSourceListEnumMediaDisksA(prodcode
, usersid
, MSIINSTALLCONTEXT_USERUNMANAGED
,
2548 MSICODE_PRODUCT
, 0, &id
, label
, &labelsz
,
2550 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
2551 ok(id
== 1, "Expected 1, got %d\n", id
);
2552 ok(!lstrcmpA(label
, "label"), "Expected \"label\", got \"%s\"\n", label
);
2553 ok(labelsz
== 5, "Expected 5, got %d\n", labelsz
);
2554 ok(!lstrcmpA(prompt
, "prompt"), "Expected \"prompt\", got \"%s\"\n", prompt
);
2555 ok(promptsz
== 6, "Expected 6, got %d\n", promptsz
);
2557 /* jump to index 2 */
2559 lstrcpyA(label
, "aaa");
2561 lstrcpyA(prompt
, "bbb");
2562 promptsz
= MAX_PATH
;
2563 r
= pMsiSourceListEnumMediaDisksA(prodcode
, usersid
, MSIINSTALLCONTEXT_USERUNMANAGED
,
2564 MSICODE_PRODUCT
, 2, &id
, label
, &labelsz
,
2566 ok(r
== ERROR_INVALID_PARAMETER
, "Expected ERROR_INVALID_PARAMETER, got %d\n", r
);
2567 ok(id
== 0xbeef, "Expected 0xbeef, got %d\n", id
);
2568 ok(!lstrcmpA(label
, "aaa"), "Expected \"aaa\", got \"%s\"\n", label
);
2569 ok(labelsz
== MAX_PATH
, "Expected MAX_PATH, got %d\n", labelsz
);
2570 ok(!lstrcmpA(prompt
, "bbb"), "Expected \"bbb\", got \"%s\"\n", prompt
);
2571 ok(promptsz
== MAX_PATH
, "Expected MAX_PATH, got %d\n", promptsz
);
2573 /* after error, try index 1 */
2575 lstrcpyA(label
, "aaa");
2577 lstrcpyA(prompt
, "bbb");
2578 promptsz
= MAX_PATH
;
2579 r
= pMsiSourceListEnumMediaDisksA(prodcode
, usersid
, MSIINSTALLCONTEXT_USERUNMANAGED
,
2580 MSICODE_PRODUCT
, 1, &id
, label
, &labelsz
,
2582 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
2583 ok(id
== 2, "Expected 2, got %d\n", id
);
2584 ok(!lstrcmpA(label
, "one"), "Expected \"one\", got \"%s\"\n", label
);
2585 ok(labelsz
== 3, "Expected 3, got %d\n", labelsz
);
2586 ok(!lstrcmpA(prompt
, "two"), "Expected \"two\", got \"%s\"\n", prompt
);
2587 ok(promptsz
== 3, "Expected 3, got %d\n", promptsz
);
2589 /* try index 1 again */
2591 lstrcpyA(label
, "aaa");
2593 lstrcpyA(prompt
, "bbb");
2594 promptsz
= MAX_PATH
;
2595 r
= pMsiSourceListEnumMediaDisksA(prodcode
, usersid
, MSIINSTALLCONTEXT_USERUNMANAGED
,
2596 MSICODE_PRODUCT
, 1, &id
, label
, &labelsz
,
2598 ok(r
== ERROR_INVALID_PARAMETER
, "Expected ERROR_INVALID_PARAMETER, got %d\n", r
);
2599 ok(id
== 0xbeef, "Expected 0xbeef, got %d\n", id
);
2600 ok(!lstrcmpA(label
, "aaa"), "Expected \"aaa\", got \"%s\"\n", label
);
2601 ok(labelsz
== MAX_PATH
, "Expected MAX_PATH, got %d\n", labelsz
);
2602 ok(!lstrcmpA(prompt
, "bbb"), "Expected \"bbb\", got \"%s\"\n", prompt
);
2603 ok(promptsz
== MAX_PATH
, "Expected MAX_PATH, got %d\n", promptsz
);
2605 /* NULL pdwDiskId */
2606 lstrcpyA(label
, "aaa");
2608 lstrcpyA(prompt
, "bbb");
2609 promptsz
= MAX_PATH
;
2610 r
= pMsiSourceListEnumMediaDisksA(prodcode
, usersid
, MSIINSTALLCONTEXT_USERUNMANAGED
,
2611 MSICODE_PRODUCT
, 0, NULL
, label
, &labelsz
,
2613 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
2614 ok(!lstrcmpA(label
, "label"), "Expected \"label\", got \"%s\"\n", label
);
2615 ok(labelsz
== 5, "Expected 5, got %d\n", labelsz
);
2616 ok(!lstrcmpA(prompt
, "prompt"), "Expected \"prompt\", got \"%s\"\n", prompt
);
2617 ok(promptsz
== 6, "Expected 6, got %d\n", promptsz
);
2619 /* szVolumeLabel is NULL */
2622 lstrcpyA(prompt
, "bbb");
2623 promptsz
= MAX_PATH
;
2624 r
= pMsiSourceListEnumMediaDisksA(prodcode
, usersid
, MSIINSTALLCONTEXT_USERUNMANAGED
,
2625 MSICODE_PRODUCT
, 0, &id
, NULL
, &labelsz
,
2627 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
2628 ok(id
== 1, "Expected 1, got %d\n", id
);
2629 ok(labelsz
== 5, "Expected 5, got %d\n", labelsz
);
2630 ok(!lstrcmpA(prompt
, "prompt"), "Expected \"prompt\", got \"%s\"\n", prompt
);
2631 ok(promptsz
== 6, "Expected 6, got %d\n", promptsz
);
2633 /* szVolumeLabel and pcchVolumeLabel are NULL */
2635 lstrcpyA(prompt
, "bbb");
2636 promptsz
= MAX_PATH
;
2637 r
= pMsiSourceListEnumMediaDisksA(prodcode
, usersid
, MSIINSTALLCONTEXT_USERUNMANAGED
,
2638 MSICODE_PRODUCT
, 0, &id
, NULL
, NULL
,
2640 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
2641 ok(id
== 1, "Expected 1, got %d\n", id
);
2642 ok(!lstrcmpA(prompt
, "prompt"), "Expected \"prompt\", got \"%s\"\n", prompt
);
2643 ok(promptsz
== 6, "Expected 6, got %d\n", promptsz
);
2645 /* szVolumeLabel is non-NULL while pcchVolumeLabel is NULL */
2647 lstrcpyA(label
, "aaa");
2648 lstrcpyA(prompt
, "bbb");
2649 promptsz
= MAX_PATH
;
2650 r
= pMsiSourceListEnumMediaDisksA(prodcode
, usersid
, MSIINSTALLCONTEXT_USERUNMANAGED
,
2651 MSICODE_PRODUCT
, 0, &id
, label
, NULL
,
2653 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
2654 ok(id
== 1, "Expected 1, got %d\n", id
);
2655 ok(!lstrcmpA(label
, "aaa"), "Expected \"aaa\", got \"%s\"\n", label
);
2656 ok(!lstrcmpA(prompt
, "prompt"), "Expected \"prompt\", got \"%s\"\n", prompt
);
2657 ok(promptsz
== 6, "Expected 6, got %d\n", promptsz
);
2659 /* szDiskPrompt is NULL */
2661 lstrcpyA(label
, "aaa");
2663 promptsz
= MAX_PATH
;
2664 r
= pMsiSourceListEnumMediaDisksA(prodcode
, usersid
, MSIINSTALLCONTEXT_USERUNMANAGED
,
2665 MSICODE_PRODUCT
, 0, &id
, label
, &labelsz
,
2667 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
2668 ok(id
== 1, "Expected 1, got %d\n", id
);
2669 ok(!lstrcmpA(label
, "label"), "Expected \"label\", got \"%s\"\n", label
);
2670 ok(labelsz
== 5, "Expected 5, got %d\n", labelsz
);
2671 ok(promptsz
== 6, "Expected 6, got %d\n", promptsz
);
2673 /* szDiskPrompt and pcchDiskPrompt are NULL */
2675 lstrcpyA(label
, "aaa");
2677 r
= pMsiSourceListEnumMediaDisksA(prodcode
, usersid
, MSIINSTALLCONTEXT_USERUNMANAGED
,
2678 MSICODE_PRODUCT
, 0, &id
, label
, &labelsz
,
2680 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
2681 ok(id
== 1, "Expected 1, got %d\n", id
);
2682 ok(!lstrcmpA(label
, "label"), "Expected \"label\", got \"%s\"\n", label
);
2683 ok(labelsz
== 5, "Expected 5, got %d\n", labelsz
);
2685 /* szDiskPrompt is non-NULL while pcchDiskPrompt is NULL */
2687 lstrcpyA(label
, "aaa");
2689 lstrcpyA(prompt
, "bbb");
2690 r
= pMsiSourceListEnumMediaDisksA(prodcode
, usersid
, MSIINSTALLCONTEXT_USERUNMANAGED
,
2691 MSICODE_PRODUCT
, 0, &id
, label
, &labelsz
,
2693 ok(r
== ERROR_INVALID_PARAMETER
,
2694 "Expected ERROR_INVALID_PARAMETER, got %d\n", r
);
2695 ok(id
== 0xbeef, "Expected 0xbeef, got %d\n", id
);
2696 ok(!lstrcmpA(label
, "aaa"), "Expected \"aaa\", got \"%s\"\n", label
);
2697 ok(labelsz
== MAX_PATH
, "Expected MAX_PATH, got %d\n", labelsz
);
2698 ok(!lstrcmpA(prompt
, "bbb"), "Expected \"bbb\", got \"%s\"\n", prompt
);
2700 /* pcchVolumeLabel is exactly 5 */
2701 lstrcpyA(label
, "aaa");
2703 lstrcpyA(prompt
, "bbb");
2704 promptsz
= MAX_PATH
;
2705 r
= pMsiSourceListEnumMediaDisksA(prodcode
, usersid
, MSIINSTALLCONTEXT_USERUNMANAGED
,
2706 MSICODE_PRODUCT
, 0, NULL
, label
, &labelsz
,
2708 ok(r
== ERROR_MORE_DATA
, "Expected ERROR_MORE_DATA, got %d\n", r
);
2709 ok(!lstrcmpA(label
, "aaa"), "Expected \"aaa\", got \"%s\"\n", label
);
2710 ok(labelsz
== 5, "Expected 5, got %d\n", labelsz
);
2711 ok(!lstrcmpA(prompt
, "bbb"), "Expected \"bbb\", got \"%s\"\n", prompt
);
2712 ok(promptsz
== 6, "Expected 6, got %d\n", promptsz
);
2714 /* pcchDiskPrompt is exactly 6 */
2715 lstrcpyA(label
, "aaa");
2717 lstrcpyA(prompt
, "bbb");
2719 r
= pMsiSourceListEnumMediaDisksA(prodcode
, usersid
, MSIINSTALLCONTEXT_USERUNMANAGED
,
2720 MSICODE_PRODUCT
, 0, NULL
, label
, &labelsz
,
2722 ok(r
== ERROR_MORE_DATA
, "Expected ERROR_MORE_DATA, got %d\n", r
);
2723 ok(!lstrcmpA(label
, "aaa"), "Expected \"aaa\", got \"%s\"\n", label
);
2724 ok(labelsz
== 5, "Expected 5, got %d\n", labelsz
);
2725 ok(!lstrcmpA(prompt
, "bbb"), "Expected \"bbb\", got \"%s\"\n", prompt
);
2726 ok(promptsz
== 6, "Expected 6, got %d\n", promptsz
);
2728 res
= RegSetValueExA(media
, "1", 0, REG_SZ
, (LPBYTE
)"label", 13);
2729 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
2733 lstrcpyA(label
, "aaa");
2735 lstrcpyA(prompt
, "bbb");
2736 promptsz
= MAX_PATH
;
2737 r
= pMsiSourceListEnumMediaDisksA(prodcode
, usersid
, MSIINSTALLCONTEXT_USERUNMANAGED
,
2738 MSICODE_PRODUCT
, 0, &id
, label
, &labelsz
,
2740 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
2741 ok(id
== 1, "Expected 1, got %d\n", id
);
2742 ok(!lstrcmpA(label
, "label"), "Expected \"label\", got \"%s\"\n", label
);
2743 ok(labelsz
== 5, "Expected 5, got %d\n", labelsz
);
2744 ok(!lstrcmpA(prompt
, "label"), "Expected \"label\", got \"%s\"\n", prompt
);
2745 ok(promptsz
== 5, "Expected 5, got %d\n", promptsz
);
2747 res
= RegSetValueExA(media
, "1", 0, REG_SZ
, (LPBYTE
)"label;", 13);
2748 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
2750 /* semicolon, no disk prompt */
2752 lstrcpyA(label
, "aaa");
2754 lstrcpyA(prompt
, "bbb");
2755 promptsz
= MAX_PATH
;
2756 r
= pMsiSourceListEnumMediaDisksA(prodcode
, usersid
, MSIINSTALLCONTEXT_USERUNMANAGED
,
2757 MSICODE_PRODUCT
, 0, &id
, label
, &labelsz
,
2759 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
2760 ok(id
== 1, "Expected 1, got %d\n", id
);
2761 ok(!lstrcmpA(label
, "label"), "Expected \"label\", got \"%s\"\n", label
);
2762 ok(labelsz
== 5, "Expected 5, got %d\n", labelsz
);
2763 ok(!lstrcmpA(prompt
, ""), "Expected \"\", got \"%s\"\n", prompt
);
2764 ok(promptsz
== 0, "Expected 0, got %d\n", promptsz
);
2766 res
= RegSetValueExA(media
, "1", 0, REG_SZ
, (LPBYTE
)";prompt", 13);
2767 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
2769 /* semicolon, label doesn't exist */
2771 lstrcpyA(label
, "aaa");
2773 lstrcpyA(prompt
, "bbb");
2774 promptsz
= MAX_PATH
;
2775 r
= pMsiSourceListEnumMediaDisksA(prodcode
, usersid
, MSIINSTALLCONTEXT_USERUNMANAGED
,
2776 MSICODE_PRODUCT
, 0, &id
, label
, &labelsz
,
2778 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
2779 ok(id
== 1, "Expected 1, got %d\n", id
);
2780 ok(!lstrcmpA(label
, ""), "Expected \"\", got \"%s\"\n", label
);
2781 ok(labelsz
== 0, "Expected 0, got %d\n", labelsz
);
2782 ok(!lstrcmpA(prompt
, "prompt"), "Expected \"prompt\", got \"%s\"\n", prompt
);
2783 ok(promptsz
== 6, "Expected 6, got %d\n", promptsz
);
2785 res
= RegSetValueExA(media
, "1", 0, REG_SZ
, (LPBYTE
)";", 13);
2786 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
2788 /* semicolon, neither label nor disk prompt exist */
2790 lstrcpyA(label
, "aaa");
2792 lstrcpyA(prompt
, "bbb");
2793 promptsz
= MAX_PATH
;
2794 r
= pMsiSourceListEnumMediaDisksA(prodcode
, usersid
, MSIINSTALLCONTEXT_USERUNMANAGED
,
2795 MSICODE_PRODUCT
, 0, &id
, label
, &labelsz
,
2797 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
2798 ok(id
== 1, "Expected 1, got %d\n", id
);
2799 ok(!lstrcmpA(label
, ""), "Expected \"\", got \"%s\"\n", label
);
2800 ok(labelsz
== 0, "Expected 0, got %d\n", labelsz
);
2801 ok(!lstrcmpA(prompt
, ""), "Expected \"\", got \"%s\"\n", prompt
);
2802 ok(promptsz
== 0, "Expected 0, got %d\n", promptsz
);
2805 res
= RegSetValueExA(media
, "1", 0, REG_DWORD
, (LPBYTE
)&val
, sizeof(DWORD
));
2806 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
2808 /* type is REG_DWORD */
2810 lstrcpyA(label
, "aaa");
2812 lstrcpyA(prompt
, "bbb");
2813 promptsz
= MAX_PATH
;
2814 r
= pMsiSourceListEnumMediaDisksA(prodcode
, usersid
, MSIINSTALLCONTEXT_USERUNMANAGED
,
2815 MSICODE_PRODUCT
, 0, &id
, label
, &labelsz
,
2817 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
2818 ok(id
== 1, "Expected 1, got %d\n", id
);
2821 ok(!lstrcmpA(label
, "#42"), "Expected \"#42\", got \"%s\"\n", label
);
2822 ok(labelsz
== 3, "Expected 3, got %d\n", labelsz
);
2823 ok(!lstrcmpA(prompt
, "#42"), "Expected \"#42\", got \"%s\"\n", prompt
);
2824 ok(promptsz
== 3, "Expected 3, got %d\n", promptsz
);
2827 RegDeleteValueA(media
, "1");
2828 RegDeleteValueA(media
, "2");
2829 RegDeleteValueA(media
, "4");
2830 RegDeleteKeyA(media
, "");
2832 RegDeleteKeyA(source
, "");
2833 RegCloseKey(source
);
2834 RegDeleteKeyA(userkey
, "");
2835 RegCloseKey(userkey
);
2837 /* MSIINSTALLCONTEXT_USERMANAGED */
2839 lstrcpyA(keypath
, "Software\\Microsoft\\Windows\\CurrentVersion\\Installer\\Managed\\");
2840 lstrcatA(keypath
, usersid
);
2841 lstrcatA(keypath
, "\\Installer\\Products\\");
2842 lstrcatA(keypath
, prod_squashed
);
2844 res
= RegCreateKeyA(HKEY_LOCAL_MACHINE
, keypath
, &userkey
);
2845 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
2847 /* user product key exists */
2848 r
= pMsiSourceListEnumMediaDisksA(prodcode
, usersid
, MSIINSTALLCONTEXT_USERMANAGED
,
2849 MSICODE_PRODUCT
, 0, &id
, label
, &labelsz
,
2851 ok(r
== ERROR_BAD_CONFIGURATION
,
2852 "Expected ERROR_BAD_CONFIGURATION, got %d\n", r
);
2854 res
= RegCreateKeyA(userkey
, "SourceList", &source
);
2855 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
2857 /* SourceList key exists */
2859 lstrcpyA(label
, "aaa");
2860 labelsz
= 0xdeadbeef;
2861 lstrcpyA(prompt
, "bbb");
2862 promptsz
= 0xdeadbeef;
2863 r
= pMsiSourceListEnumMediaDisksA(prodcode
, usersid
, MSIINSTALLCONTEXT_USERMANAGED
,
2864 MSICODE_PRODUCT
, 0, &id
, label
, &labelsz
,
2866 ok(r
== ERROR_NO_MORE_ITEMS
,
2867 "Expected ERROR_NO_MORE_ITEMS, got %d\n", r
);
2868 ok(id
== 0xbeef, "Expected 0xbeef, got %d\n", id
);
2869 ok(!lstrcmpA(label
, "aaa"), "Expected \"aaa\", got \"%s\"\n", label
);
2870 ok(labelsz
== 0xdeadbeef, "Expected 0xdeadbeef, got %d\n", labelsz
);
2871 ok(!lstrcmpA(prompt
, "bbb"), "Expected \"bbb\", got \"%s\"\n", prompt
);
2872 ok(promptsz
== 0xdeadbeef, "Expected 0xdeadbeef, got %d\n", promptsz
);
2874 res
= RegCreateKeyA(source
, "Media", &media
);
2875 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
2877 /* Media key exists */
2879 lstrcpyA(label
, "aaa");
2880 labelsz
= 0xdeadbeef;
2881 lstrcpyA(prompt
, "bbb");
2882 promptsz
= 0xdeadbeef;
2883 r
= pMsiSourceListEnumMediaDisksA(prodcode
, usersid
, MSIINSTALLCONTEXT_USERMANAGED
,
2884 MSICODE_PRODUCT
, 0, &id
, label
, &labelsz
,
2886 ok(r
== ERROR_NO_MORE_ITEMS
,
2887 "Expected ERROR_NO_MORE_ITEMS, got %d\n", r
);
2888 ok(id
== 0xbeef, "Expected 0xbeef, got %d\n", id
);
2889 ok(!lstrcmpA(label
, "aaa"), "Expected \"aaa\", got \"%s\"\n", label
);
2890 ok(labelsz
== 0xdeadbeef, "Expected 0xdeadbeef, got %d\n", labelsz
);
2891 ok(!lstrcmpA(prompt
, "bbb"), "Expected \"bbb\", got \"%s\"\n", prompt
);
2892 ok(promptsz
== 0xdeadbeef, "Expected 0xdeadbeef, got %d\n", promptsz
);
2894 res
= RegSetValueExA(media
, "2", 0, REG_SZ
, (LPBYTE
)"label;prompt", 13);
2895 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
2897 /* disk exists, but no id 1 */
2899 lstrcpyA(label
, "aaa");
2901 lstrcpyA(prompt
, "bbb");
2902 promptsz
= MAX_PATH
;
2903 r
= pMsiSourceListEnumMediaDisksA(prodcode
, usersid
, MSIINSTALLCONTEXT_USERMANAGED
,
2904 MSICODE_PRODUCT
, 0, &id
, label
, &labelsz
,
2906 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
2907 ok(id
== 2, "Expected 2, got %d\n", id
);
2908 ok(!lstrcmpA(label
, "label"), "Expected \"label\", got \"%s\"\n", label
);
2909 ok(labelsz
== 5, "Expected 5, got %d\n", labelsz
);
2910 ok(!lstrcmpA(prompt
, "prompt"), "Expected \"prompt\", got \"%s\"\n", prompt
);
2911 ok(promptsz
== 6, "Expected 6, got %d\n", promptsz
);
2913 RegDeleteValueA(media
, "2");
2914 RegDeleteKeyA(media
, "");
2916 RegDeleteKeyA(source
, "");
2917 RegCloseKey(source
);
2918 RegDeleteKeyA(userkey
, "");
2919 RegCloseKey(userkey
);
2921 /* MSIINSTALLCONTEXT_MACHINE */
2923 lstrcpyA(keypath
, "Software\\Classes\\Installer\\Products\\");
2924 lstrcatA(keypath
, prod_squashed
);
2926 res
= RegCreateKeyA(HKEY_LOCAL_MACHINE
, keypath
, &prodkey
);
2927 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
2929 /* machine product key exists */
2930 r
= pMsiSourceListEnumMediaDisksA(prodcode
, NULL
, MSIINSTALLCONTEXT_MACHINE
,
2931 MSICODE_PRODUCT
, 0, &id
, label
, &labelsz
,
2933 ok(r
== ERROR_BAD_CONFIGURATION
,
2934 "Expected ERROR_BAD_CONFIGURATION, got %d\n", r
);
2936 res
= RegCreateKeyA(prodkey
, "SourceList", &source
);
2937 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
2939 /* SourceList key exists */
2941 lstrcpyA(label
, "aaa");
2942 labelsz
= 0xdeadbeef;
2943 lstrcpyA(prompt
, "bbb");
2944 promptsz
= 0xdeadbeef;
2945 r
= pMsiSourceListEnumMediaDisksA(prodcode
, NULL
, MSIINSTALLCONTEXT_MACHINE
,
2946 MSICODE_PRODUCT
, 0, &id
, label
, &labelsz
,
2948 ok(r
== ERROR_NO_MORE_ITEMS
,
2949 "Expected ERROR_NO_MORE_ITEMS, got %d\n", r
);
2950 ok(id
== 0xbeef, "Expected 0xbeef, got %d\n", id
);
2951 ok(!lstrcmpA(label
, "aaa"), "Expected \"aaa\", got \"%s\"\n", label
);
2952 ok(labelsz
== 0xdeadbeef, "Expected 0xdeadbeef, got %d\n", labelsz
);
2953 ok(!lstrcmpA(prompt
, "bbb"), "Expected \"bbb\", got \"%s\"\n", prompt
);
2954 ok(promptsz
== 0xdeadbeef, "Expected 0xdeadbeef, got %d\n", promptsz
);
2956 res
= RegCreateKeyA(source
, "Media", &media
);
2957 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
2959 /* Media key exists */
2961 lstrcpyA(label
, "aaa");
2962 labelsz
= 0xdeadbeef;
2963 lstrcpyA(prompt
, "bbb");
2964 promptsz
= 0xdeadbeef;
2965 r
= pMsiSourceListEnumMediaDisksA(prodcode
, NULL
, MSIINSTALLCONTEXT_MACHINE
,
2966 MSICODE_PRODUCT
, 0, &id
, label
, &labelsz
,
2968 ok(r
== ERROR_NO_MORE_ITEMS
,
2969 "Expected ERROR_NO_MORE_ITEMS, got %d\n", r
);
2970 ok(id
== 0xbeef, "Expected 0xbeef, got %d\n", id
);
2971 ok(!lstrcmpA(label
, "aaa"), "Expected \"aaa\", got \"%s\"\n", label
);
2972 ok(labelsz
== 0xdeadbeef, "Expected 0xdeadbeef, got %d\n", labelsz
);
2973 ok(!lstrcmpA(prompt
, "bbb"), "Expected \"bbb\", got \"%s\"\n", prompt
);
2974 ok(promptsz
== 0xdeadbeef, "Expected 0xdeadbeef, got %d\n", promptsz
);
2976 res
= RegSetValueExA(media
, "2", 0, REG_SZ
, (LPBYTE
)"label;prompt", 13);
2977 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
2979 /* disk exists, but no id 1 */
2981 lstrcpyA(label
, "aaa");
2983 lstrcpyA(prompt
, "bbb");
2984 promptsz
= MAX_PATH
;
2985 r
= pMsiSourceListEnumMediaDisksA(prodcode
, NULL
, MSIINSTALLCONTEXT_MACHINE
,
2986 MSICODE_PRODUCT
, 0, &id
, label
, &labelsz
,
2988 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
2989 ok(id
== 2, "Expected 2, got %d\n", id
);
2990 ok(!lstrcmpA(label
, "label"), "Expected \"label\", got \"%s\"\n", label
);
2991 ok(labelsz
== 5, "Expected 5, got %d\n", labelsz
);
2992 ok(!lstrcmpA(prompt
, "prompt"), "Expected \"prompt\", got \"%s\"\n", prompt
);
2993 ok(promptsz
== 6, "Expected 6, got %d\n", promptsz
);
2995 /* szUserSid is non-NULL */
2997 lstrcpyA(label
, "aaa");
2999 lstrcpyA(prompt
, "bbb");
3000 promptsz
= MAX_PATH
;
3001 r
= pMsiSourceListEnumMediaDisksA(prodcode
, usersid
, MSIINSTALLCONTEXT_MACHINE
,
3002 MSICODE_PRODUCT
, 0, &id
, label
, &labelsz
,
3004 ok(r
== ERROR_INVALID_PARAMETER
,
3005 "Expected ERROR_INVALID_PARAMETER, got %d\n", r
);
3006 ok(id
== 0xbeef, "Expected 0xbeef, got %d\n", id
);
3007 ok(!lstrcmpA(label
, "aaa"), "Expected \"aaa\", got \"%s\"\n", label
);
3008 ok(labelsz
== MAX_PATH
, "Expected MAX_PATH, got %d\n", labelsz
);
3009 ok(!lstrcmpA(prompt
, "bbb"), "Expected \"bbb\", got \"%s\"\n", prompt
);
3010 ok(promptsz
== MAX_PATH
, "Expected MAX_PATH, got %d\n", promptsz
);
3012 RegDeleteValueA(media
, "2");
3013 RegDeleteKeyA(media
, "");
3015 RegDeleteKeyA(source
, "");
3016 RegCloseKey(source
);
3017 RegDeleteKeyA(prodkey
, "");
3018 RegCloseKey(prodkey
);
3021 static void test_MsiSourceListAddSource(void)
3023 CHAR prodcode
[MAX_PATH
];
3024 CHAR prod_squashed
[MAX_PATH
];
3025 CHAR keypath
[MAX_PATH
*2];
3026 CHAR username
[MAX_PATH
];
3030 HKEY prodkey
, userkey
;
3034 if (!pMsiSourceListAddSourceA
)
3036 skip("Skipping MsiSourceListAddSourceA tests\n");
3040 create_test_guid(prodcode
, prod_squashed
);
3041 get_user_sid(&usersid
);
3043 /* MACHINENAME\username */
3045 GetComputerNameA(username
, &size
);
3046 lstrcatA(username
, "\\");
3047 ptr
= username
+ lstrlenA(username
);
3049 GetUserNameA(ptr
, &size
);
3051 /* GetLastError is not set by the function */
3053 /* NULL szProduct */
3054 r
= pMsiSourceListAddSourceA(NULL
, username
, 0, "source");
3055 ok(r
== ERROR_INVALID_PARAMETER
, "Expected ERROR_INVALID_PARAMETER, got %d\n", r
);
3057 /* empty szProduct */
3058 r
= pMsiSourceListAddSourceA("", username
, 0, "source");
3059 ok(r
== ERROR_INVALID_PARAMETER
, "Expected ERROR_INVALID_PARAMETER, got %d\n", r
);
3061 /* garbage szProduct */
3062 r
= pMsiSourceListAddSourceA("garbage", username
, 0, "source");
3063 ok(r
== ERROR_INVALID_PARAMETER
, "Expected ERROR_INVALID_PARAMETER, got %d\n", r
);
3065 /* guid without brackets */
3066 r
= pMsiSourceListAddSourceA("51CD2AD5-0482-4C46-8DDD-0ED1022AA1AA", username
, 0, "source");
3067 ok(r
== ERROR_INVALID_PARAMETER
, "Expected ERROR_INVALID_PARAMETER, got %d\n", r
);
3069 /* guid with brackets */
3070 r
= pMsiSourceListAddSourceA("{51CD2AD5-0482-4C46-8DDD-0ED1022AA1AA}", username
, 0, "source");
3071 ok(r
== ERROR_UNKNOWN_PRODUCT
, "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r
);
3073 /* dwReserved is not 0 */
3074 r
= pMsiSourceListAddSourceA(prodcode
, username
, 42, "source");
3075 ok(r
== ERROR_INVALID_PARAMETER
, "Expected ERROR_INVALID_PARAMETER, got %d\n", r
);
3077 /* szSource is NULL */
3078 r
= pMsiSourceListAddSourceA(prodcode
, username
, 0, NULL
);
3079 ok(r
== ERROR_INVALID_PARAMETER
, "Expected ERROR_INVALID_PARAMETER, got %d\n", r
);
3081 /* szSource is empty */
3082 r
= pMsiSourceListAddSourceA(prodcode
, username
, 0, "");
3083 ok(r
== ERROR_INVALID_PARAMETER
, "Expected ERROR_INVALID_PARAMETER, got %d\n", r
);
3085 /* MSIINSTALLCONTEXT_USERMANAGED */
3087 r
= pMsiSourceListAddSourceA(prodcode
, username
, 0, "source");
3088 ok(r
== ERROR_UNKNOWN_PRODUCT
, "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r
);
3090 lstrcpyA(keypath
, "Software\\Microsoft\\Windows\\CurrentVersion\\Installer\\Managed\\");
3091 lstrcatA(keypath
, usersid
);
3092 lstrcatA(keypath
, "\\Installer\\Products\\");
3093 lstrcatA(keypath
, prod_squashed
);
3095 res
= RegCreateKeyA(HKEY_LOCAL_MACHINE
, keypath
, &userkey
);
3096 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
3098 /* user product key exists */
3099 r
= pMsiSourceListAddSourceA(prodcode
, username
, 0, "source");
3100 ok(r
== ERROR_BAD_CONFIGURATION
, "Expected ERROR_BAD_CONFIGURATION, got %d\n", r
);
3102 res
= RegCreateKeyA(userkey
, "SourceList", &source
);
3103 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
3105 /* SourceList key exists */
3106 r
= pMsiSourceListAddSourceA(prodcode
, username
, 0, "source");
3107 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3109 /* Net key is created */
3110 res
= RegOpenKeyA(source
, "Net", &net
);
3111 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
3113 /* LastUsedSource does not exist and it is not created */
3114 res
= RegQueryValueExA(source
, "LastUsedSource", 0, NULL
, NULL
, NULL
);
3115 ok(res
== ERROR_FILE_NOT_FOUND
, "Expected ERROR_FILE_NOT_FOUND, got %d\n", res
);
3117 CHECK_REG_STR(net
, "1", "source\\");
3119 RegDeleteValueA(net
, "1");
3120 RegDeleteKeyA(net
, "");
3123 res
= RegSetValueExA(source
, "LastUsedSource", 0, REG_SZ
, (LPBYTE
)"blah", 5);
3124 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
3126 /* LastUsedSource value exists */
3127 r
= pMsiSourceListAddSourceA(prodcode
, username
, 0, "source");
3128 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3130 /* Net key is created */
3131 res
= RegOpenKeyA(source
, "Net", &net
);
3132 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
3134 CHECK_REG_STR(source
, "LastUsedSource", "blah");
3135 CHECK_REG_STR(net
, "1", "source\\");
3137 RegDeleteValueA(net
, "1");
3138 RegDeleteKeyA(net
, "");
3141 res
= RegSetValueExA(source
, "LastUsedSource", 0, REG_SZ
, (LPBYTE
)"5", 2);
3142 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
3144 /* LastUsedSource is an integer */
3145 r
= pMsiSourceListAddSourceA(prodcode
, username
, 0, "source");
3146 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3148 /* Net key is created */
3149 res
= RegOpenKeyA(source
, "Net", &net
);
3150 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
3152 CHECK_REG_STR(source
, "LastUsedSource", "5");
3153 CHECK_REG_STR(net
, "1", "source\\");
3155 /* Add a second source, has trailing backslash */
3156 r
= pMsiSourceListAddSourceA(prodcode
, username
, 0, "another\\");
3157 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3159 CHECK_REG_STR(source
, "LastUsedSource", "5");
3160 CHECK_REG_STR(net
, "1", "source\\");
3161 CHECK_REG_STR(net
, "2", "another\\");
3163 res
= RegSetValueExA(source
, "LastUsedSource", 0, REG_SZ
, (LPBYTE
)"2", 2);
3164 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
3166 /* LastUsedSource is in the source list */
3167 r
= pMsiSourceListAddSourceA(prodcode
, username
, 0, "third/");
3168 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3170 CHECK_REG_STR(source
, "LastUsedSource", "2");
3171 CHECK_REG_STR(net
, "1", "source\\");
3172 CHECK_REG_STR(net
, "2", "another\\");
3173 CHECK_REG_STR(net
, "3", "third/\\");
3175 RegDeleteValueA(net
, "1");
3176 RegDeleteValueA(net
, "2");
3177 RegDeleteValueA(net
, "3");
3178 RegDeleteKeyA(net
, "");
3180 RegDeleteKeyA(source
, "");
3181 RegCloseKey(source
);
3182 RegDeleteKeyA(userkey
, "");
3183 RegCloseKey(userkey
);
3185 /* MSIINSTALLCONTEXT_USERUNMANAGED */
3187 r
= pMsiSourceListAddSourceA(prodcode
, username
, 0, "source");
3188 ok(r
== ERROR_UNKNOWN_PRODUCT
, "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r
);
3190 lstrcpyA(keypath
, "Software\\Microsoft\\Installer\\Products\\");
3191 lstrcatA(keypath
, prod_squashed
);
3193 res
= RegCreateKeyA(HKEY_CURRENT_USER
, keypath
, &userkey
);
3194 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
3196 /* user product key exists */
3197 r
= pMsiSourceListAddSourceA(prodcode
, username
, 0, "source");
3198 ok(r
== ERROR_BAD_CONFIGURATION
, "Expected ERROR_BAD_CONFIGURATION, got %d\n", r
);
3200 res
= RegCreateKeyA(userkey
, "SourceList", &source
);
3201 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
3203 /* SourceList key exists */
3204 r
= pMsiSourceListAddSourceA(prodcode
, username
, 0, "source");
3205 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3207 /* Net key is created */
3208 res
= RegOpenKeyA(source
, "Net", &net
);
3209 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
3211 CHECK_REG_STR(net
, "1", "source\\");
3213 RegDeleteValueA(net
, "1");
3214 RegDeleteKeyA(net
, "");
3216 RegDeleteKeyA(source
, "");
3217 RegCloseKey(source
);
3218 RegDeleteKeyA(userkey
, "");
3219 RegCloseKey(userkey
);
3221 /* MSIINSTALLCONTEXT_MACHINE */
3223 r
= pMsiSourceListAddSourceA(prodcode
, NULL
, 0, "source");
3224 ok(r
== ERROR_UNKNOWN_PRODUCT
, "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r
);
3226 lstrcpyA(keypath
, "Software\\Classes\\Installer\\Products\\");
3227 lstrcatA(keypath
, prod_squashed
);
3229 res
= RegCreateKeyA(HKEY_LOCAL_MACHINE
, keypath
, &prodkey
);
3230 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
3232 /* machine product key exists */
3233 r
= pMsiSourceListAddSourceA(prodcode
, NULL
, 0, "source");
3234 ok(r
== ERROR_BAD_CONFIGURATION
, "Expected ERROR_BAD_CONFIGURATION, got %d\n", r
);
3236 res
= RegCreateKeyA(prodkey
, "SourceList", &source
);
3237 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
3239 /* SourceList key exists */
3240 r
= pMsiSourceListAddSourceA(prodcode
, NULL
, 0, "source");
3241 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3243 /* Net key is created */
3244 res
= RegOpenKeyA(source
, "Net", &net
);
3245 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
3247 CHECK_REG_STR(net
, "1", "source\\");
3249 /* empty szUserName */
3250 r
= pMsiSourceListAddSourceA(prodcode
, "", 0, "another");
3251 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3253 CHECK_REG_STR(net
, "1", "source\\");
3254 CHECK_REG_STR(net
, "2", "another\\");
3256 RegDeleteValueA(net
, "2");
3257 RegDeleteValueA(net
, "1");
3258 RegDeleteKeyA(net
, "");
3260 RegDeleteKeyA(source
, "");
3261 RegCloseKey(source
);
3262 RegDeleteKeyA(prodkey
, "");
3263 RegCloseKey(prodkey
);
3268 init_functionpointers();
3270 test_MsiSourceListGetInfo();
3271 test_MsiSourceListAddSourceEx();
3272 test_MsiSourceListEnumSources();
3273 test_MsiSourceListSetInfo();
3274 test_MsiSourceListAddMediaDisk();
3275 test_MsiSourceListEnumMediaDisks();
3276 test_MsiSourceListAddSource();