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

📄 waitmask.cod

📁 怎样在win2000下构造驱动程序znsoft_Serial2000_demo.ZIP
💻 COD
📖 第 1 页 / 共 4 页
字号:
$SG15213 DB	'f:\w2ddk\src\kernel\serial\waitmask.c', 00H
	ORG $+2
$SG15214 DB	'FALSE', 00H
	ORG $+2
$SG15221 DB	'SERIAL: In SerialFinishOldWait', 0aH, 00H
$SG15235 DB	'SERIAL: The isr still owns the irp %x, mask location is '
	DB	'%x', 0aH, '------- and system buffer is %x', 0aH, 00H
	ORG $+4
$SG15254 DB	'SERIAL: Set mask location of %x, in irp %x, with system '
	DB	'buffer of %x', 0aH, 00H
; Function compile flags: /Ogs
_Context$ = 8
_SerialFinishOldWait@4 PROC NEAR			; COMDAT

; 583  : {

  0012e	55		 push	 ebp
  0012f	8b ec		 mov	 ebp, esp
  00131	56		 push	 esi

; 584  : 
; 585  :     PSERIAL_DEVICE_EXTENSION Extension = Context;
; 586  :     SERIAL_LOCKED_PAGED_CODE();

  00132	8b 35 00 00 00
	00		 mov	 esi, DWORD PTR __imp__KeGetCurrentIrql@0
  00138	57		 push	 edi
  00139	ff d6		 call	 esi
  0013b	33 ff		 xor	 edi, edi
  0013d	3c 01		 cmp	 al, 1
  0013f	76 30		 jbe	 SHORT $L15215
  00141	39 3d 14 00 00
	00		 cmp	 DWORD PTR _SerialGlobals+20, edi
  00147	75 28		 jne	 SHORT $L15215
  00149	ff d6		 call	 esi
  0014b	0f b6 c0	 movzx	 eax, al
  0014e	50		 push	 eax
  0014f	68 00 00 00 00	 push	 OFFSET FLAT:$SG15210
  00154	e8 00 00 00 00	 call	 _DbgPrint
  00159	59		 pop	 ecx
  0015a	59		 pop	 ecx
  0015b	57		 push	 edi
  0015c	68 4a 02 00 00	 push	 586			; 0000024aH
  00161	68 00 00 00 00	 push	 OFFSET FLAT:$SG15213
  00166	68 00 00 00 00	 push	 OFFSET FLAT:$SG15214
  0016b	ff 15 00 00 00
	00		 call	 DWORD PTR __imp__RtlAssert@16
$L15215:

; 587  : 
; 588  :     SerialDump(
; 589  :         SERDIAG3,
; 590  :         ("SERIAL: In SerialFinishOldWait\n")
; 591  :         );

  00171	f6 05 00 00 00
	00 04		 test	 BYTE PTR _SerialDebugLevel, 4
  00178	74 0b		 je	 SHORT $L15216
  0017a	68 00 00 00 00	 push	 OFFSET FLAT:$SG15221
  0017f	e8 00 00 00 00	 call	 _DbgPrint
  00184	59		 pop	 ecx
$L15216:

; 592  :     if (Extension->IrpMaskLocation) {

  00185	8b 75 08	 mov	 esi, DWORD PTR _Context$[ebp]
  00188	8b 8e 18 01 00
	00		 mov	 ecx, DWORD PTR [esi+280]
  0018e	3b cf		 cmp	 ecx, edi
  00190	74 4b		 je	 SHORT $L15228

; 593  : 
; 594  :         SerialDump(
; 595  :             SERDIAG4,
; 596  :             ("SERIAL: The isr still owns the irp %x, mask location is %x\n"
; 597  :              "------- and system buffer is %x\n",
; 598  :              Extension->CurrentWaitIrp,Extension->IrpMaskLocation,
; 599  :              Extension->CurrentWaitIrp->AssociatedIrp.SystemBuffer)
; 600  :             );

  00192	f6 05 00 00 00
	00 08		 test	 BYTE PTR _SerialDebugLevel, 8
  00199	74 18		 je	 SHORT $L15230
  0019b	8b 86 d4 00 00
	00		 mov	 eax, DWORD PTR [esi+212]
  001a1	ff 70 0c	 push	 DWORD PTR [eax+12]
  001a4	51		 push	 ecx
  001a5	50		 push	 eax
  001a6	68 00 00 00 00	 push	 OFFSET FLAT:$SG15235
  001ab	e8 00 00 00 00	 call	 _DbgPrint
  001b0	83 c4 10	 add	 esp, 16			; 00000010H
$L15230:

; 601  :         //
; 602  :         // The isr still "owns" the irp.
; 603  :         //
; 604  : 
; 605  :         *Extension->IrpMaskLocation = 0;

  001b3	8b 86 18 01 00
	00		 mov	 eax, DWORD PTR [esi+280]

; 606  :         Extension->IrpMaskLocation = NULL;
; 607  : 
; 608  :         Extension->CurrentWaitIrp->IoStatus.Information = sizeof(ULONG);
; 609  : 
; 610  :         //
; 611  :         // We don't decrement the reference since the completion routine
; 612  :         // will do that.
; 613  :         //
; 614  : 
; 615  :         SerialInsertQueueDpc(
; 616  :             &Extension->CommWaitDpc,
; 617  :             NULL,
; 618  :             NULL,
; 619  :             Extension
; 620  :             );

  001b9	56		 push	 esi
  001ba	57		 push	 edi
  001bb	57		 push	 edi
  001bc	89 38		 mov	 DWORD PTR [eax], edi
  001be	8b 86 d4 00 00
	00		 mov	 eax, DWORD PTR [esi+212]
  001c4	89 be 18 01 00
	00		 mov	 DWORD PTR [esi+280], edi
  001ca	c7 40 1c 04 00
	00 00		 mov	 DWORD PTR [eax+28], 4
  001d1	8d 86 ac 02 00
	00		 lea	 eax, DWORD PTR [esi+684]
  001d7	50		 push	 eax
  001d8	e8 00 00 00 00	 call	 _SerialInsertQueueDpc@16
$L15228:

; 621  : 
; 622  :     }
; 623  : 
; 624  :     //
; 625  :     // Don't wipe out any historical data we are still interested in.
; 626  :     //
; 627  : 
; 628  :     Extension->HistoryMask &= *((ULONG *)Extension->CurrentMaskIrp->
; 629  :                                             AssociatedIrp.SystemBuffer);

  001dd	8b 86 cc 00 00
	00		 mov	 eax, DWORD PTR [esi+204]
  001e3	8b 48 0c	 mov	 ecx, DWORD PTR [eax+12]
  001e6	8b 09		 mov	 ecx, DWORD PTR [ecx]
  001e8	21 8e 14 01 00
	00		 and	 DWORD PTR [esi+276], ecx

; 630  : 
; 631  :     Extension->IsrWaitMask = *((ULONG *)Extension->CurrentMaskIrp->
; 632  :                                             AssociatedIrp.SystemBuffer);

  001ee	8b 48 0c	 mov	 ecx, DWORD PTR [eax+12]
  001f1	8b 09		 mov	 ecx, DWORD PTR [ecx]
  001f3	89 8e 10 01 00
	00		 mov	 DWORD PTR [esi+272], ecx

; 633  :     SerialDump(
; 634  :         SERDIAG4,
; 635  :         ("SERIAL: Set mask location of %x, in irp %x, with system buffer of %x\n",
; 636  :          Extension->IrpMaskLocation,
; 637  :          Extension->CurrentMaskIrp,Extension->CurrentMaskIrp->AssociatedIrp.SystemBuffer)
; 638  :         );

  001f9	f6 05 00 00 00
	00 08		 test	 BYTE PTR _SerialDebugLevel, 8
  00200	74 17		 je	 SHORT $L15249
  00202	ff 70 0c	 push	 DWORD PTR [eax+12]
  00205	50		 push	 eax
  00206	ff b6 18 01 00
	00		 push	 DWORD PTR [esi+280]
  0020c	68 00 00 00 00	 push	 OFFSET FLAT:$SG15254
  00211	e8 00 00 00 00	 call	 _DbgPrint
  00216	83 c4 10	 add	 esp, 16			; 00000010H
$L15249:
  00219	5f		 pop	 edi

; 639  :     return FALSE;

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

; 640  : }

  0021d	5d		 pop	 ebp
  0021e	c2 04 00	 ret	 4
