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

📄 read.cod

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

  0009e	8b 35 00 00 00
	00		 mov	 esi, DWORD PTR __imp__KeGetCurrentIrql@0
  000a4	ff d6		 call	 esi
  000a6	3c 01		 cmp	 al, 1
  000a8	76 32		 jbe	 SHORT $L15114
  000aa	83 3d 14 00 00
	00 00		 cmp	 DWORD PTR _SerialGlobals+20, 0
  000b1	75 29		 jne	 SHORT $L15114
  000b3	ff d6		 call	 esi
  000b5	0f b6 c0	 movzx	 eax, al
  000b8	50		 push	 eax
  000b9	68 00 00 00 00	 push	 OFFSET FLAT:$SG15113
  000be	e8 00 00 00 00	 call	 _DbgPrint
  000c3	59		 pop	 ecx
  000c4	59		 pop	 ecx
  000c5	6a 00		 push	 0
  000c7	68 4b 03 00 00	 push	 843			; 0000034bH
  000cc	68 00 00 00 00	 push	 OFFSET FLAT:$SG15116
  000d1	68 00 00 00 00	 push	 OFFSET FLAT:$SG15117
  000d6	ff 15 00 00 00
	00		 call	 DWORD PTR __imp__RtlAssert@16
$L15114:

; 844  : 
; 845  :     if (extension->ReadBufferBase !=
; 846  :         extension->InterruptReadBuffer) {

  000dc	8b 45 08	 mov	 eax, DWORD PTR _Context$[ebp]
  000df	8b 88 ec 00 00
	00		 mov	 ecx, DWORD PTR [eax+236]
  000e5	3b 88 e8 00 00
	00		 cmp	 ecx, DWORD PTR [eax+232]
  000eb	74 79		 je	 SHORT $L15121

; 847  : 
; 848  :         //
; 849  :         // We need to set the information to the number of characters
; 850  :         // that the read wanted minus the number of characters that
; 851  :         // didn't get read into the interrupt buffer.
; 852  :         //
; 853  : 
; 854  :         extension->CurrentReadIrp->IoStatus.Information =
; 855  :             IoGetCurrentIrpStackLocation(
; 856  :                 extension->CurrentReadIrp
; 857  :                 )->Parameters.Read.Length -
; 858  :             ((extension->LastCharSlot - extension->CurrentCharSlot) + 1);

  000ed	8b 88 c4 00 00
	00		 mov	 ecx, DWORD PTR [eax+196]
  000f3	8d 90 f4 00 00
	00		 lea	 edx, DWORD PTR [eax+244]
  000f9	53		 push	 ebx
  000fa	8b 71 60	 mov	 esi, DWORD PTR [ecx+96]
  000fd	8b 1a		 mov	 ebx, DWORD PTR [edx]
  000ff	8b 76 04	 mov	 esi, DWORD PTR [esi+4]
  00102	2b b0 f8 00 00
	00		 sub	 esi, DWORD PTR [eax+248]
  00108	8d 74 1e ff	 lea	 esi, DWORD PTR [esi+ebx-1]
  0010c	5b		 pop	 ebx
  0010d	89 71 1c	 mov	 DWORD PTR [ecx+28], esi

; 859  : 
; 860  :         //
; 861  :         // Switch back to the interrupt buffer.
; 862  :         //
; 863  : 
; 864  :         extension->ReadBufferBase = extension->InterruptReadBuffer;

  00110	8b 88 e8 00 00
	00		 mov	 ecx, DWORD PTR [eax+232]

; 865  :         extension->CurrentCharSlot = extension->InterruptReadBuffer;
; 866  :         extension->FirstReadableChar = extension->InterruptReadBuffer;
; 867  :         extension->LastCharSlot = extension->InterruptReadBuffer +
; 868  :                                       (extension->BufferSize - 1);
; 869  :         extension->CharsInInterruptBuffer = 0;

  00116	83 a0 f0 00 00
	00 00		 and	 DWORD PTR [eax+240], 0
  0011d	89 0a		 mov	 DWORD PTR [edx], ecx
  0011f	8b 90 04 01 00
	00		 mov	 edx, DWORD PTR [eax+260]
  00125	89 88 ec 00 00
	00		 mov	 DWORD PTR [eax+236], ecx
  0012b	89 88 fc 00 00
	00		 mov	 DWORD PTR [eax+252], ecx
  00131	8d 4c 0a ff	 lea	 ecx, DWORD PTR [edx+ecx-1]
  00135	89 88 f8 00 00
	00		 mov	 DWORD PTR [eax+248], ecx

; 870  : 
; 871  :         SERIAL_CLEAR_REFERENCE(
; 872  :             extension->CurrentReadIrp,
; 873  :             SERIAL_REF_ISR
; 874  :             );

  0013b	8b 80 c4 00 00
	00		 mov	 eax, DWORD PTR [eax+196]
  00141	8b 70 60	 mov	 esi, DWORD PTR [eax+96]
  00144	83 c6 10	 add	 esi, 16			; 00000010H
  00147	f6 06 01	 test	 BYTE PTR [esi], 1
  0014a	75 17		 jne	 SHORT $L15125
  0014c	6a 00		 push	 0
  0014e	68 6a 03 00 00	 push	 874			; 0000036aH
  00153	68 00 00 00 00	 push	 OFFSET FLAT:$SG15127
  00158	68 00 00 00 00	 push	 OFFSET FLAT:$SG15128
  0015d	ff 15 00 00 00
	00		 call	 DWORD PTR __imp__RtlAssert@16
$L15125:
  00163	83 26 fe	 and	 DWORD PTR [esi], -2	; fffffffeH
$L15121:

; 875  : 
; 876  :     }
; 877  : 
; 878  :     return FALSE;

  00166	32 c0		 xor	 al, al
  00168	5e		 pop	 esi

; 879  : 
; 880  : }

  00169	5d		 pop	 ebp
  0016a	c2 04 00	 ret	 4
_SerialGrabReadFromIsr@4 ENDP
PAGESER	ENDS
PUBLIC	_SerialReadTimeout@16
;	COMDAT _SerialReadTimeout@16
_TEXT	SEGMENT
$SG15146 DB	'SERIAL: SerialReadTimeout', 0aH, 00H
; Function compile flags: /Ogs
_Dpc$ = 8
_DeferredContext$ = 12
_oldIrql$ = -4
_SerialReadTimeout@16 PROC NEAR				; COMDAT

; 913  : {

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

; 914  : 
; 915  :     PSERIAL_DEVICE_EXTENSION extension = DeferredContext;
; 916  :     KIRQL oldIrql;
; 917  : 
; 918  :     UNREFERENCED_PARAMETER(SystemContext1);
; 919  :     UNREFERENCED_PARAMETER(SystemContext2);
; 920  : 
; 921  : 
; 922  :     SerialDump(SERTRACECALLS, ("SERIAL: SerialReadTimeout\n"));

  0001f	f6 05 00 00 00
	00 40		 test	 BYTE PTR _SerialDebugLevel, 64 ; 00000040H
  00026	74 0b		 je	 SHORT $L15141
  00028	68 00 00 00 00	 push	 OFFSET FLAT:$SG15146
  0002d	e8 00 00 00 00	 call	 _DbgPrint
  00032	59		 pop	 ecx
$L15141:

; 923  : 
; 924  :     IoAcquireCancelSpinLock(&oldIrql);

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

; 925  : 
; 926  :     //
; 927  :     // We set this to indicate to the interval timer
; 928  :     // that the read has completed due to total timeout.
; 929  :     //
; 930  :     // Recall that the interval timer dpc can be lurking in some
; 931  :     // DPC queue.
; 932  :     //
; 933  : 
; 934  :     extension->CountOnLastRead = SERIAL_COMPLETE_READ_TOTAL;

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

; 935  : 
; 936  :     SerialTryToCompleteCurrent(
; 937  :         extension,
; 938  :         SerialGrabReadFromIsr,
; 939  :         oldIrql,
; 940  :         STATUS_TIMEOUT,
; 941  :         &extension->CurrentReadIrp,
; 942  :         &extension->ReadQueue,
; 943  :         &extension->ReadRequestIntervalTimer,
; 944  :         &extension->ReadRequestTotalTimer,
; 945  :         SerialStartRead,
; 946  :         SerialGetNextIrp,
; 947  :         SERIAL_REF_TOTAL_TIMER
; 948  :         );

  00041	6a 04		 push	 4
  00043	68 00 00 00 00	 push	 OFFSET FLAT:_SerialGetNextIrp@20
  00048	68 00 00 00 00	 push	 OFFSET FLAT:_SerialStartRead@4
  0004d	8d 86 b0 03 00
	00		 lea	 eax, DWORD PTR [esi+944]
  00053	c7 86 2c 01 00
	00 fe ff ff ff	 mov	 DWORD PTR [esi+300], -2	; fffffffeH
  0005d	50		 push	 eax
  0005e	8d 86 d8 03 00
	00		 lea	 eax, DWORD PTR [esi+984]
  00064	50		 push	 eax
  00065	8d 86 a4 00 00
	00		 lea	 eax, DWORD PTR [esi+164]
  0006b	50		 push	 eax
  0006c	8d 86 c4 00 00
	00		 lea	 eax, DWORD PTR [esi+196]
  00072	50		 push	 eax
  00073	68 02 01 00 00	 push	 258			; 00000102H
  00078	ff 75 fc	 push	 DWORD PTR _oldIrql$[ebp]
  0007b	68 00 00 00 00	 push	 OFFSET FLAT:_SerialGrabReadFromIsr@4
  00080	56		 push	 esi
  00081	e8 00 00 00 00	 call	 _SerialTryToCompleteCurrent@44

; 949  : 
; 950  :     SerialDpcEpilogue(extension, Dpc);

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

; 951  : 
; 952  : }

  00090	c9		 leave
  00091	c2 10 00	 ret	 16			; 00000010H
_SerialReadTimeout@16 ENDP
_TEXT	ENDS
PUBLIC	_SerialUpdateReadByIsr@4
;	COMDAT _SerialUpdateReadByIsr@4
PAGESER	SEGMENT
$SG15160 DB	'SERIAL: Pageable code called at IRQL %d without lock ', 0aH
	DB	00H
	ORG $+1
$SG15163 DB	'f:\w2ddk\src\kernel\serial\read.c', 00H
	ORG $+2
$SG15164 DB	'FALSE', 00H
; Function compile flags: /Ogs
_Context$ = 8
_SerialUpdateReadByIsr@4 PROC NEAR			; COMDAT

; 981  : {

  00062	55		 push	 ebp
  00063	8b ec		 mov	 ebp, esp
  00065	56		 push	 esi

; 982  : 
; 983  :     PSERIAL_DEVICE_EXTENSION extension = Context;
; 984  :     SERIAL_LOCKED_PAGED_CODE();

  00066	8b 35 00 00 00
	00		 mov	 esi, DWORD PTR __imp__KeGetCurrentIrql@0
  0006c	ff d6		 call	 esi
  0006e	3c 01		 cmp	 al, 1
  00070	76 32		 jbe	 SHORT $L15161
  00072	83 3d 14 00 00
	00 00		 cmp	 DWORD PTR _SerialGlobals+20, 0
  00079	75 29		 jne	 SHORT $L15161
  0007b	ff d6		 call	 esi
  0007d	0f b6 c0	 movzx	 eax, al
  00080	50		 push	 eax
  00081	68 00 00 00 00	 push	 OFFSET FLAT:$SG15160
  00086	e8 00 00 00 00	 call	 _DbgPrint
  0008b	59		 pop	 ecx
  0008c	59		 pop	 ecx
  0008d	6a 00		 push	 0
  0008f	68 d8 03 00 00	 push	 984			; 000003d8H
  00094	68 00 00 00 00	 push	 OFFSET FLAT:$SG15163
  00099	68 00 00 00 00	 push	 OFFSET FLAT:$SG15164
  0009e	ff 15 00 00 00
	00		 call	 DWORD PTR __imp__RtlAssert@16
$L15161:

; 985  : 
; 986  :     extension->CountOnLastRead = extension->ReadByIsr;

  000a4	8b 4d 08	 mov	 ecx, DWORD PTR _Context$[ebp]
  000a7	5e		 pop	 esi
  000a8	8d 81 30 01 00
	00		 lea	 eax, DWORD PTR [ecx+304]
  000ae	8b 10		 mov	 edx, DWORD PTR [eax]

; 987  :     extension->ReadByIsr = 0;

  000b0	83 20 00	 and	 DWORD PTR [eax], 0
  000b3	89 91 2c 01 00
	00		 mov	 DWORD PTR [ecx+300], edx

; 988  : 
; 989  :     return FALSE;

  000b9	32 c0		 xor	 al, al

; 990  : 
; 991  : }

  000bb	5d		 pop	 ebp
  000bc	c2 04 00	 ret	 4
_SerialUpdateReadByIsr@4 ENDP
PAGESER	ENDS
PUBLIC	_SerialIntervalReadTimeout@16
;	COMDAT _SerialIntervalReadTimeout@16
_TEXT	SEGMENT
$SG15182 DB	'SERIAL: SerialIntervalReadTimeout', 0aH, 00H
; Function compile flags: /Ogs
_Dpc$ = 8
_DeferredContext$ = 12
_oldIrql$ = -4
_currentTime$15205 = -12
_SerialIntervalReadTimeout@16 PROC NEAR			; COMDAT

; 1031 : {

  00023	55		 push	 ebp
  00024	8b ec		 mov	 ebp, esp
  00026	83 ec 0c	 sub	 esp, 12			; 0000000cH

; 1032 : 
; 1033 :     PSERIAL_DEVICE_EXTENSION extension = DeferredContext;
; 1034 :     KIRQL oldIrql;
; 1035 : 
; 1036 :     UNREFERENCED_PARAMETER(SystemContext1);
; 1037 :     UNREFERENCED_PARAMETER(SystemContext2);
; 1038 : 
; 1039 :     IoAcquireCancelSpinLock(&oldIrql);

  00029	8d 45 fc	 lea	 eax, DWORD PTR _oldIrql$[ebp]
  0002c	50		 push	 eax
  0002d	ff 15 00 00 00
	00		 call	 DWORD PTR __imp__IoAcquireCancelSpinLock@4

; 1040 : 
; 1041 :     SerialDump(SERTRACECALLS, ("SERIAL: SerialIntervalReadTimeout\n"));

  00033	f6 05 00 00 00
	00 40		 test	 BYTE PTR _SerialDebugLevel, 64 ; 00000040H
  0003a	74 0b		 je	 SHORT $L15177
  0003c	68 00 00 00 00	 push	 OFFSET FLAT:$SG15182
  00041	e8 00 00 00 00	 call	 _DbgPrint
  00046	59		 pop	 ecx
$L15177:
  00047	56		 push	 esi

; 1042 : 
; 1043 :     if (extension->CountOnLastRead == SERIAL_COMPLETE_READ_TOTAL) {

  00048	8b 75 0c	 mov	 esi, DWORD PTR _DeferredContext$[ebp]
  0004b	8b 86 2c 01 00
	00		 mov	 eax, DWORD PTR [esi+300]
  00051	83 f8 fe	 cmp	 eax, -2			; fffffffeH
  00054	75 40		 jne	 SHORT $L15190
$L15447:

; 1044 : 
; 1045 :         //
; 1046 :         // This value is only set by the total
; 1047 :         // timer to indicate that it has fired.
; 1048 :         // If so, then we should simply try to complete.
; 1049 :         //
; 1050 : 
; 1051 :         SerialTryToCompleteCurrent(
; 1052 :             extension,
; 1053 :             SerialGrabReadFromIsr,
; 1054 :             oldIrql,
; 1055 :             STATUS_TIMEOUT,
; 1056 :             &extension->CurrentReadIrp,
; 1057 :             &extension->ReadQueue,
; 1058 :             &extension->ReadRequestIntervalTimer,
; 1059 :             &extension->ReadRequestTotalTimer,
; 1060 :             SerialStartRead,
; 1061 :             SerialGetNextIrp,
; 1062 :             SERIAL_REF_INT_TIMER
; 1063 :             );

  00056	6a 08		 push	 8
  00058	68 00 00 00 00	 push	 OFFSET FLAT:_SerialGetNextIrp@20
  0005d	8d 86 b0 03 00
	00		 lea	 eax, DWORD PTR [esi+944]
  00063	68 00 00 00 00	 push	 OFFSET FLAT:_SerialStartRead@4
  00068	50		 push	 eax
  00069	8d 86 d8 03 00
	00		 lea	 eax, DWORD PTR [esi+984]
  0006f	50		 push	 eax
  00070	8d 86 a4 00 00
	00		 lea	 eax, DWORD PTR [esi+164]
  00076	50		 push	 eax
  00077	8d 86 c4 00 00
	00		 lea	 eax, DWORD PTR [esi+196]
  0007d	50		 push	 eax
  0007e	68 02 01 00 00	 push	 258			; 00000102H
$L15450:
  00083	ff 75 fc	 push	 DWORD PTR _oldIrql$[ebp]
  00086	68 00 00 00 00	 push	 OFFSET FLAT:_SerialGrabReadFromIsr@4
  0008b	56		 push	 esi
  0008c	e8 00 00 00 00	 call	 _SerialTryToCompleteCurrent@44

; 1064 : 
; 1065 :     } else if (extension->CountOnLastRead == SERIAL_COMPLETE_READ_COMPLETE) {

  00091	e9 ec 00 00 00	 jmp	 $L15208
$L15190:
  00096	83 f8 fd	 cmp	 eax, -3			; fffffffdH
  00099	75 2c		 jne	 SHORT $L15194

⌨️ 快捷键说明

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