📄 ioctl.cod
字号:
; 1052 : break;
003b6 e9 ac 05 00 00 jmp $L15551
$L15047:
; 1053 : }
; 1054 : case IOCTL_SERIAL_GET_LINE_CONTROL: {
; 1055 :
; 1056 : PSERIAL_LINE_CONTROL Lc = (PSERIAL_LINE_CONTROL)Irp->AssociatedIrp.SystemBuffer;
003bb 8b 47 0c mov eax, DWORD PTR [edi+12]
003be 89 45 a0 mov DWORD PTR _Lc$15048[ebp], eax
; 1057 :
; 1058 : if (IrpSp->Parameters.DeviceIoControl.OutputBufferLength <
; 1059 : sizeof(SERIAL_LINE_CONTROL)) {
003c1 83 7e 04 03 cmp DWORD PTR [esi+4], 3
; 1060 :
; 1061 : Status = STATUS_BUFFER_TOO_SMALL;
; 1062 : break;
003c5 0f 82 e8 fc ff
ff jb $L15554
; 1063 :
; 1064 : }
; 1065 :
; 1066 : KeAcquireSpinLock(
; 1067 : &Extension->ControlLock,
; 1068 : &OldIrql
; 1069 : );
003cb 8d 8b e4 01 00
00 lea ecx, DWORD PTR [ebx+484]
003d1 ff 15 00 00 00
00 call DWORD PTR __imp_@KfAcquireSpinLock@4
003d7 88 45 d2 mov BYTE PTR _OldIrql$[ebp], al
; 1070 :
; 1071 : if ((Extension->LineControl & SERIAL_DATA_MASK) == SERIAL_5_DATA) {
003da 8a 83 9c 01 00
00 mov al, BYTE PTR [ebx+412]
003e0 24 03 and al, 3
003e2 75 09 jne SHORT $L15055
; 1072 : Lc->WordLength = 5;
003e4 8b 45 a0 mov eax, DWORD PTR _Lc$15048[ebp]
003e7 c6 40 02 05 mov BYTE PTR [eax+2], 5
; 1073 : } else if ((Extension->LineControl & SERIAL_DATA_MASK)
003eb eb 25 jmp SHORT $L15067
$L15055:
; 1074 : == SERIAL_6_DATA) {
003ed 3c 01 cmp al, 1
003ef 75 09 jne SHORT $L15059
; 1075 : Lc->WordLength = 6;
003f1 8b 45 a0 mov eax, DWORD PTR _Lc$15048[ebp]
003f4 c6 40 02 06 mov BYTE PTR [eax+2], 6
; 1076 : } else if ((Extension->LineControl & SERIAL_DATA_MASK)
003f8 eb 18 jmp SHORT $L15067
$L15059:
; 1077 : == SERIAL_7_DATA) {
003fa 3c 02 cmp al, 2
003fc 75 09 jne SHORT $L15063
; 1078 : Lc->WordLength = 7;
003fe 8b 45 a0 mov eax, DWORD PTR _Lc$15048[ebp]
00401 c6 40 02 07 mov BYTE PTR [eax+2], 7
; 1079 : } else if ((Extension->LineControl & SERIAL_DATA_MASK)
00405 eb 0b jmp SHORT $L15067
$L15063:
; 1080 : == SERIAL_8_DATA) {
00407 3c 03 cmp al, 3
; 1081 : Lc->WordLength = 8;
00409 8b 45 a0 mov eax, DWORD PTR _Lc$15048[ebp]
; 1080 : == SERIAL_8_DATA) {
0040c 75 04 jne SHORT $L15067
; 1081 : Lc->WordLength = 8;
0040e c6 40 02 08 mov BYTE PTR [eax+2], 8
$L15067:
; 1082 : }
; 1083 :
; 1084 : if ((Extension->LineControl & SERIAL_PARITY_MASK)
; 1085 : == SERIAL_NONE_PARITY) {
00412 8a 8b 9c 01 00
00 mov cl, BYTE PTR [ebx+412]
00418 80 e1 38 and cl, 56 ; 00000038H
0041b 75 06 jne SHORT $L15070
; 1086 : Lc->Parity = NO_PARITY;
0041d 80 60 01 00 and BYTE PTR [eax+1], 0
; 1087 : } else if ((Extension->LineControl & SERIAL_PARITY_MASK)
00421 eb 2a jmp SHORT $L15086
$L15070:
; 1088 : == SERIAL_ODD_PARITY) {
00423 80 f9 08 cmp cl, 8
00426 75 06 jne SHORT $L15074
; 1089 : Lc->Parity = ODD_PARITY;
00428 c6 40 01 01 mov BYTE PTR [eax+1], 1
; 1090 : } else if ((Extension->LineControl & SERIAL_PARITY_MASK)
0042c eb 1f jmp SHORT $L15086
$L15074:
; 1091 : == SERIAL_EVEN_PARITY) {
0042e 80 f9 18 cmp cl, 24 ; 00000018H
00431 75 06 jne SHORT $L15078
; 1092 : Lc->Parity = EVEN_PARITY;
00433 c6 40 01 02 mov BYTE PTR [eax+1], 2
; 1093 : } else if ((Extension->LineControl & SERIAL_PARITY_MASK)
00437 eb 14 jmp SHORT $L15086
$L15078:
; 1094 : == SERIAL_MARK_PARITY) {
00439 80 f9 28 cmp cl, 40 ; 00000028H
0043c 75 06 jne SHORT $L15082
; 1095 : Lc->Parity = MARK_PARITY;
0043e c6 40 01 03 mov BYTE PTR [eax+1], 3
; 1096 : } else if ((Extension->LineControl & SERIAL_PARITY_MASK)
00442 eb 09 jmp SHORT $L15086
$L15082:
; 1097 : == SERIAL_SPACE_PARITY) {
00444 80 f9 38 cmp cl, 56 ; 00000038H
00447 75 04 jne SHORT $L15086
; 1098 : Lc->Parity = SPACE_PARITY;
00449 c6 40 01 04 mov BYTE PTR [eax+1], 4
$L15086:
; 1099 : }
; 1100 :
; 1101 : if (Extension->LineControl & SERIAL_2_STOP) {
0044d f6 83 9c 01 00
00 04 test BYTE PTR [ebx+412], 4
00454 74 0d je SHORT $L15088
; 1102 : if (Lc->WordLength == 5) {
00456 80 78 02 05 cmp BYTE PTR [eax+2], 5
0045a 0f 95 c1 setne cl
0045d fe c1 inc cl
0045f 88 08 mov BYTE PTR [eax], cl
; 1103 : Lc->StopBits = STOP_BITS_1_5;
; 1104 : } else {
; 1105 : Lc->StopBits = STOP_BITS_2;
; 1106 : }
; 1107 : } else {
00461 eb 03 jmp SHORT $L15091
$L15088:
; 1108 : Lc->StopBits = STOP_BIT_1;
00463 80 20 00 and BYTE PTR [eax], 0
$L15091:
; 1109 : }
; 1110 :
; 1111 : Irp->IoStatus.Information = sizeof(SERIAL_LINE_CONTROL);
00466 c7 47 1c 03 00
00 00 mov DWORD PTR [edi+28], 3
; 1112 :
; 1113 : KeReleaseSpinLock(
; 1114 : &Extension->ControlLock,
; 1115 : OldIrql
; 1116 : );
; 1117 :
; 1118 : break;
0046d e9 01 05 00 00 jmp $L14952
$L15093:
; 1119 : }
; 1120 : case IOCTL_SERIAL_SET_TIMEOUTS: {
; 1121 :
; 1122 : PSERIAL_TIMEOUTS NewTimeouts =
; 1123 : ((PSERIAL_TIMEOUTS)(Irp->AssociatedIrp.SystemBuffer));
00472 8b 47 0c mov eax, DWORD PTR [edi+12]
00475 89 45 9c mov DWORD PTR _NewTimeouts$15094[ebp], eax
; 1124 :
; 1125 :
; 1126 : if (IrpSp->Parameters.DeviceIoControl.InputBufferLength <
; 1127 : sizeof(SERIAL_TIMEOUTS)) {
00478 83 7e 08 14 cmp DWORD PTR [esi+8], 20 ; 00000014H
; 1128 :
; 1129 : Status = STATUS_BUFFER_TOO_SMALL;
; 1130 : break;
0047c 0f 82 31 fc ff
ff jb $L15554
; 1131 :
; 1132 : }
; 1133 :
; 1134 : if ((NewTimeouts->ReadIntervalTimeout == MAXULONG) &&
; 1135 : (NewTimeouts->ReadTotalTimeoutMultiplier == MAXULONG) &&
; 1136 : (NewTimeouts->ReadTotalTimeoutConstant == MAXULONG)) {
00482 83 38 ff cmp DWORD PTR [eax], -1
00485 75 10 jne SHORT $L15099
00487 83 78 04 ff cmp DWORD PTR [eax+4], -1
0048b 75 0a jne SHORT $L15099
0048d 83 78 08 ff cmp DWORD PTR [eax+8], -1
; 1137 :
; 1138 : Status = STATUS_INVALID_PARAMETER;
; 1139 : break;
00491 0f 84 a3 06 00
00 je $L15323
$L15099:
; 1140 :
; 1141 : }
; 1142 :
; 1143 : KeAcquireSpinLock(
; 1144 : &Extension->ControlLock,
; 1145 : &OldIrql
; 1146 : );
00497 8d 8b e4 01 00
00 lea ecx, DWORD PTR [ebx+484]
0049d ff 15 00 00 00
00 call DWORD PTR __imp_@KfAcquireSpinLock@4
004a3 88 45 d2 mov BYTE PTR _OldIrql$[ebp], al
; 1147 :
; 1148 : Extension->Timeouts.ReadIntervalTimeout =
; 1149 : NewTimeouts->ReadIntervalTimeout;
004a6 8b 45 9c mov eax, DWORD PTR _NewTimeouts$15094[ebp]
004a9 8b 08 mov ecx, DWORD PTR [eax]
004ab 89 8b 58 01 00
00 mov DWORD PTR [ebx+344], ecx
; 1150 :
; 1151 : Extension->Timeouts.ReadTotalTimeoutMultiplier =
; 1152 : NewTimeouts->ReadTotalTimeoutMultiplier;
004b1 8b 48 04 mov ecx, DWORD PTR [eax+4]
004b4 89 8b 5c 01 00
00 mov DWORD PTR [ebx+348], ecx
; 1153 :
; 1154 : Extension->Timeouts.ReadTotalTimeoutConstant =
; 1155 : NewTimeouts->ReadTotalTimeoutConstant;
004ba 8b 48 08 mov ecx, DWORD PTR [eax+8]
004bd 89 8b 60 01 00
00 mov DWORD PTR [ebx+352], ecx
; 1156 :
; 1157 : Extension->Timeouts.WriteTotalTimeoutMultiplier =
; 1158 : NewTimeouts->WriteTotalTimeoutMultiplier;
004c3 8b 48 0c mov ecx, DWORD PTR [eax+12]
004c6 89 8b 64 01 00
00 mov DWORD PTR [ebx+356], ecx
; 1159 :
; 1160 : Extension->Timeouts.WriteTotalTimeoutConstant =
; 1161 : NewTimeouts->WriteTotalTimeoutConstant;
004cc 8b 40 10 mov eax, DWORD PTR [eax+16]
004cf 89 83 68 01 00
00 mov DWORD PTR [ebx+360], eax
; 1162 :
; 1163 : KeReleaseSpinLock(
; 1164 : &Extension->ControlLock,
; 1165 : OldIrql
; 1166 : );
; 1167 :
; 1168 : break;
004d5 e9 99 04 00 00 jmp $L14952
$L15101:
; 1169 : }
; 1170 : case IOCTL_SERIAL_GET_TIMEOUTS: {
; 1171 :
; 1172 : if (IrpSp->Parameters.DeviceIoControl.OutputBufferLength <
; 1173 : sizeof(SERIAL_TIMEOUTS)) {
004da 83 7e 04 14 cmp DWORD PTR [esi+4], 20 ; 00000014H
; 1174 :
; 1175 : Status = STATUS_BUFFER_TOO_SMALL;
; 1176 : break;
004de 0f 82 cf fb ff
ff jb $L15554
; 1177 :
; 1178 : }
; 1179 :
; 1180 : KeAcquireSpinLock(
; 1181 : &Extension->ControlLock,
; 1182 : &OldIrql
; 1183 : );
004e4 8d 8b e4 01 00
00 lea ecx, DWORD PTR [ebx+484]
004ea ff 15 00 00 00
00 call DWORD PTR __imp_@KfAcquireSpinLock@4
004f0 88 45 d2 mov BYTE PTR _OldIrql$[ebp], al
; 1184 :
; 1185 : *((PSERIAL_TIMEOUTS)Irp->AssociatedIrp.SystemBuffer) = Extension->Timeouts;
004f3 8d b3 58 01 00
00 lea esi, DWORD PTR [ebx+344]
004f9 6a 05 push 5
004fb 59 pop ecx
004fc 8b 45 0c mov eax, DWORD PTR _Irp$[ebp]
004ff 8b 78 0c mov edi, DWORD PTR [eax+12]
00502 f3 a5 rep movsd
; 1186 : Irp->IoStatus.Information = sizeof(SERIAL_TIMEOUTS);
00504 c7 40 1c 14 00
00 00 mov DWORD PTR [eax+28], 20 ; 00000014H
$L15555:
; 1187 :
; 1188 : KeReleaseSpinLock(
; 1189 : &Extension->ControlLock,
; 1190 : OldIrql
; 1191 : );
0050b 8a 55 d2 mov dl, BYTE PTR _OldIrql$[ebp]
0050e 8d 8b e4 01 00
00 lea ecx, DWORD PTR [ebx+484]
00514 ff 15 00 00 00
00 call DWORD PTR __imp_@KfReleaseSpinLock@8
; 1192 :
; 1193 : break;
0051a 8b 7d 0c mov edi, DWORD PTR _Irp$[ebp]
0051d e9 1f 06 00 00 jmp $DoneWithIoctl$15011
$L15107:
; 1194 : }
; 1195 : case IOCTL_SERIAL_SET_CHARS: {
; 1196 :
; 1197 : SERIAL_IOCTL_SYNC S;
; 1198 : PSERIAL_CHARS NewChars =
; 1199 : ((PSERIAL_CHARS)(Irp->AssociatedIrp.SystemBuffer));
00522 8b 47 0c mov eax, DWORD PTR [edi+12]
00525 89 45 98 mov DWORD PTR _NewChars$15109[ebp], eax
; 1200 :
; 1201 :
; 1202 : if (IrpSp->Parameters.DeviceIoControl.InputBufferLength <
; 1203 : sizeof(SERIAL_CHARS)) {
00528 83 7e 08 06 cmp DWORD PTR [esi+8], 6
; 1204 :
; 1205 : Status = STATUS_BUFFER_TOO_SMALL;
; 1206 : break;
0052c 0f 82 81 fb ff
ff jb $L15554
; 1207 :
; 1208 : }
; 1209 :
; 1210 : //
; 1211 : // The only thing that can be wrong with the chars
; 1212 : // is that the xon and xoff characters are the
; 1213 : // same.
; 1214 : //
; 1215 : #if 0
; 1216 : if (NewChars->XonChar == NewChars->XoffChar) {
; 1217 :
; 1218 : Status = STATUS_INVALID_PARAMETER;
; 1219 : break;
; 1220 :
; 1221 : }
; 1222 : #endif
; 1223 :
; 1224 : //
; 1225 : // We acquire the control lock so that only
; 1226 : // one request can GET or SET the characters
; 1227 : // at a time. The sets could be synchronized
; 1228 : // by the interrupt spinlock, but that wouldn't
; 1229 : // prevent multiple gets at the same time.
; 1230 : //
; 1231 :
; 1232 : S.Extension = Extension;
00532 89 5d 90 mov DWORD PTR _S$15108[ebp], ebx
; 1233 : S.Data = NewChars;
00535 89 45 94 mov DWORD PTR _S$15108[ebp+4], eax
; 1234 :
; 1235 : KeAcquireSpinLock(
; 1236 : &Extension->ControlLock,
; 1237 : &OldIrql
; 1238 : );
00538 8d 8b e4 01 00
00 lea ecx, DWORD PTR [ebx+484]
0053e ff 15 00 00 00
00 call DWORD
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -