Commit 9ca8280b authored by Zebediah Figura's avatar Zebediah Figura Committed by Alexandre Julliard

ntdll/tests: Remove a superfluous helper.

parent 332c6753
...@@ -108,10 +108,6 @@ static HANDLE create_temp_file( ULONG flags ) ...@@ -108,10 +108,6 @@ static HANDLE create_temp_file( ULONG flags )
#define CKEY_FIRST 0x1030341 #define CKEY_FIRST 0x1030341
#define CKEY_SECOND 0x132E46 #define CKEY_SECOND 0x132E46
static ULONG_PTR completionKey;
static IO_STATUS_BLOCK ioSb;
static ULONG_PTR completionValue;
static ULONG get_pending_msgs(HANDLE h) static ULONG get_pending_msgs(HANDLE h)
{ {
NTSTATUS res; NTSTATUS res;
...@@ -124,21 +120,6 @@ static ULONG get_pending_msgs(HANDLE h) ...@@ -124,21 +120,6 @@ static ULONG get_pending_msgs(HANDLE h)
return a; return a;
} }
static BOOL get_msg(HANDLE h)
{
LARGE_INTEGER timeout = {{-10000000*3}};
DWORD res = pNtRemoveIoCompletion( h, &completionKey, &completionValue, &ioSb, &timeout);
ok( res == STATUS_SUCCESS, "NtRemoveIoCompletion failed: %x\n", res );
if (res != STATUS_SUCCESS)
{
completionKey = completionValue = 0;
memset(&ioSb, 0, sizeof(ioSb));
return FALSE;
}
return TRUE;
}
static void WINAPI apc( void *arg, IO_STATUS_BLOCK *iosb, ULONG reserved ) static void WINAPI apc( void *arg, IO_STATUS_BLOCK *iosb, ULONG reserved )
{ {
int *count = arg; int *count = arg;
...@@ -885,6 +866,9 @@ static void nt_mailslot_test(void) ...@@ -885,6 +866,9 @@ static void nt_mailslot_test(void)
static void test_iocp_setcompletion(HANDLE h) static void test_iocp_setcompletion(HANDLE h)
{ {
LARGE_INTEGER timeout = {{0}};
IO_STATUS_BLOCK iosb;
ULONG_PTR key, value;
NTSTATUS res; NTSTATUS res;
ULONG count; ULONG count;
SIZE_T size = 3; SIZE_T size = 3;
...@@ -897,13 +881,12 @@ static void test_iocp_setcompletion(HANDLE h) ...@@ -897,13 +881,12 @@ static void test_iocp_setcompletion(HANDLE h)
count = get_pending_msgs(h); count = get_pending_msgs(h);
ok( count == 1, "Unexpected msg count: %d\n", count ); ok( count == 1, "Unexpected msg count: %d\n", count );
if (get_msg(h)) res = pNtRemoveIoCompletion( h, &key, &value, &iosb, &timeout );
{ ok( res == STATUS_SUCCESS, "NtRemoveIoCompletion failed: %#x\n", res );
ok( completionKey == CKEY_FIRST, "Invalid completion key: %lx\n", completionKey ); ok( key == CKEY_FIRST, "Invalid completion key: %#lx\n", key );
ok( ioSb.Information == size, "Invalid ioSb.Information: %lu\n", ioSb.Information ); ok( iosb.Information == size, "Invalid iosb.Information: %lu\n", iosb.Information );
ok( U(ioSb).Status == STATUS_INVALID_DEVICE_REQUEST, "Invalid ioSb.Status: %x\n", U(ioSb).Status); ok( U(iosb).Status == STATUS_INVALID_DEVICE_REQUEST, "Invalid iosb.Status: %#x\n", U(iosb).Status );
ok( completionValue == CVALUE_FIRST, "Invalid completion value: %lx\n", completionValue ); ok( value == CVALUE_FIRST, "Invalid completion value: %#lx\n", value );
}
count = get_pending_msgs(h); count = get_pending_msgs(h);
ok( !count, "Unexpected msg count: %d\n", count ); ok( !count, "Unexpected msg count: %d\n", count );
...@@ -915,7 +898,9 @@ static void test_iocp_fileio(HANDLE h) ...@@ -915,7 +898,9 @@ static void test_iocp_fileio(HANDLE h)
IO_STATUS_BLOCK iosb; IO_STATUS_BLOCK iosb;
FILE_COMPLETION_INFORMATION fci = {h, CKEY_SECOND}; FILE_COMPLETION_INFORMATION fci = {h, CKEY_SECOND};
LARGE_INTEGER timeout = {{0}};
HANDLE hPipeSrv, hPipeClt; HANDLE hPipeSrv, hPipeClt;
ULONG_PTR key, value;
NTSTATUS res; NTSTATUS res;
hPipeSrv = CreateNamedPipeA( pipe_name, PIPE_ACCESS_INBOUND, PIPE_TYPE_MESSAGE | PIPE_READMODE_MESSAGE | PIPE_WAIT, 4, 1024, 1024, 1000, NULL ); hPipeSrv = CreateNamedPipeA( pipe_name, PIPE_ACCESS_INBOUND, PIPE_TYPE_MESSAGE | PIPE_READMODE_MESSAGE | PIPE_WAIT, 4, 1024, 1024, 1000, NULL );
...@@ -964,14 +949,15 @@ static void test_iocp_fileio(HANDLE h) ...@@ -964,14 +949,15 @@ static void test_iocp_fileio(HANDLE h)
ok( !count, "Unexpected msg count: %ld\n", count ); ok( !count, "Unexpected msg count: %ld\n", count );
WriteFile( hPipeClt, send_buf, TEST_BUF_LEN, &read, NULL ); WriteFile( hPipeClt, send_buf, TEST_BUF_LEN, &read, NULL );
if (get_msg(h)) res = pNtRemoveIoCompletion( h, &key, &value, &iosb, &timeout );
{ ok( res == STATUS_SUCCESS, "NtRemoveIoCompletion failed: %#x\n", res );
ok( completionKey == CKEY_SECOND, "Invalid completion key: %lx\n", completionKey ); ok( key == CKEY_SECOND, "Invalid completion key: %#lx\n", key );
ok( ioSb.Information == 3, "Invalid ioSb.Information: %ld\n", ioSb.Information ); ok( iosb.Information == 3, "Invalid iosb.Information: %ld\n", iosb.Information );
ok( U(ioSb).Status == STATUS_SUCCESS, "Invalid ioSb.Status: %x\n", U(ioSb).Status); ok( U(iosb).Status == STATUS_SUCCESS, "Invalid iosb.Status: %#x\n", U(iosb).Status );
ok( completionValue == (ULONG_PTR)&o, "Invalid completion value: %lx\n", completionValue ); ok( value == (ULONG_PTR)&o, "Invalid completion value: %#lx\n", value );
ok( !memcmp( send_buf, recv_buf, TEST_BUF_LEN ), "Receive buffer (%x %x %x) did not match send buffer (%x %x %x)\n", recv_buf[0], recv_buf[1], recv_buf[2], send_buf[0], send_buf[1], send_buf[2] ); ok( !memcmp( send_buf, recv_buf, TEST_BUF_LEN ),
} "Receive buffer (%02x %02x %02x) did not match send buffer (%02x %02x %02x)\n",
recv_buf[0], recv_buf[1], recv_buf[2], send_buf[0], send_buf[1], send_buf[2] );
count = get_pending_msgs(h); count = get_pending_msgs(h);
ok( !count, "Unexpected msg count: %ld\n", count ); ok( !count, "Unexpected msg count: %ld\n", count );
...@@ -983,27 +969,29 @@ static void test_iocp_fileio(HANDLE h) ...@@ -983,27 +969,29 @@ static void test_iocp_fileio(HANDLE h)
ReadFile( hPipeSrv, recv_buf, 2, &read, &o); ReadFile( hPipeSrv, recv_buf, 2, &read, &o);
count = get_pending_msgs(h); count = get_pending_msgs(h);
ok( count == 1, "Unexpected msg count: %ld\n", count ); ok( count == 1, "Unexpected msg count: %ld\n", count );
if (get_msg(h))
{ res = pNtRemoveIoCompletion( h, &key, &value, &iosb, &timeout );
ok( completionKey == CKEY_SECOND, "Invalid completion key: %lx\n", completionKey ); ok( res == STATUS_SUCCESS, "NtRemoveIoCompletion failed: %#x\n", res );
ok( ioSb.Information == 2, "Invalid ioSb.Information: %ld\n", ioSb.Information ); ok( key == CKEY_SECOND, "Invalid completion key: %#lx\n", key );
ok( U(ioSb).Status == STATUS_SUCCESS, "Invalid ioSb.Status: %x\n", U(ioSb).Status); ok( iosb.Information == 2, "Invalid iosb.Information: %ld\n", iosb.Information );
ok( completionValue == (ULONG_PTR)&o, "Invalid completion value: %lx\n", completionValue ); ok( U(iosb).Status == STATUS_SUCCESS, "Invalid iosb.Status: %#x\n", U(iosb).Status );
ok( !memcmp( send_buf, recv_buf, 2 ), "Receive buffer (%x %x) did not match send buffer (%x %x)\n", recv_buf[0], recv_buf[1], send_buf[0], send_buf[1] ); ok( value == (ULONG_PTR)&o, "Invalid completion value: %#lx\n", value );
} ok( !memcmp( send_buf, recv_buf, 2 ),
"Receive buffer (%02x %02x) did not match send buffer (%02x %02x)\n",
recv_buf[0], recv_buf[1], send_buf[0], send_buf[1] );
ReadFile( hPipeSrv, recv_buf, TEST_BUF_LEN, &read, &o); ReadFile( hPipeSrv, recv_buf, TEST_BUF_LEN, &read, &o);
CloseHandle( hPipeSrv ); CloseHandle( hPipeSrv );
count = get_pending_msgs(h); count = get_pending_msgs(h);
ok( count == 1, "Unexpected msg count: %ld\n", count ); ok( count == 1, "Unexpected msg count: %ld\n", count );
if (get_msg(h))
{ res = pNtRemoveIoCompletion( h, &key, &value, &iosb, &timeout );
ok( completionKey == CKEY_SECOND, "Invalid completion key: %lx\n", completionKey ); ok( res == STATUS_SUCCESS, "NtRemoveIoCompletion failed: %#x\n", res );
ok( ioSb.Information == 0, "Invalid ioSb.Information: %ld\n", ioSb.Information ); ok( key == CKEY_SECOND, "Invalid completion key: %lx\n", key );
/* wine sends wrong status here */ ok( iosb.Information == 0, "Invalid iosb.Information: %ld\n", iosb.Information );
ok( U(ioSb).Status == STATUS_PIPE_BROKEN, "Invalid ioSb.Status: %x\n", U(ioSb).Status); /* wine sends wrong status here */
ok( completionValue == (ULONG_PTR)&o, "Invalid completion value: %lx\n", completionValue ); ok( U(iosb).Status == STATUS_PIPE_BROKEN, "Invalid iosb.Status: %x\n", U(iosb).Status );
} ok( value == (ULONG_PTR)&o, "Invalid completion value: %lx\n", value );
} }
CloseHandle( hPipeClt ); CloseHandle( hPipeClt );
...@@ -1038,14 +1026,16 @@ static void test_iocp_fileio(HANDLE h) ...@@ -1038,14 +1026,16 @@ static void test_iocp_fileio(HANDLE h)
WriteFile( hPipeClt, send_buf, TEST_BUF_LEN, &read, NULL ); WriteFile( hPipeClt, send_buf, TEST_BUF_LEN, &read, NULL );
if (get_msg(h)) res = pNtRemoveIoCompletion( h, &key, &value, &iosb, &timeout );
{ ok( res == STATUS_SUCCESS, "NtRemoveIoCompletion failed: %#x\n", res );
ok( completionKey == CKEY_SECOND, "Invalid completion key: %lx\n", completionKey ); ok( key == CKEY_SECOND, "Invalid completion key: %#lx\n", key );
ok( ioSb.Information == 3, "Invalid ioSb.Information: %ld\n", ioSb.Information ); ok( iosb.Information == 3, "Invalid iosb.Information: %ld\n", iosb.Information );
ok( U(ioSb).Status == STATUS_SUCCESS, "Invalid ioSb.Status: %x\n", U(ioSb).Status); ok( U(iosb).Status == STATUS_SUCCESS, "Invalid iosb.Status: %#x\n", U(iosb).Status );
ok( completionValue == (ULONG_PTR)&o, "Invalid completion value: %lx\n", completionValue ); ok( value == (ULONG_PTR)&o, "Invalid completion value: %#lx\n", value );
ok( !memcmp( send_buf, recv_buf, TEST_BUF_LEN ), "Receive buffer (%x %x %x) did not match send buffer (%x %x %x)\n", recv_buf[0], recv_buf[1], recv_buf[2], send_buf[0], send_buf[1], send_buf[2] ); ok( !memcmp( send_buf, recv_buf, TEST_BUF_LEN ),
} "Receive buffer (%02x %02x %02x) did not match send buffer (%02x %02x %02x)\n",
recv_buf[0], recv_buf[1], recv_buf[2], send_buf[0], send_buf[1], send_buf[2] );
count = get_pending_msgs(h); count = get_pending_msgs(h);
ok( !count, "Unexpected msg count: %ld\n", count ); ok( !count, "Unexpected msg count: %ld\n", count );
......
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