protonscr

Make sharedgpures from winevulkan less restrictive in the processes handles it uses to duplicate handles

wineclosed
ValveSoftware/wine#304 · opened 2025-12-16 by xzn · updated 2025-12-16 · 1 comments · github
Xxzn 2025-12-16 github

With Final Fantasy XIV December 16 2025 update,

when using OptiScaler dx11on12 mode (e.g. for XeSS or FSR4), before the update it was working,

presently it would crash with some d3d11 error, which can be traced to the following code failing with access denied error.

With the following suggested change the setup (OptiScaler dx11on12 with FFXIV) works again.

diff --git a/dlls/sharedgpures.sys/shared_resource.c b/dlls/sharedgpures.sys/shared_resource.c
index ad836662af0..3c20540bff8 100644
--- a/dlls/sharedgpures.sys/shared_resource.c
+++ b/dlls/sharedgpures.sys/shared_resource.c
@@ -51,7 +51,7 @@ static void *reference_client_handle(obj_handle_t handle)
     cid.UniqueProcess = PsGetCurrentProcessId();
     cid.UniqueThread = 0;
 
-    if (NtOpenProcess(&client_process, PROCESS_ALL_ACCESS, &attr, &cid) != STATUS_SUCCESS)
+    if (NtOpenProcess(&client_process, PROCESS_DUP_HANDLE, &attr, &cid) != STATUS_SUCCESS)
         return NULL;
 
     if (NtDuplicateObject(client_process, wine_server_ptr_handle(handle), NtCurrentProcess(), &kernel_handle,
@@ -226,7 +226,7 @@ static obj_handle_t open_client_handle(void *object)
     cid.UniqueProcess = PsGetCurrentProcessId();
     cid.UniqueThread = 0;
 
-    if (NtOpenProcess(&client_process, PROCESS_ALL_ACCESS, &attr, &cid) != STATUS_SUCCESS)
+    if (NtOpenProcess(&client_process, PROCESS_DUP_HANDLE, &attr, &cid) != STATUS_SUCCESS)
         return 0;
 
     if (ObOpenObjectByPointer(object, 0, NULL, GENERIC_ALL, NULL, KernelMode, &kernel_handle) != STATUS_SUCCESS)

I don't know anything about this but maybe the game update attempts to do some anti-cheat, since previously the setup works fine. Now the PROCESS_VM_WRITE permission is missing from the handle sharedgpures.sys tries to open. (So PROCESS_ALL_ACCESS fails.)

Apologies if I should've posted this in the FFXIV Proton issue, the change is more general though so hopefully here is more appropriate for feedback.

Kkisak-valve maintainer 2025-12-16 github

Hello @xzn, yes, the behavior change you're seeing should be mentioned in the game's compatibility report on the Proton issue tracker and a pull request should be sent to the upstream wine project for review.

For the Proton half of this, I've gone ahead and transferred this issue report to https://github.com/ValveSoftware/Proton/issues/580#issuecomment-3662940764.

Upstream links