📄 ioctl.cod
字号:
00165 89 46 0c mov DWORD PTR [esi+12], eax
; 439 :
; 440 : if (Extension->WriteLength) {
00168 39 9f e0 00 00
00 cmp DWORD PTR [edi+224], ebx
0016e 74 54 je SHORT $L14980
; 441 :
; 442 : //
; 443 : // By definition if we have a writelength the we have
; 444 : // a current write irp.
; 445 : //
; 446 :
; 447 : ASSERT(Extension->CurrentWriteIrp);
00170 39 9f c8 00 00
00 cmp DWORD PTR [edi+200], ebx
00176 75 16 jne SHORT $L14981
00178 53 push ebx
00179 68 bf 01 00 00 push 447 ; 000001bfH
0017e 68 00 00 00 00 push OFFSET FLAT:$SG14983
00183 68 00 00 00 00 push OFFSET FLAT:$SG14984
00188 ff 15 00 00 00
00 call DWORD PTR __imp__RtlAssert@16
$L14981:
; 448 : ASSERT(Stat->AmountInOutQueue >= Extension->WriteLength);
0018e 8b 46 0c mov eax, DWORD PTR [esi+12]
00191 3b 87 e0 00 00
00 cmp eax, DWORD PTR [edi+224]
00197 73 16 jae SHORT $L14985
00199 53 push ebx
0019a 68 c0 01 00 00 push 448 ; 000001c0H
0019f 68 00 00 00 00 push OFFSET FLAT:$SG14987
001a4 68 00 00 00 00 push OFFSET FLAT:$SG14988
001a9 ff 15 00 00 00
00 call DWORD PTR __imp__RtlAssert@16
$L14985:
; 449 :
; 450 : Stat->AmountInOutQueue -=
; 451 : IoGetCurrentIrpStackLocation(Extension->CurrentWriteIrp)
; 452 : ->Parameters.Write.Length - (Extension->WriteLength);
001af 8b 87 c8 00 00
00 mov eax, DWORD PTR [edi+200]
001b5 8b 8f e0 00 00
00 mov ecx, DWORD PTR [edi+224]
001bb 8b 40 60 mov eax, DWORD PTR [eax+96]
001be 2b 48 04 sub ecx, DWORD PTR [eax+4]
001c1 01 4e 0c add DWORD PTR [esi+12], ecx
$L14980:
; 453 :
; 454 : }
; 455 :
; 456 : Stat->WaitForImmediate = Extension->TransmitImmediate;
001c4 8a 87 a1 01 00
00 mov al, BYTE PTR [edi+417]
; 457 :
; 458 : Stat->HoldReasons = 0;
001ca 89 5e 04 mov DWORD PTR [esi+4], ebx
001cd 88 46 11 mov BYTE PTR [esi+17], al
; 459 : if (Extension->TXHolding) {
001d0 8b 87 1c 01 00
00 mov eax, DWORD PTR [edi+284]
001d6 3b c3 cmp eax, ebx
001d8 74 3f je SHORT $L15003
; 460 :
; 461 : if (Extension->TXHolding & SERIAL_TX_CTS) {
001da a8 01 test al, 1
001dc 74 07 je SHORT $L14991
; 462 :
; 463 : Stat->HoldReasons |= SERIAL_TX_WAITING_FOR_CTS;
001de c7 46 04 01 00
00 00 mov DWORD PTR [esi+4], 1
$L14991:
; 464 :
; 465 : }
; 466 :
; 467 : if (Extension->TXHolding & SERIAL_TX_DSR) {
001e5 f6 87 1c 01 00
00 02 test BYTE PTR [edi+284], 2
001ec 74 04 je SHORT $L14994
; 468 :
; 469 : Stat->HoldReasons |= SERIAL_TX_WAITING_FOR_DSR;
001ee 83 4e 04 02 or DWORD PTR [esi+4], 2
$L14994:
; 470 :
; 471 : }
; 472 :
; 473 : if (Extension->TXHolding & SERIAL_TX_DCD) {
001f2 f6 87 1c 01 00
00 04 test BYTE PTR [edi+284], 4
001f9 74 04 je SHORT $L14997
; 474 :
; 475 : Stat->HoldReasons |= SERIAL_TX_WAITING_FOR_DCD;
001fb 83 4e 04 04 or DWORD PTR [esi+4], 4
$L14997:
; 476 :
; 477 : }
; 478 :
; 479 : if (Extension->TXHolding & SERIAL_TX_XOFF) {
001ff f6 87 1c 01 00
00 08 test BYTE PTR [edi+284], 8
00206 74 04 je SHORT $L15000
; 480 :
; 481 : Stat->HoldReasons |= SERIAL_TX_WAITING_FOR_XON;
00208 83 4e 04 08 or DWORD PTR [esi+4], 8
$L15000:
; 482 :
; 483 : }
; 484 :
; 485 : if (Extension->TXHolding & SERIAL_TX_BREAK) {
0020c f6 87 1c 01 00
00 10 test BYTE PTR [edi+284], 16 ; 00000010H
00213 74 04 je SHORT $L15003
; 486 :
; 487 : Stat->HoldReasons |= SERIAL_TX_WAITING_ON_BREAK;
00215 83 4e 04 20 or DWORD PTR [esi+4], 32 ; 00000020H
$L15003:
; 488 :
; 489 : }
; 490 :
; 491 : }
; 492 :
; 493 : if (Extension->RXHolding & SERIAL_RX_DSR) {
00219 8d 87 20 01 00
00 lea eax, DWORD PTR [edi+288]
0021f f6 00 08 test BYTE PTR [eax], 8
00222 74 04 je SHORT $L15006
; 494 :
; 495 : Stat->HoldReasons |= SERIAL_RX_WAITING_FOR_DSR;
00224 83 4e 04 40 or DWORD PTR [esi+4], 64 ; 00000040H
$L15006:
; 496 :
; 497 : }
; 498 :
; 499 : if (Extension->RXHolding & SERIAL_RX_XOFF) {
00228 f6 00 02 test BYTE PTR [eax], 2
0022b 74 04 je SHORT $L15009
; 500 :
; 501 : Stat->HoldReasons |= SERIAL_TX_WAITING_XOFF_SENT;
0022d 83 4e 04 10 or DWORD PTR [esi+4], 16 ; 00000010H
$L15009:
00231 5f pop edi
00232 5e pop esi
; 502 :
; 503 : }
; 504 :
; 505 : return FALSE;
00233 32 c0 xor al, al
00235 5b pop ebx
; 506 :
; 507 : }
00236 5d pop ebp
00237 c2 04 00 ret 4
_SerialGetCommStatus@4 ENDP
PAGESER ENDS
PUBLIC _SerialSetEscapeChar@4
; Function compile flags: /Ogs
; COMDAT _SerialSetEscapeChar@4
PAGESER SEGMENT
_Context$ = 8
_SerialSetEscapeChar@4 PROC NEAR ; COMDAT
; 535 : {
00000 55 push ebp
00001 8b ec mov ebp, esp
; 536 : PSERIAL_DEVICE_EXTENSION extension =
; 537 : IoGetCurrentIrpStackLocation((PIRP)Context)
; 538 : ->DeviceObject->DeviceExtension;
; 539 :
; 540 :
; 541 : extension->EscapeChar =
; 542 : *(PUCHAR)((PIRP)Context)->AssociatedIrp.SystemBuffer;
00003 8b 45 08 mov eax, DWORD PTR _Context$[ebp]
00006 8b 48 0c mov ecx, DWORD PTR [eax+12]
00009 8b 40 60 mov eax, DWORD PTR [eax+96]
0000c 8b 40 14 mov eax, DWORD PTR [eax+20]
0000f 8a 09 mov cl, BYTE PTR [ecx]
00011 8b 40 28 mov eax, DWORD PTR [eax+40]
00014 88 88 da 01 00
00 mov BYTE PTR [eax+474], cl
; 543 :
; 544 : return FALSE;
0001a 32 c0 xor al, al
; 545 :
; 546 : }
0001c 5d pop ebp
0001d c2 04 00 ret 4
_SerialSetEscapeChar@4 ENDP
PAGESER ENDS
PUBLIC _SerialGetProperties@8
PUBLIC _SerialIoControl@8
EXTRN __imp__KeSynchronizeExecution@12:NEAR
EXTRN _SerialDebugLevel:DWORD
EXTRN __imp_@KfAcquireSpinLock@4:NEAR
EXTRN __imp_@KfReleaseSpinLock@8:NEAR
EXTRN _SerialIRPPrologue@8:NEAR
EXTRN _SerialIRPEpilogue@4:NEAR
EXTRN _SerialGotoPowerState@12:NEAR
EXTRN __imp__IoAcquireCancelSpinLock@4:NEAR
EXTRN __imp__ExAllocatePoolWithQuotaTag@12:NEAR
EXTRN __except_handler3:NEAR
EXTRN __except_list:DWORD
EXTRN __imp_@IofCompleteRequest@8:NEAR
EXTRN _SerialStartRead@4:NEAR
EXTRN _SerialStartWrite@4:NEAR
EXTRN _SerialSetDTR@4:NEAR
EXTRN _SerialClrDTR@4:NEAR
EXTRN _SerialSetRTS@4:NEAR
EXTRN _SerialClrRTS@4:NEAR
EXTRN _SerialSetHandFlow@4:NEAR
EXTRN _SerialTurnOnBreak@4:NEAR
EXTRN _SerialTurnOffBreak@4:NEAR
EXTRN _SerialPretendXoff@4:NEAR
EXTRN _SerialPretendXon@4:NEAR
EXTRN _SerialStartMask@4:NEAR
EXTRN _SerialStartImmediate@4:NEAR
EXTRN _SerialStartPurge@4:NEAR
EXTRN __imp__IoReleaseCancelSpinLock@4:NEAR
EXTRN _SerialStartOrQueue@20:NEAR
EXTRN _SerialCompleteIfError@8:NEAR
EXTRN _SerialGetDivisorFromBaud@12:NEAR
; COMDAT CONST
CONST SEGMENT
$T15779 DD 0ffffffffH
DD FLAT:$L15765
DD FLAT:$L15766
CONST ENDS
; COMDAT _SerialIoControl@8
PAGESER SEGMENT
$SG15029 DB 'SERIAL: Pageable code called at IRQL %d without lock ', 0aH
DB 00H
ORG $+1
$SG15032 DB 'f:\w2ddk\src\kernel\serial\ioctl.c', 00H
ORG $+1
$SG15033 DB 'FALSE', 00H
ORG $+2
$SG15045 DB 'SERIAL: Dispatch entry for: %x', 0aH, 00H
$SG15304 DB 'SERIAL: In Ioctl processing for set mask', 0aH, 00H
ORG $+2
$SG15319 DB 'SERIAL: Invalid size fo the buffer %d', 0aH, 00H
ORG $+1
$SG15336 DB 'SERIAL: Unknown mask %x', 0aH, 00H
ORG $+3
$SG15527 DB 'SERIAL: Complete Irp: %x', 0aH, 00H
ORG $+2
$SG15351 DB 'SERIAL: Starting or queuing set mask irp %x', 0aH, 00H
ORG $+3
$SG15366 DB 'SERIAL: In Ioctl processing for wait mask', 0aH, 00H
ORG $+1
$SG15381 DB 'SERIAL: Invalid size for the buffer %d', 0aH, 00H
$SG15396 DB 'SERIAL: Starting or queuing wait mask irp %x', 0aH, 00H
; Function compile flags: /Ogs
_OldIrql$15404 = -120
_S$15431 = -132
_HandFlow$15432 = -124
_S$15459 = -140
_S$15476 = -148
_escapeChar$15495 = -152
$T15769 = -116
__$SEHRec$ = -24
_DeviceObject$ = 8
_Irp$ = 12
_Status$ = -36
_IrpSp$ = -32
_Extension$ = -28
_OldIrql$ = -46
_BaudRate$15061 = -40
_AppropriateDivisor$15062 = -42
_S$15075 = -56
_Br$15078 = -60
_S$15085 = -68
_S$15091 = -76
_S$15099 = -84
_Lc$15107 = -88
_LData$15109 = -90
_LStop$15110 = -92
_LParity$15111 = -91
_Mask$15112 = -89
_Lc$15170 = -96
_NewTimeouts$15216 = -100
_S$15230 = -112
_NewChars$15231 = -104
_SerialIoControl@8 PROC NEAR ; COMDAT
; 574 : {
001c2 55 push ebp
001c3 8b ec mov ebp, esp
001c5 6a ff push -1
001c7 68 00 00 00 00 push OFFSET FLAT:$T15779
001cc 68 00 00 00 00 push OFFSET FLAT:__except_handler3
001d1 64 a1 00 00 00
00 mov eax, DWORD PTR fs:__except_list
001d7 50 push eax
001d8 64 89 25 00 00
00 00 mov DWORD PTR fs:__except_list, esp
001df 81 ec 88 00 00
00 sub esp, 136 ; 00000088H
001e5 53 push ebx
001e6 56 push esi
001e7 57 push edi
001e8 89 65 e8 mov DWORD PTR __$SEHRec$[ebp], esp
; 575 : //
; 576 : // The status that gets returned to the caller and
; 577 : // set in the Irp.
; 578 : //
; 579 : NTSTATUS Status;
; 580 :
; 581 : //
; 582 : // The current stack location. This contains all of the
; 583 : // information we need to process this particular request.
; 584 : //
; 585 : PIO_STACK_LOCATION IrpSp;
; 586 :
; 587 : //
; 588 : // Just what it says. This is the serial specific device
; 589 : // extension of the device object create for the serial driver.
; 590 : //
; 591 : PSERIAL_DEVICE_EXTENSION Extension = DeviceObject->DeviceExtension;
001eb 8b 45 08 mov eax, DWORD PTR _DeviceObject$[ebp]
001ee 8b 58 28 mov ebx, DWORD PTR [eax+40]
001f1 89 5d e4 mov DWORD PTR _Extension$[ebp], ebx
; 592 :
; 593 : //
; 594 : // A temporary to hold the old IRQL so that it can be
; 595 : // restored once we complete/validate this request.
; 596 : //
; 597 : KIRQL OldIrql;
; 598 :
; 599 : NTSTATUS prologueStatus;
; 600 :
; 601 : SERIAL_LOCKED_PAGED_CODE();
001f4 8b 3d 00 00 00
00 mov edi, DWORD PTR __imp__KeGetCurrentIrql@0
001fa ff d7 call edi
001fc 3c 01 cmp al, 1
001fe 76 32 jbe SHORT $L15030
00200 83 3d 14 00 00
00 00 cmp DWORD PTR _SerialGlobals+20, 0
00207 75 29 jne SHORT $L15030
00209 ff d7 call edi
0020b 0f b6 c0 movzx eax, al
0020e 50 push eax
0020f 68 00 00 00 00 push OFFSET FLAT:$SG15029
00214 e8 00 00 00 00 call _DbgPrint
00219 59 pop ecx
0021a 59 pop ecx
0021b 6a 00 push 0
0021d 68 59 02 00 00 push 601 ; 00000259H
00222 68 00 00 00 00 push OFFSET FLAT:$SG15032
00227 68 00 00 00 00 push OFFSET FLAT:$SG15033
0022c ff 15 00 00 00
00 call DWORD PTR __imp__RtlAssert@16
$L15030:
; 602 :
; 603 : //
; 604 : // We expect to be open so all our pages are locked down. This is, after
; 605 : // all, an IO operation, so the device should be open first.
; 606 : //
; 607 :
; 608 : if (Extension->DeviceIsOpened != TRUE) {
00232 80 bb 9d 01 00
00 01 cmp BYTE PTR [ebx+413], 1
00239 74 15 je SHORT $L15034
; 609 : Irp->IoStatus.Status = STATUS_INVALID_DEVICE_REQUEST;
0023b be 10 00 00 c0 mov esi, -1073741808 ; c0000010H
00240 8b 4d 0c mov ecx, DWORD PTR _Irp$[ebp]
00243 89 71 18 mov DWORD PTR [ecx+24], esi
; 610 : IoCompleteRequest(Irp, IO_NO_INCREMENT);
00246 32 d2 xor dl, dl
00248 ff 15 00 00 00
00 call DWORD PTR __imp_@IofCompleteRequest@8
; 611 : return STATUS_INVALID_DEVICE_REQUEST;
0024e eb 23 jmp SHORT $L15797
$L15034:
; 612 : }
; 613 :
; 614 :
; 615 : if ((prologueStatus = SerialIRPPrologue(Irp, Extension))
; 616 : != STATUS_SUCCESS) {
00250 53 push ebx
00251 8b 7d 0c mov edi, DWORD PTR _Irp$[ebp]
00254 57 push edi
00255 e8 00 00 00 00 call _SerialIRPPrologue@8
0025a 8b f0 mov esi, eax
0025c 85 f6 test esi, esi
0025e 74 1a je SHORT $L15039
; 617 : Irp->IoStatus.Status = prologueStatus;
00260 89 77 18 mov DWORD PTR [edi+24], esi
; 618 : SerialCompleteRequest(Extension, Irp, IO_NO_INCREMENT);
00263 32 d2 xor dl, dl
00265 8b cf mov ecx, edi
00267 ff 15 00 00 00
00 call DWORD PTR __imp_@IofCompleteRequest@8
0026d 53 push ebx
0026e e8 00 00 00 00 call _SerialIRPEpilogue@4
$L15797:
; 619 : return prologueStatus;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -