ReactOS  0.4.15-dev-976-g0f66c66
misc.c
Go to the documentation of this file.
1 /*
2  * COPYRIGHT: See COPYING in the top level directory
3  * PROJECT: PCI IDE bus driver extension
4  * FILE: drivers/storage/pciidex/misc.c
5  * PURPOSE: Miscellaneous operations
6  * PROGRAMMERS: Hervé Poussineau (hpoussin@reactos.org)
7  */
8 
9 #include "pciidex.h"
10 
11 #define NDEBUG
12 #include <debug.h>
13 
17  IN PIRP Irp,
19 {
20  if (Irp->PendingReturned)
23 }
24 
28  IN PIRP Irp)
29 {
30  PDEVICE_OBJECT LowerDevice;
31  KEVENT Event;
33 
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 }
54 
58  IN PIRP Irp)
59 {
60  PDEVICE_OBJECT LowerDevice;
61 
63  LowerDevice = ((PFDO_DEVICE_EXTENSION)DeviceObject->DeviceExtension)->LowerDevice;
64  ASSERT(LowerDevice);
65 
67  return IoCallDriver(LowerDevice, Irp);
68 }
69 
72  IN ULONG Flags,
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 IN
Definition: typedefs.h:39
NTSTATUS DuplicateUnicodeString(IN ULONG Flags, IN PCUNICODE_STRING SourceString, OUT PUNICODE_STRING DestinationString)
Definition: misc.c:72
NTSYSAPI VOID NTAPI RtlCopyMemory(VOID UNALIGNED *Destination, CONST VOID UNALIGNED *Source, ULONG Length)
#define STATUS_MORE_PROCESSING_REQUIRED
Definition: shellext.h:68
_In_ PIRP Irp
Definition: csq.h:116
#define TRUE
Definition: types.h:120
#define STATUS_INVALID_PARAMETER
Definition: udferr_usr.h:135
LONG NTSTATUS
Definition: precomp.h:26
unsigned short Length
Definition: sprintf.c:451
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
_Must_inspect_result_ _In_ ULONG Flags
Definition: wsk.h:170
void * Buffer
Definition: sprintf.c:453
NTSTATUS(* NTAPI)(IN PFILE_FULL_EA_INFORMATION EaBuffer, IN ULONG EaLength, OUT PULONG ErrorOffset)
Definition: IoEaTest.cpp:117
#define FALSE
Definition: types.h:117
#define UNICODE_NULL
_In_ PVOID _In_ ULONG Event
Definition: iotypes.h:439
PVOID DeviceExtension
Definition: env_spec_w32.h:418
_Out_ _Inout_ POEM_STRING DestinationString
Definition: rtlfuncs.h:1868
smooth NULL
Definition: ftsmooth.c:416
void DPRINT(...)
Definition: polytest.cpp:61
#define RTL_DUPLICATE_UNICODE_STRING_NULL_TERMINATE
Definition: isapnp.h:82
__wchar_t WCHAR
Definition: xmlstorage.h:180
#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
_Out_ _Inout_ POEM_STRING _In_ PCUNICODE_STRING SourceString
Definition: rtlfuncs.h:1868
#define ExAllocatePool(type, size)
Definition: fbtusb.h:44
IN PDEVICE_OBJECT DeviceObject
Definition: fatprocs.h:1569
#define RTL_DUPLICATE_UNICODE_STRING_ALLOCATE_NULL_STRING
Definition: isapnp.h:83
#define KeInitializeEvent(pEvt, foo, foo2)
Definition: env_spec_w32.h:477
unsigned short USHORT
Definition: pedump.c:61
#define STATUS_NO_MEMORY
Definition: ntstatus.h:260
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 OUT
Definition: typedefs.h:40
unsigned int ULONG
Definition: retypes.h:1
#define IO_NO_INCREMENT
Definition: iotypes.h:570
NTSTATUS NTAPI PciIdeXGenericCompletion(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp, IN PVOID Context)
Definition: misc.c:15
return STATUS_SUCCESS
Definition: btrfs.c:3014
unsigned short MaximumLength
Definition: sprintf.c:452