stevemk14ebr / PolyHook_2_0

C++20, x86/x64 Hooking Libary v2.0
MIT License
1.58k stars 222 forks source link

cmake and linux specific bugfixes #170

Closed fligger closed 1 year ago

fligger commented 1 year ago

Removes missplaced source path which breaks cmake build in CMakeLists.txt.

"attribute((always_inline))" needs an additional "inline" to build correctly.

gcc does not like the goto statement without the curly brackets.

With these changes polyhook should build fine on linux.

stevemk14ebr commented 1 year ago

Please revert the formatting changes done to the dissassembler and I will merge. Thanks for finding and fixing these!

fligger commented 1 year ago

Hope I reverted as expected.

Just to be clear: The curly braces are needed to avoid the following error: (output paths are stripped)

[build] ZydisDisassembler.cpp:105:1: error: jump to label ‘exit’
[build]   105 | exit:
[build]       | ^~~~
[build]  ZydisDisassembler.cpp:53:22: note:   from here
[build]    53 |                 goto exit;
[build]       |                      ^~~~
[build] ZydisDisassembler.cpp:58:14: note:   crosses initialization of ‘bool endHit’
[build]    58 |         bool endHit = false;
[build]       |              ^~~~~~
[build] ZydisDisassembler.cpp:57:18: note:   crosses initialization of ‘uint64_t offset’
[build]    57 |         uint64_t offset = 0;
[build]       |                  ^~~~~~

This of course can also be fixed by replacing goto exit; with delete[] buf; \n return insVec; (removing the goto command completely.)

stevemk14ebr commented 1 year ago

Ah, that makes sense, I like duplicating the exit actually