Results 1 to 1 of 1
  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++] Custom apis (inline)

    Go to visual studio and start a windows console application. And create a simple message box inside Main,
    your code will look like the following:

    #include <Windows.h>
    int main()
    {
    DWORD dwMessageBoxA = (DWORD)MessageBoxA;
    char *lpText = "Test";
    char *lpCaption = "Hello World!";
    _asm push 0 //hWnd
    _asm push lpText //lpText
    _asm push lpCaption //lpCaption
    _asm push 0 //uType 0 = MB_OK
    _asm call dwMessageBoxA //Our Call
    _asm add esp,0xC //0xC = return

    }

    GHL.h
    class GHL
    {

    //Api
    void dwMessageBox(HWND hWnd,LPCSTR lpText,LPCSTR lpCaption,UINT uType);
    void ExitUserProcess();
    void DestroyWindow();

    };

    extern GHL *GameHook;

    GHL.cpp
    void GHL::dwMessageBox(HWND hWnd,LPCSTR lpText,LPCSTR lpCaption,UINT uType)
    {
    HMODULE USER32 = LoadLibraryA("user32.dll");
    DWORD dwMessageBoxA = (DWORD) GetProcAddress(USER32,"MessageBoxA");

    _asm push hWnd //hwnd
    _asm push lpText //lpText
    _asm push lpCaption //lpCaption
    _asm push uType //uType
    _asm call dwMessageBoxA //Call
    _asm add esp, 0xC //Ret
    }

    void GHL::ExitUserProcess()
    {
    HMODULE NTDLL = LoadLibraryA("ntdll.dll");
    DWORD dwExitProcess = (DWORD) GetProcAddress(NTDLL,"NtTerminateProcess");

    _asm push 0 //ExitCode
    _asm call dwExitProcess //Call
    _asm add esp, 0xC //Ret
    }
    void GHL::DestroyWindow()
    {
    HMODULE KERNAL32 = LoadLibraryA("Kernel32.dll");
    DWORD dwDestroyWindow = (DWORD) GetProcAddress(KERNAL32,"DestroyWindow");
    HANDLE Cod4 = FindWindowA("Call of Duty 4","Call of Duty 4");

    _asm push Cod4 //hWnd
    _asm call dwDestroyWindow //Call
    _asm add esp, 0xC //Ret
    }


    You can use Theses like:

    in dllMain.cpp
    GHL								*GameHook;

    BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpReserved )
    {
    switch( fdwReason )
    {
    case DLL_PROCESS_ATTACH:
    {
    DisableThreadLibraryCalls(hinstDLL);
    main_hinstDLL = hinstDLL;
    LOG.Log("CREDIT","SALT3R <333");
    GameHook->dwMessageBox(0,"Test","Test",MB_OK);
    return true;
    break;
    }
    case DLL_PROCESS_DETACH:
    {
    LOG.Log("CREDIT","SALT3R <333");
    break;
    }
    }
    return TRUE;
    }

    Usage: Same as the default MessageBoxA...
    P.S. It's written inline for education & getting used to using inline
    by Salt3r
    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

Visitors found this page by searching for:

dllmain cod4

_asm

C custom getprocaddress

BOOL WINAPI DllMain cod4

custom api for a pro game

box esp void () c

c# inline c

_asm cod4

Salt3r-Cod4

add esp 0xc

c getprocaddress custom

custom getprocaddress c

c custom getprocaddr

cod4 _asm

Salt3r_Et

dword to lpText

cod4 HWND

C Destroy COD4 Window

c inline api calls

cod 4 teamkill __asm

GetProcAddress NtTerminateProcess

c custom messagebox

Salt3r-ET

custom inline c

Posting Permissions

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