📄 pcidppublic.cod
字号:
00085 8b 40 04 mov eax, DWORD PTR [eax+4]
00088 89 78 18 mov DWORD PTR [eax+24], edi
0008b 8b 45 08 mov eax, DWORD PTR _RegisteredInt$[ebp]
0008e 8b 40 04 mov eax, DWORD PTR [eax+4]
00091 89 78 1c mov DWORD PTR [eax+28], edi
00094 8b 45 08 mov eax, DWORD PTR _RegisteredInt$[ebp]
00097 8b 48 04 mov ecx, DWORD PTR [eax+4]
0009a ff 15 00 00 00
00 call DWORD PTR __imp_@IofCompleteRequest@8
; 431 :
; 432 : //ObjExt->MemoryBase[0x1C63]++; //debug
; 433 :
; 434 : FreeEntry(ObjExt, CurrentLink);
000a0 ff 75 14 push DWORD PTR _CurrentLink$[ebp]
000a3 56 push esi
000a4 e8 00 00 00 00 call _FreeEntry@8
; 435 : }
; 436 : else
000a9 eb 92 jmp SHORT $L8821
$L8605:
; 437 : PutBackEntry(ObjExt, CurrentLink);
000ab ff 75 14 push DWORD PTR _CurrentLink$[ebp]
000ae 56 push esi
000af e8 00 00 00 00 call _PutBackEntry@8
; 438 : }
; 439 : }
; 440 : else
000b4 eb 87 jmp SHORT $L8821
$L8597:
; 441 : NTStatus = STATUS_NO_MEMORY;
000b6 c7 45 10 17 00
00 c0 mov DWORD PTR _NTStatus$[ebp], -1073741801 ; c0000017H
; 442 :
; 443 : }
; 444 : else
000bd eb 07 jmp SHORT $L8617
$L8596:
; 445 : NTStatus = STATUS_INVALID_BUFFER_SIZE;
000bf c7 45 10 06 02
00 c0 mov DWORD PTR _NTStatus$[ebp], -1073741306 ; c0000206H
$L8617:
; 446 :
; 447 : Irp->IoStatus.Status = NTStatus;
000c6 8b 45 0c mov eax, DWORD PTR _Irp$[ebp]
000c9 8b 4d 10 mov ecx, DWORD PTR _NTStatus$[ebp]
000cc 5f pop edi
000cd 5e pop esi
000ce 89 48 18 mov DWORD PTR [eax+24], ecx
000d1 5b pop ebx
; 448 : }
000d2 c9 leave
000d3 c2 10 00 ret 16 ; 00000010H
_PCIDPUnMapDMA@16 ENDP
_TEXT ENDS
PUBLIC _PCIDPGetPCIRegs@20
EXTRN _DeviceCompletionRoutine@12:NEAR
EXTRN __imp__KeWaitForSingleObject@20:NEAR
EXTRN __imp_@IofCallDriver@8:NEAR
; COMDAT _PCIDPGetPCIRegs@20
_TEXT SEGMENT
_DeviceObject$ = 8
_FileObject$ = 12
_Irp$ = 16
_IoBuffer$ = 20
_OutputBufferLength$ = 24
_PCIDPGetPCIRegs@20 PROC NEAR ; COMDAT
; 461 : ){
00000 55 push ebp
00001 8b ec mov ebp, esp
; 462 :
; 463 : // Define variables.
; 464 : NTSTATUS NTStatus;
; 465 : PPCIDP_EXTENSION ObjExt;
; 466 : PIO_STACK_LOCATION NextIrpStack;
; 467 :
; 468 : // Initialize variables.
; 469 : ObjExt = (PPCIDP_EXTENSION)DeviceObject->DeviceExtension;
00003 8b 45 08 mov eax, DWORD PTR _DeviceObject$[ebp]
; 470 :
; 471 : // Check for adequate output buffer space.
; 472 : if(OutputBufferLength >= sizeof(PCIDP00_GET_PCI_CONFIG_REGS_RECV)){
00006 8b 4d 18 mov ecx, DWORD PTR _OutputBufferLength$[ebp]
00009 53 push ebx
0000a 56 push esi
0000b 8b 70 28 mov esi, DWORD PTR [eax+40]
0000e 83 f9 40 cmp ecx, 64 ; 00000040H
00011 72 70 jb SHORT $L8635
; 473 :
; 474 : // Now get the PCI register space.
; 475 : NextIrpStack = IoGetNextIrpStackLocation(Irp);
00013 8b 55 10 mov edx, DWORD PTR _Irp$[ebp]
00016 57 push edi
; 476 : NextIrpStack->MajorFunction = IRP_MJ_PNP;
; 477 : NextIrpStack->MinorFunction = IRP_MN_READ_CONFIG;
; 478 : NextIrpStack->Flags = 0;
; 479 : NextIrpStack->Parameters.ReadWriteConfig.WhichSpace = 0;
; 480 : NextIrpStack->Parameters.ReadWriteConfig.Buffer = IoBuffer;
00017 8b 7d 14 mov edi, DWORD PTR _IoBuffer$[ebp]
0001a 33 db xor ebx, ebx
0001c 8b 42 60 mov eax, DWORD PTR [edx+96]
0001f c6 40 dc 1b mov BYTE PTR [eax-36], 27 ; 0000001bH
00023 83 e8 24 sub eax, 36 ; 00000024H
00026 c6 40 01 0f mov BYTE PTR [eax+1], 15 ; 0000000fH
0002a 88 58 02 mov BYTE PTR [eax+2], bl
0002d 89 58 04 mov DWORD PTR [eax+4], ebx
00030 89 78 08 mov DWORD PTR [eax+8], edi
; 481 : NextIrpStack->Parameters.ReadWriteConfig.Offset = 0;
00033 89 58 0c mov DWORD PTR [eax+12], ebx
; 482 : NextIrpStack->Parameters.ReadWriteConfig.Length = OutputBufferLength;
00036 89 48 10 mov DWORD PTR [eax+16], ecx
; 483 : NextIrpStack->DeviceObject = ObjExt->NextLowerDeviceObject;
00039 8b 8e 8c 00 00
00 mov ecx, DWORD PTR [esi+140]
0003f 89 48 14 mov DWORD PTR [eax+20], ecx
; 484 : NextIrpStack->FileObject = FileObject;
00042 8b 4d 0c mov ecx, DWORD PTR _FileObject$[ebp]
00045 89 48 18 mov DWORD PTR [eax+24], ecx
; 485 :
; 486 : IoSetCompletionRoutine(
; 487 : IN Irp,
; 488 : IN DeviceCompletionRoutine,
; 489 : IN NULL, //Context
; 490 : IN TRUE, //InvokeOnSuccess
; 491 : IN TRUE, //InvokeOnError
; 492 : IN TRUE //InvokeOnCancel
; 493 : );
00048 8b 42 60 mov eax, DWORD PTR [edx+96]
0004b 83 e8 24 sub eax, 36 ; 00000024H
0004e c7 40 1c 00 00
00 00 mov DWORD PTR [eax+28], OFFSET FLAT:_DeviceCompletionRoutine@12
00055 89 58 20 mov DWORD PTR [eax+32], ebx
00058 c6 40 03 e0 mov BYTE PTR [eax+3], 224 ; 000000e0H
; 494 : NTStatus = IoCallDriver(ObjExt->NextLowerDeviceObject, Irp);
0005c 8b 8e 8c 00 00
00 mov ecx, DWORD PTR [esi+140]
00062 ff 15 00 00 00
00 call DWORD PTR __imp_@IofCallDriver@8
; 495 : if(NTStatus == STATUS_PENDING){
00068 3d 03 01 00 00 cmp eax, 259 ; 00000103H
0006d 5f pop edi
0006e 75 21 jne SHORT $L8644
; 496 : KeWaitForSingleObject(
; 497 : IN &ObjExt->WaitEvent,
; 498 : IN Executive, //WaitReason
; 499 : IN KernelMode, //WaitMode
; 500 : IN FALSE, //Alertable
; 501 : IN NULL //Timeout
; 502 : );
00070 53 push ebx
00071 53 push ebx
00072 53 push ebx
00073 81 c6 90 00 00
00 add esi, 144 ; 00000090H
00079 53 push ebx
0007a 56 push esi
0007b ff 15 00 00 00
00 call DWORD PTR __imp__KeWaitForSingleObject@20
; 503 : }
; 504 : }
; 505 :
; 506 : else{
00081 eb 0e jmp SHORT $L8644
$L8635:
; 507 : NTStatus = STATUS_INVALID_BUFFER_SIZE;
; 508 : Irp->IoStatus.Status = NTStatus;
00083 8b 45 10 mov eax, DWORD PTR _Irp$[ebp]
; 509 : Irp->IoStatus.Information = 0;
00086 83 60 1c 00 and DWORD PTR [eax+28], 0
0008a c7 40 18 06 02
00 c0 mov DWORD PTR [eax+24], -1073741306 ; c0000206H
$L8644:
00091 5e pop esi
00092 5b pop ebx
; 510 : }
; 511 : }
00093 5d pop ebp
00094 c2 14 00 ret 20 ; 00000014H
_PCIDPGetPCIRegs@20 ENDP
_TEXT ENDS
PUBLIC _PCIDPSetPCIRegs@20
; COMDAT _PCIDPSetPCIRegs@20
_TEXT SEGMENT
_DeviceObject$ = 8
_FileObject$ = 12
_Irp$ = 16
_IoBuffer$ = 20
_InputBufferLength$ = 24
_PCIDPSetPCIRegs@20 PROC NEAR ; COMDAT
; 524 : ){
00000 55 push ebp
00001 8b ec mov ebp, esp
; 525 :
; 526 : // Define variables.
; 527 : NTSTATUS NTStatus;
; 528 : PPCIDP_EXTENSION ObjExt;
; 529 : PIO_STACK_LOCATION NextIrpStack;
; 530 :
; 531 : // Initialize variables.
; 532 : ObjExt = (PPCIDP_EXTENSION)DeviceObject->DeviceExtension;
00003 8b 45 08 mov eax, DWORD PTR _DeviceObject$[ebp]
; 533 :
; 534 : // Check for adequate input buffer space.
; 535 : if(InputBufferLength >= sizeof(PCIDP00_SET_PCI_CONFIG_REGS_SEND)){
00006 8b 4d 18 mov ecx, DWORD PTR _InputBufferLength$[ebp]
00009 53 push ebx
0000a 56 push esi
0000b 8b 70 28 mov esi, DWORD PTR [eax+40]
0000e 83 f9 40 cmp ecx, 64 ; 00000040H
00011 72 70 jb SHORT $L8662
; 536 :
; 537 : // Now set the PCI register space.
; 538 : NextIrpStack = IoGetNextIrpStackLocation(Irp);
00013 8b 55 10 mov edx, DWORD PTR _Irp$[ebp]
00016 57 push edi
; 539 : NextIrpStack->MajorFunction = IRP_MJ_PNP;
; 540 : NextIrpStack->MinorFunction = IRP_MN_WRITE_CONFIG;
; 541 : NextIrpStack->Flags = 0;
; 542 : NextIrpStack->Parameters.ReadWriteConfig.WhichSpace = 0;
; 543 : NextIrpStack->Parameters.ReadWriteConfig.Buffer = IoBuffer;
00017 8b 7d 14 mov edi, DWORD PTR _IoBuffer$[ebp]
0001a 33 db xor ebx, ebx
0001c 8b 42 60 mov eax, DWORD PTR [edx+96]
0001f c6 40 dc 1b mov BYTE PTR [eax-36], 27 ; 0000001bH
00023 83 e8 24 sub eax, 36 ; 00000024H
00026 c6 40 01 10 mov BYTE PTR [eax+1], 16 ; 00000010H
0002a 88 58 02 mov BYTE PTR [eax+2], bl
0002d 89 58 04 mov DWORD PTR [eax+4], ebx
00030 89 78 08 mov DWORD PTR [eax+8], edi
; 544 : NextIrpStack->Parameters.ReadWriteConfig.Offset = 0;
00033 89 58 0c mov DWORD PTR [eax+12], ebx
; 545 : NextIrpStack->Parameters.ReadWriteConfig.Length = InputBufferLength;
00036 89 48 10 mov DWORD PTR [eax+16], ecx
; 546 : NextIrpStack->DeviceObject = ObjExt->NextLowerDeviceObject;
00039 8b 8e 8c 00 00
00 mov ecx, DWORD PTR [esi+140]
0003f 89 48 14 mov DWORD PTR [eax+20], ecx
; 547 : NextIrpStack->FileObject = FileObject;
00042 8b 4d 0c mov ecx, DWORD PTR _FileObject$[ebp]
00045 89 48 18 mov DWORD PTR [eax+24], ecx
; 548 :
; 549 : IoSetCompletionRoutine(
; 550 : IN Irp,
; 551 : IN DeviceCompletionRoutine,
; 552 : IN NULL, //Context
; 553 : IN TRUE, //InvokeOnSuccess
; 554 : IN TRUE, //InvokeOnError
; 555 : IN TRUE //InvokeOnCancel
; 556 : );
00048 8b 42 60 mov eax, DWORD PTR [edx+96]
0004b 83 e8 24 sub eax, 36 ; 00000024H
0004e c7 40 1c 00 00
00 00 mov DWORD PTR [eax+28], OFFSET FLAT:_DeviceCompletionRoutine@12
00055 89 58 20 mov DWORD PTR [eax+32], ebx
00058 c6 40 03 e0 mov BYTE PTR [eax+3], 224 ; 000000e0H
; 557 : NTStatus = IoCallDriver(ObjExt->NextLowerDeviceObject, Irp);
0005c 8b 8e 8c 00 00
00 mov ecx, DWORD PTR [esi+140]
00062 ff 15 00 00 00
00 call DWORD PTR __imp_@IofCallDriver@8
; 558 : if(NTStatus == STATUS_PENDING){
00068 3d 03 01 00 00 cmp eax, 259 ; 00000103H
0006d 5f pop edi
0006e 75 21 jne SHORT $L8671
; 559 : KeWaitForSingleObject(
; 560 : IN &ObjExt->WaitEvent,
; 561 : IN Executive, //WaitReason
; 562 : IN KernelMode, //WaitMode
; 563 : IN FALSE, //Alertable
; 564 : IN NULL //Timeout
; 565 : );
00070 53 push ebx
00071 53 push ebx
00072 53 push ebx
00073 81 c6 90 00 00
00 add esi, 144 ; 00000090H
00079 53 push ebx
0007a 56 push esi
0007b ff 15 00 00 00
00 call DWORD PTR __imp__KeWaitForSingleObject@20
; 566 : }
; 567 : }
; 568 :
; 569 : else{
00081 eb 0e jmp SHORT $L8671
$L8662:
; 570 : NTStatus = STATUS_INVALID_BUFFER_SIZE;
; 571 : Irp->IoStatus.Status = NTStatus;
00083 8b 45 10 mov eax, DWORD PTR _Irp$[ebp]
; 572 : Irp->IoStatus.Information = 0;
00086 83 60 1c 00 and DWORD PTR [eax+28], 0
0008a c7 40 18 06 02
00 c0 mov DWORD PTR [eax+24], -1073741306 ; c0000206H
$L8671:
00091 5e pop esi
00092 5b pop ebx
; 573 : }
; 574 : }
00093 5d pop ebp
00094 c2 14 00 ret 20 ; 00000014H
_PCIDPSetPCIRegs@20 ENDP
_TEXT ENDS
PUBLIC _PCIDPRegisterInterrupt@20
EXTRN _PCIDPCancelInterrupt@8:NEAR
; COMDAT _PCIDPRegisterInterrupt@20
_TEXT SEGMENT
_DeviceObject$ = 8
_Irp$ = 12
_IoBuffer$ = 16
_InputBufferLength$ = 20
_CancelSpin$ = 16
_MemoryBase$ = -4
_Type$ = 8
_PCIDPRegisterInterrupt@20 PROC NEAR ; COMDAT
; 587 : ){
00000 55 push ebp
00001 8b ec mov ebp, esp
00003 51 push ecx
; 588 :
; 589 : // Define variables.
; 590 : NTSTATUS NTStatus;
; 591 : PPCIDP00_REGISTER_INTERRUPT_SEND IoInput;
; 592 : PPCIDP_EXTENSION ObjExt;
; 593 : KIRQL CancelSpin;
; 594 : PULONG MemoryBase;
; 595 : PLINKED_LIST LLEntry;
; 596 : ULONG Type;
; 597 : ULONG HINTPattern;
; 598 :
; 599 : // Initialize variables.
; 600 : IoInput = (PPCIDP00_REGISTER_INTERRUPT_SEND)IoBuffer;
; 601 : ObjExt = (PPCIDP_EXTENSION)DeviceObject->DeviceExtension;
00004 8b 45 08 mov eax, DWORD PTR _DeviceObject$[ebp]
00007 53 push ebx
; 602 : MemoryBase = ObjExt->MemoryBase;
; 603 :
; 604 : // Check that call was made via the PCIDP API.
; 605 : if((IoInput->InterruptType & 0xF0C00000) != 0xF0C00000){
00008 b9 00 00 c0 f0 mov ecx, -255852544 ; f0c00000H
0000d 56 push esi
0000e 8b 58 28 mov ebx, DWORD PTR [eax+40]
00011 57 push edi
00012 8b 7d 0c mov edi, DWORD PTR _Irp$[ebp]
00015 8b 43 18 mov eax, DWORD PTR [ebx+24]
00018 89 45 fc mov DWORD PTR _MemoryBase$[ebp], eax
0001b 8b 45 10 mov eax, DWORD PTR _IoBuffer$[ebp]
0001e 8b 00 mov eax, DWORD PTR [eax]
00020 8b d0 mov edx, eax
00022 23 d1 and edx, ecx
00024 3b d1 cmp edx, ecx
00026 74 0a je SHORT $L8694
; 606 : NTStatus = STATUS_ACCESS_DENIED;
00028 b8 22 00 00 c0 mov eax, -1073741790 ; c0000022H
; 607 : goto ExitA;
0002d e9 c0 00 00 00 jmp $ExitA$8696
$L8694:
; 608 : }
; 609 : Type = IoInput->InterruptType & 0x000003FF;
00032 25 ff 03 00 00 and eax, 1023 ; 000003ffH
; 610 :
; 611 : // Check to make sure the board has the interrupt pin enabled.
; 612 : if(ObjExt->InterruptObject == 0){
00037 83 7b 20 00 cmp DWORD PTR [ebx+32], 0
0003b 89 45 08 mov DWORD PTR _Type$[ebp], eax
0003e 75 0a jne SHORT $L8697
; 613 : NTStatus = STATUS_BIOS_FAILED_TO_CONNECT_INTERRUPT;
00040 b8 6e 01 00 c0 mov eax, -1073741458 ; c000016eH
; 614 : goto ExitA;
00045 e9 a8 00 00 00 jmp $ExitA$8696
$L8697:
; 615 : }
; 616 :
; 617 : // Make sure the buffer lengths are of sufficient size to handle
; 618 : // the transactions.
; 619 : if(InputBufferLength < sizeof(PCIDP00_REGISTER_INTERRUPT_SEND)){
0004a 83 7d 14 04 cmp DWORD PTR _InputBufferLength$[ebp], 4
0004e 73 0a jae SHORT $L8700
; 620 : NTStatus = STATUS_INVALID_BUFFER_SIZE;
00050 b8 06 02 00 c0 mov eax, -1073741306 ; c0000206H
; 621 : goto ExitA;
00055 e9 98 00 00 00 jmp $ExitA$8696
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -