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

📄 initunlo.cod

📁 怎样在win2000下构造驱动程序znsoft_Serial2000_demo.ZIP
💻 COD
📖 第 1 页 / 共 5 页
字号:
; 662  :    PAGED_CODE();

  000ad	8b 35 00 00 00
	00		 mov	 esi, DWORD PTR __imp__KeGetCurrentIrql@0
  000b3	57		 push	 edi
  000b4	8b 78 28	 mov	 edi, DWORD PTR [eax+40]
  000b7	ff d6		 call	 esi
  000b9	3c 01		 cmp	 al, 1
  000bb	76 29		 jbe	 SHORT $L15123
  000bd	ff d6		 call	 esi
  000bf	0f b6 c0	 movzx	 eax, al
  000c2	50		 push	 eax
  000c3	68 00 00 00 00	 push	 OFFSET FLAT:$SG15118
  000c8	e8 00 00 00 00	 call	 _DbgPrint
  000cd	59		 pop	 ecx
  000ce	59		 pop	 ecx
  000cf	6a 00		 push	 0
  000d1	68 96 02 00 00	 push	 662			; 00000296H
  000d6	68 00 00 00 00	 push	 OFFSET FLAT:$SG15121
  000db	68 00 00 00 00	 push	 OFFSET FLAT:$SG15122
  000e0	ff 15 00 00 00
	00		 call	 DWORD PTR __imp__RtlAssert@16
$L15123:

; 663  : 
; 664  :    SerialDump(SERTRACECALLS,("SERIAL: Enter SerialDisableInterfaces\n"));

  000e6	f6 05 00 00 00
	00 40		 test	 BYTE PTR _SerialDebugLevel, 64 ; 00000040H
  000ed	74 0b		 je	 SHORT $L15124
  000ef	68 00 00 00 00	 push	 OFFSET FLAT:$SG15129
  000f4	e8 00 00 00 00	 call	 _DbgPrint
  000f9	59		 pop	 ecx
$L15124:

; 665  : 
; 666  :    //
; 667  :    // Only do these many things if the device has started and still
; 668  :    // has resources allocated
; 669  :    //
; 670  : 
; 671  :    if (pDevExt->Flags & SERIAL_FLAGS_STARTED) {

  000fa	8b 87 e4 04 00
	00		 mov	 eax, DWORD PTR [edi+1252]
  00100	a8 01		 test	 al, 1
  00102	74 2b		 je	 SHORT $L15136

; 672  :        if (!(pDevExt->Flags & SERIAL_FLAGS_STOPPED)) {

  00104	a8 02		 test	 al, 2
  00106	75 1c		 jne	 SHORT $L15137

; 673  : 
; 674  :           if (DisableUART) {

  00108	80 7d 0c 00	 cmp	 BYTE PTR _DisableUART$[ebp], 0
  0010c	74 10		 je	 SHORT $L15141

; 675  :              //
; 676  :              // Mask off interrupts
; 677  :              //
; 678  : 
; 679  :              DISABLE_ALL_INTERRUPTS(pDevExt->Controller);

  0010e	8b 87 98 00 00
	00		 mov	 eax, DWORD PTR [edi+152]
  00114	6a 00		 push	 0
  00116	40		 inc	 eax
  00117	50		 push	 eax
  00118	ff 15 00 00 00
	00		 call	 DWORD PTR __imp__WRITE_PORT_UCHAR@8
$L15141:

; 680  :           }
; 681  : 
; 682  :           SerialReleaseResources(pDevExt);

  0011e	57		 push	 edi
  0011f	e8 00 00 00 00	 call	 _SerialReleaseResources@4
$L15137:

; 683  :        }
; 684  : 
; 685  :       //
; 686  :       // Remove us from WMI consideration
; 687  :       //
; 688  : 
; 689  :       IoWMIRegistrationControl(PDevObj, WMIREG_ACTION_DEREGISTER);

  00124	6a 02		 push	 2
  00126	ff 75 08	 push	 DWORD PTR _PDevObj$[ebp]
  00129	ff 15 00 00 00
	00		 call	 DWORD PTR __imp__IoWMIRegistrationControl@8
$L15136:

; 690  :    }
; 691  : 
; 692  :    //
; 693  :    // Undo external names
; 694  :    //
; 695  : 
; 696  :    SerialUndoExternalNaming(pDevExt);

  0012f	57		 push	 edi
  00130	e8 00 00 00 00	 call	 _SerialUndoExternalNaming@4

