ReactOS  0.4.14-dev-77-gd9e7c48
IoDeviceObject_drv.c
Go to the documentation of this file.
1 /*
2  * PROJECT: ReactOS kernel-mode tests
3  * LICENSE: GPLv2+ - See COPYING in the top level directory
4  * PURPOSE: Kernel-Mode Test Suite Driver Object Test Driver
5  * PROGRAMMER: Michael Martin <martinmnet@hotmail.com>
6  * Thomas Faber <thomas.faber@reactos.org>
7  */
8 
9 #include <kmt_test.h>
10 
11 //#define NDEBUG
12 #include <debug.h>
13 
14 #define BASE_POOL_TYPE_MASK 1
15 
16 typedef enum
17 {
22 
31 static VOID TestAttachDevice(IN PDEVICE_OBJECT DeviceObject, IN PWCHAR NewDriverRegPath);
32 static VOID TestDetachDevice(IN PDEVICE_OBJECT AttachedDevice);
33 
37 
43  IN OUT INT *Flags)
44 {
46  BOOLEAN Ret;
47  INT i;
48 
49  PAGED_CODE();
50 
52 
53  *Flags = TESTENTRY_NO_CREATE_DEVICE | TESTENTRY_NO_REGISTER_DISPATCH;
54 
56 
58 
59  /* Create and delete device, on return MainDeviceObject has been created */
61 
62  /* Make sure a device object was created */
63  if (!skip(MainDeviceObject != NULL, "Device object creation failed\n"))
64  {
65  PWCHAR LowerDriverRegPath = L"\\Registry\\Machine\\System\\CurrentControlSet\\Services\\Kmtest-IoHelper";
66 
67  /* Load driver test and load the lower driver */
68  Ret = TestZwLoad(DriverObject, RegistryPath, LowerDriverRegPath);
69  if (!skip(Ret, "Failed to load helper driver\n"))
70  {
71  TestAttachDevice(MainDeviceObject, L"\\Device\\Kmtest-IoHelper");
72  if (!skip(AttachDeviceObject != NULL, "No attached device object\n"))
74 
75  /* Unload lower driver without detaching from its device */
76  TestZwUnload(DriverObject, RegistryPath, LowerDriverRegPath);
78  }
79  }
80 
81  for (i = 0; i <= IRP_MJ_MAXIMUM_FUNCTION; ++i)
86 
87  return Status;
88 }
89 
90 VOID
93 {
94  PAGED_CODE();
95 
96  if (!skip(AttachDeviceObject != NULL, "no attached device object\n"))
97  {
101  }
102 
105 
106  if (MainDeviceObject)
108 }
109 
110 static
111 NTSTATUS
112 NTAPI
115  IN PIRP Irp)
116 {
118  PIO_STACK_LOCATION IoStackLocation;
119 
120  PAGED_CODE();
121 
122  IoStackLocation = IoGetCurrentIrpStackLocation(Irp);
123 
124  DPRINT("TestIrpHandler. Function=%s, DeviceObject=%p, AttachDeviceObject=%p\n",
125  KmtMajorFunctionNames[IoStackLocation->MajorFunction],
126  DeviceObject,
128 
129  if (AttachDeviceObject)
130  {
133  return Status;
134  }
135 
137 
138  Irp->IoStatus.Status = Status;
139  Irp->IoStatus.Information = 0;
140 
142 
143  return Status;
144 }
145 
146 extern DRIVER_INITIALIZE DriverEntry;
147 
148 static
149 VOID
153  IN DRIVER_STATUS DriverStatus)
154 {
155  BOOLEAN CheckThisDispatchRoutine;
156  PVOID FirstMajorFunc;
157  int i;
158  UNICODE_STRING HardwareDatabase = RTL_CONSTANT_STRING(L"\\REGISTRY\\MACHINE\\HARDWARE\\DESCRIPTION\\SYSTEM");
159  UNICODE_STRING RegPath = RTL_CONSTANT_STRING(L"\\REGISTRY\\MACHINE\\SYSTEM\\ControlSet001\\Services\\Kmtest-IoDeviceObject");
160  UNICODE_STRING DriverName = RTL_CONSTANT_STRING(L"\\Driver\\Kmtest-IoDeviceObject");
161  UNICODE_STRING ServiceKeyName = RTL_CONSTANT_STRING(L"Kmtest-IoDeviceObject");
162  BOOLEAN Equal;
163 
164  ok(DriverObject->Size == sizeof(DRIVER_OBJECT), "Size does not match, got %x\n",DriverObject->Size);
165  ok(DriverObject->Type == 4, "Type does not match 4. got %d\n", DriverObject->Type);
166 
167  if (DriverStatus == DriverStatusEntry)
168  {
169  ok(DriverObject->DeviceObject == NULL, "Expected DeviceObject pointer to be 0, got %p\n",
172  "Expected Flags to be DRVO_LEGACY_DRIVER, got %lu\n",
174 
176  "DriverStart is %p, expected < %p\n",
178  ok(DriverObject->DriverSize > 0x2000,
179  "DriverSize 0x%lx\n", DriverObject->DriverSize);
185  &RegPath,
186  FALSE);
187  ok(Equal, "RegistryPath is '%wZ'\n", RegistryPath);
188  ok((ULONG_PTR)RegistryPath % PAGE_SIZE == 0, "RegistryPath %p not page-aligned\n", RegistryPath);
192  &ServiceKeyName,
193  FALSE);
194  ok(Equal, "ServiceKeyName is '%wZ'\n", &DriverObject->DriverExtension->ServiceKeyName);
200  &DriverName,
201  FALSE);
202  ok(Equal, "DriverName is '%wZ'\n", &DriverObject->DriverName);
206  // TODO: show that both string and buffer are constants inside ntos
208  &HardwareDatabase,
209  FALSE);
210  ok(Equal, "HardwareDatabase is '%wZ'\n", DriverObject->HardwareDatabase);
214  "DriverInit is %p, expected %p\n",
216  }
217  else if (DriverStatus == DriverStatusIrp)
218  {
219  ok(DriverObject->DeviceObject != NULL, "Expected DeviceObject pointer to non null\n");
221  "Expected Flags to be DRVO_LEGACY_DRIVER | DRVO_INITIALIZED, got %lu\n",
223  }
224  else if (DriverStatus == DriverStatusUnload)
225  {
226  ok(DriverObject->DeviceObject != NULL, "Expected DeviceObject pointer to non null\n");
228  "Expected Flags to be DRVO_LEGACY_DRIVER | DRVO_INITIALIZED | DRVO_UNLOAD_INVOKED, got %lu\n",
230  }
231  else
232  ASSERT(FALSE);
233 
234  /* Select a routine that was not changed */
235  FirstMajorFunc = DriverObject->MajorFunction[1];
236  ok(FirstMajorFunc != 0, "Expected MajorFunction[1] to be non NULL\n");
237 
238  if (!skip(FirstMajorFunc != NULL, "First major function not set!\n"))
239  {
240  for (i = 0; i <= IRP_MJ_MAXIMUM_FUNCTION; i++)
241  {
242  if (DriverStatus > 0) CheckThisDispatchRoutine = (i > 3) && (i != 14);
243  else CheckThisDispatchRoutine = TRUE;
244 
245  if (CheckThisDispatchRoutine)
246  {
247  ok(DriverObject->MajorFunction[i] == FirstMajorFunc, "Expected MajorFunction[%d] to match %p\n",
248  i, FirstMajorFunc);
249  }
250  }
251  }
252 }
253 
254 static
255 BOOLEAN
259  IN PWCHAR NewDriverRegPath)
260 {
261  UNICODE_STRING RegPath;
263 
264  /* Try to load ourself */
265  Status = ZwLoadDriver((PUNICODE_STRING)DriverRegistryPath);
266  ok (Status == STATUS_IMAGE_ALREADY_LOADED, "Expected NTSTATUS STATUS_IMAGE_ALREADY_LOADED, got 0x%lX\n", Status);
267 
269  {
270  DbgPrint("WARNING: Loading this a second time will cause BUGCHECK!\n");
271  }
272 
273  /* Try to load with a Registry Path that doesnt exist */
274  RtlInitUnicodeString(&RegPath, L"\\Registry\\Machine\\System\\CurrentControlSet\\Services\\deadbeef");
275  Status = ZwLoadDriver(&RegPath);
276  ok (Status == STATUS_OBJECT_NAME_NOT_FOUND, "Expected NTSTATUS STATUS_OBJECT_NAME_NOT_FOUND, got 0x%lX\n", Status);
277 
278  /* Load the driver */
279  RtlInitUnicodeString(&RegPath, NewDriverRegPath);
280  Status = ZwLoadDriver(&RegPath);
281  ok(Status == STATUS_SUCCESS, "Expected STATUS_SUCCESS, got 0x%lX\n", Status);
282 
283  return NT_SUCCESS(Status);
284 }
285 
286 static
287 BOOLEAN
291  IN PWCHAR NewDriverRegPath)
292 {
293  UNICODE_STRING RegPath;
295 
296  /* Try to unload ourself, which should fail as our Unload routine hasnt been set yet. */
298  ok (Status == STATUS_INVALID_DEVICE_REQUEST, "Expected NTSTATUS STATUS_INVALID_DEVICE_REQUEST, got 0x%lX\n", Status);
299 
300  /* Try to unload with a Registry Path that doesnt exist */
301  RtlInitUnicodeString(&RegPath, L"\\Registry\\Machine\\System\\CurrentControlSet\\Services\\deadbeef");
302  Status = ZwUnloadDriver(&RegPath);
303  ok (Status == STATUS_OBJECT_NAME_NOT_FOUND, "Expected NTSTATUS STATUS_OBJECT_NAME_NOT_FOUND, got 0x%lX\n", Status);
304 
305  /* Unload the driver */
306  RtlInitUnicodeString(&RegPath, NewDriverRegPath);
307  Status = ZwUnloadDriver(&RegPath);
308  ok(Status == STATUS_SUCCESS, "Expected STATUS_SUCCESS, got 0x%lX\n", Status);
309 
310  return NT_SUCCESS(Status);
311 }
312 
313 static
314 VOID
317 {
318  PDEVICE_OBJECT RetObject;
319 
321 
322  ok(RetObject == AttachDeviceObject,
323  "Expected an Attached DeviceObject %p, got %p\n", AttachDeviceObject, RetObject);
324 
325  if (RetObject)
326  {
327  ObDereferenceObject(RetObject);
328  }
329 
331  ok(RetObject == AttachDeviceObject,
332  "Expected an Attached DeviceObject %p, got %p\n", AttachDeviceObject, RetObject);
333 
334  if (RetObject)
335  {
336  ObDereferenceObject(RetObject);
337  }
338 
339 }
340 
341 static
342 VOID
345  IN BOOLEAN ExclusiveAccess)
346 {
348 
349  /* Check the device object members */
350  ok(DeviceObject->Type == 3, "Expected Type = 3, got %x\n", DeviceObject->Type);
351  ok(DeviceObject->Size == 0xb8, "Expected Size = 0xb8, got %x\n", DeviceObject->Size);
352  ok(DeviceObject->ReferenceCount == 0, "Expected ReferenceCount = 0, got %lu\n",
353  DeviceObject->ReferenceCount);
354  ok(DeviceObject->DriverObject == ThisDriverObject,
355  "Expected DriverObject member to match this DriverObject %p, got %p\n",
356  ThisDriverObject, DeviceObject->DriverObject);
357  ok(DeviceObject->NextDevice == NULL, "Expected NextDevice to be NULL, got %p\n", DeviceObject->NextDevice);
358  ok(DeviceObject->AttachedDevice == NULL, "Expected AttachDevice to be NULL, got %p\n", DeviceObject->AttachedDevice);
359  ok(DeviceObject->Characteristics == 0, "Expected Characteristics to be 0\n");
360  if (ExclusiveAccess)
361  {
363  "Expected Flags DO_DEVICE_HAS_NAME | DO_DEVICE_INITIALIZING | DO_EXCLUSIVE, got %lu\n", DeviceObject->Flags);
364  }
365  else
366  {
368  "Expected Flags DO_DEVICE_HAS_NAME | DO_DEVICE_INITIALIZING, got %lu\n", DeviceObject->Flags);
369  }
370  ok(DeviceObject->DeviceType == FILE_DEVICE_UNKNOWN,
371  "Expected DeviceType to match creation parameter FILE_DEVICE_UNKNWOWN, got %lu\n",
372  DeviceObject->DeviceType);
373  ok(DeviceObject->ActiveThreadCount == 0, "Expected ActiveThreadCount = 0, got %lu\n", DeviceObject->ActiveThreadCount);
374 
375  /* Check the extended extension */
376  extdev = (PEXTENDED_DEVOBJ_EXTENSION)DeviceObject->DeviceObjectExtension;
377  ok(extdev->ExtensionFlags == 0, "Expected Extended ExtensionFlags to be 0, got %lu\n", extdev->ExtensionFlags);
378  ok (extdev->Type == 13, "Expected Type of 13, got %d\n", extdev->Type);
379  ok (extdev->Size == 0, "Expected Size of 0, got %d\n", extdev->Size);
380  ok (extdev->DeviceObject == DeviceObject, "Expected DeviceOject to match newly created device %p, got %p\n",
381  DeviceObject, extdev->DeviceObject);
382  ok(extdev->AttachedTo == NULL, "Expected AttachTo to be NULL, got %p\n", extdev->AttachedTo);
383  ok(extdev->StartIoCount == 0, "Expected StartIoCount = 0, got %lu\n", extdev->StartIoCount);
384  ok(extdev->StartIoKey == 0, "Expected StartIoKey = 0, got %lu\n", extdev->StartIoKey);
385  ok(extdev->StartIoFlags == 0, "Expected StartIoFlags = 0, got %lu\n", extdev->StartIoFlags);
386 }
387 
388 static
389 VOID
392  IN BOOLEAN Lower,
394 {
396 
397  /* Check the device object members */
398  ok(DeviceObject->Type == 3, "Expected Type = 3, got %d\n", DeviceObject->Type);
399  ok(DeviceObject->Size == 0xb8, "Expected Size = 0xb8, got %d\n", DeviceObject->Size);
400  ok(DeviceObject->ReferenceCount == 0, "Expected ReferenceCount = 0, got %lu\n",
401  DeviceObject->ReferenceCount);
402  if (!Lower)
403  {
404  ok(DeviceObject->DriverObject == ThisDriverObject,
405  "Expected DriverObject member to match this DriverObject %p, got %p\n",
406  ThisDriverObject, DeviceObject->DriverObject);
407  }
408  ok(DeviceObject->NextDevice == NULL, "Expected NextDevice to be NULL, got %p\n", DeviceObject->NextDevice);
409 
410  if (Lower)
411  {
412  ok(DeviceObject->AttachedDevice == MainDeviceObject,
413  "Expected AttachDevice to be %p, got %p\n", MainDeviceObject, DeviceObject->AttachedDevice);
414  }
415  else
416  {
417  ok(DeviceObject->AttachedDevice == NULL, "Expected AttachDevice to be NULL, got %p\n", DeviceObject->AttachedDevice);
418  }
419 
420  ok(DeviceObject->Flags == (DO_DEVICE_HAS_NAME | (Lower ? DO_EXCLUSIVE : 0)),
421  "Expected Flags DO_DEVICE_HAS_NAME, got %lu\n", DeviceObject->Flags);
422  ok(DeviceObject->DeviceType == FILE_DEVICE_UNKNOWN,
423  "Expected DeviceType to match creation parameter FILE_DEVICE_UNKNWOWN, got %lu\n",
424  DeviceObject->DeviceType);
425  ok(DeviceObject->ActiveThreadCount == 0, "Expected ActiveThreadCount = 0, got %lu\n", DeviceObject->ActiveThreadCount);
426 
427  /*Check the extended extension */
428  extdev = (PEXTENDED_DEVOBJ_EXTENSION)DeviceObject->DeviceObjectExtension;
430  "Expected Extended ExtensionFlags to be DOE_UNLOAD_PENDING, got %lu\n", extdev->ExtensionFlags);
431  ok (extdev->Type == 13, "Expected Type of 13, got %d\n", extdev->Type);
432  ok (extdev->Size == 0, "Expected Size of 0, got %d\n", extdev->Size);
433  ok (extdev->DeviceObject == DeviceObject, "Expected DeviceOject to match newly created device %p, got %p\n",
434  DeviceObject, extdev->DeviceObject);
435  if (Lower || !Attached)
436  {
437  ok(extdev->AttachedTo == NULL, "Expected AttachTo to be NULL, got %p\n", extdev->AttachedTo);
438  }
439  else
440  {
441  ok(extdev->AttachedTo == AttachDeviceObject, "Expected AttachTo to %p, got %p\n", AttachDeviceObject, extdev->AttachedTo);
442  }
443  ok(extdev->StartIoCount == 0, "Expected StartIoCount = 0, got %lu\n", extdev->StartIoCount);
444  ok(extdev->StartIoKey == 0, "Expected StartIoKey = 0, got %lu\n", extdev->StartIoKey);
445  ok(extdev->StartIoFlags == 0, "Expected StartIoFlags = 0, got %lu\n", extdev->StartIoFlags);
446 }
447 
448 static
449 VOID
452 {
454  UNICODE_STRING DeviceString;
456 
457  /* Create using wrong directory */
458  RtlInitUnicodeString(&DeviceString, L"\\Device1\\Kmtest-IoDeviceObject");
460  0,
461  &DeviceString,
463  0,
464  FALSE,
465  &DeviceObject);
466  ok(Status == STATUS_OBJECT_PATH_NOT_FOUND, "Expected STATUS_OBJECT_PATH_NOT_FOUND, got 0x%lX\n", Status);
467 
468  /* Create using correct params with exclusice access */
469  RtlInitUnicodeString(&DeviceString, L"\\Device\\Kmtest-IoDeviceObject");
471  0,
472  &DeviceString,
474  0,
475  TRUE,
476  &DeviceObject);
477  ok(Status == STATUS_SUCCESS, "Expected STATUS_SUCCESS, got 0x%lX\n", Status);
478 
480 
481  /* Delete the device */
482  if (NT_SUCCESS(Status))
483  {
485  ok(DriverObject->DeviceObject == 0, "Expected DriverObject->DeviceObject to be NULL, got %p\n",
487  }
488 
489  /* Create using correct params without exclusice access */
491  0,
492  &DeviceString,
494  0,
495  FALSE,
496  &DeviceObject);
497  ok(Status == STATUS_SUCCESS, "Expected STATUS_SUCCESS, got 0x%lX\n", Status);
498 
500 
501  /* Delete the device */
502  if (NT_SUCCESS(Status))
503  {
505  ok(DriverObject->DeviceObject == 0, "Expected DriverObject->DeviceObject to be NULL, got %p\n",
507  }
508 
509  /* Recreate device */
511  0,
512  &DeviceString,
514  0,
515  FALSE,
516  &DeviceObject);
517  ok(Status == STATUS_SUCCESS, "Expected STATUS_SUCCESS, got 0x%lX\n", Status);
518 
519  if (NT_SUCCESS(Status))
521 }
522 
523 static
524 VOID
527  IN PWCHAR NewDriverRegPath)
528 {
530  UNICODE_STRING LowerDeviceName;
531 
532  RtlInitUnicodeString(&LowerDeviceName, NewDriverRegPath);
533  Status = IoAttachDevice(DeviceObject, &LowerDeviceName, &AttachDeviceObject);
535 
536  /* TODO: Add more tests */
537 }
538 
539 static
540 VOID
542  IN PDEVICE_OBJECT AttachedDevice)
543 {
544  IoDetachDevice(AttachedDevice);
545 
546  /* TODO: Add more tests */
547 }
#define DO_DEVICE_INITIALIZING
Definition: env_spec_w32.h:399
#define ok_eq_ulong(value, expected)
const uint16_t * PCWSTR
Definition: typedefs.h:55
#define IN
Definition: typedefs.h:38
#define DRVO_LEGACY_DRIVER
Definition: iotypes.h:2118
static PDRIVER_OBJECT ThisDriverObject
PCSTR KmtMajorFunctionNames[]
#define TRUE
Definition: types.h:120
NTSTATUS NTAPI IoAttachDevice(PDEVICE_OBJECT SourceDevice, PUNICODE_STRING TargetDeviceName, PDEVICE_OBJECT *AttachedDevice)
Definition: device.c:913
#define IRP_MJ_CREATE
Definition: rdpdr.c:44
#define DbgPrint
Definition: loader.c:25
USHORT MaximumLength
Definition: env_spec_w32.h:370
static PDEVICE_OBJECT AttachDeviceObject
_In_ PIRP Irp
Definition: csq.h:116
#define UNREFERENCED_PARAMETER(P)
Definition: ntbasedef.h:323
#define ok_eq_pointer(value, expected)
#define IRP_MJ_MAXIMUM_FUNCTION
LONG NTSTATUS
Definition: precomp.h:26
PVOID DriverStart
Definition: iotypes.h:2171
static BOOLEAN TestZwUnload(IN PDRIVER_OBJECT DriverObject, IN PCUNICODE_STRING DriverRegistryPath, IN PWCHAR NewDriverRegPath)
PDEVICE_OBJECT DeviceObject
Definition: iotypes.h:915
static DRIVER_DISPATCH TestDispatch
#define STATUS_INVALID_DEVICE_REQUEST
Definition: udferr_usr.h:138
VOID TestUnload(IN PDRIVER_OBJECT DriverObject)
VOID NTAPI IoDetachDevice(IN PDEVICE_OBJECT TargetDevice)
Definition: device.c:1296
struct _EXTENDED_DEVOBJ_EXTENSION * PEXTENDED_DEVOBJ_EXTENSION
VOID NTAPI ObDereferenceObject(IN PVOID Object)
Definition: obref.c:375
uint16_t * PWCHAR
Definition: typedefs.h:54
WCHAR DeviceName[]
Definition: adapter.cpp:21
int32_t INT
Definition: typedefs.h:56
#define PAGED_CODE()
Definition: video.h:57
PDEVICE_OBJECT NTAPI IoGetDeviceAttachmentBaseRef(IN PDEVICE_OBJECT DeviceObject)
Definition: device.c:1419
uint32_t ULONG_PTR
Definition: typedefs.h:63
static VOID TestAttachDevice(IN PDEVICE_OBJECT DeviceObject, IN PWCHAR NewDriverRegPath)
_Must_inspect_result_ _In_ ULONG Flags
Definition: wsk.h:170
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
static BOOL Attached
Definition: vidbios.c:3905
NTSTATUS(* NTAPI)(IN PFILE_FULL_EA_INFORMATION EaBuffer, IN ULONG EaLength, OUT PULONG ErrorOffset)
Definition: IoEaTest.cpp:117
#define UNICODE_NULL
struct _DRIVER_OBJECT * DriverObject
Definition: iotypes.h:2111
PDRIVER_EXTENSION DriverExtension
Definition: iotypes.h:2174
static BOOLEAN TestZwLoad(IN PDRIVER_OBJECT DriverObject, IN PCUNICODE_STRING DriverRegistryPath, IN PWCHAR NewDriverRegPath)
unsigned char BOOLEAN
smooth NULL
Definition: ftsmooth.c:416
#define ok_eq_tag(value, expected)
Definition: kmt_test.h:263
static PDRIVER_OBJECT DriverObject
Definition: template.c:42
#define IoCompleteRequest
Definition: irp.c:1240
PUNICODE_STRING HardwareDatabase
Definition: iotypes.h:2176
void DPRINT(...)
Definition: polytest.cpp:61
static VOID TestDetachDevice(IN PDEVICE_OBJECT AttachedDevice)
static VOID TestDeviceCreateDelete(IN PDRIVER_OBJECT DriverObject)
PDEVICE_OBJECT NTAPI IoGetLowerDeviceObject(IN PDEVICE_OBJECT DeviceObject)
Definition: device.c:1507
NTSYSAPI NTSTATUS NTAPI ZwUnloadDriver(_In_ PUNICODE_STRING DriverServiceName)
CSHORT Size
Definition: iotypes.h:2168
#define DRVO_UNLOAD_INVOKED
Definition: iotypes.h:2117
PDEVICE_OBJECT AttachedTo
Definition: iotypes.h:920
DRIVER_INITIALIZE DriverEntry
Definition: condrv.c:21
#define DOE_UNLOAD_PENDING
Definition: iotypes.h:149
#define DO_DEVICE_HAS_NAME
Definition: env_spec_w32.h:398
#define DRVO_INITIALIZED
Definition: iotypes.h:4114
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
NTSTATUS TestEntry(IN PDRIVER_OBJECT DriverObject, IN PCUNICODE_STRING RegistryPath, OUT PCWSTR *DeviceName, IN OUT INT *Flags)
static VOID TestDeviceDeletion(IN PDEVICE_OBJECT DeviceObject, IN BOOLEAN Lower, IN BOOLEAN Attached)
#define STATUS_OBJECT_PATH_NOT_FOUND
Definition: udferr_usr.h:151
ASSERT((InvokeOnSuccess||InvokeOnError||InvokeOnCancel) ?(CompletionRoutine !=NULL) :TRUE)
USHORT KmtGetPoolType(PVOID Memory)
static VOID TestDriverObject(IN PDRIVER_OBJECT DriverObject, IN PCUNICODE_STRING RegistryPath OPTIONAL, IN DRIVER_STATUS DriverStatus)
#define IRP_MJ_CLOSE
Definition: rdpdr.c:45
static const WCHAR L[]
Definition: oid.c:1250
#define PAGE_SIZE
Definition: env_spec_w32.h:49
DRIVER_DISPATCH(nfs41_FsdDispatch)
Status
Definition: gdiplustypes.h:24
static VOID TestDeviceCreated(IN PDEVICE_OBJECT DeviceObject, IN BOOLEAN ExclusiveAccess)
UNICODE_STRING ServiceKeyName
Definition: iotypes.h:2114
IN PDEVICE_OBJECT DeviceObject
Definition: fatprocs.h:1560
__drv_aliasesMem FORCEINLINE PIO_STACK_LOCATION IoGetCurrentIrpStackLocation(_In_ PIRP Irp)
Definition: iofuncs.h:2745
VOID NTAPI IoDeleteDevice(IN PDEVICE_OBJECT DeviceObject)
Definition: device.c:1251
PDRIVER_ADD_DEVICE AddDevice
Definition: iotypes.h:2112
#define STATUS_OBJECT_NAME_NOT_FOUND
Definition: udferr_usr.h:149
DRIVER_STATUS
ULONG KmtGetPoolTag(PVOID Memory)
#define ok(value,...)
Definition: atltest.h:57
static PDEVICE_OBJECT MainDeviceObject
#define FILE_DEVICE_UNKNOWN
Definition: winioctl.h:139
NTSTATUS NTAPI IoCallDriver(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp)
Definition: irp.c:1218
#define IoSkipCurrentIrpStackLocation(Irp)
Definition: ntifs_ex.h:421
#define skip(...)
Definition: atltest.h:64
#define BASE_POOL_TYPE_MASK
#define OUT
Definition: typedefs.h:39
PDRIVER_DISPATCH MajorFunction[IRP_MJ_MAXIMUM_FUNCTION+1]
Definition: iotypes.h:2181
#define DO_EXCLUSIVE
Definition: env_spec_w32.h:395
#define IO_NO_INCREMENT
Definition: iotypes.h:566
NTSTATUS NTAPI IoCreateDevice(IN PDRIVER_OBJECT DriverObject, IN ULONG DeviceExtensionSize, IN PUNICODE_STRING DeviceName, IN DEVICE_TYPE DeviceType, IN ULONG DeviceCharacteristics, IN BOOLEAN Exclusive, OUT PDEVICE_OBJECT *DeviceObject)
Definition: device.c:1031
NTSYSAPI VOID NTAPI RtlInitUnicodeString(PUNICODE_STRING DestinationString, PCWSTR SourceString)
_In_ PUNICODE_STRING RegistryPath
Definition: wmip.h:27
#define ok_eq_hex(value, expected)
#define ok_eq_uint(value, expected)
Definition: kmt_test.h:239
ULONG DriverSize
Definition: iotypes.h:2172
return STATUS_SUCCESS
Definition: btrfs.c:2966
CSHORT Type
Definition: iotypes.h:2167
#define UL
Definition: tui.h:83
NTSYSAPI BOOLEAN NTAPI RtlEqualUnicodeString(PUNICODE_STRING String1, PUNICODE_STRING String2, BOOLEAN CaseInSensitive)
UNICODE_STRING DriverRegistryPath
Definition: ramdisk.c:124
PDRIVER_INITIALIZE DriverInit
Definition: iotypes.h:2178
UNICODE_STRING DriverName
Definition: iotypes.h:2175
PDEVICE_OBJECT DeviceObject
Definition: iotypes.h:2169
static VOID TestLowerDeviceKernelAPI(IN PDEVICE_OBJECT DeviceObject)
#define IRP_MJ_DEVICE_CONTROL
Definition: rdpdr.c:52
#define STATUS_IMAGE_ALREADY_LOADED
Definition: ntstatus.h:492
#define RTL_CONSTANT_STRING(s)
Definition: tunneltest.c:14
PULONG MinorVersion OPTIONAL
Definition: CrossNt.h:68