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

📄 modmflow.cod

📁 怎样在win2000下构造驱动程序znsoft_Serial2000_demo.ZIP
💻 COD
📖 第 1 页 / 共 5 页
字号:
; 577  :         } else {
; 578  : 
; 579  :             //
; 580  :             // The end result here will be that RTS is cleared.
; 581  :             //
; 582  :             // We first need to check whether reception is being held
; 583  :             // up because of previous RTS flow control.  If it is then
; 584  :             // we should clear that reason in the RXHolding mask.
; 585  :             //
; 586  : 
; 587  :             if (Extension->RXHolding & SERIAL_RX_RTS) {

  0017a	8d 8e 20 01 00
	00		 lea	 ecx, DWORD PTR [esi+288]
  00180	8b 01		 mov	 eax, DWORD PTR [ecx]
  00182	a8 04		 test	 al, 4
  00184	74 04		 je	 SHORT $L14920

; 588  : 
; 589  :                 SerialDump(
; 590  :                     SERFLOW,
; 591  :                     ("SERIAL: Clearing rts block of reception for %x\n",
; 592  :                     Extension->Controller)
; 593  :                     );
; 594  :                 Extension->RXHolding &= ~SERIAL_RX_RTS;

  00186	24 fb		 and	 al, -5			; fffffffbH
  00188	89 01		 mov	 DWORD PTR [ecx], eax
$L14920:

; 595  : 
; 596  :             }
; 597  : 
; 598  :             SerialClrRTS(Extension);

  0018a	56		 push	 esi
  0018b	e8 00 00 00 00	 call	 _SerialClrRTS@4
$L14918:

; 599  : 
; 600  :         }
; 601  : 
; 602  :     }
; 603  : 
; 604  :     //
; 605  :     // We now take care of automatic receive flow control.
; 606  :     // We only do work if things have changed.
; 607  :     //
; 608  : 
; 609  :     if ((!Extension->DeviceIsOpened) ||
; 610  :         ((Extension->HandFlow.FlowReplace & SERIAL_AUTO_RECEIVE) !=
; 611  :          (New.FlowReplace & SERIAL_AUTO_RECEIVE))) {

  00190	80 be 9d 01 00
	00 00		 cmp	 BYTE PTR [esi+413], 0
  00197	74 0c		 je	 SHORT $L14928
  00199	8b 86 78 01 00
	00		 mov	 eax, DWORD PTR [esi+376]
  0019f	33 c3		 xor	 eax, ebx
  001a1	a8 02		 test	 al, 2
  001a3	74 39		 je	 SHORT $L14935
$L14928:

; 612  : 
; 613  :         if (New.FlowReplace & SERIAL_AUTO_RECEIVE) {

  001a5	f6 c3 02	 test	 bl, 2
  001a8	74 1c		 je	 SHORT $L14930

; 614  : 
; 615  :             //
; 616  :             // We wouldn't be here if it had been on before.
; 617  :             //
; 618  :             // We should check to see whether we exceed the turn
; 619  :             // off limits.
; 620  :             //
; 621  :             // Note that since we are following the OS/2 flow
; 622  :             // control rules we will never send an xon if
; 623  :             // when enabling xon/xoff flow control we discover that
; 624  :             // we could receive characters but we are held up do
; 625  :             // to a previous Xoff.
; 626  :             //
; 627  : 
; 628  :             if ((Extension->BufferSize - New.XoffLimit) <=
; 629  :                 Extension->CharsInInterruptBuffer) {

  001aa	8b 86 04 01 00
	00		 mov	 eax, DWORD PTR [esi+260]
  001b0	2b 45 fc	 sub	 eax, DWORD PTR _New$[ebp+12]
  001b3	3b 86 f0 00 00
	00		 cmp	 eax, DWORD PTR [esi+240]
  001b9	77 23		 ja	 SHORT $L14935

; 630  : 
; 631  :                 //
; 632  :                 // Cause the Xoff to be sent.
; 633  :                 //
; 634  : 
; 635  :                 Extension->RXHolding |= SERIAL_RX_XOFF;

  001bb	83 8e 20 01 00
	00 02		 or	 DWORD PTR [esi+288], 2

; 636  : 
; 637  :                 SerialProdXonXoff(
; 638  :                     Extension,
; 639  :                     FALSE
; 640  :                     );

  001c2	6a 00		 push	 0

; 641  : 
; 642  :             }
; 643  : 
; 644  :         } else {

  001c4	eb 12		 jmp	 SHORT $L15291
$L14930:

; 645  : 
; 646  :             //
; 647  :             // The app has disabled automatic receive flow control.
; 648  :             //
; 649  :             // If transmission was being held up because of
; 650  :             // an automatic receive Xoff, then we should
; 651  :             // cause an Xon to be sent.
; 652  :             //
; 653  : 
; 654  :             if (Extension->RXHolding & SERIAL_RX_XOFF) {

  001c6	8d 8e 20 01 00
	00		 lea	 ecx, DWORD PTR [esi+288]
  001cc	8b 01		 mov	 eax, DWORD PTR [ecx]
  001ce	a8 02		 test	 al, 2
  001d0	74 0c		 je	 SHORT $L14935

; 655  : 
; 656  :                 Extension->RXHolding &= ~SERIAL_RX_XOFF;

  001d2	24 fd		 and	 al, -3			; fffffffdH

; 657  : 
; 658  :                 //
; 659  :                 // Cause the Xon to be sent.
; 660  :                 //
; 661  : 
; 662  :                 SerialProdXonXoff(
; 663  :                     Extension,
; 664  :                     TRUE
; 665  :                     );

  001d4	6a 01		 push	 1
  001d6	89 01		 mov	 DWORD PTR [ecx], eax
$L15291:
  001d8	56		 push	 esi
  001d9	e8 00 00 00 00	 call	 _SerialProdXonXoff@8
$L14935:

; 666  : 
; 667  :             }
; 668  : 
; 669  :         }
; 670  : 
; 671  :     }
; 672  : 
; 673  :     //
; 674  :     // We now take care of automatic transmit flow control.
; 675  :     // We only do work if things have changed.
; 676  :     //
; 677  : 
; 678  :     if ((!Extension->DeviceIsOpened) ||
; 679  :         ((Extension->HandFlow.FlowReplace & SERIAL_AUTO_TRANSMIT) !=
; 680  :          (New.FlowReplace & SERIAL_AUTO_TRANSMIT))) {

  001de	80 be 9d 01 00
	00 00		 cmp	 BYTE PTR [esi+413], 0
  001e5	74 0c		 je	 SHORT $L14940
  001e7	8b 86 78 01 00
	00		 mov	 eax, DWORD PTR [esi+376]
  001ed	33 c3		 xor	 eax, ebx
  001ef	a8 01		 test	 al, 1
  001f1	74 1d		 je	 SHORT $L14945
$L14940:

; 681  : 
; 682  :         if (New.FlowReplace & SERIAL_AUTO_TRANSMIT) {

  001f3	f6 c3 01	 test	 bl, 1
  001f6	75 18		 jne	 SHORT $L14945

; 683  : 
; 684  :             //
; 685  :             // We wouldn't be here if it had been on before.
; 686  :             //
; 687  :             // BUG BUG ??? There is some belief that if autotransmit
; 688  :             // was just enabled, I should go look in what we
; 689  :             // already received, and if we find the xoff character
; 690  :             // then we should stop transmitting.  I think this
; 691  :             // is an application bug.  For now we just care about
; 692  :             // what we see in the future.
; 693  :             //
; 694  : 
; 695  :             ;
; 696  : 
; 697  :         } else {
; 698  : 
; 699  :             //
; 700  :             // The app has disabled automatic transmit flow control.
; 701  :             //
; 702  :             // If transmission was being held up because of
; 703  :             // an automatic transmit Xoff, then we should
; 704  :             // cause an Xon to be sent.
; 705  :             //
; 706  : 
; 707  :             if (Extension->TXHolding & SERIAL_TX_XOFF) {

  001f8	8d 8e 1c 01 00
	00		 lea	 ecx, DWORD PTR [esi+284]
  001fe	8b 01		 mov	 eax, DWORD PTR [ecx]
  00200	a8 08		 test	 al, 8
  00202	74 0c		 je	 SHORT $L14945

; 708  : 
; 709  :                 Extension->TXHolding &= ~SERIAL_TX_XOFF;

  00204	24 f7		 and	 al, -9			; fffffff7H

; 710  : 
; 711  :                 //
; 712  :                 // Cause the Xon to be sent.
; 713  :                 //
; 714  : 
; 715  :                 SerialProdXonXoff(
; 716  :                     Extension,
; 717  :                     TRUE
; 718  :                     );

  00206	6a 01		 push	 1
  00208	56		 push	 esi
  00209	89 01		 mov	 DWORD PTR [ecx], eax
  0020b	e8 00 00 00 00	 call	 _SerialProdXonXoff@8
$L14945:

; 719  : 
; 720  :             }
; 721  : 
; 722  :         }
; 723  : 
; 724  :     }
; 725  : 
; 726  :     //
; 727  :     // At this point we can simply make sure that entire
; 728  :     // handflow structure in the extension is updated.
; 729  :     //
; 730  : 
; 731  :     Extension->HandFlow = New;

  00210	8d be 74 01 00
	00		 lea	 edi, DWORD PTR [esi+372]
  00216	8d 75 f0	 lea	 esi, DWORD PTR _New$[ebp]
  00219	a5		 movsd
  0021a	a5		 movsd
  0021b	a5		 movsd
  0021c	a5		 movsd
  0021d	5f		 pop	 edi
  0021e	5e		 pop	 esi

; 732  : 
; 733  :     return FALSE;

  0021f	32 c0		 xor	 al, al
  00221	5b		 pop	 ebx

; 734  : 
; 735  : }

  00222	c9		 leave
  00223	c2 08 00	 ret	 8
_SerialSetupNewHandFlow@8 ENDP
_TEXT	ENDS
PUBLIC	_SerialSetHandFlow@4
PUBLIC	_SerialHandleModemUpdate@8
; Function compile flags: /Ogsy
;	COMDAT _SerialSetHandFlow@4
_TEXT	SEGMENT
_Context$ = 8
_SerialSetHandFlow@4 PROC NEAR				; COMDAT

; 762  : 
; 763  :     PSERIAL_IOCTL_SYNC S = Context;
; 764  :     PSERIAL_DEVICE_EXTENSION Extension = S->Extension;

  00000	8b 44 24 04	 mov	 eax, DWORD PTR _Context$[esp-4]
  00004	56		 push	 esi

; 765  :     PSERIAL_HANDFLOW HandFlow = S->Data;
; 766  : 
; 767  :     SerialSetupNewHandFlow(
; 768  :         Extension,
; 769  :         HandFlow
; 770  :         );

  00005	ff 70 04	 push	 DWORD PTR [eax+4]
  00008	8b 30		 mov	 esi, DWORD PTR [eax]
  0000a	56		 push	 esi
  0000b	e8 00 00 00 00	 call	 _SerialSetupNewHandFlow@8

; 771  : 
; 772  :     SerialHandleModemUpdate(
; 773  :         Extension,
; 774  :         FALSE
; 775  :         );

  00010	6a 00		 push	 0
  00012	56		 push	 esi
  00013	e8 00 00 00 00	 call	 _SerialHandleModemUpdate@8

; 776  : 
; 777  :     return FALSE;

  00018	32 c0		 xor	 al, al
  0001a	5e		 pop	 esi

; 778  : 
; 779  : }

  0001b	c2 04 00	 ret	 4
_SerialSetHandFlow@4 ENDP
_TEXT	ENDS
PUBLIC	_SerialTurnOnBreak@4
; Function compile flags: /Ogsy
;	COMDAT _SerialTurnOnBreak@4
_TEXT	SEGMENT
_Context$ = 8
_OldLineControl$ = 8
_SerialTurnOnBreak@4 PROC NEAR				; COMDAT

; 804  : {

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

; 805  : 
; 806  :     PSERIAL_DEVICE_EXTENSION Extension = Context;
; 807  : 
; 808  :     UCHAR OldLineControl;
; 809  : 
; 810  :     if ((Extension->HandFlow.FlowReplace & SERIAL_RTS_MASK) ==
; 811  :         SERIAL_TRANSMIT_TOGGLE) {

  00004	8b 75 08	 mov	 esi, DWORD PTR _Context$[ebp]
  00007	57		 push	 edi
  00008	8b 86 78 01 00
	00		 mov	 eax, DWORD PTR [esi+376]
  0000e	66 25 c0 00	 and	 ax, 192			; 000000c0H
  00012	3c c0		 cmp	 al, 192			; 000000c0H
  00014	75 06		 jne	 SHORT $L14960

; 812  : 
; 813  :         SerialSetRTS(Extension);

  00016	56		 push	 esi
  00017	e8 00 00 00 00	 call	 _SerialSetRTS@4
$L14960:

; 814  : 
; 815  :     }
; 816  : 
; 817  :     OldLineControl = READ_LINE_CONTROL(Extension->Controller);

  0001c	8d be 98 00 00
	00		 lea	 edi, DWORD PTR [esi+152]
  00022	8b 07		 mov	 eax, DWORD PTR [edi]
  00024	83 c0 03	 add	 eax, 3
  00027	50		 push	 eax
  00028	ff 15 00 00 00
	00		 call	 DWORD PTR __imp__READ_PORT_UCHAR@4

; 818  : 
; 819  :     OldLineControl |= SERIAL_LCR_BREAK;

  0002e	0c 40		 or	 al, 64			; 00000040H
  00030	88 45 08	 mov	 BYTE PTR _OldLineControl$[ebp], al

; 820  : 
; 821  :     WRITE_LINE_CONTROL(
; 822  :         Extension->Controller,
; 823  :         OldLineControl
; 824  :         );

  00033	8b 07		 mov	 eax, DWORD PTR [edi]
  00035	ff 75 08	 push	 DWORD PTR _OldLineControl$[ebp]
  00038	83 c0 03	 add	 eax, 3
  0003b	50		 push	 eax
  0003c	ff 15 00 00 00
	00		 call	 DWORD PTR __imp__WRITE_PORT_UCHAR@8

; 825  : 
; 826  :     Extension->TXHolding |= SERIAL_TX_BREAK;

  00042	83 8e 1c 01 00
	00 10		 or	 DWORD PTR [esi+284], 16	; 00000010H
  00049	5f		 pop	 edi

; 827  : 
; 828  :     return FALSE;

  0004a	32 c0		 xor	 al, al
  0004c	5e		 pop	 esi

; 829  : 
; 830  : }

  0004d	5d		 pop	 ebp
  0004e	c2 04 00	 ret	 4
