mirror of https://github.com/x64dbg/TitanEngine
reduce hardcoded buffer sizes
This commit is contained in:
parent
ef8ad17f62
commit
3718dca0f8
|
|
@ -26,14 +26,14 @@ bool EngineGetFileDialog(char* GlobalBuffer)
|
||||||
|
|
||||||
RtlZeroMemory(&sOpenFileName, sizeof(OPENFILENAMEA));
|
RtlZeroMemory(&sOpenFileName, sizeof(OPENFILENAMEA));
|
||||||
sOpenFileName.lStructSize = sizeof(OPENFILENAMEA);
|
sOpenFileName.lStructSize = sizeof(OPENFILENAMEA);
|
||||||
sOpenFileName.lpstrFilter = &szFilterString[0];
|
sOpenFileName.lpstrFilter = szFilterString;
|
||||||
sOpenFileName.lpstrFile = &GlobalBuffer[0];
|
sOpenFileName.lpstrFile = GlobalBuffer;
|
||||||
sOpenFileName.nMaxFile = 1024;
|
sOpenFileName.nMaxFile = 1024;
|
||||||
sOpenFileName.Flags = OFN_FILEMUSTEXIST | OFN_PATHMUSTEXIST | OFN_LONGNAMES | OFN_EXPLORER | OFN_HIDEREADONLY;
|
sOpenFileName.Flags = OFN_FILEMUSTEXIST | OFN_PATHMUSTEXIST | OFN_LONGNAMES | OFN_EXPLORER | OFN_HIDEREADONLY;
|
||||||
sOpenFileName.lpstrTitle = &szDialogTitle[0];
|
sOpenFileName.lpstrTitle = szDialogTitle;
|
||||||
if(!GetOpenFileNameA(&sOpenFileName))
|
if(!GetOpenFileNameA(&sOpenFileName))
|
||||||
{
|
{
|
||||||
RtlZeroMemory(&GlobalBuffer[0], 1024);
|
RtlZeroMemory(GlobalBuffer, 1024);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
@ -44,7 +44,6 @@ bool EngineGetFileDialog(char* GlobalBuffer)
|
||||||
|
|
||||||
long EngineWndProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
|
long EngineWndProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
|
||||||
{
|
{
|
||||||
|
|
||||||
char szAboutTitle[] = "[ About ]";
|
char szAboutTitle[] = "[ About ]";
|
||||||
char szAboutText[] = "%s \r\n\r\n ReversingLabs - http://www.reversinglabs.com \r\n\r\n Minimum engine version needed:\r\n- TitanEngine %i.%i.%i by RevLabs\r\n\r\nUnpacker coded by %s";
|
char szAboutText[] = "%s \r\n\r\n ReversingLabs - http://www.reversinglabs.com \r\n\r\n Minimum engine version needed:\r\n- TitanEngine %i.%i.%i by RevLabs\r\n\r\nUnpacker coded by %s";
|
||||||
typedef void(TITCALL *fStartUnpacking)(char* szInputFile, bool RealignFile, bool CopyOverlay);
|
typedef void(TITCALL *fStartUnpacking)(char* szInputFile, bool RealignFile, bool CopyOverlay);
|
||||||
|
|
@ -65,7 +64,7 @@ long EngineWndProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
|
||||||
}
|
}
|
||||||
else if(uMsg == WM_DROPFILES)
|
else if(uMsg == WM_DROPFILES)
|
||||||
{
|
{
|
||||||
DragQueryFileA((HDROP)wParam, NULL, GlobalBuffer, 1024);
|
DragQueryFileA((HDROP)wParam, NULL, GlobalBuffer, sizeof(GlobalBuffer));
|
||||||
SetDlgItemTextA(hwndDlg, IDC_FILENAME, GlobalBuffer);
|
SetDlgItemTextA(hwndDlg, IDC_FILENAME, GlobalBuffer);
|
||||||
}
|
}
|
||||||
else if(uMsg == WM_CLOSE)
|
else if(uMsg == WM_CLOSE)
|
||||||
|
|
@ -76,7 +75,7 @@ long EngineWndProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
|
||||||
{
|
{
|
||||||
if(wParam == IDC_UNPACK)
|
if(wParam == IDC_UNPACK)
|
||||||
{
|
{
|
||||||
GetDlgItemTextA(hwndDlg, IDC_FILENAME, GlobalBuffer, 1024);
|
GetDlgItemTextA(hwndDlg, IDC_FILENAME, GlobalBuffer, sizeof(GlobalBuffer));
|
||||||
if(!IsFileBeingDebugged() && EngineFileExists(GlobalBuffer))
|
if(!IsFileBeingDebugged() && EngineFileExists(GlobalBuffer))
|
||||||
{
|
{
|
||||||
EngineBoxHandle = GetDlgItem(hwndDlg, IDC_LISTBOX);
|
EngineBoxHandle = GetDlgItem(hwndDlg, IDC_LISTBOX);
|
||||||
|
|
@ -109,5 +108,5 @@ long EngineWndProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
|
||||||
EndDialog(hwndDlg, NULL);
|
EndDialog(hwndDlg, NULL);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return(NULL);
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -119,7 +119,7 @@ __declspec(dllexport) bool TITCALL EngineCreateMissingDependenciesW(wchar_t* szF
|
||||||
MultiByteToWideChar(CP_ACP, NULL, ImportDllName, lstrlenA(ImportDllName)+1, ImportDllNameW, sizeof(ImportDllNameW)/(sizeof(ImportDllNameW[0])));
|
MultiByteToWideChar(CP_ACP, NULL, ImportDllName, lstrlenA(ImportDllName)+1, ImportDllNameW, sizeof(ImportDllNameW)/(sizeof(ImportDllNameW[0])));
|
||||||
if(!EngineIsDependencyPresentW(ImportDllNameW, szFileName, szOutputFolder))
|
if(!EngineIsDependencyPresentW(ImportDllNameW, szFileName, szOutputFolder))
|
||||||
{
|
{
|
||||||
RtlZeroMemory(&BuildExportName, 512);
|
RtlZeroMemory(&BuildExportName, sizeof(BuildExportName));
|
||||||
lstrcatW(BuildExportName, szOutputFolder);
|
lstrcatW(BuildExportName, szOutputFolder);
|
||||||
if(BuildExportName[lstrlenW(BuildExportName)-1] != 0x5C)
|
if(BuildExportName[lstrlenW(BuildExportName)-1] != 0x5C)
|
||||||
{
|
{
|
||||||
|
|
@ -173,7 +173,7 @@ __declspec(dllexport) bool TITCALL EngineCreateMissingDependenciesW(wchar_t* szF
|
||||||
MultiByteToWideChar(CP_ACP, NULL, ImportDllName, lstrlenA(ImportDllName)+1, ImportDllNameW, sizeof(ImportDllNameW)/(sizeof(ImportDllNameW[0])));
|
MultiByteToWideChar(CP_ACP, NULL, ImportDllName, lstrlenA(ImportDllName)+1, ImportDllNameW, sizeof(ImportDllNameW)/(sizeof(ImportDllNameW[0])));
|
||||||
if(!EngineIsDependencyPresentW(ImportDllNameW, szFileName, szOutputFolder))
|
if(!EngineIsDependencyPresentW(ImportDllNameW, szFileName, szOutputFolder))
|
||||||
{
|
{
|
||||||
RtlZeroMemory(&BuildExportName, 512);
|
RtlZeroMemory(&BuildExportName, sizeof(BuildExportName));
|
||||||
lstrcatW(BuildExportName, szOutputFolder);
|
lstrcatW(BuildExportName, szOutputFolder);
|
||||||
if(BuildExportName[lstrlenW(BuildExportName)-1] != 0x5C)
|
if(BuildExportName[lstrlenW(BuildExportName)-1] != 0x5C)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue