[REQUEST] [C#] Read/Write Memory

03/03/2010 16:08 MrDeNNiS26#1
Hi guys,

I know C# (Simple).
I try to search "how to read/write process memory" but there is not result. Please help me about this? Waiting your helps.

Thank you.

(if my English bad. I'm sorry :))
03/03/2010 18:24 Warlax#2
what u need to google for is 'ReadProcessMemory'
03/04/2010 00:41 spare2#3
PHP Code:
        //        ReadProcessMemory(
        //            HANDLE hProcess,              // handle to the process
        //            LPCVOID lpBaseAddress,        // base of memory area
        //            LPVOID lpBuffer,              // data buffer
        //            SIZE_T nSize,                 // number of bytes to read
        //            SIZE_T * lpNumberOfBytesRead  // number of bytes read
        //            );
        
[DllImport("kernel32.dll")]
        public static 
extern Int32 ReadProcessMemory(IntPtr hProcessIntPtr lpBaseAddress, [InOutbyte[] bufferUInt32 sizeout IntPtr lpNumberOfBytesRead);

        
//        WriteProcessMemory(
        //            HANDLE hProcess,                // handle to process
        //            LPVOID lpBaseAddress,           // base of memory area
        //            LPCVOID lpBuffer,               // data buffer
        //            SIZE_T nSize,                   // count of bytes to write
        //            SIZE_T * lpNumberOfBytesWritten // count of bytes written
        //            );
        
[DllImport("kernel32.dll")]
        public static 
extern Int32 WriteProcessMemory(IntPtr hProcessIntPtr lpBaseAddress, [InOutbyte[] bufferUInt32 sizeout IntPtr lpNumberOfBytesWritten);