session_request_sample() calls session_request_sample_from_node() and increments sink.requests only if that succeeds. But session_request_sample_from_node() calls session_deliver_sample_to_node() synchronously for MF_TOPOLOGY_TRANSFORM_NODE if there are output samples available. Then, if sink.requests is zero before this session_request_sample() call that sample is silently dropped.
It might not be easily noticeable currently, but I have a patchset which implements _ProcessMessage(MFT_MESSAGE_COMMAND_DRAIN) needed for some games (and also improving end of playback by fully delivering output including few last frames). And currently if session_deliver_sample_to_node() performs drain and that drain produces any samples we get a data sample processed but end marker silently dropped resulting in hanging session. That market gets to session_request_sample / session_request_sample_from_node but gets dropped in session_deliver_sample_to_node due to the reason first patch is fixing.
Thus also the second patch. I am not sure it is strictly needed, but the current handling of that seems fragile to me, I suppose we shouldn't ever drop markers.
--
v3: mf/session: Avoid dropping samples delivered from transform in session_request_sample_from_node().
https://gitlab.winehq.org/wine/wine/-/merge_requests/2012
This is the last piece that's needed for function calls to basically work.
--
v2: vkd3d-shader/hlsl: Allow the final expression in a for loop initializer to be omitted.
vkd3d-shader/hlsl: Handle early return after a CF block only if there was actually a return somewhere in the CF block.
vkd3d-shader/hlsl: Inline function calls.
vkd3d-shader/hlsl: Emit a hlsl_fixme() for unhandled instruction types when writing bytecode.
vkd3d-shader/hlsl: Lower return statements.
vkd3d-shader/hlsl: Emit a hlsl_fixme() if multiple valid entry point definitions are given.
vkd3d-shader/hlsl: Skip functions that don't have a body when looking for the entry point.
tests: Avoid performing a multi-component UAV load in uav-out-param.shader_test.
https://gitlab.winehq.org/wine/vkd3d/-/merge_requests/85
Convert all consecutive calls to d7_DrawPrimitive(TRIANGLE_FAN) into
a single call to d7_DrawPrimitive(TRIANGLE_LIST) with all the vertices.
Note, it *increase* the number of vertices, but bandwith is much less costly
than multiple calls.
Note, only a very precise subset of the calls get buffered in order to
ensure that the disruption is minimal.
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=33814
--
v8: ddraw: Convert buffer API to use d3d_device struct
ddraw: Also Buffer D3DPT_POINTLIST
ddraw: directly buffering in the streaming buffer
https://gitlab.winehq.org/wine/wine/-/merge_requests/2105
session_request_sample() calls session_request_sample_from_node() and increments sink.requests only if that succeeds. But session_request_sample_from_node() calls session_deliver_sample_to_node() synchronously for MF_TOPOLOGY_TRANSFORM_NODE if there are output samples available. Then, if sink.requests is zero before this session_request_sample() call that sample is silently dropped.
It might not be easily noticeable currently, but I have a patchset which implements _ProcessMessage(MFT_MESSAGE_COMMAND_DRAIN) needed for some games (and also improving end of playback by fully delivering output including few last frames). And currently if session_deliver_sample_to_node() performs drain and that drain produces any samples we get a data sample processed but end marker silently dropped resulting in hanging session. That market gets to session_request_sample / session_request_sample_from_node but gets dropped in session_deliver_sample_to_node due to the reason first patch is fixing.
Thus also the second patch. I am not sure it is strictly needed, but the current handling of that seems fragile to me, I suppose we shouldn't ever drop markers.
--
v2: mf/session: Avoid dropping samples delivered from transform in session_request_sample_from_node().
https://gitlab.winehq.org/wine/wine/-/merge_requests/2012
Not completely sure if it's worth having for 8.0, but opening this to share the target I'm trying to reach.
--
v8: ntdll: Add a thread-specific category group cache.
ntdll: Use atomics and lock-free list for category groups.
ntdll: Implement Low Fragmentation Heap frontend.
ntdll: Split heap_resize_block into heap_resize_(block|large) helpers.
ntdll: Count allocations and automatically enable LFH.
ntdll: Increase heap block tail_size capacity to 16 bits.
ntdll: Implement HeapCompatibilityInformation.
ntdll: Fix HeapWalk with empty uncommitted consecutive subheaps.
https://gitlab.winehq.org/wine/wine/-/merge_requests/1628
WinRT apps check if the Windows theme is set to dark mode through IUISettings3::GetColorValue().
An option needs to be added to Winecfg to enable dark mode support, which just sets the registry key AppsUseLightTheme to 0 for dark mode and 1 for light mode. It will have to be in a separate merge request. Also, not sure if a dark mode checkbox should be added or if dark mode should be automatically set based on the loaded theme in Wine. Though, for the latter there needs to be a property that returns the mode of the theme. Name alone might not be sufficient.
--
v4: windows.ui: Implement IUISettings3::GetColorValue().
windows.ui/tests: Add IUISettings3::GetColorValue() tests.
windows.ui: Add IUISettings3 stub interface.
windows.ui: Add stub DLL.
include: Add windows.ui.viewmanagement.idl file.
https://gitlab.winehq.org/wine/wine/-/merge_requests/2103
--
v2: riched20/tests: Add retry loop around OpenClipboard() to avoid access denial.
riched20: Ensure clipboard has been pasted before testing the result.
riched20: Support SFF_SELECTION when streaming in plain text.
riched20/tests: Add tests when pasting in plain text mode.
https://gitlab.winehq.org/wine/wine/-/merge_requests/2138
--
v6: wpcap/tests: Initial tests.
wpcap: Try to enable 32-bit mmap() support in libpcap.
wpcap: Add wow64 thunks.
wpcap: Enable UTF-8 encoding in libpcap.
wpcap: Reimplement pcap_loop() on top of pcap_next_ex().
wpcap: Implement pcap_init().
wpcap: Implement pcap_dump_close().
wpcap: Implement pcap_bufsize().
wpcap: Fix an off-by-one error in convert_length_to_ipv6_mask().
wpcap: Make Unix call parameters wow64 compatible.
wpcap: Sync spec file with latest version of libpcap.
configure: Check for pcap_init() instead of pcap_create().
https://gitlab.winehq.org/wine/wine/-/merge_requests/2123
--
v5: wpcap/tests: Initial tests.
wpcap: Try to enable 32-bit mmap() support in libpcap.
wpcap: Add wow64 thunks.
wpcap: Enable UTF-8 encoding in libpcap.
wpcap: Reimplement pcap_loop() on top of pcap_next_ex().
wpcap: Implement pcap_init().
wpcap: Implement pcap_dump_close().
wpcap: Implement pcap_bufsize().
wpcap: Fix an off-by-one error in convert_length_to_ipv6_mask().
wpcap: Make Unix call parameters wow64 compatible.
wpcap: Sync spec file with latest version of libpcap.
configure: Check for pcap_init() instead of pcap_create().
https://gitlab.winehq.org/wine/wine/-/merge_requests/2123
Convert all consecutive calls to d7_DrawPrimitive(TRIANGLE_FAN) into
a single call to d7_DrawPrimitive(TRIANGLE_LIST) with all the vertices.
Note, it *increase* the number of vertices, but bandwith is much less costly
than multiple calls.
Note, only a very precise subset of the calls get buffered in order to
ensure that the disruption is minimal.
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=33814
--
v7: ddraw: avoid magic fvf number
https://gitlab.winehq.org/wine/wine/-/merge_requests/2105
Convert all consecutive calls to d7_DrawPrimitive(TRIANGLE_FAN) into
a single call to d7_DrawPrimitive(TRIANGLE_LIST) with all the vertices.
Note, it *increase* the number of vertices, but bandwith is much less costly
than multiple calls.
Note, only a very precise subset of the calls get buffered in order to
ensure that the disruption is minimal.
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=33814
--
v6: ddraw: avoid magic fvf number
ddraw: using d3d_device7_DrawIndexedPrimitive()
https://gitlab.winehq.org/wine/wine/-/merge_requests/2105
Normalise the incoming vkd3d_shader_instruction IR to the shader model 6 pattern where only one patch constant function is emitted. This allows generation of a single patch constant function in SPIR-V.
--
v5: vkd3d-shader: Introduce an internal sm6 signature structure.
vkd3d-shader/spirv: Move the function declaration from spirv_compiler_begin_shader_phase() to spirv_compiler_enter_shader_phase().
vkd3d-shader/spirv: Remove the hull shader phase array.
vkd3d-shader/spirv: Merge all shader IR fork and join phases into a single phase.
https://gitlab.winehq.org/wine/vkd3d/-/merge_requests/84
Sorry to let this stagnate for months, but I can confirm that an NVidia GPU which exposes 32768 as a limit for Vulkan will still refuse to create d3d12 textures with a dimension larger than 16384, even with feature level 12.1. (And it still exposes 16384 as a limit for d3d9). Given that, I think the right thing to do is just add a test that the limit is no higher than 16384, and probably also cap this in wined3d rather than ddraw.
--
https://gitlab.winehq.org/wine/wine/-/merge_requests/126#note_23674
I took some time to look into this to see if there's extra overhead, and while I think there are some things we could do better in draw_primitive(), there's probably not very much. Depending on what's in frame, the CS spends the majority of its time in draw_primitive(). Probably about 20% of that is spent acquiring the GL context, 40% loading the RTVs, 20% in context_apply_draw_state(); the rest is difficult to measure. This is on a relatively powerful radeonsi machine, with the swap interval hacked to zero; the total frame time is probably about 9 ms in the scenes I'm testing.
I think we can potentially cut draw_primitive() down to 10% of its current overhead if none of the state changes, but when we're doing 5000 draw calls per frame, even that may be too much. We could potentially buffer in wined3d, perhaps making use of EXT_multi_draw_arrays, but as Henri pointed out on IRC, we'd have to do a fair amount of work to invalidate (less than in ddraw itself), and this sort of thing probably doesn't perform well in newer d3d versions on Windows anyway. So buffering in ddraw is probably the right way to go. I'll look at the patch itself anon.
--
https://gitlab.winehq.org/wine/wine/-/merge_requests/2105#note_23673
First part of v2 of !27, which aims to:
* Allow allocation of variables of complex types that contain both numerics and objects across multiple register sets (regsets).
* Support the tex2D and tex3D intrinsics, inferring generic samplers dimension from usage, writing sampler declarations, and writing sample instructions.
* Support for arrays of resources for both SM1 and SM4 (not to be confused with the resource-arrays of SM 5.1, which can have non-constant indexes).
* Support for resources declared within structs.
* Support for synthetic combined samplers for SM1 and synthetic separated samplers for SM4, considering that they can be arrays or members of structs.
* Imitate the way the native compiler assigns the register indexes of the resources on allocation, which proved to be the most difficult thing.
* Support for object components within complex input parameters.
* Small fixes to corner cases.
This part consists on parsing the `tex2D()` and `tex3D()` intrinsics and beginning to support the allocation of variables across multiple regsets.
The whole series, is on my [master6](https://gitlab.winehq.org/fcasas/vkd3d/-/commits/master6) branch.
--
v7: vkd3d-shader/hlsl: Allocate register reservations in a separate pass.
vkd3d-shader/hlsl: Respect object reservations even if the object is unused.
vkd3d-shader/hlsl: Allocate objects according to register set.
vkd3d-shader/hlsl: Keep an hlsl_reg for each register set in hlsl_ir_var.
vkd3d-shader/hlsl: Store the type's register size for each register set.
https://gitlab.winehq.org/wine/vkd3d/-/merge_requests/66
On Windows it seems sending to port 0 does nothing and does not error.
Presently sendmsg errors with EINVAL.
This works around it, by checking if it's port 0 then skipping the data.
--
v16: ntdll: Do not send data to port 0.
https://gitlab.winehq.org/wine/wine/-/merge_requests/2100
Without the changes, the test passes or fails based on the binutils version being used. v2.35 (used on the Debian 11 testbot) gives 64-bit DLLs an image base under 4GB, and the test always passes. On a system with binutils 2.37 or later, 64-bit DLLs are based above 4GBs, and the test will fail.
The map_view() change fixes native DLLs, and virtual_map_section() for
builtin DLLs. I wasn't sure how to test a native DLL.
This showed up under Wow64 when running the 64-bit Notepad++ installer
(a 32-bit EXE), which runs 32-bit regsvr32 to register a 64-bit DLL.
regsvr32 calls LoadLibraryExW() with LOAD_LIBRARY_AS_IMAGE_RESOURCE,
which was returning a truncated pointer to the DLLs base address.
Accessing this then crashed.
--
v2: ntdll: Respect zero_bits/limit when mapping a PE file.
ntdll/tests: Test NtMapViewOfSection with a 64-bit DLL and zero_bits > 31.
https://gitlab.winehq.org/wine/wine/-/merge_requests/269
On Windows it seems sending to port 0 does nothing and does not error.
Presently sendmsg errors with EINVAL.
This works around it, by checking if it's port 0 then skipping the data.
--
v17: ntdll: Do not send data to port 0.
https://gitlab.winehq.org/wine/wine/-/merge_requests/2100
Multiple fork and join phases are eliminated. Signature elements are merged where required, and all input/output parameters are rewritten.
--
v3: vkd3d-shader/spirv: Move the function declaration from spirv_compiler_begin_shader_phase() to spirv_compiler_enter_shader_phase().
vkd3d-shader/spirv: Remove the hull shader phase array.
vkd3d-shader/spirv: Merge all shader IR fork and join phases into a single phase.
https://gitlab.winehq.org/wine/vkd3d/-/merge_requests/84
This patch addresses an issue in Second Life and potentially other
multi-threaded applications which process WM_KEYDOWN in one thread
and then verify that the key is "still down" with GetAsyncKeyState
from another thread. Wine uses a per-thread key cache, resulting
in inconsistent views of key status. Caches are now invalidated
when an input event is injected by the driver or via SendInput.
--
https://gitlab.winehq.org/wine/wine/-/merge_requests/2153
While running in XCode's profiler, I noticed memory leaks when safearrays were used in `For Each` statements.
The following code would leak a safearray allocation:
```
For Each obj In vpDict.Keys : Debug.Print "Key" : Next
```
This following code does not leak:
```
Dim x
x = vpDict.Keys
For Each obj In x : Debug.Print "Key" : Next
```
Fixes: https://bugs.winehq.org/show_bug.cgi?id=54456
--
v3: vbscript: Fix memory leak in owned safearray iterator
https://gitlab.winehq.org/wine/wine/-/merge_requests/2141
I ran into a script where someone placed a `:` on a new line after an `Else` but before another statement:
```
Else
: VelCoef = LinearEnvelope(BallPos, VelocityIn, VelocityOut)
if Enabled then aBall.Velx = aBall.Velx*VelCoef
if Enabled then aBall.Vely = aBall.Vely*VelCoef
end if
```
I confirmed that this is allowed and works.
I've updated the grammar, and replaced `NL` with `StSep_opt` as it seems to cover all the bases.
Fixes: https://bugs.winehq.org/show_bug.cgi?id=54234
--
v2: vbscript: fix compile when colon follows Else on new line
https://gitlab.winehq.org/wine/wine/-/merge_requests/2142
wine-gecko does actually support synchronous XMLHttpRequests, even if they are deprecated, but unfortunately it is very broken compared to IE or all the other major browsers (more details [here](https://bugzilla.mozilla.org/show_bug.cgi?id=697151)). Thankfully, it still provides us with the event message loop, which is enough to fix it on mshtml side and act like IE.
For sync XHRs, send() is supposed to block all script code, except for notifications sent to the sync XHR. This is because when send() blocks, no other piece of code in the script should execute other than the sync XHR handlers. Unfortunately, that's not the case in Gecko's broken implementation, which can execute handlers as if they were APCs while it's "blocked" in send().
Note that it doesn't actually block, though, because we still process the message loop (non-event related tasks such as navigation, paints, and other stuff), and that's normal. Gecko doesn't block everything related to script events, only some things on the document and timers, but that's far from enough and not even enough for our purposes since we use our own timer tasks. And not even message events are blocked, even though we *also* use our own message event dispatchers (but it doesn't block Gecko ones either).
So what we have to do is we need to track all the timers and events dispatched that result in script handlers being executed, while "blocking" inside of a sync XHR send(), and queue them up to defer them to be dispatched later, after send() unblocks. But this is easier said that done. There are many corner cases to consider here, for example:
* Events dispatched *synchronously* from within a sync XHR handler or other piece of code called from it.
* Nested sync XHR send() calls (called during handler of another sync XHR).
* Async XHRs having their events dispatched during a blocking sync XHR send() are complicated. `readyStateChange` for example needs to have the async XHR's readyState at the time it was sent, **not** at the time it was actually dispatched, since we're going to delay it and dispatch it later. It's similar with other XHR states, such as responseText (which can be partial).
* Aborts of async XHRs during such handlers.
These patches hopefully should address all the issues and, on a high level, work like this:
* Track the `readyState` and `responseText` length manually, so we can override / force them to specific values.
* "Snapshot" the async XHR at the time we encounter an event for it, and queue this event with such information. When later dispatching this event (after being deferred), we temporarily set the state of the async XHR to the snapshot.
* To deal with nested event dispatches, keep track of a "dispatch depth" (everytime we dispatch an event we increase the depth, and when it returns we decrease it).
* For sync XHRs, we note the depth when send() is called, and defer events at that depth, since they're dispatched during the "blocked" message loop and need to be delayed (except for sync XHR events, which is a special case since it must be dispatched synchronously). When it returns, we restore the previous blocking depth.
--
v2: mshtml: Send all readystatechange events for synchronous XHRs in IE9
mshtml: Implement synchronous XMLHttpRequest.
mshtml: Track responseText's length in XHRs and report it manually.
mshtml: Track readyState in XHRs and report it manually.
mshtml: Pass optional args to XMLHttpRequest.open() correctly.
https://gitlab.winehq.org/wine/wine/-/merge_requests/2098
I ran into a script where someone placed a `:` on a new line after an `Else` but before another statement:
```
Else
: VelCoef = LinearEnvelope(BallPos, VelocityIn, VelocityOut)
if Enabled then aBall.Velx = aBall.Velx*VelCoef
if Enabled then aBall.Vely = aBall.Vely*VelCoef
end if
```
I confirmed that this is allowed and works.
I've updated the grammar, and replaced `NL` with `StSep_opt` as it seems to cover all the bases.
Fixes: https://bugs.winehq.org/show_bug.cgi?id=54234
--
https://gitlab.winehq.org/wine/wine/-/merge_requests/2142
While running in XCode's profiler, I noticed memory leaks when safearrays were used in `For Each` statements.
The following code would leak a safearray allocation:
```
For Each obj In vpDict.Keys : Debug.Print "Key" : Next
```
This following code does not leak:
```
Dim x
x = vpDict.Keys
For Each obj In x : Debug.Print "Key" : Next
```
Fixes: https://bugs.winehq.org/show_bug.cgi?id=54456
--
v2: vbscript: Fix memory leak in owned safearray iterator
https://gitlab.winehq.org/wine/wine/-/merge_requests/2141
Not completely sure if it's worth having for 8.0, but opening this to share the target I'm trying to reach.
--
v7: ntdll: Add a thread-specific category group cache.
ntdll: Use atomics and lock-free list for category groups.
ntdll: Implement Low Fragmentation Heap frontend.
ntdll: Split heap_resize_block into heap_resize_(block|large) helpers.
ntdll: Count allocations and automatically enable LFH.
ntdll: Increase heap block tail_size capacity to 16 bits.
ntdll: Implement HeapCompatibilityInformation.
ntdll: Fix HeapWalk with empty uncommitted consecutive subheaps.
https://gitlab.winehq.org/wine/wine/-/merge_requests/1628
Multiple fork and join phases are eliminated. Signature elements are merged where required, and all input/output parameters are rewritten.
--
v2: vkd3d-shader/trace: Trace the normalised instruction array after tracing the input.
vkd3d-shader/spirv: Normalise signatures and input/output registers to the Shader Model 6 pattern.
https://gitlab.winehq.org/wine/vkd3d/-/merge_requests/84
On Windows it seems sending to port 0 does nothing and does not error.
Presently sendmsg errors with EINVAL.
This works around it, by checking if it's port 0 then skipping the data.
--
v15: ntdll: Do not send data to port 0.
https://gitlab.winehq.org/wine/wine/-/merge_requests/2100
On Windows it seems sending to port 0 does nothing and does not error.
Presently sendmsg errors with EINVAL.
This works around it, by checking if it's port 0 then skipping the data.
--
v14: ntdll: Do not send data to port 0.
https://gitlab.winehq.org/wine/wine/-/merge_requests/2100
> > but we could return it from the send_socket server request
>
> Where would I look into this I see the 'macro' call inside `sock_send`, but looking at `send_socket_reply` does not seem to have an protocol attached?
It's automatically generated. You'd need to edit protocol.def and then run tools/make_requests.
--
https://gitlab.winehq.org/wine/wine/-/merge_requests/2100#note_23545
On Windows it seems sending to port 0 does nothing and does not error.
Presently sendmsg errors with EINVAL.
This works around it, by checking if it's port 0 then skipping the data.
--
v11: ntdll: Do not send data to port 0.
https://gitlab.winehq.org/wine/wine/-/merge_requests/2100
> but we could return it from the send_socket server request
Where would I look into this I see the 'macro' call inside `sock_send`, but looking at `send_socket_reply` does not seem to have an protocol attached?
--
https://gitlab.winehq.org/wine/wine/-/merge_requests/2100#note_23543
On Windows it seems sending to port 0 does nothing and does not error.
Presently sendmsg errors with EINVAL.
This works around it, by checking if it's port 0 then skipping the data.
--
v10: ntdll: Do not send data to port 0.
ws2_32/tests: Check if sending to port 0 succeeds.
https://gitlab.winehq.org/wine/wine/-/merge_requests/2100
On Windows it seems sending to port 0 does nothing and does not error.
Presently sendmsg errors with EINVAL.
This works around it, by checking if it's port 0 then skipping the data.
--
v12: ntdll: Do not send data to port 0.
https://gitlab.winehq.org/wine/wine/-/merge_requests/2100
While running in XCode's profiler, I noticed memory leaks when safearrays were used in `For Each` statements.
The following code would leak a safearray allocation:
```
For Each obj In vpDict.Keys : Debug.Print "Key" : Next
```
This following code does not leak:
```
Dim x
x = vpDict.Keys
For Each obj In x : Debug.Print "Key" : Next
```
Fixes: https://bugs.winehq.org/show_bug.cgi?id=54456
--
https://gitlab.winehq.org/wine/wine/-/merge_requests/2141
On Wed Feb 8 21:41:13 2023 +0000, Alex Henrie wrote:
> I thought we still cared about XP and later (that's what the testbot
> supports). Has that changed?
WTB might support XP and Vista but those aren't part of the default test set.
Nor are they shown on https://test.winehq.org/data/ .
The winetest/dissect utility though doesn't marks them as prediluvian.
--
https://gitlab.winehq.org/wine/wine/-/merge_requests/2128#note_23521
Sorry, accidentally hit send before I was done writing. Continuing:
> + DWORD bytesSent = 0;
Not to bikeshed style, but being consistent within the same code would at least be appreciated. (And in new code we tend to avoid camel case.)
> + s = socket(AF_INET, SOCK_DGRAM, 0);
Let's explicitly use IPPROTO_UDP here, please. It's also possible to create raw or ICMP DGRAM sockets, for which sending to port zero actually does something.
> + todo_wine ok(bytesSent == sizeof(buf), "Failed to send full data(%lu) only sent(%lu)\n", (unsigned long) sizeof(buf), (unsigned long) bytesSent);
No need to cast; you can use %Iu for expressions of type size_t, and %lu for DWORD.
From patch 2/2:
> +static int is_port0( const union unix_sockaddr *uaddr)
This returns BOOL.
> +{
> + switch (uaddr->addr.sa_family)
> + {
> + case AF_INET:
> + {
> + return uaddr->in.sin_port == 0;
> + }
> +
> + case AF_INET6:
> + {
> + return uaddr->in6.sin6_port == 0;
> + }
> +
No need for these braces.
> + #ifdef HAS_IPX
> + case AF_IPX:
> + {
> + return uaddr->ipx.sipx_port == 0;
> + }
> + #endif
Is this right? Unless we can confirm it's correct I'd leave this out.
> +
> + #ifdef HAS_IRDA
> + case AF_IRDA:
> + {
> + return FALSE;
> + }
> + #endif
> +
> + case AF_UNSPEC:
> + return FALSE;
There's no need for these; the default case already covers this.
> +
> + default:
> + return FALSE;
> + }
> +}
> @@ -1018,6 +1053,7 @@ static NTSTATUS try_send( int fd, struct async_send_ioctl *async )
> hdr.msg_iov = async->iov + async->iov_cursor;
> hdr.msg_iovlen = async->count - async->iov_cursor;
>
> +
> while ((ret = sendmsg( fd, &hdr, async->unix_flags )) == -1)
> {
> if (errno == EISCONN)
Spurious whitespace change here.
> @@ -1028,7 +1064,24 @@ static NTSTATUS try_send( int fd, struct async_send_ioctl *async )
> else if (errno != EINTR)
> {
> if (errno != EWOULDBLOCK) WARN( "sendmsg: %s\n", strerror( errno ) );
> - return sock_errno_to_status( errno );
> +
> + if(errno == EINVAL && is_port0(&unix_addr)){
> +
> + /*
> + * Some Windows applications(Spellforce 3 is known to) send to port 0.
> + * This causes 'sendmsg' to throw a EINVAL error on Windows this does nothing but consume the data.
> + * This workaround says we successfully sent data even though we didnt send anything.
> + * Matching the Windows behaviour, making the program work(in theory).
> + */
Comment spacing is mangled here.
> + ret = 0;
> + for(ssize_t i = 0; i < hdr.msg_iovlen; i++){
> + ret += hdr.msg_iov[i].iov_len;
> + }
> + WARN("Attempting to send to port 0, skipping over %zd bytes\n", ret);
> + break;
> + }else{
> + return sock_errno_to_status( errno );
> + }
> }
This works, but I'm not sure it's the place we want to handle this. For one thing, I'm not sure all platforms are going to return EINVAL here.
Probably better is to either handle it in try_send() before sending, or handle it in sock_send() in about the same place. (I think it'd need to be after the server call, though I haven't properly checked whether the server needs to do anything important here.) Note that you'll also explicitly want to check the protocol here in that case, so we only catch UDP sockets with this logic.
Also, please try to match the surrounding code style wrt things like brace placement and spacing.
--
https://gitlab.winehq.org/wine/wine/-/merge_requests/2100#note_23505
The prefix of patch 1/2 should be changed to "ws2_32/tests". The subject is not quite a grammatical sentence; I'd just write "Check if sending to port 0 succeeds."
> + char buf[12] = "hello world";
No reason to specify the buffer size; you can just write "char buf[]".
> + DWORD bytesSent = 0;
--
https://gitlab.winehq.org/wine/wine/-/merge_requests/2100#note_23489
QueryInterface should set *out to NULL on failure, as it seems to do in many different places.
This seems to be a regression from !888.
One old game started to crash on startup with this merge request.
I bisected it and it pointed to the commit 131ada052a2dbec66df695ce536ca048a2bd9174.
--
v4: wmvcore/tests: check out value for NULL in check_interface
https://gitlab.winehq.org/wine/wine/-/merge_requests/2130
On Wed Feb 8 19:01:54 2023 +0000, **** wrote:
> Paul Gofman replied on the mailing list:
> ```
> On 2/8/23 12:55, Rémi Bernon (@rbernon) wrote:
> >
> > USR1 / USR2 / INT for instance could be blocked in non-Wine threads,
> raising them again until they reach a Wine thread.
> I think USR1 may only be received by a non-Wine thread if it was
> originated by some native library and not by wineserver which sends that
> only to threads it knows? In that case, not sure how that can be handled
> better in a Wine thread?
> Also, is there a good way to block signals in threads which are created
> by native libraries, I think we don't know anything about those threads?
> ```
Yes, what Paul said. If a non-Wine thread gets USR1 or USR2 it didn't come from us, and handing it to a Wine thread is not going to do the right thing.
Note that signal masks are per-thread, but according to my understanding signal *actions* aren't.
QUIT is supposed to kill the entire process by default, not just a thread, so just killing that thread doesn't seem right. I suppose we *could* exit() in that case, but QUIT also dumps core by default, so it doesn't seem quite right to do a clean exit either. At least not right enough to be worth the extra complexity.
Rethrowing INT to a Wine thread is... nontrivial, but possible, I guess? I'd rather leave it for a follow-up patch if it's really worth doing.
--
https://gitlab.winehq.org/wine/wine/-/merge_requests/2126#note_23484
On Wed Feb 8 18:55:31 2023 +0000, Zebediah Figura wrote:
> > Should we really crash on any unexpected signal?
> All of the signals we catch are signals for which the default action
> specified by POSIX is to terminate. In the case of TRAP, SEGV, ILL, BUS
> we have no choice. That might be true for FPE too but I can't remember;
> but either way, either the program was expecting an exception and won't
> get it, or it was going to crash anyway.
> In the case of ABRT, QUIT, INT not terminating seems like the wrong
> thing to do (and we can't handle them the normal way because we don't
> have a TEB and can't contact the server).
> We could potentially ignore USR1 and USR2, but that doesn't seem great
> for stability. Whatever was sending them had a reason to do so, and
> isn't going to function correctly.
> Perhaps more saliently, we were already crashing on unexpected signals,
> simply by virtue of trying to access the TEB and then dereferencing it.
> This patch just makes it more obvious.
Well we currently crash indeed but I don't think it is intentional. Making it explicit would make it look more like it is.
I'd think that instead we should block the signals in the threads that cannot handle them, or handle them in a way that doesn't require a TEB.
USR1 / USR2 / INT for instance could be blocked in non-Wine threads, raising them again until they reach a Wine thread. I think QUIT should be handled properly by calling `pthread_cancel` or `pthread_exit` and letting the thread cleanup properly.
--
https://gitlab.winehq.org/wine/wine/-/merge_requests/2126#note_23475
Without this patch the process will silently die.
I managed to trigger this while trying to trace Child of Light with Renderdoc,
the latter of which crashed in its own "TargetControlServerThread".
This, confusingly, manifested in the game restarting itself without the Ubisoft
overlay; apparently the game or one of its launchers was capable of recognizing
when the process had died and restarting it, but would not try to inject the
overlay a second time. I have not investigated the cause of the crash; it is not
unlikely that it resulted from the overlay injection (despite the fact that that
should only directly affect PE code.)
--
https://gitlab.winehq.org/wine/wine/-/merge_requests/2126
While running in XCode's profiler, I noticed two memory leaks in `interp_redim_preserve`.
After looking at `interp_redim`, the `bounds` structure is freed.
I've updated `interp_redim_preserve` to free `bounds` when the array is NULL and not NULL.
--
v5: vbscript: Fix memory leak in Split()
https://gitlab.winehq.org/wine/wine/-/merge_requests/2132
While running in XCode's profiler, I noticed two memory leaks in `interp_redim_preserve`.
After looking at `interp_redim`, the `bounds` structure is freed.
I've updated `interp_redim_preserve` to free `bounds` when the array is NULL and not NULL.
--
v4: vbscript: Fix memory leak in interp_redim_preserve
https://gitlab.winehq.org/wine/wine/-/merge_requests/2132
The Rutoken driver installer tries to start this service, and fails if it
doesn't exist.
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=54396
--
v2: scardsvr: Add stub service.
wine.inf: Always use FLG_ADDREG_APPEND for SvcHost entries.
setupapi: Create the registry value if it doesn't exist in append_multi_sz_value().
setupapi: Fail installation when trying to append to a registry value of the wrong type.
setupapi/tests: Add tests for FLG_ADDREG_APPEND.
https://gitlab.winehq.org/wine/wine/-/merge_requests/2073
Because of the change introduced in f21693b2, SM1 scalars and vectors were not longer getting the correct writemask when they are allocated, so this is fixed.
Also, the mapping of sm1 src register swizzles is moved outside `write_sm1_instruction()` since there are some instructions that don't do this, remarkably dp2add. This is fixed.
Before the last patch we are writing the operation as:
```
dp2add r0.x, r1.x, r0.x, r2.x
```
and now it is:
```
dp2add r0.x, r1.xyxx, r0.xyxx, r2.x
```
dp2add now has its own function, `write_sm1_dp2add()`, since it seems to
be the only instruction with this structure.
Ideally we would be using the default swizzles for the first two src arguments:
```
dp2add r0.x, r1, r0, r2.x
```
since, according to native's documentation, these are supported for all sm < 4.
But using default swizzles whenever is possible -- along with following the conversion of repeating the
last component of the swizzle when fewer than 4 components are to be
specified -- has a higher scope. Probably would involve modifying
`hlsl_swizzle_from_writemask()` and `hlsl_map_swizzle()`.
--
v3: vkd3d-shader/hlsl: Fix SM1 dp2add swizzles.
vkd3d-shader/hlsl: Map SM1 src swizzles outside write_sm1_instruction().
vkd3d-shader/hlsl: Set writemasks correctly for SM1 scalar and vector types.
vkd3d-shader/hlsl: Expect component count in allocate_register().
vkd3d-shader/hlsl: Rename 'component_count' arguments to 'reg_size'.
https://gitlab.winehq.org/wine/vkd3d/-/merge_requests/81
While running in XCode's profiler, I noticed a memory leak in `Global_Split`.
When the strings are being copied into the SafeArray, the `BSTR` is not freed after `VariantCopyInd`.
--
v4: vbscript: Fix memory leak in Split()
https://gitlab.winehq.org/wine/wine/-/merge_requests/2131
QueryInterface should set *out to NULL on failure, as it seems to do in many different places.
This seems to be a regression from !888.
One old game started to crash on startup with this merge request.
I bisected it and it pointed to the commit 131ada052a2dbec66df695ce536ca048a2bd9174.
--
v3: wmvcore/tests: check out value for NULL in check_interface
https://gitlab.winehq.org/wine/wine/-/merge_requests/2130
While running in XCode's profiler, I noticed a memory leak in `Global_Split`.
When the strings are being copied into the SafeArray, the `BSTR` is not freed after `VariantCopyInd`.
--
v3: vbscript: Fix memory leak in Split()
https://gitlab.winehq.org/wine/wine/-/merge_requests/2131
While running in XCode's profiler, I noticed a memory leak in `Global_Split`.
When the strings are being copied into the SafeArray, the `BSTR` is not freed after `VariantCopyInd`.
--
https://gitlab.winehq.org/wine/wine/-/merge_requests/2131
While running in XCode's profiler, I noticed two memory leaks in `interp_redim_preserve`.
After looking at `interp_redim`, the `bounds` structure is freed.
I've updated `interp_redim_preserve` to free `bounds` when the array is NULL and not NULL.
--
v3: vbscript: Fix memory leak in interp_redim_preserve
https://gitlab.winehq.org/wine/wine/-/merge_requests/2132
Jinoh Kang (@iamahuman) commented about dlls/ntdll/rtl.c:
> + * the 32-bit addition above to handle.
> + *
> + * This produces an integer in the range [0x7fffffe2, 0xfffffffe].
> + */
> + result = 0x7fffffffu * 2 - result;
> +
> + /* Perform the 2nd round of the modulus calculation.
> + * This produces an integer in the range [0, 0x7fffffff].
> + */
> + result = (result & 0x7fffffffu) + (result >> 31);
> +
> + /* If result is 0x7fffffff, set it to 0. We avoid branching here so that
> + * RtlUniform runs in near-constant time. This also avoids unexpected
> + * performance hit due to polluted branch target buffer.
> + */
> + result &= -((0x7fffffffu * 2 - result) >> 31);
If we assume that the right shift operator is always defined as arithmetic shift, we can optimize it further:
```suggestion:-0+0
result &= (LONG)(0x7fffffffu * 2 - result) >> 31;
```
That said, GCC (https://godbolt.org/z/65od5ErMo) does this optimization already. Meanwhile clang (https://godbolt.org/z/46x8a8r9v) seems to recognize the trick and replace it with `inc + cmovns` (since `0x7fffffff + 1` is `0x80000000` which sets SF).
--
https://gitlab.winehq.org/wine/wine/-/merge_requests/821#note_23433
QueryInterface should set *out to NULL on failure, as it seems to do in many different places.
This seems to be a regression from !888.
One old game started to crash on startup with this merge request.
I bisected it and it pointed to the commit 131ada052a2dbec66df695ce536ca048a2bd9174.
--
v2: wmvcore/tests: check out value in check_interface
https://gitlab.winehq.org/wine/wine/-/merge_requests/2130
While running in XCode's profiler, I noticed two memory leaks in `interp_redim_preserve`.
After looking at `interp_redim`, the `bounds` structure is freed.
I've updated `interp_redim_preserve` to free `bounds` when the array is NULL and not NULL.
--
https://gitlab.winehq.org/wine/wine/-/merge_requests/2132