📄 utils.cod
字号:
$L14928:
00065 5e pop esi
; 622 : }
; 623 :
; 624 : }
; 625 :
; 626 : }
00066 5d pop ebp
00067 c2 10 00 ret 16 ; 00000010H
_SerialRundownIrpRefs@16 ENDP
PAGESER ENDS
PUBLIC _SerialStartOrQueue@20
PUBLIC _SerialCancelQueued@8
EXTRN __imp__ExFreePool@4:NEAR
; Function compile flags: /Ogsy
; COMDAT _SerialStartOrQueue@20
PAGESER SEGMENT
_Extension$ = 8
_Irp$ = 12
_QueueToExamine$ = 16
_CurrentOpIrp$ = 20
_Starter$ = 24
_oldIrql$ = -4
_SerialStartOrQueue@20 PROC NEAR ; COMDAT
; 671 : {
00000 55 push ebp
00001 8b ec mov ebp, esp
00003 51 push ecx
00004 53 push ebx
00005 56 push esi
; 672 :
; 673 : KIRQL oldIrql;
; 674 :
; 675 : SERIAL_LOCKED_PAGED_CODE();
; 676 :
; 677 : IoAcquireCancelSpinLock(&oldIrql);
00006 8d 45 fc lea eax, DWORD PTR _oldIrql$[ebp]
00009 57 push edi
0000a 50 push eax
0000b ff 15 00 00 00
00 call DWORD PTR __imp__IoAcquireCancelSpinLock@4
; 678 :
; 679 : //
; 680 : // If this is a write irp then take the amount of characters
; 681 : // to write and add it to the count of characters to write.
; 682 : //
; 683 :
; 684 : if (IoGetCurrentIrpStackLocation(Irp)->MajorFunction
; 685 : == IRP_MJ_WRITE) {
00011 8b 75 0c mov esi, DWORD PTR _Irp$[ebp]
00014 8b 5d 08 mov ebx, DWORD PTR _Extension$[ebp]
00017 8b 46 60 mov eax, DWORD PTR [esi+96]
0001a 8a 08 mov cl, BYTE PTR [eax]
0001c 80 f9 04 cmp cl, 4
0001f 75 0b jne SHORT $L14944
; 686 :
; 687 : Extension->TotalCharsQueued +=
; 688 : IoGetCurrentIrpStackLocation(Irp)
; 689 : ->Parameters.Write.Length;
00021 8b 40 04 mov eax, DWORD PTR [eax+4]
00024 01 83 28 01 00
00 add DWORD PTR [ebx+296], eax
; 690 :
; 691 : } else if ((IoGetCurrentIrpStackLocation(Irp)->MajorFunction
0002a eb 1c jmp SHORT $L14946
$L14944:
; 692 : == IRP_MJ_DEVICE_CONTROL) &&
; 693 : ((IoGetCurrentIrpStackLocation(Irp)
; 694 : ->Parameters.DeviceIoControl.IoControlCode ==
; 695 : IOCTL_SERIAL_IMMEDIATE_CHAR) ||
; 696 : (IoGetCurrentIrpStackLocation(Irp)
; 697 : ->Parameters.DeviceIoControl.IoControlCode ==
; 698 : IOCTL_SERIAL_XOFF_COUNTER))) {
0002c 80 f9 0e cmp cl, 14 ; 0000000eH
0002f 75 17 jne SHORT $L14946
00031 8b 40 0c mov eax, DWORD PTR [eax+12]
00034 3d 18 00 1b 00 cmp eax, 1769496 ; 001b0018H
00039 74 07 je SHORT $L14947
0003b 3d 70 00 1b 00 cmp eax, 1769584 ; 001b0070H
00040 75 06 jne SHORT $L14946
$L14947:
; 699 :
; 700 : Extension->TotalCharsQueued++;
00042 ff 83 28 01 00
00 inc DWORD PTR [ebx+296]
$L14946:
; 701 :
; 702 : }
; 703 :
; 704 : if ((IsListEmpty(QueueToExamine)) &&
; 705 : !(*CurrentOpIrp)) {
00048 8b 4d 10 mov ecx, DWORD PTR _QueueToExamine$[ebp]
0004b 39 09 cmp DWORD PTR [ecx], ecx
0004d 75 19 jne SHORT $L14948
0004f 8b 45 14 mov eax, DWORD PTR _CurrentOpIrp$[ebp]
00052 83 38 00 cmp DWORD PTR [eax], 0
00055 75 11 jne SHORT $L14948
; 706 :
; 707 : //
; 708 : // There were no current operation. Mark this one as
; 709 : // current and start it up.
; 710 : //
; 711 :
; 712 : *CurrentOpIrp = Irp;
; 713 :
; 714 : IoReleaseCancelSpinLock(oldIrql);
00057 ff 75 fc push DWORD PTR _oldIrql$[ebp]
0005a 89 30 mov DWORD PTR [eax], esi
0005c ff 15 00 00 00
00 call DWORD PTR __imp__IoReleaseCancelSpinLock@4
; 715 :
; 716 : return Starter(Extension);
00062 53 push ebx
00063 ff 55 18 call DWORD PTR _Starter$[ebp]
00066 eb 7a jmp SHORT $L14959
$L14948:
; 717 :
; 718 : } else {
; 719 :
; 720 : //
; 721 : // We don't know how long the irp will be in the
; 722 : // queue. So we need to handle cancel.
; 723 : //
; 724 :
; 725 : if (Irp->Cancel) {
00068 80 7e 24 00 cmp BYTE PTR [esi+36], 0
0006c 74 3c je SHORT $L14950
; 726 : PIO_STACK_LOCATION irpSp = IoGetCurrentIrpStackLocation(Irp);
; 727 :
; 728 : IoReleaseCancelSpinLock(oldIrql);
0006e ff 75 fc push DWORD PTR _oldIrql$[ebp]
00071 8b 7e 60 mov edi, DWORD PTR [esi+96]
00074 ff 15 00 00 00
00 call DWORD PTR __imp__IoReleaseCancelSpinLock@4
; 729 :
; 730 : if (irpSp->Parameters.DeviceIoControl.IoControlCode ==
; 731 : IOCTL_SERIAL_SET_QUEUE_SIZE) {
0007a 81 7f 0c 08 00
1b 00 cmp DWORD PTR [edi+12], 1769480 ; 001b0008H
00081 75 0d jne SHORT $L14952
; 732 : //
; 733 : // We shoved the pointer to the memory into the
; 734 : // the type 3 buffer pointer which we KNOW we
; 735 : // never use.
; 736 : //
; 737 :
; 738 : ASSERT(irpSp->Parameters.DeviceIoControl.Type3InputBuffer);
; 739 :
; 740 : ExFreePool(irpSp->Parameters.DeviceIoControl.Type3InputBuffer);
00083 ff 77 10 push DWORD PTR [edi+16]
00086 ff 15 00 00 00
00 call DWORD PTR __imp__ExFreePool@4
; 741 :
; 742 : irpSp->Parameters.DeviceIoControl.Type3InputBuffer = NULL;
0008c 83 67 10 00 and DWORD PTR [edi+16], 0
$L14952:
; 743 : }
; 744 :
; 745 : Irp->IoStatus.Status = STATUS_CANCELLED;
00090 bf 20 01 00 c0 mov edi, -1073741536 ; c0000120H
; 746 :
; 747 : SerialDump(
; 748 : SERIRPPATH,
; 749 : ("SERIAL: Complete Irp: %x\n",Irp)
; 750 : );
; 751 : SerialCompleteRequest(Extension, Irp, 0);
00095 32 d2 xor dl, dl
00097 8b ce mov ecx, esi
00099 89 7e 18 mov DWORD PTR [esi+24], edi
0009c ff 15 00 00 00
00 call DWORD PTR __imp_@IofCompleteRequest@8
000a2 53 push ebx
000a3 e8 00 00 00 00 call _SerialIRPEpilogue@4
; 752 :
; 753 : return STATUS_CANCELLED;
000a8 eb 36 jmp SHORT $L15352
$L14950:
; 754 :
; 755 : } else {
; 756 :
; 757 :
; 758 : Irp->IoStatus.Status = STATUS_PENDING;
; 759 : IoMarkIrpPending(Irp);
000aa 8b 46 60 mov eax, DWORD PTR [esi+96]
000ad bf 03 01 00 00 mov edi, 259 ; 00000103H
000b2 89 7e 18 mov DWORD PTR [esi+24], edi
000b5 80 48 03 01 or BYTE PTR [eax+3], 1
; 760 :
; 761 : InsertTailList(
; 762 : QueueToExamine,
; 763 : &Irp->Tail.Overlay.ListEntry
; 764 : );
000b9 8b 51 04 mov edx, DWORD PTR [ecx+4]
000bc 8d 46 58 lea eax, DWORD PTR [esi+88]
000bf 89 56 5c mov DWORD PTR [esi+92], edx
000c2 89 08 mov DWORD PTR [eax], ecx
000c4 89 02 mov DWORD PTR [edx], eax
000c6 89 41 04 mov DWORD PTR [ecx+4], eax
; 765 :
; 766 : IoSetCancelRoutine(
; 767 : Irp,
; 768 : SerialCancelQueued
; 769 : );
000c9 8d 4e 38 lea ecx, DWORD PTR [esi+56]
000cc ba 00 00 00 00 mov edx, OFFSET FLAT:_SerialCancelQueued@8
000d1 ff 15 00 00 00
00 call DWORD PTR __imp_@InterlockedExchange@8
; 770 :
; 771 : IoReleaseCancelSpinLock(oldIrql);
000d7 ff 75 fc push DWORD PTR _oldIrql$[ebp]
000da ff 15 00 00 00
00 call DWORD PTR __imp__IoReleaseCancelSpinLock@4
$L15352:
; 772 :
; 773 : return STATUS_PENDING;
000e0 8b c7 mov eax, edi
$L14959:
000e2 5f pop edi
000e3 5e pop esi
000e4 5b pop ebx
; 774 :
; 775 : }
; 776 :
; 777 : }
; 778 :
; 779 : }
000e5 c9 leave
000e6 c2 14 00 ret 20 ; 00000014H
_SerialStartOrQueue@20 ENDP
; Function compile flags: /Ogsy
PAGESER ENDS
; COMDAT _SerialCancelQueued@8
PAGESER SEGMENT
_DeviceObject$ = 8
_Irp$ = 12
_SerialCancelQueued@8 PROC NEAR ; COMDAT
; 807 :
; 808 : PSERIAL_DEVICE_EXTENSION extension = DeviceObject->DeviceExtension;
00000 8b 44 24 04 mov eax, DWORD PTR _DeviceObject$[esp-4]
00004 53 push ebx
00005 56 push esi
; 809 : PIO_STACK_LOCATION irpSp = IoGetCurrentIrpStackLocation(Irp);
00006 8b 74 24 10 mov esi, DWORD PTR _Irp$[esp+4]
0000a 8b 58 28 mov ebx, DWORD PTR [eax+40]
0000d 57 push edi
; 810 :
; 811 : SERIAL_LOCKED_PAGED_CODE();
; 812 :
; 813 : Irp->IoStatus.Status = STATUS_CANCELLED;
; 814 : Irp->IoStatus.Information = 0;
; 815 :
; 816 : RemoveEntryList(&Irp->Tail.Overlay.ListEntry);
0000e 8b 4e 5c mov ecx, DWORD PTR [esi+92]
00011 8b 46 58 mov eax, DWORD PTR [esi+88]
00014 8b 7e 60 mov edi, DWORD PTR [esi+96]
00017 83 66 1c 00 and DWORD PTR [esi+28], 0
0001b c7 46 18 20 01
00 c0 mov DWORD PTR [esi+24], -1073741536 ; c0000120H
00022 89 01 mov DWORD PTR [ecx], eax
00024 89 48 04 mov DWORD PTR [eax+4], ecx
; 817 :
; 818 : //
; 819 : // If this is a write irp then take the amount of characters
; 820 : // to write and subtract it from the count of characters to write.
; 821 : //
; 822 :
; 823 : if (irpSp->MajorFunction == IRP_MJ_WRITE) {
00027 8a 07 mov al, BYTE PTR [edi]
00029 3c 04 cmp al, 4
0002b 75 0b jne SHORT $L14980
; 824 :
; 825 : extension->TotalCharsQueued -= irpSp->Parameters.Write.Length;
0002d 8b 47 04 mov eax, DWORD PTR [edi+4]
00030 29 83 28 01 00
00 sub DWORD PTR [ebx+296], eax
; 826 :
; 827 : } else if (irpSp->MajorFunction == IRP_MJ_DEVICE_CONTROL) {
00036 eb 31 jmp SHORT $L14986
$L14980:
00038 3c 0e cmp al, 14 ; 0000000eH
0003a 75 2d jne SHORT $L14986
; 828 :
; 829 : //
; 830 : // If it's an immediate then we need to decrement the
; 831 : // count of chars queued. If it's a resize then we
; 832 : // need to deallocate the pool that we're passing on
; 833 : // to the "resizing" routine.
; 834 : //
; 835 :
; 836 : if ((irpSp->Parameters.DeviceIoControl.IoControlCode ==
; 837 : IOCTL_SERIAL_IMMEDIATE_CHAR) ||
; 838 : (irpSp->Parameters.DeviceIoControl.IoControlCode ==
; 839 : IOCTL_SERIAL_XOFF_COUNTER)) {
0003c 8b 47 0c mov eax, DWORD PTR [edi+12]
0003f 3d 18 00 1b 00 cmp eax, 1769496 ; 001b0018H
00044 74 1d je SHORT $L14984
00046 3d 70 00 1b 00 cmp eax, 1769584 ; 001b0070H
0004b 74 16 je SHORT $L14984
; 842 :
; 843 : } else if (irpSp->Parameters.DeviceIoControl.IoControlCode ==
; 844 : IOCTL_SERIAL_SET_QUEUE_SIZE) {
0004d 3d 08 00 1b 00 cmp eax, 1769480 ; 001b0008H
00052 75 15 jne SHORT $L14986
; 845 :
; 846 : //
; 847 : // We shoved the pointer to the memory into the
; 848 : // the type 3 buffer pointer which we KNOW we
; 849 : // never use.
; 850 : //
; 851 :
; 852 : ASSERT(irpSp->Parameters.DeviceIoControl.Type3InputBuffer);
; 853 :
; 854 : ExFreePool(irpSp->Parameters.DeviceIoControl.Type3InputBuffer);
00054 ff 77 10 push DWORD PTR [edi+16]
00057 ff 15 00 00 00
00 call DWORD PTR __imp__ExFreePool@4
; 855 :
; 856 : irpSp->Parameters.DeviceIoControl.Type3InputBuffer = NULL;
0005d 83 67 10 00 and DWORD PTR [edi+16], 0
00061 eb 06 jmp SHORT $L14986
$L14984:
; 840 :
; 841 : extension->TotalCharsQueued--;
00063 ff 8b 28 01 00
00 dec DWORD PTR [ebx+296]
$L14986:
; 857 :
; 858 : }
; 859 :
; 860 : }
; 861 :
; 862 : IoReleaseCancelSpinLock(Irp->CancelIrql);
00069 8a 46 25 mov al, BYTE PTR [esi+37]
0006c 50 push eax
0006d ff 15 00 00 00
00 call DWORD PTR __imp__IoReleaseCancelSpinLock@4
; 863 :
; 864 : SerialDump(
; 865 : SERIRPPATH,
; 866 : ("SERIAL: Complete Irp: %x\n",Irp)
; 867 : );
; 868 : SerialCompleteRequest(extension, Irp, IO_SERIAL_INCREMENT);
00073 b2 02 mov dl, 2
00075 8b ce mov ecx, esi
00077 ff 15 00 00 00
00 call DWORD PTR __imp_@IofCompleteRequest@8
0007d 53 push ebx
0007e e8 00 00 00 00 call _SerialIRPEpilogue@4
00083 5f pop edi
00084 5e pop esi
00085 5b pop ebx
; 869 : }
00086 c2 08 00 ret 8
_SerialCancelQueued@8 ENDP
PAGESER ENDS
PUBLIC _SerialCompleteIfError@8
; Function compile flags: /Ogsy
; COMDAT _SerialCompleteIfError@8
PAGESER SEGMENT
_DeviceObject$ = 8
_Irp$ = 12
_SerialCompleteIfError@8 PROC NEAR ; COMDAT
; 898 :
; 899 : PSERIAL_DEVICE_EXTENSION extension = DeviceObject->DeviceExtension;
00000 8b 44 24 04 mov eax, DWORD PTR _DeviceObject$[esp-4]
00004 56 push esi
00005 57 push edi
; 900 :
; 901 : NTSTATUS status = STATUS_SUCCESS;
00006 33 ff xor edi, edi
00008 8b 70 28 mov esi, DWORD PTR [eax+40]
; 902 :
; 903 : SERIAL_LOCKED_PAGED_CODE();
; 904 :
; 905 : if ((extension->HandFlow.ControlHandShake &
; 906 : SERIAL_ERROR_ABORT) && extension->ErrorWord) {
0000b f6 86 77 01 00
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -