差異處
這裏顯示兩個版本的差異處。
Both sides previous revision 前次修改 下次修改 | 前次修改 | ||
cpp:wdm:hlk:nonpagedpool_error [2017/11/25 00:59] tony [Reference] |
cpp:wdm:hlk:nonpagedpool_error [2023/06/25 09:48] (目前版本) |
||
---|---|---|---|
行 1: | 行 1: | ||
+ | {{tag>WDM}} | ||
====== Non-zero Code Integrity statistic found: Execute Pool Type Count ====== | ====== Non-zero Code Integrity statistic found: Execute Pool Type Count ====== | ||
===== Problem ===== | ===== Problem ===== | ||
- | 這是跑HLK HyperVisor Code Integrity Readiness Test中的錯誤。問題是Windows在Win8後基於安全性考量,建議將NonPagedPool改為使用NonPagedPoolNx。本篇文章主要分享我的改法。\\ | + | 這是跑HLK HyperVisor Code Integrity Readiness Test中的錯誤:\\ |
+ | {{:cpp:wdm:hlk:hlk_exepool_error.png|}} | ||
+ | \\ | ||
+ | 問題是Windows在Win8後基於安全性考量,建議將NonPagedPool改為使用NonPagedPoolNx。本篇文章主要分享我的改法。\\ | ||
\\ | \\ | ||
Note. 我的方法儘以解決問題為目的,可能非最佳解。 | Note. 我的方法儘以解決問題為目的,可能非最佳解。 | ||
===== How to resolve? ===== | ===== How to resolve? ===== | ||
- | 由於我的情況不需要使用到Executable nonpaged pool,因此只需要將NonPagedPool改為NonPagedPoolNx即可。在我們的情況,有以下幾點要考慮: | + | 由於我的情況不需要使用到Executable nonpaged pool,因此只需要將NonPagedPool改為NonPagedPoolNx即可。此外還有以下幾點要考慮: |
- WDK是6000,因此某些Macro要自己宣告。 | - WDK是6000,因此某些Macro要自己宣告。 | ||
- | - NonPagedPoolNx為win8以後才支援,但我們又要共用同一隻driver,因此code要做處理。 | + | - NonPagedPoolNx為win8以後才支援,但我們又要共用同一隻driver,因此code要針對版本做處理。 |
<code cpp> | <code cpp> | ||
#define NonPagedPoolNx 512 | #define NonPagedPoolNx 512 | ||
行 20: | 行 24: | ||
} | } | ||
</code> | </code> | ||
+ | 假如系統版本大於等於Win8,我就會使用NonPagedPoolNx;反之則使用NonPagedPool。Client code如下: | ||
+ | <code cpp> | ||
+ | pci_bus_interface=(PCI_BUS_INTERFACE)ExAllocatePool(getNonPagePoolNx(), | ||
+ | sizeof(PCI_BUS_INTERFACE)); | ||
+ | </code> | ||
+ | 使用這個方式後,在Windows 2008與Windows 2016都可以正常使用,且測試會通過。 | ||
===== Reference ===== | ===== Reference ===== | ||
* [[https://social.msdn.microsoft.com/Forums/windowsdesktop/en-US/d88ecbe5-7d30-425f-9bf8-7d4255f4774e/driver-verification-is-failing-due-to-code-integrity-check-with-latest-hlk-build?forum=wdk|Driver verification is failing due to code integrity check with latest HLK build.]] | * [[https://social.msdn.microsoft.com/Forums/windowsdesktop/en-US/d88ecbe5-7d30-425f-9bf8-7d4255f4774e/driver-verification-is-failing-due-to-code-integrity-check-with-latest-hlk-build?forum=wdk|Driver verification is failing due to code integrity check with latest HLK build.]] | ||
行 29: | 行 38: | ||
* [[https://docs.microsoft.com/en-us/windows-hardware/drivers/gettingstarted/platforms-and-driver-versions|Writing drivers for different versions of Windows]] | * [[https://docs.microsoft.com/en-us/windows-hardware/drivers/gettingstarted/platforms-and-driver-versions|Writing drivers for different versions of Windows]] | ||
* [[https://msdn.microsoft.com/en-us/library/windows/desktop/aa383745(v=vs.85).aspx|Using the Windows Headers]] | * [[https://msdn.microsoft.com/en-us/library/windows/desktop/aa383745(v=vs.85).aspx|Using the Windows Headers]] | ||
+ | |||
+ | ===== ===== | ||
+ | ---- | ||
+ | \\ | ||
+ | ~~DISQUS~~ |