mirror of https://github.com/x64dbg/TitanEngine
Delete a bunch of unused functionality
This commit is contained in:
parent
568334cdd4
commit
882bc1bc30
|
|
@ -1103,16 +1103,6 @@ __declspec(dllexport) bool TITCALL EngineDeleteCreatedDependencies();
|
|||
__declspec(dllexport) bool TITCALL EngineCreateUnpackerWindow(const char* WindowUnpackerTitle, const char* WindowUnpackerLongTitle, const char* WindowUnpackerName, const char* WindowUnpackerAuthor, void* StartUnpackingCallBack);
|
||||
__declspec(dllexport) void TITCALL EngineAddUnpackerWindowLogMessage(const char* szLogMessage);
|
||||
__declspec(dllexport) bool TITCALL EngineCheckStructAlignment(DWORD StructureType, ULONG_PTR StructureSize);
|
||||
// Global.Engine.Extension.Functions:
|
||||
__declspec(dllexport) bool TITCALL ExtensionManagerIsPluginLoaded(const char* szPluginName);
|
||||
__declspec(dllexport) bool TITCALL ExtensionManagerIsPluginEnabled(const char* szPluginName);
|
||||
__declspec(dllexport) bool TITCALL ExtensionManagerDisableAllPlugins();
|
||||
__declspec(dllexport) bool TITCALL ExtensionManagerDisablePlugin(const char* szPluginName);
|
||||
__declspec(dllexport) bool TITCALL ExtensionManagerEnableAllPlugins();
|
||||
__declspec(dllexport) bool TITCALL ExtensionManagerEnablePlugin(const char* szPluginName);
|
||||
__declspec(dllexport) bool TITCALL ExtensionManagerUnloadAllPlugins();
|
||||
__declspec(dllexport) bool TITCALL ExtensionManagerUnloadPlugin(const char* szPluginName);
|
||||
__declspec(dllexport) void* TITCALL ExtensionManagerGetPluginInfo(const char* szPluginName);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,281 +0,0 @@
|
|||
#include "stdafx.h"
|
||||
#include "definitions.h"
|
||||
#include "Global.Engine.Extension.h"
|
||||
|
||||
|
||||
static std::vector<PluginInformation> Plugin;
|
||||
|
||||
// Global.Engine.Extension.Functions:
|
||||
void ExtensionManagerPluginReleaseCallBack()
|
||||
{
|
||||
for(unsigned int i = 0; i < Plugin.size(); i++)
|
||||
{
|
||||
__try
|
||||
{
|
||||
if(Plugin.at(i).TitanReleasePlugin != NULL)
|
||||
{
|
||||
Plugin.at(i).TitanReleasePlugin();
|
||||
}
|
||||
}
|
||||
__except(EXCEPTION_EXECUTE_HANDLER)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void ExtensionManagerPluginResetCallBack()
|
||||
{
|
||||
for(unsigned int i = 0; i < Plugin.size(); i++)
|
||||
{
|
||||
__try
|
||||
{
|
||||
if(Plugin.at(i).TitanResetPlugin != NULL)
|
||||
{
|
||||
Plugin.at(i).TitanResetPlugin();
|
||||
}
|
||||
}
|
||||
__except(EXCEPTION_EXECUTE_HANDLER)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void ExtensionManagerPluginDebugCallBack(LPDEBUG_EVENT debugEvent, int CallReason)
|
||||
{
|
||||
for(unsigned int i = 0; i < Plugin.size(); i++)
|
||||
{
|
||||
__try
|
||||
{
|
||||
if(!Plugin.at(i).PluginDisabled)
|
||||
{
|
||||
if(Plugin.at(i).TitanDebuggingCallBack != NULL)
|
||||
{
|
||||
Plugin.at(i).TitanDebuggingCallBack(debugEvent, CallReason);
|
||||
}
|
||||
}
|
||||
}
|
||||
__except(EXCEPTION_EXECUTE_HANDLER)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void EngineInitPlugins(wchar_t* szEngineFolder)
|
||||
{
|
||||
bool MoreFiles = true;
|
||||
bool NameHasBeenRegistered = false;
|
||||
PluginInformation myPluginInfo = {};
|
||||
#if defined (_WIN64)
|
||||
wchar_t* szPluginFolder = L"\\plugins\\x64\\";
|
||||
#else
|
||||
wchar_t* szPluginFolder = L"\\plugins\\x86\\";
|
||||
#endif
|
||||
wchar_t szPluginSearchString[MAX_PATH] = {};
|
||||
wchar_t szPluginFullPath[MAX_PATH] = {};
|
||||
fPluginRegister myPluginRegister;
|
||||
WIN32_FIND_DATAW FindData;
|
||||
HANDLE CurrentFile;
|
||||
|
||||
lstrcpyW(szPluginSearchString, szEngineFolder);
|
||||
lstrcatW(szPluginSearchString, szPluginFolder);
|
||||
lstrcatW(szPluginSearchString, L"*.dll");
|
||||
CurrentFile = FindFirstFileW(szPluginSearchString, &FindData);
|
||||
while(MoreFiles)
|
||||
{
|
||||
lstrcpyW(szPluginFullPath, szEngineFolder);
|
||||
lstrcatW(szPluginFullPath, szPluginFolder);
|
||||
lstrcatW(szPluginFullPath, FindData.cFileName);
|
||||
RtlZeroMemory(&myPluginInfo, sizeof PluginInformation);
|
||||
myPluginInfo.PluginBaseAddress = LoadLibraryW(szPluginFullPath);
|
||||
if(myPluginInfo.PluginBaseAddress != NULL)
|
||||
{
|
||||
myPluginInfo.TitanResetPlugin = (fPluginResetExec)GetProcAddress(myPluginInfo.PluginBaseAddress, "TitanResetPlugin");
|
||||
myPluginInfo.TitanReleasePlugin = (fPluginReleaseExec)GetProcAddress(myPluginInfo.PluginBaseAddress, "TitanReleasePlugin");
|
||||
myPluginInfo.TitanRegisterPlugin = (fPluginRegister)GetProcAddress(myPluginInfo.PluginBaseAddress, "TitanRegisterPlugin");
|
||||
myPluginInfo.TitanDebuggingCallBack = (fPluginDebugExec)GetProcAddress(myPluginInfo.PluginBaseAddress, "TitanDebuggingCallBack");
|
||||
myPluginRegister = myPluginInfo.TitanRegisterPlugin;
|
||||
if(myPluginRegister != NULL)
|
||||
{
|
||||
__try
|
||||
{
|
||||
if(myPluginRegister((char*)&myPluginInfo.PluginName[0], &myPluginInfo.PluginMajorVersion, &myPluginInfo.PluginMinorVersion))
|
||||
{
|
||||
if(lstrlenA(myPluginInfo.PluginName) <= 64)
|
||||
{
|
||||
NameHasBeenRegistered = false;
|
||||
for(unsigned int i = 0; i < Plugin.size(); i++)
|
||||
{
|
||||
if(lstrcmpiA(Plugin.at(i).PluginName, myPluginInfo.PluginName) == NULL)
|
||||
{
|
||||
NameHasBeenRegistered = true;
|
||||
}
|
||||
}
|
||||
if(!NameHasBeenRegistered)
|
||||
{
|
||||
Plugin.push_back(myPluginInfo);
|
||||
}
|
||||
else
|
||||
{
|
||||
FreeLibrary(myPluginInfo.PluginBaseAddress);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
FreeLibrary(myPluginInfo.PluginBaseAddress);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
FreeLibrary(myPluginInfo.PluginBaseAddress);
|
||||
}
|
||||
}
|
||||
__except(EXCEPTION_EXECUTE_HANDLER)
|
||||
{
|
||||
FreeLibrary(myPluginInfo.PluginBaseAddress);
|
||||
}
|
||||
}
|
||||
}
|
||||
if(!FindNextFileW(CurrentFile, &FindData))
|
||||
{
|
||||
MoreFiles = false;
|
||||
}
|
||||
}
|
||||
FindClose(CurrentFile);
|
||||
}
|
||||
|
||||
__declspec(dllexport) bool TITCALL ExtensionManagerIsPluginLoaded(char* szPluginName)
|
||||
{
|
||||
|
||||
for(unsigned int i = 0; i < Plugin.size(); i++)
|
||||
{
|
||||
if(lstrcmpiA(Plugin.at(i).PluginName, szPluginName) == NULL)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
__declspec(dllexport) bool TITCALL ExtensionManagerIsPluginEnabled(char* szPluginName)
|
||||
{
|
||||
for(unsigned int i = 0; i < Plugin.size(); i++)
|
||||
{
|
||||
if(lstrcmpiA(Plugin.at(i).PluginName, szPluginName) == NULL)
|
||||
{
|
||||
if(!Plugin.at(i).PluginDisabled)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
__declspec(dllexport) bool TITCALL ExtensionManagerDisableAllPlugins()
|
||||
{
|
||||
for(unsigned int i = 0; i < Plugin.size(); i++)
|
||||
{
|
||||
Plugin.at(i).PluginDisabled = true;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
__declspec(dllexport) bool TITCALL ExtensionManagerDisablePlugin(char* szPluginName)
|
||||
{
|
||||
for(unsigned int i = 0; i < Plugin.size(); i++)
|
||||
{
|
||||
if(lstrcmpiA(Plugin.at(i).PluginName, szPluginName) == NULL)
|
||||
{
|
||||
Plugin.at(i).PluginDisabled = true;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
__declspec(dllexport) bool TITCALL ExtensionManagerEnableAllPlugins()
|
||||
{
|
||||
for(unsigned int i = 0; i < Plugin.size(); i++)
|
||||
{
|
||||
Plugin.at(i).PluginDisabled = false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
__declspec(dllexport) bool TITCALL ExtensionManagerEnablePlugin(char* szPluginName)
|
||||
{
|
||||
for(unsigned int i = 0; i < Plugin.size(); i++)
|
||||
{
|
||||
if(lstrcmpiA(Plugin.at(i).PluginName, szPluginName) == NULL)
|
||||
{
|
||||
Plugin.at(i).PluginDisabled = false;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
__declspec(dllexport) bool TITCALL ExtensionManagerUnloadAllPlugins()
|
||||
{
|
||||
for(unsigned int i = 0; i < Plugin.size(); i++)
|
||||
{
|
||||
if(FreeLibrary(Plugin.at(i).PluginBaseAddress))
|
||||
{
|
||||
Plugin.erase(Plugin.begin() + i);
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
__declspec(dllexport) bool TITCALL ExtensionManagerUnloadPlugin(char* szPluginName)
|
||||
{
|
||||
fPluginReleaseExec myPluginReleaseExec;
|
||||
|
||||
for(unsigned int i = 0; i < Plugin.size(); i++)
|
||||
{
|
||||
if(lstrcmpiA(Plugin.at(i).PluginName, szPluginName) == NULL)
|
||||
{
|
||||
__try
|
||||
{
|
||||
if(Plugin.at(i).TitanReleasePlugin != NULL)
|
||||
{
|
||||
myPluginReleaseExec = (fPluginReleaseExec)Plugin.at(i).TitanReleasePlugin;
|
||||
myPluginReleaseExec();
|
||||
if(FreeLibrary(Plugin.at(i).PluginBaseAddress))
|
||||
{
|
||||
Plugin.erase(Plugin.begin() + i);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
__except(EXCEPTION_EXECUTE_HANDLER)
|
||||
{
|
||||
if(FreeLibrary(Plugin.at(i).PluginBaseAddress))
|
||||
{
|
||||
Plugin.erase(Plugin.begin() + i);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
__declspec(dllexport) void* TITCALL ExtensionManagerGetPluginInfo(char* szPluginName)
|
||||
{
|
||||
for(unsigned int i = 0; i < Plugin.size(); i++)
|
||||
{
|
||||
if(lstrcmpiA(Plugin.at(i).PluginName, szPluginName) == NULL)
|
||||
{
|
||||
return(&Plugin.at(i));
|
||||
}
|
||||
}
|
||||
return(NULL);
|
||||
}
|
||||
|
|
@ -1,34 +0,0 @@
|
|||
#ifndef _GLOBAL_ENGINE_EXTENSION_H
|
||||
#define _GLOBAL_ENGINE_EXTENSION_H
|
||||
|
||||
#include "definitions.h"
|
||||
|
||||
#define PLUGCALL TITCALL
|
||||
|
||||
//typedefs
|
||||
typedef void(PLUGCALL* fPluginDebugExec)(LPDEBUG_EVENT debugEvent, int CallReason);
|
||||
typedef bool(PLUGCALL* fPluginRegister)(char* szPluginName, LPDWORD titanPluginMajorVersion, LPDWORD titanPluginMinorVersion);
|
||||
typedef void(PLUGCALL* fPluginReleaseExec)();
|
||||
typedef void(PLUGCALL* fPluginResetExec)();
|
||||
|
||||
//structs
|
||||
typedef struct
|
||||
{
|
||||
char PluginName[64];
|
||||
DWORD PluginMajorVersion;
|
||||
DWORD PluginMinorVersion;
|
||||
HMODULE PluginBaseAddress;
|
||||
fPluginDebugExec TitanDebuggingCallBack;
|
||||
fPluginRegister TitanRegisterPlugin;
|
||||
fPluginReleaseExec TitanReleasePlugin;
|
||||
fPluginResetExec TitanResetPlugin;
|
||||
bool PluginDisabled;
|
||||
} PluginInformation, *PPluginInformation;
|
||||
|
||||
//functions
|
||||
void ExtensionManagerPluginReleaseCallBack();
|
||||
void ExtensionManagerPluginResetCallBack();
|
||||
void ExtensionManagerPluginDebugCallBack(LPDEBUG_EVENT debugEvent, int CallReason);
|
||||
void EngineInitPlugins(wchar_t* szEngineFolder);
|
||||
|
||||
#endif //_GLOBAL_ENGINE_EXTENSION_H
|
||||
|
|
@ -3,7 +3,6 @@
|
|||
#include "Global.Engine.h"
|
||||
#include "Global.Handle.h"
|
||||
#include "Global.Mapping.h"
|
||||
#include "Global.Engine.Extension.h"
|
||||
#include "Global.Engine.Hash.h"
|
||||
#include "Global.Debugger.h"
|
||||
|
||||
|
|
@ -15,7 +14,6 @@ bool engineResumeProcessIfNoThreadIsActive = false;
|
|||
bool engineResetCustomHandler = true;
|
||||
bool engineRemoveConsoleForDebugee = false;
|
||||
bool enginePassAllExceptions = true;
|
||||
bool engineExecutePluginCallBack = true;
|
||||
bool engineAutoHideFromDebugger = false; // hardcoded
|
||||
bool engineEnableDebugPrivilege = false;
|
||||
bool engineSafeAttach = false;
|
||||
|
|
@ -26,8 +24,6 @@ bool engineSafeStep = true;
|
|||
char engineFoundDLLName[512] = {0};
|
||||
char engineFoundAPIName[512] = {0};
|
||||
wchar_t engineExtractedFileNameW[512] = {0};
|
||||
wchar_t engineSzEngineFile[MAX_PATH] = {0};
|
||||
wchar_t engineSzEngineFolder[MAX_PATH] = {0};
|
||||
HMODULE engineHandle;
|
||||
LPVOID engineExitThreadOneShootCallBack = NULL;
|
||||
LPVOID engineDependencyFiles;
|
||||
|
|
@ -37,22 +33,6 @@ void* EngineStartUnpackingCallBack;
|
|||
// Global.Engine.functions:
|
||||
void EngineInit()
|
||||
{
|
||||
int i;
|
||||
if(GetModuleFileNameW(engineHandle, engineSzEngineFile, _countof(engineSzEngineFile)) > NULL)
|
||||
{
|
||||
lstrcpyW(engineSzEngineFolder, engineSzEngineFile);
|
||||
i = lstrlenW(engineSzEngineFolder);
|
||||
while(engineSzEngineFolder[i] != L'\\' && i)
|
||||
i--;
|
||||
if(i)
|
||||
{
|
||||
engineSzEngineFolder[i] = L'\0';
|
||||
lstrcpyW(engineSzEngineGarbageFolder, engineSzEngineFolder);
|
||||
lstrcatW(engineSzEngineGarbageFolder, L"\\garbage\\");
|
||||
CreateDirectoryW(engineSzEngineGarbageFolder, 0);
|
||||
}
|
||||
EngineInitPlugins(engineSzEngineFolder);
|
||||
}
|
||||
HashInit();
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -5,7 +5,6 @@
|
|||
|
||||
//Global.Engine.Variables
|
||||
extern HMODULE engineHandle;
|
||||
extern wchar_t engineSzEngineGarbageFolder[MAX_PATH];
|
||||
extern LPVOID engineExitThreadOneShootCallBack;
|
||||
extern LPVOID engineDependencyFiles;
|
||||
extern LPVOID engineDependencyFilesCWP;
|
||||
|
|
@ -18,7 +17,6 @@ extern bool engineResumeProcessIfNoThreadIsActive;
|
|||
extern bool engineResetCustomHandler;
|
||||
extern bool engineRemoveConsoleForDebugee;
|
||||
extern bool enginePassAllExceptions;
|
||||
extern bool engineExecutePluginCallBack;
|
||||
extern bool engineAutoHideFromDebugger;
|
||||
extern bool engineEnableDebugPrivilege;
|
||||
extern bool engineSafeAttach;
|
||||
|
|
|
|||
|
|
@ -4,144 +4,22 @@
|
|||
#include "Global.Handle.h"
|
||||
#include "Global.Engine.h"
|
||||
|
||||
|
||||
wchar_t engineSzEngineGarbageFolder[MAX_PATH] = L"";
|
||||
|
||||
// Global.Garbage.functions:
|
||||
bool CreateGarbageItem(void* outGargabeItem, int MaxGargabeStringSize)
|
||||
{
|
||||
wchar_t szGarbageItem[512];
|
||||
wchar_t szGargabeItemBuff[128];
|
||||
|
||||
RtlZeroMemory(&szGarbageItem, sizeof szGarbageItem);
|
||||
RtlZeroMemory(&szGargabeItemBuff, sizeof szGargabeItemBuff);
|
||||
srand((unsigned int)time(NULL));
|
||||
wsprintfW(szGargabeItemBuff, L"Junk-%08x\\", (rand() % 128 + 1) * (rand() % 128 + 1) + (rand() % 1024 + 1));
|
||||
lstrcpyW(szGarbageItem, engineSzEngineGarbageFolder);
|
||||
lstrcatW(szGarbageItem, szGargabeItemBuff);
|
||||
EngineCreatePathForFileW(szGarbageItem);
|
||||
|
||||
if(lstrlenW(szGarbageItem) * 2 >= MaxGargabeStringSize)
|
||||
{
|
||||
RtlMoveMemory(outGargabeItem, &szGarbageItem, MaxGargabeStringSize);
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
RtlMoveMemory(outGargabeItem, &szGarbageItem, lstrlenW(szGarbageItem) * 2);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
bool RemoveGarbageItem(wchar_t* szGarbageItem, bool RemoveFolder)
|
||||
{
|
||||
|
||||
wchar_t szFindSearchString[MAX_PATH];
|
||||
wchar_t szFoundFile[MAX_PATH];
|
||||
WIN32_FIND_DATAW FindData;
|
||||
bool QueryNextFile = true;
|
||||
HANDLE CurrentFile;
|
||||
|
||||
if(szGarbageItem != NULL)
|
||||
{
|
||||
lstrcpyW(szFindSearchString, szGarbageItem);
|
||||
if(szFindSearchString[0] != NULL)
|
||||
{
|
||||
lstrcatW(szFindSearchString, L"\\*.*");
|
||||
CurrentFile = FindFirstFileW(szFindSearchString, &FindData);
|
||||
while(QueryNextFile == true && CurrentFile != INVALID_HANDLE_VALUE)
|
||||
{
|
||||
RtlZeroMemory(&szFoundFile, sizeof szFoundFile);
|
||||
lstrcpyW(szFoundFile, szGarbageItem);
|
||||
lstrcatW(szFoundFile, FindData.cFileName);
|
||||
if(FindData.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)
|
||||
{
|
||||
if(FindData.cFileName[0] != 0x2E)
|
||||
{
|
||||
lstrcatW(szFoundFile, L"\\");
|
||||
RemoveGarbageItem(szFoundFile, true);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if(!DeleteFileW(szFoundFile))
|
||||
{
|
||||
if(HandlerCloseAllLockHandlesW(szFoundFile, false, true))
|
||||
{
|
||||
DeleteFileW(szFoundFile);
|
||||
}
|
||||
}
|
||||
}
|
||||
if(!FindNextFileW(CurrentFile, &FindData))
|
||||
{
|
||||
QueryNextFile = false;
|
||||
}
|
||||
}
|
||||
FindClose(CurrentFile);
|
||||
if(RemoveFolder)
|
||||
{
|
||||
if(lstrlenW(engineSzEngineGarbageFolder) < lstrlenW(szGarbageItem))
|
||||
{
|
||||
if(!RemoveDirectoryW(szGarbageItem))
|
||||
{
|
||||
if(HandlerCloseAllLockHandlesW(szGarbageItem, true, true))
|
||||
{
|
||||
RemoveDirectoryW(szGarbageItem);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
bool FillGarbageItem(wchar_t* szGarbageItem, wchar_t* szFileName, void* outGargabeItem, int MaxGargabeStringSize)
|
||||
{
|
||||
if(!szGarbageItem || !szFileName || !outGargabeItem)
|
||||
return false;
|
||||
wchar_t szCopyFileName[512];
|
||||
wchar_t szGargabeItemBuff[128];
|
||||
|
||||
lstrcpyW(szCopyFileName, szGarbageItem);
|
||||
if(szFileName != NULL)
|
||||
{
|
||||
lstrcatW(szCopyFileName, EngineExtractFileNameW(szFileName));
|
||||
}
|
||||
else
|
||||
{
|
||||
srand((unsigned int)time(NULL));
|
||||
wsprintfW(szGargabeItemBuff, L"Junk-Data-%08x.bin", (rand() % 128 + 1) * (rand() % 128 + 1) + (rand() % 1024 + 1));
|
||||
lstrcatW(szCopyFileName, szGargabeItemBuff);
|
||||
}
|
||||
if(lstrlenW(szCopyFileName) >= MaxGargabeStringSize)
|
||||
{
|
||||
RtlMoveMemory(outGargabeItem, &szCopyFileName, MaxGargabeStringSize);
|
||||
if(szFileName != NULL)
|
||||
{
|
||||
CopyFileW(szFileName, szCopyFileName, false);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
RtlMoveMemory(outGargabeItem, &szCopyFileName, lstrlenW(szCopyFileName) * 2);
|
||||
if(szFileName != NULL)
|
||||
{
|
||||
CopyFileW(szFileName, szCopyFileName, false);
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
void EmptyGarbage()
|
||||
{
|
||||
RemoveGarbageItem(engineSzEngineGarbageFolder, false);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,8 +1,6 @@
|
|||
#ifndef _GLOBAL_GARBAGE_H
|
||||
#define _GLOBAL_GARBAGE_H
|
||||
|
||||
extern wchar_t engineSzEngineGarbageFolder[MAX_PATH];
|
||||
|
||||
// Global.Garbage.functions:
|
||||
bool CreateGarbageItem(void* outGargabeItem, int MaxGargabeStringSize);
|
||||
bool RemoveGarbageItem(wchar_t* szGarbageItem, bool RemoveFolder);
|
||||
|
|
|
|||
|
|
@ -3,7 +3,6 @@
|
|||
#include "Global.Debugger.h"
|
||||
#include "Global.Handle.h"
|
||||
#include "Global.Engine.h"
|
||||
#include "Global.Engine.Extension.h"
|
||||
#include "Global.Breakpoints.h"
|
||||
#include "Global.Threader.h"
|
||||
#include "Global.Librarian.h"
|
||||
|
|
@ -103,12 +102,7 @@ __declspec(dllexport) void TITCALL DebugLoop()
|
|||
memset(&DBGEvent, 0, sizeof(DEBUG_EVENT));
|
||||
memset(&TerminateDBGEvent, 0, sizeof(DEBUG_EVENT));
|
||||
memset(&DLLDebugFileName, 0, sizeof(DLLDebugFileName));
|
||||
ExtensionManagerPluginResetCallBack();
|
||||
engineFileIsBeingDebugged = true;
|
||||
if(engineExecutePluginCallBack)
|
||||
{
|
||||
ExtensionManagerPluginDebugCallBack(&DBGEvent, UE_PLUGIN_CALL_REASON_PREDEBUG);
|
||||
}
|
||||
|
||||
while(!BreakDBG) //actual debug loop
|
||||
{
|
||||
|
|
@ -164,11 +158,6 @@ __declspec(dllexport) void TITCALL DebugLoop()
|
|||
}
|
||||
}
|
||||
|
||||
if(engineExecutePluginCallBack)
|
||||
{
|
||||
ExtensionManagerPluginDebugCallBack(&DBGEvent, UE_PLUGIN_CALL_REASON_EXCEPTION);
|
||||
}
|
||||
|
||||
//Debug event custom handler
|
||||
if(DBGCustomHandler->chDebugEvent != NULL)
|
||||
{
|
||||
|
|
@ -490,10 +479,6 @@ __declspec(dllexport) void TITCALL DebugLoop()
|
|||
{
|
||||
//http://maximumcrack.wordpress.com/2009/06/22/outputdebugstring-awesomeness/ (the final advice is incorrect, but still helpful)
|
||||
DBGCode = DBG_EXCEPTION_NOT_HANDLED; //pass exception to debuggee
|
||||
if(engineExecutePluginCallBack)
|
||||
{
|
||||
ExtensionManagerPluginDebugCallBack(&DBGEvent, UE_PLUGIN_CALL_REASON_UNHANDLEDEXCEPTION);
|
||||
}
|
||||
//debug string callback
|
||||
if(DBGCustomHandler->chOutputDebugString != NULL)
|
||||
{
|
||||
|
|
@ -704,7 +689,7 @@ __declspec(dllexport) void TITCALL DebugLoop()
|
|||
if(engineMembpAlt)
|
||||
{
|
||||
// Check if the breakpoint is still enabled/present and has not been removed
|
||||
for(int i = 0; i < BreakPointBuffer.size(); i++)
|
||||
for(size_t i = 0; i < BreakPointBuffer.size(); i++)
|
||||
{
|
||||
if(BreakPointBuffer.at(i).BreakPointAddress == ResetMemBPXAddress &&
|
||||
(BreakPointBuffer.at(i).BreakPointType == UE_MEMORY ||
|
||||
|
|
@ -1433,10 +1418,6 @@ __declspec(dllexport) void TITCALL DebugLoop()
|
|||
//general unhandled exception callback
|
||||
if(DBGCode == DBG_EXCEPTION_NOT_HANDLED)
|
||||
{
|
||||
if(engineExecutePluginCallBack)
|
||||
{
|
||||
ExtensionManagerPluginDebugCallBack(&DBGEvent, UE_PLUGIN_CALL_REASON_UNHANDLEDEXCEPTION);
|
||||
}
|
||||
if(DBGCustomHandler->chUnhandledException != NULL)
|
||||
{
|
||||
myCustomHandler = (fCustomHandler)((LPVOID)DBGCustomHandler->chUnhandledException);
|
||||
|
|
@ -1456,10 +1437,6 @@ __declspec(dllexport) void TITCALL DebugLoop()
|
|||
case RIP_EVENT:
|
||||
{
|
||||
DBGCode = DBG_EXCEPTION_NOT_HANDLED; //fix an anti-debug trick
|
||||
if(engineExecutePluginCallBack)
|
||||
{
|
||||
ExtensionManagerPluginDebugCallBack(&DBGEvent, UE_PLUGIN_CALL_REASON_UNHANDLEDEXCEPTION);
|
||||
}
|
||||
//rip event callback
|
||||
if(DBGCustomHandler->chRipEvent != NULL)
|
||||
{
|
||||
|
|
@ -1528,10 +1505,6 @@ continue_dbg_event:
|
|||
}
|
||||
ForceClose();
|
||||
engineFileIsBeingDebugged = false;
|
||||
if(engineExecutePluginCallBack)
|
||||
{
|
||||
ExtensionManagerPluginDebugCallBack(&DBGEvent, UE_PLUGIN_CALL_REASON_POSTDEBUG);
|
||||
}
|
||||
DebuggerReset();
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -4,7 +4,6 @@
|
|||
#include "Global.Mapping.h"
|
||||
#include "Global.Engine.Hook.h"
|
||||
#include "Global.Engine.GUI.h"
|
||||
#include "Global.Engine.Extension.h"
|
||||
#include "Global.Debugger.h"
|
||||
|
||||
// TitanEngine.Engine.functions:
|
||||
|
|
@ -35,10 +34,6 @@ __declspec(dllexport) void TITCALL SetEngineVariable(DWORD VariableId, bool Vari
|
|||
{
|
||||
engineResetCustomHandler = VariableSet;
|
||||
}
|
||||
else if(VariableId == UE_ENGINE_CALL_PLUGIN_DEBUG_CALLBACK)
|
||||
{
|
||||
engineExecutePluginCallBack = VariableSet;
|
||||
}
|
||||
else if(VariableId == UE_ENGINE_SET_DEBUG_PRIVILEGE)
|
||||
{
|
||||
engineEnableDebugPrivilege = VariableSet;
|
||||
|
|
@ -360,8 +355,6 @@ __declspec(dllexport) bool TITCALL EngineCheckStructAlignment(DWORD StructureTyp
|
|||
return (sizeof(PROCESS_ITEM_DATA) == StructureSize);
|
||||
case UE_STRUCT_HANDLERARRAY:
|
||||
return (sizeof(HandlerArray) == StructureSize);
|
||||
case UE_STRUCT_PLUGININFORMATION:
|
||||
return (sizeof(PluginInformation) == StructureSize);
|
||||
case UE_STRUCT_HOOK_ENTRY:
|
||||
return (sizeof(HOOK_ENTRY) == StructureSize);
|
||||
case UE_STRUCT_FILE_STATUS_INFO:
|
||||
|
|
|
|||
|
|
@ -3,7 +3,6 @@
|
|||
#include "Global.Engine.h"
|
||||
#include "Global.Garbage.h"
|
||||
#include "Global.Injector.h"
|
||||
#include "Global.Engine.Extension.h"
|
||||
#include "Global.Engine.Threading.h"
|
||||
#include "Global.Debugger.h"
|
||||
|
||||
|
|
@ -16,17 +15,11 @@ BOOL APIENTRY DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved)
|
|||
engineHandle = hinstDLL;
|
||||
InitializeCriticalSection(&engineStepActiveCr);
|
||||
EngineInit();
|
||||
EmptyGarbage();
|
||||
for(int i = 0; i < UE_MAX_RESERVED_MEMORY_LEFT; i++)
|
||||
engineReservedMemoryLeft[i] = NULL;
|
||||
break;
|
||||
case DLL_THREAD_ATTACH:
|
||||
case DLL_THREAD_DETACH:
|
||||
break; //this bug has been here since 2010
|
||||
case DLL_PROCESS_DETACH:
|
||||
if(lpvReserved)
|
||||
ExtensionManagerPluginReleaseCallBack();
|
||||
RemoveDirectoryW(engineSzEngineGarbageFolder);
|
||||
CriticalSectionLocker::Deinitialize(); //delete critical sections
|
||||
break;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -396,15 +396,6 @@ EngineCreateMissingDependenciesW
|
|||
EngineCreateUnpackerWindow
|
||||
EngineAddUnpackerWindowLogMessage
|
||||
EngineCheckStructAlignment
|
||||
ExtensionManagerIsPluginLoaded
|
||||
ExtensionManagerIsPluginEnabled
|
||||
ExtensionManagerDisablePlugin
|
||||
ExtensionManagerDisableAllPlugins
|
||||
ExtensionManagerEnablePlugin
|
||||
ExtensionManagerEnableAllPlugins
|
||||
ExtensionManagerUnloadPlugin
|
||||
ExtensionManagerUnloadAllPlugins
|
||||
ExtensionManagerGetPluginInfo
|
||||
EngineUnpackerInitialize
|
||||
EngineUnpackerInitializeW
|
||||
EngineUnpackerSetEntryPointAddress
|
||||
|
|
|
|||
|
|
@ -237,7 +237,6 @@
|
|||
<ClCompile Include="Global.Debugger.cpp" />
|
||||
<ClCompile Include="Global.Engine.Context.cpp" />
|
||||
<ClCompile Include="Global.Engine.cpp" />
|
||||
<ClCompile Include="Global.Engine.Extension.cpp" />
|
||||
<ClCompile Include="Global.Engine.Hash.cpp" />
|
||||
<ClCompile Include="Global.Engine.Hider.cpp" />
|
||||
<ClCompile Include="Global.Engine.Hook.cpp" />
|
||||
|
|
@ -305,7 +304,6 @@
|
|||
<ClInclude Include="Global.Breakpoints.h" />
|
||||
<ClInclude Include="Global.Debugger.h" />
|
||||
<ClInclude Include="Global.Engine.Context.h" />
|
||||
<ClInclude Include="Global.Engine.Extension.h" />
|
||||
<ClInclude Include="Global.Engine.h" />
|
||||
<ClInclude Include="Global.Engine.Hider.h" />
|
||||
<ClInclude Include="Global.Engine.Hook.h" />
|
||||
|
|
|
|||
|
|
@ -60,9 +60,6 @@
|
|||
<ClCompile Include="Global.Engine.cpp">
|
||||
<Filter>Source Files\TitanEngine</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="Global.Engine.Extension.cpp">
|
||||
<Filter>Source Files\TitanEngine</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="Global.Engine.Hash.cpp">
|
||||
<Filter>Source Files\TitanEngine</Filter>
|
||||
</ClCompile>
|
||||
|
|
@ -242,9 +239,6 @@
|
|||
<ClInclude Include="Global.Engine.h">
|
||||
<Filter>Header Files\TitanEngine</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="Global.Engine.Extension.h">
|
||||
<Filter>Header Files\TitanEngine</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="Global.Realigner.h">
|
||||
<Filter>Header Files\TitanEngine</Filter>
|
||||
</ClInclude>
|
||||
|
|
|
|||
|
|
@ -436,16 +436,6 @@ __declspec(dllexport) bool TITCALL EngineDeleteCreatedDependencies();
|
|||
__declspec(dllexport) bool TITCALL EngineCreateUnpackerWindow(char* WindowUnpackerTitle, char* WindowUnpackerLongTitle, char* WindowUnpackerName, char* WindowUnpackerAuthor, void* StartUnpackingCallBack);
|
||||
__declspec(dllexport) void TITCALL EngineAddUnpackerWindowLogMessage(char* szLogMessage);
|
||||
__declspec(dllexport) bool TITCALL EngineCheckStructAlignment(DWORD StructureType, ULONG_PTR StructureSize);
|
||||
// Global.Engine.Extension.Functions:
|
||||
__declspec(dllexport) bool TITCALL ExtensionManagerIsPluginLoaded(char* szPluginName);
|
||||
__declspec(dllexport) bool TITCALL ExtensionManagerIsPluginEnabled(char* szPluginName);
|
||||
__declspec(dllexport) bool TITCALL ExtensionManagerDisableAllPlugins();
|
||||
__declspec(dllexport) bool TITCALL ExtensionManagerDisablePlugin(char* szPluginName);
|
||||
__declspec(dllexport) bool TITCALL ExtensionManagerEnableAllPlugins();
|
||||
__declspec(dllexport) bool TITCALL ExtensionManagerEnablePlugin(char* szPluginName);
|
||||
__declspec(dllexport) bool TITCALL ExtensionManagerUnloadAllPlugins();
|
||||
__declspec(dllexport) bool TITCALL ExtensionManagerUnloadPlugin(char* szPluginName);
|
||||
__declspec(dllexport) void* TITCALL ExtensionManagerGetPluginInfo(char* szPluginName);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue