mirror of https://github.com/x64dbg/GleeBug
Implement some more emulated APIs
This commit is contained in:
parent
3413850282
commit
ad67ff50fc
|
|
@ -407,6 +407,11 @@ public:
|
||||||
return hThread;
|
return hThread;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
PROCESS_INFORMATION* TitanGetProcessInformation()
|
||||||
|
{
|
||||||
|
return &mProcessInfo;
|
||||||
|
}
|
||||||
|
|
||||||
//Registers
|
//Registers
|
||||||
ULONG_PTR GetContextDataEx(HANDLE hActiveThread, DWORD IndexOfRegister) const
|
ULONG_PTR GetContextDataEx(HANDLE hActiveThread, DWORD IndexOfRegister) const
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -107,12 +107,45 @@ __declspec(dllexport) HANDLE TITCALL TitanOpenThread(DWORD dwDesiredAccess, bool
|
||||||
return emu.TitanOpenThread(dwDesiredAccess, bInheritHandle, dwThreadId);
|
return emu.TitanOpenThread(dwDesiredAccess, bInheritHandle, dwThreadId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
__declspec(dllexport) PROCESS_INFORMATION* TITCALL TitanGetProcessInformation()
|
||||||
|
{
|
||||||
|
return emu.TitanGetProcessInformation();
|
||||||
|
}
|
||||||
|
|
||||||
|
__declspec(dllexport) ULONG_PTR TITCALL ImporterGetRemoteAPIAddressEx(const char* szDLLName, const char* szAPIName)
|
||||||
|
{
|
||||||
|
#ifdef _WIN64
|
||||||
|
#define X64DBG_DLL L"x64dbg.dll"
|
||||||
|
#else
|
||||||
|
#define X64DBG_DLL L"x32dbg.dll"
|
||||||
|
#endif // _WIN64
|
||||||
|
static auto hModule = GetModuleHandleW(X64DBG_DLL);
|
||||||
|
#undef X64DBG_DLL
|
||||||
|
|
||||||
|
if (hModule)
|
||||||
|
{
|
||||||
|
static auto DbgValFromString = (ULONG_PTR(*)(const char*))GetProcAddress(hModule, "DbgValFromString");
|
||||||
|
if (DbgValFromString)
|
||||||
|
{
|
||||||
|
char expr[1024] = "";
|
||||||
|
_snprintf_s(expr, _TRUNCATE, "\"%s\":%s", szDLLName, szAPIName);
|
||||||
|
return DbgValFromString(expr);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
//Registers
|
//Registers
|
||||||
__declspec(dllexport) ULONG_PTR TITCALL GetContextDataEx(HANDLE hActiveThread, DWORD IndexOfRegister)
|
__declspec(dllexport) ULONG_PTR TITCALL GetContextDataEx(HANDLE hActiveThread, DWORD IndexOfRegister)
|
||||||
{
|
{
|
||||||
return emu.GetContextDataEx(hActiveThread, IndexOfRegister);
|
return emu.GetContextDataEx(hActiveThread, IndexOfRegister);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
__declspec(dllexport) ULONG_PTR TITCALL GetContextData(DWORD IndexOfRegister)
|
||||||
|
{
|
||||||
|
return GetContextDataEx(TitanGetProcessInformation()->hThread, IndexOfRegister);
|
||||||
|
}
|
||||||
|
|
||||||
__declspec(dllexport) bool TITCALL SetContextDataEx(HANDLE hActiveThread, DWORD IndexOfRegister, ULONG_PTR NewRegisterValue)
|
__declspec(dllexport) bool TITCALL SetContextDataEx(HANDLE hActiveThread, DWORD IndexOfRegister, ULONG_PTR NewRegisterValue)
|
||||||
{
|
{
|
||||||
return emu.SetContextDataEx(hActiveThread, IndexOfRegister, NewRegisterValue);
|
return emu.SetContextDataEx(hActiveThread, IndexOfRegister, NewRegisterValue);
|
||||||
|
|
|
||||||
|
|
@ -294,6 +294,11 @@ public:
|
||||||
return hThread;
|
return hThread;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
PROCESS_INFORMATION* TitanGetProcessInformation()
|
||||||
|
{
|
||||||
|
return &mMainProcess;
|
||||||
|
}
|
||||||
|
|
||||||
//Stepping
|
//Stepping
|
||||||
void StepOver(LPVOID CallBack)
|
void StepOver(LPVOID CallBack)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -107,12 +107,45 @@ __declspec(dllexport) HANDLE TITCALL TitanOpenThread(DWORD dwDesiredAccess, bool
|
||||||
return emu.TitanOpenThread(dwDesiredAccess, bInheritHandle, dwThreadId);
|
return emu.TitanOpenThread(dwDesiredAccess, bInheritHandle, dwThreadId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
__declspec(dllexport) PROCESS_INFORMATION* TITCALL TitanGetProcessInformation()
|
||||||
|
{
|
||||||
|
return emu.TitanGetProcessInformation();
|
||||||
|
}
|
||||||
|
|
||||||
|
__declspec(dllexport) ULONG_PTR TITCALL ImporterGetRemoteAPIAddressEx(const char* szDLLName, const char* szAPIName)
|
||||||
|
{
|
||||||
|
#ifdef _WIN64
|
||||||
|
#define X64DBG_DLL L"x64dbg.dll"
|
||||||
|
#else
|
||||||
|
#define X64DBG_DLL L"x32dbg.dll"
|
||||||
|
#endif // _WIN64
|
||||||
|
static auto hModule = GetModuleHandleW(X64DBG_DLL);
|
||||||
|
#undef X64DBG_DLL
|
||||||
|
|
||||||
|
if (hModule)
|
||||||
|
{
|
||||||
|
static auto DbgValFromString = (ULONG_PTR(*)(const char*))GetProcAddress(hModule, "DbgValFromString");
|
||||||
|
if (DbgValFromString)
|
||||||
|
{
|
||||||
|
char expr[1024] = "";
|
||||||
|
_snprintf_s(expr, _TRUNCATE, "\"%s\":%s", szDLLName, szAPIName);
|
||||||
|
return DbgValFromString(expr);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
//Registers
|
//Registers
|
||||||
__declspec(dllexport) ULONG_PTR TITCALL GetContextDataEx(HANDLE hActiveThread, DWORD IndexOfRegister)
|
__declspec(dllexport) ULONG_PTR TITCALL GetContextDataEx(HANDLE hActiveThread, DWORD IndexOfRegister)
|
||||||
{
|
{
|
||||||
return emu.GetContextDataEx(hActiveThread, IndexOfRegister);
|
return emu.GetContextDataEx(hActiveThread, IndexOfRegister);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
__declspec(dllexport) ULONG_PTR TITCALL GetContextData(DWORD IndexOfRegister)
|
||||||
|
{
|
||||||
|
return GetContextDataEx(TitanGetProcessInformation()->hThread, IndexOfRegister);
|
||||||
|
}
|
||||||
|
|
||||||
__declspec(dllexport) bool TITCALL SetContextDataEx(HANDLE hActiveThread, DWORD IndexOfRegister, ULONG_PTR NewRegisterValue)
|
__declspec(dllexport) bool TITCALL SetContextDataEx(HANDLE hActiveThread, DWORD IndexOfRegister, ULONG_PTR NewRegisterValue)
|
||||||
{
|
{
|
||||||
return emu.SetContextDataEx(hActiveThread, IndexOfRegister, NewRegisterValue);
|
return emu.SetContextDataEx(hActiveThread, IndexOfRegister, NewRegisterValue);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue