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

📄 initunlo.cod

📁 怎样在win2000下构造驱动程序znsoft_Serial2000_demo.ZIP
💻 COD
📖 第 1 页 / 共 5 页
字号:
  00072	c6 40 24 01	 mov	 BYTE PTR [eax+36], 1

; 833  : 
; 834  :         if (cancelRoutine) {

  00076	85 c9		 test	 ecx, ecx
  00078	74 2a		 je	 SHORT $L14977

; 835  : 
; 836  :             pDevExt->CurrentWaitIrp->CancelIrql = oldIrql;

  0007a	8b 86 d4 00 00
	00		 mov	 eax, DWORD PTR [esi+212]
  00080	8a 55 08	 mov	 dl, BYTE PTR _oldIrql$[ebp]
  00083	88 50 25	 mov	 BYTE PTR [eax+37], dl

; 837  :             pDevExt->CurrentWaitIrp->CancelRoutine = NULL;

  00086	8b 86 d4 00 00
	00		 mov	 eax, DWORD PTR [esi+212]
  0008c	83 60 38 00	 and	 DWORD PTR [eax+56], 0

; 838  : 
; 839  :             cancelRoutine(PDevObj, pDevExt->CurrentWaitIrp);

  00090	ff b6 d4 00 00
	00		 push	 DWORD PTR [esi+212]
  00096	57		 push	 edi
  00097	ff d1		 call	 ecx

; 840  : 
; 841  :         }
; 842  : 
; 843  :     } else {

  00099	eb 09		 jmp	 SHORT $L14977
$L14973:

; 844  : 
; 845  :         IoReleaseCancelSpinLock(oldIrql);

  0009b	ff 75 08	 push	 DWORD PTR _oldIrql$[ebp]
  0009e	ff 15 00 00 00
	00		 call	 DWORD PTR __imp__IoReleaseCancelSpinLock@4
$L14977:

; 846  : 
; 847  :     }
; 848  : 
; 849  :     //
; 850  :     // Cancel any pending wait-wake irps
; 851  :     //
; 852  : 
; 853  :     if (pDevExt->PendingWakeIrp != NULL) {

  000a4	81 c6 88 05 00
	00		 add	 esi, 1416		; 00000588H
  000aa	8b 06		 mov	 eax, DWORD PTR [esi]
  000ac	85 c0		 test	 eax, eax
  000ae	74 0a		 je	 SHORT $L14979

; 854  :        IoCancelIrp(pDevExt->PendingWakeIrp);

  000b0	50		 push	 eax
  000b1	ff 15 00 00 00
	00		 call	 DWORD PTR __imp__IoCancelIrp@4

; 855  :        pDevExt->PendingWakeIrp = NULL;

  000b7	83 26 00	 and	 DWORD PTR [esi], 0
$L14979:

; 856  :     }
; 857  : 
; 858  :     //
; 859  :     // Finally, dump any stalled IRPS
; 860  :     //
; 861  : 
; 862  :     SerialKillAllStalled(PDevObj);

  000ba	57		 push	 edi
  000bb	e8 00 00 00 00	 call	 _SerialKillAllStalled@4
  000c0	5f		 pop	 edi
  000c1	5e		 pop	 esi

; 863  : 
; 864  : 
; 865  :     SerialDump (SERTRACECALLS,("SERIAL: Leave SerialKillPendingIrps\n"));
; 866  : }

  000c2	5d		 pop	 ebp
  000c3	c2 04 00	 ret	 4
_SerialKillPendingIrps@4 ENDP
_TEXT	ENDS
PUBLIC	_SerialSingleToMulti@4
EXTRN	_SerialSharerIsr@8:NEAR
EXTRN	_SerialIndexedMultiportIsr@8:NEAR
EXTRN	_SerialBitMappedMultiportIsr@8:NEAR
; Function compile flags: /Ogsy
;	COMDAT _SerialSingleToMulti@4
_TEXT	SEGMENT
_Context$ = 8
_SerialSingleToMulti@4 PROC NEAR			; COMDAT

; 889  :    PSERIAL_DEVICE_EXTENSION pDevExt = (PSERIAL_DEVICE_EXTENSION)Context;
; 890  :    PSERIAL_MULTIPORT_DISPATCH pOurIsrContext;
; 891  :    PSERIAL_MULTIPORT_DISPATCH pNewIsrContext
; 892  :       = (PSERIAL_MULTIPORT_DISPATCH)pDevExt->NewExtension;

  00000	8b 44 24 04	 mov	 eax, DWORD PTR _Context$[esp-4]
  00004	56		 push	 esi
  00005	8b b0 d4 01 00
	00		 mov	 esi, DWORD PTR [eax+468]

; 893  :    PVOID isrFunc;
; 894  : 
; 895  :    SerialDump (SERTRACECALLS,("SERIAL: Enter SerialSingleToMulti\n"));
; 896  : 
; 897  :    //
; 898  :    // Stomp OurIsrContext since we are going from one to many
; 899  :    // thus our previous context was just pDevExt and doesn't
; 900  :    // need to be released (i.e., no call to ExFreePool() is needed).
; 901  :    //
; 902  : 
; 903  :    pOurIsrContext = pDevExt->OurIsrContext = pDevExt->TopLevelOurIsrContext
; 904  :       = pNewIsrContext;
; 905  : 
; 906  :    //
; 907  :    // We are now multiport
; 908  :    //
; 909  : 
; 910  :    pDevExt->PortOnAMultiportCard = TRUE;
; 911  : 
; 912  :    //
; 913  :    // Update our personal extensions slot
; 914  :    //
; 915  : 
; 916  :    pOurIsrContext->Extensions[pDevExt->PortIndex - 1] = pDevExt;

  0000b	8d 88 c0 01 00
	00		 lea	 ecx, DWORD PTR [eax+448]
  00011	89 70 04	 mov	 DWORD PTR [eax+4], esi
  00014	89 b0 94 00 00
	00		 mov	 DWORD PTR [eax+148], esi
  0001a	8b 11		 mov	 edx, DWORD PTR [ecx]
  0001c	c6 80 a3 01 00
	00 01		 mov	 BYTE PTR [eax+419], 1
  00023	89 04 96	 mov	 DWORD PTR [esi+edx*4], eax

; 917  :    pOurIsrContext->InterruptStatus = pDevExt->InterruptStatus;

  00026	8b 90 9c 00 00
	00		 mov	 edx, DWORD PTR [eax+156]
  0002c	89 16		 mov	 DWORD PTR [esi], edx

; 918  : 
; 919  : 
; 920  :    //
; 921  :    // We have to pick a new ISR and a new context.
; 922  :    // As soon as this is done, the ISR will change, so we have to
; 923  :    // be ready to handle things there.
; 924  :    //
; 925  : 
; 926  :    if (pDevExt->Indexed == FALSE) {

  0002e	80 b8 c4 01 00
	00 00		 cmp	 BYTE PTR [eax+452], 0
  00035	75 1a		 jne	 SHORT $L14997

; 927  :       pOurIsrContext->UsablePortMask = 1 << (pDevExt->PortIndex - 1);

  00037	8b 09		 mov	 ecx, DWORD PTR [ecx]
  00039	b2 01		 mov	 dl, 1
  0003b	49		 dec	 ecx
  0003c	d2 e2		 shl	 dl, cl
  0003e	88 56 48	 mov	 BYTE PTR [esi+72], dl

; 928  :       pOurIsrContext->MaskInverted = pDevExt->MaskInverted;

  00041	8b 88 c8 01 00
	00		 mov	 ecx, DWORD PTR [eax+456]
  00047	89 4e 44	 mov	 DWORD PTR [esi+68], ecx

; 929  :       isrFunc = SerialBitMappedMultiportIsr;

  0004a	b9 00 00 00 00	 mov	 ecx, OFFSET FLAT:_SerialBitMappedMultiportIsr@8

; 930  :    } else {

  0004f	eb 05		 jmp	 SHORT $L14998
$L14997:

; 931  :       isrFunc = SerialIndexedMultiportIsr;

  00051	b9 00 00 00 00	 mov	 ecx, OFFSET FLAT:_SerialIndexedMultiportIsr@8
$L14998:

; 932  :    }
; 933  : 
; 934  :    pDevExt->OurIsr = isrFunc;

  00056	89 88 90 00 00
	00		 mov	 DWORD PTR [eax+144], ecx

