📄 write.cod
字号:
; 1087 :
; 1088 : PSERIAL_DEVICE_EXTENSION Extension = Context;
; 1089 : SERIAL_LOCKED_PAGED_CODE();
; 1090 :
; 1091 : //
; 1092 : // Check if the write length is non-zero. If it is non-zero
; 1093 : // then the ISR still owns the irp. We calculate the the number
; 1094 : // of characters written and update the information field of the
; 1095 : // irp with the characters written. We then clear the write length
; 1096 : // the isr sees.
; 1097 : //
; 1098 :
; 1099 : if (Extension->WriteLength) {
00001 8b 74 24 08 mov esi, DWORD PTR _Context$[esp]
00005 57 push edi
00006 8b be e0 00 00
00 mov edi, DWORD PTR [esi+224]
0000c 85 ff test edi, edi
0000e 74 30 je SHORT $L15044
; 1100 :
; 1101 : //
; 1102 : // We could have an xoff counter masquerading as a
; 1103 : // write irp. If so, don't update the write length.
; 1104 : //
; 1105 :
; 1106 : if (IoGetCurrentIrpStackLocation(Extension->CurrentWriteIrp)
; 1107 : ->MajorFunction == IRP_MJ_WRITE) {
00010 8d 96 c8 00 00
00 lea edx, DWORD PTR [esi+200]
00016 8b 02 mov eax, DWORD PTR [edx]
00018 8b 48 60 mov ecx, DWORD PTR [eax+96]
0001b 80 39 04 cmp BYTE PTR [ecx], 4
0001e 75 0a jne SHORT $L15045
; 1108 :
; 1109 : Extension->CurrentWriteIrp->IoStatus.Information =
; 1110 : IoGetCurrentIrpStackLocation(
; 1111 : Extension->CurrentWriteIrp
; 1112 : )->Parameters.Write.Length -
; 1113 : Extension->WriteLength;
00020 8b 49 04 mov ecx, DWORD PTR [ecx+4]
00023 2b cf sub ecx, edi
00025 89 48 1c mov DWORD PTR [eax+28], ecx
; 1114 :
; 1115 : } else {
00028 eb 04 jmp SHORT $L15047
$L15045:
; 1116 :
; 1117 : Extension->CurrentWriteIrp->IoStatus.Information = 0;
0002a 83 60 1c 00 and DWORD PTR [eax+28], 0
$L15047:
; 1118 :
; 1119 : }
; 1120 :
; 1121 : //
; 1122 : // Since the isr no longer references this irp, we can
; 1123 : // decrement it's reference count.
; 1124 : //
; 1125 :
; 1126 : SERIAL_CLEAR_REFERENCE(
; 1127 : Extension->CurrentWriteIrp,
; 1128 : SERIAL_REF_ISR
; 1129 : );
0002e 8b 02 mov eax, DWORD PTR [edx]
00030 8b 40 60 mov eax, DWORD PTR [eax+96]
00033 83 c0 10 add eax, 16 ; 00000010H
00036 83 20 fe and DWORD PTR [eax], -2 ; fffffffeH
; 1130 :
; 1131 : Extension->WriteLength = 0;
00039 83 a6 e0 00 00
00 00 and DWORD PTR [esi+224], 0
$L15044:
00040 5f pop edi
; 1132 :
; 1133 : }
; 1134 :
; 1135 : return FALSE;
00041 32 c0 xor al, al
00043 5e pop esi
; 1136 :
; 1137 : }
00044 c2 04 00 ret 4
_SerialGrabWriteFromIsr@4 ENDP
; Function compile flags: /Ogsy
PAGESER ENDS
; COMDAT _SerialGrabXoffFromIsr@4
PAGESER SEGMENT
_Context$ = 8
_SerialGrabXoffFromIsr@4 PROC NEAR ; COMDAT
; 1170 :
; 1171 : PSERIAL_DEVICE_EXTENSION Extension = Context;
; 1172 : SERIAL_LOCKED_PAGED_CODE();
; 1173 :
; 1174 : if (Extension->CountSinceXoff) {
00000 8b 4c 24 04 mov ecx, DWORD PTR _Context$[esp-4]
00004 8d 81 38 01 00
00 lea eax, DWORD PTR [ecx+312]
0000a 83 38 00 cmp DWORD PTR [eax], 0
0000d 74 12 je SHORT $L15060
; 1175 :
; 1176 : //
; 1177 : // This is only non-zero when there actually is a Xoff ioctl
; 1178 : // counting down.
; 1179 : //
; 1180 :
; 1181 : Extension->CountSinceXoff = 0;
0000f 83 20 00 and DWORD PTR [eax], 0
; 1182 :
; 1183 : //
; 1184 : // We decrement the count since the isr no longer owns
; 1185 : // the irp.
; 1186 : //
; 1187 :
; 1188 : SERIAL_CLEAR_REFERENCE(
; 1189 : Extension->CurrentXoffIrp,
; 1190 : SERIAL_REF_ISR
; 1191 : );
00012 8b 81 dc 00 00
00 mov eax, DWORD PTR [ecx+220]
00018 8b 40 60 mov eax, DWORD PTR [eax+96]
0001b 83 c0 10 add eax, 16 ; 00000010H
0001e 83 20 fe and DWORD PTR [eax], -2 ; fffffffeH
$L15060:
; 1192 :
; 1193 : }
; 1194 :
; 1195 : return FALSE;
00021 32 c0 xor al, al
; 1196 :
; 1197 : }
00023 c2 04 00 ret 4
_SerialGrabXoffFromIsr@4 ENDP
PAGESER ENDS
PUBLIC _SerialCompleteXoff@16
; Function compile flags: /Ogsy
; COMDAT _SerialCompleteXoff@16
_TEXT SEGMENT
_Dpc$ = 8
_DeferredContext$ = 12
_OldIrql$ = -4
_SerialCompleteXoff@16 PROC NEAR ; COMDAT
; 1231 : {
00000 55 push ebp
00001 8b ec mov ebp, esp
00003 51 push ecx
; 1232 :
; 1233 : PSERIAL_DEVICE_EXTENSION Extension = DeferredContext;
; 1234 : KIRQL OldIrql;
; 1235 :
; 1236 : UNREFERENCED_PARAMETER(SystemContext1);
; 1237 : UNREFERENCED_PARAMETER(SystemContext2);
; 1238 :
; 1239 : SerialDump(SERTRACECALLS, ("SERIAL: SerialCompleteXoff\n"));
; 1240 :
; 1241 : IoAcquireCancelSpinLock(&OldIrql);
00004 8d 45 fc lea eax, DWORD PTR _OldIrql$[ebp]
00007 56 push esi
00008 50 push eax
00009 ff 15 00 00 00
00 call DWORD PTR __imp__IoAcquireCancelSpinLock@4
; 1242 :
; 1243 : SerialTryToCompleteCurrent(
; 1244 : Extension,
; 1245 : NULL,
; 1246 : OldIrql,
; 1247 : STATUS_SUCCESS,
; 1248 : &Extension->CurrentXoffIrp,
; 1249 : NULL,
; 1250 : NULL,
; 1251 : &Extension->XoffCountTimer,
; 1252 : NULL,
; 1253 : NULL,
; 1254 : SERIAL_REF_ISR
; 1255 : );
0000f 8b 75 0c mov esi, DWORD PTR _DeferredContext$[ebp]
00012 33 c0 xor eax, eax
00014 6a 01 push 1
00016 50 push eax
00017 8d 8e 50 04 00
00 lea ecx, DWORD PTR [esi+1104]
0001d 50 push eax
0001e 51 push ecx
0001f 50 push eax
00020 8d 8e dc 00 00
00 lea ecx, DWORD PTR [esi+220]
00026 50 push eax
00027 51 push ecx
00028 50 push eax
00029 ff 75 fc push DWORD PTR _OldIrql$[ebp]
0002c 50 push eax
0002d 56 push esi
0002e e8 00 00 00 00 call _SerialTryToCompleteCurrent@44
; 1256 :
; 1257 : SerialDpcEpilogue(Extension, Dpc);
00033 ff 75 08 push DWORD PTR _Dpc$[ebp]
00036 56 push esi
00037 e8 00 00 00 00 call _SerialDpcEpilogue@8
0003c 5e pop esi
; 1258 :
; 1259 : }
0003d c9 leave
0003e c2 10 00 ret 16 ; 00000010H
_SerialCompleteXoff@16 ENDP
_TEXT ENDS
PUBLIC _SerialTimeoutXoff@16
; Function compile flags: /Ogsy
; COMDAT _SerialTimeoutXoff@16
_TEXT SEGMENT
_Dpc$ = 8
_DeferredContext$ = 12
_OldIrql$ = -4
_SerialTimeoutXoff@16 PROC NEAR ; COMDAT
; 1292 : {
00000 55 push ebp
00001 8b ec mov ebp, esp
00003 51 push ecx
; 1293 :
; 1294 : PSERIAL_DEVICE_EXTENSION Extension = DeferredContext;
; 1295 : KIRQL OldIrql;
; 1296 :
; 1297 : UNREFERENCED_PARAMETER(SystemContext1);
; 1298 : UNREFERENCED_PARAMETER(SystemContext2);
; 1299 :
; 1300 : SerialDump(SERTRACECALLS, ("SERIAL: SerialTimeoutXoff\n"));
; 1301 :
; 1302 : IoAcquireCancelSpinLock(&OldIrql);
00004 8d 45 fc lea eax, DWORD PTR _OldIrql$[ebp]
00007 56 push esi
00008 50 push eax
00009 ff 15 00 00 00
00 call DWORD PTR __imp__IoAcquireCancelSpinLock@4
; 1303 :
; 1304 : SerialTryToCompleteCurrent(
; 1305 : Extension,
; 1306 : SerialGrabXoffFromIsr,
; 1307 : OldIrql,
; 1308 : STATUS_SERIAL_COUNTER_TIMEOUT,
; 1309 : &Extension->CurrentXoffIrp,
; 1310 : NULL,
; 1311 : NULL,
; 1312 : NULL,
; 1313 : NULL,
; 1314 : NULL,
; 1315 : SERIAL_REF_TOTAL_TIMER
; 1316 : );
0000f 8b 75 0c mov esi, DWORD PTR _DeferredContext$[ebp]
00012 33 c0 xor eax, eax
00014 6a 04 push 4
00016 50 push eax
00017 50 push eax
00018 50 push eax
00019 50 push eax
0001a 50 push eax
0001b 8d 86 dc 00 00
00 lea eax, DWORD PTR [esi+220]
00021 50 push eax
00022 68 0c 00 00 40 push 1073741836 ; 4000000cH
00027 ff 75 fc push DWORD PTR _OldIrql$[ebp]
0002a 68 00 00 00 00 push OFFSET FLAT:_SerialGrabXoffFromIsr@4
0002f 56 push esi
00030 e8 00 00 00 00 call _SerialTryToCompleteCurrent@44
; 1317 :
; 1318 : SerialDpcEpilogue(Extension, Dpc);
00035 ff 75 08 push DWORD PTR _Dpc$[ebp]
00038 56 push esi
00039 e8 00 00 00 00 call _SerialDpcEpilogue@8
0003e 5e pop esi
; 1319 :
; 1320 : }
0003f c9 leave
00040 c2 10 00 ret 16 ; 00000010H
_SerialTimeoutXoff@16 ENDP
; Function compile flags: /Ogsy
_TEXT ENDS
; COMDAT _SerialCancelCurrentXoff@8
PAGESER SEGMENT
_DeviceObject$ = 8
_Irp$ = 12
_SerialCancelCurrentXoff@8 PROC NEAR ; COMDAT
; 1347 :
; 1348 : PSERIAL_DEVICE_EXTENSION Extension = DeviceObject->DeviceExtension;
00000 8b 44 24 04 mov eax, DWORD PTR _DeviceObject$[esp-4]
; 1349 : SERIAL_LOCKED_PAGED_CODE();
; 1350 :
; 1351 : SerialTryToCompleteCurrent(
; 1352 : Extension,
; 1353 : SerialGrabXoffFromIsr,
; 1354 : Irp->CancelIrql,
; 1355 : STATUS_CANCELLED,
; 1356 : &Extension->CurrentXoffIrp,
; 1357 : NULL,
; 1358 : NULL,
; 1359 : &Extension->XoffCountTimer,
; 1360 : NULL,
; 1361 : NULL,
; 1362 : SERIAL_REF_CANCEL
; 1363 : );
00004 33 c9 xor ecx, ecx
00006 6a 02 push 2
00008 51 push ecx
00009 8b 40 28 mov eax, DWORD PTR [eax+40]
0000c 51 push ecx
0000d 8d 90 50 04 00
00 lea edx, DWORD PTR [eax+1104]
00013 52 push edx
00014 51 push ecx
00015 51 push ecx
00016 8d 88 dc 00 00
00 lea ecx, DWORD PTR [eax+220]
0001c 51 push ecx
0001d 8b 4c 24 24 mov ecx, DWORD PTR _Irp$[esp+24]
00021 68 20 01 00 c0 push -1073741536 ; c0000120H
00026 8a 49 25 mov cl, BYTE PTR [ecx+37]
00029 51 push ecx
0002a 68 00 00 00 00 push OFFSET FLAT:_SerialGrabXoffFromIsr@4
0002f 50 push eax
00030 e8 00 00 00 00 call _SerialTryToCompleteCurrent@44
; 1364 :
; 1365 : }
00035 c2 08 00 ret 8
_SerialCancelCurrentXoff@8 ENDP
; Function compile flags: /Ogsy
PAGESER ENDS
; COMDAT _SerialGiveXoffToIsr@4
PAGESER SEGMENT
_Context$ = 8
_SerialGiveXoffToIsr@4 PROC NEAR ; COMDAT
; 1397 :
; 1398 : PSERIAL_DEVICE_EXTENSION Extension = Context;
; 1399 :
; 1400 : //
; 1401 : // The current stack location. This contains all of the
; 1402 : // information we need to process this particular request.
; 1403 : //
; 1404 :
; 1405 : PSERIAL_XOFF_COUNTER Xc =
; 1406 : Extension->CurrentXoffIrp->AssociatedIrp.SystemBuffer;
00000 8b 4c 24 04 mov ecx, DWORD PTR _Context$[esp-4]
00004 8b 81 dc 00 00
00 mov eax, DWORD PTR [ecx+220]
; 1407 :
; 1408 : SERIAL_LOCKED_PAGED_CODE();
; 1409 :
; 1410 : ASSERT(Extension->CurrentXoffIrp);
; 1411 : Extension->CountSinceXoff = Xc->Counter;
0000a 8b 50 0c mov edx, DWORD PTR [eax+12]
0000d 8b 52 04 mov edx, DWORD PTR [edx+4]
00010 89 91 38 01 00
00 mov DWORD PTR [ecx+312], edx
; 1412 :
; 1413 : //
; 1414 : // The isr now has a reference to the irp.
; 1415 : //
; 1416 :
; 1417 : SERIAL_SET_REFERENCE(
; 1418 : Extension->CurrentXoffIrp,
; 1419 : SERIAL_REF_ISR
; 1420 : );
00016 8b 40 60 mov eax, DWORD PTR [eax+96]
00019 83 c0 10 add eax, 16 ; 00000010H
0001c 83 08 01 or DWORD PTR [eax], 1
; 1421 :
; 1422 : return FALSE;
0001f 32 c0 xor al, al
; 1423 :
; 1424 : }
00021 c2 04 00 ret 4
_SerialGiveXoffToIsr@4 ENDP
PAGESER ENDS
END
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -