use SERVICES_ACTIVE_DATABASE if the caller didn't specify a database for OpenSCManager()
Modified: trunk/reactos/subsys/system/services/rpcserver.c

Modified: trunk/reactos/subsys/system/services/rpcserver.c
--- trunk/reactos/subsys/system/services/rpcserver.c	2005-05-05 12:35:09 UTC (rev 14997)
+++ trunk/reactos/subsys/system/services/rpcserver.c	2005-05-05 12:58:03 UTC (rev 14998)
@@ -147,9 +147,13 @@
                        SC_HANDLE *Handle)
 {
   PMANAGER_HANDLE Ptr;
+  
+  if (lpDatabaseName == NULL)
+    lpDatabaseName = SERVICES_ACTIVE_DATABASEW;
 
-  Ptr = GlobalAlloc(GPTR,
-                    sizeof(MANAGER_HANDLE) + wcslen(lpDatabaseName) * sizeof(WCHAR));
+  Ptr = HeapAlloc(GetProcessHeap(),
+                  HEAP_ZERO_MEMORY,
+                  sizeof(MANAGER_HANDLE) + wcslen(lpDatabaseName) * sizeof(WCHAR));
   if (Ptr == NULL)
     return ERROR_NOT_ENOUGH_MEMORY;
 
@@ -172,8 +176,9 @@
 {
   PSERVICE_HANDLE Ptr;
 
-  Ptr = GlobalAlloc(GPTR,
-                    sizeof(SERVICE_HANDLE));
+  Ptr = HeapAlloc(GetProcessHeap(),
+                  HEAP_ZERO_MEMORY,
+                  sizeof(SERVICE_HANDLE));
   if (Ptr == NULL)
     return ERROR_NOT_ENOUGH_MEMORY;
 
@@ -243,7 +248,7 @@
     {
       /* FIXME: add cleanup code */
 
-      GlobalFree(hManager);
+      HeapFree(GetProcessHeap(), 0, hManager);
     }
 
     DPRINT("ScmrCloseServiceHandle() done\n");
@@ -258,7 +263,7 @@
     {
       /* FIXME: add cleanup code */
 
-      GlobalFree(hManager);
+      HeapFree(GetProcessHeap(), 0, hManager);
     }
 
     DPRINT("ScmrCloseServiceHandle() done\n");
@@ -530,7 +535,7 @@
   if (dwError != ERROR_SUCCESS)
   {
     DPRINT1("ScmCheckAccess() failed (Error %lu)\n", dwError);
-    GlobalFree(hHandle);
+    HeapFree(GetProcessHeap(), 0, hHandle);
     return dwError;
   }
 
@@ -598,7 +603,7 @@
   if (dwError != ERROR_SUCCESS)
   {
     DPRINT1("ScmCheckAccess() failed (Error %lu)\n", dwError);
-    GlobalFree(hHandle);
+    HeapFree(GetProcessHeap(), 0, hHandle);
     return dwError;
   }
 
@@ -681,13 +686,13 @@
 
 void __RPC_FAR * __RPC_USER midl_user_allocate(size_t len)
 {
-  return GlobalAlloc(GPTR, len);
+  return HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, len);
 }
 
 
 void __RPC_USER midl_user_free(void __RPC_FAR * ptr)
 {
-  GlobalFree(ptr);
+  HeapFree(GetProcessHeap(), 0, ptr);
 }
 
 /* EOF */