use SERVICES_ACTIVE_DATABASE if the caller didn't specify a database for OpenSCManager()

svn path=/trunk/; revision=14998
This commit is contained in:
Thomas Bluemel 2005-05-05 12:58:03 +00:00
parent 264cee75a3
commit cb363f4f7d

View file

@ -147,9 +147,13 @@ ScmCreateManagerHandle(LPWSTR lpDatabaseName,
SC_HANDLE *Handle) SC_HANDLE *Handle)
{ {
PMANAGER_HANDLE Ptr; PMANAGER_HANDLE Ptr;
if (lpDatabaseName == NULL)
lpDatabaseName = SERVICES_ACTIVE_DATABASEW;
Ptr = GlobalAlloc(GPTR, Ptr = HeapAlloc(GetProcessHeap(),
sizeof(MANAGER_HANDLE) + wcslen(lpDatabaseName) * sizeof(WCHAR)); HEAP_ZERO_MEMORY,
sizeof(MANAGER_HANDLE) + wcslen(lpDatabaseName) * sizeof(WCHAR));
if (Ptr == NULL) if (Ptr == NULL)
return ERROR_NOT_ENOUGH_MEMORY; return ERROR_NOT_ENOUGH_MEMORY;
@ -172,8 +176,9 @@ ScmCreateServiceHandle(PSERVICE lpServiceEntry,
{ {
PSERVICE_HANDLE Ptr; PSERVICE_HANDLE Ptr;
Ptr = GlobalAlloc(GPTR, Ptr = HeapAlloc(GetProcessHeap(),
sizeof(SERVICE_HANDLE)); HEAP_ZERO_MEMORY,
sizeof(SERVICE_HANDLE));
if (Ptr == NULL) if (Ptr == NULL)
return ERROR_NOT_ENOUGH_MEMORY; return ERROR_NOT_ENOUGH_MEMORY;
@ -243,7 +248,7 @@ ScmrCloseServiceHandle(handle_t BindingHandle,
{ {
/* FIXME: add cleanup code */ /* FIXME: add cleanup code */
GlobalFree(hManager); HeapFree(GetProcessHeap(), 0, hManager);
} }
DPRINT("ScmrCloseServiceHandle() done\n"); DPRINT("ScmrCloseServiceHandle() done\n");
@ -258,7 +263,7 @@ ScmrCloseServiceHandle(handle_t BindingHandle,
{ {
/* FIXME: add cleanup code */ /* FIXME: add cleanup code */
GlobalFree(hManager); HeapFree(GetProcessHeap(), 0, hManager);
} }
DPRINT("ScmrCloseServiceHandle() done\n"); DPRINT("ScmrCloseServiceHandle() done\n");
@ -530,7 +535,7 @@ ScmrOpenSCManagerW(handle_t BindingHandle,
if (dwError != ERROR_SUCCESS) if (dwError != ERROR_SUCCESS)
{ {
DPRINT1("ScmCheckAccess() failed (Error %lu)\n", dwError); DPRINT1("ScmCheckAccess() failed (Error %lu)\n", dwError);
GlobalFree(hHandle); HeapFree(GetProcessHeap(), 0, hHandle);
return dwError; return dwError;
} }
@ -598,7 +603,7 @@ ScmrOpenServiceW(handle_t BindingHandle,
if (dwError != ERROR_SUCCESS) if (dwError != ERROR_SUCCESS)
{ {
DPRINT1("ScmCheckAccess() failed (Error %lu)\n", dwError); DPRINT1("ScmCheckAccess() failed (Error %lu)\n", dwError);
GlobalFree(hHandle); HeapFree(GetProcessHeap(), 0, hHandle);
return dwError; return dwError;
} }
@ -681,13 +686,13 @@ ScmrOpenServiceA(handle_t BindingHandle,
void __RPC_FAR * __RPC_USER midl_user_allocate(size_t len) 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) void __RPC_USER midl_user_free(void __RPC_FAR * ptr)
{ {
GlobalFree(ptr); HeapFree(GetProcessHeap(), 0, ptr);
} }
/* EOF */ /* EOF */