ReactOS  0.4.15-dev-2344-g8ddbfde
utils.c File Reference
#include "partmgr.h"
Include dependency graph for utils.c:

Go to the source code of this file.

Functions

NTSTATUS NTAPI ForwardIrpAndForget (_In_ PDEVICE_OBJECT DeviceObject, _In_ PIRP Irp)
 
NTSTATUS IssueSyncIoControlRequest (_In_ UINT32 IoControlCode, _In_ PDEVICE_OBJECT DeviceObject, _In_ PVOID InputBuffer, _In_ ULONG InputBufferLength, _In_ PVOID OutputBuffer, _In_ ULONG OutputBufferLength, _In_ BOOLEAN InternalDeviceIoControl)
 

Function Documentation

◆ ForwardIrpAndForget()

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

Definition at line 5 of file utils.c.

8 {
9  // this part of a structure is identical in both FDO and PDO
10  PDEVICE_OBJECT LowerDevice = ((PFDO_EXTENSION)DeviceObject->DeviceExtension)->LowerDevice;
11 
12  ASSERT(LowerDevice);
13 
15  return IoCallDriver(LowerDevice, Irp);
16 }
_In_ PDEVICE_OBJECT DeviceObject
Definition: wdfdevice.h:2055
_In_ PIRP Irp
Definition: csq.h:116
#define ASSERT(a)
Definition: mode.c:45
struct _FDO_EXTENSION * PFDO_EXTENSION
NTSTATUS NTAPI IoCallDriver(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp)
Definition: irp.c:1218
#define IoSkipCurrentIrpStackLocation(Irp)
Definition: ntifs_ex.h:421

◆ IssueSyncIoControlRequest()

NTSTATUS IssueSyncIoControlRequest ( _In_ UINT32  IoControlCode,
_In_ PDEVICE_OBJECT  DeviceObject,
_In_ PVOID  InputBuffer,
_In_ ULONG  InputBufferLength,
_In_ PVOID  OutputBuffer,
_In_ ULONG  OutputBufferLength,
_In_ BOOLEAN  InternalDeviceIoControl 
)

Definition at line 19 of file utils.c.

27 {
28  PIRP Irp;
30  PKEVENT Event;
32  PAGED_CODE();
33 
34  /* Allocate a non-paged event */
36  if (!Event)
37  {
39  }
40 
41  /* Initialize it */
43 
44  /* Build the IRP */
52  Event,
53  &IoStatusBlock);
54  if (!Irp)
55  {
56  /* Fail, free the event */
59  }
60 
61  /* Call the driver and check if it's pending */
63  if (Status == STATUS_PENDING)
64  {
65  /* Wait on the driver */
68  }
69 
70  /* Free the event and return the Status */
72  return Status;
73 }
#define STATUS_INSUFFICIENT_RESOURCES
Definition: udferr_usr.h:158
_Must_inspect_result_ __drv_aliasesMem _In_ PDEVICE_OBJECT _In_opt_ PVOID _In_ ULONG _Out_opt_ PVOID _In_ ULONG _In_ BOOLEAN InternalDeviceIoControl
Definition: iofuncs.h:713
LONG NTSTATUS
Definition: precomp.h:26
_In_ WDFREQUEST _In_ size_t _In_ size_t InputBufferLength
Definition: wdfio.h:318
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
_In_ WDFREQUEST _In_ size_t OutputBufferLength
Definition: wdfio.h:318
_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
_Must_inspect_result_ _In_ WDFIOTARGET _In_opt_ WDFREQUEST _In_opt_ PWDF_MEMORY_DESCRIPTOR OutputBuffer
Definition: wdfiotarget.h:859
Status
Definition: gdiplustypes.h:24
_Must_inspect_result_ _In_ WDFIOTARGET _In_opt_ WDFREQUEST _In_opt_ PWDF_MEMORY_DESCRIPTOR InputBuffer
Definition: wdfiotarget.h:949
#define STATUS_PENDING
Definition: ntstatus.h:82
#define ExAllocatePoolWithTag(hernya, size, tag)
Definition: env_spec_w32.h:350
_In_ WDFREQUEST _In_ size_t _In_ size_t _In_ ULONG IoControlCode
Definition: wdfio.h:318
#define KeInitializeEvent(pEvt, foo, foo2)
Definition: env_spec_w32.h:477
static OUT PIO_STATUS_BLOCK IoStatusBlock
Definition: pipe.c:75
#define NULL
Definition: types.h:112
NTSTATUS NTAPI IoCallDriver(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp)
Definition: irp.c:1218
PIRP NTAPI IoBuildDeviceIoControlRequest(IN ULONG IoControlCode, IN PDEVICE_OBJECT DeviceObject, IN PVOID InputBuffer, IN ULONG InputBufferLength, IN PVOID OutputBuffer, IN ULONG OutputBufferLength, IN BOOLEAN InternalDeviceIoControl, IN PKEVENT Event, IN PIO_STATUS_BLOCK IoStatusBlock)
Definition: irp.c:881
#define ExFreePoolWithTag(_P, _T)
Definition: module.h:1099
#define TAG_PARTMGR
Definition: partmgr.h:23
#define PAGED_CODE()

Referenced by FdoHandleStartDevice(), FdoIoctlDiskGetDriveGeometryEx(), and PartMgrRefreshDiskData().