Jump to content
Welcome, Guest
Existing user? Sign In

Sign In



Sign Up
The MatriX
  • Welcome To Ghbsys
  • CS GO Streaming Version is released. Have fun streaming while cheating!
  • Have a Payment Issue? Send us a Support ticket.
  • Make a thread if you need support or join our discord for live support.
  • Have Suggestions? Make a thread and you'll earn Ghbsys Points for implemented suggestions.
  • Join our discord to stay well connected! Don't forget to integrate your discord to the site
  • Welcome to [GHB] - GAmEhAcKbAsTaRdS Forum

    Welcome to [GHB] - GAmEhAcKbAsTaRdS Forum, like most online communities you must register to view or post in our community, but don't worry this is a simple free process that requires minimal information for you to signup. Be apart of [GHB] - GAmEhAcKbAsTaRdS Forum by signing in or creating an account.
    • Start new topics and reply to others
    • Subscribe to topics and forums to get email updates
    • Get your own profile page and make new friends
    • Send personal messages to other members.

    Memory-writing functions


    Novoc
     Share

    Recommended Posts

    Just something I wrote up, handy.

     

    Wrote it to simply write Jumps, use for w/e.

     

    WriteMemory - write an byte-array to memory-address.

    WriteJump - both arguments are addresses, where to jump from and where to jump to.

    WriteNop - address and how many to write.

     

    [hide_me]

    //n! yo
    
    #ifndef MEMUTILS_H
    #define MEMUTILS_H
    
    BOOL WriteMemory( DWORD dwAddress, const void* cpvPatch, DWORD dwSize )
    {
    DWORD dwProtect;
    
    if( VirtualProtect( (void*)dwAddress, dwSize, PAGE_READWRITE, &dwProtect ) ) //Unprotect the memory
    	memcpy( (void*)dwAddress, cpvPatch, dwSize ); //Write our patch
    else
    	return false; //Failed to unprotect, so return false..
    
    return VirtualProtect( (void*)dwAddress, dwSize, dwProtect, new DWORD ); //Reprotect the memory
    }
    
    BOOL WriteJump( DWORD From, DWORD To )
    {
    if( To < From + 128 && To > From - 128 ) //Short jump
    {
    	BYTE bpJump[2] = { 0xEB, ( To - From ) - 2 }; //Calculate opcode
    
    	return WriteMemory( From, bpJump, 2 );
    }
    else //Far jump
    {
    	BYTE bpJump[5] = { 0xE9, 0x00, 0x00, 0x00, 0x00 };
    	*(DWORD*)&bpJump[1] = ( To - From ) - 5; //Calculate jump
    
    	return WriteMemory( From, bpJump, 5 );
    }
    
    return false; //If we end up here, something went horribly wrong
    }
    
    BOOL WriteNop( DWORD dwAddress, DWORD dwAmount )
    {
    BYTE bpNops[100]; //100 just incase I wanna do some gigantic NOPing 
    memset( bpNops, 0x90, 100 ); //Fill byte-array with NOPs
    
    return WriteMemory( dwAddress, bpNops, dwAmount );
    }
    
    #endif

    [/hide_me]

    Edited by Novoc
    Link to comment
    Share on other sites

    • Replies 207
    • Created
    • Last Reply

    Top Posters In This Topic

    Just something I wrote up, handy.

     

    Wrote it to simply write Jumps, use for w/e.

     

    WriteMemory - write an byte-array to memory-address.

    WriteJump - both arguments are addresses, where to jump from and where to jump to.

    WriteNop - address and how many to write.

     

    [ Hidden part. View original post. ]

    reply

    Link to comment
    Share on other sites

    Just something I wrote up, handy.

     

    Wrote it to simply write Jumps, use for w/e.

     

    WriteMemory - write an byte-array to memory-address.

    WriteJump - both arguments are addresses, where to jump from and where to jump to.

    WriteNop - address and how many to write.

     

    [ Hidden part. View original post. ]

    lemme see!!!

    Link to comment
    Share on other sites

    Just something I wrote up, handy.

     

    Wrote it to simply write Jumps, use for w/e.

     

    WriteMemory - write an byte-array to memory-address.

    WriteJump - both arguments are addresses, where to jump from and where to jump to.

    WriteNop - address and how many to write.

     

    [ Hidden part. View original post. ]

    nice work

    Link to comment
    Share on other sites

    Guest
    This topic is now closed to further replies.
     Share

    • Recently Browsing   0 members

      • No registered users viewing this page.

    ×
    ×
    • Create New...