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

📄 modmflow.cod

📁 怎样在win2000下构造驱动程序znsoft_Serial2000_demo.ZIP
💻 COD
📖 第 1 页 / 共 5 页
字号:
  0003b	50		 push	 eax
  0003c	ff d3		 call	 ebx
  0003e	5f		 pop	 edi
  0003f	5b		 pop	 ebx
$L15060:

; 1154 : 
; 1155 :     }
; 1156 : 
; 1157 :     if (SendXon) {

  00040	80 7c 24 0c 00	 cmp	 BYTE PTR _SendXon$[esp], 0
  00045	74 10		 je	 SHORT $L15066

; 1158 : 
; 1159 :         Extension->SendXonChar = TRUE;
; 1160 :         Extension->SendXoffChar = FALSE;

  00047	80 a6 dc 01 00
	00 00		 and	 BYTE PTR [esi+476], 0
  0004e	c6 86 db 01 00
	00 01		 mov	 BYTE PTR [esi+475], 1

; 1161 : 
; 1162 :     } else {

  00055	eb 0e		 jmp	 SHORT $L15067
$L15066:

; 1163 : 
; 1164 :         Extension->SendXonChar = FALSE;

  00057	80 a6 db 01 00
	00 00		 and	 BYTE PTR [esi+475], 0

; 1165 :         Extension->SendXoffChar = TRUE;

  0005e	c6 86 dc 01 00
	00 01		 mov	 BYTE PTR [esi+476], 1
$L15067:
  00065	5e		 pop	 esi

; 1166 : 
; 1167 :     }
; 1168 : 
; 1169 : }

  00066	c2 08 00	 ret	 8
_SerialProdXonXoff@8 ENDP
_TEXT	ENDS
EXTRN	_SerialPutChar@8:NEAR
; Function compile flags: /Ogsy
;	COMDAT _SerialHandleModemUpdate@8
_TEXT	SEGMENT
_Extension$ = 8
_DoingTX$ = 12
_OldTXHolding$ = -4
_ModemStatus$ = 8
_SerialHandleModemUpdate@8 PROC NEAR			; COMDAT

; 1205 : {

  00000	55		 push	 ebp
  00001	8b ec		 mov	 ebp, esp
  00003	51		 push	 ecx
  00004	53		 push	 ebx
  00005	56		 push	 esi

; 1206 : 
; 1207 :     //
; 1208 :     // We keep this local so that after we are done
; 1209 :     // examining the modem status and we've updated
; 1210 :     // the transmission holding value, we know whether
; 1211 :     // we've changed from needing to hold up transmission
; 1212 :     // to transmission being able to proceed.
; 1213 :     //
; 1214 :     ULONG OldTXHolding = Extension->TXHolding;

  00006	8b 75 08	 mov	 esi, DWORD PTR _Extension$[ebp]
  00009	57		 push	 edi
  0000a	8b 86 1c 01 00
	00		 mov	 eax, DWORD PTR [esi+284]
  00010	89 45 fc	 mov	 DWORD PTR _OldTXHolding$[ebp], eax

; 1215 : 
; 1216 :     //
; 1217 :     // Holds the value in the mode status register.
; 1218 :     //
; 1219 :     UCHAR ModemStatus;
; 1220 : 
; 1221 :     ModemStatus =
; 1222 :         READ_MODEM_STATUS(Extension->Controller);

  00013	8b 86 98 00 00
	00		 mov	 eax, DWORD PTR [esi+152]
  00019	83 c0 06	 add	 eax, 6
  0001c	50		 push	 eax
  0001d	ff 15 00 00 00
	00		 call	 DWORD PTR __imp__READ_PORT_UCHAR@4
  00023	88 45 08	 mov	 BYTE PTR _ModemStatus$[ebp], al

; 1223 : 
; 1224 :     //
; 1225 :     // If we are placeing the modem status into the data stream
; 1226 :     // on every change, we should do it now.
; 1227 :     //
; 1228 : 
; 1229 :     if (Extension->EscapeChar) {

  00026	8a 86 da 01 00
	00		 mov	 al, BYTE PTR [esi+474]
  0002c	33 db		 xor	 ebx, ebx
  0002e	3a c3		 cmp	 al, bl
  00030	74 1e		 je	 SHORT $L15077

; 1230 : 
; 1231 :         if (ModemStatus & (SERIAL_MSR_DCTS |
; 1232 :                            SERIAL_MSR_DDSR |
; 1233 :                            SERIAL_MSR_TERI |
; 1234 :                            SERIAL_MSR_DDCD)) {

  00032	f6 45 08 0f	 test	 BYTE PTR _ModemStatus$[ebp], 15 ; 0000000fH
  00036	74 18		 je	 SHORT $L15077

; 1235 : 
; 1236 :             SerialPutChar(
; 1237 :                 Extension,
; 1238 :                 Extension->EscapeChar
; 1239 :                 );

  00038	50		 push	 eax
  00039	56		 push	 esi
  0003a	e8 00 00 00 00	 call	 _SerialPutChar@8

; 1240 :             SerialPutChar(
; 1241 :                 Extension,
; 1242 :                 SERIAL_LSRMST_MST
; 1243 :                 );

  0003f	6a 03		 push	 3
  00041	56		 push	 esi
  00042	e8 00 00 00 00	 call	 _SerialPutChar@8

; 1244 :             SerialPutChar(
; 1245 :                 Extension,
; 1246 :                 ModemStatus
; 1247 :                 );

  00047	ff 75 08	 push	 DWORD PTR _ModemStatus$[ebp]
  0004a	56		 push	 esi
  0004b	e8 00 00 00 00	 call	 _SerialPutChar@8
$L15077:

; 1248 : 
; 1249 :         }
; 1250 : 
; 1251 :     }
; 1252 : 
; 1253 : 
; 1254 :     //
; 1255 :     // Take care of input flow control based on sensitivity
; 1256 :     // to the DSR.  This is done so that the application won't
; 1257 :     // see spurious data generated by odd devices.
; 1258 :     //
; 1259 :     // Basically, if we are doing dsr sensitivity then the
; 1260 :     // driver should only accept data when the dsr bit is
; 1261 :     // set.
; 1262 :     //
; 1263 : 
; 1264 :     if (Extension->HandFlow.ControlHandShake & SERIAL_DSR_SENSITIVITY) {

  00050	f6 86 74 01 00
	00 40		 test	 BYTE PTR [esi+372], 64	; 00000040H
  00057	74 0f		 je	 SHORT $L15080

; 1265 : 
; 1266 :         if (ModemStatus & SERIAL_MSR_DSR) {

  00059	f6 45 08 20	 test	 BYTE PTR _ModemStatus$[ebp], 32 ; 00000020H

; 1267 : 
; 1268 :             //
; 1269 :             // The line is high.  Simply make sure that
; 1270 :             // RXHolding does't have the DSR bit.
; 1271 :             //
; 1272 : 
; 1273 :             Extension->RXHolding &= ~SERIAL_RX_DSR;
; 1274 : 
; 1275 :         } else {

  0005d	75 09		 jne	 SHORT $L15080

; 1276 : 
; 1277 :             Extension->RXHolding |= SERIAL_RX_DSR;

  0005f	83 8e 20 01 00
	00 08		 or	 DWORD PTR [esi+288], 8

; 1278 : 
; 1279 :         }
; 1280 : 
; 1281 :     } else {

  00066	eb 07		 jmp	 SHORT $L15085
$L15080:

; 1282 : 
; 1283 :         //
; 1284 :         // We don't have sensitivity due to DSR.  Make sure we
; 1285 :         // arn't holding. (We might have been, but the app just
; 1286 :         // asked that we don't hold for this reason any more.)
; 1287 :         //
; 1288 : 
; 1289 :         Extension->RXHolding &= ~SERIAL_RX_DSR;

  00068	83 a6 20 01 00
	00 f7		 and	 DWORD PTR [esi+288], -9	; fffffff7H
$L15085:

; 1290 : 
; 1291 :     }
; 1292 : 
; 1293 :     //
; 1294 :     // Check to see if we have a wait
; 1295 :     // pending on the modem status events.  If we
; 1296 :     // do then we schedule a dpc to satisfy
; 1297 :     // that wait.
; 1298 :     //
; 1299 : 
; 1300 :     if (Extension->IsrWaitMask) {

  0006f	8b 86 10 01 00
	00		 mov	 eax, DWORD PTR [esi+272]
  00075	3b c3		 cmp	 eax, ebx
  00077	0f 84 82 00 00
	00		 je	 $L15092

; 1301 : 
; 1302 :         if ((Extension->IsrWaitMask & SERIAL_EV_CTS) &&
; 1303 :             (ModemStatus & SERIAL_MSR_DCTS)) {

  0007d	a8 08		 test	 al, 8
  0007f	74 0d		 je	 SHORT $L15088
  00081	f6 45 08 01	 test	 BYTE PTR _ModemStatus$[ebp], 1
  00085	74 07		 je	 SHORT $L15088

; 1304 : 
; 1305 :             Extension->HistoryMask |= SERIAL_EV_CTS;

  00087	83 8e 14 01 00
	00 08		 or	 DWORD PTR [esi+276], 8
$L15088:

; 1306 : 
; 1307 :         }
; 1308 : 
; 1309 :         if ((Extension->IsrWaitMask & SERIAL_EV_DSR) &&
; 1310 :             (ModemStatus & SERIAL_MSR_DDSR)) {

  0008e	a8 10		 test	 al, 16			; 00000010H
  00090	74 0d		 je	 SHORT $L15089
  00092	f6 45 08 02	 test	 BYTE PTR _ModemStatus$[ebp], 2
  00096	74 07		 je	 SHORT $L15089

; 1311 : 
; 1312 :             Extension->HistoryMask |= SERIAL_EV_DSR;

  00098	83 8e 14 01 00
	00 10		 or	 DWORD PTR [esi+276], 16	; 00000010H
$L15089:

; 1313 : 
; 1314 :         }
; 1315 : 
; 1316 :         if ((Extension->IsrWaitMask & SERIAL_EV_RING) &&
; 1317 :             (ModemStatus & SERIAL_MSR_TERI)) {

  0009f	b9 00 01 00 00	 mov	 ecx, 256		; 00000100H
  000a4	85 c1		 test	 eax, ecx
  000a6	74 0c		 je	 SHORT $L15090
  000a8	f6 45 08 04	 test	 BYTE PTR _ModemStatus$[ebp], 4
  000ac	74 06		 je	 SHORT $L15090

; 1318 : 
; 1319 :             Extension->HistoryMask |= SERIAL_EV_RING;

  000ae	09 8e 14 01 00
	00		 or	 DWORD PTR [esi+276], ecx
$L15090:

; 1320 : 
; 1321 :         }
; 1322 : 
; 1323 :         if ((Extension->IsrWaitMask & SERIAL_EV_RLSD) &&
; 1324 :             (ModemStatus & SERIAL_MSR_DDCD)) {

  000b4	a8 20		 test	 al, 32			; 00000020H
  000b6	74 0d		 je	 SHORT $L15091
  000b8	f6 45 08 08	 test	 BYTE PTR _ModemStatus$[ebp], 8
  000bc	74 07		 je	 SHORT $L15091

; 1325 : 
; 1326 :             Extension->HistoryMask |= SERIAL_EV_RLSD;

  000be	83 8e 14 01 00
	00 20		 or	 DWORD PTR [esi+276], 32	; 00000020H
$L15091:

; 1327 : 
; 1328 :         }
; 1329 : 
; 1330 :         if (Extension->IrpMaskLocation &&
; 1331 :             Extension->HistoryMask) {

  000c5	8d 8e 18 01 00
	00		 lea	 ecx, DWORD PTR [esi+280]
  000cb	8b 39		 mov	 edi, DWORD PTR [ecx]
  000cd	3b fb		 cmp	 edi, ebx
  000cf	74 2e		 je	 SHORT $L15092
  000d1	8d 86 14 01 00
	00		 lea	 eax, DWORD PTR [esi+276]
  000d7	8b 10		 mov	 edx, DWORD PTR [eax]
  000d9	3b d3		 cmp	 edx, ebx
  000db	74 22		 je	 SHORT $L15092

; 1332 : 
; 1333 :             *Extension->IrpMaskLocation =
; 1334 :              Extension->HistoryMask;

  000dd	89 17		 mov	 DWORD PTR [edi], edx

; 1335 :             Extension->IrpMaskLocation = NULL;
; 1336 :             Extension->HistoryMask = 0;

  000df	89 18		 mov	 DWORD PTR [eax], ebx

; 1337 : 
; 1338 :             Extension->CurrentWaitIrp->
; 1339 :                 IoStatus.Information = sizeof(ULONG);

  000e1	8b 86 d4 00 00
	00		 mov	 eax, DWORD PTR [esi+212]
  000e7	89 19		 mov	 DWORD PTR [ecx], ebx

; 1340 :             SerialInsertQueueDpc(
; 1341 :                 &Extension->CommWaitDpc,
; 1342 :                 NULL,
; 1343 :                 NULL,
; 1344 :                 Extension
; 1345 :                 );

  000e9	56		 push	 esi
  000ea	53		 push	 ebx
  000eb	c7 40 1c 04 00
	00 00		 mov	 DWORD PTR [eax+28], 4
  000f2	8d 86 ac 02 00
	00		 lea	 eax, DWORD PTR [esi+684]
  000f8	53		 push	 ebx
  000f9	50		 push	 eax
  000fa	e8 00 00 00 00	 call	 _SerialInsertQueueDpc@16
$L15092:

; 1346 : 
; 1347 :         }
; 1348 : 
; 1349 :     }
; 1350 : 
; 1351 :     //
; 1352 :     // If the app has modem line flow control then
; 1353 :     // we check to see if we have to hold up transmission.
; 1354 :     //
; 1355 : 
; 1356 :     if (Extension->HandFlow.ControlHandShake &
; 1357 :         SERIAL_OUT_HANDSHAKEMASK) {

  000ff	8b 86 74 01 00
	00		 mov	 eax, DWORD PTR [esi+372]
  00105	a8 38		 test	 al, 56			; 00000038H
  00107	0f 84 94 00 00
	00		 je	 $L15098

; 1358 : 
; 1359 :         if (Extension->HandFlow.ControlHandShake &
; 1360 :             SERIAL_CTS_HANDSHAKE) {

  0010d	a8 08		 test	 al, 8
  0010f	74 0f		 je	 SHORT $L15100

; 1361 : 
; 1362 :             if (ModemStatus & SERIAL_MSR_CTS) {

  00111	f6 45 08 10	 test	 BYTE PTR _ModemStatus$[ebp], 16 ; 00000010H

; 1363 : 
; 1364 :                 Extension->TXHolding &= ~SERIAL_TX_CTS;
; 1365 : 
; 1366 :             } else {

  00115	75 09		 jne	 SHORT $L15100

; 1367 : 
; 1368 :                 Extension->TXHolding |= SERIAL_TX_CTS;

  00117	83 8e 1c 01 00
	00 01		 or	 DWORD PTR [esi+284], 1

; 1369 : 
; 1370 :             }
; 1371 : 
; 1372 :         } else {

  0011e	eb 07		 jmp	 SHORT $L15105
$L15100:

; 1373 : 
; 1374 :             Extension->TXHolding &= ~SERIAL_TX_CTS;

  00120	83 a6 1c 01 00
	00 fe		 and	 DWORD PTR [esi+284], -2	; fffffffeH
$L15105:

; 1375 : 
; 1376 :         }
; 1377 : 
; 1378 :         if (Extension->HandFlow.ControlHandShake &
; 1379 :             SERIAL_DSR_HANDSHAKE) {

  00127	a8 10		 test	 al, 16			; 00000010H
  00129	74 0f		 je	 SHORT $L15108

; 1380 : 
; 1381 :             if (ModemStatus & SERIAL_MSR_DSR) {

  0012b	f6 45 08 20	 test	 BYTE PTR _ModemStatus$[ebp], 32 ; 00000020H

; 1382 : 
; 1383 :                 Extension->TXHolding &= ~SERIAL_TX_DSR;
; 1384 : 
; 1385 :             } else {

  0012f	75 09		 jne	 SHORT $L15108

; 1386 : 
; 1387 :                 Extension->TXHolding |= SERIAL_TX_DSR;

  00131	83 8e 1c 01 00
	00 02		 or	 DWORD PTR [esi+284], 2

; 1388 : 
; 1389 :             }
; 1390 : 
; 1391 :   

⌨️ 快捷键说明

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