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 static const WCHAR szAll
[] = {'A','L','L',0};
269 TRACE("%s %08x\n", debugstr_w(szProduct
), dwReinstallMode
);
271 return MsiReinstallFeatureW(szProduct
, szAll
, dwReinstallMode
);
274 UINT WINAPI
MsiApplyPatchA(LPCSTR szPatchPackage
, LPCSTR szInstallPackage
,
275 INSTALLTYPE eInstallType
, LPCSTR szCommandLine
)
277 LPWSTR patch_package
= NULL
;
278 LPWSTR install_package
= NULL
;
279 LPWSTR command_line
= NULL
;
280 UINT r
= ERROR_OUTOFMEMORY
;
282 TRACE("%s %s %d %s\n", debugstr_a(szPatchPackage
), debugstr_a(szInstallPackage
),
283 eInstallType
, debugstr_a(szCommandLine
));
285 if (szPatchPackage
&& !(patch_package
= strdupAtoW(szPatchPackage
)))
288 if (szInstallPackage
&& !(install_package
= strdupAtoW(szInstallPackage
)))
291 if (szCommandLine
&& !(command_line
= strdupAtoW(szCommandLine
)))
294 r
= MsiApplyPatchW(patch_package
, install_package
, eInstallType
, command_line
);
297 msi_free(patch_package
);
298 msi_free(install_package
);
299 msi_free(command_line
);
304 UINT WINAPI
MsiApplyPatchW(LPCWSTR szPatchPackage
, LPCWSTR szInstallPackage
,
305 INSTALLTYPE eInstallType
, LPCWSTR szCommandLine
)
307 MSIHANDLE patch
, info
;
310 LPCWSTR cmd_ptr
= szCommandLine
;
312 LPWSTR cmd
= NULL
, codes
= NULL
;
314 static const WCHAR space
[] = {' ',0};
315 static const WCHAR patcheq
[] = {'P','A','T','C','H','=',0};
316 static WCHAR empty
[] = {0};
318 TRACE("%s %s %d %s\n", debugstr_w(szPatchPackage
), debugstr_w(szInstallPackage
),
319 eInstallType
, debugstr_w(szCommandLine
));
321 if (szInstallPackage
|| eInstallType
== INSTALLTYPE_NETWORK_IMAGE
||
322 eInstallType
== INSTALLTYPE_SINGLE_INSTANCE
)
324 FIXME("Only reading target products from patch\n");
325 return ERROR_CALL_NOT_IMPLEMENTED
;
328 r
= MsiOpenDatabaseW(szPatchPackage
, MSIDBOPEN_READONLY
, &patch
);
329 if (r
!= ERROR_SUCCESS
)
332 r
= MsiGetSummaryInformationW(patch
, NULL
, 0, &info
);
333 if (r
!= ERROR_SUCCESS
)
336 r
= MsiSummaryInfoGetPropertyW(info
, PID_TEMPLATE
, &type
, NULL
, NULL
, empty
, &size
);
337 if (r
!= ERROR_MORE_DATA
|| !size
|| type
!= VT_LPSTR
)
339 ERR("Failed to read product codes from patch\n");
343 codes
= msi_alloc(++size
* sizeof(WCHAR
));
346 r
= ERROR_OUTOFMEMORY
;
350 r
= MsiSummaryInfoGetPropertyW(info
, PID_TEMPLATE
, &type
, NULL
, NULL
, codes
, &size
);
351 if (r
!= ERROR_SUCCESS
)
357 size
= lstrlenW(cmd_ptr
) + lstrlenW(patcheq
) + lstrlenW(szPatchPackage
) + 1;
358 cmd
= msi_alloc(size
* sizeof(WCHAR
));
361 r
= ERROR_OUTOFMEMORY
;
365 lstrcpyW(cmd
, cmd_ptr
);
366 if (szCommandLine
) lstrcatW(cmd
, space
);
367 lstrcatW(cmd
, patcheq
);
368 lstrcatW(cmd
, szPatchPackage
);
371 while ((end
= strchrW(beg
, '}')))
375 r
= MsiConfigureProductExW(beg
, INSTALLLEVEL_DEFAULT
, INSTALLSTATE_DEFAULT
, cmd
);
376 if (r
!= ERROR_SUCCESS
)
386 MsiCloseHandle(info
);
387 MsiCloseHandle(patch
);
392 UINT WINAPI
MsiDetermineApplicablePatchesA(LPCSTR szProductPackagePath
,
393 DWORD cPatchInfo
, PMSIPATCHSEQUENCEINFOA pPatchInfo
)
395 FIXME("(%s, %d, %p): stub!\n", debugstr_a(szProductPackagePath
),
396 cPatchInfo
, pPatchInfo
);
398 return ERROR_CALL_NOT_IMPLEMENTED
;
401 UINT WINAPI
MsiDetermineApplicablePatchesW(LPCWSTR szProductPackagePath
,
402 DWORD cPatchInfo
, PMSIPATCHSEQUENCEINFOW pPatchInfo
)
404 FIXME("(%s, %d, %p): stub!\n", debugstr_w(szProductPackagePath
),
405 cPatchInfo
, pPatchInfo
);
407 return ERROR_CALL_NOT_IMPLEMENTED
;
410 UINT
MsiDeterminePatchSequenceA(LPCSTR szProductCode
, LPCSTR szUserSid
,
411 MSIINSTALLCONTEXT dwContext
, DWORD cPatchInfo
, PMSIPATCHSEQUENCEINFOA pPatchInfo
)
413 FIXME("(%s, %s, %d, %d, %p): stub!\n", debugstr_a(szProductCode
),
414 debugstr_a(szUserSid
), dwContext
, cPatchInfo
, pPatchInfo
);
416 return ERROR_CALL_NOT_IMPLEMENTED
;
419 UINT
MsiDeterminePatchSequenceW(LPCWSTR szProductCode
, LPCWSTR szUserSid
,
420 MSIINSTALLCONTEXT dwContext
, DWORD cPatchInfo
, PMSIPATCHSEQUENCEINFOW pPatchInfo
)
422 FIXME("(%s, %s, %d, %d, %p): stub!\n", debugstr_w(szProductCode
),
423 debugstr_w(szUserSid
), dwContext
, cPatchInfo
, pPatchInfo
);
425 return ERROR_CALL_NOT_IMPLEMENTED
;
428 static UINT
msi_open_package(LPCWSTR product
, MSIINSTALLCONTEXT context
,
429 MSIPACKAGE
**package
)
435 WCHAR sourcepath
[MAX_PATH
];
436 WCHAR filename
[MAX_PATH
];
438 static const WCHAR szLocalPackage
[] = {
439 'L','o','c','a','l','P','a','c','k','a','g','e',0};
442 r
= MSIREG_OpenInstallProps(product
, context
, NULL
, &props
, FALSE
);
443 if (r
!= ERROR_SUCCESS
)
444 return ERROR_BAD_CONFIGURATION
;
446 localpack
= msi_reg_get_val_str(props
, szLocalPackage
);
449 lstrcpyW(sourcepath
, localpack
);
453 if (!localpack
|| GetFileAttributesW(sourcepath
) == INVALID_FILE_ATTRIBUTES
)
455 sz
= sizeof(sourcepath
);
456 MsiSourceListGetInfoW(product
, NULL
, context
, MSICODE_PRODUCT
,
457 INSTALLPROPERTY_LASTUSEDSOURCEW
, sourcepath
, &sz
);
459 sz
= sizeof(filename
);
460 MsiSourceListGetInfoW(product
, NULL
, context
, MSICODE_PRODUCT
,
461 INSTALLPROPERTY_PACKAGENAMEW
, filename
, &sz
);
463 lstrcatW(sourcepath
, filename
);
466 if (GetFileAttributesW(sourcepath
) == INVALID_FILE_ATTRIBUTES
)
467 return ERROR_INSTALL_SOURCE_ABSENT
;
469 return MSI_OpenPackageW(sourcepath
, package
);
472 UINT WINAPI
MsiConfigureProductExW(LPCWSTR szProduct
, int iInstallLevel
,
473 INSTALLSTATE eInstallState
, LPCWSTR szCommandLine
)
475 MSIPACKAGE
* package
= NULL
;
476 MSIINSTALLCONTEXT context
;
479 WCHAR sourcepath
[MAX_PATH
], filename
[MAX_PATH
];
482 static const WCHAR szInstalled
[] = {
483 ' ','I','n','s','t','a','l','l','e','d','=','1',0};
484 static const WCHAR szRemoveAll
[] = {
485 ' ','R','E','M','O','V','E','=','A','L','L',0};
486 static const WCHAR szMachine
[] = {
487 ' ','A','L','L','U','S','E','R','S','=','1',0};
489 TRACE("%s %d %d %s\n",debugstr_w(szProduct
), iInstallLevel
, eInstallState
,
490 debugstr_w(szCommandLine
));
492 if (!szProduct
|| lstrlenW(szProduct
) != GUID_SIZE
- 1)
493 return ERROR_INVALID_PARAMETER
;
495 if (eInstallState
== INSTALLSTATE_ADVERTISED
||
496 eInstallState
== INSTALLSTATE_SOURCE
)
498 FIXME("State %d not implemented\n", eInstallState
);
499 return ERROR_CALL_NOT_IMPLEMENTED
;
502 r
= msi_locate_product(szProduct
, &context
);
503 if (r
!= ERROR_SUCCESS
)
506 r
= msi_open_package(szProduct
, context
, &package
);
507 if (r
!= ERROR_SUCCESS
)
510 sz
= lstrlenW(szInstalled
) + 1;
513 sz
+= lstrlenW(szCommandLine
);
515 if (eInstallState
== INSTALLSTATE_ABSENT
)
516 sz
+= lstrlenW(szRemoveAll
);
518 if (context
== MSIINSTALLCONTEXT_MACHINE
)
519 sz
+= lstrlenW(szMachine
);
521 commandline
= msi_alloc(sz
* sizeof(WCHAR
));
524 r
= ERROR_OUTOFMEMORY
;
530 lstrcpyW(commandline
,szCommandLine
);
532 if (MsiQueryProductStateW(szProduct
) != INSTALLSTATE_UNKNOWN
)
533 lstrcatW(commandline
,szInstalled
);
535 if (eInstallState
== INSTALLSTATE_ABSENT
)
536 lstrcatW(commandline
, szRemoveAll
);
538 if (context
== MSIINSTALLCONTEXT_MACHINE
)
539 lstrcatW(commandline
, szMachine
);
541 sz
= sizeof(sourcepath
);
542 MsiSourceListGetInfoW(szProduct
, NULL
, context
, MSICODE_PRODUCT
,
543 INSTALLPROPERTY_LASTUSEDSOURCEW
, sourcepath
, &sz
);
545 sz
= sizeof(filename
);
546 MsiSourceListGetInfoW(szProduct
, NULL
, context
, MSICODE_PRODUCT
,
547 INSTALLPROPERTY_PACKAGENAMEW
, filename
, &sz
);
549 strcatW(sourcepath
, filename
);
551 r
= MSI_InstallPackage( package
, sourcepath
, commandline
);
553 msi_free(commandline
);
556 msiobj_release( &package
->hdr
);
561 UINT WINAPI
MsiConfigureProductExA(LPCSTR szProduct
, int iInstallLevel
,
562 INSTALLSTATE eInstallState
, LPCSTR szCommandLine
)
564 LPWSTR szwProduct
= NULL
;
565 LPWSTR szwCommandLine
= NULL
;
566 UINT r
= ERROR_OUTOFMEMORY
;
570 szwProduct
= strdupAtoW( szProduct
);
577 szwCommandLine
= strdupAtoW( szCommandLine
);
582 r
= MsiConfigureProductExW( szwProduct
, iInstallLevel
, eInstallState
,
585 msi_free( szwProduct
);
586 msi_free( szwCommandLine
);
591 UINT WINAPI
MsiConfigureProductA(LPCSTR szProduct
, int iInstallLevel
,
592 INSTALLSTATE eInstallState
)
594 LPWSTR szwProduct
= NULL
;
597 TRACE("%s %d %d\n",debugstr_a(szProduct
), iInstallLevel
, eInstallState
);
601 szwProduct
= strdupAtoW( szProduct
);
603 return ERROR_OUTOFMEMORY
;
606 r
= MsiConfigureProductW( szwProduct
, iInstallLevel
, eInstallState
);
607 msi_free( szwProduct
);
612 UINT WINAPI
MsiConfigureProductW(LPCWSTR szProduct
, int iInstallLevel
,
613 INSTALLSTATE eInstallState
)
615 return MsiConfigureProductExW(szProduct
, iInstallLevel
, eInstallState
, NULL
);
618 UINT WINAPI
MsiGetProductCodeA(LPCSTR szComponent
, LPSTR szBuffer
)
620 LPWSTR szwComponent
= NULL
;
622 WCHAR szwBuffer
[GUID_SIZE
];
624 TRACE("%s %s\n",debugstr_a(szComponent
), debugstr_a(szBuffer
));
628 szwComponent
= strdupAtoW( szComponent
);
630 return ERROR_OUTOFMEMORY
;
634 r
= MsiGetProductCodeW( szwComponent
, szwBuffer
);
637 WideCharToMultiByte(CP_ACP
, 0, szwBuffer
, -1, szBuffer
, GUID_SIZE
, NULL
, NULL
);
639 msi_free( szwComponent
);
644 UINT WINAPI
MsiGetProductCodeW(LPCWSTR szComponent
, LPWSTR szBuffer
)
647 HKEY compkey
, prodkey
;
648 WCHAR squished_comp
[GUID_SIZE
];
649 WCHAR squished_prod
[GUID_SIZE
];
650 DWORD sz
= GUID_SIZE
;
652 TRACE("%s %p\n", debugstr_w(szComponent
), szBuffer
);
654 if (!szComponent
|| !*szComponent
)
655 return ERROR_INVALID_PARAMETER
;
657 if (!squash_guid(szComponent
, squished_comp
))
658 return ERROR_INVALID_PARAMETER
;
660 if (MSIREG_OpenUserDataComponentKey(szComponent
, NULL
, &compkey
, FALSE
) != ERROR_SUCCESS
&&
661 MSIREG_OpenUserDataComponentKey(szComponent
, szLocalSid
, &compkey
, FALSE
) != ERROR_SUCCESS
)
663 return ERROR_UNKNOWN_COMPONENT
;
666 rc
= RegEnumValueW(compkey
, 0, squished_prod
, &sz
, NULL
, NULL
, NULL
, NULL
);
667 if (rc
!= ERROR_SUCCESS
)
669 RegCloseKey(compkey
);
670 return ERROR_UNKNOWN_COMPONENT
;
673 /* check simple case, only one product */
674 rc
= RegEnumValueW(compkey
, 1, squished_prod
, &sz
, NULL
, NULL
, NULL
, NULL
);
675 if (rc
== ERROR_NO_MORE_ITEMS
)
682 while ((rc
= RegEnumValueW(compkey
, index
, squished_prod
, &sz
,
683 NULL
, NULL
, NULL
, NULL
)) != ERROR_NO_MORE_ITEMS
)
687 unsquash_guid(squished_prod
, szBuffer
);
689 if (MSIREG_OpenProductKey(szBuffer
, NULL
,
690 MSIINSTALLCONTEXT_USERMANAGED
,
691 &prodkey
, FALSE
) == ERROR_SUCCESS
||
692 MSIREG_OpenProductKey(szBuffer
, NULL
,
693 MSIINSTALLCONTEXT_USERUNMANAGED
,
694 &prodkey
, FALSE
) == ERROR_SUCCESS
||
695 MSIREG_OpenProductKey(szBuffer
, NULL
,
696 MSIINSTALLCONTEXT_MACHINE
,
697 &prodkey
, FALSE
) == ERROR_SUCCESS
)
699 RegCloseKey(prodkey
);
705 rc
= ERROR_INSTALL_FAILURE
;
708 RegCloseKey(compkey
);
709 unsquash_guid(squished_prod
, szBuffer
);
713 static LPWSTR
msi_reg_get_value(HKEY hkey
, LPCWSTR name
, DWORD
*type
)
719 static const WCHAR format
[] = {'%','d',0};
721 res
= RegQueryValueExW(hkey
, name
, NULL
, type
, NULL
, NULL
);
722 if (res
!= ERROR_SUCCESS
)
726 return msi_reg_get_val_str(hkey
, name
);
728 if (!msi_reg_get_val_dword(hkey
, name
, &dval
))
731 sprintfW(temp
, format
, dval
);
732 return strdupW(temp
);
735 static UINT
MSI_GetProductInfo(LPCWSTR szProduct
, LPCWSTR szAttribute
,
736 awstring
*szValue
, LPDWORD pcchValueBuf
)
738 MSIINSTALLCONTEXT context
= MSIINSTALLCONTEXT_USERUNMANAGED
;
739 UINT r
= ERROR_UNKNOWN_PROPERTY
;
740 HKEY prodkey
, userdata
, source
;
742 WCHAR squished_pc
[GUID_SIZE
];
743 WCHAR packagecode
[GUID_SIZE
];
744 BOOL badconfig
= FALSE
;
746 DWORD save
, type
= REG_NONE
;
748 static WCHAR empty
[] = {0};
749 static const WCHAR sourcelist
[] = {
750 'S','o','u','r','c','e','L','i','s','t',0};
751 static const WCHAR display_name
[] = {
752 'D','i','s','p','l','a','y','N','a','m','e',0};
753 static const WCHAR display_version
[] = {
754 'D','i','s','p','l','a','y','V','e','r','s','i','o','n',0};
755 static const WCHAR assignment
[] = {
756 'A','s','s','i','g','n','m','e','n','t',0};
758 TRACE("%s %s %p %p\n", debugstr_w(szProduct
),
759 debugstr_w(szAttribute
), szValue
, pcchValueBuf
);
761 if ((szValue
->str
.w
&& !pcchValueBuf
) || !szProduct
|| !szAttribute
)
762 return ERROR_INVALID_PARAMETER
;
764 if (!squash_guid(szProduct
, squished_pc
))
765 return ERROR_INVALID_PARAMETER
;
767 if ((r
= MSIREG_OpenProductKey(szProduct
, NULL
,
768 MSIINSTALLCONTEXT_USERMANAGED
,
769 &prodkey
, FALSE
)) != ERROR_SUCCESS
&&
770 (r
= MSIREG_OpenProductKey(szProduct
, NULL
,
771 MSIINSTALLCONTEXT_USERUNMANAGED
,
772 &prodkey
, FALSE
)) != ERROR_SUCCESS
&&
773 (r
= MSIREG_OpenProductKey(szProduct
, NULL
,
774 MSIINSTALLCONTEXT_MACHINE
,
775 &prodkey
, FALSE
)) == ERROR_SUCCESS
)
777 context
= MSIINSTALLCONTEXT_MACHINE
;
780 MSIREG_OpenInstallProps(szProduct
, context
, NULL
, &userdata
, FALSE
);
782 if (!lstrcmpW(szAttribute
, INSTALLPROPERTY_HELPLINKW
) ||
783 !lstrcmpW(szAttribute
, INSTALLPROPERTY_HELPTELEPHONEW
) ||
784 !lstrcmpW(szAttribute
, INSTALLPROPERTY_INSTALLDATEW
) ||
785 !lstrcmpW(szAttribute
, INSTALLPROPERTY_INSTALLEDPRODUCTNAMEW
) ||
786 !lstrcmpW(szAttribute
, INSTALLPROPERTY_INSTALLLOCATIONW
) ||
787 !lstrcmpW(szAttribute
, INSTALLPROPERTY_INSTALLSOURCEW
) ||
788 !lstrcmpW(szAttribute
, INSTALLPROPERTY_LOCALPACKAGEW
) ||
789 !lstrcmpW(szAttribute
, INSTALLPROPERTY_PUBLISHERW
) ||
790 !lstrcmpW(szAttribute
, INSTALLPROPERTY_URLINFOABOUTW
) ||
791 !lstrcmpW(szAttribute
, INSTALLPROPERTY_URLUPDATEINFOW
) ||
792 !lstrcmpW(szAttribute
, INSTALLPROPERTY_VERSIONMINORW
) ||
793 !lstrcmpW(szAttribute
, INSTALLPROPERTY_VERSIONMAJORW
) ||
794 !lstrcmpW(szAttribute
, INSTALLPROPERTY_VERSIONSTRINGW
) ||
795 !lstrcmpW(szAttribute
, INSTALLPROPERTY_PRODUCTIDW
) ||
796 !lstrcmpW(szAttribute
, INSTALLPROPERTY_REGCOMPANYW
) ||
797 !lstrcmpW(szAttribute
, INSTALLPROPERTY_REGOWNERW
))
801 r
= ERROR_UNKNOWN_PRODUCT
;
806 return ERROR_UNKNOWN_PROPERTY
;
808 if (!lstrcmpW(szAttribute
, INSTALLPROPERTY_INSTALLEDPRODUCTNAMEW
))
809 szAttribute
= display_name
;
810 else if (!lstrcmpW(szAttribute
, INSTALLPROPERTY_VERSIONSTRINGW
))
811 szAttribute
= display_version
;
813 val
= msi_reg_get_value(userdata
, szAttribute
, &type
);
817 else if (!lstrcmpW(szAttribute
, INSTALLPROPERTY_INSTANCETYPEW
) ||
818 !lstrcmpW(szAttribute
, INSTALLPROPERTY_TRANSFORMSW
) ||
819 !lstrcmpW(szAttribute
, INSTALLPROPERTY_LANGUAGEW
) ||
820 !lstrcmpW(szAttribute
, INSTALLPROPERTY_PRODUCTNAMEW
) ||
821 !lstrcmpW(szAttribute
, INSTALLPROPERTY_ASSIGNMENTTYPEW
) ||
822 !lstrcmpW(szAttribute
, INSTALLPROPERTY_PACKAGECODEW
) ||
823 !lstrcmpW(szAttribute
, INSTALLPROPERTY_VERSIONW
) ||
824 !lstrcmpW(szAttribute
, INSTALLPROPERTY_PRODUCTICONW
) ||
825 !lstrcmpW(szAttribute
, INSTALLPROPERTY_PACKAGENAMEW
) ||
826 !lstrcmpW(szAttribute
, INSTALLPROPERTY_AUTHORIZED_LUA_APPW
))
830 r
= ERROR_UNKNOWN_PRODUCT
;
834 if (!lstrcmpW(szAttribute
, INSTALLPROPERTY_ASSIGNMENTTYPEW
))
835 szAttribute
= assignment
;
837 if (!lstrcmpW(szAttribute
, INSTALLPROPERTY_PACKAGENAMEW
))
839 res
= RegOpenKeyW(prodkey
, sourcelist
, &source
);
840 if (res
!= ERROR_SUCCESS
)
842 r
= ERROR_UNKNOWN_PRODUCT
;
846 val
= msi_reg_get_value(source
, szAttribute
, &type
);
854 val
= msi_reg_get_value(prodkey
, szAttribute
, &type
);
859 if (val
!= empty
&& type
!= REG_DWORD
&&
860 !lstrcmpW(szAttribute
, INSTALLPROPERTY_PACKAGECODEW
))
862 if (lstrlenW(val
) != SQUISH_GUID_SIZE
- 1)
866 unsquash_guid(val
, packagecode
);
868 val
= strdupW(packagecode
);
875 r
= ERROR_UNKNOWN_PROPERTY
;
881 save
= *pcchValueBuf
;
883 if (strlenW(val
) < *pcchValueBuf
)
884 r
= msi_strcpy_to_awstring(val
, szValue
, pcchValueBuf
);
885 else if (szValue
->str
.a
|| szValue
->str
.w
)
889 *pcchValueBuf
= lstrlenW(val
);
890 else if (r
== ERROR_SUCCESS
)
892 *pcchValueBuf
= save
;
893 r
= ERROR_BAD_CONFIGURATION
;
897 r
= ERROR_BAD_CONFIGURATION
;
903 RegCloseKey(prodkey
);
904 RegCloseKey(userdata
);
908 UINT WINAPI
MsiGetProductInfoA(LPCSTR szProduct
, LPCSTR szAttribute
,
909 LPSTR szBuffer
, LPDWORD pcchValueBuf
)
911 LPWSTR szwProduct
, szwAttribute
= NULL
;
912 UINT r
= ERROR_OUTOFMEMORY
;
915 TRACE("%s %s %p %p\n", debugstr_a(szProduct
), debugstr_a(szAttribute
),
916 szBuffer
, pcchValueBuf
);
918 szwProduct
= strdupAtoW( szProduct
);
919 if( szProduct
&& !szwProduct
)
922 szwAttribute
= strdupAtoW( szAttribute
);
923 if( szAttribute
&& !szwAttribute
)
926 buffer
.unicode
= FALSE
;
927 buffer
.str
.a
= szBuffer
;
929 r
= MSI_GetProductInfo( szwProduct
, szwAttribute
,
930 &buffer
, pcchValueBuf
);
933 msi_free( szwProduct
);
934 msi_free( szwAttribute
);
939 UINT WINAPI
MsiGetProductInfoW(LPCWSTR szProduct
, LPCWSTR szAttribute
,
940 LPWSTR szBuffer
, LPDWORD pcchValueBuf
)
944 TRACE("%s %s %p %p\n", debugstr_w(szProduct
), debugstr_w(szAttribute
),
945 szBuffer
, pcchValueBuf
);
947 buffer
.unicode
= TRUE
;
948 buffer
.str
.w
= szBuffer
;
950 return MSI_GetProductInfo( szProduct
, szAttribute
,
951 &buffer
, pcchValueBuf
);
954 UINT WINAPI
MsiGetProductInfoExA(LPCSTR szProductCode
, LPCSTR szUserSid
,
955 MSIINSTALLCONTEXT dwContext
, LPCSTR szProperty
,
956 LPSTR szValue
, LPDWORD pcchValue
)
958 LPWSTR product
= NULL
;
959 LPWSTR usersid
= NULL
;
960 LPWSTR property
= NULL
;
965 TRACE("(%s, %s, %d, %s, %p, %p)\n", debugstr_a(szProductCode
),
966 debugstr_a(szUserSid
), dwContext
, debugstr_a(szProperty
),
969 if (szValue
&& !pcchValue
)
970 return ERROR_INVALID_PARAMETER
;
972 if (szProductCode
) product
= strdupAtoW(szProductCode
);
973 if (szUserSid
) usersid
= strdupAtoW(szUserSid
);
974 if (szProperty
) property
= strdupAtoW(szProperty
);
976 r
= MsiGetProductInfoExW(product
, usersid
, dwContext
, property
,
978 if (r
!= ERROR_SUCCESS
)
981 value
= msi_alloc(++len
* sizeof(WCHAR
));
984 r
= ERROR_OUTOFMEMORY
;
988 r
= MsiGetProductInfoExW(product
, usersid
, dwContext
, property
,
990 if (r
!= ERROR_SUCCESS
)
996 len
= WideCharToMultiByte(CP_ACP
, 0, value
, -1, NULL
, 0, NULL
, NULL
);
997 if (*pcchValue
>= len
)
998 WideCharToMultiByte(CP_ACP
, 0, value
, -1, szValue
, len
, NULL
, NULL
);
1001 r
= ERROR_MORE_DATA
;
1006 if (*pcchValue
<= len
|| !szValue
)
1007 len
= len
* sizeof(WCHAR
) - 1;
1009 *pcchValue
= len
- 1;
1020 static UINT
msi_copy_outval(LPWSTR val
, LPWSTR out
, LPDWORD size
)
1025 return ERROR_UNKNOWN_PROPERTY
;
1029 if (strlenW(val
) >= *size
)
1031 r
= ERROR_MORE_DATA
;
1040 *size
= lstrlenW(val
);
1042 return ERROR_SUCCESS
;
1045 UINT WINAPI
MsiGetProductInfoExW(LPCWSTR szProductCode
, LPCWSTR szUserSid
,
1046 MSIINSTALLCONTEXT dwContext
, LPCWSTR szProperty
,
1047 LPWSTR szValue
, LPDWORD pcchValue
)
1049 WCHAR squished_pc
[GUID_SIZE
];
1051 LPCWSTR package
= NULL
;
1052 HKEY props
= NULL
, prod
;
1053 HKEY classes
= NULL
, managed
;
1056 UINT r
= ERROR_UNKNOWN_PRODUCT
;
1058 static const WCHAR one
[] = {'1',0};
1059 static const WCHAR five
[] = {'5',0};
1060 static const WCHAR empty
[] = {0};
1061 static const WCHAR displayname
[] = {
1062 'D','i','s','p','l','a','y','N','a','m','e',0};
1063 static const WCHAR displayversion
[] = {
1064 'D','i','s','p','l','a','y','V','e','r','s','i','o','n',0};
1065 static const WCHAR managed_local_package
[] = {
1066 'M','a','n','a','g','e','d','L','o','c','a','l',
1067 'P','a','c','k','a','g','e',0};
1069 TRACE("(%s, %s, %d, %s, %p, %p)\n", debugstr_w(szProductCode
),
1070 debugstr_w(szUserSid
), dwContext
, debugstr_w(szProperty
),
1071 szValue
, pcchValue
);
1073 if (!szProductCode
|| !squash_guid(szProductCode
, squished_pc
))
1074 return ERROR_INVALID_PARAMETER
;
1076 if (szValue
&& !pcchValue
)
1077 return ERROR_INVALID_PARAMETER
;
1079 if (dwContext
!= MSIINSTALLCONTEXT_USERUNMANAGED
&&
1080 dwContext
!= MSIINSTALLCONTEXT_USERMANAGED
&&
1081 dwContext
!= MSIINSTALLCONTEXT_MACHINE
)
1082 return ERROR_INVALID_PARAMETER
;
1084 if (!szProperty
|| !*szProperty
)
1085 return ERROR_INVALID_PARAMETER
;
1087 if (dwContext
== MSIINSTALLCONTEXT_MACHINE
&& szUserSid
)
1088 return ERROR_INVALID_PARAMETER
;
1090 /* FIXME: dwContext is provided, no need to search for it */
1091 MSIREG_OpenProductKey(szProductCode
, NULL
,MSIINSTALLCONTEXT_USERMANAGED
,
1093 MSIREG_OpenProductKey(szProductCode
, NULL
, MSIINSTALLCONTEXT_USERUNMANAGED
,
1096 MSIREG_OpenInstallProps(szProductCode
, dwContext
, NULL
, &props
, FALSE
);
1098 if (dwContext
== MSIINSTALLCONTEXT_USERUNMANAGED
)
1100 package
= INSTALLPROPERTY_LOCALPACKAGEW
;
1102 if (!props
&& !prod
)
1105 else if (dwContext
== MSIINSTALLCONTEXT_USERMANAGED
)
1107 package
= managed_local_package
;
1109 if (!props
&& !managed
)
1112 else if (dwContext
== MSIINSTALLCONTEXT_MACHINE
)
1114 package
= INSTALLPROPERTY_LOCALPACKAGEW
;
1115 MSIREG_OpenProductKey(szProductCode
, NULL
, dwContext
, &classes
, FALSE
);
1117 if (!props
&& !classes
)
1121 if (!lstrcmpW(szProperty
, INSTALLPROPERTY_HELPLINKW
) ||
1122 !lstrcmpW(szProperty
, INSTALLPROPERTY_HELPTELEPHONEW
) ||
1123 !lstrcmpW(szProperty
, INSTALLPROPERTY_INSTALLDATEW
) ||
1124 !lstrcmpW(szProperty
, INSTALLPROPERTY_INSTALLEDPRODUCTNAMEW
) ||
1125 !lstrcmpW(szProperty
, INSTALLPROPERTY_INSTALLLOCATIONW
) ||
1126 !lstrcmpW(szProperty
, INSTALLPROPERTY_INSTALLSOURCEW
) ||
1127 !lstrcmpW(szProperty
, INSTALLPROPERTY_LOCALPACKAGEW
) ||
1128 !lstrcmpW(szProperty
, INSTALLPROPERTY_PUBLISHERW
) ||
1129 !lstrcmpW(szProperty
, INSTALLPROPERTY_URLINFOABOUTW
) ||
1130 !lstrcmpW(szProperty
, INSTALLPROPERTY_URLUPDATEINFOW
) ||
1131 !lstrcmpW(szProperty
, INSTALLPROPERTY_VERSIONMINORW
) ||
1132 !lstrcmpW(szProperty
, INSTALLPROPERTY_VERSIONMAJORW
) ||
1133 !lstrcmpW(szProperty
, INSTALLPROPERTY_VERSIONSTRINGW
) ||
1134 !lstrcmpW(szProperty
, INSTALLPROPERTY_PRODUCTIDW
) ||
1135 !lstrcmpW(szProperty
, INSTALLPROPERTY_REGCOMPANYW
) ||
1136 !lstrcmpW(szProperty
, INSTALLPROPERTY_REGOWNERW
) ||
1137 !lstrcmpW(szProperty
, INSTALLPROPERTY_INSTANCETYPEW
))
1139 val
= msi_reg_get_value(props
, package
, &type
);
1142 if (prod
|| classes
)
1143 r
= ERROR_UNKNOWN_PROPERTY
;
1150 if (!lstrcmpW(szProperty
, INSTALLPROPERTY_INSTALLEDPRODUCTNAMEW
))
1151 szProperty
= displayname
;
1152 else if (!lstrcmpW(szProperty
, INSTALLPROPERTY_VERSIONSTRINGW
))
1153 szProperty
= displayversion
;
1155 val
= msi_reg_get_value(props
, szProperty
, &type
);
1157 val
= strdupW(empty
);
1159 r
= msi_copy_outval(val
, szValue
, pcchValue
);
1161 else if (!lstrcmpW(szProperty
, INSTALLPROPERTY_TRANSFORMSW
) ||
1162 !lstrcmpW(szProperty
, INSTALLPROPERTY_LANGUAGEW
) ||
1163 !lstrcmpW(szProperty
, INSTALLPROPERTY_PRODUCTNAMEW
) ||
1164 !lstrcmpW(szProperty
, INSTALLPROPERTY_PACKAGECODEW
) ||
1165 !lstrcmpW(szProperty
, INSTALLPROPERTY_VERSIONW
) ||
1166 !lstrcmpW(szProperty
, INSTALLPROPERTY_PRODUCTICONW
) ||
1167 !lstrcmpW(szProperty
, INSTALLPROPERTY_PACKAGENAMEW
) ||
1168 !lstrcmpW(szProperty
, INSTALLPROPERTY_AUTHORIZED_LUA_APPW
))
1170 if (!prod
&& !classes
)
1173 if (dwContext
== MSIINSTALLCONTEXT_USERUNMANAGED
)
1175 else if (dwContext
== MSIINSTALLCONTEXT_USERMANAGED
)
1177 else if (dwContext
== MSIINSTALLCONTEXT_MACHINE
)
1180 val
= msi_reg_get_value(hkey
, szProperty
, &type
);
1182 val
= strdupW(empty
);
1184 r
= msi_copy_outval(val
, szValue
, pcchValue
);
1186 else if (!lstrcmpW(szProperty
, INSTALLPROPERTY_PRODUCTSTATEW
))
1188 if (dwContext
== MSIINSTALLCONTEXT_MACHINE
)
1192 val
= msi_reg_get_value(props
, package
, &type
);
1197 val
= strdupW(five
);
1202 r
= msi_copy_outval(val
, szValue
, pcchValue
);
1205 else if (props
&& (val
= msi_reg_get_value(props
, package
, &type
)))
1208 val
= strdupW(five
);
1209 r
= msi_copy_outval(val
, szValue
, pcchValue
);
1213 if (prod
|| managed
)
1218 r
= msi_copy_outval(val
, szValue
, pcchValue
);
1220 else if (!lstrcmpW(szProperty
, INSTALLPROPERTY_ASSIGNMENTTYPEW
))
1222 if (!prod
&& !classes
)
1226 val
= strdupW(empty
);
1227 r
= msi_copy_outval(val
, szValue
, pcchValue
);
1230 r
= ERROR_UNKNOWN_PROPERTY
;
1235 RegCloseKey(managed
);
1236 RegCloseKey(classes
);
1242 UINT WINAPI
MsiGetPatchInfoExA(LPCSTR szPatchCode
, LPCSTR szProductCode
,
1243 LPCSTR szUserSid
, MSIINSTALLCONTEXT dwContext
,
1244 LPCSTR szProperty
, LPSTR lpValue
, DWORD
*pcchValue
)
1246 LPWSTR patch
= NULL
, product
= NULL
, usersid
= NULL
;
1247 LPWSTR property
= NULL
, val
= NULL
;
1251 TRACE("(%s, %s, %s, %d, %s, %p, %p)\n", debugstr_a(szPatchCode
),
1252 debugstr_a(szProductCode
), debugstr_a(szUserSid
), dwContext
,
1253 debugstr_a(szProperty
), lpValue
, pcchValue
);
1255 if (lpValue
&& !pcchValue
)
1256 return ERROR_INVALID_PARAMETER
;
1258 if (szPatchCode
) patch
= strdupAtoW(szPatchCode
);
1259 if (szProductCode
) product
= strdupAtoW(szProductCode
);
1260 if (szUserSid
) usersid
= strdupAtoW(szUserSid
);
1261 if (szProperty
) property
= strdupAtoW(szProperty
);
1264 r
= MsiGetPatchInfoExW(patch
, product
, usersid
, dwContext
, property
,
1266 if (r
!= ERROR_SUCCESS
)
1269 val
= msi_alloc(++len
* sizeof(WCHAR
));
1272 r
= ERROR_OUTOFMEMORY
;
1276 r
= MsiGetPatchInfoExW(patch
, product
, usersid
, dwContext
, property
,
1278 if (r
!= ERROR_SUCCESS
|| !pcchValue
)
1282 WideCharToMultiByte(CP_ACP
, 0, val
, -1, lpValue
,
1283 *pcchValue
- 1, NULL
, NULL
);
1285 len
= lstrlenW(val
);
1286 if ((*val
&& *pcchValue
< len
+ 1) || !lpValue
)
1290 r
= ERROR_MORE_DATA
;
1291 lpValue
[*pcchValue
- 1] = '\0';
1294 *pcchValue
= len
* sizeof(WCHAR
);
1309 UINT WINAPI
MsiGetPatchInfoExW(LPCWSTR szPatchCode
, LPCWSTR szProductCode
,
1310 LPCWSTR szUserSid
, MSIINSTALLCONTEXT dwContext
,
1311 LPCWSTR szProperty
, LPWSTR lpValue
, DWORD
*pcchValue
)
1313 WCHAR squished_pc
[GUID_SIZE
];
1314 WCHAR squished_patch
[GUID_SIZE
];
1315 HKEY udprod
= 0, prod
= 0, props
= 0;
1316 HKEY patch
= 0, patches
= 0;
1317 HKEY udpatch
= 0, datakey
= 0;
1318 HKEY prodpatches
= 0;
1320 UINT r
= ERROR_UNKNOWN_PRODUCT
;
1324 static const WCHAR szEmpty
[] = {0};
1325 static const WCHAR szPatches
[] = {'P','a','t','c','h','e','s',0};
1326 static const WCHAR szInstalled
[] = {'I','n','s','t','a','l','l','e','d',0};
1327 static const WCHAR szManagedPackage
[] = {'M','a','n','a','g','e','d',
1328 'L','o','c','a','l','P','a','c','k','a','g','e',0};
1330 TRACE("(%s, %s, %s, %d, %s, %p, %p)\n", debugstr_w(szPatchCode
),
1331 debugstr_w(szProductCode
), debugstr_w(szUserSid
), dwContext
,
1332 debugstr_w(szProperty
), lpValue
, pcchValue
);
1334 if (!szProductCode
|| !squash_guid(szProductCode
, squished_pc
))
1335 return ERROR_INVALID_PARAMETER
;
1337 if (!szPatchCode
|| !squash_guid(szPatchCode
, squished_patch
))
1338 return ERROR_INVALID_PARAMETER
;
1341 return ERROR_INVALID_PARAMETER
;
1343 if (lpValue
&& !pcchValue
)
1344 return ERROR_INVALID_PARAMETER
;
1346 if (dwContext
!= MSIINSTALLCONTEXT_USERMANAGED
&&
1347 dwContext
!= MSIINSTALLCONTEXT_USERUNMANAGED
&&
1348 dwContext
!= MSIINSTALLCONTEXT_MACHINE
)
1349 return ERROR_INVALID_PARAMETER
;
1351 if (dwContext
== MSIINSTALLCONTEXT_MACHINE
&& szUserSid
)
1352 return ERROR_INVALID_PARAMETER
;
1354 if (!lstrcmpW(szUserSid
, szLocalSid
))
1355 return ERROR_INVALID_PARAMETER
;
1357 if (MSIREG_OpenUserDataProductKey(szProductCode
, dwContext
, NULL
,
1358 &udprod
, FALSE
) != ERROR_SUCCESS
)
1361 if (MSIREG_OpenInstallProps(szProductCode
, dwContext
, NULL
,
1362 &props
, FALSE
) != ERROR_SUCCESS
)
1365 r
= ERROR_UNKNOWN_PATCH
;
1367 res
= RegOpenKeyExW(udprod
, szPatches
, 0, KEY_READ
, &patches
);
1368 if (res
!= ERROR_SUCCESS
)
1371 res
= RegOpenKeyExW(patches
, squished_patch
, 0, KEY_READ
, &patch
);
1372 if (res
!= ERROR_SUCCESS
)
1375 if (!lstrcmpW(szProperty
, INSTALLPROPERTY_TRANSFORMSW
))
1377 if (MSIREG_OpenProductKey(szProductCode
, NULL
, dwContext
,
1378 &prod
, FALSE
) != ERROR_SUCCESS
)
1381 res
= RegOpenKeyExW(prod
, szPatches
, 0, KEY_ALL_ACCESS
, &prodpatches
);
1382 if (res
!= ERROR_SUCCESS
)
1385 datakey
= prodpatches
;
1386 szProperty
= squished_patch
;
1390 if (MSIREG_OpenUserDataPatchKey(szPatchCode
, dwContext
,
1391 &udpatch
, FALSE
) != ERROR_SUCCESS
)
1394 if (!lstrcmpW(szProperty
, INSTALLPROPERTY_LOCALPACKAGEW
))
1396 if (dwContext
== MSIINSTALLCONTEXT_USERMANAGED
)
1397 szProperty
= szManagedPackage
;
1400 else if (!lstrcmpW(szProperty
, INSTALLPROPERTY_INSTALLDATEW
))
1403 szProperty
= szInstalled
;
1405 else if (!lstrcmpW(szProperty
, INSTALLPROPERTY_LOCALPACKAGEW
))
1409 else if (!lstrcmpW(szProperty
, INSTALLPROPERTY_UNINSTALLABLEW
) ||
1410 !lstrcmpW(szProperty
, INSTALLPROPERTY_PATCHSTATEW
) ||
1411 !lstrcmpW(szProperty
, INSTALLPROPERTY_DISPLAYNAMEW
) ||
1412 !lstrcmpW(szProperty
, INSTALLPROPERTY_MOREINFOURLW
))
1418 r
= ERROR_UNKNOWN_PROPERTY
;
1423 val
= msi_reg_get_val_str(datakey
, szProperty
);
1425 val
= strdupW(szEmpty
);
1433 lstrcpynW(lpValue
, val
, *pcchValue
);
1435 len
= lstrlenW(val
);
1436 if ((*val
&& *pcchValue
< len
+ 1) || !lpValue
)
1439 r
= ERROR_MORE_DATA
;
1441 *pcchValue
= len
* sizeof(WCHAR
);
1448 RegCloseKey(prodpatches
);
1451 RegCloseKey(patches
);
1452 RegCloseKey(udpatch
);
1454 RegCloseKey(udprod
);
1459 UINT WINAPI
MsiEnableLogA(DWORD dwLogMode
, LPCSTR szLogFile
, DWORD attributes
)
1461 LPWSTR szwLogFile
= NULL
;
1464 TRACE("%08x %s %08x\n", dwLogMode
, debugstr_a(szLogFile
), attributes
);
1468 szwLogFile
= strdupAtoW( szLogFile
);
1470 return ERROR_OUTOFMEMORY
;
1472 r
= MsiEnableLogW( dwLogMode
, szwLogFile
, attributes
);
1473 msi_free( szwLogFile
);
1477 UINT WINAPI
MsiEnableLogW(DWORD dwLogMode
, LPCWSTR szLogFile
, DWORD attributes
)
1479 HANDLE file
= INVALID_HANDLE_VALUE
;
1481 TRACE("%08x %s %08x\n", dwLogMode
, debugstr_w(szLogFile
), attributes
);
1485 lstrcpyW(gszLogFile
,szLogFile
);
1486 if (!(attributes
& INSTALLLOGATTRIBUTES_APPEND
))
1487 DeleteFileW(szLogFile
);
1488 file
= CreateFileW(szLogFile
, GENERIC_WRITE
, 0, NULL
, OPEN_ALWAYS
,
1489 FILE_ATTRIBUTE_NORMAL
, NULL
);
1490 if (file
!= INVALID_HANDLE_VALUE
)
1493 ERR("Unable to enable log %s\n",debugstr_w(szLogFile
));
1496 gszLogFile
[0] = '\0';
1498 return ERROR_SUCCESS
;
1501 UINT WINAPI
MsiEnumComponentCostsW(MSIHANDLE hInstall
, LPCWSTR szComponent
,
1502 DWORD dwIndex
, INSTALLSTATE iState
,
1503 LPWSTR lpDriveBuf
, DWORD
*pcchDriveBuf
,
1504 int *piCost
, int *pTempCost
)
1506 FIXME("(%d, %s, %d, %d, %p, %p, %p %p): stub!\n", hInstall
,
1507 debugstr_w(szComponent
), dwIndex
, iState
, lpDriveBuf
,
1508 pcchDriveBuf
, piCost
, pTempCost
);
1510 return ERROR_NO_MORE_ITEMS
;
1513 UINT WINAPI
MsiQueryComponentStateA(LPCSTR szProductCode
,
1514 LPCSTR szUserSid
, MSIINSTALLCONTEXT dwContext
,
1515 LPCSTR szComponent
, INSTALLSTATE
*pdwState
)
1517 LPWSTR prodcode
= NULL
, usersid
= NULL
, comp
= NULL
;
1520 TRACE("(%s, %s, %d, %s, %p)\n", debugstr_a(szProductCode
),
1521 debugstr_a(szUserSid
), dwContext
, debugstr_a(szComponent
), pdwState
);
1523 if (szProductCode
&& !(prodcode
= strdupAtoW(szProductCode
)))
1524 return ERROR_OUTOFMEMORY
;
1526 if (szUserSid
&& !(usersid
= strdupAtoW(szUserSid
)))
1527 return ERROR_OUTOFMEMORY
;
1529 if (szComponent
&& !(comp
= strdupAtoW(szComponent
)))
1530 return ERROR_OUTOFMEMORY
;
1532 r
= MsiQueryComponentStateW(prodcode
, usersid
, dwContext
, comp
, pdwState
);
1541 static BOOL
msi_comp_find_prod_key(LPCWSTR prodcode
, MSIINSTALLCONTEXT context
)
1546 r
= MSIREG_OpenProductKey(prodcode
, NULL
, context
, &hkey
, FALSE
);
1548 return (r
== ERROR_SUCCESS
);
1551 static BOOL
msi_comp_find_package(LPCWSTR prodcode
, MSIINSTALLCONTEXT context
)
1559 static const WCHAR local_package
[] = {'L','o','c','a','l','P','a','c','k','a','g','e',0};
1560 static const WCHAR managed_local_package
[] = {
1561 'M','a','n','a','g','e','d','L','o','c','a','l','P','a','c','k','a','g','e',0
1564 r
= MSIREG_OpenInstallProps(prodcode
, context
, NULL
, &hkey
, FALSE
);
1565 if (r
!= ERROR_SUCCESS
)
1568 if (context
== MSIINSTALLCONTEXT_USERMANAGED
)
1569 package
= managed_local_package
;
1571 package
= local_package
;
1574 res
= RegQueryValueExW(hkey
, package
, NULL
, NULL
, NULL
, &sz
);
1577 return (res
== ERROR_SUCCESS
);
1580 static BOOL
msi_comp_find_prodcode(LPWSTR squished_pc
,
1581 MSIINSTALLCONTEXT context
,
1582 LPCWSTR comp
, LPWSTR val
, DWORD
*sz
)
1588 if (context
== MSIINSTALLCONTEXT_MACHINE
)
1589 r
= MSIREG_OpenUserDataComponentKey(comp
, szLocalSid
, &hkey
, FALSE
);
1591 r
= MSIREG_OpenUserDataComponentKey(comp
, NULL
, &hkey
, FALSE
);
1593 if (r
!= ERROR_SUCCESS
)
1596 res
= RegQueryValueExW(hkey
, squished_pc
, NULL
, NULL
, (BYTE
*)val
, sz
);
1597 if (res
!= ERROR_SUCCESS
)
1604 UINT WINAPI
MsiQueryComponentStateW(LPCWSTR szProductCode
,
1605 LPCWSTR szUserSid
, MSIINSTALLCONTEXT dwContext
,
1606 LPCWSTR szComponent
, INSTALLSTATE
*pdwState
)
1608 WCHAR squished_pc
[GUID_SIZE
];
1609 WCHAR val
[MAX_PATH
];
1613 TRACE("(%s, %s, %d, %s, %p)\n", debugstr_w(szProductCode
),
1614 debugstr_w(szUserSid
), dwContext
, debugstr_w(szComponent
), pdwState
);
1616 if (!pdwState
|| !szComponent
)
1617 return ERROR_INVALID_PARAMETER
;
1619 if (!szProductCode
|| !*szProductCode
|| lstrlenW(szProductCode
) != GUID_SIZE
- 1)
1620 return ERROR_INVALID_PARAMETER
;
1622 if (!squash_guid(szProductCode
, squished_pc
))
1623 return ERROR_INVALID_PARAMETER
;
1625 found
= msi_comp_find_prod_key(szProductCode
, dwContext
);
1627 if (!msi_comp_find_package(szProductCode
, dwContext
))
1631 *pdwState
= INSTALLSTATE_UNKNOWN
;
1632 return ERROR_UNKNOWN_COMPONENT
;
1635 return ERROR_UNKNOWN_PRODUCT
;
1638 *pdwState
= INSTALLSTATE_UNKNOWN
;
1641 if (!msi_comp_find_prodcode(squished_pc
, dwContext
, szComponent
, val
, &sz
))
1642 return ERROR_UNKNOWN_COMPONENT
;
1645 *pdwState
= INSTALLSTATE_NOTUSED
;
1648 if (lstrlenW(val
) > 2 &&
1649 val
[0] >= '0' && val
[0] <= '9' && val
[1] >= '0' && val
[1] <= '9')
1651 *pdwState
= INSTALLSTATE_SOURCE
;
1654 *pdwState
= INSTALLSTATE_LOCAL
;
1657 return ERROR_SUCCESS
;
1660 INSTALLSTATE WINAPI
MsiQueryProductStateA(LPCSTR szProduct
)
1662 LPWSTR szwProduct
= NULL
;
1667 szwProduct
= strdupAtoW( szProduct
);
1669 return ERROR_OUTOFMEMORY
;
1671 r
= MsiQueryProductStateW( szwProduct
);
1672 msi_free( szwProduct
);
1676 INSTALLSTATE WINAPI
MsiQueryProductStateW(LPCWSTR szProduct
)
1678 MSIINSTALLCONTEXT context
= MSIINSTALLCONTEXT_USERUNMANAGED
;
1679 INSTALLSTATE state
= INSTALLSTATE_ADVERTISED
;
1680 HKEY prodkey
= 0, userdata
= 0;
1684 static const WCHAR szWindowsInstaller
[] = {
1685 'W','i','n','d','o','w','s','I','n','s','t','a','l','l','e','r',0};
1687 TRACE("%s\n", debugstr_w(szProduct
));
1689 if (!szProduct
|| !*szProduct
)
1690 return INSTALLSTATE_INVALIDARG
;
1692 if (lstrlenW(szProduct
) != GUID_SIZE
- 1)
1693 return INSTALLSTATE_INVALIDARG
;
1695 if (MSIREG_OpenProductKey(szProduct
, NULL
, MSIINSTALLCONTEXT_USERMANAGED
,
1696 &prodkey
, FALSE
) != ERROR_SUCCESS
&&
1697 MSIREG_OpenProductKey(szProduct
, NULL
, MSIINSTALLCONTEXT_USERUNMANAGED
,
1698 &prodkey
, FALSE
) != ERROR_SUCCESS
&&
1699 MSIREG_OpenProductKey(szProduct
, NULL
, MSIINSTALLCONTEXT_MACHINE
,
1700 &prodkey
, FALSE
) == ERROR_SUCCESS
)
1702 context
= MSIINSTALLCONTEXT_MACHINE
;
1705 r
= MSIREG_OpenInstallProps(szProduct
, context
, NULL
, &userdata
, FALSE
);
1706 if (r
!= ERROR_SUCCESS
)
1709 if (!msi_reg_get_val_dword(userdata
, szWindowsInstaller
, &val
))
1713 state
= INSTALLSTATE_DEFAULT
;
1715 state
= INSTALLSTATE_UNKNOWN
;
1720 state
= INSTALLSTATE_UNKNOWN
;
1723 state
= INSTALLSTATE_ABSENT
;
1726 RegCloseKey(prodkey
);
1727 RegCloseKey(userdata
);
1731 INSTALLUILEVEL WINAPI
MsiSetInternalUI(INSTALLUILEVEL dwUILevel
, HWND
*phWnd
)
1733 INSTALLUILEVEL old
= gUILevel
;
1734 HWND oldwnd
= gUIhwnd
;
1736 TRACE("%08x %p\n", dwUILevel
, phWnd
);
1738 gUILevel
= dwUILevel
;
1747 INSTALLUI_HANDLERA WINAPI
MsiSetExternalUIA(INSTALLUI_HANDLERA puiHandler
,
1748 DWORD dwMessageFilter
, LPVOID pvContext
)
1750 INSTALLUI_HANDLERA prev
= gUIHandlerA
;
1752 TRACE("%p %x %p\n",puiHandler
, dwMessageFilter
,pvContext
);
1753 gUIHandlerA
= puiHandler
;
1754 gUIFilter
= dwMessageFilter
;
1755 gUIContext
= pvContext
;
1760 INSTALLUI_HANDLERW WINAPI
MsiSetExternalUIW(INSTALLUI_HANDLERW puiHandler
,
1761 DWORD dwMessageFilter
, LPVOID pvContext
)
1763 INSTALLUI_HANDLERW prev
= gUIHandlerW
;
1765 TRACE("%p %x %p\n",puiHandler
,dwMessageFilter
,pvContext
);
1766 gUIHandlerW
= puiHandler
;
1767 gUIFilter
= dwMessageFilter
;
1768 gUIContext
= pvContext
;
1773 /******************************************************************
1774 * MsiLoadStringW [MSI.@]
1776 * Loads a string from MSI's string resources.
1780 * handle [I] only -1 is handled currently
1781 * id [I] id of the string to be loaded
1782 * lpBuffer [O] buffer for the string to be written to
1783 * nBufferMax [I] maximum size of the buffer in characters
1784 * lang [I] the preferred language for the string
1788 * If successful, this function returns the language id of the string loaded
1789 * If the function fails, the function returns zero.
1793 * The type of the first parameter is unknown. LoadString's prototype
1794 * suggests that it might be a module handle. I have made it an MSI handle
1795 * for starters, as -1 is an invalid MSI handle, but not an invalid module
1796 * handle. Maybe strings can be stored in an MSI database somehow.
1798 LANGID WINAPI
MsiLoadStringW( MSIHANDLE handle
, UINT id
, LPWSTR lpBuffer
,
1799 int nBufferMax
, LANGID lang
)
1806 TRACE("%d %u %p %d %d\n", handle
, id
, lpBuffer
, nBufferMax
, lang
);
1809 FIXME("don't know how to deal with handle = %08x\n", handle
);
1812 lang
= GetUserDefaultLangID();
1814 hres
= FindResourceExW( msi_hInstance
, (LPCWSTR
) RT_STRING
,
1818 hResData
= LoadResource( msi_hInstance
, hres
);
1821 p
= LockResource( hResData
);
1825 for (i
= 0; i
< (id
&0xf); i
++)
1829 if( nBufferMax
<= len
)
1832 memcpy( lpBuffer
, p
+1, len
* sizeof(WCHAR
));
1833 lpBuffer
[ len
] = 0;
1835 TRACE("found -> %s\n", debugstr_w(lpBuffer
));
1840 LANGID WINAPI
MsiLoadStringA( MSIHANDLE handle
, UINT id
, LPSTR lpBuffer
,
1841 int nBufferMax
, LANGID lang
)
1847 bufW
= msi_alloc(nBufferMax
*sizeof(WCHAR
));
1848 r
= MsiLoadStringW(handle
, id
, bufW
, nBufferMax
, lang
);
1851 len
= WideCharToMultiByte(CP_ACP
, 0, bufW
, -1, NULL
, 0, NULL
, NULL
);
1852 if( len
<= nBufferMax
)
1853 WideCharToMultiByte( CP_ACP
, 0, bufW
, -1,
1854 lpBuffer
, nBufferMax
, NULL
, NULL
);
1862 INSTALLSTATE WINAPI
MsiLocateComponentA(LPCSTR szComponent
, LPSTR lpPathBuf
,
1865 char szProduct
[GUID_SIZE
];
1867 TRACE("%s %p %p\n", debugstr_a(szComponent
), lpPathBuf
, pcchBuf
);
1869 if (MsiGetProductCodeA( szComponent
, szProduct
) != ERROR_SUCCESS
)
1870 return INSTALLSTATE_UNKNOWN
;
1872 return MsiGetComponentPathA( szProduct
, szComponent
, lpPathBuf
, pcchBuf
);
1875 INSTALLSTATE WINAPI
MsiLocateComponentW(LPCWSTR szComponent
, LPWSTR lpPathBuf
,
1878 WCHAR szProduct
[GUID_SIZE
];
1880 TRACE("%s %p %p\n", debugstr_w(szComponent
), lpPathBuf
, pcchBuf
);
1882 if (MsiGetProductCodeW( szComponent
, szProduct
) != ERROR_SUCCESS
)
1883 return INSTALLSTATE_UNKNOWN
;
1885 return MsiGetComponentPathW( szProduct
, szComponent
, lpPathBuf
, pcchBuf
);
1888 UINT WINAPI
MsiMessageBoxA(HWND hWnd
, LPCSTR lpText
, LPCSTR lpCaption
, UINT uType
,
1889 WORD wLanguageId
, DWORD f
)
1891 FIXME("%p %s %s %u %08x %08x\n", hWnd
, debugstr_a(lpText
), debugstr_a(lpCaption
),
1892 uType
, wLanguageId
, f
);
1893 return MessageBoxExA(hWnd
,lpText
,lpCaption
,uType
,wLanguageId
);
1896 UINT WINAPI
MsiMessageBoxW(HWND hWnd
, LPCWSTR lpText
, LPCWSTR lpCaption
, UINT uType
,
1897 WORD wLanguageId
, DWORD f
)
1899 FIXME("%p %s %s %u %08x %08x\n", hWnd
, debugstr_w(lpText
), debugstr_w(lpCaption
),
1900 uType
, wLanguageId
, f
);
1901 return MessageBoxExW(hWnd
,lpText
,lpCaption
,uType
,wLanguageId
);
1904 UINT WINAPI
MsiProvideAssemblyA( LPCSTR szAssemblyName
, LPCSTR szAppContext
,
1905 DWORD dwInstallMode
, DWORD dwAssemblyInfo
, LPSTR lpPathBuf
,
1906 LPDWORD pcchPathBuf
)
1908 FIXME("%s %s %08x %08x %p %p\n", debugstr_a(szAssemblyName
),
1909 debugstr_a(szAppContext
), dwInstallMode
, dwAssemblyInfo
, lpPathBuf
,
1911 return ERROR_CALL_NOT_IMPLEMENTED
;
1914 UINT WINAPI
MsiProvideAssemblyW( LPCWSTR szAssemblyName
, LPCWSTR szAppContext
,
1915 DWORD dwInstallMode
, DWORD dwAssemblyInfo
, LPWSTR lpPathBuf
,
1916 LPDWORD pcchPathBuf
)
1918 FIXME("%s %s %08x %08x %p %p\n", debugstr_w(szAssemblyName
),
1919 debugstr_w(szAppContext
), dwInstallMode
, dwAssemblyInfo
, lpPathBuf
,
1921 return ERROR_CALL_NOT_IMPLEMENTED
;
1924 UINT WINAPI
MsiProvideComponentFromDescriptorA( LPCSTR szDescriptor
,
1925 LPSTR szPath
, LPDWORD pcchPath
, LPDWORD pcchArgs
)
1927 FIXME("%s %p %p %p\n", debugstr_a(szDescriptor
), szPath
, pcchPath
, pcchArgs
);
1928 return ERROR_CALL_NOT_IMPLEMENTED
;
1931 UINT WINAPI
MsiProvideComponentFromDescriptorW( LPCWSTR szDescriptor
,
1932 LPWSTR szPath
, LPDWORD pcchPath
, LPDWORD pcchArgs
)
1934 FIXME("%s %p %p %p\n", debugstr_w(szDescriptor
), szPath
, pcchPath
, pcchArgs
);
1935 return ERROR_CALL_NOT_IMPLEMENTED
;
1938 HRESULT WINAPI
MsiGetFileSignatureInformationA( LPCSTR szSignedObjectPath
,
1939 DWORD dwFlags
, PCCERT_CONTEXT
* ppcCertContext
, LPBYTE pbHashData
,
1940 LPDWORD pcbHashData
)
1942 FIXME("%s %08x %p %p %p\n", debugstr_a(szSignedObjectPath
), dwFlags
,
1943 ppcCertContext
, pbHashData
, pcbHashData
);
1944 return ERROR_CALL_NOT_IMPLEMENTED
;
1947 HRESULT WINAPI
MsiGetFileSignatureInformationW( LPCWSTR szSignedObjectPath
,
1948 DWORD dwFlags
, PCCERT_CONTEXT
* ppcCertContext
, LPBYTE pbHashData
,
1949 LPDWORD pcbHashData
)
1951 FIXME("%s %08x %p %p %p\n", debugstr_w(szSignedObjectPath
), dwFlags
,
1952 ppcCertContext
, pbHashData
, pcbHashData
);
1953 return ERROR_CALL_NOT_IMPLEMENTED
;
1956 /******************************************************************
1957 * MsiGetProductPropertyA [MSI.@]
1959 UINT WINAPI
MsiGetProductPropertyA(MSIHANDLE hProduct
, LPCSTR szProperty
,
1960 LPSTR szValue
, LPDWORD pccbValue
)
1962 LPWSTR prop
= NULL
, val
= NULL
;
1966 TRACE("(%d, %s, %p, %p)\n", hProduct
, debugstr_a(szProperty
),
1967 szValue
, pccbValue
);
1969 if (szValue
&& !pccbValue
)
1970 return ERROR_INVALID_PARAMETER
;
1972 if (szProperty
) prop
= strdupAtoW(szProperty
);
1975 r
= MsiGetProductPropertyW(hProduct
, prop
, NULL
, &len
);
1976 if (r
!= ERROR_SUCCESS
&& r
!= ERROR_MORE_DATA
)
1979 if (r
== ERROR_SUCCESS
)
1981 if (szValue
) *szValue
= '\0';
1982 if (pccbValue
) *pccbValue
= 0;
1986 val
= msi_alloc(++len
* sizeof(WCHAR
));
1989 r
= ERROR_OUTOFMEMORY
;
1993 r
= MsiGetProductPropertyW(hProduct
, prop
, val
, &len
);
1994 if (r
!= ERROR_SUCCESS
)
1997 len
= WideCharToMultiByte(CP_ACP
, 0, val
, -1, NULL
, 0, NULL
, NULL
);
2000 WideCharToMultiByte(CP_ACP
, 0, val
, -1, szValue
,
2001 *pccbValue
, NULL
, NULL
);
2005 if (len
> *pccbValue
)
2006 r
= ERROR_MORE_DATA
;
2008 *pccbValue
= len
- 1;
2018 /******************************************************************
2019 * MsiGetProductPropertyW [MSI.@]
2021 UINT WINAPI
MsiGetProductPropertyW(MSIHANDLE hProduct
, LPCWSTR szProperty
,
2022 LPWSTR szValue
, LPDWORD pccbValue
)
2024 MSIPACKAGE
*package
;
2025 MSIQUERY
*view
= NULL
;
2026 MSIRECORD
*rec
= NULL
;
2030 static const WCHAR query
[] = {
2031 'S','E','L','E','C','T',' ','*',' ','F','R','O','M',' ',
2032 '`','P','r','o','p','e','r','t','y','`',' ','W','H','E','R','E',' ',
2033 '`','P','r','o','p','e','r','t','y','`','=','\'','%','s','\'',0};
2035 TRACE("(%d, %s, %p, %p)\n", hProduct
, debugstr_w(szProperty
),
2036 szValue
, pccbValue
);
2039 return ERROR_INVALID_PARAMETER
;
2041 if (szValue
&& !pccbValue
)
2042 return ERROR_INVALID_PARAMETER
;
2044 package
= msihandle2msiinfo(hProduct
, MSIHANDLETYPE_PACKAGE
);
2046 return ERROR_INVALID_HANDLE
;
2048 r
= MSI_OpenQuery(package
->db
, &view
, query
, szProperty
);
2049 if (r
!= ERROR_SUCCESS
)
2052 r
= MSI_ViewExecute(view
, 0);
2053 if (r
!= ERROR_SUCCESS
)
2056 r
= MSI_ViewFetch(view
, &rec
);
2057 if (r
!= ERROR_SUCCESS
)
2060 val
= MSI_RecordGetString(rec
, 2);
2064 if (lstrlenW(val
) >= *pccbValue
)
2066 lstrcpynW(szValue
, val
, *pccbValue
);
2067 *pccbValue
= lstrlenW(val
);
2068 r
= ERROR_MORE_DATA
;
2072 lstrcpyW(szValue
, val
);
2073 *pccbValue
= lstrlenW(val
);
2080 MSI_ViewClose(view
);
2081 msiobj_release(&view
->hdr
);
2082 if (rec
) msiobj_release(&rec
->hdr
);
2087 if (szValue
) *szValue
= '\0';
2088 if (pccbValue
) *pccbValue
= 0;
2095 UINT WINAPI
MsiVerifyPackageA( LPCSTR szPackage
)
2098 LPWSTR szPack
= NULL
;
2100 TRACE("%s\n", debugstr_a(szPackage
) );
2104 szPack
= strdupAtoW( szPackage
);
2106 return ERROR_OUTOFMEMORY
;
2109 r
= MsiVerifyPackageW( szPack
);
2116 UINT WINAPI
MsiVerifyPackageW( LPCWSTR szPackage
)
2121 TRACE("%s\n", debugstr_w(szPackage
) );
2123 r
= MsiOpenDatabaseW( szPackage
, MSIDBOPEN_READONLY
, &handle
);
2124 MsiCloseHandle( handle
);
2129 static INSTALLSTATE
MSI_GetComponentPath(LPCWSTR szProduct
, LPCWSTR szComponent
,
2130 awstring
* lpPathBuf
, LPDWORD pcchBuf
)
2132 WCHAR squished_pc
[GUID_SIZE
];
2133 WCHAR squished_comp
[GUID_SIZE
];
2139 static const WCHAR wininstaller
[] = {
2140 'W','i','n','d','o','w','s','I','n','s','t','a','l','l','e','r',0};
2142 TRACE("%s %s %p %p\n", debugstr_w(szProduct
),
2143 debugstr_w(szComponent
), lpPathBuf
->str
.w
, pcchBuf
);
2145 if (!szProduct
|| !szComponent
)
2146 return INSTALLSTATE_INVALIDARG
;
2148 if (lpPathBuf
->str
.w
&& !pcchBuf
)
2149 return INSTALLSTATE_INVALIDARG
;
2151 if (!squash_guid(szProduct
, squished_pc
) ||
2152 !squash_guid(szComponent
, squished_comp
))
2153 return INSTALLSTATE_INVALIDARG
;
2155 state
= INSTALLSTATE_UNKNOWN
;
2157 if (MSIREG_OpenUserDataComponentKey(szComponent
, szLocalSid
, &hkey
, FALSE
) == ERROR_SUCCESS
||
2158 MSIREG_OpenUserDataComponentKey(szComponent
, NULL
, &hkey
, FALSE
) == ERROR_SUCCESS
)
2160 path
= msi_reg_get_val_str(hkey
, squished_pc
);
2163 state
= INSTALLSTATE_ABSENT
;
2165 if ((MSIREG_OpenInstallProps(szProduct
, MSIINSTALLCONTEXT_MACHINE
, NULL
,
2166 &hkey
, FALSE
) == ERROR_SUCCESS
||
2167 MSIREG_OpenUserDataProductKey(szProduct
, MSIINSTALLCONTEXT_USERUNMANAGED
,
2168 NULL
, &hkey
, FALSE
) == ERROR_SUCCESS
) &&
2169 msi_reg_get_val_dword(hkey
, wininstaller
, &version
) &&
2170 GetFileAttributesW(path
) != INVALID_FILE_ATTRIBUTES
)
2173 state
= INSTALLSTATE_LOCAL
;
2177 if (state
!= INSTALLSTATE_LOCAL
&&
2178 (MSIREG_OpenProductKey(szProduct
, NULL
,
2179 MSIINSTALLCONTEXT_USERUNMANAGED
,
2180 &hkey
, FALSE
) == ERROR_SUCCESS
||
2181 MSIREG_OpenProductKey(szProduct
, NULL
, MSIINSTALLCONTEXT_MACHINE
,
2182 &hkey
, FALSE
) == ERROR_SUCCESS
))
2186 if (MSIREG_OpenUserDataComponentKey(szComponent
, szLocalSid
, &hkey
, FALSE
) == ERROR_SUCCESS
||
2187 MSIREG_OpenUserDataComponentKey(szComponent
, NULL
, &hkey
, FALSE
) == ERROR_SUCCESS
)
2190 path
= msi_reg_get_val_str(hkey
, squished_pc
);
2193 state
= INSTALLSTATE_ABSENT
;
2195 if (GetFileAttributesW(path
) != INVALID_FILE_ATTRIBUTES
)
2196 state
= INSTALLSTATE_LOCAL
;
2201 return INSTALLSTATE_UNKNOWN
;
2203 if (state
== INSTALLSTATE_LOCAL
&& !*path
)
2204 state
= INSTALLSTATE_NOTUSED
;
2206 msi_strcpy_to_awstring(path
, lpPathBuf
, pcchBuf
);
2211 /******************************************************************
2212 * MsiGetComponentPathW [MSI.@]
2214 INSTALLSTATE WINAPI
MsiGetComponentPathW(LPCWSTR szProduct
, LPCWSTR szComponent
,
2215 LPWSTR lpPathBuf
, LPDWORD pcchBuf
)
2219 path
.unicode
= TRUE
;
2220 path
.str
.w
= lpPathBuf
;
2222 return MSI_GetComponentPath( szProduct
, szComponent
, &path
, pcchBuf
);
2225 /******************************************************************
2226 * MsiGetComponentPathA [MSI.@]
2228 INSTALLSTATE WINAPI
MsiGetComponentPathA(LPCSTR szProduct
, LPCSTR szComponent
,
2229 LPSTR lpPathBuf
, LPDWORD pcchBuf
)
2231 LPWSTR szwProduct
, szwComponent
= NULL
;
2232 INSTALLSTATE r
= INSTALLSTATE_UNKNOWN
;
2235 szwProduct
= strdupAtoW( szProduct
);
2236 if( szProduct
&& !szwProduct
)
2239 szwComponent
= strdupAtoW( szComponent
);
2240 if( szComponent
&& !szwComponent
)
2243 path
.unicode
= FALSE
;
2244 path
.str
.a
= lpPathBuf
;
2246 r
= MSI_GetComponentPath( szwProduct
, szwComponent
, &path
, pcchBuf
);
2249 msi_free( szwProduct
);
2250 msi_free( szwComponent
);
2255 /******************************************************************
2256 * MsiQueryFeatureStateA [MSI.@]
2258 INSTALLSTATE WINAPI
MsiQueryFeatureStateA(LPCSTR szProduct
, LPCSTR szFeature
)
2260 LPWSTR szwProduct
= NULL
, szwFeature
= NULL
;
2261 INSTALLSTATE rc
= INSTALLSTATE_UNKNOWN
;
2263 szwProduct
= strdupAtoW( szProduct
);
2264 if ( szProduct
&& !szwProduct
)
2267 szwFeature
= strdupAtoW( szFeature
);
2268 if ( szFeature
&& !szwFeature
)
2271 rc
= MsiQueryFeatureStateW(szwProduct
, szwFeature
);
2274 msi_free( szwProduct
);
2275 msi_free( szwFeature
);
2280 /******************************************************************
2281 * MsiQueryFeatureStateW [MSI.@]
2283 * Checks the state of a feature
2286 * szProduct [I] Product's GUID string
2287 * szFeature [I] Feature's GUID string
2290 * INSTALLSTATE_LOCAL Feature is installed and usable
2291 * INSTALLSTATE_ABSENT Feature is absent
2292 * INSTALLSTATE_ADVERTISED Feature should be installed on demand
2293 * INSTALLSTATE_UNKNOWN An error occurred
2294 * INSTALLSTATE_INVALIDARG One of the GUIDs was invalid
2297 INSTALLSTATE WINAPI
MsiQueryFeatureStateW(LPCWSTR szProduct
, LPCWSTR szFeature
)
2299 WCHAR squishProduct
[33], comp
[GUID_SIZE
];
2301 LPWSTR components
, p
, parent_feature
, path
;
2305 BOOL missing
= FALSE
;
2306 BOOL machine
= FALSE
;
2307 BOOL source
= FALSE
;
2309 TRACE("%s %s\n", debugstr_w(szProduct
), debugstr_w(szFeature
));
2311 if (!szProduct
|| !szFeature
)
2312 return INSTALLSTATE_INVALIDARG
;
2314 if (!squash_guid( szProduct
, squishProduct
))
2315 return INSTALLSTATE_INVALIDARG
;
2317 if (MSIREG_OpenFeaturesKey(szProduct
, MSIINSTALLCONTEXT_USERMANAGED
,
2318 &hkey
, FALSE
) != ERROR_SUCCESS
&&
2319 MSIREG_OpenFeaturesKey(szProduct
, MSIINSTALLCONTEXT_USERUNMANAGED
,
2320 &hkey
, FALSE
) != ERROR_SUCCESS
)
2322 rc
= MSIREG_OpenFeaturesKey(szProduct
, MSIINSTALLCONTEXT_MACHINE
,
2324 if (rc
!= ERROR_SUCCESS
)
2325 return INSTALLSTATE_UNKNOWN
;
2330 parent_feature
= msi_reg_get_val_str( hkey
, szFeature
);
2333 if (!parent_feature
)
2334 return INSTALLSTATE_UNKNOWN
;
2336 r
= (parent_feature
[0] == 6) ? INSTALLSTATE_ABSENT
: INSTALLSTATE_LOCAL
;
2337 msi_free(parent_feature
);
2338 if (r
== INSTALLSTATE_ABSENT
)
2342 rc
= MSIREG_OpenUserDataFeaturesKey(szProduct
,
2343 MSIINSTALLCONTEXT_MACHINE
,
2346 rc
= MSIREG_OpenUserDataFeaturesKey(szProduct
,
2347 MSIINSTALLCONTEXT_USERUNMANAGED
,
2350 if (rc
!= ERROR_SUCCESS
)
2351 return INSTALLSTATE_ADVERTISED
;
2353 components
= msi_reg_get_val_str( hkey
, szFeature
);
2356 TRACE("rc = %d buffer = %s\n", rc
, debugstr_w(components
));
2359 return INSTALLSTATE_ADVERTISED
;
2361 for( p
= components
; *p
&& *p
!= 2 ; p
+= 20)
2363 if (!decode_base85_guid( p
, &guid
))
2365 if (p
!= components
)
2368 msi_free(components
);
2369 return INSTALLSTATE_BADCONFIG
;
2372 StringFromGUID2(&guid
, comp
, GUID_SIZE
);
2375 rc
= MSIREG_OpenUserDataComponentKey(comp
, szLocalSid
, &hkey
, FALSE
);
2377 rc
= MSIREG_OpenUserDataComponentKey(comp
, NULL
, &hkey
, FALSE
);
2379 if (rc
!= ERROR_SUCCESS
)
2381 msi_free(components
);
2382 return INSTALLSTATE_ADVERTISED
;
2385 path
= msi_reg_get_val_str(hkey
, squishProduct
);
2388 else if (lstrlenW(path
) > 2 &&
2389 path
[0] >= '0' && path
[0] <= '9' &&
2390 path
[1] >= '0' && path
[1] <= '9')
2398 TRACE("%s %s -> %d\n", debugstr_w(szProduct
), debugstr_w(szFeature
), r
);
2399 msi_free(components
);
2402 return INSTALLSTATE_ADVERTISED
;
2405 return INSTALLSTATE_SOURCE
;
2407 return INSTALLSTATE_LOCAL
;
2410 /******************************************************************
2411 * MsiGetFileVersionA [MSI.@]
2413 UINT WINAPI
MsiGetFileVersionA(LPCSTR szFilePath
, LPSTR lpVersionBuf
,
2414 LPDWORD pcchVersionBuf
, LPSTR lpLangBuf
, LPDWORD pcchLangBuf
)
2416 LPWSTR szwFilePath
= NULL
, lpwVersionBuff
= NULL
, lpwLangBuff
= NULL
;
2417 UINT ret
= ERROR_OUTOFMEMORY
;
2419 if ((lpVersionBuf
&& !pcchVersionBuf
) ||
2420 (lpLangBuf
&& !pcchLangBuf
))
2421 return ERROR_INVALID_PARAMETER
;
2425 szwFilePath
= strdupAtoW( szFilePath
);
2430 if( lpVersionBuf
&& pcchVersionBuf
&& *pcchVersionBuf
)
2432 lpwVersionBuff
= msi_alloc(*pcchVersionBuf
*sizeof(WCHAR
));
2433 if( !lpwVersionBuff
)
2437 if( lpLangBuf
&& pcchLangBuf
&& *pcchLangBuf
)
2439 lpwLangBuff
= msi_alloc(*pcchLangBuf
*sizeof(WCHAR
));
2444 ret
= MsiGetFileVersionW(szwFilePath
, lpwVersionBuff
, pcchVersionBuf
,
2445 lpwLangBuff
, pcchLangBuf
);
2447 if( (ret
== ERROR_SUCCESS
|| ret
== ERROR_MORE_DATA
) && lpwVersionBuff
)
2448 WideCharToMultiByte(CP_ACP
, 0, lpwVersionBuff
, -1,
2449 lpVersionBuf
, *pcchVersionBuf
+ 1, NULL
, NULL
);
2450 if( (ret
== ERROR_SUCCESS
|| ret
== ERROR_MORE_DATA
) && lpwLangBuff
)
2451 WideCharToMultiByte(CP_ACP
, 0, lpwLangBuff
, -1,
2452 lpLangBuf
, *pcchLangBuf
+ 1, NULL
, NULL
);
2455 msi_free(szwFilePath
);
2456 msi_free(lpwVersionBuff
);
2457 msi_free(lpwLangBuff
);
2462 /******************************************************************
2463 * MsiGetFileVersionW [MSI.@]
2465 UINT WINAPI
MsiGetFileVersionW(LPCWSTR szFilePath
, LPWSTR lpVersionBuf
,
2466 LPDWORD pcchVersionBuf
, LPWSTR lpLangBuf
, LPDWORD pcchLangBuf
)
2468 static const WCHAR szVersionResource
[] = {'\\',0};
2469 static const WCHAR szVersionFormat
[] = {
2470 '%','d','.','%','d','.','%','d','.','%','d',0};
2471 static const WCHAR szLangResource
[] = {
2472 '\\','V','a','r','F','i','l','e','I','n','f','o','\\',
2473 'T','r','a','n','s','l','a','t','i','o','n',0};
2474 static const WCHAR szLangFormat
[] = {'%','d',0};
2476 DWORD dwVerLen
, gle
;
2477 LPVOID lpVer
= NULL
;
2478 VS_FIXEDFILEINFO
*ffi
;
2483 TRACE("%s %p %d %p %d\n", debugstr_w(szFilePath
),
2484 lpVersionBuf
, pcchVersionBuf
?*pcchVersionBuf
:0,
2485 lpLangBuf
, pcchLangBuf
?*pcchLangBuf
:0);
2487 if ((lpVersionBuf
&& !pcchVersionBuf
) ||
2488 (lpLangBuf
&& !pcchLangBuf
))
2489 return ERROR_INVALID_PARAMETER
;
2491 dwVerLen
= GetFileVersionInfoSizeW(szFilePath
, NULL
);
2494 gle
= GetLastError();
2495 if (gle
== ERROR_BAD_PATHNAME
)
2496 return ERROR_FILE_NOT_FOUND
;
2497 else if (gle
== ERROR_RESOURCE_DATA_NOT_FOUND
)
2498 return ERROR_FILE_INVALID
;
2503 lpVer
= msi_alloc(dwVerLen
);
2506 ret
= ERROR_OUTOFMEMORY
;
2510 if( !GetFileVersionInfoW(szFilePath
, 0, dwVerLen
, lpVer
) )
2512 ret
= GetLastError();
2518 if( VerQueryValueW(lpVer
, szVersionResource
, (LPVOID
*)&ffi
, &puLen
) &&
2521 wsprintfW(tmp
, szVersionFormat
,
2522 HIWORD(ffi
->dwFileVersionMS
), LOWORD(ffi
->dwFileVersionMS
),
2523 HIWORD(ffi
->dwFileVersionLS
), LOWORD(ffi
->dwFileVersionLS
));
2524 if (lpVersionBuf
) lstrcpynW(lpVersionBuf
, tmp
, *pcchVersionBuf
);
2526 if (strlenW(tmp
) >= *pcchVersionBuf
)
2527 ret
= ERROR_MORE_DATA
;
2529 *pcchVersionBuf
= lstrlenW(tmp
);
2533 if (lpVersionBuf
) *lpVersionBuf
= 0;
2534 *pcchVersionBuf
= 0;
2540 if (VerQueryValueW(lpVer
, szLangResource
, (LPVOID
*)&lang
, &puLen
) &&
2543 wsprintfW(tmp
, szLangFormat
, *lang
);
2544 if (lpLangBuf
) lstrcpynW(lpLangBuf
, tmp
, *pcchLangBuf
);
2546 if (strlenW(tmp
) >= *pcchLangBuf
)
2547 ret
= ERROR_MORE_DATA
;
2549 *pcchLangBuf
= lstrlenW(tmp
);
2553 if (lpLangBuf
) *lpLangBuf
= 0;
2563 /***********************************************************************
2564 * MsiGetFeatureUsageW [MSI.@]
2566 UINT WINAPI
MsiGetFeatureUsageW( LPCWSTR szProduct
, LPCWSTR szFeature
,
2567 LPDWORD pdwUseCount
, LPWORD pwDateUsed
)
2569 FIXME("%s %s %p %p\n",debugstr_w(szProduct
), debugstr_w(szFeature
),
2570 pdwUseCount
, pwDateUsed
);
2571 return ERROR_CALL_NOT_IMPLEMENTED
;
2574 /***********************************************************************
2575 * MsiGetFeatureUsageA [MSI.@]
2577 UINT WINAPI
MsiGetFeatureUsageA( LPCSTR szProduct
, LPCSTR szFeature
,
2578 LPDWORD pdwUseCount
, LPWORD pwDateUsed
)
2580 LPWSTR prod
= NULL
, feat
= NULL
;
2581 UINT ret
= ERROR_OUTOFMEMORY
;
2583 TRACE("%s %s %p %p\n", debugstr_a(szProduct
), debugstr_a(szFeature
),
2584 pdwUseCount
, pwDateUsed
);
2586 prod
= strdupAtoW( szProduct
);
2587 if (szProduct
&& !prod
)
2590 feat
= strdupAtoW( szFeature
);
2591 if (szFeature
&& !feat
)
2594 ret
= MsiGetFeatureUsageW( prod
, feat
, pdwUseCount
, pwDateUsed
);
2603 /***********************************************************************
2604 * MsiUseFeatureExW [MSI.@]
2606 INSTALLSTATE WINAPI
MsiUseFeatureExW( LPCWSTR szProduct
, LPCWSTR szFeature
,
2607 DWORD dwInstallMode
, DWORD dwReserved
)
2611 TRACE("%s %s %i %i\n", debugstr_w(szProduct
), debugstr_w(szFeature
),
2612 dwInstallMode
, dwReserved
);
2614 state
= MsiQueryFeatureStateW( szProduct
, szFeature
);
2617 return INSTALLSTATE_INVALIDARG
;
2619 if (state
== INSTALLSTATE_LOCAL
&& dwInstallMode
!= INSTALLMODE_NODETECTION
)
2621 FIXME("mark product %s feature %s as used\n",
2622 debugstr_w(szProduct
), debugstr_w(szFeature
) );
2628 /***********************************************************************
2629 * MsiUseFeatureExA [MSI.@]
2631 INSTALLSTATE WINAPI
MsiUseFeatureExA( LPCSTR szProduct
, LPCSTR szFeature
,
2632 DWORD dwInstallMode
, DWORD dwReserved
)
2634 INSTALLSTATE ret
= INSTALLSTATE_UNKNOWN
;
2635 LPWSTR prod
= NULL
, feat
= NULL
;
2637 TRACE("%s %s %i %i\n", debugstr_a(szProduct
), debugstr_a(szFeature
),
2638 dwInstallMode
, dwReserved
);
2640 prod
= strdupAtoW( szProduct
);
2641 if (szProduct
&& !prod
)
2644 feat
= strdupAtoW( szFeature
);
2645 if (szFeature
&& !feat
)
2648 ret
= MsiUseFeatureExW( prod
, feat
, dwInstallMode
, dwReserved
);
2657 /***********************************************************************
2658 * MsiUseFeatureW [MSI.@]
2660 INSTALLSTATE WINAPI
MsiUseFeatureW( LPCWSTR szProduct
, LPCWSTR szFeature
)
2662 return MsiUseFeatureExW(szProduct
, szFeature
, 0, 0);
2665 /***********************************************************************
2666 * MsiUseFeatureA [MSI.@]
2668 INSTALLSTATE WINAPI
MsiUseFeatureA( LPCSTR szProduct
, LPCSTR szFeature
)
2670 return MsiUseFeatureExA(szProduct
, szFeature
, 0, 0);
2673 /***********************************************************************
2674 * MSI_ProvideQualifiedComponentEx [internal]
2676 static UINT
MSI_ProvideQualifiedComponentEx(LPCWSTR szComponent
,
2677 LPCWSTR szQualifier
, DWORD dwInstallMode
, LPCWSTR szProduct
,
2678 DWORD Unused1
, DWORD Unused2
, awstring
*lpPathBuf
,
2679 LPDWORD pcchPathBuf
)
2681 WCHAR product
[MAX_FEATURE_CHARS
+1], component
[MAX_FEATURE_CHARS
+1],
2682 feature
[MAX_FEATURE_CHARS
+1];
2688 TRACE("%s %s %i %s %i %i %p %p\n", debugstr_w(szComponent
),
2689 debugstr_w(szQualifier
), dwInstallMode
, debugstr_w(szProduct
),
2690 Unused1
, Unused2
, lpPathBuf
, pcchPathBuf
);
2692 rc
= MSIREG_OpenUserComponentsKey(szComponent
, &hkey
, FALSE
);
2693 if (rc
!= ERROR_SUCCESS
)
2694 return ERROR_INDEX_ABSENT
;
2696 info
= msi_reg_get_val_str( hkey
, szQualifier
);
2700 return ERROR_INDEX_ABSENT
;
2702 MsiDecomposeDescriptorW(info
, product
, feature
, component
, &sz
);
2705 rc
= MSI_GetComponentPath(product
, component
, lpPathBuf
, pcchPathBuf
);
2707 rc
= MSI_GetComponentPath(szProduct
, component
, lpPathBuf
, pcchPathBuf
);
2711 if (rc
!= INSTALLSTATE_LOCAL
)
2712 return ERROR_FILE_NOT_FOUND
;
2714 return ERROR_SUCCESS
;
2717 /***********************************************************************
2718 * MsiProvideQualifiedComponentExW [MSI.@]
2720 UINT WINAPI
MsiProvideQualifiedComponentExW(LPCWSTR szComponent
,
2721 LPCWSTR szQualifier
, DWORD dwInstallMode
, LPCWSTR szProduct
,
2722 DWORD Unused1
, DWORD Unused2
, LPWSTR lpPathBuf
,
2723 LPDWORD pcchPathBuf
)
2727 path
.unicode
= TRUE
;
2728 path
.str
.w
= lpPathBuf
;
2730 return MSI_ProvideQualifiedComponentEx(szComponent
, szQualifier
,
2731 dwInstallMode
, szProduct
, Unused1
, Unused2
, &path
, pcchPathBuf
);
2734 /***********************************************************************
2735 * MsiProvideQualifiedComponentExA [MSI.@]
2737 UINT WINAPI
MsiProvideQualifiedComponentExA(LPCSTR szComponent
,
2738 LPCSTR szQualifier
, DWORD dwInstallMode
, LPCSTR szProduct
,
2739 DWORD Unused1
, DWORD Unused2
, LPSTR lpPathBuf
,
2740 LPDWORD pcchPathBuf
)
2742 LPWSTR szwComponent
, szwQualifier
= NULL
, szwProduct
= NULL
;
2743 UINT r
= ERROR_OUTOFMEMORY
;
2746 TRACE("%s %s %u %s %u %u %p %p\n", debugstr_a(szComponent
),
2747 debugstr_a(szQualifier
), dwInstallMode
, debugstr_a(szProduct
),
2748 Unused1
, Unused2
, lpPathBuf
, pcchPathBuf
);
2750 szwComponent
= strdupAtoW( szComponent
);
2751 if (szComponent
&& !szwComponent
)
2754 szwQualifier
= strdupAtoW( szQualifier
);
2755 if (szQualifier
&& !szwQualifier
)
2758 szwProduct
= strdupAtoW( szProduct
);
2759 if (szProduct
&& !szwProduct
)
2762 path
.unicode
= FALSE
;
2763 path
.str
.a
= lpPathBuf
;
2765 r
= MSI_ProvideQualifiedComponentEx(szwComponent
, szwQualifier
,
2766 dwInstallMode
, szwProduct
, Unused1
,
2767 Unused2
, &path
, pcchPathBuf
);
2769 msi_free(szwProduct
);
2770 msi_free(szwComponent
);
2771 msi_free(szwQualifier
);
2776 /***********************************************************************
2777 * MsiProvideQualifiedComponentW [MSI.@]
2779 UINT WINAPI
MsiProvideQualifiedComponentW( LPCWSTR szComponent
,
2780 LPCWSTR szQualifier
, DWORD dwInstallMode
, LPWSTR lpPathBuf
,
2781 LPDWORD pcchPathBuf
)
2783 return MsiProvideQualifiedComponentExW(szComponent
, szQualifier
,
2784 dwInstallMode
, NULL
, 0, 0, lpPathBuf
, pcchPathBuf
);
2787 /***********************************************************************
2788 * MsiProvideQualifiedComponentA [MSI.@]
2790 UINT WINAPI
MsiProvideQualifiedComponentA( LPCSTR szComponent
,
2791 LPCSTR szQualifier
, DWORD dwInstallMode
, LPSTR lpPathBuf
,
2792 LPDWORD pcchPathBuf
)
2794 return MsiProvideQualifiedComponentExA(szComponent
, szQualifier
,
2795 dwInstallMode
, NULL
, 0, 0, lpPathBuf
, pcchPathBuf
);
2798 /***********************************************************************
2799 * MSI_GetUserInfo [internal]
2801 static USERINFOSTATE
MSI_GetUserInfo(LPCWSTR szProduct
,
2802 awstring
*lpUserNameBuf
, LPDWORD pcchUserNameBuf
,
2803 awstring
*lpOrgNameBuf
, LPDWORD pcchOrgNameBuf
,
2804 awstring
*lpSerialBuf
, LPDWORD pcchSerialBuf
)
2806 WCHAR squished_pc
[SQUISH_GUID_SIZE
];
2807 LPWSTR user
, org
, serial
;
2808 USERINFOSTATE state
;
2813 static const WCHAR szEmpty
[] = {0};
2815 TRACE("%s %p %p %p %p %p %p\n", debugstr_w(szProduct
), lpUserNameBuf
,
2816 pcchUserNameBuf
, lpOrgNameBuf
, pcchOrgNameBuf
, lpSerialBuf
,
2819 if (!szProduct
|| !squash_guid(szProduct
, squished_pc
))
2820 return USERINFOSTATE_INVALIDARG
;
2822 if (MSIREG_OpenProductKey(szProduct
, NULL
, MSIINSTALLCONTEXT_USERMANAGED
,
2823 &hkey
, FALSE
) != ERROR_SUCCESS
&&
2824 MSIREG_OpenProductKey(szProduct
, NULL
, MSIINSTALLCONTEXT_USERUNMANAGED
,
2825 &hkey
, FALSE
) != ERROR_SUCCESS
&&
2826 MSIREG_OpenProductKey(szProduct
, NULL
, MSIINSTALLCONTEXT_MACHINE
,
2827 &hkey
, FALSE
) != ERROR_SUCCESS
)
2829 return USERINFOSTATE_UNKNOWN
;
2832 if (MSIREG_OpenInstallProps(szProduct
, MSIINSTALLCONTEXT_USERUNMANAGED
,
2833 NULL
, &props
, FALSE
) != ERROR_SUCCESS
&&
2834 MSIREG_OpenInstallProps(szProduct
, MSIINSTALLCONTEXT_MACHINE
,
2835 NULL
, &props
, FALSE
) != ERROR_SUCCESS
)
2838 return USERINFOSTATE_ABSENT
;
2841 user
= msi_reg_get_val_str(props
, INSTALLPROPERTY_REGOWNERW
);
2842 org
= msi_reg_get_val_str(props
, INSTALLPROPERTY_REGCOMPANYW
);
2843 serial
= msi_reg_get_val_str(props
, INSTALLPROPERTY_PRODUCTIDW
);
2844 state
= USERINFOSTATE_ABSENT
;
2850 state
= USERINFOSTATE_PRESENT
;
2852 if (pcchUserNameBuf
)
2854 if (lpUserNameBuf
&& !user
)
2856 (*pcchUserNameBuf
)--;
2860 r
= msi_strcpy_to_awstring(user
, lpUserNameBuf
, pcchUserNameBuf
);
2861 if (r
== ERROR_MORE_DATA
)
2863 state
= USERINFOSTATE_MOREDATA
;
2871 if (!orgptr
) orgptr
= szEmpty
;
2873 r
= msi_strcpy_to_awstring(orgptr
, lpOrgNameBuf
, pcchOrgNameBuf
);
2874 if (r
== ERROR_MORE_DATA
)
2876 state
= USERINFOSTATE_MOREDATA
;
2889 r
= msi_strcpy_to_awstring(serial
, lpSerialBuf
, pcchSerialBuf
);
2890 if (r
== ERROR_MORE_DATA
)
2891 state
= USERINFOSTATE_MOREDATA
;
2902 /***********************************************************************
2903 * MsiGetUserInfoW [MSI.@]
2905 USERINFOSTATE WINAPI
MsiGetUserInfoW(LPCWSTR szProduct
,
2906 LPWSTR lpUserNameBuf
, LPDWORD pcchUserNameBuf
,
2907 LPWSTR lpOrgNameBuf
, LPDWORD pcchOrgNameBuf
,
2908 LPWSTR lpSerialBuf
, LPDWORD pcchSerialBuf
)
2910 awstring user
, org
, serial
;
2912 if ((lpUserNameBuf
&& !pcchUserNameBuf
) ||
2913 (lpOrgNameBuf
&& !pcchOrgNameBuf
) ||
2914 (lpSerialBuf
&& !pcchSerialBuf
))
2915 return USERINFOSTATE_INVALIDARG
;
2917 user
.unicode
= TRUE
;
2918 user
.str
.w
= lpUserNameBuf
;
2920 org
.str
.w
= lpOrgNameBuf
;
2921 serial
.unicode
= TRUE
;
2922 serial
.str
.w
= lpSerialBuf
;
2924 return MSI_GetUserInfo( szProduct
, &user
, pcchUserNameBuf
,
2925 &org
, pcchOrgNameBuf
,
2926 &serial
, pcchSerialBuf
);
2929 USERINFOSTATE WINAPI
MsiGetUserInfoA(LPCSTR szProduct
,
2930 LPSTR lpUserNameBuf
, LPDWORD pcchUserNameBuf
,
2931 LPSTR lpOrgNameBuf
, LPDWORD pcchOrgNameBuf
,
2932 LPSTR lpSerialBuf
, LPDWORD pcchSerialBuf
)
2934 awstring user
, org
, serial
;
2938 if ((lpUserNameBuf
&& !pcchUserNameBuf
) ||
2939 (lpOrgNameBuf
&& !pcchOrgNameBuf
) ||
2940 (lpSerialBuf
&& !pcchSerialBuf
))
2941 return USERINFOSTATE_INVALIDARG
;
2943 prod
= strdupAtoW( szProduct
);
2944 if (szProduct
&& !prod
)
2945 return ERROR_OUTOFMEMORY
;
2947 user
.unicode
= FALSE
;
2948 user
.str
.a
= lpUserNameBuf
;
2949 org
.unicode
= FALSE
;
2950 org
.str
.a
= lpOrgNameBuf
;
2951 serial
.unicode
= FALSE
;
2952 serial
.str
.a
= lpSerialBuf
;
2954 r
= MSI_GetUserInfo( prod
, &user
, pcchUserNameBuf
,
2955 &org
, pcchOrgNameBuf
,
2956 &serial
, pcchSerialBuf
);
2963 UINT WINAPI
MsiCollectUserInfoW(LPCWSTR szProduct
)
2967 MSIPACKAGE
*package
;
2968 static const WCHAR szFirstRun
[] = {'F','i','r','s','t','R','u','n',0};
2970 TRACE("(%s)\n",debugstr_w(szProduct
));
2972 rc
= MsiOpenProductW(szProduct
,&handle
);
2973 if (rc
!= ERROR_SUCCESS
)
2974 return ERROR_INVALID_PARAMETER
;
2976 /* MsiCollectUserInfo cannot be called from a custom action. */
2977 package
= msihandle2msiinfo(handle
, MSIHANDLETYPE_PACKAGE
);
2979 return ERROR_CALL_NOT_IMPLEMENTED
;
2981 rc
= ACTION_PerformUIAction(package
, szFirstRun
, -1);
2982 msiobj_release( &package
->hdr
);
2984 MsiCloseHandle(handle
);
2989 UINT WINAPI
MsiCollectUserInfoA(LPCSTR szProduct
)
2993 MSIPACKAGE
*package
;
2994 static const WCHAR szFirstRun
[] = {'F','i','r','s','t','R','u','n',0};
2996 TRACE("(%s)\n",debugstr_a(szProduct
));
2998 rc
= MsiOpenProductA(szProduct
,&handle
);
2999 if (rc
!= ERROR_SUCCESS
)
3000 return ERROR_INVALID_PARAMETER
;
3002 /* MsiCollectUserInfo cannot be called from a custom action. */
3003 package
= msihandle2msiinfo(handle
, MSIHANDLETYPE_PACKAGE
);
3005 return ERROR_CALL_NOT_IMPLEMENTED
;
3007 rc
= ACTION_PerformUIAction(package
, szFirstRun
, -1);
3008 msiobj_release( &package
->hdr
);
3010 MsiCloseHandle(handle
);
3015 /***********************************************************************
3016 * MsiConfigureFeatureA [MSI.@]
3018 UINT WINAPI
MsiConfigureFeatureA(LPCSTR szProduct
, LPCSTR szFeature
, INSTALLSTATE eInstallState
)
3020 LPWSTR prod
, feat
= NULL
;
3021 UINT r
= ERROR_OUTOFMEMORY
;
3023 TRACE("%s %s %i\n", debugstr_a(szProduct
), debugstr_a(szFeature
), eInstallState
);
3025 prod
= strdupAtoW( szProduct
);
3026 if (szProduct
&& !prod
)
3029 feat
= strdupAtoW( szFeature
);
3030 if (szFeature
&& !feat
)
3033 r
= MsiConfigureFeatureW(prod
, feat
, eInstallState
);
3042 /***********************************************************************
3043 * MsiConfigureFeatureW [MSI.@]
3045 UINT WINAPI
MsiConfigureFeatureW(LPCWSTR szProduct
, LPCWSTR szFeature
, INSTALLSTATE eInstallState
)
3047 static const WCHAR szCostInit
[] = { 'C','o','s','t','I','n','i','t','i','a','l','i','z','e',0 };
3048 MSIPACKAGE
*package
= NULL
;
3050 WCHAR sourcepath
[MAX_PATH
], filename
[MAX_PATH
];
3053 TRACE("%s %s %i\n", debugstr_w(szProduct
), debugstr_w(szFeature
), eInstallState
);
3055 if (!szProduct
|| !szFeature
)
3056 return ERROR_INVALID_PARAMETER
;
3058 switch (eInstallState
)
3060 case INSTALLSTATE_DEFAULT
:
3061 /* FIXME: how do we figure out the default location? */
3062 eInstallState
= INSTALLSTATE_LOCAL
;
3064 case INSTALLSTATE_LOCAL
:
3065 case INSTALLSTATE_SOURCE
:
3066 case INSTALLSTATE_ABSENT
:
3067 case INSTALLSTATE_ADVERTISED
:
3070 return ERROR_INVALID_PARAMETER
;
3073 r
= MSI_OpenProductW( szProduct
, &package
);
3074 if (r
!= ERROR_SUCCESS
)
3077 sz
= sizeof(sourcepath
);
3078 MsiSourceListGetInfoW(szProduct
, NULL
, MSIINSTALLCONTEXT_USERUNMANAGED
,
3079 MSICODE_PRODUCT
, INSTALLPROPERTY_LASTUSEDSOURCEW
, sourcepath
, &sz
);
3081 sz
= sizeof(filename
);
3082 MsiSourceListGetInfoW(szProduct
, NULL
, MSIINSTALLCONTEXT_USERUNMANAGED
,
3083 MSICODE_PRODUCT
, INSTALLPROPERTY_PACKAGENAMEW
, filename
, &sz
);
3085 lstrcatW( sourcepath
, filename
);
3087 MsiSetInternalUI( INSTALLUILEVEL_BASIC
, NULL
);
3089 r
= ACTION_PerformUIAction( package
, szCostInit
, -1 );
3090 if (r
!= ERROR_SUCCESS
)
3093 r
= MSI_SetFeatureStateW( package
, szFeature
, eInstallState
);
3094 if (r
!= ERROR_SUCCESS
)
3097 r
= MSI_InstallPackage( package
, sourcepath
, NULL
);
3100 msiobj_release( &package
->hdr
);
3105 /***********************************************************************
3106 * MsiCreateAndVerifyInstallerDirectory [MSI.@]
3108 * Notes: undocumented
3110 UINT WINAPI
MsiCreateAndVerifyInstallerDirectory(DWORD dwReserved
)
3112 WCHAR path
[MAX_PATH
];
3114 TRACE("%d\n", dwReserved
);
3118 FIXME("dwReserved=%d\n", dwReserved
);
3119 return ERROR_INVALID_PARAMETER
;
3122 if (!GetWindowsDirectoryW(path
, MAX_PATH
))
3123 return ERROR_FUNCTION_FAILED
;
3125 lstrcatW(path
, installerW
);
3127 if (!CreateDirectoryW(path
, NULL
))
3128 return ERROR_FUNCTION_FAILED
;
3130 return ERROR_SUCCESS
;
3133 /***********************************************************************
3134 * MsiGetShortcutTargetA [MSI.@]
3136 UINT WINAPI
MsiGetShortcutTargetA( LPCSTR szShortcutTarget
,
3137 LPSTR szProductCode
, LPSTR szFeatureId
,
3138 LPSTR szComponentCode
)
3141 const int len
= MAX_FEATURE_CHARS
+1;
3142 WCHAR product
[MAX_FEATURE_CHARS
+1], feature
[MAX_FEATURE_CHARS
+1], component
[MAX_FEATURE_CHARS
+1];
3145 target
= strdupAtoW( szShortcutTarget
);
3146 if (szShortcutTarget
&& !target
)
3147 return ERROR_OUTOFMEMORY
;
3151 r
= MsiGetShortcutTargetW( target
, product
, feature
, component
);
3153 if (r
== ERROR_SUCCESS
)
3155 WideCharToMultiByte( CP_ACP
, 0, product
, -1, szProductCode
, len
, NULL
, NULL
);
3156 WideCharToMultiByte( CP_ACP
, 0, feature
, -1, szFeatureId
, len
, NULL
, NULL
);
3157 WideCharToMultiByte( CP_ACP
, 0, component
, -1, szComponentCode
, len
, NULL
, NULL
);
3162 /***********************************************************************
3163 * MsiGetShortcutTargetW [MSI.@]
3165 UINT WINAPI
MsiGetShortcutTargetW( LPCWSTR szShortcutTarget
,
3166 LPWSTR szProductCode
, LPWSTR szFeatureId
,
3167 LPWSTR szComponentCode
)
3169 IShellLinkDataList
*dl
= NULL
;
3170 IPersistFile
*pf
= NULL
;
3171 LPEXP_DARWIN_LINK darwin
= NULL
;
3174 TRACE("%s %p %p %p\n", debugstr_w(szShortcutTarget
),
3175 szProductCode
, szFeatureId
, szComponentCode
);
3177 init
= CoInitialize(NULL
);
3179 r
= CoCreateInstance( &CLSID_ShellLink
, NULL
, CLSCTX_INPROC_SERVER
,
3180 &IID_IPersistFile
, (LPVOID
*) &pf
);
3181 if( SUCCEEDED( r
) )
3183 r
= IPersistFile_Load( pf
, szShortcutTarget
,
3184 STGM_READ
| STGM_SHARE_DENY_WRITE
);
3185 if( SUCCEEDED( r
) )
3187 r
= IPersistFile_QueryInterface( pf
, &IID_IShellLinkDataList
,
3189 if( SUCCEEDED( r
) )
3191 IShellLinkDataList_CopyDataBlock( dl
, EXP_DARWIN_ID_SIG
,
3193 IShellLinkDataList_Release( dl
);
3196 IPersistFile_Release( pf
);
3199 if (SUCCEEDED(init
))
3202 TRACE("darwin = %p\n", darwin
);
3209 ret
= MsiDecomposeDescriptorW( darwin
->szwDarwinID
,
3210 szProductCode
, szFeatureId
, szComponentCode
, &sz
);
3211 LocalFree( darwin
);
3215 return ERROR_FUNCTION_FAILED
;
3218 UINT WINAPI
MsiReinstallFeatureW( LPCWSTR szProduct
, LPCWSTR szFeature
,
3219 DWORD dwReinstallMode
)
3221 MSIPACKAGE
* package
= NULL
;
3223 WCHAR sourcepath
[MAX_PATH
];
3224 WCHAR filename
[MAX_PATH
];
3225 static const WCHAR szLogVerbose
[] = {
3226 ' ','L','O','G','V','E','R','B','O','S','E',0 };
3227 static const WCHAR szInstalled
[] = { 'I','n','s','t','a','l','l','e','d',0};
3228 static const WCHAR szReinstall
[] = {'R','E','I','N','S','T','A','L','L',0};
3229 static const WCHAR szReinstallMode
[] = {'R','E','I','N','S','T','A','L','L','M','O','D','E',0};
3230 static const WCHAR szOne
[] = {'1',0};
3231 WCHAR reinstallmode
[11];
3235 FIXME("%s %s %i\n", debugstr_w(szProduct
), debugstr_w(szFeature
),
3238 ptr
= reinstallmode
;
3240 if (dwReinstallMode
& REINSTALLMODE_FILEMISSING
)
3242 if (dwReinstallMode
& REINSTALLMODE_FILEOLDERVERSION
)
3244 if (dwReinstallMode
& REINSTALLMODE_FILEEQUALVERSION
)
3246 if (dwReinstallMode
& REINSTALLMODE_FILEEXACT
)
3248 if (dwReinstallMode
& REINSTALLMODE_FILEVERIFY
)
3250 if (dwReinstallMode
& REINSTALLMODE_FILEREPLACE
)
3252 if (dwReinstallMode
& REINSTALLMODE_USERDATA
)
3254 if (dwReinstallMode
& REINSTALLMODE_MACHINEDATA
)
3256 if (dwReinstallMode
& REINSTALLMODE_SHORTCUT
)
3258 if (dwReinstallMode
& REINSTALLMODE_PACKAGE
)
3262 sz
= sizeof(sourcepath
);
3263 MsiSourceListGetInfoW(szProduct
, NULL
, MSIINSTALLCONTEXT_USERUNMANAGED
,
3264 MSICODE_PRODUCT
, INSTALLPROPERTY_LASTUSEDSOURCEW
, sourcepath
, &sz
);
3266 sz
= sizeof(filename
);
3267 MsiSourceListGetInfoW(szProduct
, NULL
, MSIINSTALLCONTEXT_USERUNMANAGED
,
3268 MSICODE_PRODUCT
, INSTALLPROPERTY_PACKAGENAMEW
, filename
, &sz
);
3270 lstrcatW( sourcepath
, filename
);
3272 if (dwReinstallMode
& REINSTALLMODE_PACKAGE
)
3273 r
= MSI_OpenPackageW( sourcepath
, &package
);
3275 r
= MSI_OpenProductW( szProduct
, &package
);
3277 if (r
!= ERROR_SUCCESS
)
3280 MSI_SetPropertyW( package
, szReinstallMode
, reinstallmode
);
3281 MSI_SetPropertyW( package
, szInstalled
, szOne
);
3282 MSI_SetPropertyW( package
, szLogVerbose
, szOne
);
3283 MSI_SetPropertyW( package
, szReinstall
, szFeature
);
3285 r
= MSI_InstallPackage( package
, sourcepath
, NULL
);
3287 msiobj_release( &package
->hdr
);
3292 UINT WINAPI
MsiReinstallFeatureA( LPCSTR szProduct
, LPCSTR szFeature
,
3293 DWORD dwReinstallMode
)
3299 TRACE("%s %s %i\n", debugstr_a(szProduct
), debugstr_a(szFeature
),
3302 wszProduct
= strdupAtoW(szProduct
);
3303 wszFeature
= strdupAtoW(szFeature
);
3305 rc
= MsiReinstallFeatureW(wszProduct
, wszFeature
, dwReinstallMode
);
3307 msi_free(wszProduct
);
3308 msi_free(wszFeature
);
3315 unsigned int buf
[4];
3316 unsigned char in
[64];
3317 unsigned char digest
[16];
3320 extern VOID WINAPI
MD5Init( MD5_CTX
*);
3321 extern VOID WINAPI
MD5Update( MD5_CTX
*, const unsigned char *, unsigned int );
3322 extern VOID WINAPI
MD5Final( MD5_CTX
*);
3324 /***********************************************************************
3325 * MsiGetFileHashW [MSI.@]
3327 UINT WINAPI
MsiGetFileHashW( LPCWSTR szFilePath
, DWORD dwOptions
,
3328 PMSIFILEHASHINFO pHash
)
3330 HANDLE handle
, mapping
;
3333 UINT r
= ERROR_FUNCTION_FAILED
;
3335 TRACE("%s %08x %p\n", debugstr_w(szFilePath
), dwOptions
, pHash
);
3338 return ERROR_INVALID_PARAMETER
;
3341 return ERROR_PATH_NOT_FOUND
;
3344 return ERROR_INVALID_PARAMETER
;
3346 return ERROR_INVALID_PARAMETER
;
3347 if (pHash
->dwFileHashInfoSize
< sizeof *pHash
)
3348 return ERROR_INVALID_PARAMETER
;
3350 handle
= CreateFileW( szFilePath
, GENERIC_READ
,
3351 FILE_SHARE_READ
| FILE_SHARE_DELETE
, NULL
, OPEN_EXISTING
, 0, NULL
);
3352 if (handle
== INVALID_HANDLE_VALUE
)
3353 return ERROR_FILE_NOT_FOUND
;
3355 length
= GetFileSize( handle
, NULL
);
3357 mapping
= CreateFileMappingW( handle
, NULL
, PAGE_READONLY
, 0, 0, NULL
);
3360 p
= MapViewOfFile( mapping
, FILE_MAP_READ
, 0, 0, length
);
3366 MD5Update( &ctx
, p
, length
);
3368 UnmapViewOfFile( p
);
3370 memcpy( pHash
->dwData
, ctx
.digest
, sizeof pHash
->dwData
);
3373 CloseHandle( mapping
);
3375 CloseHandle( handle
);
3380 /***********************************************************************
3381 * MsiGetFileHashA [MSI.@]
3383 UINT WINAPI
MsiGetFileHashA( LPCSTR szFilePath
, DWORD dwOptions
,
3384 PMSIFILEHASHINFO pHash
)
3389 TRACE("%s %08x %p\n", debugstr_a(szFilePath
), dwOptions
, pHash
);
3391 file
= strdupAtoW( szFilePath
);
3392 if (szFilePath
&& !file
)
3393 return ERROR_OUTOFMEMORY
;
3395 r
= MsiGetFileHashW( file
, dwOptions
, pHash
);
3400 /***********************************************************************
3401 * MsiAdvertiseScriptW [MSI.@]
3403 UINT WINAPI
MsiAdvertiseScriptW( LPCWSTR szScriptFile
, DWORD dwFlags
,
3404 PHKEY phRegData
, BOOL fRemoveItems
)
3406 FIXME("%s %08x %p %d\n",
3407 debugstr_w( szScriptFile
), dwFlags
, phRegData
, fRemoveItems
);
3408 return ERROR_CALL_NOT_IMPLEMENTED
;
3411 /***********************************************************************
3412 * MsiAdvertiseScriptA [MSI.@]
3414 UINT WINAPI
MsiAdvertiseScriptA( LPCSTR szScriptFile
, DWORD dwFlags
,
3415 PHKEY phRegData
, BOOL fRemoveItems
)
3417 FIXME("%s %08x %p %d\n",
3418 debugstr_a( szScriptFile
), dwFlags
, phRegData
, fRemoveItems
);
3419 return ERROR_CALL_NOT_IMPLEMENTED
;
3422 /***********************************************************************
3423 * MsiIsProductElevatedW [MSI.@]
3425 UINT WINAPI
MsiIsProductElevatedW( LPCWSTR szProduct
, BOOL
*pfElevated
)
3427 FIXME("%s %p - stub\n",
3428 debugstr_w( szProduct
), pfElevated
);
3430 return ERROR_SUCCESS
;
3433 /***********************************************************************
3434 * MsiIsProductElevatedA [MSI.@]
3436 UINT WINAPI
MsiIsProductElevatedA( LPCSTR szProduct
, BOOL
*pfElevated
)
3438 FIXME("%s %p - stub\n",
3439 debugstr_a( szProduct
), pfElevated
);
3441 return ERROR_SUCCESS
;
3444 /***********************************************************************
3445 * MsiSetExternalUIRecord [MSI.@]
3447 UINT WINAPI
MsiSetExternalUIRecord( INSTALLUI_HANDLER_RECORD puiHandler
,
3448 DWORD dwMessageFilter
, LPVOID pvContext
,
3449 PINSTALLUI_HANDLER_RECORD ppuiPrevHandler
)
3451 FIXME("%p %08x %p %p\n", puiHandler
, dwMessageFilter
,pvContext
,
3453 return ERROR_CALL_NOT_IMPLEMENTED
;
3456 /***********************************************************************
3457 * MsiInstallMissingComponentW [MSI.@]
3459 UINT WINAPI
MsiInstallMissingComponentW(LPCWSTR szProduct
, LPCWSTR szComponent
, INSTALLSTATE eInstallState
)
3461 FIXME("(%s %s %d\n", debugstr_w(szProduct
), debugstr_w(szComponent
), eInstallState
);
3462 return ERROR_SUCCESS
;