Re: Cross Process Callbacks
- From: "Paul G. Tobey [eMVP]" <p space tobey no spam AT no instrument no spam DOT com>
- Date: Fri, 21 Jul 2006 15:19:45 -0700
If you have the help of a wrapper API in the application space, you can use
synchronization objects, like events, to handle notification of a 'callback'
that it's time to run. Getting data to it is still a problem, but you could
handle that with a point-to-point message queue, shared memory
(memory-mapped file, without the file), etc. The wrapper API, when the
application calls a function, CallMeBackWithData( Callback fcn, DWORD
extraparams ), say, would launch a thread:
thread()
{
event = CreateEvent()
DeviceIoControl( driver, set up callback, event )
WaitForSingleObject( event )
// call the application's specified call-back function, grabbing data
sent by the driver from whereever it belongs
}
Paul T.
"Silver" <thesilverring@hot> wrote in message
news:uBJRZ3QrGHA.2052@xxxxxxxxxxxxxxxxxxxxxxx
Hi all,
I want to make a callback from a driver in the context of device.exe to an
application in userland. Actually, that's a lie, I want to do it
differently but I am getting pushback for other reasons.
My scenario is like this:
Application -> registers callback via stream driver IOCTL
Driver -> allocates buffers and handles reading data from device
..
..
Driver -> Data arrives at driver and is put in a buffer in created in
device.exe context.
Driver -> Driver makes callback to userland application with the data
mapped to application user space.
Application -> processes data and returns
Driver -> handles buffer cleanup and continues in device.exe context
The first problem is mapping the data buffer, MapPtrToProcess is
deprecated and MapCallerPtr would not work as it is not a PSL call and I
want to avoid a buffer copy. The best way I could come up with was
ReadProcessMemory, this is a trusted API though so I may have problems
there too.
Next, how do I make a function call in the context of a different process
space? I could use a thread in the application space that simply waits for
an event and do it that way (like an IST) but I am racking my brains to
figure out another way - does anybody have any ideas?
BTW: This is under CE5.0, to be used on WM5.
Geoff
--
.
- References:
- Cross Process Callbacks
- From: Silver
- Cross Process Callbacks
- Prev by Date: Cross Process Callbacks
- Next by Date: Re: LAN91C and XSCALE
- Previous by thread: Cross Process Callbacks
- Next by thread: Re: Cross Process Callbacks
- Index(es):
Relevant Pages
|
|