8#define KMT_DEFINE_TEST_FUNCTIONS
18#define SERVICE_NAME L"Kmtest"
19#define SERVICE_PATH L"kmtest_drv.sys"
20#define SERVICE_DESCRIPTION L"ReactOS Kernel-Mode Test Suite Driver"
22#define RESULTBUFFER_SIZE (1024 * 1024)
60 fprintf(
stderr,
"%s: Could not retrieve error message (error 0x%08lx). Original error: 0x%08lx\n",
89 while (*Str1 && *Str1 == *Str2)
121 puts(
"Valid test names:");
132 NextTestName = TestName;
133 TestName +=
strlen(TestName) + 1;
147 TestName +=
strlen(TestName) + 1;
157 NextTestName = TestName;
158 TestName +=
strlen(TestName) + 1;
162 if (IncludeHidden && NextTestName[0] ==
'-')
165 if (NextTestName[0] !=
'-')
166 printf(
" %s\n", NextTestName);
195 if (*TestEntryName ==
'-')
198 if (!
lstrcmpA(TestEntryName, TestName))
222 DWORD LogBufferLength;
226 const DWORD BlockSize = 8 * 1024;
228 KmtFinishTest(TestName);
321 printf(
"Usage: %s <test_name> - run the specified test (creates/starts the driver(s) as appropriate)\n",
AppName);
323 printf(
" %s --list-all - list available tests, including hidden\n",
AppName);
324 printf(
" %s <create|delete|start|stop> - manage the kmtest driver\n\n",
AppName);
329 TestName = Arguments[1];
332 else if (!
lstrcmpA(TestName,
"delete"))
334 else if (!
lstrcmpA(TestName,
"start"))
336 else if (!
lstrcmpA(TestName,
"stop"))
339 else if (!
lstrcmpA(TestName,
"--list"))
341 else if (!
lstrcmpA(TestName,
"--list-all"))
DWORD KmtStartService(IN PCWSTR ServiceName OPTIONAL, IN OUT SC_HANDLE *ServiceHandle)
static void TestEntry(const ENTRY *pEntry)
static KSTART_ROUTINE RunTest
ACPI_SIZE strlen(const char *String)
HANDLE WINAPI GetStdHandle(IN DWORD nStdHandle)
int puts(const char *string)
static CHAR AppName[MAX_PATH]
BOOL WINAPI DeviceIoControl(IN HANDLE hDevice, IN DWORD dwIoControlCode, IN LPVOID lpInBuffer OPTIONAL, IN DWORD nInBufferSize OPTIONAL, OUT LPVOID lpOutBuffer OPTIONAL, IN DWORD nOutBufferSize OPTIONAL, OUT LPDWORD lpBytesReturned OPTIONAL, IN LPOVERLAPPED lpOverlapped OPTIONAL)
#define INVALID_HANDLE_VALUE
static void cleanup(void)
BOOL WINAPI WriteFile(IN HANDLE hFile, IN LPCVOID lpBuffer, IN DWORD nNumberOfBytesToWrite OPTIONAL, OUT LPDWORD lpNumberOfBytesWritten, IN LPOVERLAPPED lpOverlapped OPTIONAL)
int WINAPI lstrcmpA(LPCSTR str1, LPCSTR str2)
static const WCHAR Message[]
HLOCAL NTAPI LocalFree(HLOCAL hMem)
_Check_return_opt_ _CRTIMP int __cdecl fprintf(_Inout_ FILE *_File, _In_z_ _Printf_format_string_ const char *_Format,...)
#define IOCTL_KMTEST_GET_TESTS
#define KMTEST_DEVICE_PATH
#define IOCTL_KMTEST_SET_RESULTBUFFER
KMT_TESTFUNC * PKMT_TESTFUNC
PKMT_RESULTBUFFER ResultBuffer
static VOID KmtFreeResultBuffer(PKMT_RESULTBUFFER Buffer)
static PKMT_RESULTBUFFER KmtAllocateResultBuffer(SIZE_T ResultBufferSize)
static DWORD ListTests(IN BOOLEAN IncludeHidden)
static void OutputError(IN DWORD Error)
#define RESULTBUFFER_SIZE
static DWORD OutputResult(IN PCSTR TestName)
static INT CompareTestNames(IN PCSTR Str1, IN PCSTR Str2)
SC_HANDLE KmtestServiceHandle
DWORD KmtServiceCleanup(BOOLEAN IgnoreErrors)
DWORD KmtServiceInit(VOID)
DWORD KmtCloseService(IN OUT SC_HANDLE *ServiceHandle)
#define error_goto(Error, label)
DWORD KmtDeleteService(IN PCWSTR ServiceName OPTIONAL, IN OUT SC_HANDLE *ServiceHandle)
DWORD KmtCreateService(IN PCWSTR ServiceName, IN PCWSTR ServicePath, IN PCWSTR DisplayName OPTIONAL, OUT SC_HANDLE *ServiceHandle)
DWORD KmtStopService(IN PCWSTR ServiceName OPTIONAL, IN OUT SC_HANDLE *ServiceHandle)
DWORD KmtCreateAndStartService(IN PCWSTR ServiceName, IN PCWSTR ServicePath, IN PCWSTR DisplayName OPTIONAL, OUT SC_HANDLE *ServiceHandle, IN BOOLEAN RestartIfRunning)
_In_ ULONG _In_ ULONG Offset
_In_ ULONG _In_ ULONG _In_ ULONG Length
CHAR LogBuffer[ANYSIZE_ARRAY]
volatile LONG LogBufferLength
DWORD KmtRunKernelTest(IN PCSTR TestName)
EH_STD::__list__< TestClass, eh_allocator(TestClass) > TestList
_Must_inspect_result_ _In_ WDFIOTARGET _In_opt_ WDFREQUEST _In_opt_ PWDF_MEMORY_DESCRIPTOR _In_opt_ PLONGLONG _In_opt_ PWDF_REQUEST_SEND_OPTIONS _Out_opt_ PULONG_PTR BytesWritten
_Must_inspect_result_ _In_ WDFIOTARGET _In_opt_ WDFREQUEST _In_opt_ PWDF_MEMORY_DESCRIPTOR _In_opt_ PLONGLONG _In_opt_ PWDF_REQUEST_SEND_OPTIONS _Out_opt_ PULONG_PTR BytesRead
#define STD_OUTPUT_HANDLE
DWORD WINAPI GetLastError(void)
#define FORMAT_MESSAGE_IGNORE_INSERTS
#define FORMAT_MESSAGE_FROM_SYSTEM
#define FORMAT_MESSAGE_ALLOCATE_BUFFER
_At_(*)(_In_ PWSK_CLIENT Client, _In_opt_ PUNICODE_STRING NodeName, _In_opt_ PUNICODE_STRING ServiceName, _In_opt_ ULONG NameSpace, _In_opt_ GUID *Provider, _In_opt_ PADDRINFOEXW Hints, _Outptr_ PADDRINFOEXW *Result, _In_opt_ PEPROCESS OwningProcess, _In_opt_ PETHREAD OwningThread, _Inout_ PIRP Irp Result)(Mem)) NTSTATUS(WSKAPI *PFN_WSK_GET_ADDRESS_INFO