Sysinternals Homepage
Forum Home Forum Home > Windows Discussions > Internals
  New Posts New Posts RSS Feed: Mapping foreign page into process
  FAQ FAQ  Forum Search   Calendar   Register Register  Login Login

Mapping foreign page into process

 Post Reply Post Reply
Author
Message Reverse Sort Order
hugo View Drop Down
Newbie
Newbie
Avatar

Joined: 20 July 2005
Location: United States
Online Status: Offline
Posts: 29
Post Options Post Options   Quote hugo Quote  Post ReplyReply Direct Link To This Post Topic: Mapping foreign page into process
    Posted: 03 November 2009 at 10:55am
Originally posted by Vernum

That's kind of the problem. I am not the controller. :/
Hmm. But you gave me an idea.
Maybe i can somehow intercept the allocation and create a section instead.
Still, im not very happy with this solution. :/
 
Did you ever get your problem sorted out?
 
Hugo
 
 
Morantex Inc.
http://www.morantex.com
Back to Top
Vernum View Drop Down
Newbie
Newbie


Joined: 27 May 2007
Online Status: Offline
Posts: 15
Post Options Post Options   Quote Vernum Quote  Post ReplyReply Direct Link To This Post Posted: 15 September 2009 at 5:10pm
That's kind of the problem. I am not the controller. :/
Hmm. But you gave me an idea.
Maybe i can somehow intercept the allocation and create a section instead.
Still, im not very happy with this solution. :/
Back to Top
wj32 View Drop Down
Senior Member
Senior Member
Avatar

Joined: 16 January 2009
Location: Australia
Online Status: Offline
Posts: 704
Post Options Post Options   Quote wj32 Quote  Post ReplyReply Direct Link To This Post Posted: 14 September 2009 at 11:04pm
If you control the memory allocation, instead of using NtAllocateVirtualMemory/VirtualAlloc you should create a section using NtCreateSection/CreateFileMapping (or whatever it is) and map a view into both processes.
MCTS: Windows Internals
Process Hacker, a free and open source process viewer.
Back to Top
Vernum View Drop Down
Newbie
Newbie


Joined: 27 May 2007
Online Status: Offline
Posts: 15
Post Options Post Options   Quote Vernum Quote  Post ReplyReply Direct Link To This Post Posted: 14 September 2009 at 1:13pm
Well i just mean allocated regions of memory with VirtualAlloc().
( MEM_PRIVATE + MEM_COMMIT / MEM_RESERVE)

I want to map one of these allocated regions into another process, simultaneously.

So i can read and write to this memory-region from two process-contexts at the same time. (the processes live in the same session though)

And it doesn't matter if the address-range differs.

I am not really sure if there even is a "proper" way. Worst case scenario would be that i would have to manually manipulate the Page-Tables. Might this be the case here?


Edited by Vernum - 14 September 2009 at 1:18pm
Back to Top
wj32 View Drop Down
Senior Member
Senior Member
Avatar

Joined: 16 January 2009
Location: Australia
Online Status: Offline
Posts: 704
Post Options Post Options   Quote wj32 Quote  Post ReplyReply Direct Link To This Post Posted: 13 September 2009 at 11:14pm
What do you mean by private page? If it was mapped from a section and you have a handle to the section, you can map a view as well. I don't think you can just convert an allocated page for use in a section, though.
MCTS: Windows Internals
Process Hacker, a free and open source process viewer.
Back to Top
Vernum View Drop Down
Newbie
Newbie


Joined: 27 May 2007
Online Status: Offline
Posts: 15
Post Options Post Options   Quote Vernum Quote  Post ReplyReply Direct Link To This Post Posted: 13 September 2009 at 6:26pm
Let's say one process has mapped its own private page into his virtual memory.
In my second process i want to map this exact page into my process, too.
But i have no control on how the first process allocated the first page.

Any ideas?
Back to Top
 Post Reply Post Reply

Forum Jump Forum Permissions View Drop Down