24 #define NONAMELESSUNION 35 #include "msiserver.h" 49 #include "wine/unicode.h" 53 static const WCHAR installerW[] = {
'\\',
'I',
'n',
's',
't',
'a',
'l',
'l',
'e',
'r',0};
109 static const WCHAR managed[] = {
110 'M',
'a',
'n',
'a',
'g',
'e',
'd',
'L',
'o',
'c',
'a',
'l',
'P',
'a',
'c',
'k',
'a',
'g',
'e',0};
111 static const WCHAR local[] = {
'L',
'o',
'c',
'a',
'l',
'P',
'a',
'c',
'k',
'a',
'g',
'e',0};
153 if (!szProduct || !
squash_guid( szProduct, squashed_pc ))
291 if (szPatchPackage && !(patch_package =
strdupAtoW(szPatchPackage)))
294 if (szInstallPackage && !(install_package =
strdupAtoW(szInstallPackage)))
297 if (szCommandLine && !(command_line =
strdupAtoW(szCommandLine)))
300 r =
MsiApplyPatchW(patch_package, install_package, eInstallType, command_line);
330 ERR(
"Failed to read product codes from patch\n");
357 LPCWSTR cmd_ptr = szCommandLine;
361 static const WCHAR fmt[] = {
'%',
's',
' ',
'P',
'A',
'T',
'C',
'H',
'=',
'"',
'%',
's',
'"',0};
364 if (!szPatchPackage || !szPatchPackage[0])
386 for (
i = 0; codes[
i];
i++)
391 TRACE(
"patch applied\n");
414 FIXME(
"Only reading target products from patch\n");
432 if (!szPatchPackages || !szPatchPackages[0])
435 if (!(patch_packages =
strdupAtoW(szPatchPackages)))
441 if (szPropertiesList && !(properties_list =
strdupAtoW(szPropertiesList)))
463 if (!szPatchPackages || !szPatchPackages[0])
466 beg =
end = szPatchPackages;
472 while (*beg ==
' ') beg++;
476 while (
len && beg[
len - 1] ==
' ')
len--;
518 ret[
i].ePatchDataType =
info[
i].ePatchDataType;
532 TRACE(
"%s, %u, %p\n",
debugstr_a(szProductPackagePath), cPatchInfo, pPatchInfo);
534 if (szProductPackagePath && !(package_path =
strdupAtoW( szProductPackagePath )))
545 for (
i = 0;
i < cPatchInfo;
i++)
578 TRACE(
"patch not applicable\n");
588 static const WCHAR queryW[] = {
'M',
's',
'i',
'P',
'a',
't',
'c',
'h',
'/',
589 'T',
'a',
'r',
'g',
'e',
't',
'P',
'r',
'o',
'd',
'u',
'c',
't',
'/',
590 'T',
'a',
'r',
'g',
'e',
't',
'P',
'r',
'o',
'd',
'u',
'c',
't',
'C',
'o',
'd',
'e',0};
602 ERR(
"no product code to check\n");
607 hr = IXMLDOMDocument_selectNodes(
desc,
s, &
list );
614 hr = IXMLDOMNode_get_text(
node, &
s );
615 IXMLDOMNode_Release(
node );
622 IXMLDOMNodeList_Release(
list );
625 TRACE(
"patch not applicable\n");
637 FIXME(
"patch ordering not supported\n");
641 switch (
info[
i].ePatchDataType)
667 &IID_IXMLDOMDocument, (
void**)&
desc );
670 ERR(
"failed to create DOMDocument30 instance, 0x%08x\n",
hr);
685 hr = IXMLDOMDocument_loadXML(
desc,
s, &
b );
689 ERR(
"failed to parse patch description\n");
690 IXMLDOMDocument_Release(
desc );
708 FIXME(
"unknown patch data type %u\n",
info[
i].ePatchDataType);
716 TRACE(
"ePatchDataType: %u\n",
info[
i].ePatchDataType);
721 if (
desc) IXMLDOMDocument_Release(
desc );
732 TRACE(
"%s, %u, %p\n",
debugstr_w(szProductPackagePath), cPatchInfo, pPatchInfo);
737 ERR(
"failed to open package %u\n",
r);
757 if (usersid && !(usersidW =
strdupAtoW( usersid )))
795 strcpyW( sourcepath, localpath );
801 DWORD sz =
sizeof(sourcepath);
844 ' ',
'I',
'n',
's',
't',
'a',
'l',
'l',
'e',
'd',
'=',
'1',0};
845 static const WCHAR szMaxInstallLevel[] = {
846 ' ',
'I',
'N',
'S',
'T',
'A',
'L',
'L',
'L',
'E',
'V',
'E',
'L',
'=',
'3',
'2',
'7',
'6',
'7',0};
847 static const WCHAR szRemoveAll[] = {
848 ' ',
'R',
'E',
'M',
'O',
'V',
'E',
'=',
'A',
'L',
'L',0};
849 static const WCHAR szMachine[] = {
850 ' ',
'A',
'L',
'L',
'U',
'S',
'E',
'R',
'S',
'=',
'1',0};
852 TRACE(
"%s %d %d %s\n",
debugstr_w(szProduct), iInstallLevel, eInstallState,
861 FIXME(
"State %d not implemented\n", eInstallState);
896 lstrcpyW(commandline,szCommandLine);
899 lstrcatW(commandline, szMaxInstallLevel);
907 sz =
sizeof(sourcepath);
963 TRACE(
"%s %d %d\n",
debugstr_a(szProduct), iInstallLevel, eInstallState);
1013 HKEY compkey, prodkey;
1015 DWORD sz =
sizeof(squashed_prod)/
sizeof(squashed_prod[0]);
1019 if (!szComponent || !*szComponent)
1087 static const WCHAR fmt[] = {
'%',
'u',0};
1096 ERR(
"unhandled value type %u\n", *
type );
1104 static const WCHAR sourcelist[] = {
'S',
'o',
'u',
'r',
'c',
'e',
'L',
'i',
's',
't',0};
1105 static const WCHAR display_name[] = {
'D',
'i',
's',
'p',
'l',
'a',
'y',
'N',
'a',
'm',
'e',0};
1106 static const WCHAR display_version[] = {
'D',
'i',
's',
'p',
'l',
'a',
'y',
'V',
'e',
'r',
's',
'i',
'o',
'n',0};
1107 static const WCHAR assignment[] = {
'A',
's',
's',
'i',
'g',
'n',
'm',
'e',
'n',
't',0};
1246 if (szValue->
str.
a || szValue->
str.
w)
1256 *pcchValueBuf =
len;
1278 szBuffer, pcchValueBuf);
1281 if( szProduct && !szwProduct )
1307 szBuffer, pcchValueBuf);
1329 szValue, pcchValue);
1331 if (szValue && !pcchValue)
1335 if (szUserSid) usersid =
strdupAtoW(szUserSid);
1359 if (*pcchValue >=
len)
1368 if (*pcchValue <=
len || !szValue)
1371 *pcchValue =
len - 1;
1411 static const WCHAR five[] = {
'5',0};
1412 static const WCHAR displayname[] = {
1413 'D',
'i',
's',
'p',
'l',
'a',
'y',
'N',
'a',
'm',
'e',0};
1414 static const WCHAR displayversion[] = {
1415 'D',
'i',
's',
'p',
'l',
'a',
'y',
'V',
'e',
'r',
's',
'i',
'o',
'n',0};
1416 static const WCHAR managed_local_package[] = {
1417 'M',
'a',
'n',
'a',
'g',
'e',
'd',
'L',
'o',
'c',
'a',
'l',
1418 'P',
'a',
'c',
'k',
'a',
'g',
'e',0};
1427 szValue, pcchValue);
1432 if (szValue && !pcchValue)
1456 package = INSTALLPROPERTY_LOCALPACKAGEW;
1458 if (!
props && !prod)
1463 package = managed_local_package;
1465 if (!
props && !managed)
1470 package = INSTALLPROPERTY_LOCALPACKAGEW;
1473 if (!
props && !classes)
1498 if (prod || classes)
1526 if (!prod && !classes)
1569 if (prod || managed)
1578 if (!prod && !classes)
1602 debugstr_a(szPatchList), pcFiles, pphFileRecords);
1610 debugstr_w(szPatchList), pcFiles, pphFileRecords);
1627 if (lpValue && !pcchValue)
1630 if (szPatchCode) patch =
strdupAtoW(szPatchCode);
1632 if (szUserSid) usersid =
strdupAtoW(szUserSid);
1658 if ((*
val && *pcchValue <
len + 1) || !lpValue)
1663 lpValue[*pcchValue - 1] =
'\0';
1685 static const WCHAR szManagedPackage[] =
1686 {
'M',
'a',
'n',
'a',
'g',
'e',
'd',
'L',
'o',
'c',
'a',
'l',
'P',
'a',
'c',
'k',
'a',
'g',
'e',0};
1689 HKEY patch = 0, patches = 0;
1690 HKEY udpatch = 0, datakey = 0;
1691 HKEY prodpatches = 0;
1703 if (!szPatchCode || !
squash_guid( szPatchCode, squashed_patch ))
1709 if (lpValue && !pcchValue)
1751 datakey = prodpatches;
1798 if ((*
val && *pcchValue <
len + 1) || !lpValue)
1829 if (!patch || !
attr)
1877 if (!patch || !
attr)
1913 TRACE(
"%08x %s %08x\n", dwLogMode,
debugstr_a(szLogFile), attributes);
1928 TRACE(
"%08x %s %08x\n", dwLogMode,
debugstr_w(szLogFile), attributes);
1954 int *cost,
int *
temp )
1960 TRACE(
"%d, %s, %u, %d, %p, %p, %p %p\n",
handle,
debugstr_a(component),
index,
1992 int *cost,
int *
temp )
2001 TRACE(
"%d, %s, %u, %d, %p, %p, %p %p\n",
handle,
debugstr_w(component),
index,
2016 IWineMsiRemotePackage_Release( remote_package );
2019 hr = IWineMsiRemotePackage_EnumComponentCosts( remote_package, bname,
index,
state,
drive, buflen, cost,
temp );
2020 IWineMsiRemotePackage_Release( remote_package );
2055 if (component && component[0])
2066 *cost =
max( 8, comp->
Cost / 512 );
2094 if (szUserSid && !(usersid =
strdupAtoW(szUserSid)))
2097 if (szComponent && !(comp =
strdupAtoW(szComponent)))
2127 static const WCHAR local_package[] = {
'L',
'o',
'c',
'a',
'l',
'P',
'a',
'c',
'k',
'a',
'g',
'e',0};
2128 static const WCHAR managed_local_package[] = {
2129 'M',
'a',
'n',
'a',
'g',
'e',
'd',
'L',
'o',
'c',
'a',
'l',
'P',
'a',
'c',
'k',
'a',
'g',
'e',0
2137 package = managed_local_package;
2139 package = local_package;
2183 if (!pdwState || !szComponent)
2226 val[0] >=
'0' &&
val[0] <=
'9' &&
val[1] >=
'0' &&
val[1] <=
'9' &&
val[2] !=
':')
2235 TRACE(
"-> %d\n", *pdwState);
2259 HKEY prodkey = 0, userdata = 0;
2265 if (!szProduct || !*szProduct)
2271 if (szProduct[0] !=
'{' || szProduct[37] !=
'}')
2318 TRACE(
"%08x %p\n", dwUILevel, phWnd);
2323 FIXME(
"Unrecognized flags %08x\n", dwUILevel);
2343 TRACE(
"%p %08x %p\n", puiHandler, dwMessageFilter, pvContext);
2358 TRACE(
"%p %08x %p\n", puiHandler, dwMessageFilter, pvContext);
2404 FIXME(
"don't know how to deal with handle = %08x\n",
handle);
2420 for (
i = 0;
i < (
id & 0xf);
i++)
p += *
p + 1;
2423 if( nBufferMax <=
len )
2445 if(
len <= nBufferMax )
2462 if (!szComponent || !pcchBuf)
2478 if (!szComponent || !pcchBuf)
2491 uType, wLanguageId,
f);
2499 uType, wLanguageId,
f);
2524 debugstr_a(szAppContext), dwInstallMode, dwAssemblyInfo, lpPathBuf,
2534 debugstr_w(szAppContext), dwInstallMode, dwAssemblyInfo, lpPathBuf,
2596 data.dwProvFlags = 0;
2643 szValue, pccbValue);
2645 if (szValue && !pccbValue)
2657 if (szValue) *szValue =
'\0';
2658 if (pccbValue) *pccbValue = 0;
2681 if (
len > *pccbValue)
2684 *pccbValue =
len - 1;
2707 'S',
'E',
'L',
'E',
'C',
'T',
' ',
'*',
' ',
'F',
'R',
'O',
'M',
' ',
2708 '`',
'P',
'r',
'o',
'p',
'e',
'r',
't',
'y',
'`',
' ',
'W',
'H',
'E',
'R',
'E',
' ',
2709 '`',
'P',
'r',
'o',
'p',
'e',
'r',
't',
'y',
'`',
'=',
'\'',
'%',
's',
'\'',0};
2712 szValue, pccbValue);
2717 if (szValue && !pccbValue)
2720 package = msihandle2msiinfo(hProduct, MSIHANDLETYPE_PACKAGE);
2763 if (szValue) *szValue =
'\0';
2764 if (pccbValue) *pccbValue = 0;
2817 FIXME(
"only looking at the current user\n" );
2829 static const WCHAR wininstaller[] =
2830 {
'W',
'i',
'n',
'd',
'o',
'w',
's',
'I',
'n',
's',
't',
'a',
'l',
'l',
'e',
'r',0};
2836 if (!szProduct || !szComponent)
2839 if (lpPathBuf->
str.
w && !pcchBuf)
2928 if (usersid && !(usersidW =
strdupAtoW( usersid )))
goto end;
3023 path[0] >=
'0' &&
path[0] <=
'9' &&
3050 if (usersid && !(usersidW =
strdupAtoW( usersid )))
3085 if ( szProduct && !szwProduct )
3089 if ( szFeature && !szwFeature )
3126 if (!szProduct || !szFeature || !
squash_guid( szProduct, squashed ))
3150 if ((lpVersionBuf && !pcchVersionBuf) ||
3151 (lpLangBuf && !pcchLangBuf))
3161 if( lpVersionBuf && pcchVersionBuf && *pcchVersionBuf )
3164 if( !lpwVersionBuff )
3168 if( lpLangBuf && pcchLangBuf && *pcchLangBuf )
3176 lpwLangBuff, pcchLangBuf);
3180 lpVersionBuf, *pcchVersionBuf + 1,
NULL,
NULL);
3183 lpLangBuf, *pcchLangBuf + 1,
NULL,
NULL);
3196 static const WCHAR szVersionResource[] = {
'\\',0};
3197 static const WCHAR szVersionFormat[] = {
'%',
'd',
'.',
'%',
'd',
'.',
'%',
'd',
'.',
'%',
'd',0};
3198 static const WCHAR szLangFormat[] = {
'%',
'd',0};
3219 if (!verbuf && !verlen && !langbuf && !langlen)
3229 HIWORD(ffi->dwFileVersionMS),
LOWORD(ffi->dwFileVersionMS),
3230 HIWORD(ffi->dwFileVersionLS),
LOWORD(ffi->dwFileVersionLS) );
3231 if (verbuf)
lstrcpynW( verbuf, tmp, *verlen );
3238 if (verbuf) *verbuf = 0;
3247 if (langbuf)
lstrcpynW( langbuf, tmp, *langlen );
3254 if (langbuf) *langbuf = 0;
3272 langbuf, langlen ? *langlen : 0);
3274 if ((verbuf && !verlen) || (langbuf && !langlen))
3303 pdwUseCount, pwDateUsed);
3317 pdwUseCount, pwDateUsed);
3320 if (szProduct && !prod)
3324 if (szFeature && !feat)
3354 FIXME(
"mark product %s feature %s as used\n",
3374 if (szProduct && !prod)
3378 if (szFeature && !feat)
3424 #define BASE85_SIZE 20 3452 if (!szProduct) szProduct = product;
3497 Unused1, Unused2, lpPathBuf, pcchPathBuf);
3500 path.str.w = lpPathBuf;
3503 dwInstallMode, szProduct, Unused1, Unused2, &
path, pcchPathBuf);
3520 Unused1, Unused2, lpPathBuf, pcchPathBuf);
3523 if (szComponent && !szwComponent)
3527 if (szQualifier && !szwQualifier)
3531 if (szProduct && !szwProduct)
3535 path.str.a = lpPathBuf;
3538 dwInstallMode, szwProduct, Unused1,
3539 Unused2, &
path, pcchPathBuf);
3556 dwInstallMode,
NULL, 0, 0, lpPathBuf, pcchPathBuf);
3567 dwInstallMode,
NULL, 0, 0, lpPathBuf, pcchPathBuf);
3585 pcchUserNameBuf, lpOrgNameBuf, pcchOrgNameBuf, lpSerialBuf,
3588 if (!szProduct || !
squash_guid( szProduct, squashed_pc ))
3621 if (pcchUserNameBuf)
3623 if (lpUserNameBuf && !
user)
3625 (*pcchUserNameBuf)--;
3640 if (!orgptr) orgptr =
szEmpty;
3681 if ((lpUserNameBuf && !pcchUserNameBuf) ||
3682 (lpOrgNameBuf && !pcchOrgNameBuf) ||
3683 (lpSerialBuf && !pcchSerialBuf))
3687 user.str.w = lpUserNameBuf;
3689 org.str.w = lpOrgNameBuf;
3691 serial.str.w = lpSerialBuf;
3694 &
org, pcchOrgNameBuf,
3695 &
serial, pcchSerialBuf );
3707 if ((lpUserNameBuf && !pcchUserNameBuf) ||
3708 (lpOrgNameBuf && !pcchOrgNameBuf) ||
3709 (lpSerialBuf && !pcchSerialBuf))
3713 if (szProduct && !prod)
3717 user.str.a = lpUserNameBuf;
3719 org.str.a = lpOrgNameBuf;
3721 serial.str.a = lpSerialBuf;
3724 &
org, pcchOrgNameBuf,
3725 &
serial, pcchSerialBuf );
3737 static const WCHAR szFirstRun[] = {
'F',
'i',
'r',
's',
't',
'R',
'u',
'n',0};
3746 package = msihandle2msiinfo(handle, MSIHANDLETYPE_PACKAGE);
3763 static const WCHAR szFirstRun[] = {
'F',
'i',
'r',
's',
't',
'R',
'u',
'n',0};
3772 package = msihandle2msiinfo(handle, MSIHANDLETYPE_PACKAGE);
3795 if (szProduct && !prod)
3799 if (szFeature && !feat)
3823 if (!szProduct || !szFeature)
3826 switch (eInstallState)
3845 sz =
sizeof(sourcepath);
3906 LPSTR szComponentCode )
3914 if (szShortcutTarget && !
target )
3951 r = IPersistFile_Load( pf, szShortcutTarget,
3955 r = IPersistFile_QueryInterface( pf, &IID_IShellLinkDataList,
3961 IShellLinkDataList_Release( dl );
3964 IPersistFile_Release( pf );
3970 TRACE(
"darwin = %p\n", darwin);
3988 static const WCHAR fmtW[] = {
'%',
's',
'=',
'%',
's',
' ',
'%',
's',
'=',
'%',
's',0};
4002 ptr = reinstallmode;
4026 sz =
sizeof(sourcepath);
4059 DWORD dwReinstallMode )
4083 unsigned char digest[16];