📄 testpnp.cod
字号:
00226 6a 01 push 1
00228 8b 45 14 mov eax, DWORD PTR _DeviceData$[ebp]
0022b 8b 40 68 mov eax, DWORD PTR [eax+104]
0022e 50 push eax
0022f ff 15 00 00 00
00 call DWORD PTR __imp__MmUnmapIoSpace@8
$L2845:
$L2844:
; 303 : }
; 304 : }
; 305 : DeviceData->Started = FALSE;
00235 8b 45 14 mov eax, DWORD PTR _DeviceData$[ebp]
00238 c6 40 1a 00 mov BYTE PTR [eax+26], 0
; 306 :
; 307 : //
; 308 : // don't need a completion routine so fire and forget.
; 309 : //
; 310 : Irp->IoStatus.Status = STATUS_SUCCESS;
0023c 8b 45 0c mov eax, DWORD PTR _Irp$[ebp]
0023f c7 40 18 00 00
00 00 mov DWORD PTR [eax+24], 0
; 311 : IoSkipCurrentIrpStackLocation (Irp);
00246 8b 45 0c mov eax, DWORD PTR _Irp$[ebp]
00249 fe 40 23 inc BYTE PTR [eax+35]
0024c 8b 45 0c mov eax, DWORD PTR _Irp$[ebp]
0024f 83 40 60 24 add DWORD PTR [eax+96], 36 ; 00000024H
; 312 : status = IoCallDriver (DeviceData->TopOfStack, Irp);
00253 8b 45 14 mov eax, DWORD PTR _DeviceData$[ebp]
00256 8b 55 0c mov edx, DWORD PTR _Irp$[ebp]
00259 8b 48 2c mov ecx, DWORD PTR [eax+44]
0025c ff 15 00 00 00
00 call DWORD PTR __imp_@IofCallDriver@8
00262 89 45 e4 mov DWORD PTR _status$[ebp], eax
; 313 :
; 314 : Test98_DecIoCount (DeviceData);
00265 8b 45 14 mov eax, DWORD PTR _DeviceData$[ebp]
00268 50 push eax
00269 e8 00 00 00 00 call _Test98_DecIoCount@4
; 315 : return status;
0026e 8b 45 e4 mov eax, DWORD PTR _status$[ebp]
00271 e9 84 01 00 00 jmp $L2812
$L2846:
; 316 :
; 317 : case IRP_MN_REMOVE_DEVICE:
; 318 : Test98_KdPrint (DeviceData, TEST_DBG_PNP_TRACE, ("Remove Device\n"));
; 319 :
; 320 : //
; 321 : // PnP manager uses this IRP to dirct drivers to remove a device
; 322 : //
; 323 : DeviceData->Removed = TRUE;
00276 8b 45 14 mov eax, DWORD PTR _DeviceData$[ebp]
00279 c6 40 1b 01 mov BYTE PTR [eax+27], 1
; 324 :
; 325 : //
; 326 : // Complete any outstanding IRPs queued by the driver here.
; 327 : //
; 328 :
; 329 : IoSetDeviceInterfaceState (&DeviceData->DevClassAssocName, FALSE);
0027d 6a 00 push 0
0027f 8b 45 14 mov eax, DWORD PTR _DeviceData$[ebp]
00282 83 c0 54 add eax, 84 ; 00000054H
00285 50 push eax
00286 ff 15 00 00 00
00 call DWORD PTR __imp__IoSetDeviceInterfaceState@8
; 330 :
; 331 : //
; 332 : // complete any outstanding reqeusts now.
; 333 : // Fire and forget
; 334 : //
; 335 :
; 336 : IoSkipCurrentIrpStackLocation (Irp);
0028c 8b 45 0c mov eax, DWORD PTR _Irp$[ebp]
0028f fe 40 23 inc BYTE PTR [eax+35]
00292 8b 45 0c mov eax, DWORD PTR _Irp$[ebp]
00295 83 40 60 24 add DWORD PTR [eax+96], 36 ; 00000024H
; 337 : IoCallDriver (DeviceData->TopOfStack, Irp);
00299 8b 45 14 mov eax, DWORD PTR _DeviceData$[ebp]
0029c 8b 55 0c mov edx, DWORD PTR _Irp$[ebp]
0029f 8b 48 2c mov ecx, DWORD PTR [eax+44]
002a2 ff 15 00 00 00
00 call DWORD PTR __imp_@IofCallDriver@8
; 338 :
; 339 : //
; 340 : // Wait for all outstanding requests to complete
; 341 : //
; 342 : i = InterlockedDecrement (&DeviceData->OutstandingIO);
002a8 8b 4d 14 mov ecx, DWORD PTR _DeviceData$[ebp]
002ab 83 c1 40 add ecx, 64 ; 00000040H
002ae ff 15 00 00 00
00 call DWORD PTR __imp_@InterlockedDecrement@4
002b4 89 45 ec mov DWORD PTR _i$[ebp], eax
; 343 :
; 344 : ASSERT (0 < i);
; 345 :
; 346 : if (0 != InterlockedDecrement (&DeviceData->OutstandingIO)) {
002b7 8b 4d 14 mov ecx, DWORD PTR _DeviceData$[ebp]
002ba 83 c1 40 add ecx, 64 ; 00000040H
002bd ff 15 00 00 00
00 call DWORD PTR __imp_@InterlockedDecrement@4
002c3 85 c0 test eax, eax
002c5 0f 84 15 00 00
00 je $L2847
; 347 : Test98_KdPrint (DeviceData, TEST_DBG_PNP_INFO,
; 348 : ("Remove Device waiting for request to complete\n"));
; 349 :
; 350 : KeWaitForSingleObject (&DeviceData->RemoveEvent,
; 351 : Suspended,
; 352 : KernelMode,
; 353 : FALSE, // Not Alertable
; 354 : NULL); // No timeout
002cb 6a 00 push 0
002cd 6a 00 push 0
002cf 6a 00 push 0
002d1 6a 05 push 5
002d3 8b 45 14 mov eax, DWORD PTR _DeviceData$[ebp]
002d6 83 c0 44 add eax, 68 ; 00000044H
002d9 50 push eax
002da ff 15 00 00 00
00 call DWORD PTR __imp__KeWaitForSingleObject@20
$L2847:
; 355 : }
; 356 : //
; 357 : // Free the associated resources
; 358 : // Detatch from the undelying devices.
; 359 : //
; 360 : Test98_KdPrint(DeviceData, TEST_DBG_PNP_INFO,
; 361 : ("IoDetachDevice: 0x%x\n", DeviceData->TopOfStack));
; 362 : IoDetachDevice (DeviceData->TopOfStack);
002e0 8b 45 14 mov eax, DWORD PTR _DeviceData$[ebp]
002e3 8b 40 2c mov eax, DWORD PTR [eax+44]
002e6 50 push eax
002e7 ff 15 00 00 00
00 call DWORD PTR __imp__IoDetachDevice@4
; 363 :
; 364 : //
; 365 : // Clean up any resources here
; 366 : //
; 367 : if (DeviceData->Started) {
002ed 8b 45 14 mov eax, DWORD PTR _DeviceData$[ebp]
002f0 33 c9 xor ecx, ecx
002f2 8a 48 1a mov cl, BYTE PTR [eax+26]
002f5 85 c9 test ecx, ecx
002f7 0f 84 1f 00 00
00 je $L2848
; 368 : //
; 369 : // Free resources given by start device.
; 370 : //
; 371 : if (DeviceData->MappedPorts) {
002fd 8b 45 14 mov eax, DWORD PTR _DeviceData$[ebp]
00300 33 c9 xor ecx, ecx
00302 8a 48 18 mov cl, BYTE PTR [eax+24]
00305 85 c9 test ecx, ecx
00307 0f 84 0f 00 00
00 je $L2849
; 372 : MmUnmapIoSpace (DeviceData->TestPortAddress, 1);
0030d 6a 01 push 1
0030f 8b 45 14 mov eax, DWORD PTR _DeviceData$[ebp]
00312 8b 40 68 mov eax, DWORD PTR [eax+104]
00315 50 push eax
00316 ff 15 00 00 00
00 call DWORD PTR __imp__MmUnmapIoSpace@8
$L2849:
$L2848:
; 373 : }
; 374 : }
; 375 :
; 376 : ExFreePool (DeviceData->DevClassAssocName.Buffer);
0031c 8b 45 14 mov eax, DWORD PTR _DeviceData$[ebp]
0031f 8b 40 58 mov eax, DWORD PTR [eax+88]
00322 50 push eax
00323 ff 15 00 00 00
00 call DWORD PTR __imp__ExFreePool@4
; 377 : Test98_KdPrint(DeviceData, TEST_DBG_PNP_INFO,
; 378 : ("IoDeleteDevice1: 0x%x\n", DeviceObject));
; 379 : IoDeleteDevice (DeviceObject);
00329 8b 45 08 mov eax, DWORD PTR _DeviceObject$[ebp]
0032c 50 push eax
0032d ff 15 00 00 00
00 call DWORD PTR __imp__IoDeleteDevice@4
; 380 :
; 381 : return STATUS_SUCCESS;
00333 33 c0 xor eax, eax
00335 e9 c0 00 00 00 jmp $L2812
$L2850:
; 382 :
; 383 : case IRP_MN_QUERY_REMOVE_DEVICE:
; 384 : //
; 385 : // the driver indicates to system whether it can be removed
; 386 : // in response to this IPR...
; 387 : //
; 388 :
; 389 : Irp->IoStatus.Status = STATUS_SUCCESS;
0033a 8b 45 0c mov eax, DWORD PTR _Irp$[ebp]
0033d c7 40 18 00 00
00 00 mov DWORD PTR [eax+24], 0
; 390 : IoSkipCurrentIrpStackLocation (Irp);
00344 8b 45 0c mov eax, DWORD PTR _Irp$[ebp]
00347 fe 40 23 inc BYTE PTR [eax+35]
0034a 8b 45 0c mov eax, DWORD PTR _Irp$[ebp]
0034d 83 40 60 24 add DWORD PTR [eax+96], 36 ; 00000024H
; 391 : status = IoCallDriver (DeviceData->TopOfStack, Irp);
00351 8b 45 14 mov eax, DWORD PTR _DeviceData$[ebp]
00354 8b 55 0c mov edx, DWORD PTR _Irp$[ebp]
00357 8b 48 2c mov ecx, DWORD PTR [eax+44]
0035a ff 15 00 00 00
00 call DWORD PTR __imp_@IofCallDriver@8
00360 89 45 e4 mov DWORD PTR _status$[ebp], eax
; 392 : Test98_DecIoCount (DeviceData);
00363 8b 45 14 mov eax, DWORD PTR _DeviceData$[ebp]
00366 50 push eax
00367 e8 00 00 00 00 call _Test98_DecIoCount@4
; 393 : return status;
0036c 8b 45 e4 mov eax, DWORD PTR _status$[ebp]
0036f e9 86 00 00 00 jmp $L2812
$L2851:
; 394 :
; 395 : default:
; 396 : //
; 397 : // In the default case we merely call the next driver since
; 398 : // we don't know what to do.
; 399 : // Fire and Forget
; 400 : //
; 401 : IoSkipCurrentIrpStackLocation (Irp);
00374 8b 45 0c mov eax, DWORD PTR _Irp$[ebp]
00377 fe 40 23 inc BYTE PTR [eax+35]
0037a 8b 45 0c mov eax, DWORD PTR _Irp$[ebp]
0037d 83 40 60 24 add DWORD PTR [eax+96], 36 ; 00000024H
; 402 :
; 403 : //
; 404 : // Done, do NOT complete the IRP, it will be processed by the lower
; 405 : // device object, which will complete the IRP
; 406 : //
; 407 :
; 408 : status = IoCallDriver (DeviceData->TopOfStack, Irp);
00381 8b 45 14 mov eax, DWORD PTR _DeviceData$[ebp]
00384 8b 55 0c mov edx, DWORD PTR _Irp$[ebp]
00387 8b 48 2c mov ecx, DWORD PTR [eax+44]
0038a ff 15 00 00 00
00 call DWORD PTR __imp_@IofCallDriver@8
00390 89 45 e4 mov DWORD PTR _status$[ebp], eax
; 409 : Test98_DecIoCount (DeviceData);
00393 8b 45 14 mov eax, DWORD PTR _DeviceData$[ebp]
00396 50 push eax
00397 e8 00 00 00 00 call _Test98_DecIoCount@4
; 410 : return status;
0039c 8b 45 e4 mov eax, DWORD PTR _status$[ebp]
0039f e9 56 00 00 00 jmp $L2812
; 411 : }
003a4 e9 2c 00 00 00 jmp $L2824
$L2823:
003a9 83 7d c0 05 cmp DWORD PTR -64+[ebp], 5
003ad 0f 87 c1 ff ff
ff ja $L2851
003b3 8b 45 c0 mov eax, DWORD PTR -64+[ebp]
003b6 ff 24 85 00 00
00 00 jmp DWORD PTR $L3014[eax*4]
$L3014:
003bd 00 00 00 00 DD OFFSET FLAT:$L2827
003c1 00 00 00 00 DD OFFSET FLAT:$L2850
003c5 00 00 00 00 DD OFFSET FLAT:$L2846
003c9 00 00 00 00 DD OFFSET FLAT:$L2851
003cd 00 00 00 00 DD OFFSET FLAT:$L2843
003d1 00 00 00 00 DD OFFSET FLAT:$L2840
$L2824:
; 412 :
; 413 : Irp->IoStatus.Status = status;
003d5 8b 45 e4 mov eax, DWORD PTR _status$[ebp]
003d8 8b 4d 0c mov ecx, DWORD PTR _Irp$[ebp]
003db 89 41 18 mov DWORD PTR [ecx+24], eax
; 414 : DbgRaiseIrql (DISPATCH_LEVEL, &oldIrq);
; 415 : IoCompleteRequest (Irp, IO_NO_INCREMENT);
003de 33 d2 xor edx, edx
003e0 8b 4d 0c mov ecx, DWORD PTR _Irp$[ebp]
003e3 ff 15 00 00 00
00 call DWORD PTR __imp_@IofCompleteRequest@8
; 416 : DbgLowerIrql (oldIrq);
; 417 :
; 418 : Test98_DecIoCount (DeviceData);
003e9 8b 45 14 mov eax, DWORD PTR _DeviceData$[ebp]
003ec 50 push eax
003ed e8 00 00 00 00 call _Test98_DecIoCount@4
; 419 : return status;
003f2 8b 45 e4 mov eax, DWORD PTR _status$[ebp]
003f5 e9 00 00 00 00 jmp $L2812
$L2812:
; 420 : }
003fa 5f pop edi
003fb 5e pop esi
003fc 5b pop ebx
003fd c9 leave
003fe c2 10 00 ret 16 ; 00000010H
_Test98_FDO_PnP@16 ENDP
_TEXT ENDS
EXTRN __imp__KeSetEvent@12:NEAR
; COMDAT _Test98_FDO_PnPComplete@12
_TEXT SEGMENT
_Irp$ = 12
_Context$ = 16
_Test98_FDO_PnPComplete@12 PROC NEAR ; COMDAT
; 435 : {
00000 55 push ebp
00001 8b ec mov ebp, esp
00003 53 push ebx
00004 56 push esi
00005 57 push edi
; 436 : UNREFERENCED_PARAMETER (DeviceObject);
; 437 :
; 438 : if (Irp->PendingReturned) {
00006 8b 45 0c mov eax, DWORD PTR _Irp$[ebp]
00009 33 c9 xor ecx, ecx
0000b 8a 48 21 mov cl, BYTE PTR [eax+33]
0000e 85 c9 test ecx, ecx
00010 0f 84 17 00 00
00 je $L2856
; 439 : IoMarkIrpPending( Irp );
00016 8b 45 0c mov eax, DWORD PTR _Irp$[ebp]
00019 8b 40 60 mov eax, DWORD PTR [eax+96]
0001c 33 c9 xor ecx, ecx
0001e 8a 48 03 mov cl, BYTE PTR [eax+3]
00021 80 c9 01 or cl, 1
00024 8b 45 0c mov eax, DWORD PTR _Irp$[ebp]
00027 8b 40 60 mov eax, DWORD PTR [eax+96]
0002a 88 48 03 mov BYTE PTR [eax+3], cl
$L2856:
; 440 : }
; 441 :
; 442 : KeSetEvent ((PKEVENT) Context, 1, FALSE);
0002d 6a 00 push 0
0002f 6a 01 push 1
00031 8b 45 10 mov eax, DWORD PTR _Context$[ebp]
00034 50 push eax
00035 ff 15 00 00 00
00 call DWORD PTR __imp__KeSetEvent@12
; 443 : // No special priority
; 444 : // No Wait
; 445 :
; 446 : return STATUS_MORE_PROCESSING_REQUIRED; // Keep this IRP
0003b b8 16 00 00 c0 mov eax, -1073741802 ; c0000016H
00040 e9 00 00 00 00 jmp $L2855
$L2855:
; 447 : }
00045 5f pop edi
00046 5e pop esi
00047 5b pop ebx
00048 c9 leave
00049 c2 0c 00 ret 12 ; 0000000cH
_Test98_FDO_PnPComplete@12 ENDP
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -