ReactOS  0.4.15-dev-1201-gb2cf5a4
misc.c File Reference
#include "mouclass.h"
#include <debug.h>
Include dependency graph for misc.c:

Go to the source code of this file.

Functions

static NTSTATUS NTAPI ForwardIrpAndWaitCompletion (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)
 

Variables

static IO_COMPLETION_ROUTINE ForwardIrpAndWaitCompletion
 

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 CLASS_TAG
Definition: kbdclass.h:11
NTSYSAPI VOID NTAPI RtlCopyMemory(VOID UNALIGNED *Destination, CONST VOID UNALIGNED *Source, ULONG Length)
#define STATUS_INVALID_PARAMETER
Definition: udferr_usr.h:135
unsigned short Length
Definition: sprintf.c:451
_Must_inspect_result_ _In_ ULONG Flags
Definition: wsk.h:170
void * Buffer
Definition: sprintf.c:453
#define UNICODE_NULL
_Out_ _Inout_ POEM_STRING DestinationString
Definition: rtlfuncs.h:1868
smooth NULL
Definition: ftsmooth.c:416
#define RTL_DUPLICATE_UNICODE_STRING_NULL_TERMINATE
Definition: isapnp.h:82
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define ExAllocatePoolWithTag(hernya, size, tag)
Definition: env_spec_w32.h:350
_Out_ _Inout_ POEM_STRING _In_ PCUNICODE_STRING SourceString
Definition: rtlfuncs.h:1868
#define RTL_DUPLICATE_UNICODE_STRING_ALLOCATE_NULL_STRING
Definition: isapnp.h:83
unsigned short USHORT
Definition: pedump.c:61
#define STATUS_NO_MEMORY
Definition: ntstatus.h:260
return STATUS_SUCCESS
Definition: btrfs.c:3014
unsigned short MaximumLength
Definition: sprintf.c:452

◆ ForwardIrpAndForget()

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

Definition at line 57 of file misc.c.

60 {
61  PDEVICE_OBJECT LowerDevice;
62 
63  ASSERT(!((PCOMMON_DEVICE_EXTENSION)DeviceObject->DeviceExtension)->IsClassDO);
64  LowerDevice = ((PPORT_DEVICE_EXTENSION)DeviceObject->DeviceExtension)->LowerDevice;
65 
67  return IoCallDriver(LowerDevice, Irp);
68 }
_In_ PIRP Irp
Definition: csq.h:116
ASSERT((InvokeOnSuccess||InvokeOnError||InvokeOnCancel) ?(CompletionRoutine !=NULL) :TRUE)
struct _PORT_DEVICE_EXTENSION * PPORT_DEVICE_EXTENSION
_In_ PDEVICE_OBJECT DeviceObject
Definition: iotypes.h:2464
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 28 of file misc.c.

31 {
32  PDEVICE_OBJECT LowerDevice;
33  KEVENT Event;
35 
36  ASSERT(!((PCOMMON_DEVICE_EXTENSION)DeviceObject->DeviceExtension)->IsClassDO);
37  LowerDevice = ((PPORT_DEVICE_EXTENSION)DeviceObject->DeviceExtension)->LowerDevice;
38 
41 
42  TRACE_(CLASS_NAME, "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 }
_In_ PIRP Irp
Definition: csq.h:116
#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
#define IoSetCompletionRoutine(_Irp, _CompletionRoutine, _Context, _InvokeOnSuccess, _InvokeOnError, _InvokeOnCancel)
Definition: irp.cpp:498
static IO_COMPLETION_ROUTINE ForwardIrpAndWaitCompletion
Definition: misc.c:14
FORCEINLINE VOID IoCopyCurrentIrpStackLocationToNext(_Inout_ PIRP Irp)
Definition: iofuncs.h:2864
#define FALSE
Definition: types.h:117
_In_ PVOID _In_ ULONG Event
Definition: iotypes.h:450
smooth NULL
Definition: ftsmooth.c:416
#define TRACE_(x)
Definition: compat.h: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
struct _PORT_DEVICE_EXTENSION * PPORT_DEVICE_EXTENSION
const TCHAR * CLASS_NAME
Definition: enumwnd.c:16
#define KeInitializeEvent(pEvt, foo, foo2)
Definition: env_spec_w32.h:477
_In_ PDEVICE_OBJECT DeviceObject
Definition: iotypes.h:2464
NTSTATUS NTAPI IoCallDriver(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp)
Definition: irp.c:1218

◆ ForwardIrpAndWaitCompletion()

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

Definition at line 17 of file misc.c.

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

Variable Documentation

◆ ForwardIrpAndWaitCompletion

IO_COMPLETION_ROUTINE ForwardIrpAndWaitCompletion
static

Definition at line 14 of file misc.c.

Referenced by ForwardIrpAndWait().