ReactOS 0.4.16-dev-338-g34e76ad
msi.c File Reference
#include <stdarg.h>
#include "windef.h"
#include "winbase.h"
#include "winreg.h"
#include "winnls.h"
#include "shlwapi.h"
#include "msi.h"
#include "msidefs.h"
#include "msiquery.h"
#include "wincrypt.h"
#include "winver.h"
#include "winuser.h"
#include "shlobj.h"
#include "shobjidl.h"
#include "objidl.h"
#include "wintrust.h"
#include "softpub.h"
#include "msipriv.h"
#include "winemsi_s.h"
#include "initguid.h"
#include "msxml2.h"
#include "wine/debug.h"
#include "wine/exception.h"
Include dependency graph for msi.c:

Go to the source code of this file.

Classes

struct  md5_ctx
 

Macros

#define COBJMACROS
 
#define BASE85_SIZE   20
 

Functions

 WINE_DEFAULT_DEBUG_CHANNEL (msi)
 
UINT msi_locate_product (LPCWSTR szProduct, MSIINSTALLCONTEXT *context)
 
UINT WINAPI MsiOpenProductA (LPCSTR szProduct, MSIHANDLE *phProduct)
 
static UINT MSI_OpenProductW (LPCWSTR szProduct, MSIPACKAGE **package)
 
UINT WINAPI MsiOpenProductW (LPCWSTR szProduct, MSIHANDLE *phProduct)
 
UINT WINAPI MsiAdvertiseProductA (LPCSTR szPackagePath, LPCSTR szScriptfilePath, LPCSTR szTransforms, LANGID lgidLanguage)
 
UINT WINAPI MsiAdvertiseProductW (LPCWSTR szPackagePath, LPCWSTR szScriptfilePath, LPCWSTR szTransforms, LANGID lgidLanguage)
 
UINT WINAPI MsiAdvertiseProductExA (const char *szPackagePath, const char *szScriptfilePath, const char *szTransforms, LANGID lgidLanguage, DWORD dwPlatform, DWORD dwOptions)
 
UINT WINAPI MsiAdvertiseProductExW (const WCHAR *szPackagePath, const WCHAR *szScriptfilePath, const WCHAR *szTransforms, LANGID lgidLanguage, DWORD dwPlatform, DWORD dwOptions)
 
UINT WINAPI MsiInstallProductA (LPCSTR szPackagePath, LPCSTR szCommandLine)
 
UINT WINAPI MsiInstallProductW (LPCWSTR szPackagePath, LPCWSTR szCommandLine)
 
UINT WINAPI MsiReinstallProductA (const char *szProduct, DWORD dwReinstallMode)
 
UINT WINAPI MsiReinstallProductW (const WCHAR *szProduct, DWORD dwReinstallMode)
 
UINT WINAPI MsiApplyPatchA (LPCSTR szPatchPackage, LPCSTR szInstallPackage, INSTALLTYPE eInstallType, LPCSTR szCommandLine)
 
static UINT get_patch_product_codes (LPCWSTR szPatchPackage, WCHAR ***product_codes)
 
static UINT MSI_ApplyPatchW (LPCWSTR szPatchPackage, LPCWSTR szProductCode, LPCWSTR szCommandLine)
 
UINT WINAPI MsiApplyPatchW (LPCWSTR szPatchPackage, LPCWSTR szInstallPackage, INSTALLTYPE eInstallType, LPCWSTR szCommandLine)
 
UINT WINAPI MsiApplyMultiplePatchesA (LPCSTR szPatchPackages, LPCSTR szProductCode, LPCSTR szPropertiesList)
 
UINT WINAPI MsiApplyMultiplePatchesW (LPCWSTR szPatchPackages, LPCWSTR szProductCode, LPCWSTR szPropertiesList)
 
static void free_patchinfo (DWORD count, MSIPATCHSEQUENCEINFOW *info)
 
static MSIPATCHSEQUENCEINFOWpatchinfoAtoW (DWORD count, const MSIPATCHSEQUENCEINFOA *info)
 
UINT WINAPI MsiDetermineApplicablePatchesA (const char *szProductPackagePath, DWORD cPatchInfo, MSIPATCHSEQUENCEINFOA *pPatchInfo)
 
static UINT MSI_ApplicablePatchW (MSIPACKAGE *package, LPCWSTR patch)
 
static UINT MSI_ApplicablePatchXML (MSIPACKAGE *package, IXMLDOMDocument *desc)
 
static UINT determine_patch_sequence (MSIPACKAGE *package, DWORD count, MSIPATCHSEQUENCEINFOW *info)
 
UINT WINAPI MsiDetermineApplicablePatchesW (const WCHAR *szProductPackagePath, DWORD cPatchInfo, MSIPATCHSEQUENCEINFOW *pPatchInfo)
 
UINT WINAPI MsiDeterminePatchSequenceA (const char *product, const char *usersid, MSIINSTALLCONTEXT context, DWORD count, MSIPATCHSEQUENCEINFOA *patchinfo)
 
static UINT open_package (const WCHAR *product, const WCHAR *usersid, MSIINSTALLCONTEXT context, MSIPACKAGE **package)
 
UINT WINAPI MsiDeterminePatchSequenceW (const WCHAR *product, const WCHAR *usersid, MSIINSTALLCONTEXT context, DWORD count, MSIPATCHSEQUENCEINFOW *patchinfo)
 
UINT WINAPI MsiConfigureProductExW (LPCWSTR szProduct, int iInstallLevel, INSTALLSTATE eInstallState, LPCWSTR szCommandLine)
 
UINT WINAPI MsiConfigureProductExA (LPCSTR szProduct, int iInstallLevel, INSTALLSTATE eInstallState, LPCSTR szCommandLine)
 
UINT WINAPI MsiConfigureProductA (LPCSTR szProduct, int iInstallLevel, INSTALLSTATE eInstallState)
 
UINT WINAPI MsiConfigureProductW (LPCWSTR szProduct, int iInstallLevel, INSTALLSTATE eInstallState)
 
UINT WINAPI MsiGetProductCodeA (LPCSTR szComponent, LPSTR szBuffer)
 
UINT WINAPI MsiGetProductCodeW (LPCWSTR szComponent, LPWSTR szBuffer)
 
static WCHARreg_get_value (HKEY hkey, const WCHAR *name, DWORD *type)
 
static UINT MSI_GetProductInfo (LPCWSTR szProduct, LPCWSTR szAttribute, awstring *szValue, LPDWORD pcchValueBuf)
 
UINT WINAPI MsiGetProductInfoA (LPCSTR szProduct, LPCSTR szAttribute, LPSTR szBuffer, LPDWORD pcchValueBuf)
 
UINT WINAPI MsiGetProductInfoW (LPCWSTR szProduct, LPCWSTR szAttribute, LPWSTR szBuffer, LPDWORD pcchValueBuf)
 
UINT WINAPI MsiGetProductInfoExA (LPCSTR szProductCode, LPCSTR szUserSid, MSIINSTALLCONTEXT dwContext, LPCSTR szProperty, LPSTR szValue, LPDWORD pcchValue)
 
static UINT copy_outval (const WCHAR *val, WCHAR *out, DWORD *size)
 
UINT WINAPI MsiGetProductInfoExW (LPCWSTR szProductCode, LPCWSTR szUserSid, MSIINSTALLCONTEXT dwContext, LPCWSTR szProperty, LPWSTR szValue, LPDWORD pcchValue)
 
UINT WINAPI MsiGetPatchFileListA (LPCSTR szProductCode, LPCSTR szPatchList, LPDWORD pcFiles, MSIHANDLE **pphFileRecords)
 
UINT WINAPI MsiGetPatchFileListW (LPCWSTR szProductCode, LPCWSTR szPatchList, LPDWORD pcFiles, MSIHANDLE **pphFileRecords)
 
UINT WINAPI MsiGetPatchInfoExA (LPCSTR szPatchCode, LPCSTR szProductCode, LPCSTR szUserSid, MSIINSTALLCONTEXT dwContext, LPCSTR szProperty, LPSTR lpValue, DWORD *pcchValue)
 
UINT WINAPI MsiGetPatchInfoExW (LPCWSTR szPatchCode, LPCWSTR szProductCode, LPCWSTR szUserSid, MSIINSTALLCONTEXT dwContext, LPCWSTR szProperty, LPWSTR lpValue, DWORD *pcchValue)
 
UINT WINAPI MsiGetPatchInfoA (LPCSTR patch, LPCSTR attr, LPSTR buffer, LPDWORD buflen)
 
UINT WINAPI MsiGetPatchInfoW (LPCWSTR patch, LPCWSTR attr, LPWSTR buffer, LPDWORD buflen)
 
UINT WINAPI MsiEnableLogA (DWORD dwLogMode, const char *szLogFile, DWORD attributes)
 
UINT WINAPI MsiEnableLogW (DWORD dwLogMode, const WCHAR *szLogFile, DWORD attributes)
 
UINT WINAPI MsiEnumComponentCostsA (MSIHANDLE handle, const char *component, DWORD index, INSTALLSTATE state, char *drive, DWORD *buflen, int *cost, int *temp)
 
static UINT set_drive (WCHAR *buffer, WCHAR letter)
 
UINT WINAPI MsiEnumComponentCostsW (MSIHANDLE handle, const WCHAR *component, DWORD index, INSTALLSTATE state, WCHAR *drive, DWORD *buflen, int *cost, int *temp)
 
UINT WINAPI MsiQueryComponentStateA (LPCSTR szProductCode, LPCSTR szUserSid, MSIINSTALLCONTEXT dwContext, LPCSTR szComponent, INSTALLSTATE *pdwState)
 
static BOOL comp_find_prod_key (const WCHAR *prodcode, MSIINSTALLCONTEXT context)
 
static BOOL comp_find_package (const WCHAR *prodcode, MSIINSTALLCONTEXT context)
 
static UINT comp_find_prodcode (const WCHAR *squashed_pc, MSIINSTALLCONTEXT context, const WCHAR *comp, WCHAR *val, DWORD *sz)
 
UINT WINAPI MsiQueryComponentStateW (LPCWSTR szProductCode, LPCWSTR szUserSid, MSIINSTALLCONTEXT dwContext, LPCWSTR szComponent, INSTALLSTATE *pdwState)
 
INSTALLSTATE WINAPI MsiQueryProductStateA (LPCSTR szProduct)
 
INSTALLSTATE WINAPI MsiQueryProductStateW (LPCWSTR szProduct)
 
INSTALLUILEVEL WINAPI MsiSetInternalUI (INSTALLUILEVEL dwUILevel, HWND *phWnd)
 
INSTALLUI_HANDLERA WINAPI MsiSetExternalUIA (INSTALLUI_HANDLERA puiHandler, DWORD dwMessageFilter, void *pvContext)
 
INSTALLUI_HANDLERW WINAPI MsiSetExternalUIW (INSTALLUI_HANDLERW puiHandler, DWORD dwMessageFilter, void *pvContext)
 
LANGID WINAPI MsiLoadStringW (MSIHANDLE handle, UINT id, WCHAR *lpBuffer, int nBufferMax, LANGID lang)
 
LANGID WINAPI MsiLoadStringA (MSIHANDLE handle, UINT id, LPSTR lpBuffer, int nBufferMax, LANGID lang)
 
INSTALLSTATE WINAPI MsiLocateComponentA (LPCSTR szComponent, LPSTR lpPathBuf, LPDWORD pcchBuf)
 
INSTALLSTATE WINAPI MsiLocateComponentW (LPCWSTR szComponent, LPWSTR lpPathBuf, LPDWORD pcchBuf)
 
UINT WINAPI MsiMessageBoxA (HWND hWnd, const char *lpText, const char *lpCaption, UINT uType, WORD wLanguageId, DWORD f)
 
UINT WINAPI MsiMessageBoxW (HWND hWnd, const WCHAR *lpText, const WCHAR *lpCaption, UINT uType, WORD wLanguageId, DWORD f)
 
UINT WINAPI MsiMessageBoxExA (HWND hWnd, const char *lpText, const char *lpCaption, UINT uType, DWORD unknown, WORD wLanguageId, DWORD f)
 
UINT WINAPI MsiMessageBoxExW (HWND hWnd, const WCHAR *lpText, const WCHAR *lpCaption, UINT uType, DWORD unknown, WORD wLanguageId, DWORD f)
 
UINT WINAPI MsiProvideAssemblyA (const char *szAssemblyName, const char *szAppContext, DWORD dwInstallMode, DWORD dwAssemblyInfo, char *lpPathBuf, DWORD *pcchPathBuf)
 
UINT WINAPI MsiProvideAssemblyW (const WCHAR *szAssemblyName, const WCHAR *szAppContext, DWORD dwInstallMode, DWORD dwAssemblyInfo, WCHAR *lpPathBuf, DWORD *pcchPathBuf)
 
UINT WINAPI MsiProvideComponentFromDescriptorA (LPCSTR szDescriptor, LPSTR szPath, LPDWORD pcchPath, LPDWORD pcchArgs)
 
UINT WINAPI MsiProvideComponentFromDescriptorW (LPCWSTR szDescriptor, LPWSTR szPath, LPDWORD pcchPath, LPDWORD pcchArgs)
 
HRESULT WINAPI MsiGetFileSignatureInformationA (const char *path, DWORD flags, PCCERT_CONTEXT *cert, BYTE *hash, DWORD *hashlen)
 
HRESULT WINAPI MsiGetFileSignatureInformationW (const WCHAR *path, DWORD flags, PCCERT_CONTEXT *cert, BYTE *hash, DWORD *hashlen)
 
UINT WINAPI MsiGetProductPropertyA (MSIHANDLE hProduct, const char *szProperty, char *szValue, DWORD *pccbValue)
 
UINT WINAPI MsiGetProductPropertyW (MSIHANDLE hProduct, const WCHAR *szProperty, WCHAR *szValue, DWORD *pccbValue)
 
UINT WINAPI MsiVerifyPackageA (LPCSTR szPackage)
 
UINT WINAPI MsiVerifyPackageW (LPCWSTR szPackage)
 
static BOOL open_userdata_comp_key (const WCHAR *comp, const WCHAR *usersid, MSIINSTALLCONTEXT ctx, HKEY *hkey)
 
static INSTALLSTATE MSI_GetComponentPath (const WCHAR *szProduct, const WCHAR *szComponent, const WCHAR *szUserSid, MSIINSTALLCONTEXT ctx, awstring *lpPathBuf, DWORD *pcchBuf)
 
INSTALLSTATE WINAPI MsiGetComponentPathExW (LPCWSTR product, LPCWSTR comp, LPCWSTR usersid, MSIINSTALLCONTEXT ctx, LPWSTR buf, LPDWORD buflen)
 
INSTALLSTATE WINAPI MsiGetComponentPathExA (LPCSTR product, LPCSTR comp, LPCSTR usersid, MSIINSTALLCONTEXT ctx, LPSTR buf, LPDWORD buflen)
 
INSTALLSTATE WINAPI MsiGetComponentPathW (LPCWSTR product, LPCWSTR comp, LPWSTR buf, LPDWORD buflen)
 
INSTALLSTATE WINAPI MsiGetComponentPathA (LPCSTR product, LPCSTR comp, LPSTR buf, LPDWORD buflen)
 
static UINT query_feature_state (const WCHAR *product, const WCHAR *squashed, const WCHAR *usersid, MSIINSTALLCONTEXT ctx, const WCHAR *feature, INSTALLSTATE *state)
 
UINT WINAPI MsiQueryFeatureStateExA (LPCSTR product, LPCSTR usersid, MSIINSTALLCONTEXT ctx, LPCSTR feature, INSTALLSTATE *state)
 
UINT WINAPI MsiQueryFeatureStateExW (LPCWSTR product, LPCWSTR usersid, MSIINSTALLCONTEXT ctx, LPCWSTR feature, INSTALLSTATE *state)
 
INSTALLSTATE WINAPI MsiQueryFeatureStateA (LPCSTR szProduct, LPCSTR szFeature)
 
INSTALLSTATE WINAPI MsiQueryFeatureStateW (LPCWSTR szProduct, LPCWSTR szFeature)
 
UINT WINAPI MsiGetFileVersionA (LPCSTR szFilePath, LPSTR lpVersionBuf, LPDWORD pcchVersionBuf, LPSTR lpLangBuf, LPDWORD pcchLangBuf)
 
static UINT get_file_version (const WCHAR *path, WCHAR *verbuf, DWORD *verlen, WCHAR *langbuf, DWORD *langlen)
 
UINT WINAPI MsiGetFileVersionW (const WCHAR *path, WCHAR *verbuf, DWORD *verlen, WCHAR *langbuf, DWORD *langlen)
 
UINT WINAPI MsiGetFeatureUsageW (LPCWSTR szProduct, LPCWSTR szFeature, LPDWORD pdwUseCount, LPWORD pwDateUsed)
 
UINT WINAPI MsiGetFeatureUsageA (LPCSTR szProduct, LPCSTR szFeature, LPDWORD pdwUseCount, LPWORD pwDateUsed)
 
INSTALLSTATE WINAPI MsiUseFeatureExW (const WCHAR *szProduct, const WCHAR *szFeature, DWORD dwInstallMode, DWORD dwReserved)
 
INSTALLSTATE WINAPI MsiUseFeatureExA (const char *szProduct, const char *szFeature, DWORD dwInstallMode, DWORD dwReserved)
 
INSTALLSTATE WINAPI MsiUseFeatureW (LPCWSTR szProduct, LPCWSTR szFeature)
 
INSTALLSTATE WINAPI MsiUseFeatureA (LPCSTR szProduct, LPCSTR szFeature)
 
static WCHARreg_get_multisz (HKEY hkey, const WCHAR *name)
 
static WCHARreg_get_sz (HKEY hkey, const WCHAR *name)
 
static UINT MSI_ProvideQualifiedComponentEx (LPCWSTR szComponent, LPCWSTR szQualifier, DWORD dwInstallMode, LPCWSTR szProduct, DWORD Unused1, DWORD Unused2, awstring *lpPathBuf, LPDWORD pcchPathBuf)
 
UINT WINAPI MsiProvideQualifiedComponentExW (const WCHAR *szComponent, const WCHAR *szQualifier, DWORD dwInstallMode, const WCHAR *szProduct, DWORD Unused1, DWORD Unused2, WCHAR *lpPathBuf, DWORD *pcchPathBuf)
 
UINT WINAPI MsiProvideQualifiedComponentExA (const char *szComponent, const char *szQualifier, DWORD dwInstallMode, const char *szProduct, DWORD Unused1, DWORD Unused2, char *lpPathBuf, DWORD *pcchPathBuf)
 
UINT WINAPI MsiProvideQualifiedComponentW (LPCWSTR szComponent, LPCWSTR szQualifier, DWORD dwInstallMode, LPWSTR lpPathBuf, LPDWORD pcchPathBuf)
 
UINT WINAPI MsiProvideQualifiedComponentA (LPCSTR szComponent, LPCSTR szQualifier, DWORD dwInstallMode, LPSTR lpPathBuf, LPDWORD pcchPathBuf)
 
static USERINFOSTATE MSI_GetUserInfo (LPCWSTR szProduct, awstring *lpUserNameBuf, LPDWORD pcchUserNameBuf, awstring *lpOrgNameBuf, LPDWORD pcchOrgNameBuf, awstring *lpSerialBuf, LPDWORD pcchSerialBuf)
 
USERINFOSTATE WINAPI MsiGetUserInfoW (LPCWSTR szProduct, LPWSTR lpUserNameBuf, LPDWORD pcchUserNameBuf, LPWSTR lpOrgNameBuf, LPDWORD pcchOrgNameBuf, LPWSTR lpSerialBuf, LPDWORD pcchSerialBuf)
 
USERINFOSTATE WINAPI MsiGetUserInfoA (LPCSTR szProduct, LPSTR lpUserNameBuf, LPDWORD pcchUserNameBuf, LPSTR lpOrgNameBuf, LPDWORD pcchOrgNameBuf, LPSTR lpSerialBuf, LPDWORD pcchSerialBuf)
 
UINT WINAPI MsiCollectUserInfoW (LPCWSTR szProduct)
 
UINT WINAPI MsiCollectUserInfoA (LPCSTR szProduct)
 
UINT WINAPI MsiConfigureFeatureA (LPCSTR szProduct, LPCSTR szFeature, INSTALLSTATE eInstallState)
 
UINT WINAPI MsiConfigureFeatureW (LPCWSTR szProduct, LPCWSTR szFeature, INSTALLSTATE eInstallState)
 
UINT WINAPI MsiCreateAndVerifyInstallerDirectory (DWORD dwReserved)
 
UINT WINAPI MsiGetShortcutTargetA (LPCSTR szShortcutTarget, LPSTR szProductCode, LPSTR szFeatureId, LPSTR szComponentCode)
 
UINT WINAPI MsiGetShortcutTargetW (LPCWSTR szShortcutTarget, LPWSTR szProductCode, LPWSTR szFeatureId, LPWSTR szComponentCode)
 
UINT WINAPI MsiReinstallFeatureW (const WCHAR *szProduct, const WCHAR *szFeature, DWORD dwReinstallMode)
 
UINT WINAPI MsiReinstallFeatureA (const char *szProduct, const char *szFeature, DWORD dwReinstallMode)
 
void WINAPI MD5Init (struct md5_ctx *)
 
void WINAPI MD5Update (struct md5_ctx *, const unsigned char *, unsigned int)
 
void WINAPI MD5Final (struct md5_ctx *)
 
UINT msi_get_filehash (MSIPACKAGE *package, const WCHAR *path, MSIFILEHASHINFO *hash)
 
UINT WINAPI MsiGetFileHashW (const WCHAR *szFilePath, DWORD dwOptions, MSIFILEHASHINFO *pHash)
 
UINT WINAPI MsiGetFileHashA (const char *szFilePath, DWORD dwOptions, MSIFILEHASHINFO *pHash)
 
UINT WINAPI MsiAdvertiseScriptW (const WCHAR *szScriptFile, DWORD dwFlags, HKEY *phRegData, BOOL fRemoveItems)
 
UINT WINAPI MsiAdvertiseScriptA (const char *szScriptFile, DWORD dwFlags, HKEY *phRegData, BOOL fRemoveItems)
 
UINT WINAPI MsiIsProductElevatedW (LPCWSTR szProduct, BOOL *pfElevated)
 
UINT WINAPI MsiIsProductElevatedA (LPCSTR szProduct, BOOL *pfElevated)
 
UINT WINAPI MsiSetExternalUIRecord (INSTALLUI_HANDLER_RECORD handler, DWORD filter, void *context, INSTALLUI_HANDLER_RECORD *prev)
 
UINT WINAPI MsiInstallMissingComponentA (LPCSTR product, LPCSTR component, INSTALLSTATE state)
 
UINT WINAPI MsiInstallMissingComponentW (LPCWSTR szProduct, LPCWSTR szComponent, INSTALLSTATE eInstallState)
 
UINT WINAPI MsiProvideComponentA (const char *product, const char *feature, const char *component, DWORD mode, char *buf, DWORD *buflen)
 
UINT WINAPI MsiProvideComponentW (const WCHAR *product, const WCHAR *feature, const WCHAR *component, DWORD mode, WCHAR *buf, DWORD *buflen)
 
UINT WINAPI MsiBeginTransactionA (const char *name, DWORD attrs, MSIHANDLE *id, HANDLE *event)
 
UINT WINAPI MsiBeginTransactionW (const WCHAR *name, DWORD attrs, MSIHANDLE *id, HANDLE *event)
 
UINT WINAPI MsiJoinTransaction (MSIHANDLE handle, DWORD attrs, HANDLE *event)
 
UINT WINAPI MsiEndTransaction (DWORD state)
 
UINT WINAPI Migrate10CachedPackagesW (void *a, void *b, void *c, DWORD d)
 
UINT WINAPI MsiRemovePatchesA (LPCSTR patchlist, LPCSTR product, INSTALLTYPE type, LPCSTR propertylist)
 
UINT WINAPI MsiRemovePatchesW (LPCWSTR patchlist, LPCWSTR product, INSTALLTYPE type, LPCWSTR propertylist)
 

Variables

BOOL is_wow64
 

Macro Definition Documentation

◆ BASE85_SIZE

#define BASE85_SIZE   20

Definition at line 3362 of file msi.c.

◆ COBJMACROS

#define COBJMACROS

Definition at line 23 of file msi.c.

Function Documentation

◆ comp_find_package()

static BOOL comp_find_package ( const WCHAR prodcode,
MSIINSTALLCONTEXT  context 
)
static

Definition at line 2093 of file msi.c.

2094{
2095 LPCWSTR package;
2096 HKEY hkey;
2097 DWORD sz;
2098 LONG res;
2099 UINT r;
2100
2101 r = MSIREG_OpenInstallProps(prodcode, context, NULL, &hkey, FALSE);
2102 if (r != ERROR_SUCCESS)
2103 return FALSE;
2104
2106 package = L"ManagedLocalPackage";
2107 else
2108 package = L"LocalPackage";
2109
2110 sz = 0;
2111 res = RegQueryValueExW(hkey, package, NULL, NULL, NULL, &sz);
2112 RegCloseKey(hkey);
2113
2114 return (res == ERROR_SUCCESS);
2115}
#define RegCloseKey(hKey)
Definition: registry.h:49
#define ERROR_SUCCESS
Definition: deptool.c:10
#define NULL
Definition: types.h:112
#define FALSE
Definition: types.h:117
LONG WINAPI RegQueryValueExW(_In_ HKEY hkeyorg, _In_ LPCWSTR name, _In_ LPDWORD reserved, _In_ LPDWORD type, _In_ LPBYTE data, _In_ LPDWORD count)
Definition: reg.c:4103
unsigned long DWORD
Definition: ntddk_ex.h:95
GLdouble GLdouble GLdouble r
Definition: gl.h:2055
GLuint res
Definition: glext.h:9613
@ MSIINSTALLCONTEXT_USERMANAGED
Definition: msi.h:198
UINT MSIREG_OpenInstallProps(LPCWSTR szProduct, MSIINSTALLCONTEXT dwContext, LPCWSTR szUserSid, HKEY *key, BOOL create)
Definition: registry.c:692
unsigned int UINT
Definition: ndis.h:50
long LONG
Definition: pedump.c:60
Definition: http.c:7252
const WCHAR * LPCWSTR
Definition: xmlstorage.h:185

Referenced by MsiQueryComponentStateW().

◆ comp_find_prod_key()

static BOOL comp_find_prod_key ( const WCHAR prodcode,
MSIINSTALLCONTEXT  context 
)
static

Definition at line 2083 of file msi.c.

2084{
2085 UINT r;
2086 HKEY hkey = NULL;
2087
2088 r = MSIREG_OpenProductKey(prodcode, NULL, context, &hkey, FALSE);
2089 RegCloseKey(hkey);
2090 return (r == ERROR_SUCCESS);
2091}
UINT MSIREG_OpenProductKey(LPCWSTR szProduct, LPCWSTR szUserSid, MSIINSTALLCONTEXT context, HKEY *key, BOOL create)
Definition: registry.c:338

Referenced by MsiQueryComponentStateW().

◆ comp_find_prodcode()

static UINT comp_find_prodcode ( const WCHAR squashed_pc,
MSIINSTALLCONTEXT  context,
const WCHAR comp,
WCHAR val,
DWORD sz 
)
static

Definition at line 2117 of file msi.c.

2119{
2120 HKEY hkey;
2121 LONG res;
2122 UINT r;
2123
2125 r = MSIREG_OpenUserDataComponentKey(comp, L"S-1-5-18", &hkey, FALSE);
2126 else
2128
2129 if (r != ERROR_SUCCESS)
2130 return r;
2131
2132 res = RegQueryValueExW( hkey, squashed_pc, NULL, NULL, (BYTE *)val, sz );
2133 if (res != ERROR_SUCCESS)
2134 return res;
2135
2136 RegCloseKey(hkey);
2137 return res;
2138}
GLuint GLfloat * val
Definition: glext.h:7180
@ MSIINSTALLCONTEXT_MACHINE
Definition: msi.h:200
UINT MSIREG_OpenUserDataComponentKey(LPCWSTR szComponent, LPCWSTR szUserSid, HKEY *key, BOOL create)
Definition: registry.c:526
#define L(x)
Definition: ntvdm.h:50
unsigned char BYTE
Definition: xxhash.c:193

Referenced by MsiQueryComponentStateW().

◆ copy_outval()

static UINT copy_outval ( const WCHAR val,
WCHAR out,
DWORD size 
)
static

Definition at line 1366 of file msi.c.

1367{
1369
1370 if (!val)
1372
1373 if (out)
1374 {
1375 if (lstrlenW(val) >= *size)
1376 {
1378 if (*size > 0)
1379 *out = '\0';
1380 }
1381 else
1382 lstrcpyW(out, val);
1383 }
1384
1385 if (size)
1386 *size = lstrlenW(val);
1387
1388 return r;
1389}
#define ERROR_MORE_DATA
Definition: dderror.h:13
#define lstrcpyW
Definition: compat.h:749
#define lstrlenW
Definition: compat.h:750
GLsizeiptr size
Definition: glext.h:5919
static FILE * out
Definition: regtests2xml.c:44
#define ERROR_UNKNOWN_PROPERTY
Definition: winerror.h:966

Referenced by MsiGetProductInfoExW().

◆ determine_patch_sequence()

static UINT determine_patch_sequence ( MSIPACKAGE package,
DWORD  count,
MSIPATCHSEQUENCEINFOW info 
)
static

Definition at line 631 of file msi.c.

632{
634 DWORD i;
635
636 if (count > 1)
637 FIXME("patch ordering not supported\n");
638
639 for (i = 0; i < count; i++)
640 {
641 switch (info[i].ePatchDataType)
642 {
644 {
645 if (MSI_ApplicablePatchW( package, info[i].szPatchData ) != ERROR_SUCCESS)
646 {
647 info[i].dwOrder = ~0u;
649 }
650 else
651 {
652 info[i].dwOrder = i;
653 info[i].uStatus = ERROR_SUCCESS;
654 }
655 break;
656 }
659 {
661 HRESULT hr;
662 BSTR s;
663
664 if (!desc)
665 {
666 hr = CoCreateInstance( &CLSID_DOMDocument30, NULL, CLSCTX_INPROC_SERVER,
667 &IID_IXMLDOMDocument, (void**)&desc );
668 if (hr != S_OK)
669 {
670 ERR( "failed to create DOMDocument30 instance, %#lx\n", hr );
672 }
673 }
674
675 s = SysAllocString( info[i].szPatchData );
676 if (info[i].ePatchDataType == MSIPATCH_DATATYPE_XMLPATH)
677 {
678 VARIANT src;
679
680 V_VT(&src) = VT_BSTR;
681 V_BSTR(&src) = s;
682 hr = IXMLDOMDocument_load( desc, src, &b );
683 }
684 else
685 hr = IXMLDOMDocument_loadXML( desc, s, &b );
686 SysFreeString( s );
687 if ( hr != S_OK )
688 {
689 ERR("failed to parse patch description\n");
690 IXMLDOMDocument_Release( desc );
691 break;
692 }
693
694 if (MSI_ApplicablePatchXML( package, desc ) != ERROR_SUCCESS)
695 {
696 info[i].dwOrder = ~0u;
698 }
699 else
700 {
701 info[i].dwOrder = i;
702 info[i].uStatus = ERROR_SUCCESS;
703 }
704 break;
705 }
706 default:
707 {
708 FIXME("unknown patch data type %u\n", info[i].ePatchDataType);
709 info[i].dwOrder = i;
710 info[i].uStatus = ERROR_SUCCESS;
711 break;
712 }
713 }
714
715 TRACE("szPatchData: %s\n", debugstr_w(info[i].szPatchData));
716 TRACE("ePatchDataType: %u\n", info[i].ePatchDataType);
717 TRACE("dwOrder: %lu\n", info[i].dwOrder);
718 TRACE("uStatus: %u\n", info[i].uStatus);
719 }
720
721 if (desc) IXMLDOMDocument_Release( desc );
722
723 return ERROR_SUCCESS;
724}
#define FIXME(fmt,...)
Definition: precomp.h:53
#define ERR(fmt,...)
Definition: precomp.h:57
OLECHAR * BSTR
Definition: compat.h:2293
short VARIANT_BOOL
Definition: compat.h:2290
@ VT_BSTR
Definition: compat.h:2303
static UINT MSI_ApplicablePatchXML(MSIPACKAGE *package, IXMLDOMDocument *desc)
Definition: msi.c:589
static UINT MSI_ApplicablePatchW(MSIPACKAGE *package, LPCWSTR patch)
Definition: msi.c:559
HRESULT WINAPI DECLSPEC_HOTPATCH CoCreateInstance(REFCLSID rclsid, LPUNKNOWN pUnkOuter, DWORD dwClsContext, REFIID iid, LPVOID *ppv)
Definition: compobj.c:3325
GLdouble s
Definition: gl.h:2039
GLuint GLuint GLsizei count
Definition: gl.h:1545
GLenum src
Definition: glext.h:6340
GLboolean GLboolean GLboolean b
Definition: glext.h:6204
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble * u
Definition: glfuncs.h:240
#define S_OK
Definition: intsafe.h:52
#define b
Definition: ke_i.h:79
#define debugstr_w
Definition: kernel32.h:32
static const WCHAR desc[]
Definition: protectdata.c:36
@ MSIPATCH_DATATYPE_XMLPATH
Definition: msi.h:237
@ MSIPATCH_DATATYPE_PATCHFILE
Definition: msi.h:236
@ MSIPATCH_DATATYPE_XMLBLOB
Definition: msi.h:238
#define ERROR_PATCH_TARGET_NOT_FOUND
Definition: msi.h:259
BSTR WINAPI SysAllocString(LPCOLESTR str)
Definition: oleaut.c:238
void WINAPI DECLSPEC_HOTPATCH SysFreeString(BSTR str)
Definition: oleaut.c:271
#define V_VT(A)
Definition: oleauto.h:211
#define V_BSTR(A)
Definition: oleauto.h:226
HRESULT hr
Definition: shlfolder.c:183
#define TRACE(s)
Definition: solgame.cpp:4
#define ERROR_FUNCTION_FAILED
Definition: winerror.h:985

Referenced by MsiDetermineApplicablePatchesW(), and MsiDeterminePatchSequenceW().

◆ free_patchinfo()

static void free_patchinfo ( DWORD  count,
MSIPATCHSEQUENCEINFOW info 
)
static

Definition at line 501 of file msi.c.

502{
503 DWORD i;
504 for (i = 0; i < count; i++) free( (WCHAR *)info[i].szPatchData );
505 free( info );
506}
#define free
Definition: debug_ros.c:5
__wchar_t WCHAR
Definition: xmlstorage.h:180

Referenced by MsiDetermineApplicablePatchesA(), MsiDeterminePatchSequenceA(), and patchinfoAtoW().

◆ get_file_version()

static UINT get_file_version ( const WCHAR path,
WCHAR verbuf,
DWORD verlen,
WCHAR langbuf,
DWORD langlen 
)
static

Definition at line 3137 of file msi.c.

3139{
3141 UINT len;
3142 DWORD error;
3144 VS_FIXEDFILEINFO *ffi;
3145 USHORT *lang;
3146 WCHAR tmp[32];
3147
3148 if (!(len = GetFileVersionInfoSizeW( path, NULL )))
3149 {
3150 error = GetLastError();
3153 return error;
3154 }
3155 if (!(version = malloc( len ))) return ERROR_OUTOFMEMORY;
3156 if (!GetFileVersionInfoW( path, 0, len, version ))
3157 {
3158 free( version );
3159 return GetLastError();
3160 }
3161 if (!verbuf && !verlen && !langbuf && !langlen)
3162 {
3163 free( version );
3164 return ERROR_SUCCESS;
3165 }
3166 if (verlen)
3167 {
3168 if (VerQueryValueW( version, L"\\", (LPVOID *)&ffi, &len ) && len > 0)
3169 {
3170 swprintf( tmp, ARRAY_SIZE(tmp), L"%d.%d.%d.%d",
3171 HIWORD(ffi->dwFileVersionMS), LOWORD(ffi->dwFileVersionMS),
3172 HIWORD(ffi->dwFileVersionLS), LOWORD(ffi->dwFileVersionLS) );
3173 if (verbuf) lstrcpynW( verbuf, tmp, *verlen );
3174 len = lstrlenW( tmp );
3175 if (*verlen > len) ret = ERROR_SUCCESS;
3176 *verlen = len;
3177 }
3178 else
3179 {
3180 if (verbuf) *verbuf = 0;
3181 *verlen = 0;
3182 }
3183 }
3184 if (langlen)
3185 {
3186 if (VerQueryValueW( version, L"\\VarFileInfo\\Translation", (LPVOID *)&lang, &len ) && len > 0)
3187 {
3188 swprintf( tmp, ARRAY_SIZE(tmp), L"%d", *lang );
3189 if (langbuf) lstrcpynW( langbuf, tmp, *langlen );
3190 len = lstrlenW( tmp );
3191 if (*langlen > len) ret = ERROR_SUCCESS;
3192 *langlen = len;
3193 }
3194 else
3195 {
3196 if (langbuf) *langbuf = 0;
3197 *langlen = 0;
3198 }
3199 }
3200 free( version );
3201 return ret;
3202}
#define ARRAY_SIZE(A)
Definition: main.h:20
#define malloc
Definition: debug_ros.c:4
#define ERROR_OUTOFMEMORY
Definition: deptool.c:13
#define lstrcpynW
Definition: compat.h:738
static const WCHAR version[]
Definition: asmname.c:66
BOOL WINAPI GetFileVersionInfoW(LPCWSTR filename, DWORD handle, DWORD datasize, LPVOID data)
Definition: version.c:845
BOOL WINAPI VerQueryValueW(LPCVOID pBlock, LPCWSTR lpSubBlock, LPVOID *lplpBuffer, PUINT puLen)
Definition: version.c:1057
DWORD WINAPI GetFileVersionInfoSizeW(LPCWSTR filename, LPDWORD handle)
Definition: version.c:611
#define swprintf
Definition: precomp.h:40
GLenum GLsizei len
Definition: glext.h:6722
#define error(str)
Definition: mkdosfs.c:1605
#define ERROR_FILE_NOT_FOUND
Definition: disk.h:79
#define LOWORD(l)
Definition: pedump.c:82
unsigned short USHORT
Definition: pedump.c:61
#define HIWORD(l)
Definition: typedefs.h:247
static const WCHAR lang[]
Definition: wbemdisp.c:287
int ret
DWORD WINAPI GetLastError(void)
Definition: except.c:1042
#define ERROR_BAD_PATHNAME
Definition: winerror.h:233
#define ERROR_FILE_INVALID
Definition: winerror.h:585
#define ERROR_RESOURCE_DATA_NOT_FOUND
Definition: winerror.h:1119

Referenced by MsiGetFileVersionW().

◆ get_patch_product_codes()

static UINT get_patch_product_codes ( LPCWSTR  szPatchPackage,
WCHAR ***  product_codes 
)
static

Definition at line 316 of file msi.c.

317{
318 MSIHANDLE patch, info = 0;
319 UINT r, type;
320 DWORD size;
321 static WCHAR empty[] = L"";
322 WCHAR *codes = NULL;
323
324 r = MsiOpenDatabaseW( szPatchPackage, MSIDBOPEN_READONLY, &patch );
325 if (r != ERROR_SUCCESS)
326 return r;
327
328 r = MsiGetSummaryInformationW( patch, NULL, 0, &info );
329 if (r != ERROR_SUCCESS)
330 goto done;
331
332 size = 0;
334 if (r != ERROR_MORE_DATA || !size || type != VT_LPSTR)
335 {
336 ERR("Failed to read product codes from patch\n");
338 goto done;
339 }
340
341 codes = malloc( ++size * sizeof(WCHAR) );
342 if (!codes)
343 {
345 goto done;
346 }
347
349 if (r == ERROR_SUCCESS)
350 *product_codes = msi_split_string( codes, ';' );
351
352done:
354 MsiCloseHandle( patch );
355 free( codes );
356 return r;
357}
static const WCHAR empty[]
Definition: main.c:47
@ VT_LPSTR
Definition: compat.h:2324
WCHAR ** msi_split_string(const WCHAR *str, WCHAR sep)
Definition: action.c:304
UINT WINAPI MsiOpenDatabaseW(LPCWSTR szDBPath, LPCWSTR szPersist, MSIHANDLE *phDB)
Definition: database.c:298
UINT WINAPI MsiCloseHandle(MSIHANDLE handle)
Definition: handle.c:269
UINT WINAPI MsiGetSummaryInformationW(MSIHANDLE hDatabase, const WCHAR *szDatabase, UINT uiUpdateCount, MSIHANDLE *pHandle)
Definition: suminfo.c:519
UINT WINAPI MsiSummaryInfoGetPropertyW(MSIHANDLE handle, UINT uiProperty, UINT *puiDataType, INT *piValue, FILETIME *pftValue, WCHAR *szValueBuf, DWORD *pcchValueBuf)
Definition: suminfo.c:793
GLuint GLuint GLsizei GLenum type
Definition: gl.h:1545
#define PID_TEMPLATE
Definition: suminfo.c:49
#define MSIDBOPEN_READONLY
Definition: msiquery.h:66
unsigned long MSIHANDLE
Definition: winemsi.idl:27

Referenced by MSI_ApplyPatchW().

◆ MD5Final()

◆ MD5Init()

◆ MD5Update()

◆ Migrate10CachedPackagesW()

UINT WINAPI Migrate10CachedPackagesW ( void a,
void b,
void c,
DWORD  d 
)

Definition at line 4340 of file msi.c.

4341{
4342 FIXME( "%p, %p, %p, %#lx\n", a, b, c, d );
4343 return ERROR_SUCCESS;
4344}
const GLubyte * c
Definition: glext.h:8905
GLboolean GLboolean GLboolean GLboolean a
Definition: glext.h:6204
#define d
Definition: ke_i.h:81

◆ MSI_ApplicablePatchW()

static UINT MSI_ApplicablePatchW ( MSIPACKAGE package,
LPCWSTR  patch 
)
static

Definition at line 559 of file msi.c.

560{
561 MSISUMMARYINFO *si;
562 MSIDATABASE *patch_db;
563 UINT r;
564
565 r = MSI_OpenDatabaseW( patch, MSIDBOPEN_READONLY, &patch_db );
566 if (r != ERROR_SUCCESS)
567 {
568 WARN("failed to open patch file %s\n", debugstr_w(patch));
569 return r;
570 }
571
572 r = msi_get_suminfo( patch_db->storage, 0, &si );
573 if (r != ERROR_SUCCESS)
574 {
575 msiobj_release( &patch_db->hdr );
577 }
578
579 r = msi_check_patch_applicable( package, si );
580 if (r != ERROR_SUCCESS)
581 TRACE("patch not applicable\n");
582
583 msiobj_release( &patch_db->hdr );
584 msiobj_release( &si->hdr );
585 return r;
586}
#define WARN(fmt,...)
Definition: precomp.h:61
UINT MSI_OpenDatabaseW(LPCWSTR szDBPath, LPCWSTR szPersist, MSIDATABASE **pdb)
Definition: database.c:140
int msiobj_release(MSIOBJECTHDR *info)
Definition: handle.c:241
UINT msi_check_patch_applicable(MSIPACKAGE *package, MSISUMMARYINFO *si)
Definition: patch.c:294
UINT msi_get_suminfo(IStorage *stg, UINT uiUpdateCount, MSISUMMARYINFO **si)
Definition: suminfo.c:462
MSIOBJECTHDR hdr
Definition: msipriv.h:108
IStorage * storage
Definition: msipriv.h:109
MSIOBJECTHDR hdr
Definition: msipriv.h:486

Referenced by determine_patch_sequence().

◆ MSI_ApplicablePatchXML()

static UINT MSI_ApplicablePatchXML ( MSIPACKAGE package,
IXMLDOMDocument desc 
)
static

Definition at line 589 of file msi.c.

590{
593 LPWSTR product_code;
595 HRESULT hr;
596 BSTR s;
597
598 product_code = msi_dup_property( package->db, L"ProductCode" );
599 if (!product_code)
600 {
601 /* FIXME: the property ProductCode should be written into the DB somewhere */
602 ERR("no product code to check\n");
603 return ERROR_SUCCESS;
604 }
605
606 s = SysAllocString( L"MsiPatch/TargetProduct/TargetProductCode" );
607 hr = IXMLDOMDocument_selectNodes( desc, s, &list );
609 if (hr != S_OK)
611
612 while (IXMLDOMNodeList_nextNode( list, &node ) == S_OK && r != ERROR_SUCCESS)
613 {
614 hr = IXMLDOMNode_get_text( node, &s );
615 IXMLDOMNode_Release( node );
616 if (hr == S_OK)
617 {
618 if (!wcscmp( s, product_code )) r = ERROR_SUCCESS;
619 SysFreeString( s );
620 }
621 }
622 IXMLDOMNodeList_Release( list );
623
624 if (r != ERROR_SUCCESS)
625 TRACE("patch not applicable\n");
626
627 free( product_code );
628 return r;
629}
Definition: list.h:37
WCHAR * msi_dup_property(MSIDATABASE *db, const WCHAR *prop)
#define list
Definition: rosglue.h:35
_Check_return_ _CRTIMP int __cdecl wcscmp(_In_z_ const wchar_t *_Str1, _In_z_ const wchar_t *_Str2)
MSIDATABASE * db
Definition: msipriv.h:394
Definition: dlist.c:348
#define ERROR_INVALID_PATCH_XML
Definition: winerror.h:1008
WCHAR * LPWSTR
Definition: xmlstorage.h:184

Referenced by determine_patch_sequence().

◆ MSI_ApplyPatchW()

static UINT MSI_ApplyPatchW ( LPCWSTR  szPatchPackage,
LPCWSTR  szProductCode,
LPCWSTR  szCommandLine 
)
static

Definition at line 359 of file msi.c.

360{
362 DWORD size;
363 LPCWSTR cmd_ptr = szCommandLine;
364 LPWSTR cmd, *codes = NULL;
365 BOOL succeeded = FALSE;
366
367 if (!szPatchPackage || !szPatchPackage[0])
369
370 if (!szProductCode && (r = get_patch_product_codes( szPatchPackage, &codes )))
371 return r;
372
373 if (!szCommandLine)
374 cmd_ptr = L"";
375
376 size = lstrlenW(cmd_ptr) + lstrlenW(L"%s PATCH=\"%s\"") + lstrlenW(szPatchPackage) + 1;
377 cmd = malloc(size * sizeof(WCHAR));
378 if (!cmd)
379 {
380 free(codes);
381 return ERROR_OUTOFMEMORY;
382 }
383 swprintf(cmd, size, L"%s PATCH=\"%s\"", cmd_ptr, szPatchPackage);
384
385 if (szProductCode)
387 else
388 {
389 for (i = 0; codes[i]; i++)
390 {
392 if (r == ERROR_SUCCESS)
393 {
394 TRACE("patch applied\n");
395 succeeded = TRUE;
396 }
397 }
398
399 if (succeeded)
401 }
402
403 free(cmd);
404 free(codes);
405 return r;
406}
#define TRUE
Definition: types.h:120
#define ERROR_INVALID_PARAMETER
Definition: compat.h:101
UINT WINAPI MsiConfigureProductExW(LPCWSTR szProduct, int iInstallLevel, INSTALLSTATE eInstallState, LPCWSTR szCommandLine)
Definition: msi.c:831
static UINT get_patch_product_codes(LPCWSTR szPatchPackage, WCHAR ***product_codes)
Definition: msi.c:316
unsigned int BOOL
Definition: ntddk_ex.h:94
@ INSTALLSTATE_DEFAULT
Definition: msi.h:48
@ INSTALLLEVEL_DEFAULT
Definition: msi.h:87
Definition: ftp_var.h:139

Referenced by MsiApplyMultiplePatchesW(), and MsiApplyPatchW().

◆ msi_get_filehash()

UINT msi_get_filehash ( MSIPACKAGE package,
const WCHAR path,
MSIFILEHASHINFO hash 
)

Definition at line 4018 of file msi.c.

4019{
4021 void *p;
4022 DWORD length;
4024
4025 if (package)
4027 else
4030 {
4031 WARN( "can't open file %lu\n", GetLastError() );
4032 return ERROR_FILE_NOT_FOUND;
4033 }
4034 if ((length = GetFileSize( handle, NULL )))
4035 {
4037 {
4038 if ((p = MapViewOfFile( mapping, FILE_MAP_READ, 0, 0, length )))
4039 {
4040 struct md5_ctx ctx;
4041
4042 MD5Init( &ctx );
4043 MD5Update( &ctx, p, length );
4044 MD5Final( &ctx );
4045 UnmapViewOfFile( p );
4046
4047 memcpy( hash->dwData, ctx.digest, sizeof(hash->dwData) );
4048 r = ERROR_SUCCESS;
4049 }
4051 }
4052 }
4053 else
4054 {
4055 /* Empty file -> set hash to 0 */
4056 memset( hash->dwData, 0, sizeof(hash->dwData) );
4057 r = ERROR_SUCCESS;
4058 }
4059
4061 return r;
4062}
#define CloseHandle
Definition: compat.h:739
#define PAGE_READONLY
Definition: compat.h:138
#define UnmapViewOfFile
Definition: compat.h:746
#define OPEN_EXISTING
Definition: compat.h:775
#define INVALID_HANDLE_VALUE
Definition: compat.h:731
#define CreateFileMappingW(a, b, c, d, e, f)
Definition: compat.h:744
#define GENERIC_READ
Definition: compat.h:135
#define CreateFileW
Definition: compat.h:741
#define FILE_MAP_READ
Definition: compat.h:776
#define MapViewOfFile
Definition: compat.h:745
#define FILE_SHARE_READ
Definition: compat.h:136
DWORD WINAPI GetFileSize(HANDLE hFile, LPDWORD lpFileSizeHigh)
Definition: fileinfo.c:331
HANDLE msi_create_file(MSIPACKAGE *package, const WCHAR *filename, DWORD access, DWORD sharing, DWORD creation, DWORD flags)
Definition: files.c:60
void WINAPI MD5Update(struct md5_ctx *, const unsigned char *, unsigned int)
void WINAPI MD5Init(struct md5_ctx *)
void WINAPI MD5Final(struct md5_ctx *)
GLuint GLsizei GLsizei * length
Definition: glext.h:6040
GLenum GLenum GLenum GLenum mapping
Definition: glext.h:9031
GLfloat GLfloat p
Definition: glext.h:8902
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
#define FILE_SHARE_DELETE
Definition: nt_native.h:682
#define memset(x, y, z)
Definition: compat.h:39
Definition: _hash_fun.h:40
Definition: msi.c:4007

Referenced by file_hash_matches(), and MsiGetFileHashW().

◆ MSI_GetComponentPath()

static INSTALLSTATE MSI_GetComponentPath ( const WCHAR szProduct,
const WCHAR szComponent,
const WCHAR szUserSid,
MSIINSTALLCONTEXT  ctx,
awstring lpPathBuf,
DWORD pcchBuf 
)
static

Definition at line 2771 of file msi.c.

2774{
2775 WCHAR *path = NULL, squashed_pc[SQUASHED_GUID_SIZE], squashed_comp[SQUASHED_GUID_SIZE];
2776 HKEY hkey;
2778 DWORD version;
2779
2780 if (!szProduct || !szComponent)
2782
2783 if (lpPathBuf->str.w && !pcchBuf)
2785
2786 if (!squash_guid( szProduct, squashed_pc ) || !squash_guid( szComponent, squashed_comp ))
2788
2789 if (szUserSid && ctx == MSIINSTALLCONTEXT_MACHINE)
2791
2793
2794 if (open_userdata_comp_key( szComponent, szUserSid, ctx, &hkey ))
2795 {
2796 path = msi_reg_get_val_str( hkey, squashed_pc );
2797 RegCloseKey(hkey);
2798
2800
2801 if ((!MSIREG_OpenInstallProps(szProduct, MSIINSTALLCONTEXT_MACHINE, NULL, &hkey, FALSE) ||
2803 msi_reg_get_val_dword(hkey, L"WindowsInstaller", &version) &&
2805 {
2806 RegCloseKey(hkey);
2808 }
2809 }
2810
2811 if (state != INSTALLSTATE_LOCAL &&
2814 {
2815 RegCloseKey(hkey);
2816
2817 if (open_userdata_comp_key( szComponent, szUserSid, ctx, &hkey ))
2818 {
2819 free(path);
2820 path = msi_reg_get_val_str( hkey, squashed_pc );
2821 RegCloseKey(hkey);
2822
2824
2827 }
2828 }
2829
2830 if (!path)
2831 return INSTALLSTATE_UNKNOWN;
2832
2833 if (state == INSTALLSTATE_LOCAL && !*path)
2835
2836 if (msi_strcpy_to_awstring(path, -1, lpPathBuf, pcchBuf) == ERROR_MORE_DATA)
2838
2839 free(path);
2840 return state;
2841}
static int state
Definition: maze.c:121
DWORD WINAPI GetFileAttributesW(LPCWSTR lpFileName)
Definition: fileinfo.c:652
UINT msi_strcpy_to_awstring(const WCHAR *str, int len, awstring *awbuf, DWORD *sz)
Definition: install.c:158
static BOOL open_userdata_comp_key(const WCHAR *comp, const WCHAR *usersid, MSIINSTALLCONTEXT ctx, HKEY *hkey)
Definition: msi.c:2752
@ INSTALLSTATE_UNKNOWN
Definition: msi.h:42
@ INSTALLSTATE_LOCAL
Definition: msi.h:46
@ INSTALLSTATE_ABSENT
Definition: msi.h:45
@ INSTALLSTATE_NOTUSED
Definition: msi.h:36
@ INSTALLSTATE_INVALIDARG
Definition: msi.h:41
@ INSTALLSTATE_MOREDATA
Definition: msi.h:40
@ MSIINSTALLCONTEXT_USERUNMANAGED
Definition: msi.h:199
BOOL squash_guid(LPCWSTR in, LPWSTR out)
Definition: registry.c:74
BOOL msi_reg_get_val_dword(HKEY hkey, LPCWSTR name, DWORD *val)
Definition: registry.c:262
UINT MSIREG_OpenUserDataProductKey(LPCWSTR szProduct, MSIINSTALLCONTEXT dwContext, LPCWSTR szUserSid, HKEY *key, BOOL create)
Definition: registry.c:582
WCHAR * msi_reg_get_val_str(HKEY hkey, const WCHAR *name)
#define SQUASHED_GUID_SIZE
Definition: msipriv.h:734
LPWSTR w
Definition: msipriv.h:743
union awstring::@502 str
#define INVALID_FILE_ATTRIBUTES
Definition: vfdcmd.c:23
int INSTALLSTATE
Definition: winemsi.idl:31

Referenced by MSI_ProvideQualifiedComponentEx(), MsiGetComponentPathExA(), and MsiGetComponentPathExW().

◆ MSI_GetProductInfo()

static UINT MSI_GetProductInfo ( LPCWSTR  szProduct,
LPCWSTR  szAttribute,
awstring szValue,
LPDWORD  pcchValueBuf 
)
static

Definition at line 1088 of file msi.c.

1090{
1091 static WCHAR empty[] = L"";
1094 HKEY prodkey, userdata, source;
1095 WCHAR *val = NULL, squashed_pc[SQUASHED_GUID_SIZE], packagecode[GUID_SIZE];
1096 BOOL badconfig = FALSE;
1097 LONG res;
1099
1100 TRACE("%s %s %p %p\n", debugstr_w(szProduct),
1101 debugstr_w(szAttribute), szValue, pcchValueBuf);
1102
1103 if ((szValue->str.w && !pcchValueBuf) || !szProduct || !szAttribute)
1105
1106 if (!squash_guid( szProduct, squashed_pc ))
1108
1109 if ((r = MSIREG_OpenProductKey(szProduct, NULL,
1111 &prodkey, FALSE)) != ERROR_SUCCESS &&
1112 (r = MSIREG_OpenProductKey(szProduct, NULL,
1114 &prodkey, FALSE)) != ERROR_SUCCESS &&
1115 (r = MSIREG_OpenProductKey(szProduct, NULL,
1117 &prodkey, FALSE)) == ERROR_SUCCESS)
1118 {
1120 }
1121
1138 {
1139 if (!prodkey)
1140 {
1142 goto done;
1143 }
1144 if (MSIREG_OpenInstallProps(szProduct, context, NULL, &userdata, FALSE))
1145 {
1147 goto done;
1148 }
1149
1151 szAttribute = L"DisplayName";
1153 szAttribute = L"DisplayVersion";
1154
1155 val = reg_get_value(userdata, szAttribute, &type);
1156 if (!val)
1157 val = empty;
1158 RegCloseKey(userdata);
1159 }
1170 {
1171 if (!prodkey)
1172 {
1174 goto done;
1175 }
1176
1178 szAttribute = L"Assignment";
1179
1181 {
1182 res = RegOpenKeyW(prodkey, L"SourceList", &source);
1183 if (res != ERROR_SUCCESS)
1184 {
1186 goto done;
1187 }
1188
1190 if (!val)
1191 val = empty;
1192
1194 }
1195 else
1196 {
1197 val = reg_get_value(prodkey, szAttribute, &type);
1198 if (!val)
1199 val = empty;
1200 }
1201
1202 if (val != empty && type != REG_DWORD &&
1204 {
1205 if (lstrlenW( val ) != SQUASHED_GUID_SIZE - 1)
1206 badconfig = TRUE;
1207 else
1208 {
1209 unsquash_guid(val, packagecode);
1210 free(val);
1211 val = wcsdup(packagecode);
1212 }
1213 }
1214 }
1215
1216 if (!val)
1217 {
1219 goto done;
1220 }
1221
1222 if (pcchValueBuf)
1223 {
1224 int len = lstrlenW( val );
1225
1226 /* If szBuffer (szValue->str) is NULL, there's no need to copy the value
1227 * out. Also, *pcchValueBuf may be uninitialized in this case, so we
1228 * can't rely on its value.
1229 */
1230 if (szValue->str.a || szValue->str.w)
1231 {
1232 DWORD size = *pcchValueBuf;
1233 if (len < size)
1234 r = msi_strcpy_to_awstring( val, len, szValue, &size );
1235 else
1237 }
1238
1239 if (!badconfig)
1240 *pcchValueBuf = len;
1241 }
1242
1243 if (badconfig)
1245
1246 if (val != empty)
1247 free(val);
1248
1249done:
1250 RegCloseKey(prodkey);
1251 return r;
1252}
LONG WINAPI RegOpenKeyW(HKEY hKey, LPCWSTR lpSubKey, PHKEY phkResult)
Definition: reg.c:3268
static WCHAR * reg_get_value(HKEY hkey, const WCHAR *name, DWORD *type)
Definition: msi.c:1067
static const WCHAR szAttribute[]
Definition: domdoc.c:1179
static const WCHAR INSTALLPROPERTY_PACKAGENAMEW[]
Definition: msi.h:265
static const WCHAR INSTALLPROPERTY_INSTALLEDPRODUCTNAMEW[]
Definition: msi.h:311
static const WCHAR INSTALLPROPERTY_AUTHORIZED_LUA_APPW[]
Definition: msi.h:305
static const WCHAR INSTALLPROPERTY_INSTALLLOCATIONW[]
Definition: msi.h:327
enum tagMSIINSTALLCONTEXT MSIINSTALLCONTEXT
static const WCHAR INSTALLPROPERTY_TRANSFORMSW[]
Definition: msi.h:269
static const WCHAR INSTALLPROPERTY_PACKAGECODEW[]
Definition: msi.h:285
static const WCHAR INSTALLPROPERTY_URLINFOABOUTW[]
Definition: msi.h:347
static const WCHAR INSTALLPROPERTY_HELPTELEPHONEW[]
Definition: msi.h:323
static const WCHAR INSTALLPROPERTY_REGCOMPANYW[]
Definition: msi.h:367
static const WCHAR INSTALLPROPERTY_PUBLISHERW[]
Definition: msi.h:339
static const WCHAR INSTALLPROPERTY_INSTALLSOURCEW[]
Definition: msi.h:331
static const WCHAR INSTALLPROPERTY_URLUPDATEINFOW[]
Definition: msi.h:351
static const WCHAR INSTALLPROPERTY_PRODUCTIDW[]
Definition: msi.h:363
static const WCHAR INSTALLPROPERTY_VERSIONMAJORW[]
Definition: msi.h:359
static const WCHAR INSTALLPROPERTY_LOCALPACKAGEW[]
Definition: msi.h:343
static const WCHAR INSTALLPROPERTY_PRODUCTNAMEW[]
Definition: msi.h:277
static const WCHAR INSTALLPROPERTY_PRODUCTICONW[]
Definition: msi.h:295
static const WCHAR INSTALLPROPERTY_INSTALLDATEW[]
Definition: msi.h:335
static const WCHAR INSTALLPROPERTY_HELPLINKW[]
Definition: msi.h:319
static const WCHAR INSTALLPROPERTY_INSTANCETYPEW[]
Definition: msi.h:300
static const WCHAR INSTALLPROPERTY_VERSIONSTRINGW[]
Definition: msi.h:315
static const WCHAR INSTALLPROPERTY_VERSIONW[]
Definition: msi.h:289
static const WCHAR INSTALLPROPERTY_ASSIGNMENTTYPEW[]
Definition: msi.h:281
static const WCHAR INSTALLPROPERTY_REGOWNERW[]
Definition: msi.h:371
static const WCHAR INSTALLPROPERTY_VERSIONMINORW[]
Definition: msi.h:355
static const WCHAR INSTALLPROPERTY_LANGUAGEW[]
Definition: msi.h:273
BOOL unsquash_guid(LPCWSTR in, LPWSTR out)
Definition: registry.c:41
#define GUID_SIZE
Definition: msipriv.h:733
#define REG_NONE
Definition: nt_native.h:1492
#define REG_DWORD
Definition: sdbapi.c:596
_Check_return_ _CRTIMP wchar_t *__cdecl wcsdup(_In_z_ const wchar_t *_Str)
LPSTR a
Definition: msipriv.h:742
#define ERROR_UNKNOWN_PRODUCT
Definition: winerror.h:963
#define ERROR_BAD_CONFIGURATION
Definition: winerror.h:968

Referenced by MsiGetProductInfoA(), and MsiGetProductInfoW().

◆ MSI_GetUserInfo()

static USERINFOSTATE MSI_GetUserInfo ( LPCWSTR  szProduct,
awstring lpUserNameBuf,
LPDWORD  pcchUserNameBuf,
awstring lpOrgNameBuf,
LPDWORD  pcchOrgNameBuf,
awstring lpSerialBuf,
LPDWORD  pcchSerialBuf 
)
static

Definition at line 3507 of file msi.c.

3511{
3512 WCHAR *user, *org, *serial, squashed_pc[SQUASHED_GUID_SIZE];
3514 HKEY hkey, props;
3515 LPCWSTR orgptr;
3516 UINT r;
3517
3518 TRACE("%s %p %p %p %p %p %p\n", debugstr_w(szProduct), lpUserNameBuf,
3519 pcchUserNameBuf, lpOrgNameBuf, pcchOrgNameBuf, lpSerialBuf,
3520 pcchSerialBuf);
3521
3522 if (!szProduct || !squash_guid( szProduct, squashed_pc ))
3524
3526 &hkey, FALSE) != ERROR_SUCCESS &&
3528 &hkey, FALSE) != ERROR_SUCCESS &&
3530 &hkey, FALSE) != ERROR_SUCCESS)
3531 {
3532 return USERINFOSTATE_UNKNOWN;
3533 }
3534
3536 NULL, &props, FALSE) != ERROR_SUCCESS &&
3539 {
3540 RegCloseKey(hkey);
3541 return USERINFOSTATE_ABSENT;
3542 }
3543
3548
3549 RegCloseKey(hkey);
3551
3552 if (user && serial)
3554
3555 if (pcchUserNameBuf)
3556 {
3557 if (lpUserNameBuf && !user)
3558 {
3559 (*pcchUserNameBuf)--;
3560 goto done;
3561 }
3562
3563 r = msi_strcpy_to_awstring(user, -1, lpUserNameBuf, pcchUserNameBuf);
3564 if (r == ERROR_MORE_DATA)
3565 {
3567 goto done;
3568 }
3569 }
3570
3571 if (pcchOrgNameBuf)
3572 {
3573 orgptr = org;
3574 if (!orgptr) orgptr = L"";
3575
3576 r = msi_strcpy_to_awstring(orgptr, -1, lpOrgNameBuf, pcchOrgNameBuf);
3577 if (r == ERROR_MORE_DATA)
3578 {
3580 goto done;
3581 }
3582 }
3583
3584 if (pcchSerialBuf)
3585 {
3586 if (!serial)
3587 {
3588 (*pcchSerialBuf)--;
3589 goto done;
3590 }
3591
3592 r = msi_strcpy_to_awstring(serial, -1, lpSerialBuf, pcchSerialBuf);
3593 if (r == ERROR_MORE_DATA)
3595 }
3596
3597done:
3598 free(user);
3599 free(org);
3600 free(serial);
3601
3602 return state;
3603}
void user(int argc, const char *argv[])
Definition: cmds.c:1350
uint32_t serial
Definition: fsck.fat.h:29
static char org[]
Definition: encode.c:7456
enum tagUSERINFOSTATE USERINFOSTATE
@ USERINFOSTATE_MOREDATA
Definition: msi.h:78
@ USERINFOSTATE_UNKNOWN
Definition: msi.h:80
@ USERINFOSTATE_INVALIDARG
Definition: msi.h:79
@ USERINFOSTATE_ABSENT
Definition: msi.h:81
@ USERINFOSTATE_PRESENT
Definition: msi.h:82
static const WCHAR props[]
Definition: wbemdisp.c:288

Referenced by MsiGetUserInfoA(), and MsiGetUserInfoW().

◆ msi_locate_product()

◆ MSI_OpenProductW()

static UINT MSI_OpenProductW ( LPCWSTR  szProduct,
MSIPACKAGE **  package 
)
static

Definition at line 101 of file msi.c.

102{
103 UINT r;
104 HKEY props;
105 LPWSTR path;
107
108 TRACE("%s %p\n", debugstr_w(szProduct), package);
109
110 r = msi_locate_product(szProduct, &context);
111 if (r != ERROR_SUCCESS)
112 return r;
113
115 if (r != ERROR_SUCCESS)
117
119 path = msi_reg_get_val_str(props, L"ManagedLocalPackage");
120 else
121 path = msi_reg_get_val_str(props, L"LocalPackage");
122
124
126 goto done;
127
129 {
131 goto done;
132 }
133
134 r = MSI_OpenPackageW(path, 0, package);
135
136done:
138 free(path);
139 return r;
140}
UINT msi_locate_product(LPCWSTR szProduct, MSIINSTALLCONTEXT *context)
Definition: msi.c:54
BOOL WINAPI PathIsRelativeW(LPCWSTR lpszPath)
Definition: path.c:1579
UINT MSI_OpenPackageW(LPCWSTR szPackage, DWORD dwOptions, MSIPACKAGE **pPackage)
Definition: package.c:1384
#define ERROR_INSTALL_PACKAGE_OPEN_FAILED
Definition: winerror.h:977

Referenced by MsiConfigureFeatureW(), MsiOpenProductW(), and MsiReinstallFeatureW().

◆ MSI_ProvideQualifiedComponentEx()

static UINT MSI_ProvideQualifiedComponentEx ( LPCWSTR  szComponent,
LPCWSTR  szQualifier,
DWORD  dwInstallMode,
LPCWSTR  szProduct,
DWORD  Unused1,
DWORD  Unused2,
awstring lpPathBuf,
LPDWORD  pcchPathBuf 
)
static

Definition at line 3367 of file msi.c.

3371{
3373 WCHAR *desc;
3374 HKEY hkey;
3375 DWORD size;
3376 UINT ret;
3378
3379 if (MSIREG_OpenUserComponentsKey( szComponent, &hkey, FALSE )) return ERROR_UNKNOWN_COMPONENT;
3380
3381 desc = reg_get_multisz( hkey, szQualifier );
3382 RegCloseKey(hkey);
3383 if (!desc) return ERROR_INDEX_ABSENT;
3384
3385 /* FIXME: handle multiple descriptors */
3386 ret = MsiDecomposeDescriptorW( desc, product, feature, comp, &size );
3387 free( desc );
3388 if (ret != ERROR_SUCCESS) return ret;
3389
3390 if (!szProduct) szProduct = product;
3391 if (!comp[0])
3392 {
3395 GUID guid;
3396
3397 /* use the first component of the feature if the descriptor component is empty */
3398 if ((ret = msi_locate_product( szProduct, &ctx ))) return ret;
3399 if ((ret = MSIREG_OpenUserDataFeaturesKey( szProduct, NULL, ctx, &hkey, FALSE )))
3400 {
3401 return ERROR_FILE_NOT_FOUND;
3402 }
3403 components = reg_get_sz( hkey, feature );
3404 RegCloseKey( hkey );
3405 if (!components) return ERROR_FILE_NOT_FOUND;
3406
3408 {
3409 free( components );
3410 return ERROR_FILE_NOT_FOUND;
3411 }
3412 free( components );
3413 StringFromGUID2( &guid, comp, ARRAY_SIZE( comp ));
3414 }
3415
3416 state = MSI_GetComponentPath( szProduct, comp, L"S-1-1-0", MSIINSTALLCONTEXT_ALL, lpPathBuf, pcchPathBuf );
3417
3420 return ERROR_SUCCESS;
3421}
static INSTALLSTATE MSI_GetComponentPath(const WCHAR *szProduct, const WCHAR *szComponent, const WCHAR *szUserSid, MSIINSTALLCONTEXT ctx, awstring *lpPathBuf, DWORD *pcchBuf)
Definition: msi.c:2771
#define BASE85_SIZE
Definition: msi.c:3362
static WCHAR * reg_get_sz(HKEY hkey, const WCHAR *name)
Definition: msi.c:3353
static WCHAR * reg_get_multisz(HKEY hkey, const WCHAR *name)
Definition: msi.c:3344
INT WINAPI StringFromGUID2(REFGUID id, LPOLESTR str, INT cmax)
Definition: compobj.c:2434
GLenum GLenum GLuint components
Definition: glext.h:9620
const GUID * guid
INTERNETFEATURELIST feature
Definition: misc.c:1719
@ MSIINSTALLCONTEXT_ALL
Definition: msi.h:201
#define MAX_FEATURE_CHARS
Definition: msi.h:257
BOOL decode_base85_guid(LPCWSTR, GUID *)
Definition: registry.c:132
UINT MSIREG_OpenUserComponentsKey(LPCWSTR szComponent, HKEY *key, BOOL create)
Definition: registry.c:505
UINT MSIREG_OpenUserDataFeaturesKey(LPCWSTR szProduct, LPCWSTR szUserSid, MSIINSTALLCONTEXT context, HKEY *key, BOOL create)
Definition: registry.c:472
UINT WINAPI MsiDecomposeDescriptorW(LPCWSTR, LPWSTR, LPWSTR, LPWSTR, LPDWORD)
Definition: registry.c:927
#define ERROR_UNKNOWN_COMPONENT
Definition: winerror.h:965
#define ERROR_INDEX_ABSENT
Definition: winerror.h:969

Referenced by MsiProvideQualifiedComponentExA(), and MsiProvideQualifiedComponentExW().

◆ MsiAdvertiseProductA()

UINT WINAPI MsiAdvertiseProductA ( LPCSTR  szPackagePath,
LPCSTR  szScriptfilePath,
LPCSTR  szTransforms,
LANGID  lgidLanguage 
)

Definition at line 166 of file msi.c.

168{
169 FIXME("%s %s %s %08x\n",debugstr_a(szPackagePath),
170 debugstr_a(szScriptfilePath), debugstr_a(szTransforms), lgidLanguage);
172}
#define ERROR_CALL_NOT_IMPLEMENTED
Definition: compat.h:102
#define debugstr_a
Definition: kernel32.h:31

◆ MsiAdvertiseProductExA()

UINT WINAPI MsiAdvertiseProductExA ( const char szPackagePath,
const char szScriptfilePath,
const char szTransforms,
LANGID  lgidLanguage,
DWORD  dwPlatform,
DWORD  dwOptions 
)

Definition at line 182 of file msi.c.

184{
185 FIXME( "%s, %s, %s, %#x, %#lx, %#lx\n", debugstr_a(szPackagePath), debugstr_a(szScriptfilePath),
186 debugstr_a(szTransforms), lgidLanguage, dwPlatform, dwOptions );
188}
DWORD dwOptions
Definition: solitaire.cpp:25

◆ MsiAdvertiseProductExW()

UINT WINAPI MsiAdvertiseProductExW ( const WCHAR szPackagePath,
const WCHAR szScriptfilePath,
const WCHAR szTransforms,
LANGID  lgidLanguage,
DWORD  dwPlatform,
DWORD  dwOptions 
)

Definition at line 190 of file msi.c.

192{
193 FIXME( "%s, %s, %s, %#x %#lx %#lx\n", debugstr_w(szPackagePath), debugstr_w(szScriptfilePath),
194 debugstr_w(szTransforms), lgidLanguage, dwPlatform, dwOptions );
196}

◆ MsiAdvertiseProductW()

UINT WINAPI MsiAdvertiseProductW ( LPCWSTR  szPackagePath,
LPCWSTR  szScriptfilePath,
LPCWSTR  szTransforms,
LANGID  lgidLanguage 
)

Definition at line 174 of file msi.c.

176{
177 FIXME("%s %s %s %08x\n",debugstr_w(szPackagePath),
178 debugstr_w(szScriptfilePath), debugstr_w(szTransforms), lgidLanguage);
180}

Referenced by WinMain().

◆ MsiAdvertiseScriptA()

UINT WINAPI MsiAdvertiseScriptA ( const char szScriptFile,
DWORD  dwFlags,
HKEY phRegData,
BOOL  fRemoveItems 
)

Definition at line 4118 of file msi.c.

4119{
4120 FIXME( "%s, %#lx, %p, %d\n", debugstr_a(szScriptFile), dwFlags, phRegData, fRemoveItems );
4122}
_In_ PCCERT_CONTEXT _In_ DWORD dwFlags
Definition: wincrypt.h:1176

◆ MsiAdvertiseScriptW()

UINT WINAPI MsiAdvertiseScriptW ( const WCHAR szScriptFile,
DWORD  dwFlags,
HKEY phRegData,
BOOL  fRemoveItems 
)

Definition at line 4109 of file msi.c.

4110{
4111 FIXME( "%s, %#lx, %p, %d\n", debugstr_w(szScriptFile), dwFlags, phRegData, fRemoveItems );
4113}

◆ MsiApplyMultiplePatchesA()

UINT WINAPI MsiApplyMultiplePatchesA ( LPCSTR  szPatchPackages,
LPCSTR  szProductCode,
LPCSTR  szPropertiesList 
)

Definition at line 424 of file msi.c.

426{
427 LPWSTR patch_packages = NULL;
428 LPWSTR product_code = NULL;
429 LPWSTR properties_list = NULL;
431
432 TRACE("%s %s %s\n", debugstr_a(szPatchPackages), debugstr_a(szProductCode),
433 debugstr_a(szPropertiesList));
434
435 if (!szPatchPackages || !szPatchPackages[0])
437
438 if (!(patch_packages = strdupAtoW(szPatchPackages)))
439 return ERROR_OUTOFMEMORY;
440
441 if (szProductCode && !(product_code = strdupAtoW(szProductCode)))
442 goto done;
443
444 if (szPropertiesList && !(properties_list = strdupAtoW(szPropertiesList)))
445 goto done;
446
447 r = MsiApplyMultiplePatchesW(patch_packages, product_code, properties_list);
448
449done:
450 free(patch_packages);
451 free(product_code);
452 free(properties_list);
453
454 return r;
455}
static WCHAR * strdupAtoW(const char *str)
Definition: main.c:65
UINT WINAPI MsiApplyMultiplePatchesW(LPCWSTR szPatchPackages, LPCWSTR szProductCode, LPCWSTR szPropertiesList)
Definition: msi.c:457

Referenced by test_MsiApplyMultiplePatches().

◆ MsiApplyMultiplePatchesW()

UINT WINAPI MsiApplyMultiplePatchesW ( LPCWSTR  szPatchPackages,
LPCWSTR  szProductCode,
LPCWSTR  szPropertiesList 
)

Definition at line 457 of file msi.c.

459{
461 LPCWSTR beg, end;
462
463 TRACE("%s %s %s\n", debugstr_w(szPatchPackages), debugstr_w(szProductCode),
464 debugstr_w(szPropertiesList));
465
466 if (!szPatchPackages || !szPatchPackages[0])
468
469 beg = end = szPatchPackages;
470 while (*beg)
471 {
472 DWORD len;
473 LPWSTR patch;
474
475 while (*beg == ' ') beg++;
476 while (*end && *end != ';') end++;
477
478 len = end - beg;
479 while (len && beg[len - 1] == ' ') len--;
480
481 if (!len) return ERROR_INVALID_NAME;
482
483 patch = malloc((len + 1) * sizeof(WCHAR));
484 if (!patch)
485 return ERROR_OUTOFMEMORY;
486
487 memcpy(patch, beg, len * sizeof(WCHAR));
488 patch[len] = '\0';
489
490 r = MSI_ApplyPatchW(patch, szProductCode, szPropertiesList);
491 free(patch);
492
493 if (r != ERROR_SUCCESS || !*end)
494 break;
495
496 beg = ++end;
497 }
498 return r;
499}
#define ERROR_INVALID_NAME
Definition: compat.h:103
static UINT MSI_ApplyPatchW(LPCWSTR szPatchPackage, LPCWSTR szProductCode, LPCWSTR szCommandLine)
Definition: msi.c:359
GLuint GLuint end
Definition: gl.h:1545

Referenced by MsiApplyMultiplePatchesA().

◆ MsiApplyPatchA()

UINT WINAPI MsiApplyPatchA ( LPCSTR  szPatchPackage,
LPCSTR  szInstallPackage,
INSTALLTYPE  eInstallType,
LPCSTR  szCommandLine 
)

Definition at line 286 of file msi.c.

288{
289 LPWSTR patch_package = NULL;
290 LPWSTR install_package = NULL;
291 LPWSTR command_line = NULL;
293
294 TRACE("%s %s %d %s\n", debugstr_a(szPatchPackage), debugstr_a(szInstallPackage),
295 eInstallType, debugstr_a(szCommandLine));
296
297 if (szPatchPackage && !(patch_package = strdupAtoW(szPatchPackage)))
298 goto done;
299
300 if (szInstallPackage && !(install_package = strdupAtoW(szInstallPackage)))
301 goto done;
302
303 if (szCommandLine && !(command_line = strdupAtoW(szCommandLine)))
304 goto done;
305
306 r = MsiApplyPatchW(patch_package, install_package, eInstallType, command_line);
307
308done:
309 free(patch_package);
310 free(install_package);
311 free(command_line);
312
313 return r;
314}
UINT WINAPI MsiApplyPatchW(LPCWSTR szPatchPackage, LPCWSTR szInstallPackage, INSTALLTYPE eInstallType, LPCWSTR szCommandLine)
Definition: msi.c:408

Referenced by test_MsiApplyPatch(), test_patch_registration(), test_simple_patch(), and test_system_tables().

◆ MsiApplyPatchW()

UINT WINAPI MsiApplyPatchW ( LPCWSTR  szPatchPackage,
LPCWSTR  szInstallPackage,
INSTALLTYPE  eInstallType,
LPCWSTR  szCommandLine 
)

Definition at line 408 of file msi.c.

410{
411 TRACE("%s %s %d %s\n", debugstr_w(szPatchPackage), debugstr_w(szInstallPackage),
412 eInstallType, debugstr_w(szCommandLine));
413
414 if (szInstallPackage || eInstallType == INSTALLTYPE_NETWORK_IMAGE ||
415 eInstallType == INSTALLTYPE_SINGLE_INSTANCE)
416 {
417 FIXME("Only reading target products from patch\n");
419 }
420
421 return MSI_ApplyPatchW(szPatchPackage, NULL, szCommandLine);
422}
@ INSTALLTYPE_SINGLE_INSTANCE
Definition: msi.h:191
@ INSTALLTYPE_NETWORK_IMAGE
Definition: msi.h:190

Referenced by MsiApplyPatchA(), and WinMain().

◆ MsiBeginTransactionA()

UINT WINAPI MsiBeginTransactionA ( const char name,
DWORD  attrs,
MSIHANDLE id,
HANDLE event 
)

Definition at line 4291 of file msi.c.

4292{
4293 WCHAR *nameW;
4294 UINT r;
4295
4296 FIXME( "%s, %#lx, %p, %p\n", debugstr_a(name), attrs, id, event );
4297
4298 nameW = strdupAtoW( name );
4299 if (name && !nameW)
4300 return ERROR_OUTOFMEMORY;
4301
4302 r = MsiBeginTransactionW( nameW, attrs, id, event );
4303 free( nameW );
4304 return r;
4305}
static const WCHAR nameW[]
Definition: main.c:49
UINT WINAPI MsiBeginTransactionW(const WCHAR *name, DWORD attrs, MSIHANDLE *id, HANDLE *event)
Definition: msi.c:4310
struct _cl_event * event
Definition: glext.h:7739
Definition: name.c:39

◆ MsiBeginTransactionW()

UINT WINAPI MsiBeginTransactionW ( const WCHAR name,
DWORD  attrs,
MSIHANDLE id,
HANDLE event 
)

Definition at line 4310 of file msi.c.

4311{
4312 FIXME( "%s, %#lx, %p, %p\n", debugstr_w(name), attrs, id, event );
4313
4314 *id = (MSIHANDLE)0xdeadbeef;
4315 *event = (HANDLE)0xdeadbeef;
4316
4317 return ERROR_SUCCESS;
4318}
PVOID HANDLE
Definition: typedefs.h:73

Referenced by MsiBeginTransactionA().

◆ MsiCollectUserInfoA()

UINT WINAPI MsiCollectUserInfoA ( LPCSTR  szProduct)

Definition at line 3691 of file msi.c.

3692{
3694 UINT rc;
3695 MSIPACKAGE *package;
3696
3697 TRACE("(%s)\n",debugstr_a(szProduct));
3698
3699 rc = MsiOpenProductA(szProduct,&handle);
3700 if (rc != ERROR_SUCCESS)
3702
3703 /* MsiCollectUserInfo cannot be called from a custom action. */
3704 package = msihandle2msiinfo(handle, MSIHANDLETYPE_PACKAGE);
3705 if (!package)
3707
3708 rc = ACTION_PerformAction(package, L"FirstRun");
3709 msiobj_release( &package->hdr );
3710
3712
3713 return rc;
3714}
UINT ACTION_PerformAction(MSIPACKAGE *package, const WCHAR *action)
Definition: action.c:7640
UINT WINAPI MsiOpenProductA(LPCSTR szProduct, MSIHANDLE *phProduct)
Definition: msi.c:80
MSIOBJECTHDR hdr
Definition: msipriv.h:393

◆ MsiCollectUserInfoW()

UINT WINAPI MsiCollectUserInfoW ( LPCWSTR  szProduct)

Definition at line 3666 of file msi.c.

3667{
3669 UINT rc;
3670 MSIPACKAGE *package;
3671
3672 TRACE("(%s)\n",debugstr_w(szProduct));
3673
3674 rc = MsiOpenProductW(szProduct,&handle);
3675 if (rc != ERROR_SUCCESS)
3677
3678 /* MsiCollectUserInfo cannot be called from a custom action. */
3679 package = msihandle2msiinfo(handle, MSIHANDLETYPE_PACKAGE);
3680 if (!package)
3682
3683 rc = ACTION_PerformAction(package, L"FirstRun");
3684 msiobj_release( &package->hdr );
3685
3687
3688 return rc;
3689}
UINT WINAPI MsiOpenProductW(LPCWSTR szProduct, MSIHANDLE *phProduct)
Definition: msi.c:142

◆ MsiConfigureFeatureA()

UINT WINAPI MsiConfigureFeatureA ( LPCSTR  szProduct,
LPCSTR  szFeature,
INSTALLSTATE  eInstallState 
)

Definition at line 3719 of file msi.c.

3720{
3721 LPWSTR prod, feat = NULL;
3723
3724 TRACE("%s %s %i\n", debugstr_a(szProduct), debugstr_a(szFeature), eInstallState);
3725
3726 prod = strdupAtoW( szProduct );
3727 if (szProduct && !prod)
3728 goto end;
3729
3730 feat = strdupAtoW( szFeature );
3731 if (szFeature && !feat)
3732 goto end;
3733
3734 r = MsiConfigureFeatureW(prod, feat, eInstallState);
3735
3736end:
3737 free(feat);
3738 free(prod);
3739
3740 return r;
3741}
UINT WINAPI MsiConfigureFeatureW(LPCWSTR szProduct, LPCWSTR szFeature, INSTALLSTATE eInstallState)
Definition: msi.c:3746

Referenced by test_null().

◆ MsiConfigureFeatureW()

UINT WINAPI MsiConfigureFeatureW ( LPCWSTR  szProduct,
LPCWSTR  szFeature,
INSTALLSTATE  eInstallState 
)

Definition at line 3746 of file msi.c.

3747{
3748 MSIPACKAGE *package = NULL;
3749 UINT r;
3750 WCHAR sourcepath[MAX_PATH], filename[MAX_PATH];
3751 DWORD sz;
3752
3753 TRACE("%s %s %i\n", debugstr_w(szProduct), debugstr_w(szFeature), eInstallState);
3754
3755 if (!szProduct || !szFeature)
3757
3758 switch (eInstallState)
3759 {
3761 /* FIXME: how do we figure out the default location? */
3762 eInstallState = INSTALLSTATE_LOCAL;
3763 break;
3764 case INSTALLSTATE_LOCAL:
3768 break;
3769 default:
3771 }
3772
3773 r = MSI_OpenProductW( szProduct, &package );
3774 if (r != ERROR_SUCCESS)
3775 return r;
3776
3777 sz = sizeof(sourcepath);
3780
3781 sz = sizeof(filename);
3784
3785 lstrcatW( sourcepath, filename );
3786
3788
3789 r = ACTION_PerformAction(package, L"CostInitialize");
3790 if (r != ERROR_SUCCESS)
3791 goto end;
3792
3793 r = MSI_SetFeatureStateW( package, szFeature, eInstallState);
3794 if (r != ERROR_SUCCESS)
3795 goto end;
3796
3797 r = MSI_InstallPackage( package, sourcepath, NULL );
3798
3799end:
3800 msiobj_release( &package->hdr );
3801
3802 return r;
3803}
#define MAX_PATH
Definition: compat.h:34
UINT MSI_InstallPackage(MSIPACKAGE *package, LPCWSTR szPackagePath, LPCWSTR szCommandLine)
Definition: action.c:7740
UINT MSI_SetFeatureStateW(MSIPACKAGE *package, LPCWSTR szFeature, INSTALLSTATE iState)
Definition: install.c:915
INSTALLUILEVEL WINAPI MsiSetInternalUI(INSTALLUILEVEL dwUILevel, HWND *phWnd)
Definition: msi.c:2281
static UINT MSI_OpenProductW(LPCWSTR szProduct, MSIPACKAGE **package)
Definition: msi.c:101
UINT WINAPI MsiSourceListGetInfoW(LPCWSTR szProduct, LPCWSTR szUserSid, MSIINSTALLCONTEXT dwContext, DWORD dwOptions, LPCWSTR szProperty, LPWSTR szValue, LPDWORD pcchValue)
Definition: source.c:523
const char * filename
Definition: ioapi.h:137
LPWSTR WINAPI lstrcatW(LPWSTR lpString1, LPCWSTR lpString2)
Definition: lstring.c:274
@ MSICODE_PRODUCT
Definition: msi.h:215
static const WCHAR INSTALLPROPERTY_LASTUSEDSOURCEW[]
Definition: msi.h:405
@ INSTALLSTATE_SOURCE
Definition: msi.h:47
@ INSTALLSTATE_ADVERTISED
Definition: msi.h:44
@ INSTALLUILEVEL_BASIC
Definition: msi.h:67

Referenced by MsiConfigureFeatureA(), and test_null().

◆ MsiConfigureProductA()

UINT WINAPI MsiConfigureProductA ( LPCSTR  szProduct,
int  iInstallLevel,
INSTALLSTATE  eInstallState 
)

Definition at line 946 of file msi.c.

948{
949 LPWSTR szwProduct = NULL;
950 UINT r;
951
952 TRACE("%s %d %d\n",debugstr_a(szProduct), iInstallLevel, eInstallState);
953
954 if( szProduct )
955 {
956 szwProduct = strdupAtoW( szProduct );
957 if( !szwProduct )
958 return ERROR_OUTOFMEMORY;
959 }
960
961 r = MsiConfigureProductW( szwProduct, iInstallLevel, eInstallState );
962 free( szwProduct );
963
964 return r;
965}
UINT WINAPI MsiConfigureProductW(LPCWSTR szProduct, int iInstallLevel, INSTALLSTATE eInstallState)
Definition: msi.c:967

Referenced by test_concurrentinstall().

◆ MsiConfigureProductExA()

UINT WINAPI MsiConfigureProductExA ( LPCSTR  szProduct,
int  iInstallLevel,
INSTALLSTATE  eInstallState,
LPCSTR  szCommandLine 
)

Definition at line 916 of file msi.c.

918{
919 LPWSTR szwProduct = NULL;
920 LPWSTR szwCommandLine = NULL;
922
923 if( szProduct )
924 {
925 szwProduct = strdupAtoW( szProduct );
926 if( !szwProduct )
927 goto end;
928 }
929
930 if( szCommandLine)
931 {
932 szwCommandLine = strdupAtoW( szCommandLine );
933 if( !szwCommandLine)
934 goto end;
935 }
936
937 r = MsiConfigureProductExW( szwProduct, iInstallLevel, eInstallState,
938 szwCommandLine );
939end:
940 free( szwProduct );
941 free( szwCommandLine);
942
943 return r;
944}

Referenced by test_installed_prop(), and test_MsiConfigureProductEx().

◆ MsiConfigureProductExW()

UINT WINAPI MsiConfigureProductExW ( LPCWSTR  szProduct,
int  iInstallLevel,
INSTALLSTATE  eInstallState,
LPCWSTR  szCommandLine 
)

Definition at line 831 of file msi.c.

833{
834 MSIPACKAGE* package = NULL;
836 UINT r;
837 DWORD sz;
838 WCHAR sourcepath[MAX_PATH], filename[MAX_PATH];
839 LPWSTR commandline;
840
841 TRACE("%s %d %d %s\n",debugstr_w(szProduct), iInstallLevel, eInstallState,
842 debugstr_w(szCommandLine));
843
844 if (!szProduct || lstrlenW(szProduct) != GUID_SIZE - 1)
846
847 if (eInstallState == INSTALLSTATE_ADVERTISED ||
848 eInstallState == INSTALLSTATE_SOURCE)
849 {
850 FIXME("State %d not implemented\n", eInstallState);
852 }
853
854 r = msi_locate_product(szProduct, &context);
855 if (r != ERROR_SUCCESS)
856 return r;
857
858 r = open_package(szProduct, NULL, context, &package);
859 if (r != ERROR_SUCCESS)
860 return r;
861
862 sz = lstrlenW(L" Installed=1") + 1;
863
864 if (szCommandLine)
865 sz += lstrlenW(szCommandLine);
866
867 if (eInstallState != INSTALLSTATE_DEFAULT)
868 sz += lstrlenW(L" INSTALLLEVEL=32767");
869
870 if (eInstallState == INSTALLSTATE_ABSENT)
871 sz += lstrlenW(L" REMOVE=ALL");
872
874 sz += lstrlenW(L" ALLUSERS=1");
875
876 commandline = malloc(sz * sizeof(WCHAR));
877 if (!commandline)
878 {
880 goto end;
881 }
882
883 commandline[0] = 0;
884 if (szCommandLine)
885 lstrcpyW(commandline, szCommandLine);
886
887 if (eInstallState != INSTALLSTATE_DEFAULT)
888 lstrcatW(commandline, L" INSTALLLEVEL=32767");
889
890 if (eInstallState == INSTALLSTATE_ABSENT)
891 lstrcatW(commandline, L" REMOVE=ALL");
892
894 lstrcatW(commandline, L" ALLUSERS=1");
895
896 sz = sizeof(sourcepath);
898 INSTALLPROPERTY_LASTUSEDSOURCEW, sourcepath, &sz);
899
900 sz = sizeof(filename);
903
904 lstrcatW(sourcepath, filename);
905
906 r = MSI_InstallPackage( package, sourcepath, commandline );
907
908 free(commandline);
909
910end:
911 msiobj_release( &package->hdr );
912
913 return r;
914}
static UINT open_package(const WCHAR *product, const WCHAR *usersid, MSIINSTALLCONTEXT context, MSIPACKAGE **package)
Definition: msi.c:782

Referenced by MSI_ApplyPatchW(), MsiConfigureProductExA(), MsiConfigureProductW(), and WinMain().

◆ MsiConfigureProductW()

UINT WINAPI MsiConfigureProductW ( LPCWSTR  szProduct,
int  iInstallLevel,
INSTALLSTATE  eInstallState 
)

Definition at line 967 of file msi.c.

969{
970 return MsiConfigureProductExW(szProduct, iInstallLevel, eInstallState, NULL);
971}

Referenced by MsiConfigureProductA().

◆ MsiCreateAndVerifyInstallerDirectory()

UINT WINAPI MsiCreateAndVerifyInstallerDirectory ( DWORD  dwReserved)

Definition at line 3810 of file msi.c.

3811{
3813
3814 TRACE( "%#lx\n", dwReserved );
3815
3816 if (dwReserved)
3817 {
3818 FIXME( "dwReserved = %#lx\n", dwReserved );
3820 }
3821
3823 return ERROR_FUNCTION_FAILED;
3824
3825 lstrcatW(path, L"\\Installer");
3826
3828 return ERROR_FUNCTION_FAILED;
3829
3830 return ERROR_SUCCESS;
3831}
BOOL WINAPI CreateDirectoryW(IN LPCWSTR lpPathName, IN LPSECURITY_ATTRIBUTES lpSecurityAttributes)
Definition: dir.c:90
UINT WINAPI GetWindowsDirectoryW(OUT LPWSTR lpBuffer, IN UINT uSize)
Definition: path.c:2352
#define ERROR_ALREADY_EXISTS
Definition: disk.h:80
_In_ HANDLE _In_ DWORD _In_ DWORD _Inout_opt_ LPOVERLAPPED _In_opt_ LPTRANSMIT_FILE_BUFFERS _In_ DWORD dwReserved
Definition: mswsock.h:95

◆ MsiDetermineApplicablePatchesA()

UINT WINAPI MsiDetermineApplicablePatchesA ( const char szProductPackagePath,
DWORD  cPatchInfo,
MSIPATCHSEQUENCEINFOA pPatchInfo 
)

Definition at line 528 of file msi.c.

530{
531 UINT i, r;
532 WCHAR *package_path = NULL;
534
535 TRACE( "%s, %lu, %p\n", debugstr_a(szProductPackagePath), cPatchInfo, pPatchInfo );
536
537 if (szProductPackagePath && !(package_path = strdupAtoW( szProductPackagePath )))
538 return ERROR_OUTOFMEMORY;
539
540 if (!(psi = patchinfoAtoW( cPatchInfo, pPatchInfo )))
541 {
542 free( package_path );
543 return ERROR_OUTOFMEMORY;
544 }
545 r = MsiDetermineApplicablePatchesW( package_path, cPatchInfo, psi );
546 if (r == ERROR_SUCCESS)
547 {
548 for (i = 0; i < cPatchInfo; i++)
549 {
550 pPatchInfo[i].dwOrder = psi[i].dwOrder;
551 pPatchInfo[i].uStatus = psi[i].uStatus;
552 }
553 }
554 free( package_path );
555 free_patchinfo( cPatchInfo, psi );
556 return r;
557}
static void free_patchinfo(DWORD count, MSIPATCHSEQUENCEINFOW *info)
Definition: msi.c:501
UINT WINAPI MsiDetermineApplicablePatchesW(const WCHAR *szProductPackagePath, DWORD cPatchInfo, MSIPATCHSEQUENCEINFOW *pPatchInfo)
Definition: msi.c:726
static MSIPATCHSEQUENCEINFOW * patchinfoAtoW(DWORD count, const MSIPATCHSEQUENCEINFOA *info)
Definition: msi.c:508

◆ MsiDetermineApplicablePatchesW()

UINT WINAPI MsiDetermineApplicablePatchesW ( const WCHAR szProductPackagePath,
DWORD  cPatchInfo,
MSIPATCHSEQUENCEINFOW pPatchInfo 
)

Definition at line 726 of file msi.c.

728{
729 UINT r;
730 MSIPACKAGE *package;
731
732 TRACE( "%s, %lu, %p\n", debugstr_w(szProductPackagePath), cPatchInfo, pPatchInfo );
733
734 r = MSI_OpenPackageW( szProductPackagePath, 0, &package );
735 if (r != ERROR_SUCCESS)
736 {
737 ERR("failed to open package %u\n", r);
738 return r;
739 }
740 r = determine_patch_sequence( package, cPatchInfo, pPatchInfo );
741 msiobj_release( &package->hdr );
742 return r;
743}
static UINT determine_patch_sequence(MSIPACKAGE *package, DWORD count, MSIPATCHSEQUENCEINFOW *info)
Definition: msi.c:631

Referenced by MsiDetermineApplicablePatchesA().

◆ MsiDeterminePatchSequenceA()

UINT WINAPI MsiDeterminePatchSequenceA ( const char product,
const char usersid,
MSIINSTALLCONTEXT  context,
DWORD  count,
MSIPATCHSEQUENCEINFOA patchinfo 
)

Definition at line 745 of file msi.c.

747{
748 UINT i, r;
749 WCHAR *productW, *usersidW = NULL;
750 MSIPATCHSEQUENCEINFOW *patchinfoW;
751
752 TRACE( "%s, %s, %d, %lu, %p\n", debugstr_a(product), debugstr_a(usersid), context, count, patchinfo );
753
754 if (!product) return ERROR_INVALID_PARAMETER;
755 if (!(productW = strdupAtoW( product ))) return ERROR_OUTOFMEMORY;
756 if (usersid && !(usersidW = strdupAtoW( usersid )))
757 {
758 free( productW );
759 return ERROR_OUTOFMEMORY;
760 }
761 if (!(patchinfoW = patchinfoAtoW( count, patchinfo )))
762 {
763 free( productW );
764 free( usersidW );
765 return ERROR_OUTOFMEMORY;
766 }
767 r = MsiDeterminePatchSequenceW( productW, usersidW, context, count, patchinfoW );
768 if (r == ERROR_SUCCESS)
769 {
770 for (i = 0; i < count; i++)
771 {
772 patchinfo[i].dwOrder = patchinfoW[i].dwOrder;
773 patchinfo[i].uStatus = patchinfoW[i].uStatus;
774 }
775 }
776 free( productW );
777 free( usersidW );
778 free_patchinfo( count, patchinfoW );
779 return r;
780}
UINT WINAPI MsiDeterminePatchSequenceW(const WCHAR *product, const WCHAR *usersid, MSIINSTALLCONTEXT context, DWORD count, MSIPATCHSEQUENCEINFOW *patchinfo)
Definition: msi.c:814

◆ MsiDeterminePatchSequenceW()

UINT WINAPI MsiDeterminePatchSequenceW ( const WCHAR product,
const WCHAR usersid,
MSIINSTALLCONTEXT  context,
DWORD  count,
MSIPATCHSEQUENCEINFOW patchinfo 
)

Definition at line 814 of file msi.c.

816{
817 UINT r;
818 MSIPACKAGE *package;
819
820 TRACE( "%s, %s, %d, %lu, %p\n", debugstr_w(product), debugstr_w(usersid), context, count, patchinfo );
821
822 if (!product) return ERROR_INVALID_PARAMETER;
823 r = open_package( product, usersid, context, &package );
824 if (r != ERROR_SUCCESS) return r;
825
826 r = determine_patch_sequence( package, count, patchinfo );
827 msiobj_release( &package->hdr );
828 return r;
829}

Referenced by MsiDeterminePatchSequenceA().

◆ MsiEnableLogA()

UINT WINAPI MsiEnableLogA ( DWORD  dwLogMode,
const char szLogFile,
DWORD  attributes 
)

Definition at line 1882 of file msi.c.

1883{
1884 LPWSTR szwLogFile = NULL;
1885 UINT r;
1886
1887 TRACE( "%#lx, %s, %#lx\n", dwLogMode, debugstr_a(szLogFile), attributes );
1888
1889 if( szLogFile )
1890 {
1891 szwLogFile = strdupAtoW( szLogFile );
1892 if( !szwLogFile )
1893 return ERROR_OUTOFMEMORY;
1894 }
1895 r = MsiEnableLogW( dwLogMode, szwLogFile, attributes );
1896 free( szwLogFile );
1897 return r;
1898}
UINT WINAPI MsiEnableLogW(DWORD dwLogMode, const WCHAR *szLogFile, DWORD attributes)
Definition: msi.c:1900

Referenced by START_TEST().

◆ MsiEnableLogW()

UINT WINAPI MsiEnableLogW ( DWORD  dwLogMode,
const WCHAR szLogFile,
DWORD  attributes 
)

Definition at line 1900 of file msi.c.

1901{
1902 TRACE( "%#lx, %s, %#lx\n", dwLogMode, debugstr_w(szLogFile), attributes );
1903
1905 gszLogFile = NULL;
1906 if (szLogFile)
1907 {
1908 HANDLE file;
1909
1910 if (!(attributes & INSTALLLOGATTRIBUTES_APPEND))
1911 DeleteFileW(szLogFile);
1915 {
1916 gszLogFile = wcsdup(szLogFile);
1918 }
1919 else ERR( "unable to enable log %s (%lu)\n", debugstr_w(szLogFile), GetLastError() );
1920 }
1921
1922 return ERROR_SUCCESS;
1923}
#define FILE_ATTRIBUTE_NORMAL
Definition: compat.h:137
BOOL WINAPI DeleteFileW(IN LPCWSTR lpFileName)
Definition: delete.c:39
#define OPEN_ALWAYS
Definition: disk.h:70
@ INSTALLLOGATTRIBUTES_APPEND
Definition: msi.h:156
WCHAR * gszLogFile
Definition: msi_main.c:50
#define FILE_SHARE_WRITE
Definition: nt_native.h:681
#define GENERIC_WRITE
Definition: nt_native.h:90
Definition: fci.c:127

Referenced by MsiEnableLogA(), and WinMain().

◆ MsiEndTransaction()

UINT WINAPI MsiEndTransaction ( DWORD  state)

Definition at line 4334 of file msi.c.

4335{
4336 FIXME( "%#lx\n", state );
4337 return ERROR_SUCCESS;
4338}

◆ MsiEnumComponentCostsA()

UINT WINAPI MsiEnumComponentCostsA ( MSIHANDLE  handle,
const char component,
DWORD  index,
INSTALLSTATE  state,
char drive,
DWORD buflen,
int cost,
int temp 
)

Definition at line 1925 of file msi.c.

1927{
1928 UINT r;
1929 DWORD len;
1930 WCHAR *driveW, *componentW = NULL;
1931
1932 TRACE( "%lu, %s, %lu, %d, %p, %p, %p, %p\n", handle, debugstr_a(component), index, state, drive, buflen, cost,
1933 temp );
1934
1935 if (!drive || !buflen) return ERROR_INVALID_PARAMETER;
1936 if (component && !(componentW = strdupAtoW( component ))) return ERROR_OUTOFMEMORY;
1937
1938 len = *buflen;
1939 if (!(driveW = malloc( len * sizeof(WCHAR) )))
1940 {
1941 free( componentW );
1942 return ERROR_OUTOFMEMORY;
1943 }
1944 r = MsiEnumComponentCostsW( handle, componentW, index, state, driveW, buflen, cost, temp );
1945 if (!r)
1946 {
1947 WideCharToMultiByte( CP_ACP, 0, driveW, -1, drive, len, NULL, NULL );
1948 }
1949 free( componentW );
1950 free( driveW );
1951 return r;
1952}
#define CP_ACP
Definition: compat.h:109
#define WideCharToMultiByte
Definition: compat.h:111
UINT WINAPI MsiEnumComponentCostsW(MSIHANDLE handle, const WCHAR *component, DWORD index, INSTALLSTATE state, WCHAR *drive, DWORD *buflen, int *cost, int *temp)
Definition: msi.c:1962
GLuint index
Definition: glext.h:6031
static calc_node_t temp
Definition: rpn_ieee.c:38

Referenced by test_costs().

◆ MsiEnumComponentCostsW()

UINT WINAPI MsiEnumComponentCostsW ( MSIHANDLE  handle,
const WCHAR component,
DWORD  index,
INSTALLSTATE  state,
WCHAR drive,
DWORD buflen,
int cost,
int temp 
)

Definition at line 1962 of file msi.c.

1964{
1966 MSICOMPONENT *comp = NULL;
1967 MSIPACKAGE *package;
1968 MSIFILE *file;
1969 STATSTG stat = {0};
1971
1972 TRACE( "%lu, %s, %lu, %d, %p, %p, %p, %p\n", handle, debugstr_w(component), index, state, drive, buflen, cost,
1973 temp );
1974
1975 if (!drive || !buflen || !cost || !temp) return ERROR_INVALID_PARAMETER;
1976 if (!(package = msihandle2msiinfo( handle, MSIHANDLETYPE_PACKAGE )))
1977 {
1978 WCHAR buffer[3];
1979 MSIHANDLE remote;
1980
1981 if (!(remote = msi_get_remote(handle)))
1982 return ERROR_INVALID_HANDLE;
1983
1984 __TRY
1985 {
1986 r = remote_EnumComponentCosts(remote, component, index, state, buffer, cost, temp);
1987 }
1989 {
1990 r = GetExceptionCode();
1991 }
1992 __ENDTRY
1993
1994 if (r == ERROR_SUCCESS)
1995 {
1996 lstrcpynW(drive, buffer, *buflen);
1997 if (*buflen < 3)
1999 *buflen = 2;
2000 }
2001 return r;
2002 }
2003
2004 if (!msi_get_property_int( package->db, L"CostingComplete", 0 ))
2005 {
2006 msiobj_release( &package->hdr );
2008 }
2009 if (component && component[0] && !(comp = msi_get_loaded_component( package, component )))
2010 {
2011 msiobj_release( &package->hdr );
2013 }
2014 if (*buflen < 3)
2015 {
2016 *buflen = 2;
2017 msiobj_release( &package->hdr );
2018 return ERROR_MORE_DATA;
2019 }
2020 if (index)
2021 {
2022 msiobj_release( &package->hdr );
2023 return ERROR_NO_MORE_ITEMS;
2024 }
2025
2026 drive[0] = 0;
2027 *cost = *temp = 0;
2029 if (component && component[0])
2030 {
2031 if (msi_is_global_assembly( comp )) *temp = comp->cost;
2032 if (!comp->Enabled || !comp->KeyPath)
2033 {
2034 *cost = 0;
2035 *buflen = set_drive( drive, path[0] );
2036 r = ERROR_SUCCESS;
2037 }
2038 else if ((file = msi_get_loaded_file( package, comp->KeyPath )))
2039 {
2040 *cost = comp->cost;
2041 *buflen = set_drive( drive, file->TargetPath[0] );
2042 r = ERROR_SUCCESS;
2043 }
2044 }
2045 else if (IStorage_Stat( package->db->storage, &stat, STATFLAG_NONAME ) == S_OK)
2046 {
2047 *temp = cost_from_size( stat.cbSize.QuadPart );
2048 *buflen = set_drive( drive, path[0] );
2049 r = ERROR_SUCCESS;
2050 }
2051 msiobj_release( &package->hdr );
2052 return r;
2053}
#define __TRY
Definition: compat.h:80
#define ERROR_NO_MORE_ITEMS
Definition: compat.h:105
#define ERROR_INVALID_HANDLE
Definition: compat.h:98
#define __ENDTRY
Definition: compat.h:82
BOOL msi_is_global_assembly(MSICOMPONENT *comp)
Definition: action.c:2036
MSICOMPONENT * msi_get_loaded_component(MSIPACKAGE *package, const WCHAR *Component)
Definition: action.c:550
MSIFILE * msi_get_loaded_file(MSIPACKAGE *package, const WCHAR *key)
Definition: action.c:572
LONG WINAPI rpc_filter(EXCEPTION_POINTERS *eptr)
Definition: custom.c:85
MSIHANDLE msi_get_remote(MSIHANDLE handle)
Definition: handle.c:183
void * msihandle2msiinfo(MSIHANDLE handle, UINT type)
Definition: handle.c:158
static UINT set_drive(WCHAR *buffer, WCHAR letter)
Definition: msi.c:1954
GLuint buffer
Definition: glext.h:5915
#define GetExceptionCode
Definition: excpt.h:83
static int cost_from_size(int size)
Definition: msipriv.h:1198
int msi_get_property_int(MSIDATABASE *package, LPCWSTR prop, int def)
Definition: package.c:2305
#define MSIHANDLETYPE_PACKAGE
Definition: msipriv.h:726
#define __EXCEPT(func)
Definition: exception.h:84
Definition: stat.h:55
LPWSTR KeyPath
Definition: msipriv.h:529
#define ERROR_FUNCTION_NOT_CALLED
Definition: winerror.h:984

Referenced by MsiEnumComponentCostsA(), s_remote_EnumComponentCosts(), and test_costs().

◆ MsiGetComponentPathA()

INSTALLSTATE WINAPI MsiGetComponentPathA ( LPCSTR  product,
LPCSTR  comp,
LPSTR  buf,
LPDWORD  buflen 
)

Definition at line 2898 of file msi.c.

2899{
2900 return MsiGetComponentPathExA( product, comp, "s-1-1-0", MSIINSTALLCONTEXT_ALL, buf, buflen );
2901}
INSTALLSTATE WINAPI MsiGetComponentPathExA(LPCSTR product, LPCSTR comp, LPCSTR usersid, MSIINSTALLCONTEXT ctx, LPSTR buf, LPDWORD buflen)
Definition: msi.c:2860
GLenum GLuint GLenum GLsizei const GLchar * buf
Definition: glext.h:7751

Referenced by MsiLocateComponentA(), test_getcomponentpath(), and test_MsiGetComponentPath().

◆ MsiGetComponentPathExA()

INSTALLSTATE WINAPI MsiGetComponentPathExA ( LPCSTR  product,
LPCSTR  comp,
LPCSTR  usersid,
MSIINSTALLCONTEXT  ctx,
LPSTR  buf,
LPDWORD  buflen 
)

Definition at line 2860 of file msi.c.

2862{
2863 WCHAR *productW = NULL, *compW = NULL, *usersidW = NULL;
2865 awstring path;
2866
2867 TRACE( "%s %s %s 0x%x %p %p\n", debugstr_a(product), debugstr_a(comp), debugstr_a(usersid),
2868 ctx, buf, buflen );
2869
2870 if (product && !(productW = strdupAtoW( product ))) return INSTALLSTATE_UNKNOWN;
2871 if (comp && !(compW = strdupAtoW( comp ))) goto end;
2872 if (usersid && !(usersidW = strdupAtoW( usersid ))) goto end;
2873
2874 path.unicode = FALSE;
2875 path.str.a = buf;
2876
2877 r = MSI_GetComponentPath( productW, compW, usersidW, ctx, &path, buflen );
2878
2879end:
2880 free( productW );
2881 free( compW );
2882 free( usersidW );
2883
2884 return r;
2885}

Referenced by MsiGetComponentPathA(), and test_MsiGetComponentPathEx().

◆ MsiGetComponentPathExW()

INSTALLSTATE WINAPI MsiGetComponentPathExW ( LPCWSTR  product,
LPCWSTR  comp,
LPCWSTR  usersid,
MSIINSTALLCONTEXT  ctx,
LPWSTR  buf,
LPDWORD  buflen 
)

Definition at line 2846 of file msi.c.

2848{
2849 awstring path;
2850
2851 TRACE( "%s %s %s 0x%x %p %p\n", debugstr_w(product), debugstr_w(comp), debugstr_w(usersid),
2852 ctx, buf, buflen );
2853
2854 path.unicode = TRUE;
2855 path.str.w = buf;
2856
2857 return MSI_GetComponentPath( product, comp, usersid, ctx, &path, buflen );
2858}

Referenced by MsiGetComponentPathW().

◆ MsiGetComponentPathW()

INSTALLSTATE WINAPI MsiGetComponentPathW ( LPCWSTR  product,
LPCWSTR  comp,
LPWSTR  buf,
LPDWORD  buflen 
)

Definition at line 2890 of file msi.c.

2891{
2892 return MsiGetComponentPathExW( product, comp, L"S-1-1-0", MSIINSTALLCONTEXT_ALL, buf, buflen );
2893}
INSTALLSTATE WINAPI MsiGetComponentPathExW(LPCWSTR product, LPCWSTR comp, LPCWSTR usersid, MSIINSTALLCONTEXT ctx, LPWSTR buf, LPDWORD buflen)
Definition: msi.c:2846

Referenced by MsiLocateComponentW(), and MsiProvideComponentW().

◆ MsiGetFeatureUsageA()

UINT WINAPI MsiGetFeatureUsageA ( LPCSTR  szProduct,
LPCSTR  szFeature,
LPDWORD  pdwUseCount,
LPWORD  pwDateUsed 
)

Definition at line 3250 of file msi.c.

3252{
3253 LPWSTR prod = NULL, feat = NULL;
3255
3256 TRACE("%s %s %p %p\n", debugstr_a(szProduct), debugstr_a(szFeature),
3257 pdwUseCount, pwDateUsed);
3258
3259 prod = strdupAtoW( szProduct );
3260 if (szProduct && !prod)
3261 goto end;
3262
3263 feat = strdupAtoW( szFeature );
3264 if (szFeature && !feat)
3265 goto end;
3266
3267 ret = MsiGetFeatureUsageW( prod, feat, pdwUseCount, pwDateUsed );
3268
3269end:
3270 free( prod );
3271 free( feat );
3272
3273 return ret;
3274}
UINT WINAPI MsiGetFeatureUsageW(LPCWSTR szProduct, LPCWSTR szFeature, LPDWORD pdwUseCount, LPWORD pwDateUsed)
Definition: msi.c:3239

◆ MsiGetFeatureUsageW()

UINT WINAPI MsiGetFeatureUsageW ( LPCWSTR  szProduct,
LPCWSTR  szFeature,
LPDWORD  pdwUseCount,
LPWORD  pwDateUsed 
)

Definition at line 3239 of file msi.c.

3241{
3242 FIXME("%s %s %p %p\n",debugstr_w(szProduct), debugstr_w(szFeature),
3243 pdwUseCount, pwDateUsed);
3245}

Referenced by MsiGetFeatureUsageA().

◆ MsiGetFileHashA()

UINT WINAPI MsiGetFileHashA ( const char szFilePath,
DWORD  dwOptions,
MSIFILEHASHINFO pHash 
)

Definition at line 4090 of file msi.c.

4091{
4092 LPWSTR file;
4093 UINT r;
4094
4095 TRACE( "%s, %#lx, %p\n", debugstr_a(szFilePath), dwOptions, pHash );
4096
4098 if (szFilePath && !file)
4099 return ERROR_OUTOFMEMORY;
4100
4101 r = MsiGetFileHashW( file, dwOptions, pHash );
4102 free( file );
4103 return r;
4104}
UINT WINAPI MsiGetFileHashW(const WCHAR *szFilePath, DWORD dwOptions, MSIFILEHASHINFO *pHash)
Definition: msi.c:4067
static WCHAR szFilePath[]
Definition: qotd.c:14

Referenced by test_MsiGetFileHash().

◆ MsiGetFileHashW()

UINT WINAPI MsiGetFileHashW ( const WCHAR szFilePath,
DWORD  dwOptions,
MSIFILEHASHINFO pHash 
)

Definition at line 4067 of file msi.c.

4068{
4069 TRACE( "%s, %#lx, %p\n", debugstr_w(szFilePath), dwOptions, pHash );
4070
4071 if (!szFilePath)
4073
4074 if (!*szFilePath)
4075 return ERROR_PATH_NOT_FOUND;
4076
4077 if (dwOptions)
4079 if (!pHash)
4081 if (pHash->dwFileHashInfoSize < sizeof *pHash)
4083
4084 return msi_get_filehash( NULL, szFilePath, pHash );
4085}
UINT msi_get_filehash(MSIPACKAGE *package, const WCHAR *path, MSIFILEHASHINFO *hash)
Definition: msi.c:4018
ULONG dwFileHashInfoSize
Definition: msi.h:230
#define ERROR_PATH_NOT_FOUND
Definition: winerror.h:106

Referenced by MsiGetFileHashA().

◆ MsiGetFileSignatureInformationA()

HRESULT WINAPI MsiGetFileSignatureInformationA ( const char path,
DWORD  flags,
PCCERT_CONTEXT cert,
BYTE hash,
DWORD hashlen 
)

Definition at line 2511 of file msi.c.

2513{
2514 UINT r;
2515 WCHAR *pathW = NULL;
2516
2517 TRACE( "%s, %#lx, %p, %p, %p\n", debugstr_a(path), flags, cert, hash, hashlen );
2518
2519 if (path && !(pathW = strdupAtoW( path ))) return E_OUTOFMEMORY;
2520 r = MsiGetFileSignatureInformationW( pathW, flags, cert, hash, hashlen );
2521 free( pathW );
2522 return r;
2523}
#define E_OUTOFMEMORY
Definition: ddrawi.h:100
HRESULT WINAPI MsiGetFileSignatureInformationW(const WCHAR *path, DWORD flags, PCCERT_CONTEXT *cert, BYTE *hash, DWORD *hashlen)
Definition: msi.c:2525
GLbitfield flags
Definition: glext.h:7161
static BYTE cert[]
Definition: msg.c:1437

Referenced by test_MsiGetFileSignatureInformation().

◆ MsiGetFileSignatureInformationW()

HRESULT WINAPI MsiGetFileSignatureInformationW ( const WCHAR path,
DWORD  flags,
PCCERT_CONTEXT cert,
BYTE hash,
DWORD hashlen 
)

Definition at line 2525 of file msi.c.

2527{
2528 static GUID generic_verify_v2 = WINTRUST_ACTION_GENERIC_VERIFY_V2;
2529 HRESULT hr;
2532 CRYPT_PROVIDER_SGNR *signer;
2533 CRYPT_PROVIDER_CERT *provider;
2534
2535 TRACE( "%s, %#lx, %p, %p, %p\n", debugstr_w(path), flags, cert, hash, hashlen );
2536
2537 if (!path || !cert) return E_INVALIDARG;
2538
2539 info.cbStruct = sizeof(info);
2540 info.pcwszFilePath = path;
2541 info.hFile = NULL;
2542 info.pgKnownSubject = NULL;
2543
2544 memset( &data, 0, sizeof(data) );
2545 data.cbStruct = sizeof(data);
2546 data.dwUIChoice = WTD_UI_NONE;
2547 data.fdwRevocationChecks = WTD_REVOKE_WHOLECHAIN;
2548 data.dwUnionChoice = WTD_CHOICE_FILE;
2549 data.pFile = &info;
2550 data.dwStateAction = WTD_STATEACTION_VERIFY;
2551 data.dwUIContext = WTD_UICONTEXT_INSTALL;
2552
2553 hr = WinVerifyTrustEx( INVALID_HANDLE_VALUE, &generic_verify_v2, &data );
2554 *cert = NULL;
2555 if (FAILED(hr)) goto done;
2556
2557 if (!(signer = WTHelperGetProvSignerFromChain( data.hWVTStateData, 0, FALSE, 0 )))
2558 {
2560 goto done;
2561 }
2562 if (hash)
2563 {
2565 if (*hashlen < len)
2566 {
2567 *hashlen = len;
2569 goto done;
2570 }
2572 *hashlen = len;
2573 }
2574 if (!(provider = WTHelperGetProvCertFromChain( signer, 0 )))
2575 {
2577 goto done;
2578 }
2580
2581done:
2582 data.dwStateAction = WTD_STATEACTION_CLOSE;
2583 WinVerifyTrustEx( INVALID_HANDLE_VALUE, &generic_verify_v2, &data );
2584 return hr;
2585}
#define E_INVALIDARG
Definition: ddrawi.h:101
PCCERT_CONTEXT WINAPI CertDuplicateCertificateContext(PCCERT_CONTEXT pCertContext)
Definition: cert.c:360
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl.h:1950
#define FAILED(hr)
Definition: intsafe.h:51
#define WINTRUST_ACTION_GENERIC_VERIFY_V2
Definition: softpub.h:108
CRYPT_DATA_BLOB EncryptedHash
Definition: wincrypt.h:774
BYTE * pbData
Definition: wincrypt.h:103
PCCERT_CONTEXT pCert
Definition: wintrust.h:208
CMSG_SIGNER_INFO * psSigner
Definition: wintrust.h:237
#define TRUST_E_PROVIDER_UNKNOWN
Definition: winerror.h:3112
#define TRUST_E_NOSIGNATURE
Definition: winerror.h:3116
#define HRESULT_FROM_WIN32(x)
Definition: winerror.h:92
#define WTD_STATEACTION_CLOSE
Definition: wintrust.h:124
#define WTD_STATEACTION_VERIFY
Definition: wintrust.h:123
#define WTD_UICONTEXT_INSTALL
Definition: wintrust.h:143
#define WTD_UI_NONE
Definition: wintrust.h:84
#define WTD_REVOKE_WHOLECHAIN
Definition: wintrust.h:89
#define WTD_CHOICE_FILE
Definition: wintrust.h:91
CRYPT_PROVIDER_CERT *WINAPI WTHelperGetProvCertFromChain(CRYPT_PROVIDER_SGNR *pSgnr, DWORD idxCert)
CRYPT_PROVIDER_SGNR *WINAPI WTHelperGetProvSignerFromChain(CRYPT_PROVIDER_DATA *pProvData, DWORD idxSigner, BOOL fCounterSigner, DWORD idxCounterSigner)
HRESULT WINAPI WinVerifyTrustEx(HWND hwnd, GUID *ActionID, WINTRUST_DATA *ActionData)

Referenced by MsiGetFileSignatureInformationA().

◆ MsiGetFileVersionA()

UINT WINAPI MsiGetFileVersionA ( LPCSTR  szFilePath,
LPSTR  lpVersionBuf,
LPDWORD  pcchVersionBuf,
LPSTR  lpLangBuf,
LPDWORD  pcchLangBuf 
)

Definition at line 3088 of file msi.c.

3090{
3091 LPWSTR szwFilePath = NULL, lpwVersionBuff = NULL, lpwLangBuff = NULL;
3093
3094 if ((lpVersionBuf && !pcchVersionBuf) ||
3095 (lpLangBuf && !pcchLangBuf))
3097
3098 if( szFilePath )
3099 {
3100 szwFilePath = strdupAtoW( szFilePath );
3101 if( !szwFilePath )
3102 goto end;
3103 }
3104
3105 if( lpVersionBuf && pcchVersionBuf && *pcchVersionBuf )
3106 {
3107 lpwVersionBuff = malloc(*pcchVersionBuf * sizeof(WCHAR));
3108 if( !lpwVersionBuff )
3109 goto end;
3110 }
3111
3112 if( lpLangBuf && pcchLangBuf && *pcchLangBuf )
3113 {
3114 lpwLangBuff = malloc(*pcchLangBuf * sizeof(WCHAR));
3115 if( !lpwLangBuff )
3116 goto end;
3117 }
3118
3119 ret = MsiGetFileVersionW(szwFilePath, lpwVersionBuff, pcchVersionBuf,
3120 lpwLangBuff, pcchLangBuf);
3121
3122 if( (ret == ERROR_SUCCESS || ret == ERROR_MORE_DATA) && lpwVersionBuff )
3123 WideCharToMultiByte(CP_ACP, 0, lpwVersionBuff, -1,
3124 lpVersionBuf, *pcchVersionBuf + 1, NULL, NULL);
3125 if( (ret == ERROR_SUCCESS || ret == ERROR_MORE_DATA) && lpwLangBuff )
3126 WideCharToMultiByte(CP_ACP, 0, lpwLangBuff, -1,
3127 lpLangBuf, *pcchLangBuf + 1, NULL, NULL);
3128
3129end:
3130 free(szwFilePath);
3131 free(lpwVersionBuff);
3132 free(lpwLangBuff);
3133
3134 return ret;
3135}
UINT WINAPI MsiGetFileVersionW(const WCHAR *path, WCHAR *verbuf, DWORD *verlen, WCHAR *langbuf, DWORD *langlen)
Definition: msi.c:3208

Referenced by test_MsiGetFileVersion().

◆ MsiGetFileVersionW()

UINT WINAPI MsiGetFileVersionW ( const WCHAR path,
WCHAR verbuf,
DWORD verlen,
WCHAR langbuf,
DWORD langlen 
)

Definition at line 3208 of file msi.c.

3209{
3210 UINT ret;
3211
3212 TRACE( "%s, %p(%lu), %p(%lu)\n", debugstr_w(path), verbuf, verlen ? *verlen : 0, langbuf, langlen ? *langlen : 0 );
3213
3214 if ((verbuf && !verlen) || (langbuf && !langlen))
3216
3217 ret = get_file_version( path, verbuf, verlen, langbuf, langlen );
3218 if (ret == ERROR_RESOURCE_DATA_NOT_FOUND && verlen)
3219 {
3220 int len;
3222 if (!version) return ERROR_FILE_INVALID;
3223 len = lstrlenW( version );
3224 if (len >= *verlen) ret = ERROR_MORE_DATA;
3225 else if (verbuf)
3226 {
3227 lstrcpyW( verbuf, version );
3229 }
3230 *verlen = len;
3231 free( version );
3232 }
3233 return ret;
3234}
WCHAR * msi_get_font_file_version(MSIPACKAGE *package, const WCHAR *filename)
Definition: font.c:189
static UINT get_file_version(const WCHAR *path, WCHAR *verbuf, DWORD *verlen, WCHAR *langbuf, DWORD *langlen)
Definition: msi.c:3137

Referenced by MsiGetFileVersionA(), and ShowUsage().

◆ MsiGetPatchFileListA()

UINT WINAPI MsiGetPatchFileListA ( LPCSTR  szProductCode,
LPCSTR  szPatchList,
LPDWORD  pcFiles,
MSIHANDLE **  pphFileRecords 
)

Definition at line 1574 of file msi.c.

1576{
1577 FIXME("(%s, %s, %p, %p) stub!\n", debugstr_a(szProductCode),
1578 debugstr_a(szPatchList), pcFiles, pphFileRecords);
1579 return ERROR_FUNCTION_FAILED;
1580}

◆ MsiGetPatchFileListW()

UINT WINAPI MsiGetPatchFileListW ( LPCWSTR  szProductCode,
LPCWSTR  szPatchList,
LPDWORD  pcFiles,
MSIHANDLE **  pphFileRecords 
)

Definition at line 1582 of file msi.c.

1584{
1585 FIXME("(%s, %s, %p, %p) stub!\n", debugstr_w(szProductCode),
1586 debugstr_w(szPatchList), pcFiles, pphFileRecords);
1587 return ERROR_FUNCTION_FAILED;
1588}

◆ MsiGetPatchInfoA()

UINT WINAPI MsiGetPatchInfoA ( LPCSTR  patch,
LPCSTR  attr,
LPSTR  buffer,
LPDWORD  buflen 
)

Definition at line 1795 of file msi.c.

1796{
1798 DWORD size;
1799 LPWSTR patchW = NULL, attrW = NULL, bufferW = NULL;
1800
1801 TRACE("%s %s %p %p\n", debugstr_a(patch), debugstr_a(attr), buffer, buflen);
1802
1803 if (!patch || !attr)
1805
1806 if (!(patchW = strdupAtoW( patch )))
1807 goto done;
1808
1809 if (!(attrW = strdupAtoW( attr )))
1810 goto done;
1811
1812 size = 0;
1813 r = MsiGetPatchInfoW( patchW, attrW, NULL, &size );
1814 if (r != ERROR_SUCCESS)
1815 goto done;
1816
1817 size++;
1818 if (!(bufferW = malloc( size * sizeof(WCHAR) )))
1819 {
1821 goto done;
1822 }
1823
1824 r = MsiGetPatchInfoW( patchW, attrW, bufferW, &size );
1825 if (r == ERROR_SUCCESS)
1826 {
1827 int len = WideCharToMultiByte( CP_ACP, 0, bufferW, -1, NULL, 0, NULL, NULL );
1828 if (len > *buflen)
1830 else if (buffer)
1831 WideCharToMultiByte( CP_ACP, 0, bufferW, -1, buffer, *buflen, NULL, NULL );
1832
1833 *buflen = len - 1;
1834 }
1835
1836done:
1837 free( patchW );
1838 free( attrW );
1839 free( bufferW );
1840 return r;
1841}
UINT WINAPI MsiGetPatchInfoW(LPCWSTR patch, LPCWSTR attr, LPWSTR buffer, LPDWORD buflen)
Definition: msi.c:1843
Definition: cookie.c:202

Referenced by test_MsiGetPatchInfo().

◆ MsiGetPatchInfoExA()

UINT WINAPI MsiGetPatchInfoExA ( LPCSTR  szPatchCode,
LPCSTR  szProductCode,
LPCSTR  szUserSid,
MSIINSTALLCONTEXT  dwContext,
LPCSTR  szProperty,
LPSTR  lpValue,
DWORD pcchValue 
)

Definition at line 1590 of file msi.c.

1593{
1594 LPWSTR patch = NULL, product = NULL, usersid = NULL;
1595 LPWSTR property = NULL, val = NULL;
1596 DWORD len;
1597 UINT r;
1598
1599 TRACE("(%s, %s, %s, %d, %s, %p, %p)\n", debugstr_a(szPatchCode),
1600 debugstr_a(szProductCode), debugstr_a(szUserSid), dwContext,
1601 debugstr_a(szProperty), lpValue, pcchValue);
1602
1603 if (lpValue && !pcchValue)
1605
1606 if (szPatchCode) patch = strdupAtoW(szPatchCode);
1607 if (szProductCode) product = strdupAtoW(szProductCode);
1608 if (szUserSid) usersid = strdupAtoW(szUserSid);
1609 if (szProperty) property = strdupAtoW(szProperty);
1610
1611 len = 0;
1612 r = MsiGetPatchInfoExW(patch, product, usersid, dwContext, property,
1613 NULL, &len);
1614 if (r != ERROR_SUCCESS)
1615 goto done;
1616
1617 val = malloc(++len * sizeof(WCHAR));
1618 if (!val)
1619 {
1621 goto done;
1622 }
1623
1624 r = MsiGetPatchInfoExW(patch, product, usersid, dwContext, property,
1625 val, &len);
1626 if (r != ERROR_SUCCESS || !pcchValue)
1627 goto done;
1628
1629 if (lpValue)
1630 WideCharToMultiByte(CP_ACP, 0, val, -1, lpValue,
1631 *pcchValue - 1, NULL, NULL);
1632
1633 len = lstrlenW(val);
1634 if ((*val && *pcchValue < len + 1) || !lpValue)
1635 {
1636 if (lpValue)
1637 {
1639 lpValue[*pcchValue - 1] = '\0';
1640 }
1641
1642 *pcchValue = len * sizeof(WCHAR);
1643 }
1644 else
1645 *pcchValue = len;
1646
1647done:
1648 free(val);
1649 free(patch);
1650 free(product);
1651 free(usersid);
1652 free(property);
1653
1654 return r;
1655}
UINT WINAPI MsiGetPatchInfoExW(LPCWSTR szPatchCode, LPCWSTR szProductCode, LPCWSTR szUserSid, MSIINSTALLCONTEXT dwContext, LPCWSTR szProperty, LPWSTR lpValue, DWORD *pcchValue)
Definition: msi.c:1657

Referenced by test_MsiGetPatchInfoEx(), and test_patch_registration().

◆ MsiGetPatchInfoExW()

UINT WINAPI MsiGetPatchInfoExW ( LPCWSTR  szPatchCode,
LPCWSTR  szProductCode,
LPCWSTR  szUserSid,
MSIINSTALLCONTEXT  dwContext,
LPCWSTR  szProperty,
LPWSTR  lpValue,
DWORD pcchValue 
)

Definition at line 1657 of file msi.c.

