mirror of
https://github.com/reactos/reactos.git
synced 2025-08-04 08:15:41 +00:00
- ScmCreateManagerHandle: Fail on invalid database names.
- ROpenServiceW: Fail if lpServiceName is NULL. - ROpenServiceA: Don't pass an empty string to ROpenServiceW if lpServiceName is NULL. Use NULL instead. This patch is based on bug report #3669 by bugboy <martinmnet@hotmail.com>. svn path=/trunk/; revision=35750
This commit is contained in:
parent
b1d48577f8
commit
e2a4d8be51
1 changed files with 19 additions and 3 deletions
|
@ -152,6 +152,17 @@ ScmCreateManagerHandle(LPWSTR lpDatabaseName,
|
|||
if (lpDatabaseName == NULL)
|
||||
lpDatabaseName = SERVICES_ACTIVE_DATABASEW;
|
||||
|
||||
if (wcsicmp(lpDatabaseName,SERVICES_FAILED_DATABASEW)==0)
|
||||
{
|
||||
DPRINT1("Database %S, does not exist\n",lpDatabaseName);
|
||||
return ERROR_DATABASE_DOES_NOT_EXIST;
|
||||
}
|
||||
else if (wcsicmp(lpDatabaseName, SERVICES_ACTIVE_DATABASEW) != 0)
|
||||
{
|
||||
DPRINT1("Invalid Database name %S.\n",lpDatabaseName);
|
||||
return ERROR_INVALID_NAME;
|
||||
}
|
||||
|
||||
Ptr = (MANAGER_HANDLE*) HeapAlloc(GetProcessHeap(),
|
||||
HEAP_ZERO_MEMORY,
|
||||
sizeof(MANAGER_HANDLE) + wcslen(lpDatabaseName) * sizeof(WCHAR));
|
||||
|
@ -1936,6 +1947,9 @@ DWORD ROpenServiceW(
|
|||
if (!lpServiceHandle)
|
||||
return ERROR_INVALID_PARAMETER;
|
||||
|
||||
if (!lpServiceName)
|
||||
return ERROR_INVALID_ADDRESS;
|
||||
|
||||
hManager = (PMANAGER_HANDLE)hSCManager;
|
||||
if (!hManager || hManager->Handle.Tag != MANAGER_TAG)
|
||||
{
|
||||
|
@ -2489,8 +2503,9 @@ DWORD ROpenServiceA(
|
|||
|
||||
DPRINT("ROpenServiceA() called\n");
|
||||
|
||||
RtlCreateUnicodeStringFromAsciiz(&ServiceName,
|
||||
lpServiceName);
|
||||
if (lpServiceName)
|
||||
RtlCreateUnicodeStringFromAsciiz(&ServiceName,
|
||||
lpServiceName);
|
||||
|
||||
dwError = ROpenServiceW(BindingHandle,
|
||||
hSCManager,
|
||||
|
@ -2498,7 +2513,8 @@ DWORD ROpenServiceA(
|
|||
dwDesiredAccess,
|
||||
lpServiceHandle);
|
||||
|
||||
RtlFreeUnicodeString(&ServiceName);
|
||||
if (lpServiceName)
|
||||
RtlFreeUnicodeString(&ServiceName);
|
||||
|
||||
return dwError;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue