Private Process Memory Problem

Hi everybody,
I want to access the process memory area from an other process in W9x.
I have a flat pointer to a buffer in one process, and I want to send this
flat pointer to my process and use it; Can I do this?.
I think that I can use the ‘PageAttach()’ API and attach it to my process
context but I don’t know how to get the pointer linear page number.

Can you help me?

Thanks in advance.

-Abel.

P.D.: I am developing a debug tool in my spare time.

I have done a similar thing using the following method:

Send a message to the window of the destination application (either in the
WM_USER range, or registered using RegisterWindowMessage to get a value that
is unique in the system but common to all processes that register the same
message name)

Send the ProcessId as wParam and the pointer as lParam.

long lRet;
IPC_MSG_PARAMS msgParams; // IPC message parameters

lRet = SendMessage( hwnd, UM_IPC1, GetCurrentProcessId(), &msgParams );

in the window proc of the callee use OpenProcess to get a handle on the
process, then Read/Write ProcessMemory to transfer data between process
address spaces.

case UM_IPC1:
{
HANDLE hProcess;
IPC_MSG_PARAMS msgParams;
hProcess = OpenProcess( PROCESS_ALL_ACCESS, FALSE, wParam );
if( hProcess )
{
if( ReadProcessMemory( hProcess, lParam, &msgParams, sizeof(
msgParams ), NULL ) )
{
// process msgParams here
}
CloseHandle( hProcess );
}
}
break; // UM_IPC1

The OpenProcess, ReadProcessMemory and WriteProcessMemory are part of the
Debugging API but have worked reliably in the application for the 3+ years.

Alun Carp
Driver Development Team Leader
Data Encryption Systems Limited

-----Original Message-----
From: Abel Mu?oz Alcaraz [mailto:xxxxx@trymedia.com]
Sent: 27 October 2000 10:57
To: NT Developers Interest List
Subject: [ntdev] Private Process Memory Problem

Hi everybody,
I want to access the process memory area from an other process in
W9x.
I have a flat pointer to a buffer in one process, and I want to send
this
flat pointer to my process and use it; Can I do this?.
I think that I can use the ‘PageAttach()’ API and attach it to my
process
context but I don’t know how to get the pointer linear page number.

Can you help me?

Thanks in advance.

-Abel.

P.D.: I am developing a debug tool in my spare time.


You are currently subscribed to ntdev as: xxxxx@des.co.uk
To unsubscribe send a blank email to $subst(‘Email.Unsub’)

Or you can look into creating a shared memory region & and then you can
treat it like a regular pointer.

Look at CreateFileMapping (You would use it with a hFile ==
INVALID_HANDLE_VALUE and then probably give the object a name)

I believe there are some articles in MSDN on how to use it with
something called “based pointers” you might want to look at that.

-----Original Message-----
From: Alun Carp [mailto:xxxxx@des.co.uk]
Sent: Friday, October 27, 2000 4:46 AM
To: NT Developers Interest List
Subject: [ntdev] RE: Private Process Memory Problem

I have done a similar thing using the following method:

Send a message to the window of the destination application (either in
the
WM_USER range, or registered using RegisterWindowMessage to get a value
that
is unique in the system but common to all processes that register the
same
message name)

Send the ProcessId as wParam and the pointer as lParam.

long lRet;
IPC_MSG_PARAMS msgParams; // IPC message parameters

lRet = SendMessage( hwnd, UM_IPC1, GetCurrentProcessId(), &msgParams
);

in the window proc of the callee use OpenProcess to get a handle on the
process, then Read/Write ProcessMemory to transfer data between process
address spaces.

case UM_IPC1:
{
HANDLE hProcess;
IPC_MSG_PARAMS msgParams;
hProcess = OpenProcess( PROCESS_ALL_ACCESS, FALSE, wParam );
if( hProcess )
{
if( ReadProcessMemory( hProcess, lParam, &msgParams, sizeof(
msgParams ), NULL ) )
{
// process msgParams here
}
CloseHandle( hProcess );
}
}
break; // UM_IPC1

The OpenProcess, ReadProcessMemory and WriteProcessMemory are part of
the
Debugging API but have worked reliably in the application for the 3+
years.

Alun Carp
Driver Development Team Leader
Data Encryption Systems Limited

-----Original Message-----
From: Abel Mu?oz Alcaraz [mailto:xxxxx@trymedia.com]
Sent: 27 October 2000 10:57
To: NT Developers Interest List
Subject: [ntdev] Private Process Memory Problem

Hi everybody,
I want to access the process memory area from an other process
in
W9x.
I have a flat pointer to a buffer in one process, and I want to
send
this
flat pointer to my process and use it; Can I do this?.
I think that I can use the ‘PageAttach()’ API and attach it to
my
process
context but I don’t know how to get the pointer linear page number.

Can you help me?

Thanks in advance.

-Abel.

P.D.: I am developing a debug tool in my spare time.


You are currently subscribed to ntdev as: xxxxx@des.co.uk
To unsubscribe send a blank email to $subst(‘Email.Unsub’)


You are currently subscribed to ntdev as: xxxxx@microsoft.com
To unsubscribe send a blank email to $subst(‘Email.Unsub’)