server: Fix crash when calling GetNamedPipeHandleState on partially closed pipe.
Signed-off-by: Sebastian Lackner <sebastian@fds-team.de> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
78948b24b7
commit
ee02530bc4
@ -1387,9 +1387,9 @@ static void test_CreatePipe(void)
|
|||||||
static void test_CloseHandle(void)
|
static void test_CloseHandle(void)
|
||||||
{
|
{
|
||||||
static const char testdata[] = "Hello World";
|
static const char testdata[] = "Hello World";
|
||||||
|
DWORD state, numbytes;
|
||||||
HANDLE hpipe, hfile;
|
HANDLE hpipe, hfile;
|
||||||
char buffer[32];
|
char buffer[32];
|
||||||
DWORD numbytes;
|
|
||||||
BOOL ret;
|
BOOL ret;
|
||||||
|
|
||||||
hpipe = CreateNamedPipeA(PIPENAME, PIPE_ACCESS_DUPLEX,
|
hpipe = CreateNamedPipeA(PIPENAME, PIPE_ACCESS_DUPLEX,
|
||||||
@ -1425,6 +1425,9 @@ static void test_CloseHandle(void)
|
|||||||
ok(ret, "ReadFile failed with %u\n", GetLastError());
|
ok(ret, "ReadFile failed with %u\n", GetLastError());
|
||||||
ok(numbytes == sizeof(testdata), "expected sizeof(testdata), got %u\n", numbytes);
|
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);
|
SetLastError(0xdeadbeef);
|
||||||
ret = ReadFile(hfile, buffer, 0, &numbytes, NULL);
|
ret = ReadFile(hfile, buffer, 0, &numbytes, NULL);
|
||||||
ok(!ret, "ReadFile unexpectedly succeeded\n");
|
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());
|
todo_wine ok(ret, "ReadFile failed with %u\n", GetLastError());
|
||||||
ok(numbytes == 0, "expected 0, got %u\n", numbytes);
|
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);
|
SetLastError(0xdeadbeef);
|
||||||
ret = ReadFile(hfile, buffer, 0, &numbytes, NULL);
|
ret = ReadFile(hfile, buffer, 0, &numbytes, NULL);
|
||||||
ok(!ret, "ReadFile unexpectedly succeeded\n");
|
ok(!ret, "ReadFile unexpectedly succeeded\n");
|
||||||
@ -1507,6 +1513,9 @@ static void test_CloseHandle(void)
|
|||||||
ok(ret, "ReadFile failed with %u\n", GetLastError());
|
ok(ret, "ReadFile failed with %u\n", GetLastError());
|
||||||
ok(numbytes == sizeof(testdata), "expected sizeof(testdata), got %u\n", numbytes);
|
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);
|
SetLastError(0xdeadbeef);
|
||||||
ret = ReadFile(hpipe, buffer, 0, &numbytes, NULL);
|
ret = ReadFile(hpipe, buffer, 0, &numbytes, NULL);
|
||||||
ok(!ret, "ReadFile unexpectedly succeeded\n");
|
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());
|
todo_wine ok(ret, "ReadFile failed with %u\n", GetLastError());
|
||||||
ok(numbytes == 0, "expected 0, got %u\n", numbytes);
|
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);
|
SetLastError(0xdeadbeef);
|
||||||
ret = ReadFile(hpipe, buffer, 0, &numbytes, NULL);
|
ret = ReadFile(hpipe, buffer, 0, &numbytes, NULL);
|
||||||
ok(!ret, "ReadFile unexpectedly succeeded\n");
|
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->flags = client ? client->pipe_flags : server->pipe_flags;
|
||||||
|
if (server)
|
||||||
|
{
|
||||||
reply->sharing = server->pipe->sharing;
|
reply->sharing = server->pipe->sharing;
|
||||||
reply->maxinstances = server->pipe->maxinstances;
|
reply->maxinstances = server->pipe->maxinstances;
|
||||||
reply->instances = server->pipe->instances;
|
reply->instances = server->pipe->instances;
|
||||||
reply->insize = server->pipe->insize;
|
reply->insize = server->pipe->insize;
|
||||||
reply->outsize = server->pipe->outsize;
|
reply->outsize = server->pipe->outsize;
|
||||||
|
}
|
||||||
|
|
||||||
if (client)
|
if (client)
|
||||||
release_object(client);
|
release_object(client);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user