Skip to content
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

Implement some functions needed for cmd.exe to work #26

Merged
merged 2 commits into from
Apr 13, 2024

Conversation

TheNNX
Copy link
Contributor

@TheNNX TheNNX commented Apr 13, 2024

Proposed changes implement some functions necessary for cmd.exe to start, most notably _getstdfilex, SetStdioPathW (untested/WIP), GetStdioPathW (untested/WIP), WideCharToMultiByte, and change some existing functions (_fileno, FindFirstFile, FindNextFile).

These changes are not sufficient to start cmd.exe. Here is a branch with a quick and dirty hack to get it working, however, better solutions are necessary. Two main problems are:

The more serious issue of the two is the first one. I see two main ways to solve it:

  • SubsystemTool could patch the PE to add a custom entry point (this is somewhat difficult, as the code section would have to expand)
  • Some sort of self modifying code solution - COREDLL could locate the entrypoint like it does in the quick dirty hack, but instead of invoking it, it could stub it out to intercept it. In the intercepting function, COREDLL would repair the entrypoint, and call it with correct arguments.

@dz333n dz333n merged commit 40fa0b8 into dz333n:master Apr 13, 2024
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants