2 * Implementation of the Microsoft Installer (msi.dll)
4 * Copyright 2002,2003,2004,2005 Mike McCormack for CodeWeavers
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
24 #define NONAMELESSUNION
31 #include "wine/debug.h"
42 #include "wine/unicode.h"
44 WINE_DEFAULT_DEBUG_CHANNEL(msi);
46 static const WCHAR installerW[] = {'\\','I','n','s','t','a','l','l','e','r',0};
48 static UINT msi_locate_product(LPCWSTR szProduct, MSIINSTALLCONTEXT *context)
52 *context = MSIINSTALLCONTEXT_NONE;
54 if (MSIREG_OpenProductKey(szProduct, NULL, MSIINSTALLCONTEXT_USERMANAGED,
55 &hkey, FALSE) == ERROR_SUCCESS)
56 *context = MSIINSTALLCONTEXT_USERMANAGED;
57 else if (MSIREG_OpenProductKey(szProduct, NULL, MSIINSTALLCONTEXT_MACHINE,
58 &hkey, FALSE) == ERROR_SUCCESS)
59 *context = MSIINSTALLCONTEXT_MACHINE;
60 else if (MSIREG_OpenProductKey(szProduct, NULL,
61 MSIINSTALLCONTEXT_USERUNMANAGED,
62 &hkey, FALSE) == ERROR_SUCCESS)
63 *context = MSIINSTALLCONTEXT_USERUNMANAGED;
67 if (*context == MSIINSTALLCONTEXT_NONE)
68 return ERROR_UNKNOWN_PRODUCT;
73 UINT WINAPI MsiOpenProductA(LPCSTR szProduct, MSIHANDLE *phProduct)
76 LPWSTR szwProd = NULL;
78 TRACE("%s %p\n",debugstr_a(szProduct), phProduct);
82 szwProd = strdupAtoW( szProduct );
84 return ERROR_OUTOFMEMORY;
87 r = MsiOpenProductW( szwProd, phProduct );
94 static UINT MSI_OpenProductW(LPCWSTR szProduct, MSIPACKAGE **package)
99 MSIINSTALLCONTEXT context;
101 static const WCHAR managed[] = {
102 'M','a','n','a','g','e','d','L','o','c','a','l','P','a','c','k','a','g','e',0};
103 static const WCHAR local[] = {'L','o','c','a','l','P','a','c','k','a','g','e',0};
105 TRACE("%s %p\n", debugstr_w(szProduct), package);
107 r = msi_locate_product(szProduct, &context);
108 if (r != ERROR_SUCCESS)
111 r = MSIREG_OpenInstallProps(szProduct, context, NULL, &props, FALSE);
112 if (r != ERROR_SUCCESS)
113 return ERROR_UNKNOWN_PRODUCT;
115 if (context == MSIINSTALLCONTEXT_USERMANAGED)
116 path = msi_reg_get_val_str(props, managed);
118 path = msi_reg_get_val_str(props, local);
120 r = ERROR_UNKNOWN_PRODUCT;
122 if (!path || GetFileAttributesW(path) == INVALID_FILE_ATTRIBUTES)
125 if (PathIsRelativeW(path))
127 r = ERROR_INSTALL_PACKAGE_OPEN_FAILED;
131 r = MSI_OpenPackageW(path, package);
139 UINT WINAPI MsiOpenProductW(LPCWSTR szProduct, MSIHANDLE *phProduct)
141 MSIPACKAGE *package = NULL;
142 WCHAR squished_pc[GUID_SIZE];
145 if (!szProduct || !squash_guid(szProduct, squished_pc))
146 return ERROR_INVALID_PARAMETER;
149 return ERROR_INVALID_PARAMETER;
151 r = MSI_OpenProductW(szProduct, &package);
152 if (r != ERROR_SUCCESS)
155 *phProduct = alloc_msihandle(&package->hdr);
157 r = ERROR_NOT_ENOUGH_MEMORY;
159 msiobj_release(&package->hdr);
163 UINT WINAPI MsiAdvertiseProductA(LPCSTR szPackagePath, LPCSTR szScriptfilePath,
164 LPCSTR szTransforms, LANGID lgidLanguage)
166 FIXME("%s %s %s %08x\n",debugstr_a(szPackagePath),
167 debugstr_a(szScriptfilePath), debugstr_a(szTransforms), lgidLanguage);
168 return ERROR_CALL_NOT_IMPLEMENTED;
171 UINT WINAPI MsiAdvertiseProductW(LPCWSTR szPackagePath, LPCWSTR szScriptfilePath,
172 LPCWSTR szTransforms, LANGID lgidLanguage)
174 FIXME("%s %s %s %08x\n",debugstr_w(szPackagePath),
175 debugstr_w(szScriptfilePath), debugstr_w(szTransforms), lgidLanguage);
176 return ERROR_CALL_NOT_IMPLEMENTED;
179 UINT WINAPI MsiAdvertiseProductExA(LPCSTR szPackagePath, LPCSTR szScriptfilePath,
180 LPCSTR szTransforms, LANGID lgidLanguage, DWORD dwPlatform, DWORD dwOptions)
182 FIXME("%s %s %s %08x %08x %08x\n", debugstr_a(szPackagePath),
183 debugstr_a(szScriptfilePath), debugstr_a(szTransforms),
184 lgidLanguage, dwPlatform, dwOptions);
185 return ERROR_CALL_NOT_IMPLEMENTED;
188 UINT WINAPI MsiAdvertiseProductExW( LPCWSTR szPackagePath, LPCWSTR szScriptfilePath,
189 LPCWSTR szTransforms, LANGID lgidLanguage, DWORD dwPlatform, DWORD dwOptions)
191 FIXME("%s %s %s %08x %08x %08x\n", debugstr_w(szPackagePath),
192 debugstr_w(szScriptfilePath), debugstr_w(szTransforms),
193 lgidLanguage, dwPlatform, dwOptions);
194 return ERROR_CALL_NOT_IMPLEMENTED;
197 UINT WINAPI MsiInstallProductA(LPCSTR szPackagePath, LPCSTR szCommandLine)
199 LPWSTR szwPath = NULL, szwCommand = NULL;
200 UINT r = ERROR_OUTOFMEMORY;
202 TRACE("%s %s\n",debugstr_a(szPackagePath), debugstr_a(szCommandLine));
206 szwPath = strdupAtoW( szPackagePath );
213 szwCommand = strdupAtoW( szCommandLine );
218 r = MsiInstallProductW( szwPath, szwCommand );
222 msi_free( szwCommand );
227 UINT WINAPI MsiInstallProductW(LPCWSTR szPackagePath, LPCWSTR szCommandLine)
229 MSIPACKAGE *package = NULL;
232 TRACE("%s %s\n",debugstr_w(szPackagePath), debugstr_w(szCommandLine));
235 return ERROR_INVALID_PARAMETER;
238 return ERROR_PATH_NOT_FOUND;
240 r = MSI_OpenPackageW( szPackagePath, &package );
241 if (r == ERROR_SUCCESS)
243 r = MSI_InstallPackage( package, szPackagePath, szCommandLine );
244 msiobj_release( &package->hdr );
250 UINT WINAPI MsiReinstallProductA(LPCSTR szProduct, DWORD dwReinstallMode)
255 TRACE("%s %08x\n", debugstr_a(szProduct), dwReinstallMode);
257 wszProduct = strdupAtoW(szProduct);
259 rc = MsiReinstallProductW(wszProduct, dwReinstallMode);
261 msi_free(wszProduct);
265 UINT WINAPI MsiReinstallProductW(LPCWSTR szProduct, DWORD dwReinstallMode)
267 TRACE("%s %08x\n", debugstr_w(szProduct), dwReinstallMode);
269 return MsiReinstallFeatureW(szProduct, szAll, dwReinstallMode);
272 UINT WINAPI MsiApplyPatchA(LPCSTR szPatchPackage, LPCSTR szInstallPackage,
273 INSTALLTYPE eInstallType, LPCSTR szCommandLine)
275 LPWSTR patch_package = NULL;
276 LPWSTR install_package = NULL;
277 LPWSTR command_line = NULL;
278 UINT r = ERROR_OUTOFMEMORY;
280 TRACE("%s %s %d %s\n", debugstr_a(szPatchPackage), debugstr_a(szInstallPackage),
281 eInstallType, debugstr_a(szCommandLine));
283 if (szPatchPackage && !(patch_package = strdupAtoW(szPatchPackage)))
286 if (szInstallPackage && !(install_package = strdupAtoW(szInstallPackage)))
289 if (szCommandLine && !(command_line = strdupAtoW(szCommandLine)))
292 r = MsiApplyPatchW(patch_package, install_package, eInstallType, command_line);
295 msi_free(patch_package);
296 msi_free(install_package);
297 msi_free(command_line);
302 static UINT MSI_ApplyPatchW(LPCWSTR szPatchPackage, LPCWSTR szProductCode, LPCWSTR szCommandLine)
304 MSIHANDLE patch = 0, info = 0;
305 UINT r = ERROR_SUCCESS, type;
307 LPCWSTR cmd_ptr = szCommandLine;
308 LPWSTR beg, end, cmd = NULL, codes = NULL;
309 BOOL succeeded = FALSE;
311 static const WCHAR patcheq[] = {'P','A','T','C','H','=',0};
312 static WCHAR empty[] = {0};
314 if (!szPatchPackage || !szPatchPackage[0])
315 return ERROR_INVALID_PARAMETER;
319 r = MsiOpenDatabaseW(szPatchPackage, MSIDBOPEN_READONLY, &patch);
320 if (r != ERROR_SUCCESS)
323 r = MsiGetSummaryInformationW(patch, NULL, 0, &info);
324 if (r != ERROR_SUCCESS)
327 r = MsiSummaryInfoGetPropertyW(info, PID_TEMPLATE, &type, NULL, NULL, empty, &size);
328 if (r != ERROR_MORE_DATA || !size || type != VT_LPSTR)
330 ERR("Failed to read product codes from patch\n");
334 codes = msi_alloc(++size * sizeof(WCHAR));
337 r = ERROR_OUTOFMEMORY;
341 r = MsiSummaryInfoGetPropertyW(info, PID_TEMPLATE, &type, NULL, NULL, codes, &size);
342 if (r != ERROR_SUCCESS)
349 size = lstrlenW(cmd_ptr) + lstrlenW(patcheq) + lstrlenW(szPatchPackage) + 1;
350 cmd = msi_alloc(size * sizeof(WCHAR));
353 r = ERROR_OUTOFMEMORY;
357 lstrcpyW(cmd, cmd_ptr);
358 if (szCommandLine) lstrcatW(cmd, szSpace);
359 lstrcatW(cmd, patcheq);
360 lstrcatW(cmd, szPatchPackage);
363 r = MsiConfigureProductExW(szProductCode, INSTALLLEVEL_DEFAULT, INSTALLSTATE_DEFAULT, cmd);
367 while ((end = strchrW(beg, '}')))
370 r = MsiConfigureProductExW(beg, INSTALLLEVEL_DEFAULT, INSTALLSTATE_DEFAULT, cmd);
371 if (r == ERROR_SUCCESS)
373 TRACE("patch applied\n");
387 MsiCloseHandle(info);
388 MsiCloseHandle(patch);
393 UINT WINAPI MsiApplyPatchW(LPCWSTR szPatchPackage, LPCWSTR szInstallPackage,
394 INSTALLTYPE eInstallType, LPCWSTR szCommandLine)
396 TRACE("%s %s %d %s\n", debugstr_w(szPatchPackage), debugstr_w(szInstallPackage),
397 eInstallType, debugstr_w(szCommandLine));
399 if (szInstallPackage || eInstallType == INSTALLTYPE_NETWORK_IMAGE ||
400 eInstallType == INSTALLTYPE_SINGLE_INSTANCE)
402 FIXME("Only reading target products from patch\n");
403 return ERROR_CALL_NOT_IMPLEMENTED;
406 return MSI_ApplyPatchW(szPatchPackage, NULL, szCommandLine);
409 UINT WINAPI MsiApplyMultiplePatchesA(LPCSTR szPatchPackages,
410 LPCSTR szProductCode, LPCSTR szPropertiesList)
412 LPWSTR patch_packages = NULL;
413 LPWSTR product_code = NULL;
414 LPWSTR properties_list = NULL;
415 UINT r = ERROR_OUTOFMEMORY;
417 TRACE("%s %s %s\n", debugstr_a(szPatchPackages), debugstr_a(szProductCode),
418 debugstr_a(szPropertiesList));
420 if (!szPatchPackages || !szPatchPackages[0])
421 return ERROR_INVALID_PARAMETER;
423 if (!(patch_packages = strdupAtoW(szPatchPackages)))
424 return ERROR_OUTOFMEMORY;
426 if (szProductCode && !(product_code = strdupAtoW(szProductCode)))
429 if (szPropertiesList && !(properties_list = strdupAtoW(szPropertiesList)))
432 r = MsiApplyMultiplePatchesW(patch_packages, product_code, properties_list);
435 msi_free(patch_packages);
436 msi_free(product_code);
437 msi_free(properties_list);
442 UINT WINAPI MsiApplyMultiplePatchesW(LPCWSTR szPatchPackages,
443 LPCWSTR szProductCode, LPCWSTR szPropertiesList)
445 UINT r = ERROR_SUCCESS;
448 TRACE("%s %s %s\n", debugstr_w(szPatchPackages), debugstr_w(szProductCode),
449 debugstr_w(szPropertiesList));
451 if (!szPatchPackages || !szPatchPackages[0])
452 return ERROR_INVALID_PARAMETER;
454 beg = end = szPatchPackages;
460 while (*beg == ' ') beg++;
461 while (*end && *end != ';') end++;
464 while (len && beg[len - 1] == ' ') len--;
466 if (!len) return ERROR_INVALID_NAME;
468 patch = msi_alloc((len + 1) * sizeof(WCHAR));
470 return ERROR_OUTOFMEMORY;
472 memcpy(patch, beg, len * sizeof(WCHAR));
475 r = MSI_ApplyPatchW(patch, szProductCode, szPropertiesList);
478 if (r != ERROR_SUCCESS)
486 UINT WINAPI MsiDetermineApplicablePatchesA(LPCSTR szProductPackagePath,
487 DWORD cPatchInfo, PMSIPATCHSEQUENCEINFOA pPatchInfo)
490 WCHAR *package_path = NULL;
491 MSIPATCHSEQUENCEINFOW *psi;
493 TRACE("(%s, %d, %p)\n", debugstr_a(szProductPackagePath), cPatchInfo, pPatchInfo);
495 if (szProductPackagePath && !(package_path = strdupAtoW( szProductPackagePath )))
496 return ERROR_OUTOFMEMORY;
498 psi = msi_alloc( cPatchInfo * sizeof(*psi) );
501 msi_free( package_path );
502 return ERROR_OUTOFMEMORY;
505 for (i = 0; i < cPatchInfo; i++)
507 psi[i].szPatchData = strdupAtoW( pPatchInfo[i].szPatchData );
508 psi[i].ePatchDataType = pPatchInfo[i].ePatchDataType;
511 r = MsiDetermineApplicablePatchesW( package_path, cPatchInfo, psi );
512 if (r == ERROR_SUCCESS)
514 for (i = 0; i < cPatchInfo; i++)
516 pPatchInfo[i].dwOrder = psi[i].dwOrder;
517 pPatchInfo[i].uStatus = psi[i].uStatus;
521 msi_free( package_path );
522 for (i = 0; i < cPatchInfo; i++)
523 msi_free( (WCHAR *)psi[i].szPatchData );
528 static UINT MSI_ApplicablePatchW( MSIPACKAGE *package, LPCWSTR patch )
531 MSIDATABASE *patch_db;
532 UINT r = ERROR_SUCCESS;
534 r = MSI_OpenDatabaseW( patch, MSIDBOPEN_READONLY, &patch_db );
535 if (r != ERROR_SUCCESS)
537 WARN("failed to open patch file %s\n", debugstr_w(patch));
541 si = MSI_GetSummaryInformationW( patch_db->storage, 0 );
544 r = ERROR_FUNCTION_FAILED;
548 r = msi_check_patch_applicable( package, si );
549 if (r != ERROR_SUCCESS)
550 TRACE("patch not applicable\n");
553 msiobj_release( &patch_db->hdr );
554 msiobj_release( &si->hdr );
558 UINT WINAPI MsiDetermineApplicablePatchesW(LPCWSTR szProductPackagePath,
559 DWORD cPatchInfo, PMSIPATCHSEQUENCEINFOW pPatchInfo)
561 UINT i, r, ret = ERROR_FUNCTION_FAILED;
564 TRACE("(%s, %d, %p)\n", debugstr_w(szProductPackagePath), cPatchInfo, pPatchInfo);
566 r = MSI_OpenPackageW( szProductPackagePath, &package );
567 if (r != ERROR_SUCCESS)
569 ERR("failed to open package %u\n", r);
573 for (i = 0; i < cPatchInfo; i++)
575 switch (pPatchInfo[i].ePatchDataType)
577 case MSIPATCH_DATATYPE_PATCHFILE:
579 FIXME("patch ordering not supported\n");
580 r = MSI_ApplicablePatchW( package, pPatchInfo[i].szPatchData );
581 if (r != ERROR_SUCCESS)
583 pPatchInfo[i].dwOrder = ~0u;
584 pPatchInfo[i].uStatus = ERROR_PATCH_TARGET_NOT_FOUND;
588 pPatchInfo[i].dwOrder = i;
589 pPatchInfo[i].uStatus = ret = ERROR_SUCCESS;
595 FIXME("patch data type %u not supported\n", pPatchInfo[i].ePatchDataType);
596 pPatchInfo[i].dwOrder = ~0u;
597 pPatchInfo[i].uStatus = ERROR_PATCH_TARGET_NOT_FOUND;
602 TRACE(" szPatchData: %s\n", debugstr_w(pPatchInfo[i].szPatchData));
603 TRACE("ePatchDataType: %u\n", pPatchInfo[i].ePatchDataType);
604 TRACE(" dwOrder: %u\n", pPatchInfo[i].dwOrder);
605 TRACE(" uStatus: %u\n", pPatchInfo[i].uStatus);
610 UINT WINAPI MsiDeterminePatchSequenceA(LPCSTR szProductCode, LPCSTR szUserSid,
611 MSIINSTALLCONTEXT dwContext, DWORD cPatchInfo, PMSIPATCHSEQUENCEINFOA pPatchInfo)
613 FIXME("(%s, %s, %d, %d, %p): stub!\n", debugstr_a(szProductCode),
614 debugstr_a(szUserSid), dwContext, cPatchInfo, pPatchInfo);
616 return ERROR_CALL_NOT_IMPLEMENTED;
619 UINT WINAPI MsiDeterminePatchSequenceW(LPCWSTR szProductCode, LPCWSTR szUserSid,
620 MSIINSTALLCONTEXT dwContext, DWORD cPatchInfo, PMSIPATCHSEQUENCEINFOW pPatchInfo)
622 FIXME("(%s, %s, %d, %d, %p): stub!\n", debugstr_w(szProductCode),
623 debugstr_w(szUserSid), dwContext, cPatchInfo, pPatchInfo);
625 return ERROR_CALL_NOT_IMPLEMENTED;
628 static UINT msi_open_package(LPCWSTR product, MSIINSTALLCONTEXT context,
629 MSIPACKAGE **package)
635 WCHAR sourcepath[MAX_PATH];
636 WCHAR filename[MAX_PATH];
638 r = MSIREG_OpenInstallProps(product, context, NULL, &props, FALSE);
639 if (r != ERROR_SUCCESS)
640 return ERROR_BAD_CONFIGURATION;
642 localpack = msi_reg_get_val_str(props, szLocalPackage);
645 lstrcpyW(sourcepath, localpack);
649 if (!localpack || GetFileAttributesW(sourcepath) == INVALID_FILE_ATTRIBUTES)
651 sz = sizeof(sourcepath);
652 MsiSourceListGetInfoW(product, NULL, context, MSICODE_PRODUCT,
653 INSTALLPROPERTY_LASTUSEDSOURCEW, sourcepath, &sz);
655 sz = sizeof(filename);
656 MsiSourceListGetInfoW(product, NULL, context, MSICODE_PRODUCT,
657 INSTALLPROPERTY_PACKAGENAMEW, filename, &sz);
659 lstrcatW(sourcepath, filename);
662 if (GetFileAttributesW(sourcepath) == INVALID_FILE_ATTRIBUTES)
663 return ERROR_INSTALL_SOURCE_ABSENT;
665 return MSI_OpenPackageW(sourcepath, package);
668 UINT WINAPI MsiConfigureProductExW(LPCWSTR szProduct, int iInstallLevel,
669 INSTALLSTATE eInstallState, LPCWSTR szCommandLine)
671 MSIPACKAGE* package = NULL;
672 MSIINSTALLCONTEXT context;
675 WCHAR sourcepath[MAX_PATH], filename[MAX_PATH];
678 static const WCHAR szInstalled[] = {
679 ' ','I','n','s','t','a','l','l','e','d','=','1',0};
680 static const WCHAR szRemoveAll[] = {
681 ' ','R','E','M','O','V','E','=','A','L','L',0};
682 static const WCHAR szMachine[] = {
683 ' ','A','L','L','U','S','E','R','S','=','1',0};
685 TRACE("%s %d %d %s\n",debugstr_w(szProduct), iInstallLevel, eInstallState,
686 debugstr_w(szCommandLine));
688 if (!szProduct || lstrlenW(szProduct) != GUID_SIZE - 1)
689 return ERROR_INVALID_PARAMETER;
691 if (eInstallState == INSTALLSTATE_ADVERTISED ||
692 eInstallState == INSTALLSTATE_SOURCE)
694 FIXME("State %d not implemented\n", eInstallState);
695 return ERROR_CALL_NOT_IMPLEMENTED;
698 r = msi_locate_product(szProduct, &context);
699 if (r != ERROR_SUCCESS)
702 r = msi_open_package(szProduct, context, &package);
703 if (r != ERROR_SUCCESS)
706 sz = lstrlenW(szInstalled) + 1;
709 sz += lstrlenW(szCommandLine);
711 if (eInstallState == INSTALLSTATE_ABSENT)
712 sz += lstrlenW(szRemoveAll);
714 if (context == MSIINSTALLCONTEXT_MACHINE)
715 sz += lstrlenW(szMachine);
717 commandline = msi_alloc(sz * sizeof(WCHAR));
720 r = ERROR_OUTOFMEMORY;
726 lstrcpyW(commandline,szCommandLine);
728 if (eInstallState == INSTALLSTATE_ABSENT)
729 lstrcatW(commandline, szRemoveAll);
731 if (context == MSIINSTALLCONTEXT_MACHINE)
732 lstrcatW(commandline, szMachine);
734 sz = sizeof(sourcepath);
735 MsiSourceListGetInfoW(szProduct, NULL, context, MSICODE_PRODUCT,
736 INSTALLPROPERTY_LASTUSEDSOURCEW, sourcepath, &sz);
738 sz = sizeof(filename);
739 MsiSourceListGetInfoW(szProduct, NULL, context, MSICODE_PRODUCT,
740 INSTALLPROPERTY_PACKAGENAMEW, filename, &sz);
742 strcatW(sourcepath, filename);
744 r = MSI_InstallPackage( package, sourcepath, commandline );
746 msi_free(commandline);
749 msiobj_release( &package->hdr );
754 UINT WINAPI MsiConfigureProductExA(LPCSTR szProduct, int iInstallLevel,
755 INSTALLSTATE eInstallState, LPCSTR szCommandLine)
757 LPWSTR szwProduct = NULL;
758 LPWSTR szwCommandLine = NULL;
759 UINT r = ERROR_OUTOFMEMORY;
763 szwProduct = strdupAtoW( szProduct );
770 szwCommandLine = strdupAtoW( szCommandLine );
775 r = MsiConfigureProductExW( szwProduct, iInstallLevel, eInstallState,
778 msi_free( szwProduct );
779 msi_free( szwCommandLine);
784 UINT WINAPI MsiConfigureProductA(LPCSTR szProduct, int iInstallLevel,
785 INSTALLSTATE eInstallState)
787 LPWSTR szwProduct = NULL;
790 TRACE("%s %d %d\n",debugstr_a(szProduct), iInstallLevel, eInstallState);
794 szwProduct = strdupAtoW( szProduct );
796 return ERROR_OUTOFMEMORY;
799 r = MsiConfigureProductW( szwProduct, iInstallLevel, eInstallState );
800 msi_free( szwProduct );
805 UINT WINAPI MsiConfigureProductW(LPCWSTR szProduct, int iInstallLevel,
806 INSTALLSTATE eInstallState)
808 return MsiConfigureProductExW(szProduct, iInstallLevel, eInstallState, NULL);
811 UINT WINAPI MsiGetProductCodeA(LPCSTR szComponent, LPSTR szBuffer)
813 LPWSTR szwComponent = NULL;
815 WCHAR szwBuffer[GUID_SIZE];
817 TRACE("%s %s\n",debugstr_a(szComponent), debugstr_a(szBuffer));
821 szwComponent = strdupAtoW( szComponent );
823 return ERROR_OUTOFMEMORY;
827 r = MsiGetProductCodeW( szwComponent, szwBuffer );
830 WideCharToMultiByte(CP_ACP, 0, szwBuffer, -1, szBuffer, GUID_SIZE, NULL, NULL);
832 msi_free( szwComponent );
837 UINT WINAPI MsiGetProductCodeW(LPCWSTR szComponent, LPWSTR szBuffer)
840 HKEY compkey, prodkey;
841 WCHAR squished_comp[GUID_SIZE];
842 WCHAR squished_prod[GUID_SIZE];
843 DWORD sz = GUID_SIZE;
845 TRACE("%s %p\n", debugstr_w(szComponent), szBuffer);
847 if (!szComponent || !*szComponent)
848 return ERROR_INVALID_PARAMETER;
850 if (!squash_guid(szComponent, squished_comp))
851 return ERROR_INVALID_PARAMETER;
853 if (MSIREG_OpenUserDataComponentKey(szComponent, NULL, &compkey, FALSE) != ERROR_SUCCESS &&
854 MSIREG_OpenUserDataComponentKey(szComponent, szLocalSid, &compkey, FALSE) != ERROR_SUCCESS)
856 return ERROR_UNKNOWN_COMPONENT;
859 rc = RegEnumValueW(compkey, 0, squished_prod, &sz, NULL, NULL, NULL, NULL);
860 if (rc != ERROR_SUCCESS)
862 RegCloseKey(compkey);
863 return ERROR_UNKNOWN_COMPONENT;
866 /* check simple case, only one product */
867 rc = RegEnumValueW(compkey, 1, squished_prod, &sz, NULL, NULL, NULL, NULL);
868 if (rc == ERROR_NO_MORE_ITEMS)
875 while ((rc = RegEnumValueW(compkey, index, squished_prod, &sz,
876 NULL, NULL, NULL, NULL)) != ERROR_NO_MORE_ITEMS)
880 unsquash_guid(squished_prod, szBuffer);
882 if (MSIREG_OpenProductKey(szBuffer, NULL,
883 MSIINSTALLCONTEXT_USERMANAGED,
884 &prodkey, FALSE) == ERROR_SUCCESS ||
885 MSIREG_OpenProductKey(szBuffer, NULL,
886 MSIINSTALLCONTEXT_USERUNMANAGED,
887 &prodkey, FALSE) == ERROR_SUCCESS ||
888 MSIREG_OpenProductKey(szBuffer, NULL,
889 MSIINSTALLCONTEXT_MACHINE,
890 &prodkey, FALSE) == ERROR_SUCCESS)
892 RegCloseKey(prodkey);
898 rc = ERROR_INSTALL_FAILURE;
901 RegCloseKey(compkey);
902 unsquash_guid(squished_prod, szBuffer);
906 static LPWSTR msi_reg_get_value(HKEY hkey, LPCWSTR name, DWORD *type)
912 static const WCHAR format[] = {'%','d',0};
914 res = RegQueryValueExW(hkey, name, NULL, type, NULL, NULL);
915 if (res != ERROR_SUCCESS)
919 return msi_reg_get_val_str(hkey, name);
921 if (!msi_reg_get_val_dword(hkey, name, &dval))
924 sprintfW(temp, format, dval);
925 return strdupW(temp);
928 static UINT MSI_GetProductInfo(LPCWSTR szProduct, LPCWSTR szAttribute,
929 awstring *szValue, LPDWORD pcchValueBuf)
931 MSIINSTALLCONTEXT context = MSIINSTALLCONTEXT_USERUNMANAGED;
932 UINT r = ERROR_UNKNOWN_PROPERTY;
933 HKEY prodkey, userdata, source;
935 WCHAR squished_pc[GUID_SIZE];
936 WCHAR packagecode[GUID_SIZE];
937 BOOL badconfig = FALSE;
939 DWORD type = REG_NONE;
941 static WCHAR empty[] = {0};
942 static const WCHAR sourcelist[] = {
943 'S','o','u','r','c','e','L','i','s','t',0};
944 static const WCHAR display_name[] = {
945 'D','i','s','p','l','a','y','N','a','m','e',0};
946 static const WCHAR display_version[] = {
947 'D','i','s','p','l','a','y','V','e','r','s','i','o','n',0};
948 static const WCHAR assignment[] = {
949 'A','s','s','i','g','n','m','e','n','t',0};
951 TRACE("%s %s %p %p\n", debugstr_w(szProduct),
952 debugstr_w(szAttribute), szValue, pcchValueBuf);
954 if ((szValue->str.w && !pcchValueBuf) || !szProduct || !szAttribute)
955 return ERROR_INVALID_PARAMETER;
957 if (!squash_guid(szProduct, squished_pc))
958 return ERROR_INVALID_PARAMETER;
960 if ((r = MSIREG_OpenProductKey(szProduct, NULL,
961 MSIINSTALLCONTEXT_USERMANAGED,
962 &prodkey, FALSE)) != ERROR_SUCCESS &&
963 (r = MSIREG_OpenProductKey(szProduct, NULL,
964 MSIINSTALLCONTEXT_USERUNMANAGED,
965 &prodkey, FALSE)) != ERROR_SUCCESS &&
966 (r = MSIREG_OpenProductKey(szProduct, NULL,
967 MSIINSTALLCONTEXT_MACHINE,
968 &prodkey, FALSE)) == ERROR_SUCCESS)
970 context = MSIINSTALLCONTEXT_MACHINE;
973 MSIREG_OpenInstallProps(szProduct, context, NULL, &userdata, FALSE);
975 if (!lstrcmpW(szAttribute, INSTALLPROPERTY_HELPLINKW) ||
976 !lstrcmpW(szAttribute, INSTALLPROPERTY_HELPTELEPHONEW) ||
977 !lstrcmpW(szAttribute, INSTALLPROPERTY_INSTALLDATEW) ||
978 !lstrcmpW(szAttribute, INSTALLPROPERTY_INSTALLEDPRODUCTNAMEW) ||
979 !lstrcmpW(szAttribute, INSTALLPROPERTY_INSTALLLOCATIONW) ||
980 !lstrcmpW(szAttribute, INSTALLPROPERTY_INSTALLSOURCEW) ||
981 !lstrcmpW(szAttribute, INSTALLPROPERTY_LOCALPACKAGEW) ||
982 !lstrcmpW(szAttribute, INSTALLPROPERTY_PUBLISHERW) ||
983 !lstrcmpW(szAttribute, INSTALLPROPERTY_URLINFOABOUTW) ||
984 !lstrcmpW(szAttribute, INSTALLPROPERTY_URLUPDATEINFOW) ||
985 !lstrcmpW(szAttribute, INSTALLPROPERTY_VERSIONMINORW) ||
986 !lstrcmpW(szAttribute, INSTALLPROPERTY_VERSIONMAJORW) ||
987 !lstrcmpW(szAttribute, INSTALLPROPERTY_VERSIONSTRINGW) ||
988 !lstrcmpW(szAttribute, INSTALLPROPERTY_PRODUCTIDW) ||
989 !lstrcmpW(szAttribute, INSTALLPROPERTY_REGCOMPANYW) ||
990 !lstrcmpW(szAttribute, INSTALLPROPERTY_REGOWNERW))
994 r = ERROR_UNKNOWN_PRODUCT;
999 return ERROR_UNKNOWN_PROPERTY;
1001 if (!lstrcmpW(szAttribute, INSTALLPROPERTY_INSTALLEDPRODUCTNAMEW))
1002 szAttribute = display_name;
1003 else if (!lstrcmpW(szAttribute, INSTALLPROPERTY_VERSIONSTRINGW))
1004 szAttribute = display_version;
1006 val = msi_reg_get_value(userdata, szAttribute, &type);
1010 else if (!lstrcmpW(szAttribute, INSTALLPROPERTY_INSTANCETYPEW) ||
1011 !lstrcmpW(szAttribute, INSTALLPROPERTY_TRANSFORMSW) ||
1012 !lstrcmpW(szAttribute, INSTALLPROPERTY_LANGUAGEW) ||
1013 !lstrcmpW(szAttribute, INSTALLPROPERTY_PRODUCTNAMEW) ||
1014 !lstrcmpW(szAttribute, INSTALLPROPERTY_ASSIGNMENTTYPEW) ||
1015 !lstrcmpW(szAttribute, INSTALLPROPERTY_PACKAGECODEW) ||
1016 !lstrcmpW(szAttribute, INSTALLPROPERTY_VERSIONW) ||
1017 !lstrcmpW(szAttribute, INSTALLPROPERTY_PRODUCTICONW) ||
1018 !lstrcmpW(szAttribute, INSTALLPROPERTY_PACKAGENAMEW) ||
1019 !lstrcmpW(szAttribute, INSTALLPROPERTY_AUTHORIZED_LUA_APPW))
1023 r = ERROR_UNKNOWN_PRODUCT;
1027 if (!lstrcmpW(szAttribute, INSTALLPROPERTY_ASSIGNMENTTYPEW))
1028 szAttribute = assignment;
1030 if (!lstrcmpW(szAttribute, INSTALLPROPERTY_PACKAGENAMEW))
1032 res = RegOpenKeyW(prodkey, sourcelist, &source);
1033 if (res != ERROR_SUCCESS)
1035 r = ERROR_UNKNOWN_PRODUCT;
1039 val = msi_reg_get_value(source, szAttribute, &type);
1043 RegCloseKey(source);
1047 val = msi_reg_get_value(prodkey, szAttribute, &type);
1052 if (val != empty && type != REG_DWORD &&
1053 !lstrcmpW(szAttribute, INSTALLPROPERTY_PACKAGECODEW))
1055 if (lstrlenW(val) != SQUISH_GUID_SIZE - 1)
1059 unsquash_guid(val, packagecode);
1061 val = strdupW(packagecode);
1068 r = ERROR_UNKNOWN_PROPERTY;
1074 /* If szBuffer (szValue->str) is NULL, there's no need to copy the value
1075 * out. Also, *pcchValueBuf may be uninitialized in this case, so we
1076 * can't rely on its value.
1078 if (szValue->str.a || szValue->str.w)
1080 DWORD size = *pcchValueBuf;
1081 if (strlenW(val) < size)
1082 r = msi_strcpy_to_awstring(val, szValue, &size);
1085 r = ERROR_MORE_DATA;
1090 *pcchValueBuf = lstrlenW(val);
1094 r = ERROR_BAD_CONFIGURATION;
1100 RegCloseKey(prodkey);
1101 RegCloseKey(userdata);
1105 UINT WINAPI MsiGetProductInfoA(LPCSTR szProduct, LPCSTR szAttribute,
1106 LPSTR szBuffer, LPDWORD pcchValueBuf)
1108 LPWSTR szwProduct, szwAttribute = NULL;
1109 UINT r = ERROR_OUTOFMEMORY;
1112 TRACE("%s %s %p %p\n", debugstr_a(szProduct), debugstr_a(szAttribute),
1113 szBuffer, pcchValueBuf);
1115 szwProduct = strdupAtoW( szProduct );
1116 if( szProduct && !szwProduct )
1119 szwAttribute = strdupAtoW( szAttribute );
1120 if( szAttribute && !szwAttribute )
1123 buffer.unicode = FALSE;
1124 buffer.str.a = szBuffer;
1126 r = MSI_GetProductInfo( szwProduct, szwAttribute,
1127 &buffer, pcchValueBuf );
1130 msi_free( szwProduct );
1131 msi_free( szwAttribute );
1136 UINT WINAPI MsiGetProductInfoW(LPCWSTR szProduct, LPCWSTR szAttribute,
1137 LPWSTR szBuffer, LPDWORD pcchValueBuf)
1141 TRACE("%s %s %p %p\n", debugstr_w(szProduct), debugstr_w(szAttribute),
1142 szBuffer, pcchValueBuf);
1144 buffer.unicode = TRUE;
1145 buffer.str.w = szBuffer;
1147 return MSI_GetProductInfo( szProduct, szAttribute,
1148 &buffer, pcchValueBuf );
1151 UINT WINAPI MsiGetProductInfoExA(LPCSTR szProductCode, LPCSTR szUserSid,
1152 MSIINSTALLCONTEXT dwContext, LPCSTR szProperty,
1153 LPSTR szValue, LPDWORD pcchValue)
1155 LPWSTR product = NULL;
1156 LPWSTR usersid = NULL;
1157 LPWSTR property = NULL;
1158 LPWSTR value = NULL;
1162 TRACE("(%s, %s, %d, %s, %p, %p)\n", debugstr_a(szProductCode),
1163 debugstr_a(szUserSid), dwContext, debugstr_a(szProperty),
1164 szValue, pcchValue);
1166 if (szValue && !pcchValue)
1167 return ERROR_INVALID_PARAMETER;
1169 if (szProductCode) product = strdupAtoW(szProductCode);
1170 if (szUserSid) usersid = strdupAtoW(szUserSid);
1171 if (szProperty) property = strdupAtoW(szProperty);
1173 r = MsiGetProductInfoExW(product, usersid, dwContext, property,
1175 if (r != ERROR_SUCCESS)
1178 value = msi_alloc(++len * sizeof(WCHAR));
1181 r = ERROR_OUTOFMEMORY;
1185 r = MsiGetProductInfoExW(product, usersid, dwContext, property,
1187 if (r != ERROR_SUCCESS)
1193 len = WideCharToMultiByte(CP_ACP, 0, value, -1, NULL, 0, NULL, NULL);
1194 if (*pcchValue >= len)
1195 WideCharToMultiByte(CP_ACP, 0, value, -1, szValue, len, NULL, NULL);
1198 r = ERROR_MORE_DATA;
1203 if (*pcchValue <= len || !szValue)
1204 len = len * sizeof(WCHAR) - 1;
1206 *pcchValue = len - 1;
1217 static UINT msi_copy_outval(LPWSTR val, LPWSTR out, LPDWORD size)
1222 return ERROR_UNKNOWN_PROPERTY;
1226 if (strlenW(val) >= *size)
1228 r = ERROR_MORE_DATA;
1237 *size = lstrlenW(val);
1239 return ERROR_SUCCESS;
1242 UINT WINAPI MsiGetProductInfoExW(LPCWSTR szProductCode, LPCWSTR szUserSid,
1243 MSIINSTALLCONTEXT dwContext, LPCWSTR szProperty,
1244 LPWSTR szValue, LPDWORD pcchValue)
1246 WCHAR squished_pc[GUID_SIZE];
1248 LPCWSTR package = NULL;
1249 HKEY props = NULL, prod;
1250 HKEY classes = NULL, managed;
1253 UINT r = ERROR_UNKNOWN_PRODUCT;
1255 static const WCHAR five[] = {'5',0};
1256 static const WCHAR displayname[] = {
1257 'D','i','s','p','l','a','y','N','a','m','e',0};
1258 static const WCHAR displayversion[] = {
1259 'D','i','s','p','l','a','y','V','e','r','s','i','o','n',0};
1260 static const WCHAR managed_local_package[] = {
1261 'M','a','n','a','g','e','d','L','o','c','a','l',
1262 'P','a','c','k','a','g','e',0};
1264 TRACE("(%s, %s, %d, %s, %p, %p)\n", debugstr_w(szProductCode),
1265 debugstr_w(szUserSid), dwContext, debugstr_w(szProperty),
1266 szValue, pcchValue);
1268 if (!szProductCode || !squash_guid(szProductCode, squished_pc))
1269 return ERROR_INVALID_PARAMETER;
1271 if (szValue && !pcchValue)
1272 return ERROR_INVALID_PARAMETER;
1274 if (dwContext != MSIINSTALLCONTEXT_USERUNMANAGED &&
1275 dwContext != MSIINSTALLCONTEXT_USERMANAGED &&
1276 dwContext != MSIINSTALLCONTEXT_MACHINE)
1277 return ERROR_INVALID_PARAMETER;
1279 if (!szProperty || !*szProperty)
1280 return ERROR_INVALID_PARAMETER;
1282 if (dwContext == MSIINSTALLCONTEXT_MACHINE && szUserSid)
1283 return ERROR_INVALID_PARAMETER;
1285 /* FIXME: dwContext is provided, no need to search for it */
1286 MSIREG_OpenProductKey(szProductCode, NULL,MSIINSTALLCONTEXT_USERMANAGED,
1288 MSIREG_OpenProductKey(szProductCode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED,
1291 MSIREG_OpenInstallProps(szProductCode, dwContext, NULL, &props, FALSE);
1293 if (dwContext == MSIINSTALLCONTEXT_USERUNMANAGED)
1295 package = INSTALLPROPERTY_LOCALPACKAGEW;
1297 if (!props && !prod)
1300 else if (dwContext == MSIINSTALLCONTEXT_USERMANAGED)
1302 package = managed_local_package;
1304 if (!props && !managed)
1307 else if (dwContext == MSIINSTALLCONTEXT_MACHINE)
1309 package = INSTALLPROPERTY_LOCALPACKAGEW;
1310 MSIREG_OpenProductKey(szProductCode, NULL, dwContext, &classes, FALSE);
1312 if (!props && !classes)
1316 if (!lstrcmpW(szProperty, INSTALLPROPERTY_HELPLINKW) ||
1317 !lstrcmpW(szProperty, INSTALLPROPERTY_HELPTELEPHONEW) ||
1318 !lstrcmpW(szProperty, INSTALLPROPERTY_INSTALLDATEW) ||
1319 !lstrcmpW(szProperty, INSTALLPROPERTY_INSTALLEDPRODUCTNAMEW) ||
1320 !lstrcmpW(szProperty, INSTALLPROPERTY_INSTALLLOCATIONW) ||
1321 !lstrcmpW(szProperty, INSTALLPROPERTY_INSTALLSOURCEW) ||
1322 !lstrcmpW(szProperty, INSTALLPROPERTY_LOCALPACKAGEW) ||
1323 !lstrcmpW(szProperty, INSTALLPROPERTY_PUBLISHERW) ||
1324 !lstrcmpW(szProperty, INSTALLPROPERTY_URLINFOABOUTW) ||
1325 !lstrcmpW(szProperty, INSTALLPROPERTY_URLUPDATEINFOW) ||
1326 !lstrcmpW(szProperty, INSTALLPROPERTY_VERSIONMINORW) ||
1327 !lstrcmpW(szProperty, INSTALLPROPERTY_VERSIONMAJORW) ||
1328 !lstrcmpW(szProperty, INSTALLPROPERTY_VERSIONSTRINGW) ||
1329 !lstrcmpW(szProperty, INSTALLPROPERTY_PRODUCTIDW) ||
1330 !lstrcmpW(szProperty, INSTALLPROPERTY_REGCOMPANYW) ||
1331 !lstrcmpW(szProperty, INSTALLPROPERTY_REGOWNERW) ||
1332 !lstrcmpW(szProperty, INSTALLPROPERTY_INSTANCETYPEW))
1334 val = msi_reg_get_value(props, package, &type);
1337 if (prod || classes)
1338 r = ERROR_UNKNOWN_PROPERTY;
1345 if (!lstrcmpW(szProperty, INSTALLPROPERTY_INSTALLEDPRODUCTNAMEW))
1346 szProperty = displayname;
1347 else if (!lstrcmpW(szProperty, INSTALLPROPERTY_VERSIONSTRINGW))
1348 szProperty = displayversion;
1350 val = msi_reg_get_value(props, szProperty, &type);
1352 val = strdupW(szEmpty);
1354 r = msi_copy_outval(val, szValue, pcchValue);
1356 else if (!lstrcmpW(szProperty, INSTALLPROPERTY_TRANSFORMSW) ||
1357 !lstrcmpW(szProperty, INSTALLPROPERTY_LANGUAGEW) ||
1358 !lstrcmpW(szProperty, INSTALLPROPERTY_PRODUCTNAMEW) ||
1359 !lstrcmpW(szProperty, INSTALLPROPERTY_PACKAGECODEW) ||
1360 !lstrcmpW(szProperty, INSTALLPROPERTY_VERSIONW) ||
1361 !lstrcmpW(szProperty, INSTALLPROPERTY_PRODUCTICONW) ||
1362 !lstrcmpW(szProperty, INSTALLPROPERTY_PACKAGENAMEW) ||
1363 !lstrcmpW(szProperty, INSTALLPROPERTY_AUTHORIZED_LUA_APPW))
1365 if (!prod && !classes)
1368 if (dwContext == MSIINSTALLCONTEXT_USERUNMANAGED)
1370 else if (dwContext == MSIINSTALLCONTEXT_USERMANAGED)
1372 else if (dwContext == MSIINSTALLCONTEXT_MACHINE)
1375 val = msi_reg_get_value(hkey, szProperty, &type);
1377 val = strdupW(szEmpty);
1379 r = msi_copy_outval(val, szValue, pcchValue);
1381 else if (!lstrcmpW(szProperty, INSTALLPROPERTY_PRODUCTSTATEW))
1383 if (dwContext == MSIINSTALLCONTEXT_MACHINE)
1387 val = msi_reg_get_value(props, package, &type);
1392 val = strdupW(five);
1395 val = strdupW(szOne);
1397 r = msi_copy_outval(val, szValue, pcchValue);
1400 else if (props && (val = msi_reg_get_value(props, package, &type)))
1403 val = strdupW(five);
1404 r = msi_copy_outval(val, szValue, pcchValue);
1408 if (prod || managed)
1409 val = strdupW(szOne);
1413 r = msi_copy_outval(val, szValue, pcchValue);
1415 else if (!lstrcmpW(szProperty, INSTALLPROPERTY_ASSIGNMENTTYPEW))
1417 if (!prod && !classes)
1421 val = strdupW(szEmpty);
1422 r = msi_copy_outval(val, szValue, pcchValue);
1425 r = ERROR_UNKNOWN_PROPERTY;
1430 RegCloseKey(managed);
1431 RegCloseKey(classes);
1437 UINT WINAPI MsiGetPatchInfoExA(LPCSTR szPatchCode, LPCSTR szProductCode,
1438 LPCSTR szUserSid, MSIINSTALLCONTEXT dwContext,
1439 LPCSTR szProperty, LPSTR lpValue, DWORD *pcchValue)
1441 LPWSTR patch = NULL, product = NULL, usersid = NULL;
1442 LPWSTR property = NULL, val = NULL;
1446 TRACE("(%s, %s, %s, %d, %s, %p, %p)\n", debugstr_a(szPatchCode),
1447 debugstr_a(szProductCode), debugstr_a(szUserSid), dwContext,
1448 debugstr_a(szProperty), lpValue, pcchValue);
1450 if (lpValue && !pcchValue)
1451 return ERROR_INVALID_PARAMETER;
1453 if (szPatchCode) patch = strdupAtoW(szPatchCode);
1454 if (szProductCode) product = strdupAtoW(szProductCode);
1455 if (szUserSid) usersid = strdupAtoW(szUserSid);
1456 if (szProperty) property = strdupAtoW(szProperty);
1459 r = MsiGetPatchInfoExW(patch, product, usersid, dwContext, property,
1461 if (r != ERROR_SUCCESS)
1464 val = msi_alloc(++len * sizeof(WCHAR));
1467 r = ERROR_OUTOFMEMORY;
1471 r = MsiGetPatchInfoExW(patch, product, usersid, dwContext, property,
1473 if (r != ERROR_SUCCESS || !pcchValue)
1477 WideCharToMultiByte(CP_ACP, 0, val, -1, lpValue,
1478 *pcchValue - 1, NULL, NULL);
1480 len = lstrlenW(val);
1481 if ((*val && *pcchValue < len + 1) || !lpValue)
1485 r = ERROR_MORE_DATA;
1486 lpValue[*pcchValue - 1] = '\0';
1489 *pcchValue = len * sizeof(WCHAR);
1504 UINT WINAPI MsiGetPatchInfoExW(LPCWSTR szPatchCode, LPCWSTR szProductCode,
1505 LPCWSTR szUserSid, MSIINSTALLCONTEXT dwContext,
1506 LPCWSTR szProperty, LPWSTR lpValue, DWORD *pcchValue)
1508 WCHAR squished_pc[GUID_SIZE];
1509 WCHAR squished_patch[GUID_SIZE];
1510 HKEY udprod = 0, prod = 0, props = 0;
1511 HKEY patch = 0, patches = 0;
1512 HKEY udpatch = 0, datakey = 0;
1513 HKEY prodpatches = 0;
1515 UINT r = ERROR_UNKNOWN_PRODUCT;
1519 static const WCHAR szManagedPackage[] = {'M','a','n','a','g','e','d',
1520 'L','o','c','a','l','P','a','c','k','a','g','e',0};
1522 TRACE("(%s, %s, %s, %d, %s, %p, %p)\n", debugstr_w(szPatchCode),
1523 debugstr_w(szProductCode), debugstr_w(szUserSid), dwContext,
1524 debugstr_w(szProperty), lpValue, pcchValue);
1526 if (!szProductCode || !squash_guid(szProductCode, squished_pc))
1527 return ERROR_INVALID_PARAMETER;
1529 if (!szPatchCode || !squash_guid(szPatchCode, squished_patch))
1530 return ERROR_INVALID_PARAMETER;
1533 return ERROR_INVALID_PARAMETER;
1535 if (lpValue && !pcchValue)
1536 return ERROR_INVALID_PARAMETER;
1538 if (dwContext != MSIINSTALLCONTEXT_USERMANAGED &&
1539 dwContext != MSIINSTALLCONTEXT_USERUNMANAGED &&
1540 dwContext != MSIINSTALLCONTEXT_MACHINE)
1541 return ERROR_INVALID_PARAMETER;
1543 if (dwContext == MSIINSTALLCONTEXT_MACHINE && szUserSid)
1544 return ERROR_INVALID_PARAMETER;
1546 if (!lstrcmpW(szUserSid, szLocalSid))
1547 return ERROR_INVALID_PARAMETER;
1549 if (MSIREG_OpenUserDataProductKey(szProductCode, dwContext, NULL,
1550 &udprod, FALSE) != ERROR_SUCCESS)
1553 if (MSIREG_OpenInstallProps(szProductCode, dwContext, NULL,
1554 &props, FALSE) != ERROR_SUCCESS)
1557 r = ERROR_UNKNOWN_PATCH;
1559 res = RegOpenKeyExW(udprod, szPatches, 0, KEY_READ, &patches);
1560 if (res != ERROR_SUCCESS)
1563 res = RegOpenKeyExW(patches, squished_patch, 0, KEY_READ, &patch);
1564 if (res != ERROR_SUCCESS)
1567 if (!lstrcmpW(szProperty, INSTALLPROPERTY_TRANSFORMSW))
1569 if (MSIREG_OpenProductKey(szProductCode, NULL, dwContext,
1570 &prod, FALSE) != ERROR_SUCCESS)
1573 res = RegOpenKeyExW(prod, szPatches, 0, KEY_ALL_ACCESS, &prodpatches);
1574 if (res != ERROR_SUCCESS)
1577 datakey = prodpatches;
1578 szProperty = squished_patch;
1582 if (MSIREG_OpenUserDataPatchKey(szPatchCode, dwContext,
1583 &udpatch, FALSE) != ERROR_SUCCESS)
1586 if (!lstrcmpW(szProperty, INSTALLPROPERTY_LOCALPACKAGEW))
1588 if (dwContext == MSIINSTALLCONTEXT_USERMANAGED)
1589 szProperty = szManagedPackage;
1592 else if (!lstrcmpW(szProperty, INSTALLPROPERTY_INSTALLDATEW))
1595 szProperty = szInstalled;
1597 else if (!lstrcmpW(szProperty, INSTALLPROPERTY_LOCALPACKAGEW))
1601 else if (!lstrcmpW(szProperty, INSTALLPROPERTY_UNINSTALLABLEW) ||
1602 !lstrcmpW(szProperty, INSTALLPROPERTY_PATCHSTATEW) ||
1603 !lstrcmpW(szProperty, INSTALLPROPERTY_DISPLAYNAMEW) ||
1604 !lstrcmpW(szProperty, INSTALLPROPERTY_MOREINFOURLW))
1610 r = ERROR_UNKNOWN_PROPERTY;
1615 val = msi_reg_get_val_str(datakey, szProperty);
1617 val = strdupW(szEmpty);
1625 lstrcpynW(lpValue, val, *pcchValue);
1627 len = lstrlenW(val);
1628 if ((*val && *pcchValue < len + 1) || !lpValue)
1631 r = ERROR_MORE_DATA;
1633 *pcchValue = len * sizeof(WCHAR);
1640 RegCloseKey(prodpatches);
1643 RegCloseKey(patches);
1644 RegCloseKey(udpatch);
1646 RegCloseKey(udprod);
1651 UINT WINAPI MsiGetPatchInfoA( LPCSTR patch, LPCSTR attr, LPSTR buffer, LPDWORD buflen )
1653 UINT r = ERROR_OUTOFMEMORY;
1655 LPWSTR patchW = NULL, attrW = NULL, bufferW = NULL;
1657 TRACE("%s %s %p %p\n", debugstr_a(patch), debugstr_a(attr), buffer, buflen);
1659 if (!patch || !attr)
1660 return ERROR_INVALID_PARAMETER;
1662 if (!(patchW = strdupAtoW( patch )))
1665 if (!(attrW = strdupAtoW( attr )))
1669 r = MsiGetPatchInfoW( patchW, attrW, NULL, &size );
1670 if (r != ERROR_SUCCESS)
1674 if (!(bufferW = msi_alloc( size * sizeof(WCHAR) )))
1676 r = ERROR_OUTOFMEMORY;
1680 r = MsiGetPatchInfoW( patchW, attrW, bufferW, &size );
1681 if (r == ERROR_SUCCESS)
1683 int len = WideCharToMultiByte( CP_ACP, 0, bufferW, -1, NULL, 0, NULL, NULL );
1685 r = ERROR_MORE_DATA;
1687 WideCharToMultiByte( CP_ACP, 0, bufferW, -1, buffer, *buflen, NULL, NULL );
1695 msi_free( bufferW );
1699 UINT WINAPI MsiGetPatchInfoW( LPCWSTR patch, LPCWSTR attr, LPWSTR buffer, LPDWORD buflen )
1702 WCHAR product[GUID_SIZE];
1705 TRACE("%s %s %p %p\n", debugstr_w(patch), debugstr_w(attr), buffer, buflen);
1707 if (!patch || !attr)
1708 return ERROR_INVALID_PARAMETER;
1710 if (strcmpW( INSTALLPROPERTY_LOCALPACKAGEW, attr ))
1711 return ERROR_UNKNOWN_PROPERTY;
1716 r = MsiEnumProductsW( index, product );
1717 if (r != ERROR_SUCCESS)
1720 r = MsiGetPatchInfoExW( patch, product, NULL, MSIINSTALLCONTEXT_USERMANAGED, attr, buffer, buflen );
1721 if (r == ERROR_SUCCESS || r == ERROR_MORE_DATA)
1724 r = MsiGetPatchInfoExW( patch, product, NULL, MSIINSTALLCONTEXT_USERUNMANAGED, attr, buffer, buflen );
1725 if (r == ERROR_SUCCESS || r == ERROR_MORE_DATA)
1728 r = MsiGetPatchInfoExW( patch, product, NULL, MSIINSTALLCONTEXT_MACHINE, attr, buffer, buflen );
1729 if (r == ERROR_SUCCESS || r == ERROR_MORE_DATA)
1735 return ERROR_UNKNOWN_PRODUCT;
1738 UINT WINAPI MsiEnableLogA(DWORD dwLogMode, LPCSTR szLogFile, DWORD attributes)
1740 LPWSTR szwLogFile = NULL;
1743 TRACE("%08x %s %08x\n", dwLogMode, debugstr_a(szLogFile), attributes);
1747 szwLogFile = strdupAtoW( szLogFile );
1749 return ERROR_OUTOFMEMORY;
1751 r = MsiEnableLogW( dwLogMode, szwLogFile, attributes );
1752 msi_free( szwLogFile );
1756 UINT WINAPI MsiEnableLogW(DWORD dwLogMode, LPCWSTR szLogFile, DWORD attributes)
1758 HANDLE file = INVALID_HANDLE_VALUE;
1760 TRACE("%08x %s %08x\n", dwLogMode, debugstr_w(szLogFile), attributes);
1764 lstrcpyW(gszLogFile,szLogFile);
1765 if (!(attributes & INSTALLLOGATTRIBUTES_APPEND))
1766 DeleteFileW(szLogFile);
1767 file = CreateFileW(szLogFile, GENERIC_WRITE, 0, NULL, OPEN_ALWAYS,
1768 FILE_ATTRIBUTE_NORMAL, NULL);
1769 if (file != INVALID_HANDLE_VALUE)
1772 ERR("Unable to enable log %s\n",debugstr_w(szLogFile));
1775 gszLogFile[0] = '\0';
1777 return ERROR_SUCCESS;
1780 UINT WINAPI MsiEnumComponentCostsW(MSIHANDLE hInstall, LPCWSTR szComponent,
1781 DWORD dwIndex, INSTALLSTATE iState,
1782 LPWSTR lpDriveBuf, DWORD *pcchDriveBuf,
1783 int *piCost, int *pTempCost)
1785 FIXME("(%d, %s, %d, %d, %p, %p, %p %p): stub!\n", hInstall,
1786 debugstr_w(szComponent), dwIndex, iState, lpDriveBuf,
1787 pcchDriveBuf, piCost, pTempCost);
1789 return ERROR_NO_MORE_ITEMS;
1792 UINT WINAPI MsiQueryComponentStateA(LPCSTR szProductCode,
1793 LPCSTR szUserSid, MSIINSTALLCONTEXT dwContext,
1794 LPCSTR szComponent, INSTALLSTATE *pdwState)
1796 LPWSTR prodcode = NULL, usersid = NULL, comp = NULL;
1799 TRACE("(%s, %s, %d, %s, %p)\n", debugstr_a(szProductCode),
1800 debugstr_a(szUserSid), dwContext, debugstr_a(szComponent), pdwState);
1802 if (szProductCode && !(prodcode = strdupAtoW(szProductCode)))
1803 return ERROR_OUTOFMEMORY;
1805 if (szUserSid && !(usersid = strdupAtoW(szUserSid)))
1806 return ERROR_OUTOFMEMORY;
1808 if (szComponent && !(comp = strdupAtoW(szComponent)))
1809 return ERROR_OUTOFMEMORY;
1811 r = MsiQueryComponentStateW(prodcode, usersid, dwContext, comp, pdwState);
1820 static BOOL msi_comp_find_prod_key(LPCWSTR prodcode, MSIINSTALLCONTEXT context)
1825 r = MSIREG_OpenProductKey(prodcode, NULL, context, &hkey, FALSE);
1827 return (r == ERROR_SUCCESS);
1830 static BOOL msi_comp_find_package(LPCWSTR prodcode, MSIINSTALLCONTEXT context)
1838 static const WCHAR local_package[] = {'L','o','c','a','l','P','a','c','k','a','g','e',0};
1839 static const WCHAR managed_local_package[] = {
1840 'M','a','n','a','g','e','d','L','o','c','a','l','P','a','c','k','a','g','e',0
1843 r = MSIREG_OpenInstallProps(prodcode, context, NULL, &hkey, FALSE);
1844 if (r != ERROR_SUCCESS)
1847 if (context == MSIINSTALLCONTEXT_USERMANAGED)
1848 package = managed_local_package;
1850 package = local_package;
1853 res = RegQueryValueExW(hkey, package, NULL, NULL, NULL, &sz);
1856 return (res == ERROR_SUCCESS);
1859 static BOOL msi_comp_find_prodcode(LPWSTR squished_pc,
1860 MSIINSTALLCONTEXT context,
1861 LPCWSTR comp, LPWSTR val, DWORD *sz)
1867 if (context == MSIINSTALLCONTEXT_MACHINE)
1868 r = MSIREG_OpenUserDataComponentKey(comp, szLocalSid, &hkey, FALSE);
1870 r = MSIREG_OpenUserDataComponentKey(comp, NULL, &hkey, FALSE);
1872 if (r != ERROR_SUCCESS)
1875 res = RegQueryValueExW(hkey, squished_pc, NULL, NULL, (BYTE *)val, sz);
1876 if (res != ERROR_SUCCESS)
1883 UINT WINAPI MsiQueryComponentStateW(LPCWSTR szProductCode,
1884 LPCWSTR szUserSid, MSIINSTALLCONTEXT dwContext,
1885 LPCWSTR szComponent, INSTALLSTATE *pdwState)
1887 WCHAR squished_pc[GUID_SIZE];
1888 WCHAR val[MAX_PATH];
1892 TRACE("(%s, %s, %d, %s, %p)\n", debugstr_w(szProductCode),
1893 debugstr_w(szUserSid), dwContext, debugstr_w(szComponent), pdwState);
1895 if (!pdwState || !szComponent)
1896 return ERROR_INVALID_PARAMETER;
1898 if (!szProductCode || !*szProductCode || lstrlenW(szProductCode) != GUID_SIZE - 1)
1899 return ERROR_INVALID_PARAMETER;
1901 if (!squash_guid(szProductCode, squished_pc))
1902 return ERROR_INVALID_PARAMETER;
1904 found = msi_comp_find_prod_key(szProductCode, dwContext);
1906 if (!msi_comp_find_package(szProductCode, dwContext))
1910 *pdwState = INSTALLSTATE_UNKNOWN;
1911 return ERROR_UNKNOWN_COMPONENT;
1914 return ERROR_UNKNOWN_PRODUCT;
1917 *pdwState = INSTALLSTATE_UNKNOWN;
1920 if (!msi_comp_find_prodcode(squished_pc, dwContext, szComponent, val, &sz))
1921 return ERROR_UNKNOWN_COMPONENT;
1924 *pdwState = INSTALLSTATE_NOTUSED;
1927 if (lstrlenW(val) > 2 &&
1928 val[0] >= '0' && val[0] <= '9' && val[1] >= '0' && val[1] <= '9')
1930 *pdwState = INSTALLSTATE_SOURCE;
1933 *pdwState = INSTALLSTATE_LOCAL;
1936 return ERROR_SUCCESS;
1939 INSTALLSTATE WINAPI MsiQueryProductStateA(LPCSTR szProduct)
1941 LPWSTR szwProduct = NULL;
1946 szwProduct = strdupAtoW( szProduct );
1948 return ERROR_OUTOFMEMORY;
1950 r = MsiQueryProductStateW( szwProduct );
1951 msi_free( szwProduct );
1955 INSTALLSTATE WINAPI MsiQueryProductStateW(LPCWSTR szProduct)
1957 MSIINSTALLCONTEXT context = MSIINSTALLCONTEXT_USERUNMANAGED;
1958 INSTALLSTATE state = INSTALLSTATE_ADVERTISED;
1959 HKEY prodkey = 0, userdata = 0;
1963 static const WCHAR szWindowsInstaller[] = {
1964 'W','i','n','d','o','w','s','I','n','s','t','a','l','l','e','r',0};
1966 TRACE("%s\n", debugstr_w(szProduct));
1968 if (!szProduct || !*szProduct)
1969 return INSTALLSTATE_INVALIDARG;
1971 if (lstrlenW(szProduct) != GUID_SIZE - 1)
1972 return INSTALLSTATE_INVALIDARG;
1974 if (MSIREG_OpenProductKey(szProduct, NULL, MSIINSTALLCONTEXT_USERMANAGED,
1975 &prodkey, FALSE) != ERROR_SUCCESS &&
1976 MSIREG_OpenProductKey(szProduct, NULL, MSIINSTALLCONTEXT_USERUNMANAGED,
1977 &prodkey, FALSE) != ERROR_SUCCESS &&
1978 MSIREG_OpenProductKey(szProduct, NULL, MSIINSTALLCONTEXT_MACHINE,
1979 &prodkey, FALSE) == ERROR_SUCCESS)
1981 context = MSIINSTALLCONTEXT_MACHINE;
1984 r = MSIREG_OpenInstallProps(szProduct, context, NULL, &userdata, FALSE);
1985 if (r != ERROR_SUCCESS)
1988 if (!msi_reg_get_val_dword(userdata, szWindowsInstaller, &val))
1992 state = INSTALLSTATE_DEFAULT;
1994 state = INSTALLSTATE_UNKNOWN;
1999 state = INSTALLSTATE_UNKNOWN;
2002 state = INSTALLSTATE_ABSENT;
2005 RegCloseKey(prodkey);
2006 RegCloseKey(userdata);
2010 INSTALLUILEVEL WINAPI MsiSetInternalUI(INSTALLUILEVEL dwUILevel, HWND *phWnd)
2012 INSTALLUILEVEL old = gUILevel;
2013 HWND oldwnd = gUIhwnd;
2015 TRACE("%08x %p\n", dwUILevel, phWnd);
2017 gUILevel = dwUILevel;
2026 INSTALLUI_HANDLERA WINAPI MsiSetExternalUIA(INSTALLUI_HANDLERA puiHandler,
2027 DWORD dwMessageFilter, LPVOID pvContext)
2029 INSTALLUI_HANDLERA prev = gUIHandlerA;
2031 TRACE("%p %08x %p\n", puiHandler, dwMessageFilter, pvContext);
2033 gUIHandlerA = puiHandler;
2035 gUIFilter = dwMessageFilter;
2036 gUIContext = pvContext;
2041 INSTALLUI_HANDLERW WINAPI MsiSetExternalUIW(INSTALLUI_HANDLERW puiHandler,
2042 DWORD dwMessageFilter, LPVOID pvContext)
2044 INSTALLUI_HANDLERW prev = gUIHandlerW;
2046 TRACE("%p %08x %p\n", puiHandler, dwMessageFilter, pvContext);
2049 gUIHandlerW = puiHandler;
2050 gUIFilter = dwMessageFilter;
2051 gUIContext = pvContext;
2056 /******************************************************************
2057 * MsiLoadStringW [MSI.@]
2059 * Loads a string from MSI's string resources.
2063 * handle [I] only -1 is handled currently
2064 * id [I] id of the string to be loaded
2065 * lpBuffer [O] buffer for the string to be written to
2066 * nBufferMax [I] maximum size of the buffer in characters
2067 * lang [I] the preferred language for the string
2071 * If successful, this function returns the language id of the string loaded
2072 * If the function fails, the function returns zero.
2076 * The type of the first parameter is unknown. LoadString's prototype
2077 * suggests that it might be a module handle. I have made it an MSI handle
2078 * for starters, as -1 is an invalid MSI handle, but not an invalid module
2079 * handle. Maybe strings can be stored in an MSI database somehow.
2081 LANGID WINAPI MsiLoadStringW( MSIHANDLE handle, UINT id, LPWSTR lpBuffer,
2082 int nBufferMax, LANGID lang )
2089 TRACE("%d %u %p %d %d\n", handle, id, lpBuffer, nBufferMax, lang);
2092 FIXME("don't know how to deal with handle = %08x\n", handle);
2095 lang = GetUserDefaultLangID();
2097 hres = FindResourceExW( msi_hInstance, (LPCWSTR) RT_STRING,
2101 hResData = LoadResource( msi_hInstance, hres );
2104 p = LockResource( hResData );
2108 for (i = 0; i < (id&0xf); i++)
2112 if( nBufferMax <= len )
2115 memcpy( lpBuffer, p+1, len * sizeof(WCHAR));
2116 lpBuffer[ len ] = 0;
2118 TRACE("found -> %s\n", debugstr_w(lpBuffer));
2123 LANGID WINAPI MsiLoadStringA( MSIHANDLE handle, UINT id, LPSTR lpBuffer,
2124 int nBufferMax, LANGID lang )
2130 bufW = msi_alloc(nBufferMax*sizeof(WCHAR));
2131 r = MsiLoadStringW(handle, id, bufW, nBufferMax, lang);
2134 len = WideCharToMultiByte(CP_ACP, 0, bufW, -1, NULL, 0, NULL, NULL );
2135 if( len <= nBufferMax )
2136 WideCharToMultiByte( CP_ACP, 0, bufW, -1,
2137 lpBuffer, nBufferMax, NULL, NULL );
2145 INSTALLSTATE WINAPI MsiLocateComponentA(LPCSTR szComponent, LPSTR lpPathBuf,
2148 char szProduct[GUID_SIZE];
2150 TRACE("%s %p %p\n", debugstr_a(szComponent), lpPathBuf, pcchBuf);
2152 if (MsiGetProductCodeA( szComponent, szProduct ) != ERROR_SUCCESS)
2153 return INSTALLSTATE_UNKNOWN;
2155 return MsiGetComponentPathA( szProduct, szComponent, lpPathBuf, pcchBuf );
2158 INSTALLSTATE WINAPI MsiLocateComponentW(LPCWSTR szComponent, LPWSTR lpPathBuf,
2161 WCHAR szProduct[GUID_SIZE];
2163 TRACE("%s %p %p\n", debugstr_w(szComponent), lpPathBuf, pcchBuf);
2165 if (MsiGetProductCodeW( szComponent, szProduct ) != ERROR_SUCCESS)
2166 return INSTALLSTATE_UNKNOWN;
2168 return MsiGetComponentPathW( szProduct, szComponent, lpPathBuf, pcchBuf );
2171 UINT WINAPI MsiMessageBoxA(HWND hWnd, LPCSTR lpText, LPCSTR lpCaption, UINT uType,
2172 WORD wLanguageId, DWORD f)
2174 FIXME("%p %s %s %u %08x %08x\n", hWnd, debugstr_a(lpText), debugstr_a(lpCaption),
2175 uType, wLanguageId, f);
2176 return MessageBoxExA(hWnd,lpText,lpCaption,uType,wLanguageId);
2179 UINT WINAPI MsiMessageBoxW(HWND hWnd, LPCWSTR lpText, LPCWSTR lpCaption, UINT uType,
2180 WORD wLanguageId, DWORD f)
2182 FIXME("%p %s %s %u %08x %08x\n", hWnd, debugstr_w(lpText), debugstr_w(lpCaption),
2183 uType, wLanguageId, f);
2184 return MessageBoxExW(hWnd,lpText,lpCaption,uType,wLanguageId);
2187 UINT WINAPI MsiMessageBoxExA(HWND hWnd, LPCSTR lpText, LPCSTR lpCaption, UINT uType,
2188 DWORD unknown, WORD wLanguageId, DWORD f)
2190 FIXME("(%p, %s, %s, %u, 0x%08x, 0x%08x, 0x%08x): semi-stub\n", hWnd, debugstr_a(lpText),
2191 debugstr_a(lpCaption), uType, unknown, wLanguageId, f);
2192 return MessageBoxExA(hWnd, lpText, lpCaption, uType, wLanguageId);
2195 UINT WINAPI MsiMessageBoxExW(HWND hWnd, LPCWSTR lpText, LPCWSTR lpCaption, UINT uType,
2196 DWORD unknown, WORD wLanguageId, DWORD f)
2198 FIXME("(%p, %s, %s, %u, 0x%08x, 0x%08x, 0x%08x): semi-stub\n", hWnd, debugstr_w(lpText),
2199 debugstr_w(lpCaption), uType, unknown, wLanguageId, f);
2200 return MessageBoxExW(hWnd, lpText, lpCaption, uType, wLanguageId);
2203 UINT WINAPI MsiProvideAssemblyA( LPCSTR szAssemblyName, LPCSTR szAppContext,
2204 DWORD dwInstallMode, DWORD dwAssemblyInfo, LPSTR lpPathBuf,
2205 LPDWORD pcchPathBuf )
2207 FIXME("%s %s %08x %08x %p %p\n", debugstr_a(szAssemblyName),
2208 debugstr_a(szAppContext), dwInstallMode, dwAssemblyInfo, lpPathBuf,
2210 return ERROR_CALL_NOT_IMPLEMENTED;
2213 UINT WINAPI MsiProvideAssemblyW( LPCWSTR szAssemblyName, LPCWSTR szAppContext,
2214 DWORD dwInstallMode, DWORD dwAssemblyInfo, LPWSTR lpPathBuf,
2215 LPDWORD pcchPathBuf )
2217 FIXME("%s %s %08x %08x %p %p\n", debugstr_w(szAssemblyName),
2218 debugstr_w(szAppContext), dwInstallMode, dwAssemblyInfo, lpPathBuf,
2220 return ERROR_CALL_NOT_IMPLEMENTED;
2223 UINT WINAPI MsiProvideComponentFromDescriptorA( LPCSTR szDescriptor,
2224 LPSTR szPath, LPDWORD pcchPath, LPDWORD pcchArgs )
2226 FIXME("%s %p %p %p\n", debugstr_a(szDescriptor), szPath, pcchPath, pcchArgs );
2227 return ERROR_CALL_NOT_IMPLEMENTED;
2230 UINT WINAPI MsiProvideComponentFromDescriptorW( LPCWSTR szDescriptor,
2231 LPWSTR szPath, LPDWORD pcchPath, LPDWORD pcchArgs )
2233 FIXME("%s %p %p %p\n", debugstr_w(szDescriptor), szPath, pcchPath, pcchArgs );
2234 return ERROR_CALL_NOT_IMPLEMENTED;
2237 HRESULT WINAPI MsiGetFileSignatureInformationA( LPCSTR szSignedObjectPath,
2238 DWORD dwFlags, PCCERT_CONTEXT* ppcCertContext, LPBYTE pbHashData,
2239 LPDWORD pcbHashData)
2241 FIXME("%s %08x %p %p %p\n", debugstr_a(szSignedObjectPath), dwFlags,
2242 ppcCertContext, pbHashData, pcbHashData);
2243 return ERROR_CALL_NOT_IMPLEMENTED;
2246 HRESULT WINAPI MsiGetFileSignatureInformationW( LPCWSTR szSignedObjectPath,
2247 DWORD dwFlags, PCCERT_CONTEXT* ppcCertContext, LPBYTE pbHashData,
2248 LPDWORD pcbHashData)
2250 FIXME("%s %08x %p %p %p\n", debugstr_w(szSignedObjectPath), dwFlags,
2251 ppcCertContext, pbHashData, pcbHashData);
2252 return ERROR_CALL_NOT_IMPLEMENTED;
2255 /******************************************************************
2256 * MsiGetProductPropertyA [MSI.@]
2258 UINT WINAPI MsiGetProductPropertyA(MSIHANDLE hProduct, LPCSTR szProperty,
2259 LPSTR szValue, LPDWORD pccbValue)
2261 LPWSTR prop = NULL, val = NULL;
2265 TRACE("(%d, %s, %p, %p)\n", hProduct, debugstr_a(szProperty),
2266 szValue, pccbValue);
2268 if (szValue && !pccbValue)
2269 return ERROR_INVALID_PARAMETER;
2271 if (szProperty) prop = strdupAtoW(szProperty);
2274 r = MsiGetProductPropertyW(hProduct, prop, NULL, &len);
2275 if (r != ERROR_SUCCESS && r != ERROR_MORE_DATA)
2278 if (r == ERROR_SUCCESS)
2280 if (szValue) *szValue = '\0';
2281 if (pccbValue) *pccbValue = 0;
2285 val = msi_alloc(++len * sizeof(WCHAR));
2288 r = ERROR_OUTOFMEMORY;
2292 r = MsiGetProductPropertyW(hProduct, prop, val, &len);
2293 if (r != ERROR_SUCCESS)
2296 len = WideCharToMultiByte(CP_ACP, 0, val, -1, NULL, 0, NULL, NULL);
2299 WideCharToMultiByte(CP_ACP, 0, val, -1, szValue,
2300 *pccbValue, NULL, NULL);
2304 if (len > *pccbValue)
2305 r = ERROR_MORE_DATA;
2307 *pccbValue = len - 1;
2317 /******************************************************************
2318 * MsiGetProductPropertyW [MSI.@]
2320 UINT WINAPI MsiGetProductPropertyW(MSIHANDLE hProduct, LPCWSTR szProperty,
2321 LPWSTR szValue, LPDWORD pccbValue)
2323 MSIPACKAGE *package;
2324 MSIQUERY *view = NULL;
2325 MSIRECORD *rec = NULL;
2329 static const WCHAR query[] = {
2330 'S','E','L','E','C','T',' ','*',' ','F','R','O','M',' ',
2331 '`','P','r','o','p','e','r','t','y','`',' ','W','H','E','R','E',' ',
2332 '`','P','r','o','p','e','r','t','y','`','=','\'','%','s','\'',0};
2334 TRACE("(%d, %s, %p, %p)\n", hProduct, debugstr_w(szProperty),
2335 szValue, pccbValue);
2338 return ERROR_INVALID_PARAMETER;
2340 if (szValue && !pccbValue)
2341 return ERROR_INVALID_PARAMETER;
2343 package = msihandle2msiinfo(hProduct, MSIHANDLETYPE_PACKAGE);
2345 return ERROR_INVALID_HANDLE;
2347 r = MSI_OpenQuery(package->db, &view, query, szProperty);
2348 if (r != ERROR_SUCCESS)
2351 r = MSI_ViewExecute(view, 0);
2352 if (r != ERROR_SUCCESS)
2355 r = MSI_ViewFetch(view, &rec);
2356 if (r != ERROR_SUCCESS)
2359 val = MSI_RecordGetString(rec, 2);
2363 if (lstrlenW(val) >= *pccbValue)
2365 lstrcpynW(szValue, val, *pccbValue);
2366 *pccbValue = lstrlenW(val);
2367 r = ERROR_MORE_DATA;
2371 lstrcpyW(szValue, val);
2372 *pccbValue = lstrlenW(val);
2379 MSI_ViewClose(view);
2380 msiobj_release(&view->hdr);
2381 if (rec) msiobj_release(&rec->hdr);
2386 if (szValue) *szValue = '\0';
2387 if (pccbValue) *pccbValue = 0;
2394 UINT WINAPI MsiVerifyPackageA( LPCSTR szPackage )
2397 LPWSTR szPack = NULL;
2399 TRACE("%s\n", debugstr_a(szPackage) );
2403 szPack = strdupAtoW( szPackage );
2405 return ERROR_OUTOFMEMORY;
2408 r = MsiVerifyPackageW( szPack );
2415 UINT WINAPI MsiVerifyPackageW( LPCWSTR szPackage )
2420 TRACE("%s\n", debugstr_w(szPackage) );
2422 r = MsiOpenDatabaseW( szPackage, MSIDBOPEN_READONLY, &handle );
2423 MsiCloseHandle( handle );
2428 static INSTALLSTATE MSI_GetComponentPath(LPCWSTR szProduct, LPCWSTR szComponent,
2429 awstring* lpPathBuf, LPDWORD pcchBuf)
2431 WCHAR squished_pc[GUID_SIZE];
2432 WCHAR squished_comp[GUID_SIZE];
2438 static const WCHAR wininstaller[] = {
2439 'W','i','n','d','o','w','s','I','n','s','t','a','l','l','e','r',0};
2441 TRACE("%s %s %p %p\n", debugstr_w(szProduct),
2442 debugstr_w(szComponent), lpPathBuf->str.w, pcchBuf);
2444 if (!szProduct || !szComponent)
2445 return INSTALLSTATE_INVALIDARG;
2447 if (lpPathBuf->str.w && !pcchBuf)
2448 return INSTALLSTATE_INVALIDARG;
2450 if (!squash_guid(szProduct, squished_pc) ||
2451 !squash_guid(szComponent, squished_comp))
2452 return INSTALLSTATE_INVALIDARG;
2454 state = INSTALLSTATE_UNKNOWN;
2456 if (MSIREG_OpenUserDataComponentKey(szComponent, szLocalSid, &hkey, FALSE) == ERROR_SUCCESS ||
2457 MSIREG_OpenUserDataComponentKey(szComponent, NULL, &hkey, FALSE) == ERROR_SUCCESS)
2459 path = msi_reg_get_val_str(hkey, squished_pc);
2462 state = INSTALLSTATE_ABSENT;
2464 if ((MSIREG_OpenInstallProps(szProduct, MSIINSTALLCONTEXT_MACHINE, NULL,
2465 &hkey, FALSE) == ERROR_SUCCESS ||
2466 MSIREG_OpenUserDataProductKey(szProduct, MSIINSTALLCONTEXT_USERUNMANAGED,
2467 NULL, &hkey, FALSE) == ERROR_SUCCESS) &&
2468 msi_reg_get_val_dword(hkey, wininstaller, &version) &&
2469 GetFileAttributesW(path) != INVALID_FILE_ATTRIBUTES)
2472 state = INSTALLSTATE_LOCAL;
2476 if (state != INSTALLSTATE_LOCAL &&
2477 (MSIREG_OpenProductKey(szProduct, NULL,
2478 MSIINSTALLCONTEXT_USERUNMANAGED,
2479 &hkey, FALSE) == ERROR_SUCCESS ||
2480 MSIREG_OpenProductKey(szProduct, NULL, MSIINSTALLCONTEXT_MACHINE,
2481 &hkey, FALSE) == ERROR_SUCCESS))
2485 if (MSIREG_OpenUserDataComponentKey(szComponent, szLocalSid, &hkey, FALSE) == ERROR_SUCCESS ||
2486 MSIREG_OpenUserDataComponentKey(szComponent, NULL, &hkey, FALSE) == ERROR_SUCCESS)
2489 path = msi_reg_get_val_str(hkey, squished_pc);
2492 state = INSTALLSTATE_ABSENT;
2494 if (GetFileAttributesW(path) != INVALID_FILE_ATTRIBUTES)
2495 state = INSTALLSTATE_LOCAL;
2500 return INSTALLSTATE_UNKNOWN;
2502 if (state == INSTALLSTATE_LOCAL && !*path)
2503 state = INSTALLSTATE_NOTUSED;
2505 msi_strcpy_to_awstring(path, lpPathBuf, pcchBuf);
2510 /******************************************************************
2511 * MsiGetComponentPathW [MSI.@]
2513 INSTALLSTATE WINAPI MsiGetComponentPathW(LPCWSTR szProduct, LPCWSTR szComponent,
2514 LPWSTR lpPathBuf, LPDWORD pcchBuf)
2518 path.unicode = TRUE;
2519 path.str.w = lpPathBuf;
2521 return MSI_GetComponentPath( szProduct, szComponent, &path, pcchBuf );
2524 /******************************************************************
2525 * MsiGetComponentPathA [MSI.@]
2527 INSTALLSTATE WINAPI MsiGetComponentPathA(LPCSTR szProduct, LPCSTR szComponent,
2528 LPSTR lpPathBuf, LPDWORD pcchBuf)
2530 LPWSTR szwProduct, szwComponent = NULL;
2531 INSTALLSTATE r = INSTALLSTATE_UNKNOWN;
2534 szwProduct = strdupAtoW( szProduct );
2535 if( szProduct && !szwProduct)
2538 szwComponent = strdupAtoW( szComponent );
2539 if( szComponent && !szwComponent )
2542 path.unicode = FALSE;
2543 path.str.a = lpPathBuf;
2545 r = MSI_GetComponentPath( szwProduct, szwComponent, &path, pcchBuf );
2548 msi_free( szwProduct );
2549 msi_free( szwComponent );
2554 /******************************************************************
2555 * MsiQueryFeatureStateA [MSI.@]
2557 INSTALLSTATE WINAPI MsiQueryFeatureStateA(LPCSTR szProduct, LPCSTR szFeature)
2559 LPWSTR szwProduct = NULL, szwFeature= NULL;
2560 INSTALLSTATE rc = INSTALLSTATE_UNKNOWN;
2562 szwProduct = strdupAtoW( szProduct );
2563 if ( szProduct && !szwProduct )
2566 szwFeature = strdupAtoW( szFeature );
2567 if ( szFeature && !szwFeature )
2570 rc = MsiQueryFeatureStateW(szwProduct, szwFeature);
2573 msi_free( szwProduct);
2574 msi_free( szwFeature);
2579 /******************************************************************
2580 * MsiQueryFeatureStateW [MSI.@]
2582 * Checks the state of a feature
2585 * szProduct [I] Product's GUID string
2586 * szFeature [I] Feature's GUID string
2589 * INSTALLSTATE_LOCAL Feature is installed and usable
2590 * INSTALLSTATE_ABSENT Feature is absent
2591 * INSTALLSTATE_ADVERTISED Feature should be installed on demand
2592 * INSTALLSTATE_UNKNOWN An error occurred
2593 * INSTALLSTATE_INVALIDARG One of the GUIDs was invalid
2596 INSTALLSTATE WINAPI MsiQueryFeatureStateW(LPCWSTR szProduct, LPCWSTR szFeature)
2598 WCHAR squishProduct[33], comp[GUID_SIZE];
2600 LPWSTR components, p, parent_feature, path;
2604 BOOL missing = FALSE;
2605 BOOL machine = FALSE;
2606 BOOL source = FALSE;
2608 TRACE("%s %s\n", debugstr_w(szProduct), debugstr_w(szFeature));
2610 if (!szProduct || !szFeature)
2611 return INSTALLSTATE_INVALIDARG;
2613 if (!squash_guid( szProduct, squishProduct ))
2614 return INSTALLSTATE_INVALIDARG;
2616 if (MSIREG_OpenFeaturesKey(szProduct, MSIINSTALLCONTEXT_USERMANAGED,
2617 &hkey, FALSE) != ERROR_SUCCESS &&
2618 MSIREG_OpenFeaturesKey(szProduct, MSIINSTALLCONTEXT_USERUNMANAGED,
2619 &hkey, FALSE) != ERROR_SUCCESS)
2621 rc = MSIREG_OpenFeaturesKey(szProduct, MSIINSTALLCONTEXT_MACHINE,
2623 if (rc != ERROR_SUCCESS)
2624 return INSTALLSTATE_UNKNOWN;
2629 parent_feature = msi_reg_get_val_str( hkey, szFeature );
2632 if (!parent_feature)
2633 return INSTALLSTATE_UNKNOWN;
2635 r = (parent_feature[0] == 6) ? INSTALLSTATE_ABSENT : INSTALLSTATE_LOCAL;
2636 msi_free(parent_feature);
2637 if (r == INSTALLSTATE_ABSENT)
2641 rc = MSIREG_OpenUserDataFeaturesKey(szProduct,
2642 MSIINSTALLCONTEXT_MACHINE,
2645 rc = MSIREG_OpenUserDataFeaturesKey(szProduct,
2646 MSIINSTALLCONTEXT_USERUNMANAGED,
2649 if (rc != ERROR_SUCCESS)
2650 return INSTALLSTATE_ADVERTISED;
2652 components = msi_reg_get_val_str( hkey, szFeature );
2655 TRACE("rc = %d buffer = %s\n", rc, debugstr_w(components));
2658 return INSTALLSTATE_ADVERTISED;
2660 for( p = components; *p && *p != 2 ; p += 20)
2662 if (!decode_base85_guid( p, &guid ))
2664 if (p != components)
2667 msi_free(components);
2668 return INSTALLSTATE_BADCONFIG;
2671 StringFromGUID2(&guid, comp, GUID_SIZE);
2674 rc = MSIREG_OpenUserDataComponentKey(comp, szLocalSid, &hkey, FALSE);
2676 rc = MSIREG_OpenUserDataComponentKey(comp, NULL, &hkey, FALSE);
2678 if (rc != ERROR_SUCCESS)
2680 msi_free(components);
2681 return INSTALLSTATE_ADVERTISED;
2684 path = msi_reg_get_val_str(hkey, squishProduct);
2687 else if (lstrlenW(path) > 2 &&
2688 path[0] >= '0' && path[0] <= '9' &&
2689 path[1] >= '0' && path[1] <= '9')
2697 TRACE("%s %s -> %d\n", debugstr_w(szProduct), debugstr_w(szFeature), r);
2698 msi_free(components);
2701 return INSTALLSTATE_ADVERTISED;
2704 return INSTALLSTATE_SOURCE;
2706 return INSTALLSTATE_LOCAL;
2709 /******************************************************************
2710 * MsiGetFileVersionA [MSI.@]
2712 UINT WINAPI MsiGetFileVersionA(LPCSTR szFilePath, LPSTR lpVersionBuf,
2713 LPDWORD pcchVersionBuf, LPSTR lpLangBuf, LPDWORD pcchLangBuf)
2715 LPWSTR szwFilePath = NULL, lpwVersionBuff = NULL, lpwLangBuff = NULL;
2716 UINT ret = ERROR_OUTOFMEMORY;
2718 if ((lpVersionBuf && !pcchVersionBuf) ||
2719 (lpLangBuf && !pcchLangBuf))
2720 return ERROR_INVALID_PARAMETER;
2724 szwFilePath = strdupAtoW( szFilePath );
2729 if( lpVersionBuf && pcchVersionBuf && *pcchVersionBuf )
2731 lpwVersionBuff = msi_alloc(*pcchVersionBuf*sizeof(WCHAR));
2732 if( !lpwVersionBuff )
2736 if( lpLangBuf && pcchLangBuf && *pcchLangBuf )
2738 lpwLangBuff = msi_alloc(*pcchLangBuf*sizeof(WCHAR));
2743 ret = MsiGetFileVersionW(szwFilePath, lpwVersionBuff, pcchVersionBuf,
2744 lpwLangBuff, pcchLangBuf);
2746 if( (ret == ERROR_SUCCESS || ret == ERROR_MORE_DATA) && lpwVersionBuff )
2747 WideCharToMultiByte(CP_ACP, 0, lpwVersionBuff, -1,
2748 lpVersionBuf, *pcchVersionBuf + 1, NULL, NULL);
2749 if( (ret == ERROR_SUCCESS || ret == ERROR_MORE_DATA) && lpwLangBuff )
2750 WideCharToMultiByte(CP_ACP, 0, lpwLangBuff, -1,
2751 lpLangBuf, *pcchLangBuf + 1, NULL, NULL);
2754 msi_free(szwFilePath);
2755 msi_free(lpwVersionBuff);
2756 msi_free(lpwLangBuff);
2761 /******************************************************************
2762 * MsiGetFileVersionW [MSI.@]
2764 UINT WINAPI MsiGetFileVersionW(LPCWSTR szFilePath, LPWSTR lpVersionBuf,
2765 LPDWORD pcchVersionBuf, LPWSTR lpLangBuf, LPDWORD pcchLangBuf)
2767 static const WCHAR szVersionResource[] = {'\\',0};
2768 static const WCHAR szVersionFormat[] = {
2769 '%','d','.','%','d','.','%','d','.','%','d',0};
2770 static const WCHAR szLangResource[] = {
2771 '\\','V','a','r','F','i','l','e','I','n','f','o','\\',
2772 'T','r','a','n','s','l','a','t','i','o','n',0};
2773 static const WCHAR szLangFormat[] = {'%','d',0};
2775 DWORD dwVerLen, gle;
2776 LPVOID lpVer = NULL;
2777 VS_FIXEDFILEINFO *ffi;
2782 TRACE("%s %p %d %p %d\n", debugstr_w(szFilePath),
2783 lpVersionBuf, pcchVersionBuf?*pcchVersionBuf:0,
2784 lpLangBuf, pcchLangBuf?*pcchLangBuf:0);
2786 if ((lpVersionBuf && !pcchVersionBuf) ||
2787 (lpLangBuf && !pcchLangBuf))
2788 return ERROR_INVALID_PARAMETER;
2790 dwVerLen = GetFileVersionInfoSizeW(szFilePath, NULL);
2793 gle = GetLastError();
2794 if (gle == ERROR_BAD_PATHNAME)
2795 return ERROR_FILE_NOT_FOUND;
2796 else if (gle == ERROR_RESOURCE_DATA_NOT_FOUND)
2797 return ERROR_FILE_INVALID;
2802 lpVer = msi_alloc(dwVerLen);
2805 ret = ERROR_OUTOFMEMORY;
2809 if( !GetFileVersionInfoW(szFilePath, 0, dwVerLen, lpVer) )
2811 ret = GetLastError();
2817 if( VerQueryValueW(lpVer, szVersionResource, (LPVOID*)&ffi, &puLen) &&
2820 wsprintfW(tmp, szVersionFormat,
2821 HIWORD(ffi->dwFileVersionMS), LOWORD(ffi->dwFileVersionMS),
2822 HIWORD(ffi->dwFileVersionLS), LOWORD(ffi->dwFileVersionLS));
2823 if (lpVersionBuf) lstrcpynW(lpVersionBuf, tmp, *pcchVersionBuf);
2825 if (strlenW(tmp) >= *pcchVersionBuf)
2826 ret = ERROR_MORE_DATA;
2828 *pcchVersionBuf = lstrlenW(tmp);
2832 if (lpVersionBuf) *lpVersionBuf = 0;
2833 *pcchVersionBuf = 0;
2839 if (VerQueryValueW(lpVer, szLangResource, (LPVOID*)&lang, &puLen) &&
2842 wsprintfW(tmp, szLangFormat, *lang);
2843 if (lpLangBuf) lstrcpynW(lpLangBuf, tmp, *pcchLangBuf);
2845 if (strlenW(tmp) >= *pcchLangBuf)
2846 ret = ERROR_MORE_DATA;
2848 *pcchLangBuf = lstrlenW(tmp);
2852 if (lpLangBuf) *lpLangBuf = 0;
2862 /***********************************************************************
2863 * MsiGetFeatureUsageW [MSI.@]
2865 UINT WINAPI MsiGetFeatureUsageW( LPCWSTR szProduct, LPCWSTR szFeature,
2866 LPDWORD pdwUseCount, LPWORD pwDateUsed )
2868 FIXME("%s %s %p %p\n",debugstr_w(szProduct), debugstr_w(szFeature),
2869 pdwUseCount, pwDateUsed);
2870 return ERROR_CALL_NOT_IMPLEMENTED;
2873 /***********************************************************************
2874 * MsiGetFeatureUsageA [MSI.@]
2876 UINT WINAPI MsiGetFeatureUsageA( LPCSTR szProduct, LPCSTR szFeature,
2877 LPDWORD pdwUseCount, LPWORD pwDateUsed )
2879 LPWSTR prod = NULL, feat = NULL;
2880 UINT ret = ERROR_OUTOFMEMORY;
2882 TRACE("%s %s %p %p\n", debugstr_a(szProduct), debugstr_a(szFeature),
2883 pdwUseCount, pwDateUsed);
2885 prod = strdupAtoW( szProduct );
2886 if (szProduct && !prod)
2889 feat = strdupAtoW( szFeature );
2890 if (szFeature && !feat)
2893 ret = MsiGetFeatureUsageW( prod, feat, pdwUseCount, pwDateUsed );
2902 /***********************************************************************
2903 * MsiUseFeatureExW [MSI.@]
2905 INSTALLSTATE WINAPI MsiUseFeatureExW( LPCWSTR szProduct, LPCWSTR szFeature,
2906 DWORD dwInstallMode, DWORD dwReserved )
2910 TRACE("%s %s %i %i\n", debugstr_w(szProduct), debugstr_w(szFeature),
2911 dwInstallMode, dwReserved);
2913 state = MsiQueryFeatureStateW( szProduct, szFeature );
2916 return INSTALLSTATE_INVALIDARG;
2918 if (state == INSTALLSTATE_LOCAL && dwInstallMode != INSTALLMODE_NODETECTION)
2920 FIXME("mark product %s feature %s as used\n",
2921 debugstr_w(szProduct), debugstr_w(szFeature) );
2927 /***********************************************************************
2928 * MsiUseFeatureExA [MSI.@]
2930 INSTALLSTATE WINAPI MsiUseFeatureExA( LPCSTR szProduct, LPCSTR szFeature,
2931 DWORD dwInstallMode, DWORD dwReserved )
2933 INSTALLSTATE ret = INSTALLSTATE_UNKNOWN;
2934 LPWSTR prod = NULL, feat = NULL;
2936 TRACE("%s %s %i %i\n", debugstr_a(szProduct), debugstr_a(szFeature),
2937 dwInstallMode, dwReserved);
2939 prod = strdupAtoW( szProduct );
2940 if (szProduct && !prod)
2943 feat = strdupAtoW( szFeature );
2944 if (szFeature && !feat)
2947 ret = MsiUseFeatureExW( prod, feat, dwInstallMode, dwReserved );
2956 /***********************************************************************
2957 * MsiUseFeatureW [MSI.@]
2959 INSTALLSTATE WINAPI MsiUseFeatureW( LPCWSTR szProduct, LPCWSTR szFeature )
2961 return MsiUseFeatureExW(szProduct, szFeature, 0, 0);
2964 /***********************************************************************
2965 * MsiUseFeatureA [MSI.@]
2967 INSTALLSTATE WINAPI MsiUseFeatureA( LPCSTR szProduct, LPCSTR szFeature )
2969 return MsiUseFeatureExA(szProduct, szFeature, 0, 0);
2972 /***********************************************************************
2973 * MSI_ProvideQualifiedComponentEx [internal]
2975 static UINT MSI_ProvideQualifiedComponentEx(LPCWSTR szComponent,
2976 LPCWSTR szQualifier, DWORD dwInstallMode, LPCWSTR szProduct,
2977 DWORD Unused1, DWORD Unused2, awstring *lpPathBuf,
2978 LPDWORD pcchPathBuf)
2980 WCHAR product[MAX_FEATURE_CHARS+1], component[MAX_FEATURE_CHARS+1],
2981 feature[MAX_FEATURE_CHARS+1];
2987 TRACE("%s %s %i %s %i %i %p %p\n", debugstr_w(szComponent),
2988 debugstr_w(szQualifier), dwInstallMode, debugstr_w(szProduct),
2989 Unused1, Unused2, lpPathBuf, pcchPathBuf);
2991 rc = MSIREG_OpenUserComponentsKey(szComponent, &hkey, FALSE);
2992 if (rc != ERROR_SUCCESS)
2993 return ERROR_INDEX_ABSENT;
2995 info = msi_reg_get_val_str( hkey, szQualifier );
2999 return ERROR_INDEX_ABSENT;
3001 MsiDecomposeDescriptorW(info, product, feature, component, &sz);
3004 rc = MSI_GetComponentPath(product, component, lpPathBuf, pcchPathBuf);
3006 rc = MSI_GetComponentPath(szProduct, component, lpPathBuf, pcchPathBuf);
3010 if (rc != INSTALLSTATE_LOCAL)
3011 return ERROR_FILE_NOT_FOUND;
3013 return ERROR_SUCCESS;
3016 /***********************************************************************
3017 * MsiProvideQualifiedComponentExW [MSI.@]
3019 UINT WINAPI MsiProvideQualifiedComponentExW(LPCWSTR szComponent,
3020 LPCWSTR szQualifier, DWORD dwInstallMode, LPCWSTR szProduct,
3021 DWORD Unused1, DWORD Unused2, LPWSTR lpPathBuf,
3022 LPDWORD pcchPathBuf)
3026 path.unicode = TRUE;
3027 path.str.w = lpPathBuf;
3029 return MSI_ProvideQualifiedComponentEx(szComponent, szQualifier,
3030 dwInstallMode, szProduct, Unused1, Unused2, &path, pcchPathBuf);
3033 /***********************************************************************
3034 * MsiProvideQualifiedComponentExA [MSI.@]
3036 UINT WINAPI MsiProvideQualifiedComponentExA(LPCSTR szComponent,
3037 LPCSTR szQualifier, DWORD dwInstallMode, LPCSTR szProduct,
3038 DWORD Unused1, DWORD Unused2, LPSTR lpPathBuf,
3039 LPDWORD pcchPathBuf)
3041 LPWSTR szwComponent, szwQualifier = NULL, szwProduct = NULL;
3042 UINT r = ERROR_OUTOFMEMORY;
3045 TRACE("%s %s %u %s %u %u %p %p\n", debugstr_a(szComponent),
3046 debugstr_a(szQualifier), dwInstallMode, debugstr_a(szProduct),
3047 Unused1, Unused2, lpPathBuf, pcchPathBuf);
3049 szwComponent = strdupAtoW( szComponent );
3050 if (szComponent && !szwComponent)
3053 szwQualifier = strdupAtoW( szQualifier );
3054 if (szQualifier && !szwQualifier)
3057 szwProduct = strdupAtoW( szProduct );
3058 if (szProduct && !szwProduct)
3061 path.unicode = FALSE;
3062 path.str.a = lpPathBuf;
3064 r = MSI_ProvideQualifiedComponentEx(szwComponent, szwQualifier,
3065 dwInstallMode, szwProduct, Unused1,
3066 Unused2, &path, pcchPathBuf);
3068 msi_free(szwProduct);
3069 msi_free(szwComponent);
3070 msi_free(szwQualifier);
3075 /***********************************************************************
3076 * MsiProvideQualifiedComponentW [MSI.@]
3078 UINT WINAPI MsiProvideQualifiedComponentW( LPCWSTR szComponent,
3079 LPCWSTR szQualifier, DWORD dwInstallMode, LPWSTR lpPathBuf,
3080 LPDWORD pcchPathBuf)
3082 return MsiProvideQualifiedComponentExW(szComponent, szQualifier,
3083 dwInstallMode, NULL, 0, 0, lpPathBuf, pcchPathBuf);
3086 /***********************************************************************
3087 * MsiProvideQualifiedComponentA [MSI.@]
3089 UINT WINAPI MsiProvideQualifiedComponentA( LPCSTR szComponent,
3090 LPCSTR szQualifier, DWORD dwInstallMode, LPSTR lpPathBuf,
3091 LPDWORD pcchPathBuf)
3093 return MsiProvideQualifiedComponentExA(szComponent, szQualifier,
3094 dwInstallMode, NULL, 0, 0, lpPathBuf, pcchPathBuf);
3097 /***********************************************************************
3098 * MSI_GetUserInfo [internal]
3100 static USERINFOSTATE MSI_GetUserInfo(LPCWSTR szProduct,
3101 awstring *lpUserNameBuf, LPDWORD pcchUserNameBuf,
3102 awstring *lpOrgNameBuf, LPDWORD pcchOrgNameBuf,
3103 awstring *lpSerialBuf, LPDWORD pcchSerialBuf)
3105 WCHAR squished_pc[SQUISH_GUID_SIZE];
3106 LPWSTR user, org, serial;
3107 USERINFOSTATE state;
3112 TRACE("%s %p %p %p %p %p %p\n", debugstr_w(szProduct), lpUserNameBuf,
3113 pcchUserNameBuf, lpOrgNameBuf, pcchOrgNameBuf, lpSerialBuf,
3116 if (!szProduct || !squash_guid(szProduct, squished_pc))
3117 return USERINFOSTATE_INVALIDARG;
3119 if (MSIREG_OpenProductKey(szProduct, NULL, MSIINSTALLCONTEXT_USERMANAGED,
3120 &hkey, FALSE) != ERROR_SUCCESS &&
3121 MSIREG_OpenProductKey(szProduct, NULL, MSIINSTALLCONTEXT_USERUNMANAGED,
3122 &hkey, FALSE) != ERROR_SUCCESS &&
3123 MSIREG_OpenProductKey(szProduct, NULL, MSIINSTALLCONTEXT_MACHINE,
3124 &hkey, FALSE) != ERROR_SUCCESS)
3126 return USERINFOSTATE_UNKNOWN;
3129 if (MSIREG_OpenInstallProps(szProduct, MSIINSTALLCONTEXT_USERUNMANAGED,
3130 NULL, &props, FALSE) != ERROR_SUCCESS &&
3131 MSIREG_OpenInstallProps(szProduct, MSIINSTALLCONTEXT_MACHINE,
3132 NULL, &props, FALSE) != ERROR_SUCCESS)
3135 return USERINFOSTATE_ABSENT;
3138 user = msi_reg_get_val_str(props, INSTALLPROPERTY_REGOWNERW);
3139 org = msi_reg_get_val_str(props, INSTALLPROPERTY_REGCOMPANYW);
3140 serial = msi_reg_get_val_str(props, INSTALLPROPERTY_PRODUCTIDW);
3141 state = USERINFOSTATE_ABSENT;
3147 state = USERINFOSTATE_PRESENT;
3149 if (pcchUserNameBuf)
3151 if (lpUserNameBuf && !user)
3153 (*pcchUserNameBuf)--;
3157 r = msi_strcpy_to_awstring(user, lpUserNameBuf, pcchUserNameBuf);
3158 if (r == ERROR_MORE_DATA)
3160 state = USERINFOSTATE_MOREDATA;
3168 if (!orgptr) orgptr = szEmpty;
3170 r = msi_strcpy_to_awstring(orgptr, lpOrgNameBuf, pcchOrgNameBuf);
3171 if (r == ERROR_MORE_DATA)
3173 state = USERINFOSTATE_MOREDATA;
3186 r = msi_strcpy_to_awstring(serial, lpSerialBuf, pcchSerialBuf);
3187 if (r == ERROR_MORE_DATA)
3188 state = USERINFOSTATE_MOREDATA;
3199 /***********************************************************************
3200 * MsiGetUserInfoW [MSI.@]
3202 USERINFOSTATE WINAPI MsiGetUserInfoW(LPCWSTR szProduct,
3203 LPWSTR lpUserNameBuf, LPDWORD pcchUserNameBuf,
3204 LPWSTR lpOrgNameBuf, LPDWORD pcchOrgNameBuf,
3205 LPWSTR lpSerialBuf, LPDWORD pcchSerialBuf)
3207 awstring user, org, serial;
3209 if ((lpUserNameBuf && !pcchUserNameBuf) ||
3210 (lpOrgNameBuf && !pcchOrgNameBuf) ||
3211 (lpSerialBuf && !pcchSerialBuf))
3212 return USERINFOSTATE_INVALIDARG;
3214 user.unicode = TRUE;
3215 user.str.w = lpUserNameBuf;
3217 org.str.w = lpOrgNameBuf;
3218 serial.unicode = TRUE;
3219 serial.str.w = lpSerialBuf;
3221 return MSI_GetUserInfo( szProduct, &user, pcchUserNameBuf,
3222 &org, pcchOrgNameBuf,
3223 &serial, pcchSerialBuf );
3226 USERINFOSTATE WINAPI MsiGetUserInfoA(LPCSTR szProduct,
3227 LPSTR lpUserNameBuf, LPDWORD pcchUserNameBuf,
3228 LPSTR lpOrgNameBuf, LPDWORD pcchOrgNameBuf,
3229 LPSTR lpSerialBuf, LPDWORD pcchSerialBuf)
3231 awstring user, org, serial;
3235 if ((lpUserNameBuf && !pcchUserNameBuf) ||
3236 (lpOrgNameBuf && !pcchOrgNameBuf) ||
3237 (lpSerialBuf && !pcchSerialBuf))
3238 return USERINFOSTATE_INVALIDARG;
3240 prod = strdupAtoW( szProduct );
3241 if (szProduct && !prod)
3242 return ERROR_OUTOFMEMORY;
3244 user.unicode = FALSE;
3245 user.str.a = lpUserNameBuf;
3246 org.unicode = FALSE;
3247 org.str.a = lpOrgNameBuf;
3248 serial.unicode = FALSE;
3249 serial.str.a = lpSerialBuf;
3251 r = MSI_GetUserInfo( prod, &user, pcchUserNameBuf,
3252 &org, pcchOrgNameBuf,
3253 &serial, pcchSerialBuf );
3260 UINT WINAPI MsiCollectUserInfoW(LPCWSTR szProduct)
3264 MSIPACKAGE *package;
3265 static const WCHAR szFirstRun[] = {'F','i','r','s','t','R','u','n',0};
3267 TRACE("(%s)\n",debugstr_w(szProduct));
3269 rc = MsiOpenProductW(szProduct,&handle);
3270 if (rc != ERROR_SUCCESS)
3271 return ERROR_INVALID_PARAMETER;
3273 /* MsiCollectUserInfo cannot be called from a custom action. */
3274 package = msihandle2msiinfo(handle, MSIHANDLETYPE_PACKAGE);
3276 return ERROR_CALL_NOT_IMPLEMENTED;
3278 rc = ACTION_PerformUIAction(package, szFirstRun, -1);
3279 msiobj_release( &package->hdr );
3281 MsiCloseHandle(handle);
3286 UINT WINAPI MsiCollectUserInfoA(LPCSTR szProduct)
3290 MSIPACKAGE *package;
3291 static const WCHAR szFirstRun[] = {'F','i','r','s','t','R','u','n',0};
3293 TRACE("(%s)\n",debugstr_a(szProduct));
3295 rc = MsiOpenProductA(szProduct,&handle);
3296 if (rc != ERROR_SUCCESS)
3297 return ERROR_INVALID_PARAMETER;
3299 /* MsiCollectUserInfo cannot be called from a custom action. */
3300 package = msihandle2msiinfo(handle, MSIHANDLETYPE_PACKAGE);
3302 return ERROR_CALL_NOT_IMPLEMENTED;
3304 rc = ACTION_PerformUIAction(package, szFirstRun, -1);
3305 msiobj_release( &package->hdr );
3307 MsiCloseHandle(handle);
3312 /***********************************************************************
3313 * MsiConfigureFeatureA [MSI.@]
3315 UINT WINAPI MsiConfigureFeatureA(LPCSTR szProduct, LPCSTR szFeature, INSTALLSTATE eInstallState)
3317 LPWSTR prod, feat = NULL;
3318 UINT r = ERROR_OUTOFMEMORY;
3320 TRACE("%s %s %i\n", debugstr_a(szProduct), debugstr_a(szFeature), eInstallState);
3322 prod = strdupAtoW( szProduct );
3323 if (szProduct && !prod)
3326 feat = strdupAtoW( szFeature );
3327 if (szFeature && !feat)
3330 r = MsiConfigureFeatureW(prod, feat, eInstallState);
3339 /***********************************************************************
3340 * MsiConfigureFeatureW [MSI.@]
3342 UINT WINAPI MsiConfigureFeatureW(LPCWSTR szProduct, LPCWSTR szFeature, INSTALLSTATE eInstallState)
3344 static const WCHAR szCostInit[] = { 'C','o','s','t','I','n','i','t','i','a','l','i','z','e',0 };
3345 MSIPACKAGE *package = NULL;
3347 WCHAR sourcepath[MAX_PATH], filename[MAX_PATH];
3350 TRACE("%s %s %i\n", debugstr_w(szProduct), debugstr_w(szFeature), eInstallState);
3352 if (!szProduct || !szFeature)
3353 return ERROR_INVALID_PARAMETER;
3355 switch (eInstallState)
3357 case INSTALLSTATE_DEFAULT:
3358 /* FIXME: how do we figure out the default location? */
3359 eInstallState = INSTALLSTATE_LOCAL;
3361 case INSTALLSTATE_LOCAL:
3362 case INSTALLSTATE_SOURCE:
3363 case INSTALLSTATE_ABSENT:
3364 case INSTALLSTATE_ADVERTISED:
3367 return ERROR_INVALID_PARAMETER;
3370 r = MSI_OpenProductW( szProduct, &package );
3371 if (r != ERROR_SUCCESS)
3374 sz = sizeof(sourcepath);
3375 MsiSourceListGetInfoW(szProduct, NULL, MSIINSTALLCONTEXT_USERUNMANAGED,
3376 MSICODE_PRODUCT, INSTALLPROPERTY_LASTUSEDSOURCEW, sourcepath, &sz);
3378 sz = sizeof(filename);
3379 MsiSourceListGetInfoW(szProduct, NULL, MSIINSTALLCONTEXT_USERUNMANAGED,
3380 MSICODE_PRODUCT, INSTALLPROPERTY_PACKAGENAMEW, filename, &sz);
3382 lstrcatW( sourcepath, filename );
3384 MsiSetInternalUI( INSTALLUILEVEL_BASIC, NULL );
3386 r = ACTION_PerformUIAction( package, szCostInit, -1 );
3387 if (r != ERROR_SUCCESS)
3390 r = MSI_SetFeatureStateW( package, szFeature, eInstallState);
3391 if (r != ERROR_SUCCESS)
3394 r = MSI_InstallPackage( package, sourcepath, NULL );
3397 msiobj_release( &package->hdr );
3402 /***********************************************************************
3403 * MsiCreateAndVerifyInstallerDirectory [MSI.@]
3405 * Notes: undocumented
3407 UINT WINAPI MsiCreateAndVerifyInstallerDirectory(DWORD dwReserved)
3409 WCHAR path[MAX_PATH];
3411 TRACE("%d\n", dwReserved);
3415 FIXME("dwReserved=%d\n", dwReserved);
3416 return ERROR_INVALID_PARAMETER;
3419 if (!GetWindowsDirectoryW(path, MAX_PATH))
3420 return ERROR_FUNCTION_FAILED;
3422 lstrcatW(path, installerW);
3424 if (!CreateDirectoryW(path, NULL))
3425 return ERROR_FUNCTION_FAILED;
3427 return ERROR_SUCCESS;
3430 /***********************************************************************
3431 * MsiGetShortcutTargetA [MSI.@]
3433 UINT WINAPI MsiGetShortcutTargetA( LPCSTR szShortcutTarget,
3434 LPSTR szProductCode, LPSTR szFeatureId,
3435 LPSTR szComponentCode )
3438 const int len = MAX_FEATURE_CHARS+1;
3439 WCHAR product[MAX_FEATURE_CHARS+1], feature[MAX_FEATURE_CHARS+1], component[MAX_FEATURE_CHARS+1];
3442 target = strdupAtoW( szShortcutTarget );
3443 if (szShortcutTarget && !target )
3444 return ERROR_OUTOFMEMORY;
3448 r = MsiGetShortcutTargetW( target, product, feature, component );
3450 if (r == ERROR_SUCCESS)
3452 WideCharToMultiByte( CP_ACP, 0, product, -1, szProductCode, len, NULL, NULL );
3453 WideCharToMultiByte( CP_ACP, 0, feature, -1, szFeatureId, len, NULL, NULL );
3454 WideCharToMultiByte( CP_ACP, 0, component, -1, szComponentCode, len, NULL, NULL );
3459 /***********************************************************************
3460 * MsiGetShortcutTargetW [MSI.@]
3462 UINT WINAPI MsiGetShortcutTargetW( LPCWSTR szShortcutTarget,
3463 LPWSTR szProductCode, LPWSTR szFeatureId,
3464 LPWSTR szComponentCode )
3466 IShellLinkDataList *dl = NULL;
3467 IPersistFile *pf = NULL;
3468 LPEXP_DARWIN_LINK darwin = NULL;
3471 TRACE("%s %p %p %p\n", debugstr_w(szShortcutTarget),
3472 szProductCode, szFeatureId, szComponentCode );
3474 init = CoInitialize(NULL);
3476 r = CoCreateInstance( &CLSID_ShellLink, NULL, CLSCTX_INPROC_SERVER,
3477 &IID_IPersistFile, (LPVOID*) &pf );
3478 if( SUCCEEDED( r ) )
3480 r = IPersistFile_Load( pf, szShortcutTarget,
3481 STGM_READ | STGM_SHARE_DENY_WRITE );
3482 if( SUCCEEDED( r ) )
3484 r = IPersistFile_QueryInterface( pf, &IID_IShellLinkDataList,
3486 if( SUCCEEDED( r ) )
3488 IShellLinkDataList_CopyDataBlock( dl, EXP_DARWIN_ID_SIG,
3490 IShellLinkDataList_Release( dl );
3493 IPersistFile_Release( pf );
3496 if (SUCCEEDED(init))
3499 TRACE("darwin = %p\n", darwin);
3506 ret = MsiDecomposeDescriptorW( darwin->szwDarwinID,
3507 szProductCode, szFeatureId, szComponentCode, &sz );
3508 LocalFree( darwin );
3512 return ERROR_FUNCTION_FAILED;
3515 UINT WINAPI MsiReinstallFeatureW( LPCWSTR szProduct, LPCWSTR szFeature,
3516 DWORD dwReinstallMode )
3518 MSIPACKAGE* package = NULL;
3520 WCHAR sourcepath[MAX_PATH];
3521 WCHAR filename[MAX_PATH];
3522 static const WCHAR szLogVerbose[] = {
3523 ' ','L','O','G','V','E','R','B','O','S','E',0 };
3524 WCHAR reinstallmode[11];
3528 FIXME("%s %s %i\n", debugstr_w(szProduct), debugstr_w(szFeature),
3531 ptr = reinstallmode;
3533 if (dwReinstallMode & REINSTALLMODE_FILEMISSING)
3535 if (dwReinstallMode & REINSTALLMODE_FILEOLDERVERSION)
3537 if (dwReinstallMode & REINSTALLMODE_FILEEQUALVERSION)
3539 if (dwReinstallMode & REINSTALLMODE_FILEEXACT)
3541 if (dwReinstallMode & REINSTALLMODE_FILEVERIFY)
3543 if (dwReinstallMode & REINSTALLMODE_FILEREPLACE)
3545 if (dwReinstallMode & REINSTALLMODE_USERDATA)
3547 if (dwReinstallMode & REINSTALLMODE_MACHINEDATA)
3549 if (dwReinstallMode & REINSTALLMODE_SHORTCUT)
3551 if (dwReinstallMode & REINSTALLMODE_PACKAGE)
3555 sz = sizeof(sourcepath);
3556 MsiSourceListGetInfoW(szProduct, NULL, MSIINSTALLCONTEXT_USERUNMANAGED,
3557 MSICODE_PRODUCT, INSTALLPROPERTY_LASTUSEDSOURCEW, sourcepath, &sz);
3559 sz = sizeof(filename);
3560 MsiSourceListGetInfoW(szProduct, NULL, MSIINSTALLCONTEXT_USERUNMANAGED,
3561 MSICODE_PRODUCT, INSTALLPROPERTY_PACKAGENAMEW, filename, &sz);
3563 lstrcatW( sourcepath, filename );
3565 if (dwReinstallMode & REINSTALLMODE_PACKAGE)
3566 r = MSI_OpenPackageW( sourcepath, &package );
3568 r = MSI_OpenProductW( szProduct, &package );
3570 if (r != ERROR_SUCCESS)
3573 msi_set_property( package->db, szReinstallMode, reinstallmode );
3574 msi_set_property( package->db, szInstalled, szOne );
3575 msi_set_property( package->db, szLogVerbose, szOne );
3576 msi_set_property( package->db, szReinstall, szFeature );
3578 r = MSI_InstallPackage( package, sourcepath, NULL );
3580 msiobj_release( &package->hdr );
3585 UINT WINAPI MsiReinstallFeatureA( LPCSTR szProduct, LPCSTR szFeature,
3586 DWORD dwReinstallMode )
3592 TRACE("%s %s %i\n", debugstr_a(szProduct), debugstr_a(szFeature),
3595 wszProduct = strdupAtoW(szProduct);
3596 wszFeature = strdupAtoW(szFeature);
3598 rc = MsiReinstallFeatureW(wszProduct, wszFeature, dwReinstallMode);
3600 msi_free(wszProduct);
3601 msi_free(wszFeature);
3608 unsigned int buf[4];
3609 unsigned char in[64];
3610 unsigned char digest[16];
3613 extern VOID WINAPI MD5Init( MD5_CTX *);
3614 extern VOID WINAPI MD5Update( MD5_CTX *, const unsigned char *, unsigned int );
3615 extern VOID WINAPI MD5Final( MD5_CTX *);
3617 /***********************************************************************
3618 * MsiGetFileHashW [MSI.@]
3620 UINT WINAPI MsiGetFileHashW( LPCWSTR szFilePath, DWORD dwOptions,
3621 PMSIFILEHASHINFO pHash )
3623 HANDLE handle, mapping;
3626 UINT r = ERROR_FUNCTION_FAILED;
3628 TRACE("%s %08x %p\n", debugstr_w(szFilePath), dwOptions, pHash );
3631 return ERROR_INVALID_PARAMETER;
3634 return ERROR_PATH_NOT_FOUND;
3637 return ERROR_INVALID_PARAMETER;
3639 return ERROR_INVALID_PARAMETER;
3640 if (pHash->dwFileHashInfoSize < sizeof *pHash)
3641 return ERROR_INVALID_PARAMETER;
3643 handle = CreateFileW( szFilePath, GENERIC_READ,
3644 FILE_SHARE_READ | FILE_SHARE_DELETE, NULL, OPEN_EXISTING, 0, NULL );
3645 if (handle == INVALID_HANDLE_VALUE)
3646 return ERROR_FILE_NOT_FOUND;
3648 length = GetFileSize( handle, NULL );
3650 mapping = CreateFileMappingW( handle, NULL, PAGE_READONLY, 0, 0, NULL );
3653 p = MapViewOfFile( mapping, FILE_MAP_READ, 0, 0, length );
3659 MD5Update( &ctx, p, length );
3661 UnmapViewOfFile( p );
3663 memcpy( pHash->dwData, ctx.digest, sizeof pHash->dwData );
3666 CloseHandle( mapping );
3668 CloseHandle( handle );
3673 /***********************************************************************
3674 * MsiGetFileHashA [MSI.@]
3676 UINT WINAPI MsiGetFileHashA( LPCSTR szFilePath, DWORD dwOptions,
3677 PMSIFILEHASHINFO pHash )
3682 TRACE("%s %08x %p\n", debugstr_a(szFilePath), dwOptions, pHash );
3684 file = strdupAtoW( szFilePath );
3685 if (szFilePath && !file)
3686 return ERROR_OUTOFMEMORY;
3688 r = MsiGetFileHashW( file, dwOptions, pHash );
3693 /***********************************************************************
3694 * MsiAdvertiseScriptW [MSI.@]
3696 UINT WINAPI MsiAdvertiseScriptW( LPCWSTR szScriptFile, DWORD dwFlags,
3697 PHKEY phRegData, BOOL fRemoveItems )
3699 FIXME("%s %08x %p %d\n",
3700 debugstr_w( szScriptFile ), dwFlags, phRegData, fRemoveItems );
3701 return ERROR_CALL_NOT_IMPLEMENTED;
3704 /***********************************************************************
3705 * MsiAdvertiseScriptA [MSI.@]
3707 UINT WINAPI MsiAdvertiseScriptA( LPCSTR szScriptFile, DWORD dwFlags,
3708 PHKEY phRegData, BOOL fRemoveItems )
3710 FIXME("%s %08x %p %d\n",
3711 debugstr_a( szScriptFile ), dwFlags, phRegData, fRemoveItems );
3712 return ERROR_CALL_NOT_IMPLEMENTED;
3715 /***********************************************************************
3716 * MsiIsProductElevatedW [MSI.@]
3718 UINT WINAPI MsiIsProductElevatedW( LPCWSTR szProduct, BOOL *pfElevated )
3720 FIXME("%s %p - stub\n",
3721 debugstr_w( szProduct ), pfElevated );
3723 return ERROR_SUCCESS;
3726 /***********************************************************************
3727 * MsiIsProductElevatedA [MSI.@]
3729 UINT WINAPI MsiIsProductElevatedA( LPCSTR szProduct, BOOL *pfElevated )
3731 FIXME("%s %p - stub\n",
3732 debugstr_a( szProduct ), pfElevated );
3734 return ERROR_SUCCESS;
3737 /***********************************************************************
3738 * MsiSetExternalUIRecord [MSI.@]
3740 UINT WINAPI MsiSetExternalUIRecord( INSTALLUI_HANDLER_RECORD handler,
3741 DWORD filter, LPVOID context,
3742 PINSTALLUI_HANDLER_RECORD prev )
3744 TRACE("%p %08x %p %p\n", handler, filter, context, prev);
3747 *prev = gUIHandlerRecord;
3749 gUIHandlerRecord = handler;
3751 gUIContext = context;
3753 return ERROR_SUCCESS;
3756 /***********************************************************************
3757 * MsiInstallMissingComponentW [MSI.@]
3759 UINT WINAPI MsiInstallMissingComponentW(LPCWSTR szProduct, LPCWSTR szComponent, INSTALLSTATE eInstallState)
3761 FIXME("(%s %s %d\n", debugstr_w(szProduct), debugstr_w(szComponent), eInstallState);
3762 return ERROR_SUCCESS;