-corrected protoype

svn path=/trunk/; revision=4848
This commit is contained in:
Gunnar Dalsnes 2003-06-05 23:38:37 +00:00
parent aba6a902a2
commit a988e5ab0e
11 changed files with 49 additions and 34 deletions

View file

@ -87,11 +87,11 @@ ULONG STDCALL KeGetPreviousMode (VOID);
VOID STDCALL KeInitializeApc (PKAPC Apc, VOID STDCALL KeInitializeApc (PKAPC Apc,
struct _KTHREAD* Thread, struct _KTHREAD* Thread,
UCHAR StateIndex, KAPC_ENVIRONMENT Environment,
PKKERNEL_ROUTINE KernelRoutine, PKKERNEL_ROUTINE KernelRoutine,
PKRUNDOWN_ROUTINE RundownRoutine, PKRUNDOWN_ROUTINE RundownRoutine,
PKNORMAL_ROUTINE NormalRoutine, PKNORMAL_ROUTINE NormalRoutine,
UCHAR Mode, KPROCESSOR_MODE Mode,
PVOID Context); PVOID Context);
/* /*
@ -172,7 +172,7 @@ KeInsertQueue(IN PKQUEUE Queue,
BOOLEAN STDCALL KeInsertQueueApc (PKAPC Apc, BOOLEAN STDCALL KeInsertQueueApc (PKAPC Apc,
PVOID SystemArgument1, PVOID SystemArgument1,
PVOID SystemArgument2, PVOID SystemArgument2,
UCHAR Mode); KPRIORITY PriorityBoost);
BOOLEAN STDCALL KeInsertQueueDpc (PKDPC Dpc, BOOLEAN STDCALL KeInsertQueueDpc (PKDPC Dpc,
PVOID SystemArgument1, PVOID SystemArgument1,

View file

@ -44,6 +44,12 @@ typedef VOID STDCALL_FUNC
typedef VOID STDCALL_FUNC typedef VOID STDCALL_FUNC
(*PKRUNDOWN_ROUTINE)(struct _KAPC* Apc); (*PKRUNDOWN_ROUTINE)(struct _KAPC* Apc);
typedef enum _KAPC_ENVIRONMENT {
OriginalApcEnvironment,
AttachedApcEnvironment,
CurrentApcEnvironment
} KAPC_ENVIRONMENT;
struct _DISPATCHER_HEADER; struct _DISPATCHER_HEADER;
typedef struct _KWAIT_BLOCK typedef struct _KWAIT_BLOCK

View file

@ -256,7 +256,7 @@ IoSecondStageCompletion(
KeInitializeApc( &Irp->Tail.Apc, KeInitializeApc( &Irp->Tail.Apc,
KeGetCurrentThread(), KeGetCurrentThread(),
0, OriginalApcEnvironment,
IoSecondStageCompletion_KernelApcRoutine, IoSecondStageCompletion_KernelApcRoutine,
IoSecondStageCompletion_RundownApcRoutine, IoSecondStageCompletion_RundownApcRoutine,
UserApcRoutine, UserApcRoutine,
@ -266,7 +266,7 @@ IoSecondStageCompletion(
KeInsertQueueApc( &Irp->Tail.Apc, KeInsertQueueApc( &Irp->Tail.Apc,
Irp, Irp,
NULL, NULL,
KernelMode); PriorityBoost);
//NOTE: kernel (or rundown) routine frees the IRP //NOTE: kernel (or rundown) routine frees the IRP

View file

@ -1,4 +1,4 @@
/* $Id: irp.c,v 1.50 2003/05/22 00:47:04 gdalsnes Exp $ /* $Id: irp.c,v 1.51 2003/06/05 23:37:10 gdalsnes Exp $
* *
* COPYRIGHT: See COPYING in the top level directory * COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel * PROJECT: ReactOS kernel
@ -270,7 +270,7 @@ IofCompleteRequest(PIRP Irp,
DPRINT("Dispatching APC\n"); DPRINT("Dispatching APC\n");
KeInitializeApc( &Irp->Tail.Apc, KeInitializeApc( &Irp->Tail.Apc,
&Irp->Tail.Overlay.Thread->Tcb, &Irp->Tail.Overlay.Thread->Tcb,
0, OriginalApcEnvironment,
IoSecondStageCompletion, IoSecondStageCompletion,
NULL, NULL,
(PKNORMAL_ROUTINE) NULL, (PKNORMAL_ROUTINE) NULL,
@ -280,7 +280,7 @@ IofCompleteRequest(PIRP Irp,
bStatus = KeInsertQueueApc(&Irp->Tail.Apc, bStatus = KeInsertQueueApc(&Irp->Tail.Apc,
(PVOID)Irp, (PVOID)Irp,
(PVOID)(ULONG)PriorityBoost, (PVOID)(ULONG)PriorityBoost,
KernelMode); PriorityBoost);
if (bStatus == FALSE) if (bStatus == FALSE)
{ {

View file

@ -291,7 +291,7 @@ BOOLEAN STDCALL
KeInsertQueueApc (PKAPC Apc, KeInsertQueueApc (PKAPC Apc,
PVOID SystemArgument1, PVOID SystemArgument1,
PVOID SystemArgument2, PVOID SystemArgument2,
UCHAR Mode) KPRIORITY PriorityBoost)
/* /*
* FUNCTION: Queues an APC for execution * FUNCTION: Queues an APC for execution
* ARGUMENTS: * ARGUMENTS:
@ -305,8 +305,8 @@ KeInsertQueueApc (PKAPC Apc,
PKTHREAD TargetThread; PKTHREAD TargetThread;
DPRINT("KeInsertQueueApc(Apc %x, SystemArgument1 %x, " DPRINT("KeInsertQueueApc(Apc %x, SystemArgument1 %x, "
"SystemArgument2 %x, Mode %d)\n",Apc,SystemArgument1, "SystemArgument2 %x)\n",Apc,SystemArgument1,
SystemArgument2,Mode); SystemArgument2);
KeAcquireSpinLock(&PiApcLock, &oldlvl); KeAcquireSpinLock(&PiApcLock, &oldlvl);
@ -443,11 +443,11 @@ KeRemoveQueueApc (PKAPC Apc)
VOID STDCALL VOID STDCALL
KeInitializeApc(PKAPC Apc, KeInitializeApc(PKAPC Apc,
PKTHREAD Thread, PKTHREAD Thread,
UCHAR StateIndex, KAPC_ENVIRONMENT Environment,
PKKERNEL_ROUTINE KernelRoutine, PKKERNEL_ROUTINE KernelRoutine,
PKRUNDOWN_ROUTINE RundownRoutine, PKRUNDOWN_ROUTINE RundownRoutine,
PKNORMAL_ROUTINE NormalRoutine, PKNORMAL_ROUTINE NormalRoutine,
UCHAR Mode, KPROCESSOR_MODE Mode,
PVOID Context) PVOID Context)
/* /*
* FUNCTION: Initialize an APC object * FUNCTION: Initialize an APC object
@ -463,9 +463,9 @@ KeInitializeApc(PKAPC Apc,
* Context = Parameter to be passed to the APC routine * Context = Parameter to be passed to the APC routine
*/ */
{ {
DPRINT("KeInitializeApc(Apc %x, Thread %x, StateIndex %d, " DPRINT("KeInitializeApc(Apc %x, Thread %x, Environment %d, "
"KernelRoutine %x, RundownRoutine %x, NormalRoutine %x, Mode %d, " "KernelRoutine %x, RundownRoutine %x, NormalRoutine %x, Mode %d, "
"Context %x)\n",Apc,Thread,StateIndex,KernelRoutine,RundownRoutine, "Context %x)\n",Apc,Thread,Environment,KernelRoutine,RundownRoutine,
NormalRoutine,Mode,Context); NormalRoutine,Mode,Context);
memset(Apc, 0, sizeof(KAPC)); memset(Apc, 0, sizeof(KAPC));
@ -477,7 +477,16 @@ KeInitializeApc(PKAPC Apc,
Apc->NormalRoutine = NormalRoutine; Apc->NormalRoutine = NormalRoutine;
Apc->NormalContext = Context; Apc->NormalContext = Context;
Apc->Inserted = FALSE; Apc->Inserted = FALSE;
Apc->ApcStateIndex = StateIndex;
if (Environment == CurrentApcEnvironment)
{
Apc->ApcStateIndex = Thread->ApcStateIndex;
}
else
{
Apc->ApcStateIndex = Environment;
}
if (Apc->NormalRoutine != NULL) if (Apc->NormalRoutine != NULL)
{ {
Apc->ApcMode = Mode; Apc->ApcMode = Mode;
@ -535,7 +544,7 @@ NtQueueApcThread(HANDLE ThreadHandle,
KeInitializeApc(Apc, KeInitializeApc(Apc,
&Thread->Tcb, &Thread->Tcb,
0, OriginalApcEnvironment,
NtQueueApcKernelRoutine, NtQueueApcKernelRoutine,
NtQueueApcRundownRoutine, NtQueueApcRundownRoutine,
ApcRoutine, ApcRoutine,
@ -544,7 +553,7 @@ NtQueueApcThread(HANDLE ThreadHandle,
KeInsertQueueApc(Apc, KeInsertQueueApc(Apc,
SystemArgument1, SystemArgument1,
SystemArgument2, SystemArgument2,
UserMode); IO_NO_INCREMENT);
ObDereferenceObject(Thread); ObDereferenceObject(Thread);
return(STATUS_SUCCESS); return(STATUS_SUCCESS);

View file

@ -16,7 +16,7 @@
* along with this program; if not, write to the Free Software * along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/ */
/* $Id: kthread.c,v 1.37 2003/05/17 15:28:06 ekohl Exp $ /* $Id: kthread.c,v 1.38 2003/06/05 23:37:00 gdalsnes Exp $
* *
* FILE: ntoskrnl/ke/kthread.c * FILE: ntoskrnl/ke/kthread.c
* PURPOSE: Microkernel thread support * PURPOSE: Microkernel thread support
@ -214,7 +214,7 @@ KeInitializeThread(PKPROCESS Process, PKTHREAD Thread, BOOLEAN First)
Thread->AutoAlignment = 0; Thread->AutoAlignment = 0;
KeInitializeApc(&Thread->SuspendApc, KeInitializeApc(&Thread->SuspendApc,
Thread, Thread,
0, OriginalApcEnvironment,
PiSuspendThreadKernelRoutine, PiSuspendThreadKernelRoutine,
PiSuspendThreadRundownRoutine, PiSuspendThreadRundownRoutine,
PiSuspendThreadNormalRoutine, PiSuspendThreadNormalRoutine,

View file

@ -1,4 +1,4 @@
/* $Id: nttimer.c,v 1.17 2003/02/27 15:41:54 gdalsnes Exp $ /* $Id: nttimer.c,v 1.18 2003/06/05 23:36:48 gdalsnes Exp $
* *
* COPYRIGHT: See COPYING in the top level directory * COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel * PROJECT: ReactOS kernel
@ -99,7 +99,7 @@ NtpTimerDpcRoutine(PKDPC Dpc,
KeInsertQueueApc(&Timer->Apc, KeInsertQueueApc(&Timer->Apc,
SystemArgument1, SystemArgument1,
SystemArgument2, SystemArgument2,
KernelMode); IO_NO_INCREMENT);
} }
} }
@ -335,7 +335,7 @@ NtSetTimer(IN HANDLE TimerHandle,
if( TimerApcRoutine ) if( TimerApcRoutine )
KeInitializeApc(&Timer->Apc, KeInitializeApc(&Timer->Apc,
KeGetCurrentThread(), KeGetCurrentThread(),
0, OriginalApcEnvironment,
(PKKERNEL_ROUTINE)NtpTimerApcKernelRoutine, (PKKERNEL_ROUTINE)NtpTimerApcKernelRoutine,
(PKRUNDOWN_ROUTINE)NULL, (PKRUNDOWN_ROUTINE)NULL,
(PKNORMAL_ROUTINE)TimerApcRoutine, (PKNORMAL_ROUTINE)TimerApcRoutine,

View file

@ -1,4 +1,4 @@
/* $Id: create.c,v 1.59 2003/06/05 22:45:38 gdalsnes Exp $ /* $Id: create.c,v 1.60 2003/06/05 23:36:35 gdalsnes Exp $
* *
* COPYRIGHT: See COPYING in the top level directory * COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel * PROJECT: ReactOS kernel
@ -626,10 +626,10 @@ NtCreateThread(PHANDLE ThreadHandle,
* routine. * routine.
*/ */
LdrInitApc = ExAllocatePool(NonPagedPool, sizeof(KAPC)); LdrInitApc = ExAllocatePool(NonPagedPool, sizeof(KAPC));
KeInitializeApc(LdrInitApc, &Thread->Tcb, 0, LdrInitApcKernelRoutine, KeInitializeApc(LdrInitApc, &Thread->Tcb, OriginalApcEnvironment, LdrInitApcKernelRoutine,
LdrInitApcRundownRoutine, LdrpGetSystemDllEntryPoint(), LdrInitApcRundownRoutine, LdrpGetSystemDllEntryPoint(),
UserMode, NULL); UserMode, NULL);
KeInsertQueueApc(LdrInitApc, NULL, NULL, UserMode); KeInsertQueueApc(LdrInitApc, NULL, NULL, IO_NO_INCREMENT);
/* /*
* Start the thread running and force it to execute the APC(s) we just * Start the thread running and force it to execute the APC(s) we just

View file

@ -17,7 +17,7 @@
* along with this program; if not, write to the Free Software * along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/ */
/* $Id: debug.c,v 1.7 2002/12/22 11:35:15 gvg Exp $ /* $Id: debug.c,v 1.8 2003/06/05 23:36:35 gdalsnes Exp $
* *
* PROJECT: ReactOS kernel * PROJECT: ReactOS kernel
* FILE: ntoskrnl/ps/debug.c * FILE: ntoskrnl/ps/debug.c
@ -236,7 +236,7 @@ NtGetContextThread(IN HANDLE ThreadHandle,
KeInitializeApc(&Apc, KeInitializeApc(&Apc,
&Thread->Tcb, &Thread->Tcb,
0, OriginalApcEnvironment,
KeGetContextKernelRoutine, KeGetContextKernelRoutine,
KeGetContextRundownRoutine, KeGetContextRundownRoutine,
NULL, NULL,
@ -245,7 +245,7 @@ NtGetContextThread(IN HANDLE ThreadHandle,
KeInsertQueueApc(&Apc, KeInsertQueueApc(&Apc,
(PVOID)&Event, (PVOID)&Event,
(PVOID)&AStatus, (PVOID)&AStatus,
0); IO_NO_INCREMENT);
Status = KeWaitForSingleObject(&Event, Status = KeWaitForSingleObject(&Event,
0, 0,
UserMode, UserMode,

View file

@ -1,4 +1,4 @@
/* $Id: kill.c,v 1.59 2003/05/01 22:00:31 gvg Exp $ /* $Id: kill.c,v 1.60 2003/06/05 23:36:35 gdalsnes Exp $
* *
* COPYRIGHT: See COPYING in the top level directory * COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel * PROJECT: ReactOS kernel
@ -235,7 +235,7 @@ PsTerminateOtherThread(PETHREAD Thread,
Apc = ExAllocatePoolWithTag(NonPagedPool, sizeof(KAPC), TAG_TERMINATE_APC); Apc = ExAllocatePoolWithTag(NonPagedPool, sizeof(KAPC), TAG_TERMINATE_APC);
KeInitializeApc(Apc, KeInitializeApc(Apc,
&Thread->Tcb, &Thread->Tcb,
0, OriginalApcEnvironment,
PiTerminateThreadKernelRoutine, PiTerminateThreadKernelRoutine,
PiTerminateThreadRundownRoutine, PiTerminateThreadRundownRoutine,
PiTerminateThreadNormalRoutine, PiTerminateThreadNormalRoutine,
@ -244,7 +244,7 @@ PsTerminateOtherThread(PETHREAD Thread,
KeInsertQueueApc(Apc, KeInsertQueueApc(Apc,
NULL, NULL,
NULL, NULL,
KernelMode); IO_NO_INCREMENT);
if (THREAD_STATE_BLOCKED == Thread->Tcb.State && UserMode == Thread->Tcb.WaitMode) if (THREAD_STATE_BLOCKED == Thread->Tcb.State && UserMode == Thread->Tcb.WaitMode)
{ {
DPRINT("Unblocking thread\n"); DPRINT("Unblocking thread\n");

View file

@ -16,7 +16,7 @@
* along with this program; if not, write to the Free Software * along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/ */
/* $Id: suspend.c,v 1.10 2002/09/08 10:23:40 chorns Exp $ /* $Id: suspend.c,v 1.11 2003/06/05 23:36:35 gdalsnes Exp $
* *
* PROJECT: ReactOS kernel * PROJECT: ReactOS kernel
* FILE: ntoskrnl/ps/suspend.c * FILE: ntoskrnl/ps/suspend.c
@ -113,7 +113,7 @@ PsSuspendThread(PETHREAD Thread, PULONG PreviousSuspendCount)
KeInsertQueueApc(&Thread->Tcb.SuspendApc, KeInsertQueueApc(&Thread->Tcb.SuspendApc,
NULL, NULL,
NULL, NULL,
0); IO_NO_INCREMENT);
} }
ExReleaseFastMutex(&SuspendMutex); ExReleaseFastMutex(&SuspendMutex);
if (PreviousSuspendCount != NULL) if (PreviousSuspendCount != NULL)