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));
if (!lpServiceHandle)
return ERROR_INVALID_PARAMETER;
+ if (!lpServiceName)
+ return ERROR_INVALID_ADDRESS;
+
hManager = (PMANAGER_HANDLE)hSCManager;
if (!hManager || hManager->Handle.Tag != MANAGER_TAG)
{
DPRINT("ROpenServiceA() called\n");
- RtlCreateUnicodeStringFromAsciiz(&ServiceName,
- lpServiceName);
+ if (lpServiceName)
+ RtlCreateUnicodeStringFromAsciiz(&ServiceName,
+ lpServiceName);
dwError = ROpenServiceW(BindingHandle,
hSCManager,
dwDesiredAccess,
lpServiceHandle);
- RtlFreeUnicodeString(&ServiceName);
+ if (lpServiceName)
+ RtlFreeUnicodeString(&ServiceName);
return dwError;
}