Remove patches for SetNamedPipeHandleState implementation (accepted upstream).

This commit is contained in:
Sebastian Lackner 2014-08-21 23:08:37 +02:00
parent 3385c78c50
commit 3029f615d2
7 changed files with 12 additions and 602 deletions

View File

@ -61,7 +61,6 @@ Included bugfixes and improvements
* Support for NtSetInformationFile class FileDispositionInformation ([Wine Bug #30397](http://bugs.winehq.org/show_bug.cgi?id=30397 "Multiple applications need support for NtSetInformationFile class FileDispositionInformation (Cygwin installer, Stylizer 5.x Visual CSS editor, Spoon Studio 2011 (ex Xenocode) application sandboxing scheme)"))
* Support for PulseAudio backend for audio ([Wine Bug #10495](http://bugs.winehq.org/show_bug.cgi?id=10495 "Wine should support PulseAudio"))
* Support for SHCreateSessionKey ([Wine Bug #35630](http://bugs.winehq.org/show_bug.cgi?id=35630 "SHCreateSessionKey is unimplemented"))
* Support for SetNamedPipeHandleState ([Wine Bug #17273](http://bugs.winehq.org/show_bug.cgi?id=17273 "Many apps and games need SetNamedPipeHandleState implementation (support for named pipe message mode)(FireFox+Flash, Win8/NET 4.x SDK/vcrun2012, WiX installers)"))
* Support for TOOLTIPS_GetTipText edge cases ([Wine Bug #30648](http://bugs.winehq.org/show_bug.cgi?id=30648 "SEGA Genesis / Mega Drive Classic Collection (Steam) crashes on startup"))
* Support for TransmitFile ([Wine Bug #5048](http://bugs.winehq.org/show_bug.cgi?id=5048 "Multiple applications and games need support for ws2_32 SIO_GET_EXTENSION_FUNCTION_POINTER TransmitFile (WSAID_TRANSMITFILE)"))
* Support for WTSEnumerateProcessesW ([Wine Bug #29903](http://bugs.winehq.org/show_bug.cgi?id=29903 "Some Microsoft debuggers fail to enumerate processes due to wtsapi32.WTSEnumerateProcessesW() being a stub (Microsoft Visual Studio 2005, DbgCLR from .NET 2.0 SDK)"))
@ -73,6 +72,7 @@ Included bugfixes and improvements
* Support for stored file ACLs ([Wine Bug #31858](http://bugs.winehq.org/show_bug.cgi?id=31858 "Netflix on Firefox fails with Internet Connection Problem when loading bar is at 99%"))
* Support for ws2_32.inet_pton ([Wine Bug #36713](http://bugs.winehq.org/show_bug.cgi?id=36713 "Watch_Dogs requires ws2_32.inet_pton"))
* Use manual relay for RunDLL_CallEntry16 in shell32 ([Wine Bug #23033](http://bugs.winehq.org/show_bug.cgi?id=23033 "Tages Protection v5.x: games report \"DLL not found shell.dll16.dll\" (Runaway 2: The Dream Of The Turtle, ...)"))
* ~~Workaround for TransactNamedPipe not being supported~~ ([Wine Bug #17273](http://bugs.winehq.org/show_bug.cgi?id=17273 "Many apps and games need SetNamedPipeHandleState implementation (support for named pipe message mode)(FireFox+Flash, Win8/NET 4.x SDK/vcrun2012, WiX installers)"))
* Workaround for shlwapi URLs with relative paths
* XEMBED support for embedding Wine windows inside Linux applications

10
debian/changelog vendored
View File

@ -3,8 +3,18 @@ wine-compholio (1.7.25) UNRELEASED; urgency=low
* Added patch with stub for DwmInvalidateIconicBitmaps.
* Added Courier Prime (OFLv1.1) as a Courier New replacement.
* Added patch to better detect broken nVidia RandR 1.2 support.
* Added patch to set linker version in PE header.
* Added patch to move NtProtectVirtualMemory and NtCreateSection to separate pages.
* Added patch to fix issues with drag image in ImageLists.
* Added patch with stub for BCryptGetFipsAlgorithmMode.
* Added patch to fix issues with OpenProcess on terminated processes.
* Added patch to fix issues with msi/ITERATE_MoveFiles.
* Added patch to avoid grouping all Wine windows together.
* Updated patches for riched20 IText* Interface.
* Removed patch to update gl_drawable for embedded windows (deprecated).
* Removed patch to return empty D3D hardware flags for RGB device enumeration (accepted upstream).
* Removed patch with stub for DwmInvalidateIconicBitmaps (accepted upstream).
* Removed patch for SetNamedPipeHandleState implementation (accepted upstream).
-- Erich E. Hoover <erich.e.hoover@gmail.com> Mon, 11 Aug 2014 16:21:22 -0600
wine-compholio (1.7.24) unstable; urgency=low

View File

@ -312,24 +312,18 @@ kernel32-GetVolumePathName.ok:
# |
# | Included patches:
# | * Fix for ConnectNamedPort return value in overlapped mode. [by Dan Kegel]
# | * Add proper implementation for SetNamedPipeHandleState. [rev 7, by Sebastian Lackner / Adam Martinson]
# |
# | This patchset fixes the following Wine bugs:
# | * [#16550] Fix for ConnectNamedPort return value in overlapped mode
# | * [#17273] Support for SetNamedPipeHandleState
# |
# | Modified files:
# | * dlls/kernel32/sync.c, dlls/kernel32/tests/pipe.c, dlls/ntdll/tests/pipe.c
# | * dlls/kernel32/sync.c
# |
.INTERMEDIATE: kernel32-Named_Pipe.ok
kernel32-Named_Pipe.ok:
$(call APPLY_FILE,kernel32-Named_Pipe/0001-kernel32-ConnectNamedPort-should-return-FALSE-and-se.patch)
$(call APPLY_FILE,kernel32-Named_Pipe/0002-ntdll-tests-Add-tests-for-FILE_PIPE_INFORMATION.patch)
$(call APPLY_FILE,kernel32-Named_Pipe/0003-kernel32-tests-Always-allow-only-one-specific-test-r.patch)
$(call APPLY_FILE,kernel32-Named_Pipe/0004-kernel32-Implement-Get-Set-NamedPipeHandleState.patch)
@( \
echo '+ { "kernel32-Named_Pipe", "Dan Kegel", "Fix for ConnectNamedPort return value in overlapped mode." },'; \
echo '+ { "kernel32-Named_Pipe", "Sebastian Lackner / Adam Martinson", "Add proper implementation for SetNamedPipeHandleState. [rev 7]" },'; \
) > kernel32-Named_Pipe.ok
# Patchset kernel32-SystemFileCacheSize

View File

@ -1,244 +0,0 @@
From f78c4bb06e2c463ea2e7a7cee374714814a5fdb1 Mon Sep 17 00:00:00 2001
From: Sebastian Lackner <sebastian@fds-team.de>
Date: Tue, 12 Aug 2014 21:31:00 +0200
Subject: ntdll/tests: Add tests for FILE_PIPE_INFORMATION.
Based on patch by Adam Martinson.
I've added more tests, and have marked failing tests as broken(...). On Windows 8
we still get some failures, but as there is a lot more going wrong there, we probably shouldn't
worry about that. ;)
---
dlls/ntdll/tests/pipe.c | 188 +++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 188 insertions(+)
diff --git a/dlls/ntdll/tests/pipe.c b/dlls/ntdll/tests/pipe.c
index c275e3d..75faf76 100644
--- a/dlls/ntdll/tests/pipe.c
+++ b/dlls/ntdll/tests/pipe.c
@@ -34,6 +34,11 @@
#ifndef __WINE_WINTERNL_H
typedef struct {
+ ULONG ReadMode;
+ ULONG CompletionMode;
+} FILE_PIPE_INFORMATION;
+
+typedef struct {
ULONG NamedPipeType;
ULONG NamedPipeConfiguration;
ULONG MaximumInstances;
@@ -68,6 +73,7 @@ static NTSTATUS (WINAPI *pNtCreateNamedPipeFile) (PHANDLE handle, ULONG access,
ULONG inbound_quota, ULONG outbound_quota,
PLARGE_INTEGER timeout);
static NTSTATUS (WINAPI *pNtQueryInformationFile) (IN HANDLE FileHandle, OUT PIO_STATUS_BLOCK IoStatusBlock, OUT PVOID FileInformation, IN ULONG Length, IN FILE_INFORMATION_CLASS FileInformationClass);
+static NTSTATUS (WINAPI *pNtSetInformationFile) (HANDLE handle, PIO_STATUS_BLOCK io, PVOID ptr, ULONG len, FILE_INFORMATION_CLASS class);
static NTSTATUS (WINAPI *pNtCancelIoFile) (HANDLE hFile, PIO_STATUS_BLOCK io_status);
static void (WINAPI *pRtlInitUnicodeString) (PUNICODE_STRING target, PCWSTR source);
@@ -87,6 +93,7 @@ static BOOL init_func_ptrs(void)
loadfunc(NtFsControlFile)
loadfunc(NtCreateNamedPipeFile)
loadfunc(NtQueryInformationFile)
+ loadfunc(NtSetInformationFile)
loadfunc(NtCancelIoFile)
loadfunc(RtlInitUnicodeString)
@@ -479,6 +486,184 @@ static void test_cancelio(void)
CloseHandle(hPipe);
}
+#define check_pipe_handle_state(handle, r, c) \
+ do \
+ { \
+ memset(&fpi, 0x55, sizeof(fpi)); \
+ if (handle == INVALID_HANDLE_VALUE) break; \
+ res = pNtQueryInformationFile(handle, &iosb, &fpi, sizeof(fpi), (FILE_INFORMATION_CLASS)23); \
+ ok(!res, "NtQueryInformationFile returned %x\n", res); \
+ ok(fpi.ReadMode == r, "ReadMode == %x\n", fpi.ReadMode); \
+ ok(fpi.CompletionMode == c, "CompletionMode == %x\n", fpi.CompletionMode); \
+ } \
+ while (0)
+
+static void test_filepipeinfo(void)
+{
+ IO_STATUS_BLOCK iosb;
+ OBJECT_ATTRIBUTES attr;
+ UNICODE_STRING name;
+ LARGE_INTEGER timeout;
+ HANDLE hServer, hClient;
+ FILE_PIPE_INFORMATION fpi;
+ NTSTATUS res;
+
+ pRtlInitUnicodeString(&name, testpipe_nt);
+
+ attr.Length = sizeof(attr);
+ attr.RootDirectory = 0;
+ attr.ObjectName = &name;
+ attr.Attributes = 0x40; /* case insensitive */
+ attr.SecurityDescriptor = NULL;
+ attr.SecurityQualityOfService = NULL;
+
+ timeout.QuadPart = -100000000000ll;
+
+ /* test with INVALID_HANDLE_VALUE */
+ res = pNtQueryInformationFile(INVALID_HANDLE_VALUE, &iosb, &fpi, sizeof(fpi), (FILE_INFORMATION_CLASS)23);
+ ok(res == STATUS_OBJECT_TYPE_MISMATCH, "NtQueryInformationFile returned %x\n", res);
+
+ fpi.ReadMode = 0;
+ fpi.CompletionMode = 0;
+ res = pNtSetInformationFile(INVALID_HANDLE_VALUE, &iosb, &fpi, sizeof(fpi), (FILE_INFORMATION_CLASS)23);
+ ok(res == STATUS_OBJECT_TYPE_MISMATCH, "NtSetInformationFile returned %x\n", res);
+
+ /* server end with read-only attributes */
+ res = pNtCreateNamedPipeFile(&hServer, FILE_READ_ATTRIBUTES | SYNCHRONIZE, &attr, &iosb,
+ FILE_SHARE_READ | FILE_SHARE_WRITE, 2 /* FILE_CREATE */,
+ 0, 0, 0, 1, 0xFFFFFFFF, 500, 500, &timeout);
+ ok(!res, "NtCreateNamedPipeFile returned %x\n", res);
+
+ check_pipe_handle_state(hServer, 0, 1);
+
+ hClient = CreateFileW(testpipe, GENERIC_READ | GENERIC_WRITE, 0, 0, OPEN_EXISTING, 0, 0);
+ ok(hClient != INVALID_HANDLE_VALUE, "can't open pipe, GetLastError: %x\n", GetLastError());
+
+ check_pipe_handle_state(hServer, 0, 1);
+ check_pipe_handle_state(hClient, 0, 0);
+
+ fpi.ReadMode = 0;
+ fpi.CompletionMode = 0;
+ res = pNtSetInformationFile(hServer, &iosb, &fpi, sizeof(fpi), (FILE_INFORMATION_CLASS)23);
+ ok(res == STATUS_ACCESS_DENIED, "NtSetInformationFile returned %x\n", res);
+
+ check_pipe_handle_state(hServer, 0, 1);
+ check_pipe_handle_state(hClient, 0, 0);
+
+ fpi.ReadMode = 1; /* invalid on a byte stream pipe */
+ fpi.CompletionMode = 1;
+ res = pNtSetInformationFile(hServer, &iosb, &fpi, sizeof(fpi), (FILE_INFORMATION_CLASS)23);
+ ok(res == STATUS_ACCESS_DENIED, "NtSetInformationFile returned %x\n", res);
+
+ check_pipe_handle_state(hServer, 0, 1);
+ check_pipe_handle_state(hClient, 0, 0);
+
+ if (hClient != INVALID_HANDLE_VALUE)
+ {
+ fpi.ReadMode = 1; /* invalid on a byte stream pipe */
+ fpi.CompletionMode = 1;
+ res = pNtSetInformationFile(hClient, &iosb, &fpi, sizeof(fpi), (FILE_INFORMATION_CLASS)23);
+ ok(res == STATUS_INVALID_PARAMETER, "NtSetInformationFile returned %x\n", res);
+ }
+
+ check_pipe_handle_state(hServer, 0, 1);
+ check_pipe_handle_state(hClient, 0, 0);
+
+ if (hClient != INVALID_HANDLE_VALUE)
+ {
+ fpi.ReadMode = 0;
+ fpi.CompletionMode = 1;
+ res = pNtSetInformationFile(hClient, &iosb, &fpi, sizeof(fpi), (FILE_INFORMATION_CLASS)23);
+ ok(!res, "NtSetInformationFile returned %x\n", res);
+ }
+
+ check_pipe_handle_state(hServer, 0, 1);
+ check_pipe_handle_state(hClient, 0, 1);
+
+ if (hClient != INVALID_HANDLE_VALUE)
+ {
+ fpi.ReadMode = 0;
+ fpi.CompletionMode = 2; /* not in range 0-1 */
+ res = pNtSetInformationFile(hClient, &iosb, &fpi, sizeof(fpi), (FILE_INFORMATION_CLASS)23);
+ ok(res == STATUS_INVALID_PARAMETER || broken(!res) /* < Vista */, "NtSetInformationFile returned %x\n", res);
+
+ fpi.ReadMode = 2; /* not in range 0-1 */
+ fpi.CompletionMode = 0;
+ res = pNtSetInformationFile(hClient, &iosb, &fpi, sizeof(fpi), (FILE_INFORMATION_CLASS)23);
+ ok(res == STATUS_INVALID_PARAMETER || broken(!res) /* < Vista */, "NtSetInformationFile returned %x\n", res);
+ }
+
+ CloseHandle(hClient);
+
+ check_pipe_handle_state(hServer, 0, 1);
+
+ fpi.ReadMode = 0;
+ fpi.CompletionMode = 0;
+ res = pNtSetInformationFile(hServer, &iosb, &fpi, sizeof(fpi), (FILE_INFORMATION_CLASS)23);
+ ok(res == STATUS_ACCESS_DENIED, "NtSetInformationFile returned %x\n", res);
+
+ CloseHandle(hServer);
+
+ /* message mode server with read/write attributes */
+ res = pNtCreateNamedPipeFile(&hServer, FILE_READ_ATTRIBUTES | FILE_WRITE_ATTRIBUTES | SYNCHRONIZE, &attr, &iosb,
+ FILE_SHARE_READ | FILE_SHARE_WRITE, 2 /* FILE_CREATE */,
+ 0, 1, 1, 0, 0xFFFFFFFF, 500, 500, &timeout);
+ ok(!res, "NtCreateNamedPipeFile returned %x\n", res);
+
+ check_pipe_handle_state(hServer, 1, 0);
+
+ hClient = CreateFileW(testpipe, GENERIC_READ | GENERIC_WRITE, 0, 0, OPEN_EXISTING, 0, 0);
+ ok(hClient != INVALID_HANDLE_VALUE, "can't open pipe, GetLastError: %x\n", GetLastError());
+
+ check_pipe_handle_state(hServer, 1, 0);
+ check_pipe_handle_state(hClient, 0, 0);
+
+ if (hClient != INVALID_HANDLE_VALUE)
+ {
+ fpi.ReadMode = 1;
+ fpi.CompletionMode = 1;
+ res = pNtSetInformationFile(hClient, &iosb, &fpi, sizeof(fpi), (FILE_INFORMATION_CLASS)23);
+ ok(!res, "NtSetInformationFile returned %x\n", res);
+ }
+
+ check_pipe_handle_state(hServer, 1, 0);
+ check_pipe_handle_state(hClient, 1, 1);
+
+ fpi.ReadMode = 0;
+ fpi.CompletionMode = 1;
+ res = pNtSetInformationFile(hServer, &iosb, &fpi, sizeof(fpi), (FILE_INFORMATION_CLASS)23);
+ ok(!res, "NtSetInformationFile returned %x\n", res);
+
+ check_pipe_handle_state(hServer, 0, 1);
+ check_pipe_handle_state(hClient, 1, 1);
+
+ if (hClient != INVALID_HANDLE_VALUE)
+ {
+ fpi.ReadMode = 0;
+ fpi.CompletionMode = 2; /* not in range 0-1 */
+ res = pNtSetInformationFile(hClient, &iosb, &fpi, sizeof(fpi), (FILE_INFORMATION_CLASS)23);
+ ok(res == STATUS_INVALID_PARAMETER || broken(!res) /* < Vista */, "NtSetInformationFile returned %x\n", res);
+
+ fpi.ReadMode = 2; /* not in range 0-1 */
+ fpi.CompletionMode = 0;
+ res = pNtSetInformationFile(hClient, &iosb, &fpi, sizeof(fpi), (FILE_INFORMATION_CLASS)23);
+ ok(res == STATUS_INVALID_PARAMETER || broken(!res) /* < Vista */, "NtSetInformationFile returned %x\n", res);
+ }
+
+ CloseHandle(hClient);
+
+ check_pipe_handle_state(hServer, 0, 1);
+
+ fpi.ReadMode = 1;
+ fpi.CompletionMode = 0;
+ res = pNtSetInformationFile(hServer, &iosb, &fpi, sizeof(fpi), (FILE_INFORMATION_CLASS)23);
+ ok(!res, "NtSetInformationFile returned %x\n", res);
+
+ check_pipe_handle_state(hServer, 1, 0);
+
+ CloseHandle(hServer);
+}
+
START_TEST(pipe)
{
if (!init_func_ptrs())
@@ -493,6 +678,9 @@ START_TEST(pipe)
trace("starting overlapped tests\n");
test_overlapped();
+ trace("starting FILE_PIPE_INFORMATION tests\n");
+ test_filepipeinfo();
+
if (!pOpenThread || !pQueueUserAPC)
return;
--
1.7.9.5

View File

@ -1,126 +0,0 @@
From 2ae3b0fe9a03067879de3c7409e212510e134900 Mon Sep 17 00:00:00 2001
From: Sebastian Lackner <sebastian@fds-team.de>
Date: Wed, 30 Jul 2014 18:00:19 +0200
Subject: kernel32/tests: Always allow only one specific test result, add
todo_wine where necessary.
The current pipe tests are not really a good base for fixing the implemenation -
some of the todo_wine's depend on the return value itself. This hides if one of
the following patches breaks things. Besides that some of the tests are currently
broken on kernel >= 3.12 (bug #35781), mark those as todo_wine.
Changes in v2:
* Ensure that the APC is properly removed - as it turned out this broke like 20 patches
later one of the other new tests... ^^
---
dlls/kernel32/tests/pipe.c | 57 +++++++++++++++++---------------------------
1 file changed, 22 insertions(+), 35 deletions(-)
diff --git a/dlls/kernel32/tests/pipe.c b/dlls/kernel32/tests/pipe.c
index f7c7531..5790be8 100644
--- a/dlls/kernel32/tests/pipe.c
+++ b/dlls/kernel32/tests/pipe.c
@@ -153,20 +153,13 @@ static void test_CreateNamedPipe(int pipemode)
ok(written == sizeof(obuf2), "write file len 3b\n");
ok(PeekNamedPipe(hFile, ibuf, sizeof(ibuf), &readden, &avail, NULL), "Peek3\n");
if (pipemode == PIPE_TYPE_BYTE) {
- if (readden != sizeof(obuf)) /* Linux only returns the first message */
- ok(readden == sizeof(obuf) + sizeof(obuf2), "peek3 got %d bytes\n", readden);
- else
- todo_wine ok(readden == sizeof(obuf) + sizeof(obuf2), "peek3 got %d bytes\n", readden);
+ todo_wine ok(readden == sizeof(obuf) + sizeof(obuf2), "peek3 got %d bytes\n", readden);
}
else
{
- if (readden != sizeof(obuf) + sizeof(obuf2)) /* MacOS returns both messages */
- ok(readden == sizeof(obuf), "peek3 got %d bytes\n", readden);
- else
- todo_wine ok(readden == sizeof(obuf), "peek3 got %d bytes\n", readden);
+ ok(readden == sizeof(obuf), "peek3 got %d bytes\n", readden);
}
- if (avail != sizeof(obuf)) /* older Linux kernels only return the first write here */
- ok(avail == sizeof(obuf) + sizeof(obuf2), "peek3 got %d bytes available\n", avail);
+ ok(avail == sizeof(obuf) + sizeof(obuf2), "peek3 got %d bytes available\n", avail);
pbuf = ibuf;
ok(memcmp(obuf, pbuf, sizeof(obuf)) == 0, "pipe content 3a check\n");
if (pipemode == PIPE_TYPE_BYTE && readden >= sizeof(obuf)+sizeof(obuf2)) {
@@ -188,21 +181,13 @@ static void test_CreateNamedPipe(int pipemode)
ok(written == sizeof(obuf2), "write file len 4b\n");
ok(PeekNamedPipe(hnp, ibuf, sizeof(ibuf), &readden, &avail, NULL), "Peek4\n");
if (pipemode == PIPE_TYPE_BYTE) {
- if (readden != sizeof(obuf)) /* Linux only returns the first message */
- /* should return all 23 bytes */
- ok(readden == sizeof(obuf) + sizeof(obuf2), "peek4 got %d bytes\n", readden);
- else
- todo_wine ok(readden == sizeof(obuf) + sizeof(obuf2), "peek4 got %d bytes\n", readden);
+ todo_wine ok(readden == sizeof(obuf) + sizeof(obuf2), "peek4 got %d bytes\n", readden);
}
else
{
- if (readden != sizeof(obuf) + sizeof(obuf2)) /* MacOS returns both messages */
- ok(readden == sizeof(obuf), "peek4 got %d bytes\n", readden);
- else
- todo_wine ok(readden == sizeof(obuf), "peek4 got %d bytes\n", readden);
+ ok(readden == sizeof(obuf), "peek4 got %d bytes\n", readden);
}
- if (avail != sizeof(obuf)) /* older Linux kernels only return the first write here */
- ok(avail == sizeof(obuf) + sizeof(obuf2), "peek4 got %d bytes available\n", avail);
+ ok(avail == sizeof(obuf) + sizeof(obuf2), "peek4 got %d bytes available\n", avail);
pbuf = ibuf;
ok(memcmp(obuf, pbuf, sizeof(obuf)) == 0, "pipe content 4a check\n");
if (pipemode == PIPE_TYPE_BYTE && readden >= sizeof(obuf)+sizeof(obuf2)) {
@@ -243,14 +228,8 @@ static void test_CreateNamedPipe(int pipemode)
ok(WriteFile(hnp, obuf2, sizeof(obuf2), &written, NULL), " WriteFile5b\n");
ok(written == sizeof(obuf2), "write file len 3b\n");
ok(PeekNamedPipe(hFile, ibuf, sizeof(ibuf), &readden, &avail, NULL), "Peek5\n");
- if (readden != sizeof(obuf) + sizeof(obuf2)) /* MacOS returns both writes */
- ok(readden == sizeof(obuf), "peek5 got %d bytes\n", readden);
- else
- todo_wine ok(readden == sizeof(obuf), "peek5 got %d bytes\n", readden);
- if (avail != sizeof(obuf)) /* older Linux kernels only return the first write here */
- ok(avail == sizeof(obuf) + sizeof(obuf2), "peek5 got %d bytes available\n", avail);
- else
- todo_wine ok(avail == sizeof(obuf) + sizeof(obuf2), "peek5 got %d bytes available\n", avail);
+ ok(readden == sizeof(obuf), "peek5 got %d bytes\n", readden);
+ ok(avail == sizeof(obuf) + sizeof(obuf2), "peek5 got %d bytes available\n", avail);
pbuf = ibuf;
ok(memcmp(obuf, pbuf, sizeof(obuf)) == 0, "content 5a check\n");
ok(ReadFile(hFile, ibuf, sizeof(ibuf), &readden, NULL), "ReadFile\n");
@@ -279,12 +258,8 @@ static void test_CreateNamedPipe(int pipemode)
ok(WriteFile(hFile, obuf2, sizeof(obuf2), &written, NULL), " WriteFile6b\n");
ok(written == sizeof(obuf2), "write file len 6b\n");
ok(PeekNamedPipe(hnp, ibuf, sizeof(ibuf), &readden, &avail, NULL), "Peek6\n");
- if (readden != sizeof(obuf) + sizeof(obuf2)) /* MacOS returns both writes */
- ok(readden == sizeof(obuf), "peek6 got %d bytes\n", readden);
- else
- todo_wine ok(readden == sizeof(obuf), "peek6 got %d bytes\n", readden);
- if (avail != sizeof(obuf)) /* older Linux kernels only return the first write here */
- ok(avail == sizeof(obuf) + sizeof(obuf2), "peek6b got %d bytes available\n", avail);
+ ok(readden == sizeof(obuf), "peek6 got %d bytes\n", readden);
+ ok(avail == sizeof(obuf) + sizeof(obuf2), "peek6b got %d bytes available\n", avail);
pbuf = ibuf;
ok(memcmp(obuf, pbuf, sizeof(obuf)) == 0, "content 6a check\n");
ok(ReadFile(hnp, ibuf, sizeof(ibuf), &readden, NULL), "ReadFile\n");
@@ -1856,7 +1831,19 @@ static void test_readfileex_pending(void)
ok(completion_called == 0, "completion routine called during ReadFile\n");
wait = WaitForSingleObjectEx(event, 0, TRUE);
+ todo_wine
ok(wait == WAIT_IO_COMPLETION || wait == WAIT_OBJECT_0, "WaitForSingleObject returned %x\n", wait);
+ if (wait == WAIT_TIMEOUT)
+ {
+ /* work around kernel regression, and read some more */
+ ret = ReadFile(client, read_buf, sizeof(read_buf), &num_bytes, NULL);
+ ok(ret == TRUE, "ReadFile failed\n");
+
+ ok(completion_called == 0, "completion routine called during ReadFile\n");
+
+ wait = WaitForSingleObjectEx(event, 0, TRUE);
+ ok(wait == WAIT_IO_COMPLETION || wait == WAIT_OBJECT_0, "WaitForSingleObject returned %x\n", wait);
+ }
ok(completion_called == 1, "completion routine not called\n");
ok(completion_errorcode == 0, "completion called with error %x\n", completion_errorcode);
--
1.7.9.5

View File

@ -1,218 +0,0 @@
From 5b33f8fd992f8944442e8428e433461157b9e6c9 Mon Sep 17 00:00:00 2001
From: Sebastian Lackner <sebastian@fds-team.de>
Date: Mon, 11 Aug 2014 17:26:18 +0200
Subject: kernel32: Implement {Get,Set}NamedPipeHandleState.
Based on patch by Adam Martinson.
---
dlls/kernel32/sync.c | 88 +++++++++++++++++++++++++++++++++++++++-----
dlls/kernel32/tests/pipe.c | 16 +-------
2 files changed, 81 insertions(+), 23 deletions(-)
diff --git a/dlls/kernel32/sync.c b/dlls/kernel32/sync.c
index ff0e234..96a36b9 100644
--- a/dlls/kernel32/sync.c
+++ b/dlls/kernel32/sync.c
@@ -1713,12 +1713,16 @@ BOOL WINAPI GetNamedPipeHandleStateA(
LPDWORD lpMaxCollectionCount, LPDWORD lpCollectDataTimeout,
LPSTR lpUsername, DWORD nUsernameMaxSize)
{
- FIXME("%p %p %p %p %p %p %d\n",
- hNamedPipe, lpState, lpCurInstances,
- lpMaxCollectionCount, lpCollectDataTimeout,
- lpUsername, nUsernameMaxSize);
+ WARN("%p %p %p %p %p %p %d: semi-stub\n",
+ hNamedPipe, lpState, lpCurInstances,
+ lpMaxCollectionCount, lpCollectDataTimeout,
+ lpUsername, nUsernameMaxSize);
- return FALSE;
+ if (lpUsername && nUsernameMaxSize)
+ *lpUsername = 0;
+
+ return GetNamedPipeHandleStateW(hNamedPipe, lpState, lpCurInstances,
+ lpMaxCollectionCount, lpCollectDataTimeout, NULL, 0);
}
/***********************************************************************
@@ -1729,12 +1733,53 @@ BOOL WINAPI GetNamedPipeHandleStateW(
LPDWORD lpMaxCollectionCount, LPDWORD lpCollectDataTimeout,
LPWSTR lpUsername, DWORD nUsernameMaxSize)
{
- FIXME("%p %p %p %p %p %p %d\n",
+ IO_STATUS_BLOCK iosb;
+ NTSTATUS status;
+
+ FIXME("%p %p %p %p %p %p %d: semi-stub\n",
hNamedPipe, lpState, lpCurInstances,
lpMaxCollectionCount, lpCollectDataTimeout,
lpUsername, nUsernameMaxSize);
- return FALSE;
+ if (lpMaxCollectionCount)
+ *lpMaxCollectionCount = 0;
+
+ if (lpCollectDataTimeout)
+ *lpCollectDataTimeout = 0;
+
+ if (lpUsername && nUsernameMaxSize)
+ *lpUsername = 0;
+
+ if (lpState)
+ {
+ FILE_PIPE_INFORMATION fpi;
+ status = NtQueryInformationFile(hNamedPipe, &iosb, &fpi, sizeof(fpi),
+ FilePipeInformation);
+ if (status)
+ {
+ SetLastError( RtlNtStatusToDosError(status) );
+ return FALSE;
+ }
+
+ *lpState = (fpi.ReadMode ? PIPE_READMODE_MESSAGE : PIPE_READMODE_BYTE) |
+ (fpi.CompletionMode ? PIPE_NOWAIT : PIPE_WAIT);
+ }
+
+ if (lpCurInstances)
+ {
+ FILE_PIPE_LOCAL_INFORMATION fpli;
+ status = NtQueryInformationFile(hNamedPipe, &iosb, &fpli, sizeof(fpli),
+ FilePipeLocalInformation);
+ if (status)
+ {
+ SetLastError( RtlNtStatusToDosError(status) );
+ return FALSE;
+ }
+
+ *lpCurInstances = fpli.CurrentInstances;
+ }
+
+ return TRUE;
}
/***********************************************************************
@@ -1746,9 +1791,34 @@ BOOL WINAPI SetNamedPipeHandleState(
{
/* should be a fixme, but this function is called a lot by the RPC
* runtime, and it slows down InstallShield a fair bit. */
- WARN("stub: %p %p/%d %p %p\n",
+ WARN("semi-stub: %p %p/%d %p %p\n",
hNamedPipe, lpMode, lpMode ? *lpMode : 0, lpMaxCollectionCount, lpCollectDataTimeout);
- return FALSE;
+
+ if (lpMode)
+ {
+ FILE_PIPE_INFORMATION fpi;
+ IO_STATUS_BLOCK iosb;
+ NTSTATUS status;
+
+ if (*lpMode & ~(PIPE_READMODE_MESSAGE | PIPE_NOWAIT))
+ status = STATUS_INVALID_PARAMETER;
+ else
+ {
+ fpi.CompletionMode = (*lpMode & PIPE_NOWAIT) ?
+ FILE_PIPE_COMPLETE_OPERATION : FILE_PIPE_QUEUE_OPERATION;
+ fpi.ReadMode = (*lpMode & PIPE_READMODE_MESSAGE) ?
+ FILE_PIPE_MESSAGE_MODE : FILE_PIPE_BYTE_STREAM_MODE;
+ status = NtSetInformationFile(hNamedPipe, &iosb, &fpi, sizeof(fpi), FilePipeInformation);
+ }
+
+ if (status)
+ {
+ SetLastError( RtlNtStatusToDosError(status) );
+ return FALSE;
+ }
+ }
+
+ return TRUE;
}
/***********************************************************************
diff --git a/dlls/kernel32/tests/pipe.c b/dlls/kernel32/tests/pipe.c
index 5790be8..46004a3 100644
--- a/dlls/kernel32/tests/pipe.c
+++ b/dlls/kernel32/tests/pipe.c
@@ -218,10 +218,8 @@ static void test_CreateNamedPipe(int pipemode)
ok(!SetNamedPipeHandleState(hFile, &lpmode, NULL, NULL), "Change mode\n");
}
else {
- todo_wine {
- ok(SetNamedPipeHandleState(hFile, &lpmode, NULL, NULL), "Change mode\n");
- }
-
+ ok(SetNamedPipeHandleState(hFile, &lpmode, NULL, NULL), "Change mode\n");
+
memset(ibuf, 0, sizeof(ibuf));
ok(WriteFile(hnp, obuf, sizeof(obuf), &written, NULL), "WriteFile5a\n");
ok(written == sizeof(obuf), "write file len 3a\n");
@@ -1637,11 +1635,9 @@ static void test_NamedPipeHandleState(void)
/* lpSecurityAttrib */ NULL);
ok(server != INVALID_HANDLE_VALUE, "cf failed\n");
ret = GetNamedPipeHandleStateA(server, NULL, NULL, NULL, NULL, NULL, 0);
- todo_wine
ok(ret, "GetNamedPipeHandleState failed: %d\n", GetLastError());
ret = GetNamedPipeHandleStateA(server, &state, &instances, NULL, NULL, NULL,
0);
- todo_wine
ok(ret, "GetNamedPipeHandleState failed: %d\n", GetLastError());
if (ret)
{
@@ -1662,7 +1658,6 @@ static void test_NamedPipeHandleState(void)
state = PIPE_READMODE_MESSAGE;
SetLastError(0xdeadbeef);
ret = SetNamedPipeHandleState(server, &state, NULL, NULL);
- todo_wine
ok(!ret && GetLastError() == ERROR_INVALID_PARAMETER,
"expected ERROR_INVALID_PARAMETER, got %d\n", GetLastError());
@@ -1672,13 +1667,11 @@ static void test_NamedPipeHandleState(void)
state = PIPE_READMODE_BYTE;
ret = SetNamedPipeHandleState(client, &state, NULL, NULL);
- todo_wine
ok(ret, "SetNamedPipeHandleState failed: %d\n", GetLastError());
/* A byte-mode pipe client can't be changed to message mode, either. */
state = PIPE_READMODE_MESSAGE;
SetLastError(0xdeadbeef);
ret = SetNamedPipeHandleState(server, &state, NULL, NULL);
- todo_wine
ok(!ret && GetLastError() == ERROR_INVALID_PARAMETER,
"expected ERROR_INVALID_PARAMETER, got %d\n", GetLastError());
@@ -1694,11 +1687,9 @@ static void test_NamedPipeHandleState(void)
/* lpSecurityAttrib */ NULL);
ok(server != INVALID_HANDLE_VALUE, "cf failed\n");
ret = GetNamedPipeHandleStateA(server, NULL, NULL, NULL, NULL, NULL, 0);
- todo_wine
ok(ret, "GetNamedPipeHandleState failed: %d\n", GetLastError());
ret = GetNamedPipeHandleStateA(server, &state, &instances, NULL, NULL, NULL,
0);
- todo_wine
ok(ret, "GetNamedPipeHandleState failed: %d\n", GetLastError());
if (ret)
{
@@ -1710,7 +1701,6 @@ static void test_NamedPipeHandleState(void)
*/
state = PIPE_READMODE_BYTE;
ret = SetNamedPipeHandleState(server, &state, NULL, NULL);
- todo_wine
ok(ret, "SetNamedPipeHandleState failed: %d\n", GetLastError());
client = CreateFileA(PIPENAME, GENERIC_READ|GENERIC_WRITE, 0, NULL,
@@ -1719,13 +1709,11 @@ static void test_NamedPipeHandleState(void)
state = PIPE_READMODE_MESSAGE;
ret = SetNamedPipeHandleState(client, &state, NULL, NULL);
- todo_wine
ok(ret, "SetNamedPipeHandleState failed: %d\n", GetLastError());
/* A message-mode pipe client can also be changed to byte mode.
*/
state = PIPE_READMODE_BYTE;
ret = SetNamedPipeHandleState(client, &state, NULL, NULL);
- todo_wine
ok(ret, "SetNamedPipeHandleState failed: %d\n", GetLastError());
CloseHandle(client);
--
1.7.9.5

View File

@ -1,10 +1,4 @@
Author: Dan Kegel
Subject: Fix for ConnectNamedPort return value in overlapped mode.
Revision: 1
Author: Sebastian Lackner / Adam Martinson
Subject: Add proper implementation for SetNamedPipeHandleState.
Revision: 7
Fixes: [16550] Fix for ConnectNamedPort return value in overlapped mode
Fixes: [17273] Support for SetNamedPipeHandleState