ReactOS  0.4.15-dev-1201-gb2cf5a4
misc.c
Go to the documentation of this file.
1 /*
2  * COPYRIGHT: See COPYING in the top level directory
3  * PROJECT: Parallel Port Function Driver
4  * FILE: drivers/parallel/parport/misc.c
5  * PURPOSE: Miscellaneous functions
6  */
7 
8 #include "parport.h"
9 
10 
11 static IO_COMPLETION_ROUTINE ForwardIrpAndWaitCompletion;
12 
13 /* FUNCTIONS ****************************************************************/
14 
15 static
17 NTAPI
19  IN PIRP Irp,
21 {
22  if (Irp->PendingReturned)
25 }
26 
27 
30  IN PIRP Irp)
31 {
32  PDEVICE_OBJECT LowerDevice;
33  KEVENT Event;
35 
36  LowerDevice = ((PFDO_DEVICE_EXTENSION)DeviceObject->DeviceExtension)->LowerDevice;
37  ASSERT(LowerDevice);
38 
41 
42  DPRINT("Calling lower device %p\n", LowerDevice);
44 
45  Status = IoCallDriver(LowerDevice, Irp);
46  if (Status == STATUS_PENDING)
47  {
49  if (NT_SUCCESS(Status))
50  Status = Irp->IoStatus.Status;
51  }
52 
53  return Status;
54 }
55 
56 
58 NTAPI
60  IN PIRP Irp)
61 {
62  PDEVICE_OBJECT LowerDevice;
63 
64  if (((PFDO_DEVICE_EXTENSION)DeviceObject->DeviceExtension)->Common.IsFDO)
65  LowerDevice = ((PFDO_DEVICE_EXTENSION)DeviceObject->DeviceExtension)->LowerDevice;
66  else
67  LowerDevice = ((PPDO_DEVICE_EXTENSION)DeviceObject->DeviceExtension)->AttachedFdo;
68  ASSERT(LowerDevice);
69 
71  return IoCallDriver(LowerDevice, Irp);
72 }
73 
74 
75 PVOID
77 {
78  ASSERT(Irp);
79 
80  if (Irp->MdlAddress)
81  return Irp->MdlAddress;
82  else
83  return Irp->AssociatedIrp.SystemBuffer;
84 }
85 
86 /* EOF */
#define IN
Definition: typedefs.h:39
#define STATUS_MORE_PROCESSING_REQUIRED
Definition: shellext.h:68
_In_ PIRP Irp
Definition: csq.h:116
#define TRUE
Definition: types.h:120
LONG NTSTATUS
Definition: precomp.h:26
static IO_COMPLETION_ROUTINE ForwardIrpAndWaitCompletion
Definition: misc.c:11
struct _PDO_DEVICE_EXTENSION * PPDO_DEVICE_EXTENSION
LONG NTAPI KeSetEvent(IN PKEVENT Event, IN KPRIORITY Increment, IN BOOLEAN Wait)
Definition: eventobj.c:159
NTSTATUS NTAPI KeWaitForSingleObject(IN PVOID Object, IN KWAIT_REASON WaitReason, IN KPROCESSOR_MODE WaitMode, IN BOOLEAN Alertable, IN PLARGE_INTEGER Timeout OPTIONAL)
Definition: wait.c:416
NTSTATUS NTAPI ForwardIrpAndWait(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp)
Definition: misc.c:33
struct _FDO_DEVICE_EXTENSION * PFDO_DEVICE_EXTENSION
#define IoSetCompletionRoutine(_Irp, _CompletionRoutine, _Context, _InvokeOnSuccess, _InvokeOnError, _InvokeOnCancel)
Definition: irp.cpp:498
FORCEINLINE VOID IoCopyCurrentIrpStackLocationToNext(_Inout_ PIRP Irp)
Definition: iofuncs.h:2864
NTSTATUS(* NTAPI)(IN PFILE_FULL_EA_INFORMATION EaBuffer, IN ULONG EaLength, OUT PULONG ErrorOffset)
Definition: IoEaTest.cpp:117
#define FALSE
Definition: types.h:117
_In_ PVOID _In_ ULONG Event
Definition: iotypes.h:450
smooth NULL
Definition: ftsmooth.c:416
void DPRINT(...)
Definition: polytest.cpp:61
PVOID GetUserBuffer(IN PIRP Irp)
Definition: misc.c:76
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
#define STATUS_PENDING
Definition: ntstatus.h:82
ASSERT((InvokeOnSuccess||InvokeOnError||InvokeOnCancel) ?(CompletionRoutine !=NULL) :TRUE)
Status
Definition: gdiplustypes.h:24
#define KeInitializeEvent(pEvt, foo, foo2)
Definition: env_spec_w32.h:477
_In_ PDEVICE_OBJECT DeviceObject
Definition: iotypes.h:2464
NTSTATUS NTAPI ForwardIrpAndForget(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp)
Definition: misc.c:59
NTSTATUS NTAPI IoCallDriver(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp)
Definition: irp.c:1218
#define IoSkipCurrentIrpStackLocation(Irp)
Definition: ntifs_ex.h:421
#define IO_NO_INCREMENT
Definition: iotypes.h:581