NTSTATUS NtAllocateUserPhysicalPages( IN HANDLE ProcessHandle, IN OUT PULONG_PTR NumberOfPages, OUT PULONG_PTR UserPfnArray ); Routine Description: This function allocates nonpaged physical pages for the specified subject process. No WSLEs are maintained for this range. The caller must check the NumberOfPages returned to determine how many pages were actually allocated (this number may be less than the requested amount). On success, the user array is filled with the allocated physical page frame numbers (only up to the returned NumberOfPages is filled in). No PTEs are filled here - this gives the application the flexibility to order the address space with no metadata structure imposed by the Mm. Applications do this via NtMapUserPhysicalPages - ie: - Each physical page allocated is set in the process's bitmap. This provides remap, free and unmap a way to validate and rundown these frames. Unmaps may result in a walk of the entire bitmap, but that's ok as unmaps should be less frequent. The win is it saves us from using up system virtual address space to manage these frames. - Note that the same physical frame may NOT be mapped at two different virtual addresses in the process. This makes frees and unmaps substantially faster as no checks for aliasing need be performed. Arguments: ProcessHandle - Supplies an open handle to a process object. NumberOfPages - Supplies a pointer to a variable that supplies the desired size in pages of the allocation. This is filled with the actual number of pages allocated. UserPfnArray - Supplies a pointer to user memory to store the allocated frame numbers into. Return Value: Various NTSTATUS codes.