chore: more logging

This commit is contained in:
goaaats 2022-05-29 20:08:21 +02:00
parent c5e58ee014
commit d0213ebcfd
No known key found for this signature in database
GPG key ID: 49E2AA8C6A76498B
2 changed files with 10 additions and 3 deletions

View file

@ -30,7 +30,9 @@ DllExport DWORD WINAPI Initialize(LPVOID lpParam, HANDLE hMainThreadContinue) {
if (bootconfig::is_wait_messagebox())
MessageBoxW(nullptr, L"Press OK to continue", L"Dalamud Boot", MB_OK);
logging::print<logging::I>("Applying fixes...");
xivfixes::apply_all(true);
logging::print<logging::I>("Fixes OK");
if (bootconfig::is_wait_debugger()) {
logging::print<logging::I>("Waiting for debugger to attach...");
@ -45,6 +47,8 @@ DllExport DWORD WINAPI Initialize(LPVOID lpParam, HANDLE hMainThreadContinue) {
// ============================== CLR ========================================= //
logging::print<logging::I>("Calling InitializeClrAndGetEntryPoint");
void* entrypoint_vfn;
int result = InitializeClrAndGetEntryPoint(
g_hModule,

View file

@ -69,6 +69,7 @@ void xivfixes::prevent_devicechange_crashes(bool bApply) {
return hWnd;
});
logging::print<logging::I>("{} Enable", LogTag);
} else {
logging::print<logging::I>("{} Disable", LogTag);
@ -86,9 +87,9 @@ void xivfixes::disable_game_openprocess_access_check(bool bApply) {
if (bApply) {
hook.emplace("kernel32.dll", "OpenProcess", 0);
hook->set_detour([](DWORD dwDesiredAccess, BOOL bInheritHandle, DWORD dwProcessId)->HANDLE {
if (dwProcessId == GetCurrentProcessId()) {
logging::print<logging::I>("{} OpenProcess(0{:08X}, {}, {}) was invoked by thread {}.", LogTag, dwDesiredAccess, bInheritHandle, dwProcessId, GetCurrentThreadId());
if (dwProcessId == GetCurrentProcessId()) {
// Prevent game from feeling unsafe that it restarts
if (dwDesiredAccess & PROCESS_VM_WRITE) {
logging::print<logging::I>("{} Returning failure with last error code set to ERROR_ACCESS_DENIED(5).", LogTag);
@ -100,6 +101,7 @@ void xivfixes::disable_game_openprocess_access_check(bool bApply) {
return hook->call_original(dwDesiredAccess, bInheritHandle, dwProcessId);
});
logging::print<logging::I>("{} Enable", LogTag);
} else {
logging::print<logging::I>("{} Disable", LogTag);
hook.reset();
@ -111,7 +113,6 @@ void xivfixes::redirect_openprocess(bool bApply) {
static std::optional<hooks::direct_hook<decltype(OpenProcess)>> hook;
if (bApply) {
logging::print<logging::I>("{} Enable", LogTag);
hook.emplace(OpenProcess);
hook->set_detour([](DWORD dwDesiredAccess, BOOL bInheritHandle, DWORD dwProcessId)->HANDLE {
if (dwProcessId == GetCurrentProcessId()) {
@ -125,6 +126,8 @@ void xivfixes::redirect_openprocess(bool bApply) {
return hook->call_original(dwDesiredAccess, bInheritHandle, dwProcessId);
});
logging::print<logging::I>("{} Enable", LogTag);
} else {
logging::print<logging::I>("{} Disable", LogTag);
hook.reset();