1、在内核程序使用ZwQuerySystemInformation函数需要进行声明,否则在编译时会提示错误。声明如下:
NTKERNELAPI extern "C" NTSTATUS ZwQuerySystemInformation(ULONG SystemInformationClass,PVOID SystemInformation,ULONG SystemInformationLength,PULONG ReturnLength);
注:C与C++的区别,如果源文件是以CPP作为后缀的,需要在函数前添加extern "C" 。这是因为同样的函数,用C和C++编译器得到的符号名不同。