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

📄 modmflow.cod

📁 怎样在win2000下构造驱动程序znsoft_Serial2000_demo.ZIP
💻 COD
📖 第 1 页 / 共 5 页
字号:
; 273  :     // If that is so, then we always proceed with the work regardless
; 274  :     // of whether things have changed.
; 275  :     //
; 276  : 
; 277  :     //
; 278  :     // First we take care of the DTR flow control.  We only
; 279  :     // do work if something has changed.
; 280  :     //
; 281  : 
; 282  :     if ((!Extension->DeviceIsOpened) ||
; 283  :         ((Extension->HandFlow.ControlHandShake & SERIAL_DTR_MASK) !=
; 284  :          (New.ControlHandShake & SERIAL_DTR_MASK))) {

  0020f	8b 75 08	 mov	 esi, DWORD PTR _Extension$[ebp]
  00212	80 be 9d 01 00
	00 00		 cmp	 BYTE PTR [esi+413], 0
  00219	74 11		 je	 SHORT $L14907
  0021b	8b 86 74 01 00
	00		 mov	 eax, DWORD PTR [esi+372]
  00221	33 45 f0	 xor	 eax, DWORD PTR _New$[ebp]
  00224	a8 03		 test	 al, 3
  00226	0f 84 f9 00 00
	00		 je	 $L14977
$L14907:

; 285  : 
; 286  :         SerialDump(
; 287  :             SERFLOW,
; 288  :             ("SERIAL: Processing DTR flow for %x\n",
; 289  :              Extension->Controller)
; 290  :             );

  0022c	bb 00 00 00 20	 mov	 ebx, 536870912		; 20000000H
  00231	85 1d 00 00 00
	00		 test	 DWORD PTR _SerialDebugLevel, ebx
  00237	74 12		 je	 SHORT $L14908
  00239	ff b6 98 00 00
	00		 push	 DWORD PTR [esi+152]
  0023f	68 00 00 00 00	 push	 OFFSET FLAT:$SG14913
  00244	e8 00 00 00 00	 call	 _DbgPrint
  00249	59		 pop	 ecx
  0024a	59		 pop	 ecx
$L14908:

; 291  : 
; 292  :         if (New.ControlHandShake & SERIAL_DTR_MASK) {

  0024b	8b 45 f0	 mov	 eax, DWORD PTR _New$[ebp]
  0024e	83 e0 03	 and	 eax, 3
  00251	0f 84 a0 00 00
	00		 je	 $L14921

; 293  : 
; 294  :             //
; 295  :             // Well we might want to set DTR.
; 296  :             //
; 297  :             // Before we do, we need to check whether we are doing
; 298  :             // dtr flow control.  If we are then we need to check
; 299  :             // if then number of characters in the interrupt buffer
; 300  :             // exceeds the XoffLimit.  If it does then we don't
; 301  :             // enable DTR AND we set the RXHolding to record that
; 302  :             // we are holding because of the dtr.
; 303  :             //
; 304  : 
; 305  :             if ((New.ControlHandShake & SERIAL_DTR_MASK)
; 306  :                 == SERIAL_DTR_HANDSHAKE) {

  00257	83 f8 02	 cmp	 eax, 2
  0025a	75 71		 jne	 SHORT $L14924

; 307  : 
; 308  :                 if ((Extension->BufferSize - New.XoffLimit) >
; 309  :                     Extension->CharsInInterruptBuffer) {

  0025c	8b 8e 04 01 00
	00		 mov	 ecx, DWORD PTR [esi+260]
  00262	8b 86 f0 00 00
	00		 mov	 eax, DWORD PTR [esi+240]
  00268	2b 4d fc	 sub	 ecx, DWORD PTR _New$[ebp+12]
  0026b	3b c8		 cmp	 ecx, eax
  0026d	76 3b		 jbe	 SHORT $L14946

; 310  : 
; 311  :                     //
; 312  :                     // However if we are already holding we don't want
; 313  :                     // to turn it back on unless we exceed the Xon
; 314  :                     // limit.
; 315  :                     //
; 316  : 
; 317  :                     if (Extension->RXHolding & SERIAL_RX_DTR) {

  0026f	f6 86 20 01 00
	00 01		 test	 BYTE PTR [esi+288], 1
  00276	74 2a		 je	 SHORT $L14927

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

  00278	3b 45 f8	 cmp	 eax, DWORD PTR _New$[ebp+8]
  0027b	0f 86 a4 00 00
	00		 jbe	 $L14977

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

  00281	85 1d 00 00 00
	00		 test	 DWORD PTR _SerialDebugLevel, ebx
  00287	74 12		 je	 SHORT $L14931
  00289	ff b6 98 00 00
	00		 push	 DWORD PTR [esi+152]
  0028f	68 00 00 00 00	 push	 OFFSET FLAT:$SG14936
  00294	e8 00 00 00 00	 call	 _DbgPrint
  00299	59		 pop	 ecx
  0029a	59		 pop	 ecx
$L14931:

; 331  :                             Extension->RXHolding &= ~SERIAL_RX_DTR;

  0029b	83 a6 20 01 00
	00 fe		 and	 DWORD PTR [esi+288], -2	; fffffffeH
$L14927:

; 332  :                             SerialSetDTR(Extension);

  002a2	56		 push	 esi
  002a3	e8 00 00 00 00	 call	 _SerialSetDTR@4

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

  002a8	eb 7b		 jmp	 SHORT $L14977
$L14946:

; 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  :                         );

  002aa	85 1d 00 00 00
	00		 test	 DWORD PTR _SerialDebugLevel, ebx
  002b0	74 12		 je	 SHORT $L14947
  002b2	ff b6 98 00 00
	00		 push	 DWORD PTR [esi+152]
  002b8	68 00 00 00 00	 push	 OFFSET FLAT:$SG14952
  002bd	e8 00 00 00 00	 call	 _DbgPrint
  002c2	59		 pop	 ecx
  002c3	59		 pop	 ecx
$L14947:

; 349  :                     Extension->RXHolding |= SERIAL_RX_DTR;

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

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

  002cb	eb 52		 jmp	 SHORT $L14979
$L14924:

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

  002cd	8d be 20 01 00
	00		 lea	 edi, DWORD PTR [esi+288]
  002d3	f6 07 01	 test	 BYTE PTR [edi], 1
  002d6	74 ca		 je	 SHORT $L14927

; 365  : 
; 366  :                     SerialDump(
; 367  :                         SERFLOW,
; 368  :                         ("SERIAL: Removing dtr block of reception for %x\n",
; 369  :                         Extension->Controller)
; 370  :                         );

  002d8	85 1d 00 00 00
	00		 test	 DWORD PTR _SerialDebugLevel, ebx
  002de	74 12		 je	 SHORT $L14964
  002e0	ff b6 98 00 00
	00		 push	 DWORD PTR [esi+152]
  002e6	68 00 00 00 00	 push	 OFFSET FLAT:$SG14969
  002eb	e8 00 00 00 00	 call	 _DbgPrint
  002f0	59		 pop	 ecx
  002f1	59		 pop	 ecx
$L14964:

; 371  :                     Extension->RXHolding &= ~SERIAL_RX_DTR;

  002f2	83 27 fe	 and	 DWORD PTR [edi], -2	; fffffffeH

; 372  : 
; 373  :                 }
; 374  : 
; 375  :                 SerialSetDTR(Extension);
; 376  : 
; 377  :             }
; 378  : 
; 379  :         } else {

  002f5	eb ab		 jmp	 SHORT $L14927
$L14921:

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

  002f7	8d be 20 01 00
	00		 lea	 edi, DWORD PTR [esi+288]
  002fd	f6 07 01	 test	 BYTE PTR [edi], 1
  00300	74 1d		 je	 SHORT $L14979

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

  00302	85 1d 00 00 00
	00		 test	 DWORD PTR _SerialDebugLevel, ebx
  00308	74 12		 je	 SHORT $L14981
  0030a	ff b6 98 00 00
	00		 push	 DWORD PTR [esi+152]
  00310	68 00 00 00 00	 push	 OFFSET FLAT:$SG14986
  00315	e8 00 00 00 00	 call	 _DbgPrint
  0031a	59		 pop	 ecx
  0031b	59		 pop	 ecx
$L14981:

; 396  :                 Extension->RXHolding &= ~SERIAL_RX_DTR;

  0031c	83 27 fe	 and	 DWORD PTR [edi], -2	; fffffffeH
$L14979:

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

  0031f	56		 push	 esi
  00320	e8 00 00 00 00	 call	 _SerialClrDTR@4
$L14977:

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

  00325	80 be 9d 01 00
	00 00		 cmp	 BYTE PTR [esi+413], 0
  0032c	bb c0 00 00 00	 mov	 ebx, 192		; 000000c0H
  00331	74 11		 je	 SHORT $L14998
  00333	8b 86 78 01 00
	00		 mov	 eax, DWORD PTR [esi+376]
  00339	33 45 f4	 xor	 eax, DWORD PTR _New$[ebp+4]
  0033c	84 c3		 test	 al, bl
  0033e	0f 84 93 01 00
	00		 je	 $L15096
$L14998:

; 415  : 
; 416  :         SerialDump(
; 417  :             SERFLOW,
; 418  :             ("SERIAL: Processing RTS flow\n",
; 419  :              Extension->Controller)
; 420  :             );

  00344	bf 00 00 00 20	 mov	 edi, 536870912		; 20000000H
  00349	85 3d 00 00 00
	00		 test	 DWORD PTR _SerialDebugLevel, edi
  0034f	74 12		 je	 SHORT $L14999
  00351	ff b6 98 00 00
	00		 push	 DWORD PTR [esi+152]
  00357	68 00 00 00 00	 push	 OFFSET FLAT:$SG15004
  0035c	e8 00 00 00 00	 call	 _DbgPrint
  00361	59		 pop	 ecx
  00362	59		 pop	 ecx
$L14999:

; 421  : 
; 422  :         if ((New.FlowReplace & SERIAL_RTS_MASK) ==
; 423  :             SERIAL_RTS_HANDSHAKE) {

  00363	8b 45 f4	 mov	 eax, DWORD PTR _New$[ebp+4]
  00366	23 c3		 and	 eax, ebx
  00368	3d 80 00 00 00	 cmp	 eax, 128		; 00000080H
  0036d	75 77		 jne	 SHORT $L15013

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

  0036f	8b 8e 04 01 00
	00		 mov	 ecx, DWORD PTR [esi+260]
  00375	8b 86 f0 00 00
	00		 mov	 eax, DWORD PTR [esi+240]
  0037b	2b 4d fc	 sub	 ecx, DWORD PTR _New$[ebp+12]
  0037e	3b c8		 cmp	 ecx, eax
  00380	76 3e		 jbe	 SHORT $L15035

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

  00382	f6 86 20 01 00
	00 04		 test	 BYTE PTR [esi+288], 4
  00389	74 2a		 je	 SHORT $L15016

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

  0038b	3b 45 f8	 cmp	 eax, DWORD PTR _New$[ebp+8]
  0038e	0f 86 43 01 00
	00		 jbe	 $L15096

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

  00394	85 3d 00 00 00
	00		 test	 DWORD PTR _SerialDebugLevel, edi
  0039a	74 12		 je	 SHORT $L15020
  0039c	ff b6 98 00 00
	00		 push	 DWORD PTR [esi+152]
  003a2	68 00 00 00 00	 push	 OFFSET FLAT:$SG15025
  003a7	e8 00 00 00 00	 call	 _DbgPrint
  003ac	59		 pop	 ecx
  003ad	59		 pop	 ecx
$L15020:

; 459  :                         Extension->RXHolding &= ~SERIAL_RX_RTS;

  003ae	83 a6 20 01 00
	00 fb		 and	 DWORD PTR [esi+288], -5	; fffffffbH
$L15016:

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

  003b5	56		 push	 esi
  003b6	e8 00 00 00 00	 call	 _SerialSetRTS@4

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

  003bb	e9 17 01 00 00	 jmp	 $L15096
$L15035:

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

  003c0	85 3d 00 00 00
	00		 test	 DWORD PTR _SerialDebugLevel, edi
  003c6	74 12		 je	 SHORT $L15036
  003c8	ff b6 98 00 00
	00		 push	 DWORD PTR [esi+152]
  003ce	68 00 00 00 00	 push	 OFFSET FLAT:$SG15041
  003d3	e8 00 00 00 00	 call	 _DbgPrint
  003d8	59		 pop	 ecx
  003d9	59		 pop	 ecx
$L15036:

; 477  :                 Extension->RXHolding |= SERIAL_RX_RTS;

  003da	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) ==

⌨️ 快捷键说明

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