Results 1 to 5 of 5
  1. #1
    Dwar
    Dwar is offline
    Veteran Dwar's Avatar
    Join Date
    2010 Mar
    Posts
    2,221
    Thanks
    211
    Thanked 2,224 Times in 289 Posts
    Rep Power
    10

    [C++] Basic memory-scanning in DLL

    Basic memory-scanning in DLL


    Header with functions for searching thru the current applications memory for a certain value.
    The add_log function is just a function which prints to a log-file using a stream.
     /*
    Memory-scanner/searcher

    Syntax
    dwScanMemory(
    DWORD dwScanStart,
    DWORD dwScanEnd,
    int fValueToScanFor,
    int iValueType
    );

    Parameters
    dwScanStart
    offset to start scanning from, eg. 0x00400000
    dwScanEnd
    offset to end scanning on, eg. 0x00500000
    fValueToScanFor
    the value to scan for
    iValueType
    Data-type of the value
    0: char (1 byte)
    1: short (2 bytes)
    2: int (4 bytes)
    3: float (4 bytes & decimals)
    4: double (8 bytes & decimals)

    Return
    If it finds value it returns the offset, if not found returns 0.

    <[email protected]>
    */
    DWORD dwScanMemory( DWORD dwScanStart, DWORD dwScanEnd, float fValueToScanFor, int iValueType )
    {
    DWORD dwScanOffset = dwScanStart; //holds current offset
    char* cScanValue; //temporary variable.. holds value of current offset
    bool bScan = true; //if true, end scanning
    if( iValueType == 1 ){ short vScanFor = fValueToScanFor; }
    else if( iValueType == 2 ){ int vScanFor = fValueToScanFor; }
    else if( iValueType == 3 ){ float vScanFor = fValueToScanFor; }
    else if( iValueType == 4 ){ double vScanFor = fValueToScanFor; }
    else{ char vScanFor = fValueToScanFor; }
    add_log("Starting to scan memory for %i",vScanFor);
    while(bScan == true){ //while we're scanning, no result found
    dwScanOffset += 0x00000001; //move to next offset
    cScanValue = (char*)dwScanOffset; //set cScanValue to the current value
    if(*cScanValue == vScanFor){ //if the current value is same as the one we're scanning for
    add_log("Value found (%i) * %d",vScanFor,dwScanOffset); } //add it to the log
    if(dwScanOffset == dwScanEnd){ //if we reached the end of the scan-range
    add_log("Reached end of scan-range"); bScan = false; } //end scanning
    }
    return dwScanOffset; //return the offset that was found
    }

    Author: Mr. Novocain
    Please, post your questions on forum, not by PM or mail

    I spend my time, so please pay a little bit of your time to keep world in equilibrium

  2. #2
    TEDSON
    TEDSON is offline
    New member
    Join Date
    2010 Nov
    Posts
    6
    Thanks
    0
    Thanked 1 Time in 1 Post
    Rep Power
    0

    Re: [C++] Basic memory-scanning in DLL

    Hi, I just found you forum while searching for memory scan code, Im sorry but Im a massive noob.

    Can I compile this code as dll and call the function from withing the process I want to read the memory from?

    I'm working with an online flash game, which I load into a gui via an IE object.

    Cheat engine finds the value Im looking for really quicly and there are always only 4 addresses at which it finds it, 3 of which are good for my needs.

    The value is a double.

    As I say Im really noob and dont know anything about dll injection, but figure I dont need it since the running process I want to read belongs to myself.

    The code I have is written in an interpreted scripting language, but has no problems calling dll functions.

    I hope you can clarify some of my noob questions and appreciate any help you can offer.

  3. #3
    MrSmith
    MrSmith is offline
    Member-in-training
    Join Date
    2010 Aug
    Posts
    85
    Thanks
    9
    Thanked 7 Times in 4 Posts
    Rep Power
    0

    Re: [C++] Basic memory-scanning in DLL

    For flash games it's probably better to decompile it and see the functions. Then from your app call the function and set the value.
    Ever Danced With The Devil By The Pale Moonlight ?

  4. #4
    TEDSON
    TEDSON is offline
    New member
    Join Date
    2010 Nov
    Posts
    6
    Thanks
    0
    Thanked 1 Time in 1 Post
    Rep Power
    0

    Re: [C++] Basic memory-scanning in DLL

    Thanks for the reply, but the game is online, and although I have tried decompiling it, most code is server side, and I have nothing useful from this.

    I dont want to do much with the value Im looking for other than read it, my big problem is finding its address.

    Thanks.

  5. #5
    TEDSON
    TEDSON is offline
    New member
    Join Date
    2010 Nov
    Posts
    6
    Thanks
    0
    Thanked 1 Time in 1 Post
    Rep Power
    0
    Seems my last post was lost.

    Wanted to ask how to determine dwScanStart and dwScanEnd values.

Visitors found this page by searching for:

c memory scanner

c# memory scanner

c Scan Memory

dll memory scan

Memory Scan dll

c memory scan

memory scanner dll

c dll memory scanner

memory scanner c

how to scan memory files using c c memory scanner sourcec Memory ScanningC memory scanner dllc scan process memoryscan process memory c dll scan code in c memory scanning cdwScanMemoryc# scan memoryc memory scan sourcememory scanner c#C Scanning Memorydll scan memoryscan memory valuedll memery scaner

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •