-
-
[旧帖] [求助]大家新年好,请教一个ring0下调用NtQueryInformation导致0x00000050错误的问题 0.00雪花
-
发表于: 2008-2-8 16:48 4589
-
我写了一个驱动程序,在DriverEntry里建立了一个SystemThread.而这个Thread干的事情就是定时去执行调用 NtQuerySystemInformation 代码大约如下:
ULONG retlen;
PVOID pProcInfo = NULL;
if (KeGetCurrentIrql() < DISPATCH_LEVEL)
{
DbgPrint ( "Calling NtQuerySystemInformation \n" );
NtQuerySystemInformation ( SystemProcessInformation , NULL , 0 , &retlen );
DbgPrint ( " NtQuerySystemInformation proccessed\n" );
pProcInfo = ExAllocatePoolWithTag (NonPagedPool, retlen , 'corp');
if ( pProcInfo )
{
DbgPrint ( "2nd Calling NtQuerySystemInformation \n" );
ntStatus = NtQuerySystemInformation ( SystemProcessInformation , pProcInfo , icurrsize , &retlen );
DbgPrint ( " 2nd NtQuerySystemInformation proccessed\n" );
}
}
结果经常在执行NtQuerySystemInformation时出现兰屏,错误代码0x00000050:PAGE_FAULT_IN_NONPAGED_AREA
而且出现的几率还挺高,我试过换ZwQuerySystemInfo函数,也是一样,而且更加容易出现蓝屏。
奇怪的是在Windbg里提示的错误的模块不一定是我自己写的.sys,一次看到是atapi.sys和其他的,但更多的是自己写模块。每次蓝屏前,都可以看到DbgPrint出来的“
Calling NtQuerySystemInformation "。
请问各位,这个问题要如何解决,调用NtQuerysystemInfomation有什么讲究吗?
ULONG retlen;
PVOID pProcInfo = NULL;
if (KeGetCurrentIrql() < DISPATCH_LEVEL)
{
DbgPrint ( "Calling NtQuerySystemInformation \n" );
NtQuerySystemInformation ( SystemProcessInformation , NULL , 0 , &retlen );
DbgPrint ( " NtQuerySystemInformation proccessed\n" );
pProcInfo = ExAllocatePoolWithTag (NonPagedPool, retlen , 'corp');
if ( pProcInfo )
{
DbgPrint ( "2nd Calling NtQuerySystemInformation \n" );
ntStatus = NtQuerySystemInformation ( SystemProcessInformation , pProcInfo , icurrsize , &retlen );
DbgPrint ( " 2nd NtQuerySystemInformation proccessed\n" );
}
}
结果经常在执行NtQuerySystemInformation时出现兰屏,错误代码0x00000050:PAGE_FAULT_IN_NONPAGED_AREA
而且出现的几率还挺高,我试过换ZwQuerySystemInfo函数,也是一样,而且更加容易出现蓝屏。
奇怪的是在Windbg里提示的错误的模块不一定是我自己写的.sys,一次看到是atapi.sys和其他的,但更多的是自己写模块。每次蓝屏前,都可以看到DbgPrint出来的“
Calling NtQuerySystemInformation "。
请问各位,这个问题要如何解决,调用NtQuerysystemInfomation有什么讲究吗?
[培训]内核驱动高级班,冲击BAT一流互联网大厂工作,每周日13:00-18:00直播授课
赞赏
他的文章
赞赏
雪币:
留言: