@@ -51,20 +51,35 @@ public RemoteProcess(NativeHelper nativeHelper)
5151 /// <summary>Reads remote memory from the address into the buffer.</summary>
5252 /// <param name="address">The address to read from.</param>
5353 /// <param name="data">[out] The data buffer to fill. If the remote process is not valid, the buffer will get filled with zeros.</param>
54- public void ReadRemoteMemoryIntoBuffer ( IntPtr address , ref byte [ ] data )
54+ public bool ReadRemoteMemoryIntoBuffer ( IntPtr address , ref byte [ ] buffer )
5555 {
56- Contract . Requires ( data != null ) ;
56+ Contract . Requires ( buffer != null ) ;
57+
58+ return ReadRemoteMemoryIntoBuffer ( address , ref buffer , 0 , buffer . Length ) ;
59+ }
60+
61+ /// <summary>Reads remote memory from the address into the buffer.</summary>
62+ /// <param name="address">The address to read from.</param>
63+ /// <param name="data">[out] The data buffer to fill. If the remote process is not valid, the buffer will get filled with zeros.</param>
64+ /// <param name="offset">The offset in the data.</param>
65+ /// <param name="length">The number of bytes to read.</param>
66+ public bool ReadRemoteMemoryIntoBuffer ( IntPtr address , ref byte [ ] buffer , int offset , int length )
67+ {
68+ Contract . Requires ( buffer != null ) ;
69+ Contract . Requires ( offset >= 0 ) ;
70+ Contract . Requires ( length >= 0 ) ;
71+ Contract . Requires ( offset + length < buffer . Length ) ;
5772
5873 if ( ! IsValid )
5974 {
6075 Process = null ;
6176
62- data . FillWithZero ( ) ;
77+ buffer . FillWithZero ( ) ;
6378
64- return ;
79+ return false ;
6580 }
6681
67- nativeHelper . ReadRemoteMemory ( Process . Handle , address , data , data . Length ) ;
82+ return nativeHelper . ReadRemoteMemory ( Process . Handle , address , buffer , offset , length ) ;
6883 }
6984
7085 /// <summary>Reads <paramref name="size"/> bytes from the address in the remote process.</summary>
0 commit comments