Opening a file as a memory mapped file

How do I go about opening a file as a memory mapped file?

I figure I would use ZwCreateFile(…) then call something else based upon
it’s params.

can someone help me out or point me to some sample code?

thanks! - jb


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

You need to use the file handle to create a section object, then use the
section object to map a view of the file. See ZwCreateFile,
ZwCreateSection, ObReferenceObjectByHandle, and MmMapViewInSystemSpace.

-----Original Message-----
From: xxxxx@earthlink.net [mailto:xxxxx@earthlink.net]
Sent: Wednesday, January 17, 2001 8:00 PM
To: File Systems Developers
Subject: [ntfsd] Opening a file as a memory mapped file

How do I go about opening a file as a memory mapped file?

I figure I would use ZwCreateFile(…) then call something
else based upon
it’s params.

can someone help me out or point me to some sample code?

thanks! - jb


You are currently subscribed to ntfsd as: xxxxx@nsisw.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

> I figure I would use ZwCreateFile(…) then call something else based upon

it’s params.

Then ZwCreateSection, then ZwMapViewOfSection. Note that the file will be
mapped to the user space of the current process - there is no API to map
the file to the kernel space.

Max


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

> You need to use the file handle to create a section object, then use the

section object to map a view of the file. See ZwCreateFile,
ZwCreateSection, ObReferenceObjectByHandle, and MmMapViewInSystemSpace.

Thanks for mentioning the latter API. Is it documented somewhere?

Max


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

Where can I find the prototype and information on how to call
MmMapViewInSystemSpace?

thanks again.

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com]On Behalf Of Rob Fuller
Sent: Thursday, January 18, 2001 12:58 PM
To: File Systems Developers
Subject: [ntfsd] RE: Opening a file as a memory mapped file

You need to use the file handle to create a section object, then use the
section object to map a view of the file. See ZwCreateFile,
ZwCreateSection, ObReferenceObjectByHandle, and MmMapViewInSystemSpace.

-----Original Message-----
From: xxxxx@earthlink.net [mailto:xxxxx@earthlink.net]
Sent: Wednesday, January 17, 2001 8:00 PM
To: File Systems Developers
Subject: [ntfsd] Opening a file as a memory mapped file

How do I go about opening a file as a memory mapped file?

I figure I would use ZwCreateFile(…) then call something
else based upon
it’s params.

can someone help me out or point me to some sample code?

thanks! - jb


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


You are currently subscribed to ntfsd as: xxxxx@earthlink.net
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

You apparently could use the functions:

NTKERNELAPI
NTSTATUS
MmMapViewInSystemSpace (
IN PVOID Section,
OUT PVOID *MappedBase,
IN PULONG ViewSize
);

NTKERNELAPI
NTSTATUS
MmUnmapViewInSystemSpace (
IN PVOID MappedBase
);

These are in the ntddk.h. Does anyone know if this is incorrect?

  • jb

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com]On Behalf Of Maxim S. Shatskih
Sent: Thursday, January 18, 2001 1:51 PM
To: File Systems Developers
Subject: [ntfsd] Re: Opening a file as a memory mapped file

I figure I would use ZwCreateFile(…) then call something else based upon
it’s params.

Then ZwCreateSection, then ZwMapViewOfSection. Note that the file will be
mapped to the user space of the current process - there is no API to map
the file to the kernel space.

Max


You are currently subscribed to ntfsd as: xxxxx@earthlink.net
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

I remember some nasties about this call. I think it is used for mapping into
the cacheaddress space. Can someone enlighten us?

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com]On Behalf Of Maxim S. Shatskih
Sent: Thursday, January 18, 2001 11:58 AM
To: File Systems Developers
Subject: [ntfsd] RE: Opening a file as a memory mapped file

> You need to use the file handle to create a section object, then use the
> section object to map a view of the file. See ZwCreateFile,
> ZwCreateSection, ObReferenceObjectByHandle, and MmMapViewInSystemSpace.

Thanks for mentioning the latter API. Is it documented somewhere?

Max


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