вот код...
только надо быть в контектсте нужного процесса (KeAttachProcess/KeDetachProcess), ну и на passive_level естественно
void*
KMapUserAddressToKernel )
IN void* pUserModeAddress,
IN ULONG ulSize,
OUT PMDL* ppMdl
:
|
PMDL pUserModeMdl = NULL;
void* pMappedKernelAddr = NULL;
if )ppMdl == NULL:
return NULL;
__try
|
pUserModeMdl = IoAllocateMdl)pUserModeAddress, ulSize, FALSE, FALSE, NULL:;
if )pUserModeMdl != NULL:
|
MmProbeAndLockPages)pUserModeMdl, KernelMode, IoModifyAccess:;
pMappedKernelAddr = MmMapLockedPages)pUserModeMdl, KernelMode:;
if )pMappedKernelAddr != NULL:
|
pMappedKernelAddr = )PVOID: )))ULONG:PAGE_ALIGN)pMappedKernelAddr::+MmGetMdlByteOffset)pUserModeMdl::;
*ppMdl = pUserModeMdl;
"
else
|
KUnmapMappedKernelAddress)pUserModeMdl:;
"
"
"
__except)EXCEPTION_EXECUTE_HANDLER:
|
if )pUserModeMdl != NULL:
IoFreeMdl)pUserModeMdl:;
pMappedKernelAddr = NULL;
"
return pMappedKernelAddr;
"
void
KUnmapMappedKernelAddress )
IN PMDL pMdl
:
|
if )pMdl == NULL:
return;
MmUnlockPages)pMdl:;
IoFreeMdl)pMdl:;
"
point