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

📄 read.cod

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

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

  0001f	6a 08		 push	 8
  00021	68 00 00 00 00	 push	 OFFSET FLAT:_SerialGetNextIrp@20
  00026	8d 86 b0 03 00
	00		 lea	 eax, DWORD PTR [esi+944]
  0002c	68 00 00 00 00	 push	 OFFSET FLAT:_SerialStartRead@4
  00031	50		 push	 eax
  00032	8d 86 d8 03 00
	00		 lea	 eax, DWORD PTR [esi+984]
  00038	50		 push	 eax
  00039	8d 86 a4 00 00
	00		 lea	 eax, DWORD PTR [esi+164]
  0003f	50		 push	 eax
  00040	8d 86 c4 00 00
	00		 lea	 eax, DWORD PTR [esi+196]
  00046	50		 push	 eax
  00047	68 02 01 00 00	 push	 258			; 00000102H
$L15190:
  0004c	ff 75 fc	 push	 DWORD PTR _oldIrql$[ebp]
  0004f	68 00 00 00 00	 push	 OFFSET FLAT:_SerialGrabReadFromIsr@4
  00054	56		 push	 esi
  00055	e8 00 00 00 00	 call	 _SerialTryToCompleteCurrent@44

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

  0005a	e9 ec 00 00 00	 jmp	 $L15007
$L14989:
  0005f	83 f8 fd	 cmp	 eax, -3			; fffffffdH
  00062	75 2c		 jne	 SHORT $L14993

; 1066 : 
; 1067 :         //
; 1068 :         // This value is only set by the regular
; 1069 :         // completion routine.
; 1070 :         //
; 1071 :         // If so, then we should simply try to complete.
; 1072 :         //
; 1073 : 
; 1074 :         SerialTryToCompleteCurrent(
; 1075 :             extension,
; 1076 :             SerialGrabReadFromIsr,
; 1077 :             oldIrql,
; 1078 :             STATUS_SUCCESS,
; 1079 :             &extension->CurrentReadIrp,
; 1080 :             &extension->ReadQueue,
; 1081 :             &extension->ReadRequestIntervalTimer,
; 1082 :             &extension->ReadRequestTotalTimer,
; 1083 :             SerialStartRead,
; 1084 :             SerialGetNextIrp,
; 1085 :             SERIAL_REF_INT_TIMER
; 1086 :             );

  00064	6a 08		 push	 8
  00066	68 00 00 00 00	 push	 OFFSET FLAT:_SerialGetNextIrp@20
  0006b	8d 86 b0 03 00
	00		 lea	 eax, DWORD PTR [esi+944]
  00071	68 00 00 00 00	 push	 OFFSET FLAT:_SerialStartRead@4
  00076	50		 push	 eax
  00077	8d 86 d8 03 00
	00		 lea	 eax, DWORD PTR [esi+984]
  0007d	50		 push	 eax
  0007e	8d 86 a4 00 00
	00		 lea	 eax, DWORD PTR [esi+164]
  00084	50		 push	 eax
  00085	8d 86 c4 00 00
	00		 lea	 eax, DWORD PTR [esi+196]
  0008b	50		 push	 eax
  0008c	6a 00		 push	 0

; 1087 : 
; 1088 :     } else if (extension->CountOnLastRead == SERIAL_COMPLETE_READ_CANCEL) {

  0008e	eb bc		 jmp	 SHORT $L15190
$L14993:
  00090	83 f8 ff	 cmp	 eax, -1
  00093	75 2f		 jne	 SHORT $L14997

; 1089 : 
; 1090 :         //
; 1091 :         // This value is only set by the cancel
; 1092 :         // read routine.
; 1093 :         //
; 1094 :         // If so, then we should simply try to complete.
; 1095 :         //
; 1096 : 
; 1097 :         SerialTryToCompleteCurrent(
; 1098 :             extension,
; 1099 :             SerialGrabReadFromIsr,
; 1100 :             oldIrql,
; 1101 :             STATUS_CANCELLED,
; 1102 :             &extension->CurrentReadIrp,
; 1103 :             &extension->ReadQueue,
; 1104 :             &extension->ReadRequestIntervalTimer,
; 1105 :             &extension->ReadRequestTotalTimer,
; 1106 :             SerialStartRead,
; 1107 :             SerialGetNextIrp,
; 1108 :             SERIAL_REF_INT_TIMER
; 1109 :             );

  00095	6a 08		 push	 8
  00097	68 00 00 00 00	 push	 OFFSET FLAT:_SerialGetNextIrp@20
  0009c	8d 86 b0 03 00
	00		 lea	 eax, DWORD PTR [esi+944]
  000a2	68 00 00 00 00	 push	 OFFSET FLAT:_SerialStartRead@4
  000a7	50		 push	 eax
  000a8	8d 86 d8 03 00
	00		 lea	 eax, DWORD PTR [esi+984]
  000ae	50		 push	 eax
  000af	8d 86 a4 00 00
	00		 lea	 eax, DWORD PTR [esi+164]
  000b5	50		 push	 eax
  000b6	8d 86 c4 00 00
	00		 lea	 eax, DWORD PTR [esi+196]
  000bc	50		 push	 eax
  000bd	68 20 01 00 c0	 push	 -1073741536		; c0000120H

; 1110 : 
; 1111 :     } else if (extension->CountOnLastRead || extension->ReadByIsr) {

  000c2	eb 88		 jmp	 SHORT $L15190
$L14997:
  000c4	85 c0		 test	 eax, eax
  000c6	75 0a		 jne	 SHORT $L15001
  000c8	39 86 30 01 00
	00		 cmp	 DWORD PTR [esi+304], eax
  000ce	75 0b		 jne	 SHORT $L15189

; 1196 : 
; 1197 :             }
; 1198 : 
; 1199 : 
; 1200 :         }
; 1201 : 
; 1202 :     } else {
; 1203 : 
; 1204 :         //
; 1205 :         // Timer doesn't really start until the first character.
; 1206 :         // So we should simply resubmit ourselves.
; 1207 :         //
; 1208 : 
; 1209 :         SerialSetTimer(
; 1210 :             &extension->ReadRequestIntervalTimer,
; 1211 :             *extension->IntervalTimeToUse,
; 1212 :             &extension->IntervalReadTimeoutDpc,
; 1213 :             extension
; 1214 :             );
; 1215 : 
; 1216 :         IoReleaseCancelSpinLock(oldIrql);

  000d0	eb 51		 jmp	 SHORT $L15005
$L15001:

; 1112 : 
; 1113 :         //
; 1114 :         // Something has happened since we last came here.  We
; 1115 :         // check to see if the ISR has read in any more characters.
; 1116 :         // If it did then we should update the isr's read count
; 1117 :         // and resubmit the timer.
; 1118 :         //
; 1119 : 
; 1120 :         if (extension->ReadByIsr) {

  000d2	83 be 30 01 00
	00 00		 cmp	 DWORD PTR [esi+304], 0
  000d9	74 1e		 je	 SHORT $L15002
$L15189:

; 1121 : 
; 1122 :             KeSynchronizeExecution(
; 1123 :                 extension->Interrupt,
; 1124 :                 SerialUpdateReadByIsr,
; 1125 :                 extension
; 1126 :                 );

  000db	56		 push	 esi
  000dc	68 00 00 00 00	 push	 OFFSET FLAT:_SerialUpdateReadByIsr@4
  000e1	ff b6 a0 00 00
	00		 push	 DWORD PTR [esi+160]
  000e7	ff 15 00 00 00
	00		 call	 DWORD PTR __imp__KeSynchronizeExecution@12

; 1127 : 
; 1128 :             //
; 1129 :             // Save off the "last" time something was read.
; 1130 :             // As we come back to this routine we will compare
; 1131 :             // the current time to the "last" time.  If the
; 1132 :             // difference is ever larger then the interval
; 1133 :             // requested by the user, then time out the request.
; 1134 :             //
; 1135 : 
; 1136 :             KeQuerySystemTime(
; 1137 :                 &extension->LastReadTime
; 1138 :                 );

  000ed	8d 46 58	 lea	 eax, DWORD PTR [esi+88]
  000f0	50		 push	 eax
  000f1	ff 15 00 00 00
	00		 call	 DWORD PTR __imp__KeQuerySystemTime@4

; 1139 : 
; 1140 :             SerialSetTimer(
; 1141 :                 &extension->ReadRequestIntervalTimer,
; 1142 :                 *extension->IntervalTimeToUse,
; 1143 :                 &extension->IntervalReadTimeoutDpc,
; 1144 :                 extension
; 1145 :                 );
; 1146 : 
; 1147 :             IoReleaseCancelSpinLock(oldIrql);
; 1148 : 
; 1149 :         } else {

  000f7	eb 2a		 jmp	 SHORT $L15005
$L15002:

; 1150 : 
; 1151 :             //
; 1152 :             // Take the difference between the current time
; 1153 :             // and the last time we had characters and
; 1154 :             // see if it is greater then the interval time.
; 1155 :             // if it is, then time out the request.  Otherwise
; 1156 :             // go away again for a while.
; 1157 :             //
; 1158 : 
; 1159 :             //
; 1160 :             // No characters read in the interval time.  Kill
; 1161 :             // this read.
; 1162 :             //
; 1163 : 
; 1164 :             LARGE_INTEGER currentTime;
; 1165 : 
; 1166 :             KeQuerySystemTime(
; 1167 :                 &currentTime
; 1168 :                 );

  000f9	8d 45 f4	 lea	 eax, DWORD PTR _currentTime$15004[ebp]
  000fc	50		 push	 eax
  000fd	ff 15 00 00 00
	00		 call	 DWORD PTR __imp__KeQuerySystemTime@4

; 1169 : 
; 1170 :             if ((currentTime.QuadPart - extension->LastReadTime.QuadPart) >=
; 1171 :                 extension->IntervalTime.QuadPart) {

  00103	8b 4d f4	 mov	 ecx, DWORD PTR _currentTime$15004[ebp]
  00106	8b 45 f8	 mov	 eax, DWORD PTR _currentTime$15004[ebp+4]
  00109	2b 4e 58	 sub	 ecx, DWORD PTR [esi+88]
  0010c	1b 46 5c	 sbb	 eax, DWORD PTR [esi+92]
  0010f	3b 46 3c	 cmp	 eax, DWORD PTR [esi+60]
  00112	7c 0f		 jl	 SHORT $L15005
  00114	0f 8f 05 ff ff
	ff		 jg	 $L15187
  0011a	3b 4e 38	 cmp	 ecx, DWORD PTR [esi+56]

; 1172 : 
; 1173 :                 SerialTryToCompleteCurrent(
; 1174 :                     extension,
; 1175 :                     SerialGrabReadFromIsr,
; 1176 :                     oldIrql,
; 1177 :                     STATUS_TIMEOUT,
; 1178 :                     &extension->CurrentReadIrp,
; 1179 :                     &extension->ReadQueue,
; 1180 :                     &extension->ReadRequestIntervalTimer,
; 1181 :                     &extension->ReadRequestTotalTimer,
; 1182 :                     SerialStartRead,
; 1183 :                     SerialGetNextIrp,
; 1184 :                     SERIAL_REF_INT_TIMER
; 1185 :                     );
; 1186 : 
; 1187 :             } else {

  0011d	0f 83 fc fe ff
	ff		 jae	 $L15187
$L15005:

; 1188 : 
; 1189 :                 SerialSetTimer(
; 1190 :                     &extension->ReadRequestIntervalTimer,
; 1191 :                     *extension->IntervalTimeToUse,
; 1192 :                     &extension->IntervalReadTimeoutDpc,
; 1193 :                     extension
; 1194 :                     );

  00123	8d 86 4c 02 00
	00		 lea	 eax, DWORD PTR [esi+588]
  00129	56		 push	 esi
  0012a	50		 push	 eax
  0012b	8b 86 88 00 00
	00		 mov	 eax, DWORD PTR [esi+136]
  00131	ff 70 04	 push	 DWORD PTR [eax+4]
  00134	ff 30		 push	 DWORD PTR [eax]
  00136	8d 86 d8 03 00
	00		 lea	 eax, DWORD PTR [esi+984]
  0013c	50		 push	 eax
  0013d	e8 00 00 00 00	 call	 _SerialSetTimer@20

; 1195 :                 IoReleaseCancelSpinLock(oldIrql);

  00142	ff 75 fc	 push	 DWORD PTR _oldIrql$[ebp]
  00145	ff 15 00 00 00
	00		 call	 DWORD PTR __imp__IoReleaseCancelSpinLock@4
$L15007:

; 1217 : 
; 1218 :     }
; 1219 : 
; 1220 :     SerialDpcEpilogue(extension, Dpc);

  0014b	ff 75 08	 push	 DWORD PTR _Dpc$[ebp]
  0014e	56		 push	 esi
  0014f	e8 00 00 00 00	 call	 _SerialDpcEpilogue@8
  00154	5e		 pop	 esi

; 1221 : 
; 1222 : }

  00155	c9		 leave
  00156	c2 10 00	 ret	 16			; 00000010H
_SerialIntervalReadTimeout@16 ENDP
_TEXT	ENDS
EXTRN	__imp__memmove:NEAR
; Function compile flags: /Ogsy
;	COMDAT _SerialGetCharsFromIntBuffer@4
PAGESER	SEGMENT
_Extension$ = 8
_SerialGetCharsFromIntBuffer@4 PROC NEAR		; COMDAT

; 1252 : {

  00000	53		 push	 ebx
  00001	56		 push	 esi

; 1253 : 
; 1254 :     //
; 1255 :     // This value will be the number of characters that this
; 1256 :     // routine returns.  It will be the minimum of the number
; 1257 :     // of characters currently in the buffer or the number of
; 1258 :     // characters required for the read.
; 1259 :     //
; 1260 :     ULONG numberOfCharsToGet;
; 1261 : 
; 1262 :     //
; 1263 :     // This holds the number of characters between the first
; 1264 :     // readable character and - the last character we will read or
; 1265 :     // the real physical end of the buffer (not the last readable
; 1266 :     // character).
; 1267 :     //
; 1268 :     ULONG firstTryNumberToGet;
; 1269 : 
; 1270 :     SERIAL_LOCKED_PAGED_CODE();
; 1271 : 
; 1272 : 
; 1273 :     //
; 1274 :     // The minimum of the number of characters we need and
; 1275 :     // the number of characters available
; 1276 :     //
; 1277 : 
; 1278 :     numberOfCharsToGet = Extension->CharsInInterruptBuffer;

  00002	8b 74 24 0c	 mov	 esi, DWORD PTR _Extension$[esp+4]
  00006	57		 push	 edi
  00007	8b 9e f0 00 00
	00		 mov	 ebx, DWORD PTR [esi+240]

; 1279 : 
; 1280 :     if (numberOfCharsToGet > Extension->NumberNeededForRead) {

  0000d	8b 86 0c 01 00
	00		 mov	 eax, DWORD PTR [esi+268]
  00013	3b d8		 cmp	 ebx, eax
  00015	76 02		 jbe	 SHORT $L15014

; 1281 : 
; 1282 :         numberOfCharsToGet = Extension->NumberNeededForRead;

  00017	8b d8		 mov	 ebx, eax
$L15014:

; 1283 : 
; 1284 :     }
; 1285 : 
; 1286 :     if (numberOfCharsToGet) {

  00019	85 db		 test	 ebx, ebx
  0001b	0f 84 b7 00 00
	00		 je	

⌨️ 快捷键说明

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