Alexandre Julliard : gdi32: Try to load the printer driver from the printer driver directory.

Alexandre Julliard julliard at winehq.org
Wed Mar 31 15:55:13 CDT 2021


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

Author: Alexandre Julliard <julliard at winehq.org>
Date:   Wed Mar 31 10:18:54 2021 +0200

gdi32: Try to load the printer driver from the printer driver directory.

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

---

 dlls/gdi32/driver.c | 22 +++++++++++++++++++++-
 1 file changed, 21 insertions(+), 1 deletion(-)

diff --git a/dlls/gdi32/driver.c b/dlls/gdi32/driver.c
index e146a3a4f85..09b051cd6fa 100644
--- a/dlls/gdi32/driver.c
+++ b/dlls/gdi32/driver.c
@@ -177,6 +177,18 @@ static void release_display_device_init_mutex( HANDLE mutex )
     CloseHandle( mutex );
 }
 
+#ifdef __i386__
+static const WCHAR printer_env[] = L"w32x86";
+#elif defined __x86_64__
+static const WCHAR printer_env[] = L"x64";
+#elif defined __arm__
+static const WCHAR printer_env[] = L"arm";
+#elif defined __aarch64__
+static const WCHAR printer_env[] = L"arm64";
+#else
+#error not defined for this cpu
+#endif
+
 /**********************************************************************
  *	     DRIVER_load_driver
  */
@@ -200,7 +212,15 @@ const struct gdi_dc_funcs *DRIVER_load_driver( LPCWSTR name )
         LeaveCriticalSection( &driver_section );
     }
 
-    if (!(module = LoadLibraryW( name ))) return NULL;
+    if (!(module = LoadLibraryW( name )))
+    {
+        WCHAR path[MAX_PATH];
+
+        GetSystemDirectoryW( path, MAX_PATH );
+        swprintf( path + wcslen(path), MAX_PATH - wcslen(path), L"\\spool\\drivers\\%s\\3\\%s",
+                  printer_env, name );
+        if (!(module = LoadLibraryW( path ))) return NULL;
+    }
 
     if (!(new_driver = create_driver( module )))
     {




More information about the wine-cvs mailing list