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

📄 legacy.cod

📁 怎样在win2000下构造驱动程序znsoft_Serial2000_demo.ZIP
💻 COD
📖 第 1 页 / 共 5 页
字号:
; 336  :       reqResDesc->Flags = (USHORT)PUserData->UserAddressSpace;

  001a6	66 8b 51 34	 mov	 dx, WORD PTR [ecx+52]

; 337  :       reqResDesc->u.Port.Length = 1;

  001aa	89 58 08	 mov	 DWORD PTR [eax+8], ebx
  001ad	66 89 50 04	 mov	 WORD PTR [eax+4], dx

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

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

; 339  :       reqResDesc->u.Port.MinimumAddress = PUserData->UserInterruptStatus;

  001b4	8b 51 08	 mov	 edx, DWORD PTR [ecx+8]
  001b7	89 50 10	 mov	 DWORD PTR [eax+16], edx
  001ba	8b 51 0c	 mov	 edx, DWORD PTR [ecx+12]
  001bd	89 50 14	 mov	 DWORD PTR [eax+20], edx

; 340  :       reqResDesc->u.Port.MaximumAddress = PUserData->UserInterruptStatus;

  001c0	8b 51 08	 mov	 edx, DWORD PTR [ecx+8]
  001c3	89 50 18	 mov	 DWORD PTR [eax+24], edx
  001c6	8b 49 0c	 mov	 ecx, DWORD PTR [ecx+12]
  001c9	89 48 1c	 mov	 DWORD PTR [eax+28], ecx
$L14964:

; 341  :    }
; 342  : 
; 343  :    SerialDump(SERTRACECALLS, ("SERIAL: Leave SerialBuildRequirementsList\n"));

  001cc	f6 05 00 00 00
	00 40		 test	 BYTE PTR _SerialDebugLevel, 64 ; 00000040H
  001d3	5e		 pop	 esi
  001d4	5b		 pop	 ebx
  001d5	74 0b		 je	 SHORT $L14965
  001d7	68 00 00 00 00	 push	 OFFSET FLAT:$SG14970
  001dc	e8 00 00 00 00	 call	 _DbgPrint
  001e1	59		 pop	 ecx
$L14965:

; 344  : 
; 345  :    return status;

  001e2	33 c0		 xor	 eax, eax

; 346  : }

  001e4	5d		 pop	 ebp
  001e5	c2 0c 00	 ret	 12			; 0000000cH
_SerialBuildRequirementsList@12 ENDP
INIT	ENDS
PUBLIC	_SerialBuildResourceList@12
;	COMDAT _SerialBuildResourceList@12
INIT	SEGMENT
$SG14989 DB	'EX: Pageable code called at IRQL %d', 0aH, 00H
	ORG $+3
$SG14992 DB	'f:\w2ddk\src\kernel\serial\legacy.c', 00H
$SG14993 DB	'FALSE', 00H
	ORG $+2
$SG15000 DB	'SERIAL: Enter SerialBuildResourceList', 0aH, 00H
	ORG $+1
$SG15013 DB	'SERIAL: Building cmreslist in %x', 0aH, 00H
	ORG $+2
$SG15037 DB	'SERIAL: Leave SerialBuildResourceList', 0aH, 00H
; Function compile flags: /Ogs
_PResourceList$ = 8
_PPartialCount$ = 12
_PUserData$ = 16
_countOfPartials$ = 8
_SerialBuildResourceList@12 PROC NEAR			; COMDAT

; 380  : {

  000c7	55		 push	 ebp
  000c8	8b ec		 mov	 ebp, esp
  000ca	53		 push	 ebx
  000cb	56		 push	 esi

; 381  :    ULONG countOfPartials;
; 382  :    PCM_PARTIAL_RESOURCE_DESCRIPTOR pPartial;
; 383  :    NTSTATUS status = STATUS_SUCCESS;
; 384  : 
; 385  :    PAGED_CODE();

  000cc	8b 35 00 00 00
	00		 mov	 esi, DWORD PTR __imp__KeGetCurrentIrql@0
  000d2	57		 push	 edi
  000d3	ff d6		 call	 esi
  000d5	33 db		 xor	 ebx, ebx
  000d7	43		 inc	 ebx
  000d8	3a c3		 cmp	 al, bl
  000da	76 29		 jbe	 SHORT $L14994
  000dc	ff d6		 call	 esi
  000de	0f b6 c0	 movzx	 eax, al
  000e1	50		 push	 eax
  000e2	68 00 00 00 00	 push	 OFFSET FLAT:$SG14989
  000e7	e8 00 00 00 00	 call	 _DbgPrint
  000ec	59		 pop	 ecx
  000ed	59		 pop	 ecx
  000ee	6a 00		 push	 0
  000f0	68 81 01 00 00	 push	 385			; 00000181H
  000f5	68 00 00 00 00	 push	 OFFSET FLAT:$SG14992
  000fa	68 00 00 00 00	 push	 OFFSET FLAT:$SG14993
  000ff	ff 15 00 00 00
	00		 call	 DWORD PTR __imp__RtlAssert@16
$L14994:

; 386  : 
; 387  :    SerialDump(SERTRACECALLS, ("SERIAL: Enter SerialBuildResourceList\n"));

  00105	f6 05 00 00 00
	00 40		 test	 BYTE PTR _SerialDebugLevel, 64 ; 00000040H
  0010c	74 0b		 je	 SHORT $L14995
  0010e	68 00 00 00 00	 push	 OFFSET FLAT:$SG15000
  00113	e8 00 00 00 00	 call	 _DbgPrint
  00118	59		 pop	 ecx
$L14995:

; 388  :    SerialDump(SERDIAG1, ("SERIAL: Building cmreslist in %x\n", PResourceList));

  00119	84 1d 00 00 00
	00		 test	 BYTE PTR _SerialDebugLevel, bl
  0011f	8b 75 08	 mov	 esi, DWORD PTR _PResourceList$[ebp]
  00122	74 0d		 je	 SHORT $L15008
  00124	56		 push	 esi
  00125	68 00 00 00 00	 push	 OFFSET FLAT:$SG15013
  0012a	e8 00 00 00 00	 call	 _DbgPrint
  0012f	59		 pop	 ecx
  00130	59		 pop	 ecx
$L15008:

; 389  : 
; 390  :    *PPartialCount = 0;

  00131	8b 45 0c	 mov	 eax, DWORD PTR _PPartialCount$[ebp]

; 391  : 
; 392  :    //
; 393  :    // If we have a separate ISR register requirement, we then have 3
; 394  :    // partials instead of 2.
; 395  :    //
; 396  :    countOfPartials = (PUserData->UserInterruptStatus.LowPart != 0) ? 3 : 2;

  00134	8b 55 10	 mov	 edx, DWORD PTR _PUserData$[ebp]

; 397  :    
; 398  : 
; 399  :    RtlZeroMemory(PResourceList, sizeof(CM_RESOURCE_LIST)
; 400  :                  + sizeof(CM_PARTIAL_RESOURCE_DESCRIPTOR) * 2);

  00137	6a 11		 push	 17			; 00000011H
  00139	8b fe		 mov	 edi, esi
  0013b	83 20 00	 and	 DWORD PTR [eax], 0
  0013e	33 c0		 xor	 eax, eax
  00140	39 42 08	 cmp	 DWORD PTR [edx+8], eax
  00143	59		 pop	 ecx
  00144	0f 95 c0	 setne	 al
  00147	40		 inc	 eax
  00148	40		 inc	 eax
  00149	89 45 08	 mov	 DWORD PTR _countOfPartials$[ebp], eax
  0014c	33 c0		 xor	 eax, eax
  0014e	f3 ab		 rep stosd

; 401  : 
; 402  :    PResourceList->Count = 1;
; 403  : 
; 404  :    PResourceList->List[0].InterfaceType = PUserData->UserInterfaceType;
; 405  :    PResourceList->List[0].BusNumber = PUserData->UserBusNumber;
; 406  :    PResourceList->List[0].PartialResourceList.Count = countOfPartials;

  00150	8b 7d 08	 mov	 edi, DWORD PTR _countOfPartials$[ebp]
  00153	89 1e		 mov	 DWORD PTR [esi], ebx
  00155	8b 42 24	 mov	 eax, DWORD PTR [edx+36]
  00158	89 46 04	 mov	 DWORD PTR [esi+4], eax
  0015b	8b 42 20	 mov	 eax, DWORD PTR [edx+32]
  0015e	89 46 08	 mov	 DWORD PTR [esi+8], eax

; 407  : 
; 408  :    pPartial
; 409  :       = &PResourceList->List[0].PartialResourceList.PartialDescriptors[0];

  00161	8d 46 14	 lea	 eax, DWORD PTR [esi+20]
  00164	89 7e 10	 mov	 DWORD PTR [esi+16], edi

; 410  : 
; 411  : 
; 412  :    //
; 413  :    // Port information
; 414  :    //
; 415  : 
; 416  :    pPartial->Type = CmResourceTypePort;

  00167	88 18		 mov	 BYTE PTR [eax], bl

; 417  :    pPartial->ShareDisposition = CmResourceShareDeviceExclusive;

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

; 418  :    pPartial->Flags = (USHORT)PUserData->UserAddressSpace;

  0016c	66 8b 4a 34	 mov	 cx, WORD PTR [edx+52]
  00170	66 89 48 02	 mov	 WORD PTR [eax+2], cx

; 419  :    pPartial->u.Port.Start = PUserData->UserPort;

  00174	8b 0a		 mov	 ecx, DWORD PTR [edx]
  00176	89 48 04	 mov	 DWORD PTR [eax+4], ecx
  00179	8b 4a 04	 mov	 ecx, DWORD PTR [edx+4]
  0017c	89 48 08	 mov	 DWORD PTR [eax+8], ecx

; 420  :    pPartial->u.Port.Length = SERIAL_REGISTER_SPAN;

  0017f	c7 40 0c 07 00
	00 00		 mov	 DWORD PTR [eax+12], 7

; 421  : 
; 422  : 
; 423  :    pPartial++;

  00186	83 c0 10	 add	 eax, 16			; 00000010H

; 424  : 
; 425  : 
; 426  :    //
; 427  :    // Interrupt information
; 428  :    //
; 429  : 
; 430  :    pPartial->Type = CmResourceTypeInterrupt;

  00189	c6 00 02	 mov	 BYTE PTR [eax], 2

; 431  : 
; 432  :       //
; 433  :       // We have to globally share resources even though this is a **BAD**
; 434  :       // thing.  We must do it for multiport cards.  DO NOT replicate
; 435  :       // this in other drivers.
; 436  :       //
; 437  : 
; 438  :       pPartial->ShareDisposition = CmResourceShareShared;

  0018c	c6 40 01 03	 mov	 BYTE PTR [eax+1], 3

; 439  : 
; 440  :    if (PUserData->UserInterruptMode == Latched) {

  00190	39 5a 30	 cmp	 DWORD PTR [edx+48], ebx
  00193	75 06		 jne	 SHORT $L15024

; 441  :       pPartial->Flags = CM_RESOURCE_INTERRUPT_LATCHED;

  00195	66 89 58 02	 mov	 WORD PTR [eax+2], bx

; 442  :    } else {

  00199	eb 05		 jmp	 SHORT $L15025
$L15024:

; 443  :       pPartial->Flags = CM_RESOURCE_INTERRUPT_LEVEL_SENSITIVE;

  0019b	66 83 60 02 00	 and	 WORD PTR [eax+2], 0
$L15025:

; 444  :    }
; 445  : 
; 446  :    pPartial->u.Interrupt.Vector = PUserData->UserVector;

  001a0	8b 4a 10	 mov	 ecx, DWORD PTR [edx+16]
  001a3	89 48 08	 mov	 DWORD PTR [eax+8], ecx

; 447  : 
; 448  :    if (PUserData->UserLevel == 0) {

  001a6	8b 4a 38	 mov	 ecx, DWORD PTR [edx+56]
  001a9	85 c9		 test	 ecx, ecx
  001ab	75 03		 jne	 SHORT $L15026

; 449  :       pPartial->u.Interrupt.Level = PUserData->UserVector;

  001ad	8b 4a 10	 mov	 ecx, DWORD PTR [edx+16]
$L15026:

; 450  :    } else {
; 451  :       pPartial->u.Interrupt.Level = PUserData->UserLevel;
; 452  :    }
; 453  : 
; 454  : 
; 455  :    //
; 456  :    // ISR register information (if needed)
; 457  :    //
; 458  : 
; 459  :    if (countOfPartials == 3) {

  001b0	83 ff 03	 cmp	 edi, 3
  001b3	89 48 04	 mov	 DWORD PTR [eax+4], ecx
  001b6	75 20		 jne	 SHORT $L15028

; 460  : 
; 461  :       pPartial++;

  001b8	83 c0 10	 add	 eax, 16			; 00000010H

; 462  : 
; 463  :       pPartial->Type = CmResourceTypePort;

  001bb	88 18		 mov	 BYTE PTR [eax], bl

; 464  : 
; 465  :       //
; 466  :       // We have to globally share resources even though this is a **BAD**
; 467  :       // thing.  We must do it for multiport cards.  DO NOT replicate
; 468  :       // this in other drivers.
; 469  :       //
; 470  : 
; 471  :       pPartial->ShareDisposition = CmResourceShareShared;      

  001bd	c6 40 01 03	 mov	 BYTE PTR [eax+1], 3

; 472  : 
; 473  :       pPartial->Flags = (USHORT)PUserData->UserAddressSpace;

  001c1	66 8b 4a 34	 mov	 cx, WORD PTR [edx+52]
  001c5	66 89 48 02	 mov	 WORD PTR [eax+2], cx

; 474  :       pPartial->u.Port.Start = PUserData->UserInterruptStatus;

  001c9	8b 4a 08	 mov	 ecx, DWORD PTR [edx+8]
  001cc	89 48 04	 mov	 DWORD PTR [eax+4], ecx
  001cf	8b 4a 0c	 mov	 ecx, DWORD PTR [edx+12]
  001d2	89 48 08	 mov	 DWORD PTR [eax+8], ecx

; 475  :       pPartial->u.Port.Length = SERIAL_STATUS_LENGTH;

  001d5	89 58 0c	 mov	 DWORD PTR [eax+12], ebx
$L15028:

; 476  :    }
; 477  : 
; 478  :    *PPartialCount = countOfPartials;

  001d8	8b 45 0c	 mov	 eax, DWORD PTR _PPartialCount$[ebp]
  001db	89 38		 mov	 DWORD PTR [eax], edi
  001dd	5f		 pop	 edi

; 479  : 
; 480  :    SerialDump(SERTRACECALLS, ("SERIAL: Leave SerialBuildResourceList\n"));

  001de	f6 05 00 00 00
	00 40		 test	 BYTE PTR _SerialDebugLevel, 64 ; 00000040H
  001e5	5e		 pop	 esi
  001e6	5b		 pop	 ebx
  001e7	74 0b		 je	 SHORT $L15032
  001e9	68 00 00 00 00	 push	 OFFSET FLAT:$SG15037
  001ee	e8 00 00 00 00	 call	 _DbgPrint
  001f3	59		 pop	 ecx
$L15032:

; 481  : 
; 482  :    return status;

  001f4	33 c0		 xor	 eax, eax

; 483  : }

  001f6	5d		 pop	 ebp
  001f7	c2 0c 00	 ret	 12			; 0000000cH
_SerialBuildResourceList@12 ENDP
INIT	ENDS
PUBLIC	_SerialMigrateLegacyRegistry@12
EXTRN	_SerialPutRegistryKeyValue@24:NEAR
EXTRN	__imp__IoOpenDeviceRegistryKey@16:NEAR
EXTRN	__imp__ExAllocatePoolWithTag@12:NEAR
EXTRN	__imp__ExFreePool@4:NEAR
EXTRN	__imp__RtlAppendUnicodeStringToString@8:NEAR
EXTRN	__imp__ZwClose@4:NEAR
;	COMDAT _SerialMigrateLegacyRegistry@12
INIT	SEGMENT
$SG15057 DB	'EX: Pageable code called at IRQL %d', 0aH, 00H
	ORG $+3
$SG15060 DB	'f:\w2ddk\src\kernel\serial\legacy.c', 00H
$SG15061 DB	'FALSE', 00H
	ORG $+2
$SG15068 DB	'SERIAL: Enter SerialMigrateLegacyRegistry', 0aH, 00H
	ORG $+1
$SG15083 DB	'SERIAL: Leave (1) SerialMigrateLegacyRegistry', 0aH, 00H
	ORG $+1
$SG15105 DB	'SERIAL: Couldn''t allocate buffer for the PnP link', 0aH
	DB	00H
	ORG $+1
$SG15118 DB	'P', 00H, 'o', 00H, 'r', 00H, 't', 00H, 'N', 00H, 'a', 00H
	DB	'm', 00H, 'e', 00H, 00H, 00H
	ORG $+2
$SG15127 DB	'SERIAL: Couldn''t migrate PortName', 0aH, 00H
	ORG $+1
$SG15136 DB	'M', 00H, 'u', 00H, 'l', 00H, 't', 00H, 'i', 00H, 'p', 00H
	DB	'o', 00H, 'r', 00H, 't', 00H, 'D', 00H, 'e', 00H, 'v', 00H, 'i'
	DB	00H, 'c', 00H, 'e', 00H, 00H, 00H
$SG15145 DB	'SERIAL: Couldn''t mark multiport', 0aH, 00H
	ORG $+3
$SG15154 DB	'P', 00H, 'o', 00H, 'r', 00H, 't', 00H, 'I', 00H, 'n', 00H
	DB	'd', 00H, 'e', 00H, 'x', 00H, 00H, 00H
$SG15163 DB	'SERIAL: Couldn''t migrate PortIndex', 0aH, 00H
$SG15173 DB	'C', 00H, 'l', 00H, 'o', 00H, 'c', 00H, 'k', 00H, 'R', 00H
	DB	'a', 00H, 't', 00H, 'e', 00H, 00H, 00H
$SG15182 DB	'SERIAL: Couldn''t migrate ClockRate', 0aH, 00H
$SG15192 DB	'I', 00H, 'n', 00H, 'd', 00H, 'e', 00H, 'x', 00H, 'e', 00H
	DB	'd', 00H, 00H, 00H

⌨️ 快捷键说明

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