⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 utils.cod

📁 怎样在win2000下构造驱动程序znsoft_Serial2000_demo.ZIP
💻 COD
📖 第 1 页 / 共 5 页
字号:

  00185	ff 75 fc	 push	 DWORD PTR _oldIrql$[ebp]
  00188	8b 7e 60	 mov	 edi, DWORD PTR [esi+96]
  0018b	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) {

  00191	81 7f 0c 08 00
	1b 00		 cmp	 DWORD PTR [edi+12], 1769480 ; 001b0008H
  00198	75 2a		 jne	 SHORT $L15062

; 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);

  0019a	83 7f 10 00	 cmp	 DWORD PTR [edi+16], 0
  0019e	75 17		 jne	 SHORT $L15063
  001a0	6a 00		 push	 0
  001a2	68 e2 02 00 00	 push	 738			; 000002e2H
  001a7	68 00 00 00 00	 push	 OFFSET FLAT:$SG15065
  001ac	68 00 00 00 00	 push	 OFFSET FLAT:$SG15066
  001b1	ff 15 00 00 00
	00		 call	 DWORD PTR __imp__RtlAssert@16
$L15063:

; 739  : 
; 740  :                ExFreePool(irpSp->Parameters.DeviceIoControl.Type3InputBuffer);

  001b7	ff 77 10	 push	 DWORD PTR [edi+16]
  001ba	ff 15 00 00 00
	00		 call	 DWORD PTR __imp__ExFreePool@4

; 741  : 
; 742  :                irpSp->Parameters.DeviceIoControl.Type3InputBuffer = NULL;

  001c0	83 67 10 00	 and	 DWORD PTR [edi+16], 0
$L15062:

; 743  :             }
; 744  : 
; 745  :             Irp->IoStatus.Status = STATUS_CANCELLED;

  001c4	bf 20 01 00 c0	 mov	 edi, -1073741536	; c0000120H
  001c9	89 7e 18	 mov	 DWORD PTR [esi+24], edi

; 746  : 
; 747  :             SerialDump(
; 748  :                 SERIRPPATH,
; 749  :                 ("SERIAL: Complete Irp: %x\n",Irp)
; 750  :                 );

  001cc	f6 05 00 00 00
	00 20		 test	 BYTE PTR _SerialDebugLevel, 32 ; 00000020H
  001d3	74 0d		 je	 SHORT $L15070
  001d5	56		 push	 esi
  001d6	68 00 00 00 00	 push	 OFFSET FLAT:$SG15075
  001db	e8 00 00 00 00	 call	 _DbgPrint
  001e0	59		 pop	 ecx
  001e1	59		 pop	 ecx
$L15070:

; 751  :             SerialCompleteRequest(Extension, Irp, 0);

  001e2	32 d2		 xor	 dl, dl
  001e4	8b ce		 mov	 ecx, esi
  001e6	ff 15 00 00 00
	00		 call	 DWORD PTR __imp_@IofCompleteRequest@8
  001ec	53		 push	 ebx
  001ed	e8 00 00 00 00	 call	 _SerialIRPEpilogue@4

; 752  : 
; 753  :             return STATUS_CANCELLED;

  001f2	eb 36		 jmp	 SHORT $L15578
$L15060:

; 754  : 
; 755  :         } else {
; 756  : 
; 757  : 
; 758  :             Irp->IoStatus.Status = STATUS_PENDING;
; 759  :             IoMarkIrpPending(Irp);

  001f4	8b 46 60	 mov	 eax, DWORD PTR [esi+96]
  001f7	bf 03 01 00 00	 mov	 edi, 259		; 00000103H
  001fc	89 7e 18	 mov	 DWORD PTR [esi+24], edi
  001ff	80 48 03 01	 or	 BYTE PTR [eax+3], 1

; 760  : 
; 761  :             InsertTailList(
; 762  :                 QueueToExamine,
; 763  :                 &Irp->Tail.Overlay.ListEntry
; 764  :                 );

  00203	8b 51 04	 mov	 edx, DWORD PTR [ecx+4]
  00206	8d 46 58	 lea	 eax, DWORD PTR [esi+88]
  00209	89 56 5c	 mov	 DWORD PTR [esi+92], edx
  0020c	89 08		 mov	 DWORD PTR [eax], ecx
  0020e	89 02		 mov	 DWORD PTR [edx], eax
  00210	89 41 04	 mov	 DWORD PTR [ecx+4], eax

; 765  : 
; 766  :             IoSetCancelRoutine(
; 767  :                 Irp,
; 768  :                 SerialCancelQueued
; 769  :                 );

  00213	8d 4e 38	 lea	 ecx, DWORD PTR [esi+56]
  00216	ba 00 00 00 00	 mov	 edx, OFFSET FLAT:_SerialCancelQueued@8
  0021b	ff 15 00 00 00
	00		 call	 DWORD PTR __imp_@InterlockedExchange@8

; 770  : 
; 771  :             IoReleaseCancelSpinLock(oldIrql);

  00221	ff 75 fc	 push	 DWORD PTR _oldIrql$[ebp]
  00224	ff 15 00 00 00
	00		 call	 DWORD PTR __imp__IoReleaseCancelSpinLock@4
$L15578:

; 772  : 
; 773  :             return STATUS_PENDING;

  0022a	8b c7		 mov	 eax, edi
$L15083:
  0022c	5f		 pop	 edi
  0022d	5e		 pop	 esi
  0022e	5b		 pop	 ebx

; 774  : 
; 775  :         }
; 776  : 
; 777  :     }
; 778  : 
; 779  : }

  0022f	c9		 leave
  00230	c2 14 00	 ret	 20			; 00000014H
_SerialStartOrQueue@20 ENDP
PAGESER	ENDS
;	COMDAT _SerialCancelQueued@8
PAGESER	SEGMENT
$SG15102 DB	'SERIAL: Pageable code called at IRQL %d without lock ', 0aH
	DB	00H
	ORG $+1
$SG15105 DB	'f:\w2ddk\src\kernel\serial\utils.c', 00H
	ORG $+1
$SG15106 DB	'FALSE', 00H
	ORG $+2
$SG15119 DB	'f:\w2ddk\src\kernel\serial\utils.c', 00H
	ORG $+1
$SG15120 DB	'irpSp->Parameters.DeviceIoControl.Type3InputBuffer', 00H
	ORG $+1
$SG15128 DB	'SERIAL: Complete Irp: %x', 0aH, 00H
; Function compile flags: /Ogs
_DeviceObject$ = 8
_Irp$ = 12
_extension$ = 8
_SerialCancelQueued@8 PROC NEAR				; COMDAT

; 806  : {

  000d6	55		 push	 ebp
  000d7	8b ec		 mov	 ebp, esp

; 807  : 
; 808  :     PSERIAL_DEVICE_EXTENSION extension = DeviceObject->DeviceExtension;

  000d9	8b 45 08	 mov	 eax, DWORD PTR _DeviceObject$[ebp]
  000dc	56		 push	 esi

; 809  :     PIO_STACK_LOCATION irpSp = IoGetCurrentIrpStackLocation(Irp);

  000dd	8b 75 0c	 mov	 esi, DWORD PTR _Irp$[ebp]
  000e0	57		 push	 edi
  000e1	8b 40 28	 mov	 eax, DWORD PTR [eax+40]
  000e4	8b 7e 60	 mov	 edi, DWORD PTR [esi+96]
  000e7	89 45 08	 mov	 DWORD PTR _extension$[ebp], eax

; 810  : 
; 811  :     SERIAL_LOCKED_PAGED_CODE();

  000ea	ff 15 00 00 00
	00		 call	 DWORD PTR __imp__KeGetCurrentIrql@0
  000f0	3c 01		 cmp	 al, 1
  000f2	76 36		 jbe	 SHORT $L15103
  000f4	83 3d 14 00 00
	00 00		 cmp	 DWORD PTR _SerialGlobals+20, 0
  000fb	75 2d		 jne	 SHORT $L15103
  000fd	ff 15 00 00 00
	00		 call	 DWORD PTR __imp__KeGetCurrentIrql@0
  00103	0f b6 c0	 movzx	 eax, al
  00106	50		 push	 eax
  00107	68 00 00 00 00	 push	 OFFSET FLAT:$SG15102
  0010c	e8 00 00 00 00	 call	 _DbgPrint
  00111	59		 pop	 ecx
  00112	59		 pop	 ecx
  00113	6a 00		 push	 0
  00115	68 2b 03 00 00	 push	 811			; 0000032bH
  0011a	68 00 00 00 00	 push	 OFFSET FLAT:$SG15105
  0011f	68 00 00 00 00	 push	 OFFSET FLAT:$SG15106
  00124	ff 15 00 00 00
	00		 call	 DWORD PTR __imp__RtlAssert@16
$L15103:

; 812  : 
; 813  :     Irp->IoStatus.Status = STATUS_CANCELLED;
; 814  :     Irp->IoStatus.Information = 0;
; 815  : 
; 816  :     RemoveEntryList(&Irp->Tail.Overlay.ListEntry);

  0012a	8b 4e 5c	 mov	 ecx, DWORD PTR [esi+92]
  0012d	8b 46 58	 mov	 eax, DWORD PTR [esi+88]
  00130	83 66 1c 00	 and	 DWORD PTR [esi+28], 0
  00134	c7 46 18 20 01
	00 c0		 mov	 DWORD PTR [esi+24], -1073741536 ; c0000120H
  0013b	89 01		 mov	 DWORD PTR [ecx], eax
  0013d	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) {

  00140	8a 07		 mov	 al, BYTE PTR [edi]
  00142	3c 04		 cmp	 al, 4
  00144	75 0e		 jne	 SHORT $L15110

; 824  : 
; 825  :         extension->TotalCharsQueued -= irpSp->Parameters.Write.Length;

  00146	8b 47 04	 mov	 eax, DWORD PTR [edi+4]
  00149	8b 7d 08	 mov	 edi, DWORD PTR _extension$[ebp]
  0014c	29 87 28 01 00
	00		 sub	 DWORD PTR [edi+296], eax

; 826  : 
; 827  :     } else if (irpSp->MajorFunction == IRP_MJ_DEVICE_CONTROL) {

  00152	eb 49		 jmp	 SHORT $L15116
$L15110:
  00154	3c 0e		 cmp	 al, 14			; 0000000eH
  00156	75 42		 jne	 SHORT $L15583

; 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)) {

  00158	8b 47 0c	 mov	 eax, DWORD PTR [edi+12]
  0015b	3d 18 00 1b 00	 cmp	 eax, 1769496		; 001b0018H
  00160	74 71		 je	 SHORT $L15114
  00162	3d 70 00 1b 00	 cmp	 eax, 1769584		; 001b0070H
  00167	74 6a		 je	 SHORT $L15114

; 842  : 
; 843  :         } else if (irpSp->Parameters.DeviceIoControl.IoControlCode ==
; 844  :                    IOCTL_SERIAL_SET_QUEUE_SIZE) {

  00169	3d 08 00 1b 00	 cmp	 eax, 1769480		; 001b0008H
  0016e	75 2a		 jne	 SHORT $L15583

; 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);

  00170	83 7f 10 00	 cmp	 DWORD PTR [edi+16], 0
  00174	75 17		 jne	 SHORT $L15117
  00176	6a 00		 push	 0
  00178	68 54 03 00 00	 push	 852			; 00000354H
  0017d	68 00 00 00 00	 push	 OFFSET FLAT:$SG15119
  00182	68 00 00 00 00	 push	 OFFSET FLAT:$SG15120
  00187	ff 15 00 00 00
	00		 call	 DWORD PTR __imp__RtlAssert@16
$L15117:

; 853  : 
; 854  :             ExFreePool(irpSp->Parameters.DeviceIoControl.Type3InputBuffer);

  0018d	ff 77 10	 push	 DWORD PTR [edi+16]
  00190	ff 15 00 00 00
	00		 call	 DWORD PTR __imp__ExFreePool@4

; 855  : 
; 856  :             irpSp->Parameters.DeviceIoControl.Type3InputBuffer = NULL;

  00196	83 67 10 00	 and	 DWORD PTR [edi+16], 0
$L15583:

; 840  : 
; 841  :             extension->TotalCharsQueued--;

  0019a	8b 7d 08	 mov	 edi, DWORD PTR _extension$[ebp]
$L15116:

; 857  : 
; 858  :         }
; 859  : 
; 860  :     }
; 861  : 
; 862  :     IoReleaseCancelSpinLock(Irp->CancelIrql);

  0019d	8a 46 25	 mov	 al, BYTE PTR [esi+37]
  001a0	50		 push	 eax
  001a1	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  :         );

  001a7	f6 05 00 00 00
	00 20		 test	 BYTE PTR _SerialDebugLevel, 32 ; 00000020H
  001ae	74 0d		 je	 SHORT $L15123
  001b0	56		 push	 esi
  001b1	68 00 00 00 00	 push	 OFFSET FLAT:$SG15128
  001b6	e8 00 00 00 00	 call	 _DbgPrint
  001bb	59		 pop	 ecx
  001bc	59		 pop	 ecx
$L15123:

; 868  :     SerialCompleteRequest(extension, Irp, IO_SERIAL_INCREMENT);

  001bd	b2 02		 mov	 dl, 2
  001bf	8b ce		 mov	 ecx, esi
  001c1	ff 15 00 00 00
	00		 call	 DWORD PTR __imp_@IofCompleteRequest@8
  001c7	57		 push	 edi
  001c8	e8 00 00 00 00	 call	 _SerialIRPEpilogue@4
  001cd	5f		 pop	 edi
  001ce	5e		 pop	 esi

; 869  : }

  001cf	5d		 pop	 ebp
  001d0	c2 08 00	 ret	 8
$L15114:

; 840  : 
; 841  :             extension->TotalCharsQueued--;

  001d3	8b 7d 08	 mov	 edi, DWORD PTR _extension$[ebp]
  001d6	ff 8f 28 01 00
	00		 dec	 DWORD PTR [edi+296]
  001dc	eb bf		 jmp	 SHORT $L15116
_SerialCancelQueued@8 ENDP
PAGESER	ENDS
PUBLIC	_SerialCompleteIfError@8
;	COMDAT _SerialCompleteIfError@8
PAGESER	SEGMENT
$SG15144 DB	'SERIAL: Pageable code called at IRQL %d without lock ', 0aH
	DB	00H
	ORG $+1
$SG15147 DB	'f:\w2ddk\src\kernel\serial\utils.c', 00H
	ORG $+1
$SG15148 DB	'FALSE', 00H
	ORG $+2
$SG15162 DB	'SERIAL: Complete Irp: %x', 0aH, 00H
; Function compile flags: /Ogs
_DeviceObject$ = 8
_Irp$ = 12
_status$ = 8
_SerialCompleteIfError@8 PROC NEAR			; COMDAT

; 897  : {

  0007e	55		 push	 ebp
  0007f	8b ec		 mov	 ebp, esp

; 898  : 
; 899  :     PSERIAL_DEVICE_EXTENSION extension = DeviceObject->DeviceExtension;

  00081	8b 45 08	 mov	 eax, DWORD PTR _DeviceObject$[ebp]

; 900  : 
; 901  :     NTSTATUS status = STATUS_SUCCESS;

  00084	83 65 08 00	 and	 DWORD PTR _status$[ebp], 0
  00088	56		 push	 esi

; 902  : 
; 903  :     SERIAL_LOCKED_PAGED_CODE();

  00089	8b 35 00 00 00
	00		 mov	 esi, DWORD PTR __imp__KeGetCurrentIrql@0
  0008f	57		 push	 edi
  00090	8b 78 28	 mov	 edi, DWORD PTR [eax+40]
  00093	ff d6		 call	 esi
  00095	3c 01		 cmp	 al, 1
  00097	76 32		 jbe	 SHORT $L15145
  00099	83 3d 14 00 00
	00 00		 cmp	 DWORD PTR _SerialGlobals+20, 0
  000a0	75 29		 jne	 SHORT $L15145
  000a2	ff d6		 call	 esi
  000a4	0f b6 c0	 movzx	 eax, al
  000a7	50		 push	 eax
  000a8	68 00 00 00 00	 push	 OFFSET FLAT:$SG15144
  000ad	e8 00 00 00 00	 call	 _DbgPrint
  000b2	59		 pop	 ecx
  000b3	59		 pop	 ecx
  000b4	6a 00		 push	 0
  000b6	68 87 03 00 00	 push	 903			; 00000387H
  000bb	68 00 00 00 00	 push	 OFFSET FLAT:$SG15147
  000c0	68 00 00 00 00	 push	 OFFSET FLAT:$SG15148
  000c5	ff 15 00 00 00
	00		 call	 DWORD PTR __imp__RtlAssert@16
$L15145:

; 904  : 
; 905  :     if ((extension->HandFlow.ControlHandShake &
; 906  :          SERIAL_ERROR_ABORT) && extension->ErrorWord) {

  000cb	f6 87 77 01 00
	00 80		 test	 BYTE PTR [edi+375], -128 ; ffffff80H
  000d2	74 52		 je	 SHORT $L15152
  000d4	83 bf 24 01 00
	00 00		 cmp	 DWORD PTR [edi+292], 0
  000db	74 49		 je	 SHORT $L15152

; 907  : 
; 908  :         PIO_STACK_LOCATION irpSp = IoGetCurrentIrpStackLocation(Irp);

  000dd	8b 75 0c	 mov	 esi, DWORD PTR _Irp$[ebp]
  000e0	8b 46 60	 mov	 eax, DWORD PTR [esi+96]

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -