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

📄 write.cod

📁 怎样在win2000下构造驱动程序znsoft_Serial2000_demo.ZIP
💻 COD
📖 第 1 页 / 共 5 页
字号:
  00385	6a 00		 push	 0
  00387	68 51 02 00 00	 push	 593			; 00000251H
  0038c	68 00 00 00 00	 push	 OFFSET FLAT:$SG15111
  00391	68 00 00 00 00	 push	 OFFSET FLAT:$SG15112
  00396	ff 15 00 00 00
	00		 call	 DWORD PTR __imp__RtlAssert@16
$L15109:
  0039c	83 0b 02	 or	 DWORD PTR [ebx], 2

; 594  : 
; 595  :                 //
; 596  :                 // We don't want to complete the current irp now.  This
; 597  :                 // will now get completed by the Xoff counter code.
; 598  :                 //
; 599  : 
; 600  :                 CompleteCurrent = FALSE;

  0039f	80 65 14 00	 and	 BYTE PTR _CompleteCurrent$[ebp], 0

; 601  : 
; 602  :                 //
; 603  :                 // Give the counter to the isr.
; 604  :                 //
; 605  : 
; 606  :                 Extension->CurrentXoffIrp = Irp;
; 607  :                 KeSynchronizeExecution(
; 608  :                     Extension->Interrupt,
; 609  :                     SerialGiveXoffToIsr,
; 610  :                     Extension
; 611  :                     );

  003a3	56		 push	 esi
  003a4	68 00 00 00 00	 push	 OFFSET FLAT:_SerialGiveXoffToIsr@4
  003a9	ff b6 a0 00 00
	00		 push	 DWORD PTR [esi+160]
  003af	89 be dc 00 00
	00		 mov	 DWORD PTR [esi+220], edi
  003b5	ff 15 00 00 00
	00		 call	 DWORD PTR __imp__KeSynchronizeExecution@12

; 612  : 
; 613  :                 //
; 614  :                 // Start the timer for the counter and increment
; 615  :                 // the reference count since the timer has a
; 616  :                 // reference to the irp.
; 617  :                 //
; 618  : 
; 619  :                 if (Xc->Timeout) {

  003bb	8b 45 fc	 mov	 eax, DWORD PTR _Xc$15082[ebp]
  003be	8b 00		 mov	 eax, DWORD PTR [eax]
  003c0	85 c0		 test	 eax, eax
  003c2	74 4a		 je	 SHORT $L15482

; 620  : 
; 621  :                     LARGE_INTEGER delta;
; 622  : 
; 623  :                     delta.QuadPart = -((LONGLONG)UInt32x32To64(
; 624  :                                                      1000,
; 625  :                                                      Xc->Timeout
; 626  :                                                      ));

  003c4	6a ff		 push	 -1
  003c6	68 18 fc ff ff	 push	 -1000			; fffffc18H
  003cb	6a 00		 push	 0
  003cd	50		 push	 eax
  003ce	e8 00 00 00 00	 call	 __allmul

; 627  : 
; 628  :                     SerialSetTimer(
; 629  :                         &Extension->XoffCountTimer,
; 630  :                         delta,
; 631  :                         &Extension->XoffCountTimeoutDpc,
; 632  :                         Extension
; 633  : 
; 634  :                         );

  003d3	8d 8e 0c 03 00
	00		 lea	 ecx, DWORD PTR [esi+780]
  003d9	56		 push	 esi
  003da	51		 push	 ecx
  003db	52		 push	 edx
  003dc	50		 push	 eax
  003dd	8d 86 50 04 00
	00		 lea	 eax, DWORD PTR [esi+1104]
  003e3	50		 push	 eax
  003e4	e8 00 00 00 00	 call	 _SerialSetTimer@20

; 635  : 
; 636  :                     SERIAL_SET_REFERENCE(
; 637  :                         Irp,
; 638  :                         SERIAL_REF_TOTAL_TIMER
; 639  :                         );

  003e9	8b 7f 60	 mov	 edi, DWORD PTR [edi+96]
  003ec	83 c7 10	 add	 edi, 16			; 00000010H
  003ef	f6 07 04	 test	 BYTE PTR [edi], 4
  003f2	74 17		 je	 SHORT $L15126
  003f4	6a 00		 push	 0
  003f6	68 7f 02 00 00	 push	 639			; 0000027fH
  003fb	68 00 00 00 00	 push	 OFFSET FLAT:$SG15128
  00400	68 00 00 00 00	 push	 OFFSET FLAT:$SG15129
  00405	ff 15 00 00 00
	00		 call	 DWORD PTR __imp__RtlAssert@16
$L15126:
  0040b	83 0f 04	 or	 DWORD PTR [edi], 4
$L15482:
  0040e	8b 5d 08	 mov	 ebx, DWORD PTR _CurrentOpIrp$[ebp]
$L15122:

; 640  : 
; 641  :                 }
; 642  : 
; 643  :             }
; 644  : 
; 645  :             IoReleaseCancelSpinLock(OldIrql);

  00411	ff 75 f8	 push	 DWORD PTR _OldIrql$15080[ebp]
