Author: hbelusca Date: Sat Aug 15 16:34:21 2015 New Revision: 68715
URL: http://svn.reactos.org/svn/reactos?rev=68715&view=rev Log: [CSRSRV] - Don't use hardcoded structure types in sizeof's where possible. - Fix the parameters of NtSetInformationProcess calls in CsrSetBackground/ForegroundPriority. CORE-9911
Modified: trunk/reactos/subsystems/win32/csrsrv/procsup.c trunk/reactos/subsystems/win32/csrsrv/session.c trunk/reactos/subsystems/win32/csrsrv/thredsup.c
Modified: trunk/reactos/subsystems/win32/csrsrv/procsup.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/csrsrv/pro... ============================================================================== --- trunk/reactos/subsystems/win32/csrsrv/procsup.c [iso-8859-1] (original) +++ trunk/reactos/subsystems/win32/csrsrv/procsup.c [iso-8859-1] Sat Aug 15 16:34:21 2015 @@ -57,7 +57,7 @@ NtSetInformationProcess(NtCurrentProcess(), ProcessBasePriority, &BasePriority, - sizeof(KPRIORITY)); + sizeof(BasePriority)); }
/*++ @@ -79,7 +79,7 @@ NTAPI CsrSetToShutdownPriority(VOID) { - KPRIORITY SetBasePriority = (8 + 1) + 6; + KPRIORITY BasePriority = (8 + 1) + 6; BOOLEAN Old;
/* Get the shutdown privilege */ @@ -91,8 +91,8 @@ /* Set the Priority */ NtSetInformationProcess(NtCurrentProcess(), ProcessBasePriority, - &SetBasePriority, - sizeof(KPRIORITY)); + &BasePriority, + sizeof(BasePriority)); } }
@@ -488,11 +488,11 @@ } }
- /* Set the Exception port for us */ + /* Set the Exception Port for us */ Status = NtSetInformationProcess(hProcess, ProcessExceptionPort, &CsrApiPort, - sizeof(HANDLE)); + sizeof(CsrApiPort)); if (!NT_SUCCESS(Status)) { /* Failed */ @@ -549,7 +549,7 @@ Status = NtSetInformationProcess(hProcess, ProcessDebugPort, &CsrApiPort, - sizeof(HANDLE)); + sizeof(CsrApiPort)); ASSERT(NT_SUCCESS(Status)); if (!NT_SUCCESS(Status)) { @@ -563,7 +563,7 @@ /* Get the Thread Create Time */ Status = NtQueryInformationThread(hThread, ThreadTimes, - (PVOID)&KernelTimes, + &KernelTimes, sizeof(KernelTimes), NULL); if (!NT_SUCCESS(Status)) @@ -1072,7 +1072,7 @@ Status = NtSetInformationThread(NtCurrentThread(), ThreadImpersonationToken, &ImpersonationToken, - sizeof(HANDLE)); + sizeof(ImpersonationToken));
/* Return TRUE or FALSE */ return NT_SUCCESS(Status); @@ -1097,16 +1097,16 @@ NTAPI CsrSetBackgroundPriority(IN PCSR_PROCESS CsrProcess) { - PROCESS_PRIORITY_CLASS PriorityClass; + PROCESS_FOREGROUND_BACKGROUND ProcessPriority;
/* Set the Foreground bit off */ - PriorityClass.Foreground = FALSE; - - /* Set the new Priority */ + ProcessPriority.Foreground = FALSE; + + /* Set the new priority */ NtSetInformationProcess(CsrProcess->ProcessHandle, - ProcessPriorityClass, - &PriorityClass, - sizeof(PriorityClass)); + ProcessForegroundInformation, + &ProcessPriority, + sizeof(ProcessPriority)); }
/*++ @@ -1128,16 +1128,16 @@ NTAPI CsrSetForegroundPriority(IN PCSR_PROCESS CsrProcess) { - PROCESS_PRIORITY_CLASS PriorityClass; + PROCESS_FOREGROUND_BACKGROUND ProcessPriority;
/* Set the Foreground bit on */ - PriorityClass.Foreground = TRUE; - - /* Set the new Priority */ + ProcessPriority.Foreground = TRUE; + + /* Set the new priority */ NtSetInformationProcess(CsrProcess->ProcessHandle, - ProcessPriorityClass, - &PriorityClass, - sizeof(PriorityClass)); + ProcessForegroundInformation, + &ProcessPriority, + sizeof(ProcessPriority)); }
/*++
Modified: trunk/reactos/subsystems/win32/csrsrv/session.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/csrsrv/ses... ============================================================================== --- trunk/reactos/subsystems/win32/csrsrv/session.c [iso-8859-1] (original) +++ trunk/reactos/subsystems/win32/csrsrv/session.c [iso-8859-1] Sat Aug 15 16:34:21 2015 @@ -234,11 +234,11 @@ return TRUE; }
- /* Set the exception port */ + /* Set the Exception Port for us */ Status = NtSetInformationProcess(hProcess, ProcessExceptionPort, &CsrApiPort, - sizeof(HANDLE)); + sizeof(CsrApiPort));
/* Check for success */ if (!NT_SUCCESS(Status)) @@ -255,7 +255,7 @@ Status = NtQueryInformationThread(hThread, ThreadTimes, &KernelTimes, - sizeof(KERNEL_USER_TIMES), + sizeof(KernelTimes), NULL);
/* Check for success */
Modified: trunk/reactos/subsystems/win32/csrsrv/thredsup.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/csrsrv/thr... ============================================================================== --- trunk/reactos/subsystems/win32/csrsrv/thredsup.c [iso-8859-1] (original) +++ trunk/reactos/subsystems/win32/csrsrv/thredsup.c [iso-8859-1] Sat Aug 15 16:34:21 2015 @@ -714,7 +714,7 @@ /* Get the Thread Create Time */ Status = NtQueryInformationThread(hThread, ThreadTimes, - (PVOID)&KernelTimes, + &KernelTimes, sizeof(KernelTimes), NULL); if (!NT_SUCCESS(Status))