Make sure we always use the same name for the semaphore (spotted by

Ben A L Jemmett).
This commit is contained in:
Alexandre Julliard 2003-10-10 00:05:49 +00:00
parent 7515680a7d
commit b10dcfe3b9
1 changed files with 10 additions and 20 deletions

View File

@ -37,6 +37,10 @@ WINE_DEFAULT_DEBUG_CHANNEL(advapi);
static DWORD start_dwNumServiceArgs; static DWORD start_dwNumServiceArgs;
static LPWSTR *start_lpServiceArgVectors; static LPWSTR *start_lpServiceArgVectors;
static const WCHAR _ServiceStartDataW[] = {'A','D','V','A','P','I','_','S',
'e','r','v','i','c','e','S','t',
'a','r','t','D','a','t','a',0};
/****************************************************************************** /******************************************************************************
* EnumServicesStatusA [ADVAPI32.@] * EnumServicesStatusA [ADVAPI32.@]
*/ */
@ -81,7 +85,7 @@ StartServiceCtrlDispatcherA( LPSERVICE_TABLE_ENTRYA servent )
int i; int i;
TRACE("(%p)\n", servent); TRACE("(%p)\n", servent);
wait = OpenSemaphoreA(SEMAPHORE_ALL_ACCESS, FALSE, "ADVAPI32_ServiceStartData"); wait = OpenSemaphoreW(SEMAPHORE_ALL_ACCESS, FALSE, _ServiceStartDataW);
if(wait == 0) if(wait == 0)
{ {
ERR("Couldn't find wait semaphore\n"); ERR("Couldn't find wait semaphore\n");
@ -135,9 +139,6 @@ StartServiceCtrlDispatcherA( LPSERVICE_TABLE_ENTRYA servent )
BOOL WINAPI BOOL WINAPI
StartServiceCtrlDispatcherW( LPSERVICE_TABLE_ENTRYW servent ) StartServiceCtrlDispatcherW( LPSERVICE_TABLE_ENTRYW servent )
{ {
static const WCHAR _ServiceStartDataW[] = {'A','D','V','A','P','I','_','S',
'e','r','v','i','c','e','S','t',
'a','r','t','D','a','t','a',0};
LPSERVICE_MAIN_FUNCTIONW fpMain; LPSERVICE_MAIN_FUNCTIONW fpMain;
HANDLE wait; HANDLE wait;
DWORD dwNumServiceArgs ; DWORD dwNumServiceArgs ;
@ -608,10 +609,6 @@ BOOL WINAPI
StartServiceW( SC_HANDLE hService, DWORD dwNumServiceArgs, StartServiceW( SC_HANDLE hService, DWORD dwNumServiceArgs,
LPCWSTR *lpServiceArgVectors ) LPCWSTR *lpServiceArgVectors )
{ {
static const WCHAR _ServiceStartDataW[] = {'A','D','V','A','P','I','_','S',
'e','r','v','i','c','e','S','t',
'a','r','t','D','a','t','a',0};
static const WCHAR _WaitServiceStartW[] = {'A','D','V','A','P','I','_','W', static const WCHAR _WaitServiceStartW[] = {'A','D','V','A','P','I','_','W',
'a','i','t','S','e','r','v','i', 'a','i','t','S','e','r','v','i',
'c','e','S','t','a','r','t',0}; 'c','e','S','t','a','r','t',0};
@ -637,21 +634,14 @@ StartServiceW( SC_HANDLE hService, DWORD dwNumServiceArgs,
data = CreateSemaphoreW(NULL,1,1,_ServiceStartDataW); data = CreateSemaphoreW(NULL,1,1,_ServiceStartDataW);
if (!data) if (!data)
{ {
data = OpenSemaphoreW(SEMAPHORE_ALL_ACCESS, FALSE, _ServiceStartDataW); ERR("Couldn't create data semaphore\n");
if(data == 0) return FALSE;
{
ERR("Couldn't create data semaphore\n");
return FALSE;
}
} }
wait = CreateSemaphoreW(NULL,0,1,_WaitServiceStartW); wait = CreateSemaphoreW(NULL,0,1,_WaitServiceStartW);
if (!wait)
{ {
wait = OpenSemaphoreW(SEMAPHORE_ALL_ACCESS, FALSE, _ServiceStartDataW); ERR("Couldn't create wait semaphore\n");
if(wait == 0) return FALSE;
{
ERR("Couldn't create wait semaphore\n");
return FALSE;
}
} }
/* /*