Commit 57d438b5 authored by Zebediah Figura's avatar Zebediah Figura Committed by Alexandre Julliard

ntoskrnl/tests: Separate a helper to print the contents of the driver output file.

parent 553eb70e
...@@ -366,19 +366,37 @@ static BOOL start_driver(HANDLE service, BOOL vista_plus) ...@@ -366,19 +366,37 @@ static BOOL start_driver(HANDLE service, BOOL vista_plus)
return TRUE; return TRUE;
} }
static void cat_okfile(HANDLE okfile)
{
char buffer[512];
DWORD size;
SetFilePointer(okfile, 0, NULL, FILE_BEGIN);
do
{
ReadFile(okfile, buffer, sizeof(buffer), &size, NULL);
printf("%.*s", size, buffer);
} while (size == sizeof(buffer));
SetFilePointer(okfile, 0, NULL, FILE_BEGIN);
SetEndOfFile(okfile);
winetest_add_failures(InterlockedExchange(&test_data->failures, 0));
}
static ULONG64 modified_value; static ULONG64 modified_value;
static void main_test(void) static void main_test(void)
{ {
struct main_test_input *test_input; struct main_test_input *test_input;
char buffer[512];
HANDLE okfile; HANDLE okfile;
DWORD size; DWORD size;
BOOL res; BOOL res;
/* Create a temporary file that the driver will write ok/trace output to. */ /* Create a temporary file that the driver will write ok/trace output to. */
okfile = CreateFileA("C:\\windows\\winetest_ntoskrnl_okfile", GENERIC_READ, okfile = CreateFileA("C:\\windows\\winetest_ntoskrnl_okfile", GENERIC_READ | GENERIC_WRITE,
FILE_SHARE_READ | FILE_SHARE_WRITE, NULL, CREATE_ALWAYS, 0, NULL); FILE_SHARE_READ | FILE_SHARE_WRITE, NULL, CREATE_ALWAYS, 0, NULL);
ok(okfile != INVALID_HANDLE_VALUE, "failed to create file, error %u\n", GetLastError()); ok(okfile != INVALID_HANDLE_VALUE, "failed to create file, error %u\n", GetLastError());
...@@ -392,12 +410,7 @@ static void main_test(void) ...@@ -392,12 +410,7 @@ static void main_test(void)
ok(res, "DeviceIoControl failed: %u\n", GetLastError()); ok(res, "DeviceIoControl failed: %u\n", GetLastError());
ok(!size, "got size %u\n", size); ok(!size, "got size %u\n", size);
do { cat_okfile(okfile);
ReadFile(okfile, buffer, sizeof(buffer), &size, NULL);
printf("%.*s", size, buffer);
} while (size == sizeof(buffer));
winetest_add_failures(InterlockedExchange(&test_data->failures, 0));
heap_free(test_input); heap_free(test_input);
CloseHandle(okfile); CloseHandle(okfile);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment