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

📄 modmflow.cod

📁 怎样在win2000下构造驱动程序znsoft_Serial2000_demo.ZIP
💻 COD
📖 第 1 页 / 共 5 页
字号:
; 314  :                     // limit.
; 315  :                     //
; 316  : 
; 317  :                     if (Extension->RXHolding & SERIAL_RX_DTR) {

  0004c	8d 8e 20 01 00
	00		 lea	 ecx, DWORD PTR [esi+288]
  00052	8b 01		 mov	 eax, DWORD PTR [ecx]
  00054	a8 01		 test	 al, 1
  00056	74 09		 je	 SHORT $L14839

; 318  : 
; 319  :                         //
; 320  :                         // We can assume that its DTR line is already low.
; 321  :                         //
; 322  : 
; 323  :                         if (Extension->CharsInInterruptBuffer >
; 324  :                             (ULONG)New.XonLimit) {

  00058	3b 55 f8	 cmp	 edx, DWORD PTR _New$[ebp+8]
  0005b	76 39		 jbe	 SHORT $L14859
$L15290:

; 325  : 
; 326  :                             SerialDump(
; 327  :                                 SERFLOW,
; 328  :                                 ("SERIAL: Removing DTR block on reception for %x\n",
; 329  :                                  Extension->Controller)
; 330  :                                 );
; 331  :                             Extension->RXHolding &= ~SERIAL_RX_DTR;

  0005d	24 fe		 and	 al, -2			; fffffffeH
  0005f	89 01		 mov	 DWORD PTR [ecx], eax
$L14839:

; 332  :                             SerialSetDTR(Extension);

  00061	56		 push	 esi
  00062	e8 00 00 00 00	 call	 _SerialSetDTR@4

; 333  : 
; 334  :                         }
; 335  : 
; 336  :                     } else {

  00067	eb 2d		 jmp	 SHORT $L14859
$L14848:

; 337  : 
; 338  :                         SerialSetDTR(Extension);
; 339  : 
; 340  :                     }
; 341  : 
; 342  :                 } else {
; 343  : 
; 344  :                     SerialDump(
; 345  :                         SERFLOW,
; 346  :                         ("SERIAL: Setting DTR block on reception for %x\n",
; 347  :                          Extension->Controller)
; 348  :                         );
; 349  :                     Extension->RXHolding |= SERIAL_RX_DTR;

  00069	83 8e 20 01 00
	00 01		 or	 DWORD PTR [esi+288], 1

; 350  :                     SerialClrDTR(Extension);
; 351  : 
; 352  :                 }
; 353  : 
; 354  :             } else {

  00070	eb 1e		 jmp	 SHORT $L14861
$L14836:

; 355  : 
; 356  :                 //
; 357  :                 // Note that if we aren't currently doing dtr flow control then
; 358  :                 // we MIGHT have been.  So even if we aren't currently doing
; 359  :                 // DTR flow control, we should still check if RX is holding
; 360  :                 // because of DTR.  If it is, then we should clear the holding
; 361  :                 // of this bit.
; 362  :                 //
; 363  : 
; 364  :                 if (Extension->RXHolding & SERIAL_RX_DTR) {

  00072	8d 8e 20 01 00
	00		 lea	 ecx, DWORD PTR [esi+288]
  00078	8b 01		 mov	 eax, DWORD PTR [ecx]
  0007a	a8 01		 test	 al, 1
  0007c	74 e3		 je	 SHORT $L14839

; 365  : 
; 366  :                     SerialDump(
; 367  :                         SERFLOW,
; 368  :                         ("SERIAL: Removing dtr block of reception for %x\n",
; 369  :                         Extension->Controller)
; 370  :                         );
; 371  :                     Extension->RXHolding &= ~SERIAL_RX_DTR;
; 372  : 
; 373  :                 }
; 374  : 
; 375  :                 SerialSetDTR(Extension);
; 376  : 
; 377  :             }
; 378  : 
; 379  :         } else {

  0007e	eb dd		 jmp	 SHORT $L15290
$L14833:

; 380  : 
; 381  :             //
; 382  :             // The end result here will be that DTR is cleared.
; 383  :             //
; 384  :             // We first need to check whether reception is being held
; 385  :             // up because of previous DTR flow control.  If it is then
; 386  :             // we should clear that reason in the RXHolding mask.
; 387  :             //
; 388  : 
; 389  :             if (Extension->RXHolding & SERIAL_RX_DTR) {

  00080	8d 8e 20 01 00
	00		 lea	 ecx, DWORD PTR [esi+288]
  00086	8b 01		 mov	 eax, DWORD PTR [ecx]
  00088	a8 01		 test	 al, 1
  0008a	74 04		 je	 SHORT $L14861

; 390  : 
; 391  :                 SerialDump(
; 392  :                     SERFLOW,
; 393  :                     ("SERIAL: removing dtr block of reception for %x\n",
; 394  :                     Extension->Controller)
; 395  :                     );
; 396  :                 Extension->RXHolding &= ~SERIAL_RX_DTR;

  0008c	24 fe		 and	 al, -2			; fffffffeH
  0008e	89 01		 mov	 DWORD PTR [ecx], eax
$L14861:

; 397  : 
; 398  :             }
; 399  : 
; 400  :             SerialClrDTR(Extension);

  00090	56		 push	 esi
  00091	e8 00 00 00 00	 call	 _SerialClrDTR@4
$L14859:

; 401  : 
; 402  :         }
; 403  : 
; 404  :     }
; 405  : 
; 406  :     //
; 407  :     // Time to take care of the RTS Flow control.
; 408  :     //
; 409  :     // First we only do work if something has changed.
; 410  :     //
; 411  : 
; 412  :     if ((!Extension->DeviceIsOpened) ||
; 413  :         ((Extension->HandFlow.FlowReplace & SERIAL_RTS_MASK) !=
; 414  :          (New.FlowReplace & SERIAL_RTS_MASK))) {

  00096	80 be 9d 01 00
	00 00		 cmp	 BYTE PTR [esi+413], 0
  0009d	8b 5d f4	 mov	 ebx, DWORD PTR _New$[ebp+4]
  000a0	b9 c0 00 00 00	 mov	 ecx, 192		; 000000c0H
  000a5	74 10		 je	 SHORT $L14870
  000a7	8b 86 78 01 00
	00		 mov	 eax, DWORD PTR [esi+376]
  000ad	33 c3		 xor	 eax, ebx
  000af	84 c1		 test	 al, cl
  000b1	0f 84 d9 00 00
	00		 je	 $L14918
$L14870:

; 415  : 
; 416  :         SerialDump(
; 417  :             SERFLOW,
; 418  :             ("SERIAL: Processing RTS flow\n",
; 419  :              Extension->Controller)
; 420  :             );
; 421  : 
; 422  :         if ((New.FlowReplace & SERIAL_RTS_MASK) ==
; 423  :             SERIAL_RTS_HANDSHAKE) {

  000b7	8b c3		 mov	 eax, ebx
  000b9	23 c1		 and	 eax, ecx
  000bb	3d 80 00 00 00	 cmp	 eax, 128		; 00000080H
  000c0	75 43		 jne	 SHORT $L14875

; 424  : 
; 425  :             //
; 426  :             // Well we might want to set RTS.
; 427  :             //
; 428  :             // Before we do, we need to check whether we are doing
; 429  :             // rts flow control.  If we are then we need to check
; 430  :             // if then number of characters in the interrupt buffer
; 431  :             // exceeds the XoffLimit.  If it does then we don't
; 432  :             // enable RTS AND we set the RXHolding to record that
; 433  :             // we are holding because of the rts.
; 434  :             //
; 435  : 
; 436  :             if ((Extension->BufferSize - New.XoffLimit) >
; 437  :                 Extension->CharsInInterruptBuffer) {

  000c2	8b 86 04 01 00
	00		 mov	 eax, DWORD PTR [esi+260]
  000c8	8b 96 f0 00 00
	00		 mov	 edx, DWORD PTR [esi+240]
  000ce	2b 45 fc	 sub	 eax, DWORD PTR _New$[ebp+12]
  000d1	3b c2		 cmp	 eax, edx
  000d3	76 24		 jbe	 SHORT $L14887

; 438  : 
; 439  :                 //
; 440  :                 // However if we are already holding we don't want
; 441  :                 // to turn it back on unless we exceed the Xon
; 442  :                 // limit.
; 443  :                 //
; 444  : 
; 445  :                 if (Extension->RXHolding & SERIAL_RX_RTS) {

  000d5	8d 8e 20 01 00
	00		 lea	 ecx, DWORD PTR [esi+288]
  000db	8b 01		 mov	 eax, DWORD PTR [ecx]
  000dd	a8 04		 test	 al, 4
  000df	74 0d		 je	 SHORT $L14878

; 446  : 
; 447  :                     //
; 448  :                     // We can assume that its RTS line is already low.
; 449  :                     //
; 450  : 
; 451  :                     if (Extension->CharsInInterruptBuffer >
; 452  :                         (ULONG)New.XonLimit) {

  000e1	3b 55 f8	 cmp	 edx, DWORD PTR _New$[ebp+8]
  000e4	0f 86 a6 00 00
	00		 jbe	 $L14918
$L15292:

; 453  : 
; 454  :                        SerialDump(
; 455  :                            SERFLOW,
; 456  :                            ("SERIAL: Removing rts block of reception for %x\n",
; 457  :                            Extension->Controller)
; 458  :                            );
; 459  :                         Extension->RXHolding &= ~SERIAL_RX_RTS;

  000ea	24 fb		 and	 al, -5			; fffffffbH
  000ec	89 01		 mov	 DWORD PTR [ecx], eax
$L14878:

; 460  :                         SerialSetRTS(Extension);
; 461  : 
; 462  :                     }
; 463  : 
; 464  :                 } else {
; 465  : 
; 466  :                     SerialSetRTS(Extension);

  000ee	56		 push	 esi
  000ef	e8 00 00 00 00	 call	 _SerialSetRTS@4

; 467  : 
; 468  :                 }
; 469  : 
; 470  :             } else {

  000f4	e9 97 00 00 00	 jmp	 $L14918
$L14887:

; 471  : 
; 472  :                 SerialDump(
; 473  :                     SERFLOW,
; 474  :                     ("SERIAL: Setting rts block of reception for %x\n",
; 475  :                     Extension->Controller)
; 476  :                     );
; 477  :                 Extension->RXHolding |= SERIAL_RX_RTS;

  000f9	83 8e 20 01 00
	00 04		 or	 DWORD PTR [esi+288], 4

; 478  :                 SerialClrRTS(Extension);
; 479  : 
; 480  :             }
; 481  : 
; 482  :         } else if ((New.FlowReplace & SERIAL_RTS_MASK) ==

  00100	e9 85 00 00 00	 jmp	 $L14920
$L14875:

; 483  :                    SERIAL_RTS_CONTROL) {

  00105	83 f8 40	 cmp	 eax, 64			; 00000040H
  00108	75 0e		 jne	 SHORT $L14894

; 484  : 
; 485  :             //
; 486  :             // Note that if we aren't currently doing rts flow control then
; 487  :             // we MIGHT have been.  So even if we aren't currently doing
; 488  :             // RTS flow control, we should still check if RX is holding
; 489  :             // because of RTS.  If it is, then we should clear the holding
; 490  :             // of this bit.
; 491  :             //
; 492  : 
; 493  :             if (Extension->RXHolding & SERIAL_RX_RTS) {

  0010a	8d 8e 20 01 00
	00		 lea	 ecx, DWORD PTR [esi+288]
  00110	8b 01		 mov	 eax, DWORD PTR [ecx]
  00112	a8 04		 test	 al, 4
  00114	74 d8		 je	 SHORT $L14878

; 494  : 
; 495  :                 SerialDump(
; 496  :                     SERFLOW,
; 497  :                     ("SERIAL: Clearing rts block of reception for %x\n",
; 498  :                     Extension->Controller)
; 499  :                     );
; 500  :                 Extension->RXHolding &= ~SERIAL_RX_RTS;
; 501  : 
; 502  :             }
; 503  : 
; 504  :             SerialSetRTS(Extension);
; 505  : 
; 506  :         } else if ((New.FlowReplace & SERIAL_RTS_MASK) ==

  00116	eb d2		 jmp	 SHORT $L15292
$L14894:

; 507  :                    SERIAL_TRANSMIT_TOGGLE) {

  00118	3b c1		 cmp	 eax, ecx
  0011a	75 5e		 jne	 SHORT $L14904

; 508  : 
; 509  :             //
; 510  :             // We first need to check whether reception is being held
; 511  :             // up because of previous RTS flow control.  If it is then
; 512  :             // we should clear that reason in the RXHolding mask.
; 513  :             //
; 514  : 
; 515  :             if (Extension->RXHolding & SERIAL_RX_RTS) {

  0011c	8d 96 20 01 00
	00		 lea	 edx, DWORD PTR [esi+288]
  00122	8b 02		 mov	 eax, DWORD PTR [edx]
  00124	a8 04		 test	 al, 4
  00126	74 04		 je	 SHORT $L14906

; 516  : 
; 517  :                 SerialDump(
; 518  :                     SERFLOW,
; 519  :                     ("SERIAL: TOGGLE Clearing rts block of reception for %x\n",
; 520  :                     Extension->Controller)
; 521  :                     );
; 522  :                 Extension->RXHolding &= ~SERIAL_RX_RTS;

  00128	24 fb		 and	 al, -5			; fffffffbH
  0012a	89 02		 mov	 DWORD PTR [edx], eax
$L14906:

; 523  : 
; 524  :             }
; 525  : 
; 526  :             //
; 527  :             // We have to place the rts value into the Extension
; 528  :             // now so that the code that tests whether the
; 529  :             // rts line should be lowered will find that we
; 530  :             // are "still" doing transmit toggling.  The code
; 531  :             // for lowering can be invoked later by a timer so
; 532  :             // it has to test whether it still needs to do its
; 533  :             // work.
; 534  :             //
; 535  : 
; 536  :             Extension->HandFlow.FlowReplace &= ~SERIAL_RTS_MASK;
; 537  :             Extension->HandFlow.FlowReplace |= SERIAL_TRANSMIT_TOGGLE;

  0012c	09 8e 78 01 00
	00		 or	 DWORD PTR [esi+376], ecx

; 538  : 
; 539  :             //
; 540  :             // The order of the tests is very important below.
; 541  :             //
; 542  :             // If there is a break then we should turn on the RTS.
; 543  :             //
; 544  :             // If there isn't a break but there are characters in
; 545  :             // the hardware, then turn on the RTS.
; 546  :             //
; 547  :             // If there are writes pending that aren't being held
; 548  :             // up, then turn on the RTS.
; 549  :             //
; 550  : 
; 551  :             if ((Extension->TXHolding & SERIAL_TX_BREAK) ||
; 552  :                 ((SerialProcessLSR(Extension) & (SERIAL_LSR_THRE |
; 553  :                                                  SERIAL_LSR_TEMT)) !=
; 554  :                                                 (SERIAL_LSR_THRE |
; 555  :                                                  SERIAL_LSR_TEMT)) ||
; 556  :                 (Extension->CurrentWriteIrp || Extension->TransmitImmediate ||
; 557  :                  (!IsListEmpty(&Extension->WriteQueue)) &&
; 558  :                  (!Extension->TXHolding))) {

  00132	f6 86 1c 01 00
	00 10		 test	 BYTE PTR [esi+284], 16	; 00000010H
  00139	75 b3		 jne	 SHORT $L14878
  0013b	56		 push	 esi
  0013c	e8 00 00 00 00	 call	 _SerialProcessLSR@4
  00141	24 60		 and	 al, 96			; 00000060H
  00143	3c 60		 cmp	 al, 96			; 00000060H
  00145	75 a7		 jne	 SHORT $L14878
  00147	83 be c8 00 00
	00 00		 cmp	 DWORD PTR [esi+200], 0
  0014e	75 9e		 jne	 SHORT $L14878
  00150	80 be a1 01 00
	00 00		 cmp	 BYTE PTR [esi+417], 0
  00157	75 95		 jne	 SHORT $L14878
  00159	8d 86 ac 00 00
	00		 lea	 eax, DWORD PTR [esi+172]
  0015f	39 00		 cmp	 DWORD PTR [eax], eax
  00161	74 09		 je	 SHORT $L14914
  00163	83 be 1c 01 00
	00 00		 cmp	 DWORD PTR [esi+284], 0
  0016a	74 82		 je	 SHORT $L14878
$L14914:

; 559  : 
; 560  :                 SerialSetRTS(Extension);
; 561  : 
; 562  :             } else {
; 563  : 
; 564  :                 //
; 565  :                 // This routine will check to see if it is time
; 566  :                 // to lower the RTS because of transmit toggle
; 567  :                 // being on.  If it is ok to lower it, it will,
; 568  :                 // if it isn't ok, it will schedule things so
; 569  :                 // that it will get lowered later.
; 570  :                 //
; 571  : 
; 572  :                 Extension->CountOfTryingToLowerRTS++;

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

; 573  :                 SerialPerhapsLowerRTS(Extension);

  00172	56		 push	 esi
  00173	e8 00 00 00 00	 call	 _SerialPerhapsLowerRTS@4
  00178	eb 16		 jmp	 SHORT $L14918
$L14904:

; 574  : 
; 575  :             }
; 576  : 

⌨️ 快捷键说明

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