; 935  :    pDevExt->TopLevelOurIsr = isrFunc;

  0005c	89 08		 mov	 DWORD PTR [eax], ecx

; 936  : 
; 937  :    if (pDevExt->CIsrSw->IsrFunc != SerialSharerIsr) {

  0005e	05 c4 04 00 00	 add	 eax, 1220		; 000004c4H
  00063	8b 10		 mov	 edx, DWORD PTR [eax]
  00065	81 3a 00 00 00
	00		 cmp	 DWORD PTR [edx], OFFSET FLAT:_SerialSharerIsr@8
  0006b	74 07		 je	 SHORT $L15000

; 938  :          pDevExt->CIsrSw->IsrFunc = isrFunc;

  0006d	89 0a		 mov	 DWORD PTR [edx], ecx

; 939  :          pDevExt->CIsrSw->Context = pOurIsrContext;

  0006f	8b 00		 mov	 eax, DWORD PTR [eax]
  00071	89 70 04	 mov	 DWORD PTR [eax+4], esi
$L15000:

; 940  :    }
; 941  : 
; 942  :    SerialDump (SERTRACECALLS,("SERIAL: Leave SerialSingleToMulti\n"));
; 943  :    return TRUE;

  00074	b0 01		 mov	 al, 1
  00076	5e		 pop	 esi

; 944  : }

  00077	c2 04 00	 ret	 4
_SerialSingleToMulti@4 ENDP
_TEXT	ENDS
PUBLIC	_SerialAddToMulti@4
; Function compile flags: /Ogsy
;	COMDAT _SerialAddToMulti@4
_TEXT	SEGMENT
_Context$ = 8
_SerialAddToMulti@4 PROC NEAR				; COMDAT

; 967  :    PSERIAL_DEVICE_EXTENSION pDevExt = (PSERIAL_DEVICE_EXTENSION)Context;
; 968  :    PSERIAL_MULTIPORT_DISPATCH pOurIsrContext
; 969  :       = (PSERIAL_MULTIPORT_DISPATCH)pDevExt->OurIsrContext;

  00000	8b 44 24 04	 mov	 eax, DWORD PTR _Context$[esp-4]
  00004	53		 push	 ebx
  00005	56		 push	 esi
  00006	57		 push	 edi

; 970  :    PSERIAL_DEVICE_EXTENSION pNewExt
; 971  :       = (PSERIAL_DEVICE_EXTENSION)pDevExt->NewExtension;
; 972  : 
; 973  : 
; 974  :    SerialDump (SERTRACECALLS,("SERIAL: Enter SerialAddToMulti\n"));
; 975  : 
; 976  :    if (pDevExt->Indexed == FALSE) {

  00007	80 b8 c4 01 00
	00 00		 cmp	 BYTE PTR [eax+452], 0
  0000e	8b b8 94 00 00
	00		 mov	 edi, DWORD PTR [eax+148]
  00014	8b b0 d4 01 00
	00		 mov	 esi, DWORD PTR [eax+468]
  0001a	75 17		 jne	 SHORT $L15016

; 977  :       pOurIsrContext->UsablePortMask |= 1 << (pDevExt->NewPortIndex - 1);

  0001c	8b 88 cc 01 00
	00		 mov	 ecx, DWORD PTR [eax+460]
  00022	b2 01		 mov	 dl, 1
  00024	49		 dec	 ecx
  00025	d2 e2		 shl	 dl, cl
  00027	08 57 48	 or	 BYTE PTR [edi+72], dl

; 978  :       pOurIsrContext->MaskInverted |= pDevExt->NewMaskInverted;

  0002a	8b 88 d0 01 00
	00		 mov	 ecx, DWORD PTR [eax+464]
  00030	09 4f 44	 or	 DWORD PTR [edi+68], ecx
$L15016:

; 979  :    }
; 980  : 
; 981  :    //
; 982  :    // Add us to the linked list of common interrupt objects if we are not
; 983  :    // already in it. We may be if there is another device besides our
; 984  :    // multiport card.
; 985  :    //
; 986  : 
; 987  :    if (IsListEmpty(&pNewExt->CommonInterruptObject)) {

  00033	8d 4e 10	 lea	 ecx, DWORD PTR [esi+16]
  00036	39 09		 cmp	 DWORD PTR [ecx], ecx
  00038	75 10		 jne	 SHORT $L15017

; 988  :       InsertTailList(&pDevExt->CommonInterruptObject,
; 989  :                      &pNewExt->CommonInterruptObject);

  0003a	8d 50 10	 lea	 edx, DWORD PTR [eax+16]
  0003d	8b 5a 04	 mov	 ebx, DWORD PTR [edx+4]
  00040	89 11		 mov	 DWORD PTR [ecx], edx
  00042	89 5e 14	 mov	 DWORD PTR [esi+20], ebx
  00045	89 0b		 mov	 DWORD PTR [ebx], ecx
  00047	89 4a 04	 mov	 DWORD PTR [edx+4], ecx
$L15017:

; 990  :    }
; 991  : 
; 992  :    //
; 993  :    // Give us the list of contexts also
; 994  :    //
; 995  : 
; 996  :    pNewExt->OurIsrContext = pOurIsrContext;
; 997  : 
; 998  : 
; 999  :    //
; 1000 :    // Add us to the list of our siblings
; 1001 :    //
; 1002 :    InsertTailList(&pDevExt->MultiportSiblings, &pNewExt->MultiportSiblings);

  0004a	8d 48 18	 lea	 ecx, DWORD PTR [eax+24]
  0004d	89 be 94 00 00
	00		 mov	 DWORD PTR [esi+148], edi
  00053	8d 56 18	 lea	 edx, DWORD PTR [esi+24]
  00056	8b 59 04	 mov	 ebx, DWORD PTR [ecx+4]
  00059	89 0a		 mov	 DWORD PTR [edx], ecx
  0005b	89 5e 1c	 mov	 DWORD PTR [esi+28], ebx
  0005e	89 13		 mov	 DWORD PTR [ebx], edx
  00060	89 51 04	 mov	 DWORD PTR [ecx+4], edx

; 1003 : 
; 1004 :    SerialDump(SERDIAG1, ("SERIAL: Adding to multi...\n"));
; 1005 :    SerialDump(SERDIAG1, ("------: old ext %x\n", pDevExt));
; 1006 : 
; 1007 :    //
; 1008 :    // Map us in so the ISR can find us.
; 1009 :    //
; 1010 : 
; 1011 :    pOurIsrContext->Extensions[pDevExt->NewPortIndex - 1]
; 1012 :       = pDevExt->NewExtension;

  00063	8b 88 cc 01 00
	00		 mov	 ecx, DWORD PTR [eax+460]
  00069	8b 90 d4 01 00
	00		 mov	 edx, DWORD PTR [eax+468]
  0006f	89 14 8f	 mov	 DWORD PTR [edi+ecx*4], edx

; 1013 : 
; 1014 :    pNewExt->TopLevelOurIsr = pDevExt->TopLevelOurIsr;

  00072	8b 08		 mov	 ecx, DWORD PTR [eax]
  00074	89 0e		 mov	 DWORD PTR [esi], ecx

; 1015 :    pNewExt->TopLevelOurIsrContext = pDevExt->TopLevelOurIsrContext;

  00076	8b 40 04	 mov	 eax, DWORD PTR [eax+4]
  00079	89 46 04	 mov	 DWORD PTR [esi+4], eax
  0007c	5f		 pop	 edi
  0007d	5e		 pop	 esi

; 1016 : 
; 1017 :    SerialDump (SERTRACECALLS,("SERIAL: Leave SerialAddToMulti\n"));
; 1018 :    return TRUE;

  0007e	b0 01		 mov	 al, 1
  00080	5b		 pop	 ebx

; 1019 : }

  00081	c2 04 00	 ret	 4
_SerialAddToMulti@4 ENDP
_TEXT	ENDS
PUBLIC	_SerialInitMultiPort@12
PUBLIC	_SerialInitOneController@8
; Function compile flags: /Ogsy
;	COMDAT _SerialInitMultiPort@12
PAGESRP0	SEGMENT
_PDevExt$ = 8
_PConfigData$ = 12
_PDevObj$ = 16
_SerialInitMultiPort@12 PROC NEAR			; COMDAT

; 1047 : {

  00000	53		 push	 ebx

; 1048 :    PSERIAL_DEVICE_EXTENSION pOurIsrContext
; 1049 :       = (PSERIAL_DEVICE_EXTENSION)PDevExt->OurIsrContext;
; 1050 :    PSERIAL_DEVICE_EXTENSION pNewExt
; 1051 :       = (PSERIAL_DEVICE_EXTENSION)PDevObj->DeviceExtension;

  00001	8b 5c 24 10	 mov	 ebx, DWORD PTR _PDevObj$[esp]
  00005	56		 push	 esi

; 1052 :    NTSTATUS status;
; 1053 :    PSERIAL_MULTIPORT_DISPATCH pDispatch;
; 1054 : 
; 1055 :    PAGED_CODE();
; 1056 : 
; 1057 : 
; 1058 :    SerialDump (SERTRACECALLS,("SERIAL: Enter SerialInitMultiPort\n"));
; 1059 : 
; 1060 :    //
; 1061 :    // Allow him to share our CISRsw and interrupt object
; 1062 :    //
; 1063 : 
; 1064 :    pNewExt->CIsrSw = PDevExt->CIsrSw;

  00006	8b 74 24 0c	 mov	 esi, DWORD PTR _PDevExt$[esp+4]
  0000a	8b 43 28	 mov	 eax, DWORD PTR [ebx+40]
  0000d	57		 push	 edi
  0000e	8b 8e c4 04 00
	00		 mov	 ecx, DWORD PTR [esi+1220]

; 1065 :    pNewExt->Interrupt = PDevExt->Interrupt;
; 1066 : 
; 1067 :    //
; 1068 :    // First, see if we can initialize the one we have found
; 1069 :    //
; 1070 : 
; 1071 :    status = SerialInitOneController(PDevObj, PConfigData);

  00014	8b 7c 24 14	 mov	 edi, DWORD PTR _PConfigData$[esp+8]
  00018	89 88 c4 04 00
	00		 mov	 DWORD PTR [eax+1220], ecx
  0001e	8b 8e a0 00 00
	00		 mov	 ecx, DWORD PTR [esi+160]
  00024	57		 push	 edi
  00025	53		 push	 ebx
  00026	89 88 a0 00 00
	00		 mov	 DWORD PTR [eax+160], ecx
  0002c	e8 00 00 00 00	 call	 _SerialInitOneController@8

; 1072 : 
; 1073 :    if (!NT_SUCCESS(status)) {

  00031	85 c0		 test	 eax, eax

; 1074 :       SerialDump (SERTRACECALLS,("SERIAL: Leave SerialInitMultiPort\n"));
; 1075 :       return status;

⌨️ 快捷键说明

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