2 * Implementation of the Microsoft Installer (msi.dll)
4 * Copyright 2005 Mike McCormack for CodeWeavers
5 * Copyright 2005 Aric Stewart for CodeWeavers
7 * This library is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Lesser General Public
9 * License as published by the Free Software Foundation; either
10 * version 2.1 of the License, or (at your option) any later version.
12 * This library is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * Lesser General Public License for more details.
17 * You should have received a copy of the GNU Lesser General Public
18 * License along with this library; if not, write to the Free Software
19 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
25 #define NONAMELESSUNION
32 #include "wine/debug.h"
36 #include "wine/unicode.h"
41 WINE_DEFAULT_DEBUG_CHANNEL(msi);
45 * This module will be all the helper functions for registry access by the
48 static const WCHAR szUserFeatures_fmt[] = {
49 'S','o','f','t','w','a','r','e','\\',
50 'M','i','c','r','o','s','o','f','t','\\',
51 'I','n','s','t','a','l','l','e','r','\\',
52 'F','e','a','t','u','r','e','s','\\',
55 static const WCHAR szUserDataFeatures_fmt[] = {
56 'S','o','f','t','w','a','r','e','\\',
57 'M','i','c','r','o','s','o','f','t','\\',
58 'W','i','n','d','o','w','s','\\',
59 'C','u','r','r','e','n','t','V','e','r','s','i','o','n','\\',
60 'I','n','s','t','a','l','l','e','r','\\',
61 'U','s','e','r','D','a','t','a','\\',
62 '%','s','\\','P','r','o','d','u','c','t','s','\\',
63 '%','s','\\','F','e','a','t','u','r','e','s',0};
65 static const WCHAR szInstaller_Features_fmt[] = {
66 'S','o','f','t','w','a','r','e','\\',
67 'M','i','c','r','o','s','o','f','t','\\',
68 'W','i','n','d','o','w','s','\\',
69 'C','u','r','r','e','n','t','V','e','r','s','i','o','n','\\',
70 'I','n','s','t','a','l','l','e','r','\\',
71 'F','e','a','t','u','r','e','s','\\',
74 static const WCHAR szInstaller_Components[] = {
75 'S','o','f','t','w','a','r','e','\\',
76 'M','i','c','r','o','s','o','f','t','\\',
77 'W','i','n','d','o','w','s','\\',
78 'C','u','r','r','e','n','t','V','e','r','s','i','o','n','\\',
79 'I','n','s','t','a','l','l','e','r','\\',
80 'C','o','m','p','o','n','e','n','t','s',0 };
82 static const WCHAR szUser_Components_fmt[] = {
83 'S','o','f','t','w','a','r','e','\\',
84 'M','i','c','r','o','s','o','f','t','\\',
85 'I','n','s','t','a','l','l','e','r','\\',
86 'C','o','m','p','o','n','e','n','t','s','\\',
89 static const WCHAR szUserDataComp_fmt[] = {
90 'S','o','f','t','w','a','r','e','\\',
91 'M','i','c','r','o','s','o','f','t','\\',
92 'W','i','n','d','o','w','s','\\',
93 'C','u','r','r','e','n','t','V','e','r','s','i','o','n','\\',
94 'I','n','s','t','a','l','l','e','r','\\',
95 'U','s','e','r','D','a','t','a','\\',
96 '%','s','\\','C','o','m','p','o','n','e','n','t','s','\\','%','s',0};
98 static const WCHAR szUninstall_fmt[] = {
99 'S','o','f','t','w','a','r','e','\\',
100 'M','i','c','r','o','s','o','f','t','\\',
101 'W','i','n','d','o','w','s','\\',
102 'C','u','r','r','e','n','t','V','e','r','s','i','o','n','\\',
103 'U','n','i','n','s','t','a','l','l','\\',
106 static const WCHAR szUserProduct[] = {
107 'S','o','f','t','w','a','r','e','\\',
108 'M','i','c','r','o','s','o','f','t','\\',
109 'I','n','s','t','a','l','l','e','r','\\',
110 'P','r','o','d','u','c','t','s',0};
112 static const WCHAR szUserProduct_fmt[] = {
113 'S','o','f','t','w','a','r','e','\\',
114 'M','i','c','r','o','s','o','f','t','\\',
115 'I','n','s','t','a','l','l','e','r','\\',
116 'P','r','o','d','u','c','t','s','\\',
119 static const WCHAR szUserPatch_fmt[] = {
120 'S','o','f','t','w','a','r','e','\\',
121 'M','i','c','r','o','s','o','f','t','\\',
122 'I','n','s','t','a','l','l','e','r','\\',
123 'P','a','t','c','h','e','s','\\',
126 static const WCHAR szInstaller_Products[] = {
127 'S','o','f','t','w','a','r','e','\\',
128 'M','i','c','r','o','s','o','f','t','\\',
129 'W','i','n','d','o','w','s','\\',
130 'C','u','r','r','e','n','t','V','e','r','s','i','o','n','\\',
131 'I','n','s','t','a','l','l','e','r','\\',
132 'P','r','o','d','u','c','t','s',0};
134 static const WCHAR szInstaller_Products_fmt[] = {
135 'S','o','f','t','w','a','r','e','\\',
136 'M','i','c','r','o','s','o','f','t','\\',
137 'W','i','n','d','o','w','s','\\',
138 'C','u','r','r','e','n','t','V','e','r','s','i','o','n','\\',
139 'I','n','s','t','a','l','l','e','r','\\',
140 'P','r','o','d','u','c','t','s','\\',
143 static const WCHAR szInstaller_Patches_fmt[] = {
144 'S','o','f','t','w','a','r','e','\\',
145 'M','i','c','r','o','s','o','f','t','\\',
146 'W','i','n','d','o','w','s','\\',
147 'C','u','r','r','e','n','t','V','e','r','s','i','o','n','\\',
148 'I','n','s','t','a','l','l','e','r','\\',
149 'P','a','t','c','h','e','s','\\',
152 static const WCHAR szInstaller_UpgradeCodes_fmt[] = {
153 'S','o','f','t','w','a','r','e','\\',
154 'M','i','c','r','o','s','o','f','t','\\',
155 'W','i','n','d','o','w','s','\\',
156 'C','u','r','r','e','n','t','V','e','r','s','i','o','n','\\',
157 'I','n','s','t','a','l','l','e','r','\\',
158 'U','p','g','r','a','d','e','C','o','d','e','s','\\',
161 static const WCHAR szInstaller_UserUpgradeCodes_fmt[] = {
162 'S','o','f','t','w','a','r','e','\\',
163 'M','i','c','r','o','s','o','f','t','\\',
164 'I','n','s','t','a','l','l','e','r','\\',
165 'U','p','g','r','a','d','e','C','o','d','e','s','\\',
168 static const WCHAR szUserDataProd_fmt[] = {
169 'S','o','f','t','w','a','r','e','\\',
170 'M','i','c','r','o','s','o','f','t','\\',
171 'W','i','n','d','o','w','s','\\',
172 'C','u','r','r','e','n','t','V','e','r','s','i','o','n','\\',
173 'I','n','s','t','a','l','l','e','r','\\',
174 'U','s','e','r','D','a','t','a','\\',
175 '%','s','\\','P','r','o','d','u','c','t','s','\\','%','s',0};
177 static const WCHAR szUserDataPatch_fmt[] = {
178 'S','o','f','t','w','a','r','e','\\',
179 'M','i','c','r','o','s','o','f','t','\\',
180 'W','i','n','d','o','w','s','\\',
181 'C','u','r','r','e','n','t','V','e','r','s','i','o','n','\\',
182 'I','n','s','t','a','l','l','e','r','\\',
183 'U','s','e','r','D','a','t','a','\\',
184 '%','s','\\','P','a','t','c','h','e','s','\\','%','s',0};
186 static const WCHAR szInstallProperties_fmt[] = {
187 'S','o','f','t','w','a','r','e','\\',
188 'M','i','c','r','o','s','o','f','t','\\',
189 'W','i','n','d','o','w','s','\\',
190 'C','u','r','r','e','n','t','V','e','r','s','i','o','n','\\',
191 'I','n','s','t','a','l','l','e','r','\\',
192 'U','s','e','r','D','a','t','a','\\',
193 '%','s','\\','P','r','o','d','u','c','t','s','\\','%','s','\\',
194 'I','n','s','t','a','l','l','P','r','o','p','e','r','t','i','e','s',0};
196 static const WCHAR szInstaller_LocalClassesProd[] = {
197 'S','o','f','t','w','a','r','e','\\',
198 'C','l','a','s','s','e','s','\\',
199 'I','n','s','t','a','l','l','e','r','\\',
200 'P','r','o','d','u','c','t','s',0};
202 static const WCHAR szInstaller_LocalClassesProd_fmt[] = {
203 'S','o','f','t','w','a','r','e','\\',
204 'C','l','a','s','s','e','s','\\',
205 'I','n','s','t','a','l','l','e','r','\\',
206 'P','r','o','d','u','c','t','s','\\','%','s',0};
208 static const WCHAR szInstaller_LocalClassesFeat_fmt[] = {
209 'S','o','f','t','w','a','r','e','\\',
210 'C','l','a','s','s','e','s','\\',
211 'I','n','s','t','a','l','l','e','r','\\',
212 'F','e','a','t','u','r','e','s','\\','%','s',0};
214 static const WCHAR szInstaller_LocalManaged_fmt[] = {
215 'S','o','f','t','w','a','r','e','\\',
216 'M','i','c','r','o','s','o','f','t','\\',
217 'W','i','n','d','o','w','s','\\',
218 'C','u','r','r','e','n','t','V','e','r','s','i','o','n','\\',
219 'I','n','s','t','a','l','l','e','r','\\',
220 'M','a','n','a','g','e','d','\\','%','s','\\',
221 'I','n','s','t','a','l','l','e','r','\\',
222 'P','r','o','d','u','c','t','s',0};
224 static const WCHAR szInstaller_LocalManagedProd_fmt[] = {
225 'S','o','f','t','w','a','r','e','\\',
226 'M','i','c','r','o','s','o','f','t','\\',
227 'W','i','n','d','o','w','s','\\',
228 'C','u','r','r','e','n','t','V','e','r','s','i','o','n','\\',
229 'I','n','s','t','a','l','l','e','r','\\',
230 'M','a','n','a','g','e','d','\\','%','s','\\',
231 'I','n','s','t','a','l','l','e','r','\\',
232 'P','r','o','d','u','c','t','s','\\','%','s',0};
234 static const WCHAR szInstaller_LocalManagedFeat_fmt[] = {
235 'S','o','f','t','w','a','r','e','\\',
236 'M','i','c','r','o','s','o','f','t','\\',
237 'W','i','n','d','o','w','s','\\',
238 'C','u','r','r','e','n','t','V','e','r','s','i','o','n','\\',
239 'I','n','s','t','a','l','l','e','r','\\',
240 'M','a','n','a','g','e','d','\\','%','s','\\',
241 'I','n','s','t','a','l','l','e','r','\\',
242 'F','e','a','t','u','r','e','s','\\','%','s',0};
244 static const WCHAR szInstaller_ClassesUpgrade_fmt[] = {
245 'I','n','s','t','a','l','l','e','r','\\',
246 'U','p','g','r','a','d','e','C','o','d','e','s','\\',
249 BOOL unsquash_guid(LPCWSTR in, LPWSTR out)
253 if (lstrlenW(in) != 32)
268 out[n++] = in[17+i*2];
269 out[n++] = in[16+i*2];
274 out[n++] = in[17+i*2];
275 out[n++] = in[16+i*2];
282 BOOL squash_guid(LPCWSTR in, LPWSTR out)
289 if (FAILED(CLSIDFromString((LPOLESTR)in, &guid)))
303 out[17+i*2] = in[n++];
304 out[16+i*2] = in[n++];
309 out[17+i*2] = in[n++];
310 out[16+i*2] = in[n++];
317 /* tables for encoding and decoding base85 */
318 static const unsigned char table_dec85[0x80] = {
319 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
320 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
321 0xff,0x00,0xff,0xff,0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08,0x09,0x0a,0x0b,0xff,
322 0x0c,0x0d,0x0e,0x0f,0x10,0x11,0x12,0x13,0x14,0x15,0xff,0xff,0xff,0x16,0xff,0x17,
323 0x18,0x19,0x1a,0x1b,0x1c,0x1d,0x1e,0x1f,0x20,0x21,0x22,0x23,0x24,0x25,0x26,0x27,
324 0x28,0x29,0x2a,0x2b,0x2c,0x2d,0x2e,0x2f,0x30,0x31,0x32,0x33,0xff,0x34,0x35,0x36,
325 0x37,0x38,0x39,0x3a,0x3b,0x3c,0x3d,0x3e,0x3f,0x40,0x41,0x42,0x43,0x44,0x45,0x46,
326 0x47,0x48,0x49,0x4a,0x4b,0x4c,0x4d,0x4e,0x4f,0x50,0x51,0x52,0xff,0x53,0x54,0xff,
329 static const char table_enc85[] =
330 "!$%&'()*+,-.0123456789=?@ABCDEFGHIJKLMNO"
331 "PQRSTUVWXYZ[]^_`abcdefghijklmnopqrstuvwx"
335 * Converts a base85 encoded guid into a GUID pointer
336 * Base85 encoded GUIDs should be 20 characters long.
338 * returns TRUE if successful, FALSE if not
340 BOOL decode_base85_guid( LPCWSTR str, GUID *guid )
342 DWORD i, val = 0, base = 1, *p;
348 for( i=0; i<20; i++ )
355 val += table_dec85[str[i]] * base;
358 if( table_dec85[str[i]] == 0xff )
368 * Encodes a base85 guid given a GUID pointer
369 * Caller should provide a 21 character buffer for the encoded string.
371 * returns TRUE if successful, FALSE if not
373 BOOL encode_base85_guid( GUID *guid, LPWSTR str )
375 unsigned int x, *p, i;
377 p = (unsigned int*) guid;
381 *str++ = table_enc85[x%85];
383 *str++ = table_enc85[x%85];
385 *str++ = table_enc85[x%85];
387 *str++ = table_enc85[x%85];
389 *str++ = table_enc85[x%85];
396 DWORD msi_version_str_to_dword(LPCWSTR p)
398 DWORD major, minor = 0, build = 0, version = 0;
409 p = strchrW(p+1, '.');
414 return MAKELONG(build, MAKEWORD(minor, major));
417 LONG msi_reg_set_val_str( HKEY hkey, LPCWSTR name, LPCWSTR value )
419 static const WCHAR emptyW[] = {0};
421 if (!value) value = emptyW;
422 len = (lstrlenW(value) + 1) * sizeof (WCHAR);
423 return RegSetValueExW( hkey, name, 0, REG_SZ, (const BYTE *)value, len );
426 LONG msi_reg_set_val_multi_str( HKEY hkey, LPCWSTR name, LPCWSTR value )
429 while (*p) p += lstrlenW(p) + 1;
430 return RegSetValueExW( hkey, name, 0, REG_MULTI_SZ,
431 (const BYTE *)value, (p + 1 - value) * sizeof(WCHAR) );
434 LONG msi_reg_set_val_dword( HKEY hkey, LPCWSTR name, DWORD val )
436 return RegSetValueExW( hkey, name, 0, REG_DWORD, (LPBYTE)&val, sizeof (DWORD) );
439 LONG msi_reg_set_subkey_val( HKEY hkey, LPCWSTR path, LPCWSTR name, LPCWSTR val )
444 r = RegCreateKeyW( hkey, path, &hsubkey );
445 if (r != ERROR_SUCCESS)
447 r = msi_reg_set_val_str( hsubkey, name, val );
448 RegCloseKey( hsubkey );
452 LPWSTR msi_reg_get_val_str( HKEY hkey, LPCWSTR name )
458 r = RegQueryValueExW(hkey, name, NULL, NULL, NULL, &len);
459 if (r != ERROR_SUCCESS)
462 len += sizeof (WCHAR);
463 val = msi_alloc( len );
467 RegQueryValueExW(hkey, name, NULL, NULL, (LPBYTE) val, &len);
471 BOOL msi_reg_get_val_dword( HKEY hkey, LPCWSTR name, DWORD *val)
473 DWORD type, len = sizeof (DWORD);
474 LONG r = RegQueryValueExW(hkey, name, NULL, &type, (LPBYTE) val, &len);
475 return r == ERROR_SUCCESS && type == REG_DWORD;
478 static UINT get_user_sid(LPWSTR *usersid)
485 if (!OpenProcessToken(GetCurrentProcess(), TOKEN_QUERY, &token))
486 return ERROR_FUNCTION_FAILED;
489 if (!GetTokenInformation(token, TokenUser, buf, size, &size)) {
491 return ERROR_FUNCTION_FAILED;
494 user = (PTOKEN_USER)buf;
495 if (!ConvertSidToStringSidW(user->User.Sid, usersid)) {
497 return ERROR_FUNCTION_FAILED;
500 return ERROR_SUCCESS;
503 UINT MSIREG_OpenUninstallKey(LPCWSTR szProduct, HKEY* key, BOOL create)
506 WCHAR keypath[0x200];
507 TRACE("%s\n",debugstr_w(szProduct));
509 sprintfW(keypath,szUninstall_fmt,szProduct);
512 rc = RegCreateKeyW(HKEY_LOCAL_MACHINE, keypath, key);
514 rc = RegOpenKeyW(HKEY_LOCAL_MACHINE, keypath, key);
519 UINT MSIREG_DeleteUninstallKey(LPCWSTR szProduct)
521 WCHAR keypath[0x200];
522 TRACE("%s\n",debugstr_w(szProduct));
524 sprintfW(keypath,szUninstall_fmt,szProduct);
526 return RegDeleteTreeW(HKEY_LOCAL_MACHINE, keypath);
529 UINT MSIREG_OpenProductKey(LPCWSTR szProduct, LPCWSTR szUserSid,
530 MSIINSTALLCONTEXT context, HKEY *key, BOOL create)
533 LPWSTR usersid = NULL;
534 HKEY root = HKEY_LOCAL_MACHINE;
535 WCHAR squished_pc[GUID_SIZE];
536 WCHAR keypath[MAX_PATH];
538 TRACE("(%s, %d, %d)\n", debugstr_w(szProduct), context, create);
540 if (!squash_guid(szProduct, squished_pc))
541 return ERROR_FUNCTION_FAILED;
543 TRACE("squished (%s)\n", debugstr_w(squished_pc));
545 if (context == MSIINSTALLCONTEXT_MACHINE)
547 sprintfW(keypath, szInstaller_LocalClassesProd_fmt, squished_pc);
549 else if (context == MSIINSTALLCONTEXT_USERUNMANAGED)
551 root = HKEY_CURRENT_USER;
552 sprintfW(keypath, szUserProduct_fmt, squished_pc);
558 r = get_user_sid(&usersid);
559 if (r != ERROR_SUCCESS || !usersid)
561 ERR("Failed to retrieve user SID: %d\n", r);
568 sprintfW(keypath, szInstaller_LocalManagedProd_fmt,
569 szUserSid, squished_pc);
574 return RegCreateKeyW(root, keypath, key);
576 return RegOpenKeyW(root, keypath, key);
579 UINT MSIREG_DeleteUserProductKey(LPCWSTR szProduct)
581 WCHAR squished_pc[GUID_SIZE];
582 WCHAR keypath[0x200];
584 TRACE("%s\n",debugstr_w(szProduct));
585 if (!squash_guid(szProduct,squished_pc))
586 return ERROR_FUNCTION_FAILED;
587 TRACE("squished (%s)\n", debugstr_w(squished_pc));
589 sprintfW(keypath,szUserProduct_fmt,squished_pc);
591 return RegDeleteTreeW(HKEY_CURRENT_USER, keypath);
594 UINT MSIREG_OpenUserPatchesKey(LPCWSTR szPatch, HKEY* key, BOOL create)
597 WCHAR squished_pc[GUID_SIZE];
598 WCHAR keypath[0x200];
600 TRACE("%s\n",debugstr_w(szPatch));
601 if (!squash_guid(szPatch,squished_pc))
602 return ERROR_FUNCTION_FAILED;
603 TRACE("squished (%s)\n", debugstr_w(squished_pc));
605 sprintfW(keypath,szUserPatch_fmt,squished_pc);
608 rc = RegCreateKeyW(HKEY_CURRENT_USER,keypath,key);
610 rc = RegOpenKeyW(HKEY_CURRENT_USER,keypath,key);
615 UINT MSIREG_OpenFeaturesKey(LPCWSTR szProduct, MSIINSTALLCONTEXT context,
616 HKEY *key, BOOL create)
620 HKEY root = HKEY_LOCAL_MACHINE;
621 WCHAR squished_pc[GUID_SIZE];
622 WCHAR keypath[MAX_PATH];
624 TRACE("(%s, %d, %d)\n", debugstr_w(szProduct), context, create);
626 if (!squash_guid(szProduct, squished_pc))
627 return ERROR_FUNCTION_FAILED;
629 TRACE("squished (%s)\n", debugstr_w(squished_pc));
631 if (context == MSIINSTALLCONTEXT_MACHINE)
633 sprintfW(keypath, szInstaller_LocalClassesFeat_fmt, squished_pc);
635 else if (context == MSIINSTALLCONTEXT_USERUNMANAGED)
637 root = HKEY_CURRENT_USER;
638 sprintfW(keypath, szUserFeatures_fmt, squished_pc);
642 r = get_user_sid(&usersid);
643 if (r != ERROR_SUCCESS || !usersid)
645 ERR("Failed to retrieve user SID: %d\n", r);
649 sprintfW(keypath, szInstaller_LocalManagedFeat_fmt, usersid, squished_pc);
654 return RegCreateKeyW(root, keypath, key);
656 return RegOpenKeyW(root, keypath, key);
659 UINT MSIREG_DeleteUserFeaturesKey(LPCWSTR szProduct)
661 WCHAR squished_pc[GUID_SIZE];
662 WCHAR keypath[0x200];
664 TRACE("%s\n",debugstr_w(szProduct));
665 if (!squash_guid(szProduct,squished_pc))
666 return ERROR_FUNCTION_FAILED;
667 TRACE("squished (%s)\n", debugstr_w(squished_pc));
669 sprintfW(keypath,szUserFeatures_fmt,squished_pc);
670 return RegDeleteTreeW(HKEY_CURRENT_USER, keypath);
673 static UINT MSIREG_OpenInstallerFeaturesKey(LPCWSTR szProduct, HKEY* key, BOOL create)
676 WCHAR squished_pc[GUID_SIZE];
677 WCHAR keypath[0x200];
679 TRACE("%s\n",debugstr_w(szProduct));
680 if (!squash_guid(szProduct,squished_pc))
681 return ERROR_FUNCTION_FAILED;
682 TRACE("squished (%s)\n", debugstr_w(squished_pc));
684 sprintfW(keypath,szInstaller_Features_fmt,squished_pc);
687 rc = RegCreateKeyW(HKEY_LOCAL_MACHINE,keypath,key);
689 rc = RegOpenKeyW(HKEY_LOCAL_MACHINE,keypath,key);
694 UINT MSIREG_OpenUserDataFeaturesKey(LPCWSTR szProduct, MSIINSTALLCONTEXT context,
695 HKEY *key, BOOL create)
699 WCHAR squished_pc[GUID_SIZE];
700 WCHAR keypath[0x200];
702 TRACE("(%s, %d, %d)\n", debugstr_w(szProduct), context, create);
704 if (!squash_guid(szProduct, squished_pc))
705 return ERROR_FUNCTION_FAILED;
707 TRACE("squished (%s)\n", debugstr_w(squished_pc));
709 if (context == MSIINSTALLCONTEXT_MACHINE)
711 sprintfW(keypath, szUserDataFeatures_fmt, szLocalSid, squished_pc);
715 r = get_user_sid(&usersid);
716 if (r != ERROR_SUCCESS || !usersid)
718 ERR("Failed to retrieve user SID: %d\n", r);
722 sprintfW(keypath, szUserDataFeatures_fmt, usersid, squished_pc);
727 return RegCreateKeyW(HKEY_LOCAL_MACHINE, keypath, key);
729 return RegOpenKeyW(HKEY_LOCAL_MACHINE, keypath, key);
732 UINT MSIREG_OpenUserComponentsKey(LPCWSTR szComponent, HKEY* key, BOOL create)
735 WCHAR squished_cc[GUID_SIZE];
736 WCHAR keypath[0x200];
738 TRACE("%s\n",debugstr_w(szComponent));
739 if (!squash_guid(szComponent,squished_cc))
740 return ERROR_FUNCTION_FAILED;
741 TRACE("squished (%s)\n", debugstr_w(squished_cc));
743 sprintfW(keypath,szUser_Components_fmt,squished_cc);
746 rc = RegCreateKeyW(HKEY_CURRENT_USER,keypath,key);
748 rc = RegOpenKeyW(HKEY_CURRENT_USER,keypath,key);
753 UINT MSIREG_OpenUserDataComponentKey(LPCWSTR szComponent, LPCWSTR szUserSid,
754 HKEY *key, BOOL create)
757 WCHAR comp[GUID_SIZE];
758 WCHAR keypath[0x200];
761 TRACE("%s\n", debugstr_w(szComponent));
762 if (!squash_guid(szComponent, comp))
763 return ERROR_FUNCTION_FAILED;
764 TRACE("squished (%s)\n", debugstr_w(comp));
768 rc = get_user_sid(&usersid);
769 if (rc != ERROR_SUCCESS || !usersid)
771 ERR("Failed to retrieve user SID: %d\n", rc);
775 sprintfW(keypath, szUserDataComp_fmt, usersid, comp);
779 sprintfW(keypath, szUserDataComp_fmt, szUserSid, comp);
782 rc = RegCreateKeyW(HKEY_LOCAL_MACHINE, keypath, key);
784 rc = RegOpenKeyW(HKEY_LOCAL_MACHINE, keypath, key);
789 UINT MSIREG_DeleteUserDataComponentKey(LPCWSTR szComponent, LPCWSTR szUserSid)
792 WCHAR comp[GUID_SIZE];
793 WCHAR keypath[0x200];
796 TRACE("%s\n", debugstr_w(szComponent));
797 if (!squash_guid(szComponent, comp))
798 return ERROR_FUNCTION_FAILED;
799 TRACE("squished (%s)\n", debugstr_w(comp));
803 rc = get_user_sid(&usersid);
804 if (rc != ERROR_SUCCESS || !usersid)
806 ERR("Failed to retrieve user SID: %d\n", rc);
810 sprintfW(keypath, szUserDataComp_fmt, usersid, comp);
814 sprintfW(keypath, szUserDataComp_fmt, szUserSid, comp);
816 return RegDeleteTreeW(HKEY_LOCAL_MACHINE, keypath);
819 UINT MSIREG_OpenUserDataProductKey(LPCWSTR szProduct, MSIINSTALLCONTEXT dwContext,
820 LPCWSTR szUserSid, HKEY *key, BOOL create)
823 WCHAR squished_pc[GUID_SIZE];
824 WCHAR keypath[0x200];
827 TRACE("%s\n", debugstr_w(szProduct));
828 if (!squash_guid(szProduct, squished_pc))
829 return ERROR_FUNCTION_FAILED;
830 TRACE("squished (%s)\n", debugstr_w(squished_pc));
832 if (dwContext == MSIINSTALLCONTEXT_MACHINE)
833 sprintfW(keypath, szUserDataProd_fmt, szLocalSid, squished_pc);
835 sprintfW(keypath, szUserDataProd_fmt, szUserSid, squished_pc);
838 rc = get_user_sid(&usersid);
839 if (rc != ERROR_SUCCESS || !usersid)
841 ERR("Failed to retrieve user SID: %d\n", rc);
845 sprintfW(keypath, szUserDataProd_fmt, usersid, squished_pc);
850 rc = RegCreateKeyW(HKEY_LOCAL_MACHINE, keypath, key);
852 rc = RegOpenKeyW(HKEY_LOCAL_MACHINE, keypath, key);
857 UINT MSIREG_OpenUserDataPatchKey(LPCWSTR szPatch, MSIINSTALLCONTEXT dwContext,
858 HKEY *key, BOOL create)
861 WCHAR squished_patch[GUID_SIZE];
862 WCHAR keypath[0x200];
865 TRACE("%s\n", debugstr_w(szPatch));
866 if (!squash_guid(szPatch, squished_patch))
867 return ERROR_FUNCTION_FAILED;
868 TRACE("squished (%s)\n", debugstr_w(squished_patch));
870 if (dwContext == MSIINSTALLCONTEXT_MACHINE)
871 sprintfW(keypath, szUserDataPatch_fmt, szLocalSid, squished_patch);
874 rc = get_user_sid(&usersid);
875 if (rc != ERROR_SUCCESS || !usersid)
877 ERR("Failed to retrieve user SID: %d\n", rc);
881 sprintfW(keypath, szUserDataPatch_fmt, usersid, squished_patch);
886 return RegCreateKeyW(HKEY_LOCAL_MACHINE, keypath, key);
888 return RegOpenKeyW(HKEY_LOCAL_MACHINE, keypath, key);
891 UINT MSIREG_OpenInstallProps(LPCWSTR szProduct, MSIINSTALLCONTEXT dwContext,
892 LPCWSTR szUserSid, HKEY *key, BOOL create)
896 WCHAR squished_pc[GUID_SIZE];
897 WCHAR keypath[0x200];
899 TRACE("%s\n", debugstr_w(szProduct));
900 if (!squash_guid(szProduct, squished_pc))
901 return ERROR_FUNCTION_FAILED;
902 TRACE("squished (%s)\n", debugstr_w(squished_pc));
904 if (dwContext == MSIINSTALLCONTEXT_MACHINE)
905 sprintfW(keypath, szInstallProperties_fmt, szLocalSid, squished_pc);
907 sprintfW(keypath, szInstallProperties_fmt, szUserSid, squished_pc);
910 rc = get_user_sid(&usersid);
911 if (rc != ERROR_SUCCESS || !usersid)
913 ERR("Failed to retrieve user SID: %d\n", rc);
917 sprintfW(keypath, szInstallProperties_fmt, usersid, squished_pc);
922 return RegCreateKeyW(HKEY_LOCAL_MACHINE, keypath, key);
924 return RegOpenKeyW(HKEY_LOCAL_MACHINE, keypath, key);
927 UINT MSIREG_DeleteUserDataProductKey(LPCWSTR szProduct)
930 WCHAR squished_pc[GUID_SIZE];
931 WCHAR keypath[0x200];
934 TRACE("%s\n", debugstr_w(szProduct));
935 if (!squash_guid(szProduct, squished_pc))
936 return ERROR_FUNCTION_FAILED;
937 TRACE("squished (%s)\n", debugstr_w(squished_pc));
939 rc = get_user_sid(&usersid);
940 if (rc != ERROR_SUCCESS || !usersid)
942 ERR("Failed to retrieve user SID: %d\n", rc);
946 sprintfW(keypath, szUserDataProd_fmt, usersid, squished_pc);
949 return RegDeleteTreeW(HKEY_LOCAL_MACHINE, keypath);
952 UINT MSIREG_DeleteProductKey(LPCWSTR szProduct)
954 WCHAR squished_pc[GUID_SIZE];
955 WCHAR keypath[0x200];
957 TRACE("%s\n", debugstr_w(szProduct));
958 if (!squash_guid(szProduct, squished_pc))
959 return ERROR_FUNCTION_FAILED;
960 TRACE("squished (%s)\n", debugstr_w(squished_pc));
962 sprintfW(keypath, szInstaller_Products_fmt, squished_pc);
964 return RegDeleteTreeW(HKEY_LOCAL_MACHINE, keypath);
967 UINT MSIREG_OpenPatchesKey(LPCWSTR szPatch, HKEY* key, BOOL create)
970 WCHAR squished_pc[GUID_SIZE];
971 WCHAR keypath[0x200];
973 TRACE("%s\n",debugstr_w(szPatch));
974 if (!squash_guid(szPatch,squished_pc))
975 return ERROR_FUNCTION_FAILED;
976 TRACE("squished (%s)\n", debugstr_w(squished_pc));
978 sprintfW(keypath,szInstaller_Patches_fmt,squished_pc);
981 rc = RegCreateKeyW(HKEY_LOCAL_MACHINE,keypath,key);
983 rc = RegOpenKeyW(HKEY_LOCAL_MACHINE,keypath,key);
988 UINT MSIREG_OpenUpgradeCodesKey(LPCWSTR szUpgradeCode, HKEY* key, BOOL create)
991 WCHAR squished_pc[GUID_SIZE];
992 WCHAR keypath[0x200];
994 TRACE("%s\n",debugstr_w(szUpgradeCode));
995 if (!squash_guid(szUpgradeCode,squished_pc))
996 return ERROR_FUNCTION_FAILED;
997 TRACE("squished (%s)\n", debugstr_w(squished_pc));
999 sprintfW(keypath,szInstaller_UpgradeCodes_fmt,squished_pc);
1002 rc = RegCreateKeyW(HKEY_LOCAL_MACHINE,keypath,key);
1004 rc = RegOpenKeyW(HKEY_LOCAL_MACHINE,keypath,key);
1009 UINT MSIREG_OpenUserUpgradeCodesKey(LPCWSTR szUpgradeCode, HKEY* key, BOOL create)
1012 WCHAR squished_pc[GUID_SIZE];
1013 WCHAR keypath[0x200];
1015 TRACE("%s\n",debugstr_w(szUpgradeCode));
1016 if (!squash_guid(szUpgradeCode,squished_pc))
1017 return ERROR_FUNCTION_FAILED;
1018 TRACE("squished (%s)\n", debugstr_w(squished_pc));
1020 sprintfW(keypath,szInstaller_UserUpgradeCodes_fmt,squished_pc);
1023 rc = RegCreateKeyW(HKEY_CURRENT_USER,keypath,key);
1025 rc = RegOpenKeyW(HKEY_CURRENT_USER,keypath,key);
1030 UINT MSIREG_DeleteUserUpgradeCodesKey(LPCWSTR szUpgradeCode)
1032 WCHAR squished_pc[GUID_SIZE];
1033 WCHAR keypath[0x200];
1035 TRACE("%s\n",debugstr_w(szUpgradeCode));
1036 if (!squash_guid(szUpgradeCode,squished_pc))
1037 return ERROR_FUNCTION_FAILED;
1038 TRACE("squished (%s)\n", debugstr_w(squished_pc));
1040 sprintfW(keypath,szInstaller_UserUpgradeCodes_fmt,squished_pc);
1042 return RegDeleteTreeW(HKEY_CURRENT_USER, keypath);
1045 UINT MSIREG_DeleteLocalClassesProductKey(LPCWSTR szProductCode)
1047 WCHAR squished_pc[GUID_SIZE];
1048 WCHAR keypath[0x200];
1050 TRACE("%s\n", debugstr_w(szProductCode));
1052 if (!squash_guid(szProductCode, squished_pc))
1053 return ERROR_FUNCTION_FAILED;
1055 TRACE("squished (%s)\n", debugstr_w(squished_pc));
1057 sprintfW(keypath, szInstaller_LocalClassesProd_fmt, squished_pc);
1059 return RegDeleteTreeW(HKEY_LOCAL_MACHINE, keypath);
1062 UINT MSIREG_DeleteLocalClassesFeaturesKey(LPCWSTR szProductCode)
1064 WCHAR squished_pc[GUID_SIZE];
1065 WCHAR keypath[0x200];
1067 TRACE("%s\n", debugstr_w(szProductCode));
1069 if (!squash_guid(szProductCode, squished_pc))
1070 return ERROR_FUNCTION_FAILED;
1072 TRACE("squished (%s)\n", debugstr_w(squished_pc));
1074 sprintfW(keypath, szInstaller_LocalClassesFeat_fmt, squished_pc);
1076 return RegDeleteTreeW(HKEY_LOCAL_MACHINE, keypath);
1079 UINT MSIREG_OpenClassesUpgradeCodesKey(LPCWSTR szUpgradeCode, HKEY* key, BOOL create)
1081 WCHAR squished_pc[GUID_SIZE];
1082 WCHAR keypath[0x200];
1084 TRACE("%s\n", debugstr_w(szUpgradeCode));
1085 if (!squash_guid(szUpgradeCode, squished_pc))
1086 return ERROR_FUNCTION_FAILED;
1087 TRACE("squished (%s)\n", debugstr_w(squished_pc));
1089 sprintfW(keypath, szInstaller_ClassesUpgrade_fmt, squished_pc);
1092 return RegCreateKeyW(HKEY_CLASSES_ROOT, keypath, key);
1094 return RegOpenKeyW(HKEY_CLASSES_ROOT, keypath, key);
1097 /*************************************************************************
1098 * MsiDecomposeDescriptorW [MSI.@]
1100 * Decomposes an MSI descriptor into product, feature and component parts.
1101 * An MSI descriptor is a string of the form:
1102 * [base 85 guid] [feature code] '>' [base 85 guid]
1105 * szDescriptor [I] the descriptor to decompose
1106 * szProduct [O] buffer of MAX_FEATURE_CHARS+1 for the product guid
1107 * szFeature [O] buffer of MAX_FEATURE_CHARS+1 for the feature code
1108 * szComponent [O] buffer of MAX_FEATURE_CHARS+1 for the component guid
1109 * pUsed [O] the length of the descriptor
1112 * ERROR_SUCCESS if everything worked correctly
1113 * ERROR_INVALID_PARAMETER if the descriptor was invalid
1116 UINT WINAPI MsiDecomposeDescriptorW( LPCWSTR szDescriptor, LPWSTR szProduct,
1117 LPWSTR szFeature, LPWSTR szComponent, LPDWORD pUsed )
1121 GUID product, component;
1123 TRACE("%s %p %p %p %p\n", debugstr_w(szDescriptor), szProduct,
1124 szFeature, szComponent, pUsed);
1126 r = decode_base85_guid( szDescriptor, &product );
1128 return ERROR_INVALID_PARAMETER;
1130 TRACE("product %s\n", debugstr_guid( &product ));
1132 p = strchrW(&szDescriptor[20],'>');
1134 return ERROR_INVALID_PARAMETER;
1136 len = (p - &szDescriptor[20]);
1137 if( len > MAX_FEATURE_CHARS )
1138 return ERROR_INVALID_PARAMETER;
1140 TRACE("feature %s\n", debugstr_wn( &szDescriptor[20], len ));
1142 r = decode_base85_guid( p+1, &component );
1144 return ERROR_INVALID_PARAMETER;
1146 TRACE("component %s\n", debugstr_guid( &component ));
1149 StringFromGUID2( &product, szProduct, MAX_FEATURE_CHARS+1 );
1151 StringFromGUID2( &component, szComponent, MAX_FEATURE_CHARS+1 );
1154 memcpy( szFeature, &szDescriptor[20], len*sizeof(WCHAR) );
1157 len = ( &p[21] - szDescriptor );
1159 TRACE("length = %d\n", len);
1162 return ERROR_SUCCESS;
1165 UINT WINAPI MsiDecomposeDescriptorA( LPCSTR szDescriptor, LPSTR szProduct,
1166 LPSTR szFeature, LPSTR szComponent, LPDWORD pUsed )
1168 WCHAR product[MAX_FEATURE_CHARS+1];
1169 WCHAR feature[MAX_FEATURE_CHARS+1];
1170 WCHAR component[MAX_FEATURE_CHARS+1];
1171 LPWSTR str = NULL, p = NULL, f = NULL, c = NULL;
1174 TRACE("%s %p %p %p %p\n", debugstr_a(szDescriptor), szProduct,
1175 szFeature, szComponent, pUsed);
1177 str = strdupAtoW( szDescriptor );
1178 if( szDescriptor && !str )
1179 return ERROR_OUTOFMEMORY;
1188 r = MsiDecomposeDescriptorW( str, p, f, c, pUsed );
1190 if (r == ERROR_SUCCESS)
1192 WideCharToMultiByte( CP_ACP, 0, p, -1,
1193 szProduct, MAX_FEATURE_CHARS+1, NULL, NULL );
1194 WideCharToMultiByte( CP_ACP, 0, f, -1,
1195 szFeature, MAX_FEATURE_CHARS+1, NULL, NULL );
1196 WideCharToMultiByte( CP_ACP, 0, c, -1,
1197 szComponent, MAX_FEATURE_CHARS+1, NULL, NULL );
1205 UINT WINAPI MsiEnumProductsA(DWORD index, LPSTR lpguid)
1208 WCHAR szwGuid[GUID_SIZE];
1210 TRACE("%d %p\n", index, lpguid);
1213 return ERROR_INVALID_PARAMETER;
1214 r = MsiEnumProductsW(index, szwGuid);
1215 if( r == ERROR_SUCCESS )
1216 WideCharToMultiByte(CP_ACP, 0, szwGuid, -1, lpguid, GUID_SIZE, NULL, NULL);
1221 UINT WINAPI MsiEnumProductsW(DWORD index, LPWSTR lpguid)
1224 WCHAR szKeyName[SQUISH_GUID_SIZE];
1226 DWORD machine_count, managed_count, unmanaged_count;
1227 WCHAR keypath[MAX_PATH];
1228 LPWSTR usersid = NULL;
1230 static DWORD last_index;
1232 TRACE("%d %p\n", index, lpguid);
1235 return ERROR_INVALID_PARAMETER;
1237 if (index && index - last_index != 1)
1238 return ERROR_INVALID_PARAMETER;
1240 r = RegCreateKeyW(HKEY_LOCAL_MACHINE, szInstaller_LocalClassesProd, &key);
1241 if( r != ERROR_SUCCESS )
1242 return ERROR_NO_MORE_ITEMS;
1244 r = RegQueryInfoKeyW(key, NULL, NULL, NULL, &machine_count, NULL, NULL,
1245 NULL, NULL, NULL, NULL, NULL);
1246 if( r != ERROR_SUCCESS )
1249 return ERROR_NO_MORE_ITEMS;
1252 if (machine_count && index <= machine_count)
1254 r = RegEnumKeyW(key, index, szKeyName, SQUISH_GUID_SIZE);
1255 if( r == ERROR_SUCCESS )
1257 unsquash_guid(szKeyName, lpguid);
1260 return ERROR_SUCCESS;
1265 r = get_user_sid(&usersid);
1266 if (r != ERROR_SUCCESS || !usersid)
1268 ERR("Failed to retrieve user SID: %d\n", r);
1271 sprintfW(keypath, szInstaller_LocalManaged_fmt, usersid);
1274 r = RegCreateKeyW(HKEY_LOCAL_MACHINE, keypath, &key);
1275 if( r != ERROR_SUCCESS )
1276 return ERROR_NO_MORE_ITEMS;
1278 r = RegQueryInfoKeyW(key, NULL, NULL, NULL, &managed_count, NULL, NULL,
1279 NULL, NULL, NULL, NULL, NULL);
1280 if( r != ERROR_SUCCESS )
1283 return ERROR_NO_MORE_ITEMS;
1286 if (managed_count && index <= machine_count + managed_count)
1288 r = RegEnumKeyW(key, index - machine_count, szKeyName, SQUISH_GUID_SIZE);
1289 if( r == ERROR_SUCCESS )
1291 unsquash_guid(szKeyName, lpguid);
1294 return ERROR_SUCCESS;
1299 r = RegCreateKeyW(HKEY_CURRENT_USER, szUserProduct, &key);
1300 if( r != ERROR_SUCCESS )
1301 return ERROR_NO_MORE_ITEMS;
1303 r = RegQueryInfoKeyW(key, NULL, NULL, NULL, &unmanaged_count, NULL, NULL,
1304 NULL, NULL, NULL, NULL, NULL);
1305 if( r != ERROR_SUCCESS )
1308 return ERROR_NO_MORE_ITEMS;
1311 if (unmanaged_count && index <= machine_count + managed_count + unmanaged_count)
1313 r = RegEnumKeyW(key, index - machine_count - managed_count, szKeyName, SQUISH_GUID_SIZE);
1314 if( r == ERROR_SUCCESS )
1316 unsquash_guid(szKeyName, lpguid);
1319 return ERROR_SUCCESS;
1324 return ERROR_NO_MORE_ITEMS;
1327 UINT WINAPI MsiEnumFeaturesA(LPCSTR szProduct, DWORD index,
1328 LPSTR szFeature, LPSTR szParent)
1331 WCHAR szwFeature[GUID_SIZE], szwParent[GUID_SIZE];
1332 LPWSTR szwProduct = NULL;
1334 TRACE("%s %d %p %p\n", debugstr_a(szProduct), index, szFeature, szParent);
1338 szwProduct = strdupAtoW( szProduct );
1340 return ERROR_OUTOFMEMORY;
1343 r = MsiEnumFeaturesW(szwProduct, index, szwFeature, szwParent);
1344 if( r == ERROR_SUCCESS )
1346 WideCharToMultiByte(CP_ACP, 0, szwFeature, -1,
1347 szFeature, GUID_SIZE, NULL, NULL);
1348 WideCharToMultiByte(CP_ACP, 0, szwParent, -1,
1349 szParent, GUID_SIZE, NULL, NULL);
1352 msi_free( szwProduct);
1357 UINT WINAPI MsiEnumFeaturesW(LPCWSTR szProduct, DWORD index,
1358 LPWSTR szFeature, LPWSTR szParent)
1360 HKEY hkeyProduct = 0;
1363 TRACE("%s %d %p %p\n", debugstr_w(szProduct), index, szFeature, szParent);
1366 return ERROR_INVALID_PARAMETER;
1368 r = MSIREG_OpenInstallerFeaturesKey(szProduct,&hkeyProduct,FALSE);
1369 if( r != ERROR_SUCCESS )
1370 return ERROR_NO_MORE_ITEMS;
1373 r = RegEnumValueW(hkeyProduct, index, szFeature, &sz, NULL, NULL, NULL, NULL);
1374 RegCloseKey(hkeyProduct);
1379 UINT WINAPI MsiEnumComponentsA(DWORD index, LPSTR lpguid)
1382 WCHAR szwGuid[GUID_SIZE];
1384 TRACE("%d %p\n", index, lpguid);
1386 r = MsiEnumComponentsW(index, szwGuid);
1387 if( r == ERROR_SUCCESS )
1388 WideCharToMultiByte(CP_ACP, 0, szwGuid, -1, lpguid, GUID_SIZE, NULL, NULL);
1393 UINT WINAPI MsiEnumComponentsW(DWORD index, LPWSTR lpguid)
1395 HKEY hkeyComponents = 0;
1397 WCHAR szKeyName[SQUISH_GUID_SIZE];
1399 TRACE("%d %p\n", index, lpguid);
1401 r = RegCreateKeyW(HKEY_LOCAL_MACHINE, szInstaller_Components, &hkeyComponents);
1402 if( r != ERROR_SUCCESS )
1403 return ERROR_NO_MORE_ITEMS;
1405 r = RegEnumKeyW(hkeyComponents, index, szKeyName, SQUISH_GUID_SIZE);
1406 if( r == ERROR_SUCCESS )
1407 unsquash_guid(szKeyName, lpguid);
1408 RegCloseKey(hkeyComponents);
1413 UINT WINAPI MsiEnumClientsA(LPCSTR szComponent, DWORD index, LPSTR szProduct)
1416 WCHAR szwProduct[GUID_SIZE];
1417 LPWSTR szwComponent = NULL;
1419 TRACE("%s %d %p\n", debugstr_a(szComponent), index, szProduct);
1422 return ERROR_INVALID_PARAMETER;
1426 szwComponent = strdupAtoW( szComponent );
1428 return ERROR_OUTOFMEMORY;
1431 r = MsiEnumClientsW(szComponent?szwComponent:NULL, index, szwProduct);
1432 if( r == ERROR_SUCCESS )
1434 WideCharToMultiByte(CP_ACP, 0, szwProduct, -1,
1435 szProduct, GUID_SIZE, NULL, NULL);
1438 msi_free( szwComponent);
1443 UINT WINAPI MsiEnumClientsW(LPCWSTR szComponent, DWORD index, LPWSTR szProduct)
1447 WCHAR szValName[SQUISH_GUID_SIZE];
1449 TRACE("%s %d %p\n", debugstr_w(szComponent), index, szProduct);
1451 if (!szComponent || !*szComponent || !szProduct)
1452 return ERROR_INVALID_PARAMETER;
1454 if (MSIREG_OpenUserDataComponentKey(szComponent, NULL, &hkeyComp, FALSE) != ERROR_SUCCESS &&
1455 MSIREG_OpenUserDataComponentKey(szComponent, szLocalSid, &hkeyComp, FALSE) != ERROR_SUCCESS)
1456 return ERROR_UNKNOWN_COMPONENT;
1458 /* see if there are any products at all */
1459 sz = SQUISH_GUID_SIZE;
1460 r = RegEnumValueW(hkeyComp, 0, szValName, &sz, NULL, NULL, NULL, NULL);
1461 if (r != ERROR_SUCCESS)
1463 RegCloseKey(hkeyComp);
1466 return ERROR_INVALID_PARAMETER;
1468 return ERROR_UNKNOWN_COMPONENT;
1471 sz = SQUISH_GUID_SIZE;
1472 r = RegEnumValueW(hkeyComp, index, szValName, &sz, NULL, NULL, NULL, NULL);
1473 if( r == ERROR_SUCCESS )
1474 unsquash_guid(szValName, szProduct);
1476 RegCloseKey(hkeyComp);
1481 static UINT MSI_EnumComponentQualifiers( LPCWSTR szComponent, DWORD iIndex,
1482 awstring *lpQualBuf, LPDWORD pcchQual,
1483 awstring *lpAppBuf, LPDWORD pcchAppBuf )
1485 DWORD name_sz, val_sz, name_max, val_max, type, ofs;
1486 LPWSTR name = NULL, val = NULL;
1490 TRACE("%s %08x %p %p %p %p\n", debugstr_w(szComponent), iIndex,
1491 lpQualBuf, pcchQual, lpAppBuf, pcchAppBuf);
1494 return ERROR_INVALID_PARAMETER;
1496 r = MSIREG_OpenUserComponentsKey( szComponent, &key, FALSE );
1497 if (r != ERROR_SUCCESS)
1498 return ERROR_UNKNOWN_COMPONENT;
1500 /* figure out how big the name is we want to return */
1502 r = ERROR_OUTOFMEMORY;
1503 name = msi_alloc( name_max * sizeof(WCHAR) );
1508 r = ERROR_OUTOFMEMORY;
1509 val = msi_alloc( val_max );
1513 /* loop until we allocate enough memory */
1518 r = RegEnumValueW( key, iIndex, name, &name_sz,
1519 NULL, &type, (LPBYTE)val, &val_sz );
1520 if (r == ERROR_SUCCESS)
1522 if (r != ERROR_MORE_DATA)
1525 if (type != REG_MULTI_SZ)
1527 ERR("component data has wrong type (%d)\n", type);
1531 r = ERROR_OUTOFMEMORY;
1532 if ((name_sz+1) >= name_max)
1536 name = msi_alloc( name_max * sizeof (WCHAR) );
1541 if (val_sz > val_max)
1543 val_max = val_sz + sizeof (WCHAR);
1545 val = msi_alloc( val_max * sizeof (WCHAR) );
1550 ERR("should be enough data, but isn't %d %d\n", name_sz, val_sz );
1555 r = MsiDecomposeDescriptorW( val, NULL, NULL, NULL, &ofs );
1556 if (r != ERROR_SUCCESS)
1559 TRACE("Providing %s and %s\n", debugstr_w(name), debugstr_w(val+ofs));
1561 r = msi_strcpy_to_awstring( name, lpQualBuf, pcchQual );
1562 r2 = msi_strcpy_to_awstring( val+ofs, lpAppBuf, pcchAppBuf );
1564 if (r2 != ERROR_SUCCESS)
1575 /*************************************************************************
1576 * MsiEnumComponentQualifiersA [MSI.@]
1578 UINT WINAPI MsiEnumComponentQualifiersA( LPCSTR szComponent, DWORD iIndex,
1579 LPSTR lpQualifierBuf, LPDWORD pcchQualifierBuf,
1580 LPSTR lpApplicationDataBuf, LPDWORD pcchApplicationDataBuf )
1582 awstring qual, appdata;
1586 TRACE("%s %08x %p %p %p %p\n", debugstr_a(szComponent), iIndex,
1587 lpQualifierBuf, pcchQualifierBuf, lpApplicationDataBuf,
1588 pcchApplicationDataBuf);
1590 comp = strdupAtoW( szComponent );
1591 if (szComponent && !comp)
1592 return ERROR_OUTOFMEMORY;
1594 qual.unicode = FALSE;
1595 qual.str.a = lpQualifierBuf;
1597 appdata.unicode = FALSE;
1598 appdata.str.a = lpApplicationDataBuf;
1600 r = MSI_EnumComponentQualifiers( comp, iIndex,
1601 &qual, pcchQualifierBuf, &appdata, pcchApplicationDataBuf );
1606 /*************************************************************************
1607 * MsiEnumComponentQualifiersW [MSI.@]
1609 UINT WINAPI MsiEnumComponentQualifiersW( LPCWSTR szComponent, DWORD iIndex,
1610 LPWSTR lpQualifierBuf, LPDWORD pcchQualifierBuf,
1611 LPWSTR lpApplicationDataBuf, LPDWORD pcchApplicationDataBuf )
1613 awstring qual, appdata;
1615 TRACE("%s %08x %p %p %p %p\n", debugstr_w(szComponent), iIndex,
1616 lpQualifierBuf, pcchQualifierBuf, lpApplicationDataBuf,
1617 pcchApplicationDataBuf);
1619 qual.unicode = TRUE;
1620 qual.str.w = lpQualifierBuf;
1622 appdata.unicode = TRUE;
1623 appdata.str.w = lpApplicationDataBuf;
1625 return MSI_EnumComponentQualifiers( szComponent, iIndex,
1626 &qual, pcchQualifierBuf, &appdata, pcchApplicationDataBuf );
1629 /*************************************************************************
1630 * MsiEnumRelatedProductsW [MSI.@]
1633 UINT WINAPI MsiEnumRelatedProductsW(LPCWSTR szUpgradeCode, DWORD dwReserved,
1634 DWORD iProductIndex, LPWSTR lpProductBuf)
1638 DWORD dwSize = SQUISH_GUID_SIZE;
1639 WCHAR szKeyName[SQUISH_GUID_SIZE];
1641 TRACE("%s %u %u %p\n", debugstr_w(szUpgradeCode), dwReserved,
1642 iProductIndex, lpProductBuf);
1644 if (NULL == szUpgradeCode)
1645 return ERROR_INVALID_PARAMETER;
1646 if (NULL == lpProductBuf)
1647 return ERROR_INVALID_PARAMETER;
1649 r = MSIREG_OpenUpgradeCodesKey(szUpgradeCode, &hkey, FALSE);
1650 if (r != ERROR_SUCCESS)
1651 return ERROR_NO_MORE_ITEMS;
1653 r = RegEnumValueW(hkey, iProductIndex, szKeyName, &dwSize, NULL, NULL, NULL, NULL);
1654 if( r == ERROR_SUCCESS )
1655 unsquash_guid(szKeyName, lpProductBuf);
1661 /*************************************************************************
1662 * MsiEnumRelatedProductsA [MSI.@]
1665 UINT WINAPI MsiEnumRelatedProductsA(LPCSTR szUpgradeCode, DWORD dwReserved,
1666 DWORD iProductIndex, LPSTR lpProductBuf)
1668 LPWSTR szwUpgradeCode = NULL;
1669 WCHAR productW[GUID_SIZE];
1672 TRACE("%s %u %u %p\n", debugstr_a(szUpgradeCode), dwReserved,
1673 iProductIndex, lpProductBuf);
1677 szwUpgradeCode = strdupAtoW( szUpgradeCode );
1678 if( !szwUpgradeCode )
1679 return ERROR_OUTOFMEMORY;
1682 r = MsiEnumRelatedProductsW( szwUpgradeCode, dwReserved,
1683 iProductIndex, productW );
1684 if (r == ERROR_SUCCESS)
1686 WideCharToMultiByte( CP_ACP, 0, productW, GUID_SIZE,
1687 lpProductBuf, GUID_SIZE, NULL, NULL );
1689 msi_free( szwUpgradeCode);
1693 /***********************************************************************
1694 * MsiEnumPatchesExA [MSI.@]
1696 UINT WINAPI MsiEnumPatchesExA(LPCSTR szProductCode, LPCSTR szUserSid,
1697 DWORD dwContext, DWORD dwFilter, DWORD dwIndex, LPSTR szPatchCode,
1698 LPSTR szTargetProductCode, MSIINSTALLCONTEXT *pdwTargetProductContext,
1699 LPSTR szTargetUserSid, LPDWORD pcchTargetUserSid)
1701 LPWSTR prodcode = NULL;
1702 LPWSTR usersid = NULL;
1703 LPWSTR targsid = NULL;
1704 WCHAR patch[GUID_SIZE];
1705 WCHAR targprod[GUID_SIZE];
1709 TRACE("(%s, %s, %d, %d, %d, %p, %p, %p, %p, %p)\n",
1710 debugstr_a(szProductCode), debugstr_a(szUserSid), dwContext, dwFilter,
1711 dwIndex, szPatchCode, szTargetProductCode, pdwTargetProductContext,
1712 szTargetUserSid, pcchTargetUserSid);
1714 if (szTargetUserSid && !pcchTargetUserSid)
1715 return ERROR_INVALID_PARAMETER;
1717 if (szProductCode) prodcode = strdupAtoW(szProductCode);
1718 if (szUserSid) usersid = strdupAtoW(szUserSid);
1720 r = MsiEnumPatchesExW(prodcode, usersid, dwContext, dwFilter, dwIndex,
1721 patch, targprod, pdwTargetProductContext,
1723 if (r != ERROR_SUCCESS)
1726 WideCharToMultiByte(CP_ACP, 0, patch, -1, szPatchCode,
1727 GUID_SIZE, NULL, NULL);
1728 WideCharToMultiByte(CP_ACP, 0, targprod, -1, szTargetProductCode,
1729 GUID_SIZE, NULL, NULL);
1731 if (!szTargetUserSid)
1733 if (pcchTargetUserSid)
1734 *pcchTargetUserSid = len;
1739 targsid = msi_alloc(++len * sizeof(WCHAR));
1742 r = ERROR_OUTOFMEMORY;
1746 r = MsiEnumPatchesExW(prodcode, usersid, dwContext, dwFilter, dwIndex,
1747 patch, targprod, pdwTargetProductContext,
1749 if (r != ERROR_SUCCESS || !szTargetUserSid)
1752 WideCharToMultiByte(CP_ACP, 0, targsid, -1, szTargetUserSid,
1753 *pcchTargetUserSid, NULL, NULL);
1755 len = lstrlenW(targsid);
1756 if (*pcchTargetUserSid < len + 1)
1758 r = ERROR_MORE_DATA;
1759 *pcchTargetUserSid = len * sizeof(WCHAR);
1762 *pcchTargetUserSid = len;
1772 static UINT msi_get_patch_state(LPCWSTR prodcode, LPCWSTR usersid,
1773 MSIINSTALLCONTEXT context,
1774 LPWSTR patch, MSIPATCHSTATE *state)
1776 DWORD type, val, size;
1777 HKEY prod, hkey = 0;
1780 UINT r = ERROR_NO_MORE_ITEMS;
1782 static const WCHAR szPatches[] = {'P','a','t','c','h','e','s',0};
1783 static const WCHAR szState[] = {'S','t','a','t','e',0};
1785 *state = MSIPATCHSTATE_INVALID;
1787 r = MSIREG_OpenUserDataProductKey(prodcode, context,
1788 usersid, &prod, FALSE);
1789 if (r != ERROR_SUCCESS)
1790 return ERROR_NO_MORE_ITEMS;
1792 res = RegOpenKeyExW(prod, szPatches, 0, KEY_READ, &hkey);
1793 if (res != ERROR_SUCCESS)
1796 res = RegOpenKeyExW(hkey, patch, 0, KEY_READ, &udpatch);
1797 if (res != ERROR_SUCCESS)
1800 size = sizeof(DWORD);
1801 res = RegGetValueW(udpatch, NULL, szState, RRF_RT_DWORD, &type, &val, &size);
1802 if (res != ERROR_SUCCESS ||
1803 val < MSIPATCHSTATE_APPLIED || val > MSIPATCHSTATE_REGISTERED)
1805 r = ERROR_BAD_CONFIGURATION;
1813 RegCloseKey(udpatch);
1820 static UINT msi_check_product_patches(LPCWSTR prodcode, LPCWSTR usersid,
1821 MSIINSTALLCONTEXT context, DWORD filter, DWORD index, DWORD *idx,
1822 LPWSTR patch, LPWSTR targetprod, MSIINSTALLCONTEXT *targetctx,
1823 LPWSTR targetsid, DWORD *sidsize, LPWSTR *transforms)
1825 MSIPATCHSTATE state = MSIPATCHSTATE_INVALID;
1826 LPWSTR ptr, patches = NULL;
1827 HKEY prod, patchkey = 0;
1828 HKEY localprod = 0, localpatch = 0;
1831 UINT temp, r = ERROR_NO_MORE_ITEMS;
1833 static const WCHAR szPatches[] = {'P','a','t','c','h','e','s',0};
1834 static const WCHAR szState[] = {'S','t','a','t','e',0};
1835 static const WCHAR szEmpty[] = {0};
1837 if (MSIREG_OpenProductKey(prodcode, usersid, context,
1838 &prod, FALSE) != ERROR_SUCCESS)
1839 return ERROR_NO_MORE_ITEMS;
1842 res = RegGetValueW(prod, szPatches, szPatches, RRF_RT_ANY, &type, NULL,
1844 if (res != ERROR_SUCCESS)
1847 if (type != REG_MULTI_SZ)
1849 r = ERROR_BAD_CONFIGURATION;
1853 patches = msi_alloc(size);
1856 r = ERROR_OUTOFMEMORY;
1860 res = RegGetValueW(prod, szPatches, szPatches, RRF_RT_ANY, &type,
1862 if (res != ERROR_SUCCESS)
1866 for (ptr = patches; *ptr && r == ERROR_NO_MORE_ITEMS; ptr += lstrlenW(ptr))
1868 if (!unsquash_guid(ptr, patch))
1870 r = ERROR_BAD_CONFIGURATION;
1875 res = RegGetValueW(prod, szPatches, ptr, RRF_RT_REG_SZ,
1876 &type, NULL, &size);
1877 if (res != ERROR_SUCCESS)
1882 *transforms = msi_alloc(size);
1885 r = ERROR_OUTOFMEMORY;
1889 res = RegGetValueW(prod, szPatches, ptr, RRF_RT_REG_SZ,
1890 &type, *transforms, &size);
1891 if (res != ERROR_SUCCESS)
1895 if (context == MSIINSTALLCONTEXT_USERMANAGED)
1897 if (!(filter & MSIPATCHSTATE_APPLIED))
1899 temp = msi_get_patch_state(prodcode, usersid, context,
1901 if (temp == ERROR_BAD_CONFIGURATION)
1903 r = ERROR_BAD_CONFIGURATION;
1907 if (temp != ERROR_SUCCESS || !(filter & state))
1911 else if (context == MSIINSTALLCONTEXT_USERUNMANAGED)
1913 if (!(filter & MSIPATCHSTATE_APPLIED))
1915 temp = msi_get_patch_state(prodcode, usersid, context,
1917 if (temp == ERROR_BAD_CONFIGURATION)
1919 r = ERROR_BAD_CONFIGURATION;
1923 if (temp != ERROR_SUCCESS || !(filter & state))
1928 temp = MSIREG_OpenUserDataPatchKey(patch, context,
1930 RegCloseKey(patchkey);
1931 if (temp != ERROR_SUCCESS)
1935 else if (context == MSIINSTALLCONTEXT_MACHINE)
1939 if (MSIREG_OpenUserDataProductKey(prodcode, context, NULL, &localprod, FALSE) == ERROR_SUCCESS &&
1940 RegOpenKeyExW(localprod, szPatches, 0, KEY_READ, &localpatch) == ERROR_SUCCESS &&
1941 RegOpenKeyExW(localpatch, ptr, 0, KEY_READ, &patchkey) == ERROR_SUCCESS)
1943 res = RegGetValueW(patchkey, NULL, szState, RRF_RT_REG_DWORD,
1944 &type, &state, &size);
1946 if (!(filter & state))
1947 res = ERROR_NO_MORE_ITEMS;
1949 RegCloseKey(patchkey);
1952 RegCloseKey(localpatch);
1953 RegCloseKey(localprod);
1955 if (res != ERROR_SUCCESS)
1967 lstrcpyW(targetprod, prodcode);
1970 *targetctx = context;
1974 lstrcpynW(targetsid, usersid, *sidsize);
1975 if (lstrlenW(usersid) >= *sidsize)
1976 r = ERROR_MORE_DATA;
1981 *sidsize = lstrlenW(usersid);
1983 *sidsize *= sizeof(WCHAR);
1994 static UINT msi_enum_patches(LPCWSTR szProductCode, LPCWSTR szUserSid,
1995 DWORD dwContext, DWORD dwFilter, DWORD dwIndex, DWORD *idx,
1996 LPWSTR szPatchCode, LPWSTR szTargetProductCode,
1997 MSIINSTALLCONTEXT *pdwTargetProductContext, LPWSTR szTargetUserSid,
1998 LPDWORD pcchTargetUserSid, LPWSTR *szTransforms)
2000 LPWSTR usersid = NULL;
2001 UINT r = ERROR_INVALID_PARAMETER;
2005 get_user_sid(&usersid);
2006 szUserSid = usersid;
2009 if (dwContext & MSIINSTALLCONTEXT_USERMANAGED)
2011 r = msi_check_product_patches(szProductCode, szUserSid,
2012 MSIINSTALLCONTEXT_USERMANAGED, dwFilter,
2013 dwIndex, idx, szPatchCode,
2014 szTargetProductCode,
2015 pdwTargetProductContext, szTargetUserSid,
2016 pcchTargetUserSid, szTransforms);
2017 if (r != ERROR_NO_MORE_ITEMS)
2021 if (dwContext & MSIINSTALLCONTEXT_USERUNMANAGED)
2023 r = msi_check_product_patches(szProductCode, szUserSid,
2024 MSIINSTALLCONTEXT_USERUNMANAGED, dwFilter,
2025 dwIndex, idx, szPatchCode,
2026 szTargetProductCode,
2027 pdwTargetProductContext, szTargetUserSid,
2028 pcchTargetUserSid, szTransforms);
2029 if (r != ERROR_NO_MORE_ITEMS)
2033 if (dwContext & MSIINSTALLCONTEXT_MACHINE)
2035 r = msi_check_product_patches(szProductCode, szUserSid,
2036 MSIINSTALLCONTEXT_MACHINE, dwFilter,
2037 dwIndex, idx, szPatchCode,
2038 szTargetProductCode,
2039 pdwTargetProductContext, szTargetUserSid,
2040 pcchTargetUserSid, szTransforms);
2041 if (r != ERROR_NO_MORE_ITEMS)
2050 /***********************************************************************
2051 * MsiEnumPatchesExW [MSI.@]
2053 UINT WINAPI MsiEnumPatchesExW(LPCWSTR szProductCode, LPCWSTR szUserSid,
2054 DWORD dwContext, DWORD dwFilter, DWORD dwIndex, LPWSTR szPatchCode,
2055 LPWSTR szTargetProductCode, MSIINSTALLCONTEXT *pdwTargetProductContext,
2056 LPWSTR szTargetUserSid, LPDWORD pcchTargetUserSid)
2058 WCHAR squished_pc[GUID_SIZE];
2062 static int last_index = 0;
2064 TRACE("(%s, %s, %d, %d, %d, %p, %p, %p, %p, %p)\n",
2065 debugstr_w(szProductCode), debugstr_w(szUserSid), dwContext, dwFilter,
2066 dwIndex, szPatchCode, szTargetProductCode, pdwTargetProductContext,
2067 szTargetUserSid, pcchTargetUserSid);
2069 if (!szProductCode || !squash_guid(szProductCode, squished_pc))
2070 return ERROR_INVALID_PARAMETER;
2072 if (!lstrcmpW(szUserSid, szLocalSid))
2073 return ERROR_INVALID_PARAMETER;
2075 if (dwContext & MSIINSTALLCONTEXT_MACHINE && szUserSid)
2076 return ERROR_INVALID_PARAMETER;
2078 if (dwContext <= MSIINSTALLCONTEXT_NONE ||
2079 dwContext > MSIINSTALLCONTEXT_ALL)
2080 return ERROR_INVALID_PARAMETER;
2082 if (dwFilter <= MSIPATCHSTATE_INVALID || dwFilter > MSIPATCHSTATE_ALL)
2083 return ERROR_INVALID_PARAMETER;
2085 if (dwIndex && dwIndex - last_index != 1)
2086 return ERROR_INVALID_PARAMETER;
2091 r = msi_enum_patches(szProductCode, szUserSid, dwContext, dwFilter,
2092 dwIndex, &idx, szPatchCode, szTargetProductCode,
2093 pdwTargetProductContext, szTargetUserSid,
2094 pcchTargetUserSid, NULL);
2096 if (r == ERROR_SUCCESS)
2097 last_index = dwIndex;
2102 /***********************************************************************
2103 * MsiEnumPatchesA [MSI.@]
2105 UINT WINAPI MsiEnumPatchesA(LPCSTR szProduct, DWORD iPatchIndex,
2106 LPSTR lpPatchBuf, LPSTR lpTransformsBuf, LPDWORD pcchTransformsBuf)
2108 LPWSTR product, transforms;
2109 WCHAR patch[GUID_SIZE];
2113 TRACE("(%s %d %p %p %p)\n", debugstr_a(szProduct), iPatchIndex,
2114 lpPatchBuf, lpTransformsBuf, pcchTransformsBuf);
2116 if (!szProduct || !lpPatchBuf || !lpTransformsBuf || !pcchTransformsBuf)
2117 return ERROR_INVALID_PARAMETER;
2119 product = strdupAtoW(szProduct);
2121 return ERROR_OUTOFMEMORY;
2123 len = *pcchTransformsBuf;
2124 transforms = msi_alloc( len * sizeof(WCHAR) );
2127 r = ERROR_OUTOFMEMORY;
2131 r = MsiEnumPatchesW(product, iPatchIndex, patch, transforms, &len);
2132 if (r != ERROR_SUCCESS && r != ERROR_MORE_DATA)
2135 WideCharToMultiByte(CP_ACP, 0, patch, -1, lpPatchBuf,
2136 GUID_SIZE, NULL, NULL);
2138 if (!WideCharToMultiByte(CP_ACP, 0, transforms, -1, lpTransformsBuf,
2139 *pcchTransformsBuf, NULL, NULL))
2140 r = ERROR_MORE_DATA;
2142 if (r == ERROR_MORE_DATA)
2144 lpTransformsBuf[*pcchTransformsBuf - 1] = '\0';
2145 *pcchTransformsBuf = len * 2;
2148 *pcchTransformsBuf = strlen( lpTransformsBuf );
2151 msi_free(transforms);
2157 /***********************************************************************
2158 * MsiEnumPatchesW [MSI.@]
2160 UINT WINAPI MsiEnumPatchesW(LPCWSTR szProduct, DWORD iPatchIndex,
2161 LPWSTR lpPatchBuf, LPWSTR lpTransformsBuf, LPDWORD pcchTransformsBuf)
2163 WCHAR squished_pc[GUID_SIZE];
2164 LPWSTR transforms = NULL;
2169 TRACE("(%s %d %p %p %p)\n", debugstr_w(szProduct), iPatchIndex,
2170 lpPatchBuf, lpTransformsBuf, pcchTransformsBuf);
2172 if (!szProduct || !squash_guid(szProduct, squished_pc))
2173 return ERROR_INVALID_PARAMETER;
2175 if (!lpPatchBuf || !lpTransformsBuf || !pcchTransformsBuf)
2176 return ERROR_INVALID_PARAMETER;
2178 if (MSIREG_OpenProductKey(szProduct, NULL, MSIINSTALLCONTEXT_USERMANAGED,
2179 &prod, FALSE) != ERROR_SUCCESS &&
2180 MSIREG_OpenProductKey(szProduct, NULL, MSIINSTALLCONTEXT_USERUNMANAGED,
2181 &prod, FALSE) != ERROR_SUCCESS &&
2182 MSIREG_OpenProductKey(szProduct, NULL, MSIINSTALLCONTEXT_MACHINE,
2183 &prod, FALSE) != ERROR_SUCCESS)
2184 return ERROR_UNKNOWN_PRODUCT;
2188 r = msi_enum_patches(szProduct, NULL, MSIINSTALLCONTEXT_ALL,
2189 MSIPATCHSTATE_ALL, iPatchIndex, &idx, lpPatchBuf,
2190 NULL, NULL, NULL, NULL, &transforms);
2191 if (r != ERROR_SUCCESS)
2194 lstrcpynW(lpTransformsBuf, transforms, *pcchTransformsBuf);
2195 if (*pcchTransformsBuf <= lstrlenW(transforms))
2197 r = ERROR_MORE_DATA;
2198 *pcchTransformsBuf = lstrlenW(transforms);
2201 *pcchTransformsBuf = lstrlenW(transforms);
2204 msi_free(transforms);
2208 UINT WINAPI MsiEnumProductsExA( LPCSTR szProductCode, LPCSTR szUserSid,
2209 DWORD dwContext, DWORD dwIndex, CHAR szInstalledProductCode[39],
2210 MSIINSTALLCONTEXT* pdwInstalledContext, LPSTR szSid, LPDWORD pcchSid)
2212 FIXME("%s %s %d %d %p %p %p %p\n", debugstr_a(szProductCode), debugstr_a(szUserSid),
2213 dwContext, dwIndex, szInstalledProductCode, pdwInstalledContext,
2215 return ERROR_NO_MORE_ITEMS;
2218 UINT WINAPI MsiEnumProductsExW( LPCWSTR szProductCode, LPCWSTR szUserSid,
2219 DWORD dwContext, DWORD dwIndex, WCHAR szInstalledProductCode[39],
2220 MSIINSTALLCONTEXT* pdwInstalledContext, LPWSTR szSid, LPDWORD pcchSid)
2222 FIXME("%s %s %d %d %p %p %p %p\n", debugstr_w(szProductCode), debugstr_w(szUserSid),
2223 dwContext, dwIndex, szInstalledProductCode, pdwInstalledContext,
2225 return ERROR_NO_MORE_ITEMS;