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

📄 read.cod

📁 怎样在win2000下构造驱动程序znsoft_Serial2000_demo.ZIP
💻 COD
📖 第 1 页 / 共 5 页
字号:
; 578  :                         // count that the total timer has on the current
; 579  :                         // irp.  Note that this is safe, because even if
; 580  :                         // the io has been satisfied by the isr it can't
; 581  :                         // complete yet because we still own the cancel
; 582  :                         // spinlock.
; 583  :                         //
; 584  : 
; 585  :                         if (useTotalTimer) {

  004bd	80 7d 0b 00	 cmp	 BYTE PTR _useTotalTimer$[ebp], 0
  004c1	74 47		 je	 SHORT $L15039

; 586  : 
; 587  :                             SERIAL_SET_REFERENCE(
; 588  :                                 Extension->CurrentReadIrp,
; 589  :                                 SERIAL_REF_TOTAL_TIMER
; 590  :                                 );

  004c3	8b 06		 mov	 eax, DWORD PTR [esi]
  004c5	8b 78 60	 mov	 edi, DWORD PTR [eax+96]
  004c8	83 c7 10	 add	 edi, 16			; 00000010H
  004cb	f6 07 04	 test	 BYTE PTR [edi], 4
  004ce	74 17		 je	 SHORT $L15046
  004d0	6a 00		 push	 0
  004d2	68 4e 02 00 00	 push	 590			; 0000024eH
  004d7	68 00 00 00 00	 push	 OFFSET FLAT:$SG15048
  004dc	68 00 00 00 00	 push	 OFFSET FLAT:$SG15049
  004e1	ff 15 00 00 00
	00		 call	 DWORD PTR __imp__RtlAssert@16
$L15046:

; 591  : 
; 592  :                             SerialSetTimer(
; 593  :                                 &Extension->ReadRequestTotalTimer,
; 594  :                                 totalTime,
; 595  :                                 &Extension->TotalReadTimeoutDpc,
; 596  :                                 Extension
; 597  :                                 );

  004e7	8d 83 2c 02 00
	00		 lea	 eax, DWORD PTR [ebx+556]
  004ed	53		 push	 ebx
  004ee	50		 push	 eax
  004ef	83 0f 04	 or	 DWORD PTR [edi], 4
  004f2	ff 75 e8	 push	 DWORD PTR _totalTime$[ebp+4]
  004f5	8d 83 b0 03 00
	00		 lea	 eax, DWORD PTR [ebx+944]
  004fb	ff 75 e4	 push	 DWORD PTR _totalTime$[ebp]
  004fe	50		 push	 eax
  004ff	e8 00 00 00 00	 call	 _SerialSetTimer@20
  00504	8b 3d 00 00 00
	00		 mov	 edi, DWORD PTR __imp_@KfReleaseSpinLock@8
$L15039:

; 598  : 
; 599  :                         }
; 600  : 
; 601  :                         if (useIntervalTimer) {

  0050a	80 7d fa 00	 cmp	 BYTE PTR _useIntervalTimer$[ebp], 0
  0050e	74 56		 je	 SHORT $L15050

; 602  : 
; 603  :                             SERIAL_SET_REFERENCE(
; 604  :                                 Extension->CurrentReadIrp,
; 605  :                                 SERIAL_REF_INT_TIMER
; 606  :                                 );

  00510	8b 06		 mov	 eax, DWORD PTR [esi]
  00512	8b 78 60	 mov	 edi, DWORD PTR [eax+96]
  00515	83 c7 10	 add	 edi, 16			; 00000010H
  00518	f6 07 08	 test	 BYTE PTR [edi], 8
  0051b	74 17		 je	 SHORT $L15057
  0051d	6a 00		 push	 0
  0051f	68 5e 02 00 00	 push	 606			; 0000025eH
  00524	68 00 00 00 00	 push	 OFFSET FLAT:$SG15059
  00529	68 00 00 00 00	 push	 OFFSET FLAT:$SG15060
  0052e	ff 15 00 00 00
	00		 call	 DWORD PTR __imp__RtlAssert@16
$L15057:
  00534	83 0f 08	 or	 DWORD PTR [edi], 8

; 607  : 
; 608  :                             KeQuerySystemTime(
; 609  :                                 &Extension->LastReadTime
; 610  :                                 );

  00537	8d 43 58	 lea	 eax, DWORD PTR [ebx+88]
  0053a	50		 push	 eax
  0053b	ff 15 00 00 00
	00		 call	 DWORD PTR __imp__KeQuerySystemTime@4

; 611  :                             SerialSetTimer(
; 612  :                                 &Extension->ReadRequestIntervalTimer,
; 613  :                                 *Extension->IntervalTimeToUse,
; 614  :                                 &Extension->IntervalReadTimeoutDpc,
; 615  :                                 Extension
; 616  :                                 );

  00541	8d 83 4c 02 00
	00		 lea	 eax, DWORD PTR [ebx+588]
  00547	53		 push	 ebx
  00548	50		 push	 eax
  00549	8b 83 88 00 00
	00		 mov	 eax, DWORD PTR [ebx+136]
  0054f	ff 70 04	 push	 DWORD PTR [eax+4]
  00552	ff 30		 push	 DWORD PTR [eax]
  00554	8d 83 d8 03 00
	00		 lea	 eax, DWORD PTR [ebx+984]
  0055a	50		 push	 eax
  0055b	e8 00 00 00 00	 call	 _SerialSetTimer@20
  00560	8b 3d 00 00 00
	00		 mov	 edi, DWORD PTR __imp_@KfReleaseSpinLock@8
$L15050:

; 617  : 
; 618  :                         }
; 619  : 
; 620  :                         IoMarkIrpPending(Extension->CurrentReadIrp);

  00566	8b 06		 mov	 eax, DWORD PTR [esi]
  00568	8b 40 60	 mov	 eax, DWORD PTR [eax+96]
  0056b	80 48 03 01	 or	 BYTE PTR [eax+3], 1

; 621  :                         IoReleaseCancelSpinLock(oldIrql);

  0056f	ff 75 f0	 push	 DWORD PTR _oldIrql$[ebp]
  00572	ff 15 00 00 00
	00		 call	 DWORD PTR __imp__IoReleaseCancelSpinLock@4

; 622  :                         KeReleaseSpinLock(
; 623  :                             &Extension->ControlLock,
; 624  :                             controlIrql
; 625  :                             );

  00578	8a 55 fe	 mov	 dl, BYTE PTR _controlIrql$[ebp]
  0057b	8d 8b e4 01 00
	00		 lea	 ecx, DWORD PTR [ebx+484]
  00581	ff d7		 call	 edi

; 626  :                         if (!setFirstStatus) {

  00583	80 7d ff 00	 cmp	 BYTE PTR _setFirstStatus$[ebp], 0
  00587	75 07		 jne	 SHORT $L15403

; 627  : 
; 628  :                             firstStatus = STATUS_PENDING;

  00589	c7 45 f4 03 01
	00 00		 mov	 DWORD PTR _firstStatus$[ebp], 259 ; 00000103H
$L15403:

; 671  : 
; 672  :     return firstStatus;

  00590	8b 45 f4	 mov	 eax, DWORD PTR _firstStatus$[ebp]
  00593	5f		 pop	 edi
  00594	5e		 pop	 esi
  00595	5b		 pop	 ebx

; 673  : 
; 674  : }

  00596	c9		 leave
  00597	c2 04 00	 ret	 4
_SerialStartRead@4 ENDP
PAGESER	ENDS
PUBLIC	_SerialCompleteRead@16
EXTRN	_SerialDpcEpilogue@8:NEAR
EXTRN	_SerialTryToCompleteCurrent@44:NEAR
;	COMDAT _SerialCompleteRead@16
_TEXT	SEGMENT
$SG15084 DB	'SERIAL: SerialCompleteRead', 0aH, 00H
; Function compile flags: /Ogs
_Dpc$ = 8
_DeferredContext$ = 12
_oldIrql$ = -4
_SerialCompleteRead@16 PROC NEAR			; COMDAT

; 709  : {

  0001c	55		 push	 ebp
  0001d	8b ec		 mov	 ebp, esp
  0001f	51		 push	 ecx

; 710  : 
; 711  :     PSERIAL_DEVICE_EXTENSION extension = DeferredContext;
; 712  :     KIRQL oldIrql;
; 713  : 
; 714  :     UNREFERENCED_PARAMETER(SystemContext1);
; 715  :     UNREFERENCED_PARAMETER(SystemContext2);
; 716  : 
; 717  : 
; 718  :     SerialDump(SERTRACECALLS, ("SERIAL: SerialCompleteRead\n"));

  00020	f6 05 00 00 00
	00 40		 test	 BYTE PTR _SerialDebugLevel, 64 ; 00000040H
  00027	74 0b		 je	 SHORT $L15079
  00029	68 00 00 00 00	 push	 OFFSET FLAT:$SG15084
  0002e	e8 00 00 00 00	 call	 _DbgPrint
  00033	59		 pop	 ecx
$L15079:

; 719  : 
; 720  : 
; 721  :     IoAcquireCancelSpinLock(&oldIrql);

  00034	8d 45 fc	 lea	 eax, DWORD PTR _oldIrql$[ebp]
  00037	56		 push	 esi
  00038	50		 push	 eax
  00039	ff 15 00 00 00
	00		 call	 DWORD PTR __imp__IoAcquireCancelSpinLock@4

; 722  : 
; 723  :     //
; 724  :     // We set this to indicate to the interval timer
; 725  :     // that the read has completed.
; 726  :     //
; 727  :     // Recall that the interval timer dpc can be lurking in some
; 728  :     // DPC queue.
; 729  :     //
; 730  : 
; 731  :     extension->CountOnLastRead = SERIAL_COMPLETE_READ_COMPLETE;

  0003f	8b 75 0c	 mov	 esi, DWORD PTR _DeferredContext$[ebp]

; 732  : 
; 733  :     SerialTryToCompleteCurrent(
; 734  :         extension,
; 735  :         NULL,
; 736  :         oldIrql,
; 737  :         STATUS_SUCCESS,
; 738  :         &extension->CurrentReadIrp,
; 739  :         &extension->ReadQueue,
; 740  :         &extension->ReadRequestIntervalTimer,
; 741  :         &extension->ReadRequestTotalTimer,
; 742  :         SerialStartRead,
; 743  :         SerialGetNextIrp,
; 744  :         SERIAL_REF_ISR
; 745  :         );

  00042	6a 01		 push	 1
  00044	68 00 00 00 00	 push	 OFFSET FLAT:_SerialGetNextIrp@20
  00049	68 00 00 00 00	 push	 OFFSET FLAT:_SerialStartRead@4
  0004e	8d 86 b0 03 00
	00		 lea	 eax, DWORD PTR [esi+944]
  00054	c7 86 2c 01 00
	00 fd ff ff ff	 mov	 DWORD PTR [esi+300], -3	; fffffffdH
  0005e	50		 push	 eax
  0005f	8d 86 d8 03 00
	00		 lea	 eax, DWORD PTR [esi+984]
  00065	50		 push	 eax
  00066	8d 86 a4 00 00
	00		 lea	 eax, DWORD PTR [esi+164]
  0006c	50		 push	 eax
  0006d	8d 86 c4 00 00
	00		 lea	 eax, DWORD PTR [esi+196]
  00073	50		 push	 eax
  00074	6a 00		 push	 0
  00076	ff 75 fc	 push	 DWORD PTR _oldIrql$[ebp]
  00079	6a 00		 push	 0
  0007b	56		 push	 esi
  0007c	e8 00 00 00 00	 call	 _SerialTryToCompleteCurrent@44

; 746  : 
; 747  :     SerialDpcEpilogue(extension, Dpc);

  00081	ff 75 08	 push	 DWORD PTR _Dpc$[ebp]
  00084	56		 push	 esi
  00085	e8 00 00 00 00	 call	 _SerialDpcEpilogue@8
  0008a	5e		 pop	 esi

; 748  : }

  0008b	c9		 leave
  0008c	c2 10 00	 ret	 16			; 00000010H
_SerialCompleteRead@16 ENDP
_TEXT	ENDS
PUBLIC	_SerialCancelCurrentRead@8
PUBLIC	_SerialGrabReadFromIsr@4
;	COMDAT _SerialCancelCurrentRead@8
PAGESER	SEGMENT
$SG15101 DB	'SERIAL: Pageable code called at IRQL %d without lock ', 0aH
	DB	00H
	ORG $+1
$SG15104 DB	'f:\w2ddk\src\kernel\serial\read.c', 00H
	ORG $+2
$SG15105 DB	'FALSE', 00H
; Function compile flags: /Ogs
_DeviceObject$ = 8
_Irp$ = 12
_SerialCancelCurrentRead@8 PROC NEAR			; COMDAT

; 774  : {

  00062	55		 push	 ebp
  00063	8b ec		 mov	 ebp, esp

; 775  : 
; 776  :     PSERIAL_DEVICE_EXTENSION extension = DeviceObject->DeviceExtension;

  00065	8b 45 08	 mov	 eax, DWORD PTR _DeviceObject$[ebp]
  00068	56		 push	 esi
  00069	57		 push	 edi

; 777  :     SERIAL_LOCKED_PAGED_CODE();

  0006a	8b 3d 00 00 00
	00		 mov	 edi, DWORD PTR __imp__KeGetCurrentIrql@0
  00070	8b 70 28	 mov	 esi, DWORD PTR [eax+40]
  00073	ff d7		 call	 edi
  00075	3c 01		 cmp	 al, 1
  00077	76 32		 jbe	 SHORT $L15102
  00079	83 3d 14 00 00
	00 00		 cmp	 DWORD PTR _SerialGlobals+20, 0
  00080	75 29		 jne	 SHORT $L15102
  00082	ff d7		 call	 edi
  00084	0f b6 c0	 movzx	 eax, al
  00087	50		 push	 eax
  00088	68 00 00 00 00	 push	 OFFSET FLAT:$SG15101
  0008d	e8 00 00 00 00	 call	 _DbgPrint
  00092	59		 pop	 ecx
  00093	59		 pop	 ecx
  00094	6a 00		 push	 0
  00096	68 09 03 00 00	 push	 777			; 00000309H
  0009b	68 00 00 00 00	 push	 OFFSET FLAT:$SG15104
  000a0	68 00 00 00 00	 push	 OFFSET FLAT:$SG15105
  000a5	ff 15 00 00 00
	00		 call	 DWORD PTR __imp__RtlAssert@16
$L15102:

; 778  : 
; 779  :     //
; 780  :     // We set this to indicate to the interval timer
; 781  :     // that the read has encountered a cancel.
; 782  :     //
; 783  :     // Recall that the interval timer dpc can be lurking in some
; 784  :     // DPC queue.
; 785  :     //
; 786  : 
; 787  :     extension->CountOnLastRead = SERIAL_COMPLETE_READ_CANCEL;
; 788  : 
; 789  :     SerialTryToCompleteCurrent(
; 790  :         extension,
; 791  :         SerialGrabReadFromIsr,
; 792  :         Irp->CancelIrql,
; 793  :         STATUS_CANCELLED,
; 794  :         &extension->CurrentReadIrp,
; 795  :         &extension->ReadQueue,
; 796  :         &extension->ReadRequestIntervalTimer,
; 797  :         &extension->ReadRequestTotalTimer,
; 798  :         SerialStartRead,
; 799  :         SerialGetNextIrp,
; 800  :         SERIAL_REF_CANCEL
; 801  :         );

  000ab	6a 02		 push	 2
  000ad	68 00 00 00 00	 push	 OFFSET FLAT:_SerialGetNextIrp@20
  000b2	8d 86 b0 03 00
	00		 lea	 eax, DWORD PTR [esi+944]
  000b8	68 00 00 00 00	 push	 OFFSET FLAT:_SerialStartRead@4
  000bd	50		 push	 eax
  000be	8d 86 d8 03 00
	00		 lea	 eax, DWORD PTR [esi+984]
  000c4	50		 push	 eax
  000c5	83 8e 2c 01 00
	00 ff		 or	 DWORD PTR [esi+300], -1
  000cc	8d 86 a4 00 00
	00		 lea	 eax, DWORD PTR [esi+164]
  000d2	50		 push	 eax
  000d3	8d 86 c4 00 00
	00		 lea	 eax, DWORD PTR [esi+196]
  000d9	50		 push	 eax
  000da	8b 45 0c	 mov	 eax, DWORD PTR _Irp$[ebp]
  000dd	68 20 01 00 c0	 push	 -1073741536		; c0000120H
  000e2	8a 40 25	 mov	 al, BYTE PTR [eax+37]
  000e5	50		 push	 eax
  000e6	68 00 00 00 00	 push	 OFFSET FLAT:_SerialGrabReadFromIsr@4
  000eb	56		 push	 esi
  000ec	e8 00 00 00 00	 call	 _SerialTryToCompleteCurrent@44
  000f1	5f		 pop	 edi
  000f2	5e		 pop	 esi

; 802  : 
; 803  : }

  000f3	5d		 pop	 ebp
  000f4	c2 08 00	 ret	 8
_SerialCancelCurrentRead@8 ENDP
PAGESER	ENDS
;	COMDAT _SerialGrabReadFromIsr@4
PAGESER	SEGMENT
$SG15113 DB	'SERIAL: Pageable code called at IRQL %d without lock ', 0aH
	DB	00H
	ORG $+1
$SG15116 DB	'f:\w2ddk\src\kernel\serial\read.c', 00H
	ORG $+2
$SG15117 DB	'FALSE', 00H
	ORG $+2
$SG15127 DB	'f:\w2ddk\src\kernel\serial\read.c', 00H
	ORG $+2
$SG15128 DB	'*_arg4 & _refType', 00H
; Function compile flags: /Ogs
_Context$ = 8
_SerialGrabReadFromIsr@4 PROC NEAR			; COMDAT

; 840  : {

  0009a	55		 push	 ebp
  0009b	8b ec		 mov	 ebp, esp
  0009d	56		 push	 esi

; 841  : 
; 842  :     PSERIAL_DEVICE_EXTENSION extension = Context;

⌨️ 快捷键说明

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