24#define NONAMELESSUNION
150 if (!szProduct || !
squash_guid( szProduct, squashed_pc ))
233 const WCHAR *reinstallmode;
250 if (reinstallmode[--
len] ==
'v' || reinstallmode[
len] ==
'V')
299 if (szPatchPackage && !(patch_package =
strdupAtoW(szPatchPackage)))
302 if (szInstallPackage && !(install_package =
strdupAtoW(szInstallPackage)))
305 if (szCommandLine && !(command_line =
strdupAtoW(szCommandLine)))
308 r =
MsiApplyPatchW(patch_package, install_package, eInstallType, command_line);
338 ERR(
"Failed to read product codes from patch\n");
365 LPCWSTR cmd_ptr = szCommandLine;
369 if (!szPatchPackage || !szPatchPackage[0])
391 for (
i = 0; codes[
i];
i++)
396 TRACE(
"patch applied\n");
419 FIXME(
"Only reading target products from patch\n");
437 if (!szPatchPackages || !szPatchPackages[0])
440 if (!(patch_packages =
strdupAtoW(szPatchPackages)))
443 if (szProductCode && !(product_code =
strdupAtoW(szProductCode)))
446 if (szPropertiesList && !(properties_list =
strdupAtoW(szPropertiesList)))
468 if (!szPatchPackages || !szPatchPackages[0])
471 beg =
end = szPatchPackages;
477 while (*beg ==
' ') beg++;
481 while (
len && beg[
len - 1] ==
' ')
len--;
523 ret[
i].ePatchDataType =
info[
i].ePatchDataType;
537 TRACE(
"%s, %lu, %p\n",
debugstr_a(szProductPackagePath), cPatchInfo, pPatchInfo );
539 if (szProductPackagePath && !(package_path =
strdupAtoW( szProductPackagePath )))
550 for (
i = 0;
i < cPatchInfo;
i++)
583 TRACE(
"patch not applicable\n");
604 ERR(
"no product code to check\n");
609 hr = IXMLDOMDocument_selectNodes(
desc,
s, &
list );
616 hr = IXMLDOMNode_get_text(
node, &
s );
617 IXMLDOMNode_Release(
node );
624 IXMLDOMNodeList_Release(
list );
627 TRACE(
"patch not applicable\n");
639 FIXME(
"patch ordering not supported\n");
643 switch (
info[
i].ePatchDataType)
669 &IID_IXMLDOMDocument, (
void**)&
desc );
672 ERR(
"failed to create DOMDocument30 instance, %#lx\n",
hr );
687 hr = IXMLDOMDocument_loadXML(
desc,
s, &
b );
691 ERR(
"failed to parse patch description\n");
692 IXMLDOMDocument_Release(
desc );
710 FIXME(
"unknown patch data type %u\n",
info[
i].ePatchDataType);
718 TRACE(
"ePatchDataType: %u\n",
info[
i].ePatchDataType);
723 if (
desc) IXMLDOMDocument_Release(
desc );
734 TRACE(
"%s, %lu, %p\n",
debugstr_w(szProductPackagePath), cPatchInfo, pPatchInfo );
739 ERR(
"failed to open package %u\n",
r);
758 if (usersid && !(usersidW =
strdupAtoW( usersid )))
802 DWORD sz =
sizeof(sourcepath);
843 TRACE(
"%s %d %d %s\n",
debugstr_w(szProduct), iInstallLevel, eInstallState,
852 FIXME(
"State %d not implemented\n", eInstallState);
887 lstrcpyW(commandline, szCommandLine);
890 lstrcatW(commandline,
L" INSTALLLEVEL=32767");
898 sz =
sizeof(sourcepath);
954 TRACE(
"%s %d %d\n",
debugstr_a(szProduct), iInstallLevel, eInstallState);
1004 HKEY compkey, prodkey;
1010 if (!szComponent || !*szComponent)
1086 ERR(
"unhandled value type %lu\n", *
type );
1232 if (szValue->
str.
a || szValue->
str.
w)
1242 *pcchValueBuf =
len;
1264 szBuffer, pcchValueBuf);
1267 if( szProduct && !szwProduct )
1293 szBuffer, pcchValueBuf);
1315 szValue, pcchValue);
1317 if (szValue && !pcchValue)
1320 if (szProductCode) product =
strdupAtoW(szProductCode);
1321 if (szUserSid) usersid =
strdupAtoW(szUserSid);
1322 if (szProperty)
property =
strdupAtoW(szProperty);
1345 if (*pcchValue >=
len)
1354 if (*pcchValue <=
len || !szValue)
1357 *pcchValue =
len - 1;
1405 szValue, pcchValue);
1407 if (!szProductCode || !
squash_guid( szProductCode, squashed_pc ))
1410 if (szValue && !pcchValue)
1418 if (!szProperty || !*szProperty)
1434 package = INSTALLPROPERTY_LOCALPACKAGEW;
1436 if (!
props && !prod)
1441 package = L"ManagedLocalPackage";
1443 if (!
props && !managed)
1448 package = INSTALLPROPERTY_LOCALPACKAGEW;
1451 if (!
props && !classes)
1476 if (prod || classes)
1485 szProperty =
L"DisplayName";
1487 szProperty =
L"DisplayVersion";
1504 if (!prod && !classes)
1547 if (prod || managed)
1556 if (!prod && !classes)
1580 debugstr_a(szPatchList), pcFiles, pphFileRecords);
1588 debugstr_w(szPatchList), pcFiles, pphFileRecords);
1605 if (lpValue && !pcchValue)
1608 if (szPatchCode) patch =
strdupAtoW(szPatchCode);
1609 if (szProductCode) product =
strdupAtoW(szProductCode);
1610 if (szUserSid) usersid =
strdupAtoW(szUserSid);
1611 if (szProperty)
property =
strdupAtoW(szProperty);
1636 if ((*
val && *pcchValue <
len + 1) || !lpValue)
1641 lpValue[*pcchValue - 1] =
'\0';
1665 HKEY patch = 0, patches = 0;
1666 HKEY udpatch = 0, datakey = 0;
1667 HKEY prodpatches = 0;
1676 if (!szProductCode || !
squash_guid( szProductCode, squashed_pc ))
1679 if (!szPatchCode || !
squash_guid( szPatchCode, squashed_patch ))
1685 if (lpValue && !pcchValue)
1696 if (szUserSid && !
wcscmp( szUserSid,
L"S-1-5-18" ))
1727 datakey = prodpatches;
1728 szProperty = squashed_patch;
1739 szProperty =
L"ManagedLocalPackage";
1745 szProperty =
L"Installed";
1774 if ((*
val && *pcchValue <
len + 1) || !lpValue)
1805 if (!patch || !
attr)
1853 if (!patch || !
attr)
1889 TRACE(
"%#lx, %s, %#lx\n", dwLogMode,
debugstr_a(szLogFile), attributes );
1904 TRACE(
"%#lx, %s, %#lx\n", dwLogMode,
debugstr_w(szLogFile), attributes );
1934 TRACE(
"%lu, %s, %lu, %d, %p, %p, %p, %p\n",
handle,
debugstr_a(component),
index,
state,
drive, buflen, cost,
1974 TRACE(
"%lu, %s, %lu, %d, %p, %p, %p, %p\n",
handle,
debugstr_w(component),
index,
state,
drive, buflen, cost,
2031 if (component && component[0])
2042 *cost =
max( 8, comp->
Cost / 512 );
2067 if (szProductCode && !(prodcode =
strdupAtoW(szProductCode)))
2070 if (szUserSid && !(usersid =
strdupAtoW(szUserSid)))
2073 if (szComponent && !(comp =
strdupAtoW(szComponent)))
2108 package = L"ManagedLocalPackage";
2110 package = L"LocalPackage";
2154 if (!pdwState || !szComponent)
2157 if (!szProductCode || !*szProductCode ||
lstrlenW(szProductCode) !=
GUID_SIZE - 1)
2197 val[0] >=
'0' &&
val[0] <=
'9' &&
val[1] >=
'0' &&
val[1] <=
'9' &&
val[2] !=
':')
2206 TRACE(
"-> %d\n", *pdwState);
2230 HKEY prodkey = 0, userdata = 0;
2236 if (!szProduct || !*szProduct)
2242 if (szProduct[0] !=
'{' || szProduct[37] !=
'}')
2289 TRACE(
"%08x %p\n", dwUILevel, phWnd);
2294 FIXME(
"Unrecognized flags %08x\n", dwUILevel);
2313 TRACE(
"%p, %#lx, %p\n", puiHandler, dwMessageFilter, pvContext );
2327 TRACE(
"%p, %#lx, %p\n", puiHandler, dwMessageFilter, pvContext );
2372 FIXME(
"don't know how to deal with handle = %lu\n",
handle );
2387 for (
i = 0;
i < (
id & 0xf);
i++)
p += *
p + 1;
2390 if( nBufferMax <=
len )
2412 if(
len <= nBufferMax )
2429 if (!szComponent || !pcchBuf)
2445 if (!szComponent || !pcchBuf)
2457 FIXME(
"%p, %s, %s, %u, %#x, %#lx\n",
hWnd,
debugstr_a(lpText),
debugstr_a(lpCaption), uType, wLanguageId,
f );
2464 FIXME(
"%p, %s, %s, %u, %#x %#lx\n",
hWnd,
debugstr_w(lpText),
debugstr_w(lpCaption), uType, wLanguageId,
f );
2471 FIXME(
"%p, %s, %s, %u, %#lx, %#x, %#lx): semi-stub\n",
hWnd,
debugstr_a(lpText),
debugstr_a(lpCaption), uType,
2479 FIXME(
"%p, %s, %s, %u, %#lx, %#x, %#lx): semi-stub\n",
hWnd,
debugstr_w(lpText),
debugstr_w(lpCaption), uType,
2485 DWORD dwAssemblyInfo,
char *lpPathBuf,
DWORD *pcchPathBuf )
2488 dwAssemblyInfo, lpPathBuf, pcchPathBuf );
2496 dwAssemblyInfo, lpPathBuf, pcchPathBuf );
2557 data.dwProvFlags = 0;
2602 TRACE(
"%lu, %s, %p, %p\n", hProduct,
debugstr_a(szProperty), szValue, pccbValue );
2604 if (szValue && !pccbValue)
2607 if (szProperty) prop =
strdupAtoW(szProperty);
2616 if (szValue) *szValue =
'\0';
2617 if (pccbValue) *pccbValue = 0;
2640 if (
len > *pccbValue)
2643 *pccbValue =
len - 1;
2664 TRACE(
"%lu, %s, %p, %p)\n", hProduct,
debugstr_w(szProperty), szValue, pccbValue );
2669 if (szValue && !pccbValue)
2672 package = msihandle2msiinfo(hProduct, MSIHANDLETYPE_PACKAGE);
2676 r =
MSI_OpenQuery(package->
db, &
view,
L"SELECT * FROM `Property` WHERE `Property` = '%s'", szProperty);
2715 if (szValue) *szValue =
'\0';
2716 if (pccbValue) *pccbValue = 0;
2767 if (usersid && !
wcsicmp( usersid,
L"S-1-1-0" ))
2769 FIXME(
"only looking at the current user\n" );
2786 if (!szProduct || !szComponent)
2789 if (lpPathBuf->
str.
w && !pcchBuf)
2878 if (usersid && !(usersidW =
strdupAtoW( usersid )))
goto end;
2973 path[0] >=
'0' &&
path[0] <=
'9' &&
3000 if (usersid && !(usersidW =
strdupAtoW( usersid )))
3035 if ( szProduct && !szwProduct )
3039 if ( szFeature && !szwFeature )
3076 if (!szProduct || !szFeature || !
squash_guid( szProduct, squashed ))
3100 if ((lpVersionBuf && !pcchVersionBuf) ||
3101 (lpLangBuf && !pcchLangBuf))
3111 if( lpVersionBuf && pcchVersionBuf && *pcchVersionBuf )
3114 if( !lpwVersionBuff )
3118 if( lpLangBuf && pcchLangBuf && *pcchLangBuf )
3126 lpwLangBuff, pcchLangBuf);
3130 lpVersionBuf, *pcchVersionBuf + 1,
NULL,
NULL);
3133 lpLangBuf, *pcchLangBuf + 1,
NULL,
NULL);
3167 if (!verbuf && !verlen && !langbuf && !langlen)
3177 HIWORD(ffi->dwFileVersionMS),
LOWORD(ffi->dwFileVersionMS),
3178 HIWORD(ffi->dwFileVersionLS),
LOWORD(ffi->dwFileVersionLS) );
3179 if (verbuf)
lstrcpynW( verbuf, tmp, *verlen );
3186 if (verbuf) *verbuf = 0;
3195 if (langbuf)
lstrcpynW( langbuf, tmp, *langlen );
3202 if (langbuf) *langbuf = 0;
3218 TRACE(
"%s, %p(%lu), %p(%lu)\n",
debugstr_w(
path), verbuf, verlen ? *verlen : 0, langbuf, langlen ? *langlen : 0 );
3220 if ((verbuf && !verlen) || (langbuf && !langlen))
3249 pdwUseCount, pwDateUsed);
3263 pdwUseCount, pwDateUsed);
3266 if (szProduct && !prod)
3270 if (szFeature && !feat)
3299 FIXME(
"mark product %s feature %s as used\n",
3318 if (szProduct && !prod)
3322 if (szFeature && !feat)
3368#define BASE85_SIZE 20
3396 if (!szProduct) szProduct = product;
3434 DWORD *pcchPathBuf )
3438 TRACE(
"%s, %s, %lu, %s, %#lx, %#lx, %p, %p\n",
debugstr_w(szComponent),
debugstr_w(szQualifier), dwInstallMode,
3439 debugstr_w(szProduct), Unused1, Unused2, lpPathBuf, pcchPathBuf );
3442 path.str.w = lpPathBuf;
3445 &
path, pcchPathBuf );
3452 const char *szProduct,
DWORD Unused1,
DWORD Unused2,
char *lpPathBuf,
3453 DWORD *pcchPathBuf )
3455 WCHAR *szwComponent, *szwQualifier =
NULL, *szwProduct =
NULL;
3459 TRACE(
"%s, %s, %lu, %s, %#lx, %#lx, %p, %p\n",
debugstr_a(szComponent),
debugstr_a(szQualifier), dwInstallMode,
3460 debugstr_a(szProduct), Unused1, Unused2, lpPathBuf, pcchPathBuf );
3463 if (szComponent && !szwComponent)
3467 if (szQualifier && !szwQualifier)
3471 if (szProduct && !szwProduct)
3475 path.str.a = lpPathBuf;
3478 dwInstallMode, szwProduct, Unused1,
3479 Unused2, &
path, pcchPathBuf);
3496 dwInstallMode,
NULL, 0, 0, lpPathBuf, pcchPathBuf);
3507 dwInstallMode,
NULL, 0, 0, lpPathBuf, pcchPathBuf);
3525 pcchUserNameBuf, lpOrgNameBuf, pcchOrgNameBuf, lpSerialBuf,
3528 if (!szProduct || !
squash_guid( szProduct, squashed_pc ))
3561 if (pcchUserNameBuf)
3563 if (lpUserNameBuf && !
user)
3565 (*pcchUserNameBuf)--;
3580 if (!orgptr) orgptr =
L"";
3621 if ((lpUserNameBuf && !pcchUserNameBuf) ||
3622 (lpOrgNameBuf && !pcchOrgNameBuf) ||
3623 (lpSerialBuf && !pcchSerialBuf))
3627 user.str.w = lpUserNameBuf;
3629 org.str.w = lpOrgNameBuf;
3631 serial.str.w = lpSerialBuf;
3634 &
org, pcchOrgNameBuf,
3635 &
serial, pcchSerialBuf );
3647 if ((lpUserNameBuf && !pcchUserNameBuf) ||
3648 (lpOrgNameBuf && !pcchOrgNameBuf) ||
3649 (lpSerialBuf && !pcchSerialBuf))
3653 if (szProduct && !prod)
3657 user.str.a = lpUserNameBuf;
3659 org.str.a = lpOrgNameBuf;
3661 serial.str.a = lpSerialBuf;
3664 &
org, pcchOrgNameBuf,
3665 &
serial, pcchSerialBuf );
3685 package = msihandle2msiinfo(handle, MSIHANDLETYPE_PACKAGE);
3710 package = msihandle2msiinfo(handle, MSIHANDLETYPE_PACKAGE);
3733 if (szProduct && !prod)
3737 if (szFeature && !feat)
3761 if (!szProduct || !szFeature)
3764 switch (eInstallState)
3783 sz =
sizeof(sourcepath);
3844 LPSTR szComponentCode )
3852 if (szShortcutTarget && !
target )
3881 szProductCode, szFeatureId, szComponentCode );
3889 r = IPersistFile_Load( pf, szShortcutTarget,
3893 r = IPersistFile_QueryInterface( pf, &IID_IShellLinkDataList,
3899 IShellLinkDataList_Release( dl );
3902 IPersistFile_Release( pf );
3908 TRACE(
"darwin = %p\n", darwin);
3916 szProductCode, szFeatureId, szComponentCode, &sz );