Hans Leidekker : msi: Import mspatcha instead of loading it dynamically.

Alexandre Julliard julliard at wine.codeweavers.com
Wed Apr 1 10:40:59 CDT 2015


Module: wine
Branch: master
Commit: 2acc11c215c822fac348459aca74a0439ee8a60d
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=2acc11c215c822fac348459aca74a0439ee8a60d

Author: Hans Leidekker <hans at codeweavers.com>
Date:   Wed Apr  1 12:24:57 2015 +0200

msi: Import mspatcha instead of loading it dynamically.

---

 configure                 |  2 +-
 configure.ac              |  2 +-
 dlls/msi/Makefile.in      |  2 +-
 dlls/msi/files.c          | 38 +-------------------------------------
 dlls/mspatcha/Makefile.in |  3 ++-
 5 files changed, 6 insertions(+), 41 deletions(-)

diff --git a/configure b/configure
index 4596844..3b8dfb1 100755
--- a/configure
+++ b/configure
@@ -17372,7 +17372,7 @@ wine_fn_config_dll msisip enable_msisip
 wine_fn_config_dll msisys.ocx enable_msisys_ocx
 wine_fn_config_dll msls31 enable_msls31
 wine_fn_config_dll msnet32 enable_msnet32
-wine_fn_config_dll mspatcha enable_mspatcha
+wine_fn_config_dll mspatcha enable_mspatcha implib
 wine_fn_config_dll msrle32 enable_msrle32 po
 wine_fn_config_test dlls/msrle32/tests msrle32_test
 wine_fn_config_dll mssign32 enable_mssign32
diff --git a/configure.ac b/configure.ac
index 1fc7873..688ab26 100644
--- a/configure.ac
+++ b/configure.ac
@@ -3074,7 +3074,7 @@ WINE_CONFIG_DLL(msisip)
 WINE_CONFIG_DLL(msisys.ocx)
 WINE_CONFIG_DLL(msls31)
 WINE_CONFIG_DLL(msnet32)
-WINE_CONFIG_DLL(mspatcha)
+WINE_CONFIG_DLL(mspatcha,,[implib])
 WINE_CONFIG_DLL(msrle32,,[po])
 WINE_CONFIG_TEST(dlls/msrle32/tests)
 WINE_CONFIG_DLL(mssign32)
diff --git a/dlls/msi/Makefile.in b/dlls/msi/Makefile.in
index f355e33..79704ad 100644
--- a/dlls/msi/Makefile.in
+++ b/dlls/msi/Makefile.in
@@ -1,7 +1,7 @@
 MODULE    = msi.dll
 IMPORTLIB = msi
 IMPORTS   = uuid urlmon wininet comctl32 shell32 shlwapi cabinet oleaut32 ole32 version user32 gdi32 advapi32
-DELAYIMPORTS = odbccp32 wintrust crypt32 imagehlp
+DELAYIMPORTS = odbccp32 wintrust crypt32 imagehlp mspatcha
 
 C_SRCS = \
 	action.c \
diff --git a/dlls/msi/files.c b/dlls/msi/files.c
index 40cc3f6..dff00df 100644
--- a/dlls/msi/files.c
+++ b/dlls/msi/files.c
@@ -43,13 +43,11 @@
 #include "winuser.h"
 #include "winreg.h"
 #include "shlwapi.h"
+#include "patchapi.h"
 #include "wine/unicode.h"
 
 WINE_DEFAULT_DEBUG_CHANNEL(msi);
 
-static HMODULE hmspatcha;
-static BOOL (WINAPI *ApplyPatchToFileW)(LPCWSTR, LPCWSTR, LPCWSTR, ULONG);
-
 static void msi_file_update_ui( MSIPACKAGE *package, MSIFILE *f, const WCHAR *action )
 {
     MSIRECORD *uirow;
@@ -438,30 +436,6 @@ done:
     return rc;
 }
 
-static BOOL load_mspatcha(void)
-{
-    hmspatcha = LoadLibraryA("mspatcha.dll");
-    if (!hmspatcha)
-    {
-        ERR("Failed to load mspatcha.dll: %d\n", GetLastError());
-        return FALSE;
-    }
-
-    ApplyPatchToFileW = (void*)GetProcAddress(hmspatcha, "ApplyPatchToFileW");
-    if(!ApplyPatchToFileW)
-    {
-        ERR("GetProcAddress(ApplyPatchToFileW) failed: %d.\n", GetLastError());
-        return FALSE;
-    }
-
-    return TRUE;
-}
-
-static void unload_mspatch(void)
-{
-    FreeLibrary(hmspatcha);
-}
-
 static MSIFILEPATCH *get_next_filepatch( MSIPACKAGE *package, const WCHAR *key )
 {
     MSIFILEPATCH *patch;
@@ -525,7 +499,6 @@ UINT ACTION_PatchFiles( MSIPACKAGE *package )
     MSIFILEPATCH *patch;
     MSIMEDIAINFO *mi;
     UINT rc = ERROR_SUCCESS;
-    BOOL mspatcha_loaded = FALSE;
 
     TRACE("%p\n", package);
 
@@ -557,13 +530,6 @@ UINT ACTION_PatchFiles( MSIPACKAGE *package )
                 goto done;
             }
 
-            if (!mspatcha_loaded && !load_mspatcha())
-            {
-                rc = ERROR_FUNCTION_FAILED;
-                goto done;
-            }
-            mspatcha_loaded = TRUE;
-
             data.mi = mi;
             data.package = package;
             data.cb = patchfiles_cb;
@@ -587,8 +553,6 @@ UINT ACTION_PatchFiles( MSIPACKAGE *package )
 
 done:
     msi_free_media_info(mi);
-    if (mspatcha_loaded)
-        unload_mspatch();
     return rc;
 }
 
diff --git a/dlls/mspatcha/Makefile.in b/dlls/mspatcha/Makefile.in
index b1ddb50..bd0da7d 100644
--- a/dlls/mspatcha/Makefile.in
+++ b/dlls/mspatcha/Makefile.in
@@ -1,4 +1,5 @@
-MODULE = mspatcha.dll
+MODULE    = mspatcha.dll
+IMPORTLIB = mspatcha
 
 C_SRCS = \
 	mspatcha_main.c




More information about the wine-cvs mailing list