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

[safetyhook] new port #43983

Draft
wants to merge 3 commits into
base: master
Choose a base branch
from
Draft

[safetyhook] new port #43983

wants to merge 3 commits into from

Conversation

llm96
Copy link
Contributor

@llm96 llm96 commented Feb 23, 2025

  • Changes comply with the maintainer guide.
  • The name of the port matches an existing name for this component on https://repology.org/ if possible, and/or is strongly associated with that component on search engines.
  • Optional dependencies are resolved in exactly one way. For example, if the component is built with CMake, all find_package calls are REQUIRED, are satisfied by vcpkg.json's declared dependencies, or disabled with CMAKE_DISABLE_FIND_PACKAGE_Xxx.
  • The versioning scheme in vcpkg.json matches what upstream says.
  • The license declaration in vcpkg.json matches what upstream says.
  • The installed as the "copyright" file matches what upstream says.
  • The source code of the component installed comes from an authoritative source.
  • The generated "usage text" is accurate. See adding-usage for context.
  • The version database is fixed by rerunning ./vcpkg x-add-version --all and committing the result.
  • Only one version is in the new port's versions file.
  • Only one version is added to each modified port's versions file.

@llm96
Copy link
Contributor Author

llm96 commented Feb 23, 2025

@microsoft-github-policy-service agree

@jimwang118 jimwang118 added the category:new-port The issue is requesting a new library to be added; consider making a PR! label Feb 24, 2025
"description": "C++23 procedure hooking library.",
"homepage": "https://github.com/cursey/safetyhook",
"license": "BSL-1.0",
"supports": "(windows | linux) & !arm & !uwp",
Copy link
Contributor

Choose a reason for hiding this comment

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

Does the upstream clearly indicate that arm and uwp are not supported? Can you explain it?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Only 32-bit and 64-bit x86 are explicitly supported in this header. It's also mentioned in the README.md, although this is slightly out of date as there is support for Linux now.

From a brief search of UWP + the functions in the CI error log, it seems like SEH isn't possible under it, which the project uses for thread trapping. Admittedly, I'm not familiar with using/building UWP applications, so I can't say for certain.

D:\b\safetyhook\src\v0.6.4-e3cea2541a.clean\src\os.windows.cpp(101): error C3861: 'IsBadReadPtr': identifier not found
D:\b\safetyhook\src\v0.6.4-e3cea2541a.clean\src\os.windows.cpp(105): error C3861: 'IsBadWritePtr': identifier not found
D:\b\safetyhook\src\v0.6.4-e3cea2541a.clean\src\os.windows.cpp(171): error C3861: 'AddVectoredExceptionHandler': identifier not found
D:\b\safetyhook\src\v0.6.4-e3cea2541a.clean\src\os.windows.cpp(174): error C3861: 'RemoveVectoredExceptionHandler': identifier not found

Found similar build errors in Catch2 here: catchorg/Catch2#1020

Copy link
Contributor

Choose a reason for hiding this comment

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

Yes, I also found this problem when searching, and an upstream member replied to fix this problem, so I'm not sure if it's not supported by uwp.

@llm96
Copy link
Contributor Author

llm96 commented Feb 25, 2025

Is there anything I can do to fix the x64 Linux build? I'm able to build it locally with GCC v14.2, but the CI runner appears to be using v11.4 and I don't think std::expected was made available until v12.

-- The C compiler identification is GNU 11.4.0
-- The CXX compiler identification is GNU 11.4.0
Change Dir: '/mnt/vcpkg-ci/b/safetyhook/x64-linux-dbg'

Run Build Command(s): /mnt/vcpkg-ci/downloads/tools/ninja-1.12.1-linux/ninja -v -v -j33 install
[1/10] /usr/bin/c++ -DZYCORE_STATIC_BUILD -DZYDIS_STATIC_BUILD -I/mnt/vcpkg-ci/b/safetyhook/src/v0.6.4-e3cea2541a.clean/include -isystem /mnt/vcpkg-ci/installed/x64-linux/include -fPIC -g -std=gnu++23 -Wall -Wextra -Wshadow -Wnon-virtual-dtor -pedantic -MD -MT CMakeFiles/safetyhook.dir/src/easy.cpp.o -MF CMakeFiles/safetyhook.dir/src/easy.cpp.o.d -o CMakeFiles/safetyhook.dir/src/easy.cpp.o -c /mnt/vcpkg-ci/b/safetyhook/src/v0.6.4-e3cea2541a.clean/src/easy.cpp
FAILED: CMakeFiles/safetyhook.dir/src/easy.cpp.o 
/usr/bin/c++ -DZYCORE_STATIC_BUILD -DZYDIS_STATIC_BUILD -I/mnt/vcpkg-ci/b/safetyhook/src/v0.6.4-e3cea2541a.clean/include -isystem /mnt/vcpkg-ci/installed/x64-linux/include -fPIC -g -std=gnu++23 -Wall -Wextra -Wshadow -Wnon-virtual-dtor -pedantic -MD -MT CMakeFiles/safetyhook.dir/src/easy.cpp.o -MF CMakeFiles/safetyhook.dir/src/easy.cpp.o.d -o CMakeFiles/safetyhook.dir/src/easy.cpp.o -c /mnt/vcpkg-ci/b/safetyhook/src/v0.6.4-e3cea2541a.clean/src/easy.cpp
In file included from /mnt/vcpkg-ci/b/safetyhook/src/v0.6.4-e3cea2541a.clean/include/safetyhook/easy.hpp:7,
                 from /mnt/vcpkg-ci/b/safetyhook/src/v0.6.4-e3cea2541a.clean/src/easy.cpp:1:
/mnt/vcpkg-ci/b/safetyhook/src/v0.6.4-e3cea2541a.clean/include/safetyhook/inline_hook.hpp:8:10: fatal error: expected: No such file or directory
    8 | #include <expected>
      |          ^~~~~~~~~~
compilation terminated.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
category:new-port The issue is requesting a new library to be added; consider making a PR!
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants