Results 1 to 3 of 3
  1. #1
    LEGiiTxCHAOTiiC's Avatar
    Join Date
    Mar 2011
    Gender
    male
    Location
    Chicago
    Posts
    200
    Reputation
    39
    Thanks
    70

    Making This Work As DLL

    Ok so you've maybe seen my other thread. But now, I want to make it a DLL that you have to inject, for learning purposes. So the old code works and writes memory fine in a console application. Is there something wrong with my DLL code that'd make it not work? It injects with Winject but the effect is not apparent in game at all. I tried commenting out VirtualProtectEx just in case for some reason that might affect it, but that didn't work. Any ideas?

    Code:
    // main.cpp
    
    #include "main.h"
    
    BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved)
    {
        if(fdwReason == DLL_PROCESS_ATTACH)
        {
            byte NoSpread[] = {
                0x74,
                0x15
            };
    
            byte NoRecoil[] = {
                0x75,
                0x08
            };
    
            HWND hWnd = FindWindow(NULL, TEXT("Call of Duty 4"));
            DWORD pId;
            GetWindowThreadProcessId(hWnd, &pId);
            HANDLE hProc = OpenProcess(PROCESS_VM_WRITE | PROCESS_VM_OPERATION, FALSE, pId);
            WriteProcessMemory(hProc, (void*)0x00416C7B, &NoSpread, 2, 0);
            WriteProcessMemory(hProc, (void*)0x0041A7BD, &NoRecoil, 2, 0);
            VirtualProtectEx(hProc, (void*)0x00416C7B, 2, 0x01, (DWORD*)&NoSpread);
            VirtualProtectEx(hProc, (void*)0x0041A7BD, 2, 0x01, (DWORD*)&NoRecoil);
            CloseHandle(hProc);
            return 0;
        }
    }
    Code:
    // main.h
    
    #ifndef __MAIN_H__
    #define __MAIN_H__
    
    #include <windows.h>
    
    /*  To use this exported function of dll, include this header
     *  in your project.
     */
    
    #ifdef BUILD_DLL
        #define DLL_EXPORT __declspec(dllexport)
    #else
        #define DLL_EXPORT __declspec(dllimport)
    #endif
    
    
    #ifdef __cplusplus
    extern "C"
    {
    #endif
    
    void DLL_EXPORT SomeFunction(const LPCSTR sometext);
    
    #ifdef __cplusplus
    }
    #endif
    
    #endif // __MAIN_H__
    Last edited by LEGiiTxCHAOTiiC; 07-25-2012 at 08:25 PM.

  2. #2
    King-Orgy's Avatar
    Join Date
    Dec 2010
    Gender
    female
    Posts
    119
    Reputation
    15
    Thanks
    622
    My Mood
    Angelic
    im bored so i decided to post something

    about your codez, i see bullshit here and da

    Quote Originally Posted by LEGiiTxCHAOTiiC
    Code:
       
            HWND hWnd = FindWindow(NULL, TEXT("Call of Duty 4"));
            DWORD pId;
            GetWindowThreadProcessId(hWnd, &pId);
            HANDLE hProc = OpenProcess(PROCESS_VM_WRITE | PROCESS_VM_OPERATION, FALSE, pId);
    wow dude

    Quote Originally Posted by LEGiiTxCHAOTiiC
    Code:
     WriteProcessMemory(hProc, (void*)0x00416C7B, &NoSpread, 2, 0);
            WriteProcessMemory(hProc, (void*)0x0041A7BD, &NoRecoil, 2, 0);
            VirtualProtectEx(hProc, (void*)0x00416C7B, 2, 0x01, (DWORD*)&NoSpread);
            VirtualProtectEx(hProc, (void*)0x0041A7BD, 2, 0x01, (DWORD*)&NoRecoil);
    whats wrong with you

    however, i give your one tip
    click me

    now go and read a book
    Last edited by King-Orgy; 07-26-2012 at 02:23 PM.

  3. #3
    LEGiiTxCHAOTiiC's Avatar
    Join Date
    Mar 2011
    Gender
    male
    Location
    Chicago
    Posts
    200
    Reputation
    39
    Thanks
    70
    Quote Originally Posted by King-Orgy View Post
    im bored so i decided to post something

    about your codez, i see bullshit here and da



    wow dude



    whats wrong with you

    however, i give your one tip
    click me

    now go and read a book
    I've never worked with DLL's, and also it's just my console application code converted to DLL...

Similar Threads

  1. [Tutorial] How to make hacks work? (With injector, dll, and
    By hihihi13579 in forum Combat Arms Tutorials
    Replies: 23
    Last Post: 06-16-2012, 09:32 PM
  2. [Help] Add DLL file to resources of injector and make it work..
    By hitmen69 in forum Visual Basic Programming
    Replies: 13
    Last Post: 06-10-2011, 03:45 AM
  3. how do i move d3dx9_43.dll to make hacks work
    By -YouNoob in forum Combat Arms EU Help
    Replies: 6
    Last Post: 09-27-2010, 02:51 PM
  4. I cant seem to make this mod work
    By xbeatsszzx in forum Call of Duty Modern Warfare 2 GSC Modding Help/Discussion
    Replies: 13
    Last Post: 07-25-2010, 05:41 PM
  5. Would this work...?
    By Frolite in forum WarRock - International Hacks
    Replies: 6
    Last Post: 01-16-2006, 02:39 PM