PopTriggerMonitorPowerEvent
INT64 __stdcall PopTriggerMonitorPowerEvent(CHAR cl0, INT64 a2){
int v3;
__int64 v4;
char *i;
unsigned int v6;
__int64 v7;
__int64 *j;
__int64 *v9;
__int64 v10;
__int64 v11;
__int64 v12;
EVENT_DESCRIPTOR *v13;
INT64 v14;
INT64 a2a;
LODWORD(a2a) = 0;
if( PopPlatformAoAc )
{
v4 = 0i64;
for( i = PopMonitorEventMapping; *(_DWORD *)i != (_DWORD)a2; i += 8 )
{
v4 = (unsigned int)(v4 + 1);
if( (unsigned int)v4 >= 0x33 )
return(unsigned int)-1073741811;
}
v6 = *(_DWORD *)&PopMonitorEventMapping[8 * v4 + 4];
if( !v6 )
return(unsigned int)-1073741811;
v7 = 0i64;
for( j = PopPowerEventTable; *(_DWORD *)j != v6; j += 6 )
{
v7 = (unsigned int)(v7 + 1);
if( (unsigned int)v7 >= 0x30 )
return(unsigned int)-1073741823;
}
v9 = &PopPowerEventTable[6 * v7];
if( !v9 )
return(unsigned int)-1073741823;
PopAcquireRwLockExclusive(&PopPowerEventLock);
LOBYTE(v10) = cl0;
v3 = ((__int64(__fastcall *)(__int64, INT64 *))v9[3])(v10, &a2a);
v11 = *(_QWORD *)&KUSER_SHARED_DATA.InterruptTime.LowPart;
v12 = (unsigned int)PopPowerEventTraceCount;
++v9[4];
v9[5] = v11;
v13 = (EVENT_DESCRIPTOR *)(3 * v12);
LODWORD(PopPowerEventTrace[(_QWORD)v13]) = v6;
PopPowerEventTraceCount = ((_BYTE)v12 + 1) & 0x1F;
v14 = (unsigned int)a2a;
LODWORD(PopPowerEventTrace[(_QWORD)v13 + 1]) = a2a;
HIDWORD(PopPowerEventTrace[(_QWORD)v13]) = v3;
PopPowerEventTrace[(_QWORD)v13 + 2] = v11;
if( v3 >= 0 )
{
PopDiagTracePowerStateEvent(v6, v14, v13);
if( (_DWORD)a2a )
v3 = PopPowerAggregatorHandleIntent((unsigned int)a2a, *((unsigned int *)v9 + 4), *(unsigned int *)v9);
}
PopReleaseRwLock((UINT64)&PopPowerEventLock);
}
else
{
return(unsigned int)-1073741637;
}
return(unsigned int)v3;
}Referenced by:
PoTtmInitiatePowerStateTransition
PopProcessSessionDisplayStateChange