Follow-up of !2786, which appears to have been abandoned.
Depends on !8182, !8575, !8578
# Execute minimal test case
1. checkout wine into ~/src/wine
2. in dlls/ws2_32/tests/sock.c wrap all calls to test functions after `Init()` until `test_afunix()` with #if 0 ... #endif
3. build into ~/src/wine-build
4. run `(cd ~/src/wine-build; WINEPREFIX=~/src/wine/.wine ../wine/tools/runtest -q -P wine -T . -M ws2_32.dll -p dlls/ws2_32/tests/i386-windows/ws2_32_test.exe sock)`
# How to debug wineserver
Since `wineserver` runs in the background, simple calls to printf() will show nothing when the test case is executed. A workaround is to open a file and call fprintf() to write debug messages to this file, which can then be inspected.
# How to debug a wine test case
At https://gitlab.winehq.org/wine/wine/-/blob/master/tools/runtest#L151 there is mentioned a environment variable name `WINETEST_WRAPPER`, with which it may be possible to run gdb to debug test cases
```
(cd ~/src/wine-build; make -j10 ; WINETEST_WRAPPER="gdb --args" WINEPREFIX=~/src/wine/.wine ../wine/tools/runtest -P wine -T . -M ws2_32.dll -p dlls/ws2_32/tests/i386-windows/ws2_32_test.exe sock)
Reading symbols from ./wine...
(gdb) set follow-fork-mode child
(gdb) r
current directory: 'Z:\home\ralf.habacker\src\wine-build'
sock.c:14624: Test failed: test_afunix.sock: wrong attr ffffffff
sock.c:14658: Test failed: test_afunix.sock: wrong family 0
sock.c:14693: Test failed: test_afunix.sock: wrong family 0
...
```
With this you can debug the wine application, but unfortunally not the windows api.
# How to debug a wine test case (windows api)
1. After building wine install the binaries into a temporary location
```
make -C ~/src/wine-build install DESTDIR=~/src/wine-install
```
2. run
```
(cd ../wine-build; \
WINEDLLDIR=$HOME/wine-install/usr/local/lib/wine/i386-windows/ \
WINEPREFIX=~/src/wine/.wine \
WINEDLLOVERRIDES=';ws2_32.dll=b' \
WINETEST_PLATFORM=wine \
./wine programs/winedbg/i386-windows/winedbg.exe --gdb dlls/ws2_32/tests/i386-windows/ws2_32_test.exe sock)
```
Now let's look at the loaded shared libraries
```
Wine-gdb> info sharedlibrary
From To Syms Read Shared Object Library
0xf7b39000 0xf7bff6e0 Yes /home/user/src/wine-build/dlls/ntdll/ntdll.so
0x00401000 0x00478e2c Yes /home/user/src/wine-build/dlls/ws2_32/tests/i386-windows/ws2_32_test.exe
0x7bcc1000 0x7bd69280 Yes /home/user/src/wine/.wine/drive_c/windows/system32/ntdll.dll
0x7bb31000 0x7bb91594 Yes /home/user/src/wine/.wine/drive_c/windows/system32/kernel32.dll
0x7b5b1000 0x7b841f38 Yes /home/user/src/wine/.wine/drive_c/windows/system32/kernelbase.dll
0x77fd1000 0x77ff89d8 Yes /home/user/src/wine/.wine/drive_c/windows/system32/iphlpapi.dll
0x7b4b1000 0x7b4ebcb8 Yes /home/user/src/wine/.wine/drive_c/windows/system32/advapi32.dll
0x7b1e1000 0x7b280014 Yes /home/user/src/wine/.wine/drive_c/windows/system32/msvcrt.dll
0x7b151000 0x7b16de40 Yes /home/user/src/wine/.wine/drive_c/windows/system32/sechost.dll
0x7adf1000 0x7aec2690 Yes /home/user/src/wine/.wine/drive_c/windows/system32/ucrtbase.dll
0x77f71000 0x77f85a80 Yes /home/user/src/wine/.wine/drive_c/windows/system32/dnsapi.dll
0x77f31000 0x77f3b240 Yes /home/user/src/wine/.wine/drive_c/windows/system32/nsi.dll
0x7ad41000 0x7ad6653c Yes /home/user/src/wine/.wine/drive_c/windows/system32/ws2_32.dll
0x7a111000 0x7a2cc55c Yes /home/user/src/wine/.wine/drive_c/windows/system32/user32.dll
0x7a631000 0x7a6ae67c Yes /home/user/src/wine/.wine/drive_c/windows/system32/gdi32.dll
0x7a0b1000 0x7a0e48e8 Yes /home/user/src/wine/.wine/drive_c/windows/system32/win32u.dll
0x78121000 0x7813de90 Yes /home/user/src/wine/.wine/drive_c/windows/system32/imm32.dll
```
It is visible, that the unix variant of the shared libraries (ntdll.so) are read from the build dir and also the test case.
The Windows part (*.dll) is loaded from the wine prefix, so that these must be copied from the build directory initially and whenever changes are made.
With this is possible to set breakpoints
```
Wine-gdb> b GetFileAttributesW@4
Breakpoint 1 at 0x7b5d3725: file ../wine/dlls/kernelbase/file.c, line 1665.
Wine-gdb> c
Continuing.
Breakpoint 1, GetFileAttributesW@4 (
name=0x40fcfa <test_afunix+1434> L"\xec83\x8304\xfff8\x940f\x89c0\x247c\xf08\xc0b6\x44c7\x424\x1bbf\103\x489\xe824\x52e6\001\x44c7", <incomplete sequence \x824>)
at ../wine/dlls/kernelbase/file.c:1665
1665 TRACE( "%s\n", debugstr_w(name) );
```
--
v43: ws2_32: Add note in bind() for AF_UNIX sockets
ws2_32/tests: In tests for AF_UNIX sockets print actual directory used
https://gitlab.winehq.org/wine/wine/-/merge_requests/7650
Follow-up of !2786, which appears to have been abandoned.
Depends on !8182, !8575, !8578
# Execute minimal test case
1. checkout wine into ~/src/wine
2. in dlls/ws2_32/tests/sock.c wrap all calls to test functions after `Init()` until `test_afunix()` with #if 0 ... #endif
3. build into ~/src/wine-build
4. run `(cd ~/src/wine-build; WINEPREFIX=~/src/wine/.wine ../wine/tools/runtest -q -P wine -T . -M ws2_32.dll -p dlls/ws2_32/tests/i386-windows/ws2_32_test.exe sock)`
# How to debug wineserver
Since `wineserver` runs in the background, simple calls to printf() will show nothing when the test case is executed. A workaround is to open a file and call fprintf() to write debug messages to this file, which can then be inspected.
--
v42: ws2_32: Add note in bind() for AF_UNIX sockets
ws2_32/tests: In tests for AF_UNIX sockets print actual directory used
ws2_32/tests: In AF_UNIX socket tests always print used path in case of errors
server: Fix getsockname() and accept() on AF_UNIX sockets.
server: Introduce error when attempting to create a SOCK_DGRAM AF_UNIX socket.
ws2_32: Add support for AF_UNIX sockets.
server: Allow for deletion of socket files.
https://gitlab.winehq.org/wine/wine/-/merge_requests/7650
The frame index should be strictly less than idCount. Previously, an index equal to idCount was not rejected, leading to an out-of-range access.
Signed-off-by: chenzhengyong chenzhengyong(a)uniontech.com
Although this bug was not fatal because subsequent IStream_Read and related functions also perform boundary checks, it is better to catch the invalid index early for clarity and consistency.
--
https://gitlab.winehq.org/wine/wine/-/merge_requests/9347
This MR implements group affinity support in attributes list
passed to CreateRemoteThreadEx().
(up to the current Wine limit of 64 logical cores).
It also adds a couple of missing APIs definitions related to group affinity
support.
Notes:
- duplicating for the Nth time struct \_PROC\_THREAD\_ATTRIBUTE\_LIST
definition isn't very nice... perhaps we should define it somewhere?
- it's very likely that CreateRemoteThreadEx() should call into
NtCreateThreadEx() (instead of the Rtl counter part), but I opted
for the simpler approach to set thread affinity after thread creation
(this could be changed if needed).
--
v3: kernelbase: Support group affinity attributes.
kernel32/tests: Test thread creation with group affinity attributes.
include: Add missing process group related definitions.
kernelbase: Support affinity group in process/thread attributes list.
kernel32: Test adding group affinity to proc/thread attributes list.
https://gitlab.winehq.org/wine/wine/-/merge_requests/9271
Convert surface lock to recursive mutex to allow same thread
to acquire the lock multiple times, preventing deadlocks when
lock_surface() and window_surface_lock() are called nestedly.
Signed-off-by: Zhao Yi <zhaoyi(a)uniontech.com>
--
https://gitlab.winehq.org/wine/wine/-/merge_requests/9349