#include #include "Emulator.h" Emulator emu; //Debugger basics __declspec(dllexport) void* TITCALL InitDebugW(const wchar_t* szFileName, const wchar_t* szCommandLine, const wchar_t* szCurrentFolder) { return emu.InitDebugW(szFileName, szCommandLine, szCurrentFolder); } __declspec(dllexport) void* TITCALL InitDLLDebugW(const wchar_t* szFileName, bool ReserveModuleBase, const wchar_t* szCommandLine, const wchar_t* szCurrentFolder, LPVOID EntryCallBack) { //TODO return nullptr; } __declspec(dllexport) bool TITCALL StopDebug() { return emu.Stop(); } __declspec(dllexport) bool TITCALL AttachDebugger(DWORD ProcessId, bool KillOnExit, LPVOID DebugInfo, LPVOID CallBack) { //TODO return false; } __declspec(dllexport) bool TITCALL DetachDebuggerEx(DWORD ProcessId) { return emu.Detach(); } __declspec(dllexport) void TITCALL DebugLoop() { emu.Start(); } __declspec(dllexport) void TITCALL SetNextDbgContinueStatus(DWORD SetDbgCode) { emu.SetNextDbgContinueStatus(SetDbgCode); } //Memory __declspec(dllexport) bool TITCALL MemoryReadSafe(HANDLE hProcess, LPVOID lpBaseAddress, LPVOID lpBuffer, SIZE_T nSize, SIZE_T* lpNumberOfBytesRead) { return emu.MemoryReadSafe(hProcess, lpBaseAddress, lpBuffer, nSize, lpNumberOfBytesRead); } __declspec(dllexport) bool TITCALL MemoryWriteSafe(HANDLE hProcess, LPVOID lpBaseAddress, LPCVOID lpBuffer, SIZE_T nSize, SIZE_T* lpNumberOfBytesWritten) { return emu.MemoryWriteSafe(hProcess, lpBaseAddress, lpBuffer, nSize, lpNumberOfBytesWritten); } __declspec(dllexport) bool TITCALL Fill(LPVOID MemoryStart, DWORD MemorySize, PBYTE FillByte) { return emu.Fill(MemoryStart, MemorySize, FillByte); } //Engine __declspec(dllexport) bool TITCALL EngineCheckStructAlignment(DWORD StructureType, ULONG_PTR StructureSize) { return true; } __declspec(dllexport) bool TITCALL IsFileBeingDebugged() { return emu.IsFileBeingDebugged(); } __declspec(dllexport) void* TITCALL GetDebugData() { return emu.GetDebugData(); } __declspec(dllexport) void TITCALL SetCustomHandler(DWORD ExceptionId, LPVOID CallBack) { emu.SetCustomHandler(ExceptionId, CallBack); } __declspec(dllexport) void TITCALL SetEngineVariable(DWORD VariableId, bool VariableSet) { emu.SetEngineVariable(VariableId, VariableSet); } //Misc __declspec(dllexport) bool TITCALL IsJumpGoingToExecuteEx(HANDLE hProcess, HANDLE hThread, ULONG_PTR InstructionAddress, ULONG_PTR RegFlags) { //TODO return false; } __declspec(dllexport) void* TITCALL GetPEBLocation(HANDLE hProcess) { //TODO return nullptr; } __declspec(dllexport) bool TITCALL HideDebugger(HANDLE hProcess, DWORD PatchAPILevel) { //TODO return false; } __declspec(dllexport) HANDLE TITCALL TitanOpenProcess(DWORD dwDesiredAccess, bool bInheritHandle, DWORD dwProcessId) { //TODO return 0; } __declspec(dllexport) ULONG_PTR TITCALL ImporterGetRemoteAPIAddress(HANDLE hProcess, ULONG_PTR APIAddress) { //TODO return 0; } //Registers __declspec(dllexport) ULONG_PTR TITCALL GetContextDataEx(HANDLE hActiveThread, DWORD IndexOfRegister) { return emu.GetContextDataEx(hActiveThread, IndexOfRegister); } __declspec(dllexport) bool TITCALL SetContextDataEx(HANDLE hActiveThread, DWORD IndexOfRegister, ULONG_PTR NewRegisterValue) { //TODO return false; } __declspec(dllexport) bool TITCALL GetFullContextDataEx(HANDLE hActiveThread, TITAN_ENGINE_CONTEXT_t* titcontext) { memset(titcontext, 0, sizeof(TITAN_ENGINE_CONTEXT_t)); //TODO return false; } __declspec(dllexport) bool TITCALL SetFullContextDataEx(HANDLE hActiveThread, TITAN_ENGINE_CONTEXT_t* titcontext) { //TODO return false; } __declspec(dllexport) void TITCALL GetMMXRegisters(uint64_t mmx[8], TITAN_ENGINE_CONTEXT_t* titcontext) { //TODO } __declspec(dllexport) void TITCALL Getx87FPURegisters(x87FPURegister_t x87FPURegisters[8], TITAN_ENGINE_CONTEXT_t* titcontext) { //TODO } //PE __declspec(dllexport) bool TITCALL StaticFileLoadW(const wchar_t* szFileName, DWORD DesiredAccess, bool SimulateLoad, LPHANDLE FileHandle, LPDWORD LoadedSize, LPHANDLE FileMap, PULONG_PTR FileMapVA) { //TODO return false; } __declspec(dllexport) bool TITCALL StaticFileUnloadW(const wchar_t* szFileName, bool CommitChanges, HANDLE FileHandle, DWORD LoadedSize, HANDLE FileMap, ULONG_PTR FileMapVA) { //TODO return false; } __declspec(dllexport) ULONG_PTR TITCALL ConvertFileOffsetToVA(ULONG_PTR FileMapVA, ULONG_PTR AddressToConvert, bool ReturnType) { //TODO return 0; } __declspec(dllexport) ULONG_PTR TITCALL ConvertVAtoFileOffsetEx(ULONG_PTR FileMapVA, DWORD FileSize, ULONG_PTR ImageBase, ULONG_PTR AddressToConvert, bool AddressIsRVA, bool ReturnType) { //TODO return 0; } __declspec(dllexport) ULONG_PTR TITCALL GetPE32DataFromMappedFile(ULONG_PTR FileMapVA, DWORD WhichSection, DWORD WhichData) { //TODO return 0; } __declspec(dllexport) ULONG_PTR TITCALL GetPE32DataW(const wchar_t* szFileName, DWORD WhichSection, DWORD WhichData) { //TODO return 0; } __declspec(dllexport) bool TITCALL IsFileDLLW(const wchar_t* szFileName, ULONG_PTR FileMapVA) { //TODO return false; } __declspec(dllexport) long TITCALL GetPE32SectionNumberFromVA(ULONG_PTR FileMapVA, ULONG_PTR AddressToConvert) { //TODO return 0; } __declspec(dllexport) bool TITCALL TLSGrabCallBackDataW(const wchar_t* szFileName, LPVOID ArrayOfCallBacks, LPDWORD NumberOfCallBacks) { //TODO return false; } //Software Breakpoints __declspec(dllexport) bool TITCALL SetBPX(ULONG_PTR bpxAddress, DWORD bpxType, LPVOID bpxCallBack) { //TODO return false; } __declspec(dllexport) bool TITCALL DeleteBPX(ULONG_PTR bpxAddress) { //TODO return false; } __declspec(dllexport) bool TITCALL IsBPXEnabled(ULONG_PTR bpxAddress) { //TODO return false; } __declspec(dllexport) void TITCALL SetBPXOptions(long DefaultBreakPointType) { //TODO } //Memory Breakpoints __declspec(dllexport) bool TITCALL SetMemoryBPXEx(ULONG_PTR MemoryStart, SIZE_T SizeOfMemory, DWORD BreakPointType, bool RestoreOnHit, LPVOID bpxCallBack) { //TODO return false; } __declspec(dllexport) bool TITCALL RemoveMemoryBPX(ULONG_PTR MemoryStart, SIZE_T SizeOfMemory) { //TODO return false; } //Hardwre Breakpoints __declspec(dllexport) bool TITCALL SetHardwareBreakPoint(ULONG_PTR bpxAddress, DWORD IndexOfRegister, DWORD bpxType, DWORD bpxSize, LPVOID bpxCallBack) { //TODO return false; } __declspec(dllexport) bool TITCALL DeleteHardwareBreakPoint(DWORD IndexOfRegister) { //TODO return false; } __declspec(dllexport) bool TITCALL GetUnusedHardwareBreakPointRegister(LPDWORD RegisterIndex) { //TODO return false; } //Librarian Breakpoints __declspec(dllexport) bool TITCALL LibrarianSetBreakPoint(const char* szLibraryName, DWORD bpxType, bool SingleShoot, LPVOID bpxCallBack) { //TODO return false; } __declspec(dllexport) bool TITCALL LibrarianRemoveBreakPoint(const char* szLibraryName, DWORD bpxType) { //TODO return false; } //Generic Breakpoints __declspec(dllexport) bool TITCALL RemoveAllBreakPoints(DWORD RemoveOption) { //TODO return false; } //Stepping __declspec(dllexport) void TITCALL StepOver(LPVOID traceCallBack) { //TODO } __declspec(dllexport) void TITCALL SingleStep(DWORD StepCount, LPVOID StepCallBack) { //TODO } __declspec(dllexport) void TITCALL StepInto(LPVOID traceCallBack) { //TODO }