With this commit the following functions were implemented:
- _mbsupr_s_l - converts multibyte string to uppercase, by using specified locale that's passed in.
- _mbslwr_s_l - converts multibyte string to lowercase, by using specified locale that's passed in.
- _mbctolower_l - converts multibyte uppercase character to lowercase character, by using specified locale that's passed in.
- _mbctoupper_l - converts multibyte lowercase character to uppercase character, by using specified locale that's passed in.
More information about these methods are available at:
https://learn.microsoft.com/en-us/cpp/c-runtime-library/reference/strupr-s-…
After applying the patch the crash of the ChessBase application was fixed.
More information:
https://bugs.winehq.org/show_bug.cgi?id=45273
--
v3: msvcrt: implement missing CRT functions to fix ChessBase 14 crash
https://gitlab.winehq.org/wine/wine/-/merge_requests/1080
With this commit the following functions were implemented:
- _mbsupr_s_l - converts multibyte string to uppercase, by using specified locale that's passed in.
- _mbslwr_s_l - converts multibyte string to lowercase, by using specified locale that's passed in.
- _mbctolower_l - converts multibyte uppercase character to lowercase character, by using specified locale that's passed in.
- _mbctoupper_l - converts multibyte lowercase character to uppercase character, by using specified locale that's passed in.
More information about these methods are available at:
https://learn.microsoft.com/en-us/cpp/c-runtime-library/reference/strupr-s-…
After applying the patch the crash of the ChessBase application was fixed.
More information:
https://bugs.winehq.org/show_bug.cgi?id=45273
--
v2: msvcrt: implement missing CRT functions to fix ChessBase 14 crash
https://gitlab.winehq.org/wine/wine/-/merge_requests/1080
With this commit the following functions were implemented:
- _mbsupr_s_l - converts multibyte string to uppercase, by using specified locale that's passed in.
- _mbslwr_s_l - converts multibyte string to lowercase, by using specified locale that's passed in.
- _mbctolower_l - converts multibyte uppercase character to lowercase character, by using specified locale that's passed in.
- _mbctoupper_l - converts multibyte lowercase character to uppercase character, by using specified locale that's passed in.
More information about these methods are available at:
https://learn.microsoft.com/en-us/cpp/c-runtime-library/reference/strupr-s-…
After applying the patch the crash of the ChessBase application was fixed.
More information:
https://bugs.winehq.org/show_bug.cgi?id=45273
--
https://gitlab.winehq.org/wine/wine/-/merge_requests/1080
--
v2: vkd3d-shader/hlsl: Parse UAV types.
vkd3d-shader/hlsl: Parse texture index expressions.
vkd3d-shader/hlsl: Cast array indices inside of add_array_load().
tests: Add a basic shader test for typed UAV loads.
tests: Add a basic shader test for compute shaders.
https://gitlab.winehq.org/wine/vkd3d/-/merge_requests/30
--
v2: uiautomationcore: Add support for getting HWND providers to uia_node_from_lresult().
uiautomationcore: Add support for getting HWND providers to UiaNodeFromProvider().
uiautomationcore: Determine provider type for nested node providers.
uiautomationcore: Add support for multiple providers on a single HUIANODE.
https://gitlab.winehq.org/wine/wine/-/merge_requests/1052
--
v2: ntdll/tests: Add more tests for \Device\NamedPipe and \Device\NamedPipe\.
ntdll/tests: Add tests for exotic pipe names.
kernel32/tests: Add test for pipe name with a trailing backslash.
https://gitlab.winehq.org/wine/wine/-/merge_requests/1070
Hello, this is the first part of a patch series to support:
* Complex broadcasts.
* Complex implicit casts between component-wise equal types.
* Complex explicit casts between component-wise compatible types.
This first part of the series includes mostly tests.
Following patches in: https://gitlab.winehq.org/fcasas/vkd3d/-/commits/complex_broadcasts_2/
This supersedes !16 .
--
v3: tests: Test explicit casts between types that are component-wise
tests: Test implicit casts between types that are equal component-wise.
vkd3d-shader/hlsl: Always go through implicit conversion in assignments.
tests: Test for invalid complex broadcasts.
tests: Rename structs for readability in broadcast test.
tests: Set ULPs to 2 in normalize() test.
https://gitlab.winehq.org/wine/vkd3d/-/merge_requests/29
The default for MinGW is always ms_printf rather than gnu_printf, but if we are
using ucrtbase or ANSI stdio, we want gnu_printf.
--
v2: include: Use __MINGW_PRINTF_FORMAT when compiling with MinGW.
https://gitlab.winehq.org/wine/vkd3d/-/merge_requests/18
The Windows versions of [Read|Write]ConsoleOutput[Attribute|Character]
appear to assign an uninitialized internal DWORD to the given pointer
address before returning.
As the functions fail (intentionally) in these tests, the value of the
DWORD is never set, so the tests end up comparing the expected value of
zero with random values.
This value of this test is very limited and is best removed.
Fixes https://bugs.winehq.org/show_bug.cgi?id=53686
--
https://gitlab.winehq.org/wine/wine/-/merge_requests/1077
Rémi Bernon (@rbernon) commented about dlls/ntdll/unix/signal_x86_64.c:
> "movq %gs:0x30,%rcx\n\t"
> "movq 0x328(%rcx),%rcx\n\t" /* amd64_thread_data()->syscall_frame */
> "popq 0x70(%rcx)\n\t" /* frame->rip */
> + __ASM_CFI(".cfi_adjust_cfa_offset -8\n\t")
> + // $rip = frame->rip // (*(0x70($rcx)))
I understand the point but I don't think we need to keep these comments. We also don't use C++-style comments.
--
https://gitlab.winehq.org/wine/wine/-/merge_requests/1065#note_10939
>Yes, in my case I'm mostly only interested in the case with DWARF debug info in PE files. The applications I'm working with usually don't have debug information anyway and I'm trying to get stack traces and tooling support for Wine code specifically.
Okay, yeah that makes a lot of sense now. Just to note that Windows "runtime function" unwind information was almost always available when we checked.
--
https://gitlab.winehq.org/wine/wine/-/merge_requests/1065#note_10931
> > FWIW this also works with Valgrind, and you might be interested in https://gitlab.winehq.org/wine/wine/-/merge_requests/1074 too.
>
> That is interesting. So, but do I see correctly that this only works, if the Windows Pe/Coff files, actually have **DWARF** unwind information embedded. Which is as far as I am aware only the case for cross-compilation with mingw, right?
> > I should probably add that it only does that when it has the debug info for the PE modules, this isn't currently well supported, and needs to be done somehow manually.
>
> Are you referring to the Windows unwind information (runtime function), or the DWARF information mentioned above? Our LLDB patch (which we hopefully upstream soon), as well as the libunwindstack implementation actually takes care of all kind of PE/Coff modules, and is able to use runtime function as well, as DWARF information.
Yes, in my case I'm mostly only interested in the case with DWARF debug info in PE files. The applications I'm working with usually don't have debug information anyway and I'm trying to get stack traces and tooling support for Wine code specifically.
--
https://gitlab.winehq.org/wine/wine/-/merge_requests/1065#note_10930
>Hmm, I need to think about that. When I said it fully works, I should maybe indicate that GDB doesn't usually display local variables for the first frame below the syscall, so maybe it's because of this even though it manages to catch up for lower frames.
As far as I remember, local variables were available in all frames in our case. It should be mostly because we specify callee-save registers right away when they get stored. Also it is likely, that if the computation in not correct in the first place, that it will catch up later, as there will be new unwind information mostly specifying "register foo is saved at that position on the stack".
>FWIW this also works with Valgrind, and you might be interested in https://gitlab.winehq.org/wine/wine/-/merge_requests/1074 too.
That is interesting. So, but do I see correctly that this only works, if the Windows Pe/Coff files, actually have **DWARF** unwind information embedded. Which is as far as I am aware only the case for cross-compilation with mingw, right?
>It's not exactly the `pushfl` but more that the dispatcher pops `rip` first, which effectively removes the return address from the stack, then `pushfl` overrides its value. It's not causing problems later because the dispatcher uses the poped `rip` value to return to the caller, but it temporarily confuses GDB stack unwinding. Maybe with your CFI instructions it's not required.
Right! And that is the reason why we don't need it, as we do specify "RIP" based on syscall frame and not based on CFA, right as it gets popped. I think that's another case, where it is actually better to do the `breg` instructions, as it gives you the freedom to specify some variables based on CFA and some based on register content.
>The reason I've been told, is that some DRMs are checking that the NT syscalls didn't touch the stack. I don't really know more.
Oh interesting. That makes a lot of sense, and our lives so much harder... :smile:
>Yes, it's already an issue for `perf` captures when you want stack traces that cross user and kernel stacks, and I don't really have any good solution for that. Having an optional working mode which would interleave kernel frames and user frames may be possible but it doesn't seem much tractable.
Yep, `perf` is actually using the same `perf_event_open` syscall that we are using. So it makes sense that we are observing the same issue. The "bruteforce" way we worked around with that, is to inject into the syscall dispatcher (using a uprobe) and always collect the "user-space" stack, then for the actual samples, make both stacks available to the unwinder. This obviously comes with a big performance hit, and might corrupt your performance characteristics. However, it actually turned out to be useful to find some issues.
An alternative solution, that we never ended up actually implementing would be to use a eBPF program for the sampling/stack collection. We could make it copy both stacks explicitly.
Obvious the more elegant solution would be, as you mentioned, to either have a switch in Wine to only have one stack, or alternatively, make it possible in perf_event_open, to collect both stacks. It would be be not the first time that Linux kernel has special handling for wine.
>I should probably add that it only does that when it has the debug info for the PE modules, this isn't currently well supported, and needs to be done somehow manually.
Are you referring to the Windows unwind information (runtime function), or the DWARF information mentioned above?
Our LLDB patch (which we hopefully upstream soon), as well as the libunwindstack implementation actually takes care of all kind of PE/Coff modules, and is able to use runtime function as well, as DWARF information.
--
https://gitlab.winehq.org/wine/wine/-/merge_requests/1065#note_10929
> Ah, that is good to know, thanks. Apparently gdb's unwinder works slightly different, than the used we looked at. Also, I am surprised it actually can unwind Windows PE/Coff-based frames.
I should probably add that it only does that when it has the debug info for the PE modules, this isn't currently well supported, and needs to be done somehow manually.
--
https://gitlab.winehq.org/wine/wine/-/merge_requests/1065#note_10927
> > BTW, if the issue is only that the CFA is supposed to stay constant within a CFI procedure, would it work if we were splitting the dispatcher with some jumps / call / fake CFI procedures, at the points where we need to change its register?
>
> My point is, that the issue is actually not about CFA not being constant, but that CFA has a semantic that many unwinding tools/libraries rely on, i.e. that CFA is suppose to be the value of the stack pointer at the caller, right before the call. In particular, CFA is suppose to be a value that would be a valid stack pointer.
>
> In your change, however, CFA gets later set to be a pointer into syscall_frame.
Hmm, I need to think about that. When I said it fully works, I should maybe indicate that GDB doesn't usually display local variables for the first frame below the syscall, so maybe it's because of this even though it manages to catch up for lower frames.
> > With GDB and with the two other changes I mentioned, it fully works yes.
>
> Ah, that is good to know, thanks. Apparently gdb's unwinder works slightly different, than the used we looked at. Also, I am surprised it actually can unwind Windows PE/Coff-based frames.
FWIW this also works with Valgrind, and you might be interested in https://gitlab.winehq.org/wine/wine/-/merge_requests/1074 too.
> > I'm a bit surprised that you don't need the flags push/pop change, as I believe it corrupts the return address on the stack, but maybe the unwinder has other ways to get it back.
>
> Interesting. I am wondering why the `pushfl` instruction corrupts the return address. If this would be the case, wouldn't that not lead to actual runtime issues when the dispatcher returns? Maybe the reason why we don't see an issue with that, is that we are actually setting the CFI rule for the return address based on `syscall_frame` right away?
It's not exactly the `pushfl` but more that the dispatcher pops `rip` first, which effectively removes the return address from the stack, then `pushfl` overrides its value. It's not causing problems later because the dispatcher uses the poped `rip` value to return to the caller, but it temporarily confuses GDB stack unwinding. Maybe with your CFI instructions it's not required.
> > Yes, that's what I've been told (maybe even *you* did).
>
> No, that wasnt me :smile:, it's actually my first PR. Also note, that I am not a wine expert, so please forgive me, if I miss something obvious.
Well, nothing in this area is obvious to me either.
> > Now the other part where unwinding doesn't work well is with the other side of syscalls, with KiUserCallbackDispatcher callbacks.
>
> Unfortunately, I am not aware of the `KiUserCallbackDispatcher`. So I can't tell if there is more work to be done/how this could be fixed.
>
> We basically looked at reported unwinding errors in Orbit, and discovered the missing unwind info (CFI) being the root cause of most of them. With this, and some adjustments to our unwinder to cope with certain corner-cases of PE/Coff files, we ended up with less than 1% of unwinding errors.
>
> Actually, another issue that kept us quite busy is, that the `kernel_stack` is not allocated on the "normal"/"user" stack. That apparently used to be the case before Wine 7. This way, Linux performance collector tools, such as perf_event_open, fail to collect the "user-space" part of the stack. For debugging this is fine, as the program execution is halted and we can just read the data from memory, but for Profiling, we needed to massively work around that. Does someone know about the reason for the two separated stacks? Would it be maybe possible, to actually allocate that "kernel_stack" at the normal stack?
The reason I've been told, is that some DRMs are checking that the NT syscalls didn't touch the stack. I don't really know more.
Yes, it's already an issue for `perf` captures when you want stack traces that cross user and kernel stacks, and I don't really have any good solution for that. Having an optional working mode which would interleave kernel frames and user frames may be possible but it doesn't seem much tractable.
--
https://gitlab.winehq.org/wine/wine/-/merge_requests/1065#note_10925
>BTW, if the issue is only that the CFA is supposed to stay constant within a CFI procedure, would it work if we were splitting the dispatcher with some jumps / call / fake CFI procedures, at the points where we need to change its register?
My point is, that the issue is actually not about CFA not being constant, but that CFA has a semantic that many unwinding tools/libraries rely on, i.e. that CFA is suppose to be the value of the stack pointer at the caller, right before the call. In particular, CFA is suppose to be a value that would be a valid stack pointer.
In your change, however, CFA gets later set to be a pointer into syscall_frame.
>With GDB and with the two other changes I mentioned, it fully works yes.
Ah, that is good to know, thanks. Apparently gdb's unwinder works slightly different, than the used we looked at. Also, I am surprised it actually can unwind Windows PE/Coff-based frames.
>I'm a bit surprised that you don't need the flags push/pop change, as I believe it corrupts the return address on the stack, but maybe the unwinder has other ways to get it back.
Interesting. I am wondering why the `pushfl` instruction corrupts the return address. If this would be the case, wouldn't that not lead to actual runtime issues when the dispatcher returns?
Maybe the reason why we don't see an issue with that, is that we are actually setting the CFI rule for the return address based on `syscall_frame` right away?
>Yes, that's what I've been told (maybe even *you* did).
No, that wasnt me :smile:, it's actually my first PR. Also note, that I am not a wine expert, so please forgive me, if I miss something obvious.
>Now the other part where unwinding doesn't work well is with the other side of syscalls, with KiUserCallbackDispatcher callbacks.
Unfortunately, I am not aware of the `KiUserCallbackDispatcher`. So I can't tell if there is more work to be done/how this could be fixed.
We basically looked at reported unwinding errors in Orbit, and discovered the missing unwind info (CFI) being the root cause of most of them. With this, and some adjustments to our unwinder to cope with certain corner-cases of PE/Coff files, we ended up with less than 1% of unwinding errors.
Actually, another issue that kept us quite busy is, that the `kernel_stack` is not allocated on the "normal"/"user" stack. That apparently used to be the case before Wine 7. This way, Linux performance collector tools, such as perf_event_open, fail to collect the "user-space" part of the stack. For debugging this is fine, as the program execution is halted and we can just read the data from memory, but for Profiling, we needed to massively work around that.
Does someone know about the reason for the two separated stacks? Would it be maybe possible, to actually allocate that "kernel_stack" at the normal stack?
--
https://gitlab.winehq.org/wine/wine/-/merge_requests/1065#note_10922
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`
--
https://gitlab.winehq.org/wine/wine/-/merge_requests/1074
Currently, the code copies one extra character than requested and does not terminate the string.
Signed-off-by: David Kahurani <k.kahurani(a)gmail.com>
--
v6: xmllite/writer: Null terminate duplicated strings.
https://gitlab.winehq.org/wine/wine/-/merge_requests/1024
Currently, the code copies one extra character than requested and does not terminate the string.
Signed-off-by: David Kahurani <k.kahurani(a)gmail.com>
--
v5: xmllite/writer: Null terminate duplicated strings
https://gitlab.winehq.org/wine/wine/-/merge_requests/1024
The fd gets overwritten, therefore we need to close it before doing so.
Signed-off-by: Fabian Maurer <dark.shadow4(a)web.de>
---
Supersedes patch 233975
--
v2: ntdll: Prevent double free (Coverity)
https://gitlab.winehq.org/wine/wine/-/merge_requests/74
Currently, the code copies one extra character than requested and does not terminate the string.
Signed-off-by: David Kahurani <k.kahurani(a)gmail.com>
--
v4: xmllite/writer: Null terminate duplicated strings
https://gitlab.winehq.org/wine/wine/-/merge_requests/1024
Currently, the code copies one extra character than requested and does not terminate the string.
Signed-off-by: David Kahurani <k.kahurani(a)gmail.com>
--
v3: xmllite/writer: strings are not being "partially duplicated", but duplicated with explicit length
https://gitlab.winehq.org/wine/wine/-/merge_requests/1024
I was watching some random YouTube stream and then heard a voice telling me to do this.
This can run wglgears on wow, though there's plenty of missing pieces which I don't have any idea how to fix (like buffer mapping, etc.). Opening it as a draft for now to show the whole thing, if it seems alright I'll send it in batches.
--
v2: opengl32: Implement wow64 thunks for glMapBuffer (et al.).
opengl32: Use manual win32 thunks for glMapBuffer (et al.).
opengl32: Implement wow64 thunks for GLsizeiptr/GLintptr arrays.
opengl32: Implement wow64 thunks for glFenceSync (et al.).
opengl32: Implement wow64 thunks for input pointer arrays.
opengl32: Implement wow64 thunk for wglGetPbufferDCARB.
opengl32: Implement wow64 thunk for wglCreatePbufferARB.
opengl32: Implement wow64 thunk for wglCreateContextAttribsARB.
opengl32: Implement wow64 thunk for wglMakeCurrent (et al.).
opengl32: Implement wow64 thunk for glGetString (et al.).
opengl32: Implement wow64 thunk for wglGetProcAddress.
opengl32: Generate stub wow64 params mapping.
opengl32: Manually write glPathGlyphIndexRangeNV wow64 thunk.
opengl32: Generate wow64 thunks.
opengl32: Use RtlSetLastWin32Error instead of SetLastError.
opengl32: Use msvcrt allocation functions.
opengl32: Build with msvcrt.
opengl32: Avoid recursively entering WGL critical section.
opengl32: Use glReserved1 to keep draw and read DCs.
opengl32: Move get_current_context_type to private.h.
opengl32: Use NtCurrentTeb()->glCurrentRC instead of get_current_context_ptr.
opengl32: Use glReserved1[0] and glReserved1[1] for disabled extensions.
opengl32: Use the unixlib interface to check for extensions.
opengl32: Use the unixlib interface in glGetStringi.
opengl32: Use the unixlib interface in wglGetProcAddress.
opengl32: Split opengl_ext.h into private.h and unix_private.h.
opengl32: Avoid calling back the wglMakeCurrent win32 thunk.
opengl32: Use the unixlib interface for more WGL functions.
opengl32: Move some WGL functions to unix_wgl.c.
opengl32: Introduce a new NtUserCallOpenGLDebugMessageCallback callback.
opengl32: Avoid using internal functions in wglUseFontOutlines.
opengl32: Avoid using internal functions in wglUseFontBitmaps.
opengl32: Use the unixlib for wglSwapBuffers.
opengl32: Use the unixlib for wglGetPixelFormat.
opengl32: Use the unixlib for wglDescribePixelFormat.
opengl32: Use the unixlib for wglSetPixelFormat.
opengl32: Use the unixlib interface for WGL functions.
opengl32: Use the unixlib interface for EXT functions.
opengl32: Move the null functions to unix_thunks.c.
opengl32: Use the unixlib for glGet(String|Integerv).
opengl32: Warn about unixlib calls failures in Win32 thunks.
opengl32: Create a unixlib interface for GL functions.
opengl32: Use has_extension in filter_extensions_index.
opengl32: Move filter_extensions (et al.) around.
opengl32: Build extension list in is_extension_supported.
opengl32: Split is_extension_supported helper.
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/1010
On Thu Jun 2 16:39:03 2022 +0000, Ghost User wrote:
> Henri Verbeet replied on the mailing list:
> ```
> On Thu, 2 Jun 2022 at 17:39, Fabian Maurer (@DarkShadow44)
> <wine(a)gitlab.winehq.org> wrote:
> > On Thu Jun 2 13:17:37 2022 +0000, **** wrote:
> > > Henri Verbeet replied on the mailing list:
> > > \`\`\`
> > > On Wed, 25 May 2022 at 02:02, Fabian Maurer <wine(a)gitlab.winehq.org> wrote:
> > > > Since ddraw propably never allowed sizes that big anyways,
> > > > this should not cause any issues.
> > > This seems like something it would be easy to write tests for.
> > > \`\`\`
> > Those tests would only work if your GPU advertises 32768x32768
> textures though. Would the testbot be able to handle that?
> I suspect not, even feature level 12_1 only requires 16384 as maximum
> texture dimensions. But a test testing that ddraw never advertises
> dwMaxTextureWidth/dwMaxTextureHeight larger than 16384 would still
> pass there. You'd need such a GPU to verify the change is in fact
> correct, but presumably you already did that.
> ```
Not quite sure how to continue here, my current GPU doesn't seem to allow texture sizes over 16384x16384. Not sure how to do proper testing like this.
--
https://gitlab.winehq.org/wine/wine/-/merge_requests/126#note_10821
Some preliminary cleanups (split off from !969)
- extend an existing `wine_todo` test to show that DDE messages cause spurious calls to IMessageFilter::MessagePending (the same as RPC ones)
I have no current ideas for fixing this, just demonstrating the behavior (before refactoring the code in ways that won't change this)
- extract a helper `com_filter_messagepending` for the interactions between `CoWaitForMultipleHandles` and IMessageFilter::MessagePending
- Pull the remaining use of `PeekMessageW` into the existing `com_peek_message` helper
- one behavior fix, to make `RPC_E_CALL_CANCELED` actually work
--
https://gitlab.winehq.org/wine/wine/-/merge_requests/1068
On Fri Oct 14 12:45:38 2022 +0000, Rémi Bernon wrote:
> I'm having a hard time reproducing it, is this with some specific tests?
> The first commit indeed changes some behavior, where it was only
> repositioning the current process windows before and is now
> repositioning all windows from the desktop thread.
> I suspect that it could be about the message being sent to the desktop,
> which is now waiting for all windows to reposition by broadcasting a
> message itself. If they aren't actively processing messages, it could
> probably lock up.
> I created https://gitlab.winehq.org/wine/wine/-/merge_requests/1056 to
> address that issue, but I cannot confirm if it fixes anything. Other
> than that I experienced some random and seldom crashes running
> d3d9:device for instance, but I'm not sure to see how it's related.
I reproduce it by running the full tests, `make testclean test -k` usually hangs somewhere in the d3d tests. !1056 seems to help.
--
https://gitlab.winehq.org/wine/wine/-/merge_requests/944#note_10781
Applications calling wined3d_device_context_resolve_sub_resource() on a
deferred context would instead get this scheduled on the immediate context.
Worse, because the original call was intended for a deferred context, we'd do
this without taking the mutex required for immediate contexts, potentially
corrupting the command stream.
--
https://gitlab.winehq.org/wine/wine/-/merge_requests/1043
On Fri Oct 14 13:58:34 2022 +0000, Kevin Puetz wrote:
> Looked at it some more and since I (already) gave up on trying to fix
> the todo_wine about spurious calls to MessagePending, extracting that
> much to a helper shouldn't be so bad. It was my (abandoned) theory about
> how PeekMessage/QueueStatus should interact to suppress those unwanted
> calls that made things so tangled together - and the didn't make the
> conformance tests work any better, and it had nothing to do with the
> actual application I was working on, so it got dropped.
> The existing behavior (which this MR leaves alone) just needs an early
> exit to return RPC_E_CALL_CANCELED. So I'll extract that helper too;
> fixing IMessageFilter todo will probably have to revisit this, but we
> can just preserve the status quo (and make things more readable) for
> now. No need to borrow trouble from the future when I'm out of ideas and
> not trying to tackle that anymore.
Ok, opened !1068 to start with, with just some of the simpler changes that didn't involve the timeout/pumping behavior. This PR is now rebased on top of that, but marked draft and will can sit until we that first part landed so it gets smaller.
--
https://gitlab.winehq.org/wine/wine/-/merge_requests/969#note_10760
Salvage tests and fix a leak found in another review: see https://gitlab.winehq.org/wine/wine/-/merge_requests/897#note_9175 points 1 and 2. 3. is why !897 was reverted.
This does not contain the (incorrect) changes to VariantCopyInd, but instead fixes the leak identified in VariantClear (VT_RECORD needs to free pvRecord), and the wrong allocator being used in VariantCopy (it should have been IMalloc, rather than `HeapAlloc`, as shown by the fact IMallocSpy observes these allocations).
This also cleans up some dubious behavior by the test IRecordInfoImpl, which was modifying a VARIANT that it did not own or receive as an argument in the middle of VariantClear. This was likely undefined behavior, and in any case concealed the heap leak.
--
https://gitlab.winehq.org/wine/wine/-/merge_requests/1035
BTW, if the issue is only that the CFA is supposed to stay constant within a CFI procedure, would it work if we were splitting the dispatcher with some jumps / call / fake CFI procedures, at the points where we need to change its register?
--
https://gitlab.winehq.org/wine/wine/-/merge_requests/1065#note_10742
> I guess the biggest issue with that change is, however, that it actually goes against what the DWARF spec. says about the CFA:
>> Typically, the CFA is defined to be the value of the stack pointer at the call site in the previous frame (which may be different from its value on entry to the current frame).
>
> In particular, your change was unfortunately not working with our version of (libunwindstack)\[https://github.com/google/orbit/tree/main/third_party/libu… and LLDB (unfortunately not yet upstream).
Yes, that's what I've been told (maybe even *you* did).
> I am actually interested, does your change manage to unwind completely through the dispatcher and through the complete windows stack, as shown here?
With GDB and with the two other changes I mentioned, it fully works yes.
I'm a bit surprised that you don't need the flags push/pop change, as I believe it corrupts the return address on the stack, but maybe the unwinder has other ways to get it back.
Now the other part where unwinding doesn't work well is with the other side of syscalls, with KiUserCallbackDispatcher callbacks. Massaging a bit the frame pointers before entering it I'm able to stitch the stack trace to the frame before entering the syscall but I'm then losing the stack within the syscall. I guess we'd probably need some assembly there too to add adequate CFI info if we want to get that right too.
--
https://gitlab.winehq.org/wine/wine/-/merge_requests/1065#note_10741
>FWIW I'm achieving similar results in GDB with https://gitlab.winehq.org/rbernon/wine/-/commit/bf615abeb0c206e40678cec0583….
>As I've been told it's incorrect I didn't try upstreaming it further, but as far as I'm concerned GDB is fully happy with it, and combined with https://gitlab.winehq.org/rbernon/wine/-/commit/9e900267f6eacb8511e18ff2fc1… and https://gitlab.winehq.org/rbernon/wine/-/commit/e21cf3f7702837557f9cc221b20… it can unwind through the syscall dispatcher just fine.
>Imho, this variant with the many macros is likely going to be considered as too complex for the small benefit (it's really only for the convenience of debugging Wine itself with a Unix debugger, which I completely agree, *is* useful, though mostly for developers).
----
Hey, I saw your change and would also have hoped that this actually works, as it is obviously much more elegant not fallback to the .cfi_escape primitives.
I guess the biggest issue with that change is, however, that it actually goes against what the DWARF spec. says about the CFA:
>Typically, the CFA is defined to be the value of the stack pointer at the call site in the previous frame (which may be different from its value on entry to the current frame).
In particular, your change was unfortunately not working with our version of (libunwindstack)[https://github.com/google/orbit/tree/main/third_party/libun… and LLDB (unfortunately not yet upstream).
I am actually interested, does your change manage to unwind completely through the dispatcher and through the complete windows stack, as shown here?

A note about the macros: I agree, they look horrible at the fist glance, but there are really just for readability. When you ignore those for a second, you actually only need to grasp the `__ASM_CFI_DW_OP_bregN` and `__ASM_CFI_DW_OP_deref` instructions, to get the computation of the registers and the CFA.
Regarding the usefulness of that change, this is clearly for devs (not only wine directly, but e.g. also DXVK or similars). Also it is not only for debuggers, but also for profiling, to actually find performance problems in the syscalls. As the whole code here, is already very low level, I think this is actually also pretty helpful for people maintaining the syscall dispatcher, as you can, as said in the commit message, actually step through each instruction of the dispatcher with a debugger.
So I really think it is worth the effort.
--
https://gitlab.winehq.org/wine/wine/-/merge_requests/1065#note_10740
I haven't reviewed the actual changes here yet (and I'm not that knowledgeable on CFI either), but I would like to vote that this would be a huge quality-of-life improvement for us. When your app is also winelib (since it has dependencies on both win32 and other system ELF libraries), we almost exclusively end up debugging with a unix debugger, and the fact that backtraces almost always fail at `__wine_syscall_dispatcher` is a big pain. Using `gdb record` so we can rewind to see where the call came from helps, but can't help if all you have is a coredump. So this is would be greatly appreciated. Enough so that I had actually written myself a task to try and teach myself enough about DWARF well enough to try writing it :-)
--
https://gitlab.winehq.org/wine/wine/-/merge_requests/1065#note_10738
On Fri Oct 14 13:58:34 2022 +0000, Kevin Puetz wrote:
> > I'd suggest moving some of the existing code into helper functions first.
> You asked for that the first time too. I've tried, but I just couldn't
> find any good seams to carve it along besides consolidating the
> PeekMessage calls (e7e4c3d8eee915975e958521b8caffe94ef7a34d). The 3
> major hunks (message pump, the IMessageFilter_MessagePending stuff, and
> polling the handles for completions/APCs) all tie into how the loop
> exits and the post conditions (re-posting QuitMessage, writing `*index`
> (or leaving it unmodified), errors, translating previous Wait* result),
> and the order is quite important (because of side-effects like
> consuming/preserving QS_ALLPOSTMESSAGE).
> If you have any ideas I'd love to hear them. I could certainly pull
> those 3 major hunks out into functions, but when they have get passed in
> pointers to a bunch of outside-the-loop variables, and their return
> value ends up being decoded into ends up with stuff like `if(hr ==
> S_FALSE) break; else if(FAILED(hr)) goto err;` then the flow control
> just turned into spaghetti I hated even more than what it started as.
> > ten commits per MR is rather too many (especially when they're non trivial).
> Yeah, for lack of coming up with decent helper functions I tried to dice
> it *really* finely separate testable commits that changed only one
> behavior. I think they are all correct and improvements on the status
> quo, but the very first commit fixes the same bug (short-timeout race)
> for MTAs that the last finally fixes for STAs, so it felt weird to
> propose actually merging it partially. And yet that's really the order
> in which the steps make the most sense to read (in terms of minimizing
> extraneous code change); getting the MTA out of the loop, so that it's
> *only* the mesage loops, then building toward toward the case where
> everything is happening in the right order and there's a correct place
> to put the timeout.
> The part that I dislike about this series is temporarily introducing use
> of MWMO_INPUTAVAILABLE; that was a detour born of trying to split the
> last 3 commits apart from each other, so there's only one behavior
> change at a time.
> 1. WAIT_OBJECT_* signaled after dispatching a message
> 2. WAIT_IO_COMPLETION after dispatching a message (rather than just once
> at the start)
> 3. making sure to we're out of relevant messages before escalating
> WAIT_TIMOUET to RPC_S_CALLPENDING).
> Required some careful work to *preserve* bugs until the next commit.
> I guess there's a few things in the middle that basically just
> refactor/add tests without changing any observable behavior, so I'll
> move those to the front and make a separate MR, just to cut down the
> size of this one... And I guess I could also put a lot of the new tests
> in as just new `todo_wine` tests, separate from the actual changes that
> fix them. That would at least get a lot of lines of code out of this MR,
> though not much of the conceptual complexity.
Looked at it some more and since I (already) gave up on trying to fix the todo_wine about spurious calls to MessagePending, extracting that much to a helper shouldn't be so bad. It was my (abandoned) theory about how PeekMessage/QueueStatus should interact to suppress those unwanted calls that made things so tangled together - and the didn't make the conformance tests work any better, and it had nothing to do with the actual application I was working on, so it got dropped.
The existing behavior (which this MR leaves alone) just needs an early exit to return RPC_E_CALL_CANCELED. So I'll extract that helper too; fixing IMessageFilter todo will probably have to revisit this, but we can just preserve the status quo (and make things more readable) for now. No need to borrow trouble from the future when I'm out of ideas and not trying to tackle that anymore.
--
https://gitlab.winehq.org/wine/wine/-/merge_requests/969#note_10685
Currently, the code copies one extra character than requested and does not terminate the string.
Signed-off-by: David Kahurani <k.kahurani(a)gmail.com>
--
v2: xmllite/writer: Correctly partially duplicate strings
https://gitlab.winehq.org/wine/wine/-/merge_requests/1024
This shows that media session samples are correctly oriented, but that mfmediaengine renders them upside down.
--
v5: mfmediaengine: Remove vertical flipping of video frames.
mfmediaengine/tests: Check IMFMediaEngine_TransferVideoFrames output orientation.
mfmediaengine/tests: Pass a device manager and output format to create_media_engine.
mf/tests: Check sample grabber RGB / NV12 orientation.
mf/tests: Factor test grabber callback implementations.
https://gitlab.winehq.org/wine/wine/-/merge_requests/874
On Thu Oct 13 19:11:33 2022 +0000, Rémi Bernon wrote:
> Sorry, I'll have a look.
I'm having a hard time reproducing it, is this with some specific tests?
The first commit indeed changes some behavior, where it was only repositioning the current process windows before and is now repositioning all windows from the desktop thread.
I suspect that it could be about the message being sent to the desktop, which is now waiting for all windows to reposition by broadcasting a message itself. If they aren't actively processing messages, it could probably lock up.
I created https://gitlab.winehq.org/wine/wine/-/merge_requests/1056 to address that issue, but I cannot confirm if it fixes anything. Other than that I experienced some random and seldom crashes running d3d9:device for instance, but I'm not sure to see how it's related.
--
https://gitlab.winehq.org/wine/wine/-/merge_requests/944#note_10671
Hello, this is the first part of a patch series to support:
* Complex broadcasts.
* Complex implicit casts between component-wise equal types.
* Complex explicit casts between component-wise compatible types.
This first part of the series includes mostly tests.
Following patches in: https://gitlab.winehq.org/fcasas/vkd3d/-/commits/complex_broadcasts_2/
This supersedes !16 .
--
v2: tests: Test explicit casts between types that are component-wise
tests: Test implicit casts between types that are equal component-wise.
vkd3d-shader/hlsl: Always go through implicit conversion in assignments.
tests: Test for invalid complex broadcasts.
tests: Set ULPs to 2 in normalize() test.
https://gitlab.winehq.org/wine/vkd3d/-/merge_requests/29
The removed interfaces cannot be found in the windows SDK, so making it one step close to being the same.
Signed-off-by: Alistair Leslie-Hughes <leslie_alistair(a)hotmail.com>
--
https://gitlab.winehq.org/wine/wine/-/merge_requests/1060
> I'd suggest moving some of the existing code into helper functions first.
You asked for that the first time too. I've tried, but I just couldn't find any good seams to carve it along besides consolidating the PeekMessage calls (e7e4c3d8eee915975e958521b8caffe94ef7a34d). The 3 major hunks (message pump, the IMessageFilter_MessagePending stuff, and polling the handles for completions/APCs) all tie into how the loop exits and the post conditions (re-posting QuitMessage, writing `*index` (or leaving it unmodified), errors, translating previous Wait* result), and the order is quite important (because of side-effects like consuming/preserving QS_ALLPOSTMESSAGE).
If you have any ideas I'd love to hear them. I could certainly pull those 3 major hunks out into functions, but when they have get passed in pointers to a bunch of outside-the-loop variables, and their return value ends up being decoded into ends up with stuff like `if(hr == S_FALSE) break; else if(FAILED(hr)) goto err;` then the flow control just turned into spaghetti I hated even more than what it started as.
> ten commits per MR is rather too many (especially when they're non trivial).
Yeah, for lack of coming up with decent helper functions I tried to dice it *really* finely separate testable commits that changed only one behavior. I think they are all correct and improvements on the status quo, but the very first commit fixes the same bug (short-timeout race) for MTAs that the last finally fixes for STAs, so it felt weird to propose actually merging it partially. And yet that's really the order in which the steps make the most sense to read (in terms of minimizing extraneous code change); getting the MTA out of the loop, so that it's *only* the mesage loops, then building toward toward the case where everything is happening in the right order and there's a correct place to put the timeout.
The part that I dislike about this series is temporarily introducing use of MWMO_INPUTAVAILABLE; that was a detour born of trying to split the last 3 commits apart from each other, so there's only one behavior change at a time.
1. WAIT_OBJECT_* signaled after dispatching a message
2. WAIT_IO_COMPLETION after dispatching a message (rather than just once at the start)
3. making sure to we're out of relevant messages before escalating WAIT_TIMOUET to RPC_S_CALLPENDING).
Required some careful work to *preserve* bugs until the next commit.
I guess there's a few things in the middle that basically just refactor/add tests without changing any observable behavior, so I'll move those to the front and make a separate MR, just to cut down the size of this one... And I guess I could also put a lot of the new tests in as just new `todo_wine` tests, separate from the actual changes that fix them. That would at least get a lot of lines of code out of this MR, though not much of the conceptual complexity.
--
https://gitlab.winehq.org/wine/wine/-/merge_requests/969#note_10623