1
0
mirror of https://github.com/narzoul/DDrawCompat synced 2024-12-30 08:55:36 +01:00
2021-03-01 22:02:31 +01:00

29 lines
629 B
C++

#include <process.h>
#include <Dll/Dll.h>
namespace Dll
{
HMODULE g_currentModule = nullptr;
Procs g_origProcs = {};
Procs g_jmpTargetProcs = {};
HANDLE createThread(unsigned(__stdcall* threadProc)(void*), unsigned int* threadId, int priority)
{
HANDLE thread = reinterpret_cast<HANDLE>(_beginthreadex(nullptr, 0, threadProc, nullptr, 0, threadId));
if (thread)
{
SetThreadPriority(thread, priority);
}
return thread;
}
}
#define CREATE_PROC_STUB(procName) \
extern "C" __declspec(dllexport, naked) void procName() \
{ \
__asm jmp Dll::g_jmpTargetProcs.procName \
}
VISIT_ALL_PROCS(CREATE_PROC_STUB)