PopRegisterCoolingExtensionProtection
__int64 __fastcall PopRegisterCoolingExtensionProtection(PVOID Context){
PVOID *NotificationEntry;
bool v3;
NTSTATUS DeviceProperty;
_DEVICE_OBJECT *DeviceAttachmentBaseRef;
void *PoolWithTag;
WCHAR v7;
struct _UNICODE_STRING DestinationString;
ULONG BufferLength;
PFILE_OBJECT FileObject;
PDEVICE_OBJECT DeviceObject;
BufferLength = 0;
NotificationEntry = (PVOID *)((char *)Context + 56);
DeviceObject = 0i64;
FileObject = 0i64;
v3 = *((_QWORD *)Context + 7) == 0i64;
DestinationString = 0i64;
if( v3 )
{
DeviceAttachmentBaseRef = IoGetDeviceAttachmentBaseRef(*((_DEVICE_OBJECT **)Context + 6));
if( IoGetDeviceProperty(DeviceAttachmentBaseRef, DevicePropertyPhysicalDeviceObjectName, 0, 0i64, &BufferLength) == -1073741789 )
{
PoolWithTag = ExAllocatePoolWithTag(PagedPool, BufferLength, 0x6C6F4350ui64);
if( PoolWithTag )
{
DeviceProperty = IoGetDeviceProperty(
DeviceAttachmentBaseRef,
DevicePropertyPhysicalDeviceObjectName,
BufferLength,
PoolWithTag,
&BufferLength);
if( DeviceProperty >= 0 )
{
RtlInitUnicodeString(&DestinationString, (PCWSTR)PoolWithTag, v7);
DeviceProperty = IoGetDeviceObjectPointer(&DestinationString, 0x1F01FFui64, &FileObject, &DeviceObject);
if( DeviceProperty >= 0 )
DeviceProperty = IoRegisterPlugPlayNotification(
EventCategoryTargetDeviceChange,
0,
FileObject,
*((PDRIVER_OBJECT *)DeviceObject + 1),
(PDRIVER_NOTIFICATION_CALLBACK_ROUTINE)PopCoolingExtensionPnpNotification,
Context,
NotificationEntry);
if( FileObject )
HalPutDmaAdapter((PADAPTER_OBJECT)FileObject);
}
ExFreePoolWithTag(PoolWithTag, 0x6C6F4350u);
}
else
{
DeviceProperty = -1073741670;
}
}
else
{
DeviceProperty = -1073741823;
}
if( DeviceAttachmentBaseRef )
HalPutDmaAdapter((PADAPTER_OBJECT)DeviceAttachmentBaseRef);
}
else
{
return 0;
}
return(unsigned int)DeviceProperty;
}Referenced by:
PopAssociateThermalRequest