From bbc3974aa56c945d9607af237bc94fd59d815437 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Vincent=20B=C3=A9ron?= Date: Thu, 29 Jul 2004 02:39:20 +0000 Subject: [PATCH] Implement patching in msiexec. --- dlls/msi/msi.c | 12 ++++++++++++ dlls/msi/msi.spec | 4 ++-- include/msi.h | 10 ++++++++++ programs/msiexec/msiexec.c | 26 ++++++++++++++++++++++---- 4 files changed, 46 insertions(+), 6 deletions(-) diff --git a/dlls/msi/msi.c b/dlls/msi/msi.c index 6be45e37774..eec2cd8dc2e 100644 --- a/dlls/msi/msi.c +++ b/dlls/msi/msi.c @@ -573,6 +573,18 @@ UINT WINAPI MsiReinstallProductW(LPCWSTR szProduct, DWORD dwReinstallMode) return ERROR_CALL_NOT_IMPLEMENTED; } +UINT WINAPI MsiApplyPatchA(LPCSTR szPatchPackage, LPCSTR szInstallPackage, INSTALLTYPE eInstallType, LPCSTR szCommandLine) +{ + FIXME("%s %s %d %s\n", debugstr_a(szPatchPackage), debugstr_a(szInstallPackage), eInstallType, debugstr_a(szCommandLine)); + return ERROR_CALL_NOT_IMPLEMENTED; +} + +UINT WINAPI MsiApplyPatchW(LPCWSTR szPatchPackage, LPCWSTR szInstallPackage, INSTALLTYPE eInstallType, LPCWSTR szCommandLine) +{ + FIXME("%s %s %d %s\n", debugstr_w(szPatchPackage), debugstr_w(szInstallPackage), eInstallType, debugstr_w(szCommandLine)); + return ERROR_CALL_NOT_IMPLEMENTED; +} + UINT WINAPI MsiConfigureProductA(LPCSTR szProduct, int iInstallLevel, INSTALLSTATE eInstallState) { LPWSTR szwProduct = NULL; diff --git a/dlls/msi/msi.spec b/dlls/msi/msi.spec index 8bc8cf26a02..617bdec2832 100644 --- a/dlls/msi/msi.spec +++ b/dlls/msi/msi.spec @@ -171,8 +171,8 @@ 171 stdcall MsiFormatRecordW(long long ptr ptr) 172 stdcall MsiGetComponentPathA(str str ptr ptr) 173 stdcall MsiGetComponentPathW(wstr wstr ptr ptr) -174 stub MsiApplyPatchA -175 stub MsiApplyPatchW +174 stdcall MsiApplyPatchA(str str long str) +175 stdcall MsiApplyPatchW(wstr wstr long wstr) 176 stub MsiAdvertiseScriptA 177 stub MsiAdvertiseScriptW 178 stub MsiGetPatchInfoA diff --git a/include/msi.h b/include/msi.h index 6b5538e28e5..f461e998c7f 100644 --- a/include/msi.h +++ b/include/msi.h @@ -129,6 +129,12 @@ typedef enum tagADVERTISEFLAGS ADVERTISEFLAGS_USERASSIGN = 1 } ADVERTISEFLAGS; +typedef enum tagINSTALLTYPE +{ + INSTALLTYPE_DEFAULT = 0, + INSTALLTYPE_NETWORK_IMAGE = 1 +} INSTALLTYPE; + #define MAX_FEATURE_CHARS 38 typedef INT (CALLBACK *INSTALLUI_HANDLERA)(LPVOID pvContext, UINT iMessageType, @@ -148,6 +154,10 @@ UINT WINAPI MsiReinstallProductA(LPCSTR, DWORD); UINT WINAPI MsiReinstallProductW(LPCWSTR, DWORD); #define MsiReinstallProduct WINELIB_NAME_AW(MsiReinstallProduct) +UINT WINAPI MsiApplyPatchA(LPCSTR, LPCSTR, INSTALLTYPE, LPCSTR); +UINT WINAPI MsiApplyPatchW(LPCWSTR, LPCWSTR, INSTALLTYPE, LPCWSTR); +#define MsiApplyPatch WINELIB_NAME_AW(MsiApplyPatch) + UINT WINAPI MsiEnumProductsA(DWORD index, LPSTR lpguid); UINT WINAPI MsiEnumProductsW(DWORD index, LPWSTR lpguid); #define MsiEnumProducts WINELIB_NAME_AW(MsiEnumProducts) diff --git a/programs/msiexec/msiexec.c b/programs/msiexec/msiexec.c index c95f53e7040..8ed0cc928d8 100644 --- a/programs/msiexec/msiexec.c +++ b/programs/msiexec/msiexec.c @@ -43,8 +43,8 @@ static const char UsageStr[] = " msiexec /j[u|m] package [/t transform] [/g languageid]\n" " msiexec {u|m} package [/t transform] [/g languageid]\n" " Apply a patch:\n" -" msiexec /p patchpackage [property] (UNIMPLEMENTED)\n" -" msiexec /p patchpackage /a package [property] (UNIMPLEMENTED)\n" +" msiexec /p patchpackage [property]\n" +" msiexec /p patchpackage /a package [property]\n" " Modifiers for above operations:\n" " msiexec /l[*][i|w|e|a|r|u|c|m|o|p|v|][+|!] logfile\n" " msiexec /q{|n|b|r|f|n+|b+|b-}\n" @@ -149,8 +149,10 @@ int main(int argc, char *argv[]) { int i; BOOL FunctionInstall = FALSE; + BOOL FunctionInstallAdmin = FALSE; BOOL FunctionRepair = FALSE; BOOL FunctionAdvertise = FALSE; + BOOL FunctionPatch = FALSE; BOOL FunctionDllRegisterServer = FALSE; BOOL FunctionDllUnregisterServer = FALSE; @@ -170,6 +172,9 @@ int main(int argc, char *argv[]) LPSTR LogFileName = NULL; DWORD LogAttributes = 0; + LPSTR PatchFileName = NULL; + INSTALLTYPE InstallType = INSTALLTYPE_DEFAULT; + INSTALLUILEVEL InstallUILevel = 0, retInstallUILevel; LPSTR DllName = NULL; @@ -199,6 +204,8 @@ int main(int argc, char *argv[]) else if(!strcasecmp(argv[i], "/a")) { FunctionInstall = TRUE; + FunctionInstallAdmin = TRUE; + InstallType = INSTALLTYPE_NETWORK_IMAGE; i++; if(i >= argc) ShowUsage(1); @@ -486,12 +493,12 @@ int main(int argc, char *argv[]) } else if(!strcasecmp(argv[i], "/p")) { + FunctionPatch = TRUE; i++; if(i >= argc) ShowUsage(1); WINE_TRACE("argv[%d] = %s\n", i, argv[i]); - WINE_FIXME("Patching not yet implemented\n"); - ExitProcess(1); + PatchFileName = argv[i]; } else if(!strncasecmp(argv[i], "/q", 2)) { @@ -581,6 +588,9 @@ int main(int argc, char *argv[]) Transforms = TempStr; } + if(FunctionInstallAdmin && FunctionPatch) + FunctionInstall = FALSE; + if(FunctionInstall) { if(GotProductCode) @@ -621,6 +631,14 @@ int main(int argc, char *argv[]) ExitProcess(1); } } + else if(FunctionPatch) + { + if(MsiApplyPatchA(PatchFileName, PackageName, InstallType, Properties) != ERROR_SUCCESS) + { + fprintf(stderr, "Patching with %s (%s, %d, %s)\n", PatchFileName, PackageName, InstallType, Properties); + ExitProcess(1); + } + } else if(FunctionDllRegisterServer) { DllRegisterServer(DllName); -- 2.11.4.GIT