📄 write.cod
字号:
; 384 : //
; 385 :
; 386 : IoSetCancelRoutine(
; 387 : Extension->CurrentWriteIrp,
; 388 : SerialCancelCurrentWrite
; 389 : );
002f1 8b 0e mov ecx, DWORD PTR [esi]
002f3 ba 00 00 00 00 mov edx, OFFSET FLAT:_SerialCancelCurrentWrite@8
002f8 83 c1 38 add ecx, 56 ; 00000038H
002fb ff 15 00 00 00
00 call DWORD PTR __imp_@InterlockedExchange@8
; 390 :
; 391 : SERIAL_SET_REFERENCE(
; 392 : Extension->CurrentWriteIrp,
; 393 : SERIAL_REF_CANCEL
; 394 : );
00301 8b 06 mov eax, DWORD PTR [esi]
00303 8b 78 60 mov edi, DWORD PTR [eax+96]
00306 83 c7 10 add edi, 16 ; 00000010H
00309 f6 07 02 test BYTE PTR [edi], 2
0030c 74 17 je SHORT $L15024
0030e 6a 00 push 0
00310 68 8a 01 00 00 push 394 ; 0000018aH
00315 68 00 00 00 00 push OFFSET FLAT:$SG15026
0031a 68 00 00 00 00 push OFFSET FLAT:$SG15027
0031f ff 15 00 00 00
00 call DWORD PTR __imp__RtlAssert@16
$L15024:
00325 83 0f 02 or DWORD PTR [edi], 2
; 395 :
; 396 : if (UseATimer) {
00328 80 7d 0b 00 cmp BYTE PTR _UseATimer$[ebp], 0
0032c 74 41 je SHORT $L15031
; 397 :
; 398 : SerialSetTimer(
; 399 : &Extension->WriteRequestTotalTimer,
; 400 : TotalTime,
; 401 : &Extension->TotalWriteTimeoutDpc,
; 402 : Extension
; 403 : );
0032e 8d 83 6c 02 00
00 lea eax, DWORD PTR [ebx+620]
00334 53 push ebx
00335 50 push eax
00336 8d 83 00 04 00
00 lea eax, DWORD PTR [ebx+1024]
0033c ff 75 ec push DWORD PTR _TotalTime$[ebp+4]
0033f ff 75 e8 push DWORD PTR _TotalTime$[ebp]
00342 50 push eax
00343 e8 00 00 00 00 call _SerialSetTimer@20
; 404 :
; 405 : //
; 406 : // This timer now has a reference to the irp.
; 407 : //
; 408 :
; 409 : SERIAL_SET_REFERENCE(
; 410 : Extension->CurrentWriteIrp,
; 411 : SERIAL_REF_TOTAL_TIMER
; 412 : );
00348 8b 06 mov eax, DWORD PTR [esi]
0034a 8b 70 60 mov esi, DWORD PTR [eax+96]
0034d 83 c6 10 add esi, 16 ; 00000010H
00350 f6 06 04 test BYTE PTR [esi], 4
00353 74 17 je SHORT $L15035
00355 6a 00 push 0
00357 68 9c 01 00 00 push 412 ; 0000019cH
0035c 68 00 00 00 00 push OFFSET FLAT:$SG15037
00361 68 00 00 00 00 push OFFSET FLAT:$SG15038
00366 ff 15 00 00 00
00 call DWORD PTR __imp__RtlAssert@16
$L15035:
0036c 83 0e 04 or DWORD PTR [esi], 4
$L15031:
; 413 : }
; 414 :
; 415 : KeSynchronizeExecution(
; 416 : Extension->Interrupt,
; 417 : SerialGiveWriteToIsr,
; 418 : Extension
; 419 : );
0036f 53 push ebx
00370 68 00 00 00 00 push OFFSET FLAT:_SerialGiveWriteToIsr@4
00375 ff b3 a0 00 00
00 push DWORD PTR [ebx+160]
0037b ff 15 00 00 00
00 call DWORD PTR __imp__KeSynchronizeExecution@12
; 420 :
; 421 : IoReleaseCancelSpinLock(OldIrql);
00381 ff 75 fb push DWORD PTR _OldIrql$[ebp]
00384 ff 15 00 00 00
00 call DWORD PTR __imp__IoReleaseCancelSpinLock@4
$L14969:
; 440 :
; 441 : return FirstStatus;
0038a 8b 45 f4 mov eax, DWORD PTR _FirstStatus$[ebp]
0038d 5f pop edi
0038e 5e pop esi
0038f 5b pop ebx
; 442 :
; 443 : }
00390 c9 leave
00391 c2 04 00 ret 4
_SerialStartWrite@4 ENDP
PAGESER ENDS
PUBLIC _SerialCancelCurrentXoff@8
PUBLIC _SerialGiveXoffToIsr@4
PUBLIC _SerialProcessEmptyTransmit@4
EXTRN _SerialGetNextIrp@20:NEAR
; COMDAT _SerialGetNextWrite@20
PAGESER SEGMENT
$SG15051 DB 'SERIAL: Pageable code called at IRQL %d without lock ', 0aH
DB 00H
ORG $+1
$SG15054 DB 'f:\w2ddk\src\kernel\serial\write.c', 00H
ORG $+1
$SG15055 DB 'FALSE', 00H
ORG $+2
$SG15062 DB 'SERIAL: SerialGetNextWrite', 0aH, 00H
$SG15076 DB 'f:\w2ddk\src\kernel\serial\write.c', 00H
ORG $+5
$SG15077 DB 'Extension->TotalCharsQueued >= (IoGetCurrentIrpStackLoca'
DB 'tion(*CurrentOpIrp) ->Parameters.Write.Length)', 00H
ORG $+1
$SG15085 DB 'f:\w2ddk\src\kernel\serial\write.c', 00H
ORG $+1
$SG15086 DB '!Extension->CurrentXoffIrp', 00H
ORG $+1
$SG15089 DB 'f:\w2ddk\src\kernel\serial\write.c', 00H
ORG $+1
$SG15090 DB '!Irp->CancelRoutine', 00H
$SG15111 DB 'f:\w2ddk\src\kernel\serial\write.c', 00H
ORG $+1
$SG15112 DB '!(*_arg4 & _refType)', 00H
ORG $+3
$SG15128 DB 'f:\w2ddk\src\kernel\serial\write.c', 00H
ORG $+1
$SG15129 DB '!(*_arg4 & _refType)', 00H
ORG $+3
$SG15136 DB 'f:\w2ddk\src\kernel\serial\write.c', 00H
ORG $+1
$SG15137 DB '(*NewIrp) == (*CurrentOpIrp)', 00H
; Function compile flags: /Ogs
_CurrentOpIrp$ = 8
_QueueToProcess$ = 12
_NewIrp$ = 16
_CompleteCurrent$ = 20
_Extension$ = 24
_OldIrql$15073 = 24
_OldIrql$15080 = -8
_Xc$15082 = -4
_OldIrql$15131 = 8
_SerialGetNextWrite@20 PROC NEAR ; COMDAT
; 491 : {
00241 55 push ebp
00242 8b ec mov ebp, esp
00244 51 push ecx
00245 51 push ecx
00246 53 push ebx
00247 56 push esi
; 492 :
; 493 : // PSERIAL_DEVICE_EXTENSION Extension = CONTAINING_RECORD(
; 494 : // QueueToProcess,
; 495 : // SERIAL_DEVICE_EXTENSION,
; 496 : // WriteQueue
; 497 : // );
; 498 :
; 499 : SERIAL_LOCKED_PAGED_CODE();
00248 8b 35 00 00 00
00 mov esi, DWORD PTR __imp__KeGetCurrentIrql@0
0024e 57 push edi
0024f ff d6 call esi
00251 3c 01 cmp al, 1
00253 76 32 jbe SHORT $L15056
00255 83 3d 14 00 00
00 00 cmp DWORD PTR _SerialGlobals+20, 0
0025c 75 29 jne SHORT $L15056
0025e ff d6 call esi
00260 0f b6 c0 movzx eax, al
00263 50 push eax
00264 68 00 00 00 00 push OFFSET FLAT:$SG15051
00269 e8 00 00 00 00 call _DbgPrint
0026e 59 pop ecx
0026f 59 pop ecx
00270 6a 00 push 0
00272 68 f3 01 00 00 push 499 ; 000001f3H
00277 68 00 00 00 00 push OFFSET FLAT:$SG15054
0027c 68 00 00 00 00 push OFFSET FLAT:$SG15055
00281 ff 15 00 00 00
00 call DWORD PTR __imp__RtlAssert@16
$L15056:
; 500 :
; 501 : SerialDump(SERTRACECALLS, ("SERIAL: SerialGetNextWrite\n"));
00287 f6 05 00 00 00
00 40 test BYTE PTR _SerialDebugLevel, 64 ; 00000040H
0028e 74 0b je SHORT $L15057
00290 68 00 00 00 00 push OFFSET FLAT:$SG15062
00295 e8 00 00 00 00 call _DbgPrint
0029a 59 pop ecx
$L15057:
0029b 8b 75 18 mov esi, DWORD PTR _Extension$[ebp]
$L15069:
; 502 :
; 503 :
; 504 : do {
; 505 :
; 506 :
; 507 : //
; 508 : // We could be completing a flush.
; 509 : //
; 510 :
; 511 : if (IoGetCurrentIrpStackLocation(*CurrentOpIrp)->MajorFunction
; 512 : == IRP_MJ_WRITE) {
0029e 8b 5d 08 mov ebx, DWORD PTR _CurrentOpIrp$[ebp]
002a1 8b 03 mov eax, DWORD PTR [ebx]
002a3 8b 48 60 mov ecx, DWORD PTR [eax+96]
002a6 8a 09 mov cl, BYTE PTR [ecx]
002a8 80 f9 04 cmp cl, 4
002ab 75 45 jne SHORT $L15072
; 513 :
; 514 : KIRQL OldIrql;
; 515 :
; 516 : ASSERT(Extension->TotalCharsQueued >=
; 517 : (IoGetCurrentIrpStackLocation(*CurrentOpIrp)
; 518 : ->Parameters.Write.Length));
002ad 8b 40 60 mov eax, DWORD PTR [eax+96]
002b0 8b 8e 28 01 00
00 mov ecx, DWORD PTR [esi+296]
002b6 3b 48 04 cmp ecx, DWORD PTR [eax+4]
002b9 73 17 jae SHORT $L15074
002bb 6a 00 push 0
002bd 68 06 02 00 00 push 518 ; 00000206H
002c2 68 00 00 00 00 push OFFSET FLAT:$SG15076
002c7 68 00 00 00 00 push OFFSET FLAT:$SG15077
002cc ff 15 00 00 00
00 call DWORD PTR __imp__RtlAssert@16
$L15074:
; 519 :
; 520 : IoAcquireCancelSpinLock(&OldIrql);
002d2 8d 45 18 lea eax, DWORD PTR _OldIrql$15073[ebp]
002d5 50 push eax
002d6 ff 15 00 00 00
00 call DWORD PTR __imp__IoAcquireCancelSpinLock@4
; 521 : Extension->TotalCharsQueued -=
; 522 : IoGetCurrentIrpStackLocation(*CurrentOpIrp)
; 523 : ->Parameters.Write.Length;
002dc 8b 03 mov eax, DWORD PTR [ebx]
; 524 : IoReleaseCancelSpinLock(OldIrql);
002de ff 75 18 push DWORD PTR _OldIrql$15073[ebp]
002e1 8b 40 60 mov eax, DWORD PTR [eax+96]
002e4 8b 40 04 mov eax, DWORD PTR [eax+4]
002e7 29 86 28 01 00
00 sub DWORD PTR [esi+296], eax
; 525 :
; 526 : } else if (IoGetCurrentIrpStackLocation(*CurrentOpIrp)->MajorFunction
002ed e9 22 01 00 00 jmp $L15487
$L15072:
; 527 : == IRP_MJ_DEVICE_CONTROL) {
002f2 80 f9 0e cmp cl, 14 ; 0000000eH
002f5 0f 85 1f 01 00
00 jne $L15079
; 528 :
; 529 : KIRQL OldIrql;
; 530 : PIRP Irp;
; 531 : PSERIAL_XOFF_COUNTER Xc;
; 532 :
; 533 : IoAcquireCancelSpinLock(&OldIrql);
002fb 8d 45 f8 lea eax, DWORD PTR _OldIrql$15080[ebp]
002fe 50 push eax
002ff ff 15 00 00 00
00 call DWORD PTR __imp__IoAcquireCancelSpinLock@4
; 534 :
; 535 : Irp = *CurrentOpIrp;
00305 8b 3b mov edi, DWORD PTR [ebx]
; 536 : Xc = Irp->AssociatedIrp.SystemBuffer;
; 537 :
; 538 : //
; 539 : // We should never have a xoff counter when we
; 540 : // get to this point.
; 541 : //
; 542 :
; 543 : ASSERT(!Extension->CurrentXoffIrp);
00307 83 be dc 00 00
00 00 cmp DWORD PTR [esi+220], 0
0030e 8b 47 0c mov eax, DWORD PTR [edi+12]
00311 89 45 fc mov DWORD PTR _Xc$15082[ebp], eax
00314 74 17 je SHORT $L15083
00316 6a 00 push 0
00318 68 1f 02 00 00 push 543 ; 0000021fH
0031d 68 00 00 00 00 push OFFSET FLAT:$SG15085
00322 68 00 00 00 00 push OFFSET FLAT:$SG15086
00327 ff 15 00 00 00
00 call DWORD PTR __imp__RtlAssert@16
$L15083:
; 544 :
; 545 : //
; 546 : // We absolutely shouldn't have a cancel routine
; 547 : // at this point.
; 548 : //
; 549 :
; 550 : ASSERT(!Irp->CancelRoutine);
0032d 83 7f 38 00 cmp DWORD PTR [edi+56], 0
00331 74 17 je SHORT $L15087
00333 6a 00 push 0
00335 68 26 02 00 00 push 550 ; 00000226H
0033a 68 00 00 00 00 push OFFSET FLAT:$SG15089
0033f 68 00 00 00 00 push OFFSET FLAT:$SG15090
00344 ff 15 00 00 00
00 call DWORD PTR __imp__RtlAssert@16
$L15087:
; 551 :
; 552 : //
; 553 : // This could only be a xoff counter masquerading as
; 554 : // a write irp.
; 555 : //
; 556 :
; 557 : Extension->TotalCharsQueued--;
0034a ff 8e 28 01 00
00 dec DWORD PTR [esi+296]
; 558 :
; 559 : //
; 560 : // Check to see of the xoff irp has been set with success.
; 561 : // This means that the write completed normally. If that
; 562 : // is the case, and it hasn't been set to cancel in the
; 563 : // meanwhile, then go on and make it the CurrentXoffIrp.
; 564 : //
; 565 :
; 566 : if (Irp->IoStatus.Status != STATUS_SUCCESS) {
00350 83 7f 18 00 cmp DWORD PTR [edi+24], 0
00354 0f 85 b7 00 00
00 jne $L15122
; 567 :
; 568 : //
; 569 : // Oh well, we can just finish it off.
; 570 : //
; 571 : NOTHING;
; 572 :
; 573 : } else if (Irp->Cancel) {
0035a 80 7f 24 00 cmp BYTE PTR [edi+36], 0
0035e 74 0c je SHORT $L15094
; 574 :
; 575 : Irp->IoStatus.Status = STATUS_CANCELLED;
00360 c7 47 18 20 01
00 c0 mov DWORD PTR [edi+24], -1073741536 ; c0000120H
; 576 :
; 577 : } else {
00367 e9 a5 00 00 00 jmp $L15122
$L15094:
; 578 :
; 579 : //
; 580 : // Give it a new cancel routine, and increment the
; 581 : // reference count because the cancel routine has
; 582 : // a reference to it.
; 583 : //
; 584 :
; 585 : IoSetCancelRoutine(
; 586 : Irp,
; 587 : SerialCancelCurrentXoff
; 588 : );
0036c ba 00 00 00 00 mov edx, OFFSET FLAT:_SerialCancelCurrentXoff@8
00371 8d 4f 38 lea ecx, DWORD PTR [edi+56]
00374 ff 15 00 00 00
00 call DWORD PTR __imp_@InterlockedExchange@8
; 589 :
; 590 : SERIAL_SET_REFERENCE(
; 591 : Irp,
; 592 : SERIAL_REF_CANCEL
; 593 : );
0037a 8b 5f 60 mov ebx, DWORD PTR [edi+96]
0037d 83 c3 10 add ebx, 16 ; 00000010H
00380 f6 03 02 test BYTE PTR [ebx], 2
00383 74 17 je SHORT $L15109
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -