Thread: C++ help

  1. #1
    Registered User
    Join Date
    Oct 2011

    C++ help

    I wanted to see if someone could help me understand the following code and what I have to do to get it to work... like what header files you need and should somthing like this be an injected dll or can it be ran in a console app... also how to get a offset from a base/function address. I know it's base address - function address but when the address is like

    Base : 0x52290000 || Address : 0x5234CBC0 ||  Offset : 0xBCBC0
    I dont understand how you get 0xBCBC0 as the offset. Thanks in advance!!

    DWORD dwEngine = (DWORD)GetModuleHandle( "engine.dll" );
    DWORD  dwClientInit = dwFindPattern( dwEngine, dwClientDLL_Size,  reinterpret_cast<PBYTE>(szClientDLL_Sig), szClientDLL_Mask );
    LogMessage( "Base: 0x%X || Address: 0x%X || Offset: 0x%X", dwEngine, dwClientInit, dwClientInit - dwEngine );

    To be clear I do understand that DWORD dwEngine = (DWORD)GetModuleHandle( "engine.dll" ); gets the base address of engine.dll and that dwFindPattern(); is to find the pattern to get the function address and that LogMessage( "Base: 0x%X || Address: 0x%X || Offset: 0x%X", dwEngine, dwClientInit, dwClientInit - dwEngine ); is giving me a message showing me the base, address and finally the offset based on dwClientInit - dwEngine. but I don't understand how one would compiling it and make use of it and also how to do the calculation on getting the offset...

    I don't get how you to do the math...
    0x52290000 - 0x5234CBC0= 0xBCBC0

    can someone explain how this works.. thanks!!

  2. #2
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    The edge of the known universe
    Announcements - C++ Programming
    6. Messages relating to cracking, (erroneously called "hacking" by many), copyright violations, or other illegal activities will be deleted. Due to the overlapping boundaries of code with malicious intent, and other legitimate uses of it, the moderators will assess each potential infraction on a case by case basis.
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

  3. #3
    Join Date
    Oct 2007
    Inside my computer
    In other words, state your intent. Why do you need this?
    Quote Originally Posted by Adak View Post
    io.h certainly IS included in some modern compilers. It is no longer part of the standard for C, but it is nevertheless, included in the very latest Pelles C versions.
    Quote Originally Posted by Salem View Post
    You mean it's included as a crutch to help ancient programmers limp along without them having to relearn too much.

    Outside of your DOS world, your header file is meaningless.

Popular pages Recent additions subscribe to a feed