How to use ZwOpenSection and ZwMapViewOfsection in w2k

Hi all,
The following code fragment which got from NT 4.0 DDK example
mapmem fail in W2k. Does anyone knows the reason? Please help me!!!
Thank you.

RtlInitUnicodeString (&physicalMemoryUnicodeString,
L"\Device\PhysicalMemory");

InitializeObjectAttributes (&objectAttributes,
&physicalMemoryUnicodeString,
OBJ_CASE_INSENSITIVE,
(HANDLE) NULL,
(PSECURITY_DESCRIPTOR) NULL);

ntStatus = ZwOpenSection (&physicalMemoryHandle,
SECTION_ALL_ACCESS,
&objectAttributes);
ZwOpenSection fail


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

Hi Leo,

I’ve tried this sample out on Win2K and it seemed to work fine. I don’t
know exactly what you are doing in your code (I would need more info on
the error returned from ZwOpenSection and so on), however, may I suggest
using an alternative approach if you want to map memory to user address
space:

http://support.microsoft.com/support/kb/articles/Q189/3/27.asp

This article shows you how to use MmMapLockedPages instead.

I hope this helps.

Youssef

-----Original Message-----
From: xxxxx@asus.com.tw [mailto:xxxxx@asus.com.tw]
Sent: Friday, June 15, 2001 12:55 AM
To: NT Developers Interest List
Subject: [ntdev] How to use ZwOpenSection and ZwMapViewOfsection in w2k

Hi all,
The following code fragment which got from NT 4.0 DDK example
mapmem fail in W2k. Does anyone knows the reason? Please help me!!!
Thank you.

RtlInitUnicodeString (&physicalMemoryUnicodeString,
L"\Device\PhysicalMemory");

InitializeObjectAttributes (&objectAttributes,
&physicalMemoryUnicodeString,
OBJ_CASE_INSENSITIVE,
(HANDLE) NULL,
(PSECURITY_DESCRIPTOR) NULL);

ntStatus = ZwOpenSection (&physicalMemoryHandle,
SECTION_ALL_ACCESS,
&objectAttributes);
ZwOpenSection fail


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


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