Subject: x64dbg cannot find builtin libraries references when running on the Guix's wine

From: Carlos <[email-masked]>
Date: Mon, 14 Apr 2025 02:06:15 +0000

Hi!

I'm facing a strange bug on wine that seems to be present only on the 
guix build.

In summary, I'm running a debugger through wine (x64dbg) and a specific 
functionality is misbehaving when compared with the same program running 
on another distributions (formerly, I use to get it working in Gentoo 
and Void Linux).

The problem itself is that x64dbg seems to be unable to resolve builtin 
libraries at the import table of an executable. That is, if there's some 
random dll file used by the exe in the same directory, x64dbg is able to 
resolve it and show the symbols it exports and etc. But if the .exe is 
linked against some of the builtin dlls provided by wine, it just fails 
and shows the error "GetFileNameFromHandle failed", which is a function 
of x64dbg. Apparently, the point of code where this function is called 
on x64dbg is: 
https://github.com/x64dbg/x64dbg/blob/a5a25cc4a46d3823078050d548a5322849cb245c/src/dbg/commands/cmd-debug-control.cpp#L124

By the way, running wine with WINEDEBUG=warn+all shown some interesting 
log lines that occurs for a lot of dlls and is not present on the wine 
tested in another distribution, except for the first one:

0158:warn:file:NtCreateFile 
L"\\??\\Z:\\home\\mim\\projects\\gc\\gc2-client-cd\\shlwapi.dll" not 
found (c0000034)
0158:warn:module:virtual_map_builtin_module 
L"\\??\\C:\\windows\\system32\\shlwapi.dll" found in WINEDLLPATH but not 
a builtin, ignoring
0150:warn:file:NtCreateFile 
L"\\??\\Z:\\home\\mim\\projects\\gc\\gc2-client-cd\\x64dbg\\x32\\??? 
(GetFileNameFromHandle failed)" not found (c0000033)

I've tested 3 versions of wine on guix: 9.0, 9.17 (the exact one that I 
had working on Void Linux) and 10.0.

Thank you all,
Carlos