ReactOS  0.4.14-dev-114-gc8cbd56
misc.c
Go to the documentation of this file.
1 /*
2  * PROJECT: ReactOS i8042 (ps/2 keyboard-mouse controller) driver
3  * LICENSE: GPL - See COPYING in the top level directory
4  * FILE: drivers/input/i8042prt/misc.c
5  * PURPOSE: Miscellaneous operations
6  * PROGRAMMERS: Copyright 2006-2007 Hervé Poussineau (hpoussin@reactos.org)
7  */
8 
9 /* INCLUDES ******************************************************************/
10 
11 #include "i8042prt.h"
12 
13 #include <debug.h>
14 
15 /* FUNCTIONS *****************************************************************/
16 
17 static IO_COMPLETION_ROUTINE ForwardIrpAndWaitCompletion;
18 
19 static NTSTATUS NTAPI
22  IN PIRP Irp,
24 {
27  if (Irp->PendingReturned)
30 }
31 
35  IN PIRP Irp)
36 {
37  KEVENT Event;
40  ASSERT(LowerDevice);
41 
44 
46 
47  Status = IoCallDriver(LowerDevice, Irp);
48  if (Status == STATUS_PENDING)
49  {
51  if (NT_SUCCESS(Status))
52  Status = Irp->IoStatus.Status;
53  }
54 
55  return Status;
56 }
57 
61  IN PIRP Irp)
62 {
64 
65  ASSERT(LowerDevice);
66 
68  return IoCallDriver(LowerDevice, Irp);
69 }
70 
73  IN ULONG Flags,
76 {
81  {
83  }
84 
85 
86  if ((SourceString->Length == 0)
89  {
93  }
94  else
95  {
96  USHORT DestMaxLength = SourceString->Length;
97 
99  DestMaxLength += sizeof(UNICODE_NULL);
100 
102  if (DestinationString->Buffer == NULL)
103  return STATUS_NO_MEMORY;
104 
107  DestinationString->MaximumLength = DestMaxLength;
108 
111  }
112 
113  return STATUS_SUCCESS;
114 }
#define IN
Definition: typedefs.h:38
NTSTATUS DuplicateUnicodeString(IN ULONG Flags, IN PCUNICODE_STRING SourceString, OUT PUNICODE_STRING DestinationString)
Definition: misc.c:72
#define TRUE
Definition: types.h:120
NTSYSAPI VOID NTAPI RtlCopyMemory(VOID UNALIGNED *Destination, CONST VOID UNALIGNED *Source, ULONG Length)
#define STATUS_MORE_PROCESSING_REQUIRED
Definition: shellext.h:63
_In_ PIRP Irp
Definition: csq.h:116
#define UNREFERENCED_PARAMETER(P)
Definition: ntbasedef.h:323
#define STATUS_INVALID_PARAMETER
Definition: udferr_usr.h:135
#define RTL_DUPLICATE_UNICODE_STRING_ALLOCATE_NULL_STRING
Definition: green.h:16
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 I8042PRT_TAG
Definition: i8042prt.h:12
#define IoSetCompletionRoutine(_Irp, _CompletionRoutine, _Context, _InvokeOnSuccess, _InvokeOnError, _InvokeOnCancel)
Definition: irp.cpp:515
FORCEINLINE VOID IoCopyCurrentIrpStackLocationToNext(_Inout_ PIRP Irp)
Definition: iofuncs.h:2820
_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 UNICODE_NULL
_In_ PVOID _In_ ULONG Event
Definition: iotypes.h:435
PVOID DeviceExtension
Definition: env_spec_w32.h:418
#define __analysis_assume(expr)
Definition: sal.h:2893
_Out_ _Inout_ POEM_STRING DestinationString
Definition: rtlfuncs.h:1869
smooth NULL
Definition: ftsmooth.c:416
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
#define STATUS_PENDING
Definition: ntstatus.h:82
#define RTL_DUPLICATE_UNICODE_STRING_NULL_TERMINATE
Definition: green.h:15
ASSERT((InvokeOnSuccess||InvokeOnError||InvokeOnCancel) ?(CompletionRoutine !=NULL) :TRUE)
#define ExAllocatePoolWithTag(hernya, size, tag)
Definition: env_spec_w32.h:350
_Out_ _Inout_ POEM_STRING _In_ PCUNICODE_STRING SourceString
Definition: rtlfuncs.h:1869
Status
Definition: gdiplustypes.h:24
IN PDEVICE_OBJECT DeviceObject
Definition: fatprocs.h:1560
#define KeInitializeEvent(pEvt, foo, foo2)
Definition: env_spec_w32.h:477
static IO_COMPLETION_ROUTINE ForwardIrpAndWaitCompletion
Definition: misc.c:17
unsigned short USHORT
Definition: pedump.c:61
#define STATUS_NO_MEMORY
Definition: ntstatus.h:246
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:39
unsigned int ULONG
Definition: retypes.h:1
#define IO_NO_INCREMENT
Definition: iotypes.h:566
return STATUS_SUCCESS
Definition: btrfs.c:2966
unsigned short MaximumLength
Definition: sprintf.c:452