Add option to use global import hook instead of MinHook for OpenProcess (#860)

This commit is contained in:
kizer 2022-05-31 00:54:29 +09:00 committed by GitHub
parent d1e69ed6fd
commit c5f84eb27d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
13 changed files with 775 additions and 165 deletions

View file

@ -55,6 +55,18 @@ void logging::start_file_logging(const std::filesystem::path& path) {
if (s_hLogFile)
return;
try {
if (exists(path) && file_size(path) > 1048576) {
auto oldPath = std::filesystem::path(path);
oldPath.replace_extension(".log.old");
if (exists(oldPath))
remove(oldPath);
rename(path, oldPath);
}
} catch (...) {
// whatever
}
const auto h = CreateFile(path.wstring().c_str(),
GENERIC_WRITE,
FILE_SHARE_READ | FILE_SHARE_WRITE,