试图使用DeviceIoControl向过滤驱动发送控制代码。 源代码如下:
#define START_FILTER CTL_CODE(FILE_DEVICE_CD_ROM_FILE_SYSTEM,XD_CTL_CODE_READONLY,METHOD_BUFFERED,FILE_ANY_ACCESS)
#define STOP_FILTER CTL_CODE(FILE_DEVICE_CD_ROM_FILE_SYSTEM,XD_CTL_CODE_WRITABLE,METHOD_BUFFERED,FILE_ANY_ACCESS)
//XD_CTL_CODE_READONLY 为驱动程序中定义的控制代码
#define erron GetLastError()
....
//传递启动的I/O控制代码
if (!( DeviceIoControl(hDevice,START_FILTER,NULL,0,NULL,0,NULL,NULL)))
{
#ifdef DEBUGMSG
printf("XD_CTL_CODE_READONLY DeviceIoControl() GetLastError reports [%d]\n",erron);
#endif
CloseHandle(hDevice);
return FALSE;
}
//=================================================================================================
结果DeviceIoControl函数返回错误码87,即ERROR_INVALID_PARAMETER 87 (0x57) The parameter is incorrect.
请指教!