Commit ee02530b authored by Sebastian Lackner's avatar Sebastian Lackner Committed by Alexandre Julliard

server: Fix crash when calling GetNamedPipeHandleState on partially closed pipe.

parent 78948b24
......@@ -1387,9 +1387,9 @@ static void test_CreatePipe(void)
static void test_CloseHandle(void)
{
static const char testdata[] = "Hello World";
DWORD state, numbytes;
HANDLE hpipe, hfile;
char buffer[32];
DWORD numbytes;
BOOL ret;
hpipe = CreateNamedPipeA(PIPENAME, PIPE_ACCESS_DUPLEX,
......@@ -1425,6 +1425,9 @@ static void test_CloseHandle(void)
ok(ret, "ReadFile failed with %u\n", GetLastError());
ok(numbytes == sizeof(testdata), "expected sizeof(testdata), got %u\n", numbytes);
ret = GetNamedPipeHandleStateA(hfile, &state, NULL, NULL, NULL, NULL, 0);
ok(ret, "GetNamedPipeHandleState failed with %u\n", GetLastError());
SetLastError(0xdeadbeef);
ret = ReadFile(hfile, buffer, 0, &numbytes, NULL);
ok(!ret, "ReadFile unexpectedly succeeded\n");
......@@ -1459,6 +1462,9 @@ static void test_CloseHandle(void)
todo_wine ok(ret, "ReadFile failed with %u\n", GetLastError());
ok(numbytes == 0, "expected 0, got %u\n", numbytes);
ret = GetNamedPipeHandleStateA(hfile, &state, NULL, NULL, NULL, NULL, 0);
ok(ret, "GetNamedPipeHandleState failed with %u\n", GetLastError());
SetLastError(0xdeadbeef);
ret = ReadFile(hfile, buffer, 0, &numbytes, NULL);
ok(!ret, "ReadFile unexpectedly succeeded\n");
......@@ -1507,6 +1513,9 @@ static void test_CloseHandle(void)
ok(ret, "ReadFile failed with %u\n", GetLastError());
ok(numbytes == sizeof(testdata), "expected sizeof(testdata), got %u\n", numbytes);
ret = GetNamedPipeHandleStateA(hpipe, &state, NULL, NULL, NULL, NULL, 0);
ok(ret, "GetNamedPipeHandleState failed with %u\n", GetLastError());
SetLastError(0xdeadbeef);
ret = ReadFile(hpipe, buffer, 0, &numbytes, NULL);
ok(!ret, "ReadFile unexpectedly succeeded\n");
......@@ -1541,6 +1550,9 @@ static void test_CloseHandle(void)
todo_wine ok(ret, "ReadFile failed with %u\n", GetLastError());
ok(numbytes == 0, "expected 0, got %u\n", numbytes);
ret = GetNamedPipeHandleStateA(hpipe, &state, NULL, NULL, NULL, NULL, 0);
ok(ret, "GetNamedPipeHandleState failed with %u\n", GetLastError());
SetLastError(0xdeadbeef);
ret = ReadFile(hpipe, buffer, 0, &numbytes, NULL);
ok(!ret, "ReadFile unexpectedly succeeded\n");
......
......@@ -1013,11 +1013,14 @@ DECL_HANDLER(get_named_pipe_info)
}
reply->flags = client ? client->pipe_flags : server->pipe_flags;
reply->sharing = server->pipe->sharing;
reply->maxinstances = server->pipe->maxinstances;
reply->instances = server->pipe->instances;
reply->insize = server->pipe->insize;
reply->outsize = server->pipe->outsize;
if (server)
{
reply->sharing = server->pipe->sharing;
reply->maxinstances = server->pipe->maxinstances;
reply->instances = server->pipe->instances;
reply->insize = server->pipe->insize;
reply->outsize = server->pipe->outsize;
}
if (client)
release_object(client);
......
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