From cb363f4f7dac26f29126531a21a9173c24ee4678 Mon Sep 17 00:00:00 2001 From: Thomas Bluemel Date: Thu, 5 May 2005 12:58:03 +0000 Subject: [PATCH] use SERVICES_ACTIVE_DATABASE if the caller didn't specify a database for OpenSCManager() svn path=/trunk/; revision=14998 --- reactos/subsys/system/services/rpcserver.c | 25 +++++++++++++--------- 1 file changed, 15 insertions(+), 10 deletions(-) diff --git a/reactos/subsys/system/services/rpcserver.c b/reactos/subsys/system/services/rpcserver.c index 42c172e66d7..2f0b28443d5 100644 --- a/reactos/subsys/system/services/rpcserver.c +++ b/reactos/subsys/system/services/rpcserver.c @@ -147,9 +147,13 @@ ScmCreateManagerHandle(LPWSTR lpDatabaseName, 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 @@ ScmCreateServiceHandle(PSERVICE lpServiceEntry, { 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 @@ ScmrCloseServiceHandle(handle_t BindingHandle, { /* FIXME: add cleanup code */ - GlobalFree(hManager); + HeapFree(GetProcessHeap(), 0, hManager); } DPRINT("ScmrCloseServiceHandle() done\n"); @@ -258,7 +263,7 @@ ScmrCloseServiceHandle(handle_t BindingHandle, { /* FIXME: add cleanup code */ - GlobalFree(hManager); + HeapFree(GetProcessHeap(), 0, hManager); } DPRINT("ScmrCloseServiceHandle() done\n"); @@ -530,7 +535,7 @@ ScmrOpenSCManagerW(handle_t BindingHandle, if (dwError != ERROR_SUCCESS) { DPRINT1("ScmCheckAccess() failed (Error %lu)\n", dwError); - GlobalFree(hHandle); + HeapFree(GetProcessHeap(), 0, hHandle); return dwError; } @@ -598,7 +603,7 @@ ScmrOpenServiceW(handle_t BindingHandle, if (dwError != ERROR_SUCCESS) { DPRINT1("ScmCheckAccess() failed (Error %lu)\n", dwError); - GlobalFree(hHandle); + HeapFree(GetProcessHeap(), 0, hHandle); return dwError; } @@ -681,13 +686,13 @@ ScmrOpenServiceA(handle_t BindingHandle, 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 */