-
Notifications
You must be signed in to change notification settings - Fork 261
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Improve Reko's handling of compiler emitted boiler-plate entry points #205
Comments
The sequence of instructions seems to be like |
There is call of __startup at the end of RussianText.exe entry function.
|
This is right only for Borland (not sure about differences between versions of Borland linker), of course. Visual C and other compilers are used other way to start *.exe file |
And this works only for x86 on Win32. A more general solution is required to dig out the WinMain / main program from the C startup code (which typically isn't interesting). Other decompilers do pattern matching of various sorts to figure this out. We may want to look at their solutions to see if any could be applied to Reko. |
But PeImageLoader changes for .exe (not sure about dlls) introduced in 7c49dcc should be undone |
It's tricky. The entry point for a Win32 PE executable does have that signature, but it isn't the "real" |
So it seems we have a few issues to resolve here
|
And finally, the big question: do think this is worth postponing the 0.6.0.0 release to implement this? There are obviously workarounds (manually selecting the "real" My personal opinion is to finish 0.6.0.0, which has a lot of GUI work that I want to release, and then focus on more code-generation stuff in the next release. |
I agree
Really? Are you sure that crt startup has
signature? I'm not sure but it looks like crt startup has not arguments. It gets hInstance, lpCmdLine and other arguments from Win API functions and passes them to WinMain |
You're right, Pavel, I was thinking of Win16 (yes, I'm that old). According to Raymond Chen (https://blogs.msdn.microsoft.com/oldnewthing/20110525-00/?p=10573/) the signature is
It seems to me that fixing all these entrypoint items will have to wait until after 0.6.0.0 is released. Agree? BTW: reko already has some mechanisms in place to detect signatures for the purpose of detecting unpackers. I suggest we use those mechanisms to identify and process CRT startup code, to save a lot of time. |
All I want is the correct name and signature for PE *.exe entry point. I think it is a little fix and should be done in 0.6.0.0 |
I suggest that you make the correction in the |
Do you mean replacing |
Yes, let fix both name and signature. |
OK, I'll do it when I'll have spare time. |
Yes let's do both at the same time. |
... but DllMain is correct. See https://msdn.microsoft.com/en-us/library/windows/desktop/ms682583%28v=vs.85%29.aspx and PySample |
Indeed. We want correct signatures for both and correct names for both. |
Done in 2bccebe |
Now it could be closed, is not it, John? |
Actually, I'll leave this open. We want to track the other items in the checklist above. |
Each implementation of |
Starting on |
An implementation of Each
Can we consider this a reasonable resolution for the issue? |
Good! Now Reko discovers main procedure for RussianText.exe
Yes, we can |
WinMain is not entry point of PE .exe binary.
Let's see RussianText.exe. Its entry point is at 0x401018. Its main function (int main(int argc, char* argv[]), not WinMain) is at 0x401168 (it's not discovered by Reko but it is another issue)
The text was updated successfully, but these errors were encountered: