@jacek sorry I somehow missed your comment on the other MR
I'm not sure I like the patch as is...
- I wonder if kernelbase.CtrlRoutine should only be called for CUI programs... MSDN doc is as usual imprecise (it speaks about all descendants, and all descendants attached to the same console)
- quick test show that a GUI process isn't killed by GenerateConsoleCtrlEvent
+ tested parent + console, cp_flags=0 and pgid = parent's pgid
+ tested parent + console, cp_flags=detached + new group, pgid = child.id
=> it doesn't fully anwser whether CtrlRoutine is called or not for GUI
- it assumes pgid are inherited for gui (but we don't have proper tests AFAICT)
moreover it means that we'd want two different behaviors when receiving SIGINT (whether it's a genuine unix signal or one sent by the server if we follow the tests result above)
perhaps, the solution would be in the default_ctrl_handler to only terminate the program if attached to a console, or in the program group of a unix console
remark: Wine unix console is the sole case where launching a GUI program from command line doesn't return immediately to prompt (native & builtin cmd implementation only wait on CUI programs completion). But that's conform to unix behavior.
note: I'm not even sure tweeking with setsid whould be useful as anyway the unix console is in raw mode, so only conhost regenerates the signals
--
https://gitlab.winehq.org/wine/wine/-/merge_requests/3312#note_39749
CFI directives allow the context stored on the stack by raise_func_trampoline
to be used to unwind to any exception handlers as required when dispatching
an exception. As the dispatcher may change its input context in e.g.
BTCpuResetToConsistentState and these changes also need to be used when
unwinding make sure to pass this copy of the context to
KiUserExceptionDispatcher as opposed to the copy initially stored on the stack,
which is not taken into account when unwinding.
--
v2: ntdll: Avoid storing a second ctx copy in the aarch64 raise trampoline
ntdll: Add aarch64 DWARF register definitions.
https://gitlab.winehq.org/wine/wine/-/merge_requests/3365
What about my suggestion from !3290? Something like the attached [patch](/uploads/86c669e3c725b4f009338e80379552f4/patch.diff) should make it work, but we'd probably need some adjustments to `setsid` heuristics as well.
--
https://gitlab.winehq.org/wine/wine/-/merge_requests/3312#note_39734
rebased in order to get rid of error of compilation on mac
failure on amstream is still present: looks like a generic issue when exiting gstreamer in 32bit (can repro locally without that MR applied)
@julliard need to do something else?
--
https://gitlab.winehq.org/wine/wine/-/merge_requests/3312#note_39733
CFI directives allow the context stored on the stack by raise_func_trampoline
to be used to unwind to any exception handlers as required when dispatching
an exception. As the dispatcher may change its input context in e.g.
BTCpuResetToConsistentState and these changes also need to be used when
unwinding make sure to pass this copy of the context to
KiUserExceptionDispatcher as opposed to the copy initially stored on the stack,
which is not taken into account when unwinding.
--
https://gitlab.winehq.org/wine/wine/-/merge_requests/3365
Windows 10 [received support](https://devblogs.microsoft.com/commandline/af_unix-comes-to-window… for AF_UNIX sockets in Insider Build 17063. This merge request adds basic support for AF_UNIX sockets to ws2_32 and wineserver.
Of particular note is the difficulty in handling `sun_path`. Most of the functions that allow for translating Windows paths to Unix paths are not accessible from ws2_32. I considered the following options:
* Pass the Windows path to wineserver and do the conversion there.
* This is, as far as I can tell, not possible without major rearchitecting. wineserver does not have functions to translate Windows paths to Unix paths, for obvious reasons.
* Obtain the current working directory of the requesting process and temporarily change directories to there.
* This only handles relative paths and fails for absolute paths, UNC paths, etc.
* Conditionally change directories based on whether the path is relative or not.
* This is error-prone and wineserver does not have the requisite functions to do this cleanly.
I ultimately decided to pass the translated Unix path to wineserver, which changes directories to `dirname(path)`. It then provides `bind` and `connect` with `basename(path)`. This is not threadsafe, but wineserver is not (currently) multithreaded.
Abstract sockets are supported by this patch.
--
v45: ws2_32/tests: Add test for AF_UNIX sockets fix.
server: Fix getsockname() and accept() on AF_UNIX sockets.
server: Introduce error when attempting to create a SOCK_DGRAM AF_UNIX socket.
server: Allow for deletion of socket files.
ws2_32: Add support for AF_UNIX sockets.
ntdll/unix: Add support for AF_UNIX sockets to multiple functions.
ws2_32: Add afunix.h header.
https://gitlab.winehq.org/wine/wine/-/merge_requests/2786
`getpeername()` is currently handled in ntdll. This merge request changes ntdll to forward `getpeername()` to wineserver. The implementation utilises new `peer_addr` and `peer_addr_len` fields in wineserver's `struct sock`.
This fixes multiple `todo_wine`s in `ws2_32/tests` and allows for more accurate peer names to be provided in case the address the socket is bound to on the Unix side does not match what `bind()` was called with on the Windows side.
*This merge request was originally intended to be included in !2786 (Add support for AF_UNIX sockets) but was split into its own merge request because this is not an insignificant change.*
--
v22: server: Move getpeername() implementation from ntdll/unix.
https://gitlab.winehq.org/wine/wine/-/merge_requests/3074
This is probably the most ugly and controversial bit of API. I don't really know
if this is the right approach to solving this.
sm4 registers match by register index, such that shaders can mostly be compiled
in isolation. sm1 does not—registers may be specified in any order in the vertex
and pixel shaders, and will be matched by usage and usage index.
By itself this is not much of a problem. Where it gets hairy is that we want to
do some degree of caching, as well as pre-compilation, and avoid recompiling
either shader every time it's matched with a new one.
Wine currently deals with this problem, for GLSL, by generating a "main" GLSL
shader for the vertex shader, and then an extra function setup_vs_output(), and
linking the two together every time a new pixel shader is used. This could in
theory be used for SPIR-V, but it requires the use of extra, probably external,
code to link SPIR-V shaders together, which I do not particularly anticipate
being well-received.
(I'm not sure how Wine deals with this problem in the ARB backend. It seems to
take the pixel shader signature into account when generating the vertex shader—
cf. init_output_registers()—but it doesn't take it into account when looking up
a vertex shader variant? I didn't look too closely at the code, so maybe I'm
missing something.)
--
The vkd3d parts of this patch are quite straightforward, and looking at them, I
think the design is quite intuitive in isolation. There may be some room for
internal refactoring (in particular with an eye to not so much overloading
the "register_index" field of struct shader_signature_element) but I'm
relatively happy with the way it turned out. In isolation, that is.
The Wine part is worse. I've uploaded branches for vkd3d and Wine that use this
API, and correctly handle shaders with some nontrivial reordering:
https://gitlab.winehq.org/zfigura/vkd3d/-/commits/himavant5https://gitlab.winehq.org/zfigura/wine/-/commits/himavant_cb
The test can be run, as before, like so:
make tests/shader_runner.exe && WINE_D3D_CONFIG=renderer=vulkan wine tests/shader_runner.exe ../vkd3d/tests/hlsl/sm1-interstage-interface.shader_test
The interesting Wine parts are concentrated in a single patch, 5cfb9d930f11e.
The patch takes a few shortcuts, partly because I wanted not to block the vkd3d
API design questions, but also because while writing it I came up with a couple
of problems that I wasn't sure how to fix. There are two main problems I see:
(1) This patch has the user pass the signature from the pixel shader when
compiling the vertex shader, and looks up register indices already
arbitrarily allocated by the pixel shader. This is problematic when trying
to use this signature as a cache key, by virtue of it not being clear (or
even defined) which fields are key elements and which aren't. It's also not
particularly kind to lookup, on account of not being directly comparable
with memcmp(). There are a few options I see:
(a) Provide an internal function to compare key elements. This feels... odd,
like a very special-purpose function, but perhaps workable.
(b) Just make the user deal with it, and assert that all fields are key
elements.
(c) Use some alternative, perhaps shortened structure as a field of
vkd3d_shader_next_stage_info. This has the disadvantage that it is not
as simple for a hypothetical user to retrieve from the pixel shader, but
we would presumably provide a function to generate one from a shader
signature. This would probably also be kinder to cache lookup if it's
shorter.
(d) Make caching vkd3d's responsibility, to some degree. This seems
daunting, but the more we optimize, the more difficult it may be to
design API that allows for nice caching.
(2) Assuming we use signatures, there is a memory management problem that
5cfb9d930f11e spells out. This is probably a matter of "just fix it", but
I suppose another option is to take the GLSL or ARB architecture.
--
April is the cruellest month, breeding
Lilacs out of the dead land, mixing
Memory and desire, stirring
Dull roots with spring rain.
--
https://gitlab.winehq.org/wine/vkd3d/-/merge_requests/280
On Fri Jul 21 01:25:37 2023 +0000, Henri Verbeet wrote:
> > For the d3d12 and shader runner tests I've been using an environment
> variable to specify the path to DXC, HLSL source declarations in
> d3d12.c, and an `[enable]` directive in shader runner. Are those
> acceptable for upstream?
> It's of course not ideal to depend on DXC/dxcompiler for the DXIL shader
> runner tests like that, but I think we can work with that, yes. There's
> some precedent as well, because we can also use d3dcompiler for running
> shader runner tests.
> In terms of the checksum, the most practical way to make that work in
> the shader runner is probably to introduce a flag like
> "VKD3D_SHADER_PARSE_DXBC_IGNORE_CHECKSUM" for vkd3d_shader_parse_dxbc(),
> then use that to parse the DXBCs produced by Linux DXC, and use
> vkd3d_shader_serialize_dxbc() to create a DXBC blob to pass to
> d3d12/vkd3d. Also, would we need to use DXC, or could we use the
> dxcompiler library?
Using dxcompiler would be preferable, but instead of COM interfaces it uses C++ linking, and when I tried using it a while ago I couldn't get the calling conventions to match up, even if the C declaration was explicitly declared the same convention as the dxcompiler function. It worked if I added a wrapper in a C++ source file, but we probably don't want that. I'll take another look and see if they can be made to match up.
--
https://gitlab.winehq.org/wine/vkd3d/-/merge_requests/278#note_39702
It's a clean-room reimplementation that mimics Windows 10 program's output format.
It prints all the information that is available via KerbQueryTicketCacheMessage.
Also tested to work on Windows if dynamically linked + built with winegcc.
For further extension of the functonality, implementing
KerbQueryTicketCacheEx{,2,3}Message is required.
--
v12: klist: Add a program that lists Kerberos tickets.
https://gitlab.winehq.org/wine/wine/-/merge_requests/3347
`wcsncpy` and `GetLocaleInfoEx` take length in number of characters, but `size` and `ret` counts number of bytes.
Previous commit changed a call to `GetLocaleInfoW` which counts lenght in `TCHAR`s (aka bytes), to the current `GetLocaleInfoEx`, which is probably the source of this confusion.
--
v4: msvcrt: Fix out-of-bound access in create_locinfo.
https://gitlab.winehq.org/wine/wine/-/merge_requests/3358
Shader visibility is currently ignored, but we don't want to create Vulkan descriptor sets for CPU heaps.
--
v3: vkd3d: Do not create Vulkan descriptor sets for non-shader-visible heaps.
vkd3d: Return a null handle from GetGPUDescriptorHandleForHeapStart() for non-shader-visible heaps.
tests: Test GetGPUDescriptorHandleForHeapStart() on a non-shader-visible heap.
vkd3d: Enable Vulkan-backed heaps for each heap instead of per device.
https://gitlab.winehq.org/wine/vkd3d/-/merge_requests/272
Recap:
I implemented relative addressing in !229, but I was suggested to handle register indexes by moving all the registers to the heap, which I did in https://gitlab.winehq.org/fcasas/vkd3d/-/commits/nonconst-offsets-6. A part of this implementation required !269, but I was asked to try to turn the sm4 register structs into the vkd3d-shader register structs instead, to get closer to a common low level IR.
This is the first part of that transformation. The whole thing is in https://gitlab.winehq.org/fcasas/vkd3d/-/commits/use_vkd3d_reg.
This is built on top of !225 (the first two patches), so it may be good to get that upstream first.
---
This patch series aims to do the following replacements:
```
struct sm4_register -> struct vkd3d_shader_register
struct sm4_dst_register -> struct vkd3d_shader_dst_param
struct sm4_src_register -> struct vkd3d_shader_src_param
```
to get us closer to a common level IR and simplify the implementation of relative-addressing.
To achieve this, the fields in the sm4 register structs are replaced with fields in the vkd3d-shader structs or removed altogether, one at the time.
As can be seen when looking at the whole branch, it is possible to do this transformation without having to add additional fields to `struct vkd3d_shader_register`, by restricting each register type to a single `enum vkd3d_sm4_dimension` (and its src registers to a single `enum vkd3d_sm4_swizzle_type`) by default.
The only exception we need so far is for registers sampler registers: They always have dimension NONE, except when used as arguments of gather instructions, in which case they have dimension VEC4 and SCALAR swizzle. This, and similar exceptions we may find in the future, can be handled using the opcode_info, as in 7/8 (81e17506ba2cb1fbf4d021159ab1692af0940d06).
--
https://gitlab.winehq.org/wine/vkd3d/-/merge_requests/281
`wcsncpy` and `GetLocaleInfoEx` take length in number of characters, but `size` and `ret` counts number of bytes.
Previous commit changed a call to `GetLocaleInfoW` which counts lenght in `TCHAR`s (aka bytes), to the current `GetLocaleInfoEx`, which is probably the source of this confusion.
--
v2: msvcrt: fix out-of-bound access in create_locinfo
https://gitlab.winehq.org/wine/wine/-/merge_requests/3358
It's a clean-room reimplementation that mimics Windows 10 program's output format.
It prints all the information that is available via KerbQueryTicketCacheMessage.
Also tested to work on Windows if dynamically linked + built with winegcc.
For further extension of the functonality, implementing
KerbQueryTicketCacheEx{,2,3}Message is required.
--
v11: klist: Add a program that lists Kerberos tickets.
https://gitlab.winehq.org/wine/wine/-/merge_requests/3347
It's a clean-room reimplementation that mimics Windows 10 program's output format.
It prints all the information that is available via KerbQueryTicketCacheMessage.
Also tested to work on Windows if dynamically linked + built with winegcc.
For further extension of the functonality, implementing
KerbQueryTicketCacheEx{,2,3}Message is required.
--
v10: klist: Add a program that lists Kerberos tickets.
https://gitlab.winehq.org/wine/wine/-/merge_requests/3347
Shader visibility is currently ignored, but we don't want to create Vulkan descriptor sets for CPU heaps.
--
v2: vkd3d: Do not create Vulkan descriptor sets for non-shader-visible heaps.
vkd3d: Return a null handle from GetGPUDescriptorHandleForHeapStart() for non-shader-visible heaps.
tests: Test GetGPUDescriptorHandleForHeapStart() on a non-shader-visible heap.
vkd3d: Enable Vulkan-backed heaps for each heap instead of per device.
https://gitlab.winehq.org/wine/vkd3d/-/merge_requests/272
Sufficient for compiling a no-op pixel shader.
This should probably be rebased on top of !263 because it introduces vkd3d_spirv_get_type_id_for_data_type(), which 263 renders unnecessary.
!263 is not essential, but I think using two different type systems in the backend is not ideal.
--
v3: vkd3d-shader/dxil: Emit undefined constants.
vkd3d-shader/spirv: Introduce an undefined register type.
vkd3d-shader/dxil: Emit the shader instructions.
vkd3d-shader/spirv: Do not normalise Shader Model 6 shaders.
https://gitlab.winehq.org/wine/vkd3d/-/merge_requests/278
Logically the change here is that the parent shell folder resolves
each child path in 'FORPARSING' mode, instead of resolving itself
and doing a bunch more string concatenation for assumed simple child
pidls.
This also removes hacks for change notifications in the delete path
by actually performing notifications for deletion and trash operations
within the shell op.
Background:
I noticed a comment in the ReactOS version which suggested the first
change, it makes sense to not query the children in this way here.
The notifications hack also seemed really off. I'm not sure why the shell
operation wasn't performing these notifications already.
Testing:
All tests pass, and loading up wine explorer was easy to test the deletion.
Items were deleted (or trashed) and the shell folder was notified.
Unfortunately, copy and paste seem very broken at the moment, as the
paste_pidls function only calls ISFHelper_CopyItems with one pidl at a time,
and it itself seems to fail to correctly resolve the from path.
I did some hacking so that it did work correctly if the 'from' folder was the
desktop, and it worked fine with these changes (but those hacks wouldn't pass
review).
--
https://gitlab.winehq.org/wine/wine/-/merge_requests/3360
This fixes an issue when the path includes non-ASCII characters.
Signed-off-by: Jactry Zeng <jzeng(a)codeweavers.com>
--
v3: mshtml: Call UrlUnescapeW() with URL_UNESCAPE_AS_UTF8 in is_gecko_path().
shlwapi/tests: Test UrlUnescapeW() with URL_UNESCAPE_AS_UTF8.
kernelbase: Implement URL_UNESCAPE_AS_UTF8 for UrlUnescapeW().
shlwapi/tests: Test UrlUnescapeW() with independent data.
https://gitlab.winehq.org/wine/wine/-/merge_requests/585
`wcsncpy` and `GetLocaleInfoEx` take length in number of characters, but `size` and `ret` counts number of bytes.
Previous commit changed a call to `GetLocaleInfoW` which counts lenght in `TCHAR`s (aka bytes), to the current `GetLocaleInfoEx`, which is probably the source of this confusion.
--
https://gitlab.winehq.org/wine/wine/-/merge_requests/3358
This series is basically a single patch but that requires @cmccarthy's !225 first. So, the 2 patches from !225 are included as 1/3 and 2/3.
As can be implied from !225, in SM4 bytecode, all the information regarding whether the register uses a writemask, a swizzle, a dimension index, or none of these, is encoded in the register itself, and doesn't depend on the instruction nor argument position on which the register is used.
The possible register encodings are given by the following diagram:

Where the swizzle_type (MASK4, VEC4, or SCALAR) only matter when the dim is VEC4.
Thus, it makes sense to merge these two types of registers into a single data type as 3/3 does. This has the added benefit of removing additional writemask and swizzle_type arguments to be initialized by pointer in several helper functions.
Also, this would help me to simplify a new version of !229.
--
https://gitlab.winehq.org/wine/vkd3d/-/merge_requests/269
On Wed Jul 19 19:09:02 2023 +0000, Huw Davies wrote:
> There are a lot of changes in this MR, in particular the second commit
> could do with splitting and then the MR itself would ideally be split
> into two.
Done.
--
https://gitlab.winehq.org/wine/wine/-/merge_requests/3328#note_39522
With this pipeline vkd3d automatically gets built on Linux (in an image based on Debian unstable), both in 32 and 64 bit mode. Both builds are tested with radv and llvmpipe. A number of caveats apply, though:
* A number of tests currently fail in llvmpipe, so the llvmpipe jobs are marked as allowed to fail. Ideally we'll eventually fix our bugs and mark the llvmpipe ones in the tests, so that the CI tests completely pass and possible problems in the Vulkan driver are recorded at a better granularity (this is the reason why GitLab says that the pipeline is passed with warnings: the warnings are that there are jobs that failed, even if they were allowed to fail).
* ~~The runners provided by the GitLab instance don't have a GPU available, so I configured my own computer (equipped with an AMD Radeon RX 5700 RX) to provide a runner with access to the GPU. This setup is not currently satisfying: for me, because I use that computer for other things and I don't like having random code submitted to it (it is theoretically sandboxed, but sandboxes are not always bullet-proof, especially if they have access to a GPU); for the users, because my computer might be unavailable at any time. I'll work on a better solution. For the time being I intend the runner to only accept jobs from the master branch; once a better solution is implemented I'd like to run the pipeline for MRs too.~~ **Fixed**, now there is a shared worker with an AMD GPU available.
* While the `Dockerfile` and related assets do not necessarily need to be available in this repository, given that the CI accesses the binary image from the Docker hub anyway, I think it's still valuable to have them, so others can improve them (and for sure improvement opportunities are nowhere near missing). However, other ways to make them available can be found, if for some reason it is not liked to have them in this repository (they are not pretty!).
* ~~One of the reason they are not pretty is that I have a custom hack to compile `widl` from the Wine sources without compiling (or installing from the distribution) the whole of Wine, in the interest of keeping the Docker image small (well, small-ish: Vulkan drivers, compilers and X libraries are not small anyway).~~ **A better solution was implemented**
* ~~Again on the subject of the Docker image, I am currently putting the binary image in my own namespace on the Docker hub. Using the GitLab container registry in the namespace of the Wine project would probably be better, so that I am not a bottleneck in the future.~~ **Done**
* ~~Even if we discount all the points above, this MR cannot be merged yet, because my runner is currently configured for my namespace only. I guess I need the intervention of a GitLab admin to fix that. However, I think there's already material enough for valuable feedback.~~ **Fixed too**
--
v5: ci: Introduce a CI pipeline for GitLab.
https://gitlab.winehq.org/wine/vkd3d/-/merge_requests/271
I expect this is going to be tricky to get in. I ran into the following issues:
* test_ShowWindow behaves very strangely on Windows. It seems this isn't typical behavior, and is caused by an interaction with test_SetFocus, but I'm not sure exactly what it does to the thread state that causes this.
* Many of the SetWindowPos flag combinations tested don't actually show the window on Windows, therefore they don't send EVENT_SYSTEM_FOREGROUND. I was able to reproduce this with a stand-alone test, so it seems to be normal behavior.
* Windows can show a window without activating it, and Wine on X11 can't do that reliably for managed windows.
* There are a couple of cases where Windows sends an event and Wine doesn't. I figure it's OK to not cover every case, but I can go back and investigate those if needed.
This interacts with https://gitlab.winehq.org/wine/wine/-/merge_requests/2314, in that the tests don't really test much without it. I applied that MR for my own testing.
--
v2: win32u: Implement EVENT_SYSTEM_FOREGROUND.
user32: Run tests that notice focus changes early.
https://gitlab.winehq.org/wine/wine/-/merge_requests/2853
Supersedes !3329.
--
v3: server: Cancel pipe asyncs when the last handle in process is closed.
server: Cancel socket asyncs when the last handle in process is closed.
ws2_32/tests: Add test for async cancel on socket's last process handle close.
ntdll/tests: Add test for async cancel on pipe's last process handle close.
https://gitlab.winehq.org/wine/wine/-/merge_requests/3339
Knowing the content of the edit field is more useful than knowing the
strcmp() result. The text field may contain carriage returns and
linefeeds so use wine_dbgstr_a() so they are clearly visible in the
failure message.
Also prefix the ok messages with a unique string to indicate which
test_WM_PASTE() test failed.
---
The old failure messages all look the same so one has to refer to the
line number to know which test actually failed which is pretty tiresome.
Thisis even more so when checking old reports on test.winehq.org or
TestBot job results. It also prevents the TestBot from correctly
identifying failure modes (i.e. all test_WM_PASTE() failures looked the
same to it).
--
https://gitlab.winehq.org/wine/wine/-/merge_requests/3356
Windows only provides the 32-bit API and using todo_wine win_skip() in
the 64-bit case would imply Wine needs fixing. So it's simpler to use
a plain skip().
Other schemes like picking between skip() and win_skip() based on bitness feel like they would be way overkill.
--
v2: msvcrt/tests: Check that some functions are only available in 32-bit code.
https://gitlab.winehq.org/wine/wine/-/merge_requests/2811