[Bug 30432] New: UpdateResource doesn't update PE checksum neither Resource Table virtual address
http://bugs.winehq.org/show_bug.cgi?id=30432 Bug #: 30432 Summary: UpdateResource doesn't update PE checksum neither Resource Table virtual address Product: Wine Version: 1.3.26 Platform: x86 OS/Version: Linux Status: UNCONFIRMED Severity: minor Priority: P2 Component: kernel32 AssignedTo: wine-bugs(a)winehq.org ReportedBy: kervala(a)gmail.com Classification: Unclassified Hi, I'm implementing a mt.exe clone which only can add a manifest to an EXE or DLL file. When I call BeginUpdateResource, UpdateResource and EndUpdateResource under Windows to add a .manifest to a .exe the modified .exe has a valid checksum and its Resource Table virtual address in PE header is defined. Later if I call LoadLibrary and FindResourceEx with the resulting, it returns a correct pointer on the manifest resource. But if I call the same functions under Linux with WINE, the manifest seems to be added to the EXE but the EXE checksum is set to 0 and Resource Table virtual address too, so if I check the Manifest with FindResourceEx it returns NULL because it can't find it. I have some .exe with and without manifest and the corresponding .manifest if you're interested to compare PE header. I also have a test case to check if manifest is found. Please could you fix that ? Thanks -- Configure bugmail: http://bugs.winehq.org/userprefs.cgi?tab=email Do not reply to this email, post in Bugzilla using the above URL to reply. ------- You are receiving this mail because: ------- You are watching all bug changes.
http://bugs.winehq.org/show_bug.cgi?id=30432 Jerome Leclanche <adys.wh(a)gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |adys.wh(a)gmail.com --- Comment #1 from Jerome Leclanche <adys.wh(a)gmail.com> 2012-04-14 10:11:03 CDT --- Please attach the test case, it'll help -- Configure bugmail: http://bugs.winehq.org/userprefs.cgi?tab=email Do not reply to this email, post in Bugzilla using the above URL to reply. ------- You are receiving this mail because: ------- You are watching all bug changes.
http://bugs.winehq.org/show_bug.cgi?id=30432 --- Comment #2 from Cédric OCHS <kervala(a)gmail.com> 2012-04-14 10:21:25 CDT --- Created attachment 39792 --> http://bugs.winehq.org/attachment.cgi?id=39792 testcase with an exe without manifest and manifest to add There is the compiled test case with VC++ 2010 Express. test.exe is a basic executable without manifest test.exe.manifest is the manifest to be added to the exe testcase.exe is the testcase that tries to add manifest to the exe and next check if the manifest is accessible. When launching under Window, I got : Manifest added Found manifest Under Linux with WINE, I got : Manifest added Could not locate manifest -- Configure bugmail: http://bugs.winehq.org/userprefs.cgi?tab=email Do not reply to this email, post in Bugzilla using the above URL to reply. ------- You are receiving this mail because: ------- You are watching all bug changes.
http://bugs.winehq.org/show_bug.cgi?id=30432 --- Comment #3 from Cédric OCHS <kervala(a)gmail.com> 2012-04-14 10:22:34 CDT --- Created attachment 39793 --> http://bugs.winehq.org/attachment.cgi?id=39793 Testcase source There is the C++ source of the testcase that is using all necessary kernel32.dll API. -- Configure bugmail: http://bugs.winehq.org/userprefs.cgi?tab=email Do not reply to this email, post in Bugzilla using the above URL to reply. ------- You are receiving this mail because: ------- You are watching all bug changes.
http://bugs.winehq.org/show_bug.cgi?id=30432 Cédric OCHS <kervala(a)gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |kervala(a)gmail.com -- Configure bugmail: http://bugs.winehq.org/userprefs.cgi?tab=email Do not reply to this email, post in Bugzilla using the above URL to reply. ------- You are receiving this mail because: ------- You are watching all bug changes.
http://bugs.winehq.org/show_bug.cgi?id=30432 --- Comment #4 from Cédric OCHS <kervala(a)gmail.com> 2012-04-14 14:47:43 CDT --- I investigated further on this issue and it seems to occur only if the executable doesn't have any resource before adding the manifest. -- Configure bugmail: http://bugs.winehq.org/userprefs.cgi?tab=email Do not reply to this email, post in Bugzilla using the above URL to reply. ------- You are receiving this mail because: ------- You are watching all bug changes.
http://bugs.winehq.org/show_bug.cgi?id=30432 --- Comment #5 from Cédric OCHS <kervala(a)gmail.com> 2012-04-14 14:51:24 CDT --- Created attachment 39797 --> http://bugs.winehq.org/attachment.cgi?id=39797 Resulting test.exe under Windows and under Linux with WINE There are the 2 resulting exe : - test_with_manifest_windows.exe under Windows - test_with_manifest_wine.exe under Linux with WINE -- Configure bugmail: http://bugs.winehq.org/userprefs.cgi?tab=email Do not reply to this email, post in Bugzilla using the above URL to reply. ------- You are receiving this mail because: ------- You are watching all bug changes.
http://bugs.winehq.org/show_bug.cgi?id=30432 Cédric OCHS <kervala(a)gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Summary|UpdateResource doesn't |UpdateResource doesn't |update PE checksum neither |update Resource Table |Resource Table virtual |virtual address |address | -- Configure bugmail: http://bugs.winehq.org/userprefs.cgi?tab=email Do not reply to this email, post in Bugzilla using the above URL to reply. ------- You are receiving this mail because: ------- You are watching all bug changes.
http://bugs.winehq.org/show_bug.cgi?id=30432 --- Comment #6 from Cédric OCHS <kervala(a)gmail.com> 2012-04-14 15:39:29 CDT --- I updated issue title because PE checksum is optional and a bad value is not important. -- Configure bugmail: http://bugs.winehq.org/userprefs.cgi?tab=email Do not reply to this email, post in Bugzilla using the above URL to reply. ------- You are receiving this mail because: ------- You are watching all bug changes.
https://bugs.winehq.org/show_bug.cgi?id=30432 Austin English <austinenglish(a)gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Keywords| |download, testcase Status|UNCONFIRMED |NEW Ever confirmed|0 |1 --- Comment #7 from Austin English <austinenglish(a)gmail.com> --- The original testcase still fails in git: austin(a)aw25 ~/test $ wine testcase.exe fixme:heap:HeapSetInformation (nil) 1 (nil) 0 fixme:process:SetProcessDEPPolicy (1): stub fixme:heap:HeapSetInformation (nil) 1 (nil) 0 fixme:process:SetProcessShutdownParameters (00000380, 00000000): partial stub. fixme:heap:HeapSetInformation (nil) 1 (nil) 0 Manifest added Could not locate manifest austin(a)aw25 ~/test $ wine --version wine-1.7.16-178-g7e874ae I'm not sure what the updated testcase is supposed to do, but they both pass for me: austin(a)aw25 ~ $ wine test_with_manifest_windows.exe ; echo $? fixme:heap:HeapSetInformation (nil) 1 (nil) 0 0 austin(a)aw25 ~ $ wine test_with_manifest_wine.exe ; echo $? fixme:heap:HeapSetInformation (nil) 1 (nil) 0 0 -- Do not reply to this email, post in Bugzilla using the above URL to reply. You are receiving this mail because: You are watching all bug changes.
https://bugs.winehq.org/show_bug.cgi?id=30432 --- Comment #8 from Cédric OCHS <kervala(a)gmail.com> --- Yes, both functions are called successfully but result is not correct :) The manifest was not added to executable, you can check it manually by viewing the executable with a Hex editor. And the test program displayed : Manifest added Could not locate manifest While it should display : Manifest added Found manifest -- Do not reply to this email, post in Bugzilla using the above URL to reply. You are receiving this mail because: You are watching all bug changes.
http://bugs.winehq.org/show_bug.cgi?id=30432 Sebastian Lackner <sebastian(a)fds-team.de> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |sebastian(a)fds-team.de --- Comment #9 from Sebastian Lackner <sebastian(a)fds-team.de> --- Created attachment 48791 --> http://bugs.winehq.org/attachment.cgi?id=48791 kernel32: Update VirtualAddress of resource section in write_raw_resources. I'm wondering that noone else looked at this issue yet - if I don't miss anything the virtual address should be relatively easy to fix. I've attached a patch that lets the test succeed with "Found manifest". Please report back if it solves the issue (and doesn't break anything else), if yes I'll send it to wine-patches. The checksum is a bit more difficult to fix, because either kernel32 would have to import imagehlp (which is most likely not allowd) or we have to duplicate code. This file already seems to contain a function to calculate the checksum: http://source.winehq.org/source/dlls/imagehlp/modify.c#L88 -- Do not reply to this email, post in Bugzilla using the above URL to reply. You are receiving this mail because: You are watching all bug changes.
http://bugs.winehq.org/show_bug.cgi?id=30432 --- Comment #10 from Cédric OCHS <kervala(a)gmail.com> --- Thanks a lot for the patch Sebastian, I'm compiling WINE with it and I'll check it :) About checksum, I don't think it's so important because it works anyway with a wrong one (always to 0). -- Do not reply to this email, post in Bugzilla using the above URL to reply. You are receiving this mail because: You are watching all bug changes.
http://bugs.winehq.org/show_bug.cgi?id=30432 --- Comment #11 from Cédric OCHS <kervala(a)gmail.com> --- It seems to work perfectly :) Thanks again and great job for this patch ! -- Do not reply to this email, post in Bugzilla using the above URL to reply. You are receiving this mail because: You are watching all bug changes.
http://bugs.winehq.org/show_bug.cgi?id=30432 Bruno Jesus <00cpxxx(a)gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Keywords| |patch -- Do not reply to this email, post in Bugzilla using the above URL to reply. You are receiving this mail because: You are watching all bug changes.
http://bugs.winehq.org/show_bug.cgi?id=30432 --- Comment #12 from Sebastian Lackner <sebastian(a)fds-team.de> --- Thanks for testing :) My patch (including some additional tests) was submitted to wine-patches: http://source.winehq.org/patches/data/105118 BTW: As it turns out this problem can even be reproduced with the wine test suite - it just wasn't noticed because the tests didn't explicitly check the resource directory virtual address. -- Do not reply to this email, post in Bugzilla using the above URL to reply. You are receiving this mail because: You are watching all bug changes.
http://bugs.winehq.org/show_bug.cgi?id=30432 --- Comment #13 from Sebastian Lackner <sebastian(a)fds-team.de> --- My patch got upstream today, so this problem should be fixed with commit: http://source.winehq.org/git/wine.git/patch/270d66efc74c11d86ea1c62d289c825a... Which will be included in wine >= 1.7.21. -- Do not reply to this email, post in Bugzilla using the above URL to reply. You are receiving this mail because: You are watching all bug changes.
https://bugs.winehq.org/show_bug.cgi?id=30432 Nikolay Sivov <bunglehead(a)gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Fixed by SHA1| |270d66efc74c11d86ea1c62d289 | |c825a225b1f37 Status|NEW |RESOLVED Resolution|--- |FIXED --- Comment #14 from Nikolay Sivov <bunglehead(a)gmail.com> --- Most likely fixed with 270d66efc74c11d86ea1c62d289c825a225b1f37. -- Do not reply to this email, post in Bugzilla using the above URL to reply. You are receiving this mail because: You are watching all bug changes.
https://bugs.winehq.org/show_bug.cgi?id=30432 Alexandre Julliard <julliard(a)winehq.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|RESOLVED |CLOSED --- Comment #15 from Alexandre Julliard <julliard(a)winehq.org> --- Closing bugs fixed in 1.7.36. -- Do not reply to this email, post in Bugzilla using the above URL to reply. You are receiving this mail because: You are watching all bug changes.
participants (1)
-
wine-bugs@winehq.org