$L15487:
  00414	ff 15 00 00 00
	00		 call	 DWORD PTR __imp__IoReleaseCancelSpinLock@4
$L15079:

; 646  : 
; 647  :         }
; 648  : 
; 649  :         //
; 650  :         // Note that the following call will (probably) also cause
; 651  :         // the current irp to be completed.
; 652  :         //
; 653  : 
; 654  :         SerialGetNextIrp(
; 655  :             CurrentOpIrp,
; 656  :             QueueToProcess,
; 657  :             NewIrp,
; 658  :             CompleteCurrent,
; 659  :             Extension
; 660  :             );

  0041a	8b 7d 10	 mov	 edi, DWORD PTR _NewIrp$[ebp]
  0041d	56		 push	 esi
  0041e	ff 75 14	 push	 DWORD PTR _CompleteCurrent$[ebp]
  00421	57		 push	 edi
  00422	ff 75 0c	 push	 DWORD PTR _QueueToProcess$[ebp]
  00425	53		 push	 ebx
  00426	e8 00 00 00 00	 call	 _SerialGetNextIrp@20

; 661  : 
; 662  :         if (!*NewIrp) {

  0042b	8b 07		 mov	 eax, DWORD PTR [edi]
  0042d	85 c0		 test	 eax, eax
  0042f	74 2e		 je	 SHORT $L15480

; 673  : 
; 674  :             break;
; 675  : 
; 676  :         } else if (IoGetCurrentIrpStackLocation(*NewIrp)->MajorFunction
; 677  :                    == IRP_MJ_FLUSH_BUFFERS) {

  00431	8b 48 60	 mov	 ecx, DWORD PTR [eax+96]
  00434	80 39 09	 cmp	 BYTE PTR [ecx], 9
  00437	75 4b		 jne	 SHORT $L15071

; 678  : 
; 679  :             //
; 680  :             // If we encounter a flush request we just want to get
; 681  :             // the next irp and complete the flush.
; 682  :             //
; 683  :             // Note that if NewIrp is non-null then it is also
; 684  :             // equal to CurrentWriteIrp.
; 685  :             //
; 686  : 
; 687  : 
; 688  :             ASSERT((*NewIrp) == (*CurrentOpIrp));

  00439	3b 03		 cmp	 eax, DWORD PTR [ebx]
  0043b	74 17		 je	 SHORT $L15134
  0043d	6a 00		 push	 0
  0043f	68 b0 02 00 00	 push	 688			; 000002b0H
  00444	68 00 00 00 00	 push	 OFFSET FLAT:$SG15136
  00449	68 00 00 00 00	 push	 OFFSET FLAT:$SG15137
  0044e	ff 15 00 00 00
	00		 call	 DWORD PTR __imp__RtlAssert@16
$L15134:

; 689  :             (*NewIrp)->IoStatus.Status = STATUS_SUCCESS;

  00454	8b 07		 mov	 eax, DWORD PTR [edi]
  00456	83 60 18 00	 and	 DWORD PTR [eax+24], 0

; 690  : 
; 691  :         } else {
; 692  : 
; 693  :             break;
; 694  : 
; 695  :         }
; 696  : 
; 697  :     } while (TRUE);

  0045a	e9 3f fe ff ff	 jmp	 $L15069
$L15480:

; 663  : 
; 664  :             KIRQL OldIrql;
; 665  : 
; 666  :             IoAcquireCancelSpinLock(&OldIrql);

  0045f	8d 45 08	 lea	 eax, DWORD PTR _OldIrql$15131[ebp]
  00462	50		 push	 eax
  00463	ff 15 00 00 00
	00		 call	 DWORD PTR __imp__IoAcquireCancelSpinLock@4

; 667  :             KeSynchronizeExecution(
; 668  :                 Extension->Interrupt,
; 669  :                 SerialProcessEmptyTransmit,
; 670  :                 Extension
; 671  :                 );

  00469	56		 push	 esi
  0046a	68 00 00 00 00	 push	 OFFSET FLAT:_SerialProcessEmptyTransmit@4
  0046f	ff b6 a0 00 00
	00		 push	 DWORD PTR [esi+160]
  00475	ff 15 00 00 00
	00		 call	 DWORD PTR __imp__KeSynchronizeExecution@12

; 672  :             IoReleaseCancelSpinLock(OldIrql);

  0047b	ff 75 08	 push	 DWORD PTR _OldIrql$15131[ebp]
  0047e	ff 15 00 00 00
	00		 call	 DWORD PTR __imp__IoReleaseCancelSpinLock@4
$L15071:
  00484	5f		 pop	 edi
  00485	5e		 pop	 esi
  00486	5b		 pop	 ebx

; 698  : 
; 699  : }

  00487	c9		 leave
  00488	c2 14 00	 ret	 20			; 00000014H
_SerialGetNextWrite@20 ENDP
PAGESER	ENDS
PUBLIC	_SerialCompleteWrite@16
EXTRN	_SerialDpcEpilogue@8:NEAR
;	COMDAT _SerialCompleteWrite@16
_TEXT	SEGMENT
$SG15157 DB	'SERIAL: SerialCompleteWrite', 0aH, 00H
; Function compile flags: /Ogs
_Dpc$ = 8
_DeferredContext$ = 12
_OldIrql$ = -4
_SerialCompleteWrite@16 PROC NEAR			; COMDAT

; 733  : {

  0001d	55		 push	 ebp
  0001e	8b ec		 mov	 ebp, esp
  00020	51		 push	 ecx

; 734  : 
; 735  :     PSERIAL_DEVICE_EXTENSION Extension = DeferredContext;
; 736  :     KIRQL OldIrql;
; 737  : 
; 738  :     UNREFERENCED_PARAMETER(SystemContext1);
; 739  :     UNREFERENCED_PARAMETER(SystemContext2);
; 740  : 
; 741  :     SerialDump(SERTRACECALLS, ("SERIAL: SerialCompleteWrite\n"));

  00021	f6 05 00 00 00
	00 40		 test	 BYTE PTR _SerialDebugLevel, 64 ; 00000040H
  00028	74 0b		 je	 SHORT $L15152
  0002a	68 00 00 00 00	 push	 OFFSET FLAT:$SG15157
  0002f	e8 00 00 00 00	 call	 _DbgPrint
  00034	59		 pop	 ecx
$L15152:

; 742  : 
; 743  :     IoAcquireCancelSpinLock(&OldIrql);

  00035	8d 45 fc	 lea	 eax, DWORD PTR _OldIrql$[ebp]
  00038	56		 push	 esi
  00039	50		 push	 eax
  0003a	ff 15 00 00 00
	00		 call	 DWORD PTR __imp__IoAcquireCancelSpinLock@4

; 744  : 
; 745  :     SerialTryToCompleteCurrent(
; 746  :         Extension,
; 747  :         NULL,
; 748  :         OldIrql,
; 749  :         STATUS_SUCCESS,
; 750  :         &Extension->CurrentWriteIrp,
; 751  :         &Extension->WriteQueue,
; 752  :         NULL,
; 753  :         &Extension->WriteRequestTotalTimer,
; 754  :         SerialStartWrite,
; 755  :         SerialGetNextWrite,
; 756  :         SERIAL_REF_ISR
; 757  :         );

  00040	8b 75 0c	 mov	 esi, DWORD PTR _DeferredContext$[ebp]
  00043	6a 01		 push	 1
  00045	68 00 00 00 00	 push	 OFFSET FLAT:_SerialGetNextWrite@20
  0004a	68 00 00 00 00	 push	 OFFSET FLAT:_SerialStartWrite@4
  0004f	8d 86 00 04 00
	00		 lea	 eax, DWORD PTR [esi+1024]
  00055	8d 8e ac 00 00
	00		 lea	 ecx, DWORD PTR [esi+172]
  0005b	50		 push	 eax
  0005c	33 c0		 xor	 eax, eax
  0005e	50		 push	 eax
  0005f	51		 push	 ecx
  00060	8d 8e c8 00 00
	00		 lea	 ecx, DWORD PTR [esi+200]
  00066	51		 push	 ecx
  00067	50		 push	 eax
  00068	ff 75 fc	 push	 DWORD PTR _OldIrql$[ebp]
  0006b	50		 push	 eax
  0006c	56		 push	 esi
  0006d	e8 00 00 00 00	 call	 _SerialTryToCompleteCurrent@44

; 758  : 
; 759  :     SerialDpcEpilogue(Extension, Dpc);

  00072	ff 75 08	 push	 DWORD PTR _Dpc$[ebp]
  00075	56		 push	 esi
  00076	e8 00 00 00 00	 call	 _SerialDpcEpilogue@8
  0007b	5e		 pop	 esi

; 760  : 
; 761  : }

  0007c	c9		 leave
  0007d	c2 10 00	 ret	 16			; 00000010H
_SerialCompleteWrite@16 ENDP
_TEXT	ENDS
EXTRN	_SerialInsertQueueDpc@16:NEAR
EXTRN	_SerialPerhapsLowerRTS@4:NEAR
;	COMDAT _SerialProcessEmptyTransmit@4
PAGESER	SEGMENT
$SG15172 DB	'SERIAL: Pageable code called at IRQL %d without lock ', 0aH
	DB	00H
	ORG $+1
$SG15175 DB	'f:\w2ddk\src\kernel\serial\write.c', 00H
	ORG $+1
$SG15176 DB	'FALSE', 00H
; Function compile flags: /Ogs
_Context$ = 8
_SerialProcessEmptyTransmit@4 PROC NEAR			; COMDAT

; 793  : {

  00062	55		 push	 ebp
  00063	8b ec		 mov	 ebp, esp
  00065	53		 push	 ebx
  00066	56		 push	 esi

; 794  : 
; 795  :     PSERIAL_DEVICE_EXTENSION Extension = Context;
; 796  :     SERIAL_LOCKED_PAGED_CODE();

  00067	8b 35 00 00 00
	00		 mov	 esi, DWORD PTR __imp__KeGetCurrentIrql@0
  0006d	ff d6		 call	 esi
  0006f	33 db		 xor	 ebx, ebx
  00071	3c 01		 cmp	 al, 1
  00073	76 30		 jbe	 SHORT $L15173
  00075	39 1d 14 00 00
	00		 cmp	 DWORD PTR _SerialGlobals+20, ebx
  0007b	75 28		 jne	 SHORT $L15173
  0007d	ff d6		 call	 esi
  0007f	0f b6 c0	 movzx	 eax, al
  00082	50		 push	 eax
  00083	68 00 00 00 00	 push	 OFFSET FLAT:$SG15172
  00088	e8 00 00 00 00	 call	 _DbgPrint
  0008d	59		 pop	 ecx
  0008e	59		 pop	 ecx
  0008f	53		 push	 ebx
  00090	68 1c 03 00 00	 push	 796			; 0000031cH
  00095	68 00 00 00 00	 push	 OFFSET FLAT:$SG15175
  0009a	68 00 00 00 00	 push	 OFFSET FLAT:$SG15176
  0009f	ff 15 00 00 00
	00		 call	 DWORD PTR __imp__RtlAssert@16
$L15173:

; 797  : 
; 798  :     if (Extension->IsrWaitMask && (Extension->IsrWaitMask & SERIAL_EV_TXEMPTY) &&
; 799  :         Extension->EmptiedTransmit && (!Extension->TransmitImmediate) &&
; 800  :         (!Extension->CurrentWriteIrp) && IsListEmpty(&Extension->WriteQueue)) {

  000a5	8b 75 08	 mov	 esi, DWORD PTR _Context$[ebp]
  000a8	8b 86 10 01 00
	00		 mov	 eax, DWORD PTR [esi+272]
  000ae	3b c3		 cmp	 eax, ebx
  000b0	74 6d		 je	 SHORT $L15177
  000b2	a8 04		 test	 al, 4
  000b4	74 69		 je	 SHORT $L15177
  000b6	38 9e a2 01 00
	00		 cmp	 BYTE PTR [esi+418], bl
  000bc	74 61		 je	 SHORT $L15177
  000be	38 9e a1 01 00
	00		 cmp	 BYTE PTR [esi+417], bl
  000c4	75 59		 jne	 SHORT $L15177
  000c6	39 9e c8 00 00
	00		 cmp	 DWORD PTR [esi+200], ebx
  000cc	75 51		 jne	 SHORT $L15177
  000ce	8d 86 ac 00 00
	00		 lea	 eax, DWORD PTR [esi+172]
  000d4	39 00		 cmp	 DWORD PTR [eax], eax
  000d6	75 47		 jne	 SHORT $L15177

; 801  : 
; 802  :         Extension->HistoryMask |= SERIAL_EV_TXEMPTY;
; 803  :         if (Extension->IrpMaskLocation) {

  000d8	8d 8e 18 01 00
	00		 lea	 ecx, DWORD PTR [esi+280]
  000de	8d 86 14 01 00
	00		 lea	 eax, DWORD PTR [esi+276]
  000e4	57		 push	 edi
  000e5	8b 11		 mov	 edx, DWORD PTR [ecx]
  000e7	83 08 04	 or	 DWORD PTR [eax], 4
  000ea	8b 38		 mov	 edi, DWORD PTR [eax]
  000ec	3b d3		 cmp	 edx, ebx
  000ee	74 22		 je	 SHORT $L15178

; 804  : 
; 805  :             *Extension->IrpMaskLocation = Extension->HistoryMask;

⌨️ 快捷键说明

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