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

📄 modmflow.cod

📁 怎样在win2000下构造驱动程序znsoft_Serial2000_demo.ZIP
💻 COD
📖 第 1 页 / 共 5 页
字号:
  00020	75 09		 jne	 SHORT $L15203
  00022	83 b8 e0 00 00
	00 00		 cmp	 DWORD PTR [eax+224], 0
  00029	74 29		 je	 SHORT $L15213
$L15203:
  0002b	80 b8 a0 01 00
	00 00		 cmp	 BYTE PTR [eax+416], 0
  00032	74 20		 je	 SHORT $L15213
  00034	56		 push	 esi

; 1021 : 
; 1022 :             DISABLE_ALL_INTERRUPTS(Extension->Controller);

  00035	8d b0 98 00 00
	00		 lea	 esi, DWORD PTR [eax+152]
  0003b	57		 push	 edi
  0003c	8b 3d 00 00 00
	00		 mov	 edi, DWORD PTR __imp__WRITE_PORT_UCHAR@8
  00042	8b 06		 mov	 eax, DWORD PTR [esi]
  00044	6a 00		 push	 0
  00046	40		 inc	 eax
  00047	50		 push	 eax
  00048	ff d7		 call	 edi

; 1023 :             ENABLE_ALL_INTERRUPTS(Extension->Controller);

  0004a	8b 06		 mov	 eax, DWORD PTR [esi]
  0004c	6a 0f		 push	 15			; 0000000fH
  0004e	40		 inc	 eax
  0004f	50		 push	 eax
  00050	ff d7		 call	 edi
  00052	5f		 pop	 edi
  00053	5e		 pop	 esi
$L15213:

; 1024 : 
; 1025 :         }
; 1026 : 
; 1027 :     }
; 1028 : 
; 1029 :     return FALSE;

  00054	32 c0		 xor	 al, al

; 1030 : 
; 1031 : }

  00056	5d		 pop	 ebp
  00057	c2 04 00	 ret	 4
_SerialPretendXon@4 ENDP
_TEXT	ENDS
PUBLIC	_SerialHandleReducedIntBuffer@4
; Function compile flags: /Ogs
;	COMDAT _SerialHandleReducedIntBuffer@4
_TEXT	SEGMENT
_Extension$ = 8
_SerialHandleReducedIntBuffer@4 PROC NEAR		; COMDAT

; 1059 : {

  00000	55		 push	 ebp
  00001	8b ec		 mov	 ebp, esp
  00003	56		 push	 esi

; 1060 : 
; 1061 : 
; 1062 :     //
; 1063 :     // If we are doing receive side flow control and we are
; 1064 :     // currently "holding" then because we've emptied out
; 1065 :     // some characters from the interrupt buffer we need to
; 1066 :     // see if we can "re-enable" reception.
; 1067 :     //
; 1068 : 
; 1069 :     if (Extension->RXHolding) {

  00004	8b 75 08	 mov	 esi, DWORD PTR _Extension$[ebp]
  00007	8b 86 20 01 00
	00		 mov	 eax, DWORD PTR [esi+288]
  0000d	85 c0		 test	 eax, eax
  0000f	74 49		 je	 SHORT $L15232

; 1070 : 
; 1071 :         if (Extension->CharsInInterruptBuffer <=
; 1072 :             (ULONG)Extension->HandFlow.XonLimit) {

  00011	8b 8e f0 00 00
	00		 mov	 ecx, DWORD PTR [esi+240]
  00017	3b 8e 7c 01 00
	00		 cmp	 ecx, DWORD PTR [esi+380]
  0001d	77 3b		 ja	 SHORT $L15232

; 1073 : 
; 1074 :             if (Extension->RXHolding & SERIAL_RX_DTR) {

  0001f	a8 01		 test	 al, 1
  00021	74 0e		 je	 SHORT $L15226

; 1075 : 
; 1076 :                 Extension->RXHolding &= ~SERIAL_RX_DTR;

  00023	24 fe		 and	 al, -2			; fffffffeH

; 1077 :                 SerialSetDTR(Extension);

  00025	56		 push	 esi
  00026	89 86 20 01 00
	00		 mov	 DWORD PTR [esi+288], eax
  0002c	e8 00 00 00 00	 call	 _SerialSetDTR@4
$L15226:

; 1078 : 
; 1079 :             }
; 1080 : 
; 1081 :             if (Extension->RXHolding & SERIAL_RX_RTS) {

  00031	8b 86 20 01 00
	00		 mov	 eax, DWORD PTR [esi+288]
  00037	a8 04		 test	 al, 4
  00039	74 0e		 je	 SHORT $L15229

; 1082 : 
; 1083 :                 Extension->RXHolding &= ~SERIAL_RX_RTS;

  0003b	24 fb		 and	 al, -5			; fffffffbH

; 1084 :                 SerialSetRTS(Extension);

  0003d	56		 push	 esi
  0003e	89 86 20 01 00
	00		 mov	 DWORD PTR [esi+288], eax
  00044	e8 00 00 00 00	 call	 _SerialSetRTS@4
$L15229:

; 1085 : 
; 1086 :             }
; 1087 : 
; 1088 :             if (Extension->RXHolding & SERIAL_RX_XOFF) {

  00049	f6 86 20 01 00
	00 02		 test	 BYTE PTR [esi+288], 2
  00050	74 08		 je	 SHORT $L15232

; 1089 : 
; 1090 :                 //
; 1091 :                 // Prod the transmit code to send xon.
; 1092 :                 //
; 1093 : 
; 1094 :                 SerialProdXonXoff(
; 1095 :                     Extension,
; 1096 :                     TRUE
; 1097 :                     );

  00052	6a 01		 push	 1
  00054	56		 push	 esi
  00055	e8 00 00 00 00	 call	 _SerialProdXonXoff@8
$L15232:
  0005a	5e		 pop	 esi

; 1098 : 
; 1099 :             }
; 1100 : 
; 1101 :         }
; 1102 : 
; 1103 :     }
; 1104 : 
; 1105 : }

  0005b	5d		 pop	 ebp
  0005c	c2 04 00	 ret	 4
_SerialHandleReducedIntBuffer@4 ENDP
; Function compile flags: /Ogs
_TEXT	ENDS
;	COMDAT _SerialProdXonXoff@8
_TEXT	SEGMENT
_Extension$ = 8
_SendXon$ = 12
_SerialProdXonXoff@8 PROC NEAR				; COMDAT

; 1138 : {

  00000	55		 push	 ebp
  00001	8b ec		 mov	 ebp, esp
  00003	56		 push	 esi

; 1139 : 
; 1140 :     //
; 1141 :     // We assume that if the prodding is called more than
; 1142 :     // once that the last prod has set things up appropriately.
; 1143 :     //
; 1144 :     // We could get called before the character is sent out
; 1145 :     // because the send of the character was blocked because
; 1146 :     // of hardware flow control (or break).
; 1147 :     //
; 1148 : 
; 1149 :     if (!Extension->SendXonChar && !Extension->SendXoffChar
; 1150 :         && Extension->HoldingEmpty) {

  00004	8b 75 08	 mov	 esi, DWORD PTR _Extension$[ebp]
  00007	80 be db 01 00
	00 00		 cmp	 BYTE PTR [esi+475], 0
  0000e	75 32		 jne	 SHORT $L15248
  00010	80 be dc 01 00
	00 00		 cmp	 BYTE PTR [esi+476], 0
  00017	75 29		 jne	 SHORT $L15248
  00019	80 be a0 01 00
	00 00		 cmp	 BYTE PTR [esi+416], 0
  00020	74 20		 je	 SHORT $L15248
  00022	53		 push	 ebx
  00023	57		 push	 edi

; 1151 : 
; 1152 :         DISABLE_ALL_INTERRUPTS(Extension->Controller);

  00024	8b 1d 00 00 00
	00		 mov	 ebx, DWORD PTR __imp__WRITE_PORT_UCHAR@8
  0002a	8d be 98 00 00
	00		 lea	 edi, DWORD PTR [esi+152]
  00030	6a 00		 push	 0
  00032	8b 07		 mov	 eax, DWORD PTR [edi]
  00034	40		 inc	 eax
  00035	50		 push	 eax
  00036	ff d3		 call	 ebx

; 1153 :         ENABLE_ALL_INTERRUPTS(Extension->Controller);

  00038	8b 07		 mov	 eax, DWORD PTR [edi]
  0003a	6a 0f		 push	 15			; 0000000fH
  0003c	40		 inc	 eax
  0003d	50		 push	 eax
  0003e	ff d3		 call	 ebx
  00040	5f		 pop	 edi
  00041	5b		 pop	 ebx
$L15248:

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

  00042	80 7d 0c 00	 cmp	 BYTE PTR _SendXon$[ebp], 0
  00046	74 10		 je	 SHORT $L15254

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

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

; 1161 : 
; 1162 :     } else {

  00056	eb 0e		 jmp	 SHORT $L15255
$L15254:

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

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

; 1165 :         Extension->SendXoffChar = TRUE;

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

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

  00067	5d		 pop	 ebp
  00068	c2 08 00	 ret	 8
_SerialProdXonXoff@8 ENDP
_TEXT	ENDS
EXTRN	_SerialPutChar@8:NEAR
; Function compile flags: /Ogs
;	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 $L15265

; 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 $L15265

; 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
$L15265:

; 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 $L15268

; 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 $L15268

; 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 $L15273
$L15268:

; 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
$L15273:

; 1290 : 
; 1291 :     }
; 1

⌨️ 快捷键说明

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