ReactOS  0.4.15-dev-3181-g4acf100
misc.c File Reference
#include "pciidex.h"
#include <debug.h>
Include dependency graph for misc.c:

Go to the source code of this file.

Macros

#define NDEBUG
 

Functions

NTSTATUS NTAPI PciIdeXGenericCompletion (IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp, IN PVOID Context)
 
NTSTATUS ForwardIrpAndWait (IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp)
 
NTSTATUS NTAPI ForwardIrpAndForget (IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp)
 
NTSTATUS DuplicateUnicodeString (IN ULONG Flags, IN PCUNICODE_STRING SourceString, OUT PUNICODE_STRING DestinationString)
 

Macro Definition Documentation

◆ NDEBUG

#define NDEBUG

Definition at line 11 of file misc.c.

Function Documentation

◆ DuplicateUnicodeString()

NTSTATUS DuplicateUnicodeString ( IN ULONG  Flags,
IN PCUNICODE_STRING  SourceString,
OUT PUNICODE_STRING  DestinationString 
)

Definition at line 71 of file misc.c.

75 {
80  {
82  }
83 
84 
85  if ((SourceString->Length == 0)
88  {
92  }
93  else
94  {
95  USHORT DestMaxLength = SourceString->Length;
96 
98  DestMaxLength += sizeof(UNICODE_NULL);
99 
101  if (DestinationString->Buffer == NULL)
102  return STATUS_NO_MEMORY;
103 
106  DestinationString->MaximumLength = DestMaxLength;
107 
110  }
111 
112  return STATUS_SUCCESS;
113 }
#define STATUS_INVALID_PARAMETER
Definition: udferr_usr.h:135
#define RTL_DUPLICATE_UNICODE_STRING_ALLOCATE_NULL_STRING
Definition: green.h:16
unsigned short Length
Definition: sprintf.c:451
void * Buffer
Definition: sprintf.c:453
#define UNICODE_NULL
_Out_ _Inout_ POEM_STRING DestinationString
Definition: rtlfuncs.h:1868
_Must_inspect_result_ _In_ ULONG Flags
Definition: wsk.h:170
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define RTL_DUPLICATE_UNICODE_STRING_NULL_TERMINATE
Definition: green.h:15
_Out_ _Inout_ POEM_STRING _In_ PCUNICODE_STRING SourceString
Definition: rtlfuncs.h:1868
#define ExAllocatePool(type, size)
Definition: fbtusb.h:44
unsigned short USHORT
Definition: pedump.c:61
#define STATUS_NO_MEMORY
Definition: ntstatus.h:260
#define NULL
Definition: types.h:112
#define RtlCopyMemory(Destination, Source, Length)
Definition: typedefs.h:263
#define STATUS_SUCCESS
Definition: shellext.h:65
unsigned short MaximumLength
Definition: sprintf.c:452

Referenced by DriverEntry(), FdcPdoQueryId(), PciCreateCompatibleIDsString(), PciCreateHardwareIDsString(), PciIdeXPdoQueryId(), ReportDetectedDevice(), SearchForLegacyDrivers(), and SerenumPdoQueryId().

◆ ForwardIrpAndForget()

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

Definition at line 56 of file misc.c.

59 {
60  PDEVICE_OBJECT LowerDevice;
61 
62  ASSERT(((PCOMMON_DEVICE_EXTENSION)DeviceObject->DeviceExtension)->IsFDO);
63  LowerDevice = ((PFDO_DEVICE_EXTENSION)DeviceObject->DeviceExtension)->LowerDevice;
64  ASSERT(LowerDevice);
65 
67  return IoCallDriver(LowerDevice, Irp);
68 }
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:44
NTSTATUS NTAPI IoCallDriver(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp)
Definition: irp.c:1218
#define IoSkipCurrentIrpStackLocation(Irp)
Definition: ntifs_ex.h:421

◆ ForwardIrpAndWait()

NTSTATUS ForwardIrpAndWait ( IN PDEVICE_OBJECT  DeviceObject,
IN PIRP  Irp 
)

Definition at line 26 of file misc.c.

29 {
30  PDEVICE_OBJECT LowerDevice;
31  KEVENT Event;
33 
34  ASSERT(((PCOMMON_DEVICE_EXTENSION)DeviceObject->DeviceExtension)->IsFDO);
35  LowerDevice = ((PFDO_DEVICE_EXTENSION)DeviceObject->DeviceExtension)->LowerDevice;
36  ASSERT(LowerDevice);
37 
40 
41  DPRINT("Calling lower device %p [%wZ]\n", LowerDevice, &LowerDevice->DriverObject->DriverName);
43 
44  Status = IoCallDriver(LowerDevice, Irp);
45  if (Status == STATUS_PENDING)
46  {
48  if (NT_SUCCESS(Status))
49  Status = Irp->IoStatus.Status;
50  }
51 
52  return Status;
53 }
#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:2868
_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:44
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
#define STATUS_PENDING
Definition: ntstatus.h:82
#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
NTSTATUS NTAPI PciIdeXGenericCompletion(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp, IN PVOID Context)
Definition: misc.c:15
#define DPRINT
Definition: sndvol32.h:71

◆ PciIdeXGenericCompletion()

NTSTATUS NTAPI PciIdeXGenericCompletion ( IN PDEVICE_OBJECT  DeviceObject,
IN PIRP  Irp,
IN PVOID  Context 
)

Definition at line 15 of file misc.c.

19 {
20  if (Irp->PendingReturned)
23 }
#define STATUS_MORE_PROCESSING_REQUIRED
Definition: shellext.h:68
LONG NTAPI KeSetEvent(IN PKEVENT Event, IN KPRIORITY Increment, IN BOOLEAN Wait)
Definition: eventobj.c:159
#define FALSE
Definition: types.h:117
_In_ PIRP Irp
Definition: csq.h:116
#define IO_NO_INCREMENT
Definition: iotypes.h:598

Referenced by ForwardIrpAndWait().