Alexandre Julliard : localspl: Use --prefer-native instead of DLL_WINE_PREATTACH.

Alexandre Julliard julliard at winehq.org
Fri Feb 26 14:39:28 CST 2021


Module: wine
Branch: master
Commit: ade15558dbb87fbceb3e59fc9385ebf86a928723
URL:    https://source.winehq.org/git/wine.git/?a=commit;h=ade15558dbb87fbceb3e59fc9385ebf86a928723

Author: Alexandre Julliard <julliard at winehq.org>
Date:   Fri Feb 26 11:40:32 2021 +0100

localspl: Use --prefer-native instead of DLL_WINE_PREATTACH.

Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/localspl/Makefile.in        |  3 +--
 dlls/localspl/localmon.c         | 18 +++++++++++++
 dlls/localspl/localspl_main.c    | 55 ----------------------------------------
 dlls/localspl/localspl_private.h |  4 ---
 dlls/localspl/provider.c         | 16 +++---------
 5 files changed, 22 insertions(+), 74 deletions(-)

diff --git a/dlls/localspl/Makefile.in b/dlls/localspl/Makefile.in
index abff68a499b..4b0ec9509d0 100644
--- a/dlls/localspl/Makefile.in
+++ b/dlls/localspl/Makefile.in
@@ -1,11 +1,10 @@
 MODULE    = localspl.dll
 IMPORTS   = spoolss user32 advapi32
 
-EXTRADLLFLAGS = -mno-cygwin
+EXTRADLLFLAGS = -mno-cygwin -Wb,--prefer-native
 
 C_SRCS = \
 	localmon.c \
-	localspl_main.c \
 	provider.c
 
 RC_SRCS = localspl.rc
diff --git a/dlls/localspl/localmon.c b/dlls/localspl/localmon.c
index 19a74566503..d4346505319 100644
--- a/dlls/localspl/localmon.c
+++ b/dlls/localspl/localmon.c
@@ -81,6 +81,24 @@ static struct list xcv_handles = LIST_INIT( xcv_handles );
 static const WCHAR WinNT_CV_PortsW[] = L"Software\\Microsoft\\Windows NT\\CurrentVersion\\Ports";
 static const WCHAR WinNT_CV_WindowsW[] = L"Software\\Microsoft\\Windows NT\\CurrentVersion\\Windows";
 
+static HINSTANCE LOCALSPL_hInstance;
+
+/*****************************************************
+ *      DllMain
+ */
+BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved)
+{
+    TRACE("(%p, %d, %p)\n",hinstDLL, fdwReason, lpvReserved);
+
+    switch(fdwReason)
+    {
+        case DLL_PROCESS_ATTACH:
+            DisableThreadLibraryCalls( hinstDLL );
+            LOCALSPL_hInstance = hinstDLL;
+            break;
+    }
+    return TRUE;
+}
 
 /******************************************************************
  * does_port_exist (internal)
diff --git a/dlls/localspl/localspl_main.c b/dlls/localspl/localspl_main.c
deleted file mode 100644
index 48db9c31a6f..00000000000
--- a/dlls/localspl/localspl_main.c
+++ /dev/null
@@ -1,55 +0,0 @@
-/*
- * Implementation of the Local Printprovider/ Printmonitor/ Prontprocessor
- *
- * Copyright 2006-2009 Detlef Riekenberg
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
- */
-
-#include <stdarg.h>
-
-#define COBJMACROS
-
-#include "windef.h"
-#include "winbase.h"
-
-#include "wine/debug.h"
-#include "localspl_private.h"
-
-WINE_DEFAULT_DEBUG_CHANNEL(localspl);
-
-
-HINSTANCE LOCALSPL_hInstance = NULL;
-
-/*****************************************************
- *      DllMain
- */
-BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved)
-{
-    TRACE("(%p, %d, %p)\n",hinstDLL, fdwReason, lpvReserved);
-
-    switch(fdwReason)
-    {
-        case DLL_WINE_PREATTACH:
-            return FALSE;           /* prefer native version */
-
-        case DLL_PROCESS_ATTACH:
-            DisableThreadLibraryCalls( hinstDLL );
-            LOCALSPL_hInstance = hinstDLL;
-            setup_provider();
-            break;
-    }
-    return TRUE;
-}
diff --git a/dlls/localspl/localspl_private.h b/dlls/localspl/localspl_private.h
index f27005c16de..ed44b1413c9 100644
--- a/dlls/localspl/localspl_private.h
+++ b/dlls/localspl/localspl_private.h
@@ -23,10 +23,6 @@
 
 #include <windef.h>
 
-/* ## DLL-wide Globals ## */
-extern HINSTANCE LOCALSPL_hInstance DECLSPEC_HIDDEN;
-void setup_provider(void) DECLSPEC_HIDDEN;
-
 /* ## Resource-ID ## */
 #define IDS_LOCALPORT       500
 #define IDS_LOCALMONITOR    507
diff --git a/dlls/localspl/provider.c b/dlls/localspl/provider.c
index 93a457ab0ba..7dde72d323d 100644
--- a/dlls/localspl/provider.c
+++ b/dlls/localspl/provider.c
@@ -99,8 +99,6 @@ typedef struct {
 static struct list monitor_handles = LIST_INIT( monitor_handles );
 static monitor_t * pm_localport;
 
-static const PRINTPROVIDOR * pprovider = NULL;
-
 static const WCHAR fmt_driversW[] =
     L"System\\CurrentControlSet\\control\\Print\\Environments\\%s\\Drivers%s";
 static const WCHAR fmt_printprocessorsW[] =
@@ -2508,12 +2506,7 @@ static BOOL WINAPI fpXcvData(HANDLE hXcv, LPCWSTR pszDataName, PBYTE pInputData,
     return TRUE;
 }
 
-/*****************************************************
- *  setup_provider [internal]
- */
-void setup_provider(void)
-{
-    static const PRINTPROVIDOR backend = {
+static const PRINTPROVIDOR backend = {
         fpOpenPrinter,
         NULL,   /* fpSetJob */
         NULL,   /* fpGetJob */
@@ -2600,10 +2593,7 @@ void setup_provider(void)
         NULL,   /* fpFlushPrinter */
         NULL,   /* fpSendRecvBidiData */
         NULL    /* fpAddDriverCatalog */
-    };
-    pprovider = &backend;
-
-}
+};
 
 /*****************************************************
  * InitializePrintProvidor     (localspl.@)
@@ -2631,7 +2621,7 @@ BOOL WINAPI InitializePrintProvidor(LPPRINTPROVIDOR pPrintProvidor,
 {
 
     TRACE("(%p, %u, %s)\n", pPrintProvidor, cbPrintProvidor, debugstr_w(pFullRegistryPath));
-    memcpy(pPrintProvidor, pprovider,
+    memcpy(pPrintProvidor, &backend,
           (cbPrintProvidor < sizeof(PRINTPROVIDOR)) ? cbPrintProvidor : sizeof(PRINTPROVIDOR));
 
     return TRUE;




More information about the wine-cvs mailing list