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

📄 initunlo.cod

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

  0001a	57		 push	 edi
  0001b	e8 00 00 00 00	 call	 _SerialKillPendingIrps@4

; 635  : 
; 636  :    //
; 637  :    // Wait for any pending requests we raced on.
; 638  :    //
; 639  : 
; 640  :    pendingIRPs = InterlockedDecrement(&pDevExt->PendingIRPCnt);

  00020	8d 8e c8 04 00
	00		 lea	 ecx, DWORD PTR [esi+1224]
  00026	ff 15 00 00 00
	00		 call	 DWORD PTR __imp_@InterlockedDecrement@4

; 641  : 
; 642  :    if (pendingIRPs) {

  0002c	85 c0		 test	 eax, eax
  0002e	74 13		 je	 SHORT $L14918

; 643  :       KeWaitForSingleObject(&pDevExt->PendingIRPEvent, Executive, KernelMode,
; 644  :                             FALSE, NULL);

  00030	33 c0		 xor	 eax, eax
  00032	81 c6 d0 04 00
	00		 add	 esi, 1232		; 000004d0H
  00038	50		 push	 eax
  00039	50		 push	 eax
  0003a	50		 push	 eax
  0003b	50		 push	 eax
  0003c	56		 push	 esi
  0003d	ff 15 00 00 00
	00		 call	 DWORD PTR __imp__KeWaitForSingleObject@20
$L14918:

; 645  :    }
; 646  : 
; 647  :    state.DeviceState = PowerDeviceD3;

  00043	6a 04		 push	 4
  00045	58		 pop	 eax

; 648  : 
; 649  :    PoSetPowerState(PDevObj, DevicePowerState, state);

  00046	50		 push	 eax
  00047	6a 01		 push	 1
  00049	57		 push	 edi
  0004a	ff 15 00 00 00
	00		 call	 DWORD PTR __imp__PoSetPowerState@12

; 650  : 
; 651  :    return TRUE;

  00050	33 c0		 xor	 eax, eax
  00052	5f		 pop	 edi
  00053	40		 inc	 eax
  00054	5e		 pop	 esi

; 652  : }

  00055	c2 04 00	 ret	 4
_SerialPrepareRemove@4 ENDP
_TEXT	ENDS
PUBLIC	_SerialDisableInterfacesResources@8
EXTRN	_SerialUndoExternalNaming@4:NEAR
EXTRN	__imp__IoWMIRegistrationControl@8:NEAR
EXTRN	__imp__WRITE_PORT_UCHAR@8:NEAR
; Function compile flags: /Ogsy
;	COMDAT _SerialDisableInterfacesResources@8
_TEXT	SEGMENT
_PDevObj$ = 8
_DisableUART$ = 12
_SerialDisableInterfacesResources@8 PROC NEAR		; COMDAT

; 658  : {

  00000	56		 push	 esi
  00001	57		 push	 edi

; 659  :    PSERIAL_DEVICE_EXTENSION pDevExt
; 660  :       = (PSERIAL_DEVICE_EXTENSION)PDevObj->DeviceExtension;

  00002	8b 7c 24 0c	 mov	 edi, DWORD PTR _PDevObj$[esp+4]
  00006	8b 77 28	 mov	 esi, DWORD PTR [edi+40]

; 661  : 
; 662  :    PAGED_CODE();
; 663  : 
; 664  :    SerialDump(SERTRACECALLS,("SERIAL: Enter SerialDisableInterfaces\n"));
; 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) {

  00009	8b 86 e4 04 00
	00		 mov	 eax, DWORD PTR [esi+1252]
  0000f	a8 01		 test	 al, 1
  00011	74 2a		 je	 SHORT $L14930

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

  00013	a8 02		 test	 al, 2
  00015	75 1d		 jne	 SHORT $L14931

; 673  : 
; 674  :           if (DisableUART) {

  00017	80 7c 24 10 00	 cmp	 BYTE PTR _DisableUART$[esp+4], 0
  0001c	74 10		 je	 SHORT $L14935

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

  0001e	8b 86 98 00 00
	00		 mov	 eax, DWORD PTR [esi+152]
  00024	6a 00		 push	 0
  00026	40		 inc	 eax
  00027	50		 push	 eax
  00028	ff 15 00 00 00
	00		 call	 DWORD PTR __imp__WRITE_PORT_UCHAR@8
$L14935:

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

  0002e	56		 push	 esi
  0002f	e8 00 00 00 00	 call	 _SerialReleaseResources@4
$L14931:

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

  00034	6a 02		 push	 2
  00036	57		 push	 edi
  00037	ff 15 00 00 00
	00		 call	 DWORD PTR __imp__IoWMIRegistrationControl@8
$L14930:

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

  0003d	56		 push	 esi
  0003e	e8 00 00 00 00	 call	 _SerialUndoExternalNaming@4
  00043	5f		 pop	 edi
  00044	5e		 pop	 esi

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

  00045	c2 08 00	 ret	 8
_SerialDisableInterfacesResources@8 ENDP
_TEXT	ENDS
PUBLIC	_SerialRemoveDevObj@4
EXTRN	__imp__IoDeleteDevice@4:NEAR
EXTRN	__imp__IoDetachDevice@4:NEAR
; Function compile flags: /Ogsy
;	COMDAT _SerialRemoveDevObj@4
PAGESRP0	SEGMENT
_PDevObj$ = 8
_SerialRemoveDevObj@4 PROC NEAR				; COMDAT

; 719  : {

  00000	53		 push	 ebx

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

  00001	8b 5c 24 08	 mov	 ebx, DWORD PTR _PDevObj$[esp]
  00005	56		 push	 esi
  00006	57		 push	 edi
  00007	8b 73 28	 mov	 esi, DWORD PTR [ebx+40]

; 722  : 
; 723  :    PAGED_CODE();
; 724  : 
; 725  :    SerialDump(SERTRACECALLS,("SERIAL: Enter SerialRemoveDevObj\n"));
; 726  : 
; 727  :    if (!(pDevExt->DevicePNPAccept & SERIAL_PNPACCEPT_SURPRISE_REMOVING)) {

  0000a	f6 86 cc 04 00
	00 08		 test	 BYTE PTR [esi+1228], 8
  00011	75 08		 jne	 SHORT $L14951

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

  00013	6a 01		 push	 1
  00015	53		 push	 ebx
  00016	e8 00 00 00 00	 call	 _SerialDisableInterfacesResources@8
$L14951:

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

  0001b	ff b6 a0 04 00
	00		 push	 DWORD PTR [esi+1184]
  00021	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) {

  00027	8b 46 74	 mov	 eax, DWORD PTR [esi+116]
  0002a	8b 3d 00 00 00
	00		 mov	 edi, DWORD PTR __imp__ExFreePool@4
  00030	85 c0		 test	 eax, eax
  00032	74 03		 je	 SHORT $L14953

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

  00034	50		 push	 eax
  00035	ff d7		 call	 edi
$L14953:

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

  00037	8b 46 64	 mov	 eax, DWORD PTR [esi+100]
  0003a	85 c0		 test	 eax, eax
  0003c	74 03		 je	 SHORT $L14955

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

  0003e	50		 push	 eax
  0003f	ff d7		 call	 edi
$L14955:

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

  00041	8b 46 7c	 mov	 eax, DWORD PTR [esi+124]
  00044	85 c0		 test	 eax, eax
  00046	74 03		 je	 SHORT $L14957

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

  00048	50		 push	 eax
  00049	ff d7		 call	 edi
$L14957:

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

  0004b	8b 86 84 00 00
	00		 mov	 eax, DWORD PTR [esi+132]
  00051	85 c0		 test	 eax, eax
  00053	74 03		 je	 SHORT $L14959

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

  00055	50		 push	 eax
  00056	ff d7		 call	 edi
$L14959:

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

  00058	8b 76 6c	 mov	 esi, DWORD PTR [esi+108]
  0005b	85 f6		 test	 esi, esi
  0005d	74 03		 je	 SHORT $L14960

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

  0005f	56		 push	 esi
  00060	ff d7		 call	 edi
$L14960:

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

  00062	53		 push	 ebx
  00063	ff 15 00 00 00
	00		 call	 DWORD PTR __imp__IoDeleteDevice@4
  00069	5f		 pop	 edi
  0006a	5e		 pop	 esi

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

  0006b	33 c0		 xor	 eax, eax
  0006d	5b		 pop	 ebx

; 771  : }

  0006e	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
; Function compile flags: /Ogsy
;	COMDAT _SerialKillPendingIrps@4
_TEXT	SEGMENT
_PDevObj$ = 8
_oldIrql$ = 8
_SerialKillPendingIrps@4 PROC NEAR			; COMDAT

; 791  : {

  00000	55		 push	 ebp
  00001	8b ec		 mov	 ebp, esp
  00003	56		 push	 esi
  00004	57		 push	 edi

; 792  :    PSERIAL_DEVICE_EXTENSION pDevExt = PDevObj->DeviceExtension;

  00005	8b 7d 08	 mov	 edi, DWORD PTR _PDevObj$[ebp]
  00008	8b 77 28	 mov	 esi, DWORD PTR [edi+40]

; 793  :    KIRQL oldIrql;
; 794  : 
; 795  :    SerialDump (SERTRACECALLS,("SERIAL: Enter SerialKillPendingIrps\n"));
; 796  : 
; 797  :    //
; 798  :    // First kill all the reads and writes.
; 799  :    //
; 800  : 
; 801  :     SerialKillAllReadsOrWrites(PDevObj, &pDevExt->WriteQueue,
; 802  :                                &pDevExt->CurrentWriteIrp);

  0000b	8d 86 c8 00 00
	00		 lea	 eax, DWORD PTR [esi+200]
  00011	50		 push	 eax
  00012	8d 86 ac 00 00
	00		 lea	 eax, DWORD PTR [esi+172]
  00018	50		 push	 eax
  00019	57		 push	 edi
  0001a	e8 00 00 00 00	 call	 _SerialKillAllReadsOrWrites@12

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

  0001f	8d 86 c4 00 00
	00		 lea	 eax, DWORD PTR [esi+196]
  00025	50		 push	 eax
  00026	8d 86 a4 00 00
	00		 lea	 eax, DWORD PTR [esi+164]
  0002c	50		 push	 eax
  0002d	57		 push	 edi
  0002e	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);

  00033	8d 86 d0 00 00
	00		 lea	 eax, DWORD PTR [esi+208]
  00039	50		 push	 eax
  0003a	8d 86 bc 00 00
	00		 lea	 eax, DWORD PTR [esi+188]
  00040	50		 push	 eax
  00041	57		 push	 edi
  00042	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);

  00047	8d 86 cc 00 00
	00		 lea	 eax, DWORD PTR [esi+204]
  0004d	50		 push	 eax
  0004e	8d 86 b4 00 00
	00		 lea	 eax, DWORD PTR [esi+180]
  00054	50		 push	 eax
  00055	57		 push	 edi
  00056	e8 00 00 00 00	 call	 _SerialKillAllReadsOrWrites@12

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

  0005b	8d 45 08	 lea	 eax, DWORD PTR _oldIrql$[ebp]
  0005e	50		 push	 eax
  0005f	ff 15 00 00 00
	00		 call	 DWORD PTR __imp__IoAcquireCancelSpinLock@4

; 826  : 
; 827  :     if (pDevExt->CurrentWaitIrp) {

  00065	8b 86 d4 00 00
	00		 mov	 eax, DWORD PTR [esi+212]
  0006b	85 c0		 test	 eax, eax
  0006d	74 2c		 je	 SHORT $L14973

; 828  : 
; 829  :         PDRIVER_CANCEL cancelRoutine;
; 830  : 
; 831  :         cancelRoutine = pDevExt->CurrentWaitIrp->CancelRoutine;

  0006f	8b 48 38	 mov	 ecx, DWORD PTR [eax+56]

; 832  :         pDevExt->CurrentWaitIrp->Cancel = TRUE;

⌨️ 快捷键说明

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