http://bugs.winehq.org/show_bug.cgi?id=58162
Bug ID: 58162 Summary: GetPrivateProfileIntA/W and WritePrivateProfileStringA/W does not detour properly. Product: Wine Version: 10.6 Hardware: x86-64 OS: Linux Status: UNCONFIRMED Severity: normal Priority: P2 Component: kernel32 Assignee: wine-bugs@winehq.org Reporter: hibbsncc1701@gmail.com Distribution: ---
Created attachment 78443 --> http://bugs.winehq.org/attachment.cgi?id=78443 sone_patch's debug log under Windows 10.
When trying to detour a Recettear - An Item Shop's Tale's custom.exe using https://gitlab.com/redpolline/sone_patch, all attempts to update the game's config ini file fail under Wine, but work under Windows.
The game's custom.exe uses the GetPrivateProfileIntA() and WritePrivateProfileStringA() functions to access the game's ini file instead of calling CreateFileA(), ReadFile(), and WriteFile() directly.
I assume that the cause is Wine possibly having GetFullPathNameW() as a statically linked symbol within the context of GetPrivateProfileIntA() and WritePrivateProfileStringA(). (As all three of them are exported by kernel32.dll, and therefore the compiler would not need to search for the symbol at build time.) But I could be wrong here.
What matters is that when sone_patch detours GetFullPathNameA/W(), GetPrivateProfileIntA() and WritePrivateProfileStringA() should be affected by that detour without being detoured themselves.
A good way to see this is by using sone_patch's debug build, as it logs when a detoured function is hit, along with the given arguments.
Under Windows 10, multiple calls to GetFullPathNameA/W() are seen in the log. (But no CreateFileA/W() for the ini file.)
Under Wine, no calls are logged at all for the ini file. The only call to GetFullPathNameW() seen under Wine is for C:\windows\resources\themes\light\light.msstyles. Which isn't present under the Windows log, so that one is Wine specific.)
As a result, the game's button config and display settings cannot be altered by the game's custom.exe. As it gets the original (developer intended) file which is read-only (and owned by another user) on my system. Which sone_patch is supposed to workaround through the detouring of GetFullPathNameA/W() to point custom.exe to an accessible file elsewhere.