NtPowerInformation
NTSTATUS __stdcall NtPowerInformation(
POWER_INFORMATION_LEVEL InformationLevel,
VOID *InputBuffer,
UINT64 InputBufferLength,
VOID *OutputBuffer,
UINT64 OutputBufferLength){
int v6;
unsigned int v8;
__int64 v9;
INT64 v10;
char *PoolWithTag;
UINT64 v12;
char PreviousMode;
unsigned int v14;
VOID *v15;
_IRP *v16;
int v17;
unsigned __int64 v18;
unsigned __int64 v19;
unsigned __int64 v20;
__int64 v21;
unsigned __int64 v22;
__int64 v23;
unsigned __int64 v24;
__int64 v25;
unsigned __int64 v26;
__int64 v27;
unsigned __int64 v28;
size_t v29;
INT64 v30;
INT64 v31;
NTSTATUS IsAppContainerOrIdentifyLevelContext;
char v33;
unsigned __int64 v34;
INT64 v35;
INT64 v36;
unsigned int v37;
int v39;
NTSTATUS v40;
bool v41;
NTSTATUS SettingValue;
NTSTATUS v43;
NTSTATUS Info;
unsigned __int8 IsDevicePotentialDripsConstraint;
SYSTEM_BATTERY_STATE *v46;
unsigned int v47;
UINT64 *v48;
char v49;
unsigned int v50;
unsigned int v51;
INT64 v52;
__int64 v53;
__int64 v54;
__int64 v55;
int v56;
char Rate;
unsigned int ProcessSessionId;
NTSTATUS v59;
UINT16 v60;
__int64 v61;
unsigned int v62;
_MEMORY_CACHING_TYPE_ORIG v63;
_KNOWN_CONTROLLER_TYPE *v64;
VOID **v65;
unsigned int v66;
POWER_REQUEST_TYPE_INTERNAL v67;
VOID *v68;
NTSTATUS PowerRequestListInfo;
POWER_MONITOR_REQUEST_REASON v70;
char v71;
unsigned int v72;
char v73;
INT64 v74;
INT64 v75;
INT64 v76;
VOID **ReturnBuffer;
UINT *ReturnBufferLength;
UINT8 *FreeReturnBuffer;
INT64 *CallbackRoutine;
_UNICODE_STRING *v81;
INT64 *v82;
VOID *v83;
UINT64 ReturnListLength;
PVOID ReturnList;
UINT64 IsAppContainerContext;
PVOID P;
UINT64 v88;
UINT64 v89;
UINT64 BufferSize;
_KNOWN_CONTROLLER_TYPE v91[2];
VOID *Data;
DBGK_LIVEDUMP_FLAGS Flags[2];
unsigned __int64 v94;
VOID *v95;
INT64 v96;
SYSTEM_BATTERY_STATE ReturnHandle[48];
char v98[64];
v94 = (unsigned __int64)OutputBuffer;
v6 = InputBufferLength;
v8 = InformationLevel;
LODWORD(v89) = InformationLevel;
LOBYTE(IsAppContainerContext) = 0;
memset(ReturnHandle, 0i64, sizeof(ReturnHandle));
LODWORD(BufferSize) = 0;
*(_QWORD *)v91 = 0i64;
ReturnList = 0i64;
LODWORD(ReturnListLength) = 0;
PoolWithTag = 0i64;
P = 0i64;
*(_QWORD *)&Flags[0]._bf_0 = 0i64;
LOBYTE(v12) = 0;
LOBYTE(v83) = 0;
BYTE6(ReturnListLength) = 0;
BYTE4(ReturnListLength) = 0;
if( v8 > 0x5F )
{
IsAppContainerOrIdentifyLevelContext = -1073741811;
goto LABEL_379;
}
PreviousMode = KeGetCurrentThread()->PreviousMode;
BYTE5(ReturnListLength) = PreviousMode;
v14 = InputBuffer != 0i64 ? v6 : 0;
v15 = (VOID *)((unsigned __int64)InputBuffer & -(__int64)(v14 != 0));
v95 = v15;
HIDWORD(v83) = OutputBuffer != 0i64 ? OutputBufferLength : 0;
v16 = (_IRP *)(v94 & -(__int64)(HIDWORD(v83) != 0));
if( PreviousMode )
{
if( v8 <= 0x19 && (v17 = 50462912, _bittest(&v17, v8))
|| (v18 = v8 - 30, (unsigned int)v18 <= 0x3D) && (v9 = 0x209E02E385CA1E1Fi64, _bittest64(&v9, v18)) )
{
IsAppContainerOrIdentifyLevelContext = -1073741790;
InputBuffer = (VOID *)((unsigned __int64)InputBuffer & -(__int64)(v14 != 0));
PoolWithTag = (char *)P;
LABEL_379:
v33 = 0;
goto LABEL_66;
}
v19 = v8 - 37;
if( (unsigned int)v19 <= 0x3A && (v9 = 0x608801808940903i64, _bittest64(&v9, v19)) || v8 - 2 <= 1 )
{
IsAppContainerOrIdentifyLevelContext = SeIsAppContainerOrIdentifyLevelContext(
0i64,
(UINT8 *)&IsAppContainerContext);
LODWORD(v88) = IsAppContainerOrIdentifyLevelContext;
if( IsAppContainerOrIdentifyLevelContext < 0 )
{
InputBuffer = (VOID *)((unsigned __int64)InputBuffer & -(__int64)(v14 != 0));
PoolWithTag = (char *)P;
v33 = 0;
goto LABEL_66;
}
v8 = v89;
if( (_BYTE)IsAppContainerContext )
{
if( (_DWORD)v89 != 73 && (_DWORD)v89 != 88 )
{
IsAppContainerOrIdentifyLevelContext = -1073741790;
LODWORD(v88) = -1073741790;
InputBuffer = (VOID *)((unsigned __int64)InputBuffer & -(__int64)(v14 != 0));
PoolWithTag = (char *)P;
v33 = 0;
goto LABEL_66;
}
BYTE4(v88) = PopCapabilityCheck(
L"ID_CAP_SCREENOFF",
v12,
v10,
v30,
(INT64)ReturnBuffer,
(INT64)ReturnBufferLength,
(INT64)FreeReturnBuffer,
(INT64)CallbackRoutine);
if( !BYTE4(v88) )
{
IsAppContainerOrIdentifyLevelContext = -1073741790;
LODWORD(v88) = -1073741790;
InputBuffer = (VOID *)((unsigned __int64)InputBuffer & -(__int64)(v14 != 0));
PoolWithTag = (char *)P;
v33 = 0;
goto LABEL_66;
}
}
}
if( v8 - 92 <= 1 )
{
LOBYTE(v9) = PreviousMode;
IsAppContainerOrIdentifyLevelContext = ExCheckFullProcessInformationAccess(v9);
LODWORD(v88) = IsAppContainerOrIdentifyLevelContext;
if( IsAppContainerOrIdentifyLevelContext < 0 )
{
InputBuffer = (VOID *)((unsigned __int64)InputBuffer & -(__int64)(v14 != 0));
PoolWithTag = (char *)P;
v33 = 0;
goto LABEL_66;
}
v8 = v89;
}
v20 = v8 - 28;
if( (unsigned int)v20 <= 0x32 )
{
v21 = 0x4000000420001i64;
if( _bittest64(&v21, v20) )
{
if( !PspIsContextAdmin() )
{
IsAppContainerOrIdentifyLevelContext = -1073741790;
LODWORD(v88) = -1073741790;
InputBuffer = (VOID *)((unsigned __int64)InputBuffer & -(__int64)(v14 != 0));
PoolWithTag = (char *)P;
v33 = 0;
goto LABEL_66;
}
}
}
if( v15 )
{
v22 = v8 - 11;
if( (unsigned int)v22 > 0x3D || (v23 = 0x2001800900000001i64, !_bittest64(&v23, v22)) )
{
if( PsIsCurrentThreadInServerSilo() )
{
IsAppContainerOrIdentifyLevelContext = -1073741637;
LODWORD(v88) = -1073741637;
InputBuffer = (VOID *)((unsigned __int64)InputBuffer & -(__int64)(v14 != 0));
PoolWithTag = (char *)P;
v33 = 0;
goto LABEL_66;
}
}
v24 = v8 - 38;
if( (unsigned int)v24 <= 0x39 && (v25 = 0x218000004422401i64, _bittest64(&v25, v24)) || v8 == 9 )
{
if( !PspIsContextAdmin() )
{
IsAppContainerOrIdentifyLevelContext = -1073741790;
LODWORD(v88) = -1073741790;
InputBuffer = (VOID *)((unsigned __int64)InputBuffer & -(__int64)(v14 != 0));
PoolWithTag = (char *)P;
v33 = 0;
goto LABEL_66;
}
}
v26 = v8 - 37;
if( (unsigned int)v26 > 0x3A || (v27 = 0x7AE005828F40BC3i64, !_bittest64(&v27, v26)) )
{
if( v8 - 2 > 1 && v8 != 11 )
{
v31 = (INT64)SeShutdownPrivilege;
if( v8 == 10 )
v31 = (INT64)SeCreatePagefilePrivilege;
v96 = v31;
if( !SeSinglePrivilegeCheck(v31, PreviousMode) )
{
IsAppContainerOrIdentifyLevelContext = -1073741727;
LODWORD(v88) = -1073741727;
InputBuffer = (VOID *)((unsigned __int64)InputBuffer & -(__int64)(v14 != 0));
PoolWithTag = (char *)P;
v33 = 0;
goto LABEL_66;
}
}
}
if( v14 )
{
v28 = (unsigned __int64)v15 + v14;
if( v28 > 0x7FFFFFFF0000i64 || v28 < (unsigned __int64)v15 )
MEMORY[0x7FFFFFFF0000] = 0;
}
v29 = v14;
if( v14 > 0x40 )
{
PoolWithTag = (char *)ExAllocatePoolWithTag(1ui64, v14, 544040269i64);
P = PoolWithTag;
v29 = v14;
if( !PoolWithTag )
{
IsAppContainerOrIdentifyLevelContext = -1073741670;
LODWORD(v88) = -1073741670;
InputBuffer = (VOID *)((unsigned __int64)InputBuffer & -(__int64)(v14 != 0));
v33 = 0;
goto LABEL_66;
}
}
else
{
PoolWithTag = v98;
P = v98;
}
memmove(PoolWithTag, v15, v29);
}
else
{
PoolWithTag = (char *)P;
}
if( v16 )
ProbeForWrite((UINT64)v16, HIDWORD(v83), 1i64);
LOBYTE(v12) = 0;
}
else
{
PoolWithTag = (char *)((unsigned __int64)InputBuffer & -(__int64)(v14 != 0));
P = PoolWithTag;
}
v34 = v8 - 38;
v35 = 0x3FFE3BE75BE26EDi64;
if( !_bittest64(&v35, v34) )
{
LABEL_74:
if( v8 > 0x1F || (LODWORD(v34) = -234812256, !_bittest((const int *)&v34, v8)) )
{
PopAcquirePolicyLock();
LOBYTE(v12) = 1;
LOBYTE(v83) = 1;
BYTE6(ReturnListLength) = 1;
}
}
v36 = 0x140000000ui64;
switch( (int)v34 )
{
case 0:
if( !PoolWithTag || v16 )
goto LABEL_215;
if( v14 == 8 )
{
v40 = PpmSetSimulatedLoad((PPROCESSOR_NUMBER)PoolWithTag);
goto LABEL_89;
}
if( v14 != 4 )
goto LABEL_263;
v40 = PpmClearSimulatedLoad((PROCESSOR_NUMBER *)PoolWithTag);
goto LABEL_89;
case 1:
if( !PoolWithTag || v16 || v14 != 24 )
goto LABEL_215;
v65 = ExAllocatePoolWithTag(0x200ui64, 0x18ui64, 544040269i64);
if( v65 )
{
*(_OWORD *)v65 = *(_OWORD *)PoolWithTag;
v65[2] = (VOID *)*((_QWORD *)PoolWithTag + 2);
if( !_InterlockedCompareExchange64((_QWORD *)&WheapErrorSourceTable + 120, (signed __int64)v65, 0i64) )
goto LABEL_119;
ExFreePoolWithTag(v65, 0x206D654Du);
IsAppContainerOrIdentifyLevelContext = -1073741823;
PoolWithTag = (char *)P;
}
else
{
IsAppContainerOrIdentifyLevelContext = -1073741670;
}
goto LABEL_64;
case 2:
if( !PoolWithTag || v14 != 4 || v16 )
goto LABEL_215;
LODWORD(Data) = *(_DWORD *)PoolWithTag != 0;
PopSetPowerSettingValueAcDc((_LPCGUID)&GUID_VIDEO_BRIGHTNESS_CAPABLE, 4ui64, &Data);
goto LABEL_58;
case 3:
if( PoolWithTag || !v16 || HIDWORD(v83) != 64 )
goto LABEL_215;
PopAcquireRwLockExclusive(&PopEsLock);
v56 = *(&stru_140CF2E80 + 1281);
PopReleaseRwLock(&PopEsLock);
Rate = ReturnHandle[1].Rate;
if( v56 == 1 )
Rate = 1;
LOBYTE(ReturnHandle[1].Rate) = Rate;
LOBYTE(ReturnHandle[1].DefaultAlert1) = TtmpEnabled == 1;
if( TtmpEnabled != 1 )
goto LABEL_187;
IsAppContainerOrIdentifyLevelContext = TtmInitCurrentSession();
InputBuffer = (VOID *)((unsigned __int64)InputBuffer & -(__int64)(v14 != 0));
if( IsAppContainerOrIdentifyLevelContext < 0 )
goto LABEL_65;
PopNotifySessionUserPowerRequestsPresent();
LABEL_187:
PopAcquirePolicyLock();
ReturnHandle[0].Rate = 0;
*(_QWORD *)&ReturnHandle[0].AcOnLine = &PopNoMoreInput;
*(_QWORD *)&ReturnHandle[0].MaxCapacity = &byte_140C502F8;
ReturnHandle[0].DefaultAlert1 = *(&stru_140C23628 + 1769) != 0;
ReturnHandle[0].DefaultAlert2 = *(&stru_140C23628 + 441);
ReturnHandle[0].EstimatedTime = *(&stru_140C23628 + 449);
*(_QWORD *)&ReturnHandle[1].AcOnLine = *(&stru_140C23628 + 225);
ReturnHandle[1].MaxCapacity = *(&stru_140C23628 + 452);
ReturnHandle[1].EstimatedTime = *(&stru_140C23628 + 453);
ReturnHandle[1].RemainingCapacity = *(&stru_140C23628 + 454);
BYTE1(ReturnHandle[1].Rate) = PopLidOpened;
ReturnList = ReturnHandle;
LODWORD(ReturnListLength) = 64;
ProcessSessionId = PsGetProcessSessionIdEx((INT64)KeGetCurrentThread()->ApcState.Process);
PopPrintEx(3ui64, (INT8 *)"PopAdaptive: Session %u is started\n");
PopDiagTraceSessionStates(&POP_ETW_ADPM_SESSION_CREATED, ProcessSessionId, 0i64);
PopReleasePolicyLock();
goto LABEL_119;
case 4:
if( !PoolWithTag || v14 != 16 || v16 )
goto LABEL_215;
if( PoolWithTag[13] && PoolWithTag[12] )
{
if( PopPlatformAoAc )
{
if( !dword_140C50478 && *((_DWORD *)PoolWithTag + 1) == 2 )
{
LODWORD(v81) = 0;
DbgkWerCaptureLiveKernelDump(
L"InvalidDisplayStateTransition",
0xA0ui64,
0x801ui64,
*((int *)PoolWithTag + 2),
*(unsigned int *)PoolWithTag,
0i64,
0i64,
0i64,
v81,
v82,
v83,
(const _GUID *)ReturnListLength,
ReturnList,
IsAppContainerContext,
(UINT64)P,
v88,
v89,
BufferSize,
*(UINT64 *)v91,
Data,
Flags[0]);
}
if( PopPlatformAoAc && *((_DWORD *)PoolWithTag + 1) != 2 )
PopProcessSessionDisplayStateChange(PoolWithTag[15], *((_DWORD *)PoolWithTag + 2));
}
PopSetDisplayStatus(*((_MONITOR_DISPLAY_STATE *)PoolWithTag + 1));
PopUpdateConsoleDisplayState(*((_MONITOR_DISPLAY_STATE *)PoolWithTag + 1));
if( *((_DWORD *)PoolWithTag + 1) == 1 )
PopPowerAggregatorNotifyDisplayPoweredOn();
}
v49 = PoolWithTag[14];
if( v49 )
{
if( PoolWithTag[12] )
{
LODWORD(FreeReturnBuffer) = 0;
LODWORD(ReturnBufferLength) = 0;
ZwUpdateWnfStateData(
&WNF_PO_PRIMARY_DISPLAY_VISIBLE_STATE,
PoolWithTag + 4,
4ui64,
0i64,
0i64,
(UINT64)ReturnBufferLength,
(UINT64)FreeReturnBuffer);
v49 = PoolWithTag[14];
}
if( v49 )
PopDiagTraceSessionDisplayStateChange(
*((_DWORD *)PoolWithTag + 1) == 0,
*(unsigned int *)PoolWithTag,
(unsigned __int8)PoolWithTag[12],
*((unsigned int *)PoolWithTag + 2));
}
goto LABEL_58;
case 5:
case 34:
if( !PoolWithTag || !v16 )
goto LABEL_215;
if( v14 != 40 )
goto LABEL_236;
v37 = HIDWORD(v83);
if( HIDWORD(v83) != 8 )
goto LABEL_236;
Info = PopPowerRequestCreateInfo(
(_COUNTED_REASON_CONTEXT *)PoolWithTag,
v8 == 72,
(VOID **)ReturnHandle,
0x140000000ui64,
(INT64)ReturnBuffer,
(INT64)ReturnBufferLength,
(INT64)FreeReturnBuffer,
(INT64)CallbackRoutine);
goto LABEL_130;
case 6:
if( !PoolWithTag || v16 )
goto LABEL_215;
if( v14 != 24 )
goto LABEL_236;
v43 = PopPowerRequestActionInfo((POWER_REQUEST_ACTION *)PoolWithTag);
goto LABEL_118;
case 7:
if( PoolWithTag || !v16 )
goto LABEL_215;
PowerRequestListInfo = PopGetPowerRequestListInfo(&ReturnList, &ReturnListLength);
goto LABEL_296;
case 8:
if( !PoolWithTag )
goto LABEL_215;
if( v14 < 2 )
goto LABEL_215;
if( !v16 )
goto LABEL_215;
v60 = *(_WORD *)PoolWithTag;
if( v60 >= KeQueryActiveGroupCount() )
goto LABEL_215;
InputBuffer = (VOID *)((unsigned __int64)InputBuffer & -(__int64)(v14 != 0));
IsAppContainerOrIdentifyLevelContext = PopProcessorInformation((__int64)ReturnHandle, v61, v60, &ReturnListLength);
if( IsAppContainerOrIdentifyLevelContext < 0 )
goto LABEL_65;
ReturnList = ReturnHandle;
goto LABEL_58;
case 9:
if( !PoolWithTag || v14 != 16 )
goto LABEL_215;
v59 = PopUmpoSendLegacyEvent((__int128 *)PoolWithTag);
IsAppContainerOrIdentifyLevelContext = v59;
if( v59 >= 0 )
goto LABEL_58;
InputBuffer = (VOID *)((unsigned __int64)InputBuffer & -(__int64)(v14 != 0));
if( v59 == -1073741536 )
goto LABEL_58;
goto LABEL_65;
case 10:
if( !(_BYTE)KdDebuggerEnabled )
goto LABEL_255;
if( !PoolWithTag || v16 )
goto LABEL_215;
if( v14 == 16 || v14 == 24 )
{
v40 = PpmParkApplyForcedMask((_GROUP_AFFINITY *)PoolWithTag);
goto LABEL_89;
}
if( v14 != 2 )
goto LABEL_263;
v40 = PpmParkClearForcedMask((UINT16 *)PoolWithTag);
goto LABEL_89;
case 11:
case 14:
case 15:
case 16:
case 41:
case 42:
case 43:
case 44:
goto LABEL_239;
case 12:
if( PoolWithTag || !v16 )
goto LABEL_215;
PowerRequestListInfo = ExGetWakeTimerList(&ReturnList, &ReturnListLength);
LABEL_296:
InputBuffer = (VOID *)((unsigned __int64)InputBuffer & -(__int64)(v14 != 0));
IsAppContainerOrIdentifyLevelContext = PowerRequestListInfo;
if( PowerRequestListInfo < 0 )
goto LABEL_65;
BYTE4(ReturnListLength) = 1;
goto LABEL_58;
case 13:
if( !PoolWithTag || !v16 )
goto LABEL_215;
if( v14 < 4 )
goto LABEL_236;
PopAcquireTransitionLock();
PopAcquirePolicyLock();
IsAppContainerOrIdentifyLevelContext = PopSetHiberFileSize(*(unsigned int *)PoolWithTag, (UINT64 *)v91);
PopReleasePolicyLock();
goto LABEL_249;
case 17:
if( !(_BYTE)KdDebuggerEnabled )
goto LABEL_255;
if( !PoolWithTag || v16 )
goto LABEL_215;
if( v14 == 8 )
{
v40 = PpmSetSimulatedIdle((__int64)PoolWithTag);
}
else
{
if( v14 != 4 )
{
LABEL_263:
IsAppContainerOrIdentifyLevelContext = -1073741811;
goto LABEL_90;
}
v40 = PpmClearSimulatedIdle((PROCESSOR_NUMBER *)PoolWithTag);
}
goto LABEL_89;
case 18:
if( !PoolWithTag || !v16 )
goto LABEL_215;
if( v14 != 8 )
goto LABEL_236;
v37 = HIDWORD(v83);
if( HIDWORD(v83) != 4 )
goto LABEL_236;
IsAppContainerOrIdentifyLevelContext = PpmParkSetLpiCap(
*(unsigned int *)PoolWithTag,
*((unsigned int *)PoolWithTag + 1),
(UINT64 *)&ReturnHandle[0].AcOnLine);
if( IsAppContainerOrIdentifyLevelContext < 0 )
goto LABEL_64;
ReturnList = ReturnHandle;
LODWORD(ReturnListLength) = 4;
goto LABEL_59;
case 19:
if( !ExVerifySuite(PhoneNT) )
{
LABEL_239:
IsAppContainerOrIdentifyLevelContext = -1073741822;
goto LABEL_64;
}
if( !PoolWithTag || v14 != 1 || v16 )
goto LABEL_215;
IsAppContainerOrIdentifyLevelContext = PopUserPresentOverride(*PoolWithTag);
if( IsAppContainerOrIdentifyLevelContext >= 0 )
goto LABEL_58;
goto LABEL_64;
case 20:
if( !v16 )
goto LABEL_215;
if( v15 && v14 != 20 || HIDWORD(v83) != 8 )
goto LABEL_236;
PopGetSettingNotificationName((_DEVICE_OBJECT *)PoolWithTag, v16);
goto LABEL_107;
case 21:
if( !PoolWithTag || !v16 )
goto LABEL_215;
if( v14 != 16 || HIDWORD(v83) < 4 )
goto LABEL_236;
SettingValue = PopGetSettingValue((const _GUID *)PoolWithTag, v16, HIDWORD(v83));
goto LABEL_107;
case 22:
if( !PoolWithTag || v16 )
goto LABEL_215;
if( v14 < 8 )
goto LABEL_236;
PopEnforceResiliencyScenarios((PPOWER_IDLE_RESILIENCY)PoolWithTag);
goto LABEL_58;
case 23:
if( !PoolWithTag )
goto LABEL_215;
if( v14 != 8 )
goto LABEL_215;
if( !v16 )
goto LABEL_215;
v37 = HIDWORD(v83);
if( HIDWORD(v83) != 8 )
goto LABEL_215;
v47 = PsGetProcessSessionIdEx((INT64)KeGetCurrentThread()->ApcState.Process);
PoolWithTag = (char *)P;
PopSessionInputChange((_DEVICE_OBJECT *)v47, (POWER_SESSION_RIT_STATE *)P, (POWER_SESSION_TIMEOUTS *)v16, v48);
goto LABEL_59;
case 24:
if( !PoolWithTag )
goto LABEL_215;
if( v14 != 2 )
goto LABEL_215;
if( !v16 )
goto LABEL_215;
v37 = HIDWORD(v83);
if( HIDWORD(v83) != 8 )
goto LABEL_215;
v51 = PsGetProcessSessionIdEx((INT64)KeGetCurrentThread()->ApcState.Process);
PopSessionConnectionChange((UINT64 *)v51, (_POWER_SESSION_CONNECT *)P, (_POWER_SESSION_TIMEOUTS *)v16, v52);
v54 = (unsigned int)PsGetProcessSessionIdEx((INT64)KeGetCurrentThread()->ApcState.Process);
PoolWithTag = (char *)P;
if( qword_140C54118 )
{
LOBYTE(v53) = *((_BYTE *)P + 1);
LOBYTE(v55) = *(_BYTE *)P;
qword_140C54118(v54, v53, v55);
}
goto LABEL_59;
case 25:
if( PoolWithTag || v16 )
goto LABEL_215;
v66 = PsGetProcessSessionIdEx((INT64)KeGetCurrentThread()->ApcState.Process);
PopPrintEx(3ui64, (INT8 *)"PopAdaptive: Session %u is closed\n");
PopDiagTraceSessionStates(&POP_ETW_ADPM_SESSION_CLOSED, v66, 0i64);
PopFreeSessionState(v66);
if( TtmpEnabled == 1 )
TtmCleanupCurrentSession();
goto LABEL_119;
case 26:
if( !PoolWithTag || v14 != 8 || v16 )
goto LABEL_215;
v62 = PsGetProcessSessionIdEx((INT64)KeGetCurrentThread()->ApcState.Process);
PoolWithTag = (char *)P;
PopSessionWinlogonNotification(v62, (POWER_SESSION_WINLOGON *)P);
goto LABEL_58;
case 27:
if( PsIsCurrentThreadInServerSilo() )
goto LABEL_138;
if( PoolWithTag || !v16 )
goto LABEL_215;
PopFilterCapabilities(
(_SYSTEM_POWER_CAPABILITIES *)&stru_140C23628 + 518,
(_SYSTEM_POWER_CAPABILITIES *)ReturnHandle);
if( BYTE2(ReturnHandle[0].Rate) )
PopReadHiberbootPolicy((_KNOWN_CONTROLLER_TYPE)((char *)&ReturnHandle[0].Rate + 2), v63, v64);
v46 = (SYSTEM_BATTERY_STATE *)((char *)&ReturnHandle[0].Rate + 2);
goto LABEL_136;
case 28:
if( PoolWithTag || !v16 )
goto LABEL_215;
IsDevicePotentialDripsConstraint = PopPlatformAoAc;
goto LABEL_135;
case 29:
if( !PoolWithTag || v14 != 184 || v16 && HIDWORD(v83) != 160 )
goto LABEL_215;
SettingValue = PopPdcInvocation((POWER_PDC_INPUT *)PoolWithTag, (POWER_PDC_OUTPUT *)&v16->Type);
goto LABEL_107;
case 30:
if( !PoolWithTag || v14 != 8 || v16 || HIDWORD(v83) )
goto LABEL_215;
IsAppContainerOrIdentifyLevelContext = 0;
v50 = *((_DWORD *)PoolWithTag + 1);
if( PopPlatformAoAc && *PoolWithTag )
{
PopAcquirePolicyLock();
if( PopIsInputSuppressionEngaged(v50) && (GUID *)PopWdiCurrentScenario != &NullGuid )
PopTraceMonitorOnRequestUserInput();
IsAppContainerOrIdentifyLevelContext = PopProcessSessionDisplayStateChange(1, v50);
PopReleasePolicyLock();
if( (!IsAppContainerOrIdentifyLevelContext || IsAppContainerOrIdentifyLevelContext == 259)
&& PopLastStandbyExitScenarioId != PopWdiCurrentScenarioInstanceId
&& !dword_140C50478 )
{
PopDiagTraceMonitorOnWithLidClosed();
PopLastStandbyExitScenarioId = PopWdiCurrentScenarioInstanceId;
LODWORD(FreeReturnBuffer) = 0;
LODWORD(ReturnBufferLength) = 0;
ZwUpdateWnfStateData(
&WNF_PO_MODERN_STANDBY_EXIT_INITIATED,
&PopWdiCurrentScenarioInstanceId,
8ui64,
0i64,
0i64,
(UINT64)ReturnBufferLength,
(UINT64)FreeReturnBuffer);
}
}
goto LABEL_64;
case 31:
if( PoolWithTag || v16 )
goto LABEL_215;
IsAppContainerOrIdentifyLevelContext = PopInitPlatformSettings();
*(&stru_140C23628 + 2092) = PopPlatformAoAc;
goto LABEL_64;
case 32:
*(&stru_140C23628 + 597) = KeQueryPerformanceCounter(0i64);
goto LABEL_58;
case 33:
if( !PoolWithTag || v14 != 8 || v16 && HIDWORD(v83) )
goto LABEL_215;
SettingValue = PopSuspendResumeInvocation((POWER_SUSPEND_RESUME *)PoolWithTag);
goto LABEL_107;
case 35:
case 50:
if( PoolWithTag || v16 )
goto LABEL_215;
v70 = MonitorRequestReasonThermalStandby;
if( v8 != 88 )
v70 = MonitorRequestReasonScreenOffRequest;
PopScreenOff(v70);
goto LABEL_63;
case 36:
if( BYTE5(ReturnListLength) )
goto LABEL_255;
if( !PoolWithTag || v14 != 16 || v16 || HIDWORD(v83) )
goto LABEL_215;
SettingValue = PopPdcCsDeviceNotification((PO_CS_DEVICE_NOTIFICATION *)PoolWithTag);
LABEL_107:
IsAppContainerOrIdentifyLevelContext = SettingValue;
goto LABEL_64;
case 37:
if( PoolWithTag || !v16 )
goto LABEL_215;
*(_DWORD *)&ReturnHandle[0].AcOnLine = PopCapturePlatformRole();
ReturnList = ReturnHandle;
LODWORD(ReturnListLength) = 4;
goto LABEL_58;
case 38:
if( PoolWithTag || !v16 )
goto LABEL_215;
*(_DWORD *)&ReturnHandle[0].AcOnLine = *(&stru_140C23628 + 120);
*(_LIST_ENTRY *)&ReturnHandle[0].MaxCapacity = *(_LIST_ENTRY *)((char *)&stru_140C23628 + 888);
if( *(&stru_140C23628 + 280) )
{
ReturnList = ReturnHandle;
LODWORD(ReturnListLength) = 24;
goto LABEL_58;
}
IsAppContainerOrIdentifyLevelContext = -1073741823;
goto LABEL_64;
case 39:
if( PoolWithTag || v16 )
goto LABEL_215;
v71 = *(&stru_140CF2E80 + 6570);
if( TtmpEnabled == 1 )
{
v72 = PsGetProcessSessionIdEx((INT64)KeGetCurrentThread()->ApcState.Process);
TtmNotifySessionDisplayBurst(v72, MonitorRequestReasonUserDisplayBurst);
LABEL_119:
PoolWithTag = (char *)P;
}
else
{
v73 = 0;
if( !PopLidOpened && !(_BYTE)PopConsoleExternalDisplayConnected )
v73 = 1;
if( !v73 )
PopEventCalloutDispatch(PsW32DisplayBurst, 6ui64);
if( !v71 )
{
LOBYTE(v10) = v73;
PopDiagTraceDisplayBurstWin32kCallout(
v35,
v12,
v10,
v36,
(INT64)ReturnBuffer,
(INT64)ReturnBufferLength,
(INT64)FreeReturnBuffer,
(INT64)CallbackRoutine,
v81);
}
}
goto LABEL_58;
case 40:
if( BYTE5(ReturnListLength) != 1 )
{
LABEL_255:
IsAppContainerOrIdentifyLevelContext = -1073741790;
goto LABEL_64;
}
if( v16 || HIDWORD(v83) )
goto LABEL_215;
if( PoolWithTag )
{
if( v14 != 4 )
goto LABEL_215;
PpmSetExitLatencySamplingPercentage((int *)PoolWithTag);
}
else
{
PpmClearExitLatencySamplingPercentage();
}
goto LABEL_58;
case 45:
if( PoolWithTag || !v16 )
goto LABEL_215;
PopCurrentPowerStatePrecise(ReturnHandle);
ReturnList = ReturnHandle;
LODWORD(ReturnListLength) = 32;
goto LABEL_58;
case 46:
if( !PoolWithTag || v16 )
goto LABEL_215;
if( v14 < 0x10 || v14 < 2 * (unsigned int)*((unsigned __int16 *)PoolWithTag + 6) + 14 )
goto LABEL_236;
v43 = PopThermalProcessUsermodeEvent((PACKED_THERMAL_EVENT *)PoolWithTag);
LABEL_118:
IsAppContainerOrIdentifyLevelContext = v43;
v41 = v43 < 0;
goto LABEL_91;
case 47:
v67 = *((_DWORD *)PoolWithTag + 2);
v68 = *(VOID **)PoolWithTag;
if( PoolWithTag[12] )
PoSetPowerRequestInternal(v68, v67);
else
PoClearPowerRequestInternal(v68, v67);
goto LABEL_58;
case 48:
if( !PoolWithTag || !v16 )
goto LABEL_215;
IsAppContainerOrIdentifyLevelContext = RtlStringCbLengthW((WCHAR *)PoolWithTag, v14, 0i64);
InputBuffer = (VOID *)((unsigned __int64)InputBuffer & -(__int64)(v14 != 0));
if( IsAppContainerOrIdentifyLevelContext < 0 )
goto LABEL_65;
IsAppContainerOrIdentifyLevelContext = PopBatteryDeviceState((wchar_t *)PoolWithTag, (__int64)ReturnHandle);
if( IsAppContainerOrIdentifyLevelContext < 0 )
goto LABEL_65;
ReturnList = ReturnHandle;
LODWORD(ReturnListLength) = 52;
goto LABEL_58;
case 49:
if( !PoolWithTag )
goto LABEL_215;
if( v14 < 8 )
goto LABEL_215;
v39 = *(_DWORD *)PoolWithTag;
if( (unsigned int)(*(_DWORD *)PoolWithTag - 68) <= 0xFBB || v39 >= 4107 )
goto LABEL_215;
if( (unsigned int)(v39 - 4096) <= 0xA )
{
if( !SeSinglePrivilegeCheck(*(_QWORD *)&SeShutdownPrivilege, SBYTE5(ReturnListLength))
&& !(unsigned __int8)PopCapabilityCheck(
L"terminalPowerManagement",
v74,
v75,
v76,
(INT64)ReturnBuffer,
(INT64)ReturnBufferLength,
(INT64)FreeReturnBuffer,
(INT64)CallbackRoutine) )
{
IsAppContainerOrIdentifyLevelContext = -1073741727;
goto LABEL_64;
}
TtmDispatchApi((INT64 *)(unsigned int)v39, PoolWithTag, v14, v16);
}
else
{
v40 = PopPowerInformationInternal(
(POWER_INFORMATION_LEVEL_INTERNAL)v39,
PoolWithTag,
v14,
v16,
&ReturnList,
&ReturnListLength,
(UINT8 *)&ReturnListLength + 4,
(INT64)CallbackRoutine);
}
LABEL_89:
IsAppContainerOrIdentifyLevelContext = v40;
LABEL_90:
v41 = IsAppContainerOrIdentifyLevelContext < 0;
LABEL_91:
InputBuffer = (VOID *)((unsigned __int64)InputBuffer & -(__int64)(v14 != 0));
if( v41 )
goto LABEL_65;
goto LABEL_58;
case 51:
if( !PoolWithTag || !v16 )
goto LABEL_215;
if( v14 < 4 )
goto LABEL_236;
PopAcquireTransitionLock();
PopAcquirePolicyLock();
IsAppContainerOrIdentifyLevelContext = PopSetHiberFileType(*(unsigned int *)PoolWithTag, (UINT64 *)v91);
PopReleasePolicyLock();
LABEL_249:
PopReleaseTransitionLock();
InputBuffer = (VOID *)((unsigned __int64)InputBuffer & -(__int64)(v14 != 0));
if( IsAppContainerOrIdentifyLevelContext < 0 )
goto LABEL_65;
ReturnList = v91;
LODWORD(ReturnListLength) = 8;
goto LABEL_58;
case 52:
if( !PoolWithTag || v14 < 4 || v16 )
goto LABEL_215;
PopUpdatePowerButtonHoldState(*(_DWORD *)PoolWithTag != 0);
goto LABEL_58;
case 53:
if( !PopPlatformAoAc )
{
LABEL_138:
IsAppContainerOrIdentifyLevelContext = -1073741637;
goto LABEL_64;
}
if( PoolWithTag && v14 == 336 && v16 )
{
IsDevicePotentialDripsConstraint = PopFxIsDevicePotentialDripsConstraint(PoolWithTag);
LABEL_135:
ReturnHandle[0].AcOnLine = IsDevicePotentialDripsConstraint;
v46 = ReturnHandle;
LABEL_136:
ReturnList = v46;
LODWORD(ReturnListLength) = 1;
LABEL_58:
v37 = HIDWORD(v83);
LABEL_59:
if( !ReturnList || !v16 )
goto LABEL_63;
if( v37 >= (unsigned int)ReturnListLength )
{
memmove(v16, ReturnList, ReturnListLength);
LABEL_63:
IsAppContainerOrIdentifyLevelContext = 0;
goto LABEL_64;
}
LABEL_236:
IsAppContainerOrIdentifyLevelContext = -1073741789;
}
else
{
LABEL_215:
IsAppContainerOrIdentifyLevelContext = -1073741811;
}
LABEL_64:
InputBuffer = v15;
LABEL_65:
v33 = (char)v83;
LABEL_66:
if( *(_QWORD *)&Flags[0]._bf_0 )
ExFreePoolWithTag(*(PVOID *)&Flags[0]._bf_0, 0);
if( BYTE4(ReturnListLength) )
ExFreePoolWithTag(ReturnList, 0x206D654Du);
if( v33 )
PopReleasePolicyLock();
if( PoolWithTag && PoolWithTag != InputBuffer && PoolWithTag != v98 )
ExFreePoolWithTag(PoolWithTag, 0x206D654Du);
return IsAppContainerOrIdentifyLevelContext;
case 54:
if( !PoolWithTag || !v16 )
goto LABEL_215;
if( v14 != 12 )
goto LABEL_236;
v37 = HIDWORD(v83);
if( HIDWORD(v83) != 8 )
goto LABEL_236;
Info = PopEtEnergyTrackerCreate((INT64 *)PoolWithTag, (VOID **)ReturnHandle);
LABEL_130:
InputBuffer = v15;
IsAppContainerOrIdentifyLevelContext = Info;
if( Info < 0 )
goto LABEL_65;
ReturnList = ReturnHandle;
LODWORD(ReturnListLength) = 8;
goto LABEL_59;
case 55:
if( !PoolWithTag || !v16 )
goto LABEL_215;
if( v14 != 8 )
goto LABEL_236;
v37 = HIDWORD(v83);
if( HIDWORD(v83) < 0xC )
goto LABEL_236;
IsAppContainerOrIdentifyLevelContext = PopEtEnergyTrackerQuery(*(VOID **)PoolWithTag, (INT64)v16, HIDWORD(v83));
InputBuffer = v15;
if( IsAppContainerOrIdentifyLevelContext >= 0 )
goto LABEL_59;
goto LABEL_65;
case 56:
if( !PoolWithTag || v16 || HIDWORD(v83) )
goto LABEL_215;
if( v14 != 32 )
goto LABEL_236;
LOBYTE(v12) = BYTE5(ReturnListLength);
IsAppContainerOrIdentifyLevelContext = PopBlackBoxUpdate((INT64)PoolWithTag, v12);
InputBuffer = v15;
if( IsAppContainerOrIdentifyLevelContext < 0 )
goto LABEL_65;
goto LABEL_58;
case 57:
if( !PoolWithTag || v14 != 1 || v16 )
goto LABEL_215;
ExNotifyCallback(PipCslCallbackObject, PoolWithTag, 0i64);
goto LABEL_58;
default:
goto LABEL_74;
}
}Referenced by:
IoInitSystemPreDrivers
PnpRecordBlackboxDelayedRemoveWorkerInformation
PnpRecordBlackboxDeviceCompletionQueueInformation
PnpRecordBlackboxPnpEventInformation
PnpRecordBlackboxPnpEventWorkerInformation
PopRecordPepWorkorderBlackboxInformation
PopRecordPoIrpBlackboxInformation
PopRecordPowerWatchdogBlackboxInformation
TtmpCalloutArmWatchdog
TtmpCalloutCreateWatchdog
TtmpCalloutDestroyWatchdog
WheaLogInternalEvent