zoukankan      html  css  js  c++  java
  • windows内核下内存申请,链表使用函数


    ExAllocatePool(pageType, nAllocSize);

    ExFreePool(address);

    ExAllocatePoolWithTag(pageType, nAllocSize, tag);

    ExFreePoolWithTag(address, tag);

    NPAGED_LOOKASIDE_LIST lookaside;

    ExInitializeNPagedLookasideList(&lookaside, NULL, NULL, 0, nAllocSize, tag, 0);

    ExAllocateFromNPagedLookasideList(&lookaside);

    ExFreeToNPagedLookasideList(&lookaside, address);

    ExDeleteNPagedLookasideList(&lookaside);

    LIST_ENTRY listEntry;

    InitializeListHead(&listEntry);

    IsListEmpty(&listEntry);

    InsertTailList(&listEntry, &newEntry);

    InsertHeadList(&listEntry, &newEntry);

    /*
    Calling RemoveHeadList Or RemoveTailList with an empty list can cause a system failure. Callers of
    RemoveHeadList or RemoveTailList should first call IsListEmpty to determine if the list has any entries.
    */
    RemoveTailList(&listEntry);

    RemoveHeadList(&listEntry);

    RemoveEntryList(&entryItem);


    SPIN_LOCK spinLock;

    KeInitializeSpinLock(&spinLock);

    ExInterLockedInsertHeadList(&listEntry, &newEntry, &spinLock);

    ExInterLockedInsertTailList(&listEntry, &newEntry, &spinLock);

    /*
    If the list is empty, a NULL pointer is returned. Otherwise, a pointer to the dequeued entry is returned.
    */
    ExInterLockedRemoveHeadList(&listEntry, &spinLock);


    SLIST_EHADER sListHead;
    ExInitializeSListHead(&sListHead);
    ExInterLockedPushEntrySList(&sListHead, sListEntry, lock);

    /*
    ExInterlockedPopEntrySList returns a pointer to the first entry in the list. If the list was empty,
    it returns NULL.
    */
    ExInterLockedPopEntrySList(&sListHead, lock)


    /*
    ExQueryDepthSList returns the current number of entries in the S-List.
    */
    ExQueryDepthSList(&sListHead);

  • 相关阅读:
    浅谈左偏树入门
    【洛谷3768】简单的数学题(莫比乌斯反演+杜教筛)
    【51nod1743】雪之国度(最小生成树+倍增)
    【BZOJ1562】[NOI2009] 变换序列(匈牙利算法)
    【HHHOJ】NOIP模拟赛 玖 解题报告
    【BZOJ3930】[CQOI2015] 选数(容斥)
    【BZOJ1257】[CQOI2007] 余数之和(除法分块)
    杜教筛入门
    初学狄利克雷卷积
    关于积性函数的一些知识
  • 原文地址:https://www.cnblogs.com/endenvor/p/11510816.html
Copyright © 2011-2022 走看看