1660{
1661 WCHAR *val = NULL, squashed_pc[SQUASHED_GUID_SIZE], squashed_patch[SQUASHED_GUID_SIZE];
1662 HKEY udprod = 0, prod = 0, props = 0;
1663 HKEY patch = 0, patches = 0;
1664 HKEY udpatch = 0, datakey = 0;
1665 HKEY prodpatches = 0;
1667 DWORD len, type;
1668 LONG res;
1669
1670 TRACE("(%s, %s, %s, %d, %s, %p, %p)\n", debugstr_w(szPatchCode),
1671 debugstr_w(szProductCode), debugstr_w(szUserSid), dwContext,
1672 debugstr_w(szProperty), lpValue, pcchValue);
1673
1674 if (!szProductCode || !squash_guid( szProductCode, squashed_pc ))
1676
1677 if (!szPatchCode || !squash_guid( szPatchCode, squashed_patch ))
1679
1680 if (!szProperty)
1682
1683 if (lpValue && !pcchValue)
1685
1686 if (dwContext != MSIINSTALLCONTEXT_USERMANAGED &&
1687 dwContext != MSIINSTALLCONTEXT_USERUNMANAGED &&
1688 dwContext != MSIINSTALLCONTEXT_MACHINE)
1690
1691 if (dwContext == MSIINSTALLCONTEXT_MACHINE && szUserSid)
1693
1694 if (szUserSid && !wcscmp( szUserSid, L"S-1-5-18" ))
1696
1697 if (MSIREG_OpenUserDataProductKey(szProductCode, dwContext, NULL,
1698 &udprod, FALSE) != ERROR_SUCCESS)
1699 goto done;
1700
1701 if (MSIREG_OpenInstallProps(szProductCode, dwContext, NULL,
1703 goto done;
1704
1706
1707 res = RegOpenKeyExW(udprod, L"Patches", 0, KEY_READ, &patches);
1708 if (res != ERROR_SUCCESS)
1709 goto done;
1710
1711 res = RegOpenKeyExW( patches, squashed_patch, 0, KEY_READ, &patch );
1712 if (res != ERROR_SUCCESS)
1713 goto done;
1714
1715 if (!wcscmp( szProperty, INSTALLPROPERTY_TRANSFORMSW ))
1716 {
1717 if (MSIREG_OpenProductKey(szProductCode, NULL, dwContext,
1718 &prod, FALSE) != ERROR_SUCCESS)
1719 goto done;
1720
1721 res = RegOpenKeyExW(prod, L"Patches", 0, KEY_ALL_ACCESS, &prodpatches);
1722 if (res != ERROR_SUCCESS)
1723 goto done;
1724
1725 datakey = prodpatches;
1726 szProperty = squashed_patch;
1727 }
1728 else
1729 {
1730 if (MSIREG_OpenUserDataPatchKey(szPatchCode, dwContext,
1731 &udpatch, FALSE) != ERROR_SUCCESS)
1732 goto done;
1733
1734 if (!wcscmp( szProperty, INSTALLPROPERTY_LOCALPACKAGEW ))
1735 {
1736 if (dwContext == MSIINSTALLCONTEXT_USERMANAGED)
1737 szProperty = L"ManagedLocalPackage";
1738 datakey = udpatch;
1739 }
1740 else if (!wcscmp( szProperty, INSTALLPROPERTY_INSTALLDATEW ))
1741 {
1742 datakey = patch;
1743 szProperty = L"Installed";
1744 }
1745 else if (!wcscmp( szProperty, INSTALLPROPERTY_UNINSTALLABLEW ) ||
1746 !wcscmp( szProperty, INSTALLPROPERTY_PATCHSTATEW ) ||
1747 !wcscmp( szProperty, INSTALLPROPERTY_DISPLAYNAMEW ) ||
1748 !wcscmp( szProperty, INSTALLPROPERTY_MOREINFOURLW ))
1749 {
1750 datakey = patch;
1751 }
1752 else
1753 {
1755 goto done;
1756 }
1757 }
1758
1759 val = reg_get_value(datakey, szProperty, &type);
1760 if (!val)
1761 val = wcsdup(L"");
1762
1763 r = ERROR_SUCCESS;
1764
1765 if (!pcchValue)
1766 goto done;
1767
1768 if (lpValue)
1769 lstrcpynW(lpValue, val, *pcchValue);
1770
1771 len = lstrlenW(val);
1772 if ((*val && *pcchValue < len + 1) || !lpValue)
1773 {
1774 if (lpValue)
1776
1777 *pcchValue = len * sizeof(WCHAR);
1778 }
1779
1780 *pcchValue = len;
1781
1782done:
1783 free(val);
1784 RegCloseKey(prodpatches);
1785 RegCloseKey(prod);
1786 RegCloseKey(patch);
1787 RegCloseKey(patches);
1788 RegCloseKey(udpatch);
1790 RegCloseKey(udprod);
1791
1792 return r;
1793}
LONG WINAPI RegOpenKeyExW(HKEY hKey, LPCWSTR lpSubKey, DWORD ulOptions, REGSAM samDesired, PHKEY phkResult)
Definition: reg.c:3333
static const WCHAR INSTALLPROPERTY_UNINSTALLABLEW[]
Definition: msi.h:376
static const WCHAR INSTALLPROPERTY_PATCHSTATEW[]
Definition: msi.h:384
static const WCHAR INSTALLPROPERTY_DISPLAYNAMEW[]
Definition: msi.h:396
static const WCHAR INSTALLPROPERTY_MOREINFOURLW[]
Definition: msi.h:400
UINT MSIREG_OpenUserDataPatchKey(LPCWSTR szPatch, MSIINSTALLCONTEXT dwContext, HKEY *key, BOOL create)
Definition: registry.c:610
#define KEY_ALL_ACCESS
Definition: nt_native.h:1041
#define KEY_READ
Definition: nt_native.h:1023
#define ERROR_UNKNOWN_PATCH
Definition: winerror.h:1005

Referenced by msi_apply_registered_patch(), MsiGetPatchInfoExA(), and MsiGetPatchInfoW().

◆ MsiGetPatchInfoW()

UINT WINAPI MsiGetPatchInfoW ( LPCWSTR  patch,
LPCWSTR  attr,
LPWSTR  buffer,
LPDWORD  buflen 
)

Definition at line 1843 of file msi.c.

1844{
1845 UINT r;
1846 WCHAR product[GUID_SIZE];
1847 DWORD index;
1848
1849 TRACE("%s %s %p %p\n", debugstr_w(patch), debugstr_w(attr), buffer, buflen);
1850
1851 if (!patch || !attr)
1853
1856
1857 index = 0;
1858 while (1)
1859 {
1860 r = MsiEnumProductsW( index, product );
1861 if (r != ERROR_SUCCESS)
1862 break;
1863
1864 r = MsiGetPatchInfoExW( patch, product, NULL, MSIINSTALLCONTEXT_USERMANAGED, attr, buffer, buflen );
1865 if (r == ERROR_SUCCESS || r == ERROR_MORE_DATA)
1866 return r;
1867
1868 r = MsiGetPatchInfoExW( patch, product, NULL, MSIINSTALLCONTEXT_USERUNMANAGED, attr, buffer, buflen );
1869 if (r == ERROR_SUCCESS || r == ERROR_MORE_DATA)
1870 return r;
1871
1872 r = MsiGetPatchInfoExW( patch, product, NULL, MSIINSTALLCONTEXT_MACHINE, attr, buffer, buflen );
1873 if (r == ERROR_SUCCESS || r == ERROR_MORE_DATA)
1874 return r;
1875
1876 index++;
1877 }
1878
1879 return ERROR_UNKNOWN_PRODUCT;
1880}
#define index(s, c)
Definition: various.h:29
UINT WINAPI MsiEnumProductsW(DWORD index, WCHAR *lpguid)
Definition: registry.c:1040

Referenced by MsiGetPatchInfoA(), and test_MsiGetPatchInfo().

◆ MsiGetProductCodeA()

UINT WINAPI MsiGetProductCodeA ( LPCSTR  szComponent,
LPSTR  szBuffer 
)

Definition at line 973 of file msi.c.

974{
975 LPWSTR szwComponent = NULL;
976 UINT r;
977 WCHAR szwBuffer[GUID_SIZE];
978
979 TRACE("%s %p\n", debugstr_a(szComponent), szBuffer);
980
981 if( szComponent )
982 {
983 szwComponent = strdupAtoW( szComponent );
984 if( !szwComponent )
985 return ERROR_OUTOFMEMORY;
986 }
987
988 *szwBuffer = '\0';
989 r = MsiGetProductCodeW( szwComponent, szwBuffer );
990
991 if(*szwBuffer)
992 WideCharToMultiByte(CP_ACP, 0, szwBuffer, -1, szBuffer, GUID_SIZE, NULL, NULL);
993
994 free( szwComponent );
995
996 return r;
997}
UINT WINAPI MsiGetProductCodeW(LPCWSTR szComponent, LPWSTR szBuffer)
Definition: msi.c:999

Referenced by MsiLocateComponentA(), and test_MsiGetProductCode().

◆ MsiGetProductCodeW()

UINT WINAPI MsiGetProductCodeW ( LPCWSTR  szComponent,
LPWSTR  szBuffer 
)

Definition at line 999 of file msi.c.

1000{
1001 UINT rc, index;
1002 HKEY compkey, prodkey;
1003 WCHAR squashed_comp[SQUASHED_GUID_SIZE], squashed_prod[SQUASHED_GUID_SIZE];
1004 DWORD sz = ARRAY_SIZE(squashed_prod);
1005
1006 TRACE("%s %p\n", debugstr_w(szComponent), szBuffer);
1007
1008 if (!szComponent || !*szComponent)
1010
1011 if (!squash_guid( szComponent, squashed_comp ))
1013
1014 if (MSIREG_OpenUserDataComponentKey(szComponent, NULL, &compkey, FALSE) != ERROR_SUCCESS &&
1015 MSIREG_OpenUserDataComponentKey(szComponent, L"S-1-5-18", &compkey, FALSE) != ERROR_SUCCESS)
1016 {
1018 }
1019
1020 rc = RegEnumValueW( compkey, 0, squashed_prod, &sz, NULL, NULL, NULL, NULL );
1021 if (rc != ERROR_SUCCESS)
1022 {
1023 RegCloseKey(compkey);
1025 }
1026
1027 /* check simple case, only one product */
1028 rc = RegEnumValueW( compkey, 1, squashed_prod, &sz, NULL, NULL, NULL, NULL );
1029 if (rc == ERROR_NO_MORE_ITEMS)
1030 {
1031 rc = ERROR_SUCCESS;
1032 goto done;
1033 }
1034
1035 index = 0;
1036 while ((rc = RegEnumValueW( compkey, index, squashed_prod, &sz, NULL, NULL, NULL, NULL )) !=
1038 {
1039 index++;
1040 sz = GUID_SIZE;
1041 unsquash_guid( squashed_prod, szBuffer );
1042
1043 if (MSIREG_OpenProductKey(szBuffer, NULL,
1045 &prodkey, FALSE) == ERROR_SUCCESS ||
1046 MSIREG_OpenProductKey(szBuffer, NULL,
1048 &prodkey, FALSE) == ERROR_SUCCESS ||
1049 MSIREG_OpenProductKey(szBuffer, NULL,
1051 &prodkey, FALSE) == ERROR_SUCCESS)
1052 {
1053 RegCloseKey(prodkey);
1054 rc = ERROR_SUCCESS;
1055 goto done;
1056 }
1057 }
1058
1060
1061done:
1062 RegCloseKey(compkey);
1063 unsquash_guid( squashed_prod, szBuffer );
1064 return rc;
1065}
LONG WINAPI RegEnumValueW(_In_ HKEY hKey, _In_ DWORD index, _Out_ LPWSTR value, _Inout_ PDWORD val_count, _Reserved_ PDWORD reserved, _Out_opt_ PDWORD type, _Out_opt_ LPBYTE data, _Inout_opt_ PDWORD count)
Definition: reg.c:2830
#define ERROR_INSTALL_FAILURE
Definition: winerror.h:961

Referenced by MsiGetProductCodeA(), and MsiLocateComponentW().

◆ MsiGetProductInfoA()

UINT WINAPI MsiGetProductInfoA ( LPCSTR  szProduct,
LPCSTR  szAttribute,
LPSTR  szBuffer,
LPDWORD  pcchValueBuf 
)

Definition at line 1254 of file msi.c.

1256{
1257 LPWSTR szwProduct, szwAttribute = NULL;
1260
1261 TRACE("%s %s %p %p\n", debugstr_a(szProduct), debugstr_a(szAttribute),
1262 szBuffer, pcchValueBuf);
1263
1264 szwProduct = strdupAtoW( szProduct );
1265 if( szProduct && !szwProduct )
1266 goto end;
1267
1268 szwAttribute = strdupAtoW( szAttribute );
1269 if( szAttribute && !szwAttribute )
1270 goto end;
1271
1272 buffer.unicode = FALSE;
1273 buffer.str.a = szBuffer;
1274
1275 r = MSI_GetProductInfo( szwProduct, szwAttribute,
1276 &buffer, pcchValueBuf );
1277
1278end:
1279 free( szwProduct );
1280 free( szwAttribute );
1281
1282 return r;
1283}
static UINT MSI_GetProductInfo(LPCWSTR szProduct, LPCWSTR szAttribute, awstring *szValue, LPDWORD pcchValueBuf)
Definition: msi.c:1088

Referenced by test_null(), test_simple_patch(), and test_states().

◆ MsiGetProductInfoExA()

UINT WINAPI MsiGetProductInfoExA ( LPCSTR  szProductCode,
LPCSTR  szUserSid,
MSIINSTALLCONTEXT  dwContext,
LPCSTR  szProperty,
LPSTR  szValue,
LPDWORD  pcchValue 
)

Definition at line 1300 of file msi.c.

1303{
1304 LPWSTR product = NULL;
1305 LPWSTR usersid = NULL;
1306 LPWSTR property = NULL;
1307 LPWSTR value = NULL;
1308 DWORD len = 0;
1309 UINT r;
1310
1311 TRACE("(%s, %s, %d, %s, %p, %p)\n", debugstr_a(szProductCode),
1312 debugstr_a(szUserSid), dwContext, debugstr_a(szProperty),
1313 szValue, pcchValue);
1314
1315 if (szValue && !pcchValue)
1317
1318 if (szProductCode) product = strdupAtoW(szProductCode);
1319 if (szUserSid) usersid = strdupAtoW(szUserSid);
1320 if (szProperty) property = strdupAtoW(szProperty);
1321
1322 r = MsiGetProductInfoExW(product, usersid, dwContext, property,
1323 NULL, &len);
1324 if (r != ERROR_SUCCESS)
1325 goto done;
1326
1327 value = malloc(++len * sizeof(WCHAR));
1328 if (!value)
1329 {
1331 goto done;
1332 }
1333
1334 r = MsiGetProductInfoExW(product, usersid, dwContext, property,
1335 value, &len);
1336 if (r != ERROR_SUCCESS)
1337 goto done;
1338
1339 if (!pcchValue)
1340 goto done;
1341
1342 len = WideCharToMultiByte(CP_ACP, 0, value, -1, NULL, 0, NULL, NULL);
1343 if (*pcchValue >= len)
1344 WideCharToMultiByte(CP_ACP, 0, value, -1, szValue, len, NULL, NULL);
1345 else if (szValue)
1346 {
1348 if (*pcchValue > 0)
1349 *szValue = '\0';
1350 }
1351
1352 if (*pcchValue <= len || !szValue)
1353 len = len * sizeof(WCHAR) - 1;
1354
1355 *pcchValue = len - 1;
1356
1357done:
1358 free(product);
1359 free(usersid);
1360 free(property);
1361 free(value);
1362
1363 return r;
1364}
UINT WINAPI MsiGetProductInfoExW(LPCWSTR szProductCode, LPCWSTR szUserSid, MSIINSTALLCONTEXT dwContext, LPCWSTR szProperty, LPWSTR szValue, LPDWORD pcchValue)
Definition: msi.c:1391
Definition: pdh_main.c:94

Referenced by test_MsiGetProductInfoEx().

◆ MsiGetProductInfoExW()

UINT WINAPI MsiGetProductInfoExW ( LPCWSTR  szProductCode,
LPCWSTR  szUserSid,
MSIINSTALLCONTEXT  dwContext,
LPCWSTR  szProperty,
LPWSTR  szValue,
LPDWORD  pcchValue 
)

Definition at line 1391 of file msi.c.

1394{
1395 WCHAR *val = NULL, squashed_pc[SQUASHED_GUID_SIZE];
1396 LPCWSTR package = NULL;
1397 HKEY props = NULL, prod, classes = NULL, managed, hkey = NULL;
1398 DWORD type;
1400
1401 TRACE("(%s, %s, %d, %s, %p, %p)\n", debugstr_w(szProductCode),
1402 debugstr_w(szUserSid), dwContext, debugstr_w(szProperty),
1403 szValue, pcchValue);
1404
1405 if (!szProductCode || !squash_guid( szProductCode, squashed_pc ))
1407
1408 if (szValue && !pcchValue)
1410
1411 if (dwContext != MSIINSTALLCONTEXT_USERUNMANAGED &&
1412 dwContext != MSIINSTALLCONTEXT_USERMANAGED &&
1413 dwContext != MSIINSTALLCONTEXT_MACHINE)
1415
1416 if (!szProperty || !*szProperty)
1418
1419 if (dwContext == MSIINSTALLCONTEXT_MACHINE && szUserSid)
1421
1422 /* FIXME: dwContext is provided, no need to search for it */
1424 &managed, FALSE);
1426 &prod, FALSE);
1427
1428 MSIREG_OpenInstallProps(szProductCode, dwContext, NULL, &props, FALSE);
1429
1430 if (dwContext == MSIINSTALLCONTEXT_USERUNMANAGED)
1431 {
1432 package = INSTALLPROPERTY_LOCALPACKAGEW;
1433
1434 if (!props && !prod)
1435 goto done;
1436 }
1437 else if (dwContext == MSIINSTALLCONTEXT_USERMANAGED)
1438 {
1439 package = L"ManagedLocalPackage";
1440
1441 if (!props && !managed)
1442 goto done;
1443 }
1444 else if (dwContext == MSIINSTALLCONTEXT_MACHINE)
1445 {
1446 package = INSTALLPROPERTY_LOCALPACKAGEW;
1447 MSIREG_OpenProductKey(szProductCode, NULL, dwContext, &classes, FALSE);
1448
1449 if (!props && !classes)
1450 goto done;
1451 }
1452
1453 if (!wcscmp( szProperty, INSTALLPROPERTY_HELPLINKW ) ||
1454 !wcscmp( szProperty, INSTALLPROPERTY_HELPTELEPHONEW ) ||
1455 !wcscmp( szProperty, INSTALLPROPERTY_INSTALLDATEW ) ||
1457 !wcscmp( szProperty, INSTALLPROPERTY_INSTALLLOCATIONW ) ||
1458 !wcscmp( szProperty, INSTALLPROPERTY_INSTALLSOURCEW ) ||
1459 !wcscmp( szProperty, INSTALLPROPERTY_LOCALPACKAGEW ) ||
1460 !wcscmp( szProperty, INSTALLPROPERTY_PUBLISHERW ) ||
1461 !wcscmp( szProperty, INSTALLPROPERTY_URLINFOABOUTW ) ||
1462 !wcscmp( szProperty, INSTALLPROPERTY_URLUPDATEINFOW ) ||
1463 !wcscmp( szProperty, INSTALLPROPERTY_VERSIONMINORW ) ||
1464 !wcscmp( szProperty, INSTALLPROPERTY_VERSIONMAJORW ) ||
1465 !wcscmp( szProperty, INSTALLPROPERTY_VERSIONSTRINGW ) ||
1466 !wcscmp( szProperty, INSTALLPROPERTY_PRODUCTIDW ) ||
1467 !wcscmp( szProperty, INSTALLPROPERTY_REGCOMPANYW ) ||
1468 !wcscmp( szProperty, INSTALLPROPERTY_REGOWNERW ) ||
1469 !wcscmp( szProperty, INSTALLPROPERTY_INSTANCETYPEW ))
1470 {
1471 val = reg_get_value(props, package, &type);
1472 if (!val)
1473 {
1474 if (prod || classes)
1476
1477 goto done;
1478 }
1479
1480 free(val);
1481
1483 szProperty = L"DisplayName";
1484 else if (!wcscmp( szProperty, INSTALLPROPERTY_VERSIONSTRINGW ))
1485 szProperty = L"DisplayVersion";
1486
1487 val = reg_get_value(props, szProperty, &type);
1488 if (!val)
1489 val = wcsdup(L"");
1490
1491 r = copy_outval(val, szValue, pcchValue);
1492 }
1493 else if (!wcscmp( szProperty, INSTALLPROPERTY_TRANSFORMSW ) ||
1494 !wcscmp( szProperty, INSTALLPROPERTY_LANGUAGEW ) ||
1495 !wcscmp( szProperty, INSTALLPROPERTY_PRODUCTNAMEW ) ||
1496 !wcscmp( szProperty, INSTALLPROPERTY_PACKAGECODEW ) ||
1497 !wcscmp( szProperty, INSTALLPROPERTY_VERSIONW ) ||
1498 !wcscmp( szProperty, INSTALLPROPERTY_PRODUCTICONW ) ||
1499 !wcscmp( szProperty, INSTALLPROPERTY_PACKAGENAMEW ) ||
1501 {
1502 if (!prod && !classes)
1503 goto done;
1504
1505 if (dwContext == MSIINSTALLCONTEXT_USERUNMANAGED)
1506 hkey = prod;
1507 else if (dwContext == MSIINSTALLCONTEXT_USERMANAGED)
1508 hkey = managed;
1509 else if (dwContext == MSIINSTALLCONTEXT_MACHINE)
1510 hkey = classes;
1511
1512 val = reg_get_value(hkey, szProperty, &type);
1513 if (!val)
1514 val = wcsdup(L"");
1515
1516 r = copy_outval(val, szValue, pcchValue);
1517 }
1518 else if (!wcscmp( szProperty, INSTALLPROPERTY_PRODUCTSTATEW ))
1519 {
1520 if (dwContext == MSIINSTALLCONTEXT_MACHINE)
1521 {
1522 if (props)
1523 {
1524 val = reg_get_value(props, package, &type);
1525 if (!val)
1526 goto done;
1527
1528 free(val);
1529 val = wcsdup(