[4/5] winedevice: add unmanaged mode that allows a driver to load multiple times

Damjan Jovanovic damjan.jov at gmail.com
Sun Apr 18 03:31:20 CDT 2010


Changelog:
* winedevice: add unmanaged mode that allows a driver to load multiple times

Damjan Jovanovic
-------------- next part --------------
diff --git a/programs/winedevice/device.c b/programs/winedevice/device.c
index bd65654..012f551 100644
--- a/programs/winedevice/device.c
+++ b/programs/winedevice/device.c
@@ -302,6 +302,7 @@ static void WINAPI ServiceMain( DWORD argc, LPWSTR *argv )
 
 int wmain( int argc, WCHAR *argv[] )
 {
+    static const WCHAR unmanagedW[] = {'-','-','u','n','m','a','n','a','g','e','d',0};
     SERVICE_TABLE_ENTRYW service_table[2];
 
     if (!(driver_name = argv[1]))
@@ -310,6 +311,24 @@ int wmain( int argc, WCHAR *argv[] )
         return 1;
     }
 
+    if (argc == 3 && !strcmpW(argv[2], unmanagedW))
+    {
+        if (load_driver())
+        {
+            stop_event = CreateEventW( NULL, TRUE, FALSE, NULL );
+            if (stop_event)
+            {
+                wine_ntoskrnl_main_loop( stop_event );
+                CloseHandle( stop_event );
+            }
+            else
+                WINE_ERR( "error %d creating event", GetLastError() );
+        }
+        else
+            WINE_ERR( "driver %s failed to load\n", wine_dbgstr_w(driver_name) );
+        return 0;
+    }
+
     service_table[0].lpServiceName = argv[1];
     service_table[0].lpServiceProc = ServiceMain;
     service_table[1].lpServiceName = NULL;


More information about the wine-patches mailing list