mirror of https://github.com/x64dbg/TitanEngine
- threaded dialog, meaning you can see the log when a target is running
- aligned the GUI elements
This commit is contained in:
parent
44ebae8396
commit
9fc398c76b
|
|
@ -6,6 +6,8 @@
|
||||||
//variables
|
//variables
|
||||||
static HINSTANCE hInst;
|
static HINSTANCE hInst;
|
||||||
static HWND hLogBox;
|
static HWND hLogBox;
|
||||||
|
static HWND hRunBtn;
|
||||||
|
static bool bRunning;
|
||||||
static TCHAR FileNameTarget[MAX_PATH] = {};
|
static TCHAR FileNameTarget[MAX_PATH] = {};
|
||||||
static TCHAR FileNameScript[MAX_PATH] = {};
|
static TCHAR FileNameScript[MAX_PATH] = {};
|
||||||
static TCHAR FileNameIni[MAX_PATH] = {};
|
static TCHAR FileNameIni[MAX_PATH] = {};
|
||||||
|
|
@ -18,6 +20,7 @@ static void SettingSet(const TCHAR* name, const TCHAR* value);
|
||||||
static void SettingGet(const TCHAR* name, TCHAR* value, int value_size);
|
static void SettingGet(const TCHAR* name, TCHAR* value, int value_size);
|
||||||
static bool FileExists(LPCTSTR szPath);
|
static bool FileExists(LPCTSTR szPath);
|
||||||
static void CreateDummyUnicodeFile(const TCHAR* szFileName);
|
static void CreateDummyUnicodeFile(const TCHAR* szFileName);
|
||||||
|
static DWORD WINAPI TitanScriptExecThread(LPVOID lpParam);
|
||||||
|
|
||||||
//TitanScript functions
|
//TitanScript functions
|
||||||
static tScripterLoadFileA load_file = NULL;
|
static tScripterLoadFileA load_file = NULL;
|
||||||
|
|
@ -49,6 +52,7 @@ INT_PTR CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
|
||||||
|
|
||||||
//initialize variables
|
//initialize variables
|
||||||
hLogBox = GetDlgItem(hWnd, IDC_LOG);
|
hLogBox = GetDlgItem(hWnd, IDC_LOG);
|
||||||
|
hRunBtn = GetDlgItem(hWnd, IDC_RUN);
|
||||||
int i = GetModuleFileName(hInst, FileNameIni, _countof(FileNameIni));
|
int i = GetModuleFileName(hInst, FileNameIni, _countof(FileNameIni));
|
||||||
while(FileNameIni[i] != TCHAR('\\') && i)
|
while(FileNameIni[i] != TCHAR('\\') && i)
|
||||||
i--;
|
i--;
|
||||||
|
|
@ -117,23 +121,10 @@ INT_PTR CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
|
||||||
}
|
}
|
||||||
case IDC_RUN:
|
case IDC_RUN:
|
||||||
{
|
{
|
||||||
char buf[MAX_PATH] = {0};
|
if(!bRunning)
|
||||||
|
CreateThread(0, 0, TitanScriptExecThread, 0, 0, 0);
|
||||||
wcstombs(buf, FileNameScript, sizeof(buf));
|
else
|
||||||
if(!load_file(buf))
|
StopDebug();
|
||||||
{
|
|
||||||
AddLogMessage("Script failed to load", TS_LOG_ERROR);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
wcstombs(buf, FileNameTarget, sizeof(buf));
|
|
||||||
if(!exec(buf, "")) //TitanScript will generate the output filename
|
|
||||||
{
|
|
||||||
AddLogMessage("Failed to execute", TS_LOG_ERROR);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
@ -209,3 +200,26 @@ static void CreateDummyUnicodeFile(const TCHAR* szFileName)
|
||||||
CloseHandle(hFile);
|
CloseHandle(hFile);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static DWORD WINAPI TitanScriptExecThread(LPVOID lpParam)
|
||||||
|
{
|
||||||
|
char buf[MAX_PATH] = {0};
|
||||||
|
wcstombs(buf, FileNameScript, sizeof(buf));
|
||||||
|
if(!load_file(buf))
|
||||||
|
{
|
||||||
|
AddLogMessage("Script failed to load", TS_LOG_ERROR);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
SetWindowText(hRunBtn, _T("Stop"));
|
||||||
|
bRunning = true;
|
||||||
|
wcstombs(buf, FileNameTarget, sizeof(buf));
|
||||||
|
if(!exec(buf, "")) //TitanScript will generate the output filename
|
||||||
|
{
|
||||||
|
AddLogMessage("Failed to execute", TS_LOG_ERROR);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
AddLogMessage("Debugging stopped", TS_LOG_NORMAL);
|
||||||
|
bRunning = false;
|
||||||
|
SetWindowText(hRunBtn, _T("Run"));
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
Binary file not shown.
Loading…
Reference in New Issue