ReactOS  0.4.15-dev-1647-g91fceab
processr.h File Reference
#include <ntddk.h>
Include dependency graph for processr.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  _DEVICE_EXTENSION
 

Typedefs

typedef struct _DEVICE_EXTENSION DEVICE_EXTENSION
 
typedef struct _DEVICE_EXTENSIONPDEVICE_EXTENSION
 

Functions

NTSTATUS NTAPI ForwardIrpAndWait (IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp)
 
NTSTATUS NTAPI ForwardIrpAndForget (IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp)
 
NTSTATUS NTAPI ProcessorPnp (IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp)
 
NTSTATUS NTAPI ProcessorAddDevice (IN PDRIVER_OBJECT DriverObject, IN PDEVICE_OBJECT Pdo)
 

Typedef Documentation

◆ DEVICE_EXTENSION

◆ PDEVICE_EXTENSION

Function Documentation

◆ ForwardIrpAndForget()

NTSTATUS NTAPI ForwardIrpAndForget ( IN PDEVICE_OBJECT  DeviceObject,
IN PIRP  Irp 
)

Definition at line 59 of file misc.c.

62 {
63  PDEVICE_OBJECT LowerDevice = ((PFDO_DEVICE_EXTENSION)DeviceObject->DeviceExtension)->LowerDevice;
64 
65  ASSERT(LowerDevice);
66 
68  return IoCallDriver(LowerDevice, Irp);
69 }
struct _FDO_DEVICE_EXTENSION * PFDO_DEVICE_EXTENSION
_In_ PDEVICE_OBJECT DeviceObject
Definition: wdfdevice.h:2055
_In_ PIRP Irp
Definition: csq.h:116
#define ASSERT(a)
Definition: mode.c:45
NTSTATUS NTAPI IoCallDriver(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp)
Definition: irp.c:1218
#define IoSkipCurrentIrpStackLocation(Irp)
Definition: ntifs_ex.h:421

◆ ForwardIrpAndWait()

NTSTATUS NTAPI ForwardIrpAndWait ( IN PDEVICE_OBJECT  DeviceObject,
IN PIRP  Irp 
)

Definition at line 32 of file fdo.c.

35 {
36  KEVENT Event;
38  PDEVICE_OBJECT LowerDevice = ((PFDO_DEVICE_EXTENSION)DeviceObject->DeviceExtension)->Ldo;
39  ASSERT(LowerDevice);
40 
43 
45 
46  Status = IoCallDriver(LowerDevice, Irp);
47  if (Status == STATUS_PENDING)
48  {
50  if (NT_SUCCESS(Status))
51  Status = Irp->IoStatus.Status;
52  }
53 
54  return Status;
55 }
#define TRUE
Definition: types.h:120
LONG NTSTATUS
Definition: precomp.h:26
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
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
_In_ PDEVICE_OBJECT DeviceObject
Definition: wdfdevice.h:2055
#define FALSE
Definition: types.h:117
_In_ PIRP Irp
Definition: csq.h:116
_In_ PVOID _In_ ULONG Event
Definition: iotypes.h:467
Status
Definition: gdiplustypes.h:24
#define ASSERT(a)
Definition: mode.c:45
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
#define STATUS_PENDING
Definition: ntstatus.h:82
static IO_COMPLETION_ROUTINE ForwardIrpAndWaitCompletion
Definition: fdo.c:17
#define KeInitializeEvent(pEvt, foo, foo2)
Definition: env_spec_w32.h:477
#define NULL
Definition: types.h:112
NTSTATUS NTAPI IoCallDriver(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp)
Definition: irp.c:1218

◆ ProcessorAddDevice()

NTSTATUS NTAPI ProcessorAddDevice ( IN PDRIVER_OBJECT  DriverObject,
IN PDEVICE_OBJECT  Pdo 
)

Definition at line 357 of file pnp.c.

360 {
361  PDEVICE_EXTENSION DeviceExtension = NULL;
364 
365  DPRINT("ProcessorAddDevice()\n");
366 
368  ASSERT(Pdo);
369 
370  /* Create functional device object */
372  sizeof(DEVICE_EXTENSION),
373  NULL,
376  FALSE,
377  &Fdo);
378  if (NT_SUCCESS(Status))
379  {
380  DeviceExtension = (PDEVICE_EXTENSION)Fdo->DeviceExtension;
381  RtlZeroMemory(DeviceExtension, sizeof(DEVICE_EXTENSION));
382 
383  DeviceExtension->DeviceObject = Fdo;
384 
385  Status = IoAttachDeviceToDeviceStackSafe(Fdo, Pdo, &DeviceExtension->LowerDevice);
386  if (!NT_SUCCESS(Status))
387  {
388  DPRINT1("IoAttachDeviceToDeviceStackSafe() failed with status 0x%08lx\n", Status);
390  return Status;
391  }
392 
393  Fdo->Flags |= DO_DIRECT_IO;
394  Fdo->Flags |= DO_POWER_PAGABLE;
395 
396  Fdo->Flags &= ~DO_DEVICE_INITIALIZING;
397  }
398 
399  return Status;
400 }
#define DO_DEVICE_INITIALIZING
Definition: env_spec_w32.h:399
#define DO_POWER_PAGABLE
LONG NTSTATUS
Definition: precomp.h:26
#define DO_DIRECT_IO
Definition: env_spec_w32.h:396
#define FALSE
Definition: types.h:117
WDF_EXTERN_C_START typedef _Must_inspect_result_ _In_ WDFDRIVER _In_opt_ PWDF_OBJECT_ATTRIBUTES _In_ PDEVICE_OBJECT _In_opt_ PDEVICE_OBJECT _In_opt_ PDEVICE_OBJECT Pdo
Definition: wdfminiport.h:64
void DPRINT(...)
Definition: polytest.cpp:61
_Must_inspect_result_ _In_ PDRIVER_OBJECT DriverObject
Definition: wdfdriver.h:213
Status
Definition: gdiplustypes.h:24
#define ASSERT(a)
Definition: mode.c:45
NTSTATUS NTAPI IoAttachDeviceToDeviceStackSafe(IN PDEVICE_OBJECT SourceDevice, IN PDEVICE_OBJECT TargetDevice, IN OUT PDEVICE_OBJECT *AttachedToDeviceObject)
Definition: device.c:980
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
_Must_inspect_result_ _In_ WDFDEVICE Fdo
Definition: wdffdo.h:461
VOID NTAPI IoDeleteDevice(IN PDEVICE_OBJECT DeviceObject)
Definition: device.c:1251
#define NULL
Definition: types.h:112
#define FILE_DEVICE_UNKNOWN
Definition: winioctl.h:140
#define DPRINT1
Definition: precomp.h:8
NTSTATUS NTAPI IoCreateDevice(IN PDRIVER_OBJECT DriverObject, IN ULONG DeviceExtensionSize, IN PUNICODE_STRING DeviceName, IN DEVICE_TYPE DeviceType, IN ULONG DeviceCharacteristics, IN BOOLEAN Exclusive, OUT PDEVICE_OBJECT *DeviceObject)
Definition: device.c:1031
#define RtlZeroMemory(Destination, Length)
Definition: typedefs.h:262
#define FILE_DEVICE_SECURE_OPEN
Definition: cdrw_usr.h:46
struct _BEEP_DEVICE_EXTENSION * PDEVICE_EXTENSION

Referenced by DriverEntry().

◆ ProcessorPnp()

NTSTATUS NTAPI ProcessorPnp ( IN PDEVICE_OBJECT  DeviceObject,
IN PIRP  Irp 
)

Definition at line 262 of file pnp.c.

265 {
269 
270  DPRINT("ProcessorPnp()\n");
271 
273 
274  switch (IrpSp->MinorFunction)
275  {
276  case IRP_MN_START_DEVICE:
277  DPRINT(" IRP_MN_START_DEVICE received\n");
278 
279  /* Call lower driver */
281  if (NT_SUCCESS(Status))
282  {
284  IrpSp->Parameters.StartDevice.AllocatedResources,
285  IrpSp->Parameters.StartDevice.AllocatedResourcesTranslated);
286  }
287  break;
288 
290  DPRINT(" IRP_MN_QUERY_REMOVE_DEVICE\n");
292 
294  DPRINT(" IRP_MN_REMOVE_DEVICE received\n");
296 
298  DPRINT(" IRP_MN_CANCEL_REMOVE_DEVICE\n");
300 
301  case IRP_MN_STOP_DEVICE:
302  DPRINT(" IRP_MN_STOP_DEVICE received\n");
304 
306  DPRINT(" IRP_MN_QUERY_STOP_DEVICE received\n");
308 
310  DPRINT(" IRP_MN_CANCEL_STOP_DEVICE\n");
312 
314  DPRINT(" IRP_MN_QUERY_DEVICE_RELATIONS\n");
315 
316  switch (IrpSp->Parameters.QueryDeviceRelations.Type)
317  {
318  case BusRelations:
319  DPRINT(" IRP_MJ_PNP / IRP_MN_QUERY_DEVICE_RELATIONS / BusRelations\n");
321  break;
322 
323  case RemovalRelations:
324  DPRINT(" IRP_MJ_PNP / IRP_MN_QUERY_DEVICE_RELATIONS / RemovalRelations\n");
326 
327  default:
328  DPRINT(" IRP_MJ_PNP / IRP_MN_QUERY_DEVICE_RELATIONS / Unknown type 0x%lx\n",
329  IrpSp->Parameters.QueryDeviceRelations.Type);
331  }
332  break;
333 
335  DPRINT(" IRP_MN_SURPRISE_REMOVAL received\n");
337 
338  case IRP_MN_FILTER_RESOURCE_REQUIREMENTS: /* (optional) 0xd */
339  DPRINT(" IRP_MN_FILTER_RESOURCE_REQUIREMENTS\n");
341 
342  default:
343  DPRINT(" Unknown IOCTL 0x%lx\n", IrpSp->MinorFunction);
345  }
346 
347  Irp->IoStatus.Information = Information;
348  Irp->IoStatus.Status = Status;
350 
351  return Status;
352 }
#define IRP_MN_CANCEL_REMOVE_DEVICE
return STATUS_NOT_SUPPORTED
#define IRP_MN_REMOVE_DEVICE
#define IRP_MN_FILTER_RESOURCE_REQUIREMENTS
DRIVER_DISPATCH ForwardIrpAndForget
Definition: i8042prt.h:341
LONG NTSTATUS
Definition: precomp.h:26
_In_ WDFREQUEST _In_ NTSTATUS _In_ ULONG_PTR Information
Definition: wdfrequest.h:1044
uint32_t ULONG_PTR
Definition: typedefs.h:65
_In_ PDEVICE_OBJECT DeviceObject
Definition: wdfdevice.h:2055
_In_ PIRP Irp
Definition: csq.h:116
#define IRP_MN_QUERY_REMOVE_DEVICE
#define IoCompleteRequest
Definition: irp.c:1240
void DPRINT(...)
Definition: polytest.cpp:61
#define IRP_MN_QUERY_STOP_DEVICE
Status
Definition: gdiplustypes.h:24
#define IRP_MN_SURPRISE_REMOVAL
Definition: ntifs_ex.h:408
#define IRP_MN_STOP_DEVICE
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
#define IRP_MN_START_DEVICE
DRIVER_DISPATCH ForwardIrpAndWait
Definition: i8042prt.h:343
__drv_aliasesMem FORCEINLINE PIO_STACK_LOCATION IoGetCurrentIrpStackLocation(_In_ PIRP Irp)
Definition: iofuncs.h:2789
_In_ PIO_STACK_LOCATION IrpSp
Definition: create.c:4137
#define IRP_MN_QUERY_DEVICE_RELATIONS
#define IO_NO_INCREMENT
Definition: iotypes.h:598
static NTSTATUS ProcessorStartDevice(IN PDEVICE_OBJECT DeviceObject, IN PCM_RESOURCE_LIST ResourceList, IN PCM_RESOURCE_LIST ResourceListTranslated)
Definition: pnp.c:247
#define IRP_MN_CANCEL_STOP_DEVICE
struct _NAMED_PIPE_CREATE_PARAMETERS * Parameters
Definition: iotypes.h:3124

Referenced by DriverEntry().