[KMTESTS]
[reactos.git] / rostests / kmtests / example / Example_user.c
1 /*
2 * PROJECT: ReactOS kernel-mode tests
3 * LICENSE: GPLv2+ - See COPYING in the top level directory
4 * PURPOSE: Kernel-Mode Test Suite Example user-mode test part
5 * PROGRAMMER: Thomas Faber <thomas.faber@reactos.org>
6 */
7
8 #include <kmt_test.h>
9
10 #include "Example.h"
11
12 START_TEST(Example)
13 {
14 /* do some user-mode stuff */
15 SYSTEM_INFO SystemInfo;
16 MY_STRUCT MyStruct[2] = { { 123, ":D" }, { 0 } };
17 DWORD Length = sizeof MyStruct;
18
19 trace("Message from user-mode\n");
20
21 GetSystemInfo(&SystemInfo);
22 ok(SystemInfo.dwActiveProcessorMask != 0, "No active processors?!\n");
23
24 /* now run the kernel-mode part (see Example.c).
25 * If no user-mode part exists, this is what's done automatically */
26 KmtRunKernelTest("Example");
27
28 /* now start the special-purpose driver */
29 KmtLoadDriver(L"Example", FALSE);
30 trace("After Entry\n");
31 KmtOpenDriver();
32 trace("After Create\n");
33
34 ok(KmtSendToDriver(IOCTL_NOTIFY) == ERROR_SUCCESS, "\n");
35 ok(KmtSendStringToDriver(IOCTL_SEND_STRING, "yay") == ERROR_SUCCESS, "\n");
36 ok(KmtSendBufferToDriver(IOCTL_SEND_MYSTRUCT, MyStruct, sizeof MyStruct[0], &Length) == ERROR_SUCCESS, "\n");
37 ok_eq_int(MyStruct[1].a, 456);
38 ok_eq_str(MyStruct[1].b, "!!!");
39
40 KmtCloseDriver();
41 trace("After Close\n");
42 KmtUnloadDriver();
43 trace("After Unload\n");
44 }