调用MmFreeNonCachedMemory出现错误?
急!请高手帮忙,vs2008调用MmFreeNonCachedMemory出现错误c:\001\hellowdm\hellowdm\hellowdm.cpp(167) : error C2440: '=' : cannot convert from 'PVOID' to 'IOPM (*)'
我的代码是这样的
#define IOPM_SIZE 8192
typedef UCHAR IOPM[IOPM_SIZE];
IOPM *pIOPM = NULL;
void Ke386SetIoAccessMap(int, IOPM *);
void Ke386IoSetAccessProcess(PEPROCESS, int);
DriverEntry的代码:
pIOPM = MmAllocateNonCachedMemory(sizeof(IOPM));
if (pIOPM == 0)
{
return STATUS_INSUFFICIENT_RESOURCES;
}
RtlZeroMemory(pIOPM, sizeof(IOPM));
Ke386IoSetAccessProcess(PsGetCurrentProcess(), 1);
Ke386SetIoAccessMap(1, pIOPM);
部问题在于不能将PVOID类型转换成其它的指针,因为调用pvIOBuffer = Irp->AssociatedIrp.SystemBuffer;
同样出现c:\001\hellowdm\hellowdm\hellowdm.cpp(82) : error C2440: '=' : cannot convert from 'PVOID' to 'PULONG' 的错误