非分页 | 分页 |
---|
ExInitializeNPagedLookasideLIst | ExInitializePagedLookasideLIst |
ExAllocateFromNPagedLookasideList | ExAllocateFromPagedLookasideList |
ExFreeToNPagedLookasideList | ExFreeToPagedLookasideList |
ExDeleteNPagedLookasideList | ExDeletePagedLookasideList |
typedef struct _MYDATA
{
int number;
}MYDATA, *PMYDATA;
VOID Unload(IN PDRIVER_OBJECT pDriverObject)
{
//驱动卸载的时候显示
KdPrint(("驱动卸载\n"));
}
VOID LookAsideTest()
{
PAGED_LOOKASIDE_LIST LookAsideList;
PMYDATA pData[100] = {NULL};
KdPrint(("分页快查表测试\n"));
ExInitializePagedLookasideList(&LookAsideList ,NULL,NULL,0,sizeof(MYDATA),'abcd',0);
int i = 0;
for (i = 0; i < 100; i++)
{
pData[i] = (PMYDATA)ExAllocateFromPagedLookasideList(&LookAsideList);//申请内存
pData[i]->number = i;
}
for (i = 0; i < 100; i++)
{
KdPrint(("%d\n", pData[i]->number));
ExFreeToPagedLookasideList(&LookAsideList,pData[i]);
}
ExDeletePagedLookasideList(&LookAsideList);
}
NTSTATUS DriverEntry(
IN PDRIVER_OBJECT DriverObject,
IN PUNICODE_STRING RegistryPath
)
{
DriverObject->DriverUnload = Unload;
//驱动启动的时候显示
LookAsideTest();
KdPrint(("驱动加载\n"));
return STATUS_SUCCESS;
}