📄 ioctl.cod
字号:
; 854 : Status = SerialGotoPowerState(Extension->Pdo, Extension,
; 855 : PowerDeviceD0);
00228 6a 01 push 1
0022a 53 push ebx
0022b ff b3 80 05 00
00 push DWORD PTR [ebx+1408]
00231 e8 00 00 00 00 call _SerialGotoPowerState@12
00236 89 45 dc mov DWORD PTR _Status$[ebp], eax
; 856 : if (!NT_SUCCESS(Status)) {
00239 85 c0 test eax, eax
0023b 0f 8c 00 09 00
00 jl $DoneWithIoctl$15011
$L14983:
; 857 : break;
; 858 : }
; 859 : }
; 860 :
; 861 : KeAcquireSpinLock(
; 862 : &Extension->ControlLock,
; 863 : &OldIrql
; 864 : );
00241 8d 8b e4 01 00
00 lea ecx, DWORD PTR [ebx+484]
00247 ff 15 00 00 00
00 call DWORD PTR __imp_@KfAcquireSpinLock@4
0024d 88 45 d2 mov BYTE PTR _OldIrql$[ebp], al
; 865 :
; 866 : KeSynchronizeExecution(
; 867 : Extension->Interrupt,
; 868 : SerialSetFCRContents,
; 869 : &S
; 870 : );
00250 8d 45 ac lea eax, DWORD PTR _S$14977[ebp]
00253 50 push eax
00254 68 00 00 00 00 push OFFSET FLAT:_SerialSetFCRContents@4
; 871 :
; 872 : KeReleaseSpinLock(
; 873 : &Extension->ControlLock,
; 874 : OldIrql
; 875 : );
; 876 :
; 877 : break;
00259 e9 09 07 00 00 jmp $L15551
$L14984:
; 878 : }
; 879 : case IOCTL_SERIAL_SET_LINE_CONTROL: {
; 880 :
; 881 : //
; 882 : // Points to the line control record in the Irp.
; 883 : //
; 884 : PSERIAL_LINE_CONTROL Lc =
; 885 : ((PSERIAL_LINE_CONTROL)(Irp->AssociatedIrp.SystemBuffer));
0025e 8b 4f 0c mov ecx, DWORD PTR [edi+12]
00261 89 4d a8 mov DWORD PTR _Lc$14985[ebp], ecx
; 886 :
; 887 : UCHAR LData;
; 888 : UCHAR LStop;
; 889 : UCHAR LParity;
; 890 : UCHAR Mask = 0xff;
00264 80 4d a7 ff or BYTE PTR _Mask$14990[ebp], 255 ; 000000ffH
; 891 :
; 892 : if (IrpSp->Parameters.DeviceIoControl.InputBufferLength <
; 893 : sizeof(SERIAL_LINE_CONTROL)) {
00268 83 7e 08 03 cmp DWORD PTR [esi+8], 3
; 894 :
; 895 : Status = STATUS_BUFFER_TOO_SMALL;
; 896 : break;
0026c 0f 82 41 fe ff
ff jb $L15554
; 897 :
; 898 : }
; 899 :
; 900 : //
; 901 : // Make sure we are at power D0
; 902 : //
; 903 :
; 904 : if (Extension->PowerState != PowerDeviceD0) {
00272 33 d2 xor edx, edx
00274 42 inc edx
00275 39 93 a4 04 00
00 cmp DWORD PTR [ebx+1188], edx
0027b 74 1e je SHORT $L14996
; 905 : Status = SerialGotoPowerState(Extension->Pdo, Extension,
; 906 : PowerDeviceD0);
0027d 52 push edx
0027e 53 push ebx
0027f ff b3 80 05 00
00 push DWORD PTR [ebx+1408]
00285 e8 00 00 00 00 call _SerialGotoPowerState@12
0028a 89 45 dc mov DWORD PTR _Status$[ebp], eax
; 907 : if (!NT_SUCCESS(Status)) {
0028d 85 c0 test eax, eax
0028f 0f 8c ac 08 00
00 jl $DoneWithIoctl$15011
00295 33 d2 xor edx, edx
00297 42 inc edx
00298 8b 4d a8 mov ecx, DWORD PTR _Lc$14985[ebp]
$L14996:
; 908 : break;
; 909 : }
; 910 : }
; 911 :
; 912 : switch (Lc->WordLength) {
0029b 0f b6 71 02 movzx esi, BYTE PTR [ecx+2]
0029f 8b c6 mov eax, esi
002a1 83 e8 05 sub eax, 5
002a4 74 27 je SHORT $L15001
002a6 48 dec eax
002a7 74 1a je SHORT $L15003
002a9 48 dec eax
002aa 74 0d je SHORT $L15005
002ac 48 dec eax
; 938 :
; 939 : }
; 940 : default: {
; 941 :
; 942 : Status = STATUS_INVALID_PARAMETER;
; 943 : goto DoneWithIoctl;
002ad 0f 85 87 08 00
00 jne $L15323
; 932 :
; 933 : }
; 934 : case 8: {
; 935 :
; 936 : LData = SERIAL_8_DATA;
002b3 c6 45 a6 03 mov BYTE PTR _LData$14987[ebp], 3
; 937 : break;
002b7 eb 1c jmp SHORT $L14998
$L15005:
; 925 :
; 926 : }
; 927 : case 7: {
; 928 :
; 929 : LData = SERIAL_7_DATA;
002b9 c6 45 a6 02 mov BYTE PTR _LData$14987[ebp], 2
; 930 : Mask = 0x7f;
002bd c6 45 a7 7f mov BYTE PTR _Mask$14990[ebp], 127 ; 0000007fH
; 931 : break;
002c1 eb 12 jmp SHORT $L14998
$L15003:
; 917 : break;
; 918 :
; 919 : }
; 920 : case 6: {
; 921 :
; 922 : LData = SERIAL_6_DATA;
002c3 c6 45 a6 01 mov BYTE PTR _LData$14987[ebp], 1
; 923 : Mask = 0x3f;
002c7 c6 45 a7 3f mov BYTE PTR _Mask$14990[ebp], 63 ; 0000003fH
; 924 : break;
002cb eb 08 jmp SHORT $L14998
$L15001:
; 913 : case 5: {
; 914 :
; 915 : LData = SERIAL_5_DATA;
002cd 80 65 a6 00 and BYTE PTR _LData$14987[ebp], 0
; 916 : Mask = 0x1f;
002d1 c6 45 a7 1f mov BYTE PTR _Mask$14990[ebp], 31 ; 0000001fH
$L14998:
; 944 :
; 945 : }
; 946 :
; 947 : }
; 948 :
; 949 : Extension->WmiCommData.BitsPerByte = Lc->WordLength;
002d5 89 b3 b8 05 00
00 mov DWORD PTR [ebx+1464], esi
; 950 :
; 951 : switch (Lc->Parity) {
002db 0f b6 41 01 movzx eax, BYTE PTR [ecx+1]
002df 33 f6 xor esi, esi
002e1 2b c6 sub eax, esi
002e3 74 4c je SHORT $L15016
002e5 48 dec eax
002e6 74 3d je SHORT $L15020
002e8 48 dec eax
002e9 74 2a je SHORT $L15018
002eb 48 dec eax
002ec 74 17 je SHORT $L15024
002ee 48 dec eax
; 981 :
; 982 : }
; 983 : default: {
; 984 :
; 985 : Status = STATUS_INVALID_PARAMETER;
; 986 : goto DoneWithIoctl;
002ef 0f 85 45 08 00
00 jne $L15323
; 969 :
; 970 : }
; 971 : case SPACE_PARITY: {
; 972 : Extension->WmiCommData.Parity = SERIAL_WMI_PARITY_SPACE;
002f5 c7 83 bc 05 00
00 03 00 00 00 mov DWORD PTR [ebx+1468], 3
; 973 : LParity = SERIAL_SPACE_PARITY;
002ff c6 45 a5 38 mov BYTE PTR _LParity$14989[ebp], 56 ; 00000038H
; 974 : break;
00303 eb 36 jmp SHORT $L15013
$L15024:
; 975 :
; 976 : }
; 977 : case MARK_PARITY: {
; 978 : Extension->WmiCommData.Parity = SERIAL_WMI_PARITY_MARK;
00305 c7 83 bc 05 00
00 04 00 00 00 mov DWORD PTR [ebx+1468], 4
; 979 : LParity = SERIAL_MARK_PARITY;
0030f c6 45 a5 28 mov BYTE PTR _LParity$14989[ebp], 40 ; 00000028H
; 980 : break;
00313 eb 26 jmp SHORT $L15013
$L15018:
; 956 : break;
; 957 :
; 958 : }
; 959 : case EVEN_PARITY: {
; 960 : Extension->WmiCommData.Parity = SERIAL_WMI_PARITY_EVEN;
00315 c7 83 bc 05 00
00 02 00 00 00 mov DWORD PTR [ebx+1468], 2
; 961 : LParity = SERIAL_EVEN_PARITY;
0031f c6 45 a5 18 mov BYTE PTR _LParity$14989[ebp], 24 ; 00000018H
; 962 : break;
00323 eb 16 jmp SHORT $L15013
$L15020:
; 963 :
; 964 : }
; 965 : case ODD_PARITY: {
; 966 : Extension->WmiCommData.Parity = SERIAL_WMI_PARITY_ODD;
00325 89 93 bc 05 00
00 mov DWORD PTR [ebx+1468], edx
; 967 : LParity = SERIAL_ODD_PARITY;
0032b c6 45 a5 08 mov BYTE PTR _LParity$14989[ebp], 8
; 968 : break;
0032f eb 0a jmp SHORT $L15013
$L15016:
; 952 :
; 953 : case NO_PARITY: {
; 954 : Extension->WmiCommData.Parity = SERIAL_WMI_PARITY_NONE;
00331 89 b3 bc 05 00
00 mov DWORD PTR [ebx+1468], esi
; 955 : LParity = SERIAL_NONE_PARITY;
00337 80 65 a5 00 and BYTE PTR _LParity$14989[ebp], 0
$L15013:
; 987 : break;
; 988 : }
; 989 :
; 990 : }
; 991 :
; 992 : switch (Lc->StopBits) {
0033b 0f b6 01 movzx eax, BYTE PTR [ecx]
0033e 2b c6 sub eax, esi
00340 74 36 je SHORT $L15032
00342 48 dec eax
00343 74 21 je SHORT $L15034
00345 48 dec eax
; 1021 :
; 1022 : }
; 1023 : default: {
; 1024 :
; 1025 : Status = STATUS_INVALID_PARAMETER;
; 1026 : goto DoneWithIoctl;
00346 0f 85 ee 07 00
00 jne $L15323
; 1009 :
; 1010 : }
; 1011 : case STOP_BITS_2: {
; 1012 :
; 1013 : if (LData == SERIAL_5_DATA) {
0034c 80 7d a6 00 cmp BYTE PTR _LData$14987[ebp], 0
; 1014 :
; 1015 : Status = STATUS_INVALID_PARAMETER;
; 1016 : goto DoneWithIoctl;
00350 0f 84 e4 07 00
00 je $L15323
; 1017 : }
; 1018 : Extension->WmiCommData.StopBits = SERIAL_WMI_STOP_2;
00356 c7 83 c4 05 00
00 02 00 00 00 mov DWORD PTR [ebx+1476], 2
$L15549:
; 1019 : LStop = SERIAL_2_STOP;
00360 c6 45 a4 04 mov BYTE PTR _LStop$14988[ebp], 4
; 1020 : break;
00364 eb 1c jmp SHORT $L15029
$L15034:
; 997 : break;
; 998 : }
; 999 : case STOP_BITS_1_5: {
; 1000 :
; 1001 : if (LData != SERIAL_5_DATA) {
00366 80 7d a6 00 cmp BYTE PTR _LData$14987[ebp], 0
; 1002 :
; 1003 : Status = STATUS_INVALID_PARAMETER;
; 1004 : goto DoneWithIoctl;
0036a 0f 85 ca 07 00
00 jne $L15323
; 1005 : }
; 1006 : Extension->WmiCommData.StopBits = SERIAL_WMI_STOP_1_5;
00370 89 93 c4 05 00
00 mov DWORD PTR [ebx+1476], edx
; 1007 : LStop = SERIAL_1_5_STOP;
; 1008 : break;
00376 eb e8 jmp SHORT $L15549
$L15032:
; 993 :
; 994 : case STOP_BIT_1: {
; 995 : Extension->WmiCommData.StopBits = SERIAL_WMI_STOP_1;
00378 89 b3 c4 05 00
00 mov DWORD PTR [ebx+1476], esi
; 996 : LStop = SERIAL_1_STOP;
0037e 80 65 a4 00 and BYTE PTR _LStop$14988[ebp], 0
$L15029:
; 1027 : }
; 1028 :
; 1029 : }
; 1030 :
; 1031 : KeAcquireSpinLock(
; 1032 : &Extension->ControlLock,
; 1033 : &OldIrql
; 1034 : );
00382 8d 8b e4 01 00
00 lea ecx, DWORD PTR [ebx+484]
00388 ff 15 00 00 00
00 call DWORD PTR __imp_@KfAcquireSpinLock@4
0038e 88 45 d2 mov BYTE PTR _OldIrql$[ebp], al
; 1035 :
; 1036 : Extension->LineControl =
; 1037 : (UCHAR)((Extension->LineControl & SERIAL_LCR_BREAK) |
; 1038 : (LData | LParity | LStop));
00391 8d 83 9c 01 00
00 lea eax, DWORD PTR [ebx+412]
00397 8a 08 mov cl, BYTE PTR [eax]
00399 80 e1 40 and cl, 64 ; 00000040H
0039c 0a 4d a4 or cl, BYTE PTR _LStop$14988[ebp]
0039f 0a 4d a5 or cl, BYTE PTR _LParity$14989[ebp]
003a2 0a 4d a6 or cl, BYTE PTR _LData$14987[ebp]
003a5 88 08 mov BYTE PTR [eax], cl
; 1039 : Extension->ValidDataMask = Mask;
003a7 8a 45 a7 mov al, BYTE PTR _Mask$14990[ebp]
003aa 88 83 d9 01 00
00 mov BYTE PTR [ebx+473], al
; 1040 :
; 1041 : KeSynchronizeExecution(
; 1042 : Extension->Interrupt,
; 1043 : SerialSetLineControl,
; 1044 : Extension
; 1045 : );
003b0 53 push ebx
003b1 68 00 00 00 00 push OFFSET FLAT:_SerialSetLineControl@4
; 1046 :
; 1047 : KeReleaseSpinLock(
; 1048 : &Extension->ControlLock,
; 1049 : OldIrql
; 1050 : );
; 1051 :
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -