Bernhard Loos : winedevice: A driver path can also start with \systemroot\.

Alexandre Julliard julliard at winehq.org
Wed Nov 23 13:40:08 CST 2011


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

Author: Bernhard Loos <bernhardloos at googlemail.com>
Date:   Wed Nov 23 13:12:31 2011 +0100

winedevice: A driver path can also start with \systemroot\.

---

 programs/winedevice/device.c |   24 ++++++++++++++++++++----
 1 files changed, 20 insertions(+), 4 deletions(-)

diff --git a/programs/winedevice/device.c b/programs/winedevice/device.c
index 2ce8c15..e48218e 100644
--- a/programs/winedevice/device.c
+++ b/programs/winedevice/device.c
@@ -170,6 +170,7 @@ static NTSTATUS init_driver( HMODULE module, UNICODE_STRING *keyname )
 static BOOL load_driver(void)
 {
     static const WCHAR driversW[] = {'\\','d','r','i','v','e','r','s','\\',0};
+    static const WCHAR systemrootW[] = {'\\','S','y','s','t','e','m','R','o','o','t','\\',0};
     static const WCHAR postfixW[] = {'.','s','y','s',0};
     static const WCHAR ntprefixW[] = {'\\','?','?','\\',0};
     static const WCHAR ImagePathW[] = {'I','m','a','g','e','P','a','t','h',0};
@@ -209,6 +210,24 @@ static BOOL load_driver(void)
         }
         HeapFree( GetProcessHeap(), 0, str );
         if (!path) return FALSE;
+
+        if (!strncmpiW( path, systemrootW, 12 ))
+        {
+            WCHAR buffer[MAX_PATH];
+
+            GetWindowsDirectoryW(buffer, MAX_PATH);
+
+            str = HeapAlloc(GetProcessHeap(), 0, (size -11 + strlenW(buffer))
+                                                        * sizeof(WCHAR));
+            lstrcpyW(str, buffer);
+            lstrcatW(str, path + 11);
+            HeapFree( GetProcessHeap(), 0, path );
+            path = str;
+        }
+        else if (!strncmpW( path, ntprefixW, 4 ))
+            str = path + 4;
+        else
+            str = path;
     }
     else
     {
@@ -222,12 +241,9 @@ static BOOL load_driver(void)
         lstrcatW(path, driversW);
         lstrcatW(path, driver_name);
         lstrcatW(path, postfixW);
+        str = path;
     }
 
-    /* GameGuard uses an NT-style path name */
-    str = path;
-    if (!strncmpW( path, ntprefixW, 4 )) str += 4;
-
     WINE_TRACE( "loading driver %s\n", wine_dbgstr_w(str) );
 
     module = load_driver_module( str );




More information about the wine-cvs mailing list