Results 1 to 3 of 3

Thread: [RESOLVED] [2.0] Question about ReadProcessMemory

  1. #1

    Thread Starter
    Addicted Member Kal-El's Avatar
    Join Date
    Jun 2007
    Location
    Fortress of solitude
    Posts
    179

    Resolved [RESOLVED] [2.0] Question about ReadProcessMemory

    This is my declaration:

    [DllImport("kernel32.dll")]
    public static extern int ReadProcessMemory(IntPtr hProcess, Int32 lpBaseAddress, [In, Out] byte[] buffer, Int32 nSize, [In, Out] Int32 lpNumberOfbytesWritten);

    //

    int BytesWritten = 0;
    byte[] data = new byte[260];
    ReadProcessMemory(lpProcess, iFile, data, 260, BytesWritten);
    MessageBox.Show("Bytes: " + BytesWritten + "\nData: " + data);

    This is what I tested:
    1. lpProcess is valid handle
    2. iFile is the address and also valid

    The thing is that data (the buffer), must return a string... and the messagebox returns this:
    Bytes: 0
    Data: System.Byte[]
    any ideas???

    «Source Code»«plugins»«skin»«fav apps»«Winamp en español»«Nsis en español»
    So what if your signature move is driving a tractor? I think it's adorable. - Lois ("Crimson")
    Don't forget to when your question is resolved ...and the people who help

  2. #2
    I wonder how many charact
    Join Date
    Feb 2001
    Location
    Savage, MN, USA
    Posts
    3,704

    Re: [2.0] Question about ReadProcessMemory

    Try:
    MessageBox.Show(System.Text.Encoding.ASCII.GetString(data));

  3. #3

    Thread Starter
    Addicted Member Kal-El's Avatar
    Join Date
    Jun 2007
    Location
    Fortress of solitude
    Posts
    179

    Re: [2.0] Question about ReadProcessMemory

    Thank you...
    Some letters doesn't show, for example "í" is replace by a square....but the example you gave me, left me to this:
    vb Code:
    1. System.Text.Encoding.GetEncoding("ISO-8859-1").GetString(data);
    Thanks!
    Last edited by Kal-El; Jul 11th, 2007 at 02:16 PM. Reason: typo

    «Source Code»«plugins»«skin»«fav apps»«Winamp en español»«Nsis en español»
    So what if your signature move is driving a tractor? I think it's adorable. - Lois ("Crimson")
    Don't forget to when your question is resolved ...and the people who help

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width