Page MenuHomedesp's stash

No OneTemporary

diff --git a/Scylla/OptionsGui.cpp b/Scylla/OptionsGui.cpp
index 1176435..8bab408 100644
--- a/Scylla/OptionsGui.cpp
+++ b/Scylla/OptionsGui.cpp
@@ -1,159 +1,89 @@
#include "OptionsGui.h"
#include "ConfigurationHolder.h"
-#include "definitions.h"
BOOL OptionsGui::OnInitDialog(CWindow wndFocus, LPARAM lInitParam)
{
- DoDataExchange(); // attach controls
+ loadOptions();
+ DoDataExchange(DDX_LOAD); // show settings
EditSectionName.LimitText(IMAGE_SIZEOF_SHORT_NAME);
- loadOptions();
-
CenterWindow();
return TRUE;
}
void OptionsGui::OnOK(UINT uNotifyCode, int nID, CWindow wndCtl)
{
+ DoDataExchange(DDX_SAVE);
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);
+ switch(mapIter->first)
+ {
+ case USE_PE_HEADER_FROM_DISK:
+ usePEHeaderFromDisk ? mapIter->second.setTrue() : mapIter->second.setFalse();
+ break;
+ case DEBUG_PRIVILEGE:
+ debugPrivilege ? mapIter->second.setTrue() : mapIter->second.setFalse();
+ break;
+ case CREATE_BACKUP:
+ createBackup ? mapIter->second.setTrue() : mapIter->second.setFalse();
+ break;
+ case DLL_INJECTION_AUTO_UNLOAD:
+ dllInjectionAutoUnload ? mapIter->second.setTrue() : mapIter->second.setFalse();
+ break;
+ case UPDATE_HEADER_CHECKSUM:
+ updateHeaderChecksum ? mapIter->second.setTrue() : mapIter->second.setFalse();
+ break;
+ case IAT_SECTION_NAME:
+ wcscpy(mapIter->second.valueString, iatSectionName);
+ break;
+ }
}
}
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:
+ switch(mapIter->first)
{
- setEditControl(config.dialogItemValue, config.valueString);
+ case USE_PE_HEADER_FROM_DISK:
+ usePEHeaderFromDisk = mapIter->second.isTrue();
+ break;
+ case DEBUG_PRIVILEGE:
+ debugPrivilege = mapIter->second.isTrue();
+ break;
+ case CREATE_BACKUP:
+ createBackup = mapIter->second.isTrue();
+ break;
+ case DLL_INJECTION_AUTO_UNLOAD:
+ dllInjectionAutoUnload = mapIter->second.isTrue();
+ break;
+ case UPDATE_HEADER_CHECKSUM:
+ updateHeaderChecksum = mapIter->second.isTrue();
+ break;
+ case IAT_SECTION_NAME:
+ wcsncpy(iatSectionName, mapIter->second.valueString, _countof(iatSectionName)-1);
+ iatSectionName[_countof(iatSectionName)-1] = L'\0';
+ break;
}
- break;
- case Boolean:
- {
- setCheckBox(config.dialogItemValue, config.isTrue());
- }
- break;
- case Decimal:
- {
- swprintf_s(config.valueString, CONFIG_OPTIONS_STRING_LENGTH, TEXT(PRINTF_INTEGER),config.valueNumeric);
-
- setEditControl(config.dialogItemValue, config.valueString);
- }
- break;
- case Hexadecimal:
- {
- swprintf_s(config.valueString, CONFIG_OPTIONS_STRING_LENGTH, TEXT(PRINTF_DWORD_PTR_FULL),config.valueNumeric);
-
- 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/OptionsGui.h b/Scylla/OptionsGui.h
index c993c98..422bfc2 100644
--- a/Scylla/OptionsGui.h
+++ b/Scylla/OptionsGui.h
@@ -1,52 +1,63 @@
#pragma once
#include <windows.h>
#include "resource.h"
// WTL
#include <atlbase.h> // base ATL classes
#include <atlapp.h> // base WTL classes
#include <atlwin.h> // ATL GUI classes
#include <atlcrack.h> // WTL enhanced msg map macros
#include <atlctrls.h> // WTL controls
#include <atlddx.h> // WTL dialog data exchange
-class ConfigObject;
-
class OptionsGui : public CDialogImpl<OptionsGui>, public CWinDataExchange<OptionsGui>
{
public:
enum { IDD = IDD_DLG_OPTIONS };
BEGIN_DDX_MAP(OptionsGui)
DDX_CONTROL_HANDLE(IDC_OPTIONS_SECTIONNAME, EditSectionName)
+ DDX_TEXT(IDC_OPTIONS_SECTIONNAME, iatSectionName)
+ DDX_CHECK(IDC_CHECK_HEADER_CHECKSUM, updateHeaderChecksum)
+ DDX_CHECK(IDC_CHECK_CREATE_BACKUP, createBackup)
+ DDX_CHECK(IDC_CHECK_UNLOAD_DLL, dllInjectionAutoUnload)
+ DDX_CHECK(IDC_CHECK_PE_HEADER_FROM_DISK, usePEHeaderFromDisk)
+ DDX_CHECK(IDC_CHECK_DEBUG_PRIVILEGES, debugPrivilege)
END_DDX_MAP()
BEGIN_MSG_MAP(OptionsGui)
MSG_WM_INITDIALOG(OnInitDialog)
COMMAND_ID_HANDLER_EX(IDC_BTN_OPTIONS_OK, OnOK)
COMMAND_ID_HANDLER_EX(IDC_BTN_OPTIONS_CANCEL, OnCancel)
COMMAND_ID_HANDLER_EX(IDCANCEL, OnCancel)
END_MSG_MAP()
-private:
+protected:
+
+ // Settings (filled by DDX)
+
+ WCHAR iatSectionName[IMAGE_SIZEOF_SHORT_NAME+1];
+ bool updateHeaderChecksum;
+ bool createBackup;
+ bool dllInjectionAutoUnload;
+ bool usePEHeaderFromDisk;
+ bool debugPrivilege;
+
+ // Controls
CEdit EditSectionName;
+ // Message handlers
+
BOOL OnInitDialog(CWindow wndFocus, LPARAM lInitParam);
void OnOK(UINT uNotifyCode, int nID, CWindow wndCtl);
void OnCancel(UINT uNotifyCode, int nID, CWindow wndCtl);
+ // Gui helpers
+
void saveOptions();
void loadOptions();
- void setCheckBox( int nIDDlgItem, bool bValue );
- void displayConfigInDlg( ConfigObject & config );
- void setEditControl( int nIDDlgItem, const WCHAR * valueString );
- void getConfigOptionsFromDlg( ConfigObject & config );
-
- bool getEditControl( int nIDDlgItem, WCHAR * valueString );
- void getCheckBox( int dialogItemValue, DWORD_PTR * valueNumeric );
- void getEditControlNumeric( int nIDDlgItem, DWORD_PTR * valueNumeric, int nBase );
};

File Metadata

Mime Type
text/x-diff
Expires
Tue, Jan 7, 1:00 AM (2 h, 38 m)
Storage Engine
local-disk
Storage Format
Raw Data
Storage Handle
d7/a1/c94fa3d92eae02bbd996ba19fc86

Event Timeline