阅读:1576回复:0
使用MOUSE_INPUT_DATA驱动不了鼠标,咋回事?
哪位兄弟帮忙瞅瞅这个函数有啥问题,为啥调用了鼠标也不动呢?
其中的 (*(PSERVICE_CALLBACK_ROUTINE)DeviceExtension->ConnectData.ClassService) 在 IRP_MJ_INTERNAL_DEVICE_CONTROL的入口函数里面貌似成功获得了,可为啥就是驱动不了鼠标的动作呢? // x,y是屏幕坐标 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ VOID SendToScreen( PDEVICE_EXTENSION DeviceExtension, double x, double y) { MOUSE_INPUT_DATA *pInputData = & DeviceExtension->InputData; ULONG inputDataConsumed; KIRQL oldIrql; RtlZeroMemory(pInputData, sizeof(MOUSE_INPUT_DATA)); pInputData->LastX = (LONG)((x*65535)/DeviceExtension->scr_metric_x); pInputData->LastY = (LONG)((y*65535)/DeviceExtension->scr_metric_y); pInputData->Flags = MOUSE_MOVE_ABSOLUTE; pInputData->ButtonFlags = MOUSE_LEFT_BUTTON_DOWN; Print(DeviceExtension, DBG_CC_NOISE, ("mouse class call back.\n")); KeRaiseIrql(DISPATCH_LEVEL, &oldIrql); // // Call the callback. // (*(PSERVICE_CALLBACK_ROUTINE) DeviceExtension->ConnectData.ClassService) ( DeviceExtension->ConnectData.ClassDeviceObject, pInputData, //NULL,//&InputData + 1, pInputData + 1, &inputDataConsumed); // // Restore the previous IRQL right away. // KeLowerIrql(oldIrql); if (1 != inputDataConsumed) { // // oh well, the packet was not consumed, just drop it // Print(DeviceExtension, DBG_READ_ERROR, ("packet not consumed!!!\n")); } } |
|