-
-
[求助]ExInterlockedInsertHeadList函数
-
发表于: 2008-4-23 22:39 6070
-
PLIST_ENTRY
ExInterlockedInsertHeadList(
IN PLIST_ENTRY ListHead,
IN PLIST_ENTRY ListEntry,
IN PKSPIN_LOCK Lock
);
想了很久,在google上也没介绍
这个函数怎么理解呢?它是怎么工作的?
为什么可以用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]
[培训]科锐软件逆向54期预科班、正式班开始火爆招生报名啦!!!
赞赏
他的文章
赞赏
雪币:
留言: