Alexandre Julliard : wintab32: Retrieve the graphics driver name from the registry.

Alexandre Julliard julliard at winehq.org
Tue Oct 22 13:30:42 CDT 2013


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

Author: Alexandre Julliard <julliard at winehq.org>
Date:   Tue Oct 22 16:16:09 2013 +0200

wintab32: Retrieve the graphics driver name from the registry.

---

 dlls/wintab32/Makefile.in |    2 +-
 dlls/wintab32/wintab32.c  |   40 +++++++++++++++++++++++++++++++++++-----
 2 files changed, 36 insertions(+), 6 deletions(-)

diff --git a/dlls/wintab32/Makefile.in b/dlls/wintab32/Makefile.in
index ab71e45..7c265b4 100644
--- a/dlls/wintab32/Makefile.in
+++ b/dlls/wintab32/Makefile.in
@@ -1,6 +1,6 @@
 MODULE    = wintab32.dll
 IMPORTLIB = wintab32
-IMPORTS   = user32 gdi32
+IMPORTS   = user32 advapi32
 
 C_SRCS = \
 	context.c \
diff --git a/dlls/wintab32/wintab32.c b/dlls/wintab32/wintab32.c
index 0633ea8..3037963 100644
--- a/dlls/wintab32/wintab32.c
+++ b/dlls/wintab32/wintab32.c
@@ -22,13 +22,14 @@
 
 #include "windef.h"
 #include "winbase.h"
+#include "winreg.h"
 #include "wingdi.h"
 #include "winuser.h"
 #include "winerror.h"
 #define NOFIX32
 #include "wintab.h"
 #include "wintab_internal.h"
-#include "wine/gdi_driver.h"
+#include "wine/unicode.h"
 #include "wine/debug.h"
 
 WINE_DEFAULT_DEBUG_CHANNEL(wintab32);
@@ -71,6 +72,38 @@ static VOID TABLET_Unregister(void)
     UnregisterClassW(WC_TABLETCLASSNAME, NULL);
 }
 
+static HMODULE load_graphics_driver(void)
+{
+    static const WCHAR display_device_guid_propW[] = {
+        '_','_','w','i','n','e','_','d','i','s','p','l','a','y','_',
+        'd','e','v','i','c','e','_','g','u','i','d',0 };
+    static const WCHAR key_pathW[] = {
+        'S','y','s','t','e','m','\\',
+        'C','u','r','r','e','n','t','C','o','n','t','r','o','l','S','e','t','\\',
+        'C','o','n','t','r','o','l','\\',
+        'V','i','d','e','o','\\','{',0};
+    static const WCHAR displayW[] = {'}','\\','0','0','0','0',0};
+    static const WCHAR driverW[] = {'G','r','a','p','h','i','c','s','D','r','i','v','e','r',0};
+
+    HMODULE ret = 0;
+    HKEY hkey;
+    DWORD size;
+    WCHAR path[MAX_PATH];
+    WCHAR key[(sizeof(key_pathW) + sizeof(displayW)) / sizeof(WCHAR) + 40];
+    UINT guid_atom = HandleToULong( GetPropW( GetDesktopWindow(), display_device_guid_propW ));
+
+    if (!guid_atom) return 0;
+    memcpy( key, key_pathW, sizeof(key_pathW) );
+    if (!GlobalGetAtomNameW( guid_atom, key + strlenW(key), 40 )) return 0;
+    strcatW( key, displayW );
+    if (RegOpenKeyW( HKEY_LOCAL_MACHINE, key, &hkey )) return 0;
+    size = sizeof(path);
+    if (!RegQueryValueExW( hkey, driverW, NULL, NULL, (BYTE *)path, &size )) ret = LoadLibraryW( path );
+    RegCloseKey( hkey );
+    TRACE( "%s %p\n", debugstr_w(path), ret );
+    return ret;
+}
+
 BOOL WINAPI DllMain(HINSTANCE hInstDLL, DWORD fdwReason, LPVOID lpReserved)
 {
     static const WCHAR name[] = {'T','a','b','l','e','t',0};
@@ -86,14 +119,11 @@ BOOL WINAPI DllMain(HINSTANCE hInstDLL, DWORD fdwReason, LPVOID lpReserved)
                                         WS_POPUPWINDOW,0,0,0,0,0,0,hInstDLL,0);
             if (hwndDefault)
             {
-                HDC hdc = GetDC( hwndDefault );
-                HMODULE module = __wine_get_driver_module( hdc );
-
+                HMODULE module = load_graphics_driver();
                 pLoadTabletInfo = (void *)GetProcAddress(module, "LoadTabletInfo");
                 pAttachEventQueueToTablet = (void *)GetProcAddress(module, "AttachEventQueueToTablet");
                 pGetCurrentPacket = (void *)GetProcAddress(module, "GetCurrentPacket");
                 pWTInfoW = (void *)GetProcAddress(module, "WTInfoW");
-                ReleaseDC( hwndDefault, hdc );
             }
             else
                 return FALSE;




More information about the wine-cvs mailing list