; 697  : 
; 698  :    SerialDump(SERTRACECALLS,("SERIAL: Exit SerialDisableInterfaces\n"));

  00135	f6 05 00 00 00
	00 40		 test	 BYTE PTR _SerialDebugLevel, 64 ; 00000040H
  0013c	5f		 pop	 edi
  0013d	5e		 pop	 esi
  0013e	74 0b		 je	 SHORT $L15147
  00140	68 00 00 00 00	 push	 OFFSET FLAT:$SG15152
  00145	e8 00 00 00 00	 call	 _DbgPrint
  0014a	59		 pop	 ecx
$L15147:

; 699  : }

  0014b	5d		 pop	 ebp
  0014c	c2 08 00	 ret	 8
_SerialDisableInterfacesResources@8 ENDP
_TEXT	ENDS
PUBLIC	_SerialRemoveDevObj@4
EXTRN	__imp__IoDeleteDevice@4:NEAR
EXTRN	__imp__IoDetachDevice@4:NEAR
;	COMDAT _SerialRemoveDevObj@4
PAGESRP0	SEGMENT
$SG15165 DB	'EX: Pageable code called at IRQL %d', 0aH, 00H
	ORG $+3
$SG15168 DB	'f:\w2ddk\src\kernel\serial\initunlo.c', 00H
	ORG $+2
$SG15169 DB	'FALSE', 00H
	ORG $+2
$SG15176 DB	'SERIAL: Enter SerialRemoveDevObj', 0aH, 00H
	ORG $+2
$SG15199 DB	'SERIAL: Leave SerialRemoveDevObj', 0aH, 00H
; Function compile flags: /Ogs
_PDevObj$ = 8
_SerialRemoveDevObj@4 PROC NEAR				; COMDAT

