mirror of https://github.com/x64dbg/TitanEngine
Add TTD APIs
This commit is contained in:
parent
d0e2efeb9a
commit
5ce48fef05
|
|
@ -159,6 +159,69 @@ __declspec(dllexport) bool TITCALL IsFileBeingDebugged()
|
|||
return(engineFileIsBeingDebugged);
|
||||
}
|
||||
|
||||
__declspec(dllexport) bool TITCALL GetSessionInfo(TITAN_SESSION_INFO* SessionInfo)
|
||||
{
|
||||
if(!SessionInfo)
|
||||
{
|
||||
SetLastError(ERROR_INVALID_PARAMETER);
|
||||
return false;
|
||||
}
|
||||
RtlZeroMemory(SessionInfo, sizeof(*SessionInfo));
|
||||
SessionInfo->structSize = sizeof(*SessionInfo);
|
||||
if(!engineFileIsBeingDebugged && !dbgProcessInformation.dwProcessId)
|
||||
return true;
|
||||
SessionInfo->kind = UE_SESSION_LIVE;
|
||||
SessionInfo->capabilities = UE_SESSION_CAP_MEMORY_READ | UE_SESSION_CAP_MEMORY_QUERY |
|
||||
UE_SESSION_CAP_CONTEXT_READ | UE_SESSION_CAP_FORWARD_EXECUTION |
|
||||
UE_SESSION_CAP_MEMORY_WRITE | UE_SESSION_CAP_CONTEXT_WRITE |
|
||||
UE_SESSION_CAP_PROCESS_CONTROL | UE_SESSION_CAP_THREAD_CONTROL |
|
||||
UE_SESSION_CAP_NATIVE_HANDLES | UE_SESSION_CAP_EXCEPTION_CONTINUE;
|
||||
#ifdef _WIN64
|
||||
SessionInfo->machineType = IMAGE_FILE_MACHINE_AMD64;
|
||||
#else
|
||||
SessionInfo->machineType = IMAGE_FILE_MACHINE_I386;
|
||||
#endif
|
||||
SessionInfo->processId = dbgProcessInformation.dwProcessId;
|
||||
SessionInfo->threadId = dbgProcessInformation.dwThreadId;
|
||||
return true;
|
||||
}
|
||||
|
||||
__declspec(dllexport) bool TITCALL ReplayGetPosition(TITAN_REPLAY_POSITION* Position)
|
||||
{
|
||||
if(Position)
|
||||
RtlZeroMemory(Position, sizeof(*Position));
|
||||
SetLastError(ERROR_NOT_SUPPORTED);
|
||||
return false;
|
||||
}
|
||||
|
||||
__declspec(dllexport) bool TITCALL ReplayGetExtent(TITAN_REPLAY_POSITION* First, TITAN_REPLAY_POSITION* Last)
|
||||
{
|
||||
if(First)
|
||||
RtlZeroMemory(First, sizeof(*First));
|
||||
if(Last)
|
||||
RtlZeroMemory(Last, sizeof(*Last));
|
||||
SetLastError(ERROR_NOT_SUPPORTED);
|
||||
return false;
|
||||
}
|
||||
|
||||
__declspec(dllexport) bool TITCALL ReplaySetPosition(const TITAN_REPLAY_POSITION* Position)
|
||||
{
|
||||
SetLastError(Position ? ERROR_NOT_SUPPORTED : ERROR_INVALID_PARAMETER);
|
||||
return false;
|
||||
}
|
||||
|
||||
__declspec(dllexport) bool TITCALL ReplayRun(bool Reverse)
|
||||
{
|
||||
SetLastError(ERROR_NOT_SUPPORTED);
|
||||
return false;
|
||||
}
|
||||
|
||||
__declspec(dllexport) bool TITCALL ReplayStep(bool Reverse, bool StepOver, TITANCBSTEP StepCallBack)
|
||||
{
|
||||
SetLastError(ERROR_NOT_SUPPORTED);
|
||||
return false;
|
||||
}
|
||||
|
||||
__declspec(dllexport) void TITCALL SetErrorModel(bool DisplayErrorMessages)
|
||||
{
|
||||
|
||||
|
|
|
|||
|
|
@ -303,6 +303,12 @@ static bool HollowProcessWithoutASLR(const wchar_t* szFileName, PROCESS_INFORMAT
|
|||
return success;
|
||||
}
|
||||
|
||||
__declspec(dllexport) PROCESS_INFORMATION* TITCALL InitReplayW(const wchar_t* szArtifactPath, TitanSessionKind ExpectedKind)
|
||||
{
|
||||
SetLastError(ERROR_NOT_SUPPORTED);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
__declspec(dllexport) void* TITCALL InitDebugW(wchar_t* szFileName, wchar_t* szCommandLine, wchar_t* szCurrentFolder)
|
||||
{
|
||||
int creationFlags = DEBUG_PROCESS | DEBUG_ONLY_THIS_PROCESS;
|
||||
|
|
|
|||
|
|
@ -142,6 +142,27 @@ __declspec(dllexport) HANDLE TITCALL TitanOpenThread(DWORD dwDesiredAccess, bool
|
|||
return EngineOpenThread(dwDesiredAccess, bInheritHandle, dwThreadId);
|
||||
}
|
||||
|
||||
__declspec(dllexport) bool TITCALL TitanGetProcessImagePathW(HANDLE hProcess, LPWSTR szPath, SIZE_T cchPath)
|
||||
{
|
||||
if(!hProcess || !szPath || !cchPath || cchPath > MAXDWORD)
|
||||
{
|
||||
SetLastError(ERROR_INVALID_PARAMETER);
|
||||
return false;
|
||||
}
|
||||
DWORD length = (DWORD)cchPath;
|
||||
return !!QueryFullProcessImageNameW(hProcess, 0, szPath, &length);
|
||||
}
|
||||
|
||||
__declspec(dllexport) bool TITCALL TitanGetModulePathW(HANDLE hProcess, ULONG_PTR ModuleBase, LPWSTR szPath, SIZE_T cchPath)
|
||||
{
|
||||
if(!hProcess || !ModuleBase || !szPath || !cchPath || cchPath > MAXDWORD)
|
||||
{
|
||||
SetLastError(ERROR_INVALID_PARAMETER);
|
||||
return false;
|
||||
}
|
||||
return GetModuleFileNameExW(hProcess, (HMODULE)ModuleBase, szPath, (DWORD)cchPath) != 0;
|
||||
}
|
||||
|
||||
__declspec(dllexport) bool TITCALL TitanCloseHandle(HANDLE hEngineHandle)
|
||||
{
|
||||
return EngineCloseHandle(hEngineHandle);
|
||||
|
|
|
|||
|
|
@ -87,6 +87,13 @@ FixHeaderCheckSum
|
|||
FixHeaderCheckSumW
|
||||
InitDebug
|
||||
InitDebugW
|
||||
InitReplayW
|
||||
GetSessionInfo
|
||||
ReplayGetPosition
|
||||
ReplayGetExtent
|
||||
ReplaySetPosition
|
||||
ReplayRun
|
||||
ReplayStep
|
||||
InitNativeDebug
|
||||
InitNativeDebugW
|
||||
InitDebugEx
|
||||
|
|
@ -394,6 +401,8 @@ GetActiveProcessId
|
|||
GetActiveProcessIdW
|
||||
EnumProcessesWithLibrary
|
||||
TitanOpenProcess
|
||||
TitanGetProcessImagePathW
|
||||
TitanGetModulePathW
|
||||
TitanCloseHandle
|
||||
ProcessIsWow64
|
||||
TitanTerminateProcess
|
||||
|
|
|
|||
|
|
@ -166,6 +166,13 @@ __declspec(dllexport) long TITCALL LengthDisassemble(LPVOID DisassmAddress);
|
|||
|
||||
__declspec(dllexport) void* TITCALL InitDebug(char* szFileName, char* szCommandLine, char* szCurrentFolder);
|
||||
__declspec(dllexport) void* TITCALL InitDebugW(wchar_t* szFileName, wchar_t* szCommandLine, wchar_t* szCurrentFolder);
|
||||
__declspec(dllexport) PROCESS_INFORMATION* TITCALL InitReplayW(const wchar_t* szArtifactPath, TitanSessionKind ExpectedKind);
|
||||
__declspec(dllexport) bool TITCALL GetSessionInfo(TITAN_SESSION_INFO* SessionInfo);
|
||||
__declspec(dllexport) bool TITCALL ReplayGetPosition(TITAN_REPLAY_POSITION* Position);
|
||||
__declspec(dllexport) bool TITCALL ReplayGetExtent(TITAN_REPLAY_POSITION* First, TITAN_REPLAY_POSITION* Last);
|
||||
__declspec(dllexport) bool TITCALL ReplaySetPosition(const TITAN_REPLAY_POSITION* Position);
|
||||
__declspec(dllexport) bool TITCALL ReplayRun(bool Reverse);
|
||||
__declspec(dllexport) bool TITCALL ReplayStep(bool Reverse, bool StepOver, TITANCBSTEP StepCallBack);
|
||||
__declspec(dllexport) void* TITCALL InitNativeDebug(char* szFileName, char* szCommandLine, char* szCurrentFolder);
|
||||
__declspec(dllexport) void* TITCALL InitNativeDebugW(wchar_t* szFileName, wchar_t* szCommandLine, wchar_t* szCurrentFolder);
|
||||
__declspec(dllexport) void* TITCALL InitDebugEx(char* szFileName, char* szCommandLine, char* szCurrentFolder, LPVOID EntryCallBack);
|
||||
|
|
@ -360,6 +367,8 @@ __declspec(dllexport) long TITCALL GetActiveProcessId(char* szImageName);
|
|||
__declspec(dllexport) long TITCALL GetActiveProcessIdW(wchar_t* szImageName);
|
||||
__declspec(dllexport) void TITCALL EnumProcessesWithLibrary(char* szLibraryName, void* EnumFunction);
|
||||
__declspec(dllexport) HANDLE TITCALL TitanOpenProcess(DWORD dwDesiredAccess, bool bInheritHandle, DWORD dwProcessId);
|
||||
__declspec(dllexport) bool TITCALL TitanGetProcessImagePathW(HANDLE hProcess, LPWSTR szPath, SIZE_T cchPath);
|
||||
__declspec(dllexport) bool TITCALL TitanGetModulePathW(HANDLE hProcess, ULONG_PTR ModuleBase, LPWSTR szPath, SIZE_T cchPath);
|
||||
__declspec(dllexport) bool TITCALL TitanCloseHandle(HANDLE hEngineHandle);
|
||||
__declspec(dllexport) bool TITCALL ProcessIsWow64(HANDLE hProcess, PBOOL isWow64);
|
||||
__declspec(dllexport) bool TITCALL TitanTerminateProcess(HANDLE hProcess, DWORD exitCode);
|
||||
|
|
|
|||
|
|
@ -33,6 +33,8 @@
|
|||
#include <time.h>
|
||||
#include <stdint.h>
|
||||
|
||||
typedef void(*TITANCBSTEP)();
|
||||
|
||||
#ifndef _Out_writes_opt_
|
||||
#define _Out_writes_opt_(x)
|
||||
#endif
|
||||
|
|
@ -127,6 +129,51 @@ static inline T ObjectPointerToCallback(LPVOID callbackData)
|
|||
#define CONTEXT_EXTENDED_REGISTERS 0
|
||||
#endif
|
||||
|
||||
enum TitanSessionKind
|
||||
{
|
||||
UE_SESSION_NONE = 0,
|
||||
UE_SESSION_LIVE = 1,
|
||||
UE_SESSION_MINIDUMP = 2,
|
||||
UE_SESSION_TTD = 3,
|
||||
UE_SESSION_STATIC = 4,
|
||||
};
|
||||
|
||||
enum TitanSessionCapability : uint64_t
|
||||
{
|
||||
UE_SESSION_CAP_MEMORY_READ = 1ull << 0,
|
||||
UE_SESSION_CAP_MEMORY_QUERY = 1ull << 1,
|
||||
UE_SESSION_CAP_CONTEXT_READ = 1ull << 2,
|
||||
UE_SESSION_CAP_FORWARD_EXECUTION = 1ull << 3,
|
||||
UE_SESSION_CAP_REVERSE_EXECUTION = 1ull << 4,
|
||||
UE_SESSION_CAP_EXACT_POSITION = 1ull << 5,
|
||||
UE_SESSION_CAP_LOGICAL_CODE_BREAKPOINT = 1ull << 6,
|
||||
UE_SESSION_CAP_LOGICAL_DATA_BREAKPOINT = 1ull << 7,
|
||||
UE_SESSION_CAP_MEMORY_WRITE = 1ull << 8,
|
||||
UE_SESSION_CAP_CONTEXT_WRITE = 1ull << 9,
|
||||
UE_SESSION_CAP_PROCESS_CONTROL = 1ull << 10,
|
||||
UE_SESSION_CAP_THREAD_CONTROL = 1ull << 11,
|
||||
UE_SESSION_CAP_NATIVE_HANDLES = 1ull << 12,
|
||||
UE_SESSION_CAP_EXCEPTION_CONTINUE = 1ull << 13,
|
||||
UE_SESSION_CAP_TIMELINE_STATE = 1ull << 14,
|
||||
};
|
||||
|
||||
typedef struct
|
||||
{
|
||||
DWORD structSize;
|
||||
TitanSessionKind kind;
|
||||
uint64_t capabilities;
|
||||
DWORD machineType;
|
||||
DWORD processId;
|
||||
DWORD threadId;
|
||||
DWORD reserved;
|
||||
} TITAN_SESSION_INFO;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
uint64_t sequence;
|
||||
uint64_t steps;
|
||||
} TITAN_REPLAY_POSITION;
|
||||
|
||||
typedef struct DECLSPEC_ALIGN(16) _XmmRegister_t
|
||||
{
|
||||
ULONGLONG Low;
|
||||
|
|
|
|||
Loading…
Reference in New Issue