1
0
Fork 0

DBG: added EnableDebugPrivilege setting

DBG: fixed a small bug in GetFileNameFromHandle
DBG: fixed a bug with attaching to x32 processes from x64_dbg
DBG: updated TitanEngine
GUI: added 'Enable Debug Privilege' to the settings dialog
This commit is contained in:
Mr. eXoDia 2014-04-16 19:25:45 +02:00
parent 22e78f5a8d
commit e8664e2749
11 changed files with 49 additions and 13 deletions

View File

@ -51,6 +51,7 @@
#define UE_ENGINE_CALL_PLUGIN_CALLBACK 6
#define UE_ENGINE_RESET_CUSTOM_HANDLER 7
#define UE_ENGINE_CALL_PLUGIN_DEBUG_CALLBACK 8
#define UE_ENGINE_SET_DEBUG_PRIVILEGE 9
#define UE_OPTION_REMOVEALL 1
#define UE_OPTION_DISABLEALL 2
@ -859,6 +860,7 @@ __declspec(dllexport) void TITCALL LibrarianEnumLibraryInfoW(void* EnumCallBack)
__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);
// TitanEngine.TLSFixer.functions:
__declspec(dllexport) bool TITCALL TLSBreakOnCallBack(LPVOID ArrayOfCallBacks, DWORD NumberOfCallBacks, LPVOID bpxCallBack);
__declspec(dllexport) bool TITCALL TLSGrabCallBackData(char* szFileName, LPVOID ArrayOfCallBacks, LPDWORD NumberOfCallBacks);

View File

@ -662,6 +662,13 @@ extern "C" DLL_EXPORT uint _dbg_sendmessage(DBGMSG type, void* param1, void* par
break;
}
}
if(BridgeSettingGetUint("Engine", "EnableDebugPrivilege", &setting))
{
if(setting)
SetEngineVariable(UE_ENGINE_SET_DEBUG_PRIVILEGE, true);
else
SetEngineVariable(UE_ENGINE_SET_DEBUG_PRIVILEGE, false);
}
char exceptionRange[MAX_SETTING_SIZE]="";
dbgclearignoredexceptions();
if(BridgeSettingGet("Exceptions", "IgnoreRange", exceptionRange))

View File

@ -170,7 +170,8 @@ bool GetFileNameFromHandle(HANDLE hFile, char* szFileName)
char szMappedName[MAX_PATH]="";
if(GetMappedFileNameA(GetCurrentProcess(), pFileMap, szMappedName, MAX_PATH))
{
DevicePathToPath(szMappedName, szFileName, MAX_PATH);
if(!DevicePathToPath(szMappedName, szFileName, MAX_PATH))
return false;
UnmapViewOfFile(pFileMap);
CloseHandle(hFileMap);
return true;

View File

@ -1912,18 +1912,12 @@ CMDRESULT cbDebugAttach(int argc, char* argv[])
dputs("terminate the current session!");
return STATUS_ERROR;
}
HANDLE hProcess=OpenProcess(PROCESS_ALL_ACCESS, false, pid);
HANDLE hProcess=TitanOpenProcess(PROCESS_ALL_ACCESS, false, pid);
if(!hProcess)
{
dprintf("could not open process %X!\n", pid);
return STATUS_ERROR;
}
if(!GetModuleFileNameExA(hProcess, 0, szFileName, sizeof(szFileName)))
{
dprintf("could not get module filename %X!\n", pid);
CloseHandle(hProcess);
return STATUS_ERROR;
}
BOOL wow64=false, mewow64=false;
if(!IsWow64Process(hProcess, &wow64) or !IsWow64Process(GetCurrentProcess(), &mewow64))
{
@ -1941,6 +1935,12 @@ CMDRESULT cbDebugAttach(int argc, char* argv[])
CloseHandle(hProcess);
return STATUS_ERROR;
}
if(!GetModuleFileNameExA(hProcess, 0, szFileName, sizeof(szFileName)))
{
dprintf("could not get module filename %X!\n", pid);
CloseHandle(hProcess);
return STATUS_ERROR;
}
CloseHandle(hProcess);
CreateThread(0, 0, threadAttachLoop, (void*)pid, 0, 0);
return STATUS_CONTINUE;

