C++ help

This is a discussion on C++ help within the C++ Programming forums, part of the General Programming Boards category; I wanted to see if someone could help me understand the following code and what I have to do to ...

  1. #1
    Registered User
    Join Date
    Oct 2011
    Posts
    1

    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

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


    Code:
    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 wrongness Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    32,451
    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.
    I support http://www.ukip.org/ as the first necessary step to a free Europe.

  3. #3
    C++まいる!Cをこわせ! Elysia's Avatar
    Join Date
    Oct 2007
    Posts
    22,449
    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

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21