Unless I’m missing something, it’s exported by the PE header, and there
is also a linker member entry for it in the export library, at least on
XP SP2:
Dump of file c:\windows\system32\ntoskrnl.exe
File Type: EXECUTABLE IMAGE
Section contains the following exports for ntoskrnl.exe
00000000 characteristics
42250F77 time date stamp Tue Mar 01 19:57:27 2005
0.00 version
1 ordinal base
1483 number of functions
1483 number of names
ordinal hint RVA name
…
1283 502 0000C3D6 ZwAllocateVirtualMemory
…
Microsoft (R) COFF/PE Dumper Version 8.00.50727.42
Copyright (C) Microsoft Corporation. All rights reserved.
Dump of file ntoskrnl.lib
File Type: LIBRARY
Archive member name at 8: /
472C29EF time/date Sat Nov 03 03:57:35 2007
uid
gid
0 mode
1F1D9 size
correct header end
3937 public symbols
45D58 _ZwAllocateVirtualMemory@24
45D58 __imp__ZwAllocateVirtualMemory@24
There’s also a linker member entry for WLH in the 6001.18000 WDK, but I
don’t currently have a target that is running S2008 to check for to see
whether it is exported or not.
mm
xxxxx@hotmail.com wrote:
Dmitry,
> ZwAllocateVirtualMemory is exported from kernel
Indeed, it is exported from the kernel, but it is exported via SSDT, rather than PE header, which means kernel-mode components are not supposed to call it. Therefore, it just cannot be prototyped in ifs.h. Certainly you can call it simply by its address, but be ready for “surprises” if you do it this way. ZwMapViewOfSection() is a totally different beast - it is exported by the kernel via PE header in both Nt… and Zw… forms , which means it is supposed to be called from the kernel mode in either form (the latter one is even documented in WDK). Therefore,
it may “misunderstand” MEM_LARGE_PAGES flag - after all, once ZwAllocateVirtualMemory()
is meant to be called only by the user-mode components, all allocations that it does are meant to be specific to the target process, rather than having system-wide implications…
> Anyway, I am pretty sure that the all modern DDIs (and majority of Win32 APIs
> like CreateFileMapping) that accept standard MEM_ flags will also
> accept MEM_LARGE_PAGES / SEC_LARGE_PAGES.
Well, if kernel does not expect it on OS versions <=XP, this flag, apparently, just does not
have any meaning to the older versions of kernel…
Anton Bassov