Page MenuHomedesp's stash

No OneTemporary

diff --git a/Scylla/DisassemblerGui.cpp b/Scylla/DisassemblerGui.cpp
index 7a2b2b7..7d51881 100644
--- a/Scylla/DisassemblerGui.cpp
+++ b/Scylla/DisassemblerGui.cpp
@@ -1,135 +1,137 @@
#include "DisassemblerGui.h"
#include "ProcessAccessHelp.h"
BOOL DisassemblerGui::OnInitDialog(CWindow wndFocus, LPARAM lInitParam)
{
ListDisassembler.Attach(GetDlgItem(IDC_LIST_DISASSEMBLER));
addColumnsToDisassembler(ListDisassembler);
displayDisassembly(ListDisassembler);
+ CenterWindow();
+
return TRUE;
}
void DisassemblerGui::OnContextMenu(CWindow wnd, CPoint point)
{
if (wnd.GetDlgCtrlID() == IDC_LIST_DISASSEMBLER)
{
CMenuHandle hmenuTrackPopup = getCorrectSubMenu(IDR_MENU_DISASSEMBLER, 0);
BOOL menuItem = hmenuTrackPopup.TrackPopupMenu(TPM_LEFTALIGN | TPM_RIGHTBUTTON | TPM_RETURNCMD, point.x, point.y, wnd);
hmenuTrackPopup.DestroyMenu();
if (menuItem)
{
int selection = ListDisassembler.GetSelectionMark();
if (selection != -1) //valid selection?
{
int column = -1;
switch (menuItem)
{
case ID__DIS_ADDRESS:
column = COL_ADDRESS;
break;
case ID__DIS_SIZE:
column = COL_INSTRUCTION_SIZE;
break;
case ID__DIS_OPCODES:
column = COL_OPCODES;
break;
case ID__DIS_INSTRUCTIONS:
column = COL_INSTRUCTION;
break;
}
if(column != -1)
{
tempBuffer[0] = '\0';
ListDisassembler.GetItemText(selection, column, tempBuffer, _countof(tempBuffer));
copyToClipboard(tempBuffer);
}
}
}
}
}
void DisassemblerGui::OnCancel(UINT uNotifyCode, int nID, CWindow wndCtl)
{
EndDialog(0);
}
void DisassemblerGui::addColumnsToDisassembler(CListViewCtrl& list)
{
list.SetExtendedListViewStyle(LVS_EX_FULLROWSELECT, LVS_EX_FULLROWSELECT);
list.InsertColumn(COL_ADDRESS, L"Address", LVCFMT_LEFT, 105);
list.InsertColumn(COL_INSTRUCTION_SIZE, L"Size", LVCFMT_CENTER, 40);
list.InsertColumn(COL_OPCODES, L"OpCodes", LVCFMT_LEFT, 130);
list.InsertColumn(COL_INSTRUCTION, L"Instructions", LVCFMT_LEFT, 200);
}
void DisassemblerGui::displayDisassembly(CListViewCtrl& list)
{
BYTE data[DISASSEMBLER_GUI_MEMORY_SIZE];
list.DeleteAllItems();
if(!ProcessAccessHelp::readMemoryFromProcess(startAddress, sizeof(data), data))
return;
ProcessAccessHelp::disassembleMemory(data, sizeof(data), startAddress);
for (unsigned int i = 0; i < ProcessAccessHelp::decodedInstructionsCount; i++)
{
#ifdef _WIN64
swprintf_s(tempBuffer, _countof(tempBuffer),L"%016I64X",ProcessAccessHelp::decodedInstructions[i].offset);
#else
swprintf_s(tempBuffer, _countof(tempBuffer),L"%08X",ProcessAccessHelp::decodedInstructions[i].offset);
#endif
list.InsertItem(i, tempBuffer);
swprintf_s(tempBuffer, _countof(tempBuffer),L"%02d",ProcessAccessHelp::decodedInstructions[i].size);
list.SetItemText(i, COL_INSTRUCTION_SIZE, tempBuffer);
swprintf_s(tempBuffer, _countof(tempBuffer),L"%-24S",(char *)ProcessAccessHelp::decodedInstructions[i].instructionHex.p);
list.SetItemText(i, COL_OPCODES, tempBuffer);
swprintf_s(tempBuffer, _countof(tempBuffer),L"%S%S%S",(char*)ProcessAccessHelp::decodedInstructions[i].mnemonic.p, ProcessAccessHelp::decodedInstructions[i].operands.length != 0 ? " " : "", (char*)ProcessAccessHelp::decodedInstructions[i].operands.p);
list.SetItemText(i, COL_INSTRUCTION, tempBuffer);
}
}
void DisassemblerGui::copyToClipboard(const WCHAR * text)
{
if(OpenClipboard())
{
EmptyClipboard();
HGLOBAL hMem = GlobalAlloc(GMEM_MOVEABLE, (wcslen(text)+1)*sizeof(WCHAR));
if(hMem)
{
wcscpy((WCHAR *)GlobalLock(hMem), text);
GlobalUnlock(hMem);
if(!SetClipboardData(CF_UNICODETEXT, hMem))
{
GlobalFree(hMem);
}
}
CloseClipboard();
}
}
CMenuHandle DisassemblerGui::getCorrectSubMenu(int menuItem, int subMenuItem)
{
CMenuHandle hmenu; // top-level menu
// Load the menu resource.
if (!hmenu.LoadMenu(menuItem))
return NULL;
return hmenu.GetSubMenu(subMenuItem);
}
diff --git a/Scylla/OptionsGui.cpp b/Scylla/OptionsGui.cpp
index cc3941a..5289648 100644
--- a/Scylla/OptionsGui.cpp
+++ b/Scylla/OptionsGui.cpp
@@ -1,162 +1,164 @@
#include "OptionsGui.h"
#include "ConfigurationHolder.h"
BOOL OptionsGui::OnInitDialog(CWindow wndFocus, LPARAM lInitParam)
{
EditSectionName.Attach(GetDlgItem(IDC_OPTIONS_SECTIONNAME));
EditSectionName.LimitText(IMAGE_SIZEOF_SHORT_NAME);
loadOptions();
+ CenterWindow();
+
return TRUE;
}
void OptionsGui::OnOK(UINT uNotifyCode, int nID, CWindow wndCtl)
{
saveOptions();
ConfigurationHolder::saveConfiguration();
EndDialog(0);
}
void OptionsGui::OnCancel(UINT uNotifyCode, int nID, CWindow wndCtl)
{
EndDialog(0);
}
void OptionsGui::saveOptions()
{
std::map<Configuration, ConfigObject>::iterator mapIter;
for (mapIter = ConfigurationHolder::getConfigList().begin() ; mapIter != ConfigurationHolder::getConfigList().end(); mapIter++)
{
getConfigOptionsFromDlg((*mapIter).second);
}
}
void OptionsGui::loadOptions()
{
std::map<Configuration, ConfigObject>::iterator mapIter;
for (mapIter = ConfigurationHolder::getConfigList().begin() ; mapIter != ConfigurationHolder::getConfigList().end(); mapIter++)
{
displayConfigInDlg((*mapIter).second);
}
}
void OptionsGui::setCheckBox( int nIDDlgItem, bool bValue )
{
CButton Button(GetDlgItem(nIDDlgItem));
Button.SetCheck(bValue ? BST_CHECKED : BST_UNCHECKED);
}
void OptionsGui::displayConfigInDlg( ConfigObject & config )
{
switch (config.configType)
{
case String:
{
setEditControl(config.dialogItemValue, config.valueString);
}
break;
case Boolean:
{
setCheckBox(config.dialogItemValue, config.isTrue());
}
break;
case Decimal:
{
#ifdef _WIN64
swprintf_s(config.valueString, CONFIG_OPTIONS_STRING_LENGTH, TEXT("%I64u"),config.valueNumeric);
#else
swprintf_s(config.valueString, CONFIG_OPTIONS_STRING_LENGTH, TEXT("%u"),config.valueNumeric);
#endif
setEditControl(config.dialogItemValue, config.valueString);
}
break;
case Hexadecimal:
{
#ifdef _WIN64
swprintf_s(config.valueString, CONFIG_OPTIONS_STRING_LENGTH, TEXT("%016I64X"),config.valueNumeric);
#else
swprintf_s(config.valueString, CONFIG_OPTIONS_STRING_LENGTH, TEXT("%08X"),config.valueNumeric);
#endif
setEditControl(config.dialogItemValue, config.valueString);
}
break;
}
}
void OptionsGui::setEditControl( int nIDDlgItem, const WCHAR * valueString )
{
CEdit Edit(GetDlgItem(nIDDlgItem));
Edit.SetWindowText(valueString);
}
void OptionsGui::getConfigOptionsFromDlg( ConfigObject & config )
{
switch (config.configType)
{
case String:
{
getEditControl(config.dialogItemValue, config.valueString);
}
break;
case Boolean:
{
getCheckBox(config.dialogItemValue, &config.valueNumeric);
}
break;
case Decimal:
{
getEditControlNumeric(config.dialogItemValue, &config.valueNumeric, 10);
}
break;
case Hexadecimal:
{
getEditControlNumeric(config.dialogItemValue, &config.valueNumeric, 16);
}
break;
}
}
bool OptionsGui::getEditControl( int nIDDlgItem, WCHAR * valueString )
{
CEdit Edit(GetDlgItem(nIDDlgItem));
return (Edit.GetWindowText(valueString, CONFIG_OPTIONS_STRING_LENGTH) > 0);
}
void OptionsGui::getCheckBox( int nIDDlgItem, DWORD_PTR * valueNumeric )
{
CButton Button(GetDlgItem(nIDDlgItem));
switch (Button.GetCheck())
{
case BST_CHECKED:
*valueNumeric = 1;
return;
case BST_UNCHECKED:
*valueNumeric = 0;
return;
default:
*valueNumeric = 0;
}
}
void OptionsGui::getEditControlNumeric( int nIDDlgItem, DWORD_PTR * valueNumeric, int nBase )
{
WCHAR temp[CONFIG_OPTIONS_STRING_LENGTH] = {0};
if (getEditControl(nIDDlgItem, temp))
{
#ifdef _WIN64
*valueNumeric = _wcstoui64(temp, NULL, nBase);
#else
*valueNumeric = wcstoul(temp, NULL, nBase);
#endif
}
else
{
*valueNumeric = 0;
}
}
diff --git a/Scylla/PickDllGui.cpp b/Scylla/PickDllGui.cpp
index a21dfbc..39832bb 100644
--- a/Scylla/PickDllGui.cpp
+++ b/Scylla/PickDllGui.cpp
@@ -1,59 +1,61 @@
#include "PickDllGui.h"
BOOL PickDllGui::OnInitDialog(CWindow wndFocus, LPARAM lInitParam)
{
ListDLLSelect.Attach(GetDlgItem(IDC_LIST_DLLSELECT));
addColumnsToModuleList(ListDLLSelect);
displayModuleList(ListDLLSelect);
+ CenterWindow();
+
return TRUE;
}
void PickDllGui::OnOK(UINT uNotifyCode, int nID, CWindow wndCtl)
{
int index = ListDLLSelect.GetSelectionMark();
if (index != -1)
{
selectedModule = &moduleList[index];
EndDialog(1);
}
}
void PickDllGui::OnCancel(UINT uNotifyCode, int nID, CWindow wndCtl)
{
EndDialog(0);
}
void PickDllGui::addColumnsToModuleList(CListViewCtrl& list)
{
list.SetExtendedListViewStyle(LVS_EX_FULLROWSELECT, LVS_EX_FULLROWSELECT);
list.InsertColumn(COL_PATH, L"Path", LVCFMT_LEFT, 210);
list.InsertColumn(COL_NAME, L"Name", LVCFMT_CENTER, 130);
list.InsertColumn(COL_IMAGEBASE, L"ImageBase", LVCFMT_CENTER, 70);
list.InsertColumn(COL_IMAGESIZE, L"ImageSize", LVCFMT_CENTER, 70);
}
void PickDllGui::displayModuleList(CListViewCtrl& list)
{
WCHAR temp[20];
list.DeleteAllItems();
std::vector<ModuleInfo>::const_iterator iter;
int count = 0;
for( iter = moduleList.begin(); iter != moduleList.end(); iter++ , count++)
{
list.InsertItem(count, iter->fullPath);
list.SetItemText(count, COL_NAME, iter->getFilename());
swprintf_s(temp,_countof(temp),L"%08X",iter->modBaseAddr);
list.SetItemText(count, COL_IMAGEBASE, temp);
swprintf_s(temp,_countof(temp),L"%08X",iter->modBaseSize);
list.SetItemText(count, COL_IMAGESIZE, temp);
}
}

File Metadata

Mime Type
text/x-diff
Expires
Sat, Sep 21, 9:39 PM (1 d, 18 h)
Storage Engine
local-disk
Storage Format
Raw Data
Storage Handle
73/11/a28e087ad2f1086ac21a0935a0aa

Event Timeline