📄 legacy.cod
字号:
; 421 :
; 422 :
; 423 : pPartial++;
0005b 83 c0 10 add eax, 16 ; 00000010H
; 424 :
; 425 :
; 426 : //
; 427 : // Interrupt information
; 428 : //
; 429 :
; 430 : pPartial->Type = CmResourceTypeInterrupt;
0005e 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;
00061 c6 40 01 03 mov BYTE PTR [eax+1], 3
; 439 :
; 440 : if (PUserData->UserInterruptMode == Latched) {
00065 39 4a 30 cmp DWORD PTR [edx+48], ecx
00068 75 06 jne SHORT $L14878
; 441 : pPartial->Flags = CM_RESOURCE_INTERRUPT_LATCHED;
0006a 66 89 48 02 mov WORD PTR [eax+2], cx
; 442 : } else {
0006e eb 05 jmp SHORT $L14879
$L14878:
; 443 : pPartial->Flags = CM_RESOURCE_INTERRUPT_LEVEL_SENSITIVE;
00070 66 83 60 02 00 and WORD PTR [eax+2], 0
$L14879:
; 444 : }
; 445 :
; 446 : pPartial->u.Interrupt.Vector = PUserData->UserVector;
00075 8b 72 10 mov esi, DWORD PTR [edx+16]
00078 89 70 08 mov DWORD PTR [eax+8], esi
; 447 :
; 448 : if (PUserData->UserLevel == 0) {
0007b 8b 72 38 mov esi, DWORD PTR [edx+56]
0007e 85 f6 test esi, esi
00080 75 03 jne SHORT $L14880
; 449 : pPartial->u.Interrupt.Level = PUserData->UserVector;
00082 8b 72 10 mov esi, DWORD PTR [edx+16]
$L14880:
; 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) {
00085 83 fb 03 cmp ebx, 3
00088 89 70 04 mov DWORD PTR [eax+4], esi
0008b 75 1f jne SHORT $L14882
; 460 :
; 461 : pPartial++;
0008d 83 c0 10 add eax, 16 ; 00000010H
; 462 :
; 463 : pPartial->Type = CmResourceTypePort;
00090 88 08 mov BYTE PTR [eax], cl
; 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;
00092 88 58 01 mov BYTE PTR [eax+1], bl
; 472 :
; 473 : pPartial->Flags = (USHORT)PUserData->UserAddressSpace;
00095 66 8b 72 34 mov si, WORD PTR [edx+52]
00099 66 89 70 02 mov WORD PTR [eax+2], si
; 474 : pPartial->u.Port.Start = PUserData->UserInterruptStatus;
0009d 8b 72 08 mov esi, DWORD PTR [edx+8]
000a0 89 70 04 mov DWORD PTR [eax+4], esi
000a3 8b 52 0c mov edx, DWORD PTR [edx+12]
000a6 89 50 08 mov DWORD PTR [eax+8], edx
; 475 : pPartial->u.Port.Length = SERIAL_STATUS_LENGTH;
000a9 89 48 0c mov DWORD PTR [eax+12], ecx
$L14882:
; 476 : }
; 477 :
; 478 : *PPartialCount = countOfPartials;
000ac 8b 44 24 14 mov eax, DWORD PTR _PPartialCount$[esp+8]
000b0 5f pop edi
000b1 5e pop esi
000b2 89 18 mov DWORD PTR [eax], ebx
; 479 :
; 480 : SerialDump(SERTRACECALLS, ("SERIAL: Leave SerialBuildResourceList\n"));
; 481 :
; 482 : return status;
000b4 33 c0 xor eax, eax
000b6 5b pop ebx
; 483 : }
000b7 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
$SG14926 DB 'P', 00H, 'o', 00H, 'r', 00H, 't', 00H, 'N', 00H, 'a', 00H
DB 'm', 00H, 'e', 00H, 00H, 00H
ORG $+2
$SG14934 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
$SG14942 DB 'P', 00H, 'o', 00H, 'r', 00H, 't', 00H, 'I', 00H, 'n', 00H
DB 'd', 00H, 'e', 00H, 'x', 00H, 00H, 00H
$SG14951 DB 'C', 00H, 'l', 00H, 'o', 00H, 'c', 00H, 'k', 00H, 'R', 00H
DB 'a', 00H, 't', 00H, 'e', 00H, 00H, 00H
$SG14960 DB 'I', 00H, 'n', 00H, 'd', 00H, 'e', 00H, 'x', 00H, 'e', 00H
DB 'd', 00H, 00H, 00H
$SG14969 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
$SG14978 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
$SG14987 DB 'R', 00H, 'x', 00H, 'F', 00H, 'I', 00H, 'F', 00H, 'O', 00H
DB 00H, 00H
ORG $+2
$SG14996 DB 'T', 00H, 'x', 00H, 'F', 00H, 'I', 00H, 'F', 00H, 'O', 00H
DB 00H, 00H
ORG $+2
$SG15005 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
; Function compile flags: /Ogsy
_PPdo$ = 8
_PUserData$ = 12
_IsMulti$ = 16
_pnpKey$ = 8
_pnpNameBuf$ = -12
_isMultiport$ = -4
_SerialMigrateLegacyRegistry@12 PROC NEAR ; COMDAT
; 513 : {
000de 55 push ebp
000df 8b ec mov ebp, esp
000e1 83 ec 0c sub esp, 12 ; 0000000cH
000e4 53 push ebx
; 514 : NTSTATUS status;
; 515 : HANDLE pnpKey;
; 516 : UNICODE_STRING pnpNameBuf;
; 517 : ULONG isMultiport = 1;
; 518 : ULONG one = 1;
; 519 :
; 520 : PAGED_CODE();
; 521 :
; 522 : SerialDump(SERTRACECALLS, ("SERIAL: Enter SerialMigrateLegacyRegistry\n"));
; 523 :
; 524 : status = IoOpenDeviceRegistryKey(PPdo, PLUGPLAY_REGKEY_DEVICE,
; 525 : STANDARD_RIGHTS_WRITE, &pnpKey);
000e5 8b 5d 08 mov ebx, DWORD PTR _PPdo$[ebp]
000e8 56 push esi
000e9 33 f6 xor esi, esi
000eb 8d 45 08 lea eax, DWORD PTR _pnpKey$[ebp]
000ee 57 push edi
000ef 46 inc esi
000f0 50 push eax
000f1 68 00 00 02 00 push 131072 ; 00020000H
000f6 56 push esi
000f7 53 push ebx
000f8 89 75 fc mov DWORD PTR _isMultiport$[ebp], esi
000fb ff 15 00 00 00
00 call DWORD PTR __imp__IoOpenDeviceRegistryKey@16
; 526 :
; 527 : if (!NT_SUCCESS(status)) {
00101 33 ff xor edi, edi
00103 3b c7 cmp eax, edi
; 528 : SerialDump(SERTRACECALLS, ("SERIAL: Leave (1) SerialMigrateLegacyRegistry"
; 529 : "\n"));
; 530 : return status;
00105 0f 8c f5 01 00
00 jl $L14894
; 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);
0010b 68 43 4f 4d 58 push 1481461571 ; 584d4f43H
00110 68 02 02 00 00 push 514 ; 00000202H
00115 56 push esi
00116 66 c7 45 f6 00
02 mov WORD PTR _pnpNameBuf$[ebp+2], 512 ; 00000200H
0011c 66 89 7d f4 mov WORD PTR _pnpNameBuf$[ebp], di
00120 ff 15 00 00 00
00 call DWORD PTR __imp__ExAllocatePoolWithTag@12
; 540 :
; 541 : if (pnpNameBuf.Buffer == NULL) {
00126 3b c7 cmp eax, edi
00128 89 45 f8 mov DWORD PTR _pnpNameBuf$[ebp+4], eax
0012b 75 36 jne SHORT $L14911
; 542 : SerialLogError(PPdo->DriverObject, NULL, PUserData->UserPort,
; 543 : SerialPhysicalZero, 0, 0, 0, 63, STATUS_SUCCESS,
; 544 : SERIAL_INSUFFICIENT_RESOURCES, 0, NULL, 0, NULL);
0012d 57 push edi
0012e 57 push edi
0012f 57 push edi
00130 57 push edi
00131 68 08 00 06 c0 push -1073348600 ; c0060008H
00136 57 push edi
00137 6a 3f push 63 ; 0000003fH
00139 8b 45 0c mov eax, DWORD PTR _PUserData$[ebp]
0013c 57 push edi
0013d 57 push edi
0013e 57 push edi
0013f ff 35 04 00 00
00 push DWORD PTR _SerialPhysicalZero+4
00145 ff 35 00 00 00
00 push DWORD PTR _SerialPhysicalZero
0014b ff 70 04 push DWORD PTR [eax+4]
0014e ff 30 push DWORD PTR [eax]
00150 57 push edi
00151 ff 73 08 push DWORD PTR [ebx+8]
00154 e8 00 00 00 00 call _SerialLogError@64
; 545 :
; 546 : SerialDump(SERERRORS, ("SERIAL: Couldn't allocate buffer for the PnP "
; 547 : "link\n"));
; 548 : status = STATUS_INSUFFICIENT_RESOURCES;
00159 be 9a 00 00 c0 mov esi, -1073741670 ; c000009aH
; 549 : goto MigrateLegacyExit;
0015e e9 92 01 00 00 jmp $MigrateLegacyExit$14921
$L14911:
; 550 :
; 551 : }
; 552 :
; 553 : RtlZeroMemory(pnpNameBuf.Buffer, pnpNameBuf.MaximumLength + sizeof(WCHAR));
00163 0f b7 4d f6 movzx ecx, WORD PTR _pnpNameBuf$[ebp+2]
00167 8b 7d f8 mov edi, DWORD PTR _pnpNameBuf$[ebp+4]
0016a 41 inc ecx
0016b 41 inc ecx
; 554 :
; 555 :
; 556 : //
; 557 : // Add the port name -- ALWAYS
; 558 : //
; 559 :
; 560 : RtlAppendUnicodeStringToString(&pnpNameBuf, &PUserData->UserSymbolicLink);
0016c 8b 5d 0c mov ebx, DWORD PTR _PUserData$[ebp]
0016f 8b d1 mov edx, ecx
00171 33 c0 xor eax, eax
00173 c1 e9 02 shr ecx, 2
00176 f3 ab rep stosd
00178 8b ca mov ecx, edx
0017a 83 e1 03 and ecx, 3
0017d f3 aa rep stosb
0017f 8d 43 14 lea eax, DWORD PTR [ebx+20]
00182 50 push eax
00183 8d 45 f4 lea eax, DWORD PTR _pnpNameBuf$[ebp]
00186 50 push eax
00187 ff 15 00 00 00
00 call DWORD PTR __imp__RtlAppendUnicodeStringToString@8
; 561 : RtlZeroMemory(((PUCHAR)(&pnpNameBuf.Buffer[0])) + pnpNameBuf.Length,
; 562 : sizeof(WCHAR));
0018d 0f b7 7d f4 movzx edi, WORD PTR _pnpNameBuf$[ebp]
00191 03 7d f8 add edi, DWORD PTR _pnpNameBuf$[ebp+4]
00194 33 c0 xor eax, eax
00196 66 ab stosw
; 563 :
; 564 : status = SerialPutRegistryKeyValue(pnpKey, L"PortName", sizeof(L"PortName"),
; 565 : REG_SZ, pnpNameBuf.Buffer,
; 566 : pnpNameBuf.Length + sizeof(WCHAR));
00198 0f b7 45 f4 movzx eax, WORD PTR _pnpNameBuf$[ebp]
0019c 40 inc eax
0019d 40 inc eax
0019e 50 push eax
0019f ff 75 f8 push DWORD PTR _pnpNameBuf$[ebp+4]
001a2 56 push esi
001a3 6a 12 push 18 ; 00000012H
001a5 68 00 00 00 00 push OFFSET FLAT:$SG14926
001aa ff 75 08 push DWORD PTR _pnpKey$[ebp]
001ad e8 00 00 00 00 call _SerialPutRegistryKeyValue@24
; 567 :
; 568 : ExFreePool(pnpNameBuf.Buffer);
001b2 ff 75 f8 push DWORD PTR _pnpNameBuf$[ebp+4]
001b5 8b f0 mov esi, eax
001b7 ff 15 00 00 00
00 call DWORD PTR __imp__ExFreePool@4
; 569 :
; 570 : if (!NT_SUCCESS(status)) {
001bd 85 f6 test esi, esi
001bf 0f 8c 30 01 00
00 jl $MigrateLegacyExit$14921
; 571 : SerialDump(SERERRORS, ("SERIAL: Couldn't migrate PortName\n"));
; 572 : goto MigrateLegacyExit;
; 573 : }
; 574 :
; 575 : //
; 576 : // If it was part of a multiport card, save that info as well
; 577 : //
; 578 :
; 579 : if (IsMulti) {
001c5 80 7d 10 00 cmp BYTE PTR _IsMulti$[ebp], 0
001c9 6a 04 push 4
001cb 5f pop edi
001cc 74 1f je SHORT $L14936
; 580 : status = SerialPutRegistryKeyValue(pnpKey, L"MultiportDevice",
; 581 : sizeof(L"MultiportDevice"), REG_DWORD,
; 582 : &isMultiport, sizeof(ULONG));
001ce 8d 45 fc lea eax, DWORD PTR _isMultiport$[ebp]
001d1 57 push edi
001d2 50 push eax
001d3 57 push edi
001d4 6a 20 push 32 ; 00000020H
001d6 68 00 00 00 00 push OFFSET FLAT:$SG14934
001db ff 75 08 push DWORD PTR _pnpKey$[ebp]
001de e8 00 00 00 00 call _SerialPutRegistryKeyValue@24
001e3 8b f0 mov esi, eax
; 583 :
; 584 : if (!NT_SUCCESS(status)) {
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -