Cheat Engine Forum Index Cheat Engine
The Official Site of Cheat Engine
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 


[HELP]Creating a Memory Scanner

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> General programming
View previous topic :: View next topic  
Author Message
porring09
Newbie cheater
Reputation: 0

Joined: 11 Feb 2014
Posts: 11

PostPosted: Mon May 26, 2014 12:06 am    Post subject: [HELP]Creating a Memory Scanner Reply with quote

Hi, I hope there are someone make my app fixed,

I make a memory scanner in C++ Language,
Before i make it in GUI version, i used DevC++ first to make some Header file then it works fine but kinda Slow when scanning a Process

I try to use it in winmine.exe(Mine Sweeper) and Farm Frenzy 3 that used more Memory.

It takes 10~20 seconds of scanning in minesweeper depends on what value input use for comparing.

and for Farm Frenzy it takes 30~40 Seconds of scanning depends on what value input use for comparing.

after few testing i convert it in a GUI'd version i called it Critical Engine hehe.

But there are some problem on it. and i need your help Sad

when i used it in winmine(that used lower memory) the application works fine, but when i scan in Farm Frenzy or any game that use larger memory
Like (Grand Chase) it makes the GUI'd Freezed and i never stop Looping.

Please Help Sad

* I don't know how i make the Scanning Procedure Fast like CE
* I have an idea about avoid Freezing GUI but i don't know how to use System::Threading::Thread in VC++ 2008 (I only know in VB.net)

Help me Out Sad


Here is my Code:

MemoryScanner.h
Code:

//=======
 #ifndef H_MemoryScanner
#define H_MemoryScanner

#define _READABLE (PAGE_EXECUTE_READ | PAGE_EXECUTE_READWRITE | PAGE_EXECUTE_WRITECOPY | PAGE_READONLY | PAGE_READWRITE | PAGE_WRITECOPY)
#define _READABLE_A (PAGE_EXECUTE_WRITECOPY | PAGE_WRITECOPY | PAGE_READWRITE)
#define _PROTECTION (MEM_PRIVATE | MEM_MAPPED | MEM_IMAGE)

#include <windows.h>
#include <iostream>

using namespace System::Collections;
using namespace std;
  /*
   Author : Jonnel ross Mendoza
   Rev: 1.2
   Last Rev : May 18 , 2014
  */


  enum ScanType{
   ExactValue ,
   IncreaseValue ,
   DecreaseValue ,
   IncreseValueBy ,
   DecreaseValueBy ,
   BetweenValue ,
   UnknownInitialValue
  }ScanStyle; // End of struct ScanType
 
 
  template<typename Type>
  struct memoryInfo{
    // This data Structure constains the Scanned Addresses and Their Current Values
    // During the Executed Scan
    unsigned int *Address;
    bool allocated;
    unsigned int Pointer;
  };
 
  template<class Type>
  class Scanner{
           
  public:
  Scanner();
  Scanner(HANDLE hProcess , MEMORY_BASIC_INFORMATION mbi , DWORD START_RANGE = 0x00000000 , DWORD END_RANGE = 0x7FFFFFFF);
  ~Scanner();
  void Option(bool v_ReadOnly = false , bool v_Executable = true , bool v_writeCopy = true , unsigned int stepSize = 4);
  void FirstScan(memoryInfo<Type> &mem , const Type& VALUE = NULL , const Type& OTHER_VALUE = NULL );     
  void NextScan(memoryInfo<Type> &mem , const Type& VALUE = NULL , const Type& OTHER_VALUE = NULL);
  void setMaxMemoryBlock(unsigned int _MEMORY_SIZE);
  void setScanType(ScanType scanStyle);
  void cancelScan();
  unsigned int getPageCount();
  unsigned int getRegionSize();
  unsigned int getBaseAddress();

  private:       
  // void printProperties(); unused
  bool isEqual(Type VALUE , Type toValue);
  bool isBetween(Type VALUE , Type from , Type to );
  bool isIncresed(Type VALUE , Type before );
  bool isDecresed(Type VALUE , Type before );
  bool isIncreasedBy(Type VALUE , Type increment );
  bool isDecresedBy(Type VALUE , Type decrement );
 
  struct Property{
         
   HANDLE _PROCESS_HANDLE;
   MEMORY_BASIC_INFORMATION _MBI;
   DWORD _START_RANGE;
   DWORD _END_RANGE;
  // DWORD *_CACHE_SCANNED; For now it is unused
  // DWORD *_CACHE_SCANNED_VALUE; For now it is unused
   unsigned int _STEP_SIZE;
   unsigned int _BYTE_SIZE;
   unsigned int _REGION_SIZE;
   unsigned int _PAGE_COUNT;
   unsigned int _MAX_MEMORY_BLOCK;
   ScanType scanningStyle;
   bool _VREAD_ONLY;
   bool _VEXREAD;
   bool _VEXECUTABLE;
   bool _VWRITECOPY;
   bool _CANCEL_SCAN;
   LPVOID _BASE_ADDRESS;
 
   };
   
   Property props;
  }; // End of Class Scanner
 
 
 template<class Type>
 Scanner<Type>::Scanner(){
 // Default Constructor of Scanner Class                       
 props._PROCESS_HANDLE = NULL;
 props._START_RANGE = 0x00000000;
 props._END_RANGE = 0x7FFFFFFF;
 props._BYTE_SIZE = sizeof(Type); 
 props._CANCEL_SCAN = false;
                       
 } // End of Default Constructor
 
 template<class Type>
 Scanner<Type>::Scanner(HANDLE hProcess , MEMORY_BASIC_INFORMATION mbi , DWORD START_RANGE , DWORD END_RANGE){
 /*
    This Function is Use as CONSTRUCTOR of the Scanner Class
    Initialize Each private member of the Class
    Revision : 0
 */
 
 props._PROCESS_HANDLE = hProcess;
 props._MBI = mbi;
 props._START_RANGE = START_RANGE;
 props._END_RANGE = END_RANGE;
 props._BYTE_SIZE = sizeof(Type);
 props._BASE_ADDRESS = 0;
 props._CANCEL_SCAN = false;
 
 // Initialize MBI
 VirtualQueryEx(props._PROCESS_HANDLE , (void *)props._BASE_ADDRESS, &props._MBI, sizeof(props._MBI));
 // Get the PAGE_COUNT and TOTAL Readable Address in the Process Memory
 
  { // Start Block of Getting the PAGE_COUNT and TOTAL REGION SIZE   
   unsigned int pageCount = 0;
   unsigned int BytesReadable = 0;
   unsigned int start = 0, end = 0;
   LPVOID baseAddress = props._BASE_ADDRESS;
   while(VirtualQueryEx(props._PROCESS_HANDLE , (void *)baseAddress, &props._MBI, sizeof(props._MBI))){
         
         start = (unsigned)props._MBI.BaseAddress;
         end = (unsigned)props._MBI.BaseAddress + props._MBI.RegionSize;
       if(props._MBI.State & MEM_COMMIT){
          if(props._MBI.AllocationProtect & _READABLE){
              pageCount++;
             BytesReadable += props._MBI.RegionSize;
         }
       }
    baseAddress = reinterpret_cast<void*>(end);
  }
   
   props._PAGE_COUNT = pageCount;
   props._REGION_SIZE = BytesReadable;   
  } // END OF TEMP BLOCK           
 
 } // End of Constructor of Class Scanner
 
 template<class Type>
 Scanner<Type>::~Scanner(){
 // Default Destructor of Class Scanner
 Property *p;
 p = &props;
 delete p;
 }// End of Destructor of Class Scanner
 
 template<class Type>
 void Scanner<Type>::Option(bool v_ReadOnly , bool v_Executable , bool v_writeCopy , unsigned int stepSize){
 props._VREAD_ONLY = v_ReadOnly;
 props._VEXECUTABLE = v_Executable;
 props._VWRITECOPY = v_writeCopy;
 props._STEP_SIZE = stepSize;
 } // End of Option Function of Class Scanner   
 
 template<class Type>
 void Scanner<Type>::FirstScan(memoryInfo<Type> &mem, const Type& VALUE , const Type& OTHER_VALUE){
 // This is use to Do a First Scan in the Process Memory Address
 unsigned int _START = 0;
 unsigned int _END = 0;
 unsigned int _TOTAL_READ = 0;
 unsigned int _TOTAL_FOUND = 0;
 unsigned int _ARRAY_SIZE = props._MAX_MEMORY_BLOCK ; // 134217727 = 134 Billion
 Type _READ;
 LPVOID baseAddress;
 props._BASE_ADDRESS = reinterpret_cast<void *>(props._START_RANGE);
 memoryInfo<Type> *temp_mem = new memoryInfo<Type>;
 baseAddress   = props._BASE_ADDRESS;
 Stack^ _AddressList = gcnew Stack;
 Stack^ _ValueList = gcnew Stack;

 if(mem.allocated){
   goto bypass;
 }
 mem.Address = new unsigned int[_ARRAY_SIZE];

bypass:
 mem.Pointer = 0;
 mem.allocated = true;
 
 Sleep(100);
 
 
 while(VirtualQueryEx(props._PROCESS_HANDLE , (void *)baseAddress , &props._MBI , sizeof(props._MBI))){
      _START = (unsigned)props._MBI.BaseAddress;
      _END   = (unsigned)props._MBI.BaseAddress + props._MBI.RegionSize;
    
      if(props._MBI.State == MEM_COMMIT){
         // Make a switch statement to choose what to view and not
      switch(props._MBI.AllocationProtect){
       case PAGE_READONLY:
            if(props._VREAD_ONLY){
             goto scanRegion;   
            }else{goto skipRegion;}
       case PAGE_EXECUTE:
             if(props._VEXECUTABLE){
             goto scanRegion;   
            }else{goto skipRegion;}
       case PAGE_EXECUTE_READ:
       case PAGE_READWRITE:
       case PAGE_WRITECOPY:
       case PAGE_EXECUTE_READWRITE:
       case PAGE_EXECUTE_WRITECOPY:
       scanRegion:
        for(DWORD _POINTER = _START; _POINTER < _END; _POINTER += props._STEP_SIZE){
            ReadProcessMemory(props._PROCESS_HANDLE, (void *)_POINTER, &_READ, sizeof(Type) , 0);
           if(_READ != VALUE){goto bypassAddress;}
           // switch for Scanning Style
           switch(ScanStyle){
             case ExactValue:
                  {
                   if(isEqual(VALUE , _READ)){
                     _AddressList->Push(_POINTER);
                _ValueList->Push(_READ);
                  _TOTAL_FOUND++;   
                   }         
                  }break;
             case IncreaseValue:
                  {
                               
                  }break;
             case DecreaseValue:
                  {
                               
                  }break;
             case IncreseValueBy:
                  {
                                 
                  }break;
             case DecreaseValueBy:
                  {
                                 
                  }break;
             case BetweenValue:
                  {
                   if(isBetween(_READ ,  VALUE , OTHER_VALUE)){
                     _AddressList->Push(_POINTER);
                _ValueList->Push(_READ);   
                  _TOTAL_FOUND++;   
                   }             
                  }break;
             case UnknownInitialValue: 
                  {
                                       
                  }break;
            } // End of Switch
         bypassAddress:
         _TOTAL_READ++;
        } // End of For Loop
      }   // End of Switch
     } // End of IF _MBI.State
     
 skipRegion:
 baseAddress = reinterpret_cast<void*>(_END); // Move to Next Readable Region
 
 } // End of While Loop [VirtualQueryEx]
 
  IEnumerator^ enum_items = _AddressList->GetEnumerator();
  unsigned a = 0;
  while(enum_items->MoveNext()){
   Object^ temp = safe_cast<Object^>(enum_items->Current);
   mem.Address[a] = static_cast<UInt32>(System::Convert::ChangeType(temp , System::TypeCode::UInt32));
   a++;
   mem.Pointer = a;
  }

  System::GC::Collect();

 } // End of Function FirstScan of Class Scanner
 
 template<class Type>
 void Scanner<Type>::NextScan(memoryInfo<Type> &mem , const Type& VALUE , const Type& OTHER_VALUE ){
 
  // Declare Temporary Memory Block to Store new Set of addreses
  unsigned int _TOTAL_READ = 0;
  unsigned int _TOTAL_FOUND = 0;
  unsigned int BUFF_POINTER = 0;
  Type _READ = 0;
  memoryInfo<Type> _TEMP_MEM;
  _TEMP_MEM.Pointer = 0;
 _TEMP_MEM.Address = new unsigned __int32[mem.Pointer];
  LPVOID baseAddress = reinterpret_cast<void *>(mem.Address[0]); // Initialization of baseAddress;
 
  Sleep(100);
  while(VirtualQueryEx(props._PROCESS_HANDLE , baseAddress ,  &props._MBI , sizeof(props._MBI)) ){
   while(BUFF_POINTER < mem.Pointer){
    ReadProcessMemory(props._PROCESS_HANDLE , (void *)mem.Address[BUFF_POINTER] , &_READ , sizeof(Type) , 0 );
    if(BUFF_POINTER >= mem.Pointer){break;}
      // switch for Scanning Style
           switch(ScanStyle){
             case ExactValue:
                  {
                   if(isEqual(VALUE , _READ)){
                    _TEMP_MEM.Address[_TEMP_MEM.Pointer] = mem.Address[BUFF_POINTER];
                   _TEMP_MEM.Pointer++;   
                     _TOTAL_FOUND++;
                     BUFF_POINTER++;
                     goto bypassAddress; 
                   }           
                  }break;
             case IncreaseValue:
                  {
                               
                  }break;
             case DecreaseValue:
                  {
                               
                  }break;
             case IncreseValueBy:
                  {
                                 
                  }break;
             case DecreaseValueBy:
                  {
                                 
                  }break;
             case BetweenValue:
                  {
                   if(isBetween(_READ ,  VALUE , OTHER_VALUE)){
                    _TEMP_MEM.Address[_TEMP_MEM.Pointer] = mem.Address[BUFF_POINTER];
                   _TEMP_MEM.Pointer++;   
                     _TOTAL_FOUND++;
                     BUFF_POINTER++;
                     goto bypassAddress;   
               }           
                  }break;
             case UnknownInitialValue: 
                  {
                                       
                  }break;
            } // End of Switch
bypassAddress: 
     BUFF_POINTER++;   
     baseAddress = reinterpret_cast<void *>((unsigned) mem.Address[BUFF_POINTER] ) ;// Set new baseAddress to skip unlisted Address from the Region       
 // End of If [READ == VALUE]
    _TOTAL_READ++;
   } // End of while Block [Pointer to BUFF_ADDRESS (BUFF_POINTER < itemCount)]   
   if(BUFF_POINTER >= mem.Pointer){break;} 
  } // End of While Block [VirtualQueryEx]
 
  mem = _TEMP_MEM;
 } // End of NextScan Function of Scanner Class
 
 template<class Type>
 void Scanner<Type>::setMaxMemoryBlock(unsigned int _MEMORY_SIZE){
  // Set the Maximum Storage of Addreses and Values
  props._MAX_MEMORY_BLOCK = _MEMORY_SIZE;
 } // End of setMaxMemoryBlock Function in Class Scanner
 
 template<class Type>
 void Scanner<Type>::cancelScan(){
  // Use to Cancel Scan Event
  props._CANCEL_SCAN = true;
 } // End of cancelScan Function
 
 template<class Type>
 unsigned int Scanner<Type>::getPageCount(){
  return props._PAGE_COUNT;
 } // End of getPageCount Function
 
 template<class Type>
 unsigned int Scanner<Type>::getRegionSize(){
  return props._REGION_SIZE;       
 } // End of getRegionSize Function
 
 template<class Type>
 unsigned int Scanner<Type>::getBaseAddress(){
  return props._BASE_ADDRESS;   
 } // End of getBaseAddress Function

 template<class Type>
 void Scanner<Type>::setScanType(ScanType scanStyle){
  ScanStyle = scanStyle;
 }
// ======================= END OF PUBLIC FUNCTIONS ===================== //
 template<class Type>
 bool Scanner<Type>::isEqual(Type VALUE , Type toValue){
  return (VALUE == toValue);   
 }
 
 template<class Type>
 bool Scanner<Type>::isBetween(Type VALUE , Type from , Type to ){
  return ((VALUE >= to) && (VALUE <= from));
 }
 template<class Type>
 bool Scanner<Type>::isIncresed(Type VALUE , Type before){
  return (VALUE > before);
 }
 
 template<class Type>
 bool Scanner<Type>::isDecresed(Type VALUE , Type before){
  return (VALUE < before);
 }
 
 template<class Type>
 bool Scanner<Type>::isIncreasedBy(Type VALUE , Type increment ){
  return ((VALUE - increment) == VALUE);
 }
 
 template<class Type>
 bool Scanner<Type>::isDecresedBy(Type VALUE , Type decrement ){
  return ((VALUE + decrement) == VALUE);   
 }
// ======================= END OF PRIVATE FUNCTIONS ==================== //


#endif



Form1.h
Code:

//=====
#include <windows.h>
#include "MemoryScanner.h"
#include "procHook.h"
#pragma once



namespace CriticalEngine {

   using namespace System;
   using namespace System::ComponentModel;
   using namespace System::Collections;
   using namespace System::Windows::Forms;
   using namespace System::Data;
   using namespace System::Drawing;
   
    HANDLE hProcess;
   memoryInfo<short> list_short;
   memoryInfo<int> list_int;
    memoryInfo<long> list_long;
   memoryInfo<float> list_float;
   memoryInfo<double> list_double;
   
   /// <summary>
   /// Summary for Form1
   ///
   /// WARNING: If you change the name of this class, you will need to change the
   ///          'Resource File Name' property for the managed resource compiler tool
   ///          associated with all .resx files this class depends on.  Otherwise,
   ///          the designers will not be able to interact properly with localized
   ///          resources associated with this form.
   /// </summary>
   public ref class Form1 : public System::Windows::Forms::Form
   {
   public:
      Form1(void)
      {
         InitializeComponent();
         //
         //TODO: Add the constructor code here
         //
      }

   protected:
      /// <summary>
      /// Clean up any resources being used.
      /// </summary>
      ~Form1()
      {
         if (components)
         {
            delete components;
         }
      }
   private: System::Windows::Forms::GroupBox^  gb_main;
   private: System::Windows::Forms::ListBox^  list_address;
   private: System::Windows::Forms::MenuStrip^  menuStrip1;
   private: System::Windows::Forms::ToolStripMenuItem^  fileToolStripMenuItem;
   private: System::Windows::Forms::ToolStripMenuItem^  openProcessToolStripMenuItem;
   private: System::Windows::Forms::ToolStripMenuItem^  exitToolStripMenuItem;
   private: System::Windows::Forms::Button^  btn_ns;

   private: System::Windows::Forms::Button^  btn_fs;

   private: System::Windows::Forms::ToolStripMenuItem^  openCheatTableToolStripMenuItem;
   private: System::Windows::Forms::ToolStripMenuItem^  saveCheatTableToolStripMenuItem;
   private: System::Windows::Forms::ToolStripMenuItem^  helpToolStripMenuItem;
   private: System::Windows::Forms::ToolStripMenuItem^  aboutToolStripMenuItem;
   private: System::Windows::Forms::ToolStripMenuItem^  featuresToolStripMenuItem;
   private: System::Windows::Forms::ToolStripMenuItem^  donationToolStripMenuItem;
   private: System::Windows::Forms::GroupBox^  gb_scanoption;

   private: System::Windows::Forms::ComboBox^  cbo_dataType;
   private: System::Windows::Forms::Label^  label2;
   private: System::Windows::Forms::TextBox^  txt_value;
   private: System::Windows::Forms::Label^  label1;

   private: System::Windows::Forms::ComboBox^  cbo_scanType;

   private: System::Windows::Forms::Label^  label3;
   private: System::Windows::Forms::TextBox^  txt_endRange;
   private: System::Windows::Forms::Label^  label5;
   private: System::Windows::Forms::TextBox^  txt_startRange;
   private: System::Windows::Forms::Label^  label4;
   private: System::Windows::Forms::ToolStripMenuItem^  settingsToolStripMenuItem;
   private: System::Windows::Forms::ToolStripMenuItem^  scannerOptionToolStripMenuItem;
   private: System::Windows::Forms::ToolStripMenuItem^  othersToolStripMenuItem;
   private: System::Windows::Forms::TextBox^  txt_pid;
   private: System::Windows::Forms::Label^  label6;
   private: System::Windows::Forms::Label^  lbl_info;
   public: System::Windows::Forms::ProgressBar^  pb_scan;
   private: System::Windows::Forms::ToolStripMenuItem^  write_addr;
   public:

   public:

   public:
   private:



   private: System::ComponentModel::IContainer^  components;


   protected:


   private:
      /// <summary>
      /// Required designer variable.
      /// </summary>


#pragma region Windows Form Designer generated code
      /// <summary>
      /// Required method for Designer support - do not modify
      /// the contents of this method with the code editor.
      /// </summary>
      void InitializeComponent(void)
      {
         this->gb_main = (gcnew System::Windows::Forms::GroupBox());
         this->lbl_info = (gcnew System::Windows::Forms::Label());
         this->gb_scanoption = (gcnew System::Windows::Forms::GroupBox());
         this->txt_pid = (gcnew System::Windows::Forms::TextBox());
         this->label6 = (gcnew System::Windows::Forms::Label());
         this->txt_endRange = (gcnew System::Windows::Forms::TextBox());
         this->label5 = (gcnew System::Windows::Forms::Label());
         this->txt_startRange = (gcnew System::Windows::Forms::TextBox());
         this->label4 = (gcnew System::Windows::Forms::Label());
         this->cbo_scanType = (gcnew System::Windows::Forms::ComboBox());
         this->label3 = (gcnew System::Windows::Forms::Label());
         this->cbo_dataType = (gcnew System::Windows::Forms::ComboBox());
         this->label2 = (gcnew System::Windows::Forms::Label());
         this->txt_value = (gcnew System::Windows::Forms::TextBox());
         this->label1 = (gcnew System::Windows::Forms::Label());
         this->btn_ns = (gcnew System::Windows::Forms::Button());
         this->btn_fs = (gcnew System::Windows::Forms::Button());
         this->list_address = (gcnew System::Windows::Forms::ListBox());
         this->menuStrip1 = (gcnew System::Windows::Forms::MenuStrip());
         this->fileToolStripMenuItem = (gcnew System::Windows::Forms::ToolStripMenuItem());
         this->openProcessToolStripMenuItem = (gcnew System::Windows::Forms::ToolStripMenuItem());
         this->openCheatTableToolStripMenuItem = (gcnew System::Windows::Forms::ToolStripMenuItem());
         this->saveCheatTableToolStripMenuItem = (gcnew System::Windows::Forms::ToolStripMenuItem());
         this->write_addr = (gcnew System::Windows::Forms::ToolStripMenuItem());
         this->exitToolStripMenuItem = (gcnew System::Windows::Forms::ToolStripMenuItem());
         this->settingsToolStripMenuItem = (gcnew System::Windows::Forms::ToolStripMenuItem());
         this->scannerOptionToolStripMenuItem = (gcnew System::Windows::Forms::ToolStripMenuItem());
         this->othersToolStripMenuItem = (gcnew System::Windows::Forms::ToolStripMenuItem());
         this->helpToolStripMenuItem = (gcnew System::Windows::Forms::ToolStripMenuItem());
         this->aboutToolStripMenuItem = (gcnew System::Windows::Forms::ToolStripMenuItem());
         this->featuresToolStripMenuItem = (gcnew System::Windows::Forms::ToolStripMenuItem());
         this->donationToolStripMenuItem = (gcnew System::Windows::Forms::ToolStripMenuItem());
         this->pb_scan = (gcnew System::Windows::Forms::ProgressBar());
         this->gb_main->SuspendLayout();
         this->gb_scanoption->SuspendLayout();
         this->menuStrip1->SuspendLayout();
         this->SuspendLayout();
         //
         // gb_main
         //
         this->gb_main->Controls->Add(this->lbl_info);
         this->gb_main->Controls->Add(this->gb_scanoption);
         this->gb_main->Controls->Add(this->btn_ns);
         this->gb_main->Controls->Add(this->btn_fs);
         this->gb_main->Controls->Add(this->list_address);
         this->gb_main->Font = (gcnew System::Drawing::Font(L"Microsoft Sans Serif", 9.75F, System::Drawing::FontStyle::Regular, System::Drawing::GraphicsUnit::Point,
            static_cast<System::Byte>(0)));
         this->gb_main->Location = System::Drawing::Point(12, 44);
         this->gb_main->Name = L"gb_main";
         this->gb_main->Size = System::Drawing::Size(599, 426);
         this->gb_main->TabIndex = 1;
         this->gb_main->TabStop = false;
         //
         // lbl_info
         //
         this->lbl_info->AutoSize = true;
         this->lbl_info->Location = System::Drawing::Point(6, 18);
         this->lbl_info->Name = L"lbl_info";
         this->lbl_info->Size = System::Drawing::Size(15, 16);
         this->lbl_info->TabIndex = 9;
         this->lbl_info->Text = L"_";
         //
         // gb_scanoption
         //
         this->gb_scanoption->Controls->Add(this->txt_pid);
         this->gb_scanoption->Controls->Add(this->label6);
         this->gb_scanoption->Controls->Add(this->txt_endRange);
         this->gb_scanoption->Controls->Add(this->label5);
         this->gb_scanoption->Controls->Add(this->txt_startRange);
         this->gb_scanoption->Controls->Add(this->label4);
         this->gb_scanoption->Controls->Add(this->cbo_scanType);
         this->gb_scanoption->Controls->Add(this->label3);
         this->gb_scanoption->Controls->Add(this->cbo_dataType);
         this->gb_scanoption->Controls->Add(this->label2);
         this->gb_scanoption->Controls->Add(this->txt_value);
         this->gb_scanoption->Controls->Add(this->label1);
         this->gb_scanoption->Location = System::Drawing::Point(269, 72);
         this->gb_scanoption->Name = L"gb_scanoption";
         this->gb_scanoption->Size = System::Drawing::Size(304, 211);
         this->gb_scanoption->TabIndex = 8;
         this->gb_scanoption->TabStop = false;
         this->gb_scanoption->Text = L"Scan Option";
         //
         // txt_pid
         //
         this->txt_pid->Location = System::Drawing::Point(66, 177);
         this->txt_pid->Name = L"txt_pid";
         this->txt_pid->Size = System::Drawing::Size(216, 22);
         this->txt_pid->TabIndex = 14;
         this->txt_pid->TextAlign = System::Windows::Forms::HorizontalAlignment::Center;
         //
         // label6
         //
         this->label6->AutoSize = true;
         this->label6->Location = System::Drawing::Point(5, 183);
         this->label6->Name = L"label6";
         this->label6->Size = System::Drawing::Size(30, 16);
         this->label6->TabIndex = 15;
         this->label6->Text = L"PID";
         //
         // txt_endRange
         //
         this->txt_endRange->Location = System::Drawing::Point(66, 146);
         this->txt_endRange->Name = L"txt_endRange";
         this->txt_endRange->Size = System::Drawing::Size(216, 22);
         this->txt_endRange->TabIndex = 12;
         this->txt_endRange->Text = L"7FFFFFFF";
         this->txt_endRange->TextAlign = System::Windows::Forms::HorizontalAlignment::Right;
         //
         // label5
         //
         this->label5->AutoSize = true;
         this->label5->Location = System::Drawing::Point(5, 149);
         this->label5->Name = L"label5";
         this->label5->Size = System::Drawing::Size(32, 16);
         this->label5->TabIndex = 13;
         this->label5->Text = L"End";
         //
         // txt_startRange
         //
         this->txt_startRange->Location = System::Drawing::Point(66, 118);
         this->txt_startRange->Name = L"txt_startRange";
         this->txt_startRange->Size = System::Drawing::Size(216, 22);
         this->txt_startRange->TabIndex = 10;
         this->txt_startRange->Text = L"00000000";
         this->txt_startRange->TextAlign = System::Windows::Forms::HorizontalAlignment::Right;
         //
         // label4
         //
         this->label4->AutoSize = true;
         this->label4->Location = System::Drawing::Point(5, 121);
         this->label4->Name = L"label4";
         this->label4->Size = System::Drawing::Size(35, 16);
         this->label4->TabIndex = 11;
         this->label4->Text = L"Start";
         //
         // cbo_scanType
         //
         this->cbo_scanType->DropDownStyle = System::Windows::Forms::ComboBoxStyle::DropDownList;
         this->cbo_scanType->FormattingEnabled = true;
         this->cbo_scanType->Location = System::Drawing::Point(66, 88);
         this->cbo_scanType->Name = L"cbo_scanType";
         this->cbo_scanType->Size = System::Drawing::Size(216, 24);
         this->cbo_scanType->TabIndex = 9;
         //
         // label3
         //
         this->label3->AutoSize = true;
         this->label3->Location = System::Drawing::Point(6, 91);
         this->label3->Name = L"label3";
         this->label3->Size = System::Drawing::Size(39, 16);
         this->label3->TabIndex = 8;
         this->label3->Text = L"Scan";
         //
         // cbo_dataType
         //
         this->cbo_dataType->DropDownStyle = System::Windows::Forms::ComboBoxStyle::DropDownList;
         this->cbo_dataType->FormattingEnabled = true;
         this->cbo_dataType->Location = System::Drawing::Point(66, 57);
         this->cbo_dataType->Name = L"cbo_dataType";
         this->cbo_dataType->Size = System::Drawing::Size(216, 24);
         this->cbo_dataType->TabIndex = 6;
         //
         // label2
         //
         this->label2->AutoSize = true;
         this->label2->Location = System::Drawing::Point(6, 60);
         this->label2->Name = L"label2";
         this->label2->Size = System::Drawing::Size(40, 16);
         this->label2->TabIndex = 7;
         this->label2->Text = L"Type";
         //
         // txt_value
         //
         this->txt_value->Location = System::Drawing::Point(66, 26);
         this->txt_value->Name = L"txt_value";
         this->txt_value->Size = System::Drawing::Size(216, 22);
         this->txt_value->TabIndex = 4;
         this->txt_value->TextAlign = System::Windows::Forms::HorizontalAlignment::Center;
         //
         // label1
         //
         this->label1->AutoSize = true;
         this->label1->Location = System::Drawing::Point(5, 29);
         this->label1->Name = L"label1";
         this->label1->Size = System::Drawing::Size(43, 16);
         this->label1->TabIndex = 5;
         this->label1->Text = L"Value";
         //
         // btn_ns
         //
         this->btn_ns->Location = System::Drawing::Point(446, 43);
         this->btn_ns->Name = L"btn_ns";
         this->btn_ns->Size = System::Drawing::Size(94, 23);
         this->btn_ns->TabIndex = 3;
         this->btn_ns->Text = L"Next Scan";
         this->btn_ns->UseVisualStyleBackColor = true;
         this->btn_ns->Click += gcnew System::EventHandler(this, &Form1::btn_ns_Click);
         //
         // btn_fs
         //
         this->btn_fs->Location = System::Drawing::Point(292, 43);
         this->btn_fs->Name = L"btn_fs";
         this->btn_fs->Size = System::Drawing::Size(94, 23);
         this->btn_fs->TabIndex = 2;
         this->btn_fs->Text = L"First Scan";
         this->btn_fs->UseVisualStyleBackColor = true;
         this->btn_fs->Click += gcnew System::EventHandler(this, &Form1::btn_fs_Click);
         //
         // list_address
         //
         this->list_address->FormattingEnabled = true;
         this->list_address->ItemHeight = 16;
         this->list_address->Location = System::Drawing::Point(6, 43);
         this->list_address->Name = L"list_address";
         this->list_address->Size = System::Drawing::Size(251, 244);
         this->list_address->TabIndex = 1;
         this->list_address->SelectedIndexChanged += gcnew System::EventHandler(this, &Form1::list_address_SelectedIndexChanged);
         //
         // menuStrip1
         //
         this->menuStrip1->Items->AddRange(gcnew cli::array< System::Windows::Forms::ToolStripItem^  >(3) {this->fileToolStripMenuItem,
            this->settingsToolStripMenuItem, this->helpToolStripMenuItem});
         this->menuStrip1->Location = System::Drawing::Point(0, 0);
         this->menuStrip1->Name = L"menuStrip1";
         this->menuStrip1->Size = System::Drawing::Size(623, 24);
         this->menuStrip1->TabIndex = 2;
         this->menuStrip1->Text = L"menu_list";
         //
         // fileToolStripMenuItem
         //
         this->fileToolStripMenuItem->DropDownItems->AddRange(gcnew cli::array< System::Windows::Forms::ToolStripItem^  >(5) {this->openProcessToolStripMenuItem,
            this->openCheatTableToolStripMenuItem, this->saveCheatTableToolStripMenuItem, this->write_addr, this->exitToolStripMenuItem});
         this->fileToolStripMenuItem->Name = L"fileToolStripMenuItem";
         this->fileToolStripMenuItem->Size = System::Drawing::Size(35, 20);
         this->fileToolStripMenuItem->Text = L"File";
         //
         // openProcessToolStripMenuItem
         //
         this->openProcessToolStripMenuItem->Name = L"openProcessToolStripMenuItem";
         this->openProcessToolStripMenuItem->Size = System::Drawing::Size(227, 22);
         this->openProcessToolStripMenuItem->Text = L"Open Process";
         this->openProcessToolStripMenuItem->Click += gcnew System::EventHandler(this, &Form1::openProcessToolStripMenuItem_Click);
         //
         // openCheatTableToolStripMenuItem
         //
         this->openCheatTableToolStripMenuItem->Name = L"openCheatTableToolStripMenuItem";
         this->openCheatTableToolStripMenuItem->Size = System::Drawing::Size(227, 22);
         this->openCheatTableToolStripMenuItem->Text = L"Open Cheat Table";
         //
         // saveCheatTableToolStripMenuItem
         //
         this->saveCheatTableToolStripMenuItem->Name = L"saveCheatTableToolStripMenuItem";
         this->saveCheatTableToolStripMenuItem->Size = System::Drawing::Size(227, 22);
         this->saveCheatTableToolStripMenuItem->Text = L"Save Cheat Table";
         //
         // write_addr
         //
         this->write_addr->Name = L"write_addr";
         this->write_addr->Size = System::Drawing::Size(227, 22);
         this->write_addr->Text = L"Write in the Selected Address";
         this->write_addr->Click += gcnew System::EventHandler(this, &Form1::write_addr_Click);
         //
         // exitToolStripMenuItem
         //
         this->exitToolStripMenuItem->Name = L"exitToolStripMenuItem";
         this->exitToolStripMenuItem->Size = System::Drawing::Size(227, 22);
         this->exitToolStripMenuItem->Text = L"Exit";
         this->exitToolStripMenuItem->Click += gcnew System::EventHandler(this, &Form1::exitToolStripMenuItem_Click);
         //
         // settingsToolStripMenuItem
         //
         this->settingsToolStripMenuItem->DropDownItems->AddRange(gcnew cli::array< System::Windows::Forms::ToolStripItem^  >(2) {this->scannerOptionToolStripMenuItem,
            this->othersToolStripMenuItem});
         this->settingsToolStripMenuItem->Name = L"settingsToolStripMenuItem";
         this->settingsToolStripMenuItem->Size = System::Drawing::Size(58, 20);
         this->settingsToolStripMenuItem->Text = L"Settings";
         //
         // scannerOptionToolStripMenuItem
         //
         this->scannerOptionToolStripMenuItem->Name = L"scannerOptionToolStripMenuItem";
         this->scannerOptionToolStripMenuItem->Size = System::Drawing::Size(166, 22);
         this->scannerOptionToolStripMenuItem->Text = L"Scanner Settings";
         //
         // othersToolStripMenuItem
         //
         this->othersToolStripMenuItem->Name = L"othersToolStripMenuItem";
         this->othersToolStripMenuItem->Size = System::Drawing::Size(166, 22);
         this->othersToolStripMenuItem->Text = L"Others";
         //
         // helpToolStripMenuItem
         //
         this->helpToolStripMenuItem->DropDownItems->AddRange(gcnew cli::array< System::Windows::Forms::ToolStripItem^  >(3) {this->aboutToolStripMenuItem,
            this->featuresToolStripMenuItem, this->donationToolStripMenuItem});
         this->helpToolStripMenuItem->Name = L"helpToolStripMenuItem";
         this->helpToolStripMenuItem->Size = System::Drawing::Size(40, 20);
         this->helpToolStripMenuItem->Text = L"Help";
         //
         // aboutToolStripMenuItem
         //
         this->aboutToolStripMenuItem->Name = L"aboutToolStripMenuItem";
         this->aboutToolStripMenuItem->Size = System::Drawing::Size(128, 22);
         this->aboutToolStripMenuItem->Text = L"About";
         //
         // featuresToolStripMenuItem
         //
         this->featuresToolStripMenuItem->Name = L"featuresToolStripMenuItem";
         this->featuresToolStripMenuItem->Size = System::Drawing::Size(128, 22);
         this->featuresToolStripMenuItem->Text = L"Features";
         //
         // donationToolStripMenuItem
         //
         this->donationToolStripMenuItem->Name = L"donationToolStripMenuItem";
         this->donationToolStripMenuItem->Size = System::Drawing::Size(128, 22);
         this->donationToolStripMenuItem->Text = L"Donation";
         //
         // pb_scan
         //
         this->pb_scan->Location = System::Drawing::Point(12, 27);
         this->pb_scan->Name = L"pb_scan";
         this->pb_scan->Size = System::Drawing::Size(599, 23);
         this->pb_scan->TabIndex = 3;
         //
         // Form1
         //
         this->AutoScaleDimensions = System::Drawing::SizeF(6, 13);
         this->AutoScaleMode = System::Windows::Forms::AutoScaleMode::Font;
         this->ClientSize = System::Drawing::Size(623, 482);
         this->Controls->Add(this->pb_scan);
         this->Controls->Add(this->gb_main);
         this->Controls->Add(this->menuStrip1);
         this->FormBorderStyle = System::Windows::Forms::FormBorderStyle::FixedToolWindow;
         this->MainMenuStrip = this->menuStrip1;
         this->Name = L"Form1";
         this->StartPosition = System::Windows::Forms::FormStartPosition::CenterScreen;
         this->Text = L"Critical Engine Beta";
         this->Load += gcnew System::EventHandler(this, &Form1::Form1_Load);
         this->gb_main->ResumeLayout(false);
         this->gb_main->PerformLayout();
         this->gb_scanoption->ResumeLayout(false);
         this->gb_scanoption->PerformLayout();
         this->menuStrip1->ResumeLayout(false);
         this->menuStrip1->PerformLayout();
         this->ResumeLayout(false);
         this->PerformLayout();

      }
#pragma endregion
   private: System::Void Form1_Load(System::Object^  sender, System::EventArgs^  e) {
           // Initialization of Form Controls
      
           cbo_dataType->Items->Add("Byte");
           cbo_dataType->Items->Add("2 Bytes");
           cbo_dataType->Items->Add("4 Bytes");
           cbo_dataType->Items->Add("8 Bytes");
           cbo_dataType->Items->Add("Float");
           cbo_dataType->Items->Add("Double");
           cbo_dataType->Items->Add("String");
           cbo_dataType->Items->Add("Array of Bytes");
           cbo_dataType->SelectedIndex = 2;
           cbo_dataType->DropDownStyle = ComboBoxStyle::DropDownList;
           // cbo_dataType->ItemCount = 8

           cbo_scanType->Items->Add("Exact Value");
           cbo_scanType->Items->Add("Increased Value");
           cbo_scanType->Items->Add("Increased Value By");
           cbo_scanType->Items->Add("Decreased Value");
           cbo_scanType->Items->Add("Decreased Value By");
           cbo_scanType->Items->Add("Value Between");
           cbo_scanType->Items->Add("Unknown Initial Value");
           cbo_scanType->SelectedIndex = 0;
           cbo_scanType->DropDownStyle = ComboBoxStyle::DropDownList;
           lbl_info->Text = "";
              // cbo_scanType->ItemCount = 7

          
          }
private: System::Void openProcessToolStripMenuItem_Click(System::Object^  sender, System::EventArgs^  e) {
        // Open a Process
          if(txt_pid->Text->Length <= 0){
             MessageBox::Show("Please enter a PID!" , "Error" , MessageBoxButtons::OK);
          }else{
           procHook hooker;
           DWORD pid = Convert::ToInt32(txt_pid->Text->Trim());
            hProcess = hooker.createHandleByPID(pid);
          }
       }
private: System::Void btn_fs_Click(System::Object^  sender, System::EventArgs^  e) {
          if(btn_fs->Text->Equals("New Scan")){
             btn_fs->Text = "First Scan";
              list_address->Items->Clear();
          }else{
                     if(txt_value->Text->Length <= 0){
             MessageBox::Show("Please enter a value!" , "Error" , MessageBoxButtons::OK);
          }else{
           // switch for a data type [specified size of bytes to read]
             btn_fs->Text = "New Scan";
             switch(cbo_dataType->SelectedIndex){
              case 2:goto _4ByteScan;
             } // End of Switch

_4ByteScan:
// Start of 4 Byte Scan
MEMORY_BASIC_INFORMATION _MBI;
LPVOID _BASE_ADDRESS = 0;
VirtualQueryEx(hProcess , (void *)_BASE_ADDRESS, &_MBI, sizeof(_MBI));
list_int.Pointer = 0;
Scanner<int> *s = new Scanner<int>(hProcess, _MBI , 0x0 , 0x7FFFFFFF);
s->Option(false , true , true , 4);
s->setMaxMemoryBlock(0x7FFFFFF);
s->setScanType(ExactValue); //  ExactValue
s->FirstScan(list_int , System::Convert::ToInt32(txt_value->Text->Trim()) , 0);

for(unsigned int a = 0; a < list_int.Pointer; a++){
   //reinterpret_cast<void *>()
   char buffer[] = {'0','0','0','0','0','0','0','0','0','0'};

   scanf_s("%x",&list_int.Address[a]);
    _itoa_s(list_int.Address[a],buffer,16);
   String ^temp = gcnew System::String(buffer);
    //
   if(temp->Length < 8){
      while(temp->Length != 8){
       temp = "0" + temp;
      }
   }

   //
    list_address->Items->Add(temp->ToUpper());
}
lbl_info->Text = Convert::ToString(L"Found : " + list_int.Pointer);


           }
          }

       }
private: System::Void btn_ns_Click(System::Object^  sender, System::EventArgs^  e) {
           if(txt_value->Text->Length <= 0){
             MessageBox::Show("Please enter a value!" , "Error" , MessageBoxButtons::OK);
           }else{
            // switch for a data type [specified size of bytes to read]
             switch(cbo_dataType->SelectedIndex){
              case 2:goto _4ByteScan;
             } // End of Switch
_4ByteScan:
// Start of 4 Byte Scan
list_address->Items->Clear();
MEMORY_BASIC_INFORMATION _MBI;
LPVOID _BASE_ADDRESS = reinterpret_cast<void *>(list_int.Address[0]);
VirtualQueryEx(hProcess , (void *)_BASE_ADDRESS, &_MBI, sizeof(_MBI));
Scanner<int> *s = new Scanner<int>(hProcess, _MBI , 0x0 , 0x7FFFFFFF);
s->Option(false , true , true , 4);
s->setMaxMemoryBlock(0x7FFFFFF);
s->setScanType(ExactValue); //  ExactValue
s->NextScan(list_int , System::Convert::ToInt32(txt_value->Text->Trim()) , 0);


for(unsigned int a = 0; a < list_int.Pointer; a++){
   //reinterpret_cast<void *>()
   char buffer[] = {'0','0','0','0','0','0','0','0','0','0'};

   scanf_s("%x",&list_int.Address[a]);
    _itoa_s(list_int.Address[a],buffer,16);
   String ^temp = gcnew System::String(buffer);
    //
   if(temp->Length < 8){
      while(temp->Length != 8){
       temp = "0" + temp;
      }
   }

   //
    list_address->Items->Add(temp->ToUpper());



}
lbl_info->Text = Convert::ToString(L"Found : " + list_int.Pointer);

           }
       }
private: System::Void exitToolStripMenuItem_Click(System::Object^  sender, System::EventArgs^  e) {
   
       }
private: System::Void list_address_SelectedIndexChanged(System::Object^  sender, System::EventArgs^  e) {
          if(list_address->Items->Count <= 0){
           write_addr->Enabled = false;
          }else{
           write_addr->Enabled = true;
          }
       }
private: System::Void write_addr_Click(System::Object^  sender, System::EventArgs^  e) {
          WriteProcessMemory(hProcess, (void *)Convert::ToInt32(list_address->SelectedItem->ToString()) , (LPCVOID)Convert::ToInt32(txt_value->Text), sizeof(Convert::ToInt32(txt_value->Text)) , 0);
       }
};   
}




procHook.h
Code:

//=====
#ifndef H_procHook
#define H_procHook
#include<iostream>
#include<windows.h>

using namespace std;

 //================This is use to Handle Process using PID of a Process , etc==================
 class procHook
 {
  public:
  DWORD getProcessidByProcessName(string processName);
  DWORD getProcessidByWindow(string windowName);
  HANDLE adjustPriv(DWORD pid);
  HANDLE createHandleByPID(DWORD pid);
  void createHandle();
  void isHandled();
  private:
  DWORD pid;
  HANDLE phandle; 
  bool handled;     
 };
 
 /*HANDLE procHook::adjustPriv(DWORD pid){
 
  TOKEN_PRIVILEGES priv;
  HANDLE hThis, hToken;
  LUID luid;
  hThis = OpenProcess(PROCESS_QUERY_INFORMATION | PROCESS_VM_READ , 0 , pid);

  OpenProcessToken(hThis , TOKEN_ADJUST_PRIVILEGES , &hToken);
  LookupPrivilegeValue(0, L"SeDebugPrivilege" , &luid);
  priv.PrivilegeCount = 1;
  priv.Privileges[0].Luid = luid;
  priv.Privileges[0].Attributes = SE_PRIVILEGE_ENABLED;
  AdjustTokenPrivileges(hToken , false , &priv , 0, 0, 0);
 
  CloseHandle(hToken);
  CloseHandle(hThis);
 
  hThis = OpenProcess(PROCESS_VM_READ | PROCESS_VM_WRITE | PROCESS_VM_OPERATION | PROCESS_QUERY_INFORMATION , 0 , pid);

  return hThis;
 }*/

 HANDLE procHook::createHandleByPID(DWORD pid)
 {
  system("tasklist");
  cout << "\nEnter the PID: ";
  cin >> pid;

  HANDLE tempHandle = OpenProcess(PROCESS_VM_READ | PROCESS_VM_WRITE | PROCESS_VM_OPERATION | PROCESS_QUERY_INFORMATION , 0 , pid);

  if(!tempHandle)
  { // Start Check if Handled
   cout << "Failed to handle PID " << pid;   
   return tempHandle; 
  } // End Check if Handled
  else
  { // If Handled
    phandle = tempHandle;
    handled = true;
    return phandle;
  } // End if Handled
 }
 
 
 
 #endif



if you need more about this app feel free to ask me,. because i really need your help., i just want to make this app Fix and usable before i go to school again.
Back to top
View user's profile Send private message
Stylo
Grandmaster Cheater Supreme
Reputation: 3

Joined: 16 May 2007
Posts: 1073
Location: Israel

PostPosted: Mon May 26, 2014 2:22 am    Post subject: Reply with quote

Execute the scanning from a separate thread, that way the current thread (GUI's thread) won't have to wait for the scan to end.
_________________
Stylo
Back to top
View user's profile Send private message
atom0s
Moderator
Reputation: 205

Joined: 25 Jan 2006
Posts: 8587
Location: 127.0.0.1

PostPosted: Mon May 26, 2014 2:06 pm    Post subject: Reply with quote

You are calling ReadProcessMemory way too much which is causing your major slow downs as well. For each page, dump the whole page into your application (or a temp file on disk) and then scan through that instead of reading 4 bytes at a time from the process.
_________________
- Retired.
Back to top
View user's profile Send private message Visit poster's website
Polynomial
Grandmaster Cheater
Reputation: 5

Joined: 17 Feb 2008
Posts: 524
Location: Inside the Intel CET shadow stack

PostPosted: Sat May 31, 2014 6:43 pm    Post subject: Reply with quote

atom0s wrote:
For each page, dump the whole page into your application


Or, even better, grab a few hundred pages at a time and only grab individual pages if the operation fails. That way, for large contiguous readable memory blocks, you get much better performance.

_________________
It's not fun unless every exploit mitigation is enabled.
Please do not reply to my posts with LLM-generated slop; I consider it to be an insult to my time.
Back to top
View user's profile Send private message
porring09
Newbie cheater
Reputation: 0

Joined: 11 Feb 2014
Posts: 11

PostPosted: Sat May 31, 2014 11:37 pm    Post subject: Reply with quote

Thank you sir(S) for your replie(s)

I didn't get what you mean , but i have an idea

You just say if the VirtualQueryEx detects the page is Readable/Writable
i should read the whole Page/Region <For example the Size of Page/Region is 65536> then i should read it with ReadProcessMemory in just one Swipe!

then put it in a dump(a File) to prevent too much memory Space Usage,
then Read the File Base on what Type(Size) i need , like int = 4 Bytes

sir can you give me an example please? Sad
* How to dump Read Bytes(Chunk of ReadBytes) into a temporary file
* How to Read Bytes from the temporary file then put it in an Array for the next scan event
* Pseudocode , Algorithm , Sample Source Code.


with comments, i would like to understand the logic, flow for better performance of the app.


Thank you again..
Back to top
View user's profile Send private message
ProjectEz
Newbie cheater
Reputation: 0

Joined: 03 Dec 2011
Posts: 18
Location: Phlippines

PostPosted: Sun Jun 01, 2014 12:23 am    Post subject: Reply with quote

I saw something like that in codeproject, unfortunately, as I can remember, it is in C#...
but his process in creating a dump file is writing to a text file,
so probably, you can read that too line by line, you can just google it, it will be a great help for you Smile
Also thank you for this thread, gave me lots of idea...
Back to top
View user's profile Send private message
Polynomial
Grandmaster Cheater
Reputation: 5

Joined: 17 Feb 2008
Posts: 524
Location: Inside the Intel CET shadow stack

PostPosted: Sun Jun 01, 2014 6:48 am    Post subject: Reply with quote

You could also do heap enumeration, similar to how this blog post shows. If you only want to target heap memory (most things are in heap) rather than static stuff from PE segments, and don't care about memory created with VirtualAlloc, you'll get a really awesome overview of the process memory space and massively reduce overheads.

To answer your questions:

"How to dump Read Bytes(Chunk of ReadBytes) into a temporary file"

That's simple. System.IO contains a class called File, with a static method called WriteAllBytes. To get a temporary file, try Path.GetTempFileName, then write to that.

"How to Read Bytes from the temporary file then put it in an Array for the next scan event "

Turns out that's easy too. Just take your temp file name and use File.ReadAllBytes(path) to get your byte array back.

"Pseudocode , Algorithm , Sample Source Code."

I'll leave that bit to you. It's not difficult to work out what it's meant to do.

_________________
It's not fun unless every exploit mitigation is enabled.
Please do not reply to my posts with LLM-generated slop; I consider it to be an insult to my time.
Back to top
View user's profile Send private message
porring09
Newbie cheater
Reputation: 0

Joined: 11 Feb 2014
Posts: 11

PostPosted: Tue Jun 03, 2014 10:25 pm    Post subject: Reply with quote

Thank you Burningmace for your answer Smile

I'll gonna try it now Smile

If i have some problems, i will tell it again here..

Thank you all of you Smile
Back to top
View user's profile Send private message
porring09
Newbie cheater
Reputation: 0

Joined: 11 Feb 2014
Posts: 11

PostPosted: Sat Jun 07, 2014 11:29 pm    Post subject: Still Fail Reply with quote

Sir thank you for your previous replies Smile

But i have a problem Sad

I hope you will help me again.

*I dump all addresses that is equal to the given value.(Therefore i don't need to store all Addresses in a Large number Length or Array.)

*I can read a 256 Bytes as 1 chunk then Splt it into 256 Array Sized.
(I can't Read more than 256 , like 1024 , 2048 , 4096) the application abnormally exits when i read a chunk of bytes with the size of more than 256.

Problem:
*Can't read more than 256 bytes
*After Splitting up the 256 bytes and then scan per 4 bytes(meaning build a 4 bytes = Convert Array of 4 bytes into 1 integer value) then if equal to the given value , dump the given address to the temporary file.
It gives me some error whenever i try to do this

Read 256 Bytes -> Assume the the Value of Chunk(256 Bytes is 65536)
-> Split into array of 256 -> Scan it by the number of bytes(eg: 4 bytes) -> Loop until the index is (Index < (ArraySize - (ScanSetBytes - 1))) ->
Build the 4 bytes into a 1 value -> If Equal then Dump the Given Address.

Please is anyone can give me an example? Sad
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Cheat Engine Forum Index -> General programming All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group

CE Wiki   IRC (#CEF)   Twitter
Third party websites