└── MemoryHacker ├── CustomizeDlg.cpp ├── CustomizeDlg.h ├── GenericPurposeMethods.cpp ├── GenericPurposeMethods.h ├── InspectMemory.cpp ├── InspectMemory.h ├── MemoryBlock.cpp ├── MemoryBlock.h ├── MemoryHack.cpp ├── MemoryHack.h ├── MemoryHacker.aps ├── MemoryHacker.clw ├── MemoryHacker.cpp ├── MemoryHacker.dsp ├── MemoryHacker.dsw ├── MemoryHacker.h ├── MemoryHacker.ncb ├── MemoryHacker.opt ├── MemoryHacker.plg ├── MemoryHacker.rc ├── MemoryHackerDlg.cpp ├── MemoryHackerDlg.h ├── MemoryHackerReadMe.txt ├── ModulesDlg.cpp ├── ModulesDlg.h ├── NewEdit.cpp ├── NewEdit.h ├── ReadMe.txt ├── StdAfx.cpp ├── StdAfx.h ├── res ├── MemoryHacker.ico └── MemoryHacker.rc2 └── resource.h /MemoryHacker/CustomizeDlg.cpp: -------------------------------------------------------------------------------- 1 | // CustomizeDlg.cpp : implementation file 2 | // 3 | 4 | #include "stdafx.h" 5 | #include "MemoryHacker.h" 6 | #include "MemoryHack.h" 7 | #include "CustomizeDlg.h" 8 | #include "GenericPurposeMethods.h" 9 | 10 | #ifdef _DEBUG 11 | #define new DEBUG_NEW 12 | #undef THIS_FILE 13 | static char THIS_FILE[] = __FILE__; 14 | #endif 15 | 16 | ///////////////////////////////////////////////////////////////////////////// 17 | // CCustomizeDlg dialog 18 | 19 | 20 | CCustomizeDlg::CCustomizeDlg(CWnd* pParent /*=NULL*/) 21 | : CDialog(CCustomizeDlg::IDD, pParent) 22 | { 23 | //{{AFX_DATA_INIT(CCustomizeDlg) 24 | // NOTE: the ClassWizard will add member initialization here 25 | //}}AFX_DATA_INIT 26 | } 27 | 28 | 29 | void CCustomizeDlg::DoDataExchange(CDataExchange* pDX) 30 | { 31 | CDialog::DoDataExchange(pDX); 32 | //{{AFX_DATA_MAP(CCustomizeDlg) 33 | DDX_Control(pDX, IDC_LIST1, m_cListCtrl); 34 | DDX_Control(pDX, IDC_STARTA_EDIT, m_endaddress); 35 | DDX_Control(pDX, IDC_ENDA_EDIT, m_startaddress); 36 | //}}AFX_DATA_MAP 37 | } 38 | 39 | CCustomizeDlg& CCustomizeDlg::operator=(CCustomizeDlg& right) 40 | { 41 | // right contains value to be set 42 | // this contains old value 43 | (*this).m_hWnd = right.m_hWnd; 44 | return *this; 45 | 46 | } 47 | 48 | 49 | BEGIN_MESSAGE_MAP(CCustomizeDlg, CDialog) 50 | //{{AFX_MSG_MAP(CCustomizeDlg) 51 | ON_WM_CLOSE() 52 | ON_BN_CLICKED(IDC_MODULE_BUT, OnModuleBut) 53 | ON_BN_CLICKED(IDC_BLOCK_BUT, OnBlockBut) 54 | ON_BN_CLICKED(IDC_PICK_START, OnPickStart) 55 | ON_BN_CLICKED(IDC_PICK_END, OnPickEnd) 56 | ON_BN_CLICKED(IDC_ADD_BUT, OnAddBut) 57 | ON_BN_CLICKED(IDC_CLEARALL_BUT, OnClearallBut) 58 | ON_NOTIFY(NM_RCLICK, IDC_LIST1, OnRclickList1) 59 | //}}AFX_MSG_MAP 60 | END_MESSAGE_MAP() 61 | 62 | ///////////////////////////////////////////////////////////////////////////// 63 | // CCustomizeDlg message handlers 64 | 65 | void CCustomizeDlg::OnClose() 66 | { 67 | // TODO: Add your message handler code here and/or call default 68 | this->DestroyWindow(); // destroy the window 69 | CDialog::OnClose(); 70 | } 71 | 72 | void CCustomizeDlg::UpdateStartAddress(unsigned int address) 73 | { 74 | char straddress[20]; 75 | wsprintf(straddress,"%X", address); // convert number to hex string 76 | 77 | int len = 8-strlen(straddress); // get the missing part size 78 | memmove(straddress+len,straddress,strlen(straddress)); // move the string characters to the end 79 | for ( int i = 0; i < len; i++ ) // fill the beginning characters with '0' 80 | straddress[i] = '0'; 81 | 82 | straddress[8] = 0; // place the 00 end char at the end of string! 83 | 84 | CWnd *pWnd = instance.GetDlgItem(IDC_STARTA_EDIT); 85 | pWnd->SetWindowText(straddress); 86 | 87 | } 88 | 89 | void CCustomizeDlg::UpdateEndAddress(unsigned int address) 90 | { 91 | 92 | char straddress[20]; 93 | wsprintf(straddress,"%X", address); // convert number to hex string 94 | 95 | int len = 8-strlen(straddress); // get the missing part size 96 | memmove(straddress+len,straddress,strlen(straddress)); // move the string characters to the end 97 | for ( int i = 0; i < len; i++ ) // fill the beginning characters with '0' 98 | straddress[i] = '0'; 99 | 100 | straddress[8] = 0; // place the 00 end char at the end of string! 101 | 102 | CWnd *pWnd = instance.GetDlgItem(IDC_ENDA_EDIT); 103 | pWnd->SetWindowText(straddress); 104 | 105 | } 106 | 107 | CCustomizeDlg CCustomizeDlg::instance; // need for static members 108 | 109 | BOOL CCustomizeDlg::OnInitDialog() 110 | { 111 | CDialog::OnInitDialog(); 112 | 113 | // TODO: Add extra initialization here 114 | //CCustomizeDlg m_pmhdialog = new CCustomizeDlg(this); 115 | instance = (CCustomizeDlg)this; 116 | instance.m_hWnd = this->m_hWnd; 117 | CCustomizeDlg::UpdateStartAddress(01); 118 | CCustomizeDlg::UpdateEndAddress(02); 119 | 120 | DWORD dwStyle = m_cListCtrl.GetExtendedStyle(); 121 | dwStyle |= LVS_EX_FULLROWSELECT; 122 | 123 | // Setup the list control 124 | m_cListCtrl.SetExtendedStyle(dwStyle); 125 | 126 | // Create the columns 127 | CRect rect; 128 | m_cListCtrl.GetClientRect(&rect); 129 | int size = rect.Width()/2-16; 130 | m_cListCtrl.InsertColumn(0, _T("Start Address"), LVCFMT_LEFT, size); 131 | m_cListCtrl.InsertColumn(1, _T("End Address"), LVCFMT_LEFT, size); 132 | 133 | RefreshList(); 134 | 135 | return TRUE; // return TRUE unless you set the focus to a control 136 | // EXCEPTION: OCX Property Pages should return FALSE 137 | } 138 | 139 | void CCustomizeDlg::OnModuleBut() 140 | { 141 | // TODO: Add your control notification handler code here 142 | if (!IsWindow(modulesdlg.m_hWnd)||!modulesdlg.IsWindowVisible()) 143 | { 144 | 145 | ModulesDlg m_pmodulesdialog = new ModulesDlg(this); 146 | modulesdlg = m_pmodulesdialog; 147 | modulesdlg.processname = processname; 148 | modulesdlg.processid = processid; 149 | //testdlg.DoModal(); // not modal one! 150 | BOOL ret = modulesdlg.Create(IDD_MODULESDLG_DIALOG,this); 151 | if (ret) // If create not failed. 152 | modulesdlg.ShowWindow(SW_SHOWNORMAL); 153 | } 154 | 155 | } 156 | 157 | void CCustomizeDlg::OnBlockBut() 158 | { 159 | // TODO: Add your control notification handler code here 160 | if (!IsWindow(memblockdlg.m_hWnd)||!memblockdlg.IsWindowVisible()) 161 | { 162 | 163 | MemoryBlock m_pmodulesdialog = new MemoryBlock(this); 164 | memblockdlg = m_pmodulesdialog; 165 | memblockdlg.processname = processname; 166 | memblockdlg.processid = processid; 167 | memblockdlg.settype = MemoryBlock::SetType::MemoryBlockT; 168 | //testdlg.DoModal(); // not modal one! 169 | BOOL ret = memblockdlg.Create(IDD_MEMORYBLOCK_DIALOG,this); 170 | if (ret) // If create not failed. 171 | memblockdlg.ShowWindow(SW_SHOWNORMAL); 172 | } 173 | } 174 | 175 | void CCustomizeDlg::OnPickStart() 176 | { 177 | // TODO: Add your control notification handler code here 178 | if (!IsWindow(memblockdlg.m_hWnd)||!memblockdlg.IsWindowVisible()) 179 | { 180 | 181 | MemoryBlock m_pmodulesdialog = new MemoryBlock(this); 182 | memblockdlg = m_pmodulesdialog; 183 | memblockdlg.processname = processname; 184 | memblockdlg.processid = processid; 185 | memblockdlg.settype = MemoryBlock::SetType::StartAddressT; 186 | //testdlg.DoModal(); // not modal one! 187 | BOOL ret = memblockdlg.Create(IDD_MEMORYBLOCK_DIALOG,this); 188 | if (ret) // If create not failed. 189 | memblockdlg.ShowWindow(SW_SHOWNORMAL); 190 | } 191 | } 192 | 193 | void CCustomizeDlg::OnPickEnd() 194 | { 195 | // TODO: Add your control notification handler code here 196 | if (!IsWindow(memblockdlg.m_hWnd)||!memblockdlg.IsWindowVisible()) 197 | { 198 | 199 | MemoryBlock m_pmodulesdialog = new MemoryBlock(this); 200 | memblockdlg = m_pmodulesdialog; 201 | memblockdlg.processname = processname; 202 | memblockdlg.processid = processid; 203 | memblockdlg.settype = MemoryBlock::SetType::EndAddressT; 204 | //testdlg.DoModal(); // not modal one! 205 | BOOL ret = memblockdlg.Create(IDD_MEMORYBLOCK_DIALOG,this); 206 | if (ret) // If create not failed. 207 | memblockdlg.ShowWindow(SW_SHOWNORMAL); 208 | } 209 | } 210 | 211 | void CCustomizeDlg::RefreshList() 212 | { 213 | 214 | // Add the memory custom search: 215 | for (int i=0;iGetWindowText(start_address, 9); 268 | 269 | char end_address[9]; 270 | GetDlgItem(IDC_ENDA_EDIT)->GetWindowText(end_address, 9); 271 | 272 | if (strlen(start_address)<=0||strlen(end_address)<=0) 273 | return; 274 | 275 | unsigned int start_address_c = GenericPurposeMethods::ConvertHexStringToInt(start_address); 276 | unsigned int end_address_c = GenericPurposeMethods::ConvertHexStringToInt(end_address); 277 | 278 | LVITEM lvi; 279 | CString strItem; 280 | 281 | // Insert the first item 282 | lvi.mask = LVIF_TEXT; 283 | lvi.iItem = m_cListCtrl.GetItemCount(); // this starts with 0! 284 | 285 | // insert subitem 0 286 | lvi.iSubItem = 0; 287 | lvi.pszText = (LPTSTR)(start_address); 288 | m_cListCtrl.InsertItem(&lvi); 289 | 290 | // insert subitem 1 291 | lvi.iSubItem = 1; 292 | lvi.pszText = (char*)LPCTSTR(end_address); 293 | m_cListCtrl.SetItem(&lvi); 294 | 295 | 296 | MemoryHack::start_addresses[MemoryHack::custom_count] = start_address_c; 297 | MemoryHack::end_addresses[MemoryHack::custom_count] = end_address_c; 298 | MemoryHack::custom_count++; // increment custom count 299 | 300 | } 301 | 302 | void CCustomizeDlg::OnClearallBut() 303 | { 304 | // TODO: Add your control notification handler code here 305 | 306 | m_cListCtrl.DeleteAllItems(); // clean old items! 307 | MemoryHack::custom_count = 0; 308 | 309 | } 310 | 311 | void CCustomizeDlg::OnRclickList1(NMHDR* pNMHDR, LRESULT* pResult) 312 | { 313 | // TODO: Add your control notification handler code here 314 | CMenu menu; 315 | menu.LoadMenu(IDR_CUSTOM_MENU); // our context menu 316 | CMenu* pPopup = menu.GetSubMenu(0); 317 | 318 | RECT rect; 319 | GetWindowRect(&rect); 320 | CPoint mousepos; 321 | GetCursorPos(&mousepos); 322 | pPopup->TrackPopupMenu(NULL,mousepos.x,mousepos.y, this); 323 | 324 | // The menu is a temporary MFC object, no need to delete it. 325 | *pResult = 0; 326 | } 327 | 328 | BOOL CCustomizeDlg::OnCommand(WPARAM wParam, LPARAM lParam) 329 | { 330 | // TODO: Add your specialized code here and/or call the base class 331 | 332 | if (HIWORD(wParam) == BN_CLICKED) // if button clicked 333 | { 334 | switch(LOWORD(wParam)) // Retrieves the low-order word from the specified value. 335 | { 336 | case ID_CUSTOMMENU_REMOVESELECTED: 337 | { 338 | RemoveSelected(); 339 | break; 340 | } 341 | 342 | } 343 | 344 | } 345 | 346 | return CDialog::OnCommand(wParam, lParam); 347 | } 348 | 349 | void CCustomizeDlg::RemoveSelected() 350 | { 351 | int selectcount = 0; 352 | int* selected_indexes = new int[2000]; 353 | 354 | int nRow = m_cListCtrl.GetNextItem(-1, LVNI_SELECTED); 355 | while (nRow != -1) 356 | { 357 | 358 | if (nRow=0;i--) 370 | { 371 | 372 | for (int j=selected_indexes[i];j=0;i--) 385 | { 386 | m_cListCtrl.DeleteItem(selected_indexes[i]); // delete item from ClistCtrl 387 | } 388 | 389 | 390 | } 391 | -------------------------------------------------------------------------------- /MemoryHacker/CustomizeDlg.h: -------------------------------------------------------------------------------- 1 | #if !defined(AFX_CUSTOMIZEDLG_H__01CA843C_6019_4DBF_90EE_CDD5D6141932__INCLUDED_) 2 | #define AFX_CUSTOMIZEDLG_H__01CA843C_6019_4DBF_90EE_CDD5D6141932__INCLUDED_ 3 | 4 | #if _MSC_VER > 1000 5 | #pragma once 6 | #endif // _MSC_VER > 1000 7 | // CustomizeDlg.h : header file 8 | // 9 | #include "NewEdit.h" 10 | #include "ModulesDlg.h" 11 | #include "MemoryBlock.h" 12 | 13 | ///////////////////////////////////////////////////////////////////////////// 14 | // CCustomizeDlg dialog 15 | 16 | class CCustomizeDlg : public CDialog 17 | { 18 | // Construction 19 | public: 20 | CCustomizeDlg(CWnd* pParent = NULL); // standard constructor 21 | CCustomizeDlg& operator=(CCustomizeDlg& right); // Overload Assignment Operator 22 | 23 | int processid; 24 | CString processname; 25 | static CCustomizeDlg instance; 26 | 27 | ModulesDlg modulesdlg; 28 | MemoryBlock memblockdlg; 29 | 30 | void RefreshList(); 31 | void RemoveSelected(); 32 | static void UpdateStartAddress(unsigned int address); 33 | static void UpdateEndAddress(unsigned int address); 34 | 35 | 36 | 37 | // Dialog Data 38 | //{{AFX_DATA(CCustomizeDlg) 39 | enum { IDD = IDD_CUSTOMIZEDLG_DIALOG }; 40 | CListCtrl m_cListCtrl; 41 | NewEdit m_endaddress; 42 | NewEdit m_startaddress; 43 | //}}AFX_DATA 44 | 45 | 46 | // Overrides 47 | // ClassWizard generated virtual function overrides 48 | //{{AFX_VIRTUAL(CCustomizeDlg) 49 | protected: 50 | virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support 51 | virtual BOOL OnCommand(WPARAM wParam, LPARAM lParam); 52 | //}}AFX_VIRTUAL 53 | 54 | // Implementation 55 | protected: 56 | 57 | // Generated message map functions 58 | //{{AFX_MSG(CCustomizeDlg) 59 | afx_msg void OnClose(); 60 | virtual BOOL OnInitDialog(); 61 | afx_msg void OnModuleBut(); 62 | afx_msg void OnBlockBut(); 63 | afx_msg void OnPickStart(); 64 | afx_msg void OnPickEnd(); 65 | afx_msg void OnAddBut(); 66 | afx_msg void OnClearallBut(); 67 | afx_msg void OnRclickList1(NMHDR* pNMHDR, LRESULT* pResult); 68 | //}}AFX_MSG 69 | DECLARE_MESSAGE_MAP() 70 | }; 71 | 72 | //{{AFX_INSERT_LOCATION}} 73 | // Microsoft Visual C++ will insert additional declarations immediately before the previous line. 74 | 75 | #endif // !defined(AFX_CUSTOMIZEDLG_H__01CA843C_6019_4DBF_90EE_CDD5D6141932__INCLUDED_) 76 | -------------------------------------------------------------------------------- /MemoryHacker/GenericPurposeMethods.cpp: -------------------------------------------------------------------------------- 1 | // GenericPurposeMethods.cpp: implementation of the GenericPurposeMethods class. 2 | // 3 | ////////////////////////////////////////////////////////////////////// 4 | 5 | #include "stdafx.h" 6 | #include "MemoryHacker.h" 7 | #include "GenericPurposeMethods.h" 8 | 9 | #include "math.h" 10 | 11 | #ifdef _DEBUG 12 | #undef THIS_FILE 13 | static char THIS_FILE[]=__FILE__; 14 | #define new DEBUG_NEW 15 | #endif 16 | 17 | ////////////////////////////////////////////////////////////////////// 18 | // Construction/Destruction 19 | ////////////////////////////////////////////////////////////////////// 20 | 21 | GenericPurposeMethods::GenericPurposeMethods() 22 | { 23 | 24 | } 25 | 26 | GenericPurposeMethods::~GenericPurposeMethods() 27 | { 28 | 29 | } 30 | 31 | int GenericPurposeMethods::StringToNumber(char *buffer) 32 | { 33 | int result = 0; 34 | int startIndex = 0; 35 | bool negativeNumber = false; 36 | 37 | if (buffer[0] == '-') 38 | { 39 | negativeNumber = true; 40 | startIndex = 1; 41 | } 42 | 43 | for (int i = startIndex; i < (int)strlen(buffer); i++) 44 | { 45 | 46 | if(buffer[i] >= '0' && buffer[i] <= '9') 47 | { 48 | int digit = buffer[i] - '0'; 49 | result = result * 10 + digit; 50 | } 51 | else 52 | return 0; 53 | 54 | } 55 | 56 | if (negativeNumber == true) 57 | result *= -1; 58 | 59 | return result; 60 | } 61 | 62 | unsigned int GenericPurposeMethods::ConvertHexStringToInt(CString sHexNum) 63 | { 64 | unsigned int iSum = 0; 65 | if (sHexNum.GetLength() == 0) return 0; 66 | 67 | for(int i=sHexNum.GetLength()-1; i >= 0; i--) 68 | { 69 | if (!GenericPurposeMethods::IsHexNumber(sHexNum[i])) return 0; 70 | 71 | if(sHexNum[i]) 72 | { 73 | unsigned int current_char = sHexNum[i]-'0'; 74 | if (current_char>=0x011&¤t_char<=0x016) // is it 'A'- 'F' 75 | current_char = current_char - 07; 76 | 77 | if (current_char>=0x031&¤t_char<=0x036) // is it 'a'- 'f' 78 | current_char = current_char - 0x27; 79 | 80 | iSum += current_char*Pow(16,sHexNum.GetLength()-1-i); 81 | } 82 | } 83 | return iSum; 84 | 85 | } 86 | 87 | bool GenericPurposeMethods::IsHexNumber(char tobetested) 88 | { 89 | if (tobetested >= '0' && tobetested <= '9') 90 | return true; 91 | 92 | if (tobetested >= 'A' && tobetested <= 'F') 93 | return true; 94 | 95 | if (tobetested >= 'a' && tobetested <= 'f') 96 | return true; 97 | 98 | return false; 99 | } 100 | 101 | unsigned int GenericPurposeMethods::Pow(int value,int exponent) 102 | { 103 | unsigned int result = 1; 104 | 105 | for (int i = 0; i < exponent; ++i) 106 | result *= value; 107 | 108 | return (result); 109 | } 110 | 111 | 112 | unsigned __int64 GenericPurposeMethods::BigPow(unsigned __int64 value,unsigned __int64 exponent) 113 | { 114 | unsigned __int64 result = 1; 115 | 116 | for (int i = 0; i < exponent; ++i) 117 | result *= value; 118 | 119 | return (result); 120 | } 121 | 122 | void GenericPurposeMethods::ToUpperCase(char *buffer) 123 | { 124 | for (int i = 0; i < (int)strlen(buffer); i++) 125 | { 126 | 127 | if(buffer[i] >= 'a' && buffer[i] <= 'z') 128 | { 129 | buffer[i] -= 'a'-'A'; 130 | } 131 | } 132 | } 133 | 134 | unsigned int GenericPurposeMethods::UnsignedArrayToUInt(unsigned char *buffer,int position) 135 | { 136 | return ((buffer[position+3]<<24)|(buffer[position+2]<<16)|(buffer[position+1]<<8)|(buffer[position+0])); 137 | } 138 | 139 | unsigned int GenericPurposeMethods::UnsignedArrayToShort(unsigned char *buffer,int position) 140 | { 141 | return ((buffer[position+1]<<8)|(buffer[position+0])); 142 | } 143 | 144 | unsigned char* GenericPurposeMethods::UIntToUnsignedArray(unsigned int value) 145 | { 146 | unsigned char* array = new unsigned char[4]; 147 | array[0] = value & 0x000000ff; 148 | array[1] = (value & 0x0000ff00) >> 8; 149 | array[2] = (value & 0x00ff0000) >> 16; 150 | array[3] = (value & 0xff000000) >> 24; 151 | 152 | return array; 153 | 154 | } 155 | 156 | unsigned char* GenericPurposeMethods::StringToBytes(char *value, char *type, char *base, int *out_len) 157 | { 158 | out_len[0] = 0; // set out len to 0 159 | unsigned char* array = new unsigned char[0]; 160 | 161 | if (strlen(value)>0&&strlen(type)>0&&strlen(base)>0) 162 | { 163 | 164 | if (strcmp(type,CString(_T("byte")).GetBuffer(0))==0) 165 | { // if type is byte 166 | out_len[0] = 1; // set out len to 1 167 | array = new unsigned char[1]; 168 | array[0] = GenericPurposeMethods::GetCharFromStr(value,base); 169 | } 170 | 171 | if (strcmp(type,CString(_T("word")).GetBuffer(0))==0) 172 | { // if type is word 173 | out_len[0] = 2; // set out len to 2 174 | array = new unsigned char[2]; 175 | unsigned short svalue = GenericPurposeMethods::GetShortFromStr(value,base); 176 | 177 | array[0] = svalue & 0x000000ff; 178 | array[1] = (svalue & 0x0000ff00) >> 8; 179 | 180 | } 181 | 182 | if (strcmp(type,CString(_T("dword")).GetBuffer(0))==0) 183 | { // if type is dword 184 | out_len[0] = 4; // set out len to 4 185 | array = new unsigned char[4]; 186 | unsigned int ivalue = GenericPurposeMethods::GetIntFromStr(value,base); 187 | 188 | array[0] = ivalue & 0x000000ff; 189 | array[1] = (ivalue & 0x0000ff00) >> 8; 190 | array[2] = (ivalue & 0x00ff0000) >> 16; 191 | array[3] = (ivalue & 0xff000000) >> 24; 192 | 193 | } 194 | 195 | if (strcmp(type,CString(_T("qword")).GetBuffer(0))==0) 196 | { // if type is qword 197 | out_len[0] = 8; // set out len to 8 198 | array = new unsigned char[8]; 199 | unsigned __int64 lvalue = GenericPurposeMethods::GetLongFromStr(value,base); 200 | 201 | array[0] = (unsigned char)(lvalue & 0x00000000000000ff); 202 | array[1] = (unsigned char)((lvalue & 0x000000000000ff00) >> 8); 203 | array[2] = (unsigned char)((lvalue & 0x0000000000ff0000) >> 16); 204 | array[3] = (unsigned char)((lvalue & 0x00000000ff000000) >> 24); 205 | array[4] = (unsigned char)((lvalue & 0x000000ff00000000) >> 32); 206 | array[5] = (unsigned char)((lvalue & 0x0000ff0000000000) >> 40); 207 | array[6] = (unsigned char)((lvalue & 0x00ff000000000000) >> 48); 208 | array[7] = (unsigned char)((lvalue & 0xff00000000000000) >> 56); 209 | 210 | } 211 | 212 | if (strcmp(type,CString(_T("bytes")).GetBuffer(0))==0) 213 | { // if type is bytes 214 | int chars_per_byte = 0; 215 | if (strcmp(base,CString(_T("decimal")).GetBuffer(0))==0) 216 | chars_per_byte = 3; 217 | else 218 | chars_per_byte = 2; 219 | 220 | int ostrlen = (int)strlen(value); 221 | int bsize = ostrlen/chars_per_byte; 222 | 223 | out_len[0] = bsize; // set out len 224 | array = new unsigned char[bsize]; 225 | 226 | int start_index = 0; 227 | int end_index = 0; 228 | 229 | for (int i=0;i=0&&rchar<=9) 306 | rchar = rchar+'0'; 307 | else if (rchar>=0x0A&&rchar<=0x0F) 308 | rchar = rchar+'A'-0x0A; 309 | 310 | return rchar; 311 | 312 | } 313 | 314 | char* GenericPurposeMethods::BytesToString(unsigned char* bytes, int bytes_len, char *type, char *base) 315 | { 316 | char* cstring = new char[1]; 317 | cstring[0] = 0; 318 | 319 | if (bytes_len>0&&strlen(type)>0&&strlen(base)>0) 320 | { 321 | 322 | if (strcmp(type,CString(_T("byte")).GetBuffer(0))==0||strcmp(type,CString(_T("bytes")).GetBuffer(0))==0) 323 | { // if type is byte 324 | 325 | if (strcmp(base,CString(_T("hexadecimal")).GetBuffer(0))==0) 326 | { // if hexadecimal as base 327 | cstring = new char[bytes_len*2+1]; 328 | 329 | for (int i = 0; i < bytes_len; i++) 330 | { 331 | 332 | char firstchar = (bytes[i] & 0xF0) >> 4; 333 | char secondchar = bytes[i] & 0x0F; 334 | 335 | firstchar = GenericPurposeMethods::NumberToCharString(firstchar); 336 | secondchar = GenericPurposeMethods::NumberToCharString(secondchar); 337 | 338 | cstring[2 * i] = firstchar; 339 | cstring[2 * i + 1] = secondchar; 340 | } 341 | 342 | cstring[bytes_len*2] = 00; // the end marker of string 343 | } // end of hex 344 | 345 | else if (strcmp(base,CString(_T("decimal")).GetBuffer(0))==0) 346 | { // if hexadecimal as base 347 | cstring = new char[bytes_len*3+1]; 348 | 349 | for (int i = 0; i < bytes_len; i++) 350 | { 351 | cstring[3*i] = '0' + bytes[i] / 100; 352 | cstring[3*i + 1] = '0' + (bytes[i] / 10) % 10; 353 | cstring[3*i + 2] = '0' + bytes[i] % 10; 354 | } 355 | 356 | cstring[3*i] = 0; 357 | 358 | } 359 | 360 | } 361 | 362 | if (strcmp(type,CString(_T("word")).GetBuffer(0))==0) 363 | { // if type is word 364 | unsigned short svalue = bytes[0] | (bytes[1] << 8); 365 | 366 | if (strcmp(base,CString(_T("hexadecimal")).GetBuffer(0))==0) 367 | { // if hexadecimal as base 368 | cstring = new char[2*2+1]; 369 | 370 | char firstchar = (bytes[1] & 0xF0) >> 4; 371 | char secondchar = bytes[1] & 0x0F; 372 | 373 | firstchar = GenericPurposeMethods::NumberToCharString(firstchar); 374 | secondchar = GenericPurposeMethods::NumberToCharString(secondchar); 375 | 376 | if (secondchar>=0&&secondchar<=9) 377 | secondchar = secondchar+'0'; 378 | else if (secondchar>=0x0A&&secondchar<=0x0F) 379 | secondchar = secondchar+'A'-0x0A; 380 | 381 | cstring[0] = firstchar; 382 | cstring[1] = secondchar; 383 | 384 | firstchar = (bytes[0] & 0xF0) >> 4; 385 | secondchar = bytes[0] & 0x0F; 386 | 387 | firstchar = GenericPurposeMethods::NumberToCharString(firstchar); 388 | secondchar = GenericPurposeMethods::NumberToCharString(secondchar); 389 | 390 | cstring[2] = firstchar; 391 | cstring[3] = secondchar; 392 | 393 | cstring[4] = 00; // mark the end of string 394 | 395 | } 396 | 397 | else if (strcmp(base,CString(_T("decimal")).GetBuffer(0))==0) 398 | { // if hexadecimal as base 399 | cstring = new char[2*3+1]; 400 | cstring[0] = 00; 401 | wsprintf(cstring,"%d",svalue); // convert short number to decimal string 402 | 403 | } 404 | 405 | } 406 | 407 | if (strcmp(type,CString(_T("dword")).GetBuffer(0))==0) 408 | { // if type is dword 409 | unsigned int ivalue = 0; 410 | ivalue = (ivalue << 8) + bytes[3]; 411 | ivalue = (ivalue << 8) + bytes[2]; 412 | ivalue = (ivalue << 8) + bytes[1]; 413 | ivalue = (ivalue << 8) + bytes[0]; 414 | 415 | if (strcmp(base,CString(_T("hexadecimal")).GetBuffer(0))==0) 416 | { // if hexadecimal as base 417 | cstring = new char[4*2+1]; 418 | cstring[0] = 00; 419 | wsprintf(cstring,"%X",ivalue); // convert int number to hexadecimal string 420 | } 421 | else if (strcmp(base,CString(_T("decimal")).GetBuffer(0))==0) 422 | { // if hexadecimal as base 423 | cstring = new char[4*3+1]; 424 | cstring[0] = 00; 425 | wsprintf(cstring,"%d",ivalue); // convert int number to decimal string 426 | } 427 | 428 | } 429 | 430 | if (strcmp(type,CString(_T("qword")).GetBuffer(0))==0) 431 | { // if type is qword 432 | unsigned __int64 lvalue = 0; 433 | lvalue = (lvalue << 8) + bytes[7]; 434 | lvalue = (lvalue << 8) + bytes[6]; 435 | lvalue = (lvalue << 8) + bytes[5]; 436 | lvalue = (lvalue << 8) + bytes[4]; 437 | lvalue = (lvalue << 8) + bytes[3]; 438 | lvalue = (lvalue << 8) + bytes[2]; 439 | lvalue = (lvalue << 8) + bytes[1]; 440 | lvalue = (lvalue << 8) + bytes[0]; 441 | 442 | if (strcmp(base,CString(_T("hexadecimal")).GetBuffer(0))==0) 443 | { // if hexadecimal as base 444 | cstring = new char[8*2+1]; 445 | cstring[0] = 00; 446 | wsprintf(cstring,"%I64X",lvalue); // convert long number to hexadecimal string 447 | } 448 | else if (strcmp(base,CString(_T("decimal")).GetBuffer(0))==0) 449 | { // if hexadecimal as base 450 | cstring = new char[8*3+1]; 451 | cstring[0] = 00; 452 | wsprintf(cstring,"%I64u",lvalue); // convert long number to decimal string 453 | } 454 | 455 | } 456 | 457 | if (strcmp(type,CString(_T("ASCII string")).GetBuffer(0))==0) 458 | { // if type is ASCII string 459 | cstring = new char[bytes_len+1]; 460 | 461 | for (int i=0;i= '0' && buffer[i] <= '9') 546 | { 547 | unsigned char digit = buffer[i] - '0'; 548 | result = result * 10 + digit; 549 | } 550 | else 551 | return 0; 552 | 553 | } 554 | else // hexadecimal parse: 555 | { 556 | if (!GenericPurposeMethods::IsHexNumber(buffer[i])) return 0; 557 | 558 | if(buffer[i]) 559 | { 560 | unsigned char current_char = buffer[i]-'0'; 561 | if (current_char>=0x011&¤t_char<=0x016) // is it 'A'- 'F' 562 | current_char = current_char - 07; 563 | 564 | if (current_char>=0x031&¤t_char<=0x036) // is it 'a'- 'f' 565 | current_char = current_char - 0x27; 566 | 567 | result += current_char*Pow(16,strlen(buffer)-1-i); 568 | } 569 | } 570 | 571 | } 572 | 573 | if (negativeNumber == true) 574 | result *= -1; 575 | 576 | return result; 577 | } 578 | 579 | unsigned short GenericPurposeMethods::GetShortFromStr(char *value, char *base) 580 | { 581 | unsigned short converted = 0; 582 | int max_len = 0; 583 | if (value[0] == '-') max_len++; // for negative number increment 584 | if (strcmp(base,CString(_T("decimal")).GetBuffer(0))==0) 585 | { // if decimal as base 586 | max_len = max_len+3*2; 587 | } 588 | else if (strcmp(base,CString(_T("hexadecimal")).GetBuffer(0))==0) 589 | { // if hexadecimal as base 590 | max_len = max_len+2*2; 591 | } 592 | 593 | char *truncated_value = GenericPurposeMethods::TruncateString(value, max_len); 594 | converted = GenericPurposeMethods::GetShortFromTStr(value, base); 595 | return converted; 596 | } 597 | 598 | unsigned short GenericPurposeMethods::GetShortFromTStr(char *buffer, char *base) 599 | { 600 | unsigned short result = 0; 601 | int startIndex = 0; 602 | bool negativeNumber = false; 603 | 604 | if (buffer[0] == '-') 605 | { 606 | negativeNumber = true; 607 | startIndex = 1; 608 | } 609 | 610 | bool isdecimal = (strcmp(base,CString(_T("decimal")).GetBuffer(0))==0); 611 | 612 | for (int i = startIndex; i < (int)strlen(buffer); i++) 613 | { 614 | 615 | if (isdecimal) 616 | { 617 | if (buffer[i] >= '0' && buffer[i] <= '9') 618 | { 619 | unsigned short digit = buffer[i] - '0'; 620 | result = result * 10 + digit; 621 | } 622 | else 623 | return 0; 624 | 625 | } 626 | else // hexadecimal parse: 627 | { 628 | if (!GenericPurposeMethods::IsHexNumber(buffer[i])) return 0; 629 | 630 | if(buffer[i]) 631 | { 632 | unsigned short current_char = buffer[i]-'0'; 633 | if (current_char>=0x011&¤t_char<=0x016) // is it 'A'- 'F' 634 | current_char = current_char - 07; 635 | 636 | if (current_char>=0x031&¤t_char<=0x036) // is it 'a'- 'f' 637 | current_char = current_char - 0x27; 638 | 639 | result += current_char*Pow(16,strlen(buffer)-1-i); 640 | } 641 | } 642 | 643 | } 644 | 645 | if (negativeNumber == true) 646 | result *= -1; 647 | 648 | return result; 649 | } 650 | 651 | unsigned int GenericPurposeMethods::GetIntFromStr(char *value, char *base) 652 | { 653 | unsigned int converted = 0; 654 | int max_len = 0; 655 | if (value[0] == '-') max_len++; // for negative number increment 656 | if (strcmp(base,CString(_T("decimal")).GetBuffer(0))==0) 657 | { // if decimal as base 658 | max_len = max_len+3*4; 659 | } 660 | else if (strcmp(base,CString(_T("hexadecimal")).GetBuffer(0))==0) 661 | { // if hexadecimal as base 662 | max_len = max_len+2*4; 663 | } 664 | 665 | char *truncated_value = GenericPurposeMethods::TruncateString(value, max_len); 666 | converted = GenericPurposeMethods::GetIntFromTStr(value, base); 667 | return converted; 668 | } 669 | 670 | unsigned int GenericPurposeMethods::GetIntFromTStr(char *buffer, char *base) 671 | { 672 | unsigned int result = 0; 673 | int startIndex = 0; 674 | bool negativeNumber = false; 675 | 676 | if (buffer[0] == '-') 677 | { 678 | negativeNumber = true; 679 | startIndex = 1; 680 | } 681 | 682 | bool isdecimal = (strcmp(base,CString(_T("decimal")).GetBuffer(0))==0); 683 | 684 | for (int i = startIndex; i < (int)strlen(buffer); i++) 685 | { 686 | 687 | if (isdecimal) 688 | { 689 | if (buffer[i] >= '0' && buffer[i] <= '9') 690 | { 691 | unsigned int digit = buffer[i] - '0'; 692 | result = result * 10 + digit; 693 | } 694 | else 695 | return 0; 696 | 697 | } 698 | else // hexadecimal parse: 699 | { 700 | if (!GenericPurposeMethods::IsHexNumber(buffer[i])) return 0; 701 | 702 | if(buffer[i]) 703 | { 704 | unsigned int current_char = buffer[i]-'0'; 705 | if (current_char>=0x011&¤t_char<=0x016) // is it 'A'- 'F' 706 | current_char = current_char - 07; 707 | 708 | if (current_char>=0x031&¤t_char<=0x036) // is it 'a'- 'f' 709 | current_char = current_char - 0x27; 710 | 711 | result += current_char*Pow(16,strlen(buffer)-1-i); 712 | } 713 | } 714 | 715 | } 716 | 717 | if (negativeNumber == true) 718 | result *= -1; 719 | 720 | return result; 721 | } 722 | 723 | unsigned __int64 GenericPurposeMethods::GetLongFromStr(char *value, char *base) 724 | { 725 | unsigned __int64 converted = 0; 726 | int max_len = 0; 727 | if (value[0] == '-') max_len++; // for negative number increment 728 | if (strcmp(base,CString(_T("decimal")).GetBuffer(0))==0) 729 | { // if decimal as base 730 | max_len = max_len+3*8; 731 | } 732 | else if (strcmp(base,CString(_T("hexadecimal")).GetBuffer(0))==0) 733 | { // if hexadecimal as base 734 | max_len = max_len+2*8; 735 | } 736 | 737 | char *truncated_value = GenericPurposeMethods::TruncateString(value, max_len); 738 | converted = GenericPurposeMethods::GetLongFromTStr(value, base); 739 | return converted; 740 | } 741 | 742 | unsigned __int64 GenericPurposeMethods::GetLongFromTStr(char *buffer, char *base) 743 | { 744 | unsigned __int64 result = 0; 745 | int startIndex = 0; 746 | bool negativeNumber = false; 747 | 748 | if (buffer[0] == '-') 749 | { 750 | negativeNumber = true; 751 | startIndex = 1; 752 | } 753 | 754 | bool isdecimal = (strcmp(base,CString(_T("decimal")).GetBuffer(0))==0); 755 | 756 | for (int i = startIndex; i < (int)strlen(buffer); i++) 757 | { 758 | 759 | if (isdecimal) 760 | { 761 | if (buffer[i] >= '0' && buffer[i] <= '9') 762 | { 763 | unsigned __int64 digit = buffer[i] - '0'; 764 | result = result * 10 + digit; 765 | } 766 | else 767 | return 0; 768 | 769 | } 770 | else // hexadecimal parse: 771 | { 772 | if (!GenericPurposeMethods::IsHexNumber(buffer[i])) return 0; 773 | 774 | if(buffer[i]) 775 | { 776 | unsigned __int64 current_char = buffer[i]-'0'; 777 | if (current_char>=0x011&¤t_char<=0x016) // is it 'A'- 'F' 778 | current_char = current_char - 07; 779 | 780 | if (current_char>=0x031&¤t_char<=0x036) // is it 'a'- 'f' 781 | current_char = current_char - 0x27; 782 | 783 | result += current_char*BigPow(16,strlen(buffer)-1-i); 784 | } 785 | } 786 | 787 | } 788 | 789 | if (negativeNumber == true) 790 | result *= -1; 791 | 792 | return result; 793 | } 794 | 795 | // convert string to float (base 10) 796 | float GenericPurposeMethods::str2float(char* s) 797 | { 798 | char* newp = s; 799 | float rez = 0, fact = 1; 800 | if (*newp == '-') 801 | { 802 | newp++; 803 | fact = -1; 804 | }; 805 | 806 | 807 | for (int point_seen = 0; *newp; newp++) 808 | { 809 | 810 | if (*newp == '.') 811 | { 812 | point_seen = 1; 813 | continue; 814 | }; 815 | 816 | 817 | int d = *newp - '0'; 818 | if (d >= 0 && d <= 9) 819 | { 820 | if (point_seen) fact /= 10.0f; 821 | rez = rez * 10.0f + (float)d; 822 | }; 823 | 824 | 825 | }; 826 | return rez * fact; 827 | 828 | } 829 | 830 | float GenericPurposeMethods::str2float(char* s, char *base) 831 | { 832 | bool isdecimal = (strcmp(base,CString(_T("decimal")).GetBuffer(0))==0); 833 | 834 | if (isdecimal) return GenericPurposeMethods::str2float(s); 835 | 836 | int ostrlen = (int)strlen(s); 837 | 838 | int start_index = 0; 839 | if (s[0] == '-') start_index++; 840 | 841 | 842 | int point_index = -1; 843 | 844 | for (int i = 0; i= 0 && d <= 9) 919 | { 920 | if (point_seen) fact /= 10.0f; 921 | rez = rez * 10.0f + (float)d; 922 | }; 923 | 924 | 925 | }; 926 | return rez * fact; 927 | 928 | } 929 | 930 | double GenericPurposeMethods::str2double(char* s, char *base) 931 | { 932 | bool isdecimal = (strcmp(base,CString(_T("decimal")).GetBuffer(0))==0); 933 | 934 | if (isdecimal) return GenericPurposeMethods::str2double(s); 935 | 936 | int ostrlen = (int)strlen(s); 937 | 938 | int start_index = 0; 939 | if (s[0] == '-') start_index++; 940 | 941 | 942 | int point_index = -1; 943 | 944 | for (int i = 0; i x ); /* convert trunc to floor */ 998 | } 999 | 1000 | char* GenericPurposeMethods::double2str(double number, char *base) 1001 | { 1002 | long double premz = (long double)number; 1003 | bool isdecimal = (strcmp(base,CString(_T("decimal")).GetBuffer(0))==0); 1004 | char* conversion = new char[1076]; // this is NOT actualy alocate as memory on stack (local var) 1005 | char intPart_reversed[311]; 1006 | int i, charCount = 0; 1007 | 1008 | //Separate integer/fractional parts 1009 | int int_part = (int)number; 1010 | double integer_part = (long double)int_part; 1011 | double fractional_part = number-integer_part; 1012 | 1013 | 1014 | while (integer_part > 0) //Convert integer part, if any 1015 | { 1016 | intPart_reversed[charCount++] = '0' + (int)fmod(integer_part,10); 1017 | integer_part = floor(integer_part/10); 1018 | } 1019 | 1020 | for (i=0; i 0) // Convert fractional part, if any 1028 | { 1029 | fractional_part*=10; 1030 | fractional_part = modf(fractional_part,&new_integer_part); 1031 | conversion[charCount++] = '0' + (int)new_integer_part; 1032 | } 1033 | 1034 | conversion[charCount] = 0; //String terminator 1035 | 1036 | return conversion; 1037 | } 1038 | 1039 | char* GenericPurposeMethods::TruncateString(char *value, int newlen) 1040 | { 1041 | int ostrlen = strlen(value); 1042 | if (ostrlen<=newlen) return value; // no truncate needed! 1043 | 1044 | char* array = new char[newlen+1]; 1045 | for (int i=0;i=end_index) return new char[0]; 1058 | if (start_index<0||start_index>=ostrlen) return new char[0]; // if start_index is invalid 1059 | if (start_index<0||start_index>ostrlen) return new char[0]; // if end_index is invalid 1060 | 1061 | int newlen = end_index-start_index; 1062 | 1063 | char* array = new char[newlen+1]; // +1 since also include end char 1064 | for (int i=0;i= 0; --i) 1082 | { 1083 | if (fullname[i]==92) // if char == "\" 1084 | { 1085 | slash_position=i+1; 1086 | break; 1087 | } 1088 | 1089 | } 1090 | 1091 | for (i=slash_position;i<=ostringlen;i++) // including null (00) terminating char! 1092 | shortname[i-slash_position]=fullname[i]; 1093 | 1094 | return shortname; 1095 | 1096 | } 1097 | 1098 | TCHAR* GenericPurposeMethods::GetDirectory(TCHAR fullname[]) 1099 | { 1100 | TCHAR* directory = new TCHAR[MAX_PATH]; 1101 | int i=0; 1102 | int ostringlen = _tcslen(fullname); 1103 | int slash_position = 0; 1104 | 1105 | for (i = ostringlen - 1; i >= 0; --i) 1106 | { 1107 | if (fullname[i]==92) // if char == "\" 1108 | { 1109 | slash_position=i+1; 1110 | break; 1111 | } 1112 | 1113 | } 1114 | 1115 | for (i=0;i= 0; --i) 1132 | { 1133 | if (shortname[i]==46) // if char == "." 1134 | { 1135 | point_position=i; 1136 | break; 1137 | } 1138 | 1139 | } 1140 | 1141 | for (i=0;i= 0; --i) 1167 | { 1168 | if (shortname[i]==46) // if char == "." 1169 | { 1170 | point_position=i; 1171 | break; 1172 | } 1173 | 1174 | } 1175 | 1176 | for (i=point_position;i= 0; --i) 1213 | { 1214 | if (filename[i]==46) // if char == "." 1215 | { 1216 | point_position=i; 1217 | break; 1218 | } 1219 | 1220 | } 1221 | 1222 | if (point_position == -1) return false; 1223 | 1224 | int extpos = stringlen-point_position; 1225 | if (extpos==4) // if 3 chars as extension 1226 | return true; 1227 | 1228 | if (extpos==3) // if 2 chars as extension 1229 | return true; 1230 | 1231 | if (extpos==2) // if 1 chars as extension 1232 | return true; 1233 | 1234 | return false; 1235 | } 1236 | 1237 | /* 1238 | public enum MemoryProtection : uint 1239 | { 1240 | AccessDenied = 0x0, 1241 | Execute = 0x10, 1242 | ExecuteRead = 0x20, 1243 | ExecuteReadWrite = 0x40, 1244 | ExecuteWriteCopy = 0x80, 1245 | Guard = 0x100, 1246 | NoCache = 0x200, 1247 | WriteCombine = 0x400, 1248 | NoAccess = 0x01, 1249 | ReadOnly = 0x02, 1250 | ReadWrite = 0x04, 1251 | WriteCopy = 0x08 1252 | } 1253 | */ 1254 | 1255 | TCHAR* GenericPurposeMethods::GetMemoryProtectionInfo(unsigned int value) 1256 | { 1257 | CString str = TEXT(""); 1258 | if (value==0x0) 1259 | str = TEXT("AccessDenied"); 1260 | else if (value==0x10) 1261 | str = TEXT("Execute"); 1262 | else if (value==0x20) 1263 | str = TEXT("ExecuteRead"); 1264 | else if (value==0x40) 1265 | str = TEXT("ExecuteReadWrite"); 1266 | else if (value==0x80) 1267 | str = TEXT("ExecuteWriteCopy"); 1268 | else if (value==0x100) 1269 | str = TEXT("Guard"); 1270 | else if (value==0x200) 1271 | str = TEXT("NoCache"); 1272 | else if (value==0x400) 1273 | str = TEXT("WriteCombine"); 1274 | else if (value==0x01) 1275 | str = TEXT("NoAccess"); 1276 | else if (value==0x02) 1277 | str = TEXT("ReadOnly"); 1278 | else if (value==0x04) 1279 | str = TEXT("ReadWrite"); 1280 | else if (value==0x08) 1281 | str = TEXT("WriteCopy"); 1282 | 1283 | TCHAR* buf = new TCHAR[str.GetLength()+1]; 1284 | lstrcpy(buf, str); 1285 | 1286 | return buf; 1287 | } -------------------------------------------------------------------------------- /MemoryHacker/GenericPurposeMethods.h: -------------------------------------------------------------------------------- 1 | // GenericPurposeMethods.h: interface for the GenericPurposeMethods class. 2 | // 3 | ////////////////////////////////////////////////////////////////////// 4 | 5 | #if !defined(AFX_GENERICPURPOSEMETHODS_H__DB5CA191_5583_4171_9A54_3B45355468DF__INCLUDED_) 6 | #define AFX_GENERICPURPOSEMETHODS_H__DB5CA191_5583_4171_9A54_3B45355468DF__INCLUDED_ 7 | 8 | #if _MSC_VER > 1000 9 | #pragma once 10 | #endif // _MSC_VER > 1000 11 | 12 | class GenericPurposeMethods 13 | { 14 | public: 15 | GenericPurposeMethods(); 16 | virtual ~GenericPurposeMethods(); 17 | static unsigned int ConvertHexStringToInt(CString sHexNum); 18 | static bool IsHexNumber(char tobetested); 19 | static unsigned int Pow(int value,int exponent); 20 | static unsigned __int64 BigPow(unsigned __int64 value,unsigned __int64 exponent); 21 | static int StringToNumber(char *buffer); 22 | static void ToUpperCase(char *buffer); 23 | static unsigned int UnsignedArrayToUInt(unsigned char *buffer,int position); 24 | static unsigned char* UIntToUnsignedArray(unsigned int value); 25 | static unsigned int UnsignedArrayToShort(unsigned char *buffer,int position); 26 | static unsigned char* StringToBytes(char *value, char *type, char *base, int *out_len); 27 | static unsigned char GetCharFromStr(char *value, char *base); 28 | static unsigned char GetCharFromTStr(char *value, char *base); 29 | static unsigned short GetShortFromStr(char *value, char *base); 30 | static unsigned short GetShortFromTStr(char *buffer, char *base); 31 | static unsigned int GetIntFromStr(char *value, char *base); 32 | static unsigned int GetIntFromTStr(char *buffer, char *base); 33 | static unsigned __int64 GetLongFromStr(char *value, char *base); 34 | static unsigned __int64 GetLongFromTStr(char *buffer, char *base); 35 | static float str2float(char* s); 36 | static float str2float(char* s, char *base); 37 | static double str2double(char* s); 38 | static double str2double(char* s, char *base); 39 | static char* BytesToString(unsigned char* bytes, int bytes_len, char *type, char *base); 40 | static char* TruncateString(char *value, int newlen); 41 | static char* Substring(char *value, int start_index, int end_index); 42 | static char NumberToCharString(char input); 43 | static char* double2str(double number, char *base); 44 | static TCHAR* GetShortModuleName(TCHAR fullname[]); 45 | static TCHAR* GetDirectory(TCHAR fullname[]); 46 | static TCHAR* GetDumpFileName(TCHAR shortname[]); 47 | static TCHAR* GetExtension(TCHAR shortname[]); 48 | static TCHAR* JoinChars(TCHAR first[],TCHAR second[]); 49 | static bool ContainsExtension(TCHAR filename[]); 50 | static TCHAR* GetMemoryProtectionInfo(unsigned int value); 51 | 52 | }; 53 | 54 | #endif // !defined(AFX_GENERICPURPOSEMETHODS_H__DB5CA191_5583_4171_9A54_3B45355468DF__INCLUDED_) 55 | -------------------------------------------------------------------------------- /MemoryHacker/InspectMemory.cpp: -------------------------------------------------------------------------------- 1 | // InspectMemory.cpp : implementation file 2 | // 3 | 4 | #include "stdafx.h" 5 | #include "MemoryHacker.h" 6 | #include "InspectMemory.h" 7 | #include "GenericPurposeMethods.h" 8 | 9 | #ifdef _DEBUG 10 | #define new DEBUG_NEW 11 | #undef THIS_FILE 12 | static char THIS_FILE[] = __FILE__; 13 | #endif 14 | 15 | ///////////////////////////////////////////////////////////////////////////// 16 | // InspectMemory dialog 17 | 18 | 19 | InspectMemory::InspectMemory(CWnd* pParent /*=NULL*/) 20 | : CDialog(InspectMemory::IDD, pParent) 21 | { 22 | //{{AFX_DATA_INIT(InspectMemory) 23 | //}}AFX_DATA_INIT 24 | } 25 | 26 | 27 | void InspectMemory::DoDataExchange(CDataExchange* pDX) 28 | { 29 | CDialog::DoDataExchange(pDX); 30 | //{{AFX_DATA_MAP(InspectMemory) 31 | DDX_Control(pDX, IDC_EDIT_RESULT, m_result_edit); 32 | DDX_Control(pDX, IDC_EDIT_BRBYTES, m_edit_2); 33 | DDX_Control(pDX, IDC_EDIT1, m_edit1); 34 | //}}AFX_DATA_MAP 35 | } 36 | 37 | 38 | BEGIN_MESSAGE_MAP(InspectMemory, CDialog) 39 | //{{AFX_MSG_MAP(InspectMemory) 40 | ON_BN_CLICKED(IDC_INSPECTBUT, OnInspectbut) 41 | ON_WM_CLOSE() 42 | //}}AFX_MSG_MAP 43 | END_MESSAGE_MAP() 44 | 45 | ///////////////////////////////////////////////////////////////////////////// 46 | // InspectMemory message handlers 47 | 48 | void InspectMemory::OnInspectbut() 49 | { 50 | // TODO: Add your control notification handler code here 51 | 52 | char address_str[9]; 53 | m_edit1.GetWindowText(address_str, 9); 54 | if (address_str[0]==0) return; 55 | 56 | char size_str[9]; 57 | m_edit_2.GetWindowText(size_str, 9); 58 | if (size_str[0]==0) return; 59 | 60 | unsigned int caddress = GenericPurposeMethods::ConvertHexStringToInt(address_str); 61 | 62 | int size = GenericPurposeMethods::StringToNumber(size_str); 63 | 64 | HANDLE hProcess = OpenProcess( PROCESS_QUERY_INFORMATION | PROCESS_VM_READ, 65 | FALSE, processid); 66 | 67 | if (hProcess==NULL) 68 | return; 69 | 70 | 71 | unsigned long dwTotalRead; 72 | 73 | char* valuestr = new char[1]; 74 | valuestr[0] = 00; 75 | 76 | unsigned char* valbytes = new unsigned char[size]; 77 | int isok = ReadProcessMemory(hProcess, (LPVOID)caddress, valbytes, 78 | size, &dwTotalRead); 79 | 80 | if (isok != 0) // if read didn't failed 81 | { 82 | valuestr = GenericPurposeMethods::BytesToString(valbytes, size, CString(_T("bytes")).GetBuffer(0), CString(_T("hexadecimal")).GetBuffer(0)); 83 | } 84 | else 85 | { 86 | valuestr = _T("Read failed!!!"); 87 | } 88 | 89 | 90 | m_result_edit.SetWindowText(valuestr); 91 | 92 | 93 | } 94 | 95 | 96 | InspectMemory& InspectMemory::operator=(InspectMemory& right) 97 | { 98 | // right contains value to be set 99 | // this contains old value 100 | (*this).m_hWnd = right.m_hWnd; 101 | return *this; 102 | 103 | } 104 | 105 | BOOL InspectMemory::OnInitDialog() 106 | { 107 | CDialog::OnInitDialog(); 108 | 109 | // TODO: Add extra initialization here 110 | m_edit1.SetWindowText(address_str); 111 | return TRUE; // return TRUE unless you set the focus to a control 112 | // EXCEPTION: OCX Property Pages should return FALSE 113 | } 114 | 115 | void InspectMemory::OnClose() 116 | { 117 | // TODO: Add your message handler code here and/or call default 118 | this->DestroyWindow(); // destroy the window 119 | CDialog::OnClose(); 120 | } 121 | -------------------------------------------------------------------------------- /MemoryHacker/InspectMemory.h: -------------------------------------------------------------------------------- 1 | #if !defined(AFX_INSPECTMEMORY_H__88778F85_6EF4_4F11_98D7_4C3BC40F62DD__INCLUDED_) 2 | #define AFX_INSPECTMEMORY_H__88778F85_6EF4_4F11_98D7_4C3BC40F62DD__INCLUDED_ 3 | 4 | #if _MSC_VER > 1000 5 | #pragma once 6 | #endif // _MSC_VER > 1000 7 | // InspectMemory.h : header file 8 | // 9 | #include "NewEdit.h" 10 | 11 | ///////////////////////////////////////////////////////////////////////////// 12 | // InspectMemory dialog 13 | 14 | class InspectMemory : public CDialog 15 | { 16 | // Construction 17 | public: 18 | InspectMemory(CWnd* pParent = NULL); // standard constructor 19 | InspectMemory& InspectMemory::operator=(InspectMemory& right); 20 | CString address_str; 21 | int processid; 22 | 23 | // Dialog Data 24 | //{{AFX_DATA(InspectMemory) 25 | enum { IDD = IDD_INSPECTMEMORY_DIALOG }; 26 | CEdit m_result_edit; 27 | NewEdit m_edit_2; 28 | NewEdit m_edit1; 29 | //}}AFX_DATA 30 | 31 | 32 | // Overrides 33 | // ClassWizard generated virtual function overrides 34 | //{{AFX_VIRTUAL(InspectMemory) 35 | protected: 36 | virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support 37 | //}}AFX_VIRTUAL 38 | 39 | // Implementation 40 | protected: 41 | 42 | // Generated message map functions 43 | //{{AFX_MSG(InspectMemory) 44 | afx_msg void OnInspectbut(); 45 | virtual BOOL OnInitDialog(); 46 | afx_msg void OnClose(); 47 | //}}AFX_MSG 48 | DECLARE_MESSAGE_MAP() 49 | }; 50 | 51 | //{{AFX_INSERT_LOCATION}} 52 | // Microsoft Visual C++ will insert additional declarations immediately before the previous line. 53 | 54 | #endif // !defined(AFX_INSPECTMEMORY_H__88778F85_6EF4_4F11_98D7_4C3BC40F62DD__INCLUDED_) 55 | -------------------------------------------------------------------------------- /MemoryHacker/MemoryBlock.cpp: -------------------------------------------------------------------------------- 1 | // MemoryBlock.cpp : implementation file 2 | // 3 | 4 | #include "stdafx.h" 5 | #include "MemoryHacker.h" 6 | #include "MemoryBlock.h" 7 | #include "GenericPurposeMethods.h" 8 | #include "CustomizeDlg.h" 9 | 10 | #ifdef _DEBUG 11 | #define new DEBUG_NEW 12 | #undef THIS_FILE 13 | static char THIS_FILE[] = __FILE__; 14 | #endif 15 | 16 | ///////////////////////////////////////////////////////////////////////////// 17 | // MemoryBlock dialog 18 | 19 | 20 | MemoryBlock::MemoryBlock(CWnd* pParent /*=NULL*/) 21 | : CDialog(MemoryBlock::IDD, pParent) 22 | { 23 | //{{AFX_DATA_INIT(MemoryBlock) 24 | // NOTE: the ClassWizard will add member initialization here 25 | //}}AFX_DATA_INIT 26 | } 27 | 28 | 29 | void MemoryBlock::DoDataExchange(CDataExchange* pDX) 30 | { 31 | CDialog::DoDataExchange(pDX); 32 | //{{AFX_DATA_MAP(MemoryBlock) 33 | DDX_Control(pDX, IDC_LIST1, m_cListCtrl); 34 | //}}AFX_DATA_MAP 35 | } 36 | 37 | 38 | BEGIN_MESSAGE_MAP(MemoryBlock, CDialog) 39 | //{{AFX_MSG_MAP(MemoryBlock) 40 | ON_WM_CLOSE() 41 | ON_NOTIFY(LVN_ITEMCHANGED, IDC_LIST1, OnItemchangedList1) 42 | //}}AFX_MSG_MAP 43 | END_MESSAGE_MAP() 44 | 45 | ///////////////////////////////////////////////////////////////////////////// 46 | // MemoryBlock message handlers 47 | 48 | MemoryBlock& MemoryBlock::operator=(MemoryBlock& right) 49 | { 50 | // right contains value to be set 51 | // this contains old value 52 | (*this).m_hWnd = right.m_hWnd; 53 | return *this; 54 | 55 | } 56 | 57 | void MemoryBlock::GetVirtualMemories() 58 | { 59 | 60 | vmem_counts = 0; 61 | valid_mems = new MEMORY_BASIC_INFORMATION[2000]; // 2000 should be enough 62 | 63 | HANDLE hProcess = OpenProcess( PROCESS_QUERY_INFORMATION | 64 | PROCESS_VM_READ, 65 | FALSE, processid); 66 | 67 | if (hProcess==NULL) return; 68 | 69 | unsigned int Start = 0; 70 | SYSTEM_INFO si; 71 | GetSystemInfo(&si); 72 | while (Start < (unsigned int)si.lpMaximumApplicationAddress) 73 | { 74 | MEMORY_BASIC_INFORMATION mbi; 75 | VirtualQueryEx( hProcess, 76 | (void *)Start, 77 | &mbi, 78 | sizeof(MEMORY_BASIC_INFORMATION)); 79 | 80 | // mbi.State == MEM_PRIVATE / MEM_IMAGE / MEM_MAPPED - never used 81 | // mbi.State == MEM_RESERVE / MEM_FREE - used but is not what we want 82 | // mbi.State == MEM_COMMIT - that's what we want 83 | // && (mbi.Protect == PAGE_GUARD||mbi.Protect != PAGE_NOACCESS) 84 | 85 | if (mbi.State == MEM_COMMIT) 86 | { 87 | valid_mems[vmem_counts]=mbi; 88 | vmem_counts++; 89 | 90 | 91 | } 92 | 93 | if(Start + mbi.RegionSize < Start) break; 94 | Start += mbi.RegionSize; 95 | } // end of while memory 96 | CloseHandle(hProcess); 97 | 98 | 99 | 100 | } // end of GetVirtualMemories method 101 | 102 | 103 | BOOL MemoryBlock::OnInitDialog() 104 | { 105 | CDialog::OnInitDialog(); 106 | 107 | // TODO: Add extra initialization here 108 | DWORD dwStyle = m_cListCtrl.GetExtendedStyle(); 109 | dwStyle |= LVS_EX_FULLROWSELECT; 110 | 111 | // Setup the list control 112 | m_cListCtrl.SetExtendedStyle(dwStyle); 113 | 114 | // Create the columns 115 | CRect rect; 116 | m_cListCtrl.GetClientRect(&rect); 117 | int size = rect.Width()/3-16; 118 | m_cListCtrl.InsertColumn(0, _T("Base Address"), LVCFMT_LEFT, size); 119 | m_cListCtrl.InsertColumn(1, _T("Size"), LVCFMT_LEFT, size); 120 | m_cListCtrl.InsertColumn(2, _T("Protection"), LVCFMT_LEFT, size); 121 | 122 | MemoryBlock::RefreshVirtualMemoriesList(); 123 | 124 | return TRUE; // return TRUE unless you set the focus to a control 125 | // EXCEPTION: OCX Property Pages should return FALSE 126 | } 127 | 128 | 129 | 130 | void MemoryBlock::RefreshVirtualMemoriesList() 131 | { 132 | m_cListCtrl.DeleteAllItems(); // clean old items! 133 | MemoryBlock::GetVirtualMemories(); 134 | 135 | 136 | // Add the process name and identifier. 137 | for (int i=0;iDestroyWindow(); // destroy the window 202 | CDialog::OnClose(); 203 | } 204 | 205 | void MemoryBlock::OnItemchangedList1(NMHDR* pNMHDR, LRESULT* pResult) 206 | { 207 | NM_LISTVIEW* pNMListView = (NM_LISTVIEW*)pNMHDR; 208 | // TODO: Add your control notification handler code here 209 | 210 | POSITION pos = m_cListCtrl.GetFirstSelectedItemPosition(); 211 | int position = m_cListCtrl.GetNextSelectedItem(pos); 212 | 213 | if (position>=0) 214 | { 215 | unsigned int base_address = (unsigned int)valid_mems[position].BaseAddress; 216 | 217 | if (settype == MemoryBlock::SetType::MemoryBlockT||settype == MemoryBlock::SetType::StartAddressT) 218 | CCustomizeDlg::UpdateStartAddress((unsigned int)base_address); 219 | 220 | unsigned int end_address = base_address+(unsigned int)valid_mems[position].RegionSize; 221 | if (settype == MemoryBlock::SetType::MemoryBlockT) 222 | CCustomizeDlg::UpdateEndAddress(end_address); 223 | 224 | if (settype == MemoryBlock::SetType::EndAddressT) 225 | CCustomizeDlg::UpdateEndAddress((unsigned int)base_address); 226 | 227 | 228 | } 229 | 230 | *pResult = 0; 231 | } 232 | -------------------------------------------------------------------------------- /MemoryHacker/MemoryBlock.h: -------------------------------------------------------------------------------- 1 | #if !defined(AFX_MEMORYBLOCK_H__501EDED6_DA94_4AB4_B454_F56BDEE562A2__INCLUDED_) 2 | #define AFX_MEMORYBLOCK_H__501EDED6_DA94_4AB4_B454_F56BDEE562A2__INCLUDED_ 3 | 4 | #if _MSC_VER > 1000 5 | #pragma once 6 | #endif // _MSC_VER > 1000 7 | // MemoryBlock.h : header file 8 | // 9 | 10 | ///////////////////////////////////////////////////////////////////////////// 11 | // MemoryBlock dialog 12 | 13 | class MemoryBlock : public CDialog 14 | { 15 | // Construction 16 | public: 17 | MemoryBlock(CWnd* pParent = NULL); // standard constructor 18 | MemoryBlock& operator=(MemoryBlock& right); // Overload Assignment Operator 19 | void GetVirtualMemories(); 20 | void RefreshVirtualMemoriesList(); 21 | 22 | CString processname; 23 | int processid; 24 | int vmem_counts; 25 | MEMORY_BASIC_INFORMATION* valid_mems; 26 | 27 | enum SetType { MemoryBlockT, StartAddressT, EndAddressT }; 28 | SetType settype; 29 | 30 | // Dialog Data 31 | //{{AFX_DATA(MemoryBlock) 32 | enum { IDD = IDD_MEMORYBLOCK_DIALOG }; 33 | CListCtrl m_cListCtrl; 34 | //}}AFX_DATA 35 | 36 | 37 | // Overrides 38 | // ClassWizard generated virtual function overrides 39 | //{{AFX_VIRTUAL(MemoryBlock) 40 | protected: 41 | virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support 42 | //}}AFX_VIRTUAL 43 | 44 | // Implementation 45 | protected: 46 | 47 | // Generated message map functions 48 | //{{AFX_MSG(MemoryBlock) 49 | virtual BOOL OnInitDialog(); 50 | afx_msg void OnClose(); 51 | afx_msg void OnItemchangedList1(NMHDR* pNMHDR, LRESULT* pResult); 52 | //}}AFX_MSG 53 | DECLARE_MESSAGE_MAP() 54 | }; 55 | 56 | //{{AFX_INSERT_LOCATION}} 57 | // Microsoft Visual C++ will insert additional declarations immediately before the previous line. 58 | 59 | #endif // !defined(AFX_MEMORYBLOCK_H__501EDED6_DA94_4AB4_B454_F56BDEE562A2__INCLUDED_) 60 | -------------------------------------------------------------------------------- /MemoryHacker/MemoryHack.cpp: -------------------------------------------------------------------------------- 1 | // MemoryHack.cpp : implementation file 2 | // 3 | 4 | #include "stdafx.h" 5 | #include "MemoryHacker.h" 6 | #include "MemoryHack.h" 7 | #include "CustomizeDlg.h" 8 | #include "GenericPurposeMethods.h" 9 | 10 | #ifdef _DEBUG 11 | #define new DEBUG_NEW 12 | #undef THIS_FILE 13 | static char THIS_FILE[] = __FILE__; 14 | #endif 15 | 16 | ///////////////////////////////////////////////////////////////////////////// 17 | // MemoryHack dialog 18 | 19 | 20 | MemoryHack::MemoryHack(CWnd* pParent /*=NULL*/) 21 | : CDialog(MemoryHack::IDD, pParent) 22 | { 23 | //{{AFX_DATA_INIT(MemoryHack) 24 | // NOTE: the ClassWizard will add member initialization here 25 | //}}AFX_DATA_INIT 26 | } 27 | 28 | MemoryHack& MemoryHack::operator=(MemoryHack& right) 29 | { 30 | // right contains value to be set 31 | // this contains old value 32 | (*this).m_hWnd = right.m_hWnd; 33 | return *this; 34 | 35 | } 36 | 37 | 38 | void MemoryHack::DoDataExchange(CDataExchange* pDX) 39 | { 40 | CDialog::DoDataExchange(pDX); 41 | //{{AFX_DATA_MAP(MemoryHack) 42 | DDX_Control(pDX, IDC_LIST2, m_cListCtrl); 43 | DDX_Control(pDX, IDC_TYPE_COMBO, m_type); 44 | DDX_Control(pDX, IDC_BASE_COMBO, m_base); 45 | //}}AFX_DATA_MAP 46 | } 47 | 48 | 49 | BEGIN_MESSAGE_MAP(MemoryHack, CDialog) 50 | //{{AFX_MSG_MAP(MemoryHack) 51 | ON_WM_CLOSE() 52 | ON_BN_CLICKED(IDC_CUSTOMSEARCH_RAD, OnCustomsearchRad) 53 | ON_BN_CLICKED(IDC_FULLSEARCH_RAD, OnFullsearchRad) 54 | ON_BN_CLICKED(IDC_CUSTOMIZE_BTN, OnCustomizeBtn) 55 | ON_BN_CLICKED(IDC_SEARCH_BUT, OnSearchBut) 56 | ON_BN_CLICKED(IDC_READ_VALUES, OnReadValues) 57 | ON_BN_CLICKED(IDC_RNFBUT, OnRnfbut) 58 | ON_BN_CLICKED(IDC_PATCHBUT, OnPatchbut) 59 | ON_NOTIFY(NM_RCLICK, IDC_LIST2, OnRclickList2) 60 | //}}AFX_MSG_MAP 61 | END_MESSAGE_MAP() 62 | 63 | ///////////////////////////////////////////////////////////////////////////// 64 | // MemoryHack message handlers 65 | 66 | // these are needed for static members: 67 | int MemoryHack::custom_count; 68 | unsigned int MemoryHack::start_addresses[2000]; 69 | unsigned int MemoryHack::end_addresses[2000]; 70 | 71 | BOOL MemoryHack::OnInitDialog() 72 | { 73 | CDialog::OnInitDialog(); 74 | 75 | // TODO: Add extra initialization here 76 | char window_title[500]; 77 | this->GetWindowText(window_title,sizeof(window_title)); 78 | strcat(window_title, processname); 79 | this->SetWindowText(window_title); 80 | 81 | CButton *m_ctlRadio = (CButton*) GetDlgItem(IDC_FULLSEARCH_RAD); 82 | m_ctlRadio->SetCheck(BST_CHECKED);// check IDC_FULLSEARCH_RAD 83 | 84 | CButton* pCustomizebtn = (CButton*)GetDlgItem(IDC_CUSTOMIZE_BTN); 85 | pCustomizebtn->EnableWindow(false); // disable button 86 | 87 | 88 | MemoryHack::custom_count = 0; // init custom count with 0 89 | 90 | // populate type combo: 91 | m_type.AddString("byte"); 92 | m_type.AddString("word"); 93 | int dword_index = m_type.AddString("dword"); 94 | m_type.AddString("qword"); 95 | m_type.AddString("bytes"); 96 | m_type.AddString("ASCII string"); 97 | m_type.AddString("UNICODE string"); 98 | m_type.AddString("float"); 99 | m_type.AddString("double"); 100 | m_type.SetCurSel(dword_index); 101 | 102 | int dec_index = m_base.AddString("decimal"); 103 | m_base.AddString("hexadecimal"); 104 | m_base.SetCurSel(dec_index); 105 | 106 | DWORD dwStyle = m_cListCtrl.GetExtendedStyle(); 107 | dwStyle |= LVS_EX_FULLROWSELECT; 108 | 109 | // Setup the list control 110 | m_cListCtrl.SetExtendedStyle(dwStyle); 111 | 112 | // Create the columns 113 | CRect rect; 114 | m_cListCtrl.GetClientRect(&rect); 115 | int size = rect.Width()/2-16; 116 | m_cListCtrl.InsertColumn(0, _T("Address"), LVCFMT_LEFT, size); 117 | m_cListCtrl.InsertColumn(1, _T("Value"), LVCFMT_LEFT, size); 118 | 119 | 120 | return TRUE; // return TRUE unless you set the focus to a control 121 | // EXCEPTION: OCX Property Pages should return FALSE 122 | } 123 | 124 | 125 | void MemoryHack::OnClose() 126 | { 127 | // TODO: Add your message handler code here and/or call default 128 | this->DestroyWindow(); // destroy the window 129 | CDialog::OnClose(); 130 | } 131 | 132 | void MemoryHack::OnCustomsearchRad() 133 | { 134 | // TODO: Add your control notification handler code here 135 | MemoryHack::SetCustomizeBtnEnabled(); 136 | } 137 | 138 | void MemoryHack::OnFullsearchRad() 139 | { 140 | // TODO: Add your control notification handler code here 141 | MemoryHack::SetCustomizeBtnEnabled(); 142 | } 143 | 144 | void MemoryHack::SetCustomizeBtnEnabled() 145 | { 146 | CButton* pCustomizebtn = (CButton*)GetDlgItem(IDC_CUSTOMIZE_BTN); 147 | CButton* pCustomsearchRad = (CButton*)GetDlgItem(IDC_CUSTOMSEARCH_RAD); 148 | CButton* pFullsearchRad = (CButton*)GetDlgItem(IDC_FULLSEARCH_RAD); 149 | 150 | if (pCustomsearchRad->GetCheck()==1) 151 | pCustomizebtn->EnableWindow(true); // enable button 152 | 153 | if (pFullsearchRad->GetCheck()==1) 154 | pCustomizebtn->EnableWindow(false); // disable button 155 | 156 | } 157 | 158 | void MemoryHack::OnCustomizeBtn() 159 | { 160 | // TODO: Add your control notification handler code here 161 | 162 | if (!IsWindow(customizedlg.m_hWnd)||!customizedlg.IsWindowVisible()) 163 | { 164 | 165 | CCustomizeDlg m_cddialog = new CCustomizeDlg(this); 166 | customizedlg = m_cddialog; 167 | customizedlg.processname = processname; 168 | customizedlg.processid = processid; 169 | //testdlg.DoModal(); // not modal one! 170 | BOOL ret = customizedlg.Create(IDD_CUSTOMIZEDLG_DIALOG,this); 171 | if (ret) // If create not failed. 172 | customizedlg.ShowWindow(SW_SHOWNORMAL); 173 | } 174 | 175 | } 176 | 177 | void MemoryHack::GetVirtualMemories() 178 | { 179 | 180 | 181 | vmem_counts = 0; 182 | valid_mems = new MEMORY_BASIC_INFORMATION[2000]; // 2000 should be enough 183 | 184 | HANDLE hProcess = OpenProcess( PROCESS_QUERY_INFORMATION | 185 | PROCESS_VM_READ, 186 | FALSE, processid); 187 | 188 | if (hProcess==NULL) return; 189 | 190 | unsigned int Start = 0; 191 | SYSTEM_INFO si; 192 | GetSystemInfo(&si); 193 | 194 | while (Start < (unsigned int)si.lpMaximumApplicationAddress) 195 | { 196 | MEMORY_BASIC_INFORMATION mbi; 197 | VirtualQueryEx( hProcess, 198 | (void *)Start, 199 | &mbi, 200 | sizeof(MEMORY_BASIC_INFORMATION)); 201 | 202 | // mbi.State == MEM_PRIVATE / MEM_IMAGE / MEM_MAPPED - never used 203 | // mbi.State == MEM_RESERVE / MEM_FREE - used but is not what we want 204 | // mbi.State == MEM_COMMIT - that's what we want 205 | // && (mbi.Protect == PAGE_GUARD||mbi.Protect != PAGE_NOACCESS) 206 | 207 | if (mbi.State == MEM_COMMIT) 208 | { 209 | valid_mems[vmem_counts]=mbi; 210 | vmem_counts++; 211 | 212 | 213 | } 214 | 215 | if(Start + mbi.RegionSize < Start) break; 216 | Start += mbi.RegionSize; 217 | } // end of while memory 218 | CloseHandle(hProcess); 219 | 220 | 221 | 222 | } // end of GetVirtualMemories method 223 | 224 | bool MemoryHack::MemoryInRange(unsigned int address) 225 | { 226 | 227 | for (int i=0;i=MemoryHack::start_addresses[i]&&addressSetWindowText(_T("No sel for type!")); 246 | return; 247 | } 248 | 249 | CString search_type; 250 | m_type.GetLBText(row, search_type); 251 | if (search_type.GetLength()==0) 252 | { 253 | statusWnd->SetWindowText(_T("Type text len can be 0!")); 254 | return; 255 | } 256 | 257 | row = m_base.GetCurSel(); 258 | if(row < 0) 259 | { 260 | statusWnd->SetWindowText(_T("No sel for base!")); 261 | return; 262 | } 263 | 264 | CString base; 265 | m_base.GetLBText(row, base); 266 | if (base.GetLength()==0) 267 | { 268 | statusWnd->SetWindowText(_T("Base text len can be 0!")); 269 | return; 270 | } 271 | 272 | char value_to_search_str[500]; 273 | GetDlgItem(IDC_VALUETOSEARCH_EDIT)->GetWindowText(value_to_search_str, 500); 274 | 275 | if (value_to_search_str[0]==0) 276 | { 277 | statusWnd->SetWindowText(_T("Value to search len can be 0!")); 278 | return; 279 | } 280 | 281 | m_cListCtrl.DeleteAllItems(); // clean old items! 282 | MemoryHack::GetVirtualMemories(); 283 | 284 | //char end_address[500]; 285 | //GetDlgItem(IDC_ENDA_EDIT)->GetWindowText(end_address, 9); 286 | int search_len = 0; 287 | unsigned char* to_search_val = GenericPurposeMethods::StringToBytes(value_to_search_str, search_type.GetBuffer(0), base.GetBuffer(0), &search_len); 288 | 289 | 290 | if (search_len==0) 291 | { 292 | statusWnd->SetWindowText(_T("Failed to convert value to search!")); 293 | return; 294 | } 295 | 296 | HANDLE hProcess = OpenProcess( PROCESS_QUERY_INFORMATION | PROCESS_VM_READ, 297 | FALSE, processid); 298 | 299 | 300 | if (hProcess==NULL) 301 | { 302 | statusWnd->SetWindowText(_T("Failed to open the process!")); 303 | return; 304 | } 305 | 306 | 307 | bool Fullsearch = false; 308 | bool Customsearch = false; 309 | 310 | CButton* pCustomsearchRad = (CButton*)GetDlgItem(IDC_CUSTOMSEARCH_RAD); 311 | CButton* pFullsearchRad = (CButton*)GetDlgItem(IDC_FULLSEARCH_RAD); 312 | 313 | if (pCustomsearchRad->GetCheck()==1) 314 | Customsearch = true; 315 | 316 | if (pFullsearchRad->GetCheck()==1) 317 | Fullsearch = true; 318 | 319 | unsigned long dwTotalRead; 320 | unsigned char* buf; 321 | 322 | 323 | for (int i=0;i=(int)valid_mems[i].RegionSize) 349 | { // if k+l (index) bigger or equal then buf size 350 | are_equal = false; 351 | break; 352 | } 353 | 354 | 355 | if (buf[k+l]!=to_search_val[l]) 356 | { 357 | are_equal = false; 358 | break; 359 | } 360 | 361 | } 362 | 363 | if (are_equal) 364 | { // if something found 365 | 366 | LVITEM lvi; 367 | CString strItem; 368 | 369 | // Insert the first item 370 | lvi.mask = LVIF_TEXT; 371 | lvi.iItem = m_cListCtrl.GetItemCount(); // this starts with 0! 372 | 373 | // insert subitem 0 374 | lvi.iSubItem = 0; 375 | 376 | char baseaddress[20]; 377 | baseaddress[0] = 00; 378 | wsprintf(baseaddress,"%X",faddress); // convert number to hex string 379 | 380 | int len = 8-strlen(baseaddress); // get the missing part size 381 | memmove(baseaddress+len,baseaddress,strlen(baseaddress)); // move the string characters to the end 382 | for ( int j = 0; j < len; j++ ) // fill the beginning characters with '0' 383 | baseaddress[j] = '0'; 384 | 385 | baseaddress[8] = 0; // place the 00 end char at the end of string! 386 | 387 | lvi.pszText = (char*)LPCTSTR(baseaddress); 388 | m_cListCtrl.InsertItem(&lvi); 389 | 390 | 391 | char* valuestr = new char[1]; 392 | valuestr[0] = 00; 393 | 394 | unsigned char* valbytes = new unsigned char[search_len]; 395 | int isok = ReadProcessMemory(hProcess, (LPVOID)faddress, valbytes, 396 | search_len, &dwTotalRead); 397 | 398 | if (isok != 0) // if read didn't failed 399 | { 400 | valuestr = GenericPurposeMethods::BytesToString(valbytes,search_len, search_type.GetBuffer(0), base.GetBuffer(0)); 401 | } 402 | 403 | // insert subitem 1 404 | lvi.iSubItem = 1; 405 | lvi.pszText = (char*)LPCTSTR(valuestr); 406 | m_cListCtrl.SetItem(&lvi); 407 | 408 | 409 | } 410 | 411 | } // end of if first byte equal 412 | 413 | 414 | 415 | } // end of for valid_mems[i].RegionSize! 416 | 417 | } // end of isok 418 | 419 | delete[] buf; 420 | 421 | } 422 | 423 | 424 | 425 | CloseHandle(hProcess); 426 | 427 | 428 | } 429 | 430 | void MemoryHack::OnReadValues() 431 | { 432 | // TODO: Add your control notification handler code here 433 | 434 | CWnd* statusWnd = GetDlgItem(IDC_STATUS_STATIC); 435 | 436 | int row = m_type.GetCurSel(); 437 | if (row < 0) 438 | { 439 | statusWnd->SetWindowText(_T("No sel for type!")); 440 | return; 441 | } 442 | 443 | CString search_type; 444 | m_type.GetLBText(row, search_type); 445 | if (search_type.GetLength()==0) 446 | { 447 | statusWnd->SetWindowText(_T("Type text len can be 0!")); 448 | return; 449 | } 450 | 451 | row = m_base.GetCurSel(); 452 | if(row < 0) 453 | { 454 | statusWnd->SetWindowText(_T("No sel for base!")); 455 | return; 456 | } 457 | 458 | CString base; 459 | m_base.GetLBText(row, base); 460 | if (base.GetLength()==0) 461 | { 462 | statusWnd->SetWindowText(_T("Base text len can be 0!")); 463 | return; 464 | } 465 | 466 | char value_to_search_str[500]; 467 | GetDlgItem(IDC_VALUETOSEARCH_EDIT)->GetWindowText(value_to_search_str, 500); 468 | 469 | if (value_to_search_str[0]==0) 470 | { 471 | statusWnd->SetWindowText(_T("Value to search len can be 0!")); 472 | return; 473 | } 474 | 475 | int nLastItem = m_cListCtrl.GetItemCount(); //gets the number of ListView items in the CListCtrl 476 | 477 | if (nLastItem<=0) 478 | { 479 | statusWnd->SetWindowText(_T("List doesn't contain any address!!!")); 480 | return; 481 | } 482 | 483 | int search_len = 0; 484 | unsigned char* to_search_val = GenericPurposeMethods::StringToBytes(value_to_search_str, search_type.GetBuffer(0), base.GetBuffer(0), &search_len); 485 | 486 | 487 | if (search_len==0) 488 | { 489 | statusWnd->SetWindowText(_T("Failed to convert value to search!")); 490 | return; 491 | } 492 | 493 | HANDLE hProcess = OpenProcess( PROCESS_QUERY_INFORMATION | PROCESS_VM_READ, 494 | FALSE, processid); 495 | 496 | 497 | if (hProcess==NULL) 498 | { 499 | statusWnd->SetWindowText(_T("Failed to open the process!")); 500 | return; 501 | } 502 | 503 | unsigned long dwTotalRead; 504 | 505 | for (int i=0;iSetWindowText(_T("No sel for type!")); 559 | return; 560 | } 561 | 562 | CString search_type; 563 | m_type.GetLBText(row, search_type); 564 | if (search_type.GetLength()==0) 565 | { 566 | statusWnd->SetWindowText(_T("Type text len can be 0!")); 567 | return; 568 | } 569 | 570 | row = m_base.GetCurSel(); 571 | if(row < 0) 572 | { 573 | statusWnd->SetWindowText(_T("No sel for base!")); 574 | return; 575 | } 576 | 577 | CString base; 578 | m_base.GetLBText(row, base); 579 | if (base.GetLength()==0) 580 | { 581 | statusWnd->SetWindowText(_T("Base text len can be 0!")); 582 | return; 583 | } 584 | 585 | char value_to_search_str[500]; 586 | GetDlgItem(IDC_VALUETOSEARCH_EDIT)->GetWindowText(value_to_search_str, 500); 587 | 588 | if (value_to_search_str[0]==0) 589 | { 590 | statusWnd->SetWindowText(_T("Value to search len can be 0!")); 591 | return; 592 | } 593 | 594 | int nLastItem = m_cListCtrl.GetItemCount(); //gets the number of ListView items in the CListCtrl 595 | 596 | if (nLastItem<=0) 597 | { 598 | statusWnd->SetWindowText(_T("List doesn't contain any address!!!")); 599 | return; 600 | } 601 | 602 | int search_len = 0; 603 | unsigned char* to_search_val = GenericPurposeMethods::StringToBytes(value_to_search_str, search_type.GetBuffer(0), base.GetBuffer(0), &search_len); 604 | 605 | 606 | if (search_len==0) 607 | { 608 | statusWnd->SetWindowText(_T("Failed to convert value to search!")); 609 | return; 610 | } 611 | 612 | HANDLE hProcess = OpenProcess( PROCESS_QUERY_INFORMATION | PROCESS_VM_READ, 613 | FALSE, processid); 614 | 615 | 616 | if (hProcess==NULL) 617 | { 618 | statusWnd->SetWindowText(_T("Failed to open the process!")); 619 | return; 620 | } 621 | 622 | unsigned long dwTotalRead; 623 | 624 | int* items_to_remove = new int[nLastItem]; 625 | int remove_count = 0; 626 | 627 | for (int i=0;i=0;j--) // remove not found items: 678 | { 679 | m_cListCtrl.DeleteItem(items_to_remove[j]); 680 | 681 | } 682 | 683 | CloseHandle(hProcess); 684 | 685 | } 686 | 687 | int patches_count; 688 | unsigned int* items_to_patch; 689 | 690 | void MemoryHack::OnPatchbut() 691 | { 692 | // TODO: Add your control notification handler code here 693 | int nLastItem = m_cListCtrl.GetItemCount(); //gets the number of ListView items in the CListCtrl 694 | patches_count = 0; 695 | items_to_patch = new unsigned int[nLastItem]; 696 | 697 | for (int i=0;iSetWindowText(_T("No sel for type!")); 728 | return; 729 | } 730 | 731 | CString search_type; 732 | m_type.GetLBText(row, search_type); 733 | if (search_type.GetLength()==0) 734 | { 735 | statusWnd->SetWindowText(_T("Type text len can be 0!")); 736 | return; 737 | } 738 | 739 | row = m_base.GetCurSel(); 740 | if(row < 0) 741 | { 742 | statusWnd->SetWindowText(_T("No sel for base!")); 743 | return; 744 | } 745 | 746 | CString base; 747 | m_base.GetLBText(row, base); 748 | if (base.GetLength()==0) 749 | { 750 | statusWnd->SetWindowText(_T("Base text len can be 0!")); 751 | return; 752 | } 753 | 754 | char patch_str[500]; 755 | GetDlgItem(IDC_NEWVALEDIT)->GetWindowText(patch_str, 500); 756 | 757 | if (patch_str[0]==0) 758 | { 759 | statusWnd->SetWindowText(_T("New Value len can be 0!")); 760 | return; 761 | } 762 | 763 | if (patches_count<=0) 764 | { 765 | statusWnd->SetWindowText(_T("No Address to be patched!!!")); 766 | return; 767 | } 768 | 769 | int patch_len = 0; 770 | unsigned char* value_to_set = GenericPurposeMethods::StringToBytes(patch_str, search_type.GetBuffer(0), base.GetBuffer(0), &patch_len); 771 | 772 | 773 | if (patch_len==0) 774 | { 775 | statusWnd->SetWindowText(_T("Failed to convert New value!")); 776 | return; 777 | } 778 | 779 | HANDLE hProcess = OpenProcess( PROCESS_ALL_ACCESS, 780 | FALSE, processid); 781 | 782 | 783 | if (hProcess==NULL) 784 | { 785 | statusWnd->SetWindowText(_T("Failed to open the process!")); 786 | return; 787 | } 788 | 789 | for (int i=0;iTrackPopupMenu(NULL,mousepos.x,mousepos.y, this); 829 | 830 | // The menu is a temporary MFC object, no need to delete it. 831 | *pResult = 0; 832 | } 833 | 834 | int selectcount = 0; 835 | int* selected_indexes; 836 | 837 | void MemoryHack::GetSelectedIndexes() 838 | { 839 | 840 | selectcount = 0; 841 | selected_indexes = new int[2000]; 842 | 843 | int nRow = m_cListCtrl.GetNextItem(-1, LVNI_SELECTED); 844 | while (nRow != -1) 845 | { 846 | 847 | selected_indexes[selectcount]=nRow; 848 | selectcount++; 849 | 850 | nRow = m_cListCtrl.GetNextItem(nRow, LVNI_SELECTED); 851 | } 852 | 853 | } 854 | 855 | void MemoryHack::CopySelected() 856 | { 857 | GetSelectedIndexes(); 858 | if (selectcount<=0) return; // nothing to do! 859 | 860 | CString formated = _T(""); 861 | 862 | for (int i=0;i=0;i--) 905 | { 906 | m_cListCtrl.DeleteItem(selected_indexes[i]); // delete item from ClistCtrl 907 | } 908 | } 909 | 910 | void MemoryHack::PatchSelected() 911 | { 912 | GetSelectedIndexes(); 913 | if (selectcount<=0) return; // nothing to do! 914 | 915 | patches_count = 0; 916 | items_to_patch = new unsigned int[selectcount]; 917 | 918 | for (int i=0;i 1000 5 | #pragma once 6 | #endif // _MSC_VER > 1000 7 | // MemoryHack.h : header file 8 | // 9 | 10 | #include "CustomizeDlg.h" 11 | #include "InspectMemory.h" 12 | 13 | ///////////////////////////////////////////////////////////////////////////// 14 | // MemoryHack dialog 15 | 16 | class MemoryHack : public CDialog 17 | { 18 | // Construction 19 | public: 20 | MemoryHack(CWnd* pParent = NULL); // standard constructor 21 | MemoryHack& operator=(MemoryHack& right); // Overload Assignment Operator 22 | void GetVirtualMemories(); 23 | void PatchAddresses(); 24 | void CopySelected(); 25 | void RemoveSelected(); 26 | void PatchSelected(); 27 | void GetSelectedIndexes(); 28 | void InspectMemoryMethod(); 29 | 30 | static int custom_count; 31 | static unsigned int start_addresses[2000]; 32 | static unsigned int end_addresses[2000]; 33 | 34 | bool MemoryInRange(unsigned int address); 35 | 36 | int vmem_counts; 37 | MEMORY_BASIC_INFORMATION* valid_mems; 38 | 39 | void SetCustomizeBtnEnabled(); 40 | int processid; 41 | CString processname; 42 | CCustomizeDlg customizedlg; 43 | InspectMemory inspectdlg; 44 | //int MemoryHack::custom_count = 0; 45 | 46 | // Dialog Data 47 | //{{AFX_DATA(MemoryHack) 48 | enum { IDD = IDD_MEMORYHACK_DIALOG }; 49 | CListCtrl m_cListCtrl; 50 | CComboBox m_type; 51 | CComboBox m_base; 52 | //}}AFX_DATA 53 | 54 | 55 | // Overrides 56 | // ClassWizard generated virtual function overrides 57 | //{{AFX_VIRTUAL(MemoryHack) 58 | protected: 59 | virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support 60 | virtual BOOL OnCommand(WPARAM wParam, LPARAM lParam); 61 | //}}AFX_VIRTUAL 62 | 63 | // Implementation 64 | protected: 65 | 66 | // Generated message map functions 67 | //{{AFX_MSG(MemoryHack) 68 | virtual BOOL OnInitDialog(); 69 | afx_msg void OnClose(); 70 | afx_msg void OnCustomsearchRad(); 71 | afx_msg void OnFullsearchRad(); 72 | afx_msg void OnCustomizeBtn(); 73 | afx_msg void OnSearchBut(); 74 | afx_msg void OnReadValues(); 75 | afx_msg void OnRnfbut(); 76 | afx_msg void OnPatchbut(); 77 | afx_msg void OnRclickList2(NMHDR* pNMHDR, LRESULT* pResult); 78 | //}}AFX_MSG 79 | DECLARE_MESSAGE_MAP() 80 | }; 81 | 82 | //{{AFX_INSERT_LOCATION}} 83 | // Microsoft Visual C++ will insert additional declarations immediately before the previous line. 84 | 85 | #endif // !defined(AFX_MEMORYHACK_H__79FD0C8B_C9D1_43F7_AA43_3BAF860553AA__INCLUDED_) 86 | -------------------------------------------------------------------------------- /MemoryHacker/MemoryHacker.aps: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CodeCrackerSND/MemoryHacker/c31a58da22b056c677b0c018be80e79f64cd5d0e/MemoryHacker/MemoryHacker.aps -------------------------------------------------------------------------------- /MemoryHacker/MemoryHacker.clw: -------------------------------------------------------------------------------- 1 | ; CLW file contains information for the MFC ClassWizard 2 | 3 | [General Info] 4 | Version=1 5 | LastClass=InspectMemory 6 | LastTemplate=CDialog 7 | NewFileInclude1=#include "stdafx.h" 8 | NewFileInclude2=#include "MemoryHacker.h" 9 | 10 | ClassCount=8 11 | Class1=CMemoryHackerApp 12 | Class2=CMemoryHackerDlg 13 | 14 | ResourceCount=10 15 | Resource1=IDR_MAINFRAME 16 | Resource2=IDD_INSPECTMEMORY_DIALOG 17 | Resource3=IDD_MEMORYHACKER_DIALOG 18 | Class3=MemoryHack 19 | Resource4=IDD_MEMORYBLOCK_DIALOG 20 | Class4=NewEdit 21 | Class5=CCustomizeDlg 22 | Resource5=IDD_MEMORYHACK_DIALOG 23 | Resource6=IDR_PROCESS_MENU 24 | Class6=ModulesDlg 25 | Class7=MemoryBlock 26 | Resource7=IDD_CUSTOMIZEDLG_DIALOG 27 | Resource8=IDR_CUSTOM_MENU 28 | Resource9=IDD_MODULESDLG_DIALOG 29 | Class8=InspectMemory 30 | Resource10=IDR_MEMHACKMENU 31 | 32 | [CLS:CMemoryHackerApp] 33 | Type=0 34 | HeaderFile=MemoryHacker.h 35 | ImplementationFile=MemoryHacker.cpp 36 | Filter=N 37 | 38 | [CLS:CMemoryHackerDlg] 39 | Type=0 40 | HeaderFile=MemoryHackerDlg.h 41 | ImplementationFile=MemoryHackerDlg.cpp 42 | Filter=D 43 | LastObject=CMemoryHackerDlg 44 | BaseClass=CDialog 45 | VirtualFilter=dWC 46 | 47 | 48 | 49 | [DLG:IDD_MEMORYHACKER_DIALOG] 50 | Type=1 51 | Class=CMemoryHackerDlg 52 | ControlCount=1 53 | Control1=IDC_LIST1,SysListView32,1350631425 54 | 55 | [MNU:IDR_PROCESS_MENU] 56 | Type=1 57 | Class=? 58 | Command1=ID_PROCESS_MEMORYHACK 59 | Command2=ID_PROCESS_REFRESH 60 | CommandCount=2 61 | 62 | [DLG:IDD_MEMORYHACK_DIALOG] 63 | Type=1 64 | Class=MemoryHack 65 | ControlCount=17 66 | Control1=IDC_FULLSEARCH_RAD,button,1342177289 67 | Control2=IDC_CUSTOMSEARCH_RAD,button,1342177289 68 | Control3=IDC_CUSTOMIZE_BTN,button,1342242816 69 | Control4=IDC_STATIC,static,1342308352 70 | Control5=IDC_TYPE_COMBO,combobox,1344339970 71 | Control6=IDC_STATIC,static,1342308352 72 | Control7=IDC_BASE_COMBO,combobox,1344340226 73 | Control8=IDC_STATIC,static,1342308352 74 | Control9=IDC_VALUETOSEARCH_EDIT,edit,1350631552 75 | Control10=IDC_STATIC,static,1342308352 76 | Control11=IDC_NEWVALEDIT,edit,1350631552 77 | Control12=IDC_SEARCH_BUT,button,1342242816 78 | Control13=IDC_STATUS_STATIC,static,1342308352 79 | Control14=IDC_LIST2,SysListView32,1350631425 80 | Control15=IDC_READ_VALUES,button,1342242816 81 | Control16=IDC_RNFBUT,button,1342242816 82 | Control17=IDC_PATCHBUT,button,1342242816 83 | 84 | [CLS:MemoryHack] 85 | Type=0 86 | HeaderFile=MemoryHack.h 87 | ImplementationFile=MemoryHack.cpp 88 | BaseClass=CDialog 89 | Filter=D 90 | LastObject=IDC_LIST2 91 | VirtualFilter=dWC 92 | 93 | [DLG:IDD_CUSTOMIZEDLG_DIALOG] 94 | Type=1 95 | Class=CCustomizeDlg 96 | ControlCount=11 97 | Control1=IDC_STATIC,static,1342308352 98 | Control2=IDC_STARTA_EDIT,edit,1350631552 99 | Control3=IDC_STATIC,static,1342308352 100 | Control4=IDC_ENDA_EDIT,edit,1350631552 101 | Control5=IDC_PICK_START,button,1342242816 102 | Control6=IDC_PICK_END,button,1342242816 103 | Control7=IDC_MODULE_BUT,button,1342242816 104 | Control8=IDC_BLOCK_BUT,button,1342242816 105 | Control9=IDC_ADD_BUT,button,1342242816 106 | Control10=IDC_CLEARALL_BUT,button,1342242816 107 | Control11=IDC_LIST1,SysListView32,1350631425 108 | 109 | [CLS:CCustomizeDlg] 110 | Type=0 111 | HeaderFile=CustomizeDlg.h 112 | ImplementationFile=CustomizeDlg.cpp 113 | BaseClass=CDialog 114 | Filter=D 115 | LastObject=IDC_ADD_BUT 116 | VirtualFilter=dWC 117 | 118 | [CLS:NewEdit] 119 | Type=0 120 | HeaderFile=NewEdit.h 121 | ImplementationFile=NewEdit.cpp 122 | BaseClass=CEdit 123 | Filter=W 124 | LastObject=ID_PROCESS_MEMORYHACK 125 | 126 | [DLG:IDD_MODULESDLG_DIALOG] 127 | Type=1 128 | Class=ModulesDlg 129 | ControlCount=1 130 | Control1=IDC_LIST1,SysListView32,1350631425 131 | 132 | [CLS:ModulesDlg] 133 | Type=0 134 | HeaderFile=ModulesDlg.h 135 | ImplementationFile=ModulesDlg.cpp 136 | BaseClass=CDialog 137 | Filter=D 138 | VirtualFilter=dWC 139 | LastObject=IDC_LIST1 140 | 141 | [DLG:IDD_MEMORYBLOCK_DIALOG] 142 | Type=1 143 | Class=MemoryBlock 144 | ControlCount=1 145 | Control1=IDC_LIST1,SysListView32,1350631425 146 | 147 | [CLS:MemoryBlock] 148 | Type=0 149 | HeaderFile=MemoryBlock.h 150 | ImplementationFile=MemoryBlock.cpp 151 | BaseClass=CDialog 152 | Filter=D 153 | LastObject=MemoryBlock 154 | VirtualFilter=dWC 155 | 156 | [MNU:IDR_CUSTOM_MENU] 157 | Type=1 158 | Class=? 159 | Command1=ID_CUSTOMMENU_REMOVESELECTED 160 | CommandCount=1 161 | 162 | [MNU:IDR_MEMHACKMENU] 163 | Type=1 164 | Class=? 165 | Command1=ID_COPYSELECTED 166 | Command2=ID_REMOVESELECTED 167 | Command3=ID_PATCHSELECTED 168 | Command4=ID_INSPECTMEMORY 169 | CommandCount=4 170 | 171 | [DLG:IDD_INSPECTMEMORY_DIALOG] 172 | Type=1 173 | Class=InspectMemory 174 | ControlCount=7 175 | Control1=IDC_STATIC,static,1342308352 176 | Control2=IDC_EDIT1,edit,1350631552 177 | Control3=IDC_STATIC,static,1342308352 178 | Control4=IDC_EDIT_BRBYTES,edit,1350631552 179 | Control5=IDC_INSPECTBUT,button,1342242816 180 | Control6=IDC_EDIT_RESULT,edit,1352728708 181 | Control7=IDC_STATIC,static,1342308352 182 | 183 | [CLS:InspectMemory] 184 | Type=0 185 | HeaderFile=InspectMemory.h 186 | ImplementationFile=InspectMemory.cpp 187 | BaseClass=CDialog 188 | Filter=D 189 | VirtualFilter=dWC 190 | LastObject=InspectMemory 191 | 192 | -------------------------------------------------------------------------------- /MemoryHacker/MemoryHacker.cpp: -------------------------------------------------------------------------------- 1 | // MemoryHacker.cpp : Defines the class behaviors for the application. 2 | // 3 | 4 | #include "stdafx.h" 5 | #include "MemoryHacker.h" 6 | #include "MemoryHackerDlg.h" 7 | 8 | #ifdef _DEBUG 9 | #define new DEBUG_NEW 10 | #undef THIS_FILE 11 | static char THIS_FILE[] = __FILE__; 12 | #endif 13 | 14 | ///////////////////////////////////////////////////////////////////////////// 15 | // CMemoryHackerApp 16 | 17 | BEGIN_MESSAGE_MAP(CMemoryHackerApp, CWinApp) 18 | //{{AFX_MSG_MAP(CMemoryHackerApp) 19 | // NOTE - the ClassWizard will add and remove mapping macros here. 20 | // DO NOT EDIT what you see in these blocks of generated code! 21 | //}}AFX_MSG 22 | ON_COMMAND(ID_HELP, CWinApp::OnHelp) 23 | END_MESSAGE_MAP() 24 | 25 | ///////////////////////////////////////////////////////////////////////////// 26 | // CMemoryHackerApp construction 27 | 28 | CMemoryHackerApp::CMemoryHackerApp() 29 | { 30 | // TODO: add construction code here, 31 | // Place all significant initialization in InitInstance 32 | } 33 | 34 | ///////////////////////////////////////////////////////////////////////////// 35 | // The one and only CMemoryHackerApp object 36 | 37 | CMemoryHackerApp theApp; 38 | 39 | ///////////////////////////////////////////////////////////////////////////// 40 | // CMemoryHackerApp initialization 41 | 42 | BOOL CMemoryHackerApp::InitInstance() 43 | { 44 | // Standard initialization 45 | // If you are not using these features and wish to reduce the size 46 | // of your final executable, you should remove from the following 47 | // the specific initialization routines you do not need. 48 | 49 | CMemoryHackerDlg dlg; 50 | m_pMainWnd = &dlg; 51 | int nResponse = dlg.DoModal(); 52 | if (nResponse == IDOK) 53 | { 54 | // TODO: Place code here to handle when the dialog is 55 | // dismissed with OK 56 | } 57 | else if (nResponse == IDCANCEL) 58 | { 59 | // TODO: Place code here to handle when the dialog is 60 | // dismissed with Cancel 61 | } 62 | 63 | // Since the dialog has been closed, return FALSE so that we exit the 64 | // application, rather than start the application's message pump. 65 | return FALSE; 66 | } 67 | -------------------------------------------------------------------------------- /MemoryHacker/MemoryHacker.dsp: -------------------------------------------------------------------------------- 1 | # Microsoft Developer Studio Project File - Name="MemoryHacker" - Package Owner=<4> 2 | # Microsoft Developer Studio Generated Build File, Format Version 6.00 3 | # ** DO NOT EDIT ** 4 | 5 | # TARGTYPE "Win32 (x86) Application" 0x0101 6 | 7 | CFG=MemoryHacker - Win32 Debug 8 | !MESSAGE This is not a valid makefile. To build this project using NMAKE, 9 | !MESSAGE use the Export Makefile command and run 10 | !MESSAGE 11 | !MESSAGE NMAKE /f "MemoryHacker.mak". 12 | !MESSAGE 13 | !MESSAGE You can specify a configuration when running NMAKE 14 | !MESSAGE by defining the macro CFG on the command line. For example: 15 | !MESSAGE 16 | !MESSAGE NMAKE /f "MemoryHacker.mak" CFG="MemoryHacker - Win32 Debug" 17 | !MESSAGE 18 | !MESSAGE Possible choices for configuration are: 19 | !MESSAGE 20 | !MESSAGE "MemoryHacker - Win32 Release" (based on "Win32 (x86) Application") 21 | !MESSAGE "MemoryHacker - Win32 Debug" (based on "Win32 (x86) Application") 22 | !MESSAGE 23 | 24 | # Begin Project 25 | # PROP AllowPerConfigDependencies 0 26 | # PROP Scc_ProjName "" 27 | # PROP Scc_LocalPath "" 28 | CPP=cl.exe 29 | MTL=midl.exe 30 | RSC=rc.exe 31 | 32 | !IF "$(CFG)" == "MemoryHacker - Win32 Release" 33 | 34 | # PROP BASE Use_MFC 6 35 | # PROP BASE Use_Debug_Libraries 0 36 | # PROP BASE Output_Dir "Release" 37 | # PROP BASE Intermediate_Dir "Release" 38 | # PROP BASE Target_Dir "" 39 | # PROP Use_MFC 6 40 | # PROP Use_Debug_Libraries 0 41 | # PROP Output_Dir "Release" 42 | # PROP Intermediate_Dir "Release" 43 | # PROP Target_Dir "" 44 | # ADD BASE CPP /nologo /MD /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_AFXDLL" /Yu"stdafx.h" /FD /c 45 | # ADD CPP /nologo /MD /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_AFXDLL" /D "_MBCS" /Yu"stdafx.h" /FD /c 46 | # ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32 47 | # ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32 48 | # ADD BASE RSC /l 0x409 /d "NDEBUG" /d "_AFXDLL" 49 | # ADD RSC /l 0x409 /d "NDEBUG" /d "_AFXDLL" 50 | BSC32=bscmake.exe 51 | # ADD BASE BSC32 /nologo 52 | # ADD BSC32 /nologo 53 | LINK32=link.exe 54 | # ADD BASE LINK32 /nologo /subsystem:windows /machine:I386 55 | # ADD LINK32 /nologo /subsystem:windows /machine:I386 56 | 57 | !ELSEIF "$(CFG)" == "MemoryHacker - Win32 Debug" 58 | 59 | # PROP BASE Use_MFC 6 60 | # PROP BASE Use_Debug_Libraries 1 61 | # PROP BASE Output_Dir "Debug" 62 | # PROP BASE Intermediate_Dir "Debug" 63 | # PROP BASE Target_Dir "" 64 | # PROP Use_MFC 6 65 | # PROP Use_Debug_Libraries 1 66 | # PROP Output_Dir "Debug" 67 | # PROP Intermediate_Dir "Debug" 68 | # PROP Target_Dir "" 69 | # ADD BASE CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_AFXDLL" /Yu"stdafx.h" /FD /GZ /c 70 | # ADD CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_AFXDLL" /D "_MBCS" /Yu"stdafx.h" /FD /GZ /c 71 | # ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32 72 | # ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32 73 | # ADD BASE RSC /l 0x409 /d "_DEBUG" /d "_AFXDLL" 74 | # ADD RSC /l 0x409 /d "_DEBUG" /d "_AFXDLL" 75 | BSC32=bscmake.exe 76 | # ADD BASE BSC32 /nologo 77 | # ADD BSC32 /nologo 78 | LINK32=link.exe 79 | # ADD BASE LINK32 /nologo /subsystem:windows /debug /machine:I386 /pdbtype:sept 80 | # ADD LINK32 /nologo /subsystem:windows /debug /machine:I386 /pdbtype:sept 81 | 82 | !ENDIF 83 | 84 | # Begin Target 85 | 86 | # Name "MemoryHacker - Win32 Release" 87 | # Name "MemoryHacker - Win32 Debug" 88 | # Begin Group "Source Files" 89 | 90 | # PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat" 91 | # Begin Source File 92 | 93 | SOURCE=.\CustomizeDlg.cpp 94 | # End Source File 95 | # Begin Source File 96 | 97 | SOURCE=.\GenericPurposeMethods.cpp 98 | # End Source File 99 | # Begin Source File 100 | 101 | SOURCE=.\InspectMemory.cpp 102 | # End Source File 103 | # Begin Source File 104 | 105 | SOURCE=.\MemoryBlock.cpp 106 | # End Source File 107 | # Begin Source File 108 | 109 | SOURCE=.\MemoryHack.cpp 110 | # End Source File 111 | # Begin Source File 112 | 113 | SOURCE=.\MemoryHacker.cpp 114 | # End Source File 115 | # Begin Source File 116 | 117 | SOURCE=.\MemoryHacker.rc 118 | # End Source File 119 | # Begin Source File 120 | 121 | SOURCE=.\MemoryHackerDlg.cpp 122 | # End Source File 123 | # Begin Source File 124 | 125 | SOURCE=.\ModulesDlg.cpp 126 | # End Source File 127 | # Begin Source File 128 | 129 | SOURCE=.\NewEdit.cpp 130 | # End Source File 131 | # Begin Source File 132 | 133 | SOURCE=.\StdAfx.cpp 134 | # ADD CPP /Yc"stdafx.h" 135 | # End Source File 136 | # End Group 137 | # Begin Group "Header Files" 138 | 139 | # PROP Default_Filter "h;hpp;hxx;hm;inl" 140 | # Begin Source File 141 | 142 | SOURCE=.\CustomizeDlg.h 143 | # End Source File 144 | # Begin Source File 145 | 146 | SOURCE=.\GenericPurposeMethods.h 147 | # End Source File 148 | # Begin Source File 149 | 150 | SOURCE=.\InspectMemory.h 151 | # End Source File 152 | # Begin Source File 153 | 154 | SOURCE=.\MemoryBlock.h 155 | # End Source File 156 | # Begin Source File 157 | 158 | SOURCE=.\MemoryHack.h 159 | # End Source File 160 | # Begin Source File 161 | 162 | SOURCE=.\MemoryHacker.h 163 | # End Source File 164 | # Begin Source File 165 | 166 | SOURCE=.\MemoryHackerDlg.h 167 | # End Source File 168 | # Begin Source File 169 | 170 | SOURCE=.\ModulesDlg.h 171 | # End Source File 172 | # Begin Source File 173 | 174 | SOURCE=.\NewEdit.h 175 | # End Source File 176 | # Begin Source File 177 | 178 | SOURCE=.\Resource.h 179 | # End Source File 180 | # Begin Source File 181 | 182 | SOURCE=.\StdAfx.h 183 | # End Source File 184 | # End Group 185 | # Begin Group "Resource Files" 186 | 187 | # PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe" 188 | # Begin Source File 189 | 190 | SOURCE=.\res\MemoryHacker.ico 191 | # End Source File 192 | # Begin Source File 193 | 194 | SOURCE=.\res\MemoryHacker.rc2 195 | # End Source File 196 | # End Group 197 | # Begin Source File 198 | 199 | SOURCE=.\ReadMe.txt 200 | # End Source File 201 | # End Target 202 | # End Project 203 | -------------------------------------------------------------------------------- /MemoryHacker/MemoryHacker.dsw: -------------------------------------------------------------------------------- 1 | Microsoft Developer Studio Workspace File, Format Version 6.00 2 | # WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE! 3 | 4 | ############################################################################### 5 | 6 | Project: "MemoryHacker"=.\MemoryHacker.dsp - Package Owner=<4> 7 | 8 | Package=<5> 9 | {{{ 10 | }}} 11 | 12 | Package=<4> 13 | {{{ 14 | }}} 15 | 16 | ############################################################################### 17 | 18 | Global: 19 | 20 | Package=<5> 21 | {{{ 22 | }}} 23 | 24 | Package=<3> 25 | {{{ 26 | }}} 27 | 28 | ############################################################################### 29 | 30 | -------------------------------------------------------------------------------- /MemoryHacker/MemoryHacker.h: -------------------------------------------------------------------------------- 1 | // MemoryHacker.h : main header file for the MEMORYHACKER application 2 | // 3 | 4 | #if !defined(AFX_MEMORYHACKER_H__F4A35146_CD97_41C6_9C61_9DC5665E0343__INCLUDED_) 5 | #define AFX_MEMORYHACKER_H__F4A35146_CD97_41C6_9C61_9DC5665E0343__INCLUDED_ 6 | 7 | #if _MSC_VER > 1000 8 | #pragma once 9 | #endif // _MSC_VER > 1000 10 | 11 | #ifndef __AFXWIN_H__ 12 | #error include 'stdafx.h' before including this file for PCH 13 | #endif 14 | 15 | #include "resource.h" // main symbols 16 | 17 | ///////////////////////////////////////////////////////////////////////////// 18 | // CMemoryHackerApp: 19 | // See MemoryHacker.cpp for the implementation of this class 20 | // 21 | 22 | class CMemoryHackerApp : public CWinApp 23 | { 24 | public: 25 | CMemoryHackerApp(); 26 | 27 | // Overrides 28 | // ClassWizard generated virtual function overrides 29 | //{{AFX_VIRTUAL(CMemoryHackerApp) 30 | public: 31 | virtual BOOL InitInstance(); 32 | //}}AFX_VIRTUAL 33 | 34 | // Implementation 35 | 36 | //{{AFX_MSG(CMemoryHackerApp) 37 | // NOTE - the ClassWizard will add and remove member functions here. 38 | // DO NOT EDIT what you see in these blocks of generated code ! 39 | //}}AFX_MSG 40 | DECLARE_MESSAGE_MAP() 41 | }; 42 | 43 | 44 | ///////////////////////////////////////////////////////////////////////////// 45 | 46 | //{{AFX_INSERT_LOCATION}} 47 | // Microsoft Visual C++ will insert additional declarations immediately before the previous line. 48 | 49 | #endif // !defined(AFX_MEMORYHACKER_H__F4A35146_CD97_41C6_9C61_9DC5665E0343__INCLUDED_) 50 | -------------------------------------------------------------------------------- /MemoryHacker/MemoryHacker.ncb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CodeCrackerSND/MemoryHacker/c31a58da22b056c677b0c018be80e79f64cd5d0e/MemoryHacker/MemoryHacker.ncb -------------------------------------------------------------------------------- /MemoryHacker/MemoryHacker.opt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CodeCrackerSND/MemoryHacker/c31a58da22b056c677b0c018be80e79f64cd5d0e/MemoryHacker/MemoryHacker.opt -------------------------------------------------------------------------------- /MemoryHacker/MemoryHacker.plg: -------------------------------------------------------------------------------- 1 | 2 | 3 |
  4 | 

Build Log

5 |

6 | --------------------Configuration: MemoryHacker - Win32 Release-------------------- 7 |

8 |

Command Lines

9 | Creating command line "rc.exe /l 0x409 /fo"Release/MemoryHacker.res" /d "NDEBUG" /d "_AFXDLL" "D:\NewProjects\Native\MemoryHacker\MemoryHacker.rc"" 10 | Creating temporary file "C:\Users\Mihai\AppData\Local\Temp\RSPC31.tmp" with contents 11 | [ 12 | /nologo /MD /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_AFXDLL" /D "_MBCS" /Fp"Release/MemoryHacker.pch" /Yu"stdafx.h" /Fo"Release/" /Fd"Release/" /FD /c 13 | "D:\NewProjects\Native\MemoryHacker\CustomizeDlg.cpp" 14 | "D:\NewProjects\Native\MemoryHacker\GenericPurposeMethods.cpp" 15 | "D:\NewProjects\Native\MemoryHacker\InspectMemory.cpp" 16 | "D:\NewProjects\Native\MemoryHacker\MemoryBlock.cpp" 17 | "D:\NewProjects\Native\MemoryHacker\MemoryHack.cpp" 18 | "D:\NewProjects\Native\MemoryHacker\MemoryHacker.cpp" 19 | "D:\NewProjects\Native\MemoryHacker\MemoryHackerDlg.cpp" 20 | "D:\NewProjects\Native\MemoryHacker\ModulesDlg.cpp" 21 | "D:\NewProjects\Native\MemoryHacker\NewEdit.cpp" 22 | ] 23 | Creating command line "cl.exe @C:\Users\Mihai\AppData\Local\Temp\RSPC31.tmp" 24 | Creating temporary file "C:\Users\Mihai\AppData\Local\Temp\RSPC41.tmp" with contents 25 | [ 26 | /nologo /MD /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_AFXDLL" /D "_MBCS" /Fp"Release/MemoryHacker.pch" /Yc"stdafx.h" /Fo"Release/" /Fd"Release/" /FD /c 27 | "D:\NewProjects\Native\MemoryHacker\StdAfx.cpp" 28 | ] 29 | Creating command line "cl.exe @C:\Users\Mihai\AppData\Local\Temp\RSPC41.tmp" 30 | Creating temporary file "C:\Users\Mihai\AppData\Local\Temp\RSPC42.tmp" with contents 31 | [ 32 | /nologo /subsystem:windows /incremental:no /pdb:"Release/MemoryHacker.pdb" /machine:I386 /out:"Release/MemoryHacker.exe" 33 | .\Release\CustomizeDlg.obj 34 | .\Release\GenericPurposeMethods.obj 35 | .\Release\InspectMemory.obj 36 | .\Release\MemoryBlock.obj 37 | .\Release\MemoryHack.obj 38 | .\Release\MemoryHacker.obj 39 | .\Release\MemoryHackerDlg.obj 40 | .\Release\ModulesDlg.obj 41 | .\Release\NewEdit.obj 42 | .\Release\StdAfx.obj 43 | .\Release\MemoryHacker.res 44 | ] 45 | Creating command line "link.exe @C:\Users\Mihai\AppData\Local\Temp\RSPC42.tmp" 46 |

Output Window

47 | Compiling resources... 48 | Compiling... 49 | StdAfx.cpp 50 | Compiling... 51 | CustomizeDlg.cpp 52 | GenericPurposeMethods.cpp 53 | InspectMemory.cpp 54 | MemoryBlock.cpp 55 | MemoryHack.cpp 56 | MemoryHacker.cpp 57 | MemoryHackerDlg.cpp 58 | ModulesDlg.cpp 59 | NewEdit.cpp 60 | Generating Code... 61 | Linking... 62 | 63 | 64 | 65 |

Results

66 | MemoryHacker.exe - 0 error(s), 0 warning(s) 67 |

68 | --------------------Configuration: MemoryHacker - Win32 Debug-------------------- 69 |

70 |

Command Lines

71 | Creating command line "rc.exe /l 0x409 /fo"Debug/MemoryHacker.res" /d "_DEBUG" /d "_AFXDLL" "D:\NewProjects\Native\MemoryHacker\MemoryHacker.rc"" 72 | Creating temporary file "C:\Users\Mihai\AppData\Local\Temp\RSP1EBA.tmp" with contents 73 | [ 74 | /nologo /MDd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_AFXDLL" /D "_MBCS" /Fp"Debug/MemoryHacker.pch" /Yu"stdafx.h" /Fo"Debug/" /Fd"Debug/" /FD /GZ /c 75 | "D:\NewProjects\Native\MemoryHacker\CustomizeDlg.cpp" 76 | "D:\NewProjects\Native\MemoryHacker\GenericPurposeMethods.cpp" 77 | "D:\NewProjects\Native\MemoryHacker\InspectMemory.cpp" 78 | "D:\NewProjects\Native\MemoryHacker\MemoryBlock.cpp" 79 | "D:\NewProjects\Native\MemoryHacker\MemoryHack.cpp" 80 | "D:\NewProjects\Native\MemoryHacker\MemoryHacker.cpp" 81 | "D:\NewProjects\Native\MemoryHacker\MemoryHackerDlg.cpp" 82 | "D:\NewProjects\Native\MemoryHacker\ModulesDlg.cpp" 83 | "D:\NewProjects\Native\MemoryHacker\NewEdit.cpp" 84 | ] 85 | Creating command line "cl.exe @C:\Users\Mihai\AppData\Local\Temp\RSP1EBA.tmp" 86 | Creating temporary file "C:\Users\Mihai\AppData\Local\Temp\RSP1EBB.tmp" with contents 87 | [ 88 | /nologo /MDd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_AFXDLL" /D "_MBCS" /Fp"Debug/MemoryHacker.pch" /Yc"stdafx.h" /Fo"Debug/" /Fd"Debug/" /FD /GZ /c 89 | "D:\NewProjects\Native\MemoryHacker\StdAfx.cpp" 90 | ] 91 | Creating command line "cl.exe @C:\Users\Mihai\AppData\Local\Temp\RSP1EBB.tmp" 92 | Creating temporary file "C:\Users\Mihai\AppData\Local\Temp\RSP1EBC.tmp" with contents 93 | [ 94 | /nologo /subsystem:windows /incremental:yes /pdb:"Debug/MemoryHacker.pdb" /debug /machine:I386 /out:"Debug/MemoryHacker.exe" /pdbtype:sept 95 | .\Debug\CustomizeDlg.obj 96 | .\Debug\GenericPurposeMethods.obj 97 | .\Debug\InspectMemory.obj 98 | .\Debug\MemoryBlock.obj 99 | .\Debug\MemoryHack.obj 100 | .\Debug\MemoryHacker.obj 101 | .\Debug\MemoryHackerDlg.obj 102 | .\Debug\ModulesDlg.obj 103 | .\Debug\NewEdit.obj 104 | .\Debug\StdAfx.obj 105 | .\Debug\MemoryHacker.res 106 | ] 107 | Creating command line "link.exe @C:\Users\Mihai\AppData\Local\Temp\RSP1EBC.tmp" 108 |

