Pointer validity between VC++ application and UMDF Driver

Is it valid to write to a memory address (pointer) created in a Visual C++ application programs from a UMDF Driver?
In general my thought was that pointers could be used between an application and user mode driver since they are both running in user space. I am interested if there are caveats, or that it simply will not work. If it will not work, is there some workaround?

They are both in user space, but each application has a seperate address
space so you are going to do bad things. This is basically a
METHOD_NEITHER which UMDF drivers do not support.


Don Burn (MVP, Windows DDK)
Windows 2k/XP/2k3 Filesystem and Driver Consulting
Website: http://www.windrvr.com
Blog: http://msmvps.com/blogs/WinDrvr
Remove StopSpam to reply

wrote in message news:xxxxx@ntdev…
> Is it valid to write to a memory address (pointer) created in a Visual C++
> application programs from a UMDF Driver?
> In general my thought was that pointers could be used between an
> application and user mode driver since they are both running in user
> space. I am interested if there are caveats, or that it simply will not
> work. If it will not work, is there some workaround?
>

Is there any type of method to be able to do this type of thing?

Not that I know of, basically it is a bad idea in general. If you could do
this it is easy for the application to attack the driver by freeing memory
the driver is using, or giving an invalid pointer, so it is hard to do
correctly in a kernel driver, and no mechanism is provided in UMDF.


Don Burn (MVP, Windows DDK)
Windows 2k/XP/2k3 Filesystem and Driver Consulting
Website: http://www.windrvr.com
Blog: http://msmvps.com/blogs/WinDrvr
Remove StopSpam to reply

wrote in message news:xxxxx@ntdev…
> Is there any type of method to be able to do this type of thing?
>

Then the only option would be to pass the data back and forth using IRPs (I/O)?

AFAIK that is correct.


Don Burn (MVP, Windows DDK)
Windows 2k/XP/2k3 Filesystem and Driver Consulting
Website: http://www.windrvr.com
Blog: http://msmvps.com/blogs/WinDrvr
Remove StopSpam to reply

wrote in message news:xxxxx@ntdev…
> Then the only option would be to pass the data back and forth using IRPs
> (I/O)?
>

Hmmm, well it’s all user mode, right? So user mode actually has standard
facilities for sharing memory between separate processes. You can’t just
toss a pointer at your UMDF driver, but you could accomplish the
equivalent non-copy data transfer operation if you work at it.

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of
xxxxx@aeshen.com
Sent: Monday, October 08, 2007 4:30 PM
To: Windows System Software Devs Interest List
Subject: RE:[ntdev] Pointer validity between VC++ application and UMDF
Driver

Then the only option would be to pass the data back and forth using IRPs
(I/O)?


NTDEV is sponsored by OSR

For our schedule of WDF, WDM, debugging and other seminars visit:
http://www.osr.com/seminars

To unsubscribe, visit the List Server section of OSR Online at
http://www.osronline.com/page.cfm?name=ListServer

And what might the facitilites be to share memory between seperate processes?

Sorry but I had to revisit this issue after weeks of doing something else.

Check out MSDN:

http://msdn2.microsoft.com/en-us/library/aa365574.aspx

I don’t recall exactly what you wish to do, and I don’t really know much of anything about UMDS, but the most commonly used and probably what you want is memory mapped files (“File Mapping”). There are issue with all of these, and none of these, other than RPC, guarantee that you can pass pointers around between processes, which is what it sounds like you wish to do. Either way, I would a hard look at your requirements, because, while this sort of arrangement sounds like it can simplify things, it generally introduces considerable complexity and makes debugging more difficult. If you’re doing this for performance, you’re wasting your time and this is bad idea. Otherwise, it’s hard to say more than this without knowing your requirements.

Good luck,

mm

Good luck,

mm

Google is a really good tool.

http://msdn2.microsoft.com/en-us/library/aa366551.aspx

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of
xxxxx@aeshen.com
Sent: Monday, October 08, 2007 5:06 PM
To: Windows System Software Devs Interest List
Subject: RE:[ntdev] Pointer validity between VC++ application and UMDF
Driver

And what might the facitilites be to share memory between seperate
processes?

Sorry but I had to revisit this issue after weeks of doing something
else.


NTDEV is sponsored by OSR

For our schedule of WDF, WDM, debugging and other seminars visit:
http://www.osr.com/seminars

To unsubscribe, visit the List Server section of OSR Online at
http://www.osronline.com/page.cfm?name=ListServer

Before you go this route, what are you trying to do with this driver?
Unless the driver and application are being done together you are likely to
have problems, and if they are being tied together one wonders if there is
not a better way to do this if you step back and examine the problem.


Don Burn (MVP, Windows DDK)
Windows 2k/XP/2k3 Filesystem and Driver Consulting
Website: http://www.windrvr.com
Blog: http://msmvps.com/blogs/WinDrvr
Remove StopSpam to reply

wrote in message news:xxxxx@ntdev…
> And what might the facitilites be to share memory between seperate
> processes?
>
> Sorry but I had to revisit this issue after weeks of doing something else.
>

Currently the goal is really to take an existing implementation (which passes pointers) and simply do the same between a UMDF driver and application.

In general the question about if passing pointers around is a good idea is valid. It definately is not a good way to access memory in a driver. The goal is really short-term and not any type of final product.

In any case I appreciate the responses. I also have found the MSDN information on File Mapping which appears to be the way to share memory between processes.