_mbctolower_l - converts multibyte uppercase character to lowercase 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/mbctolowe…
More information about application crash:
https://bugs.winehq.org/show_bug.cgi?id=45273
--
v7: msvcrt: Fix error handling in _mbslwr_s_l.
msvcrt: Fix error handling in _mbsupr_s_l.
msvcrt: Add support for multi-byte characters in _mbctoupper_l.
msvcrt: Add support for multi-byte characters in _mbctolower_l.
msvcrt: Fix mbcasemap initialization.
msvcrt: Add _mbsupr_s_l partial implementation.
msvcrt: Add _mbslwr_s_l partial implementation.
msvcrt: Add _mbctoupper_l partial implementation.
msvcrt: Add _mbctolower_l partial implementation.
https://gitlab.winehq.org/wine/wine/-/merge_requests/1090
--
v4: 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
On Wed Oct 19 09:30:37 2022 +0000, Patrick Hibbs wrote:
> changed this line in [version 5 of the diff](/wine/wine/-/merge_requests/979/diffs?diff_id=14510&start_sha=9be4873a7477520f0eb74837f2a269f864a9ac13#6af8d13245d87d86339fd93c308f9d2332f22092_9163_9194)
Done in v3 of the patch for the tests. Should be in the next version of the implementation.
--
https://gitlab.winehq.org/wine/wine/-/merge_requests/979#note_11313
On Tue Oct 18 10:04:56 2022 +0000, Matteo Bruni wrote:
> This should presumably copy data to an offset inside "raw", right?
> Actually, this poses an issue with preserving the existing contents over
> the part that's skipped over.
It does.
In the current version of patch 1, I just take the returned pointer and add the offset to it. Writing far enough will cause a C0000005 under win10, so I don't bother checking the returned pointer anymore. (I haven't submitted that version yet because I need to finish fixing the current test failures on it. And I will need to amend the commit to do so.)
--
https://gitlab.winehq.org/wine/wine/-/merge_requests/979#note_11312
On Wed Oct 19 09:30:28 2022 +0000, Patrick Hibbs wrote:
> changed this line in [version 5 of the diff](/wine/wine/-/merge_requests/979/diffs?diff_id=14510&start_sha=9be4873a7477520f0eb74837f2a269f864a9ac13#6af8d13245d87d86339fd93c308f9d2332f22092_8977_8977)
Done in v3 of the patch.
--
https://gitlab.winehq.org/wine/wine/-/merge_requests/979#note_11311
On Tue Oct 18 10:04:58 2022 +0000, Matteo Bruni wrote:
> Can you reorder the fields such that the values to set are all at the
> start and the expected values all at the end? E.g.:
> ```suggestion:-10+0
> struct test_set_raw_data_value
> {
> const char *param_name;
> D3DXPARAMETER_TYPE param_type;
> const void *data;
> unsigned int data_size;
> unsigned int offset;
> HRESULT expected_hr;
> const void *expected_data;
> unsigned int expected_data_size;
> };
> ```
Done in v3 of the patch.
--
https://gitlab.winehq.org/wine/wine/-/merge_requests/979#note_11310
On Wed Oct 19 09:30:31 2022 +0000, Patrick Hibbs wrote:
> changed this line in [version 5 of the diff](/wine/wine/-/merge_requests/979/diffs?diff_id=14510&start_sha=9be4873a7477520f0eb74837f2a269f864a9ac13#6af8d13245d87d86339fd93c308f9d2332f22092_9024_9004)
Converted the index to decimal in v3 of the patch. (Also fixed the log messages.)
--
https://gitlab.winehq.org/wine/wine/-/merge_requests/979#note_11309
On Tue Oct 18 10:05:01 2022 +0000, Matteo Bruni wrote:
> You forgot to increment the "byte" pointer, you're only printing the
> first byte.
> BTW, I'd just get rid of this function and related machinery entirely.
> The hex prints do the job just fine.
Fixed the increment. Thanks for pointing it out, I was running in circles trying to fix the SetRawValue() implementation because of that. I'll remove the function in the final version of the patch. (It's helpful to me while working on it.)
--
https://gitlab.winehq.org/wine/wine/-/merge_requests/979#note_11308
On Wed Oct 19 09:30:39 2022 +0000, Patrick Hibbs wrote:
> changed this line in [version 5 of the diff](/wine/wine/-/merge_requests/979/diffs?diff_id=14510&start_sha=9be4873a7477520f0eb74837f2a269f864a9ac13#6af8d13245d87d86339fd93c308f9d2332f22092_9173_9199)
Done in v3 of the patch.
--
https://gitlab.winehq.org/wine/wine/-/merge_requests/979#note_11307
On Wed Oct 19 09:30:41 2022 +0000, Patrick Hibbs wrote:
> changed this line in [version 5 of the diff](/wine/wine/-/merge_requests/979/diffs?diff_id=14510&start_sha=9be4873a7477520f0eb74837f2a269f864a9ac13#6af8d13245d87d86339fd93c308f9d2332f22092_9180_9216)
Done in v3 of the patch.
--
https://gitlab.winehq.org/wine/wine/-/merge_requests/979#note_11306
On Wed Oct 19 09:30:44 2022 +0000, Patrick Hibbs wrote:
> changed this line in [version 5 of the diff](/wine/wine/-/merge_requests/979/diffs?diff_id=14510&start_sha=9be4873a7477520f0eb74837f2a269f864a9ac13#6af8d13245d87d86339fd93c308f9d2332f22092_9185_9222)
Done in v3 of the patch.
--
https://gitlab.winehq.org/wine/wine/-/merge_requests/979#note_11305
On Wed Oct 19 09:30:46 2022 +0000, Patrick Hibbs wrote:
> changed this line in [version 5 of the diff](/wine/wine/-/merge_requests/979/diffs?diff_id=14510&start_sha=9be4873a7477520f0eb74837f2a269f864a9ac13#6af8d13245d87d86339fd93c308f9d2332f22092_9196_9222)
Done in v3 of the patch.
--
https://gitlab.winehq.org/wine/wine/-/merge_requests/979#note_11304
On Wed Oct 19 09:30:48 2022 +0000, Patrick Hibbs wrote:
> changed this line in [version 5 of the diff](/wine/wine/-/merge_requests/979/diffs?diff_id=14510&start_sha=9be4873a7477520f0eb74837f2a269f864a9ac13#6af8d13245d87d86339fd93c308f9d2332f22092_9004_9004)
Done in v3 of the patch.
--
https://gitlab.winehq.org/wine/wine/-/merge_requests/979#note_11303
On Wed Oct 19 09:30:54 2022 +0000, Patrick Hibbs wrote:
> changed this line in [version 5 of the diff](/wine/wine/-/merge_requests/979/diffs?diff_id=14510&start_sha=9be4873a7477520f0eb74837f2a269f864a9ac13#6af8d13245d87d86339fd93c308f9d2332f22092_9210_9259)
Done in v3 of the patch.
--
https://gitlab.winehq.org/wine/wine/-/merge_requests/979#note_11302
On Wed Oct 19 09:30:56 2022 +0000, Patrick Hibbs wrote:
> changed this line in [version 5 of the diff](/wine/wine/-/merge_requests/979/diffs?diff_id=14510&start_sha=9be4873a7477520f0eb74837f2a269f864a9ac13#6af8d13245d87d86339fd93c308f9d2332f22092_9225_9259)
Done in v3 of the patch.
--
https://gitlab.winehq.org/wine/wine/-/merge_requests/979#note_11301
On Wed Oct 19 09:30:58 2022 +0000, Patrick Hibbs wrote:
> changed this line in [version 5 of the diff](/wine/wine/-/merge_requests/979/diffs?diff_id=14510&start_sha=9be4873a7477520f0eb74837f2a269f864a9ac13#6af8d13245d87d86339fd93c308f9d2332f22092_9265_9259)
Done in v3 of the patch.
Should I respond to all of these if I think it's been done?
Should I mark the thread resolved if I think it's been done, or is that something the reviewer should do?
--
https://gitlab.winehq.org/wine/wine/-/merge_requests/979#note_11300
On Tue Oct 18 10:04:52 2022 +0000, Matteo Bruni wrote:
> First of all, sorry for the delay.
> These are some good tests, in principle. They already show that the
> implementation is not correct (e.g. it doesn't sanitize D3DXPT_BOOL
> values to 0/1) but I guess you already knew that.
> Actually, in regard to that point specifically: assuming that
> SetRawValue() does in fact do what it says, it suggests that BOOL values
> are stored unchanged and are instead sanitized on use (or e.g. by
> GetValue()). That's probably something that we want to fix in our
> implementation, separately from SetRawValue() itself. Marking the
> relevant tests as todo_wine initially and fixing them afterwards is an option.
> The expected results used by the tests are muddied quite a bit by the
> fact that the parameter value is not cleared to 0 (or any other value)
> between individual tests. That also makes it more complicated than
> necessary to add more tests. I'd fix that by explicitly clearing the
> tested parameter before each test.
> WRT your questions:
> 1. I think you can simply compute the expected results beforehand and
> put them into static const variables. You can certainly e.g. use your
> test_effect_setrawvalue_init_floats() function with some additional
> traces to figure out what those values are supposed to be, but I don't
> see any reason to recalculate the expected results at runtime in the
> final tests. It might make sense to have a comment in the test
> explaining what those "weird" expected results actually mean, hard to
> say at this point.
> 2. If I understand the test correctly, there is no evidence that
> SetRawValue() can "overflow" the current parameter. Either way, I think
> it's a matter of cutting the value size to the maximum of bytes and
> param->bytes or something like that.
> 3. For sure :smile:. I think we used the /Fx output parameter to get
> DWORD data.
> 4. Testing that SetRawValue() doesn't affect the "next" parameter when
> used with larger offsets / sizes is probably interesting. I also have a
> bunch of comments that I'll mention inline. There's most likely more,
> it's not an exhaustive list.
> One more thing. I saw you just pushed a new version of the patches,
> fixing a couple issues I had noticed. Nice, but generally please wait to
> push updates while I have the MR assigned to me, it means I'm actively
> reviewing it and changing stuff at that time can be somewhat disruptive
> for me.
Sorry about the unexpected push, I'll be more careful next time.
With regards to the bool fixups, are we sure we want to just write the raw data given to us? I ask because I've also noticed that SetRawValue() has a tendency to promote datatypes when given a single value and a vector / matrix paramater. I.e. float and int become a float4 and int4 respectively for both vectors and matrices. (MSDN calls this behavior a "cast.") This results in the next 3 values in the paramater's buffer being set to zero.
Assuming SetRawValue() shouldn't fix the bool values itself, should it also avoid fixing the ints and floats? If so, how should we indicate the need for a fixup to other functions? There doesn't seem to be any infrastructure to support that in wine currently. (We could abuse the paramater block support for that, but see the speculation below.)
The float and int promotions were the reason I didn't clear the paramater after each test. As doing so would cause us to miss the writes to the next 3 values in the paramater. As they would already be set to zero before the call. Should I still go ahead and clear the paramaters after each test anyway?
As a dirty hack, I added a call to zero out the paramaters after each test with a 4x4 matrix of zero ints in v3 of the test. That call is commented out in the push, but if you enable it it will succeed for most of the tests under win10. (I disabled it before I fixed the string test crashes. So it may work fine now, I haven't checked.) I haven't tried checking the paramaters after the current one for alterations. I was going to put that in it's own set of tests.
This part is speculation but, if it is a valid use of SetRawValue() to set adjacent paramaters regardless of type with one call, then the entire set of paramaters for a given effect needs to be in the same memory block. (Which seems to be not the case in wine, as there are plenty of calls to heap_alloc() / heap_realloc() using the param->data pointer in effect.c.) That would also imply that there is a specific ordering of paramaters in memory as well. Which would need to be tested for. If this behavior is combined with the bool assumption above, then we'd also need to test for order of operations too.
Assuming all of that needs to be done, how do we split this up? Because I have a feeling that this patchset is going to be rather large in scope. (If all of the assumptions and speculation are true that is.)
--
https://gitlab.winehq.org/wine/wine/-/merge_requests/979#note_11299
This change is adding DWARF (CFI) unwind information to the
hand-written assembly of the `__wine_syscall_dispatcher` function.
This enables unwinding through the dispatcher from the Linux stack
into (and through) the Windows stack.
The general idea is that the `syscall_frame` struct contains the
content of the callee-save registers before the function call
(in particular the stack pointer and the return address). At any
point of the execution, we have a pointer into the `syscall_frame`
in $rcx, $rbp or $rsp.
For the CFI codes the general idea is that we are defining the
computations of the callee-save registers based on the
`syscall_frame` using DWARF’s `breg` instruction, rather than
relative to CFA.
This change adds a bunch of convenience macros, to (hopefully)
improve readability of the CFI instructions.
Note: Those change was used with great success for unwinding through
the dispatcher using a modified LLDB shown in the
[“how-wine-works-101”](https://werat.dev/blog/how-wine-works-101/)
blog post as well as for in the [Orbit profiler](https://github.com/google/orbit),
that has mixed-callstack unwinding support.
Test: Inspect callstacks reported by the Orbit profiler while
running some Windows targets using the modified wine, as well as
verify debugging reports correct callstacks when stepping with our
modified LLDB through the dispatcher itself (so that we are able
to unwind through the dispatcher at any instruction).
--
v7: ntdll: Add CFI unwind info to __wine_syscall_dispatcher (x86_64)
https://gitlab.winehq.org/wine/wine/-/merge_requests/1065
On Tue Oct 18 23:34:47 2022 +0000, Rémi Bernon wrote:
> The cause of the failure was that we're using incorrect mutex names in
> some places for the `display_device_init` mutex. In some unlikely event,
> which becomes apparently more likely with the changes here,
> `D3DKMTOpenAdapterFromGdiDisplayName` was able to enter the mutex CS at
> the same time as the devices are refreshed, and fails to find the video
> device in `HKLM\\HARDWARE\\DEVICEMAP\\VIDEO`, returning an error which
> ultimately triggers an allocation failure.
> This should never happens as the device refresh should also be done
> while holding the same mutex, but because the names were wrong it was
> two different mutexes. I've opened
> https://gitlab.winehq.org/wine/wine/-/merge_requests/1099 to fix this.
> This is for the `d3drm` tests failure at least, I didn't look at the
> ddraw ones, hopefully it's the same problem.
Marvin reported the same `ddraw7` errors in !1099, so they may not be fixed. I'm not able to reproduce them locally so far, using the same kind of setup as Gitlab and running the tests in a loop.
These take a longer time, especially as I'm running the other d3d tests with ddraw in case they have an impact, so it's possible I'm simply being unlucky, or that they are somehow only happening on the testbot now. I'll probably stop looking for now and see how things improve with that MR.
--
https://gitlab.winehq.org/wine/wine/-/merge_requests/944#note_11293
On Wed Oct 19 09:30:52 2022 +0000, Patrick Hibbs wrote:
> changed this line in [version 5 of the diff](/wine/wine/-/merge_requests/979/diffs?diff_id=14510&start_sha=9be4873a7477520f0eb74837f2a269f864a9ac13#6af8d13245d87d86339fd93c308f9d2332f22092_9206_9250)
That was a leftover I missed from a previous iteration of the test. It's been removed in v3 of the patch.
--
https://gitlab.winehq.org/wine/wine/-/merge_requests/979#note_11292
On Wed Oct 19 09:30:34 2022 +0000, Patrick Hibbs wrote:
> changed this line in [version 5 of the diff](/wine/wine/-/merge_requests/979/diffs?diff_id=14510&start_sha=9be4873a7477520f0eb74837f2a269f864a9ac13#6af8d13245d87d86339fd93c308f9d2332f22092_9089_9004)
The same issue with strings occurs with Texture and shader types.
I.e. Paramater is rendered irretrievable. Calling it's relevant GetXXX() function causes a crash if it's a scalar. Calling GetParamaterByName() will return an invalid handle.
--
https://gitlab.winehq.org/wine/wine/-/merge_requests/979#note_11291
On Wed Oct 19 09:30:33 2022 +0000, Patrick Hibbs wrote:
> changed this line in [version 5 of the diff](/wine/wine/-/merge_requests/979/diffs?diff_id=14510&start_sha=9be4873a7477520f0eb74837f2a269f864a9ac13#6af8d13245d87d86339fd93c308f9d2332f22092_9077_9004)
Actually it seems that the strings are rendered irretrievable by the call to SetRawValue().
Calling GetString() on a scalar string after the destruction causes a crash in win10. While calling it with a string vector doesn't crash, but returns D3DERR_INVALIDCALL instead.
I've updated the tests in v3 of the patch to check for this.
--
https://gitlab.winehq.org/wine/wine/-/merge_requests/979#note_11290
This seems to be more correct than what we previously had with fewer lines of code, so I like that. I still don't really like the extra flag I had to add for Nt{Create,Open}Key, but I couldn't find a way to make things work without it. I also checked that Windows doesn't use a similar flag (by iterating over all bit masks).
--
v3: wine.inf: Put the Clients key in the right place.
ntdll/tests: Factor out the NtEnumerateKey() tests.
kernelbase: Remove special Wow64 handling for HKEY_CLASSES_ROOT.
kernelbase: Remove special Wow6432Node handling from RegCreateKeyEx().
kernelbase: Remove special Wow6432Node handling from RegOpenKeyEx().
server: Don't return the actual 32-bit Software\Classes key.
ntdll/tests: Add some some Software\Classes query and enumerate tests.
ntdll/tests: Test that NtCreateKeyEx() also recursively obtains the Wow6432Node parent.
server: Recursively obtain the Wow6432Node parent.
https://gitlab.winehq.org/wine/wine/-/merge_requests/966
This is the first in a series of MRs to get rid of the `HTMLDocument` basedoc struct and separate the `HTMLDocumentNode` and `HTMLDocumentObj`, as suggested. The other interfaces and fields will be done in follow-up MRs. It should be a no-op in general.
Some of the things are ugly but temporary (e.g. the chunk in `HTMLDocument_put_designMode` on first commit) until the entire transition is done, then they will be cleaned up.
For most of the interfaces, they all deal with doc objects in most cases, so the implementation on HTMLDocumentNode tends to just forward to that. There are exceptions of course, but care has been taken to have them mostly no-ops ("mostly" because there's cases where the previous code did not check for e.g. NULL node, so it would crash instead, which is bad and should be fixed now).
--
https://gitlab.winehq.org/wine/wine/-/merge_requests/1078
The mutex is also used in user32, gdi32, and winevulkan, where it is
opened through kernel32, which opens it from the session directory.
I believe this will fix the d3drm spurious errors, and hopefully the
ddraw ones too, but I haven't investigated these as the test takes
much longer to run.
--
https://gitlab.winehq.org/wine/wine/-/merge_requests/1099
Some applications spam this fixme.
fixme:cryptasn:CRYPT_GetBuiltinDecoder Unsupported decoder for lpszStructType 1.3.6.1.4.1.311.2.1.4
This OID is supported in wintrust.dll which crypt32 uses, so this console fixme doesn't make sense.
The fixme will only appear if no support for the requested decoder is available.
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=53800
Signed-off-by: Alistair Leslie-Hughes <leslie_alistair(a)hotmail.com>
--
https://gitlab.winehq.org/wine/wine/-/merge_requests/1104
Set the native thread name on Linux when set with SetThreadDescription(). I'm also working on support for macOS and exception-based thread naming.
This uses the `get_thread_times` server call to get the PID/TID, is this ok or should I make a new server call for this?
`/proc/%u/task/%u/comm` is documented in the proc(5) man page, strings written to it are silently truncated at `TASK_COMM_LEN` (16) characters.
--
https://gitlab.winehq.org/wine/wine/-/merge_requests/1098
On Tue Oct 18 21:43:53 2022 +0000, Rémi Bernon wrote:
> Yes, I'm investigating. I can reproduce the failures locally, and they
> look indeed related.
The cause of the failure was that we're using incorrect mutex names in some places for the `display_device_init` mutex. In some unlikely event, which becomes apparently more likely with the changes here, `D3DKMTOpenAdapterFromGdiDisplayName` was able to enter the mutex CS at the same time as the devices are refreshed, and fails to find the video device in `HKLM\\HARDWARE\\DEVICEMAP\\VIDEO`, returning an error which ultimately triggers an allocation failure.
This should never happens as the device refresh should also be done while holding the same mutex, but because the names were wrong it was two different mutexes. I've opened https://gitlab.winehq.org/wine/wine/-/merge_requests/1099 to fix this.
This is for the `d3drm` tests failure at least, I didn't look at the ddraw ones, hopefully it's the same problem.
--
https://gitlab.winehq.org/wine/wine/-/merge_requests/944#note_11227
On Tue Oct 18 21:43:53 2022 +0000, Alexandre Julliard wrote:
> > The first one seems to be caused by an OOM error. I've seen similar
> issues in the past when running the tests under llvmpipe, and when
> multiple D3D devices are initialized. The llvmpipe GL context is memory
> hungry and it quickly fills the 32-bit address space.
> >
> > This doesn't disculp this changes in any way and it could be very well
> related, if for some reason the messages here are causing GL contexts to
> be re-created more often or at different times.
> It's possible that the failures could have been triggered before, though
> I don't remember ever seeing the d3drm one.
> But they are happening much more often, almost every test run has one of
> them now. We need to fix that.
Yes, I'm investigating. I can reproduce the failures locally, and they look indeed related.
--
https://gitlab.winehq.org/wine/wine/-/merge_requests/944#note_11205
> The first one seems to be caused by an OOM error. I've seen similar issues in the past when running the tests under llvmpipe, and when multiple D3D devices are initialized. The llvmpipe GL context is memory hungry and it quickly fills the 32-bit address space.
>
> This doesn't disculp this changes in any way and it could be very well related, if for some reason the messages here are causing GL contexts to be re-created more often or at different times.
It's possible that the failures could have been triggered before, though I don't remember ever seeing the d3drm one.
But they are happening much more often, almost every test run has one of them now. We need to fix that.
--
https://gitlab.winehq.org/wine/wine/-/merge_requests/944#note_11204
--
v3: 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
On Tue Oct 18 17:24:25 2022 +0000, Alexandre Julliard wrote:
> I have a feeling that the recent stream of ddraw and d3drm test failures
> are also related to this MR. Any ideas?
Do you mean the `d3drm.c:4776: Test failed: Cannot create IDirect3DRMDevice2 interface, hr 0x8007000e.` and the `ddraw7.c:15663: Test failed: Expected unsynchronised map for flags 0x1000.` kind of errors?
The first one seems to be caused by an OOM error. I've seen similar issues in the past when running the tests under llvmpipe, and when multiple D3D devices are initialized. The llvmpipe GL context is memory hungry and it quickly fills the 32-bit address space.
This doesn't disculp this changes in any way and it could be very well related, if for some reason the messages here are causing GL contexts to be re-created more often or at different times.
For the ddraw issue, I can't guess where it comes from, I believe I've seen the errors before but I'll have to investigate. I'll probably need to re-create the test environment to be sure, these tests tend to be annoying to run as they changes the display modes.
--
https://gitlab.winehq.org/wine/wine/-/merge_requests/944#note_11182
This series improves support for blocks which spread across several
non contiguous memory chunks.
Mingw/Gcc tends to emit quite a few of these, especially in 32bit mode.
Now the gaps (between two valid ranges) will no longer be understood
as being part of the block, hence potentially hiding valid information
lying in other blocks.
Note that native doesn't support blocks with multiple ranges of addresses
(MSVC stores the information quite differently), so these ranges will
be used internally but not exposed to DbgHelp's user.
--
https://gitlab.winehq.org/wine/wine/-/merge_requests/1091
--
v2: comctl32: Add helper for getting icon from HPROPSHEETPAGE.
comctl32: Add helper for getting title from HPROPSHEETPAGE.
comctl32: Add helper for loading dialog template from HPROPSHEETPAGE.
https://gitlab.winehq.org/wine/wine/-/merge_requests/1072
_mbctolower_l - converts multibyte uppercase character to lowercase 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/mbctolowe…
More information about application crash:
https://bugs.winehq.org/show_bug.cgi?id=45273
--
v2: msvcrt: implement missing _mbsupr_s_l CRT function to fix ChessBase 14 crash
msvcrt: implement missing _mbslwr_s_l CRT function to fix ChessBase 14 crash
msvcrt: implement missing _mbctoupper_l CRT function to fix ChessBase 14 crash
msvcrt: implement missing _mbctolower_l CRT function to fix ChessBase 14 crash
https://gitlab.winehq.org/wine/wine/-/merge_requests/1090
On Tue Oct 18 12:28:34 2022 +0000, Rémi Bernon wrote:
> Can `current_modref` really still be NULL now if
> `LdrGetProcedureAddress` also sets it?
Seems like it, although I haven't verified it rigorously.
--
https://gitlab.winehq.org/wine/wine/-/merge_requests/7#note_11165
On Tue Oct 18 12:28:32 2022 +0000, Rémi Bernon wrote:
> I think you can simplify this a bit, by doing `if ((current_modref =
> get_modref(...)))`, after saving its previous value, and restoring it
> before leaving the CS.
> Then I'm not sure what side effects this could have, and maybe it'd be
> better to have this specific change separate from the rest?
How about
```c
RtlEnterCriticalSection( &loader_section );
prev = current_modref;
wm = get_modref( module );
if (wm) current_modref = wm;
if (!wm) ret = STATUS_DLL_NOT_FOUND;
else
{ ... }
current_modref = prev;
RtlLeaveCriticalSection( &loader_section );
```
--
https://gitlab.winehq.org/wine/wine/-/merge_requests/7#note_11162
On Tue Oct 18 15:32:53 2022 +0000, Jinoh Kang wrote:
> Also note that the forward[1-3] DLLs are exactly designed to test
> transitively forwarded exports.
Correction:
The importer DLL references not only the final DLL but also every intermediate DLL in the forward chain. Intermediate DLLs do not gain any new dependencies, even if they are used in the resolution process of forwarded exports. Only the earliest import DLLs gain dependencies.
--
https://gitlab.winehq.org/wine/wine/-/merge_requests/7#note_11161
On Tue Oct 18 15:31:21 2022 +0000, Jinoh Kang wrote:
> > Then what happens here if `find_ordinal_export` finds another
> transitive forwarded export? Should we still keep the same `current_modref`?
> Yes, we should. The importer DLL references the eventual DLL the target
> object resides in, not any of the intermediate DLL in the forward chain.
> > Should we add the second forwarded module to the first one
> dependencies instead?
> No, we should only add the last non-forwarding module to the importer
> DLL's dependencies.
Also note that the forward[1-3] DLLs are exactly designed to test transitively forwarded exports.
--
https://gitlab.winehq.org/wine/wine/-/merge_requests/7#note_11158
> Then what happens here if `find_ordinal_export` finds another transitive forwarded export? Should we still keep the same `current_modref`?
Yes, we should. The importer DLL references the eventual DLL the target object resides in, not any of the intermediate DLL in the forward chain.
> Should we add the second forwarded module to the first one dependencies instead?
No, we should only add the last non-forwarding module to the importer DLL's dependencies.
--
https://gitlab.winehq.org/wine/wine/-/merge_requests/7#note_11157
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
--
v7: msvcrt: implement missing CRT functions to fix ChessBase 14 crash
https://gitlab.winehq.org/wine/wine/-/merge_requests/1080
@rbernon Thanks for your review! Right now I'm tentatively putting this MR on hold until I find a solution for a memory leak: a new (redundant) dependency edge is added every time the application calls `GetProcAddress()` on a forwarded ref.
--
https://gitlab.winehq.org/wine/wine/-/merge_requests/7#note_11151
This change is adding DWARF (CFI) unwind information to the
hand-written assembly of the `__wine_syscall_dispatcher` function.
This enables unwinding through the dispatcher from the Linux stack
into (and through) the Windows stack.
The general idea is that the `syscall_frame` struct contains the
content of the callee-save registers before the function call
(in particular the stack pointer and the return address). At any
point of the execution, we have a pointer into the `syscall_frame`
in $rcx, $rbp or $rsp.
For the CFI codes the general idea is that we are defining the
computations of the callee-save registers based on the
`syscall_frame` using DWARF’s `breg` instruction, rather than
relative to CFA.
This change adds a bunch of convenience macros, to (hopefully)
improve readability of the CFI instructions.
Note: Those change was used with great success for unwinding through
the dispatcher using a modified LLDB shown in the
[“how-wine-works-101”](https://werat.dev/blog/how-wine-works-101/)
blog post as well as for in the [Orbit profiler](https://github.com/google/orbit),
that has mixed-callstack unwinding support.
Test: Inspect callstacks reported by the Orbit profiler while
running some Windows targets using the modified wine, as well as
verify debugging reports correct callstacks when stepping with our
modified LLDB through the dispatcher itself (so that we are able
to unwind through the dispatcher at any instruction).
--
v6: ntdll: Add CFI unwind info to __wine_syscall_dispatcher (x86_64)
https://gitlab.winehq.org/wine/wine/-/merge_requests/1065
Using a dedicated exit jmpbuf and removing the need for assembly
routines.
When Wine handles an exception in unix code, we return to user mode by
jumping to the last syscall frame. This can leave some pthread cancel
cleanups registered, in the pthread internal linked list, and at the
same time later overwrite the stack frame they were registered for.
In the same way, jumping to the exit frame on thread exit or abort, can
also leave some cleanup handlers registered for invalid stack frames.
Depending on the implementation, calling pthread_exit will cause all the
registered pthread cleanup handlers to be called, possibly jumping back
to now overwritten stack frames and causing segmentation faults.
Exiting a pthread normally, by returning from its procedure, or calling
exit(0) for the main thread doesn't run pthread_exit and doesn't call
cleanup handlers, avoiding that situation.
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=52213
### Additional note:
For robustness, we should probably try to execute these cleanup handlers
when unwinding the stack frames, as we would otherwise leave pthread
objects in a potential problematic state (like a mutex locked, etc).
It is however hard to do so when the handlers are registered from some C
code: pthread C implementation is done by calling some internal pthread
functions to register the handlers, and they aren't registered as
standard unwind handlers.
Only pthread_cancel and pthread_exit can unwind and call / unregister
the C handlers, but interrupting that procedure, for instance calling
setjmp / longjmp from withing our own handler isn't supported.
From C++ code, pthread cleanup handlers are registered through C++ class
constructors / destructors, and it would then be possible to partially
unwind and call them at the same time.
--
v2: ntdll: Remove unnecessary signal_start_thread register spilling.
ntdll: Remove unnecessary arch specific exit frame pointer.
ntdll: Avoid calling pthread_exit on thread exit.
loader: Allow __wine_main return without emitting a warning.
https://gitlab.winehq.org/wine/wine/-/merge_requests/1088
This change is adding DWARF (CFI) unwind information to the
hand-written assembly of the `__wine_syscall_dispatcher` function.
This enables unwinding through the dispatcher from the Linux stack
into (and through) the Windows stack.
The general idea is that the `syscall_frame` struct contains the
content of the callee-save registers before the function call
(in particular the stack pointer and the return address). At any
point of the execution, we have a pointer into the `syscall_frame`
in $rcx, $rbp or $rsp.
For the CFI codes the general idea is that we are defining the
computations of the callee-save registers based on the
`syscall_frame` using DWARF’s `breg` instruction, rather than
relative to CFA.
This change adds a bunch of convenience macros, to (hopefully)
improve readability of the CFI instructions.
Note: Those change was used with great success for unwinding through
the dispatcher using a modified LLDB shown in the
[“how-wine-works-101”](https://werat.dev/blog/how-wine-works-101/)
blog post as well as for in the [Orbit profiler](https://github.com/google/orbit),
that has mixed-callstack unwinding support.
Test: Inspect callstacks reported by the Orbit profiler while
running some Windows targets using the modified wine, as well as
verify debugging reports correct callstacks when stepping with our
modified LLDB through the dispatcher itself (so that we are able
to unwind through the dispatcher at any instruction).
--
v5: ntdll: Add CFI unwind info to __wine_syscall_dispatcher (x86_64)
https://gitlab.winehq.org/wine/wine/-/merge_requests/1065
Rémi Bernon (@rbernon) commented about dlls/ntdll/loader.c:
> proc = find_ordinal_export( wm->ldr.DllBase, exports, exp_size,
> atoi(name+1) - exports->Base, load_path );
> } else
> proc = find_named_export( wm->ldr.DllBase, exports, exp_size, name, -1, load_path );
Then what happens here if `find_ordinal_export` finds another transitive forwarded export? Should we still keep the same `current_modref`? Should we add the second forwarded module to the first one dependencies instead?
--
https://gitlab.winehq.org/wine/wine/-/merge_requests/7#note_11123
Rémi Bernon (@rbernon) commented about dlls/ntdll/loader.c:
> " If you are using builtin %s, try using the native one instead.\n",
> forward, debugstr_w(get_modref(module)->ldr.FullDllName.Buffer),
> debugstr_w(get_modref(module)->ldr.BaseDllName.Buffer) );
> + if (wm) LdrUnloadDll( wm->ldr.DllBase );
> + }
> + else if (current_modref)
> + {
> + add_module_dependency( current_modref->ldr.DdagNode, wm->ldr.DdagNode );
Maybe we can then always add the module dependency after it's been loaded?
--
https://gitlab.winehq.org/wine/wine/-/merge_requests/7#note_11122
Rémi Bernon (@rbernon) commented about dlls/ntdll/loader.c:
>
> RtlEnterCriticalSection( &loader_section );
>
> - /* check if the module itself is invalid to return the proper error */
> - if (!get_modref( module )) ret = STATUS_DLL_NOT_FOUND;
> - else if ((exports = RtlImageDirectoryEntryToData( module, TRUE,
> - IMAGE_DIRECTORY_ENTRY_EXPORT, &exp_size )))
> + wm = get_modref( module );
> + if (!wm) ret = STATUS_DLL_NOT_FOUND;
> + else
> {
> - void *proc = name ? find_named_export( module, exports, exp_size, name->Buffer, -1, NULL )
> - : find_ordinal_export( module, exports, exp_size, ord - exports->Base, NULL );
> - if (proc)
> + prev = current_modref;
> + current_modref = wm;
I think you can simplify this a bit, by doing `if ((current_modref = get_modref(...)))`, after saving its previous value, and restoring it before leaving the CS.
Then I'm not sure what side effects this could have, and maybe it'd be better to have this specific change separate from the rest?
--
https://gitlab.winehq.org/wine/wine/-/merge_requests/7#note_11120
Using a dedicated exit jmpbuf and removing the need for assembly
routines.
When Wine handles an exception in unix code, we return to user mode by
jumping to the last syscall frame. This can leave some pthread cancel
cleanups registered, in the pthread internal linked list, and at the
same time later overwrite the stack frame they were registered for.
In the same way, jumping to the exit frame on thread exit or abort, can
also leave some cleanup handlers registered for invalid stack frames.
Depending on the implementation, calling pthread_exit will cause all the
registered pthread cleanup handlers to be called, possibly jumping back
to now overwritten stack frames and causing segmentation faults.
Exiting a pthread normally, by returning from its procedure, or calling
exit(0) for the main thread doesn't run pthread_exit and doesn't call
cleanup handlers, avoiding that situation.
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=52213
### Additional note:
For robustness, we should probably try to execute these cleanup handlers
when unwinding the stack frames, as we would otherwise leave pthread
objects in a potential problematic state (like a mutex locked, etc).
It is however hard to do so when the handlers are registered from some C
code: pthread C implementation is done by calling some internal pthread
functions to register the handlers, and they aren't registered as
standard unwind handlers.
Only pthread_cancel and pthread_exit can unwind and call / unregister
the C handlers, but interrupting that procedure, for instance calling
setjmp / longjmp from withing our own handler isn't supported.
From C++ code, pthread cleanup handlers are registered through C++ class
constructors / destructors, and it would then be possible to partially
unwind and call them at the same time.
--
https://gitlab.winehq.org/wine/wine/-/merge_requests/1088
--
v2: 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: Create a unixlib interface for GL functions.
https://gitlab.winehq.org/wine/wine/-/merge_requests/1087
With this series it's now possible to run and pass `user32:monitor` and `user32:sysparams` tests with nulldrv, and so most `user32` tests (except for a few desktop cursor position tests). This still requires some prefix configuration to enable the nulldrv driver, or a change like https://gitlab.winehq.org/rbernon/wine/-/commit/753368ad0ec52f03f8d6e78ca79… to enable it when `DISPLAY` environment variable is unset.
This then shows that some of the user32 tests are failing with winex11 but passing with nulldrv, as in https://gitlab.winehq.org/rbernon/wine/-/commit/6d5f4109a514a0dc266899fcacf….
--
v10: win32u: Read mode from the registry if GetCurrentDisplaySettings fails.
win32u: Write display settings to the registry in apply_display_settings.
win32u: Lock display devices while applying display settings.
win32u: Use an internal WINE_DM_PRIMARY_DEVICE flag on primary adapter modes.
win32u: Remove the device name parameter from GetCurrentDisplaySettings.
win32u: Force update display cache after NtUserChangeDisplaySettingsEx.
win32u: Add a BOOL force parameter to update_display_cache.
https://gitlab.winehq.org/wine/wine/-/merge_requests/551
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
--
v6: fix: reintroduce _mbsupr_s_l and _mbctolower_l in msvcr100.spec
Revert "fix: temporarly remove new tests"
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
--
v5: revert spec definitions
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
--
v4: fix: temporarly remove new tests
msvcrt: implement missing CRT functions to fix ChessBase 14 crash
https://gitlab.winehq.org/wine/wine/-/merge_requests/1080
This change has been in Proton to fix a bug in the DayZ launcher.
The launcher is a .NET application that, best I can tell, contains marshaling code that calls SetWindowPlacement incorrectly. This results in undefined memory being passed in and broken values returned by GetWindowPlacement. I think the value passed in must be broken on Windows, but as the tests show, Windows rejects SetWindowPlacement calls that don't have length set correctly (but not GetWindowPlacement, as zeroing the structure to give it an invalid length in `other_process_proc` shows).
--
https://gitlab.winehq.org/wine/wine/-/merge_requests/1081