WriteProcessMemory() problem on Windows 7 64-bit - C programming

This is a discussion on WriteProcessMemory() problem on Windows 7 64-bit - C programming within the Windows Programming forums, part of the Platform Specific Boards category; Code: BYTE bNewData[]={0x90,0x90,0x90,0x90,0x90,0x90,0x90}; DWORD dwNewDataSize = sizeof(bNewData); if (WriteProcessMemory(hProcess, 0x0094f720, &bNewData, dwNewDataSize, NULL) == 0 ) { puts("Failure!"); printf( "Reason ...

  1. #1
    Registered User
    Join Date
    Jan 2013
    Posts
    55

    WriteProcessMemory() problem on Windows 7 64-bit - C programming

    Code:
                BYTE bNewData[]={0x90,0x90,0x90,0x90,0x90,0x90,0x90};
                DWORD dwNewDataSize = sizeof(bNewData);
    
    
                if (WriteProcessMemory(hProcess, 0x0094f720, &bNewData, dwNewDataSize, NULL) == 0 ) 
                { 
                    puts("Failure!"); printf( "Reason for failure : %s\n", strerror( GetLastError() ) ); 
                } else { 
                    puts("Success!"); 
                }
    When I execute that code on my computer, I get the error, " Reason for failure : No such device or address ". I do not get how to fix this error when I know the address I gave it is valid. Is the error because I don't typecast the address to LPVOID, or is it just my computer? Also, how can I fix it?

  2. #2
    Registered User
    Join Date
    Jan 2013
    Posts
    55
    Never mind, I fixed it, I accidentally closed the process handle before changing the memory inside.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. WriteProcessMemory() problem on Windows 7 64-bit
    By BatchProgrammer in forum C Programming
    Replies: 1
    Last Post: 06-09-2013, 12:06 AM
  2. WriteProcessMemory failing with GetLastError 87
    By Anddos in forum Windows Programming
    Replies: 5
    Last Post: 04-19-2009, 03:34 PM
  3. WriteProcessMemory
    By Crypteasy in forum Windows Programming
    Replies: 1
    Last Post: 07-26-2008, 11:33 PM
  4. WriteProcessMemory help please
    By Rune Hunter in forum Windows Programming
    Replies: 6
    Last Post: 02-22-2005, 12:34 AM
  5. WriteProcessMemory
    By cppdude in forum Windows Programming
    Replies: 3
    Last Post: 04-12-2002, 09:31 AM

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