PopUmpoInitializeChannel
NTSTATUS __stdcall PopUmpoInitializeChannel(){
int v0;
unsigned int v1;
VOID **PoolWithTag;
UINT64 v3;
_ACL *v4;
int Acl;
PCALLBACK_OBJECT v6;
PCALLBACK_OBJECT ObjectAttributes[7];
__int128 PortInformation;
_UNICODE_STRING DestinationString;
__int128 SecurityDescriptor[2];
__int64 v12;
_ALPC_PORT_ATTRIBUTES PortAttributes;
memset(&PortAttributes, 0i64, sizeof(PortAttributes));
PopAlpcServerPort = 0i64;
PopAlpcClientPort = 0i64;
*(_QWORD *)&PopUmpoPushLock = 0i64;
memset(ObjectAttributes, 0, sizeof(ObjectAttributes));
v12 = 0i64;
PopUmpoAlpcClientConnected = 0;
DestinationString = 0i64;
memset(SecurityDescriptor, 0, sizeof(SecurityDescriptor));
v0 = *((unsigned __int8 *)SeLocalSystemSid + 1);
PortInformation = 0i64;
v1 = 4 * v0 + 28;
PoolWithTag = ExAllocatePoolWithTag(0x200ui64, v1, 1869638997i64);
v4 = (_ACL *)PoolWithTag;
if( !PoolWithTag )
return -1073741670;
Acl = RtlCreateAcl((PACL)PoolWithTag, (_ACL)v1, 2ui64, v3);
if( Acl >= 0 )
{
Acl = RtlAddAccessAllowedAce(v4, 2ui64, 0x10000000, SeLocalSystemSid);
if( Acl >= 0 )
{
Acl = RtlCreateSecurityDescriptor(SecurityDescriptor, 1ui64);
if( Acl >= 0 )
{
Acl = RtlSetDaclSecurityDescriptor(SecurityDescriptor, 1u, v4, 0);
if( Acl >= 0 )
{
RtlInitUnicodeString(&DestinationString, L"\\PowerPort");
ObjectAttributes[2] = 0i64;
ObjectAttributes[6] = 0i64;
ObjectAttributes[3] = (PCALLBACK_OBJECT)&DestinationString;
PortAttributes.MaxMessageLength = 4096i64;
ObjectAttributes[5] = (PCALLBACK_OBJECT)SecurityDescriptor;
PortAttributes.Flags = 0x100000;
LODWORD(ObjectAttributes[1]) = 48;
LODWORD(ObjectAttributes[4]) = 512;
Acl = ZwAlpcCreatePort(
(VOID **)&PopAlpcServerPort,
(_OBJECT_ATTRIBUTES *)&ObjectAttributes[1],
&PortAttributes);
if( Acl >= 0 )
{
ObjectAttributes[2] = 0i64;
ObjectAttributes[3] = 0i64;
LODWORD(ObjectAttributes[1]) = 48;
LODWORD(ObjectAttributes[4]) = 512;
*(_OWORD *)&ObjectAttributes[5] = 0i64;
Acl = ExCreateCallback(ObjectAttributes, (POBJECT_ATTRIBUTES)&ObjectAttributes[1], 1u, 0);
if( Acl >= 0 )
{
v6 = ObjectAttributes[0];
if( ExRegisterCallback(ObjectAttributes[0], PopUmpoMessageCallback, 0i64) )
{
PortInformation = (unsigned __int64)v6;
Acl = ZwAlpcSetInformation(
(VOID *)PopAlpcServerPort,
AlpcRegisterCallbackInformation,
&PortInformation,
0x10ui64);
ObfDereferenceObjectWithTag(v6, 0x746C6644ui64);
if( Acl >= 0 )
{
PopUmpoProcessMessages();
Acl = 0;
}
}
else
{
Acl = -1073741670;
}
}
}
}
}
}
}
ExFreePoolWithTag(v4, 0);
return Acl;
}Referenced by:
PoInitSystem