68 trace(
"Hi, this is the example driver\n");
103 trace(
"Unloading example driver\n");
142 static int TimesReceived = 0;
145 ok(TimesReceived == 1,
"Received control code 1 %d times\n", TimesReceived);
153 static int TimesReceived = 0;
158 ok(TimesReceived == 1,
"Received control code 2 %d times\n", TimesReceived);
169 static int TimesReceived = 0;
170 MY_STRUCT ExpectedStruct = { 123,
":D" };
174 ok(TimesReceived == 1,
"Received control code 3 %d times\n", TimesReceived);
178 if (!
skip(
Buffer && InLength >=
sizeof ExpectedStruct,
"Cannot read from buffer!\n"))
179 ok(
RtlCompareMemory(&ExpectedStruct,
Buffer,
sizeof ExpectedStruct) ==
sizeof ExpectedStruct,
"Buffer does not contain expected values\n");
181 if (!
skip(
Buffer && *OutLength >= 2 *
sizeof ExpectedStruct,
"Cannot write to buffer!\n"))
184 *OutLength = 2 *
sizeof ExpectedStruct;
189 ok(0,
"Got an unknown message! DeviceObject=%p, ControlCode=%lu, Buffer=%p, In=%lu, Out=%lu bytes\n",
233 trace(
"Got IRP_MJ_CREATE!\n");
234 else if (IoStackLocation->MajorFunction ==
IRP_MJ_CLOSE)
235 trace(
"Got IRP_MJ_CLOSE!\n");
237 trace(
"Got an IRP!\n");
240 Irp->IoStatus.Information = 0;
#define IOCTL_SEND_MYSTRUCT
#define IOCTL_SEND_STRING
static KMT_MESSAGE_HANDLER TestMessageHandler
VOID TestUnload(IN PDRIVER_OBJECT DriverObject)
static PDRIVER_OBJECT TestDriverObject
NTSTATUS TestEntry(IN PDRIVER_OBJECT DriverObject, IN PCUNICODE_STRING RegistryPath, OUT PCWSTR *DeviceName, IN OUT INT *Flags)
static KMT_IRP_HANDLER TestIrpHandler
#define ok_eq_pointer(value, expected)
#define ok_eq_ulong(value, expected)
#define RtlCompareMemory(s1, s2, l)
NTSTATUS KmtRegisterMessageHandler(IN ULONG ControlCode OPTIONAL, IN PDEVICE_OBJECT DeviceObject OPTIONAL, IN PKMT_MESSAGE_HANDLER MessageHandler)
NTSTATUS KmtRegisterIrpHandler(IN UCHAR MajorFunction, IN PDEVICE_OBJECT DeviceObject OPTIONAL, IN PKMT_IRP_HANDLER IrpHandler)
NTSYSAPI LONG NTAPI RtlCompareString(PSTRING String1, PSTRING String2, BOOLEAN CaseInSensitive)
#define UNREFERENCED_PARAMETER(P)
#define IoCompleteRequest
PULONG MinorVersion OPTIONAL
#define RTL_CONSTANT_STRING(s)
#define RtlCopyMemory(Destination, Source, Length)
_In_ PDEVICE_OBJECT DeviceObject
_Must_inspect_result_ _In_ PWDFDEVICE_INIT _In_opt_ PCUNICODE_STRING DeviceName
_Must_inspect_result_ _In_ PDRIVER_OBJECT _In_ PCUNICODE_STRING RegistryPath
_Must_inspect_result_ _In_ PDRIVER_OBJECT DriverObject
_IRQL_requires_same_ typedef _In_ ULONG ControlCode
_Must_inspect_result_ _In_ ULONG Flags