- fixed a possible deadlock in SmBeginClientInitialization - fixed SmCompleteClientInitialization to return success when the client data could be found - don't copy the program name to a NULL pointer in SmCreateClient in case allocating the storage failed Modified: trunk/reactos/subsys/smss/client.c _____
Modified: trunk/reactos/subsys/smss/client.c --- trunk/reactos/subsys/smss/client.c 2005-06-17 16:12:33 UTC (rev 15988) +++ trunk/reactos/subsys/smss/client.c 2005-06-17 16:26:04 UTC (rev 15989) @@ -177,6 +177,7 @@
DPRINT("SM: %s: attempt to register again subsystem %d.\n", __FUNCTION__, ConnectData->SubSystemId); + RtlLeaveCriticalSection (& SmpClientDirectory.Lock); return STATUS_UNSUCCESSFUL; } DPRINT("SM: %s: registering subsystem ID=%d \n", @@ -245,7 +246,7 @@ NTSTATUS STDCALL SmCompleteClientInitialization (ULONG ProcessId) { - NTSTATUS Status = STATUS_SUCCESS; + NTSTATUS Status = STATUS_NOT_FOUND; PSM_CLIENT_DATA Client = NULL;
DPRINT("SM: %s called\n", __FUNCTION__); @@ -259,11 +260,11 @@ if (ProcessId == Client->ServerProcessId) { SmpSetClientInitialized (Client); + Status = STATUS_SUCCESS; break; } Client = Client->Next; } - Status = STATUS_NOT_FOUND; } RtlLeaveCriticalSection (& SmpClientDirectory.Lock); return Status; @@ -321,13 +322,14 @@ (HANDLE) ProcessInfo->ProcessHandle; SmpClientDirectory.CandidateClient->ServerProcessId = (ULONG) ProcessInfo->ClientId.UniqueProcess; + /* + * Copy the program name + */ + RtlCopyMemory (SmpClientDirectory.CandidateClient->ProgramName, + ProgramName, + SM_SB_NAME_MAX_LENGTH); } - /* - * Copy the program name - */ - RtlCopyMemory (SmpClientDirectory.CandidateClient->ProgramName, - ProgramName, - SM_SB_NAME_MAX_LENGTH); + RtlLeaveCriticalSection (& SmpClientDirectory.Lock); return Status; }