View File

@ -96,6 +96,7 @@ void SettingsDialog::LoadSettings()
}
}
GetSettingBool("Engine", "UndecorateSymbolNames", &settings.engineUndecorateSymbolNames);
GetSettingBool("Engine", "EnableDebugPrivilege", &settings.engineEnableDebugPrivilege);
switch(settings.engineCalcType)
{
case calc_signed:
@ -118,6 +119,7 @@ void SettingsDialog::LoadSettings()
break;
}
ui->chkUndecorateSymbolNames->setChecked(settings.engineUndecorateSymbolNames);
ui->chkEnableDebugPrivilege->setChecked(settings.engineEnableDebugPrivilege);
//Exceptions tab
char exceptionRange[MAX_SETTING_SIZE]="";
@ -157,6 +159,7 @@ void SettingsDialog::SaveSettings()
BridgeSettingSetUint("Engine", "CalculationType", settings.engineCalcType);
BridgeSettingSetUint("Engine", "BreakpointType", settings.engineBreakpointType);
BridgeSettingSetUint("Engine", "UndecorateSymbolNames", settings.engineUndecorateSymbolNames);
BridgeSettingSetUint("Engine", "EnableDebugPrivilege", settings.engineEnableDebugPrivilege);
//Exceptions tab
QString exceptionRange="";
@ -327,6 +330,14 @@ void SettingsDialog::on_chkUndecorateSymbolNames_stateChanged(int arg1)
settings.engineUndecorateSymbolNames=true;
}
void SettingsDialog::on_chkEnableDebugPrivilege_stateChanged(int arg1)
{
if(arg1==Qt::Unchecked)
settings.engineEnableDebugPrivilege=false;
else
settings.engineEnableDebugPrivilege=true;
}
void SettingsDialog::on_btnAddRange_clicked()
{
ExceptionRangeDialog exceptionRange(this);

View File

@ -42,6 +42,7 @@ private slots:
void on_radioInt3Long_clicked();
void on_radioUd2_clicked();
void on_chkUndecorateSymbolNames_stateChanged(int arg1);
void on_chkEnableDebugPrivilege_stateChanged(int arg1);
//Exception tab
void on_btnAddRange_clicked();
void on_btnDeleteRange_clicked();
@ -94,6 +95,7 @@ private:
CalcType engineCalcType;
BreakpointType engineBreakpointType;
bool engineUndecorateSymbolNames;
bool engineEnableDebugPrivilege;
//Exception Tab
QList<RangeStruct>* exceptionRanges;
};

View File

@ -7,7 +7,7 @@
<x>0</x>
<y>0</y>
<width>262</width>
<height>201</height>
<height>220</height>
</rect>
</property>
<property name="sizePolicy">
@ -32,7 +32,7 @@
<x>2</x>
<y>2</y>
<width>261</width>
<height>161</height>
<height>181</height>
</rect>
</property>
<property name="autoFillBackground">
@ -306,6 +306,19 @@
<string>Undecorate Symbol Names</string>
</property>
</widget>
<widget class="QCheckBox" name="chkEnableDebugPrivilege">
<property name="geometry">
<rect>
<x>10</x>
<y>130</y>
<width>131</width>
<height>17</height>
</rect>
</property>
<property name="text">
<string>Enable Debug &amp;Privilege</string>
</property>
</widget>
</widget>
<widget class="QWidget" name="tabExceptions">
<attribute name="title">
@ -317,7 +330,7 @@
<x>10</x>
<y>30</y>
<width>151</width>
<height>81</height>
<height>111</height>
</rect>
</property>
<property name="font">
@ -382,7 +395,7 @@
<property name="geometry">
<rect>
<x>100</x>
<y>170</y>
<y>190</y>
<width>75</width>
<height>23</height>
</rect>
@ -398,7 +411,7 @@
<property name="geometry">
<rect>
<x>180</x>
<y>170</y>
<y>190</y>
<width>75</width>
<height>23</height>
</rect>