-
-
[求助]ExInterlockedInsertHeadList函数
-
发表于: 2008-4-23 22:39 5864
-
PLIST_ENTRY ExInterlockedInsertHeadList( IN PLIST_ENTRY ListHead, IN PLIST_ENTRY ListEntry, IN PKSPIN_LOCK Lock );
想了很久,在google上也没介绍 ,只有在ddk_help上有一点资料,但还是很难理解,希望大家能帮忙下:
这个函数怎么理解呢?它是怎么工作的?
为什么可以用for循环,而不需要改变ListHead
如:
[quote=RootKit:Subverting the windows kernel]
struct KEY_DATA
{
LIST_ENTRY ListEntry;
char KeyData;
char KeyFlags;
};
for(int i = 0; i < numKeys; i++)
{
DbgPrint("ScanCode: %x\n", keys[i].MakeCode);
if(keys[i].Flags == KEY_BREAK)
DbgPrint("%s\n","Key Up");
if(keys[i].Flags == KEY_MAKE)
DbgPrint("%s\n","Key Down")
KEY_DATA* kData = (KEY_DATA*)ExAllocatePool(NonPagedPool,sizeof(KEY_DATA));
//fill in kData structure with info from IRP
kData->KeyData = (char)keys[i].MakeCode;
kData->KeyFlags = (char)keys[i].Flags;
//Add the scan code to the linked list queue so our worker thread
//can write it out to a file.
DbgPrint("Adding IRP to work queue...");
ExInterlockedInsertTailList(&pKeyboardDeviceExtension->QueueListHead,
&kData->ListEntry,
&pKeyboardDeviceExtension->lockQueue);
//Increment the semaphore by 1 - no WaitForXXX after this call
KeReleaseSemaphore(&pKeyboardDeviceExtension->semQueue,0,1,FALSE);
}//end for
[/quote]
[培训]内核驱动高级班,冲击BAT一流互联网大厂工作,每周日13:00-18:00直播授课
赞赏
他的文章
看原图
赞赏
雪币:
留言: