NX and Execute Pool Types
To indicate whether memory allocated from a nonpaged pool should be no-execute (NX), you can use two new pool types starting with Windows 8. These pool types are designated by the following POOL_TYPE enumeration values:
NX nonpaged pool. Instructions cannot be executed in memory allocated from this pool.
Executable nonpaged pool. Instruction execution is enabled in memory allocated from this pool.
Most drivers use allocated memory only to store data, and do not execute instructions in this memory. If you build your driver to run on Windows 8 and later versions of Windows, allocate NonPagedPoolNx memory from the NX nonpaged pool whenever possible. Only drivers that need to execute instructions from nonpaged memory should allocate NonPagedPoolExecute memory from the executable nonpaged pool.
For existing drivers that are built for Windows 7 and earlier versions of Windows, when you use the NonPagedPool pool type your driver allocates memory from the executable pool. The NonPagedPool constant name has the same value as the NonPagedPoolExecute constant name that is defined starting with Windows 8. Therefore, these constants refer to the same pool type.
If a driver written for Windows 7 or an earlier version of Windows is built for Windows 8 or a later version of Windows, instances of the NonPagedPool pool type should be replaced by either NonPagedPoolNx or NonPagedPoolExecute. The driver developer either can explicitly perform this replacement, or can implicitly perform the replacement by using one of the opt-in mechanisms that is provided to aid developers in porting their drivers to Windows 8. For more information, see NX Pool Opt-In Mechanisms.