🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: borland.public.cppbuilder.nativeapi
4 messages
4 total messages Started by RaynorPao Thu, 03 Apr 2003 12:33
ReadProcessMemory
#17217
Author: RaynorPao
Date: Thu, 03 Apr 2003 12:33
36 lines
2009 bytes
Hi all:

I want to read memory from a process...the code is as below:

   BYTE buf[4];
   DWORD addr;
   STARTUPINFO si;
   PROCESS_INFORMATION pi;

   ZeroMemory(&si, sizeof(STARTUPINFO));
   si.cb=sizeof(STARTUPINFO);
   if(!CreateProcess("c:\\winnt\\notepad.exe", 0, 0, 0, 0,
CREATE_NEW_CONSOLE, 0, 0, &si, &pi))
   {
      ShowMessage("could not create process - "+IntToStr(GetLastError()));
   }
   WaitForInputIdle(pi.hProcess, INFINITE);
   addr=0;
   DWORD dummy;

   if(!ReadProcessMemory(pi.hProcess, 0, buf, 4, &dummy))
   {
      ShowMessage("could not read process memory -
"+IntToStr(GetLastError()));
      ShowMessage("dummy = "+IntToStr(dummy));
   }
   CloseHandle(pi.hProcess);
   CloseHandle(pi.hThread);

But, this line "ReadProcessMemory" occurs error at runtime.
And the error code is 299 (Only part of a ReadProcessMemory or
WriteProcessMemory request was completed. ).
Is there something wrong what I do? I have no idea...Please help me.

Thanks.
RaynorPao.
Re: ReadProcessMemory
#17325
Author: Remy Lebeau (TeamB)
Date: Thu, 03 Apr 2003 18:02
16 lines
1357 bytes
"RaynorPao" <RaynorPao.nospam@nospam.pchome.com.tw> wrote in message
news:3e8c2645@newsgroups.borland.com...

> But, this line "ReadProcessMemory" occurs error at runtime.
> And the error code is 299 (Only part of a ReadProcessMemory or
> WriteProcessMemory request was completed. ).

According to the documentation:

    "The entire area to be read must be accessible, or the operation fails."

What exactly are you trying to accomplish?


Gambit
Re: ReadProcessMemory
#17322
Author: RaynorPao
Date: Thu, 03 Apr 2003 18:32
26 lines
1590 bytes
Hi Remy:

Thanks for your reply.
I just want to read memory block from the process which I created.
Is there something wrong what I do? Please help me.

Thanks.
RaynorPao.

"Remy Lebeau (TeamB)" <gambit47@yahoo.com> ���g��l��
news:3e8c776f$1@newsgroups.borland.com...
>
> "RaynorPao" <RaynorPao.nospam@nospam.pchome.com.tw> wrote in message
> news:3e8c2645@newsgroups.borland.com...
>
> According to the documentation:
>
>     "The entire area to be read must be accessible, or the operation
fails."
>
> What exactly are you trying to accomplish?
>
>
> Gambit
>
>
Re: ReadProcessMemory
#17329
Author: Remy Lebeau (TeamB)
Date: Thu, 03 Apr 2003 19:35
12 lines
1337 bytes
"RaynorPao" <RaynorPao.nospam@nospam.pchome.com.tw> wrote in message
news:3e8c7a80@newsgroups.borland.com...

> I just want to read memory block from the process
> which I created.

But, what KIND of memory block exactly?  You didn't answer my question
fully - what EXACTLY are you trying to accomplish with this?


Gambit
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads