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

📄 legacy.cod

📁 怎样在win2000下构造驱动程序znsoft_Serial2000_demo.ZIP
💻 COD
📖 第 1 页 / 共 5 页
字号:
$SG15201 DB	'SERIAL: Couldn''t migrate Indexed', 0aH, 00H
	ORG $+2
$SG15211 DB	'D', 00H, 'i', 00H, 's', 00H, 'a', 00H, 'b', 00H, 'l', 00H
	DB	'e', 00H, 'P', 00H, 'o', 00H, 'r', 00H, 't', 00H, 00H, 00H
$SG15220 DB	'SERIAL: Couldn''t migrate DisablePort', 0aH, 00H
	ORG $+2
$SG15230 DB	'F', 00H, 'o', 00H, 'r', 00H, 'c', 00H, 'e', 00H, 'F', 00H
	DB	'i', 00H, 'f', 00H, 'o', 00H, 'E', 00H, 'n', 00H, 'a', 00H, 'b'
	DB	00H, 'l', 00H, 'e', 00H, 00H, 00H
$SG15239 DB	'SERIAL: Couldn''t migrate ForceFifoEnable', 0aH, 00H
	ORG $+2
$SG15249 DB	'R', 00H, 'x', 00H, 'F', 00H, 'I', 00H, 'F', 00H, 'O', 00H
	DB	00H, 00H
	ORG $+2
$SG15258 DB	'SERIAL: Couldn''t migrate RxFIFO', 0aH, 00H
	ORG $+3
$SG15268 DB	'T', 00H, 'x', 00H, 'F', 00H, 'I', 00H, 'F', 00H, 'O', 00H
	DB	00H, 00H
	ORG $+2
$SG15277 DB	'SERIAL: Couldn''t migrate TxFIFO', 0aH, 00H
	ORG $+3
$SG15287 DB	'M', 00H, 'a', 00H, 's', 00H, 'k', 00H, 'I', 00H, 'n', 00H
	DB	'v', 00H, 'e', 00H, 'r', 00H, 't', 00H, 'e', 00H, 'd', 00H, 00H
	DB	00H
	ORG $+2
$SG15296 DB	'SERIAL: Couldn''t migrate MaskInverted', 0aH, 00H
	ORG $+1
$SG15309 DB	'SERIAL: Leave (2) SerialMigrateLegacyRegistry', 0aH, 00H
; Function compile flags: /Ogs
_PPdo$ = 8
_PUserData$ = 12
_IsMulti$ = 16
_status$ = 8
_pnpKey$ = -4
_pnpNameBuf$ = -16
_isMultiport$ = -8
_SerialMigrateLegacyRegistry@12 PROC NEAR		; COMDAT

; 513  : {

  0036b	55		 push	 ebp
  0036c	8b ec		 mov	 ebp, esp
  0036e	83 ec 10	 sub	 esp, 16			; 00000010H
  00371	53		 push	 ebx
  00372	56		 push	 esi

; 514  :    NTSTATUS status;
; 515  :    HANDLE pnpKey;
; 516  :    UNICODE_STRING pnpNameBuf;
; 517  :    ULONG isMultiport = 1;

  00373	33 f6		 xor	 esi, esi
  00375	57		 push	 edi

; 518  :    ULONG one = 1;
; 519  : 
; 520  :    PAGED_CODE();

  00376	8b 3d 00 00 00
	00		 mov	 edi, DWORD PTR __imp__KeGetCurrentIrql@0
  0037c	46		 inc	 esi
  0037d	89 75 f8	 mov	 DWORD PTR _isMultiport$[ebp], esi
  00380	ff d7		 call	 edi
  00382	3c 01		 cmp	 al, 1
  00384	76 2c		 jbe	 SHORT $L16274
  00386	ff d7		 call	 edi
  00388	0f b6 c0	 movzx	 eax, al
  0038b	50		 push	 eax
  0038c	68 00 00 00 00	 push	 OFFSET FLAT:$SG15057
  00391	e8 00 00 00 00	 call	 _DbgPrint
  00396	59		 pop	 ecx
  00397	33 ff		 xor	 edi, edi
  00399	59		 pop	 ecx
  0039a	57		 push	 edi
  0039b	68 08 02 00 00	 push	 520			; 00000208H
  003a0	68 00 00 00 00	 push	 OFFSET FLAT:$SG15060
  003a5	68 00 00 00 00	 push	 OFFSET FLAT:$SG15061
  003aa	ff 15 00 00 00
	00		 call	 DWORD PTR __imp__RtlAssert@16
  003b0	eb 02		 jmp	 SHORT $L15062
$L16274:
  003b2	33 ff		 xor	 edi, edi
$L15062:

; 521  : 
; 522  :    SerialDump(SERTRACECALLS, ("SERIAL: Enter SerialMigrateLegacyRegistry\n"));

  003b4	f6 05 00 00 00
	00 40		 test	 BYTE PTR _SerialDebugLevel, 64 ; 00000040H
  003bb	74 0b		 je	 SHORT $L15063
  003bd	68 00 00 00 00	 push	 OFFSET FLAT:$SG15068
  003c2	e8 00 00 00 00	 call	 _DbgPrint
  003c7	59		 pop	 ecx
$L15063:

; 523  : 
; 524  :    status = IoOpenDeviceRegistryKey(PPdo, PLUGPLAY_REGKEY_DEVICE,
; 525  :                                     STANDARD_RIGHTS_WRITE, &pnpKey);

  003c8	8b 5d 08	 mov	 ebx, DWORD PTR _PPdo$[ebp]
  003cb	8d 45 fc	 lea	 eax, DWORD PTR _pnpKey$[ebp]
  003ce	50		 push	 eax
  003cf	68 00 00 02 00	 push	 131072			; 00020000H
  003d4	56		 push	 esi
  003d5	53		 push	 ebx
  003d6	ff 15 00 00 00
	00		 call	 DWORD PTR __imp__IoOpenDeviceRegistryKey@16

; 526  : 
; 527  :    if (!NT_SUCCESS(status)) {

  003dc	3b c7		 cmp	 eax, edi
  003de	89 45 08	 mov	 DWORD PTR _status$[ebp], eax
  003e1	7d 1c		 jge	 SHORT $L15076

; 528  :       SerialDump(SERTRACECALLS, ("SERIAL: Leave (1) SerialMigrateLegacyRegistry"
; 529  :                                  "\n"));

  003e3	f6 05 00 00 00
	00 40		 test	 BYTE PTR _SerialDebugLevel, 64 ; 00000040H
  003ea	74 0b		 je	 SHORT $L15078
  003ec	68 00 00 00 00	 push	 OFFSET FLAT:$SG15083
  003f1	e8 00 00 00 00	 call	 _DbgPrint
  003f6	59		 pop	 ecx
$L15078:

; 530  :       return status;

  003f7	8b 45 08	 mov	 eax, DWORD PTR _status$[ebp]
  003fa	e9 e2 02 00 00	 jmp	 $L15050
$L15076:

; 531  :    }
; 532  : 
; 533  :    //
; 534  :    // Allocate a buffer to copy the port name over.
; 535  :    //
; 536  : 
; 537  :    pnpNameBuf.MaximumLength = sizeof(WCHAR) * 256;
; 538  :    pnpNameBuf.Length = 0;
; 539  :    pnpNameBuf.Buffer = ExAllocatePool(PagedPool, sizeof(WCHAR) * 257);

  003ff	68 43 4f 4d 58	 push	 1481461571		; 584d4f43H
  00404	68 02 02 00 00	 push	 514			; 00000202H
  00409	56		 push	 esi
  0040a	66 c7 45 f2 00
	02		 mov	 WORD PTR _pnpNameBuf$[ebp+2], 512 ; 00000200H
  00410	66 89 7d f0	 mov	 WORD PTR _pnpNameBuf$[ebp], di
  00414	ff 15 00 00 00
	00		 call	 DWORD PTR __imp__ExAllocatePoolWithTag@12

; 540  : 
; 541  :    if (pnpNameBuf.Buffer == NULL) {

  0041a	3b c7		 cmp	 eax, edi
  0041c	89 45 f4	 mov	 DWORD PTR _pnpNameBuf$[ebp+4], eax
  0041f	75 4a		 jne	 SHORT $L15093

; 542  :       SerialLogError(PPdo->DriverObject, NULL, PUserData->UserPort,
; 543  :                      SerialPhysicalZero, 0, 0, 0, 63, STATUS_SUCCESS,
; 544  :                      SERIAL_INSUFFICIENT_RESOURCES, 0, NULL, 0, NULL);

  00421	57		 push	 edi
  00422	57		 push	 edi
  00423	57		 push	 edi
  00424	57		 push	 edi
  00425	68 08 00 06 c0	 push	 -1073348600		; c0060008H
  0042a	57		 push	 edi
  0042b	6a 3f		 push	 63			; 0000003fH
  0042d	8b 45 0c	 mov	 eax, DWORD PTR _PUserData$[ebp]
  00430	57		 push	 edi
  00431	57		 push	 edi
  00432	57		 push	 edi
  00433	ff 35 04 00 00
	00		 push	 DWORD PTR _SerialPhysicalZero+4
  00439	ff 35 00 00 00
	00		 push	 DWORD PTR _SerialPhysicalZero
  0043f	ff 70 04	 push	 DWORD PTR [eax+4]
  00442	ff 30		 push	 DWORD PTR [eax]
  00444	57		 push	 edi
  00445	ff 73 08	 push	 DWORD PTR [ebx+8]
  00448	e8 00 00 00 00	 call	 _SerialLogError@64

; 545  : 
; 546  :       SerialDump(SERERRORS, ("SERIAL: Couldn't allocate buffer for the PnP "
; 547  :                              "link\n"));

  0044d	f6 05 03 00 00
	00 40		 test	 BYTE PTR _SerialDebugLevel+3, 64 ; 00000040H
  00454	74 0b		 je	 SHORT $L15100
  00456	68 00 00 00 00	 push	 OFFSET FLAT:$SG15105
  0045b	e8 00 00 00 00	 call	 _DbgPrint
  00460	59		 pop	 ecx
$L15100:

; 548  :       status = STATUS_INSUFFICIENT_RESOURCES;

  00461	be 9a 00 00 c0	 mov	 esi, -1073741670	; c000009aH

; 549  :       goto MigrateLegacyExit;

  00466	e9 57 02 00 00	 jmp	 $MigrateLegacyExit$15113
$L15093:

; 550  : 
; 551  :    }
; 552  : 
; 553  :    RtlZeroMemory(pnpNameBuf.Buffer, pnpNameBuf.MaximumLength + sizeof(WCHAR));

  0046b	0f b7 4d f2	 movzx	 ecx, WORD PTR _pnpNameBuf$[ebp+2]
  0046f	8b 7d f4	 mov	 edi, DWORD PTR _pnpNameBuf$[ebp+4]
  00472	41		 inc	 ecx
  00473	41		 inc	 ecx

; 554  : 
; 555  : 
; 556  :    //
; 557  :    // Add the port name -- ALWAYS
; 558  :    //
; 559  : 
; 560  :    RtlAppendUnicodeStringToString(&pnpNameBuf, &PUserData->UserSymbolicLink);

  00474	8b 5d 0c	 mov	 ebx, DWORD PTR _PUserData$[ebp]
  00477	8b d1		 mov	 edx, ecx
  00479	33 c0		 xor	 eax, eax
  0047b	c1 e9 02	 shr	 ecx, 2
  0047e	f3 ab		 rep stosd
  00480	8b ca		 mov	 ecx, edx
  00482	83 e1 03	 and	 ecx, 3
  00485	f3 aa		 rep stosb
  00487	8d 43 14	 lea	 eax, DWORD PTR [ebx+20]
  0048a	50		 push	 eax
  0048b	8d 45 f0	 lea	 eax, DWORD PTR _pnpNameBuf$[ebp]
  0048e	50		 push	 eax
  0048f	ff 15 00 00 00
	00		 call	 DWORD PTR __imp__RtlAppendUnicodeStringToString@8

; 561  :    RtlZeroMemory(((PUCHAR)(&pnpNameBuf.Buffer[0])) + pnpNameBuf.Length,
; 562  :                  sizeof(WCHAR));

  00495	0f b7 7d f0	 movzx	 edi, WORD PTR _pnpNameBuf$[ebp]
  00499	03 7d f4	 add	 edi, DWORD PTR _pnpNameBuf$[ebp+4]
  0049c	33 c0		 xor	 eax, eax
  0049e	66 ab		 stosw

; 563  : 
; 564  :    status = SerialPutRegistryKeyValue(pnpKey, L"PortName", sizeof(L"PortName"),
; 565  :                                       REG_SZ, pnpNameBuf.Buffer,
; 566  :                                       pnpNameBuf.Length + sizeof(WCHAR));

  004a0	0f b7 45 f0	 movzx	 eax, WORD PTR _pnpNameBuf$[ebp]
  004a4	40		 inc	 eax
  004a5	40		 inc	 eax
  004a6	50		 push	 eax
  004a7	ff 75 f4	 push	 DWORD PTR _pnpNameBuf$[ebp+4]
  004aa	56		 push	 esi
  004ab	6a 12		 push	 18			; 00000012H
  004ad	68 00 00 00 00	 push	 OFFSET FLAT:$SG15118
  004b2	ff 75 fc	 push	 DWORD PTR _pnpKey$[ebp]
  004b5	e8 00 00 00 00	 call	 _SerialPutRegistryKeyValue@24

; 567  : 
; 568  :    ExFreePool(pnpNameBuf.Buffer);

  004ba	ff 75 f4	 push	 DWORD PTR _pnpNameBuf$[ebp+4]
  004bd	8b f0		 mov	 esi, eax
  004bf	ff 15 00 00 00
	00		 call	 DWORD PTR __imp__ExFreePool@4

; 569  : 
; 570  :    if (!NT_SUCCESS(status)) {

  004c5	85 f6		 test	 esi, esi
  004c7	7d 17		 jge	 SHORT $L15120

; 571  :       SerialDump(SERERRORS, ("SERIAL: Couldn't migrate PortName\n"));

  004c9	f6 05 03 00 00
	00 40		 test	 BYTE PTR _SerialDebugLevel+3, 64 ; 00000040H
  004d0	0f 84 ec 01 00
	00		 je	 $MigrateLegacyExit$15113
  004d6	68 00 00 00 00	 push	 OFFSET FLAT:$SG15127

; 572  :       goto MigrateLegacyExit;

  004db	e9 dc 01 00 00	 jmp	 $L16282
$L15120:

; 573  :    }
; 574  : 
; 575  :    //
; 576  :    // If it was part of a multiport card, save that info as well
; 577  :    //
; 578  : 
; 579  :    if (IsMulti) {

  004e0	80 7d 10 00	 cmp	 BYTE PTR _IsMulti$[ebp], 0
  004e4	6a 04		 push	 4
  004e6	5f		 pop	 edi
  004e7	74 32		 je	 SHORT $L15138

; 580  :       status = SerialPutRegistryKeyValue(pnpKey, L"MultiportDevice",
; 581  :                                          sizeof(L"MultiportDevice"), REG_DWORD,
; 582  :                                          &isMultiport, sizeof(ULONG));

  004e9	8d 45 f8	 lea	 eax, DWORD PTR _isMultiport$[ebp]
  004ec	57		 push	 edi
  004ed	50		 push	 eax
  004ee	57		 push	 edi
  004ef	6a 20		 push	 32			; 00000020H
  004f1	68 00 00 00 00	 push	 OFFSET FLAT:$SG15136
  004f6	ff 75 fc	 push	 DWORD PTR _pnpKey$[ebp]
  004f9	e8 00 00 00 00	 call	 _SerialPutRegistryKeyValue@24
  004fe	8b f0		 mov	 esi, eax

; 583  : 
; 584  :       if (!NT_SUCCESS(status)) {

  00500	85 f6		 test	 esi, esi
  00502	7d 17		 jge	 SHORT $L15138

; 585  :          SerialDump(SERERRORS, ("SERIAL: Couldn't mark multiport\n"));

  00504	f6 05 03 00 00
	00 40		 test	 BYTE PTR _SerialDebugLevel+3, 64 ; 00000040H
  0050b	0f 84 b1 01 00
	00		 je	 $MigrateLegacyExit$15113
  00511	68 00 00 00 00	 push	 OFFSET FLAT:$SG15145

; 586  :          goto MigrateLegacyExit;

  00516	e9 a1 01 00 00	 jmp	 $L16282
$L15138:

; 587  :       }
; 588  :    }
; 589  : 
; 590  :   
; 591  : 
; 592  : 
; 593  :    //
; 594  :    // If a port index was specified, save it
; 595  :    //
; 596  : 
; 597  :    if (PUserData->UserPortIndex != 0) {

  0051b	8d 43 1c	 lea	 eax, DWORD PTR [ebx+28]
  0051e	83 38 00	 cmp	 DWORD PTR [eax], 0
  00521	74 2f		 je	 SHORT $L15156

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

  00523	57		 push	 edi
  00524	50		 push	 eax
  00525	57		 push	 edi
  00526	6a 14		 push	 20			; 00000014H
  00528	68 00 00 00 00	 push	 OFFSET FLAT:$SG15154
  0052d	ff 75 fc	 push	 DWORD PTR _pnpKey$[ebp]
  00530	e8 00 00 00 00	 call	 _SerialPutRegistryKeyValue@24
  00535	8b f0		 mov	 esi, eax

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

  00537	85 f6		 test	 esi, esi
  00539	7d 17		 jge	 SHORT $L15156

; 604  :          SerialDump(SERERRORS, ("SERIAL: Couldn't migrate PortIndex\n"));

  0053b	f6 05 03 00 00
	00 40		 test	 BYTE PTR _SerialDebugLevel+3, 64 ; 00000040H
  00542	0f 84 7a 01 00
	00		 je	 $MigrateLegacyExit$15113
  00548	68 00 00 00 00	 push	 OFFSET FLAT:$SG15163

; 605  :          goto MigrateLegacyExit;

  0054d	e9 6a 01 00 00	 jmp	 $L16282
$L15156:

; 606  :       }
; 607  :    }
; 608  : 
; 609  : 
; 610  :    //
; 611  :    // If not default clock rate, save it
; 612  :    //
; 613  : 
; 614  :    if (PUserData->UserClockRate != SERIAL_BAD_VALUE) {

  00552	8d 43 28	 lea	 eax, DWORD PTR [ebx+40]
  00555	83 38 ff	 cmp	 DWORD PTR [eax], -1
  00558	74 2f		 je	 SHORT $L15175

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

  0055a	57		 push	 edi
  0055b	50		 push	 eax
  0055c	57		 push	 edi
  0055d	6a 14		 push	 20			; 00000014H
  0055f	68 00 00 00 00	 push	 OFFSET FLAT:$SG15173
  00564	ff 75 fc	 push	 DWORD PTR _pnpKey$[ebp]

⌨️ 快捷键说明

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