`getpeername()` is currently handled in ntdll. This merge request changes ntdll to forward `getpeername()` to wineserver. The implementation utilises new `peer_addr` and `peer_addr_len` fields in wineserver's `struct sock`.
This fixes multiple `todo_wine`s in `ws2_32/tests` and allows for more accurate peer names to be provided in case the address the socket is bound to on the Unix side does not match what `bind()` was called with on the Windows side.
*This merge request was originally intended to be included in !2786 (Add support for AF_UNIX sockets) but was split into its own merge request because this is not an insignificant change.*
--
v3: ws2_32/tests: Remove todo_wine from now-successful tests.
https://gitlab.winehq.org/wine/wine/-/merge_requests/3074
Valgrind support requires a fork, which I've published to https://gitlab.winehq.org/rbernon/valgrind. The fork implements loading DWARF debug info from PE files, instead of the old and broken upstream PDB support. I've tried to upstream these changes a long time ago but didn't receive any feedback.
I think we could maybe consider keeping a fork, which I'm happy to maintain, as the changes aren't too large. We may want to investigate adding 32-on-64 support, which may require a bit more changes (to VEX specifically, because its amd64 guest doesn't support segment register manipulation).
The changes here are not all related to Valgrind, and I'll create separate MR for those which may make sense independently from Valgrind / GDB.
Also included is a suppression file to silent some annoying false positives, many of which are coming from the cross-stack accesses during syscalls, which are confusing Valgrind's stack heuristics. One can try this out with something like:
`WINELOADERNOEXEC=1 valgrind --suppressions=tools/valgrind.supp wine64/loader/wine64 wine64/programs/winecfg/winecfg.exe`
--
v9: ntdll: Avoid writing to invalid memory in i386 unix dispatcher.
ntdll: Fix incorrect i386 call_user_mode_callback CFI.
ntdll: Avoid marking freed block header as undefined for valgrind.
ntdll: Force HEAP_TAIL_CHECKING_ENABLED flag with valgrind.
ntdll: Fix valgrind notifications from ntdll.so.
ntdll: Import valgrind headers for PE side ntdll.
ntdll: Maintain a PE module link map and expose it to GDB.
ntdll: Pass a UNICODE_STRING to load_builtin and virtual_map_image.
loader: Expose a shadow copy of ld.so link map to GDB.
ntdll: Add .cfi_signal_frame to __wine_syscall_dispatcher.
https://gitlab.winehq.org/wine/wine/-/merge_requests/1074
Windows 10 [received support](https://devblogs.microsoft.com/commandline/af_unix-comes-to-window… for AF_UNIX sockets in Insider Build 17063. This merge request adds basic support for AF_UNIX sockets to ws2_32 and wineserver.
Of particular note is the difficulty in handling `sun_path`. Most of the functions that allow for translating Windows paths to Unix paths are not accessible from ws2_32. I considered the following options:
* Pass the Windows path to wineserver and do the conversion there.
* This is, as far as I can tell, not possible without major rearchitecting. wineserver does not have functions to translate Windows paths to Unix paths, for obvious reasons.
* Obtain the current working directory of the requesting process and temporarily change directories to there.
* This only handles relative paths and fails for absolute paths, UNC paths, etc.
* Conditionally change directories based on whether the path is relative or not.
* This is error-prone and wineserver does not have the requisite functions to do this cleanly.
I ultimately decided to pass the translated Unix path to wineserver, which changes directories to `dirname(path)`. It then provides `bind` and `connect` with `basename(path)`. This is not threadsafe, but wineserver is not (currently) multithreaded.
Abstract sockets are supported by this patch.
--
v24: ws2_32/tests: Add test for AF_UNIX sockets.
server: Fix getsockname() and accept() on AF_UNIX sockets.
server: Introduce error when attempting to connect() to abstract AF_UNIX sockets.
server: Allow for deletion of socket files.
ws2_32: Add support for AF_UNIX sockets.
ntdll/unix: Add support for AF_UNIX sockets to multiple functions.
ws2_32: Add afunix.h header.
https://gitlab.winehq.org/wine/wine/-/merge_requests/2786
Windows 10 [received support](https://devblogs.microsoft.com/commandline/af_unix-comes-to-window… for AF_UNIX sockets in Insider Build 17063. This merge request adds basic support for AF_UNIX sockets to ws2_32 and wineserver.
Of particular note is the difficulty in handling `sun_path`. Most of the functions that allow for translating Windows paths to Unix paths are not accessible from ws2_32. I considered the following options:
* Pass the Windows path to wineserver and do the conversion there.
* This is, as far as I can tell, not possible without major rearchitecting. wineserver does not have functions to translate Windows paths to Unix paths, for obvious reasons.
* Obtain the current working directory of the requesting process and temporarily change directories to there.
* This only handles relative paths and fails for absolute paths, UNC paths, etc.
* Conditionally change directories based on whether the path is relative or not.
* This is error-prone and wineserver does not have the requisite functions to do this cleanly.
I ultimately decided to pass the translated Unix path to wineserver, which changes directories to `dirname(path)`. It then provides `bind` and `connect` with `basename(path)`. This is not threadsafe, but wineserver is not (currently) multithreaded.
Abstract sockets are supported by this patch.
--
v23: kernel32/tests: Extend console inheritance tests.
shell32: Don't show size for inaccessible drives in My Computer.
shell32: Show >4GB values in size columns of My Computer.
win32u: Remove duplicated d3dkmdt.h include.
user32: Remove no longer used setupapi import.
winex11: Set the window cursor immediately in SetCursor.
wineandroid: Set the window cursor immediately in SetCursor.
win32u: Notify drivers of cursor changes on WM_WINE_SETCURSOR.
win32u: Add a hwnd parameter to SetCursor driver entry points.
server: Introduce and send new WM_WINE_SETCURSOR hardware message.
server: Keep track of the current desktop cursor handle.
server: Update desktop cursor window when cursor pos changes.
ntdll: Make only the necessary pages writable in the ARM64EC code map.
ntdll: Load modules with a high base address in high memory.
ntdll: Allocate 64-bit and kernel stacks in high memory.
ntdll: Support the lower memory limit in MEM_ADDRESS_REQUIREMENTS.
server: Also enforce the size of varargs data structures.
kernel32/tests: Fix the PROCESS_BASIC_INFORMATION exit status type.
wineoss: Implement main_loop in unixlib.
winecoreaudio: Implement main_loop in unixlib.
winealsa: Implement main_loop in unixlib.
winepulse: Move main loop logic into mmdevapi.
uiautomationcore: Unconditionally match all events registered on the desktop node with a scope of subtree.
uiautomationcore: Implement UiaRaiseAutomationEvent.
uiautomationcore: Add support for cloning UiaCondition structures.
uiautomationcore: Clone UiaCacheRequest structure passed to UiaAddEvent.
uiautomationcore: Store all events in an event list.
wineps.drv: Use afm FamilyName instead of FullName.
win32u: Cleanup naming and log messages for QueryDisplayConfig.
win32u: Move QueryDisplayConfig from user32.
win32u: Move fullscreen window cursor clipping from winex11.
winex11: Move clip_fullscreen_window foreground check inside it.
win32u: Add a clipping_cursor member to user_thread_info.
win32u: Add a clipping_reset member to user_thread_info.
win32u: Move grab_pointer registry option from winex11.
winex11: Remove now unnecessary WM_X11DRV_CLIP_CURSOR_NOTIFY.
imm32: Avoid resizing IMCC to zero-size buffer.
winepulse: Return E_NOTIMPL when the property is not found.
winepulse: Don't overwrite the result in the insufficient buffer case.
wow64: Don't force wow64 dlls to load at low addresses.
winegcc: Fix an uninitialized variable warning in the PE build.
loader: Make the loader position-independent on 64-bit.
makefiles: Define WINE_UNIX_LIB for all files that are built for Unix.
include: Remove redundant __WINE_USE_MSVCRT checks.
windows.media.speech: Fix memory leak on error path in session_worker_thread_cb (scan-build).
server: Use hardware message category when checking filter.
server: Pass the message code to get_hardware_msg_bit.
user32: Add GetSystemDpiForProcess export.
ntdll: Allow RtlAllocateHeap to crash with invalid handle.
This merge request has too many patches to be relayed via email.
Please visit the URL below to see the contents of the merge request.
https://gitlab.winehq.org/wine/wine/-/merge_requests/2786
This MR supercedes !1895 as a solution to bug [#50771](https://bugs.winehq.org/show_bug.cgi?id=50771). Rather than fixing the problem of Wine's inability to modify the attributes of read-only files, this patch set instead implements `FILE_DISPOSITION_IGNORE_READONLY_ATTRIBUTE` which the Msys2 and Cygwin runtime libriries can use to avoid needing to modify attributes.
--
v2: ntdll: Implemented FILE_DISPOSITION_IGNORE_READONLY_ATTRIBUTE
ntdll/tests: Added tests for FILE_DISPOSITION_IGNORE_READONLY_ATTRIBUTE
https://gitlab.winehq.org/wine/wine/-/merge_requests/3073
This MR supercedes !1895 as a solution to bug [#50771](https://bugs.winehq.org/show_bug.cgi?id=50771). Rather than fixing the problem of Wine's inability to modify the attributes of read-only files, this patch set instead implements `FILE_DISPOSITION_IGNORE_READONLY_ATTRIBUTE` which the Msys2 and Cygwin runtime libriries can use to avoid needing to modify attributes.
--
https://gitlab.winehq.org/wine/wine/-/merge_requests/3073