• 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);

  • 相关阅读:
    打造自定义 eslint
    二叉树(三): 二叉查找树
    二叉树(二): 补充
    二叉树(一): 遍历
    redux 源码浅析
    react-redux 源码浅析
    WebComponents使用以及思考
    SHELL 语法以及实例
    React-Native 原生 APP 更新
    关于 cdn 在项目中的使用
  • 原文地址:https://www.cnblogs.com/endenvor/p/11510816.html
Copyright © 2020-2023  润新知