📄 power.cod
字号:
002f4 a1 00 00 00 00 mov eax, DWORD PTR _SerialDebugLevel
002f9 59 pop ecx
002fa b9 00 01 00 00 mov ecx, 256 ; 00000100H
$L15098:
; 415 : }
; 416 :
; 417 :
; 418 : //
; 419 : // If we are already in the requested state, just pass the IRP down
; 420 : //
; 421 :
; 422 : if (pDevExt->PowerState
; 423 : == pIrpStack->Parameters.Power.State.DeviceState) {
002ff 8b 5b 0c mov ebx, DWORD PTR [ebx+12]
00302 39 9e a4 04 00
00 cmp DWORD PTR [esi+1188], ebx
00308 75 12 jne SHORT $L15125
; 424 : SerialDump(SERPNPPOWER, ("SERIAL: Already in requested power state\n")
; 425 : );
0030a 85 c1 test eax, ecx
0030c 0f 84 20 01 00
00 je $PowerExit$15070
00312 68 00 00 00 00 push OFFSET FLAT:$SG15132
; 426 : status = STATUS_SUCCESS;
; 427 : break;
00317 e9 10 01 00 00 jmp $L15517
$L15125:
; 428 : }
; 429 :
; 430 :
; 431 : switch (pIrpStack->Parameters.Power.State.DeviceState) {
0031c 83 fb 01 cmp ebx, 1
0031f 74 2c je SHORT $L15145
00321 0f 8e 0b 01 00
00 jle $PowerExit$15070
00327 83 fb 04 cmp ebx, 4
0032a 0f 8f 02 01 00
00 jg $PowerExit$15070
; 436 :
; 437 : case PowerDeviceD1:
; 438 : case PowerDeviceD2:
; 439 : case PowerDeviceD3:
; 440 : SerialDump(SERPNPPOWER, ("SERIAL: Going to power state D3\n"));
00330 85 c1 test eax, ecx
00332 74 0b je SHORT $L15160
00334 68 00 00 00 00 push OFFSET FLAT:$SG15165
00339 e8 00 00 00 00 call _DbgPrint
0033e 59 pop ecx
$L15160:
; 441 : return SerialSetPowerD3(PDevObj, PIrp);
0033f 57 push edi
00340 ff 75 08 push DWORD PTR _PDevObj$[ebp]
00343 e8 00 00 00 00 call _SerialSetPowerD3@8
00348 e9 fd 00 00 00 jmp $L14987
$L15145:
; 432 :
; 433 : case PowerDeviceD0:
; 434 : SerialDump(SERPNPPOWER, ("SERIAL: Going to power state D0\n"));
0034d 85 c1 test eax, ecx
0034f 74 0b je SHORT $L15146
00351 68 00 00 00 00 push OFFSET FLAT:$SG15151
00356 e8 00 00 00 00 call _DbgPrint
0035b 59 pop ecx
$L15146:
; 435 : return SerialSetPowerD0(PDevObj, PIrp);
0035c 57 push edi
0035d ff 75 08 push DWORD PTR _PDevObj$[ebp]
00360 e8 00 00 00 00 call _SerialSetPowerD0@8
00365 e9 e0 00 00 00 jmp $L14987
$L15055:
; 310 : case SystemPowerState: {
; 311 : POWER_STATE powerState;
; 312 :
; 313 : //
; 314 : // They asked for a system power state change
; 315 : //
; 316 :
; 317 : SerialDump(SERPNPPOWER, ("------: SystemPowerState\n"));
0036a 85 c1 test eax, ecx
0036c 74 0b je SHORT $L15056
0036e 68 00 00 00 00 push OFFSET FLAT:$SG15061
00373 e8 00 00 00 00 call _DbgPrint
00378 59 pop ecx
$L15056:
; 318 :
; 319 : //
; 320 : // We will only service this if we are policy owner -- we
; 321 : // don't need to lock on this value since we only service
; 322 : // one power request at a time.
; 323 : //
; 324 :
; 325 : if (pDevExt->OwnsPowerPolicy != TRUE) {
00379 80 be 74 05 00
00 01 cmp BYTE PTR [esi+1396], 1
00380 0f 85 ac 00 00
00 jne $PowerExit$15070
; 326 : status = STATUS_SUCCESS;
; 327 : goto PowerExit;
; 328 : }
; 329 :
; 330 :
; 331 : switch (pIrpStack->Parameters.Power.State.SystemState) {
00386 8b 43 0c mov eax, DWORD PTR [ebx+12]
00389 85 c0 test eax, eax
0038b 74 27 je SHORT $L15075
0038d 33 c9 xor ecx, ecx
0038f 41 inc ecx
00390 3b c1 cmp eax, ecx
00392 74 1b je SHORT $L15076
00394 0f 8e 98 00 00
00 jle $PowerExit$15070
0039a 83 f8 07 cmp eax, 7
0039d 0f 8f 8f 00 00
00 jg $PowerExit$15070
; 339 :
; 340 : case PowerSystemSleeping1:
; 341 : case PowerSystemSleeping2:
; 342 : case PowerSystemSleeping3:
; 343 : case PowerSystemHibernate:
; 344 : case PowerSystemShutdown:
; 345 : case PowerSystemMaximum:
; 346 : powerState.DeviceState
; 347 : = pDevExt->DeviceStateMap[pIrpStack->
; 348 : Parameters.Power.State.SystemState];
003a3 8b 84 86 00 05
00 00 mov eax, DWORD PTR [esi+eax*4+1280]
003aa 89 45 0c mov DWORD PTR _powerState$15054[ebp], eax
; 349 : break;
003ad eb 09 jmp SHORT $L15072
$L15076:
; 334 : break;
; 335 :
; 336 : case PowerSystemWorking:
; 337 : powerState.DeviceState = PowerDeviceD0;
003af 89 4d 0c mov DWORD PTR _powerState$15054[ebp], ecx
; 338 : break;
003b2 eb 04 jmp SHORT $L15072
$L15075:
; 332 : case PowerSystemUnspecified:
; 333 : powerState.DeviceState = PowerDeviceUnspecified;
003b4 83 65 0c 00 and DWORD PTR _powerState$15054[ebp], 0
$L15072:
; 350 :
; 351 : default:
; 352 : status = STATUS_SUCCESS;
; 353 : goto PowerExit;
; 354 : break;
; 355 : }
; 356 :
; 357 :
; 358 : status = STATUS_SUCCESS;
; 359 :
; 360 : PoSetPowerState(PDevObj, pIrpStack->Parameters.Power.Type,
; 361 : pIrpStack->Parameters.Power.State);
003b8 ff 73 0c push DWORD PTR [ebx+12]
003bb ff 73 08 push DWORD PTR [ebx+8]
003be ff 75 08 push DWORD PTR _PDevObj$[ebp]
003c1 ff 15 00 00 00
00 call DWORD PTR __imp__PoSetPowerState@12
; 362 :
; 363 : //
; 364 : // Send IRP to change device state if we should change
; 365 : //
; 366 :
; 367 : //
; 368 : // We only power up the stack if the device is open. This is based
; 369 : // on our policy of keeping the device powered down unless it is
; 370 : // open.
; 371 : //
; 372 :
; 373 : if (((powerState.DeviceState < pDevExt->PowerState)
; 374 : && pDevExt->OpenCount)) {
003c7 8b 86 a4 04 00
00 mov eax, DWORD PTR [esi+1188]
003cd 8b 55 0c mov edx, DWORD PTR _powerState$15054[ebp]
003d0 33 c9 xor ecx, ecx
003d2 3b d0 cmp edx, eax
003d4 7d 1d jge SHORT $L15520
003d6 39 8e e8 04 00
00 cmp DWORD PTR [esi+1256], ecx
003dc 74 11 je SHORT $L15081
$L15089:
; 375 : PoRequestPowerIrp(pPdo, IRP_MN_SET_POWER, powerState, NULL, NULL,
; 376 : NULL);
003de 51 push ecx
003df 51 push ecx
003e0 51 push ecx
003e1 52 push edx
003e2 6a 02 push 2
003e4 ff 75 fc push DWORD PTR _pPdo$[ebp]
003e7 ff 15 00 00 00
00 call DWORD PTR __imp__PoRequestPowerIrp@24
; 377 : }else {
003ed eb 43 jmp SHORT $PowerExit$15070
$L15081:
; 378 : //
; 379 : // If powering down, we can't go past wake state
; 380 : // if wait-wake pending
; 381 : //
; 382 :
; 383 : if (powerState.DeviceState >= pDevExt->PowerState) {
003ef 3b d0 cmp edx, eax
003f1 7c 3f jl SHORT $PowerExit$15070
$L15520:
; 384 :
; 385 : //
; 386 : // Power down -- ensure there is no wake-wait pending OR
; 387 : // we can do down to that level and still wake the machine
; 388 : //
; 389 :
; 390 : if ((pDevExt->PendingWakeIrp == NULL && !pDevExt->SendWaitWake)
; 391 : || powerState.DeviceState <= pDevExt->DeviceWake) {
003f3 39 8e 88 05 00
00 cmp DWORD PTR [esi+1416], ecx
003f9 75 09 jne SHORT $L15090
003fb 80 be 84 05 00
00 00 cmp BYTE PTR [esi+1412], 0
00402 74 da je SHORT $L15089
$L15090:
00404 3b 96 7c 05 00
00 cmp edx, DWORD PTR [esi+1404]
0040a 7f 26 jg SHORT $PowerExit$15070
; 392 : PoRequestPowerIrp(pPdo, IRP_MN_SET_POWER, powerState, NULL,
; 393 : NULL, NULL);
; 394 : } else {
; 395 : //
; 396 : // Fail the request
; 397 : //
; 398 :
; 399 : status = STATUS_INVALID_DEVICE_STATE;
; 400 : }
; 401 : }
; 402 : }
; 403 :
; 404 : goto PowerExit;
0040c eb d0 jmp SHORT $L15089
$L15022:
; 294 : break;
; 295 :
; 296 :
; 297 : case IRP_MN_POWER_SEQUENCE:
; 298 : SerialDump(SERPNPPOWER, ("SERIAL: Got IRP_MN_POWER_SEQUENCE Irp\n"));
0040e f6 05 01 00 00
00 01 test BYTE PTR _SerialDebugLevel+1, 1
00415 74 1b je SHORT $PowerExit$15070
00417 68 00 00 00 00 push OFFSET FLAT:$SG15028
; 299 : break;
0041c eb 0e jmp SHORT $L15517
$L15008:
; 291 :
; 292 : case IRP_MN_WAIT_WAKE:
; 293 : SerialDump(SERPNPPOWER, ("SERIAL: Got IRP_MN_WAIT_WAKE Irp\n"));
0041e f6 05 01 00 00
00 01 test BYTE PTR _SerialDebugLevel+1, 1
00425 74 0b je SHORT $PowerExit$15070
00427 68 00 00 00 00 push OFFSET FLAT:$SG15014
$L15517:
0042c e8 00 00 00 00 call _DbgPrint
00431 59 pop ecx
$PowerExit$15070:
; 480 :
; 481 : } // switch (pIrpStack->MinorFunction)
; 482 :
; 483 :
; 484 : PowerExit:;
; 485 :
; 486 : PoStartNextPowerIrp(PIrp);
00432 57 push edi
00433 ff 15 00 00 00
00 call DWORD PTR __imp__PoStartNextPowerIrp@4
; 487 :
; 488 :
; 489 : //
; 490 : // Pass to the lower driver
; 491 : //
; 492 : IoSkipCurrentIrpStackLocation(PIrp);
00439 83 47 60 24 add DWORD PTR [edi+96], 36 ; 00000024H
0043d fe 47 23 inc BYTE PTR [edi+35]
; 493 : status = SerialPoCallDriver(pDevExt, pLowerDevObj, PIrp);
00440 57 push edi
00441 ff 75 f8 push DWORD PTR _pLowerDevObj$[ebp]
00444 56 push esi
00445 e8 00 00 00 00 call _SerialPoCallDriver@12
$L14987:
0044a 5f pop edi
0044b 5e pop esi
0044c 5b pop ebx
; 494 :
; 495 : return status;
; 496 : }
0044d c9 leave
0044e c2 08 00 ret 8
_SerialPowerDispatch@8 ENDP
PAGESRP0 ENDS
EXTRN __imp__KeClearEvent@4:NEAR
EXTRN __imp__KeWaitForSingleObject@20:NEAR
EXTRN _SerialSyncCompletion@12:NEAR
EXTRN __imp__PoCallDriver@8:NEAR
; COMDAT _SerialSetPowerD0@8
PAGESRP0 SEGMENT
$SG15203 DB 'EX: Pageable code called at IRQL %d', 0aH, 00H
ORG $+3
$SG15206 DB 'f:\w2ddk\src\kernel\serial\power.c', 00H
ORG $+1
$SG15207 DB 'FALSE', 00H
ORG $+2
$SG15214 DB 'SERIAL: In SerialSetPowerD0', 0aH, 00H
ORG $+3
$SG15227 DB 'SERIAL: SetPowerD0 has IRP %x', 0aH, 00H
ORG $+1
$SG15236 DB 'f:\w2ddk\src\kernel\serial\power.c', 00H
ORG $+1
$SG15237 DB 'pDevExt->LowerDeviceObject', 00H
ORG $+1
$SG15247 DB 'f:\w2ddk\src\kernel\serial\power.c', 00H
ORG $+1
$SG15248 DB '(1) | (1) | (1) ? (SerialSyncCompletion) != NULL : TRUE', 00H
$SG15258 DB 'SERIAL: Calling next driver', 0aH, 00H
ORG $+3
$SG15273 DB 'SERIAL: Waiting for next driver', 0aH, 00H
ORG $+3
$SG15293 DB 'SERIAL: Leaving SerialSetPowerD0', 0aH, 00H
; Function compile flags: /Ogs
_PDevObj$ = 8
_PIrp$ = 12
_pDevExt$ = -4
_pIrpStack$ = -8
_status$ = 12
_SerialSetPowerD0@8 PROC NEAR ; COMDAT
; 527 : {
00196 55 push ebp
00197 8b ec mov ebp, esp
00199 51 push ecx
0019a 51 push ecx
; 528 : PSERIAL_DEVICE_EXTENSION pDevExt = PDevObj->DeviceExtension;
0019b 8b 45 08 mov eax, DWORD PTR _PDevObj$[ebp]
0019e 53 push ebx
; 529 : PIO_STACK_LOCATION pIrpStack = IoGetCurrentIrpStackLocation(PIrp);
0019f 8b 5d 0c mov ebx, DWORD PTR _PIrp$[ebp]
001a2 56 push esi
001a3 8b 40 28 mov eax, DWORD PTR [eax+40]
; 530 : NTSTATUS status;
; 531 :
; 532 : PAGED_CODE();
001a6 8b 35 00 00 00
00 mov esi, DWORD PTR __imp__KeGetCurrentIrql@0
001ac 89 45 fc mov DWORD PTR _pDevExt$[ebp], eax
001af 8b 43 60 mov eax, DWORD PTR [ebx+96]
001b2 57 push edi
001b3 89 45 f8 mov DWORD PTR _pIrpStack$[ebp], eax
001b6 ff d6 call esi
001b8 3c 01 cmp al, 1
001ba 76 29 jbe SHORT $L15208
001bc ff d6 call esi
001be 0f b6 c0 movzx eax, al
001c1 50 push eax
001c2 68 00 00 00 00 push OFFSET FLAT:$SG15203
001c7 e8 00 00 00 00 call _DbgPrint
001cc 59 pop ecx
001cd 59 pop ecx
001ce 6a 00 push 0
001d0 68 14 02 00 00 push 532 ; 00000214H
001d5 68 00 00 00 00 push OFFSET FLAT:$SG15206
001da 68 00 00 00 00 push OFFSET FLAT:$SG15207
001df ff 15 00 00 00
00 call DWORD PTR __imp__RtlAssert@16
$L15208:
; 533 :
; 534 : SerialDump(SERTRACECALLS, ("SERIAL: In SerialSetPowerD0\n"));
001e5 f6 05 00 00 00
00 40 test BYTE PTR _SerialDebugLevel, 64 ; 00000040H
001ec 74 0b je SHORT $L15209
001ee 68 00 00 00 00 push OFFSET FLAT:$SG15214
001f3 e8 00 00 00 00 call _DbgPrint
001f8 59 pop ecx
$L15209:
; 535 : SerialDump(SERPNPPOWER, ("SERIAL: SetPowerD0 has IRP %x\n", PIrp));
001f9 f6 05 01 00 00
00 01 test BYTE PTR _SerialDebugLevel+1, 1
00200 74 0d je SHORT $L15222
00202 53 push ebx
00203 68 00 00 00 00 push OFFSET FLAT:$SG15227
00208 e8 00 00 00 00 call _DbgPrint
0020d 59 pop ecx
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -