Hi All
I have use DeviceIoControl to send user mode data to the kernel,
but it wiil crash down when I copy data to Kernal dma buffer,
Does anyone can help this ?? any comment or sample code is wellcome
Thanks a lot
Ps:
I define my CTL_CODE like this
#define IOCTL_SEND_DATA CTL_CODE(MY_TYPE, 0x900, METHOD_IN_DIRECT,
FILE_ANY_ACCES)
and send data like this
DeviceIoControl(hdevice, IOCTL_SEND_DATA, MyParam, MY_LEN, NULL, NULL,
&dwRet, NULL);
Myparam is allocate by (MY_PARAM*) malloc(MY_LEN);
typedef struct _MY_PARAM {
ULONG Channel;
ULONG DataLen;
ULONG Message[1];
} MY_PARAM
#define MY_LEN (sizeof(MY_PARAM)+1024*sizeof(unsigned char))
My Driver code is write as this
KeAcquireSpinLock(&pLDI->DmaSpinLock, &oldIrql);
pMPG = (MY_PARAM*) pIrp->AssociatedIrp.SystemBuffer;
RtlCopyMemory((PULONG)
pLDI->DMABuffers[(pMPG->DmaChannel)].Virtual,pMPG->Message,pMPG->DataLen);---->crash
down here!!!!
KeReleaseSpinLock(&pLDI->DmaSpinLock, oldIrql);
Thanks for you read this letter,Sorry for my poor english^^"""