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

📄 legacy.cod

📁 怎样在win2000下构造驱动程序znsoft_Serial2000_demo.ZIP
💻 COD
📖 第 1 页 / 共 5 页
字号:
  003a6	8d 45 f8	 lea	 eax, DWORD PTR _outAddrSpace$[ebp]
  003a9	50		 push	 eax
  003aa	ff 73 0c	 push	 DWORD PTR [ebx+12]
  003ad	ff 73 08	 push	 DWORD PTR [ebx+8]
  003b0	ff 73 20	 push	 DWORD PTR [ebx+32]
  003b3	ff 73 24	 push	 DWORD PTR [ebx+36]
  003b6	ff 15 00 00 00
	00		 call	 DWORD PTR __imp__HalTranslateBusAddress@24
  003bc	84 c0		 test	 al, al
  003be	75 6c		 jne	 SHORT $L14896

; 173  : 
; 174  :          SerialLogError(DriverObject, NULL, PUserData->UserPort,
; 175  :                         SerialPhysicalZero, 0, 0, 0, 62, STATUS_SUCCESS,
; 176  :                         SERIAL_NO_TRANSLATE_ISR, UserSubKey->NameLength
; 177  :                         + sizeof(WCHAR), &UserSubKey->Name[0], 0, NULL);

  003c0	8b 4d 0c	 mov	 ecx, DWORD PTR _UserSubKey$[ebp]
  003c3	33 c0		 xor	 eax, eax
  003c5	50		 push	 eax
  003c6	50		 push	 eax
  003c7	8d 51 10	 lea	 edx, DWORD PTR [ecx+16]
  003ca	8b 49 0c	 mov	 ecx, DWORD PTR [ecx+12]
  003cd	41		 inc	 ecx
  003ce	52		 push	 edx
  003cf	41		 inc	 ecx
  003d0	51		 push	 ecx
  003d1	68 27 00 06 c0	 push	 -1073348569		; c0060027H
  003d6	50		 push	 eax
  003d7	6a 3e		 push	 62			; 0000003eH
  003d9	50		 push	 eax
  003da	50		 push	 eax
  003db	50		 push	 eax
  003dc	ff 35 04 00 00
	00		 push	 DWORD PTR _SerialPhysicalZero+4
  003e2	ff 35 00 00 00
	00		 push	 DWORD PTR _SerialPhysicalZero
  003e8	ff 73 04	 push	 DWORD PTR [ebx+4]
  003eb	ff 33		 push	 DWORD PTR [ebx]
  003ed	50		 push	 eax
  003ee	ff 75 08	 push	 DWORD PTR _DriverObject$[ebp]
  003f1	e8 00 00 00 00	 call	 _SerialLogError@64

; 178  : 
; 179  : 
; 180  :          SerialDump(SERERRORS, ("SERIAL: ISR map failed attempt was \n"
; 181  :                                 "------- Interface:  %x\n"
; 182  :                                 "------- Bus Number: %x\n"
; 183  :                                 "------- IntStatus:  %x\n"
; 184  :                                 "------- AddrSpace:  %x\n"
; 185  :                                 "------- PhysAddr:   %x\n",
; 186  :                                 PUserData->UserInterfaceType,
; 187  :                                 PUserData->UserBusNumber,
; 188  :                                 PUserData->UserInterruptStatus,
; 189  :                                 PTrResourceList->List[0].
; 190  :                                 PartialResourceList.PartialDescriptors[2]
; 191  :                                 .Flags,
; 192  :                                 PTrResourceList->List[0].
; 193  :                                 PartialResourceList.PartialDescriptors[2]
; 194  :                                 .u.Port.Start.QuadPart));

  003f6	f6 05 03 00 00
	00 40		 test	 BYTE PTR _SerialDebugLevel+3, 64 ; 00000040H
  003fd	74 24		 je	 SHORT $L14883
  003ff	ff 76 3c	 push	 DWORD PTR [esi+60]
  00402	0f b7 46 36	 movzx	 eax, WORD PTR [esi+54]
  00406	ff 76 38	 push	 DWORD PTR [esi+56]
  00409	50		 push	 eax
  0040a	ff 73 0c	 push	 DWORD PTR [ebx+12]
  0040d	ff 73 08	 push	 DWORD PTR [ebx+8]
  00410	ff 73 20	 push	 DWORD PTR [ebx+32]
  00413	ff 73 24	 push	 DWORD PTR [ebx+36]
  00416	68 00 00 00 00	 push	 OFFSET FLAT:$SG14888
$L16243:
  0041b	e8 00 00 00 00	 call	 _DbgPrint
  00420	83 c4 20	 add	 esp, 32			; 00000020H
$L14883:

; 195  : 
; 196  :         status = STATUS_NONE_MAPPED;

  00423	c7 45 f4 73 00
	00 c0		 mov	 DWORD PTR _status$[ebp], -1073741709 ; c0000073H

; 197  :         goto SerialTranslateError;

  0042a	eb 30		 jmp	 SHORT $SerialTranslateError$14866
$L14896:

; 198  :       }
; 199  : 
; 200  :       SerialDump(SERDIAG1, ("SERIAL: ISR map was %x\n", outPhysAddr.QuadPart));

  0042c	f6 05 00 00 00
	00 01		 test	 BYTE PTR _SerialDebugLevel, 1
  00433	74 13		 je	 SHORT $L14897
  00435	ff 75 ec	 push	 DWORD PTR _outPhysAddr$[ebp+4]
  00438	ff 75 e8	 push	 DWORD PTR _outPhysAddr$[ebp]
  0043b	68 00 00 00 00	 push	 OFFSET FLAT:$SG14902
  00440	e8 00 00 00 00	 call	 _DbgPrint
  00445	83 c4 0c	 add	 esp, 12			; 0000000cH
$L14897:

; 201  : 
; 202  :       PTrResourceList->List[0].PartialResourceList.
; 203  :          PartialDescriptors[2].Flags = (USHORT)outAddrSpace;

  00448	66 8b 45 f8	 mov	 ax, WORD PTR _outAddrSpace$[ebp]
  0044c	66 89 46 36	 mov	 WORD PTR [esi+54], ax

; 204  :       PTrResourceList->List[0].PartialResourceList.PartialDescriptors[2]
; 205  :          .u.Port.Start = outPhysAddr;

  00450	8b 45 e8	 mov	 eax, DWORD PTR _outPhysAddr$[ebp]
  00453	89 46 38	 mov	 DWORD PTR [esi+56], eax
  00456	8b 45 ec	 mov	 eax, DWORD PTR _outPhysAddr$[ebp+4]
  00459	89 46 3c	 mov	 DWORD PTR [esi+60], eax
$SerialTranslateError$14866:

; 206  :    }
; 207  : 
; 208  :    SerialTranslateError:;
; 209  : 
; 210  :    SerialDump(SERTRACECALLS, ("SERIAL: Enter SerialTranslateResourceList\n"));

  0045c	f6 05 00 00 00
	00 40		 test	 BYTE PTR _SerialDebugLevel, 64 ; 00000040H
  00463	5f		 pop	 edi
  00464	5e		 pop	 esi
  00465	5b		 pop	 ebx
  00466	74 0b		 je	 SHORT $L14911
  00468	68 00 00 00 00	 push	 OFFSET FLAT:$SG14916
  0046d	e8 00 00 00 00	 call	 _DbgPrint
  00472	59		 pop	 ecx
$L14911:

; 211  : 
; 212  :    return status;

  00473	8b 45 f4	 mov	 eax, DWORD PTR _status$[ebp]

; 213  : }

  00476	c9		 leave
  00477	c2 18 00	 ret	 24			; 00000018H
_SerialTranslateResourceList@24 ENDP
INIT	ENDS
PUBLIC	_SerialBuildRequirementsList@12
;	COMDAT _SerialBuildRequirementsList@12
INIT	SEGMENT
$SG14935 DB	'EX: Pageable code called at IRQL %d', 0aH, 00H
	ORG $+3
$SG14938 DB	'f:\w2ddk\src\kernel\serial\legacy.c', 00H
$SG14939 DB	'FALSE', 00H
	ORG $+2
$SG14946 DB	'SERIAL: Enter SerialBuildRequirementsList', 0aH, 00H
	ORG $+1
$SG14970 DB	'SERIAL: Leave SerialBuildRequirementsList', 0aH, 00H
; Function compile flags: /Ogs
_PRequiredList$ = 8
_PartialCount$ = 12
_PUserData$ = 16
_SerialBuildRequirementsList@12 PROC NEAR		; COMDAT

; 248  : {

  000ab	55		 push	 ebp
  000ac	8b ec		 mov	 ebp, esp
  000ae	53		 push	 ebx
  000af	56		 push	 esi

; 249  :    PIO_RESOURCE_LIST reqResList;
; 250  :    PIO_RESOURCE_DESCRIPTOR reqResDesc;
; 251  :    NTSTATUS status = STATUS_SUCCESS;
; 252  : 
; 253  :    PAGED_CODE();

  000b0	8b 35 00 00 00
	00		 mov	 esi, DWORD PTR __imp__KeGetCurrentIrql@0
  000b6	ff d6		 call	 esi
  000b8	33 db		 xor	 ebx, ebx
  000ba	43		 inc	 ebx
  000bb	3a c3		 cmp	 al, bl
  000bd	76 29		 jbe	 SHORT $L14940
  000bf	ff d6		 call	 esi
  000c1	0f b6 c0	 movzx	 eax, al
  000c4	50		 push	 eax
  000c5	68 00 00 00 00	 push	 OFFSET FLAT:$SG14935
  000ca	e8 00 00 00 00	 call	 _DbgPrint
  000cf	59		 pop	 ecx
  000d0	59		 pop	 ecx
  000d1	6a 00		 push	 0
  000d3	68 fd 00 00 00	 push	 253			; 000000fdH
  000d8	68 00 00 00 00	 push	 OFFSET FLAT:$SG14938
  000dd	68 00 00 00 00	 push	 OFFSET FLAT:$SG14939
  000e2	ff 15 00 00 00
	00		 call	 DWORD PTR __imp__RtlAssert@16
$L14940:

; 254  : 
; 255  :    SerialDump(SERTRACECALLS, ("SERIAL: Enter SerialBuildRequirementsList\n"));

  000e8	f6 05 00 00 00
	00 40		 test	 BYTE PTR _SerialDebugLevel, 64 ; 00000040H
  000ef	74 0b		 je	 SHORT $L14941
  000f1	68 00 00 00 00	 push	 OFFSET FLAT:$SG14946
  000f6	e8 00 00 00 00	 call	 _DbgPrint
  000fb	59		 pop	 ecx
$L14941:

; 256  : 
; 257  : 
; 258  :    // Build requirements list
; 259  :    //
; 260  : 
; 261  :    RtlZeroMemory(PRequiredList, sizeof(IO_RESOURCE_REQUIREMENTS_LIST)
; 262  :                  + sizeof(IO_RESOURCE_DESCRIPTOR) * 2);

  000fc	8b 55 08	 mov	 edx, DWORD PTR _PRequiredList$[ebp]
  000ff	57		 push	 edi
  00100	6a 22		 push	 34			; 00000022H
  00102	33 c0		 xor	 eax, eax
  00104	59		 pop	 ecx
  00105	8b fa		 mov	 edi, edx
  00107	f3 ab		 rep stosd

; 263  : 
; 264  :    PRequiredList->ListSize = sizeof(IO_RESOURCE_REQUIREMENTS_LIST)
; 265  :       + sizeof(IO_RESOURCE_DESCRIPTOR) * (PartialCount - 1);

  00109	8b 7d 0c	 mov	 edi, DWORD PTR _PartialCount$[ebp]

; 266  :    PRequiredList->InterfaceType = PUserData->UserInterfaceType;

  0010c	8b 4d 10	 mov	 ecx, DWORD PTR _PUserData$[ebp]
  0010f	8b c7		 mov	 eax, edi
  00111	c1 e0 05	 shl	 eax, 5
  00114	83 c0 28	 add	 eax, 40			; 00000028H
  00117	89 02		 mov	 DWORD PTR [edx], eax
  00119	8b 41 24	 mov	 eax, DWORD PTR [ecx+36]
  0011c	89 42 04	 mov	 DWORD PTR [edx+4], eax

; 267  :    PRequiredList->BusNumber = PUserData->UserBusNumber;

  0011f	8b 41 20	 mov	 eax, DWORD PTR [ecx+32]

; 268  :    PRequiredList->SlotNumber = 0;

  00122	83 62 0c 00	 and	 DWORD PTR [edx+12], 0
  00126	89 42 08	 mov	 DWORD PTR [edx+8], eax

; 269  :    PRequiredList->AlternativeLists = 1;

  00129	89 5a 1c	 mov	 DWORD PTR [edx+28], ebx

; 270  : 
; 271  :    reqResList = &PRequiredList->List[0];
; 272  : 
; 273  :    reqResList->Version = 1;

  0012c	66 89 5a 20	 mov	 WORD PTR [edx+32], bx

; 274  :    reqResList->Revision = 1;

  00130	66 89 5a 22	 mov	 WORD PTR [edx+34], bx

; 275  :    reqResList->Count = PartialCount;

  00134	89 7a 24	 mov	 DWORD PTR [edx+36], edi

; 276  : 
; 277  :    reqResDesc = &reqResList->Descriptors[0];

  00137	8d 42 28	 lea	 eax, DWORD PTR [edx+40]

; 278  : 
; 279  : 
; 280  :    //
; 281  :    // Port Information
; 282  :    //
; 283  : 
; 284  :    reqResDesc->Flags = (USHORT)PUserData->UserAddressSpace;

  0013a	66 8b 51 34	 mov	 dx, WORD PTR [ecx+52]
  0013e	66 89 50 04	 mov	 WORD PTR [eax+4], dx

; 285  :    reqResDesc->Type = CmResourceTypePort;

  00142	88 58 01	 mov	 BYTE PTR [eax+1], bl

; 286  :    reqResDesc->ShareDisposition = CmResourceShareDriverExclusive;

  00145	c6 40 02 02	 mov	 BYTE PTR [eax+2], 2

; 287  :    reqResDesc->u.Port.Length = SERIAL_REGISTER_SPAN;

  00149	c7 40 08 07 00
	00 00		 mov	 DWORD PTR [eax+8], 7

; 288  :    reqResDesc->u.Port.Alignment= 1;

  00150	89 58 0c	 mov	 DWORD PTR [eax+12], ebx

; 289  :    reqResDesc->u.Port.MinimumAddress = PUserData->UserPort;

  00153	8b 11		 mov	 edx, DWORD PTR [ecx]
  00155	89 50 10	 mov	 DWORD PTR [eax+16], edx
  00158	8b 51 04	 mov	 edx, DWORD PTR [ecx+4]
  0015b	89 50 14	 mov	 DWORD PTR [eax+20], edx

; 290  :    reqResDesc->u.Port.MaximumAddress.QuadPart
; 291  :       = PUserData->UserPort.QuadPart + SERIAL_REGISTER_SPAN - 1;

  0015e	8b 11		 mov	 edx, DWORD PTR [ecx]
  00160	8b 71 04	 mov	 esi, DWORD PTR [ecx+4]
  00163	83 c2 06	 add	 edx, 6
  00166	83 d6 00	 adc	 esi, 0
  00169	89 50 18	 mov	 DWORD PTR [eax+24], edx
  0016c	89 70 1c	 mov	 DWORD PTR [eax+28], esi

; 292  : 
; 293  : 
; 294  :    reqResDesc++;

  0016f	83 c0 20	 add	 eax, 32			; 00000020H

; 295  : 
; 296  : 
; 297  :    //
; 298  :    // Interrupt information
; 299  :    //
; 300  : 
; 301  :    if (PUserData->UserInterruptMode == Latched) {

  00172	39 59 30	 cmp	 DWORD PTR [ecx+48], ebx
  00175	75 06		 jne	 SHORT $L14960

; 302  :       reqResDesc->Flags = CM_RESOURCE_INTERRUPT_LATCHED;

  00177	66 89 58 04	 mov	 WORD PTR [eax+4], bx

; 303  :    } else {

  0017b	eb 05		 jmp	 SHORT $L14961
$L14960:

; 304  :       reqResDesc->Flags = CM_RESOURCE_INTERRUPT_LEVEL_SENSITIVE;

  0017d	66 83 60 04 00	 and	 WORD PTR [eax+4], 0
$L14961:

; 305  :    }
; 306  : 
; 307  :    //
; 308  :    // We have to globally share resources even though this is a **BAD**
; 309  :    // thing.  We must do it for multiport cards.  DO NOT replicate
; 310  :    // this in other drivers.
; 311  :    //
; 312  : 
; 313  :    reqResDesc->ShareDisposition = CmResourceShareShared;

  00182	c6 40 02 03	 mov	 BYTE PTR [eax+2], 3

; 314  : 
; 315  :    reqResDesc->Type = CmResourceTypeInterrupt;

  00186	c6 40 01 02	 mov	 BYTE PTR [eax+1], 2

; 316  :    reqResDesc->u.Interrupt.MinimumVector = PUserData->UserVector;

  0018a	8b 51 10	 mov	 edx, DWORD PTR [ecx+16]

; 317  :    reqResDesc->u.Interrupt.MaximumVector = PUserData->UserVector;
; 318  : 
; 319  :    //
; 320  :    // ISR register information (if needed)
; 321  :    //
; 322  :    if (PartialCount == 3) {

  0018d	83 ff 03	 cmp	 edi, 3
  00190	89 50 08	 mov	 DWORD PTR [eax+8], edx
  00193	8b 51 10	 mov	 edx, DWORD PTR [ecx+16]
  00196	89 50 0c	 mov	 DWORD PTR [eax+12], edx
  00199	5f		 pop	 edi
  0019a	75 30		 jne	 SHORT $L14964

; 323  : 
; 324  :       reqResDesc++;

  0019c	83 c0 20	 add	 eax, 32			; 00000020H

; 325  : 
; 326  :       reqResDesc->Type = CmResourceTypePort;

  0019f	88 58 01	 mov	 BYTE PTR [eax+1], bl

; 327  : 
; 328  :       //
; 329  :       // We have to globally share resources even though this is a **BAD**
; 330  :       // thing.  We must do it for multiport cards.  DO NOT replicate
; 331  :       // this in other drivers.
; 332  :       //
; 333  : 
; 334  :       reqResDesc->ShareDisposition = CmResourceShareShared;

  001a2	c6 40 02 03	 mov	 BYTE PTR [eax+2], 3

; 335  : 

⌨️ 快捷键说明

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