-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,
struct _KTHREAD* Thread,
UCHAR StateIndex,
KAPC_ENVIRONMENT Environment,
PKKERNEL_ROUTINE KernelRoutine,
PKRUNDOWN_ROUTINE RundownRoutine,
PKNORMAL_ROUTINE NormalRoutine,
UCHAR Mode,
KPROCESSOR_MODE Mode,
PVOID Context);
/*
@ -172,7 +172,7 @@ KeInsertQueue(IN PKQUEUE Queue,
BOOLEAN STDCALL KeInsertQueueApc (PKAPC Apc,
PVOID SystemArgument1,
PVOID SystemArgument2,
UCHAR Mode);
KPRIORITY PriorityBoost);
BOOLEAN STDCALL KeInsertQueueDpc (PKDPC Dpc,
PVOID SystemArgument1,

View file

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

View file

@ -256,7 +256,7 @@ IoSecondStageCompletion(
KeInitializeApc( &Irp->Tail.Apc,
KeGetCurrentThread(),
0,
OriginalApcEnvironment,
IoSecondStageCompletion_KernelApcRoutine,
IoSecondStageCompletion_RundownApcRoutine,
UserApcRoutine,
@ -266,7 +266,7 @@ IoSecondStageCompletion(
KeInsertQueueApc( &Irp->Tail.Apc,
Irp,
NULL,
KernelMode);
PriorityBoost);
//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
* PROJECT: ReactOS kernel
@ -270,7 +270,7 @@ IofCompleteRequest(PIRP Irp,
DPRINT("Dispatching APC\n");
KeInitializeApc( &Irp->Tail.Apc,
&Irp->Tail.Overlay.Thread->Tcb,
0,
OriginalApcEnvironment,
IoSecondStageCompletion,
NULL,
(PKNORMAL_ROUTINE) NULL,
@ -280,7 +280,7 @@ IofCompleteRequest(PIRP Irp,
bStatus = KeInsertQueueApc(&Irp->Tail.Apc,
(PVOID)Irp,
(PVOID)(ULONG)PriorityBoost,
KernelMode);
PriorityBoost);
if (bStatus == FALSE)
{

View file

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

View file

@ -16,7 +16,7 @@
* along with this program; if not, write to the Free Software
* 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
* PURPOSE: Microkernel thread support
@ -214,7 +214,7 @@ KeInitializeThread(PKPROCESS Process, PKTHREAD Thread, BOOLEAN First)
Thread->AutoAlignment = 0;
KeInitializeApc(&Thread->SuspendApc,
Thread,
0,
OriginalApcEnvironment,
PiSuspendThreadKernelRoutine,
PiSuspendThreadRundownRoutine,
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
* PROJECT: ReactOS kernel
@ -99,7 +99,7 @@ NtpTimerDpcRoutine(PKDPC Dpc,
KeInsertQueueApc(&Timer->Apc,
SystemArgument1,
SystemArgument2,
KernelMode);
IO_NO_INCREMENT);
}
}
@ -335,7 +335,7 @@ NtSetTimer(IN HANDLE TimerHandle,
if( TimerApcRoutine )
KeInitializeApc(&Timer->Apc,
KeGetCurrentThread(),
0,
OriginalApcEnvironment,
(PKKERNEL_ROUTINE)NtpTimerApcKernelRoutine,
(PKRUNDOWN_ROUTINE)NULL,
(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
* PROJECT: ReactOS kernel
@ -626,10 +626,10 @@ NtCreateThread(PHANDLE ThreadHandle,
* routine.
*/
LdrInitApc = ExAllocatePool(NonPagedPool, sizeof(KAPC));
KeInitializeApc(LdrInitApc, &Thread->Tcb, 0, LdrInitApcKernelRoutine,
KeInitializeApc(LdrInitApc, &Thread->Tcb, OriginalApcEnvironment, LdrInitApcKernelRoutine,
LdrInitApcRundownRoutine, LdrpGetSystemDllEntryPoint(),
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

View file

@ -17,7 +17,7 @@
* along with this program; if not, write to the Free Software
* 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
* FILE: ntoskrnl/ps/debug.c
@ -236,7 +236,7 @@ NtGetContextThread(IN HANDLE ThreadHandle,
KeInitializeApc(&Apc,
&Thread->Tcb,
0,
OriginalApcEnvironment,
KeGetContextKernelRoutine,
KeGetContextRundownRoutine,
NULL,
@ -245,7 +245,7 @@ NtGetContextThread(IN HANDLE ThreadHandle,
KeInsertQueueApc(&Apc,
(PVOID)&Event,
(PVOID)&AStatus,
0);
IO_NO_INCREMENT);
Status = KeWaitForSingleObject(&Event,
0,
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
* PROJECT: ReactOS kernel
@ -235,7 +235,7 @@ PsTerminateOtherThread(PETHREAD Thread,
Apc = ExAllocatePoolWithTag(NonPagedPool, sizeof(KAPC), TAG_TERMINATE_APC);
KeInitializeApc(Apc,
&Thread->Tcb,
0,
OriginalApcEnvironment,
PiTerminateThreadKernelRoutine,
PiTerminateThreadRundownRoutine,
PiTerminateThreadNormalRoutine,
@ -244,7 +244,7 @@ PsTerminateOtherThread(PETHREAD Thread,
KeInsertQueueApc(Apc,
NULL,
NULL,
KernelMode);
IO_NO_INCREMENT);
if (THREAD_STATE_BLOCKED == Thread->Tcb.State && UserMode == Thread->Tcb.WaitMode)
{
DPRINT("Unblocking thread\n");

View file

@ -16,7 +16,7 @@
* along with this program; if not, write to the Free Software
* 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
* FILE: ntoskrnl/ps/suspend.c
@ -113,7 +113,7 @@ PsSuspendThread(PETHREAD Thread, PULONG PreviousSuspendCount)
KeInsertQueueApc(&Thread->Tcb.SuspendApc,
NULL,
NULL,
0);
IO_NO_INCREMENT);
}
ExReleaseFastMutex(&SuspendMutex);
if (PreviousSuspendCount != NULL)