Application access memory from structure created using ExAllocatePool in driver

I create a structure with memory allocated from
ExAllocatePool(NonPagedPool, sizeof(my structure)) and use DeviceControl to
pass the reference to my application, but the application cannot access the
memory.

Is the memory read-only, or the memory address is not the same in
user-mode?


You are currently subscribed to ntfsd as: $subst(‘Recip.EmailAddr’)
To unsubscribe send a blank email to leave-ntfsd-$subst(‘Recip.MemberIDChar’)@lists.osr.com

Under NT/2k/XP, user-mode code cannot read from kernel memory locations.
You need to modify your IOCTL interface so that you have the user-mode
code pass a buffer of the appropriate size to your driver, and then have
the driver copy into this buffer.

  • Nicholas Ryan

-----Original Message-----
From: xxxxx@lists.osr.com [mailto:bounce-ntfsd-
xxxxx@lists.osr.com] On Behalf Of Eric Chan
Sent: Thursday, February 14, 2002 9:22 PM
To: File Systems Developers
Subject: [ntfsd] Application access memory from structure created
using
ExAllocatePool in driver

I create a structure with memory allocated from
ExAllocatePool(NonPagedPool, sizeof(my structure)) and use
DeviceControl
to
pass the reference to my application, but the application cannot
access
the
memory.

Is the memory read-only, or the memory address is not the same in
user-mode?


You are currently subscribed to ntfsd as: xxxxx@secretseal.com
To unsubscribe send a blank email to leave-ntfsd-$subst(‘Recip.MemberIDChar’)@lists.osr.com


You are currently subscribed to ntfsd as: $subst(‘Recip.EmailAddr’)
To unsubscribe send a blank email to leave-ntfsd-$subst(‘Recip.MemberIDChar’)@lists.osr.com

No user code can access structures from the kernel pool.
Copy it to Irp->AssociatedIrp.SystemBuffer instead (I’m assuming you’re using METHOD_BUFFERED IOCTL).

Max

----- Original Message -----
From: “Eric Chan”
To: “File Systems Developers”
Sent: Thursday, February 14, 2002 9:22 PM
Subject: [ntfsd] Application access memory from structure created using ExAllocatePool in driver

> I create a structure with memory allocated from
> ExAllocatePool(NonPagedPool, sizeof(my structure)) and use DeviceControl to
> pass the reference to my application, but the application cannot access the
> memory.
>
> Is the memory read-only, or the memory address is not the same in
> user-mode?
>
> —
> You are currently subscribed to ntfsd as: xxxxx@storagecraft.com
> To unsubscribe send a blank email to leave-ntfsd-$subst(‘Recip.MemberIDChar’)@lists.osr.com
>


You are currently subscribed to ntfsd as: $subst(‘Recip.EmailAddr’)
To unsubscribe send a blank email to leave-ntfsd-$subst(‘Recip.MemberIDChar’)@lists.osr.com