Comments (16)
I created a new project with just a main function and nothing else, I then Added this into my CMakeLists.txt file:
but I get this output:
Any ideas?
from safetyhook.
Looks like we had a typo in the README.md for the example. Sorry about that. Try again.
from safetyhook.
I’ve opened an issue on bddisasm about this stuff, hopefully it’ll compile on other compilers without hassle soon. I’ll update this issue as I find out more.
from safetyhook.
I never actually tried using GCC to compile this project. I've gone ahead and fixed the issues I ran into when doing so in commit 59a4d32. Give that a try.
from safetyhook.
Also, this project has no dependency on pegtl. Are you sure you made this issue on the right project?
from safetyhook.
Now I'm having issues with bddisasm. Currently using mingw64 gcc
from safetyhook.
bddisasm is a tricky one. I've only had luck compiling it with MSVC on windows, it refuses to work with clang-cl (my main compiler). Basically, it refuses to work with FetchContent specifically when my compiler is using clang-cl.
Could you maybe try installing Visual Studio and use MSVC with VCPKG in CMake (bootstrap it or whatever)? I have no issues compiling bddisasm when I do this.
from safetyhook.
I got bddisasm working by following the guide on its repo, and building from either the CMake section, or vcpkg section. Even though I fixed bddisasm, I still had other issues with safetyhook where upon calling auto builder = factory->acquire();
I believe it would just crash (this is on x64) I gave up trying to figure out what was wrong since the implementation looked easy but there was too many issues. Might give it another go though
from safetyhook.
That is very odd. I’ve never had it crash ever since I found two bugs a while back that were fixed. If you do try it again and it crashes please post a log or crash dump/debugging info if you don’t mind, thanks!
from safetyhook.
Here are some issues I'm having currently (using mingw64 gcc). I've linked a video recording of the whole creation of a test program from start to finish here
- When including bddisasm into the cmake file, I have to fix the
static __forceinline
to just__forceinline
. Doesn't seem to play well with static. - I cannot include
<SafetyHook.hpp>
directly, I have to follow the relative path from the build folder to access it. - When using anything from the SafetyHook file, I get undefined references to things.
This is where I'm currently at when retrying to use this library. BTW I cannot remember how I got it to work somehow last time.
from safetyhook.
Thanks! Really helpful information. I had a lot of issues with bddisasm on clang-cl myself because of AES intrinsics. I think most of these issues (mine and yours) stem from bddisasm specifically. Their repo states: “The build process was tested with GCC and Clang on Linux and MSVC on Windows.”. Maybe it would be a good idea to open issues on their side and ask about clang-cl/gcc on windows.
from safetyhook.
Hi! Could you try again to see if bddisasm compiles without issue now? The nice dev(s) over there added a fix that works for me on clang-cl: bitdefender/bddisasm@102b43d
from safetyhook.
It seems they've fixed the static issue that was in bddisasm and I also found that including target_link_libraries(<project name> safetyhook)
into the CMakeList.txt file allows me to include the SafetyHook file regularly as described in the tutorial. There is another issue that appears which is bddisasm-src/bddisasm/bddisasm.c:4164: undefined reference to __stack_chk_fail
and it seems you have to add -fstack-protector
as a link flag which removes the error. I do get another problem now with safetyhook this time though which I believe I was having before I gave up last time. Using the example given, whenever I run the example it seems to have a Segmentation fault in the constructor of ThreadFreezer
from safetyhook.
My only guess at this point is something funky is going on with your compiler, etc. I used mingw to compile bddisasm and it’s tools without any warnings. Though, I didn’t test for 32-bit. About the exception: Is there any chance you could try a different debugger or something? I don’t see how an exception could happen there. Also could you post your exact “gcc —version” and how you installed it?
from safetyhook.
gcc.exe (x86_64-posix-seh-rev0, Built by MinGW-W64 project) 8.1.0
Copyright (C) 2018 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
Pretty sure I installed it either through the cygwin installer or from here
from safetyhook.
I've finally got it working. It turns out that the crash was specific to the compiler that I was using. I deleted it and decided to download msys2 and install mingw64 g++ from here. Really weird issue, but I guess I fixed it, though one little grime I still have is that I still need to include target_link_libraries(project safetyhook m)
to be able to include the file without following the relative path from the build folder.
from safetyhook.
Related Issues (20)
- Windows loader lock can cause a deadlock after thread suspension
- LdrpModuleDatatableLock and other ntdll mechanisms can cause a deadlock after thread freezing HOT 1
- Compiling broken on clang-cl HOT 4
- Thread IP/register corruption due to late SuspendThread? HOT 1
- NtGetNextThread exception in UWP apps HOT 10
- Inline hook not applying with program optimization enabled HOT 1
- Calling original of functions with references in the parameters causes crashing HOT 3
- Add an option to let midhook call original first instead of calling hook code first HOT 3
- Is it possible to skip the original instruction in midhook? HOT 5
- Multiple definition of type_info HOT 3
- MidHook: RSP is off by sizeof(void*)
- MidHook x86: ESP is offset by -8 HOT 8
- ResumeThread causes crash when unfreezing, possibly due to unhandled SuspendThread error HOT 5
- Allow to disable original bytes restoration in hook's destructor HOT 2
- Instruction translating for RIP-relative addresses. HOT 11
- Missing call to SetThreadContext HOT 1
- Vcpkg support HOT 4
- [PR #63] Crashes when attempting to hook LoadLibraryExW HOT 3
- Fast toggling of hooks HOT 6
- create_inline: game launched via Rockstar Games Launcher crashes HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from safetyhook.