[SERVMAN]

- Explicitely use UNICODE versions of OpenSCManager and OpenService.
- When OpenSCManager or OpenService fail, they return a NULL handle (not INVALID_HANDLE_VALUE).

svn path=/trunk/; revision=69719
This commit is contained in:
Hermès Bélusca-Maïto
2015-10-26 23:15:40 +00:00
parent 781a27b6d0
commit 6a9bc47c37
3 changed files with 23 additions and 23 deletions
@@ -17,14 +17,14 @@ DoDeleteService(PMAIN_WND_INFO Info,
SC_HANDLE hSc;
BOOL bRet = FALSE;
hSCManager = OpenSCManager(NULL,
NULL,
SC_MANAGER_ALL_ACCESS);
hSCManager = OpenSCManagerW(NULL,
NULL,
SC_MANAGER_ALL_ACCESS);
if (hSCManager)
{
hSc = OpenService(hSCManager,
Info->pCurrentService->lpServiceName,
DELETE);
hSc = OpenServiceW(hSCManager,
Info->pCurrentService->lpServiceName,
DELETE);
if (hSc)
{
if (DeleteService(hSc))
@@ -17,14 +17,14 @@ TV2_HasDependantServices(LPWSTR lpServiceName)
DWORD dwBytesNeeded, dwCount;
BOOL bRet = FALSE;
hSCManager = OpenSCManager(NULL,
NULL,
SC_MANAGER_ALL_ACCESS);
hSCManager = OpenSCManagerW(NULL,
NULL,
SC_MANAGER_ALL_ACCESS);
if (hSCManager)
{
hService = OpenService(hSCManager,
lpServiceName,
SERVICE_QUERY_STATUS | SERVICE_ENUMERATE_DEPENDENTS);
hService = OpenServiceW(hSCManager,
lpServiceName,
SERVICE_QUERY_STATUS | SERVICE_ENUMERATE_DEPENDENTS);
if (hService)
{
/* Does this have any dependencies? */
@@ -273,10 +273,10 @@ GetServiceList(PMAIN_WND_INFO Info,
Info->pAllServices = NULL;
}
ScHandle = OpenSCManager(NULL,
NULL,
SC_MANAGER_ENUMERATE_SERVICE);
if (ScHandle != INVALID_HANDLE_VALUE)
ScHandle = OpenSCManagerW(NULL,
NULL,
SC_MANAGER_ENUMERATE_SERVICE);
if (ScHandle != NULL)
{
if (!EnumServicesStatusEx(ScHandle,
SC_ENUM_PROCESS_INFO,
@@ -336,16 +336,16 @@ UpdateServiceStatus(ENUM_SERVICE_STATUS_PROCESS* pService)
SC_HANDLE hScm;
BOOL bRet = FALSE;
hScm = OpenSCManager(NULL,
NULL,
SC_MANAGER_ENUMERATE_SERVICE);
if (hScm != INVALID_HANDLE_VALUE)
hScm = OpenSCManagerW(NULL,
NULL,
SC_MANAGER_ENUMERATE_SERVICE);
if (hScm != NULL)
{
SC_HANDLE hService;
hService = OpenService(hScm,
pService->lpServiceName,
SERVICE_QUERY_STATUS);
hService = OpenServiceW(hScm,
pService->lpServiceName,
SERVICE_QUERY_STATUS);
if (hService)
{
DWORD size;