Use proper IRP structure

svn path=/trunk/; revision=11515
This commit is contained in:
Alex Ionescu 2004-10-31 22:21:41 +00:00
parent 129c75c64d
commit 47cef79cec
4 changed files with 15 additions and 18 deletions

View file

@ -1,6 +1,6 @@
#ifndef _INCLUDE_DDK_IOFUNCS_H #ifndef _INCLUDE_DDK_IOFUNCS_H
#define _INCLUDE_DDK_IOFUNCS_H #define _INCLUDE_DDK_IOFUNCS_H
/* $Id: iofuncs.h,v 1.45 2004/10/22 20:51:44 ekohl Exp $ */ /* $Id: iofuncs.h,v 1.46 2004/10/31 22:21:41 ion Exp $ */
#ifdef __NTOSKRNL__ #ifdef __NTOSKRNL__
extern POBJECT_TYPE EXPORTED IoAdapterObjectType; extern POBJECT_TYPE EXPORTED IoAdapterObjectType;
@ -1042,14 +1042,8 @@ IoSetTopLevelIrp (
USHORT USHORT
IoSizeOfIrp (CCHAR StackSize) IoSizeOfIrp (CCHAR StackSize)
*/ */
#define IoSizeOfIrp(StackSize) \
((USHORT)(sizeof(IRP)+(((StackSize)-1)*sizeof(IO_STACK_LOCATION))))
/* original macro */
/*
#define IoSizeOfIrp(StackSize) \ #define IoSizeOfIrp(StackSize) \
((USHORT)(sizeof(IRP)+((StackSize)*sizeof(IO_STACK_LOCATION)))) ((USHORT)(sizeof(IRP)+((StackSize)*sizeof(IO_STACK_LOCATION))))
*/
/* /*
* FUNCTION: Dequeues the next IRP from the device's associated queue and * FUNCTION: Dequeues the next IRP from the device's associated queue and

View file

@ -1,4 +1,4 @@
/* $Id: iotypes.h,v 1.66 2004/10/23 23:43:23 ion Exp $ /* $Id: iotypes.h,v 1.67 2004/10/31 22:21:41 ion Exp $
* *
*/ */
@ -869,7 +869,6 @@ typedef struct _IRP
KAPC Apc; KAPC Apc;
ULONG CompletionKey; ULONG CompletionKey;
} Tail; } Tail;
IO_STACK_LOCATION Stack[1];
} IRP, *PIRP; } IRP, *PIRP;
#define VPB_MOUNTED 0x00000001 #define VPB_MOUNTED 0x00000001

View file

@ -190,7 +190,8 @@ IoSecondStageCompletion(
InitializeListHead(&Irp->ThreadListEntry); InitializeListHead(&Irp->ThreadListEntry);
} }
IoStack = &Irp->Stack[(ULONG)Irp->CurrentLocation]; DPRINT("Tail Value %x, Irp Value %x\n", Irp->Tail.Overlay.CurrentStackLocation - (PIO_STACK_LOCATION)(Irp+1), Irp->CurrentLocation);
by
DeviceObject = IoStack->DeviceObject; DeviceObject = IoStack->DeviceObject;
DPRINT("IoSecondStageCompletion(Irp %x, PriorityBoost %d)\n", Irp, PriorityBoost); DPRINT("IoSecondStageCompletion(Irp %x, PriorityBoost %d)\n", Irp, PriorityBoost);

View file

@ -1,4 +1,4 @@
/* $Id: irp.c,v 1.68 2004/10/22 20:25:53 ekohl Exp $ /* $Id: irp.c,v 1.69 2004/10/31 22:21:41 ion Exp $
* *
* COPYRIGHT: See COPYING in the top level directory * COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel * PROJECT: ReactOS kernel
@ -164,12 +164,14 @@ IoInitializeIrp(PIRP Irp,
{ {
ASSERT(Irp != NULL); ASSERT(Irp != NULL);
DPRINT("IoInitializeIrp(StackSize %x, Irp %x)\n",StackSize, Irp);
memset(Irp, 0, PacketSize); memset(Irp, 0, PacketSize);
Irp->Size = PacketSize; Irp->Size = PacketSize;
Irp->StackCount = StackSize; Irp->StackCount = StackSize;
Irp->CurrentLocation = StackSize; Irp->CurrentLocation = StackSize;
InitializeListHead(&Irp->ThreadListEntry); InitializeListHead(&Irp->ThreadListEntry);
Irp->Tail.Overlay.CurrentStackLocation = &Irp->Stack[(ULONG)StackSize]; Irp->Tail.Overlay.CurrentStackLocation = (PIO_STACK_LOCATION)(Irp + 1) + StackSize;
DPRINT("Irp->Tail.Overlay.CurrentStackLocation %x\n", Irp->Tail.Overlay.CurrentStackLocation);
Irp->ApcEnvironment = KeGetCurrentThread()->ApcStateIndex; Irp->ApcEnvironment = KeGetCurrentThread()->ApcStateIndex;
} }
@ -297,6 +299,7 @@ IofCompleteRequest(PIRP Irp,
PDEVICE_OBJECT DeviceObject; PDEVICE_OBJECT DeviceObject;
KIRQL oldIrql; KIRQL oldIrql;
PMDL Mdl; PMDL Mdl;
PIO_STACK_LOCATION Stack = (PIO_STACK_LOCATION)(Irp + 1);
DPRINT("IoCompleteRequest(Irp %x, PriorityBoost %d) Event %x THread %x\n", DPRINT("IoCompleteRequest(Irp %x, PriorityBoost %d) Event %x THread %x\n",
Irp,PriorityBoost, Irp->UserEvent, PsGetCurrentThread()); Irp,PriorityBoost, Irp->UserEvent, PsGetCurrentThread());
@ -334,14 +337,14 @@ IofCompleteRequest(PIRP Irp,
DeviceObject = NULL; DeviceObject = NULL;
} }
if (Irp->Stack[i].CompletionRoutine != NULL && if (Stack[i].CompletionRoutine != NULL &&
((NT_SUCCESS(Irp->IoStatus.Status) && (Irp->Stack[i].Control & SL_INVOKE_ON_SUCCESS)) || ((NT_SUCCESS(Irp->IoStatus.Status) && (Stack[i].Control & SL_INVOKE_ON_SUCCESS)) ||
(!NT_SUCCESS(Irp->IoStatus.Status) && (Irp->Stack[i].Control & SL_INVOKE_ON_ERROR)) || (!NT_SUCCESS(Irp->IoStatus.Status) && (Stack[i].Control & SL_INVOKE_ON_ERROR)) ||
(Irp->Cancel && (Irp->Stack[i].Control & SL_INVOKE_ON_CANCEL)))) (Irp->Cancel && (Stack[i].Control & SL_INVOKE_ON_CANCEL))))
{ {
Status = Irp->Stack[i].CompletionRoutine(DeviceObject, Status = Stack[i].CompletionRoutine(DeviceObject,
Irp, Irp,
Irp->Stack[i].Context); Stack[i].Context);
if (Status == STATUS_MORE_PROCESSING_REQUIRED) if (Status == STATUS_MORE_PROCESSING_REQUIRED)
{ {