阅读:1739回复:7
有关KeWaitForSingleObject的问题
请问有没有人用过 NTSTATUS
KeWaitForSingleObject( IN PVOID Object, IN KWAIT_REASON WaitReason, IN KPROCESSOR_MODE WaitMode, IN BOOLEAN Alertable, IN PLARGE_INTEGER Timeout OPTIONAL ); 在ddk里面 WaitReason 只有看到设成 \" Executive \" 但是在ddk的sample code里面 , 有些有用到这个service 的code 有些设定成 \"suspend\"这个是什么意思呢 , 什么样的作用 ? 谢谢 |
|
沙发#
发布于:2003-08-15 14:15
的确在DDK中有不同的Reason
并且DDK中有这样的代码: typedef enum _KWAIT_REASON { Executive, FreePage, PageIn, PoolAllocation, DelayExecution, Suspended, UserRequest, WrExecutive, WrFreePage, WrPageIn, WrPoolAllocation, WrDelayExecution, WrSuspended, WrUserRequest, WrEventPair, WrQueue, WrLpcReceive, WrLpcReply, WrVirtualMemory, WrPageOut, WrRendezvous, Spare2, Spare3, Spare4, Spare5, Spare6, WrKernel, MaximumWaitReason } KWAIT_REASON; 至于具体的含义我也不能肯定,实在抱歉,如果你知道了请不要忘记告诉我一下,谢谢 |
|
|
板凳#
发布于:2003-08-21 20:33
你只管设. 你甚至可以设定一个不存在的VALUE. 只要后面的MODE填写KERNEL MODE, 就不会出问题.
这个VALUE是给调度器看的. |
|
|
地板#
发布于:2003-08-22 10:26
极度佩服中!
|
|
|
地下室#
发布于:2003-08-23 22:55
看osr的文章说,此值在除错调试时有用。
|
|
5楼#
发布于:2003-08-24 10:34
究竟具体怎么使用这个函数呢?哪位大虾给详细讲讲
|
|
|
6楼#
发布于:2003-09-17 17:47
void PnpStopDevice( IN PWDM2_DEVICE_EXTENSION dx)
{ // Stop I/O ASAP dx->IODisabled = true; // Do nothing if we\'re already stopped if( !dx->GotResources) return; // Wait for any pending I/O operations to complete dx->Stopping = true; KeResetEvent(&dx->StoppingEvent); UnlockDevice(dx); UnlockDevice(dx); //why is two times KeWaitForSingleObject( &dx->StoppingEvent, Executive, KernelMode, FALSE, NULL); DebugPrint(\"PnpStopDevice: All pending I/O completed\"); dx->Stopping = false; // Stop our device before passing down StopDevice(dx); // Bump usage count back up again LockDevice(dx); LockDevice(dx); } 看看这个吧 |
|
7楼#
发布于:2003-09-17 18:31
Lu0回帖;羡慕
|
|
|