-
-
[求助]MmAllocatePagesForMdl 共享内存 属性的问题
-
-
[求助]MmAllocatePagesForMdl 共享内存 属性的问题
LowAddress.QuadPart = 0;
MAX_MEM(HighAddress.QuadPart);
// 分配4K的共享缓冲区
Mdl = MmAllocatePagesForMdl(LowAddress,
HighAddress,
LowAddress,
TotalBytes);
if (!Mdl)
{
return STATUS_INSUFFICIENT_RESOURCES;
}
Status = ObReferenceObjectByHandle
(
ProcessHandle,
PROCESS_VM_OPERATION,
*PsProcessType,
UserMode,
(PVOID*)(&Process),
NULL);
if (!NT_SUCCESS(Status))
{
__try
{
*lpStatus = STATUS_INSUFFICIENT_RESOURCES;
return STATUS_INSUFFICIENT_RESOURCES;
}
__except (1)
{
return STATUS_INSUFFICIENT_RESOURCES;
}
}
KeStackAttachProcess((PRKPROCESS)(PVOID)(Process), &ApcState);
//KdPrint(("jmg-kernel-> AllocateVirtualMemory call Process: %s\n", PsGetProcessImageFileName(PsGetCurrentProcess())));
// 映射共享缓冲区到用户地址空间
UserVAToReturn = MmMapLockedPagesSpecifyCache
(Mdl,
UserMode,
MmCached,
NULL,
FALSE,
NormalPagePriority);
Mdl->MdlFlags = Mdl->MdlFlags | MDL_MAPPED_TO_SYSTEM_VA;
PVOID MappedSystemCallTable = MmMapLockedPages(Mdl, UserMode);
KeUnstackDetachProcess(&ApcState);
ObDereferenceObject(Process);
if (!UserVAToReturn)
{
MmFreePagesFromMdl(Mdl);
IoFreeMdl(Mdl);
return STATUS_INSUFFICIENT_RESOURCES;
}
映射 到了R3 的地址..mdl地址属性应该怎么改成可执行呢??
[培训]内核驱动高级班,冲击BAT一流互联网大厂工作,每周日13:00-18:00直播授课