fix msvc compilation

This commit is contained in:
2023-12-23 17:09:31 -05:00
parent d4372fa5c2
commit eb174fb8ba
3 changed files with 11 additions and 26 deletions

View File

@ -1,7 +1,6 @@
#include <windows.h>
#include <stdbool.h>
#include <stdint.h>
#include <libgen.h>
#include "hooklib/procaddr.h"
@ -83,6 +82,13 @@ static void proc_addr_hook_init(void)
_countof(win32_hooks));
}
#define PATH_MAX 1024
char *gnu_basename(char *path)
{
char *base = strrchr(path, '/');
return base ? base+1 : path;
}
FARPROC WINAPI my_GetProcAddress(HMODULE hModule, const char *name)
{
uintptr_t ordinal = (uintptr_t) name;
@ -92,7 +98,7 @@ FARPROC WINAPI my_GetProcAddress(HMODULE hModule, const char *name)
FARPROC result = next_GetProcAddress(hModule, name);
GetModuleFileNameA(hModule, mod_path, PATH_MAX);
mod_name = basename(mod_path);
mod_name = gnu_basename(mod_path);
for (int i = 0; i < proc_addr_hook_count; i++) {