sdktools: permit symbol signatures on win32 (#1346)

* Fix sig scanner for windows

* fix linux build

* Update vcaller.cpp

Co-authored-by: Kyle Sanderson <kyle.leet@gmail.com>
This commit is contained in:
Rostu13 2020-10-03 10:33:05 +10:00 committed by GitHub
parent e0d9dfb68e
commit c38b392fdf
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -119,9 +119,15 @@ static cell_t PrepSDKCall_SetSignature(IPluginContext *pContext, const cell_t *p
char *sig;
pContext->LocalToString(params[2], &sig);
#if defined PLATFORM_POSIX
if (sig[0] == '@')
{
#if defined PLATFORM_WINDOWS
MEMORY_BASIC_INFORMATION mem;
if (VirtualQuery(addrInBase, &mem, sizeof(mem)))
{
s_call_addr = memutils->ResolveSymbol(mem.AllocationBase, &sig[1]);
}
#elif defined PLATFORM_POSIX
Dl_info info;
if (dladdr(addrInBase, &info) == 0)
{
@ -132,6 +138,7 @@ static cell_t PrepSDKCall_SetSignature(IPluginContext *pContext, const cell_t *p
{
return 0;
}
#if SOURCE_ENGINE == SE_CSS \
|| SOURCE_ENGINE == SE_HL2DM \
|| SOURCE_ENGINE == SE_DODS \
@ -148,12 +155,13 @@ static cell_t PrepSDKCall_SetSignature(IPluginContext *pContext, const cell_t *p
s_call_addr = memutils->ResolveSymbol(handle, &sig[1]);
#else
s_call_addr = dlsym(handle, &sig[1]);
#endif
#endif /* SOURCE_ENGINE */
dlclose(handle);
#endif
return (s_call_addr != NULL) ? 1 : 0;
}
#endif
s_call_addr = memutils->FindPattern(addrInBase, sig, params[3]);