2011-07-06 18:55:21 +00:00
|
|
|
/*
|
2018-02-18 10:14:13 +00:00
|
|
|
* PROJECT: ReactOS kernel-mode tests
|
|
|
|
* LICENSE: LGPL-2.1+ (https://spdx.org/licenses/LGPL-2.1+)
|
|
|
|
* PURPOSE: Kernel-Mode Test Suite Example user-mode test part
|
|
|
|
* COPYRIGHT: Copyright 2011-2018 Thomas Faber <thomas.faber@reactos.org>
|
2011-07-06 18:55:21 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
#include <kmt_test.h>
|
|
|
|
|
2011-07-06 22:23:03 +00:00
|
|
|
#include "Example.h"
|
|
|
|
|
2011-07-06 18:55:21 +00:00
|
|
|
START_TEST(Example)
|
|
|
|
{
|
|
|
|
/* do some user-mode stuff */
|
|
|
|
SYSTEM_INFO SystemInfo;
|
2011-07-06 22:23:03 +00:00
|
|
|
MY_STRUCT MyStruct[2] = { { 123, ":D" }, { 0 } };
|
|
|
|
DWORD Length = sizeof MyStruct;
|
2022-08-08 07:50:28 +00:00
|
|
|
DWORD Error;
|
2011-07-06 18:55:21 +00:00
|
|
|
|
|
|
|
trace("Message from user-mode\n");
|
|
|
|
|
|
|
|
GetSystemInfo(&SystemInfo);
|
|
|
|
ok(SystemInfo.dwActiveProcessorMask != 0, "No active processors?!\n");
|
|
|
|
|
|
|
|
/* now run the kernel-mode part (see Example.c).
|
|
|
|
* If no user-mode part exists, this is what's done automatically */
|
|
|
|
KmtRunKernelTest("Example");
|
2011-07-06 22:23:03 +00:00
|
|
|
|
|
|
|
/* now start the special-purpose driver */
|
2022-08-08 07:50:28 +00:00
|
|
|
Error = KmtLoadAndOpenDriver(L"Example", FALSE);
|
|
|
|
ok_eq_int(Error, ERROR_SUCCESS);
|
|
|
|
if (Error)
|
|
|
|
return;
|
2011-07-06 22:23:03 +00:00
|
|
|
trace("After Create\n");
|
|
|
|
|
|
|
|
ok(KmtSendToDriver(IOCTL_NOTIFY) == ERROR_SUCCESS, "\n");
|
|
|
|
ok(KmtSendStringToDriver(IOCTL_SEND_STRING, "yay") == ERROR_SUCCESS, "\n");
|
|
|
|
ok(KmtSendBufferToDriver(IOCTL_SEND_MYSTRUCT, MyStruct, sizeof MyStruct[0], &Length) == ERROR_SUCCESS, "\n");
|
|
|
|
ok_eq_int(MyStruct[1].a, 456);
|
|
|
|
ok_eq_str(MyStruct[1].b, "!!!");
|
|
|
|
|
|
|
|
KmtCloseDriver();
|
|
|
|
trace("After Close\n");
|
|
|
|
KmtUnloadDriver();
|
|
|
|
trace("After Unload\n");
|
2011-07-06 18:55:21 +00:00
|
|
|
}
|