https://bugs.winehq.org/show_bug.cgi?id=47079
Bug ID: 47079 Summary: CreateToolhelp32Snapshot(TH32CS_SNAPMODULE, <pid>) fails with error 998 (ERROR_NOACCESS) Product: Wine Version: 4.6 Hardware: x86-64 OS: Linux Status: UNCONFIRMED Severity: normal Priority: P2 Component: kernel32 Assignee: wine-bugs@winehq.org Reporter: davidebeatrici@gmail.com Distribution: ---
Hello,
I was testing, on a 64 bit prefix, an application which makes use of CreateToolhelp32Snapshot() with the TH32CS_SNAPMODULE flag to retrieve a snapshot of the modules loaded by a specific process (its ID is the second and last argument to the function).
The application was not working as expected and after debugging it I found out that CreateToolhelp32Snapshot() returns INVALID_HANDLE_VALUE and GetLastError() returns 998, which corresponds to ERROR_NOACCESS.
After seeing that CreateToolhelp32Snapshot() succeeds with one of the "native" Wine processes (e.g. explorer.exe), I discovered that the issue only happens when the application calling CreateToolhelp32Snapshot() has a different architecture compared to the target process (32 bit vs 64 bit or vice versa).
Best regards, Davide
https://bugs.winehq.org/show_bug.cgi?id=47079
--- Comment #1 from Nikolay Sivov bunglehead@gmail.com --- Could you attach a test application for that issue? Preferably something that compiles with mingw-w64.
P.S. there is also TH32CS_SNAPMODULE32 that we don't use.
https://bugs.winehq.org/show_bug.cgi?id=47079
--- Comment #2 from Davide Beatrici davidebeatrici@gmail.com --- I created a test application: https://github.com/davidebeatrici/createtoolhelp32snapshot_test