Output Window

109 | Compiling resources... 110 | Compiling... 111 | StdAfx.cpp 112 | Compiling... 113 | CustomizeDlg.cpp 114 | GenericPurposeMethods.cpp 115 | InspectMemory.cpp 116 | MemoryBlock.cpp 117 | MemoryHack.cpp 118 | MemoryHacker.cpp 119 | MemoryHackerDlg.cpp 120 | ModulesDlg.cpp 121 | NewEdit.cpp 122 | Generating Code... 123 | Linking... 124 | 125 | 126 | 127 |

Results

128 | MemoryHacker.exe - 0 error(s), 0 warning(s) 129 |
130 | 131 | 132 | -------------------------------------------------------------------------------- /MemoryHacker/MemoryHacker.rc: -------------------------------------------------------------------------------- 1 | //Microsoft Developer Studio generated resource script. 2 | // 3 | #include "resource.h" 4 | 5 | #define APSTUDIO_READONLY_SYMBOLS 6 | ///////////////////////////////////////////////////////////////////////////// 7 | // 8 | // Generated from the TEXTINCLUDE 2 resource. 9 | // 10 | #include "afxres.h" 11 | 12 | ///////////////////////////////////////////////////////////////////////////// 13 | #undef APSTUDIO_READONLY_SYMBOLS 14 | 15 | ///////////////////////////////////////////////////////////////////////////// 16 | // English (U.S.) resources 17 | 18 | #if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU) 19 | #ifdef _WIN32 20 | LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US 21 | #pragma code_page(1252) 22 | #endif //_WIN32 23 | 24 | #ifdef APSTUDIO_INVOKED 25 | ///////////////////////////////////////////////////////////////////////////// 26 | // 27 | // TEXTINCLUDE 28 | // 29 | 30 | 1 TEXTINCLUDE DISCARDABLE 31 | BEGIN 32 | "resource.h\0" 33 | END 34 | 35 | 2 TEXTINCLUDE DISCARDABLE 36 | BEGIN 37 | "#include ""afxres.h""\r\n" 38 | "\0" 39 | END 40 | 41 | 3 TEXTINCLUDE DISCARDABLE 42 | BEGIN 43 | "#define _AFX_NO_SPLITTER_RESOURCES\r\n" 44 | "#define _AFX_NO_OLE_RESOURCES\r\n" 45 | "#define _AFX_NO_TRACKER_RESOURCES\r\n" 46 | "#define _AFX_NO_PROPERTY_RESOURCES\r\n" 47 | "\r\n" 48 | "#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)\r\n" 49 | "#ifdef _WIN32\r\n" 50 | "LANGUAGE 9, 1\r\n" 51 | "#pragma code_page(1252)\r\n" 52 | "#endif //_WIN32\r\n" 53 | "#include ""res\\MemoryHacker.rc2"" // non-Microsoft Visual C++ edited resources\r\n" 54 | "#include ""afxres.rc"" // Standard components\r\n" 55 | "#endif\r\n" 56 | "\0" 57 | END 58 | 59 | #endif // APSTUDIO_INVOKED 60 | 61 | 62 | ///////////////////////////////////////////////////////////////////////////// 63 | // 64 | // Icon 65 | // 66 | 67 | // Icon with lowest ID value placed first to ensure application icon 68 | // remains consistent on all systems. 69 | IDR_MAINFRAME ICON DISCARDABLE "res\\MemoryHacker.ico" 70 | 71 | ///////////////////////////////////////////////////////////////////////////// 72 | // 73 | // Dialog 74 | // 75 | 76 | IDD_MEMORYHACKER_DIALOG DIALOGEX 0, 0, 320, 313 77 | STYLE DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU 78 | EXSTYLE WS_EX_APPWINDOW 79 | CAPTION "MemoryHacker by CodeCracker / SnD" 80 | FONT 8, "MS Sans Serif", 0, 0, 0x1 81 | BEGIN 82 | CONTROL "List1",IDC_LIST1,"SysListView32",LVS_REPORT | WS_BORDER | 83 | WS_TABSTOP,7,7,306,299 84 | END 85 | 86 | IDD_MEMORYHACK_DIALOG DIALOG DISCARDABLE 0, 0, 320, 250 87 | STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU 88 | CAPTION "Memory hacker for " 89 | FONT 8, "MS Sans Serif" 90 | BEGIN 91 | CONTROL "Full search",IDC_FULLSEARCH_RAD,"Button", 92 | BS_AUTORADIOBUTTON,15,14,50,10 93 | CONTROL "Custom search",IDC_CUSTOMSEARCH_RAD,"Button", 94 | BS_AUTORADIOBUTTON,70,15,63,10 95 | PUSHBUTTON "Customize",IDC_CUSTOMIZE_BTN,137,14,50,14 96 | LTEXT "Type:",IDC_STATIC,17,31,19,8 97 | COMBOBOX IDC_TYPE_COMBO,18,42,80,50,CBS_DROPDOWN | WS_VSCROLL | 98 | WS_TABSTOP 99 | LTEXT "Base:",IDC_STATIC,106,30,19,8 100 | COMBOBOX IDC_BASE_COMBO,104,41,64,50,CBS_DROPDOWN | CBS_SORT | 101 | WS_VSCROLL | WS_TABSTOP 102 | LTEXT "Value to search:",IDC_STATIC,19,60,52,8 103 | EDITTEXT IDC_VALUETOSEARCH_EDIT,19,71,237,14,ES_AUTOHSCROLL 104 | LTEXT "New value:",IDC_STATIC,20,90,37,8 105 | EDITTEXT IDC_NEWVALEDIT,20,100,238,14,ES_AUTOHSCROLL 106 | PUSHBUTTON "Search",IDC_SEARCH_BUT,20,119,50,14 107 | LTEXT "Status",IDC_STATUS_STATIC,23,140,159,8 108 | CONTROL "List2",IDC_LIST2,"SysListView32",LVS_REPORT | WS_BORDER | 109 | WS_TABSTOP,21,159,233,78 110 | PUSHBUTTON "Read",IDC_READ_VALUES,75,119,50,14 111 | PUSHBUTTON "Remove Not Found",IDC_RNFBUT,129,119,73,14 112 | PUSHBUTTON "Patch",IDC_PATCHBUT,207,119,50,14 113 | END 114 | 115 | IDD_CUSTOMIZEDLG_DIALOG DIALOG DISCARDABLE 0, 0, 222, 201 116 | STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU 117 | CAPTION "Customize" 118 | FONT 8, "MS Sans Serif" 119 | BEGIN 120 | LTEXT "Start Address:",IDC_STATIC,49,17,45,8 121 | EDITTEXT IDC_STARTA_EDIT,49,30,57,14,ES_AUTOHSCROLL 122 | LTEXT "End Address:",IDC_STATIC,51,51,43,8 123 | EDITTEXT IDC_ENDA_EDIT,50,65,55,14,ES_AUTOHSCROLL 124 | PUSHBUTTON "...",IDC_PICK_START,27,30,20,14 125 | PUSHBUTTON "...",IDC_PICK_END,27,64,20,14 126 | PUSHBUTTON "Module",IDC_MODULE_BUT,107,14,41,14 127 | PUSHBUTTON "Block",IDC_BLOCK_BUT,155,14,33,14 128 | PUSHBUTTON "Add",IDC_ADD_BUT,29,90,50,14 129 | PUSHBUTTON "Clear All",IDC_CLEARALL_BUT,88,90,50,14 130 | CONTROL "List1",IDC_LIST1,"SysListView32",LVS_REPORT | WS_BORDER | 131 | WS_TABSTOP,31,115,151,70 132 | END 133 | 134 | IDD_MODULESDLG_DIALOG DIALOG DISCARDABLE 0, 0, 320, 313 135 | STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU 136 | CAPTION "Modules" 137 | FONT 8, "MS Sans Serif" 138 | BEGIN 139 | CONTROL "List1",IDC_LIST1,"SysListView32",LVS_REPORT | WS_BORDER | 140 | WS_TABSTOP,7,7,306,299 141 | END 142 | 143 | IDD_MEMORYBLOCK_DIALOG DIALOG DISCARDABLE 0, 0, 320, 313 144 | STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU 145 | CAPTION "Memory Block" 146 | FONT 8, "MS Sans Serif" 147 | BEGIN 148 | CONTROL "List1",IDC_LIST1,"SysListView32",LVS_REPORT | WS_BORDER | 149 | WS_TABSTOP,7,7,306,299 150 | END 151 | 152 | IDD_INSPECTMEMORY_DIALOG DIALOG DISCARDABLE 0, 0, 320, 201 153 | STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU 154 | CAPTION "Inspect Memory:" 155 | FONT 8, "MS Sans Serif" 156 | BEGIN 157 | LTEXT "Address:",IDC_STATIC,31,15,28,8 158 | EDITTEXT IDC_EDIT1,27,25,121,14,ES_AUTOHSCROLL 159 | LTEXT "Number of bytes (dec):",IDC_STATIC,30,46,72,8 160 | EDITTEXT IDC_EDIT_BRBYTES,27,54,121,14,ES_AUTOHSCROLL 161 | PUSHBUTTON "Inspect",IDC_INSPECTBUT,27,78,50,14 162 | EDITTEXT IDC_EDIT_RESULT,26,112,192,51,ES_MULTILINE | 163 | ES_AUTOHSCROLL | WS_VSCROLL 164 | LTEXT "Value:",IDC_STATIC,31,102,21,8 165 | END 166 | 167 | 168 | #ifndef _MAC 169 | ///////////////////////////////////////////////////////////////////////////// 170 | // 171 | // Version 172 | // 173 | 174 | VS_VERSION_INFO VERSIONINFO 175 | FILEVERSION 1,0,0,1 176 | PRODUCTVERSION 1,0,0,1 177 | FILEFLAGSMASK 0x3fL 178 | #ifdef _DEBUG 179 | FILEFLAGS 0x1L 180 | #else 181 | FILEFLAGS 0x0L 182 | #endif 183 | FILEOS 0x4L 184 | FILETYPE 0x1L 185 | FILESUBTYPE 0x0L 186 | BEGIN 187 | BLOCK "StringFileInfo" 188 | BEGIN 189 | BLOCK "040904B0" 190 | BEGIN 191 | VALUE "CompanyName", "\0" 192 | VALUE "FileDescription", "MemoryHacker MFC Application\0" 193 | VALUE "FileVersion", "1, 0, 0, 1\0" 194 | VALUE "InternalName", "MemoryHacker\0" 195 | VALUE "LegalCopyright", "Copyright (C) 2016\0" 196 | VALUE "LegalTrademarks", "\0" 197 | VALUE "OriginalFilename", "MemoryHacker.EXE\0" 198 | VALUE "ProductName", "MemoryHacker Application\0" 199 | VALUE "ProductVersion", "1, 0, 0, 1\0" 200 | END 201 | END 202 | BLOCK "VarFileInfo" 203 | BEGIN 204 | VALUE "Translation", 0x409, 1200 205 | END 206 | END 207 | 208 | #endif // !_MAC 209 | 210 | 211 | ///////////////////////////////////////////////////////////////////////////// 212 | // 213 | // DESIGNINFO 214 | // 215 | 216 | #ifdef APSTUDIO_INVOKED 217 | GUIDELINES DESIGNINFO DISCARDABLE 218 | BEGIN 219 | IDD_MEMORYHACKER_DIALOG, DIALOG 220 | BEGIN 221 | LEFTMARGIN, 7 222 | RIGHTMARGIN, 313 223 | TOPMARGIN, 7 224 | BOTTOMMARGIN, 193 225 | END 226 | 227 | IDD_MEMORYHACK_DIALOG, DIALOG 228 | BEGIN 229 | LEFTMARGIN, 7 230 | RIGHTMARGIN, 313 231 | TOPMARGIN, 7 232 | BOTTOMMARGIN, 243 233 | END 234 | 235 | IDD_CUSTOMIZEDLG_DIALOG, DIALOG 236 | BEGIN 237 | LEFTMARGIN, 7 238 | RIGHTMARGIN, 215 239 | TOPMARGIN, 7 240 | BOTTOMMARGIN, 194 241 | END 242 | 243 | IDD_MODULESDLG_DIALOG, DIALOG 244 | BEGIN 245 | LEFTMARGIN, 7 246 | RIGHTMARGIN, 313 247 | TOPMARGIN, 7 248 | BOTTOMMARGIN, 194 249 | END 250 | 251 | IDD_MEMORYBLOCK_DIALOG, DIALOG 252 | BEGIN 253 | LEFTMARGIN, 7 254 | RIGHTMARGIN, 313 255 | TOPMARGIN, 7 256 | BOTTOMMARGIN, 194 257 | END 258 | 259 | IDD_INSPECTMEMORY_DIALOG, DIALOG 260 | BEGIN 261 | LEFTMARGIN, 7 262 | RIGHTMARGIN, 313 263 | TOPMARGIN, 7 264 | BOTTOMMARGIN, 194 265 | END 266 | END 267 | #endif // APSTUDIO_INVOKED 268 | 269 | 270 | ///////////////////////////////////////////////////////////////////////////// 271 | // 272 | // Menu 273 | // 274 | 275 | IDR_PROCESS_MENU MENU DISCARDABLE 276 | BEGIN 277 | POPUP "Process" 278 | BEGIN 279 | MENUITEM "Memory hack", ID_PROCESS_MEMORYHACK 280 | MENUITEM "Refresh", ID_PROCESS_REFRESH 281 | END 282 | END 283 | 284 | IDR_CUSTOM_MENU MENU DISCARDABLE 285 | BEGIN 286 | POPUP "Custom menu" 287 | BEGIN 288 | MENUITEM "Remove selected", ID_CUSTOMMENU_REMOVESELECTED 289 | END 290 | END 291 | 292 | IDR_MEMHACKMENU MENU DISCARDABLE 293 | BEGIN 294 | POPUP "Memory Hacker Menu" 295 | BEGIN 296 | MENUITEM "Copy Selected", ID_COPYSELECTED 297 | MENUITEM "Remove Selected", ID_REMOVESELECTED 298 | MENUITEM "Patch Selected", ID_PATCHSELECTED 299 | MENUITEM "Inspect Memory", ID_INSPECTMEMORY 300 | END 301 | END 302 | 303 | #endif // English (U.S.) resources 304 | ///////////////////////////////////////////////////////////////////////////// 305 | 306 | 307 | 308 | #ifndef APSTUDIO_INVOKED 309 | ///////////////////////////////////////////////////////////////////////////// 310 | // 311 | // Generated from the TEXTINCLUDE 3 resource. 312 | // 313 | #define _AFX_NO_SPLITTER_RESOURCES 314 | #define _AFX_NO_OLE_RESOURCES 315 | #define _AFX_NO_TRACKER_RESOURCES 316 | #define _AFX_NO_PROPERTY_RESOURCES 317 | 318 | #if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU) 319 | #ifdef _WIN32 320 | LANGUAGE 9, 1 321 | #pragma code_page(1252) 322 | #endif //_WIN32 323 | #include "res\MemoryHacker.rc2" // non-Microsoft Visual C++ edited resources 324 | #include "afxres.rc" // Standard components 325 | #endif 326 | 327 | ///////////////////////////////////////////////////////////////////////////// 328 | #endif // not APSTUDIO_INVOKED 329 | 330 | -------------------------------------------------------------------------------- /MemoryHacker/MemoryHackerDlg.cpp: -------------------------------------------------------------------------------- 1 | // MemoryHackerDlg.cpp : implementation file 2 | // 3 | 4 | #include "stdafx.h" 5 | #include "MemoryHacker.h" 6 | #include "MemoryHackerDlg.h" 7 | #include "GenericPurposeMethods.h" 8 | 9 | #include "C:\Program Files (x86)\Microsoft SDK\include\Psapi.h" 10 | #pragma comment (lib, "Psapi.lib") 11 | 12 | #ifdef _DEBUG 13 | #define new DEBUG_NEW 14 | #undef THIS_FILE 15 | static char THIS_FILE[] = __FILE__; 16 | #endif 17 | 18 | ///////////////////////////////////////////////////////////////////////////// 19 | // CMemoryHackerDlg dialog 20 | 21 | CMemoryHackerDlg::CMemoryHackerDlg(CWnd* pParent /*=NULL*/) 22 | : CDialog(CMemoryHackerDlg::IDD, pParent) 23 | { 24 | //{{AFX_DATA_INIT(CMemoryHackerDlg) 25 | // NOTE: the ClassWizard will add member initialization here 26 | //}}AFX_DATA_INIT 27 | // Note that LoadIcon does not require a subsequent DestroyIcon in Win32 28 | m_hIcon = AfxGetApp()->LoadIcon(IDR_MAINFRAME); 29 | } 30 | 31 | void CMemoryHackerDlg::DoDataExchange(CDataExchange* pDX) 32 | { 33 | CDialog::DoDataExchange(pDX); 34 | //{{AFX_DATA_MAP(CMemoryHackerDlg) 35 | DDX_Control(pDX, IDC_LIST1, m_cListCtrl); 36 | //}}AFX_DATA_MAP 37 | } 38 | 39 | BEGIN_MESSAGE_MAP(CMemoryHackerDlg, CDialog) 40 | //{{AFX_MSG_MAP(CMemoryHackerDlg) 41 | ON_WM_PAINT() 42 | ON_WM_QUERYDRAGICON() 43 | ON_NOTIFY(NM_RCLICK, IDC_LIST1, OnRclickList1) 44 | //}}AFX_MSG_MAP 45 | END_MESSAGE_MAP() 46 | 47 | ///////////////////////////////////////////////////////////////////////////// 48 | // CMemoryHackerDlg message handlers 49 | 50 | BOOL CMemoryHackerDlg::OnInitDialog() 51 | { 52 | CDialog::OnInitDialog(); 53 | 54 | // Set the icon for this dialog. The framework does this automatically 55 | // when the application's main window is not a dialog 56 | SetIcon(m_hIcon, TRUE); // Set big icon 57 | SetIcon(m_hIcon, FALSE); // Set small icon 58 | 59 | // TODO: Add extra initialization here 60 | DWORD dwStyle = m_cListCtrl.GetExtendedStyle(); 61 | dwStyle |= LVS_EX_FULLROWSELECT; 62 | 63 | // Setup the list control 64 | m_cListCtrl.SetExtendedStyle(dwStyle); 65 | 66 | // Create the columns 67 | CRect rect; 68 | m_cListCtrl.GetClientRect(&rect); 69 | int size = rect.Width()/3-16; 70 | m_cListCtrl.InsertColumn(0, _T("ProcessName"), LVCFMT_LEFT, size*2); 71 | m_cListCtrl.InsertColumn(1, _T("pid"), LVCFMT_LEFT, size); 72 | 73 | RefreshProcessList(); 74 | 75 | return TRUE; // return TRUE unless you set the focus to a control 76 | } 77 | 78 | // If you add a minimize button to your dialog, you will need the code below 79 | // to draw the icon. For MFC applications using the document/view model, 80 | // this is automatically done for you by the framework. 81 | 82 | void CMemoryHackerDlg::OnPaint() 83 | { 84 | if (IsIconic()) 85 | { 86 | CPaintDC dc(this); // device context for painting 87 | 88 | SendMessage(WM_ICONERASEBKGND, (WPARAM) dc.GetSafeHdc(), 0); 89 | 90 | // Center icon in client rectangle 91 | int cxIcon = GetSystemMetrics(SM_CXICON); 92 | int cyIcon = GetSystemMetrics(SM_CYICON); 93 | CRect rect; 94 | GetClientRect(&rect); 95 | int x = (rect.Width() - cxIcon + 1) / 2; 96 | int y = (rect.Height() - cyIcon + 1) / 2; 97 | 98 | // Draw the icon 99 | dc.DrawIcon(x, y, m_hIcon); 100 | } 101 | else 102 | { 103 | CDialog::OnPaint(); 104 | } 105 | } 106 | 107 | // The system calls this to obtain the cursor to display while the user drags 108 | // the minimized window. 109 | HCURSOR CMemoryHackerDlg::OnQueryDragIcon() 110 | { 111 | return (HCURSOR) m_hIcon; 112 | } 113 | 114 | 115 | BOOL CMemoryHackerDlg::EnableDebugPrivileges() 116 | { 117 | HANDLE tokenHandle; 118 | LUID luid; 119 | TOKEN_PRIVILEGES newPrivileges; 120 | 121 | if(!OpenProcessToken(GetCurrentProcess(), TOKEN_ALL_ACCESS, &tokenHandle)) 122 | return FALSE; 123 | 124 | if(!LookupPrivilegeValue(NULL, SE_DEBUG_NAME, &luid)) 125 | { 126 | CloseHandle(tokenHandle); 127 | return FALSE; 128 | } 129 | 130 | newPrivileges.PrivilegeCount = 1; 131 | newPrivileges.Privileges[0].Luid = luid; 132 | newPrivileges.Privileges[0].Attributes = SE_PRIVILEGE_ENABLED; 133 | 134 | if(!AdjustTokenPrivileges(tokenHandle, FALSE, &newPrivileges, sizeof(newPrivileges), NULL, NULL)) 135 | { 136 | CloseHandle(tokenHandle); 137 | return FALSE; 138 | } 139 | 140 | CloseHandle(tokenHandle); 141 | 142 | return TRUE; 143 | } 144 | 145 | void CMemoryHackerDlg::RefreshProcessList() 146 | { 147 | 148 | m_cListCtrl.DeleteAllItems(); // clean old items! 149 | 150 | EnableDebugPrivileges(); // enable debug privileges for this process 151 | // Get the list of process identifiers. 152 | DWORD aProcesses[1024], cbNeeded, cProcesses; 153 | unsigned int i; 154 | 155 | if ( !EnumProcesses( aProcesses, sizeof(aProcesses), &cbNeeded ) ) 156 | return; 157 | 158 | // Calculate how many process identifiers were returned. 159 | cProcesses = cbNeeded / sizeof(DWORD); 160 | 161 | // The name and process identifier for each process. 162 | for ( i = 0; i < cProcesses; i++ ) 163 | { 164 | if( aProcesses[i] != 0 ) 165 | { 166 | TCHAR szProcessName[MAX_PATH] = TEXT(""); 167 | 168 | 169 | // Get a handle to the process. 170 | HANDLE hProcess = OpenProcess( PROCESS_QUERY_INFORMATION | 171 | PROCESS_VM_READ, 172 | FALSE, aProcesses[i] ); 173 | 174 | // DWORD Error = GetLastError(); 175 | // Get the process name. 176 | if (NULL != hProcess ) 177 | { 178 | HMODULE hMod; 179 | DWORD cbNeeded; 180 | 181 | if ( EnumProcessModules( hProcess, &hMod, sizeof(hMod), 182 | &cbNeeded) ) 183 | { 184 | GetModuleBaseName( hProcess, hMod, szProcessName, 185 | sizeof(szProcessName)/sizeof(TCHAR) ); 186 | } 187 | } 188 | 189 | // Add the process name and identifier. 190 | LVITEM lvi; 191 | CString strItem; 192 | 193 | // Insert the first item 194 | lvi.mask = LVIF_TEXT; 195 | lvi.iItem = m_cListCtrl.GetItemCount(); // this starts with 0! 196 | 197 | // insert subitem 0 198 | lvi.iSubItem = 0; 199 | lvi.pszText = (LPTSTR)(szProcessName); 200 | m_cListCtrl.InsertItem(&lvi); 201 | 202 | CString cpid; 203 | cpid.Format(_T("%d"), aProcesses[i]); 204 | // insert subitem 1 205 | lvi.iSubItem =1; 206 | lvi.pszText = (char*)LPCTSTR(cpid); 207 | m_cListCtrl.SetItem(&lvi); 208 | 209 | // Release the handle to the process. 210 | CloseHandle( hProcess ); 211 | } 212 | } 213 | } 214 | 215 | 216 | void CMemoryHackerDlg::OnRclickList1(NMHDR* pNMHDR, LRESULT* pResult) 217 | { 218 | // TODO: Add your control notification handler code here 219 | CMenu menu; 220 | menu.LoadMenu(IDR_PROCESS_MENU); // our context menu 221 | CMenu* pPopup = menu.GetSubMenu(0); 222 | 223 | RECT rect; 224 | GetWindowRect(&rect); 225 | CPoint mousepos; 226 | GetCursorPos(&mousepos); 227 | pPopup->TrackPopupMenu(NULL,mousepos.x,mousepos.y, this); 228 | 229 | // The menu is a temporary MFC object, no need to delete it. 230 | *pResult = 0; 231 | } 232 | 233 | BOOL CMemoryHackerDlg::OnCommand(WPARAM wParam, LPARAM lParam) 234 | { 235 | // TODO: Add your specialized code here and/or call the base class 236 | 237 | if (HIWORD(wParam) == BN_CLICKED) // if button clicked 238 | { 239 | switch(LOWORD(wParam)) // Retrieves the low-order word from the specified value. 240 | { 241 | case ID_PROCESS_MEMORYHACK: 242 | { 243 | if (!IsWindow(memoryhackdlg.m_hWnd)||!memoryhackdlg.IsWindowVisible()) 244 | { 245 | 246 | MemoryHack m_pmhdialog = new MemoryHack(this); 247 | memoryhackdlg = m_pmhdialog; 248 | POSITION pos = m_cListCtrl.GetFirstSelectedItemPosition(); 249 | int position = m_cListCtrl.GetNextSelectedItem(pos); 250 | 251 | memoryhackdlg.processname = m_cListCtrl.GetItemText(position, 0); // item number, subitem number 252 | CString pid_str = m_cListCtrl.GetItemText(position, 1); // 1 since we need process id 253 | memoryhackdlg.processid = GenericPurposeMethods::StringToNumber(pid_str.GetBuffer(pid_str.GetLength())); 254 | //testdlg.DoModal(); // not modal one! 255 | BOOL ret = memoryhackdlg.Create(IDD_MEMORYHACK_DIALOG,this); 256 | if (ret) // If create not failed. 257 | memoryhackdlg.ShowWindow(SW_SHOWNORMAL); 258 | } 259 | 260 | break; 261 | } 262 | 263 | case ID_PROCESS_REFRESH: 264 | RefreshProcessList(); 265 | break; 266 | 267 | } 268 | 269 | } 270 | 271 | return CDialog::OnCommand(wParam, lParam); 272 | } 273 | -------------------------------------------------------------------------------- /MemoryHacker/MemoryHackerDlg.h: -------------------------------------------------------------------------------- 1 | // MemoryHackerDlg.h : header file 2 | // 3 | #include "MemoryHack.h" 4 | 5 | #if !defined(AFX_MEMORYHACKERDLG_H__C5ABA573_DCA3_4DB7_96B1_CF3E3D8C3779__INCLUDED_) 6 | #define AFX_MEMORYHACKERDLG_H__C5ABA573_DCA3_4DB7_96B1_CF3E3D8C3779__INCLUDED_ 7 | 8 | #if _MSC_VER > 1000 9 | #pragma once 10 | #endif // _MSC_VER > 1000 11 | 12 | ///////////////////////////////////////////////////////////////////////////// 13 | // CMemoryHackerDlg dialog 14 | 15 | class CMemoryHackerDlg : public CDialog 16 | { 17 | // Construction 18 | public: 19 | CMemoryHackerDlg(CWnd* pParent = NULL); // standard constructor 20 | static BOOL EnableDebugPrivileges(); 21 | 22 | MemoryHack memoryhackdlg; 23 | // Dialog Data 24 | //{{AFX_DATA(CMemoryHackerDlg) 25 | enum { IDD = IDD_MEMORYHACKER_DIALOG }; 26 | CListCtrl m_cListCtrl; 27 | //}}AFX_DATA 28 | 29 | // ClassWizard generated virtual function overrides 30 | //{{AFX_VIRTUAL(CMemoryHackerDlg) 31 | protected: 32 | virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support 33 | virtual BOOL OnCommand(WPARAM wParam, LPARAM lParam); 34 | //}}AFX_VIRTUAL 35 | 36 | // Implementation 37 | protected: 38 | void RefreshProcessList(); 39 | HICON m_hIcon; 40 | 41 | // Generated message map functions 42 | //{{AFX_MSG(CMemoryHackerDlg) 43 | virtual BOOL OnInitDialog(); 44 | afx_msg void OnPaint(); 45 | afx_msg HCURSOR OnQueryDragIcon(); 46 | afx_msg void OnRclickList1(NMHDR* pNMHDR, LRESULT* pResult); 47 | //}}AFX_MSG 48 | DECLARE_MESSAGE_MAP() 49 | }; 50 | 51 | //{{AFX_INSERT_LOCATION}} 52 | // Microsoft Visual C++ will insert additional declarations immediately before the previous line. 53 | 54 | #endif // !defined(AFX_MEMORYHACKERDLG_H__C5ABA573_DCA3_4DB7_96B1_CF3E3D8C3779__INCLUDED_) 55 | -------------------------------------------------------------------------------- /MemoryHacker/MemoryHackerReadMe.txt: -------------------------------------------------------------------------------- 1 | MemoryHacker: 2 | MemoryHacker is a tool which can search for values on the target process! 3 | You can use to search/write in the memory of a process. 4 | Can be used for finding information for creating trainers/memory hacking. 5 | 6 | First Select a process then do a right mouse click on it and choose "Memory hack", 7 | A new dialog with options will come, 8 | with search type: Full search or Custom search (Customize button), 9 | Customize dialog contains list with Start Address/End Address 10 | in order to perform search only on these ranges. 11 | You can pick up a Module or a memory block. 12 | 13 | Type combo specifies the type of variables to search 14 | can be: byte, word, dword, qword, bytes, ASCII string, UNICODE string, float or double. 15 | 16 | Base combo specifies the base of "Value to search", 17 | decimal = base 10 and hexadecimal = base 16. 18 | 19 | First time you enter "Value to search" and click on "Search" button 20 | in order to find addresses and they will be added to list (Address/Value) 21 | 22 | "New value" textbox is used only when you press "Patch" button, 23 | holds the new value to be set! 24 | 25 | They are three more options when you right click on list(Address/Value) 26 | "Copy Selected", "Remove Selected" and "Patch Selected". 27 | 28 | Read button will read current values of list (Address/Value). 29 | 30 | "Remove Not Found" button will read current values of list (Address/Value) 31 | and will remove from list (Address/Value) the ones which 32 | are not equal with "Value to search". 33 | 34 | "Patch" button will patch all values of list (Address/Value) 35 | with "New value". 36 | 37 | -------------------------------------------------------------------------------- /MemoryHacker/ModulesDlg.cpp: -------------------------------------------------------------------------------- 1 | // ModulesDlg.cpp : implementation file 2 | // 3 | 4 | #include "stdafx.h" 5 | #include "MemoryHacker.h" 6 | #include "ModulesDlg.h" 7 | #include "GenericPurposeMethods.h" 8 | #include "CustomizeDlg.h" 9 | 10 | #include "C:\Program Files (x86)\Microsoft SDK\include\Psapi.h" 11 | #pragma comment (lib, "Psapi.lib") 12 | 13 | #ifdef _DEBUG 14 | #define new DEBUG_NEW 15 | #undef THIS_FILE 16 | static char THIS_FILE[] = __FILE__; 17 | #endif 18 | 19 | ///////////////////////////////////////////////////////////////////////////// 20 | // ModulesDlg dialog 21 | 22 | 23 | ModulesDlg::ModulesDlg(CWnd* pParent /*=NULL*/) 24 | : CDialog(ModulesDlg::IDD, pParent) 25 | { 26 | //{{AFX_DATA_INIT(ModulesDlg) 27 | // NOTE: the ClassWizard will add member initialization here 28 | //}}AFX_DATA_INIT 29 | } 30 | 31 | 32 | void ModulesDlg::DoDataExchange(CDataExchange* pDX) 33 | { 34 | CDialog::DoDataExchange(pDX); 35 | //{{AFX_DATA_MAP(ModulesDlg) 36 | DDX_Control(pDX, IDC_LIST1, m_cListCtrl); 37 | //}}AFX_DATA_MAP 38 | } 39 | 40 | ModulesDlg& ModulesDlg::operator=(ModulesDlg& right) 41 | { 42 | // right contains value to be set 43 | // this contains old value 44 | (*this).m_hWnd = right.m_hWnd; 45 | return *this; 46 | 47 | } 48 | 49 | BEGIN_MESSAGE_MAP(ModulesDlg, CDialog) 50 | //{{AFX_MSG_MAP(ModulesDlg) 51 | ON_WM_CLOSE() 52 | ON_NOTIFY(LVN_ITEMCHANGED, IDC_LIST1, OnItemchangedList1) 53 | //}}AFX_MSG_MAP 54 | END_MESSAGE_MAP() 55 | 56 | ///////////////////////////////////////////////////////////////////////////// 57 | // ModulesDlg message handlers 58 | 59 | void ModulesDlg::OnClose() 60 | { 61 | // TODO: Add your message handler code here and/or call default 62 | this->DestroyWindow(); // destroy the window 63 | CDialog::OnClose(); 64 | } 65 | 66 | TCHAR fullmodulenames[1024][MAX_PATH]; 67 | TCHAR shortmodulenames[1024][MAX_PATH]; 68 | HMODULE modules_address[1024]; 69 | int modulecount; 70 | 71 | void ModulesDlg::RefreshModulesList() 72 | { 73 | m_cListCtrl.DeleteAllItems(); // clean old items! 74 | 75 | modulecount = 0; 76 | HANDLE hProcess = OpenProcess( PROCESS_QUERY_INFORMATION | 77 | PROCESS_VM_READ, 78 | FALSE, processid); 79 | 80 | if (hProcess==NULL) return; 81 | 82 | HMODULE hMods[1024]; 83 | DWORD cbNeeded; 84 | 85 | 86 | // Get a list of all the modules in this process. 87 | if (EnumProcessModules(hProcess, hMods, sizeof(hMods), &cbNeeded)) 88 | { 89 | 90 | for (unsigned int i = 0; i < (cbNeeded / sizeof(HMODULE)); i++ ) 91 | { 92 | TCHAR szModName[MAX_PATH]; 93 | // Get the full path to the module's file. 94 | if ( GetModuleFileNameEx( hProcess, hMods[i], szModName, 95 | sizeof(szModName) / sizeof(TCHAR))) 96 | { 97 | 98 | for (int j=0;j<(sizeof(szModName) / sizeof(TCHAR));j++) 99 | fullmodulenames[modulecount][j] = szModName[j]; 100 | 101 | modules_address[modulecount] = hMods[i]; 102 | 103 | TCHAR* psname = GenericPurposeMethods::GetShortModuleName(fullmodulenames[modulecount]); 104 | for (int k=0;k<(sizeof(szModName) / sizeof(TCHAR));k++) 105 | shortmodulenames[modulecount][k] = psname[k]; 106 | 107 | modulecount++; 108 | 109 | } 110 | } 111 | 112 | } 113 | 114 | CloseHandle(hProcess); 115 | 116 | 117 | // Add the process name and identifier. 118 | for (int i=0;i=0) 185 | { 186 | HMODULE hmod = modules_address[position]; 187 | CCustomizeDlg::UpdateStartAddress((unsigned int)hmod); 188 | unsigned int size = ModulesDlg::GetModuleSize(hmod); 189 | unsigned int end_address = (unsigned int)hmod+size; 190 | CCustomizeDlg::UpdateEndAddress(end_address); 191 | } 192 | 193 | *pResult = 0; 194 | } 195 | 196 | 197 | unsigned int ModulesDlg::GetModuleSize(HMODULE hMod) 198 | { 199 | 200 | unsigned int speed = 0x1000; 201 | 202 | try 203 | { 204 | SYSTEM_INFO* pSI = new SYSTEM_INFO(); 205 | GetSystemInfo(pSI); 206 | speed = pSI->dwPageSize; 207 | } 208 | catch(...) // catch any exception 209 | { 210 | } 211 | 212 | 213 | HANDLE hProcess = OpenProcess( PROCESS_QUERY_INFORMATION | PROCESS_VM_READ, 214 | FALSE, processid); 215 | if (hProcess==NULL) return 0; 216 | 217 | unsigned char* tempbuf= new unsigned char[04]; 218 | unsigned long dwTotalRead; 219 | 220 | unsigned int base_address = (unsigned int)hMod+0x03C; 221 | int isok = ReadProcessMemory(hProcess, (LPVOID)base_address, tempbuf, 04, &dwTotalRead); 222 | if (isok == 0) return 0; // if read failed return 0 223 | 224 | int PEOffset = GenericPurposeMethods::UnsignedArrayToUInt(tempbuf, 0); 225 | if (PEOffset==0) return 0; 226 | 227 | base_address = (unsigned int)hMod+PEOffset+0x0F8+20; 228 | isok = ReadProcessMemory(hProcess, (LPVOID)base_address, tempbuf, 04, &dwTotalRead); 229 | if (isok == 0) return 0; // if read failed return 230 | 231 | unsigned int RawOfFirstSection = GenericPurposeMethods::UnsignedArrayToUInt(tempbuf, 0); 232 | unsigned int offset=0; 233 | 234 | unsigned int sizetocopy = RawOfFirstSection; 235 | if (sizetocopy>speed) sizetocopy=(unsigned int)speed; 236 | if (sizetocopy==0) sizetocopy = speed; 237 | 238 | offset=offset+RawOfFirstSection; 239 | 240 | unsigned char* PeHeader = new byte[sizetocopy]; 241 | isok = ReadProcessMemory(hProcess, (LPVOID)hMod, PeHeader, sizetocopy, &dwTotalRead); 242 | if (isok == 0) return 0; // if read failed return 243 | 244 | unsigned int nrofsection = GenericPurposeMethods::UnsignedArrayToShort(PeHeader, PEOffset+0x06); 245 | 246 | base_address = (unsigned int)hMod+PEOffset+0x28; 247 | isok = ReadProcessMemory(hProcess, (LPVOID)base_address, tempbuf, 04, &dwTotalRead); 248 | if (isok == 0) return 0; // if read failed return 0 249 | 250 | unsigned int modulesize = 0; 251 | 252 | for (int i = nrofsection-1; i >= 0; --i) 253 | { 254 | unsigned int virtualsize = GenericPurposeMethods::UnsignedArrayToUInt(PeHeader, PEOffset+0x0F8+0x28*i+8); 255 | unsigned int virtualAddress = GenericPurposeMethods::UnsignedArrayToUInt(PeHeader, PEOffset+0x0F8+0x28*i+0xC); 256 | if (virtualAddress!=0) 257 | { 258 | modulesize = virtualsize+virtualAddress; 259 | break; 260 | } 261 | } 262 | 263 | CloseHandle(hProcess); 264 | 265 | return modulesize; 266 | 267 | } 268 | 269 | -------------------------------------------------------------------------------- /MemoryHacker/ModulesDlg.h: -------------------------------------------------------------------------------- 1 | #if !defined(AFX_MODULESDLG_H__DA24E17E_874B_41A1_A218_8A25A88F374F__INCLUDED_) 2 | #define AFX_MODULESDLG_H__DA24E17E_874B_41A1_A218_8A25A88F374F__INCLUDED_ 3 | 4 | #if _MSC_VER > 1000 5 | #pragma once 6 | #endif // _MSC_VER > 1000 7 | // ModulesDlg.h : header file 8 | // 9 | 10 | ///////////////////////////////////////////////////////////////////////////// 11 | // ModulesDlg dialog 12 | 13 | class ModulesDlg : public CDialog 14 | { 15 | // Construction 16 | public: 17 | ModulesDlg(CWnd* pParent = NULL); // standard constructor 18 | ModulesDlg& operator=(ModulesDlg& right); // Overload Assignment Operator 19 | void RefreshModulesList(); 20 | unsigned int GetModuleSize(HMODULE hMod); 21 | 22 | int processid; 23 | CString processname; 24 | 25 | // Dialog Data 26 | //{{AFX_DATA(ModulesDlg) 27 | enum { IDD = IDD_MODULESDLG_DIALOG }; 28 | CListCtrl m_cListCtrl; 29 | //}}AFX_DATA 30 | 31 | 32 | // Overrides 33 | // ClassWizard generated virtual function overrides 34 | //{{AFX_VIRTUAL(ModulesDlg) 35 | protected: 36 | virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support 37 | //}}AFX_VIRTUAL 38 | 39 | // Implementation 40 | protected: 41 | 42 | // Generated message map functions 43 | //{{AFX_MSG(ModulesDlg) 44 | afx_msg void OnClose(); 45 | virtual BOOL OnInitDialog(); 46 | afx_msg void OnItemchangedList1(NMHDR* pNMHDR, LRESULT* pResult); 47 | //}}AFX_MSG 48 | DECLARE_MESSAGE_MAP() 49 | }; 50 | 51 | //{{AFX_INSERT_LOCATION}} 52 | // Microsoft Visual C++ will insert additional declarations immediately before the previous line. 53 | 54 | #endif // !defined(AFX_MODULESDLG_H__DA24E17E_874B_41A1_A218_8A25A88F374F__INCLUDED_) 55 | -------------------------------------------------------------------------------- /MemoryHacker/NewEdit.cpp: -------------------------------------------------------------------------------- 1 | // NewEdit.cpp : implementation file 2 | // 3 | 4 | #include "stdafx.h" 5 | #include "MemoryHacker.h" 6 | #include "NewEdit.h" 7 | 8 | #ifdef _DEBUG 9 | #define new DEBUG_NEW 10 | #undef THIS_FILE 11 | static char THIS_FILE[] = __FILE__; 12 | #endif 13 | 14 | ///////////////////////////////////////////////////////////////////////////// 15 | // NewEdit 16 | 17 | NewEdit::NewEdit() 18 | { 19 | } 20 | 21 | NewEdit::~NewEdit() 22 | { 23 | } 24 | 25 | 26 | BEGIN_MESSAGE_MAP(NewEdit, CEdit) 27 | //{{AFX_MSG_MAP(NewEdit) 28 | ON_WM_CHAR() 29 | //}}AFX_MSG_MAP 30 | END_MESSAGE_MAP() 31 | 32 | ///////////////////////////////////////////////////////////////////////////// 33 | // NewEdit message handlers 34 | 35 | void NewEdit::OnChar(UINT nChar, UINT nRepCnt, UINT nFlags) 36 | { 37 | // TODO: Add your message handler code here and/or call default 38 | if (islower(nChar)) nChar -=32; // MAKE CHAR UPPER IF IS LOWER 39 | 40 | if ((nChar>=48&&nChar<=57)||(nChar>=65&&nChar<=70)) 41 | DefWindowProc(WM_CHAR, nChar,0); 42 | 43 | if (nChar == VK_BACK||nChar == VK_DELETE) // if backslash or delete key 44 | DefWindowProc(WM_CHAR, nChar,0); 45 | 46 | // Originaly calls this: 47 | //CEdit::OnChar(nChar, nRepCnt, nFlags); 48 | } 49 | 50 | void NewEdit::PreSubclassWindow() 51 | { 52 | // TODO: Add your specialized code here and/or call the base class 53 | this->SetLimitText(8); // set max text lenght to 8 54 | CEdit::PreSubclassWindow(); 55 | } 56 | -------------------------------------------------------------------------------- /MemoryHacker/NewEdit.h: -------------------------------------------------------------------------------- 1 | #if !defined(AFX_NEWEDIT_H__C7ADE44F_91C6_4741_BE27_5A11F8D50BAF__INCLUDED_) 2 | #define AFX_NEWEDIT_H__C7ADE44F_91C6_4741_BE27_5A11F8D50BAF__INCLUDED_ 3 | 4 | #if _MSC_VER > 1000 5 | #pragma once 6 | #endif // _MSC_VER > 1000 7 | // NewEdit.h : header file 8 | // 9 | 10 | ///////////////////////////////////////////////////////////////////////////// 11 | // NewEdit window 12 | 13 | class NewEdit : public CEdit 14 | { 15 | // Construction 16 | public: 17 | NewEdit(); 18 | 19 | // Attributes 20 | public: 21 | 22 | // Operations 23 | public: 24 | 25 | // Overrides 26 | // ClassWizard generated virtual function overrides 27 | //{{AFX_VIRTUAL(NewEdit) 28 | protected: 29 | virtual void PreSubclassWindow(); 30 | //}}AFX_VIRTUAL 31 | 32 | // Implementation 33 | public: 34 | virtual ~NewEdit(); 35 | 36 | // Generated message map functions 37 | protected: 38 | //{{AFX_MSG(NewEdit) 39 | afx_msg void OnChar(UINT nChar, UINT nRepCnt, UINT nFlags); 40 | //}}AFX_MSG 41 | 42 | DECLARE_MESSAGE_MAP() 43 | }; 44 | 45 | ///////////////////////////////////////////////////////////////////////////// 46 | 47 | //{{AFX_INSERT_LOCATION}} 48 | // Microsoft Visual C++ will insert additional declarations immediately before the previous line. 49 | 50 | #endif // !defined(AFX_NEWEDIT_H__C7ADE44F_91C6_4741_BE27_5A11F8D50BAF__INCLUDED_) 51 | -------------------------------------------------------------------------------- /MemoryHacker/ReadMe.txt: -------------------------------------------------------------------------------- 1 | ======================================================================== 2 | MICROSOFT FOUNDATION CLASS LIBRARY : MemoryHacker 3 | ======================================================================== 4 | 5 | 6 | AppWizard has created this MemoryHacker application for you. This application 7 | not only demonstrates the basics of using the Microsoft Foundation classes 8 | but is also a starting point for writing your application. 9 | 10 | This file contains a summary of what you will find in each of the files that 11 | make up your MemoryHacker application. 12 | 13 | MemoryHacker.dsp 14 | This file (the project file) contains information at the project level and 15 | is used to build a single project or subproject. Other users can share the 16 | project (.dsp) file, but they should export the makefiles locally. 17 | 18 | MemoryHacker.h 19 | This is the main header file for the application. It includes other 20 | project specific headers (including Resource.h) and declares the 21 | CMemoryHackerApp application class. 22 | 23 | MemoryHacker.cpp 24 | This is the main application source file that contains the application 25 | class CMemoryHackerApp. 26 | 27 | MemoryHacker.rc 28 | This is a listing of all of the Microsoft Windows resources that the 29 | program uses. It includes the icons, bitmaps, and cursors that are stored 30 | in the RES subdirectory. This file can be directly edited in Microsoft 31 | Visual C++. 32 | 33 | MemoryHacker.clw 34 | This file contains information used by ClassWizard to edit existing 35 | classes or add new classes. ClassWizard also uses this file to store 36 | information needed to create and edit message maps and dialog data 37 | maps and to create prototype member functions. 38 | 39 | res\MemoryHacker.ico 40 | This is an icon file, which is used as the application's icon. This 41 | icon is included by the main resource file MemoryHacker.rc. 42 | 43 | res\MemoryHacker.rc2 44 | This file contains resources that are not edited by Microsoft 45 | Visual C++. You should place all resources not editable by 46 | the resource editor in this file. 47 | 48 | 49 | 50 | 51 | ///////////////////////////////////////////////////////////////////////////// 52 | 53 | AppWizard creates one dialog class: 54 | 55 | MemoryHackerDlg.h, MemoryHackerDlg.cpp - the dialog 56 | These files contain your CMemoryHackerDlg class. This class defines 57 | the behavior of your application's main dialog. The dialog's 58 | template is in MemoryHacker.rc, which can be edited in Microsoft 59 | Visual C++. 60 | 61 | 62 | ///////////////////////////////////////////////////////////////////////////// 63 | Other standard files: 64 | 65 | StdAfx.h, StdAfx.cpp 66 | These files are used to build a precompiled header (PCH) file 67 | named MemoryHacker.pch and a precompiled types file named StdAfx.obj. 68 | 69 | Resource.h 70 | This is the standard header file, which defines new resource IDs. 71 | Microsoft Visual C++ reads and updates this file. 72 | 73 | ///////////////////////////////////////////////////////////////////////////// 74 | Other notes: 75 | 76 | AppWizard uses "TODO:" to indicate parts of the source code you 77 | should add to or customize. 78 | 79 | If your application uses MFC in a shared DLL, and your application is 80 | in a language other than the operating system's current language, you 81 | will need to copy the corresponding localized resources MFC42XXX.DLL 82 | from the Microsoft Visual C++ CD-ROM onto the system or system32 directory, 83 | and rename it to be MFCLOC.DLL. ("XXX" stands for the language abbreviation. 84 | For example, MFC42DEU.DLL contains resources translated to German.) If you 85 | don't do this, some of the UI elements of your application will remain in the 86 | language of the operating system. 87 | 88 | ///////////////////////////////////////////////////////////////////////////// 89 | -------------------------------------------------------------------------------- /MemoryHacker/StdAfx.cpp: -------------------------------------------------------------------------------- 1 | // stdafx.cpp : source file that includes just the standard includes 2 | // MemoryHacker.pch will be the pre-compiled header 3 | // stdafx.obj will contain the pre-compiled type information 4 | 5 | #include "stdafx.h" 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /MemoryHacker/StdAfx.h: -------------------------------------------------------------------------------- 1 | // stdafx.h : include file for standard system include files, 2 | // or project specific include files that are used frequently, but 3 | // are changed infrequently 4 | // 5 | 6 | #if !defined(AFX_STDAFX_H__BACD9C4C_D97C_488C_8D40_6BEFD66DA24B__INCLUDED_) 7 | #define AFX_STDAFX_H__BACD9C4C_D97C_488C_8D40_6BEFD66DA24B__INCLUDED_ 8 | 9 | #if _MSC_VER > 1000 10 | #pragma once 11 | #endif // _MSC_VER > 1000 12 | 13 | #define VC_EXTRALEAN // Exclude rarely-used stuff from Windows headers 14 | 15 | #include // MFC core and standard components 16 | #include // MFC extensions 17 | #include // MFC support for Internet Explorer 4 Common Controls 18 | #ifndef _AFX_NO_AFXCMN_SUPPORT 19 | #include // MFC support for Windows Common Controls 20 | #endif // _AFX_NO_AFXCMN_SUPPORT 21 | 22 | 23 | //{{AFX_INSERT_LOCATION}} 24 | // Microsoft Visual C++ will insert additional declarations immediately before the previous line. 25 | 26 | #endif // !defined(AFX_STDAFX_H__BACD9C4C_D97C_488C_8D40_6BEFD66DA24B__INCLUDED_) 27 | -------------------------------------------------------------------------------- /MemoryHacker/res/MemoryHacker.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CodeCrackerSND/MemoryHacker/c31a58da22b056c677b0c018be80e79f64cd5d0e/MemoryHacker/res/MemoryHacker.ico -------------------------------------------------------------------------------- /MemoryHacker/res/MemoryHacker.rc2: -------------------------------------------------------------------------------- 1 | // 2 | // MEMORYHACKER.RC2 - resources Microsoft Visual C++ does not edit directly 3 | // 4 | 5 | #ifdef APSTUDIO_INVOKED 6 | #error this file is not editable by Microsoft Visual C++ 7 | #endif //APSTUDIO_INVOKED 8 | 9 | 10 | ///////////////////////////////////////////////////////////////////////////// 11 | // Add manually edited resources here... 12 | 13 | ///////////////////////////////////////////////////////////////////////////// 14 | -------------------------------------------------------------------------------- /MemoryHacker/resource.h: -------------------------------------------------------------------------------- 1 | //{{NO_DEPENDENCIES}} 2 | // Microsoft Developer Studio generated include file. 3 | // Used by MemoryHacker.rc 4 | // 5 | #define IDD_MEMORYHACKER_DIALOG 102 6 | #define IDD_MEMORYHACK_DIALOG 103 7 | #define IDD_USTOMIZEDLG_DIALOG 104 8 | #define IDD_CUSTOMIZEDLG_DIALOG 106 9 | #define IDD_MODULESDLG_DIALOG 107 10 | #define IDD_MEMORYBLOCK_DIALOG 108 11 | #define IDD_INSPECTMEMORY_DIALOG 109 12 | #define IDR_MAINFRAME 128 13 | #define IDR_PROCESS_MENU 129 14 | #define IDR_CUSTOM_MENU 130 15 | #define IDR_MEMHACKMENU 131 16 | #define IDC_LIST1 1000 17 | #define IDC_FULLSEARCH_RAD 1000 18 | #define IDC_CUSTOMSEARCH_RAD 1001 19 | #define IDC_CUSTOMIZE_BTN 1002 20 | #define IDC_STARTA_EDIT 1003 21 | #define IDC_ENDA_EDIT 1004 22 | #define IDC_PICK_START 1005 23 | #define IDC_PICK_END 1006 24 | #define IDC_MODULE_BUT 1007 25 | #define IDC_BLOCK_BUT 1008 26 | #define IDC_ADD_BUT 1009 27 | #define IDC_CLEARALL_BUT 1010 28 | #define IDC_TYPE_COMBO 1011 29 | #define IDC_BASE_COMBO 1012 30 | #define IDC_VALUETOSEARCH_EDIT 1013 31 | #define IDC_EDIT2 1014 32 | #define IDC_NEWVALEDIT 1014 33 | #define IDC_EDIT_RESULT 1014 34 | #define IDC_SEARCH_BUT 1015 35 | #define IDC_STATUS_STATIC 1016 36 | #define IDC_LIST2 1017 37 | #define IDC_READ_VALUES 1018 38 | #define IDC_RNFBUT 1019 39 | #define IDC_PATCHBUT 1020 40 | #define IDC_EDIT1 1021 41 | #define IDC_EDIT_BRBYTES 1022 42 | #define IDC_INSPECTBUT 1023 43 | #define ID_PROCESS_MEMORYHACK 32771 44 | #define ID_PROCESS_REFRESH 32772 45 | #define ID_CUSTOMMENU_REMOVESELECTED 32773 46 | #define ID_COPYSELECTED 32774 47 | #define ID_REMOVESELECTED 32775 48 | #define ID_PATCHSELECTED 32776 49 | #define ID_INSPECTMEMORY 32777 50 | 51 | // Next default values for new objects 52 | // 53 | #ifdef APSTUDIO_INVOKED 54 | #ifndef APSTUDIO_READONLY_SYMBOLS 55 | #define _APS_NEXT_RESOURCE_VALUE 132 56 | #define _APS_NEXT_COMMAND_VALUE 32778 57 | #define _APS_NEXT_CONTROL_VALUE 1024 58 | #define _APS_NEXT_SYMED_VALUE 110 59 | #endif 60 | #endif 61 | --------------------------------------------------------------------------------