📄 ioctl.cod
字号:
; 393 : return FALSE;
0001b 32 c0 xor al, al
; 394 : }
0001d c2 04 00 ret 4
_SerialSetFCRContents@4 ENDP
PAGESER ENDS
PUBLIC _SerialGetCommStatus@4
; Function compile flags: /Ogsy
; COMDAT _SerialGetCommStatus@4
PAGESER SEGMENT
_Context$ = 8
_SerialGetCommStatus@4 PROC NEAR ; COMDAT
; 421 :
; 422 : PSERIAL_DEVICE_EXTENSION Extension = ((PSERIAL_IOCTL_SYNC)Context)->Extension;
00000 8b 44 24 04 mov eax, DWORD PTR _Context$[esp-4]
00004 56 push esi
00005 8b 08 mov ecx, DWORD PTR [eax]
; 423 : PSERIAL_STATUS Stat = ((PSERIAL_IOCTL_SYNC)Context)->Data;
00007 8b 40 04 mov eax, DWORD PTR [eax+4]
; 424 :
; 425 : SERIAL_LOCKED_PAGED_CODE();
; 426 :
; 427 :
; 428 : Stat->Errors = Extension->ErrorWord;
0000a 8d 91 24 01 00
00 lea edx, DWORD PTR [ecx+292]
00010 8b 32 mov esi, DWORD PTR [edx]
00012 89 30 mov DWORD PTR [eax], esi
; 429 : Extension->ErrorWord = 0;
00014 83 22 00 and DWORD PTR [edx], 0
; 430 :
; 431 : //
; 432 : // BUG BUG We need to do something about eof (binary mode).
; 433 : //
; 434 : Stat->EofReceived = FALSE;
00017 80 60 10 00 and BYTE PTR [eax+16], 0
; 435 :
; 436 : Stat->AmountInInQueue = Extension->CharsInInterruptBuffer;
0001b 8b 91 f0 00 00
00 mov edx, DWORD PTR [ecx+240]
00021 89 50 08 mov DWORD PTR [eax+8], edx
; 437 :
; 438 : Stat->AmountInOutQueue = Extension->TotalCharsQueued;
00024 8b b1 28 01 00
00 mov esi, DWORD PTR [ecx+296]
0002a 89 70 0c mov DWORD PTR [eax+12], esi
; 439 :
; 440 : if (Extension->WriteLength) {
0002d 8b 91 e0 00 00
00 mov edx, DWORD PTR [ecx+224]
00033 85 d2 test edx, edx
00035 74 13 je SHORT $L14882
00037 57 push edi
; 441 :
; 442 : //
; 443 : // By definition if we have a writelength the we have
; 444 : // a current write irp.
; 445 : //
; 446 :
; 447 : ASSERT(Extension->CurrentWriteIrp);
; 448 : ASSERT(Stat->AmountInOutQueue >= Extension->WriteLength);
; 449 :
; 450 : Stat->AmountInOutQueue -=
; 451 : IoGetCurrentIrpStackLocation(Extension->CurrentWriteIrp)
; 452 : ->Parameters.Write.Length - (Extension->WriteLength);
00038 8b b9 c8 00 00
00 mov edi, DWORD PTR [ecx+200]
0003e 8b 7f 60 mov edi, DWORD PTR [edi+96]
00041 2b 57 04 sub edx, DWORD PTR [edi+4]
00044 5f pop edi
00045 03 d6 add edx, esi
00047 89 50 0c mov DWORD PTR [eax+12], edx
$L14882:
; 453 :
; 454 : }
; 455 :
; 456 : Stat->WaitForImmediate = Extension->TransmitImmediate;
0004a 8a 91 a1 01 00
00 mov dl, BYTE PTR [ecx+417]
; 457 :
; 458 : Stat->HoldReasons = 0;
00050 83 60 04 00 and DWORD PTR [eax+4], 0
00054 88 50 11 mov BYTE PTR [eax+17], dl
; 459 : if (Extension->TXHolding) {
00057 8b 91 1c 01 00
00 mov edx, DWORD PTR [ecx+284]
0005d 85 d2 test edx, edx
0005f 5e pop esi
00060 74 40 je SHORT $L14897
; 460 :
; 461 : if (Extension->TXHolding & SERIAL_TX_CTS) {
00062 f6 c2 01 test dl, 1
00065 74 07 je SHORT $L14885
; 462 :
; 463 : Stat->HoldReasons |= SERIAL_TX_WAITING_FOR_CTS;
00067 c7 40 04 01 00
00 00 mov DWORD PTR [eax+4], 1
$L14885:
; 464 :
; 465 : }
; 466 :
; 467 : if (Extension->TXHolding & SERIAL_TX_DSR) {
0006e f6 81 1c 01 00
00 02 test BYTE PTR [ecx+284], 2
00075 74 04 je SHORT $L14888
; 468 :
; 469 : Stat->HoldReasons |= SERIAL_TX_WAITING_FOR_DSR;
00077 83 48 04 02 or DWORD PTR [eax+4], 2
$L14888:
; 470 :
; 471 : }
; 472 :
; 473 : if (Extension->TXHolding & SERIAL_TX_DCD) {
0007b f6 81 1c 01 00
00 04 test BYTE PTR [ecx+284], 4
00082 74 04 je SHORT $L14891
; 474 :
; 475 : Stat->HoldReasons |= SERIAL_TX_WAITING_FOR_DCD;
00084 83 48 04 04 or DWORD PTR [eax+4], 4
$L14891:
; 476 :
; 477 : }
; 478 :
; 479 : if (Extension->TXHolding & SERIAL_TX_XOFF) {
00088 f6 81 1c 01 00
00 08 test BYTE PTR [ecx+284], 8
0008f 74 04 je SHORT $L14894
; 480 :
; 481 : Stat->HoldReasons |= SERIAL_TX_WAITING_FOR_XON;
00091 83 48 04 08 or DWORD PTR [eax+4], 8
$L14894:
; 482 :
; 483 : }
; 484 :
; 485 : if (Extension->TXHolding & SERIAL_TX_BREAK) {
00095 f6 81 1c 01 00
00 10 test BYTE PTR [ecx+284], 16 ; 00000010H
0009c 74 04 je SHORT $L14897
; 486 :
; 487 : Stat->HoldReasons |= SERIAL_TX_WAITING_ON_BREAK;
0009e 83 48 04 20 or DWORD PTR [eax+4], 32 ; 00000020H
$L14897:
; 488 :
; 489 : }
; 490 :
; 491 : }
; 492 :
; 493 : if (Extension->RXHolding & SERIAL_RX_DSR) {
000a2 81 c1 20 01 00
00 add ecx, 288 ; 00000120H
000a8 f6 01 08 test BYTE PTR [ecx], 8
000ab 74 04 je SHORT $L14900
; 494 :
; 495 : Stat->HoldReasons |= SERIAL_RX_WAITING_FOR_DSR;
000ad 83 48 04 40 or DWORD PTR [eax+4], 64 ; 00000040H
$L14900:
; 496 :
; 497 : }
; 498 :
; 499 : if (Extension->RXHolding & SERIAL_RX_XOFF) {
000b1 f6 01 02 test BYTE PTR [ecx], 2
000b4 74 04 je SHORT $L14903
; 500 :
; 501 : Stat->HoldReasons |= SERIAL_TX_WAITING_XOFF_SENT;
000b6 83 48 04 10 or DWORD PTR [eax+4], 16 ; 00000010H
$L14903:
; 502 :
; 503 : }
; 504 :
; 505 : return FALSE;
000ba 32 c0 xor al, al
; 506 :
; 507 : }
000bc c2 04 00 ret 4
_SerialGetCommStatus@4 ENDP
PAGESER ENDS
PUBLIC _SerialSetEscapeChar@4
; Function compile flags: /Ogsy
; COMDAT _SerialSetEscapeChar@4
PAGESER SEGMENT
_Context$ = 8
_SerialSetEscapeChar@4 PROC NEAR ; COMDAT
; 536 : PSERIAL_DEVICE_EXTENSION extension =
; 537 : IoGetCurrentIrpStackLocation((PIRP)Context)
; 538 : ->DeviceObject->DeviceExtension;
; 539 :
; 540 :
; 541 : extension->EscapeChar =
; 542 : *(PUCHAR)((PIRP)Context)->AssociatedIrp.SystemBuffer;
00000 8b 44 24 04 mov eax, DWORD PTR _Context$[esp-4]
00004 8b 48 0c mov ecx, DWORD PTR [eax+12]
00007 8b 40 60 mov eax, DWORD PTR [eax+96]
0000a 8b 40 14 mov eax, DWORD PTR [eax+20]
0000d 8a 09 mov cl, BYTE PTR [ecx]
0000f 8b 40 28 mov eax, DWORD PTR [eax+40]
00012 88 88 da 01 00
00 mov BYTE PTR [eax+474], cl
; 543 :
; 544 : return FALSE;
00018 32 c0 xor al, al
; 545 :
; 546 : }
0001a c2 04 00 ret 4
_SerialSetEscapeChar@4 ENDP
PAGESER ENDS
PUBLIC _SerialIoControl@8
PUBLIC _SerialGetProperties@8
EXTRN __imp__KeSynchronizeExecution@12:NEAR
EXTRN __imp_@KfAcquireSpinLock@4:NEAR
EXTRN __imp_@KfReleaseSpinLock@8:NEAR
EXTRN _SerialIRPPrologue@8:NEAR
EXTRN _SerialIRPEpilogue@4:NEAR
EXTRN __except_handler3:NEAR
EXTRN __except_list:DWORD
EXTRN _SerialGotoPowerState@12:NEAR
EXTRN __imp__IoAcquireCancelSpinLock@4:NEAR
EXTRN __imp__ExAllocatePoolWithQuotaTag@12:NEAR
EXTRN _SerialStartRead@4:NEAR
EXTRN __imp_@IofCompleteRequest@8: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
$T15539 DD 0ffffffffH
DD FLAT:$L15525
DD FLAT:$L15526
; Function compile flags: /Ogsy
CONST ENDS
; COMDAT _SerialIoControl@8
PAGESER SEGMENT
_S$15263 = -140
_S$15280 = -148
_escapeChar$15299 = -152
$T15529 = -116
__$SEHRec$ = -24
_DeviceObject$ = 8
_Irp$ = 12
_Status$ = -36
_IrpSp$ = -32
_Extension$ = -28
_OldIrql$ = -46
_BaudRate$14939 = -40
_AppropriateDivisor$14940 = -42
_S$14953 = -56
_Br$14956 = -60
_S$14963 = -68
_S$14969 = -76
_S$14977 = -84
_Lc$14985 = -88
_LData$14987 = -90
_LStop$14988 = -92
_LParity$14989 = -91
_Mask$14990 = -89
_Lc$15048 = -96
_NewTimeouts$15094 = -100
_S$15108 = -112
_NewChars$15109 = -104
_OldIrql$15208 = -120
_S$15235 = -132
_HandFlow$15236 = -124
_SerialIoControl@8 PROC NEAR ; COMDAT
; 574 : {
00000 55 push ebp
00001 8b ec mov ebp, esp
00003 6a ff push -1
00005 68 00 00 00 00 push OFFSET FLAT:$T15539
0000a 68 00 00 00 00 push OFFSET FLAT:__except_handler3
0000f 64 a1 00 00 00
00 mov eax, DWORD PTR fs:__except_list
00015 50 push eax
00016 64 89 25 00 00
00 00 mov DWORD PTR fs:__except_list, esp
0001d 81 ec 88 00 00
00 sub esp, 136 ; 00000088H
00023 53 push ebx
00024 56 push esi
00025 57 push edi
00026 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;
00029 8b 45 08 mov eax, DWORD PTR _DeviceObject$[ebp]
0002c 8b 58 28 mov ebx, DWORD PTR [eax+40]
0002f 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();
; 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) {
00032 80 bb 9d 01 00
00 01 cmp BYTE PTR [ebx+413], 1
00039 74 18 je SHORT $L14922
; 609 : Irp->IoStatus.Status = STATUS_INVALID_DEVICE_REQUEST;
0003b be 10 00 00 c0 mov esi, -1073741808 ; c0000010H
00040 8b 4d 0c mov ecx, DWORD PTR _Irp$[ebp]
00043 89 71 18 mov DWORD PTR [ecx+24], esi
; 610 : IoCompleteRequest(Irp, IO_NO_INCREMENT);
00046 32 d2 xor dl, dl
00048 ff 15 00 00 00
00 call DWORD PTR __imp_@IofCompleteRequest@8
; 611 : return STATUS_INVALID_DEVICE_REQUEST;
0004e e9 04 0b 00 00 jmp $L15547
$L14922:
; 612 : }
; 613 :
; 614 :
; 615 : if ((prologueStatus = SerialIRPPrologue(Irp, Extension))
; 616 : != STATUS_SUCCESS) {
00053 53 push ebx
00054 8b 7d 0c mov edi, DWORD PTR _Irp$[ebp]
00057 57 push edi
00058 e8 00 00 00 00 call _SerialIRPPrologue@8
0005d 8b f0 mov esi, eax
0005f 85 f6 test esi, esi
; 617 : Irp->IoStatus.Status = prologueStatus;
; 618 : SerialCompleteRequest(Extension, Irp, IO_NO_INCREMENT);
; 619 : return prologueStatus;
00061 0f 85 dd 0a 00
00 jne $L15548
; 620 : }
; 621 :
; 622 : SerialDump(
; 623 : SERIRPPATH,
; 624 : ("SERIAL: Dispatch entry for: %x\n",Irp)
; 625 : );
; 626 : if (SerialCompleteIfError(
; 627 : DeviceObject,
; 628 : Irp
; 629 : ) != STATUS_SUCCESS) {
00067 57 push edi
00068 ff 75 08 push DWORD PTR _DeviceObject$[ebp]
0006b e8 00 00 00 00 call _SerialCompleteIfError@8
00070 85 c0 test eax, eax
00072 74 0a je SHORT $L14931
; 630 :
; 631 : return STATUS_CANCELLED;
00074 b8 20 01 00 c0 mov eax, -1073741536 ; c0000120H
00079 e9 db 0a 00 00 jmp $L14916
$L14931:
; 632 :
; 633 : }
; 634 : IrpSp = IoGetCurrentIrpStackLocation(Irp);
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -