| 418 | |
| 419 | |
| 420 | NTSTATUS SearchServiceFromMouExt(PDRIVER_OBJECT MouDriverObject, PDEVICE_OBJECT pPortDev) |
| 421 | { |
| 422 | PDEVICE_OBJECT pTargetDeviceObject = NULL; |
| 423 | UCHAR* DeviceExt; |
| 424 | int i = 0; |
| 425 | NTSTATUS status; |
| 426 | PVOID KbdDriverStart; |
| 427 | ULONG KbdDriverSize = 0; |
| 428 | PDEVICE_OBJECT pTmpDev; |
| 429 | UNICODE_STRING kbdDriName; |
| 430 | |
| 431 | KbdDriverStart = MouDriverObject->DriverStart; |
| 432 | KbdDriverSize = MouDriverObject->DriverSize; |
| 433 | |
| 434 | status = STATUS_UNSUCCESSFUL; |
| 435 | |
| 436 | RtlInitUnicodeString(&kbdDriName, L"\\Driver\\mouclass"); |
| 437 | pTmpDev = pPortDev; |
| 438 | while (pTmpDev->AttachedDevice != NULL) |
| 439 | { |
| 440 | KdPrint(("Att: 0x%x", pTmpDev->AttachedDevice)); |
| 441 | KdPrint(("Dri Name : %wZ", &pTmpDev->AttachedDevice->DriverObject->DriverName)); |
| 442 | if (RtlCompareUnicodeString(&pTmpDev->AttachedDevice->DriverObject->DriverName, |
| 443 | &kbdDriName, TRUE) == 0) |
| 444 | { |
| 445 | KdPrint(("Find Object Device: ")); |
| 446 | break; |
| 447 | } |
| 448 | pTmpDev = pTmpDev->AttachedDevice; |
| 449 | } |
| 450 | if (pTmpDev->AttachedDevice == NULL) |
| 451 | { |
| 452 | return status; |
| 453 | } |
| 454 | pTargetDeviceObject = MouDriverObject->DeviceObject; |
| 455 | while (pTargetDeviceObject) |
| 456 | { |
| 457 | if (pTmpDev->AttachedDevice != pTargetDeviceObject) |
| 458 | { |
| 459 | pTargetDeviceObject = pTargetDeviceObject->NextDevice; |
| 460 | continue; |
| 461 | } |
| 462 | DeviceExt = (UCHAR*)pTmpDev->DeviceExtension; |
| 463 | g_KoMCallBack.MouDeviceObject = NULL; |
| 464 | //�����������ҵ��Ķ˿��������豸��չ��ÿһ��ָ�� |
| 465 | for (i = 0; i < 4096; i++, DeviceExt++) |
| 466 | { |
| 467 | PVOID tmp; |
| 468 | if (!MmIsAddressValid(DeviceExt)) |
| 469 | { |
| 470 | break; |
| 471 | } |
| 472 | //�ҵ������д�����ȫ�ֱ����У��������Ƿ��Ѿ������ |
| 473 | //����Ѿ�����˾Ͳ��ü������ˣ�����ֱ���˳� |
| 474 | if (g_KoMCallBack.MouDeviceObject && g_KoMCallBack.MouseClassServiceCallback) |
| 475 | { |
| 476 | status = STATUS_SUCCESS; |
| 477 | break; |
no outgoing calls
no test coverage detected