From 36433ba5ecef6274dfc8fb2c7c75a6851ec97cda Mon Sep 17 00:00:00 2001 From: Alex Ionescu Date: Tue, 23 Jan 2007 22:46:38 +0000 Subject: [PATCH] - Fix some warnings. - Rearrange some code. - Remove useless/deprecated code. svn path=/trunk/; revision=25607 --- reactos/ntoskrnl/ex/handle.c | 2 +- reactos/ntoskrnl/include/internal/ke_x.h | 14 ++++----- reactos/ntoskrnl/ke/wait.c | 40 ++++++------------------ 3 files changed, 16 insertions(+), 40 deletions(-) diff --git a/reactos/ntoskrnl/ex/handle.c b/reactos/ntoskrnl/ex/handle.c index 4ec0e6ec16c..5c6b2f2c75c 100644 --- a/reactos/ntoskrnl/ex/handle.c +++ b/reactos/ntoskrnl/ex/handle.c @@ -1066,7 +1066,7 @@ ExDupHandleTable(IN PEPROCESS Process, /* Loop each entry */ while (NewTable->NextHandleNeedingPool < - HandleTable->NextHandleNeedingPool) + HandleTable->NextHandleNeedingPool) { /* Insert it into the duplicated copy */ if (!ExpAllocateHandleTableEntrySlow(NewTable, FALSE)) diff --git a/reactos/ntoskrnl/include/internal/ke_x.h b/reactos/ntoskrnl/include/internal/ke_x.h index 69a480c6517..11050ad723a 100644 --- a/reactos/ntoskrnl/include/internal/ke_x.h +++ b/reactos/ntoskrnl/include/internal/ke_x.h @@ -193,7 +193,8 @@ Ke386SanitizeDr(IN PVOID DrAddress, (Object)->OwnerThread = Thread; \ \ /* Disable APCs if needed */ \ - Thread->KernelApcDisable -= (Object)->ApcDisable; \ + Thread->KernelApcDisable = Thread->KernelApcDisable - \ + (Object)->ApcDisable; \ \ /* Check if it's abandoned */ \ if ((Object)->Abandoned) \ @@ -238,7 +239,8 @@ Ke386SanitizeDr(IN PVOID DrAddress, (Object)->OwnerThread = Thread; \ \ /* Disable APCs if needed */ \ - Thread->KernelApcDisable -= (Object)->ApcDisable; \ + Thread->KernelApcDisable = Thread->KernelApcDisable - \ + (Object)->ApcDisable; \ \ /* Check if it's abandoned */ \ if ((Object)->Abandoned) \ @@ -259,7 +261,7 @@ Ke386SanitizeDr(IN PVOID DrAddress, // // Satisfies the wait of any nonmutant dispatcher object // -#define KiSatisfyNonMutantWait(Object, Thread) \ +#define KiSatisfyNonMutantWait(Object) \ { \ if (((Object)->Header.Type & TIMER_OR_EVENT_TYPE) == \ EventSynchronizationObject) \ @@ -454,7 +456,7 @@ KxSetTimerForThreadWait(IN PKTIMER Timer, /* Fill out the wait block */ \ WaitBlock = &WaitBlockArray[Index]; \ WaitBlock->Object = Object[Index]; \ - WaitBlock->WaitKey = Index; \ + WaitBlock->WaitKey = (USHORT)Index; \ WaitBlock->WaitType = WaitType; \ WaitBlock->Thread = Thread; \ \ @@ -1470,10 +1472,6 @@ VOID FORCEINLINE KiInsertWaitTimer(IN PKTIMER Timer) { - /* Set default data */ - Timer->Header.Inserted = TRUE; - if (!Timer->Period) Timer->Header.SignalState = FALSE; - /* Now insert it into the Timer List */ InsertAscendingList(&KiTimerListHead, Timer, diff --git a/reactos/ntoskrnl/ke/wait.c b/reactos/ntoskrnl/ke/wait.c index 52eef587058..19ec2498323 100644 --- a/reactos/ntoskrnl/ke/wait.c +++ b/reactos/ntoskrnl/ke/wait.c @@ -11,34 +11,10 @@ #include #define NDEBUG -#include +#include /* PRIVATE FUNCTIONS *********************************************************/ -#if 0 -VOID -FASTCALL -KiWaitSatisfyAll(PKWAIT_BLOCK FirstBlock) -{ - PKWAIT_BLOCK WaitBlock = FirstBlock; - PKTHREAD WaitThread = WaitBlock->Thread; - - /* Loop through all the Wait Blocks, and wake each Object */ - do - { - /* Make sure it hasn't timed out */ - if (WaitBlock->WaitKey != STATUS_TIMEOUT) - { - /* Wake the Object */ - KiSatisfyObjectWait((PKMUTANT)WaitBlock->Object, WaitThread); - } - - /* Move to the next block */ - WaitBlock = WaitBlock->NextWaitBlock; - } while (WaitBlock != FirstBlock); -} -#endif - VOID FASTCALL KiWaitTest(IN PVOID ObjectPointer, @@ -163,7 +139,7 @@ KiExitDispatcher(IN KIRQL OldIrql) BOOLEAN PendingApc; /* Make sure we're at synchronization level */ - ASSERT_IRQL_EQUAL(SYNCH_LEVEL); + ASSERT(KeGetCurrentIrql() == SYNCH_LEVEL); /* Check if we have deferred threads */ KiCheckDeferredReadyList(Prcb); @@ -288,7 +264,7 @@ KeDelayExecutionThread(IN KPROCESSOR_MODE WaitMode, /* Check if the timer expired */ InterruptTime.QuadPart = KeQueryInterruptTime(); - if (InterruptTime.QuadPart >= Timer->DueTime.QuadPart) + if ((ULONGLONG)InterruptTime.QuadPart >= Timer->DueTime.QuadPart) { /* It did, so we don't need to wait */ goto NoWait; @@ -426,7 +402,7 @@ KeWaitForSingleObject(IN PVOID Object, else if (CurrentObject->Header.SignalState > 0) { /* Another satisfied object */ - KiSatisfyNonMutantWait(CurrentObject, Thread); + KiSatisfyNonMutantWait(CurrentObject); WaitStatus = STATUS_WAIT_0; goto DontWait; } @@ -440,7 +416,8 @@ KeWaitForSingleObject(IN PVOID Object, { /* Check if the timer expired */ InterruptTime.QuadPart = KeQueryInterruptTime(); - if (InterruptTime.QuadPart >= Timer->DueTime.QuadPart) + if ((ULONGLONG)InterruptTime.QuadPart >= + Timer->DueTime.QuadPart) { /* It did, so we don't need to wait */ WaitStatus = STATUS_TIMEOUT; @@ -626,7 +603,7 @@ KeWaitForMultipleObjects(IN ULONG Count, else if (CurrentObject->Header.SignalState > 0) { /* Another signaled object, unwait and return */ - KiSatisfyNonMutantWait(CurrentObject, Thread); + KiSatisfyNonMutantWait(CurrentObject); WaitStatus = Index; goto DontWait; } @@ -702,7 +679,8 @@ KeWaitForMultipleObjects(IN ULONG Count, { /* Check if the timer expired */ InterruptTime.QuadPart = KeQueryInterruptTime(); - if (InterruptTime.QuadPart >= Timer->DueTime.QuadPart) + if ((ULONGLONG)InterruptTime.QuadPart >= + Timer->DueTime.QuadPart) { /* It did, so we don't need to wait */ WaitStatus = STATUS_TIMEOUT;