Check service database name in OpenSCManager()

Alexander Yaworsky yaworsky at migusoft.ru
Thu Dec 9 02:41:06 CST 2004


ChangeLog:

Check service database name in OpenSCManager().

Index: dlls/advapi32/service.c
===================================================================
RCS file: /home/wine/wine/dlls/advapi32/service.c,v
retrieving revision 1.73
diff -u -r1.73 service.c
--- dlls/advapi32/service.c	8 Dec 2004 14:01:26 -0000	1.73
+++ dlls/advapi32/service.c	9 Dec 2004 09:31:10 -0000
@@ -748,11 +748,23 @@
     TRACE("(%s,%s,0x%08lx)\n", debugstr_w(lpMachineName),
           debugstr_w(lpDatabaseName), dwDesiredAccess);
 
-    /*
-     * FIXME: what is lpDatabaseName?
-     * It should be set to "SERVICES_ACTIVE_DATABASE" according to
-     * docs, but what if it isn't?
-     */
+    if( lpDatabaseName )
+    {
+        if( strcmpiW( lpDatabaseName, SERVICES_ACTIVE_DATABASEW ) == 0 )
+        {
+            // noop, all right
+        }
+        else if( strcmpiW( lpDatabaseName, SERVICES_FAILED_DATABASEW ) == 0 )
+        {
+            SetLastError( ERROR_DATABASE_DOES_NOT_EXIST );
+            return NULL;
+        }
+        else
+        {
+            SetLastError( ERROR_INVALID_NAME );
+            return NULL;
+        }
+    }
 
     retval = alloc_sc_handle( SC_HTYPE_MANAGER );
     if( NULL == retval ) return NULL;



More information about the wine-patches mailing list