0xnobody / vmpdump

A dynamic VMP dumper and import fixer, powered by VTIL.
GNU General Public License v3.0
1.12k stars 209 forks source link

WinPE/nt_headers.hpp: __builtin_ctz not defined #25

Open MeFisto94 opened 1 year ago

MeFisto94 commented 1 year ago

Line 183:

inline void set_alignment( uint32_t a ) { alignment = a == 0x10 ? 0x0 : __builtin_ctz( a ) + 1; }

Apparently, MSVC doesn't know that builtin (it stems from GCC), so I added a quick workaround into common.hpp, but I don't know if it's universally correct:

#ifndef __builtin_ctz
#define __builtin_ctz __lzcnt
#endif

Have you been building with GCC/MinGW, or am I not using the correct MSVC version?

Edit: On a side note, I need to clean-build everytime, because on the second incremental compile, my setup (CLion via CMake and the VS 2019 (16) generator) runs into a stack overflow, because it ignores the /STACK pragma. I've tried to fix it by forcing the following into CMake, not sure if that really helps, I'll see, but also it's not platform independent: target_link_options(${PROJECT_NAME} PRIVATE /STACK:34359738368)

NamelessG0d commented 1 year ago

Same here

psyirius commented 5 months ago

Use clang-cl (C++20)