mirror of
https://github.com/reactos/reactos.git
synced 2024-11-20 14:30:57 +00:00
- Remove some redundant ProcessData == NULL checks - ClientConnectionThread already checks this for every request.
- CsrApiCallHandler: Get rid of "Found" variable and just return when the right definition is found. - Make CsrApiCallHandler use the return value from the function (previously unused) to set Request->Status, and trim the now-redundant Request->Status setting from tons of CSR_API functions. - CsrCreateProcess: Don't set shutdown parameters again - already set in CsrCreateProcessData. svn path=/trunk/; revision=35049
This commit is contained in:
parent
57edd3268d
commit
1914d86bac
8 changed files with 193 additions and 366 deletions
|
@ -66,10 +66,6 @@ NTSTATUS STDCALL CsrGetObject( PCSRSS_PROCESS_DATA ProcessData, HANDLE Handle, O
|
|||
ULONG h = (ULONG)Handle >> 2;
|
||||
DPRINT("CsrGetObject, Object: %x, %x, %x\n", Object, Handle, ProcessData ? ProcessData->HandleTableSize : 0);
|
||||
|
||||
if (ProcessData == NULL)
|
||||
{
|
||||
return STATUS_INVALID_PARAMETER;
|
||||
}
|
||||
RtlEnterCriticalSection(&ProcessData->HandleTableLock);
|
||||
if (!CsrIsConsoleHandle(Handle) || h >= ProcessData->HandleTableSize
|
||||
|| (*Object = ProcessData->HandleTable[h].Object) == NULL
|
||||
|
@ -117,10 +113,6 @@ CsrReleaseObject(PCSRSS_PROCESS_DATA ProcessData,
|
|||
ULONG h = (ULONG)Handle >> 2;
|
||||
Object_t *Object;
|
||||
|
||||
if (ProcessData == NULL)
|
||||
{
|
||||
return STATUS_INVALID_PARAMETER;
|
||||
}
|
||||
RtlEnterCriticalSection(&ProcessData->HandleTableLock);
|
||||
if (h >= ProcessData->HandleTableSize
|
||||
|| (Object = ProcessData->HandleTable[h].Object) == NULL)
|
||||
|
@ -143,11 +135,6 @@ NTSTATUS STDCALL CsrInsertObject(PCSRSS_PROCESS_DATA ProcessData,
|
|||
ULONG i;
|
||||
PVOID* Block;
|
||||
|
||||
if (ProcessData == NULL)
|
||||
{
|
||||
return STATUS_INVALID_PARAMETER;
|
||||
}
|
||||
|
||||
RtlEnterCriticalSection(&ProcessData->HandleTableLock);
|
||||
|
||||
for (i = 0; i < ProcessData->HandleTableSize; i++)
|
||||
|
@ -188,9 +175,7 @@ NTSTATUS STDCALL CsrDuplicateHandleTable(PCSRSS_PROCESS_DATA SourceProcessData,
|
|||
{
|
||||
ULONG i;
|
||||
|
||||
if (SourceProcessData == NULL ||
|
||||
TargetProcessData == NULL ||
|
||||
TargetProcessData->HandleTableSize)
|
||||
if (TargetProcessData->HandleTableSize)
|
||||
{
|
||||
return STATUS_INVALID_PARAMETER;
|
||||
}
|
||||
|
@ -225,10 +210,6 @@ NTSTATUS STDCALL CsrVerifyObject( PCSRSS_PROCESS_DATA ProcessData, HANDLE Handle
|
|||
{
|
||||
ULONG h = (ULONG)Handle >> 2;
|
||||
|
||||
if (ProcessData == NULL)
|
||||
{
|
||||
return STATUS_INVALID_PARAMETER;
|
||||
}
|
||||
if (h >= ProcessData->HandleTableSize
|
||||
|| ProcessData->HandleTable[h].Object == NULL)
|
||||
{
|
||||
|
|
|
@ -228,7 +228,6 @@ CSR_API(CsrCreateProcess)
|
|||
NewProcessData = CsrCreateProcessData(Request->Data.CreateProcessRequest.NewProcessId);
|
||||
if (NewProcessData == NULL)
|
||||
{
|
||||
Request->Status = STATUS_NO_MEMORY;
|
||||
return(STATUS_NO_MEMORY);
|
||||
}
|
||||
|
||||
|
@ -251,11 +250,6 @@ CSR_API(CsrCreateProcess)
|
|||
NewProcessData->ProcessGroup = ProcessData->ProcessGroup;
|
||||
}
|
||||
|
||||
/* Set default shutdown parameters */
|
||||
NewProcessData->ShutdownLevel = 0x280;
|
||||
NewProcessData->ShutdownFlags = 0;
|
||||
|
||||
Request->Status = STATUS_SUCCESS;
|
||||
return(STATUS_SUCCESS);
|
||||
}
|
||||
|
||||
|
@ -264,13 +258,7 @@ CSR_API(CsrTerminateProcess)
|
|||
Request->Header.u1.s1.TotalLength = sizeof(CSR_API_MESSAGE);
|
||||
Request->Header.u1.s1.DataLength = sizeof(CSR_API_MESSAGE) - sizeof(PORT_MESSAGE);
|
||||
|
||||
if (ProcessData == NULL)
|
||||
{
|
||||
return(Request->Status = STATUS_INVALID_PARAMETER);
|
||||
}
|
||||
|
||||
ProcessData->Terminated = TRUE;
|
||||
Request->Status = STATUS_SUCCESS;
|
||||
return STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
|
@ -279,8 +267,6 @@ CSR_API(CsrConnectProcess)
|
|||
Request->Header.u1.s1.TotalLength = sizeof(CSR_API_MESSAGE);
|
||||
Request->Header.u1.s1.DataLength = sizeof(CSR_API_MESSAGE) - sizeof(PORT_MESSAGE);
|
||||
|
||||
Request->Status = STATUS_SUCCESS;
|
||||
|
||||
return(STATUS_SUCCESS);
|
||||
}
|
||||
|
||||
|
@ -289,16 +275,9 @@ CSR_API(CsrGetShutdownParameters)
|
|||
Request->Header.u1.s1.TotalLength = sizeof(CSR_API_MESSAGE);
|
||||
Request->Header.u1.s1.DataLength = sizeof(CSR_API_MESSAGE) - sizeof(PORT_MESSAGE);
|
||||
|
||||
if (ProcessData == NULL)
|
||||
{
|
||||
return(Request->Status = STATUS_INVALID_PARAMETER);
|
||||
}
|
||||
|
||||
Request->Data.GetShutdownParametersRequest.Level = ProcessData->ShutdownLevel;
|
||||
Request->Data.GetShutdownParametersRequest.Flags = ProcessData->ShutdownFlags;
|
||||
|
||||
Request->Status = STATUS_SUCCESS;
|
||||
|
||||
return(STATUS_SUCCESS);
|
||||
}
|
||||
|
||||
|
@ -307,16 +286,9 @@ CSR_API(CsrSetShutdownParameters)
|
|||
Request->Header.u1.s1.TotalLength = sizeof(CSR_API_MESSAGE);
|
||||
Request->Header.u1.s1.DataLength = sizeof(CSR_API_MESSAGE) - sizeof(PORT_MESSAGE);
|
||||
|
||||
if (ProcessData == NULL)
|
||||
{
|
||||
return(Request->Status = STATUS_INVALID_PARAMETER);
|
||||
}
|
||||
|
||||
ProcessData->ShutdownLevel = Request->Data.SetShutdownParametersRequest.Level;
|
||||
ProcessData->ShutdownFlags = Request->Data.SetShutdownParametersRequest.Flags;
|
||||
|
||||
Request->Status = STATUS_SUCCESS;
|
||||
|
||||
return(STATUS_SUCCESS);
|
||||
}
|
||||
|
||||
|
@ -325,12 +297,7 @@ CSR_API(CsrGetInputHandle)
|
|||
Request->Header.u1.s1.TotalLength = sizeof(CSR_API_MESSAGE);
|
||||
Request->Header.u1.s1.DataLength = sizeof(CSR_API_MESSAGE) - sizeof(PORT_MESSAGE);
|
||||
|
||||
if (ProcessData == NULL)
|
||||
{
|
||||
Request->Data.GetInputHandleRequest.InputHandle = INVALID_HANDLE_VALUE;
|
||||
Request->Status = STATUS_INVALID_PARAMETER;
|
||||
}
|
||||
else if (ProcessData->Console)
|
||||
if (ProcessData->Console)
|
||||
{
|
||||
Request->Status = CsrInsertObject(ProcessData,
|
||||
&Request->Data.GetInputHandleRequest.InputHandle,
|
||||
|
@ -352,12 +319,7 @@ CSR_API(CsrGetOutputHandle)
|
|||
Request->Header.u1.s1.TotalLength = sizeof(CSR_API_MESSAGE);
|
||||
Request->Header.u1.s1.DataLength = sizeof(CSR_API_MESSAGE) - sizeof(PORT_MESSAGE);
|
||||
|
||||
if (ProcessData == NULL)
|
||||
{
|
||||
Request->Data.GetOutputHandleRequest.OutputHandle = INVALID_HANDLE_VALUE;
|
||||
Request->Status = STATUS_INVALID_PARAMETER;
|
||||
}
|
||||
else if (ProcessData->Console)
|
||||
if (ProcessData->Console)
|
||||
{
|
||||
RtlEnterCriticalSection(&ProcessDataLock);
|
||||
Request->Status = CsrInsertObject(ProcessData,
|
||||
|
@ -381,15 +343,7 @@ CSR_API(CsrCloseHandle)
|
|||
Request->Header.u1.s1.TotalLength = sizeof(CSR_API_MESSAGE);
|
||||
Request->Header.u1.s1.DataLength = sizeof(CSR_API_MESSAGE) - sizeof(PORT_MESSAGE);
|
||||
|
||||
if (ProcessData == NULL)
|
||||
{
|
||||
Request->Status = STATUS_INVALID_PARAMETER;
|
||||
}
|
||||
else
|
||||
{
|
||||
Request->Status = CsrReleaseObject(ProcessData, Request->Data.CloseHandleRequest.Handle);
|
||||
}
|
||||
return Request->Status;
|
||||
return CsrReleaseObject(ProcessData, Request->Data.CloseHandleRequest.Handle);
|
||||
}
|
||||
|
||||
CSR_API(CsrVerifyHandle)
|
||||
|
@ -415,22 +369,14 @@ CSR_API(CsrDuplicateHandle)
|
|||
Request->Header.u1.s1.TotalLength = sizeof(CSR_API_MESSAGE);
|
||||
Request->Header.u1.s1.DataLength = sizeof(CSR_API_MESSAGE) - sizeof(PORT_MESSAGE);
|
||||
|
||||
if (NULL == ProcessData)
|
||||
{
|
||||
DPRINT1("Invalid source process\n");
|
||||
Request->Status = STATUS_INVALID_PARAMETER;
|
||||
return Request->Status;
|
||||
}
|
||||
|
||||
Index = (ULONG)Request->Data.DuplicateHandleRequest.Handle >> 2;
|
||||
RtlEnterCriticalSection(&ProcessData->HandleTableLock);
|
||||
if (Index >= ProcessData->HandleTableSize
|
||||
|| (Entry = &ProcessData->HandleTable[Index])->Object == NULL)
|
||||
{
|
||||
DPRINT1("Couldn't dup invalid handle %p\n", Request->Data.DuplicateHandleRequest.Handle);
|
||||
Request->Status = STATUS_INVALID_HANDLE;
|
||||
RtlLeaveCriticalSection(&ProcessData->HandleTableLock);
|
||||
return Request->Status;
|
||||
return STATUS_INVALID_HANDLE;
|
||||
}
|
||||
|
||||
if (Request->Data.DuplicateHandleRequest.Options & DUPLICATE_SAME_ACCESS)
|
||||
|
@ -445,9 +391,8 @@ CSR_API(CsrDuplicateHandle)
|
|||
{
|
||||
DPRINT1("Handle %p only has access %X; requested %X\n",
|
||||
Request->Data.DuplicateHandleRequest.Handle, Entry->Access, DesiredAccess);
|
||||
Request->Status = STATUS_INVALID_PARAMETER;
|
||||
RtlLeaveCriticalSection(&ProcessData->HandleTableLock);
|
||||
return Request->Status;
|
||||
return STATUS_INVALID_PARAMETER;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -473,18 +418,8 @@ CSR_API(CsrGetInputWaitHandle)
|
|||
Request->Header.u1.s1.TotalLength = sizeof(CSR_API_MESSAGE);
|
||||
Request->Header.u1.s1.DataLength = sizeof(CSR_API_MESSAGE) - sizeof(PORT_MESSAGE);
|
||||
|
||||
if (ProcessData == NULL)
|
||||
{
|
||||
|
||||
Request->Data.GetConsoleInputWaitHandle.InputWaitHandle = INVALID_HANDLE_VALUE;
|
||||
Request->Status = STATUS_INVALID_PARAMETER;
|
||||
}
|
||||
else
|
||||
{
|
||||
Request->Data.GetConsoleInputWaitHandle.InputWaitHandle = ProcessData->ConsoleEvent;
|
||||
Request->Status = STATUS_SUCCESS;
|
||||
}
|
||||
return Request->Status;
|
||||
Request->Data.GetConsoleInputWaitHandle.InputWaitHandle = ProcessData->ConsoleEvent;
|
||||
return STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
/* EOF */
|
||||
|
|
|
@ -26,26 +26,20 @@ static ULONG ServicesProcessId;
|
|||
|
||||
CSR_API(CsrRegisterServicesProcess)
|
||||
{
|
||||
NTSTATUS Status;
|
||||
|
||||
Request->Header.u1.s1.TotalLength = sizeof(CSR_API_MESSAGE);
|
||||
Request->Header.u1.s1.DataLength = sizeof(CSR_API_MESSAGE) - sizeof(PORT_MESSAGE);
|
||||
|
||||
if (ServicesProcessIdValid == TRUE)
|
||||
{
|
||||
/* Only accept a single call */
|
||||
Status = STATUS_INVALID_PARAMETER;
|
||||
return STATUS_INVALID_PARAMETER;
|
||||
}
|
||||
else
|
||||
{
|
||||
ServicesProcessId = (ULONG)Request->Data.RegisterServicesProcessRequest.ProcessId;
|
||||
ServicesProcessIdValid = TRUE;
|
||||
Status = STATUS_SUCCESS;
|
||||
return STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
Request->Status = Status;
|
||||
|
||||
return(Status);
|
||||
}
|
||||
|
||||
/* EOF */
|
||||
|
|
|
@ -70,7 +70,6 @@ FASTCALL
|
|||
CsrApiCallHandler(PCSRSS_PROCESS_DATA ProcessData,
|
||||
PCSR_API_MESSAGE Request)
|
||||
{
|
||||
BOOL Found = FALSE;
|
||||
unsigned DefIndex;
|
||||
ULONG Type;
|
||||
|
||||
|
@ -79,7 +78,7 @@ CsrApiCallHandler(PCSRSS_PROCESS_DATA ProcessData,
|
|||
DPRINT("CSR: API Number: %x ServerID: %x\n",Type, Request->Type >> 16);
|
||||
|
||||
/* FIXME: Extract DefIndex instead of looping */
|
||||
for (DefIndex = 0; ! Found && DefIndex < ApiDefinitionsCount; DefIndex++)
|
||||
for (DefIndex = 0; DefIndex < ApiDefinitionsCount; DefIndex++)
|
||||
{
|
||||
if (ApiDefinitions[DefIndex].Type == Type)
|
||||
{
|
||||
|
@ -92,18 +91,15 @@ CsrApiCallHandler(PCSRSS_PROCESS_DATA ProcessData,
|
|||
}
|
||||
else
|
||||
{
|
||||
(ApiDefinitions[DefIndex].Handler)(ProcessData, Request);
|
||||
Found = TRUE;
|
||||
Request->Status = (ApiDefinitions[DefIndex].Handler)(ProcessData, Request);
|
||||
}
|
||||
return;
|
||||
}
|
||||
}
|
||||
if (! Found)
|
||||
{
|
||||
DPRINT1("CSR: Unknown request type 0x%x\n", Request->Type);
|
||||
Request->Header.u1.s1.TotalLength = sizeof(CSR_API_MESSAGE);
|
||||
Request->Header.u1.s1.DataLength = sizeof(CSR_API_MESSAGE) - sizeof(PORT_MESSAGE);
|
||||
Request->Status = STATUS_INVALID_SYSTEM_SERVICE;
|
||||
}
|
||||
DPRINT1("CSR: Unknown request type 0x%x\n", Request->Type);
|
||||
Request->Header.u1.s1.TotalLength = sizeof(CSR_API_MESSAGE);
|
||||
Request->Header.u1.s1.DataLength = sizeof(CSR_API_MESSAGE) - sizeof(PORT_MESSAGE);
|
||||
Request->Status = STATUS_INVALID_SYSTEM_SERVICE;
|
||||
}
|
||||
|
||||
BOOL
|
||||
|
|
|
@ -312,8 +312,7 @@ CSR_API(CsrAddConsoleAlias)
|
|||
|
||||
if (lpExeName == NULL || lpSource == NULL)
|
||||
{
|
||||
Request->Status = STATUS_INVALID_PARAMETER;
|
||||
return Request->Status;
|
||||
return STATUS_INVALID_PARAMETER;
|
||||
}
|
||||
|
||||
Request->Status = ConioConsoleFromProcessData(ProcessData, &Console);
|
||||
|
@ -328,9 +327,8 @@ CSR_API(CsrAddConsoleAlias)
|
|||
Header = IntCreateAliasHeader(lpExeName);
|
||||
if (!Header)
|
||||
{
|
||||
Request->Status = STATUS_INSUFFICIENT_RESOURCES;
|
||||
ConioUnlockConsole(Console);
|
||||
return Request->Status;
|
||||
return STATUS_INSUFFICIENT_RESOURCES;
|
||||
}
|
||||
IntInsertAliasHeader(&Console->Aliases, Header);
|
||||
}
|
||||
|
@ -355,15 +353,13 @@ CSR_API(CsrAddConsoleAlias)
|
|||
|
||||
if (!Entry)
|
||||
{
|
||||
Request->Status = STATUS_INSUFFICIENT_RESOURCES;
|
||||
ConioUnlockConsole(Console);
|
||||
return Request->Status;
|
||||
return STATUS_INSUFFICIENT_RESOURCES;
|
||||
}
|
||||
|
||||
IntInsertAliasEntry(Header, Entry);
|
||||
Request->Status = STATUS_SUCCESS;
|
||||
ConioUnlockConsole(Console);
|
||||
return Request->Status;
|
||||
return STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
CSR_API(CsrGetConsoleAlias)
|
||||
|
@ -387,8 +383,7 @@ CSR_API(CsrGetConsoleAlias)
|
|||
if (Request->Data.GetConsoleAlias.ExeLength == 0 || lpTarget == NULL ||
|
||||
Request->Data.GetConsoleAlias.TargetBufferLength == 0 || Request->Data.GetConsoleAlias.SourceLength == 0)
|
||||
{
|
||||
Request->Status = STATUS_INVALID_PARAMETER;
|
||||
return Request->Status;
|
||||
return STATUS_INVALID_PARAMETER;
|
||||
}
|
||||
|
||||
Request->Status = ConioConsoleFromProcessData(ProcessData, &Console);
|
||||
|
@ -400,39 +395,34 @@ CSR_API(CsrGetConsoleAlias)
|
|||
Header = IntFindAliasHeader(Console->Aliases, lpExeName);
|
||||
if (!Header)
|
||||
{
|
||||
Request->Status = STATUS_INVALID_PARAMETER;
|
||||
ConioUnlockConsole(Console);
|
||||
return Request->Status;
|
||||
return STATUS_INVALID_PARAMETER;
|
||||
}
|
||||
|
||||
Entry = IntGetAliasEntry(Header, lpSource);
|
||||
if (!Entry)
|
||||
{
|
||||
Request->Status = STATUS_INVALID_PARAMETER;
|
||||
ConioUnlockConsole(Console);
|
||||
return Request->Status;
|
||||
return STATUS_INVALID_PARAMETER;
|
||||
}
|
||||
|
||||
Length = (wcslen(Entry->lpTarget)+1) * sizeof(WCHAR);
|
||||
if (Length > Request->Data.GetConsoleAlias.TargetBufferLength)
|
||||
{
|
||||
Request->Status = STATUS_BUFFER_TOO_SMALL;
|
||||
ConioUnlockConsole(Console);
|
||||
return Request->Status;
|
||||
return STATUS_BUFFER_TOO_SMALL;
|
||||
}
|
||||
|
||||
if (!ValidateBuffer(ProcessData, lpTarget, Request->Data.GetConsoleAlias.TargetBufferLength))
|
||||
{
|
||||
Request->Status = STATUS_ACCESS_VIOLATION;
|
||||
ConioUnlockConsole(Console);
|
||||
return Request->Status;
|
||||
return STATUS_ACCESS_VIOLATION;
|
||||
}
|
||||
|
||||
wcscpy(lpTarget, Entry->lpTarget);
|
||||
Request->Data.GetConsoleAlias.BytesWritten = Length;
|
||||
Request->Status = STATUS_SUCCESS;
|
||||
ConioUnlockConsole(Console);
|
||||
return Request->Status;
|
||||
return STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
CSR_API(CsrGetAllConsoleAliases)
|
||||
|
@ -443,8 +433,7 @@ CSR_API(CsrGetAllConsoleAliases)
|
|||
|
||||
if (Request->Data.GetAllConsoleAlias.lpExeName == NULL)
|
||||
{
|
||||
Request->Status = STATUS_INVALID_PARAMETER;
|
||||
return Request->Status;
|
||||
return STATUS_INVALID_PARAMETER;
|
||||
}
|
||||
|
||||
Request->Status = ConioConsoleFromProcessData(ProcessData, &Console);
|
||||
|
@ -456,25 +445,22 @@ CSR_API(CsrGetAllConsoleAliases)
|
|||
Header = IntFindAliasHeader(Console->Aliases, Request->Data.GetAllConsoleAlias.lpExeName);
|
||||
if (!Header)
|
||||
{
|
||||
Request->Status = STATUS_INVALID_PARAMETER;
|
||||
ConioUnlockConsole(Console);
|
||||
return Request->Status;
|
||||
return STATUS_INVALID_PARAMETER;
|
||||
}
|
||||
|
||||
if (IntGetAllConsoleAliasesLength(Header) > Request->Data.GetAllConsoleAlias.AliasBufferLength)
|
||||
{
|
||||
Request->Status = STATUS_BUFFER_OVERFLOW;
|
||||
ConioUnlockConsole(Console);
|
||||
return Request->Status;
|
||||
return STATUS_BUFFER_OVERFLOW;
|
||||
}
|
||||
|
||||
if (!ValidateBuffer(ProcessData,
|
||||
Request->Data.GetAllConsoleAlias.AliasBuffer,
|
||||
Request->Data.GetAllConsoleAlias.AliasBufferLength))
|
||||
{
|
||||
Request->Status = STATUS_ACCESS_VIOLATION;
|
||||
ConioUnlockConsole(Console);
|
||||
return Request->Status;
|
||||
return STATUS_ACCESS_VIOLATION;
|
||||
}
|
||||
|
||||
BytesWritten = IntGetAllConsoleAliases(Header,
|
||||
|
@ -482,9 +468,8 @@ CSR_API(CsrGetAllConsoleAliases)
|
|||
Request->Data.GetAllConsoleAlias.AliasBufferLength);
|
||||
|
||||
Request->Data.GetAllConsoleAlias.BytesWritten = BytesWritten;
|
||||
Request->Status = STATUS_SUCCESS;
|
||||
ConioUnlockConsole(Console);
|
||||
return Request->Status;
|
||||
return STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
CSR_API(CsrGetAllConsoleAliasesLength)
|
||||
|
@ -495,8 +480,7 @@ CSR_API(CsrGetAllConsoleAliasesLength)
|
|||
|
||||
if (Request->Data.GetAllConsoleAliasesLength.lpExeName == NULL)
|
||||
{
|
||||
Request->Status = STATUS_INVALID_PARAMETER;
|
||||
return Request->Status;
|
||||
return STATUS_INVALID_PARAMETER;
|
||||
}
|
||||
|
||||
Request->Status = ConioConsoleFromProcessData(ProcessData, &Console);
|
||||
|
@ -508,17 +492,14 @@ CSR_API(CsrGetAllConsoleAliasesLength)
|
|||
Header = IntFindAliasHeader(Console->Aliases, Request->Data.GetAllConsoleAliasesLength.lpExeName);
|
||||
if (!Header)
|
||||
{
|
||||
Request->Status = STATUS_INVALID_PARAMETER;
|
||||
ConioUnlockConsole(Console);
|
||||
return Request->Status;
|
||||
return STATUS_INVALID_PARAMETER;
|
||||
}
|
||||
|
||||
Length = IntGetAllConsoleAliasesLength(Header);
|
||||
Request->Data.GetAllConsoleAliasesLength.Length = Length;
|
||||
Request->Status = STATUS_SUCCESS;
|
||||
ConioUnlockConsole(Console);
|
||||
return Request->Status;
|
||||
|
||||
return STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
CSR_API(CsrGetConsoleAliasesExes)
|
||||
|
@ -539,25 +520,22 @@ CSR_API(CsrGetConsoleAliasesExes)
|
|||
|
||||
if (ExesLength > Request->Data.GetConsoleAliasesExes.Length)
|
||||
{
|
||||
Request->Status = STATUS_BUFFER_OVERFLOW;
|
||||
ConioUnlockConsole(Console);
|
||||
return Request->Status;
|
||||
return STATUS_BUFFER_OVERFLOW;
|
||||
}
|
||||
|
||||
if (Request->Data.GetConsoleAliasesExes.ExeNames == NULL)
|
||||
{
|
||||
Request->Status = STATUS_INVALID_PARAMETER;
|
||||
ConioUnlockConsole(Console);
|
||||
return Request->Status;
|
||||
return STATUS_INVALID_PARAMETER;
|
||||
}
|
||||
|
||||
if (!ValidateBuffer(ProcessData,
|
||||
Request->Data.GetConsoleAliasesExes.ExeNames,
|
||||
Request->Data.GetConsoleAliasesExes.Length))
|
||||
{
|
||||
Request->Status = STATUS_ACCESS_VIOLATION;
|
||||
ConioUnlockConsole(Console);
|
||||
return Request->Status;
|
||||
return STATUS_ACCESS_VIOLATION;
|
||||
}
|
||||
|
||||
BytesWritten = IntGetConsoleAliasesExes(Console->Aliases,
|
||||
|
@ -565,9 +543,8 @@ CSR_API(CsrGetConsoleAliasesExes)
|
|||
Request->Data.GetConsoleAliasesExes.Length);
|
||||
|
||||
Request->Data.GetConsoleAliasesExes.BytesWritten = BytesWritten;
|
||||
Request->Status = STATUS_SUCCESS;
|
||||
ConioUnlockConsole(Console);
|
||||
return Request->Status;
|
||||
return STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
CSR_API(CsrGetConsoleAliasesExesLength)
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -209,7 +209,7 @@ CSR_API(CsrCreateDesktop)
|
|||
BgInitialized = TRUE;
|
||||
if (! DtbgInit())
|
||||
{
|
||||
return Request->Status = STATUS_UNSUCCESSFUL;
|
||||
return STATUS_UNSUCCESSFUL;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -222,7 +222,7 @@ CSR_API(CsrCreateDesktop)
|
|||
if (NULL == ThreadData.Event)
|
||||
{
|
||||
DPRINT1("Failed to create event (error %d)\n", GetLastError());
|
||||
return Request->Status = STATUS_UNSUCCESSFUL;
|
||||
return STATUS_UNSUCCESSFUL;
|
||||
}
|
||||
ThreadHandle = CreateThread(NULL,
|
||||
0,
|
||||
|
@ -234,16 +234,14 @@ CSR_API(CsrCreateDesktop)
|
|||
{
|
||||
CloseHandle(ThreadData.Event);
|
||||
DPRINT1("Failed to create desktop window thread.\n");
|
||||
return Request->Status = STATUS_UNSUCCESSFUL;
|
||||
return STATUS_UNSUCCESSFUL;
|
||||
}
|
||||
CloseHandle(ThreadHandle);
|
||||
|
||||
WaitForSingleObject(ThreadData.Event, INFINITE);
|
||||
CloseHandle(ThreadData.Event);
|
||||
|
||||
Request->Status = ThreadData.Status;
|
||||
|
||||
return Request->Status;
|
||||
return ThreadData.Status;
|
||||
}
|
||||
|
||||
CSR_API(CsrShowDesktop)
|
||||
|
@ -261,13 +259,11 @@ CSR_API(CsrShowDesktop)
|
|||
nmh.ShowDesktop.Width = (int)Request->Data.ShowDesktopRequest.Width;
|
||||
nmh.ShowDesktop.Height = (int)Request->Data.ShowDesktopRequest.Height;
|
||||
|
||||
Request->Status = SendMessageW(Request->Data.ShowDesktopRequest.DesktopWindow,
|
||||
WM_NOTIFY,
|
||||
(WPARAM)nmh.hdr.hwndFrom,
|
||||
(LPARAM)&nmh)
|
||||
? STATUS_UNSUCCESSFUL : STATUS_SUCCESS;
|
||||
|
||||
return Request->Status;
|
||||
return SendMessageW(Request->Data.ShowDesktopRequest.DesktopWindow,
|
||||
WM_NOTIFY,
|
||||
(WPARAM)nmh.hdr.hwndFrom,
|
||||
(LPARAM)&nmh)
|
||||
? STATUS_UNSUCCESSFUL : STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
CSR_API(CsrHideDesktop)
|
||||
|
@ -282,13 +278,11 @@ CSR_API(CsrHideDesktop)
|
|||
nmh.hdr.idFrom = 0;
|
||||
nmh.hdr.code = PM_HIDE_DESKTOP;
|
||||
|
||||
Request->Status = SendMessageW(Request->Data.ShowDesktopRequest.DesktopWindow,
|
||||
WM_NOTIFY,
|
||||
(WPARAM)nmh.hdr.hwndFrom,
|
||||
(LPARAM)&nmh)
|
||||
? STATUS_UNSUCCESSFUL : STATUS_SUCCESS;
|
||||
|
||||
return Request->Status;
|
||||
return SendMessageW(Request->Data.ShowDesktopRequest.DesktopWindow,
|
||||
WM_NOTIFY,
|
||||
(WPARAM)nmh.hdr.hwndFrom,
|
||||
(LPARAM)&nmh)
|
||||
? STATUS_UNSUCCESSFUL : STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
BOOL FASTCALL
|
||||
|
|
|
@ -27,8 +27,7 @@ CSR_API(CsrRegisterLogonProcess)
|
|||
{
|
||||
if (0 != LogonProcess)
|
||||
{
|
||||
Request->Status = STATUS_LOGON_SESSION_EXISTS;
|
||||
return Request->Status;
|
||||
return STATUS_LOGON_SESSION_EXISTS;
|
||||
}
|
||||
LogonProcess = Request->Data.RegisterLogonProcessRequest.ProcessId;
|
||||
}
|
||||
|
@ -38,15 +37,12 @@ CSR_API(CsrRegisterLogonProcess)
|
|||
{
|
||||
DPRINT1("Current logon process 0x%x, can't deregister from process 0x%x\n",
|
||||
LogonProcess, Request->Header.ClientId.UniqueProcess);
|
||||
Request->Status = STATUS_NOT_LOGON_PROCESS;
|
||||
return Request->Status;
|
||||
return STATUS_NOT_LOGON_PROCESS;
|
||||
}
|
||||
LogonProcess = 0;
|
||||
}
|
||||
|
||||
Request->Status = STATUS_SUCCESS;
|
||||
|
||||
return Request->Status;
|
||||
return STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
CSR_API(CsrSetLogonNotifyWindow)
|
||||
|
@ -61,21 +57,17 @@ CSR_API(CsrSetLogonNotifyWindow)
|
|||
&WindowCreator))
|
||||
{
|
||||
DPRINT1("Can't get window creator\n");
|
||||
Request->Status = STATUS_INVALID_HANDLE;
|
||||
return Request->Status;
|
||||
return STATUS_INVALID_HANDLE;
|
||||
}
|
||||
if (WindowCreator != (DWORD)LogonProcess)
|
||||
{
|
||||
DPRINT1("Trying to register window not created by winlogon as notify window\n");
|
||||
Request->Status = STATUS_ACCESS_DENIED;
|
||||
return Request->Status;
|
||||
return STATUS_ACCESS_DENIED;
|
||||
}
|
||||
|
||||
LogonNotifyWindow = Request->Data.SetLogonNotifyWindowRequest.LogonNotifyWindow;
|
||||
|
||||
Request->Status = STATUS_SUCCESS;
|
||||
|
||||
return Request->Status;
|
||||
return STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
typedef struct tagSHUTDOWN_SETTINGS
|
||||
|
@ -938,17 +930,15 @@ CSR_API(CsrExitReactos)
|
|||
|
||||
if (0 == (Request->Data.ExitReactosRequest.Flags & EWX_INTERNAL_FLAG))
|
||||
{
|
||||
Request->Status = UserExitReactos((DWORD) Request->Header.ClientId.UniqueProcess,
|
||||
Request->Data.ExitReactosRequest.Flags);
|
||||
return UserExitReactos((DWORD) Request->Header.ClientId.UniqueProcess,
|
||||
Request->Data.ExitReactosRequest.Flags);
|
||||
}
|
||||
else
|
||||
{
|
||||
Request->Status = InternalExitReactos((DWORD) Request->Header.ClientId.UniqueProcess,
|
||||
(DWORD) Request->Header.ClientId.UniqueThread,
|
||||
Request->Data.ExitReactosRequest.Flags);
|
||||
return InternalExitReactos((DWORD) Request->Header.ClientId.UniqueProcess,
|
||||
(DWORD) Request->Header.ClientId.UniqueThread,
|
||||
Request->Data.ExitReactosRequest.Flags);
|
||||
}
|
||||
|
||||
return Request->Status;
|
||||
}
|
||||
|
||||
/* EOF */
|
||||
|
|
Loading…
Reference in a new issue