[WIP] Basic C++ support for windows#918
Closed
t-moe wants to merge 2 commits into
Closed
Conversation
Member
|
Nice work, we needed this long ago |
|
@wtdcode by removing old_dev you might have accidentally closed this pr... Can this be easily re targeted to dev? |
Member
15 tasks
Member
|
i changed the base to dev. @t-moe can you please resolv the conflict ? |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR is based on #917. Complete that one first.
#377 mentions that a simple hello world from C++ on windows, causes a crash.
Demo Code + Crash
HelloWorld.Cpp build with vs2019 for x86 (32 bit)
Invocation using qiling before applying this PR (dev branch).
The reason for this crash is, that
std::coutis not initialized.std::coutis usually initialized by the dll entry point of msvcp140d.dll.There are two ways of fixing this:
This PR focuses on the 2nd approach. The supplied changes patch some windows API functions so that the DllMain of msvcp140d.dll runs through and does not longer crash. This will intialize
std::coutand prevent the crash inmain().In the current state of the PR "hello world" does not appear on the console yet. However, the sample application does no longer crash and instead terminates successfully after running main with exit code 0 🥳 .
New output
generated by qiling after applying this PRNote that uncaught_exception is a getter. There is no exception happening.
Next Steps:
std::coutto the console.Checklist
Which kind of PR do you create?
Coding convention?
Extra tests?
Changelog?
Target branch?
One last thing