diff --git a/reactos/ntoskrnl/include/internal/ps.h b/reactos/ntoskrnl/include/internal/ps.h index 6692979f8d3..f7244cd5f2f 100644 --- a/reactos/ntoskrnl/include/internal/ps.h +++ b/reactos/ntoskrnl/include/internal/ps.h @@ -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: ps.h,v 1.63 2004/08/08 20:33:17 ion Exp $ +/* $Id: ps.h,v 1.64 2004/08/10 06:26:42 ion Exp $ * * FILE: ntoskrnl/ke/kthread.c * PURPOSE: Process manager definitions @@ -169,12 +169,6 @@ typedef struct _KTHREAD #define FSRTL_FAST_IO_TOP_LEVEL_IRP (0x04) #define FSRTL_MAX_TOP_LEVEL_IRP_FLAG (0x04) -typedef struct _TOP_LEVEL_IRP -{ - PIRP TopLevelIrp; - ULONG TopLevelIrpConst; -} TOP_LEVEL_IRP; - typedef struct { PACCESS_TOKEN Token; // 0x0 @@ -207,7 +201,7 @@ typedef struct _ETHREAD ULONG PerformanceCounterLow; /* 204/230 */ PPS_IMPERSONATION_INFO ImpersonationInfo; /* 208/234 */ LIST_ENTRY IrpList; /* 20C/238 */ - TOP_LEVEL_IRP* TopLevelIrp; /* 214/240 */ + PIRP TopLevelIrp; /* 214/240 */ PDEVICE_OBJECT DeviceToVerify; /* 218/244 */ ULONG ReadClusterSize; /* 21C/248 */ UCHAR ForwardClusterOnly; /* 220/24C */ diff --git a/reactos/ntoskrnl/io/buildirp.c b/reactos/ntoskrnl/io/buildirp.c index 4ee36f2ee29..9ea987d222c 100644 --- a/reactos/ntoskrnl/io/buildirp.c +++ b/reactos/ntoskrnl/io/buildirp.c @@ -1,4 +1,4 @@ -/* $Id: buildirp.c,v 1.41 2004/07/20 11:06:47 navaraf Exp $ +/* $Id: buildirp.c,v 1.42 2004/08/10 06:26:42 ion Exp $ * * COPYRIGHT: See COPYING in the top level directory * PROJECT: ReactOS kernel @@ -469,7 +469,7 @@ IoBuildSynchronousFsdRequestWithMdl(ULONG MajorFunction, StackPtr->CompletionRoutine = NULL; Irp->MdlAddress = Mdl; - Irp->UserBuffer = NULL; + Irp->UserBuffer = MmGetMdlVirtualAddress(Mdl); Irp->AssociatedIrp.SystemBuffer = NULL; if (MajorFunction == IRP_MJ_READ) diff --git a/reactos/ntoskrnl/io/cleanup.c b/reactos/ntoskrnl/io/cleanup.c index 8a5b49e6199..2f32e69e9f9 100644 --- a/reactos/ntoskrnl/io/cleanup.c +++ b/reactos/ntoskrnl/io/cleanup.c @@ -285,7 +285,7 @@ IoSecondStageCompletion( KeInitializeApc( &Irp->Tail.Apc, KeGetCurrentThread(), - OriginalApcEnvironment, + CurrentApcEnvironment, IoSecondStageCompletion_KernelApcRoutine, IoSecondStageCompletion_RundownApcRoutine, UserApcRoutine, diff --git a/reactos/ntoskrnl/io/irp.c b/reactos/ntoskrnl/io/irp.c index b3aa19da446..6b330b1fd3f 100644 --- a/reactos/ntoskrnl/io/irp.c +++ b/reactos/ntoskrnl/io/irp.c @@ -1,4 +1,4 @@ -/* $Id: irp.c,v 1.62 2004/06/23 21:42:50 ion Exp $ +/* $Id: irp.c,v 1.63 2004/08/10 06:26:42 ion Exp $ * * COPYRIGHT: See COPYING in the top level directory * PROJECT: ReactOS kernel @@ -116,7 +116,7 @@ IoIsValidNameGraftingBuffer( } /* - * @unimplemented + * @implemented */ PIRP STDCALL IoMakeAssociatedIrp(PIRP Irp, @@ -130,10 +130,19 @@ IoMakeAssociatedIrp(PIRP Irp, */ { PIRP AssocIrp; - - AssocIrp = IoAllocateIrp(StackSize,FALSE); - UNIMPLEMENTED; - return NULL; + + /* Allocate the IRP */ + AssocIrp = IoAllocateIrp(StackSize,FALSE); + + /* Set the Flags */ + AssocIrp->Flags |= IRP_ASSOCIATED_IRP; + + /* Set the Thread */ + AssocIrp->Tail.Overlay.Thread = Irp->Tail.Overlay.Thread; + + /* Associate them */ + AssocIrp->AssociatedIrp.MasterIrp = Irp; + return AssocIrp; } @@ -160,6 +169,7 @@ IoInitializeIrp(PIRP Irp, Irp->CurrentLocation = StackSize; InitializeListHead(&Irp->ThreadListEntry); Irp->Tail.Overlay.CurrentStackLocation = &Irp->Stack[(ULONG)StackSize]; + Irp->ApcEnvironment = KeGetCurrentThread()->ApcStateIndex; } @@ -422,7 +432,7 @@ IofCompleteRequest(PIRP Irp, DPRINT("Dispatching APC\n"); KeInitializeApc( &Irp->Tail.Apc, &Irp->Tail.Overlay.Thread->Tcb, - OriginalApcEnvironment, + Irp->ApcEnvironment, IoSecondStageCompletion,//kernel routine NULL, (PKNORMAL_ROUTINE) NULL, @@ -527,8 +537,8 @@ IoSetTopLevelIrp(IN PIRP Irp) { PETHREAD Thread; - Thread = PsGetCurrentThread(); - Thread->TopLevelIrp->TopLevelIrp = Irp; + Thread = PsGetCurrentThread(); + Thread->TopLevelIrp = Irp; } @@ -538,7 +548,7 @@ IoSetTopLevelIrp(IN PIRP Irp) PIRP STDCALL IoGetTopLevelIrp(VOID) { - return(PsGetCurrentThread()->TopLevelIrp->TopLevelIrp); + return(PsGetCurrentThread()->TopLevelIrp); }