Results 1 to 5 of 5
  1. #1
    nucl34r's Avatar
    Join Date
    Oct 2009
    Gender
    male
    Posts
    5
    Reputation
    10
    Thanks
    0
    My Mood
    Psychedelic

    .dll injection question...

    How exactly do you write memory to a process by using a .dll I've done this the external way (using WriteProcessMemory).

  2. #2
    why06's Avatar
    Join Date
    Jul 2009
    Gender
    male
    Location
    IBM
    Posts
    4,304
    Reputation
    170
    Thanks
    2,203
    My Mood
    Flirty
    By using takes a memcpy() function. It takes a couple parameters:
    memcpy, wmemcpy (CRT)
    memcpy(destination, source, num_of_bytes);

    ofcourse you may have to change the protection of memory in order to write to it. That's what VirtualProtect() is for. VirtualProtect Function (Windows)

    and I think you should change back the protection once you change whatever address you wan, but Im not sure. =/

    "Every gun that is made, every warship launched, every rocket fired signifies, in the final sense, a theft from those who hunger and are not fed, those who are cold and are not clothed. This world in arms is not spending money alone. It is spending the sweat of its laborers, the genius of its scientists, the hopes of its children. The cost of one modern heavy bomber is this: a modern brick school in more than 30 cities. It is two electric power plants, each serving a town of 60,000 population. It is two fine, fully equipped hospitals. It is some fifty miles of concrete pavement. We pay for a single fighter plane with a half million bushels of wheat. We pay for a single destroyer with new homes that could have housed more than 8,000 people. This is, I repeat, the best way of life to be found on the road the world has been taking. This is not a way of life at all, in any true sense. Under the cloud of threatening war, it is humanity hanging from a cross of iron."
    - Dwight D. Eisenhower

  3. The Following User Says Thank You to why06 For This Useful Post:

    nucl34r (03-12-2010)

  4. #3
    I got ants in my butt, and I needs to strut.
    Premium Seller
    Former Staff
    Premium Member
    Trusted
    Wyo's Avatar
    Join Date
    Feb 2010
    Gender
    male
    Location
    Guadalajara
    Posts
    24,113
    Reputation
    4354
    Thanks
    4,203
    My Mood
    Lurking
    yep that why sai is true

  5. #4
    Retoxified's Avatar
    Join Date
    Feb 2010
    Gender
    male
    Posts
    148
    Reputation
    8
    Thanks
    171
    Code:
    *(DWORD*)0x138732 = 541;
    or

    Code:
    void PatchMem(LPVOID dwAddress, LPVOID bytes, DWORD dwSize)
    {
    	DWORD flOldProtect = 0;
    	VirtualProtect((void*)dwAddress, dwSize, PAGE_EXECUTE_READWRITE, &flOldProtect);
    	memcpy((void*) dwAddress, bytes, dwSize);
    	VirtualProtect((void*)dwAddress, dwSize, flOldProtect, &flOldProtect);
    }
    then use that like
    Code:
    unsigned long* fireRecoil = 0x387489;
    BYTE fireRecoilPatch[2] = {0x25, 0x5F};
    PatchMem(fireRecoil, fireRecoilPatch, 2);

  6. The Following User Says Thank You to Retoxified For This Useful Post:

    why06 (03-11-2010)

  7. #5
    nucl34r's Avatar
    Join Date
    Oct 2009
    Gender
    male
    Posts
    5
    Reputation
    10
    Thanks
    0
    My Mood
    Psychedelic
    Quote Originally Posted by why06 View Post
    By using takes a memcpy() function. It takes a couple parameters:
    memcpy, wmemcpy (CRT)
    memcpy(destination, source, num_of_bytes);

    ofcourse you may have to change the protection of memory in order to write to it. That's what VirtualProtect() is for. VirtualProtect Function (Windows)

    and I think you should change back the protection once you change whatever address you wan, but Im not sure. =/
    tyvm +thanks

Similar Threads

  1. WH.DLL-------Injection question
    By 117898140 in forum CrossFire Hacks & Cheats
    Replies: 10
    Last Post: 02-06-2010, 06:33 AM
  2. [HELP] - DLL Injection
    By pelonzudo in forum C++/C Programming
    Replies: 1
    Last Post: 09-10-2008, 02:27 AM
  3. Crash at Dll inject
    By CyberStriker in forum WarRock - International Hacks
    Replies: 1
    Last Post: 08-13-2008, 06:51 AM
  4. [Help!] CA crash on dll inject
    By CyberStriker in forum Combat Arms Hacks & Cheats
    Replies: 9
    Last Post: 08-12-2008, 09:23 PM
  5. DLL injection Failled
    By aynal in forum WarRock - International Hacks
    Replies: 1
    Last Post: 01-15-2006, 09:41 PM