_SerialFinishOldWait@4 ENDP
PAGESER	ENDS
EXTRN	_SerialTryToCompleteCurrent@44:NEAR
;	COMDAT _SerialCancelWait@8
PAGESER	SEGMENT
$SG15268 DB	'SERIAL: Pageable code called at IRQL %d without lock ', 0aH
	DB	00H
	ORG $+1
$SG15271 DB	'f:\w2ddk\src\kernel\serial\waitmask.c', 00H
	ORG $+2
$SG15272 DB	'FALSE', 00H
	ORG $+2
$SG15279 DB	'SERIAL: In SerialCancelWait', 0aH, 00H
	ORG $+3
$SG15292 DB	'SERIAL: Canceling wait for irp %x', 0aH, 00H
; Function compile flags: /Ogs
_DeviceObject$ = 8
_Irp$ = 12
_SerialCancelWait@8 PROC NEAR				; COMDAT

; 667  : {

  000ab	55		 push	 ebp
  000ac	8b ec		 mov	 ebp, esp

; 668  : 
; 669  :     PSERIAL_DEVICE_EXTENSION Extension = DeviceObject->DeviceExtension;

  000ae	8b 45 08	 mov	 eax, DWORD PTR _DeviceObject$[ebp]
  000b1	53		 push	 ebx
  000b2	56		 push	 esi

; 670  :     SERIAL_LOCKED_PAGED_CODE();

  000b3	8b 35 00 00 00
	00		 mov	 esi, DWORD PTR __imp__KeGetCurrentIrql@0
  000b9	57		 push	 edi
  000ba	8b 78 28	 mov	 edi, DWORD PTR [eax+40]
  000bd	ff d6		 call	 esi
  000bf	33 db		 xor	 ebx, ebx
  000c1	3c 01		 cmp	 al, 1
  000c3	76 30		 jbe	 SHORT $L15273
  000c5	39 1d 14 00 00
	00		 cmp	 DWORD PTR _SerialGlobals+20, ebx
  000cb	75 28		 jne	 SHORT $L15273
  000cd	ff d6		 call	 esi
  000cf	0f b6 c0	 movzx	 eax, al
  000d2	50		 push	 eax
  000d3	68 00 00 00 00	 push	 OFFSET FLAT:$SG15268
  000d8	e8 00 00 00 00	 call	 _DbgPrint
  000dd	59		 pop	 ecx
  000de	59		 pop	 ecx
  000df	53		 push	 ebx
  000e0	68 9e 02 00 00	 push	 670			; 0000029eH
  000e5	68 00 00 00 00	 push	 OFFSET FLAT:$SG15271
  000ea	68 00 00 00 00	 push	 OFFSET FLAT:$SG15272
  000ef	ff 15 00 00 00
	00		 call	 DWORD PTR __imp__RtlAssert@16
$L15273:

; 671  : 
; 672  :     SerialDump(
; 673  :         SERDIAG3,
; 674  :         ("SERIAL: In SerialCancelWait\n")
; 675  :         );

  000f5	f6 05 00 00 00
	00 04		 test	 BYTE PTR _SerialDebugLevel, 4
  000fc	74 0b		 je	 SHORT $L15274
  000fe	68 00 00 00 00	 push	 OFFSET FLAT:$SG15279
  00103	e8 00 00 00 00	 call	 _DbgPrint
  00108	59		 pop	 ecx
$L15274:

; 676  : 
; 677  :     SerialDump(
; 678  :         SERDIAG4,
; 679  :         ("SERIAL: Canceling wait for irp %x\n",Extension->CurrentWaitIrp)
; 680  :         );

  00109	f6 05 00 00 00
	00 08		 test	 BYTE PTR _SerialDebugLevel, 8
  00110	74 12		 je	 SHORT $L15287
  00112	ff b7 d4 00 00
	00		 push	 DWORD PTR [edi+212]
  00118	68 00 00 00 00	 push	 OFFSET FLAT:$SG15292
  0011d	e8 00 00 00 00	 call	 _DbgPrint
  00122	59		 pop	 ecx
  00123	59		 pop	 ecx
$L15287:

; 681  :     SerialTryToCompleteCurrent(
; 682  :         Extension,
; 683  :         SerialGrabWaitFromIsr,
; 684  :         Irp->CancelIrql,
; 685  :         STATUS_CANCELLED,
; 686  :         &Extension->CurrentWaitIrp,
; 687  :         NULL,
; 688  :         NULL,
; 689  :         NULL,
; 690  :         NULL,
; 691  :         NULL,
; 692  :         SERIAL_REF_CANCEL
; 693  :         );

  00124	6a 02		 push	 2
  00126	53		 push	 ebx
  00127	53		 push	 ebx
  00128	53		 push	 ebx
  00129	53		 push	 ebx
  0012a	8d 87 d4 00 00
	00		 lea	 eax, DWORD PTR [edi+212]
  00130	53		 push	 ebx
  00131	50		 push	 eax
  00132	8b 45 0c	 mov	 eax, DWORD PTR _Irp$[ebp]
  00135	68 20 01 00 c0	 push	 -1073741536		; c0000120H
  0013a	8a 40 25	 mov	 al, BYTE PTR [eax+37]
  0013d	50		 push	 eax
  0013e	68 00 00 00 00	 push	 OFFSET FLAT:_SerialGrabWaitFromIsr@4
  00143	57		 push	 edi
  00144	e8 00 00 00 00	 call	 _SerialTryToCompleteCurrent@44
  00149	5f		 pop	 edi
  0014a	5e		 pop	 esi
  0014b	5b		 pop	 ebx

; 694  : 
; 695  : }

  0014c	5d		 pop	 ebp
  0014d	c2 08 00	 ret	 8