; 719  : {

  0009e	55		 push	 ebp
  0009f	8b ec		 mov	 ebp, esp

; 720  :    PSERIAL_DEVICE_EXTENSION pDevExt
; 721  :       = (PSERIAL_DEVICE_EXTENSION)PDevObj->DeviceExtension;

  000a1	8b 45 08	 mov	 eax, DWORD PTR _PDevObj$[ebp]
  000a4	56		 push	 esi
  000a5	57		 push	 edi

; 722  : 
; 723  :    PAGED_CODE();

  000a6	8b 3d 00 00 00
	00		 mov	 edi, DWORD PTR __imp__KeGetCurrentIrql@0
  000ac	8b 70 28	 mov	 esi, DWORD PTR [eax+40]
  000af	ff d7		 call	 edi
  000b1	3c 01		 cmp	 al, 1
  000b3	76 29		 jbe	 SHORT $L15170
  000b5	ff d7		 call	 edi
  000b7	0f b6 c0	 movzx	 eax, al
  000ba	50		 push	 eax
  000bb	68 00 00 00 00	 push	 OFFSET FLAT:$SG15165
  000c0	e8 00 00 00 00	 call	 _DbgPrint
  000c5	59		 pop	 ecx
  000c6	59		 pop	 ecx
  000c7	6a 00		 push	 0
  000c9	68 d3 02 00 00	 push	 723			; 000002d3H
  000ce	68 00 00 00 00	 push	 OFFSET FLAT:$SG15168
  000d3	68 00 00 00 00	 push	 OFFSET FLAT:$SG15169
  000d8	ff 15 00 00 00
	00		 call	 DWORD PTR __imp__RtlAssert@16
$L15170:

; 724  : 
; 725  :    SerialDump(SERTRACECALLS,("SERIAL: Enter SerialRemoveDevObj\n"));

  000de	f6 05 00 00 00
	00 40		 test	 BYTE PTR _SerialDebugLevel, 64 ; 00000040H
  000e5	74 0b		 je	 SHORT $L15171
  000e7	68 00 00 00 00	 push	 OFFSET FLAT:$SG15176
  000ec	e8 00 00 00 00	 call	 _DbgPrint
  000f1	59		 pop	 ecx
$L15171:

; 726  : 
; 727  :    if (!(pDevExt->DevicePNPAccept & SERIAL_PNPACCEPT_SURPRISE_REMOVING)) {

  000f2	f6 86 cc 04 00
	00 08		 test	 BYTE PTR [esi+1228], 8
  000f9	75 0a		 jne	 SHORT $L15183

; 728  :       //
; 729  :       // Disable all external interfaces and release resources
; 730  :       //
; 731  : 
; 732  :       SerialDisableInterfacesResources(PDevObj, TRUE);

  000fb	6a 01		 push	 1
  000fd	ff 75 08	 push	 DWORD PTR _PDevObj$[ebp]
  00100	e8 00 00 00 00	 call	 _SerialDisableInterfacesResources@8
$L15183:

; 733  :    }
; 734  : 
; 735  :    IoDetachDevice(pDevExt->LowerDeviceObject);

  00105	ff b6 a0 04 00
	00		 push	 DWORD PTR [esi+1184]
  0010b	ff 15 00 00 00
	00		 call	 DWORD PTR __imp__IoDetachDevice@4

; 736  : 
; 737  :    //
; 738  :    // Free memory allocated in the extension
; 739  :    //
; 740  : 
; 741  :    if (pDevExt->NtNameForPort.Buffer != NULL) {

  00111	8b 46 74	 mov	 eax, DWORD PTR [esi+116]
  00114	8b 3d 00 00 00
	00		 mov	 edi, DWORD PTR __imp__ExFreePool@4
  0011a	85 c0		 test	 eax, eax
  0011c	74 03		 je	 SHORT $L15185

; 742  :       ExFreePool(pDevExt->NtNameForPort.Buffer);

  0011e	50		 push	 eax
  0011f	ff d7		 call	 edi
$L15185:

; 743  :    }
; 744  : 
; 745  :    if (pDevExt->DeviceName.Buffer != NULL) {

  00121	8b 46 64	 mov	 eax, DWORD PTR [esi+100]
  00124	85 c0		 test	 eax, eax
  00126	74 03		 je	 SHORT $L15187

; 746  :       ExFreePool(pDevExt->DeviceName.Buffer);

  00128	50		 push	 eax
  00129	ff d7		 call	 edi
$L15187:

; 747  :    }
; 748  : 
; 749  :    if (pDevExt->SymbolicLinkName.Buffer != NULL) {

  0012b	8b 46 7c	 mov	 eax, DWORD PTR [esi+124]
  0012e	85 c0		 test	 eax, eax
  00130	74 03		 je	 SHORT $L15189

; 750  :       ExFreePool(pDevExt->SymbolicLinkName.Buffer);

  00132	50		 push	 eax
  00133	ff d7		 call	 edi
$L15189:

; 751  :    }
; 752  : 
; 753  :    if (pDevExt->DosName.Buffer != NULL) {

  00135	8b 86 84 00 00
	00		 mov	 eax, DWORD PTR [esi+132]
  0013b	85 c0		 test	 eax, eax
  0013d	74 03		 je	 SHORT $L15191

; 754  :       ExFreePool(pDevExt->DosName.Buffer);

  0013f	50		 push	 eax
  00140	ff d7		 call	 edi
$L15191:

; 755  :    }
; 756  : 
; 757  :    if (pDevExt->ObjectDirectory.Buffer) {

  00142	8b 76 6c	 mov	 esi, DWORD PTR [esi+108]
  00145	85 f6		 test	 esi, esi
  00147	74 03		 je	 SHORT $L15192

; 758  :       ExFreePool(pDevExt->ObjectDirectory.Buffer);

  00149	56		 push	 esi
  0014a	ff d7		 call	 edi
$L15192:

; 759  :    }
; 760  : 
; 761  :    //
; 762  :    // Delete the devobj
; 763  :    //
; 764  : 
; 765  :    IoDeleteDevice(PDevObj);

  0014c	ff 75 08	 push	 DWORD PTR _PDevObj$[ebp]
  0014f	ff 15 00 00 00
	00		 call	 DWORD PTR __imp__IoDeleteDevice@4

; 766  : 
; 767  : 
; 768  :    SerialDump(SERTRACECALLS,("SERIAL: Leave SerialRemoveDevObj\n"));

  00155	f6 05 00 00 00
	00 40		 test	 BYTE PTR _SerialDebugLevel, 64 ; 00000040H
  0015c	5f		 pop	 edi
  0015d	5e		 pop	 esi
  0015e	74 0b		 je	 SHORT $L15194
  00160	68 00 00 00 00	 push	 OFFSET FLAT:$SG15199
  00165	e8 00 00 00 00	 call	 _DbgPrint
  0016a	59		 pop	 ecx
$L15194:

; 769  : 
; 770  :    return STATUS_SUCCESS;

  0016b	33 c0		 xor	 eax, eax

; 771  : }

  0016d	5d		 pop	 ebp
  0016e	c2 04 00	 ret	 4
_SerialRemoveDevObj@4 ENDP
PAGESRP0	ENDS
EXTRN	_SerialKillAllStalled@4:NEAR
EXTRN	__imp__IoAcquireCancelSpinLock@4:NEAR
EXTRN	__imp__IoCancelIrp@4:NEAR
EXTRN	_SerialKillAllReadsOrWrites@12:NEAR
EXTRN	__imp__IoReleaseCancelSpinLock@4:NEAR
;	COMDAT _SerialKillPendingIrps@4
_TEXT	SEGMENT
$SG15218 DB	'SERIAL: Enter SerialKillPendingIrps', 0aH, 00H
	ORG $+3
$SG15239 DB	'SERIAL: Leave SerialKillPendingIrps', 0aH, 00H
; Function compile flags: /Ogs
_PDevObj$ = 8
_oldIrql$ = 8
_SerialKillPendingIrps@4 PROC NEAR			; COMDAT

; 791  : {

  0004d	55		 push	 ebp
  0004e	8b ec		 mov	 ebp, esp

; 792  :    PSERIAL_DEVICE_EXTENSION pDevExt = PDevObj->DeviceExtension;
; 793  :    KIRQL oldIrql;
; 794  : 
; 795  :    SerialDump (SERTRACECALLS,("SERIAL: Enter SerialKillPendingIrps\n"));

  00050	f6 05 00 00 00
	00 40		 test	 BYTE PTR _SerialDebugLevel, 64 ; 00000040H
  00057	56		 push	 esi
  00058	57		 push	 edi
  00059	8b 7d 08	 mov	 edi, DWORD PTR _PDevObj$[ebp]
  0005c	8b 77 28	 mov	 esi, DWORD PTR [edi+40]
  0005f	74 0b		 je	 SHORT $L15213
  00061	68 00 00 00 00	 push	 OFFSET FLAT:$SG15218
  00066	e8 00 00 00 00	 call	 _DbgPrint
  0006b	59		 pop	 ecx
$L15213:

; 796  : 
; 797  :    //
; 798  :    // First kill all the reads and writes.
; 799  :    //
; 800  : 
; 801  :     SerialKillAllReadsOrWrites(PDevObj, &pDevExt->WriteQueue,
; 802  :                                &pDevExt->CurrentWriteIrp);

  0006c	8d 86 c8 00 00
	00		 lea	 eax, DWORD PTR [esi+200]
  00072	50		 push	 eax
  00073	8d 86 ac 00 00
	00		 lea	 eax, DWORD PTR [esi+172]
  00079	50		 push	 eax
  0007a	57		 push	 edi
  0007b	e8 00 00 00 00	 call	 _SerialKillAllReadsOrWrites@12

; 803  : 
; 804  :     SerialKillAllReadsOrWrites(PDevObj, &pDevExt->ReadQueue,
; 805  :                                &pDevExt->CurrentReadIrp);

  00080	8d 86 c4 00 00
	00		 lea	 eax, DWORD PTR [esi+196]
  00086	50		 push	 eax
  00087	8d 86 a4 00 00
	00		 lea	 eax, DWORD PTR [esi+164]
  0008d	50		 push	 eax
  0008e	57		 push	 edi
  0008f	e8 00 00 00 00	 call	 _SerialKillAllReadsOrWrites@12

; 806  : 
; 807  :     //
; 808  :     // Next get rid of purges.
; 809  :     //
; 810  : 
; 811  :     SerialKillAllReadsOrWrites(PDevObj, &pDevExt->PurgeQueue,
; 812  :                                &pDevExt->CurrentPurgeIrp);

  00094	8d 86 d0 00 00
	00		 lea	 eax, DWORD PTR [esi+208]
  0009a	50		 push	 eax
  0009b	8d 86 bc 00 00
	00		 lea	 eax, DWORD PTR [esi+188]
  000a1	50		 push	 eax
  000a2	57		 push	 edi
  000a3	e8 00 00 00 00	 call	 _SerialKillAllReadsOrWrites@12

; 813  : 
; 814  :     //
; 815  :     // Get rid of any mask operations.
; 816  :     //
; 817  : 
; 818  :     SerialKillAllReadsOrWrites(PDevObj, &pDevExt->MaskQueue,
; 819  :                                &pDevExt->CurrentMaskIrp);

  000a8	8d 86 cc 00 00
	00		 lea	 eax, DWORD PTR [esi+204]
  000ae	50		 push	 eax
  000af	8d 86 b4 00 00
	00		 lea	 eax, DWORD PTR [esi+180]
  000b5	50		 push	 eax
  000b6	57		 push	 edi
  000b7	e8 00 00 00 00	 call	 _SerialKillAllReadsOrWrites@12

; 820  : 
; 821  :     //
; 822  :     // Now get rid a pending wait mask irp.
; 823  :     //
; 824  : 
; 825  :     IoAcquireCancelSpinLock(&oldIrql);

  000bc	8d 45 08	 lea	 eax, DWORD PTR _oldIrql

⌨️ 快捷键说明

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