Zebediah Figura : setupapi: Link directly to cabinet.
Alexandre Julliard
julliard at winehq.org
Fri Mar 5 15:31:15 CST 2021
Module: wine
Branch: master
Commit: ad59a006ac9839c8bd29e4c4c6b80e6fc736136d
URL: https://source.winehq.org/git/wine.git/?a=commit;h=ad59a006ac9839c8bd29e4c4c6b80e6fc736136d
Author: Zebediah Figura <z.figura12 at gmail.com>
Date: Thu Mar 4 20:08:14 2021 -0600
setupapi: Link directly to cabinet.
Signed-off-by: Zebediah Figura <z.figura12 at gmail.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
---
dlls/setupapi/Makefile.in | 2 +-
dlls/setupapi/setupcab.c | 36 +++---------------------------------
2 files changed, 4 insertions(+), 34 deletions(-)
diff --git a/dlls/setupapi/Makefile.in b/dlls/setupapi/Makefile.in
index 539bfed0caa..70ffd23d245 100644
--- a/dlls/setupapi/Makefile.in
+++ b/dlls/setupapi/Makefile.in
@@ -2,7 +2,7 @@ EXTRADEFS = -D_SETUPAPI_
MODULE = setupapi.dll
IMPORTLIB = setupapi
IMPORTS = uuid version advapi32 rpcrt4 kernelbase
-DELAYIMPORTS = shell32 wintrust ole32 winspool.drv comdlg32 user32
+DELAYIMPORTS = cabinet shell32 wintrust ole32 winspool.drv comdlg32 user32
EXTRADLLFLAGS = -mno-cygwin
diff --git a/dlls/setupapi/setupcab.c b/dlls/setupapi/setupcab.c
index 55d0fe6f64c..02245a10b7f 100644
--- a/dlls/setupapi/setupcab.c
+++ b/dlls/setupapi/setupcab.c
@@ -63,17 +63,8 @@
OSVERSIONINFOW OsVersionInfo;
-static HINSTANCE CABINET_hInstance = 0;
HINSTANCE SETUPAPI_hInstance = 0;
-static HFDI (__cdecl *sc_FDICreate)(PFNALLOC, PFNFREE, PFNOPEN,
- PFNREAD, PFNWRITE, PFNCLOSE, PFNSEEK, int, PERF);
-
-static BOOL (__cdecl *sc_FDICopy)(HFDI, char *, char *, int,
- PFNFDINOTIFY, PFNFDIDECRYPT, void *);
-
-static BOOL (__cdecl *sc_FDIDestroy)(HFDI);
-
#define SC_HSC_A_MAGIC 0xACABFEED
typedef struct {
UINT magic;
@@ -86,23 +77,6 @@ typedef struct {
WINE_DEFAULT_DEBUG_CHANNEL(setupapi);
-static BOOL LoadCABINETDll(void)
-{
- if (!CABINET_hInstance) {
- CABINET_hInstance = LoadLibraryA("cabinet.dll");
- if (CABINET_hInstance) {
- sc_FDICreate = (void *)GetProcAddress(CABINET_hInstance, "FDICreate");
- sc_FDICopy = (void *)GetProcAddress(CABINET_hInstance, "FDICopy");
- sc_FDIDestroy = (void *)GetProcAddress(CABINET_hInstance, "FDIDestroy");
- return TRUE;
- } else {
- ERR("load cabinet dll failed.\n");
- return FALSE;
- }
- } else
- return TRUE;
-}
-
/* FDICreate callbacks */
static void * CDECL sc_cb_alloc(ULONG cb)
@@ -392,9 +366,6 @@ BOOL WINAPI SetupIterateCabinetA(PCSTR CabinetFile, DWORD Reserved,
TRACE("(CabinetFile == %s, Reserved == %u, MsgHandler == ^%p, Context == ^%p)\n",
debugstr_a(CabinetFile), Reserved, MsgHandler, Context);
- if (!LoadCABINETDll())
- return FALSE;
-
if (!CabinetFile)
{
SetLastError(ERROR_INVALID_PARAMETER);
@@ -429,14 +400,14 @@ BOOL WINAPI SetupIterateCabinetA(PCSTR CabinetFile, DWORD Reserved,
my_hsc.magic = SC_HSC_A_MAGIC;
my_hsc.msghandler = MsgHandler;
my_hsc.context = Context;
- my_hsc.hfdi = sc_FDICreate( sc_cb_alloc, sc_cb_free, sc_cb_open, sc_cb_read,
+ my_hsc.hfdi = FDICreate( sc_cb_alloc, sc_cb_free, sc_cb_open, sc_cb_read,
sc_cb_write, sc_cb_close, sc_cb_lseek, cpuUNKNOWN, &erf );
if (!my_hsc.hfdi) return FALSE;
- ret = sc_FDICopy(my_hsc.hfdi, pszCabinet, pszCabPath, 0, sc_FNNOTIFY_A, NULL, &my_hsc);
+ ret = FDICopy(my_hsc.hfdi, pszCabinet, pszCabPath, 0, sc_FNNOTIFY_A, NULL, &my_hsc);
- sc_FDIDestroy(my_hsc.hfdi);
+ FDIDestroy(my_hsc.hfdi);
return ret;
}
@@ -572,7 +543,6 @@ BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved)
case DLL_PROCESS_DETACH:
if (lpvReserved) break;
SetupCloseLog();
- if (CABINET_hInstance) FreeLibrary(CABINET_hInstance);
break;
}
More information about the wine-cvs
mailing list