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

📄 legacy.cod

📁 怎样在win2000下构造驱动程序znsoft_Serial2000_demo.ZIP
💻 COD
📖 第 1 页 / 共 5 页
字号:
; 199  : 
; 200  :       SerialDump(SERDIAG1, ("SERIAL: ISR map was %x\n", outPhysAddr.QuadPart));
; 201  : 
; 202  :       PTrResourceList->List[0].PartialResourceList.
; 203  :          PartialDescriptors[2].Flags = (USHORT)outAddrSpace;

  0016f	66 8b 45 14	 mov	 ax, WORD PTR _outAddrSpace$[ebp]
  00173	66 89 46 36	 mov	 WORD PTR [esi+54], ax

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

  00177	8b 45 f0	 mov	 eax, DWORD PTR _outPhysAddr$[ebp]
  0017a	89 46 38	 mov	 DWORD PTR [esi+56], eax
  0017d	8b 45 f4	 mov	 eax, DWORD PTR _outPhysAddr$[ebp+4]
  00180	89 46 3c	 mov	 DWORD PTR [esi+60], eax
$SerialTranslateError$14802:

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

  00183	8b 45 fc	 mov	 eax, DWORD PTR _status$[ebp]
  00186	5f		 pop	 edi
  00187	5e		 pop	 esi
  00188	5b		 pop	 ebx

; 213  : }

  00189	c9		 leave
  0018a	c2 18 00	 ret	 24			; 00000018H
_SerialTranslateResourceList@24 ENDP
INIT	ENDS
PUBLIC	_SerialBuildRequirementsList@12
; Function compile flags: /Ogsy
;	COMDAT _SerialBuildRequirementsList@12
INIT	SEGMENT
_PRequiredList$ = 8
_PartialCount$ = 12
_PUserData$ = 16
_SerialBuildRequirementsList@12 PROC NEAR		; COMDAT

; 249  :    PIO_RESOURCE_LIST reqResList;
; 250  :    PIO_RESOURCE_DESCRIPTOR reqResDesc;
; 251  :    NTSTATUS status = STATUS_SUCCESS;
; 252  : 
; 253  :    PAGED_CODE();
; 254  : 
; 255  :    SerialDump(SERTRACECALLS, ("SERIAL: Enter SerialBuildRequirementsList\n"));
; 256  : 
; 257  : 
; 258  :    // Build requirements list
; 259  :    //
; 260  : 
; 261  :    RtlZeroMemory(PRequiredList, sizeof(IO_RESOURCE_REQUIREMENTS_LIST)
; 262  :                  + sizeof(IO_RESOURCE_DESCRIPTOR) * 2);

  00000	8b 54 24 04	 mov	 edx, DWORD PTR _PRequiredList$[esp-4]
  00004	53		 push	 ebx
  00005	56		 push	 esi

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

  00006	8b 74 24 10	 mov	 esi, DWORD PTR _PartialCount$[esp+4]
  0000a	57		 push	 edi
  0000b	6a 22		 push	 34			; 00000022H
  0000d	59		 pop	 ecx
  0000e	33 c0		 xor	 eax, eax
  00010	8b fa		 mov	 edi, edx

; 266  :    PRequiredList->InterfaceType = PUserData->UserInterfaceType;
; 267  :    PRequiredList->BusNumber = PUserData->UserBusNumber;
; 268  :    PRequiredList->SlotNumber = 0;
; 269  :    PRequiredList->AlternativeLists = 1;

  00012	33 db		 xor	 ebx, ebx
  00014	f3 ab		 rep stosd
  00016	8b 4c 24 18	 mov	 ecx, DWORD PTR _PUserData$[esp+8]
  0001a	8b c6		 mov	 eax, esi
  0001c	c1 e0 05	 shl	 eax, 5
  0001f	83 c0 28	 add	 eax, 40			; 00000028H
  00022	43		 inc	 ebx
  00023	89 02		 mov	 DWORD PTR [edx], eax
  00025	8b 41 24	 mov	 eax, DWORD PTR [ecx+36]
  00028	89 42 04	 mov	 DWORD PTR [edx+4], eax
  0002b	8b 41 20	 mov	 eax, DWORD PTR [ecx+32]
  0002e	83 62 0c 00	 and	 DWORD PTR [edx+12], 0
  00032	89 42 08	 mov	 DWORD PTR [edx+8], eax
  00035	89 5a 1c	 mov	 DWORD PTR [edx+28], ebx

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

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

; 274  :    reqResList->Revision = 1;

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

; 275  :    reqResList->Count = PartialCount;

  00040	89 72 24	 mov	 DWORD PTR [edx+36], esi

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

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

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

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

; 285  :    reqResDesc->Type = CmResourceTypePort;

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

; 286  :    reqResDesc->ShareDisposition = CmResourceShareDriverExclusive;

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

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

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

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

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

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

  0005f	8b 11		 mov	 edx, DWORD PTR [ecx]
  00061	89 50 10	 mov	 DWORD PTR [eax+16], edx
  00064	8b 51 04	 mov	 edx, DWORD PTR [ecx+4]
  00067	89 50 14	 mov	 DWORD PTR [eax+20], edx

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

  0006a	8b 11		 mov	 edx, DWORD PTR [ecx]
  0006c	8b 79 04	 mov	 edi, DWORD PTR [ecx+4]
  0006f	83 c2 06	 add	 edx, 6
  00072	83 d7 00	 adc	 edi, 0
  00075	89 50 18	 mov	 DWORD PTR [eax+24], edx
  00078	89 78 1c	 mov	 DWORD PTR [eax+28], edi

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

  0007b	83 c0 20	 add	 eax, 32			; 00000020H

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

  0007e	39 59 30	 cmp	 DWORD PTR [ecx+48], ebx
  00081	75 06		 jne	 SHORT $L14850

; 302  :       reqResDesc->Flags = CM_RESOURCE_INTERRUPT_LATCHED;

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

; 303  :    } else {

  00087	eb 05		 jmp	 SHORT $L14851
$L14850:

; 304  :       reqResDesc->Flags = CM_RESOURCE_INTERRUPT_LEVEL_SENSITIVE;

  00089	66 83 60 04 00	 and	 WORD PTR [eax+4], 0
$L14851:

; 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;

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

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

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

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

  00096	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) {

  00099	83 fe 03	 cmp	 esi, 3
  0009c	89 50 08	 mov	 DWORD PTR [eax+8], edx
  0009f	8b 51 10	 mov	 edx, DWORD PTR [ecx+16]
  000a2	89 50 0c	 mov	 DWORD PTR [eax+12], edx
  000a5	75 30		 jne	 SHORT $L14854

; 323  : 
; 324  :       reqResDesc++;

  000a7	83 c0 20	 add	 eax, 32			; 00000020H

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

  000aa	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;

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

; 335  : 
; 336  :       reqResDesc->Flags = (USHORT)PUserData->UserAddressSpace;

  000b1	66 8b 51 34	 mov	 dx, WORD PTR [ecx+52]

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

  000b5	89 58 08	 mov	 DWORD PTR [eax+8], ebx
  000b8	66 89 50 04	 mov	 WORD PTR [eax+4], dx

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

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

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

  000bf	8b 51 08	 mov	 edx, DWORD PTR [ecx+8]
  000c2	89 50 10	 mov	 DWORD PTR [eax+16], edx
  000c5	8b 51 0c	 mov	 edx, DWORD PTR [ecx+12]
  000c8	89 50 14	 mov	 DWORD PTR [eax+20], edx

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

  000cb	8b 51 08	 mov	 edx, DWORD PTR [ecx+8]
  000ce	89 50 18	 mov	 DWORD PTR [eax+24], edx
  000d1	8b 49 0c	 mov	 ecx, DWORD PTR [ecx+12]
  000d4	89 48 1c	 mov	 DWORD PTR [eax+28], ecx
$L14854:
  000d7	5f		 pop	 edi
  000d8	5e		 pop	 esi

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

  000d9	33 c0		 xor	 eax, eax
  000db	5b		 pop	 ebx

; 346  : }

  000dc	c2 0c 00	 ret	 12			; 0000000cH
_SerialBuildRequirementsList@12 ENDP
INIT	ENDS
PUBLIC	_SerialBuildResourceList@12
; Function compile flags: /Ogsy
;	COMDAT _SerialBuildResourceList@12
INIT	SEGMENT
_PResourceList$ = 8
_PPartialCount$ = 12
_PUserData$ = 16
_SerialBuildResourceList@12 PROC NEAR			; COMDAT

; 381  :    ULONG countOfPartials;
; 382  :    PCM_PARTIAL_RESOURCE_DESCRIPTOR pPartial;
; 383  :    NTSTATUS status = STATUS_SUCCESS;
; 384  : 
; 385  :    PAGED_CODE();
; 386  : 
; 387  :    SerialDump(SERTRACECALLS, ("SERIAL: Enter SerialBuildResourceList\n"));
; 388  :    SerialDump(SERDIAG1, ("SERIAL: Building cmreslist in %x\n", PResourceList));
; 389  : 
; 390  :    *PPartialCount = 0;

  00000	8b 44 24 08	 mov	 eax, DWORD PTR _PPartialCount$[esp-4]

; 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;

  00004	8b 54 24 0c	 mov	 edx, DWORD PTR _PUserData$[esp-4]
  00008	53		 push	 ebx
  00009	33 db		 xor	 ebx, ebx
  0000b	83 20 00	 and	 DWORD PTR [eax], 0
  0000e	39 5a 08	 cmp	 DWORD PTR [edx+8], ebx
  00011	56		 push	 esi

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

  00012	8b 74 24 0c	 mov	 esi, DWORD PTR _PResourceList$[esp+4]
  00016	57		 push	 edi
  00017	6a 11		 push	 17			; 00000011H
  00019	0f 95 c3	 setne	 bl
  0001c	59		 pop	 ecx
  0001d	33 c0		 xor	 eax, eax
  0001f	8b fe		 mov	 edi, esi
  00021	43		 inc	 ebx
  00022	f3 ab		 rep stosd

; 401  : 
; 402  :    PResourceList->Count = 1;

  00024	33 c9		 xor	 ecx, ecx
  00026	43		 inc	 ebx
  00027	41		 inc	 ecx
  00028	89 0e		 mov	 DWORD PTR [esi], ecx

; 403  : 
; 404  :    PResourceList->List[0].InterfaceType = PUserData->UserInterfaceType;

  0002a	8b 42 24	 mov	 eax, DWORD PTR [edx+36]
  0002d	89 46 04	 mov	 DWORD PTR [esi+4], eax

; 405  :    PResourceList->List[0].BusNumber = PUserData->UserBusNumber;

  00030	8b 42 20	 mov	 eax, DWORD PTR [edx+32]
  00033	89 46 08	 mov	 DWORD PTR [esi+8], eax

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

  00036	8d 46 14	 lea	 eax, DWORD PTR [esi+20]
  00039	89 5e 10	 mov	 DWORD PTR [esi+16], ebx

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

  0003c	88 08		 mov	 BYTE PTR [eax], cl

; 417  :    pPartial->ShareDisposition = CmResourceShareDeviceExclusive;

  0003e	88 48 01	 mov	 BYTE PTR [eax+1], cl

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

  00041	66 8b 72 34	 mov	 si, WORD PTR [edx+52]
  00045	66 89 70 02	 mov	 WORD PTR [eax+2], si

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

  00049	8b 32		 mov	 esi, DWORD PTR [edx]
  0004b	89 70 04	 mov	 DWORD PTR [eax+4], esi
  0004e	8b 72 04	 mov	 esi, DWORD PTR [edx+4]
  00051	89 70 08	 mov	 DWORD PTR [eax+8], esi

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

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

⌨️ 快捷键说明

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