1
0
mirror of https://github.com/FunkyFr3sh/cnc-ddraw.git synced 2025-03-15 06:04:49 +01:00

update DebugLog build

This commit is contained in:
FunkyFr3sh 2021-01-23 14:55:22 +01:00
parent 5e79340fef
commit 59a57ed7a5
3 changed files with 23 additions and 19 deletions

View File

@ -4,7 +4,7 @@
#define VERSION_MAJOR 1
#define VERSION_MINOR 4
#define VERSION_BUILD 0
#define VERSION_REVISION 0
#define VERSION_REVISION 1
#define VERSION VERSION_MAJOR, VERSION_MINOR, VERSION_BUILD, VERSION_REVISION
#define VERSION_STRING ver_str(VERSION_MAJOR, VERSION_MINOR, VERSION_BUILD, VERSION_REVISION)

View File

@ -31,6 +31,7 @@ BOOL WINAPI DllMain(HANDLE hDll, DWORD dwReason, LPVOID lpReserved)
{
#if _DEBUG
dbg_init();
dprintf("cnc-ddraw = %p\n", hDll);
#endif
g_ddraw_module = hDll;

View File

@ -4,6 +4,7 @@
#include "dd.h"
#include "winapi_hooks.h"
#include "hook.h"
#include "debug.h"
#include "dllmain.h"
#ifdef _MSC_VER
@ -233,15 +234,15 @@ void hook_create(hook_list* hooks)
if (g_hook_method == 3 || g_hook_method == 4)
{
WCHAR game_exe_path[MAX_PATH] = { 0 };
WCHAR game_dir[MAX_PATH] = { 0 };
char game_exe_path[MAX_PATH] = { 0 };
char game_dir[MAX_PATH] = { 0 };
if (GetModuleFileNameW(NULL, game_exe_path, MAX_PATH))
if (GetModuleFileNameA(NULL, game_exe_path, MAX_PATH))
{
_wsplitpath(game_exe_path, NULL, game_dir, NULL, NULL);
_splitpath(game_exe_path, NULL, game_dir, NULL, NULL);
WCHAR mod_path[MAX_PATH] = { 0 };
WCHAR mod_dir[MAX_PATH] = { 0 };
char mod_path[MAX_PATH] = { 0 };
char mod_dir[MAX_PATH] = { 0 };
HMODULE hmod = NULL;
while (hmod = DetourEnumerateModules(hmod))
@ -249,11 +250,13 @@ void hook_create(hook_list* hooks)
if (hmod == g_ddraw_module)
continue;
if (GetModuleFileNameW(hmod, mod_path, MAX_PATH))
if (GetModuleFileNameA(hmod, mod_path, MAX_PATH))
{
_wsplitpath(mod_path, NULL, mod_dir, NULL, NULL);
dprintfex("Module %s = %p\n", mod_path, hmod);
if (_wcsnicmp(game_dir, mod_dir, wcslen(game_dir)) == 0)
_splitpath(mod_path, NULL, mod_dir, NULL, NULL);
if (_strnicmp(game_dir, mod_dir, strlen(game_dir)) == 0)
{
hook_patch_iat_list(hmod, FALSE, hooks);
}
@ -291,15 +294,15 @@ void hook_revert(hook_list* hooks)
if (g_hook_method == 3 || g_hook_method == 4)
{
WCHAR game_exe_path[MAX_PATH] = { 0 };
WCHAR game_dir[MAX_PATH] = { 0 };
char game_exe_path[MAX_PATH] = { 0 };
char game_dir[MAX_PATH] = { 0 };
if (GetModuleFileNameW(NULL, game_exe_path, MAX_PATH))
if (GetModuleFileNameA(NULL, game_exe_path, MAX_PATH))
{
_wsplitpath(game_exe_path, NULL, game_dir, NULL, NULL);
_splitpath(game_exe_path, NULL, game_dir, NULL, NULL);
WCHAR mod_path[MAX_PATH] = { 0 };
WCHAR mod_dir[MAX_PATH] = { 0 };
char mod_path[MAX_PATH] = { 0 };
char mod_dir[MAX_PATH] = { 0 };
HMODULE hmod = NULL;
while (hmod = DetourEnumerateModules(hmod))
@ -307,11 +310,11 @@ void hook_revert(hook_list* hooks)
if (hmod == g_ddraw_module)
continue;
if (GetModuleFileNameW(hmod, mod_path, MAX_PATH))
if (GetModuleFileNameA(hmod, mod_path, MAX_PATH))
{
_wsplitpath(mod_path, NULL, mod_dir, NULL, NULL);
_splitpath(mod_path, NULL, mod_dir, NULL, NULL);
if (_wcsnicmp(game_dir, mod_dir, wcslen(game_dir)) == 0)
if (_strnicmp(game_dir, mod_dir, strlen(game_dir)) == 0)
{
hook_patch_iat_list(hmod, TRUE, hooks);
}