Results 1 to 2 of 2

Thread: Useful C code

  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

    Useful C code

    [Snippet]

    Dll Template
    #include <Windows.h>

    DWORD WINAPI dwThread( LPVOID )
    {

    return 0;
    }

    BOOL WINAPI DllMain( HMODULE hModule, DWORD dwReason, LPVOID lvpReserved )
    {
    switch( dwReason )
    {
    case DLL_PROCESS_ATTACH:
    CreateThread( 0, 0, dwThread, 0, 0, 0 );
    break;

    case DLL_PROCESS_DETACH:

    break;
    }
    }

    Console Attach Dll
    #include <Windows.h>
    #include <stdio.h>

    DWORD WINAPI dwConsole( LPVOID )
    {
    //Windows Console
    AllocConsole();
    AttachConsole( GetCurrentProcessId() );
    freopen( "CON", "w", stdout );

    //Print Text on console
    printf( "CONSOLE ATTACHED!\n" );

    return 0;
    }

    BOOL WINAPI DllMain( HMODULE hModule, DWORD dwReason, LPVOID lvpReserved )
    {
    switch( dwReason )
    {
    case DLL_PROCESS_ATTACH:
    CreateThread( 0, 0, dwConsole, 0, 0, 0 );
    break;

    case DLL_PROCESS_DETACH:

    break;
    }
    }

    Using Classes
    class CClass;

    class CClass
    {
    public:
    char cName[16]; //0x0000
    DWORD dwHealth; //0x0010
    DWORD dwAmmo; //0x0014
    };
    CClass* cClass = (CClass*)0xFFFFFFF;


    [Class Name* randomname = (Class Name*)Address]

    void hack()
    {
    cClass->dwHealth = 999;
    }

    Print Text from Class
    class CClass;

    class CClass
    {
    public:
    char cName[16]; //0x0000
    DWORD dwHealth; //0x0010
    DWORD dwAmmo; //0x0014
    };
    CClass* cClass = (CClass*)0xFFFFFFF;

    char Name[256];
    sprintf( Name, "Name:%S [H:%X]", cClass->cName, cClass->dwHealth );
    PrintText( Name );

    Comes out as:
    Name:Code[V] [H: 100]


    by Code[V]
    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. The Following 3 Users Say Thank You to Dwar For This Useful Post:


  3. #2
    SaptaAgunk
    SaptaAgunk is offline
    New member SaptaAgunk's Avatar
    Join Date
    2010 Dec
    Posts
    13
    Thanks
    14
    Thanked 0 Times in 0 Posts
    Rep Power
    0
    Thanks for shared......

    how about using the message box, hotkey and the injection into the game?
    and have multiple functions, such as: blood + Ammo + and any more ??

Visitors found this page by searching for:

bool winapi dllmain c#

useful winapi snippets

BOOL WINAPI DllMain( HMODULE hModule DWORD dwReason LPVOID lvpReserved )

progamercity allocconsole

c console winapi allocconsole

winapi snippet

bool winapi allocconsole(void); c#

attachconsole breaks allocconsole

winapi snippets

createthread allocconsole

c# allocconsole

dllmain allocconsole

winapi c

C# useful code forum

C# allocconsole freopen

AttachConsole GetCurrentProcessId

allocconsole on injection c

CreateThread( 0 0 dwConsole 0 0 0 );

usefull game programming snippets

c createthread allocconsole

window.h c useful

snippet windows #include &lt;stdio.h&gt;

bool winapi dllmain allocconsole

AttachConsole freopen

AttachConsole DllMain

Tags for this Thread

Posting Permissions

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