_SerialCancelWait@8 ENDP
PAGESER	ENDS
PUBLIC	_SerialCompleteWait@16
EXTRN	_SerialDpcEpilogue@8:NEAR
;	COMDAT _SerialCompleteWait@16
_TEXT	SEGMENT
$SG15322 DB	'SERIAL: SerialCompleteWait', 0aH, 00H
$SG15335 DB	'SERIAL: In SerialCompleteWait', 0aH, 00H
	ORG $+1
$SG15348 DB	'SERIAL: Completing wait for irp %x', 0aH, 00H
; Function compile flags: /Ogs
_Dpc$ = 8
_DeferredContext$ = 12
_OldIrql$ = -4
_SerialCompleteWait@16 PROC NEAR			; COMDAT

; 705  : {

  00060	55		 push	 ebp
  00061	8b ec		 mov	 ebp, esp
  00063	51		 push	 ecx

; 706  : 
; 707  :     PSERIAL_DEVICE_EXTENSION Extension = DeferredContext;
; 708  :     KIRQL OldIrql;
; 709  : 
; 710  : 
; 711  :     SerialDump(SERTRACECALLS, ("SERIAL: SerialCompleteWait\n"));

  00064	f6 05 00 00 00
	00 40		 test	 BYTE PTR _SerialDebugLevel, 64 ; 00000040H
  0006b	74 0b		 je	 SHORT $L15317
  0006d	68 00 00 00 00	 push	 OFFSET FLAT:$SG15322
  00072	e8 00 00 00 00	 call	 _DbgPrint
  00077	59		 pop	 ecx
$L15317:

; 712  : 
; 713  :     SerialDump(
; 714  :         SERDIAG3,
; 715  :         ("SERIAL: In SerialCompleteWait\n")
; 716  :         );

  00078	f6 05 00 00 00
	00 04		 test	 BYTE PTR _SerialDebugLevel, 4
  0007f	74 0b		 je	 SHORT $L15330
  00081	68 00 00 00 00	 push	 OFFSET FLAT:$SG15335
  00086	e8 00 00 00 00	 call	 _DbgPrint
  0008b	59		 pop	 ecx
$L15330:

; 717  :     UNREFERENCED_PARAMETER(SystemContext1);
; 718  :     UNREFERENCED_PARAMETER(SystemContext2);
; 719  : 
; 720  :     IoAcquireCancelSpinLock(&OldIrql);

  0008c	8d 45 fc	 lea	 eax, DWORD PTR _OldIrql$[ebp]
  0008f	56		 push	 esi
  00090	50		 push	 eax
  00091	ff 15 00 00 00
	00		 call	 DWORD PTR __imp__IoAcquireCancelSpinLock@4

; 721  : 
; 722  :     SerialDump(
; 723  :         SERDIAG4,
; 724  :         ("SERIAL: Completing wait for irp %x\n",Extension->CurrentWaitIrp)
; 725  :         );

  00097	f6 05 00 00 00
	00 08		 test	 BYTE PTR _SerialDebugLevel, 8
  0009e	8b 75 0c	 mov	 esi, DWORD PTR _DeferredContext$[ebp]
  000a1	74 12		 je	 SHORT $L15343
  000a3	ff b6 d4 00 00
	00		 push	 DWORD PTR [esi+212]
  000a9	68 00 00 00 00	 push	 OFFSET FLAT:$SG15348
  000ae	e8 00 00 00 00	 call	 _DbgPrint
  000b3	59		 pop	 ecx
  000b4	59		 pop	 ecx
$L15343:

; 726  :     SerialTryToCompleteCurrent(
; 727  :         Extension,
; 728  :         NULL,
; 729  :         OldIrql,
; 730  :         STATUS_SUCCESS,
; 731  :         &Extension->CurrentWaitIrp,
; 732  :         NULL,
; 733  :         NULL,
; 734  :         NULL,
; 735  :         NULL,
; 736  :         NULL,
; 737  :         SERIAL_REF_ISR
; 738  :         );

  000b5	33 c0		 xor	 eax, eax
  000b7	6a 01		 push	 1
  000b9	50		 push	 eax
  000ba	50		 push	 eax
  000bb	50		 push	 eax
  000bc	50		 push	 eax
  000bd	8d 8e d4 00 00
	00		 lea	 ecx, DWORD PTR [esi+212]
  000c3	50		 push	 eax
  000c4	51		 push	 ecx
  000c5	50		 push	 eax
  000c6	ff 75 fc	 push	 DWORD PTR _OldIrql$[ebp]
  000c9	50		 push	 eax
  000ca	56		 push	 esi
  000cb	e8 00 00 00 00	 call	 _SerialTryToCompleteCurrent@44

; 739  : 
; 740  :     SerialDpcEpilogue(Extension, Dpc);

  000d0	ff 75 08	 push	 DWORD PTR _Dpc$[ebp]
  000d3	56		 push	 esi
  000d4	e8 00 00 00 00	 call	 _SerialDpcEpilogue@8
  000d9	5e		 pop	 esi

; 741  : }

  000da	c9		 leave
  000db	c2 10 00	 ret	 16			; 00000010H
_SerialCompleteWait@16 ENDP
_TEXT	ENDS
END

⌨️ 快捷键说明

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