Update the Indentation.

svn path=/trunk/; revision=18929
This commit is contained in:
Eric Kohl 2005-11-01 13:47:40 +00:00
parent f72f2cf5ea
commit 9c843bd352

View file

@ -25,37 +25,37 @@ handle_t BindingHandle = NULL;
static VOID static VOID
HandleBind(VOID) HandleBind(VOID)
{ {
LPWSTR pszStringBinding; LPWSTR pszStringBinding;
RPC_STATUS status; RPC_STATUS status;
if (BindingHandle != NULL) if (BindingHandle != NULL)
return; return;
status = RpcStringBindingComposeW(NULL, status = RpcStringBindingComposeW(NULL,
L"ncacn_np", L"ncacn_np",
NULL, NULL,
L"\\pipe\\ntsvcs", L"\\pipe\\ntsvcs",
NULL, NULL,
&pszStringBinding); &pszStringBinding);
if (status) if (status)
{ {
DPRINT1("RpcStringBindingCompose returned 0x%x\n", status); DPRINT1("RpcStringBindingCompose returned 0x%x\n", status);
return; return;
} }
/* Set the binding handle that will be used to bind to the server. */ /* Set the binding handle that will be used to bind to the server. */
status = RpcBindingFromStringBindingW(pszStringBinding, status = RpcBindingFromStringBindingW(pszStringBinding,
&BindingHandle); &BindingHandle);
if (status) if (status)
{ {
DPRINT1("RpcBindingFromStringBinding returned 0x%x\n", status); DPRINT1("RpcBindingFromStringBinding returned 0x%x\n", status);
} }
status = RpcStringFreeW(&pszStringBinding); status = RpcStringFreeW(&pszStringBinding);
if (status) if (status)
{ {
DPRINT1("RpcStringFree returned 0x%x\n", status); DPRINT1("RpcStringFree returned 0x%x\n", status);
} }
} }
@ -63,16 +63,16 @@ HandleBind(VOID)
static VOID static VOID
HandleUnbind(VOID) HandleUnbind(VOID)
{ {
RPC_STATUS status; RPC_STATUS status;
if (BindingHandle == NULL) if (BindingHandle == NULL)
return; return;
status = RpcBindingFree(&BindingHandle); status = RpcBindingFree(&BindingHandle);
if (status) if (status)
{ {
DPRINT1("RpcBindingFree returned 0x%x\n", status); DPRINT1("RpcBindingFree returned 0x%x\n", status);
} }
} }
#endif #endif
@ -179,25 +179,25 @@ ChangeServiceConfigW(SC_HANDLE hService,
BOOL STDCALL BOOL STDCALL
CloseServiceHandle(SC_HANDLE hSCObject) CloseServiceHandle(SC_HANDLE hSCObject)
{ {
DWORD dwError; DWORD dwError;
DPRINT("CloseServiceHandle() called\n"); DPRINT("CloseServiceHandle() called\n");
HandleBind(); HandleBind();
/* Call to services.exe using RPC */ /* Call to services.exe using RPC */
dwError = ScmrCloseServiceHandle(BindingHandle, dwError = ScmrCloseServiceHandle(BindingHandle,
(unsigned int)hSCObject); (unsigned int)hSCObject);
if (dwError) if (dwError)
{ {
DPRINT1("ScmrCloseServiceHandle() failed (Error %lu)\n", dwError); DPRINT1("ScmrCloseServiceHandle() failed (Error %lu)\n", dwError);
SetLastError(dwError); SetLastError(dwError);
return FALSE; return FALSE;
} }
DPRINT("CloseServiceHandle() done\n"); DPRINT("CloseServiceHandle() done\n");
return TRUE; return TRUE;
} }
@ -207,32 +207,32 @@ CloseServiceHandle(SC_HANDLE hSCObject)
* @unimplemented * @unimplemented
*/ */
BOOL STDCALL BOOL STDCALL
ControlService(SC_HANDLE hService, ControlService(SC_HANDLE hService,
DWORD dwControl, DWORD dwControl,
LPSERVICE_STATUS lpServiceStatus) LPSERVICE_STATUS lpServiceStatus)
{ {
DWORD dwError; DWORD dwError;
DPRINT("ControlService(%x, %x, %p)\n", DPRINT("ControlService(%x, %x, %p)\n",
hService, dwControl, lpServiceStatus); hService, dwControl, lpServiceStatus);
HandleBind(); HandleBind();
/* Call to services.exe using RPC */ /* Call to services.exe using RPC */
dwError = ScmrControlService(BindingHandle, dwError = ScmrControlService(BindingHandle,
(unsigned int)hService, (unsigned int)hService,
dwControl, dwControl,
lpServiceStatus); lpServiceStatus);
if (dwError != ERROR_SUCCESS) if (dwError != ERROR_SUCCESS)
{ {
DPRINT1("ScmrControlService() failed (Error %lu)\n", dwError); DPRINT1("ScmrControlService() failed (Error %lu)\n", dwError);
SetLastError(dwError); SetLastError(dwError);
return FALSE; return FALSE;
} }
DPRINT("ControlService() done\n"); DPRINT("ControlService() done\n");
return TRUE; return TRUE;
} }
@ -364,23 +364,23 @@ CreateServiceW(SC_HANDLE hSCManager,
BOOL STDCALL BOOL STDCALL
DeleteService(SC_HANDLE hService) DeleteService(SC_HANDLE hService)
{ {
DWORD dwError; DWORD dwError;
DPRINT("DeleteService(%x)\n", hService); DPRINT("DeleteService(%x)\n", hService);
HandleBind(); HandleBind();
/* Call to services.exe using RPC */ /* Call to services.exe using RPC */
dwError = ScmrDeleteService(BindingHandle, dwError = ScmrDeleteService(BindingHandle,
(unsigned int)hService); (unsigned int)hService);
if (dwError != ERROR_SUCCESS) if (dwError != ERROR_SUCCESS)
{ {
DPRINT1("ScmrDeleteService() failed (Error %lu)\n", dwError); DPRINT1("ScmrDeleteService() failed (Error %lu)\n", dwError);
SetLastError(dwError); SetLastError(dwError);
return FALSE; return FALSE;
} }
return TRUE; return TRUE;
} }
@ -656,67 +656,67 @@ GetServiceKeyNameW(SC_HANDLE hSCManager,
SC_LOCK STDCALL SC_LOCK STDCALL
LockServiceDatabase(SC_HANDLE hSCManager) LockServiceDatabase(SC_HANDLE hSCManager)
{ {
SC_LOCK hLock; SC_LOCK hLock;
DWORD dwError; DWORD dwError;
DPRINT("LockServiceDatabase(%x)\n", hSCManager); DPRINT("LockServiceDatabase(%x)\n", hSCManager);
HandleBind(); HandleBind();
/* Call to services.exe using RPC */ /* Call to services.exe using RPC */
dwError = ScmrLockServiceDatabase(BindingHandle, dwError = ScmrLockServiceDatabase(BindingHandle,
(unsigned int)hSCManager, (unsigned int)hSCManager,
(unsigned int *)&hLock); (unsigned int *)&hLock);
if (dwError != ERROR_SUCCESS) if (dwError != ERROR_SUCCESS)
{ {
DPRINT1("ScmrLockServiceDatabase() failed (Error %lu)\n", dwError); DPRINT1("ScmrLockServiceDatabase() failed (Error %lu)\n", dwError);
SetLastError(dwError); SetLastError(dwError);
return NULL; return NULL;
} }
DPRINT("hLock = %p\n", hLock); DPRINT("hLock = %p\n", hLock);
return hLock; return hLock;
} }
static VOID static VOID
WaitForSCManager(VOID) WaitForSCManager(VOID)
{ {
HANDLE hEvent; HANDLE hEvent;
DPRINT("WaitForSCManager() called\n"); DPRINT("WaitForSCManager() called\n");
/* Try to open the existing event */ /* Try to open the existing event */
hEvent = OpenEventW(SYNCHRONIZE, hEvent = OpenEventW(SYNCHRONIZE,
FALSE, FALSE,
L"SvcctrlStartEvent_A3725DX"); L"SvcctrlStartEvent_A3725DX");
if (hEvent == NULL)
{
if (GetLastError() != ERROR_FILE_NOT_FOUND)
return;
/* Try to create a new event */
hEvent = CreateEventW(NULL,
TRUE,
FALSE,
L"SvcctrlStartEvent_A3725DX");
if (hEvent == NULL) if (hEvent == NULL)
{ {
/* Try to open the existing event again */ if (GetLastError() != ERROR_FILE_NOT_FOUND)
hEvent = OpenEventW(SYNCHRONIZE, return;
FALSE,
L"SvcctrlStartEvent_A3725DX"); /* Try to create a new event */
if (hEvent == NULL) hEvent = CreateEventW(NULL,
return; TRUE,
FALSE,
L"SvcctrlStartEvent_A3725DX");
if (hEvent == NULL)
{
/* Try to open the existing event again */
hEvent = OpenEventW(SYNCHRONIZE,
FALSE,
L"SvcctrlStartEvent_A3725DX");
if (hEvent == NULL)
return;
}
} }
}
/* Wait for 3 minutes */ /* Wait for 3 minutes */
WaitForSingleObject(hEvent, 180000); WaitForSingleObject(hEvent, 180000);
CloseHandle(hEvent); CloseHandle(hEvent);
DPRINT("ScmWaitForSCManager() done\n"); DPRINT("ScmWaitForSCManager() done\n");
} }
@ -730,32 +730,32 @@ OpenSCManagerA(LPCSTR lpMachineName,
LPCSTR lpDatabaseName, LPCSTR lpDatabaseName,
DWORD dwDesiredAccess) DWORD dwDesiredAccess)
{ {
SC_HANDLE hScm = NULL; SC_HANDLE hScm = NULL;
DWORD dwError; DWORD dwError;
DPRINT("OpenSCManagerA(%s, %s, %lx)\n", DPRINT("OpenSCManagerA(%s, %s, %lx)\n",
lpMachineName, lpDatabaseName, dwDesiredAccess); lpMachineName, lpDatabaseName, dwDesiredAccess);
WaitForSCManager(); WaitForSCManager();
HandleBind(); HandleBind();
/* Call to services.exe using RPC */ /* Call to services.exe using RPC */
dwError = ScmrOpenSCManagerA(BindingHandle, dwError = ScmrOpenSCManagerA(BindingHandle,
(LPSTR)lpMachineName, (LPSTR)lpMachineName,
(LPSTR)lpDatabaseName, (LPSTR)lpDatabaseName,
dwDesiredAccess, dwDesiredAccess,
(unsigned int*)&hScm); (unsigned int*)&hScm);
if (dwError != ERROR_SUCCESS) if (dwError != ERROR_SUCCESS)
{ {
DPRINT1("ScmrOpenSCManagerA() failed (Error %lu)\n", dwError); DPRINT1("ScmrOpenSCManagerA() failed (Error %lu)\n", dwError);
SetLastError(dwError); SetLastError(dwError);
return NULL; return NULL;
} }
DPRINT("hScm = %p\n", hScm); DPRINT("hScm = %p\n", hScm);
return hScm; return hScm;
} }
@ -769,32 +769,32 @@ OpenSCManagerW(LPCWSTR lpMachineName,
LPCWSTR lpDatabaseName, LPCWSTR lpDatabaseName,
DWORD dwDesiredAccess) DWORD dwDesiredAccess)
{ {
SC_HANDLE hScm = NULL; SC_HANDLE hScm = NULL;
DWORD dwError; DWORD dwError;
DPRINT("OpenSCManagerW(%S, %S, %lx)\n", DPRINT("OpenSCManagerW(%S, %S, %lx)\n",
lpMachineName, lpDatabaseName, dwDesiredAccess); lpMachineName, lpDatabaseName, dwDesiredAccess);
WaitForSCManager(); WaitForSCManager();
HandleBind(); HandleBind();
/* Call to services.exe using RPC */ /* Call to services.exe using RPC */
dwError = ScmrOpenSCManagerW(BindingHandle, dwError = ScmrOpenSCManagerW(BindingHandle,
(LPWSTR)lpMachineName, (LPWSTR)lpMachineName,
(LPWSTR)lpDatabaseName, (LPWSTR)lpDatabaseName,
dwDesiredAccess, dwDesiredAccess,
(unsigned int*)&hScm); (unsigned int*)&hScm);
if (dwError != ERROR_SUCCESS) if (dwError != ERROR_SUCCESS)
{ {
DPRINT1("ScmrOpenSCManagerW() failed (Error %lu)\n", dwError); DPRINT1("ScmrOpenSCManagerW() failed (Error %lu)\n", dwError);
SetLastError(dwError); SetLastError(dwError);
return NULL; return NULL;
} }
DPRINT("hScm = %p\n", hScm); DPRINT("hScm = %p\n", hScm);
return hScm; return hScm;
} }
@ -808,30 +808,30 @@ OpenServiceA(SC_HANDLE hSCManager,
LPCSTR lpServiceName, LPCSTR lpServiceName,
DWORD dwDesiredAccess) DWORD dwDesiredAccess)
{ {
SC_HANDLE hService = NULL; SC_HANDLE hService = NULL;
DWORD dwError; DWORD dwError;
DPRINT("OpenServiceA(%p, %s, %lx)\n", DPRINT("OpenServiceA(%p, %s, %lx)\n",
hSCManager, lpServiceName, dwDesiredAccess); hSCManager, lpServiceName, dwDesiredAccess);
HandleBind(); HandleBind();
/* Call to services.exe using RPC */ /* Call to services.exe using RPC */
dwError = ScmrOpenServiceA(BindingHandle, dwError = ScmrOpenServiceA(BindingHandle,
(unsigned int)hSCManager, (unsigned int)hSCManager,
(LPSTR)lpServiceName, (LPSTR)lpServiceName,
dwDesiredAccess, dwDesiredAccess,
(unsigned int*)&hService); (unsigned int*)&hService);
if (dwError != ERROR_SUCCESS) if (dwError != ERROR_SUCCESS)
{ {
DPRINT1("ScmrOpenServiceA() failed (Error %lu)\n", dwError); DPRINT1("ScmrOpenServiceA() failed (Error %lu)\n", dwError);
SetLastError(dwError); SetLastError(dwError);
return NULL; return NULL;
} }
DPRINT("hService = %p\n", hService); DPRINT("hService = %p\n", hService);
return hService; return hService;
} }
@ -845,30 +845,30 @@ OpenServiceW(SC_HANDLE hSCManager,
LPCWSTR lpServiceName, LPCWSTR lpServiceName,
DWORD dwDesiredAccess) DWORD dwDesiredAccess)
{ {
SC_HANDLE hService = NULL; SC_HANDLE hService = NULL;
DWORD dwError; DWORD dwError;
DPRINT("OpenServiceW(%p, %S, %lx)\n", DPRINT("OpenServiceW(%p, %S, %lx)\n",
hSCManager, lpServiceName, dwDesiredAccess); hSCManager, lpServiceName, dwDesiredAccess);
HandleBind(); HandleBind();
/* Call to services.exe using RPC */ /* Call to services.exe using RPC */
dwError = ScmrOpenServiceW(BindingHandle, dwError = ScmrOpenServiceW(BindingHandle,
(unsigned int)hSCManager, (unsigned int)hSCManager,
(LPWSTR)lpServiceName, (LPWSTR)lpServiceName,
dwDesiredAccess, dwDesiredAccess,
(unsigned int*)&hService); (unsigned int*)&hService);
if (dwError != ERROR_SUCCESS) if (dwError != ERROR_SUCCESS)
{ {
DPRINT1("ScmrOpenServiceW() failed (Error %lu)\n", dwError); DPRINT1("ScmrOpenServiceW() failed (Error %lu)\n", dwError);
SetLastError(dwError); SetLastError(dwError);
return NULL; return NULL;
} }
DPRINT("hService = %p\n", hService); DPRINT("hService = %p\n", hService);
return hService; return hService;
} }
@ -977,25 +977,25 @@ BOOL STDCALL
QueryServiceStatus(SC_HANDLE hService, QueryServiceStatus(SC_HANDLE hService,
LPSERVICE_STATUS lpServiceStatus) LPSERVICE_STATUS lpServiceStatus)
{ {
DWORD dwError; DWORD dwError;
DPRINT("QueryServiceStatus(%p, %p)\n", DPRINT("QueryServiceStatus(%p, %p)\n",
hService, lpServiceStatus); hService, lpServiceStatus);
HandleBind(); HandleBind();
/* Call to services.exe using RPC */ /* Call to services.exe using RPC */
dwError = ScmrQueryServiceStatus(BindingHandle, dwError = ScmrQueryServiceStatus(BindingHandle,
(unsigned int)hService, (unsigned int)hService,
lpServiceStatus); lpServiceStatus);
if (dwError != ERROR_SUCCESS) if (dwError != ERROR_SUCCESS)
{ {
DPRINT1("ScmrQueryServiceStatus() failed (Error %lu)\n", dwError); DPRINT1("ScmrQueryServiceStatus() failed (Error %lu)\n", dwError);
SetLastError(dwError); SetLastError(dwError);
return FALSE; return FALSE;
} }
return TRUE; return TRUE;
} }
@ -1062,23 +1062,23 @@ StartServiceW(
BOOL STDCALL BOOL STDCALL
UnlockServiceDatabase(SC_LOCK ScLock) UnlockServiceDatabase(SC_LOCK ScLock)
{ {
DWORD dwError; DWORD dwError;
DPRINT("UnlockServiceDatabase(%x)\n", ScLock); DPRINT("UnlockServiceDatabase(%x)\n", ScLock);
HandleBind(); HandleBind();
/* Call to services.exe using RPC */ /* Call to services.exe using RPC */
dwError = ScmrUnlockServiceDatabase(BindingHandle, dwError = ScmrUnlockServiceDatabase(BindingHandle,
(unsigned int)ScLock); (unsigned int)ScLock);
if (dwError != ERROR_SUCCESS) if (dwError != ERROR_SUCCESS)
{ {
DPRINT1("ScmrUnlockServiceDatabase() failed (Error %lu)\n", dwError); DPRINT1("ScmrUnlockServiceDatabase() failed (Error %lu)\n", dwError);
SetLastError(dwError); SetLastError(dwError);
return FALSE; return FALSE;
} }
return TRUE; return TRUE;
} }
@ -1112,13 +1112,13 @@ NotifyBootConfigStatus(BOOL BootAcceptable)
void __RPC_FAR * __RPC_USER midl_user_allocate(size_t len) void __RPC_FAR * __RPC_USER midl_user_allocate(size_t len)
{ {
return HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, 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)
{ {
HeapFree(GetProcessHeap(), 0, ptr); HeapFree(GetProcessHeap(), 0, ptr);
} }
/* EOF */ /* EOF */