_SerialTurnOnBreak@4 ENDP
_TEXT	ENDS
PUBLIC	_SerialTurnOffBreak@4
; Function compile flags: /Ogsy
;	COMDAT _SerialTurnOffBreak@4
_TEXT	SEGMENT
_Context$ = 8
_OldLineControl$ = 8
_SerialTurnOffBreak@4 PROC NEAR				; COMDAT

; 855  : {

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

; 856  : 
; 857  :     PSERIAL_DEVICE_EXTENSION Extension = Context;
; 858  : 
; 859  :     UCHAR OldLineControl;
; 860  : 
; 861  :     if (Extension->TXHolding & SERIAL_TX_BREAK) {

  00004	8b 75 08	 mov	 esi, DWORD PTR _Context$[ebp]
  00007	57		 push	 edi
  00008	f6 86 1c 01 00
	00 10		 test	 BYTE PTR [esi+284], 16	; 00000010H
  0000f	74 72		 je	 SHORT $L14997

; 862  : 
; 863  :         //
; 864  :         // We actually have a good reason for testing if transmission
; 865  :         // is holding instead of blindly clearing the bit.
; 866  :         //
; 867  :         // If transmission actually was holding and the result of
; 868  :         // clearing the bit is that we should restart transmission
; 869  :         // then we will poke the interrupt enable bit, which will
; 870  :         // cause an actual interrupt and transmission will then
; 871  :         // restart on its own.
; 872  :         //

⌨️ 快捷键说明

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