Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 11 additions & 3 deletions extensions/sdktools/vcaller.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
Expand All @@ -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 \
Expand All @@ -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]);

Expand Down