📄 read.cod
字号:
; 521 : setFirstStatus = TRUE;
; 522 :
; 523 : }
; 524 :
; 525 : } else {
001c7 eb 7c jmp SHORT $L15161
$L14891:
; 526 :
; 527 : //
; 528 : // If we are supposed to crunch the read down to
; 529 : // one character, then update the read length
; 530 : // in the irp and truncate the number needed for
; 531 : // read down to one. Note that if we are doing
; 532 : // this crunching, then the information must be
; 533 : // zero (or we would have completed above) and
; 534 : // the number needed for the read must still be
; 535 : // equal to the read length.
; 536 : //
; 537 :
; 538 : if (crunchDownToOne) {
001c9 80 7d fb 00 cmp BYTE PTR _crunchDownToOne$[ebp], 0
001cd 74 0f je SHORT $L14896
; 539 :
; 540 : ASSERT(
; 541 : (!Extension->CurrentReadIrp->IoStatus.Information)
; 542 : &&
; 543 : (Extension->NumberNeededForRead ==
; 544 : IoGetCurrentIrpStackLocation(
; 545 : Extension->CurrentReadIrp
; 546 : )->Parameters.Read.Length)
; 547 : );
; 548 :
; 549 : Extension->NumberNeededForRead = 1;
001cf 33 c9 xor ecx, ecx
001d1 41 inc ecx
001d2 89 8b 0c 01 00
00 mov DWORD PTR [ebx+268], ecx
; 550 : IoGetCurrentIrpStackLocation(
; 551 : Extension->CurrentReadIrp
; 552 : )->Parameters.Read.Length = 1;
001d8 8b 40 60 mov eax, DWORD PTR [eax+96]
001db 89 48 04 mov DWORD PTR [eax+4], ecx
$L14896:
; 553 :
; 554 : }
; 555 :
; 556 : //
; 557 : // We still need to get more characters for this read.
; 558 : // synchronize with the isr so that we can update the
; 559 : // number of characters and if necessary it will have the
; 560 : // isr switch to copying into the users buffer.
; 561 : //
; 562 :
; 563 : KeSynchronizeExecution(
; 564 : Extension->Interrupt,
; 565 : SerialUpdateAndSwitchToUser,
; 566 : &updateChar
; 567 : );
001de 8d 45 d8 lea eax, DWORD PTR _updateChar$[ebp]
001e1 50 push eax
001e2 68 00 00 00 00 push OFFSET FLAT:_SerialUpdateAndSwitchToUser@4
001e7 ff b3 a0 00 00
00 push DWORD PTR [ebx+160]
001ed ff 15 00 00 00
00 call DWORD PTR __imp__KeSynchronizeExecution@12
; 568 :
; 569 : if (!updateChar.Completed) {
001f3 80 7d e0 00 cmp BYTE PTR _updateChar$[ebp+8], 0
001f7 74 79 je SHORT $L15144
; 629 :
; 630 : }
; 631 : return firstStatus;
; 632 :
; 633 : } else {
; 634 :
; 635 : IoReleaseCancelSpinLock(oldIrql);
001f9 ff 75 f0 push DWORD PTR _oldIrql$[ebp]
001fc ff 15 00 00 00
00 call DWORD PTR __imp__IoReleaseCancelSpinLock@4
; 636 : KeReleaseSpinLock(
; 637 : &Extension->ControlLock,
; 638 : controlIrql
; 639 : );
00202 8a 55 fe mov dl, BYTE PTR _controlIrql$[ebp]
00205 8d 8b e4 01 00
00 lea ecx, DWORD PTR [ebx+484]
0020b ff d7 call edi
; 640 : Extension->CurrentReadIrp->IoStatus.Status =
; 641 : STATUS_SUCCESS;
0020d 8b 06 mov eax, DWORD PTR [esi]
; 642 :
; 643 : if (!setFirstStatus) {
; 644 :
; 645 : firstStatus = STATUS_SUCCESS;
; 646 : setFirstStatus = TRUE;
0020f eb 26 jmp SHORT $L15163
$L14885:
; 465 :
; 466 : //
; 467 : // We got all we needed for this read.
; 468 : // Update the number of characters in the
; 469 : // interrupt read buffer.
; 470 : //
; 471 :
; 472 : KeSynchronizeExecution(
; 473 : Extension->Interrupt,
; 474 : SerialUpdateInterruptBuffer,
; 475 : &updateChar
; 476 : );
00211 8d 45 d8 lea eax, DWORD PTR _updateChar$[ebp]
00214 50 push eax
00215 68 00 00 00 00 push OFFSET FLAT:_SerialUpdateInterruptBuffer@4
0021a ff b3 a0 00 00
00 push DWORD PTR [ebx+160]
00220 ff 15 00 00 00
00 call DWORD PTR __imp__KeSynchronizeExecution@12
; 477 :
; 478 : KeReleaseSpinLock(
; 479 : &Extension->ControlLock,
; 480 : controlIrql
; 481 : );
00226 8a 55 fe mov dl, BYTE PTR _controlIrql$[ebp]
00229 8d 8b e4 01 00
00 lea ecx, DWORD PTR [ebx+484]
0022f ff d7 call edi
; 482 :
; 483 : Extension->CurrentReadIrp->IoStatus.Status = STATUS_SUCCESS;
00231 8b 83 c4 00 00
00 mov eax, DWORD PTR [ebx+196]
$L15163:
00237 83 60 18 00 and DWORD PTR [eax+24], 0
; 484 : if (!setFirstStatus) {
0023b 80 7d ff 00 cmp BYTE PTR _setFirstStatus$[ebp], 0
0023f 75 08 jne SHORT $L14887
; 485 :
; 486 : firstStatus = STATUS_SUCCESS;
00241 83 65 f4 00 and DWORD PTR _firstStatus$[ebp], 0
$L15161:
; 487 : setFirstStatus = TRUE;
00245 c6 45 ff 01 mov BYTE PTR _setFirstStatus$[ebp], 1
$L14887:
; 647 :
; 648 : }
; 649 :
; 650 : }
; 651 :
; 652 : }
; 653 :
; 654 : }
; 655 :
; 656 : }
; 657 :
; 658 : //
; 659 : // Well the operation is complete.
; 660 : //
; 661 :
; 662 : SerialGetNextIrp(
; 663 : &Extension->CurrentReadIrp,
; 664 : &Extension->ReadQueue,
; 665 : &newIrp,
; 666 : TRUE,
; 667 : Extension
; 668 : );
00249 53 push ebx
0024a 8d 45 ec lea eax, DWORD PTR _newIrp$[ebp]
0024d 6a 01 push 1
0024f 50 push eax
00250 8d 83 a4 00 00
00 lea eax, DWORD PTR [ebx+164]
00256 8d b3 c4 00 00
00 lea esi, DWORD PTR [ebx+196]
0025c 50 push eax
0025d 56 push esi
0025e e8 00 00 00 00 call _SerialGetNextIrp@20
; 669 :
; 670 : } while (newIrp);
00263 83 7d ec 00 cmp DWORD PTR _newIrp$[ebp], 0
00267 0f 85 ac fd ff
ff jne $L14855
0026d e9 8f 00 00 00 jmp $L15145
$L15144:
; 570 :
; 571 : //
; 572 : // The irp still isn't complete. The
; 573 : // completion routines will end up reinvoking
; 574 : // this routine. So we simply leave.
; 575 : //
; 576 : // First thought we should start off the total
; 577 : // timer for the read and increment the reference
; 578 : // count that the total timer has on the current
; 579 : // irp. Note that this is safe, because even if
; 580 : // the io has been satisfied by the isr it can't
; 581 : // complete yet because we still own the cancel
; 582 : // spinlock.
; 583 : //
; 584 :
; 585 : if (useTotalTimer) {
00272 80 7d 0b 00 cmp BYTE PTR _useTotalTimer$[ebp], 0
00276 74 25 je SHORT $L14898
; 586 :
; 587 : SERIAL_SET_REFERENCE(
; 588 : Extension->CurrentReadIrp,
; 589 : SERIAL_REF_TOTAL_TIMER
; 590 : );
00278 8b 06 mov eax, DWORD PTR [esi]
; 591 :
; 592 : SerialSetTimer(
; 593 : &Extension->ReadRequestTotalTimer,
; 594 : totalTime,
; 595 : &Extension->TotalReadTimeoutDpc,
; 596 : Extension
; 597 : );
0027a 53 push ebx
0027b 8b 40 60 mov eax, DWORD PTR [eax+96]
0027e 83 c0 10 add eax, 16 ; 00000010H
00281 83 08 04 or DWORD PTR [eax], 4
00284 8d 83 2c 02 00
00 lea eax, DWORD PTR [ebx+556]
0028a 50 push eax
0028b 8d 83 b0 03 00
00 lea eax, DWORD PTR [ebx+944]
00291 ff 75 e8 push DWORD PTR _totalTime$[ebp+4]
00294 ff 75 e4 push DWORD PTR _totalTime$[ebp]
00297 50 push eax
00298 e8 00 00 00 00 call _SerialSetTimer@20
$L14898:
; 598 :
; 599 : }
; 600 :
; 601 : if (useIntervalTimer) {
0029d 80 7d fa 00 cmp BYTE PTR _useIntervalTimer$[ebp], 0
002a1 74 34 je SHORT $L14905
; 602 :
; 603 : SERIAL_SET_REFERENCE(
; 604 : Extension->CurrentReadIrp,
; 605 : SERIAL_REF_INT_TIMER
; 606 : );
002a3 8b 06 mov eax, DWORD PTR [esi]
002a5 8b 40 60 mov eax, DWORD PTR [eax+96]
002a8 83 c0 10 add eax, 16 ; 00000010H
002ab 83 08 08 or DWORD PTR [eax], 8
; 607 :
; 608 : KeQuerySystemTime(
; 609 : &Extension->LastReadTime
; 610 : );
002ae 8d 43 58 lea eax, DWORD PTR [ebx+88]
002b1 50 push eax
002b2 ff 15 00 00 00
00 call DWORD PTR __imp__KeQuerySystemTime@4
; 611 : SerialSetTimer(
; 612 : &Extension->ReadRequestIntervalTimer,
; 613 : *Extension->IntervalTimeToUse,
; 614 : &Extension->IntervalReadTimeoutDpc,
; 615 : Extension
; 616 : );
002b8 8d 83 4c 02 00
00 lea eax, DWORD PTR [ebx+588]
002be 53 push ebx
002bf 50 push eax
002c0 8b 83 88 00 00
00 mov eax, DWORD PTR [ebx+136]
002c6 ff 70 04 push DWORD PTR [eax+4]
002c9 ff 30 push DWORD PTR [eax]
002cb 8d 83 d8 03 00
00 lea eax, DWORD PTR [ebx+984]
002d1 50 push eax
002d2 e8 00 00 00 00 call _SerialSetTimer@20
$L14905:
; 617 :
; 618 : }
; 619 :
; 620 : IoMarkIrpPending(Extension->CurrentReadIrp);
002d7 8b 06 mov eax, DWORD PTR [esi]
002d9 8b 40 60 mov eax, DWORD PTR [eax+96]
002dc 80 48 03 01 or BYTE PTR [eax+3], 1
; 621 : IoReleaseCancelSpinLock(oldIrql);
002e0 ff 75 f0 push DWORD PTR _oldIrql$[ebp]
002e3 ff 15 00 00 00
00 call DWORD PTR __imp__IoReleaseCancelSpinLock@4
; 622 : KeReleaseSpinLock(
; 623 : &Extension->ControlLock,
; 624 : controlIrql
; 625 : );
002e9 8a 55 fe mov dl, BYTE PTR _controlIrql$[ebp]
002ec 8d 8b e4 01 00
00 lea ecx, DWORD PTR [ebx+484]
002f2 ff d7 call edi
; 626 : if (!setFirstStatus) {
002f4 80 7d ff 00 cmp BYTE PTR _setFirstStatus$[ebp], 0
002f8 75 07 jne SHORT $L15145
; 627 :
; 628 : firstStatus = STATUS_PENDING;
002fa c7 45 f4 03 01
00 00 mov DWORD PTR _firstStatus$[ebp], 259 ; 00000103H
$L15145:
; 671 :
; 672 : return firstStatus;
00301 8b 45 f4 mov eax, DWORD PTR _firstStatus$[ebp]
00304 5f pop edi
00305 5e pop esi
00306 5b pop ebx
; 673 :
; 674 : }
00307 c9 leave
00308 c2 04 00 ret 4
_SerialStartRead@4 ENDP
PAGESER ENDS
PUBLIC _SerialCompleteRead@16
EXTRN _SerialDpcEpilogue@8:NEAR
EXTRN _SerialTryToCompleteCurrent@44:NEAR
; Function compile flags: /Ogsy
; COMDAT _SerialCompleteRead@16
_TEXT SEGMENT
_Dpc$ = 8
_DeferredContext$ = 12
_oldIrql$ = -4
_SerialCompleteRead@16 PROC NEAR ; COMDAT
; 709 : {
00000 55 push ebp
00001 8b ec mov ebp, esp
00003 51 push ecx
; 710 :
; 711 : PSERIAL_DEVICE_EXTENSION extension = DeferredContext;
; 712 : KIRQL oldIrql;
; 713 :
; 714 : UNREFERENCED_PARAMETER(SystemContext1);
; 715 : UNREFERENCED_PARAMETER(SystemContext2);
; 716 :
; 717 :
; 718 : SerialDump(SERTRACECALLS, ("SERIAL: SerialCompleteRead\n"));
; 719 :
; 720 :
; 721 : IoAcquireCancelSpinLock(&oldIrql);
00004 8d 45 fc lea eax, DWORD PTR _oldIrql$[ebp]
00007 56 push esi
00008 50 push eax
00009 ff 15 00 00 00
00 call DWORD PTR __imp__IoAcquireCancelSpinLock@4
; 722 :
; 723 : //
; 724 : // We set this to indicate to the interval timer
; 725 : // that the read has completed.
; 726 : //
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -