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

Add MINGW cross-compilation support and fix occational windows codepatch issues #3

Merged
merged 7 commits into from
Aug 18, 2023

Conversation

burnedram
Copy link
Contributor

@burnedram burnedram commented Aug 15, 2023

While trying out the changes in neeetman's PR #2 I had trouble getting the build to work with MSVC.
I had more success cross-compiling using Cygwin and MINGW so I thought that I'd contribute my findings.
Additionally I added my proposed fix to #2 with a simple VirtualProtectEx fallback.

I also found a few pain-points that is more than likely due to not using MSVC:

  • Re-typedefing standard types (int8_t, int16_t, etc)
  • Implicit FARPROC -> void * conversion (only supported by MSVC)
  • Inconsistent code patterns in code-buffer-x64.cc
  • Undefined behaviour in GetProtectionFromMemory

The first three are probably toolchain related, but the fourth actually made the program not work as memory did not get (un)protected correctly.

Copy link
Member

@ManlyMarco ManlyMarco left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me, thanks for the PR!

Copy link
Member

@Kasuromi Kasuromi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, using VirtualProtectEx and opening a handle to the current process still feels like a niche solution to me, but I'll merge it for now.

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.

3 participants