I Allocate a Memory in driver. and the virtual address is bigger thang
0x80000000.
I want to every app can visisted that memory .

how can do with it ?

Current my method is:


///////////////////////////////////////////////////////////////////////////
void* CalPFN(void * pBase, void* pAddr)
{
unsigned long lPFN;
lPFN = ((unsigned long)pAddr/(ONEPAGE))*4 + (unsigned long)pBase;
return (void*)lPFN;
}


void MakePageAvailable(void * pPageStart, void *pPageEnd)
{
const int nMapNum = 0xffffffff/(ONEPAGE)*4;
PEPROCESS pEPROCESS = NULL;
PHYSICAL_ADDRESS phyPFN ;
unsigned char * pCurPage = pPageStart;

unsigned char * pVIRPFN = NULL;
unsigned char * pucByte; //

if( pPageStart > pPageEnd)
{
return ;
}

pEPROCESS = PsGetCurrentProcess();
phyPFN.LowPart = *(unsigned long*)(((unsigned char*)pEPROCESS) + 0x18);
phyPFN.HighPart = 0 ;

pVIRPFN = (unsigned char*)MmMapIoSpace(phyPFN, nMapNum, FALSE);

do{
pucByte = (unsigned char*)CalPFN((void*)pVIRPFN, (void*)pCurPage);
*pucByte |= 0x4; // Set the Flags that can be visited by user mode
pCurPage += ONEPAGE;
}while( (void*)pCurPage < pPageEnd && (void*)pCurPage > pPageStart);

MmUnmapIoSpace(pVIRPFN, nMapNum);
}
///////////////////////////////////////////////////////////////////////////

I Called MakePageAvailable function in the Create process notify routine.

But when the app visisted that memory, there will be appear a Error.

say the meomoy can't be read.

who can give me another meothod to solve it ?? very thanks.