Windows System Software -- Consulting, Training, Development -- Unique Expertise, Guaranteed Results
The free OSR Learning Library has more than 50 articles on a wide variety of topics about writing and debugging device drivers and Minifilters. From introductory level to advanced. All the articles have been recently reviewed and updated, and are written using the clear and definitive style you've come to expect from OSR over the years.
Check out The OSR Learning Library at: https://www.osr.com/osr-learning-library/
Windows 10 has a function to walk the pages using an enumeration index (MiWalkPage-something), but as Peter stated, everything about paging tables on Windows is internal and non-documented/non-exported. (Normal) kernel drivers should never mess with the page tables. If you still want to mess with it... you would have to lock the process's address space and do tons of shenanigans, OR build an hypervisor.
Before you go further down this path, I want to emphasize a couple of things.
Phil has the right answer. This is a very common idiom, going clear back to the streaming capture driver samples in 1999. Device Manager allocates the memory for you. You run "placement new" to run your constructor on that memory. When the device unloads, the memory is freed. Your destructor will not run.
CDeviceExtension * devCtx = new (devobj->DeviceExtension) CDeviceExtension;
Of course, the better answer is to write the driver in KMDF, which handles all of this for you.
Suddenly (well, not suddenly -- I haven't checked in many weeks), I cannot get a response from any timestamp servers. verisign, globalsign, digicert -- none of them seem to work, either from Visual Studio or from a batch file calling signtool.
They all say
SignTool Error: The specified timestamp server either could not be reached or returned an invalid response.
Is it only me?
There do exist versions of STL that do not use exceptions, and those version do work in the kernel. That does mean they aren't standard-compliant, which brings up trust issues. I would never switch to a custom STL just to get support for tuples, which are easily implemented at structus.
On the other hand, if you look at the source, the Visual C++ version of tuple does not appear to throw any exceptions. If you were really desperate, you could probably isolate it yourself.
Templates are a compiler feature, and the MSVC for kernel drivers supports it.
You can simply do a template <typename T1, typename T2> struct Tuple { T1 v1; T2 v2; };
if you really need something that looks like a tuple... althought you don't need tuples in any way...
You're writing a driver for an operating system, you're sort of a "part" of the OS. You're the one providing feature to the softwares running in usermode (or even other drivers, for that matter). You should be able to write a kernel component/driver without needing any libraries or extensions. So please.
Could this means that C++ templates in the kernel cannot be used? or in very limited circumstances?
What makes you think that templates and exceptions are related in any way?