Wine-Devel
By thread
wine-devel@list.winehq.org
By month
Messages by month
- ----- 2026 -----
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2025 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2024 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2023 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2022 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2021 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2020 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2019 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2018 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2017 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2016 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2015 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2014 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2013 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2012 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2011 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2010 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2009 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2008 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2007 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2006 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2005 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2004 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2003 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2002 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2001 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
January 2022
- 86 participants
- 2418 messages
[PATCH v4 4/4] wdscore: Add stubs for WdsSetupLogMessage[AW].
by Mohamad Al-Jaf
Required by the Windows MediaCreationTool21H2.
Signed-off-by: Mohamad Al-Jaf <mohamadaljaf(a)gmail.com>
---
v4: - Add missing argument
- Rename one more unknown
---
dlls/wdscore/main.c | 28 ++++++++++++++++++++++++++++
dlls/wdscore/wdscore.spec | 4 ++--
dlls/wdscore/wdscore_internal.h | 27 +++++++++++++++++++++++++++
3 files changed, 57 insertions(+), 2 deletions(-)
diff --git a/dlls/wdscore/main.c b/dlls/wdscore/main.c
index 6f054cdd63b..e4d28b9301a 100644
--- a/dlls/wdscore/main.c
+++ b/dlls/wdscore/main.c
@@ -74,3 +74,31 @@ LPVOID WINAPI ConstructPartialMsgVW( WdsLogLevel level, LPCWSTR msg, va_list arg
FIXME( "%u %s - stub\n", level, debugstr_w(msg) );
return NULL;
}
+
+
+/***********************************************************************
+ * WdsSetupLogMessageA (wdscore.@)
+ */
+HRESULT WINAPI WdsSetupLogMessageA( LPVOID msg, WdsLogSource src, LPCSTR unknown1, LPCSTR unknown2,
+ ULONG unknown3, LPCSTR file, LPCSTR func, void *ip,
+ ULONG unknown4, void *unknown5, UINT unknown6 )
+{
+ FIXME( "%p, %u, %s, %s, %u, %s, %s, %p, %u, %p, %u - stub\n", msg, src, debugstr_a(unknown1),
+ debugstr_a(unknown2), unknown3, debugstr_a(file), debugstr_a(func), ip, unknown4,
+ unknown5, unknown6 );
+ return S_OK;
+}
+
+
+/***********************************************************************
+ * WdsSetupLogMessageW (wdscore.@)
+ */
+HRESULT WINAPI WdsSetupLogMessageW( LPVOID msg, WdsLogSource src, LPCWSTR unknown1, LPCWSTR unknown2,
+ ULONG unknown3, LPCWSTR file, LPCWSTR func, void *ip,
+ ULONG unknown4, void *unknown5, UINT unknown6 )
+{
+ FIXME( "%p, %u, %s, %s, %u, %s, %s, %p, %u, %p, %u - stub\n", msg, src, debugstr_w(unknown1),
+ debugstr_w(unknown2), unknown3, debugstr_w(file), debugstr_w(func), ip, unknown4,
+ unknown5, unknown6 );
+ return S_OK;
+}
diff --git a/dlls/wdscore/wdscore.spec b/dlls/wdscore/wdscore.spec
index b14778001a8..7ec8025ddee 100644
--- a/dlls/wdscore/wdscore.spec
+++ b/dlls/wdscore/wdscore.spec
@@ -150,8 +150,8 @@
@ stub WdsSetUILanguage
@ stub WdsSetupLogDestroy
@ stub WdsSetupLogInit
-@ stub WdsSetupLogMessageA
-@ stub WdsSetupLogMessageW
+@ stdcall WdsSetupLogMessageA(ptr long str str long str str ptr long ptr long)
+@ stdcall WdsSetupLogMessageW(ptr long wstr wstr long wstr wstr ptr long ptr long)
@ stub WdsSubscribeEx
@ stub WdsTerminate
@ stub WdsUnlockExecutionGroup
diff --git a/dlls/wdscore/wdscore_internal.h b/dlls/wdscore/wdscore_internal.h
index b5cbe3c8c25..84a17d5fbc0 100644
--- a/dlls/wdscore/wdscore_internal.h
+++ b/dlls/wdscore/wdscore_internal.h
@@ -30,4 +30,31 @@ typedef enum _WdsLogLevel {
WdsLogLevelTrace = 0x7000000
} WdsLogLevel;
+typedef enum _WdsLogSource {
+ WdsLogSourceDPX = 0x1000000,
+ WdsLogSourceCBS = 0x2000000,
+ WdsLogSourceCSI = 0x1800000,
+ WdsLogSourceSXS = 0x2800000,
+ WdsLogSourceCMI = 0x3000000,
+ WdsLogSourceDEPLOY = 0x4000000,
+ WdsLogSourceDU = 0x5000000,
+ WdsLogSourceIBS = 0x6000000,
+ WdsLogSourceIBSLIB = 0x6400000,
+ WdsLogSourceDIAG = 0x7000000,
+ WdsLogSourceDIAGER = 0x7400000,
+ WdsLogSourceMIG = 0x8000000,
+ WdsLogSourceHWARE = 0x8400000,
+ WdsLogSourceMIGUI = 0x8800000,
+ WdsLogSourceUI = 0xA000000,
+ WdsLogSourceCONX = 0xA400000,
+ WdsLogSourceMOUPG = 0xA800000,
+ WdsLogSourceWDS = 0xB000000,
+ WdsLogSourceDISM = 0xB800000,
+ WdsLogSourcePANTHR = 0x9000000,
+ WdsLogSourceWINPE = 0xC000000,
+ WdsLogSourceSP = 0xC800000,
+ WdsLogSourceLIB = 0xD000000,
+ WdsLogSourceTOOL = 0xE000000
+} WdsLogSource;
+
#endif /* __WDSCORE_INTERNAL_H */
--
2.35.0
Jan. 27, 2022
[PATCH v4 3/4] wdscore: Add stubs for ConstructPartialMsgV[AW].
by Mohamad Al-Jaf
Enables the Windows MediaCreationTool21H2 to run.
Signed-off-by: Mohamad Al-Jaf <mohamadaljaf(a)gmail.com>
---
The debug channel emits a rather long string for msg:
fixme:wdscore:ConstructPartialMsgVW 67108864
L"\5343\7465\7075\614c\676e\6e49\4c69\616f\6564\3a72\
493a\696e\6974\6c61\7a69\3a65\4c20\4e41\2e47\4e49\2049\
6944\6572\7463\726f\2079\203d\7325" - stub
Should I get rid of it?
---
dlls/wdscore/main.c | 22 ++++++++++++++++++++++
dlls/wdscore/wdscore.spec | 4 ++--
dlls/wdscore/wdscore_internal.h | 33 +++++++++++++++++++++++++++++++++
3 files changed, 57 insertions(+), 2 deletions(-)
create mode 100644 dlls/wdscore/wdscore_internal.h
diff --git a/dlls/wdscore/main.c b/dlls/wdscore/main.c
index 9001838431d..6f054cdd63b 100644
--- a/dlls/wdscore/main.c
+++ b/dlls/wdscore/main.c
@@ -24,6 +24,8 @@
#include "wine/asm.h"
#include "wine/debug.h"
+#include "wdscore_internal.h"
+
WINE_DEFAULT_DEBUG_CHANNEL(wdscore);
/***********************************************************************
@@ -52,3 +54,23 @@ void *CurrentIP(void)
return 0;
}
#endif
+
+
+/***********************************************************************
+ * ConstructPartialMsgVA (wdscore.@)
+ */
+LPVOID WINAPI ConstructPartialMsgVA( WdsLogLevel level, LPCSTR msg, va_list args )
+{
+ FIXME( "%u %s - stub\n", level, debugstr_a(msg) );
+ return NULL;
+}
+
+
+/***********************************************************************
+ * ConstructPartialMsgVW (wdscore.@)
+ */
+LPVOID WINAPI ConstructPartialMsgVW( WdsLogLevel level, LPCWSTR msg, va_list args )
+{
+ FIXME( "%u %s - stub\n", level, debugstr_w(msg) );
+ return NULL;
+}
diff --git a/dlls/wdscore/wdscore.spec b/dlls/wdscore/wdscore.spec
index 282b6301688..b14778001a8 100644
--- a/dlls/wdscore/wdscore.spec
+++ b/dlls/wdscore/wdscore.spec
@@ -69,8 +69,8 @@
#@ extern g_bEnableDiagnosticMode
@ stub ConstructPartialMsgIfA
@ stub ConstructPartialMsgIfW
-@ stub ConstructPartialMsgVA
-@ stub ConstructPartialMsgVW
+@ stdcall ConstructPartialMsgVA(long str ptr)
+@ stdcall ConstructPartialMsgVW(long wstr ptr)
@ stdcall CurrentIP()
@ stub EndMajorTask
@ stub EndMinorTask
diff --git a/dlls/wdscore/wdscore_internal.h b/dlls/wdscore/wdscore_internal.h
new file mode 100644
index 00000000000..b5cbe3c8c25
--- /dev/null
+++ b/dlls/wdscore/wdscore_internal.h
@@ -0,0 +1,33 @@
+/*
+ * Copyright 2022 Mohamad Al-Jaf
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
+ */
+
+#ifndef __WDSCORE_INTERNAL_H
+#define __WDSCORE_INTERNAL_H
+
+typedef enum _WdsLogLevel {
+ WdsLogLevelAssert = 0x0000000,
+ WdsLogLevelFatalError = 0x1000000,
+ WdsLogLevelError = 0x2000000,
+ WdsLogLevelWarning = 0x3000000,
+ WdsLogLevelInfo = 0x4000000,
+ WdsLogLevelStatus = 0x5000000,
+ WdsLogLevelVerbose = 0x6800000,
+ WdsLogLevelTrace = 0x7000000
+} WdsLogLevel;
+
+#endif /* __WDSCORE_INTERNAL_H */
--
2.35.0
Jan. 27, 2022
[PATCH v4 2/4] wdscore: Fix spec entries.
by Mohamad Al-Jaf
Signed-off-by: Mohamad Al-Jaf <mohamadaljaf(a)gmail.com>
---
dlls/wdscore/wdscore.spec | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/dlls/wdscore/wdscore.spec b/dlls/wdscore/wdscore.spec
index 8b6febe6b3b..282b6301688 100644
--- a/dlls/wdscore/wdscore.spec
+++ b/dlls/wdscore/wdscore.spec
@@ -116,7 +116,7 @@
@ stub WdsGetBlackboardValue
@ stub WdsGetCurrentExecutionGroup
@ stub WdsGetSetupLog
-@ stub WdsTempDir
+@ stub WdsGetTempDir
@ stub WdsInitialize
@ stub WdsInitializeCallbackArray
@ stub WdsInitializeDataBinary
@@ -139,7 +139,7 @@
@ stub WdsPackCollection
@ stub WdsPublish
@ stub WdsPublishEx
-@ stub WdsPublishImmediateAsynch
+@ stub WdsPublishImmediateAsync
@ stub WdsPublishImmediateEx
@ stub WdsPublishOffline
@ stub WdsSeqAlloc
@@ -150,8 +150,8 @@
@ stub WdsSetUILanguage
@ stub WdsSetupLogDestroy
@ stub WdsSetupLogInit
-@ stub WdsSetLogMessageA
-@ stub WdsSetLogMessageW
+@ stub WdsSetupLogMessageA
+@ stub WdsSetupLogMessageW
@ stub WdsSubscribeEx
@ stub WdsTerminate
@ stub WdsUnlockExecutionGroup
--
2.35.0
Jan. 27, 2022
[PATCH v4 1/4] wdscore: Implement CurrentIP.
by Mohamad Al-Jaf
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=51850
Signed-off-by: Mohamad Al-Jaf <mohamadaljaf(a)gmail.com>
---
v4: - Remove WINAPI in the function in main.c and tests/main.c.
Since WINAPI cleans the stack, it doesn't make sense to use it in
this context.
---
configure.ac | 1 +
dlls/wdscore/Makefile.in | 3 ++
dlls/wdscore/main.c | 54 ++++++++++++++++++++++++++++
dlls/wdscore/tests/Makefile.in | 4 +++
dlls/wdscore/tests/main.c | 65 ++++++++++++++++++++++++++++++++++
dlls/wdscore/wdscore.spec | 2 +-
6 files changed, 128 insertions(+), 1 deletion(-)
create mode 100644 dlls/wdscore/main.c
create mode 100644 dlls/wdscore/tests/Makefile.in
create mode 100644 dlls/wdscore/tests/main.c
diff --git a/configure.ac b/configure.ac
index 0b1a53f3ff9..1923c95f4b4 100644
--- a/configure.ac
+++ b/configure.ac
@@ -3345,6 +3345,7 @@ WINE_CONFIG_MAKEFILE(dlls/wbemdisp/tests)
WINE_CONFIG_MAKEFILE(dlls/wbemprox)
WINE_CONFIG_MAKEFILE(dlls/wbemprox/tests)
WINE_CONFIG_MAKEFILE(dlls/wdscore)
+WINE_CONFIG_MAKEFILE(dlls/wdscore/tests)
WINE_CONFIG_MAKEFILE(dlls/webservices)
WINE_CONFIG_MAKEFILE(dlls/webservices/tests)
WINE_CONFIG_MAKEFILE(dlls/websocket)
diff --git a/dlls/wdscore/Makefile.in b/dlls/wdscore/Makefile.in
index 20ba1d3b1c9..2020e72c7bb 100644
--- a/dlls/wdscore/Makefile.in
+++ b/dlls/wdscore/Makefile.in
@@ -1,3 +1,6 @@
MODULE = wdscore.dll
EXTRADLLFLAGS = -Wb,--prefer-native
+
+C_SRCS = \
+ main.c
diff --git a/dlls/wdscore/main.c b/dlls/wdscore/main.c
new file mode 100644
index 00000000000..9001838431d
--- /dev/null
+++ b/dlls/wdscore/main.c
@@ -0,0 +1,54 @@
+/*
+ * Copyright 2022 Mohamad Al-Jaf
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
+ */
+
+#include <stdarg.h>
+
+#include "windef.h"
+#include "winbase.h"
+
+#include "wine/asm.h"
+#include "wine/debug.h"
+
+WINE_DEFAULT_DEBUG_CHANNEL(wdscore);
+
+/***********************************************************************
+ * CurrentIP (wdscore.@)
+ */
+#ifdef __i386__
+__ASM_STDCALL_FUNC(CurrentIP, 0,
+ "movl (%esp), %eax\n\t"
+ "ret" )
+#elif defined(__x86_64__)
+__ASM_STDCALL_FUNC(CurrentIP, 0,
+ "movq (%rsp), %rax\n\t"
+ "ret" )
+#elif defined(__arm__)
+__ASM_STDCALL_FUNC(CurrentIP, 0,
+ "mov r0, lr\n\t"
+ "bx lr" )
+#elif defined(__aarch64__)
+__ASM_STDCALL_FUNC(CurrentIP, 0,
+ "mov x0, lr\n\t"
+ "ret" )
+#else
+void *CurrentIP(void)
+{
+ FIXME( "not implemented\n" );
+ return 0;
+}
+#endif
diff --git a/dlls/wdscore/tests/Makefile.in b/dlls/wdscore/tests/Makefile.in
new file mode 100644
index 00000000000..baf4adf23a1
--- /dev/null
+++ b/dlls/wdscore/tests/Makefile.in
@@ -0,0 +1,4 @@
+TESTDLL = wdscore.dll
+
+C_SRCS = \
+ main.c
diff --git a/dlls/wdscore/tests/main.c b/dlls/wdscore/tests/main.c
new file mode 100644
index 00000000000..f17abbbdb3f
--- /dev/null
+++ b/dlls/wdscore/tests/main.c
@@ -0,0 +1,65 @@
+/*
+ * Unit test suite for wdscore
+ *
+ * Copyright 2022 Mohamad Al-Jaf
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
+ *
+ */
+
+#include <stdarg.h>
+
+#include "windef.h"
+#include "winbase.h"
+
+#include "wine/test.h"
+
+static HMODULE dll;
+static void* (*pCurrentIP)(void);
+
+static BOOL init_function_pointers(void)
+{
+ dll = LoadLibraryA("wdscore.dll");
+
+ if (dll)
+ {
+ pCurrentIP = (void*)GetProcAddress(dll, "CurrentIP");
+ return TRUE;
+ }
+
+ return FALSE;
+}
+
+static void test_CurrentIP(void)
+{
+ char *cur;
+ char *ret;
+
+ cur = (char*)&test_CurrentIP;
+ ret = (char*)pCurrentIP();
+
+ ok(cur <= ret && ret < (cur + 0x100), "Address %p not in function starting at %p.\n", ret, cur);
+}
+
+START_TEST(main)
+{
+ if (init_function_pointers())
+ {
+ test_CurrentIP();
+ FreeLibrary(dll);
+ }
+ else
+ skip("could not load wdscore.dll\n");
+}
diff --git a/dlls/wdscore/wdscore.spec b/dlls/wdscore/wdscore.spec
index 15958b86aba..8b6febe6b3b 100644
--- a/dlls/wdscore/wdscore.spec
+++ b/dlls/wdscore/wdscore.spec
@@ -71,7 +71,7 @@
@ stub ConstructPartialMsgIfW
@ stub ConstructPartialMsgVA
@ stub ConstructPartialMsgVW
-@ stub CurrentIP
+@ stdcall CurrentIP()
@ stub EndMajorTask
@ stub EndMinorTask
@ stub GetMajorTask
--
2.35.0
Jan. 27, 2022
[PATCH 7/7] winhttp: Don't allow queueing websocket receive if another is pending.
by Paul Gofman
Signed-off-by: Paul Gofman <pgofman(a)codeweavers.com>
---
dlls/winhttp/request.c | 15 +++++++++++++--
dlls/winhttp/tests/notification.c | 2 ++
2 files changed, 15 insertions(+), 2 deletions(-)
diff --git a/dlls/winhttp/request.c b/dlls/winhttp/request.c
index a61355da7b9..728b1895ba7 100644
--- a/dlls/winhttp/request.c
+++ b/dlls/winhttp/request.c
@@ -3743,13 +3743,24 @@ DWORD WINAPI WinHttpWebSocketReceive( HINTERNET hsocket, void *buf, DWORD len, D
{
struct socket_receive *r;
- if (!(r = malloc( sizeof(*r) ))) return FALSE;
+ if (InterlockedIncrement( &socket->hdr.pending_receives ) > 1)
+ {
+ InterlockedDecrement( &socket->hdr.pending_receives );
+ WARN( "Attempt to queue receive while another is pending.\n" );
+ release_object( &socket->hdr );
+ return ERROR_INVALID_OPERATION;
+ }
+
+ if (!(r = malloc( sizeof(*r) )))
+ {
+ InterlockedDecrement( &socket->hdr.pending_receives );
+ return ERROR_OUTOFMEMORY;
+ }
r->socket = socket;
r->buf = buf;
r->len = len;
addref_object( &socket->hdr );
- InterlockedIncrement( &socket->hdr.pending_receives );
if ((ret = queue_task( &socket->recv_q, task_socket_receive, r )))
{
InterlockedDecrement( &socket->hdr.pending_receives );
diff --git a/dlls/winhttp/tests/notification.c b/dlls/winhttp/tests/notification.c
index fabc5a03a46..121190ba9d2 100644
--- a/dlls/winhttp/tests/notification.c
+++ b/dlls/winhttp/tests/notification.c
@@ -1104,6 +1104,8 @@ static void test_websocket(BOOL secure)
err = pWinHttpWebSocketReceive( socket, buffer, sizeof(buffer), &size, &type );
ok( err == ERROR_SUCCESS, "got %u\n", err );
+ err = pWinHttpWebSocketReceive( socket, buffer, sizeof(buffer), &size, &type );
+ ok( err == ERROR_INVALID_OPERATION, "got %u\n", err );
setup_test( &info, winhttp_websocket_shutdown, __LINE__ );
ws_status = (WINHTTP_WEB_SOCKET_STATUS *)info.buffer;
--
2.34.1
Jan. 27, 2022
[PATCH 6/7] winhttp: Don't allow socket transfers after receiving close frame.
by Paul Gofman
Signed-off-by: Paul Gofman <pgofman(a)codeweavers.com>
---
dlls/winhttp/request.c | 14 ++++++++++++--
dlls/winhttp/tests/notification.c | 3 +++
2 files changed, 15 insertions(+), 2 deletions(-)
diff --git a/dlls/winhttp/request.c b/dlls/winhttp/request.c
index 04df90f74d7..a61355da7b9 100644
--- a/dlls/winhttp/request.c
+++ b/dlls/winhttp/request.c
@@ -3287,6 +3287,16 @@ static BOOL receive_io_complete( struct socket *socket )
return count >= 0;
}
+static BOOL socket_can_send( struct socket *socket )
+{
+ return socket->state == SOCKET_STATE_OPEN && !socket->close_frame_received;
+}
+
+static BOOL socket_can_receive( struct socket *socket )
+{
+ return socket->state <= SOCKET_STATE_SHUTDOWN && !socket->close_frame_received;
+}
+
static enum socket_opcode map_buffer_type( WINHTTP_WEB_SOCKET_BUFFER_TYPE type )
{
switch (type)
@@ -3364,7 +3374,7 @@ DWORD WINAPI WinHttpWebSocketSend( HINTERNET hsocket, WINHTTP_WEB_SOCKET_BUFFER_
release_object( &socket->hdr );
return ERROR_WINHTTP_INCORRECT_HANDLE_TYPE;
}
- if (socket->state != SOCKET_STATE_OPEN)
+ if (!socket_can_send( socket ))
{
release_object( &socket->hdr );
return ERROR_INVALID_OPERATION;
@@ -3723,7 +3733,7 @@ DWORD WINAPI WinHttpWebSocketReceive( HINTERNET hsocket, void *buf, DWORD len, D
release_object( &socket->hdr );
return ERROR_WINHTTP_INCORRECT_HANDLE_TYPE;
}
- if (socket->state > SOCKET_STATE_SHUTDOWN)
+ if (!socket_can_receive( socket ))
{
release_object( &socket->hdr );
return ERROR_INVALID_OPERATION;
diff --git a/dlls/winhttp/tests/notification.c b/dlls/winhttp/tests/notification.c
index 3dc94a909b4..fabc5a03a46 100644
--- a/dlls/winhttp/tests/notification.c
+++ b/dlls/winhttp/tests/notification.c
@@ -1132,6 +1132,9 @@ static void test_websocket(BOOL secure)
ok( close_status == 1000, "got %u\n", close_status );
ok( size <= sizeof(buffer), "got %u\n", size );
+ err = pWinHttpWebSocketReceive( socket, buffer, sizeof(buffer), &size, &type );
+ ok( err == ERROR_INVALID_OPERATION, "got %u\n", err );
+
info.buflen = 0xdeadbeef;
setup_test( &info, winhttp_websocket_close, __LINE__ );
err = pWinHttpWebSocketClose( socket, 1000, (void *)"success", sizeof("success") );
--
2.34.1
Jan. 27, 2022
[PATCH 5/7] winhttp: Don't queue socket_close() in WinHttpWebSocketClose() if close frame is already received.
by Paul Gofman
Signed-off-by: Paul Gofman <pgofman(a)codeweavers.com>
---
dlls/winhttp/request.c | 7 +++++++
dlls/winhttp/tests/notification.c | 10 ++++++++++
2 files changed, 17 insertions(+)
diff --git a/dlls/winhttp/request.c b/dlls/winhttp/request.c
index 5568f04d0d0..04df90f74d7 100644
--- a/dlls/winhttp/request.c
+++ b/dlls/winhttp/request.c
@@ -3959,6 +3959,13 @@ DWORD WINAPI WinHttpWebSocketClose( HINTERNET hsocket, USHORT status, void *reas
if (prev_state < SOCKET_STATE_SHUTDOWN
&& (ret = send_socket_shutdown( socket, status, reason, len, FALSE ))) goto done;
+ if (!pending_receives && socket->close_frame_received)
+ {
+ if (socket->request->connect->hdr.flags & WINHTTP_FLAG_ASYNC)
+ socket_close_complete( socket, socket->close_frame_receive_err );
+ goto done;
+ }
+
if (socket->request->connect->hdr.flags & WINHTTP_FLAG_ASYNC)
{
struct socket_shutdown *s;
diff --git a/dlls/winhttp/tests/notification.c b/dlls/winhttp/tests/notification.c
index 1ae1bb537b0..3dc94a909b4 100644
--- a/dlls/winhttp/tests/notification.c
+++ b/dlls/winhttp/tests/notification.c
@@ -728,6 +728,8 @@ static const struct notification websocket_test3[] =
{ winhttp_websocket_shutdown, WINHTTP_CALLBACK_STATUS_SHUTDOWN_COMPLETE, NF_MAIN_THREAD },
{ winhttp_websocket_shutdown, WINHTTP_CALLBACK_STATUS_READ_COMPLETE, NF_SAVE_BUFFER | NF_SIGNAL },
+ { winhttp_websocket_close, WINHTTP_CALLBACK_STATUS_CLOSE_COMPLETE,
+ NF_MAIN_THREAD| NF_SAVE_BUFFER | NF_SIGNAL },
{ winhttp_close_handle, WINHTTP_CALLBACK_STATUS_HANDLE_CLOSING },
{ winhttp_close_handle, WINHTTP_CALLBACK_STATUS_CLOSING_CONNECTION, NF_WINE_ALLOW },
{ winhttp_close_handle, WINHTTP_CALLBACK_STATUS_CONNECTION_CLOSED, NF_WINE_ALLOW },
@@ -1130,6 +1132,14 @@ static void test_websocket(BOOL secure)
ok( close_status == 1000, "got %u\n", close_status );
ok( size <= sizeof(buffer), "got %u\n", size );
+ info.buflen = 0xdeadbeef;
+ setup_test( &info, winhttp_websocket_close, __LINE__ );
+ err = pWinHttpWebSocketClose( socket, 1000, (void *)"success", sizeof("success") );
+ ok( err == ERROR_SUCCESS, "got %u\n", err );
+
+ WaitForSingleObject( info.wait, INFINITE );
+ ok( !info.buflen, "Got unexpected buflen %u.\n", info.buflen );
+
setup_test( &info, winhttp_close_handle, __LINE__ );
WinHttpCloseHandle( socket );
--
2.34.1
Jan. 27, 2022
[PATCH 4/7] winhttp: Factor out socket_close_complete() function.
by Paul Gofman
Signed-off-by: Paul Gofman <pgofman(a)codeweavers.com>
---
dlls/winhttp/request.c | 21 +++++++++++++--------
1 file changed, 13 insertions(+), 8 deletions(-)
diff --git a/dlls/winhttp/request.c b/dlls/winhttp/request.c
index 8e13e678e22..5568f04d0d0 100644
--- a/dlls/winhttp/request.c
+++ b/dlls/winhttp/request.c
@@ -3886,24 +3886,29 @@ static DWORD socket_close( struct socket *socket )
return receive_close_status( socket, count );
}
-static void CALLBACK task_socket_close( TP_CALLBACK_INSTANCE *instance, void *ctx, TP_WORK *work )
+static void socket_close_complete( struct socket *socket, DWORD ret )
{
- struct socket_shutdown *s = ctx;
- DWORD ret;
-
- ret = socket_close( s->socket );
-
- if (!ret) send_callback( &s->socket->hdr, WINHTTP_CALLBACK_STATUS_CLOSE_COMPLETE, NULL, 0 );
+ if (!ret) send_callback( &socket->hdr, WINHTTP_CALLBACK_STATUS_CLOSE_COMPLETE, NULL, 0 );
else
{
WINHTTP_WEB_SOCKET_ASYNC_RESULT result;
result.AsyncResult.dwResult = API_READ_DATA; /* FIXME */
result.AsyncResult.dwError = ret;
result.Operation = WINHTTP_WEB_SOCKET_CLOSE_OPERATION;
- send_callback( &s->socket->hdr, WINHTTP_CALLBACK_STATUS_REQUEST_ERROR, &result, sizeof(result) );
+ send_callback( &socket->hdr, WINHTTP_CALLBACK_STATUS_REQUEST_ERROR, &result, sizeof(result) );
}
+}
+
+static void CALLBACK task_socket_close( TP_CALLBACK_INSTANCE *instance, void *ctx, TP_WORK *work )
+{
+ struct socket_shutdown *s = ctx;
+ DWORD ret;
TRACE("running %p\n", work);
+
+ ret = socket_close( s->socket );
+ socket_close_complete( s->socket, ret );
+
release_object( &s->socket->hdr );
free( s );
}
--
2.34.1
Jan. 27, 2022
[PATCH 3/7] winhttp: Don't mind socket state in WinHttpWebSocketQueryCloseStatus().
by Paul Gofman
Signed-off-by: Paul Gofman <pgofman(a)codeweavers.com>
---
dlls/winhttp/request.c | 5 -----
dlls/winhttp/tests/notification.c | 6 +++---
2 files changed, 3 insertions(+), 8 deletions(-)
diff --git a/dlls/winhttp/request.c b/dlls/winhttp/request.c
index 10c1beb0d2b..8e13e678e22 100644
--- a/dlls/winhttp/request.c
+++ b/dlls/winhttp/request.c
@@ -3991,11 +3991,6 @@ DWORD WINAPI WinHttpWebSocketQueryCloseStatus( HINTERNET hsocket, USHORT *status
release_object( &socket->hdr );
return ERROR_WINHTTP_INCORRECT_HANDLE_TYPE;
}
- if (socket->state < SOCKET_STATE_CLOSED)
- {
- release_object( &socket->hdr );
- return ERROR_INVALID_OPERATION;
- }
if (!socket->close_frame_received || socket->close_frame_receive_err)
{
diff --git a/dlls/winhttp/tests/notification.c b/dlls/winhttp/tests/notification.c
index 6545a1d92fe..1ae1bb537b0 100644
--- a/dlls/winhttp/tests/notification.c
+++ b/dlls/winhttp/tests/notification.c
@@ -1126,9 +1126,9 @@ static void test_websocket(BOOL secure)
close_status = 0xdead;
size = sizeof(buffer) + 1;
err = pWinHttpWebSocketQueryCloseStatus( socket, &close_status, buffer, sizeof(buffer), &size );
- todo_wine ok( err == ERROR_SUCCESS, "got %u\n", err );
- todo_wine ok( close_status == 1000, "got %u\n", close_status );
- todo_wine ok( size <= sizeof(buffer), "got %u\n", size );
+ ok( err == ERROR_SUCCESS, "got %u\n", err );
+ ok( close_status == 1000, "got %u\n", close_status );
+ ok( size <= sizeof(buffer), "got %u\n", size );
setup_test( &info, winhttp_close_handle, __LINE__ );
--
2.34.1
Jan. 27, 2022
[PATCH 2/7] winhttp/tests: Test shutting down websocket when receive is pending.
by Paul Gofman
Signed-off-by: Paul Gofman <pgofman(a)codeweavers.com>
---
dlls/winhttp/tests/notification.c | 110 +++++++++++++++++++++++++++++-
1 file changed, 109 insertions(+), 1 deletion(-)
diff --git a/dlls/winhttp/tests/notification.c b/dlls/winhttp/tests/notification.c
index 1ae7e1af2e7..6545a1d92fe 100644
--- a/dlls/winhttp/tests/notification.c
+++ b/dlls/winhttp/tests/notification.c
@@ -707,6 +707,30 @@ static const struct notification websocket_test2[] =
{ winhttp_close_handle, WINHTTP_CALLBACK_STATUS_HANDLE_CLOSING },
{ winhttp_close_handle, WINHTTP_CALLBACK_STATUS_CLOSING_CONNECTION, NF_WINE_ALLOW },
{ winhttp_close_handle, WINHTTP_CALLBACK_STATUS_CONNECTION_CLOSED, NF_WINE_ALLOW },
+ { winhttp_close_handle, WINHTTP_CALLBACK_STATUS_HANDLE_CLOSING, NF_SIGNAL }
+};
+
+static const struct notification websocket_test3[] =
+{
+ { winhttp_open_request, WINHTTP_CALLBACK_STATUS_HANDLE_CREATED },
+ { winhttp_send_request, WINHTTP_CALLBACK_STATUS_RESOLVING_NAME, NF_ALLOW },
+ { winhttp_send_request, WINHTTP_CALLBACK_STATUS_NAME_RESOLVED, NF_ALLOW },
+ { winhttp_send_request, WINHTTP_CALLBACK_STATUS_CONNECTING_TO_SERVER },
+ { winhttp_send_request, WINHTTP_CALLBACK_STATUS_CONNECTED_TO_SERVER },
+ { winhttp_send_request, WINHTTP_CALLBACK_STATUS_SENDING_REQUEST },
+ { winhttp_send_request, WINHTTP_CALLBACK_STATUS_REQUEST_SENT },
+ { winhttp_send_request, WINHTTP_CALLBACK_STATUS_SENDREQUEST_COMPLETE, NF_SIGNAL },
+ { winhttp_receive_response, WINHTTP_CALLBACK_STATUS_RECEIVING_RESPONSE },
+ { winhttp_receive_response, WINHTTP_CALLBACK_STATUS_RESPONSE_RECEIVED },
+ { winhttp_receive_response, WINHTTP_CALLBACK_STATUS_HEADERS_AVAILABLE, NF_SIGNAL },
+ { winhttp_websocket_complete_upgrade, WINHTTP_CALLBACK_STATUS_HANDLE_CREATED, NF_SIGNAL },
+ { winhttp_websocket_receive, WINHTTP_CALLBACK_STATUS_READ_COMPLETE, NF_SIGNAL },
+
+ { winhttp_websocket_shutdown, WINHTTP_CALLBACK_STATUS_SHUTDOWN_COMPLETE, NF_MAIN_THREAD },
+ { winhttp_websocket_shutdown, WINHTTP_CALLBACK_STATUS_READ_COMPLETE, NF_SAVE_BUFFER | NF_SIGNAL },
+ { winhttp_close_handle, WINHTTP_CALLBACK_STATUS_HANDLE_CLOSING },
+ { winhttp_close_handle, WINHTTP_CALLBACK_STATUS_CLOSING_CONNECTION, NF_WINE_ALLOW },
+ { winhttp_close_handle, WINHTTP_CALLBACK_STATUS_CONNECTION_CLOSED, NF_WINE_ALLOW },
{ winhttp_close_handle, WINHTTP_CALLBACK_STATUS_HANDLE_CLOSING },
{ winhttp_close_handle, WINHTTP_CALLBACK_STATUS_HANDLE_CLOSING },
{ winhttp_close_handle, WINHTTP_CALLBACK_STATUS_HANDLE_CLOSING, NF_SIGNAL }
@@ -996,7 +1020,7 @@ static void test_websocket(BOOL secure)
ok( err == ERROR_SUCCESS, "got %u\n", err );
setup_test( &info, winhttp_websocket_close, __LINE__ );
- ret = pWinHttpWebSocketClose( socket, 1000, (void *)"success", sizeof("success") );
+ err = pWinHttpWebSocketClose( socket, 1000, (void *)"success", sizeof("success") );
ok( err == ERROR_SUCCESS, "got %u\n", err );
ok( info.buflen == sizeof(*result), "got unexpected buflen %u.\n", info.buflen );
result = (WINHTTP_WEB_SOCKET_ASYNC_RESULT *)info.buffer;
@@ -1022,6 +1046,90 @@ static void test_websocket(BOOL secure)
ok( close_status == 1000, "got %u\n", close_status );
ok( size <= sizeof(buffer), "got %u\n", size );
+ setup_test( &info, winhttp_close_handle, __LINE__ );
+ WinHttpCloseHandle( socket );
+ WinHttpCloseHandle( request );
+
+ WaitForSingleObject( info.wait, INFINITE );
+ end_test( &info, __LINE__ );
+
+ /* Test socket shutdown while receive is pending. */
+ info.test = websocket_test3;
+ info.count = ARRAY_SIZE( websocket_test3 );
+ info.index = 0;
+
+ setup_test( &info, winhttp_open_request, __LINE__ );
+ request = WinHttpOpenRequest( connection, NULL, L"/", NULL, NULL, NULL, secure ? WINHTTP_FLAG_SECURE : 0);
+ ok( request != NULL, "got %u\n", err );
+
+ if (secure)
+ {
+ flags = SECURITY_FLAG_IGNORE_UNKNOWN_CA | SECURITY_FLAG_IGNORE_CERT_DATE_INVALID |
+ SECURITY_FLAG_IGNORE_CERT_CN_INVALID;
+ ret = WinHttpSetOption(request, WINHTTP_OPTION_SECURITY_FLAGS, &flags, sizeof(flags));
+ ok(ret, "failed to set security flags %u\n", GetLastError());
+ }
+
+ ret = WinHttpSetOption( request, WINHTTP_OPTION_UPGRADE_TO_WEB_SOCKET, NULL, 0 );
+ ok( ret, "got %u\n", GetLastError() );
+
+ setup_test( &info, winhttp_send_request, __LINE__ );
+ ret = WinHttpSendRequest( request, NULL, 0, NULL, 0, 0, 0 );
+ ok( ret, "got %u\n", GetLastError() );
+ WaitForSingleObject( info.wait, INFINITE );
+
+ setup_test( &info, winhttp_receive_response, __LINE__ );
+ ret = WinHttpReceiveResponse( request, NULL );
+ ok( ret, "got %u\n", err );
+ WaitForSingleObject( info.wait, INFINITE );
+
+ size = sizeof(status);
+ ret = WinHttpQueryHeaders( request, WINHTTP_QUERY_STATUS_CODE|WINHTTP_QUERY_FLAG_NUMBER, NULL, &status, &size, NULL );
+ ok( ret, "failed unexpectedly %u\n", err );
+ ok( status == 101, "got %u\n", status );
+
+ setup_test( &info, winhttp_websocket_complete_upgrade, __LINE__ );
+ socket = pWinHttpWebSocketCompleteUpgrade( request, (DWORD_PTR)context );
+ ok( socket != NULL, "got %u\n", err );
+ WaitForSingleObject( info.wait, INFINITE );
+
+ setup_test( &info, winhttp_websocket_receive, __LINE__ );
+ buffer[0] = 0;
+ err = pWinHttpWebSocketReceive( socket, buffer, sizeof(buffer), &size, &type );
+ ok( err == ERROR_SUCCESS, "got %u\n", err );
+ WaitForSingleObject( info.wait, INFINITE );
+ ok( buffer[0] == 'R', "unexpected data\n" );
+
+ err = pWinHttpWebSocketReceive( socket, buffer, sizeof(buffer), &size, &type );
+ ok( err == ERROR_SUCCESS, "got %u\n", err );
+
+ setup_test( &info, winhttp_websocket_shutdown, __LINE__ );
+ ws_status = (WINHTTP_WEB_SOCKET_STATUS *)info.buffer;
+ ws_status->eBufferType = ~0u;
+ err = pWinHttpWebSocketShutdown( socket, 1000, (void *)"success", sizeof("success") );
+ ok( err == ERROR_SUCCESS, "got %u\n", err );
+
+ close_status = 0xdead;
+ size = sizeof(buffer) + 1;
+ err = pWinHttpWebSocketQueryCloseStatus( socket, &close_status, buffer, sizeof(buffer), &size );
+ ok( err == ERROR_INVALID_OPERATION, "got %u\n", err );
+ ok( close_status == 0xdead, "got %u\n", close_status );
+ ok( size == sizeof(buffer) + 1, "got %u\n", size );
+
+ WaitForSingleObject( info.wait, INFINITE );
+
+ ok( info.buflen == sizeof(*ws_status), "got unexpected buflen %u.\n", info.buflen );
+ ok( ws_status->eBufferType == WINHTTP_WEB_SOCKET_CLOSE_BUFFER_TYPE, "Got unexpected eBufferType %u.\n",
+ ws_status->eBufferType );
+ ok( !ws_status->dwBytesTransferred, "got unexpected dwBytesTransferred %u.\n", ws_status->dwBytesTransferred );
+
+ close_status = 0xdead;
+ size = sizeof(buffer) + 1;
+ err = pWinHttpWebSocketQueryCloseStatus( socket, &close_status, buffer, sizeof(buffer), &size );
+ todo_wine ok( err == ERROR_SUCCESS, "got %u\n", err );
+ todo_wine ok( close_status == 1000, "got %u\n", close_status );
+ todo_wine ok( size <= sizeof(buffer), "got %u\n", size );
+
setup_test( &info, winhttp_close_handle, __LINE__ );
WinHttpCloseHandle( socket );
--
2.34.1
Jan. 27, 2022