如何建立应用程序和驱动程序间的通信
2006-07-20 11:39:30 来源:WEB开发网核心提示: void Test_P9052_IOCTL_804_ReadBase3(void){ULONGbufOutput[IOCTL_OUTBUF_SIZE];// 传出读取的数据缓冲区ULONGnOutput;// 实际读取的数据个数ULONG bufInput[2]; // 传入读取的参数UL
void Test_P9052_IOCTL_804_ReadBase3(void)
{
ULONG bufOutput[IOCTL_OUTBUF_SIZE]; // 传出读取的数据缓冲区
ULONG nOutput; // 实际读取的数据个数
ULONG bufInput[2]; // 传入读取的参数
ULONG offset; // 要读取的偏移地址
printf("\n----------- ready for reading from Base3 -----------");
//获取读取的偏移地址:
printf("\nPlease input the offset of read operation(Hex):");
scanf("%x",&offset);
// //获取读取的数据个数:
// printf("\nPlease input the number of data to read(Dec):");
// scanf("%d",&number);
bufInput[0]=offset;
bufInput[1]=IOCTL_OUTBUF_SIZE;
// Call device IO Control interface (PCI9054_IOCTL_804_ReadBase3) in driver
if (!DeviceIoControl(hDevice,
P9052_IOCTL_804_ReadBase3,
bufInput,
2*4, // 字节
bufOutput,
IOCTL_OUTBUF_SIZE*4,//sizeof(bufOutput),
&nOutput,
NULL)
)
{
printf("\nERROR: DeviceIoControl returns %0x.", GetLastError());
Exit(1);
}
printf("\n------>>>>>> data read <<<<<<------");
for(ULONG i=0;i<nOutput;i++)
{
printf("\nread data[%d]=%x",i,bufOutput[i]);
}
printf("\n\n");
}
驱动程序与应用程序的通信:
更多精彩
赞助商链接