http://bugs.winehq.org/show_bug.cgi?id=32779
Bug #: 32779 Summary: RegOpenKeyExA fails on 64bit wine when build with lazarus (fpc 2.6 - 64bit) Product: Wine Version: 1.5.22 Platform: x86-64 OS/Version: Linux Status: NEW Severity: normal Priority: P2 Component: -unknown AssignedTo: wine-bugs@winehq.org ReportedBy: kgbricola@web.de Classification: Unclassified
Created attachment 43283 --> http://bugs.winehq.org/attachment.cgi?id=43283 Testcases as source and binary (fpc32/64, mingw32/64)
Somehow 64bit executables build with lazarus (fpc 2.6) fail when calling RegOpenKeyExA().
Attached are the test cases and builds for 32/64 bit RegOpenKeyExA with fpc and with mingw.
- All 32bit builds work on 32bit and 64bit wine. - mingw 64bit build works on wine 64 bit - fpc 64bit build fails on wine 64 bit - All builds work on windows 32 bit / 64 bit
For reference see the tests: https://testbot.winehq.org/JobDetails.pl?Key=24050 https://testbot.winehq.org/JobDetails.pl?Key=24051 https://testbot.winehq.org/JobDetails.pl?Key=24052 https://testbot.winehq.org/JobDetails.pl?Key=24053
http://bugs.winehq.org/show_bug.cgi?id=32779
--- Comment #1 from Rico kgbricola@web.de 2013-01-22 03:50:34 CST --- Created attachment 43291 --> http://bugs.winehq.org/attachment.cgi?id=43291 updated mingw64 to show the problem.
New mingw test case to show the problem, see https://testbot.winehq.org/JobDetails.pl?Key=24062 which works on win, but fails on wine.
#define HKEY_CURRENT_USER ((HKEY)(LONG_PTR)(LONG)0x80000001)
laz64: fixme:reg:RegOpenKeyExA hkey1 0x80000001 fixme:reg:RegOpenKeyExA hkey2 0x80000001
mingw64: fixme:reg:RegOpenKeyExA hkey1 0xffffffff80000001 fixme:reg:RegOpenKeyExA hkey2 0x30
So imho the HKEY_CURRENT_USER supplied by laz64 doesn't match the predefined version in wine and thus it fails in get_special_root_hkey() - http://source.winehq.org/git/wine.git/blob/HEAD:/dlls/advapi32/registry.c#l2... .
http://bugs.winehq.org/show_bug.cgi?id=32779
Rico kgbricola@web.de changed:
What |Removed |Added ---------------------------------------------------------------------------- Attachment #43291|text/x-csrc |text/plain mime type| |
http://bugs.winehq.org/show_bug.cgi?id=32779
--- Comment #2 from Rico kgbricola@web.de 2013-01-22 04:23:03 CST --- Created attachment 43292 --> http://bugs.winehq.org/attachment.cgi?id=43292 Hack to workaround the problem.
Attached is a hack to workaround the problem.
There may be other functions which have the same problem (e.g. RegOverridePredefKey).
http://bugs.winehq.org/show_bug.cgi?id=32779
--- Comment #3 from Nikolay Sivov bunglehead@gmail.com 2013-01-22 04:27:57 CST --- Does it help if you make it ULONG_PTR in winreg.h? That's what PSDK does.
http://bugs.winehq.org/show_bug.cgi?id=32779
--- Comment #4 from Rico kgbricola@web.de 2013-01-22 05:10:28 CST --- ((HKEY)(ULONG_PTR)(LONG)0x80000001) does not work, but ((HKEY)(ULONG_PTR)(ULONG)0x80000001) works fine. This breaks the mingw build (see http://sourceforge.net/apps/trac/mingw-w64/browser/trunk/mingw-w64-headers/i... ).
Maybe the correct step is using ((HKEY)(ULONG_PTR)(ULONG)0x80000001) for HKEY_CURRENT_USER and later comparing hkey like: (hkey & 0xffffffff) == HKEY_CURRENT_USER ?
http://bugs.winehq.org/show_bug.cgi?id=32779
--- Comment #5 from Nikolay Sivov bunglehead@gmail.com 2013-01-22 05:23:40 CST --- Well, I think first thing to fix is to use ULONG_PTR for definitions as does PSDK and apparently mingw-w64. Next step is to test how 64 bit windows handles special HKEYs with non-zero high DWORD (not necessary (DWORD)~0 but (DWORD)0xdeadbeef too for example), if it works regardless of what's in higher DWORD we should mask out everything there when checking for special keys.
http://bugs.winehq.org/show_bug.cgi?id=32779
Rico kgbricola@web.de changed:
What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |RESOLVED Resolution| |FIXED
--- Comment #6 from Rico kgbricola@web.de 2013-01-24 13:14:20 CST --- Fixed by cea0e758e632fcc27a057c656d271e532f7646bc .
http://bugs.winehq.org/show_bug.cgi?id=32779
Rico kgbricola@web.de changed:
What |Removed |Added ---------------------------------------------------------------------------- Fixed by SHA1| |cea0e758e632fcc27a057c656d2 | |71e532f7646bc
http://bugs.winehq.org/show_bug.cgi?id=32779
Alexandre Julliard julliard@winehq.org changed:
What |Removed |Added ---------------------------------------------------------------------------- Status|RESOLVED |CLOSED
--- Comment #7 from Alexandre Julliard julliard@winehq.org 2013-02-01 04:57:54 CST --- Closing bugs fixed in 1.5.23.
https://bugs.winehq.org/show_bug.cgi?id=32779
Anastasius Focht focht@gmx.net changed:
What |Removed |Added ---------------------------------------------------------------------------- CC| |focht@gmx.net Component|-unknown |advapi32
https://bugs.winehq.org/show_bug.cgi?id=32779
Anastasius Focht focht@gmx.net changed:
What |Removed |Added ---------------------------------------------------------------------------- Keywords| |win64