📄 pnp.cod
字号:
002c4 ff 15 00 00 00
00 call DWORD PTR __imp__ExFreePool@4
; 739 :
; 740 :
; 741 : PIrp->IoStatus.Status = STATUS_INSUFFICIENT_RESOURCES;
; 742 : PIrp->IoStatus.Information = 0;
; 743 : SerialCompleteRequest(pDevExt, PIrp, IO_NO_INCREMENT);
; 744 : return STATUS_INSUFFICIENT_RESOURCES;
002ca eb 6a jmp SHORT $L16219
$L15031:
; 745 : }
; 746 :
; 747 : pIdBuf.MaximumLength = (USHORT)(allocLen + pnpIdStrLen);
; 748 : pIdBuf.Length = (USHORT)allocLen - sizeof(UNICODE_NULL);
002cc 8d 4e fe lea ecx, DWORD PTR [esi-2]
002cf 8d 46 12 lea eax, DWORD PTR [esi+18]
002d2 66 89 4d e8 mov WORD PTR _pIdBuf$14999[ebp], cx
; 749 :
; 750 : RtlZeroMemory(pIdBuf.Buffer, pIdBuf.MaximumLength + sizeof(WCHAR));
002d6 8b 7d ec mov edi, DWORD PTR _pIdBuf$14999[ebp+4]
002d9 0f b7 c8 movzx ecx, ax
002dc 41 inc ecx
002dd 66 89 45 ea mov WORD PTR _pIdBuf$14999[ebp+2], ax
002e1 41 inc ecx
002e2 33 c0 xor eax, eax
002e4 8b d1 mov edx, ecx
; 751 : RtlCopyMemory(pIdBuf.Buffer, (PWSTR)PIrp->IoStatus.Information,
; 752 : allocLen);
; 753 : RtlAppendUnicodeToString(&pIdBuf, pPnpIdStr);
002e6 ff 75 0c push DWORD PTR _pPnpIdStr$15000[ebp]
002e9 c1 e9 02 shr ecx, 2
002ec f3 ab rep stosd
002ee 8b ca mov ecx, edx
002f0 83 e1 03 and ecx, 3
002f3 f3 aa rep stosb
002f5 8b 7d ec mov edi, DWORD PTR _pIdBuf$14999[ebp+4]
002f8 8b ce mov ecx, esi
002fa 8b 73 1c mov esi, DWORD PTR [ebx+28]
002fd 8b c1 mov eax, ecx
002ff c1 e9 02 shr ecx, 2
00302 f3 a5 rep movsd
00304 8b c8 mov ecx, eax
00306 8d 45 e8 lea eax, DWORD PTR _pIdBuf$14999[ebp]
00309 83 e1 03 and ecx, 3
0030c 50 push eax
0030d f3 a4 rep movsb
0030f ff 15 00 00 00
00 call DWORD PTR __imp__RtlAppendUnicodeToString@8
; 754 :
; 755 : //
; 756 : // Free what the previous driver allocated
; 757 : //
; 758 :
; 759 : ExFreePool((PWSTR)PIrp->IoStatus.Information);
00315 ff 73 1c push DWORD PTR [ebx+28]
00318 ff 15 00 00 00
00 call DWORD PTR __imp__ExFreePool@4
; 760 :
; 761 :
; 762 : } else {
0031e eb 48 jmp SHORT $L15041
$L15042:
; 763 :
; 764 : SerialDump(SERPNPPOWER, ("SERIAL: ID is sole ID\n"));
; 765 :
; 766 : pIdBuf.Buffer = ExAllocatePool(PagedPool, pnpIdStrLen
; 767 : + sizeof(WCHAR) * 2);
00320 68 43 4f 4d 58 push 1481461571 ; 584d4f43H
00325 6a 16 push 22 ; 00000016H
00327 6a 01 push 1
00329 ff 15 00 00 00
00 call DWORD PTR __imp__ExAllocatePoolWithTag@12
; 768 :
; 769 : if (pIdBuf.Buffer == NULL) {
0032f 85 c0 test eax, eax
00331 89 45 ec mov DWORD PTR _pIdBuf$14999[ebp+4], eax
00334 75 0e jne SHORT $L15047
$L16219:
; 770 : PIrp->IoStatus.Status = STATUS_INSUFFICIENT_RESOURCES;
; 771 : PIrp->IoStatus.Information = 0;
00336 83 63 1c 00 and DWORD PTR [ebx+28], 0
0033a be 9a 00 00 c0 mov esi, -1073741670 ; c000009aH
; 772 : SerialCompleteRequest(pDevExt, PIrp, IO_NO_INCREMENT);
; 773 : return STATUS_INSUFFICIENT_RESOURCES;
0033f e9 25 03 00 00 jmp $L16216
$L15047:
; 774 : }
; 775 :
; 776 : pIdBuf.MaximumLength = (USHORT)pnpIdStrLen;
; 777 : pIdBuf.Length = 0;
; 778 :
; 779 : RtlZeroMemory(pIdBuf.Buffer, pIdBuf.MaximumLength + sizeof(WCHAR)
; 780 : * 2);
00344 8b 7d ec mov edi, DWORD PTR _pIdBuf$14999[ebp+4]
00347 66 83 65 e8 00 and WORD PTR _pIdBuf$14999[ebp], 0
0034c 33 c0 xor eax, eax
0034e 66 c7 45 ea 12
00 mov WORD PTR _pIdBuf$14999[ebp+2], 18 ; 00000012H
00354 ab stosd
00355 ab stosd
00356 ab stosd
00357 ab stosd
; 781 :
; 782 : RtlAppendUnicodeToString(&pIdBuf, pPnpIdStr);
00358 ff 75 0c push DWORD PTR _pPnpIdStr$15000[ebp]
0035b ab stosd
0035c 66 ab stosw
0035e 8d 45 e8 lea eax, DWORD PTR _pIdBuf$14999[ebp]
00361 50 push eax
00362 ff 15 00 00 00
00 call DWORD PTR __imp__RtlAppendUnicodeToString@8
$L15041:
; 783 : }
; 784 :
; 785 : PIrp->IoStatus.Information = (ULONG_PTR)pIdBuf.Buffer;
00368 8b 45 ec mov eax, DWORD PTR _pIdBuf$14999[ebp+4]
0036b 89 43 1c mov DWORD PTR [ebx+28], eax
; 786 : PIrp->IoStatus.Status = STATUS_SUCCESS;
; 787 :
; 788 : IoCopyCurrentIrpStackLocationToNext(PIrp);
; 789 : return SerialIoCallDriver(pDevExt, pLowerDevObj, PIrp);
0036e e9 36 03 00 00 jmp $L16213
$L15059:
; 790 : }
; 791 :
; 792 : case IRP_MN_FILTER_RESOURCE_REQUIREMENTS: {
; 793 : HANDLE pnpKey;
; 794 : PKEVENT pResFiltEvent;
; 795 : ULONG isMulti = 0;
00373 83 65 0c 00 and DWORD PTR _isMulti$15062[ebp], 0
; 796 : PIO_RESOURCE_REQUIREMENTS_LIST pReqList;
; 797 : PIO_RESOURCE_LIST pResList;
; 798 : PIO_RESOURCE_DESCRIPTOR pResDesc;
; 799 : ULONG i, j;
; 800 : ULONG reqCnt;
; 801 : ULONG gotISR;
; 802 : ULONG gotInt;
; 803 : ULONG listNum;
; 804 :
; 805 : SerialDump(SERPNPPOWER, ("SERIAL: Got "
; 806 : "IRP_MN_FILTER_RESOURCE_REQUIREMENTS Irp\n"));
; 807 : SerialDump(SERPNPPOWER, ("------- for device %x\n", pLowerDevObj));
; 808 :
; 809 :
; 810 : pResFiltEvent = ExAllocatePool(NonPagedPool, sizeof(KEVENT));
00377 68 43 4f 4d 58 push 1481461571 ; 584d4f43H
0037c 6a 10 push 16 ; 00000010H
0037e 6a 00 push 0
00380 ff 15 00 00 00
00 call DWORD PTR __imp__ExAllocatePoolWithTag@12
; 811 :
; 812 : if (pResFiltEvent == NULL) {
00386 85 c0 test eax, eax
00388 89 45 08 mov DWORD PTR _pResFiltEvent$15061[ebp], eax
0038b 75 0a jne SHORT $L15080
; 813 : PIrp->IoStatus.Status = STATUS_INSUFFICIENT_RESOURCES;
0038d be 9a 00 00 c0 mov esi, -1073741670 ; c000009aH
00392 e9 5e 01 00 00 jmp $L15111
$L15080:
; 814 : SerialCompleteRequest(pDevExt, PIrp, IO_NO_INCREMENT);
; 815 : return STATUS_INSUFFICIENT_RESOURCES;
; 816 : }
; 817 :
; 818 : KeInitializeEvent(pResFiltEvent, SynchronizationEvent, FALSE);
00397 6a 00 push 0
00399 6a 01 push 1
0039b ff 75 08 push DWORD PTR _pResFiltEvent$15061[ebp]
0039e ff 15 00 00 00
00 call DWORD PTR __imp__KeInitializeEvent@12
; 819 :
; 820 : IoCopyCurrentIrpStackLocationToNext(PIrp);
003a4 8b 73 60 mov esi, DWORD PTR [ebx+96]
003a7 6a 07 push 7
003a9 59 pop ecx
; 821 : IoSetCompletionRoutine(PIrp, SerialSyncCompletion, pResFiltEvent,
; 822 : TRUE, TRUE, TRUE);
; 823 :
; 824 : status = IoCallDriver(pLowerDevObj, PIrp);
003aa 8b d3 mov edx, ebx
003ac 8d 46 dc lea eax, DWORD PTR [esi-36]
003af 8b f8 mov edi, eax
003b1 f3 a5 rep movsd
003b3 80 60 03 00 and BYTE PTR [eax+3], 0
003b7 8b 43 60 mov eax, DWORD PTR [ebx+96]
003ba 8b 4d 08 mov ecx, DWORD PTR _pResFiltEvent$15061[ebp]
003bd 83 e8 24 sub eax, 36 ; 00000024H
003c0 89 48 20 mov DWORD PTR [eax+32], ecx
003c3 8b 4d fc mov ecx, DWORD PTR _pLowerDevObj$[ebp]
003c6 c7 40 1c 00 00
00 00 mov DWORD PTR [eax+28], OFFSET FLAT:_SerialSyncCompletion@12
003cd c6 40 03 e0 mov BYTE PTR [eax+3], 224 ; 000000e0H
003d1 ff 15 00 00 00
00 call DWORD PTR __imp_@IofCallDriver@8
; 825 :
; 826 :
; 827 : //
; 828 : // Wait for lower drivers to be done with the Irp
; 829 : //
; 830 :
; 831 : if (status == STATUS_PENDING) {
; 832 : KeWaitForSingleObject (pResFiltEvent, Executive, KernelMode, FALSE,
; 833 : NULL);
003d7 33 f6 xor esi, esi
003d9 3d 03 01 00 00 cmp eax, 259 ; 00000103H
003de 75 0d jne SHORT $L15093
003e0 56 push esi
003e1 56 push esi
003e2 56 push esi
003e3 56 push esi
003e4 ff 75 08 push DWORD PTR _pResFiltEvent$15061[ebp]
003e7 ff 15 00 00 00
00 call DWORD PTR __imp__KeWaitForSingleObject@20
$L15093:
; 834 : }
; 835 :
; 836 : ExFreePool(pResFiltEvent);
003ed ff 75 08 push DWORD PTR _pResFiltEvent$15061[ebp]
003f0 ff 15 00 00 00
00 call DWORD PTR __imp__ExFreePool@4
; 837 :
; 838 : if (PIrp->IoStatus.Information == 0) {
003f6 39 73 1c cmp DWORD PTR [ebx+28], esi
003f9 75 15 jne SHORT $L15095
; 839 : if (pIrpStack->Parameters.FilterResourceRequirements
; 840 : .IoResourceRequirementList == 0) {
003fb 8b 45 f0 mov eax, DWORD PTR _pIrpStack$[ebp]
003fe 8b 40 04 mov eax, DWORD PTR [eax+4]
00401 3b c6 cmp eax, esi
00403 75 08 jne SHORT $L15096
; 841 : SerialDump(SERPNPPOWER, ("------- Can't filter NULL resources!"
; 842 : "\n"));
; 843 : status = PIrp->IoStatus.Status;
00405 8b 73 18 mov esi, DWORD PTR [ebx+24]
00408 e9 eb 00 00 00 jmp $L16195
$L15096:
; 844 : SerialCompleteRequest(pDevExt, PIrp, IO_NO_INCREMENT);
; 845 : return status;
; 846 : }
; 847 :
; 848 : PIrp->IoStatus.Information = (ULONG_PTR)pIrpStack->Parameters
; 849 : .FilterResourceRequirements
; 850 : .IoResourceRequirementList;
0040d 89 43 1c mov DWORD PTR [ebx+28], eax
$L15095:
; 851 :
; 852 : }
; 853 :
; 854 : status = IoOpenDeviceRegistryKey(pDevExt->Pdo, PLUGPLAY_REGKEY_DEVICE,
; 855 : STANDARD_RIGHTS_WRITE, &pnpKey);
00410 8d 45 ec lea eax, DWORD PTR _pnpKey$15060[ebp]
00413 50 push eax
00414 8b 45 f8 mov eax, DWORD PTR _pDevExt$[ebp]
00417 68 00 00 02 00 push 131072 ; 00020000H
0041c 6a 01 push 1
0041e ff b0 80 05 00
00 push DWORD PTR [eax+1408]
00424 ff 15 00 00 00
00 call DWORD PTR __imp__IoOpenDeviceRegistryKey@16
; 856 :
; 857 : if (!NT_SUCCESS(status)) {
0042a 3b c6 cmp eax, esi
0042c 7d 0a jge SHORT $L15102
; 858 : PIrp->IoStatus.Status = status;
0042e 89 43 18 mov DWORD PTR [ebx+24], eax
00431 8b f0 mov esi, eax
00433 e9 c0 00 00 00 jmp $L16195
$L15102:
; 859 :
; 860 : SerialCompleteRequest(pDevExt, PIrp, IO_NO_INCREMENT);
; 861 : return status;
; 862 :
; 863 : }
; 864 :
; 865 : //
; 866 : // No matter what we add our filter if we can and return success.
; 867 : //
; 868 :
; 869 : status = SerialGetRegistryKeyValue (pnpKey, L"MultiportDevice",
; 870 : sizeof(L"MultiportDevice"),
; 871 : &isMulti,
; 872 : sizeof (ULONG));
00438 8d 45 0c lea eax, DWORD PTR _isMulti$15062[ebp]
0043b 6a 04 push 4
0043d 50 push eax
0043e 6a 20 push 32 ; 00000020H
00440 68 00 00 00 00 push OFFSET FLAT:$SG15104
00445 ff 75 ec push DWORD PTR _pnpKey$15060[ebp]
00448 e8 00 00 00 00 call _SerialGetRegistryKeyValue@20
; 873 :
; 874 : ZwClose(pnpKey);
0044d ff 75 ec push DWORD PTR _pnpKey$15060[ebp]
00450 ff 15 00 00 00
00 call DWORD PTR __imp__ZwClose@4
; 875 :
; 876 :
; 877 : //
; 878 : // Force ISR ports in IO_RES_REQ_LIST to shared status
; 879 : // Force interrupts to shared status
; 880 : //
; 881 :
; 882 : //
; 883 : // We will only process the first list -- multiport boards
; 884 : // should not have alternative resources
; 885 : //
; 886 :
; 887 : pReqList = (PIO_RESOURCE_REQUIREMENTS_LIST)PIrp->IoStatus.Information;
00456 8b 53 1c mov edx, DWORD PTR [ebx+28]
; 888 : pResList = &pReqList->List[0];
; 889 :
; 890 : SerialDump(SERPNPPOWER, ("------- List has %x lists "
; 891 : "(including alternatives)\n",
; 892 : pReqList->AlternativeLists));
; 893 :
; 894 : for (listNum = 0; listNum < (pReqList->AlternativeLists);
; 895 : listNum++) {
00459 89 75 f0 mov DWORD PTR _listNum$15071[ebp], esi
0045c 39 72 1c cmp DWORD PTR [edx+28], esi
0045f 8d 42 20 lea eax, DWORD PTR [edx+32]
00462 0f 86 8d 00 00
00 jbe $L15111
$L15109:
; 897 : gotInt = 0;
; 898 :
; 899 : SerialDump(SERPNPPOWER, ("------- List has %x resources in it\n",
; 900 : pResList->Count));
; 901 :
; 902 : for (j = 0; (j < pResList->Count); j++) {
00468 39 70 04 cmp DWORD PTR [eax+4], esi
0046b 89 75 fc mov DWORD PTR _gotISR$15069[ebp], esi
0046e 89 75 08 mov DWORD PTR _gotInt$15070[ebp], esi
00471 89 75 f4 mov DWORD PTR _j$15067[ebp], esi
00474 76 66 jbe SHORT $L15140
; 896 : gotISR = 0;
00476 8d 48 0a lea ecx, DWORD PTR [eax+10]
$L15115:
; 903 : pResDesc = &pResList->Descriptors[j];
; 904 :
; 905 : switch (pResDesc->Type) {
00479 0f b6 79 ff movzx edi,
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -