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

📄 legacy.cod

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

  001e5	85 f6		 test	 esi, esi
  001e7	0f 8c 08 01 00
	00		 jl	 $MigrateLegacyExit$14921
$L14936:

; 585  :          SerialDump(SERERRORS, ("SERIAL: Couldn't mark multiport\n"));
; 586  :          goto MigrateLegacyExit;
; 587  :       }
; 588  :    }
; 589  : 
; 590  :   
; 591  : 
; 592  : 
; 593  :    //
; 594  :    // If a port index was specified, save it
; 595  :    //
; 596  : 
; 597  :    if (PUserData->UserPortIndex != 0) {

  001ed	8d 43 1c	 lea	 eax, DWORD PTR [ebx+28]
  001f0	83 38 00	 cmp	 DWORD PTR [eax], 0
  001f3	74 1c		 je	 SHORT $L14944

; 598  :       status = SerialPutRegistryKeyValue(pnpKey, L"PortIndex",
; 599  :                                          sizeof(L"PortIndex"), REG_DWORD,
; 600  :                                          &PUserData->UserPortIndex,
; 601  :                                          sizeof(ULONG));

  001f5	57		 push	 edi
  001f6	50		 push	 eax
  001f7	57		 push	 edi
  001f8	6a 14		 push	 20			; 00000014H
  001fa	68 00 00 00 00	 push	 OFFSET FLAT:$SG14942
  001ff	ff 75 08	 push	 DWORD PTR _pnpKey$[ebp]
  00202	e8 00 00 00 00	 call	 _SerialPutRegistryKeyValue@24
  00207	8b f0		 mov	 esi, eax

; 602  : 
; 603  :       if (!NT_SUCCESS(status)) {

  00209	85 f6		 test	 esi, esi
  0020b	0f 8c e4 00 00
	00		 jl	 $MigrateLegacyExit$14921
$L14944:

; 604  :          SerialDump(SERERRORS, ("SERIAL: Couldn't migrate PortIndex\n"));
; 605  :          goto MigrateLegacyExit;
; 606  :       }
; 607  :    }
; 608  : 
; 609  : 
; 610  :    //
; 611  :    // If not default clock rate, save it
; 612  :    //
; 613  : 
; 614  :    if (PUserData->UserClockRate != SERIAL_BAD_VALUE) {

  00211	8d 43 28	 lea	 eax, DWORD PTR [ebx+40]
  00214	83 38 ff	 cmp	 DWORD PTR [eax], -1
  00217	74 1c		 je	 SHORT $L14953

; 615  :       status = SerialPutRegistryKeyValue(pnpKey, L"ClockRate",
; 616  :                                          sizeof(L"ClockRate"), REG_DWORD,
; 617  :                                          &PUserData->UserClockRate,
; 618  :                                          sizeof(ULONG));

  00219	57		 push	 edi
  0021a	50		 push	 eax
  0021b	57		 push	 edi
  0021c	6a 14		 push	 20			; 00000014H
  0021e	68 00 00 00 00	 push	 OFFSET FLAT:$SG14951
  00223	ff 75 08	 push	 DWORD PTR _pnpKey$[ebp]
  00226	e8 00 00 00 00	 call	 _SerialPutRegistryKeyValue@24
  0022b	8b f0		 mov	 esi, eax

; 619  : 
; 620  :       if (!NT_SUCCESS(status)) {

  0022d	85 f6		 test	 esi, esi
  0022f	0f 8c c0 00 00
	00		 jl	 $MigrateLegacyExit$14921
$L14953:

; 621  :          SerialDump(SERERRORS, ("SERIAL: Couldn't migrate ClockRate\n"));
; 622  :          goto MigrateLegacyExit;
; 623  :       }
; 624  :    }
; 625  : 
; 626  : 
; 627  :    //
; 628  :    // If there is a user index, save it.
; 629  :    //
; 630  : 
; 631  :    if (PUserData->UserIndexed != SERIAL_BAD_VALUE) {

  00235	8d 43 2c	 lea	 eax, DWORD PTR [ebx+44]
  00238	83 38 ff	 cmp	 DWORD PTR [eax], -1
  0023b	74 1c		 je	 SHORT $L14962

; 632  :       status = SerialPutRegistryKeyValue(pnpKey, L"Indexed", sizeof(L"Indexed"),
; 633  :                                          REG_DWORD, &PUserData->UserIndexed,
; 634  :                                          sizeof(ULONG));

  0023d	57		 push	 edi
  0023e	50		 push	 eax
  0023f	57		 push	 edi
  00240	6a 10		 push	 16			; 00000010H
  00242	68 00 00 00 00	 push	 OFFSET FLAT:$SG14960
  00247	ff 75 08	 push	 DWORD PTR _pnpKey$[ebp]
  0024a	e8 00 00 00 00	 call	 _SerialPutRegistryKeyValue@24
  0024f	8b f0		 mov	 esi, eax

; 635  : 
; 636  :       if (!NT_SUCCESS(status)) {

  00251	85 f6		 test	 esi, esi
  00253	0f 8c 9c 00 00
	00		 jl	 $MigrateLegacyExit$14921
$L14962:

; 637  :          SerialDump(SERERRORS, ("SERIAL: Couldn't migrate Indexed\n"));
; 638  :          goto MigrateLegacyExit;
; 639  :       }
; 640  :    }
; 641  : 
; 642  : 
; 643  :    //
; 644  :    // If the port was disabled, save that.
; 645  :    //
; 646  : 
; 647  :    if (PUserData->DisablePort != SERIAL_BAD_VALUE) {

  00259	8d 43 40	 lea	 eax, DWORD PTR [ebx+64]
  0025c	83 38 ff	 cmp	 DWORD PTR [eax], -1
  0025f	74 18		 je	 SHORT $L14971

; 648  :       status = SerialPutRegistryKeyValue(pnpKey, L"DisablePort",
; 649  :                                          sizeof(L"DisablePort"), REG_DWORD,
; 650  :                                          &PUserData->DisablePort,
; 651  :                                          sizeof(ULONG));

  00261	57		 push	 edi
  00262	50		 push	 eax
  00263	57		 push	 edi
  00264	6a 18		 push	 24			; 00000018H
  00266	68 00 00 00 00	 push	 OFFSET FLAT:$SG14969
  0026b	ff 75 08	 push	 DWORD PTR _pnpKey$[ebp]
  0026e	e8 00 00 00 00	 call	 _SerialPutRegistryKeyValue@24
  00273	8b f0		 mov	 esi, eax

; 652  :       if (!NT_SUCCESS(status)) {

  00275	85 f6		 test	 esi, esi
  00277	7c 7c		 jl	 SHORT $MigrateLegacyExit$14921
$L14971:

; 653  :          SerialDump(SERERRORS, ("SERIAL: Couldn't migrate DisablePort\n"));
; 654  :          goto MigrateLegacyExit;
; 655  :       }
; 656  :    }
; 657  : 
; 658  : 
; 659  :    //
; 660  :    // If Fifo's were forced enabled, save that.
; 661  :    //
; 662  :    if (PUserData->ForceFIFOEnable != SERIAL_BAD_VALUE) {

  00279	8d 43 54	 lea	 eax, DWORD PTR [ebx+84]
  0027c	83 38 ff	 cmp	 DWORD PTR [eax], -1
  0027f	74 18		 je	 SHORT $L14980

; 663  :       status = SerialPutRegistryKeyValue(pnpKey, L"ForceFifoEnable",
; 664  :                                          sizeof(L"ForceFifoEnable"), REG_DWORD,
; 665  :                                          &PUserData->ForceFIFOEnable,
; 666  :                                          sizeof(ULONG));

  00281	57		 push	 edi
  00282	50		 push	 eax
  00283	57		 push	 edi
  00284	6a 20		 push	 32			; 00000020H
  00286	68 00 00 00 00	 push	 OFFSET FLAT:$SG14978
  0028b	ff 75 08	 push	 DWORD PTR _pnpKey$[ebp]
  0028e	e8 00 00 00 00	 call	 _SerialPutRegistryKeyValue@24
  00293	8b f0		 mov	 esi, eax

; 667  : 
; 668  :       if (!NT_SUCCESS(status)) {

  00295	85 f6		 test	 esi, esi
  00297	7c 5c		 jl	 SHORT $MigrateLegacyExit$14921
$L14980:

; 669  :          SerialDump(SERERRORS, ("SERIAL: Couldn't migrate ForceFifoEnable\n"));
; 670  :          goto MigrateLegacyExit;
; 671  :       }
; 672  :    }
; 673  : 
; 674  : 
; 675  :    //
; 676  :    // If RxFIFO had an override, save that.
; 677  :    //
; 678  : 
; 679  :    if (PUserData->RxFIFO != SERIAL_BAD_VALUE) {

  00299	8d 43 44	 lea	 eax, DWORD PTR [ebx+68]
  0029c	83 38 ff	 cmp	 DWORD PTR [eax], -1
  0029f	74 18		 je	 SHORT $L14989

; 680  :       status = SerialPutRegistryKeyValue(pnpKey, L"RxFIFO", sizeof(L"RxFIFO"),
; 681  :                                          REG_DWORD, &PUserData->RxFIFO,
; 682  :                                          sizeof(ULONG));

  002a1	57		 push	 edi
  002a2	50		 push	 eax
  002a3	57		 push	 edi
  002a4	6a 0e		 push	 14			; 0000000eH
  002a6	68 00 00 00 00	 push	 OFFSET FLAT:$SG14987
  002ab	ff 75 08	 push	 DWORD PTR _pnpKey$[ebp]
  002ae	e8 00 00 00 00	 call	 _SerialPutRegistryKeyValue@24
  002b3	8b f0		 mov	 esi, eax

; 683  : 
; 684  :       if (!NT_SUCCESS(status)) {

  002b5	85 f6		 test	 esi, esi
  002b7	7c 3c		 jl	 SHORT $MigrateLegacyExit$14921
$L14989:

; 685  :          SerialDump(SERERRORS, ("SERIAL: Couldn't migrate RxFIFO\n"));
; 686  :          goto MigrateLegacyExit;
; 687  :       }
; 688  :    }
; 689  : 
; 690  : 
; 691  :    //
; 692  :    // If TxFIFO had an override, save that.
; 693  :    //
; 694  : 
; 695  :    if (PUserData->TxFIFO != SERIAL_BAD_VALUE) {

  002b9	8d 43 4c	 lea	 eax, DWORD PTR [ebx+76]
  002bc	83 38 ff	 cmp	 DWORD PTR [eax], -1
  002bf	74 18		 je	 SHORT $L14998

; 696  :       status = SerialPutRegistryKeyValue(pnpKey, L"TxFIFO", sizeof(L"TxFIFO"),
; 697  :                                          REG_DWORD, &PUserData->TxFIFO,
; 698  :                                          sizeof(ULONG));

  002c1	57		 push	 edi
  002c2	50		 push	 eax
  002c3	57		 push	 edi
  002c4	6a 0e		 push	 14			; 0000000eH
  002c6	68 00 00 00 00	 push	 OFFSET FLAT:$SG14996
  002cb	ff 75 08	 push	 DWORD PTR _pnpKey$[ebp]
  002ce	e8 00 00 00 00	 call	 _SerialPutRegistryKeyValue@24
  002d3	8b f0		 mov	 esi, eax

; 699  : 
; 700  :       if (!NT_SUCCESS(status)) {

  002d5	85 f6		 test	 esi, esi
  002d7	7c 1c		 jl	 SHORT $MigrateLegacyExit$14921
$L14998:

; 701  :          SerialDump(SERERRORS, ("SERIAL: Couldn't migrate TxFIFO\n"));
; 702  :          goto MigrateLegacyExit;
; 703  :       }
; 704  :    }
; 705  : 
; 706  : 
; 707  :    //
; 708  :    // If MaskInverted had an override, save that.
; 709  :    //
; 710  : 
; 711  :    if (PUserData->MaskInverted != SERIAL_BAD_VALUE) {

  002d9	83 c3 64	 add	 ebx, 100		; 00000064H
  002dc	83 3b ff	 cmp	 DWORD PTR [ebx], -1
  002df	74 14		 je	 SHORT $MigrateLegacyExit$14921

; 712  :       status = SerialPutRegistryKeyValue(pnpKey, L"MaskInverted",
; 713  :                                          sizeof(L"MaskInverted"), REG_DWORD,
; 714  :                                          &PUserData->MaskInverted,
; 715  :                                          sizeof(ULONG));

  002e1	57		 push	 edi
  002e2	53		 push	 ebx
  002e3	57		 push	 edi
  002e4	6a 1a		 push	 26			; 0000001aH
  002e6	68 00 00 00 00	 push	 OFFSET FLAT:$SG15005
  002eb	ff 75 08	 push	 DWORD PTR _pnpKey$[ebp]
  002ee	e8 00 00 00 00	 call	 _SerialPutRegistryKeyValue@24
  002f3	8b f0		 mov	 esi, eax
$MigrateLegacyExit$14921:

; 716  :       if (!NT_SUCCESS(status)) {
; 717  :          SerialDump(SERERRORS, ("SERIAL: Couldn't migrate MaskInverted\n"));
; 718  :          goto MigrateLegacyExit;
; 719  :       }
; 720  :    }
; 721  : 
; 722  : 
; 723  :    MigrateLegacyExit:;
; 724  : 
; 725  :    ZwClose(pnpKey);

  002f5	ff 75 08	 push	 DWORD PTR _pnpKey$[ebp]
  002f8	ff 15 00 00 00
	00		 call	 DWORD PTR __imp__ZwClose@4

; 726  : 
; 727  :    SerialDump(SERTRACECALLS, ("SERIAL: Leave (2) SerialMigrateLegacyRegistry"
; 728  :                               "\n"));
; 729  : 
; 730  :    return status;

  002fe	8b c6		 mov	 eax, esi
$L14894:
  00300	5f		 pop	 edi
  00301	5e		 pop	 esi
  00302	5b		 pop	 ebx

; 731  : }

  00303	c9		 leave
  00304	c2 0c 00	 ret	 12			; 0000000cH
_SerialMigrateLegacyRegistry@12 ENDP
INIT	ENDS
PUBLIC	_SerialIsUserDataValid@20
EXTRN	_SerialItemCallBack@44:NEAR
EXTRN	__imp__wcslen:NEAR
EXTRN	__imp__IoQueryDeviceDescription@32:NEAR
; Function compile flags: /Ogsy
;	COMDAT _SerialIsUserDataValid@20
INIT	SEGMENT
_DriverObject$ = 8
_UserSubKey$ = 12
_Parameters$ = 16
_DefaultInterfaceType$ = 20
_PUserData$ = 24
_zero$ = -8
_rval$ = -1
_foundIt$15104 = 19
_SerialIsUserDataValid@20 PROC NEAR			; COMDAT

; 772  : {

  00000	55		 push	 ebp
  00001	8b ec		 mov	 ebp, esp
  00003	51		 push	 ecx
  00004	51		 push	 ecx
  00005	53		 push	 ebx
  00006	56		 push	 esi

; 773  :    ULONG zero = 0;
; 774  :    BOOLEAN rval = TRUE;
; 775  : 
; 776  :    PAGED_CODE();
; 777  : 
; 778  : 
; 779  :    SerialDump(SERTRACECALLS, ("SERIAL: Enter SerialIsUserDataValid\n"));
; 780  : 
; 781  :    //
; 782  :    // Make sure that the interrupt is non zero (which we defaulted
; 783  :    // it to).
; 784  :    //
; 785  :    // Make sure that the portaddress is non zero (which we defaulted
; 786  :    // it to).
; 787  :    //
; 788  :    // Make sure that the DosDevices is not NULL (which we defaulted
; 789  :    // it to).
; 790  :    //
; 791  :    // We need to make sure that if an interrupt status
; 792  :    // was specified, that a port index was also specfied,
; 793  :    // and if so that the port index is <= maximum ports
; 794  :    // on a board.
; 795  :    //
; 796  :    // We should also validate that the bus type and number
; 797  :    // are correct.
; 798  :    //
; 799  :    // We will also validate that the interrupt mode makes
; 800  :    // sense for the bus.
; 801  :    //
; 802  : 
; 803  :    if (!PUserData->UserPort.LowPart) {

  00007	8b 75 18	 mov	 esi, DWORD PTR _PUserData$[ebp]
  0000a	33 db		 xor	 ebx, ebx
  0000c	57		 push	 edi
  0000d	89 5d f8	 mov	 DWORD PTR _zero$[ebp], ebx
  00010	39 1e		 cmp	 DWORD PTR [esi], ebx
  00012	c6 45 ff 01	 mov	 BYTE PTR _rval$[ebp], 1
  00016	75 2e		 jne	 SHORT $L15030

; 804  : 
; 805  :       //
; 806  :       // Ehhhh! Lose Game.
; 807  :       //
; 808  : 

⌨️ 快捷键说明

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