From: Albert Almeida [albert@fce.uclv.edu.cu] Sent: Friday, January 11, 2002 2:01 PM To: NT Developers Interest List Cc: jeyaram_g@ctd.hcltech.com Subject: [ntdev] Re: How to create a memory mapped file in a NT driver Hello from Cuba! You first have to create a section object using the undocumented function NtCreateSection whose prototype is: NTSTATUS NtCreateSection( OUT PHANDLE SectionHandle, IN ACCESS_MASK DesiredAccess, IN POBJECT_ATTRIBUTES ObjectAttributes OPTIONAL, IN PLARGE_INTEGER MaximumSize OPTIONAL, IN ULONG SectionPageProtection, IN ULONG AllocationAttributes, IN HANDLE FileHandle OPTIONAL ); The bit masks for SectionPageProtecction, AllocationAttributes and DesiredAccess are defined in the NT4 DDK. Later you have to map a section view in memory by using the function NtMapViewOfSection which is defined as follows: NTSTATUS NtMapViewOfSection( IN HANDLE SectionHandle, IN HANDLE ProcessHandle, IN OUT PVOID *BaseAddress, IN ULONG ZeroBits, IN ULONG CommitSize, IN OUT PLARGE_INTEGER SectionOffset OPTIONAL, IN OUT PULONG ViewSize, IN SECTION_INHERIT InheritDisposition, IN ULONG AllocationType, IN ULONG Protect ); To unmap the view you use NtUnmapViewOfSection: NTSTATUS NtUnmapViewOfSection( IN HANDLE ProcessHandle, IN PVOID BaseAddress ); Well, thatīs it! I hope this helps! Best regards, Albert Almeida --- You are currently subscribed to ntdev as: GlennEverhart@FirstUSA.com To unsubscribe send a blank email to leave-ntdev-247T@lists.osr.com