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

fix min/max() compiling issue when NOMINMAX is predefined #101

Merged
merged 16 commits into from
May 9, 2021

Conversation

randydu
Copy link
Contributor

@randydu randydu commented May 8, 2021

When both and Microsoft's header (Windows.h / WinDefs.h) are included in a same unit, the min/max() will cause compiler issue if NOMINMAX is not defined. (ref: http://www.suodenjoki.dk/us/archive/2010/min-max.htm)

In my use case, I adds a global "/D NOMINMAX" to c++ compiler option to disable the MS min/max macro expansion, otherwise other cross-platform libs using std::min/max() will fail to compile.

When NOMINMAX is globally predefined, we must use std::min/std::max() to explicitly specify that we are using standard algorithm, otherwise c++ compiler cannot resolve min/max unless "using namespace std" is declared.

After this fix is applied, I've verified that my project can build successfully with or without NOMINMAX globally predefined.

+ implements push-ret based INPLACE scheme to avoid random crash issue if code-cave
  is modified after api hooking.
- fix a code-cave-pattern (NOP2_RET) too small issue that can corrupt code;
  (ref: memset.asm)
@stevemk14ebr
Copy link
Owner

My build env is just windows with msvc so I appreciate you trying other configurations and correcting this

@stevemk14ebr stevemk14ebr merged commit d30b357 into stevemk14ebr:master May 9, 2021
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.

None yet

2 participants