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

📄 modmflow.cod

📁 怎样在win2000下构造驱动程序znsoft_Serial2000_demo.ZIP
💻 COD
📖 第 1 页 / 共 5 页
字号:
; 873  :         // If transmission wasn't holding and we poked the bit
; 874  :         // then we would interrupt before a character actually made
; 875  :         // it out and we could end up over writing a character in
; 876  :         // the transmission hardware.
; 877  : 
; 878  :         OldLineControl = READ_LINE_CONTROL(Extension->Controller);

  00011	8b 86 98 00 00
	00		 mov	 eax, DWORD PTR [esi+152]
  00017	83 c0 03	 add	 eax, 3
  0001a	50		 push	 eax
  0001b	ff 15 00 00 00
	00		 call	 DWORD PTR __imp__READ_PORT_UCHAR@4

; 879  : 
; 880  :         OldLineControl &= ~SERIAL_LCR_BREAK;
; 881  : 
; 882  :         WRITE_LINE_CONTROL(
; 883  :             Extension->Controller,
; 884  :             OldLineControl
; 885  :             );

  00021	8b 3d 00 00 00
	00		 mov	 edi, DWORD PTR __imp__WRITE_PORT_UCHAR@8
  00027	24 bf		 and	 al, 191			; 000000bfH
  00029	88 45 08	 mov	 BYTE PTR _OldLineControl$[ebp], al
  0002c	8b 86 98 00 00
	00		 mov	 eax, DWORD PTR [esi+152]
  00032	ff 75 08	 push	 DWORD PTR _OldLineControl$[ebp]
  00035	83 c0 03	 add	 eax, 3
  00038	50		 push	 eax
  00039	ff d7		 call	 edi

; 886  : 
; 887  :         Extension->TXHolding &= ~SERIAL_TX_BREAK;

  0003b	83 a6 1c 01 00
	00 ef		 and	 DWORD PTR [esi+284], -17 ; ffffffefH

; 888  : 
; 889  :         if (!Extension->TXHolding &&
; 890  :             (Extension->TransmitImmediate ||
; 891  :              Extension->WriteLength) &&
; 892  :              Extension->HoldingEmpty) {

  00042	75 33		 jne	 SHORT $L14980
  00044	33 c0		 xor	 eax, eax
  00046	38 86 a1 01 00
	00		 cmp	 BYTE PTR [esi+417], al
  0004c	75 08		 jne	 SHORT $L14981
  0004e	39 86 e0 00 00
	00		 cmp	 DWORD PTR [esi+224], eax
  00054	74 21		 je	 SHORT $L14980
$L14981:
  00056	38 86 a0 01 00
	00		 cmp	 BYTE PTR [esi+416], al
  0005c	74 19		 je	 SHORT $L14980

; 893  : 
; 894  :             DISABLE_ALL_INTERRUPTS(Extension->Controller);

  0005e	50		 push	 eax
  0005f	8b 86 98 00 00
	00		 mov	 eax, DWORD PTR [esi+152]
  00065	40		 inc	 eax
  00066	50		 push	 eax
  00067	ff d7		 call	 edi

; 895  :             ENABLE_ALL_INTERRUPTS(Extension->Controller);

  00069	8b 86 98 00 00
	00		 mov	 eax, DWORD PTR [esi+152]
  0006f	6a 0f		 push	 15			; 0000000fH
  00071	40		 inc	 eax
  00072	50		 push	 eax
  00073	ff d7		 call	 edi

; 896  : 
; 897  :         } else {

  00075	eb 0c		 jmp	 SHORT $L14997
$L14980:

; 898  : 
; 899  :             //
; 900  :             // The following routine will lower the rts if we
; 901  :             // are doing transmit toggleing and there is no
; 902  :             // reason to keep it up.
; 903  :             //
; 904  : 
; 905  :             Extension->CountOfTryingToLowerRTS++;

  00077	ff 86 3c 01 00
	00		 inc	 DWORD PTR [esi+316]

; 906  :             SerialPerhapsLowerRTS(Extension);

  0007d	56		 push	 esi
  0007e	e8 00 00 00 00	 call	 _SerialPerhapsLowerRTS@4
$L14997:
  00083	5f		 pop	 edi

; 907  : 
; 908  :         }
; 909  : 
; 910  :     }
; 911  : 
; 912  :     return FALSE;

  00084	32 c0		 xor	 al, al
  00086	5e		 pop	 esi

; 913  : 
; 914  : }

  00087	5d		 pop	 ebp
  00088	c2 04 00	 ret	 4
_SerialTurnOffBreak@4 ENDP
_TEXT	ENDS
PUBLIC	_SerialPretendXoff@4
EXTRN	_SerialInsertQueueDpc@16:NEAR
; Function compile flags: /Ogsy
;	COMDAT _SerialPretendXoff@4
_TEXT	SEGMENT
_Context$ = 8
_SerialPretendXoff@4 PROC NEAR				; COMDAT

; 946  : {

  00000	56		 push	 esi

; 947  : 
; 948  :     PSERIAL_DEVICE_EXTENSION Extension = Context;
; 949  : 
; 950  :     Extension->TXHolding |= SERIAL_TX_XOFF;

  00001	8b 74 24 08	 mov	 esi, DWORD PTR _Context$[esp]

; 951  : 
; 952  :     if ((Extension->HandFlow.FlowReplace & SERIAL_RTS_MASK) ==
; 953  :         SERIAL_TRANSMIT_TOGGLE) {

  00005	8b 86 78 01 00
	00		 mov	 eax, DWORD PTR [esi+376]
  0000b	83 8e 1c 01 00
	00 08		 or	 DWORD PTR [esi+284], 8
  00012	66 25 c0 00	 and	 ax, 192			; 000000c0H
  00016	3c c0		 cmp	 al, 192			; 000000c0H
  00018	75 1b		 jne	 SHORT $L15311

; 954  : 
; 955  :         SerialInsertQueueDpc(
; 956  :             &Extension->StartTimerLowerRTSDpc,
; 957  :             NULL,
; 958  :             NULL,
; 959  :             Extension
; 960  :             )?Extension->CountOfTryingToLowerRTS++:0;

  0001a	56		 push	 esi
  0001b	6a 00		 push	 0
  0001d	8d 86 4c 03 00
	00		 lea	 eax, DWORD PTR [esi+844]
  00023	6a 00		 push	 0
  00025	50		 push	 eax
  00026	e8 00 00 00 00	 call	 _SerialInsertQueueDpc@16
  0002b	84 c0		 test	 al, al
  0002d	74 06		 je	 SHORT $L15311
  0002f	ff 86 3c 01 00
	00		 inc	 DWORD PTR [esi+316]
$L15311:

; 961  : 
; 962  :     }
; 963  : 
; 964  :     return FALSE;

  00035	32 c0		 xor	 al, al
  00037	5e		 pop	 esi

; 965  : 
; 966  : }

  00038	c2 04 00	 ret	 4
_SerialPretendXoff@4 ENDP
_TEXT	ENDS
PUBLIC	_SerialPretendXon@4
; Function compile flags: /Ogsy
;	COMDAT _SerialPretendXon@4
_TEXT	SEGMENT
_Context$ = 8
_SerialPretendXon@4 PROC NEAR				; COMDAT

; 995  : 
; 996  :     PSERIAL_DEVICE_EXTENSION Extension = Context;
; 997  : 
; 998  :     if (Extension->TXHolding) {

  00000	8b 44 24 04	 mov	 eax, DWORD PTR _Context$[esp-4]
  00004	8d 88 1c 01 00
	00		 lea	 ecx, DWORD PTR [eax+284]
  0000a	8b 11		 mov	 edx, DWORD PTR [ecx]
  0000c	85 d2		 test	 edx, edx
  0000e	74 42		 je	 SHORT $L15025

; 999  : 
; 1000 :         //
; 1001 :         // We actually have a good reason for testing if transmission
; 1002 :         // is holding instead of blindly clearing the bit.
; 1003 :         //
; 1004 :         // If transmission actually was holding and the result of
; 1005 :         // clearing the bit is that we should restart transmission
; 1006 :         // then we will poke the interrupt enable bit, which will
; 1007 :         // cause an actual interrupt and transmission will then
; 1008 :         // restart on its own.
; 1009 :         //
; 1010 :         // If transmission wasn't holding and we poked the bit
; 1011 :         // then we would interrupt before a character actually made
; 1012 :         // it out and we could end up over writing a character in
; 1013 :         // the transmission hardware.
; 1014 : 
; 1015 :         Extension->TXHolding &= ~SERIAL_TX_XOFF;

  00010	83 e2 f7	 and	 edx, -9			; fffffff7H
  00013	89 11		 mov	 DWORD PTR [ecx], edx

; 1016 : 
; 1017 :         if (!Extension->TXHolding &&
; 1018 :             (Extension->TransmitImmediate ||
; 1019 :              Extension->WriteLength) &&
; 1020 :              Extension->HoldingEmpty) {

  00015	75 3b		 jne	 SHORT $L15025
  00017	80 b8 a1 01 00
	00 00		 cmp	 BYTE PTR [eax+417], 0
  0001e	75 09		 jne	 SHORT $L15015
  00020	83 b8 e0 00 00
	00 00		 cmp	 DWORD PTR [eax+224], 0
  00027	74 29		 je	 SHORT $L15025
$L15015:
  00029	80 b8 a0 01 00
	00 00		 cmp	 BYTE PTR [eax+416], 0
  00030	74 20		 je	 SHORT $L15025
  00032	56		 push	 esi

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

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

; 1023 :             ENABLE_ALL_INTERRUPTS(Extension->Controller);

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

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

  00052	32 c0		 xor	 al, al

; 1030 : 
; 1031 : }

  00054	c2 04 00	 ret	 4
_SerialPretendXon@4 ENDP
_TEXT	ENDS
PUBLIC	_SerialHandleReducedIntBuffer@4
; Function compile flags: /Ogsy
;	COMDAT _SerialHandleReducedIntBuffer@4
_TEXT	SEGMENT
_Extension$ = 8
_SerialHandleReducedIntBuffer@4 PROC NEAR		; COMDAT

; 1059 : {

  00000	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) {

  00001	8b 74 24 08	 mov	 esi, DWORD PTR _Extension$[esp]
  00005	8b 86 20 01 00
	00		 mov	 eax, DWORD PTR [esi+288]
  0000b	85 c0		 test	 eax, eax
  0000d	74 49		 je	 SHORT $L15044

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

  0000f	8b 8e f0 00 00
	00		 mov	 ecx, DWORD PTR [esi+240]
  00015	3b 8e 7c 01 00
	00		 cmp	 ecx, DWORD PTR [esi+380]
  0001b	77 3b		 ja	 SHORT $L15044

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

  0001d	a8 01		 test	 al, 1
  0001f	74 0e		 je	 SHORT $L15038

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

  00021	24 fe		 and	 al, -2			; fffffffeH

; 1077 :                 SerialSetDTR(Extension);

  00023	56		 push	 esi
  00024	89 86 20 01 00
	00		 mov	 DWORD PTR [esi+288], eax
  0002a	e8 00 00 00 00	 call	 _SerialSetDTR@4
$L15038:

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

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

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

  00039	24 fb		 and	 al, -5			; fffffffbH

; 1084 :                 SerialSetRTS(Extension);

  0003b	56		 push	 esi
  0003c	89 86 20 01 00
	00		 mov	 DWORD PTR [esi+288], eax
  00042	e8 00 00 00 00	 call	 _SerialSetRTS@4
$L15041:

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

  00047	f6 86 20 01 00
	00 02		 test	 BYTE PTR [esi+288], 2
  0004e	74 08		 je	 SHORT $L15044

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

  00050	6a 01		 push	 1
  00052	56		 push	 esi
  00053	e8 00 00 00 00	 call	 _SerialProdXonXoff@8
$L15044:
  00058	5e		 pop	 esi

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

  00059	c2 04 00	 ret	 4
_SerialHandleReducedIntBuffer@4 ENDP
; Function compile flags: /Ogsy
_TEXT	ENDS
;	COMDAT _SerialProdXonXoff@8
_TEXT	SEGMENT
_Extension$ = 8
_SendXon$ = 12
_SerialProdXonXoff@8 PROC NEAR				; COMDAT

; 1138 : {

  00000	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) {

  00001	8b 74 24 08	 mov	 esi, DWORD PTR _Extension$[esp]
  00005	80 be db 01 00
	00 00		 cmp	 BYTE PTR [esi+475], 0
  0000c	75 32		 jne	 SHORT $L15060
  0000e	80 be dc 01 00
	00 00		 cmp	 BYTE PTR [esi+476], 0
  00015	75 29		 jne	 SHORT $L15060
  00017	80 be a0 01 00
	00 00		 cmp	 BYTE PTR [esi+416], 0
  0001e	74 20		 je	 SHORT $L15060
  00020	53		 push	 ebx
  00021	57		 push	 edi

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

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

; 1153 :         ENABLE_ALL_INTERRUPTS(Extension->Controller);

  00036	8b 07		 mov	 eax, DWORD PTR [edi]
  00038	6a 0f		 push	 15			; 0000000fH
  0003a	40		 inc	 eax

⌨️ 快捷键说明

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