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

📄 write.cod

📁 怎样在win2000下构造驱动程序znsoft_Serial2000_demo.ZIP
💻 COD
📖 第 1 页 / 共 5 页
字号:
	00		 lea	 ecx, DWORD PTR [ebx+484]
  0006f	ff 15 00 00 00
	00		 call	 DWORD PTR __imp_@KfAcquireSpinLock@4

; 298  : 
; 299  :         Timeouts = Extension->Timeouts;

  00075	6a 05		 push	 5
  00077	8d b3 58 01 00
	00		 lea	 esi, DWORD PTR [ebx+344]
  0007d	59		 pop	 ecx
  0007e	8d 7d d4	 lea	 edi, DWORD PTR _Timeouts$[ebp]
  00081	f3 a5		 rep movsd

; 300  : 
; 301  :         KeReleaseSpinLock(
; 302  :             &Extension->ControlLock,
; 303  :             OldIrql
; 304  :             );

  00083	8a d0		 mov	 dl, al
  00085	8d 8b e4 01 00
	00		 lea	 ecx, DWORD PTR [ebx+484]
  0008b	88 45 fb	 mov	 BYTE PTR _OldIrql$[ebp], al
  0008e	ff 15 00 00 00
	00		 call	 DWORD PTR __imp_@KfReleaseSpinLock@8

; 305  : 
; 306  :         if (Timeouts.WriteTotalTimeoutConstant ||
; 307  :             Timeouts.WriteTotalTimeoutMultiplier) {

  00094	33 ff		 xor	 edi, edi
  00096	39 7d e4	 cmp	 DWORD PTR _Timeouts$[ebp+16], edi
  00099	75 05		 jne	 SHORT $L14857
  0009b	39 7d e0	 cmp	 DWORD PTR _Timeouts$[ebp+12], edi
  0009e	74 38		 je	 SHORT $L14856
$L14857:

; 308  : 
; 309  :             PIO_STACK_LOCATION IrpSp = IoGetCurrentIrpStackLocation(
; 310  :                                            Extension->CurrentWriteIrp
; 311  :                                            );

  000a0	8b 83 c8 00 00
	00		 mov	 eax, DWORD PTR [ebx+200]

; 312  :             UseATimer = TRUE;

  000a6	c6 45 0b 01	 mov	 BYTE PTR _UseATimer$[ebp], 1
  000aa	8b 40 60	 mov	 eax, DWORD PTR [eax+96]

; 313  : 
; 314  :             //
; 315  :             // We have some timer values to calculate.
; 316  :             //
; 317  :             // Take care, we might have an xoff counter masquerading
; 318  :             // as a write.
; 319  :             //
; 320  : 
; 321  :             TotalTime.QuadPart =
; 322  :                 ((LONGLONG)((UInt32x32To64(
; 323  :                                  (IrpSp->MajorFunction == IRP_MJ_WRITE)?
; 324  :                                      (IrpSp->Parameters.Write.Length):
; 325  :                                      (1),
; 326  :                                  Timeouts.WriteTotalTimeoutMultiplier
; 327  :                                  )
; 328  :                                  + Timeouts.WriteTotalTimeoutConstant)))
; 329  :                 * -10000;

  000ad	80 38 04	 cmp	 BYTE PTR [eax], 4
  000b0	75 05		 jne	 SHORT $L15168
  000b2	8b 40 04	 mov	 eax, DWORD PTR [eax+4]
  000b5	eb 03		 jmp	 SHORT $L15169
$L15168:
  000b7	33 c0		 xor	 eax, eax
  000b9	40		 inc	 eax
$L15169:
  000ba	f7 65 e0	 mul	 DWORD PTR _Timeouts$[ebp+12]
  000bd	33 c9		 xor	 ecx, ecx
  000bf	03 45 e4	 add	 eax, DWORD PTR _Timeouts$[ebp+16]
  000c2	6a ff		 push	 -1
  000c4	68 f0 d8 ff ff	 push	 -10000			; ffffd8f0H
  000c9	13 d1		 adc	 edx, ecx
  000cb	52		 push	 edx
  000cc	50		 push	 eax
  000cd	e8 00 00 00 00	 call	 __allmul
  000d2	89 45 e8	 mov	 DWORD PTR _TotalTime$[ebp], eax
  000d5	89 55 ec	 mov	 DWORD PTR _TotalTime$[ebp+4], edx
$L14856:

; 330  : 
; 331  :         }
; 332  : 
; 333  :         //
; 334  :         // The irp may be going to the isr shortly.  Now
; 335  :         // is a good time to initialize its reference counts.
; 336  :         //
; 337  : 
; 338  :         SERIAL_INIT_REFERENCE(Extension->CurrentWriteIrp);

  000d8	8d b3 c8 00 00
	00		 lea	 esi, DWORD PTR [ebx+200]
  000de	8b 06		 mov	 eax, DWORD PTR [esi]
  000e0	8b 40 60	 mov	 eax, DWORD PTR [eax+96]
  000e3	89 78 10	 mov	 DWORD PTR [eax+16], edi

; 339  : 
; 340  :         //
; 341  :         // We need to see if this irp should be canceled.
; 342  :         //
; 343  : 
; 344  :         IoAcquireCancelSpinLock(&OldIrql);

  000e6	8d 45 fb	 lea	 eax, DWORD PTR _OldIrql$[ebp]
  000e9	50		 push	 eax
  000ea	ff 15 00 00 00
	00		 call	 DWORD PTR __imp__IoAcquireCancelSpinLock@4

; 345  :         if (Extension->CurrentWriteIrp->Cancel) {

  000f0	8b 06		 mov	 eax, DWORD PTR [esi]
  000f2	80 78 24 00	 cmp	 BYTE PTR [eax+36], 0
  000f6	74 3f		 je	 SHORT $L14865

; 346  : 
; 347  :             IoReleaseCancelSpinLock(OldIrql);

  000f8	ff 75 fb	 push	 DWORD PTR _OldIrql$[ebp]
  000fb	ff 15 00 00 00
	00		 call	 DWORD PTR __imp__IoReleaseCancelSpinLock@4

; 348  :             Extension->CurrentWriteIrp->IoStatus.Status = STATUS_CANCELLED;

  00101	8b 0e		 mov	 ecx, DWORD PTR [esi]

; 349  : 
; 350  :             if (!SetFirstStatus) {

  00103	80 7d ff 00	 cmp	 BYTE PTR _SetFirstStatus$[ebp], 0
  00107	b8 20 01 00 c0	 mov	 eax, -1073741536	; c0000120H
  0010c	89 41 18	 mov	 DWORD PTR [ecx+24], eax
  0010f	75 07		 jne	 SHORT $L14867

; 351  : 
; 352  :                 FirstStatus = STATUS_CANCELLED;

  00111	89 45 f4	 mov	 DWORD PTR _FirstStatus$[ebp], eax

; 353  :                 SetFirstStatus = TRUE;

  00114	c6 45 ff 01	 mov	 BYTE PTR _SetFirstStatus$[ebp], 1
$L14867:

; 422  :             break;
; 423  : 
; 424  :         }
; 425  : 
; 426  :         //
; 427  :         // Well the write was canceled before we could start it up.
; 428  :         // Try to get another.
; 429  :         //
; 430  : 
; 431  :         SerialGetNextWrite(
; 432  :             &Extension->CurrentWriteIrp,
; 433  :             &Extension->WriteQueue,
; 434  :             &NewIrp,
; 435  :             TRUE,
; 436  :             Extension
; 437  :             );

  00118	53		 push	 ebx
  00119	8d 45 f0	 lea	 eax, DWORD PTR _NewIrp$[ebp]
  0011c	6a 01		 push	 1
  0011e	50		 push	 eax
  0011f	8d 83 ac 00 00
	00		 lea	 eax, DWORD PTR [ebx+172]
  00125	50		 push	 eax
  00126	56		 push	 esi
  00127	e8 00 00 00 00	 call	 _SerialGetNextWrite@20

; 438  : 
; 439  :     } while (NewIrp);

  0012c	39 7d f0	 cmp	 DWORD PTR _NewIrp$[ebp], edi
  0012f	0f 85 db fe ff
	ff		 jne	 $L14837
  00135	eb 77		 jmp	 SHORT $L14839
$L14865:

; 354  : 
; 355  :             }
; 356  : 
; 357  :         } else {
; 358  : 
; 359  :             if (!SetFirstStatus) {

  00137	80 7d ff 00	 cmp	 BYTE PTR _SetFirstStatus$[ebp], 0
  0013b	75 10		 jne	 SHORT $L14870

; 360  : 
; 361  :                 //
; 362  :                 // If we haven't set our first status, then
; 363  :                 // this is the only irp that could have possibly
; 364  :                 // not been on the queue.  (It could have been
; 365  :                 // on the queue if this routine is being invoked
; 366  :                 // from the completion routine.)  Since this
; 367  :                 // irp might never have been on the queue we
; 368  :                 // should mark it as pending.
; 369  :                 //
; 370  : 
; 371  :                 IoMarkIrpPending(Extension->CurrentWriteIrp);

  0013d	8b 06		 mov	 eax, DWORD PTR [esi]

; 372  :                 SetFirstStatus = TRUE;
; 373  :                 FirstStatus = STATUS_PENDING;

  0013f	c7 45 f4 03 01
	00 00		 mov	 DWORD PTR _FirstStatus$[ebp], 259 ; 00000103H
  00146	8b 40 60	 mov	 eax, DWORD PTR [eax+96]
  00149	80 48 03 01	 or	 BYTE PTR [eax+3], 1
$L14870:

; 374  : 
; 375  :             }
; 376  : 
; 377  :             //
; 378  :             // We give the irp to to the isr to write out.
; 379  :             // We set a cancel routine that knows how to
; 380  :             // grab the current write away from the isr.
; 381  :             //
; 382  :             // Since the cancel routine has an implicit reference
; 383  :             // to this irp up the reference count.
; 384  :             //
; 385  : 
; 386  :             IoSetCancelRoutine(
; 387  :                 Extension->CurrentWriteIrp,
; 388  :                 SerialCancelCurrentWrite
; 389  :                 );

  0014d	8b 0e		 mov	 ecx, DWORD PTR [esi]
  0014f	ba 00 00 00 00	 mov	 edx, OFFSET FLAT:_SerialCancelCurrentWrite@8
  00154	83 c1 38	 add	 ecx, 56			; 00000038H
  00157	ff 15 00 00 00
	00		 call	 DWORD PTR __imp_@InterlockedExchange@8

; 390  : 
; 391  :             SERIAL_SET_REFERENCE(
; 392  :                 Extension->CurrentWriteIrp,
; 393  :                 SERIAL_REF_CANCEL
; 394  :                 );

  0015d	8b 06		 mov	 eax, DWORD PTR [esi]
  0015f	8b 40 60	 mov	 eax, DWORD PTR [eax+96]
  00162	83 c0 10	 add	 eax, 16			; 00000010H
  00165	83 08 02	 or	 DWORD PTR [eax], 2

; 395  : 
; 396  :             if (UseATimer) {

  00168	80 7d 0b 00	 cmp	 BYTE PTR _UseATimer$[ebp], 0
  0016c	74 25		 je	 SHORT $L14887

; 397  : 
; 398  :                 SerialSetTimer(
; 399  :                     &Extension->WriteRequestTotalTimer,
; 400  :                     TotalTime,
; 401  :                     &Extension->TotalWriteTimeoutDpc,
; 402  :                     Extension
; 403  :                     );

  0016e	8d 83 6c 02 00
	00		 lea	 eax, DWORD PTR [ebx+620]
  00174	53		 push	 ebx
  00175	50		 push	 eax
  00176	8d 83 00 04 00
	00		 lea	 eax, DWORD PTR [ebx+1024]
  0017c	ff 75 ec	 push	 DWORD PTR _TotalTime$[ebp+4]
  0017f	ff 75 e8	 push	 DWORD PTR _TotalTime$[ebp]
  00182	50		 push	 eax
  00183	e8 00 00 00 00	 call	 _SerialSetTimer@20

; 404  : 
; 405  :                 //
; 406  :                 // This timer now has a reference to the irp.
; 407  :                 //
; 408  : 
; 409  :                 SERIAL_SET_REFERENCE(
; 410  :                     Extension->CurrentWriteIrp,
; 411  :                     SERIAL_REF_TOTAL_TIMER
; 412  :                     );

  00188	8b 06		 mov	 eax, DWORD PTR [esi]
  0018a	8b 40 60	 mov	 eax, DWORD PTR [eax+96]
  0018d	83 c0 10	 add	 eax, 16			; 00000010H
  00190	83 08 04	 or	 DWORD PTR [eax], 4
$L14887:

; 413  :             }
; 414  : 
; 415  :             KeSynchronizeExecution(
; 416  :                 Extension->Interrupt,
; 417  :                 SerialGiveWriteToIsr,
; 418  :                 Extension
; 419  :                 );

  00193	53		 push	 ebx
  00194	68 00 00 00 00	 push	 OFFSET FLAT:_SerialGiveWriteToIsr@4
  00199	ff b3 a0 00 00
	00		 push	 DWORD PTR [ebx+160]
  0019f	ff 15 00 00 00
	00		 call	 DWORD PTR __imp__KeSynchronizeExecution@12

; 420  : 
; 421  :             IoReleaseCancelSpinLock(OldIrql);

  001a5	ff 75 fb	 push	 DWORD PTR _OldIrql$[ebp]
  001a8	ff 15 00 00 00
	00		 call	 DWORD PTR __imp__IoReleaseCancelSpinLock@4
$L14839:

; 440  : 
; 441  :     return FirstStatus;

  001ae	8b 45 f4	 mov	 eax, DWORD PTR _FirstStatus$[ebp]
  001b1	5f		 pop	 edi
  001b2	5e		 pop	 esi
  001b3	5b		 pop	 ebx

; 442  : 
; 443  : }

  001b4	c9		 leave
  001b5	c2 04 00	 ret	 4
_SerialStartWrite@4 ENDP
PAGESER	ENDS
PUBLIC	_SerialCancelCurrentXoff@8
PUBLIC	_SerialGiveXoffToIsr@4
PUBLIC	_SerialProcessEmptyTransmit@4
EXTRN	_SerialGetNextIrp@20:NEAR
; Function compile flags: /Ogsy
;	COMDAT _SerialGetNextWrite@20
PAGESER	SEGMENT
_CurrentOpIrp$ = 8
_QueueToProcess$ = 12
_NewIrp$ = 16
_CompleteCurrent$ = 20
_Extension$ = 24
_OldIrql$14909 = 24
_OldIrql$14912 = -4
_OldIrql$14947 = 8
_SerialGetNextWrite@20 PROC NEAR			; COMDAT

; 491  : {

  00000	55		 push	 ebp
  00001	8b ec		 mov	 ebp, esp
  00003	51		 push	 ecx
  00004	53		 push	 ebx
  00005	56		 push	 esi

; 492  : 
; 493  : //    PSERIAL_DEVICE_EXTENSION Extension = CONTAINING_RECORD(
; 494  : //                                             QueueToProcess,
; 495  :  //                                            SERIAL_DEVICE_EXTENSION,
; 496  :  //                                            WriteQueue
; 497  : //                                             );
; 498  : 
; 499  :    SERIAL_LOCKED_PAGED_CODE();
; 500  : 
; 501  :    SerialDump(SERTRACECALLS, ("SERIAL: SerialGetNextWrite\n"));
; 502  : 
; 503  : 
; 504  :     do {
; 505  : 
; 506  : 
; 507  :         //
; 508  :         // We could be completing a flush.
; 509  :         //
; 510  : 
; 511  :         if (IoGetCurrentIrpStackLocation(*CurrentOpIrp)->MajorFunction
; 512  :             == IRP_MJ_WRITE) {

  00006	8b 75 18	 mov	 esi, DWORD PTR _Extension$[ebp]
  00009	57		 push	 edi
$L14905:
  0000a	8b 7d 08	 mov	 edi, DWORD PTR _CurrentOpIrp$[ebp]
  0000d	8b 07		 mov	 eax, DWORD PTR [edi]
  0000f	8b 40 60	 mov	 eax, DWORD PTR [eax+96]
  00012	8a 00		 mov	 al, BYTE PTR [eax]
  00014	3c 04		 cmp	 al, 4
  00016	75 26		 jne	 SHORT $L14908

; 513  : 
; 514  :             KIRQL OldIrql;
; 515  : 
; 516  :             ASSERT(Extension->TotalCharsQueued >=
; 517  :                    (IoGetCurrentIrpStackLocation(*CurrentOpIrp)
; 518  :                     ->Parameters.Write.Length));
; 519  : 
; 520  :             IoAcquireCancelSpinLock(&OldIrql);

  00018	8d 45 18	 lea	 eax, DWORD PTR _OldIrql$14909[ebp]
  0001b	50		 push	 eax
  0001c	ff 15 00 00 00
	00		 call	 DWORD PTR __imp__IoAcquireCancelSpinLock@4

; 521  :             Extension->TotalCharsQueued -=
; 522  :                 IoGetCurrentIrpStackLocation(*CurrentOpIrp)
; 523  :                 ->Parameters.Write.Length;

  00022	8b 07		 mov	 eax, DWORD PTR [edi]

; 524  :             IoReleaseCancelSpinLock(OldIrql);

  00024	ff 75 18	 push	 DWORD PTR _OldIrql$14909[ebp]
  00027	8b 40 60	 mov	 eax, DWORD PTR [eax+96]
  0002a	8b 40 04	 mov	 eax, DWORD PTR [eax+4]
  0002d	29 86 28 01 00
	00		 sub	 DWORD PTR [esi+296], eax
  00033	ff 15 00 00 00
	00		 call	 DWORD PTR __imp__IoReleaseCancelSpinLock@4

; 525  : 
; 526  :         } else if (IoGetCurrentIrpStackLocation(*CurrentOpIrp)->MajorFunction

  00039	e9 a5 00 00 00	 jmp	 $L14911
$L14908:

; 527  :                    == IRP_MJ_DEVICE_CONTROL) {

  0003e	3c 0e		 cmp	 al, 14			; 0000000eH
  00040	0f 85 9d 00 00
	00		 jne	 $L14911

; 528  : 

⌨️ 快捷键说明

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