📄 pnp.cod
字号:
00175 c7 81 04 05 00
00 01 00 00 00 mov DWORD PTR [ecx+1284], 1
; 546 :
; 547 : pDevExt->SystemWake = pDevCaps->SystemWake;
0017f 8b 50 2c mov edx, DWORD PTR [eax+44]
00182 89 91 78 05 00
00 mov DWORD PTR [ecx+1400], edx
; 548 : pDevExt->DeviceWake = pDevCaps->DeviceWake;
00188 8b 40 30 mov eax, DWORD PTR [eax+48]
0018b 89 81 7c 05 00
00 mov DWORD PTR [ecx+1404], eax
$errQueryCaps$14926:
00191 8b 75 0c mov esi, DWORD PTR _status$[ebp]
00194 8b 7d f8 mov edi, DWORD PTR _pDevExt$[ebp]
; 549 :
; 550 : errQueryCaps:;
; 551 :
; 552 : SerialCompleteRequest(pDevExt, PIrp, IO_NO_INCREMENT);
; 553 : return status;
00197 e9 d0 04 00 00 jmp $L16218
$L14937:
; 554 : }
; 555 :
; 556 : case IRP_MN_QUERY_DEVICE_RELATIONS:
; 557 : //
; 558 : // We just pass this down -- serenum enumerates our bus for us.
; 559 : //
; 560 :
; 561 : SerialDump (SERPNPPOWER, ("SERIAL: Got IRP_MN_QUERY_DEVICE_RELATIONS "
; 562 : "Irp\n"));
; 563 :
; 564 : switch (pIrpStack->Parameters.QueryDeviceRelations.Type) {
0019c 8b 76 04 mov esi, DWORD PTR [esi+4]
0019f 83 ee 00 sub esi, 0
001a2 74 07 je SHORT $L15274
001a4 4e dec esi
001a5 74 04 je SHORT $L15274
001a7 4e dec esi
001a8 74 01 je SHORT $L15274
001aa 4e dec esi
$L15274:
; 1285 : }
; 1286 :
; 1287 : default:
; 1288 : break;
; 1289 :
; 1290 :
; 1291 :
; 1292 : } // switch (pIrpStack->MinorFunction)
; 1293 :
; 1294 : //
; 1295 : // Pass to driver beneath us
; 1296 : //
; 1297 :
; 1298 : IoSkipCurrentIrpStackLocation(PIrp);
001ab 83 43 60 24 add DWORD PTR [ebx+96], 36 ; 00000024H
001af fe 43 23 inc BYTE PTR [ebx+35]
; 1299 : status = SerialIoCallDriver(pDevExt, pLowerDevObj, PIrp);
001b2 53 push ebx
001b3 ff 75 fc push DWORD PTR _pLowerDevObj$[ebp]
001b6 57 push edi
$L16210:
001b7 e8 00 00 00 00 call _SerialIoCallDriver@12
$L14889:
001bc 5f pop edi
001bd 5e pop esi
001be 5b pop ebx
; 1300 : return status;
; 1301 : }
001bf c9 leave
001c0 c2 08 00 ret 8
$L14978:
; 565 : case BusRelations:
; 566 : SerialDump(SERPNPPOWER, ("------- BusRelations Query\n"));
; 567 : break;
; 568 :
; 569 : case EjectionRelations:
; 570 : SerialDump(SERPNPPOWER, ("------- EjectionRelations Query\n"));
; 571 : break;
; 572 :
; 573 : case PowerRelations:
; 574 : SerialDump(SERPNPPOWER, ("------- PowerRelations Query\n"));
; 575 : break;
; 576 :
; 577 : case RemovalRelations:
; 578 : SerialDump(SERPNPPOWER, ("------- RemovalRelations Query\n"));
; 579 : break;
; 580 :
; 581 : case TargetDeviceRelation:
; 582 : SerialDump(SERPNPPOWER, ("------- TargetDeviceRelation Query\n"));
; 583 : break;
; 584 :
; 585 : default:
; 586 : SerialDump(SERPNPPOWER, ("------- Unknown Query\n"));
; 587 : break;
; 588 : }
; 589 :
; 590 : IoSkipCurrentIrpStackLocation(PIrp);
; 591 : status = SerialIoCallDriver(pDevExt, pLowerDevObj, PIrp);
; 592 : return status;
; 593 :
; 594 :
; 595 : case IRP_MN_QUERY_INTERFACE:
; 596 : SerialDump (SERPNPPOWER, ("SERIAL: Got IRP_MN_QUERY_INTERFACE Irp\n"));
; 597 : break;
; 598 :
; 599 :
; 600 : case IRP_MN_QUERY_RESOURCE_REQUIREMENTS:
; 601 : SerialDump (SERPNPPOWER, ("SERIAL: Got "
; 602 : "IRP_MN_QUERY_RESOURCE_REQUIREMENTS Irp\n"));
; 603 : break;
; 604 :
; 605 :
; 606 : case IRP_MN_START_DEVICE: {
; 607 : PVOID startLockPtr;
; 608 :
; 609 : SerialDump (SERPNPPOWER, ("SERIAL: Got IRP_MN_START_DEVICE Irp\n"));
; 610 :
; 611 : //
; 612 : // SerialStartDevice will pass this Irp to the next driver,
; 613 : // and process it as completion so just complete it here.
; 614 : //
; 615 :
; 616 : SerialLockPagableSectionByHandle(SerialGlobals.PAGESER_Handle);
001c3 ff 35 08 00 00
00 push DWORD PTR _SerialGlobals+8
001c9 ff 15 00 00 00
00 call DWORD PTR __imp__MmLockPagableSectionByHandle@4
; 617 :
; 618 : //
; 619 : // We used to make sure the stack was powered up, but now it
; 620 : // is supposed to be done implicitly by start_device.
; 621 : // If that wasn't the case we would just make this call:
; 622 : //
; 623 : // status = SerialGotoPowerState(PDevObj, pDevExt, PowerDeviceD0);
; 624 : //
; 625 :
; 626 : pDevExt->PowerState = PowerDeviceD0;
; 627 :
; 628 : status = SerialStartDevice(PDevObj, PIrp);
001cf 53 push ebx
001d0 c7 87 a4 04 00
00 01 00 00 00 mov DWORD PTR [edi+1188], 1
001da ff 75 08 push DWORD PTR _PDevObj$[ebp]
001dd e8 00 00 00 00 call _SerialStartDevice@8
; 629 :
; 630 : (void)SerialGotoPowerState(PDevObj, pDevExt, PowerDeviceD3);
001e2 6a 04 push 4
001e4 57 push edi
001e5 ff 75 08 push DWORD PTR _PDevObj$[ebp]
001e8 8b f0 mov esi, eax
001ea e8 00 00 00 00 call _SerialGotoPowerState@12
; 631 :
; 632 : SerialUnlockPagableImageSection(SerialGlobals.PAGESER_Handle);
001ef ff 35 08 00 00
00 push DWORD PTR _SerialGlobals+8
001f5 ff 15 00 00 00
00 call DWORD PTR __imp__MmUnlockPagableImageSection@4
; 633 :
; 634 :
; 635 : PIrp->IoStatus.Status = status;
; 636 :
; 637 : SerialCompleteRequest(pDevExt, PIrp, IO_NO_INCREMENT);
; 638 : return status;
001fb e9 69 04 00 00 jmp $L16216
$L14998:
; 639 : }
; 640 :
; 641 :
; 642 : case IRP_MN_READ_CONFIG:
; 643 : SerialDump (SERPNPPOWER, ("SERIAL: Got IRP_MN_READ_CONFIG Irp\n"));
; 644 : break;
; 645 :
; 646 :
; 647 : case IRP_MN_WRITE_CONFIG:
; 648 : SerialDump (SERPNPPOWER, ("SERIAL: Got IRP_MN_WRITE_CONFIG Irp\n"));
; 649 : break;
; 650 :
; 651 :
; 652 : case IRP_MN_EJECT:
; 653 : SerialDump (SERPNPPOWER, ("SERIAL: Got IRP_MN_EJECT Irp\n"));
; 654 : break;
; 655 :
; 656 :
; 657 : case IRP_MN_SET_LOCK:
; 658 : SerialDump (SERPNPPOWER, ("SERIAL: Got IRP_MN_SET_LOCK Irp\n"));
; 659 : break;
; 660 :
; 661 :
; 662 : case IRP_MN_QUERY_ID: {
; 663 : UNICODE_STRING pIdBuf;
; 664 : PWCHAR pPnpIdStr;
; 665 : ULONG pnpIdStrLen;
; 666 : ULONG isMulti = 0;
; 667 : HANDLE pnpKey;
; 668 :
; 669 : SerialDump(SERPNPPOWER, ("SERIAL: Got IRP_MN_QUERY_ID Irp\n"));
; 670 :
; 671 : if (pIrpStack->Parameters.QueryId.IdType != BusQueryHardwareIDs
; 672 : && pIrpStack->Parameters.QueryId.IdType != BusQueryCompatibleIDs) {
00200 8b 76 04 mov esi, DWORD PTR [esi+4]
00203 83 65 f4 00 and DWORD PTR _isMulti$15002[ebp], 0
00207 83 fe 01 cmp esi, 1
0020a 74 07 je SHORT $L15007
0020c 83 fe 02 cmp esi, 2
0020f 74 07 je SHORT $L16206
; 673 : IoSkipCurrentIrpStackLocation(PIrp);
; 674 : return SerialIoCallDriver(pDevExt, pLowerDevObj, PIrp);
00211 eb 98 jmp SHORT $L15274
$L15007:
; 675 : }
; 676 :
; 677 : if (pIrpStack->Parameters.QueryId.IdType == BusQueryCompatibleIDs) {
00213 83 fe 02 cmp esi, 2
00216 75 06 jne SHORT $L15008
$L16206:
; 678 : PIrp->IoStatus.Status = STATUS_SUCCESS;
00218 83 63 18 00 and DWORD PTR [ebx+24], 0
; 679 : IoSkipCurrentIrpStackLocation(PIrp);
; 680 : return SerialIoCallDriver(pDevExt, pLowerDevObj, PIrp);
0021c eb 8d jmp SHORT $L15274
$L15008:
; 681 : }
; 682 :
; 683 : status = IoOpenDeviceRegistryKey(pDevExt->Pdo, PLUGPLAY_REGKEY_DEVICE,
; 684 : STANDARD_RIGHTS_WRITE, &pnpKey);
0021e 8d 45 f0 lea eax, DWORD PTR _pnpKey$15003[ebp]
00221 50 push eax
00222 68 00 00 02 00 push 131072 ; 00020000H
00227 6a 01 push 1
00229 ff b7 80 05 00
00 push DWORD PTR [edi+1408]
0022f ff 15 00 00 00
00 call DWORD PTR __imp__IoOpenDeviceRegistryKey@16
; 685 :
; 686 : if (!NT_SUCCESS(status)) {
00235 85 c0 test eax, eax
00237 7d 08 jge SHORT $L15011
; 687 : PIrp->IoStatus.Status = status;
00239 89 43 18 mov DWORD PTR [ebx+24], eax
0023c e9 56 fe ff ff jmp $L16220
$L15011:
; 688 :
; 689 : SerialCompleteRequest(pDevExt, PIrp, IO_NO_INCREMENT);
; 690 : return status;
; 691 :
; 692 : }
; 693 :
; 694 : status = SerialGetRegistryKeyValue (pnpKey, L"MultiportDevice",
; 695 : sizeof(L"MultiportDevice"),
; 696 : &isMulti,
; 697 : sizeof (ULONG));
00241 8d 45 f4 lea eax, DWORD PTR _isMulti$15002[ebp]
00244 6a 04 push 4
00246 50 push eax
00247 6a 20 push 32 ; 00000020H
00249 68 00 00 00 00 push OFFSET FLAT:$SG15013
0024e ff 75 f0 push DWORD PTR _pnpKey$15003[ebp]
00251 e8 00 00 00 00 call _SerialGetRegistryKeyValue@20
; 698 :
; 699 : ZwClose(pnpKey);
00256 ff 75 f0 push DWORD PTR _pnpKey$15003[ebp]
00259 8b f0 mov esi, eax
0025b ff 15 00 00 00
00 call DWORD PTR __imp__ZwClose@4
; 700 :
; 701 : if (!NT_SUCCESS(status)) {
00261 85 f6 test esi, esi
; 702 : PIrp->IoStatus.Status = status;
00263 0f 8c 00 04 00
00 jl $L16216
; 703 : SerialCompleteRequest(pDevExt, PIrp, IO_NO_INCREMENT);
; 704 : return status;
; 705 : }
; 706 :
; 707 : pPnpIdStr = isMulti ? SERIAL_PNP_MULTI_ID_STR : SERIAL_PNP_ID_STR;
00269 83 7d f4 00 cmp DWORD PTR _isMulti$15002[ebp], 0
0026d c7 45 0c 00 00
00 00 mov DWORD PTR _pPnpIdStr$15000[ebp], OFFSET FLAT:$SG15016
00274 75 07 jne SHORT $L16141
00276 c7 45 0c 00 00
00 00 mov DWORD PTR _pPnpIdStr$15000[ebp], OFFSET FLAT:$SG15017
$L16141:
; 708 : pnpIdStrLen = isMulti ? sizeof(SERIAL_PNP_MULTI_ID_STR)
; 709 : : sizeof(SERIAL_PNP_ID_STR);
; 710 :
; 711 : if (PIrp->IoStatus.Information != 0) {
0027d 8b 43 1c mov eax, DWORD PTR [ebx+28]
00280 85 c0 test eax, eax
00282 0f 84 98 00 00
00 je $L15042
; 712 : ULONG curStrLen;
; 713 : ULONG allocLen = 0;
00288 33 f6 xor esi, esi
; 714 : PWSTR curStr = (PWSTR)PIrp->IoStatus.Information;
0028a 89 45 08 mov DWORD PTR _curStr$15021[ebp], eax
; 715 :
; 716 : //
; 717 : // We have to walk the strings to count the amount of space to
; 718 : // reallocate
; 719 : //
; 720 :
; 721 : while ((curStrLen = wcslen(curStr)) != 0) {
0028d 50 push eax
0028e eb 0c jmp SHORT $L16209
$L15024:
; 722 : allocLen += curStrLen * sizeof(WCHAR) + sizeof(UNICODE_NULL);
00290 8d 44 00 02 lea eax, DWORD PTR [eax+eax+2]
00294 03 f0 add esi, eax
; 723 : curStr += curStrLen + 1;
00296 01 45 08 add DWORD PTR _curStr$15021[ebp], eax
00299 ff 75 08 push DWORD PTR _curStr$15021[ebp]
$L16209:
0029c ff 15 00 00 00
00 call DWORD PTR __imp__wcslen
002a2 85 c0 test eax, eax
002a4 59 pop ecx
002a5 75 e9 jne SHORT $L15024
; 724 : }
; 725 :
; 726 : allocLen += sizeof(UNICODE_NULL);
002a7 46 inc esi
; 727 :
; 728 : pIdBuf.Buffer = ExAllocatePool(PagedPool, allocLen
; 729 : + pnpIdStrLen
; 730 : + sizeof(WCHAR));
002a8 68 43 4f 4d 58 push 1481461571 ; 584d4f43H
002ad 46 inc esi
002ae 8d 46 14 lea eax, DWORD PTR [esi+20]
002b1 50 push eax
002b2 6a 01 push 1
002b4 ff 15 00 00 00
00 call DWORD PTR __imp__ExAllocatePoolWithTag@12
; 731 :
; 732 : if (pIdBuf.Buffer == NULL) {
002ba 85 c0 test eax, eax
002bc 89 45 ec mov DWORD PTR _pIdBuf$14999[ebp+4], eax
002bf 75 0b jne SHORT $L15031
; 733 : //
; 734 : // Clean up after other drivers since we are
; 735 : // sending the irp back up.
; 736 : //
; 737 :
; 738 : ExFreePool((PWSTR)PIrp->IoStatus.Information);
002c1 ff 73 1c push DWORD PTR [ebx+28]
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -