IoReportHalResourceUsage
NTSTATUS __stdcall IoReportHalResourceUsage(
_UNICODE_STRING *HalName,
_CM_RESOURCE_LIST *RawResourceList,
_CM_RESOURCE_LIST *TranslatedResourceList,
UINT64 ResourceListSize){
UINT64 v4;
int v8;
NTSTATUS v9;
_CM_RESOURCE_LIST *v10;
int v11;
_CM_RESOURCE_LIST *v12;
_CM_RESOURCE_LIST *v13;
int v14;
VOID **PoolWithTag;
UINT64 CreateOptions;
UINT64 *Disposition;
UINT64 *Dispositiona;
UINT64 NewListSize;
PVOID Handle;
_CM_RESOURCE_LIST *NewList;
_CM_RESOURCE_LIST *ResourceList;
_UNICODE_STRING DeviceName;
_UNICODE_STRING DestinationString;
v4 = (unsigned int)ResourceListSize;
Handle = 0i64;
NewList = 0i64;
NewListSize = 0i64;
ResourceList = 0i64;
DestinationString = 0i64;
DeviceName = 0i64;
RtlInitUnicodeString(&DestinationString, L"Hardware Abstraction Layer");
LODWORD(CreateOptions) = 1;
v8 = IopCreateRegistryKeyEx(
&Handle,
0i64,
&CmRegistryMachineHardwareResourceMapName,
0x2001Fui64,
CreateOptions,
0i64);
if( v8 >= 0 )
{
RtlInitUnicodeString(&DeviceName, L".Raw");
v9 = HeadlessTerminalAddResources(RawResourceList, v4, 0, &NewList, &NewListSize);
v10 = NewList;
v8 = v9;
if( v9 >= 0 )
{
v11 = v4;
if( NewList )
v11 = NewListSize;
v12 = RawResourceList;
LODWORD(Disposition) = v11;
if( NewList )
v12 = NewList;
v8 = IopWriteResourceList(Handle, &DestinationString, HalName, &DeviceName, v12, (UINT64)Disposition);
if( v8 >= 0 )
{
RtlInitUnicodeString(&DeviceName, L".Translated");
v8 = HeadlessTerminalAddResources(
TranslatedResourceList,
v4,
1u,
&ResourceList,
(UINT64 *)((char *)&NewListSize + 4));
if( v8 >= 0 )
{
v13 = ResourceList;
v14 = v4;
if( ResourceList )
v14 = HIDWORD(NewListSize);
if( ResourceList )
TranslatedResourceList = ResourceList;
LODWORD(Dispositiona) = v14;
v8 = IopWriteResourceList(
Handle,
&DestinationString,
HalName,
&DeviceName,
TranslatedResourceList,
(UINT64)Dispositiona);
if( v13 )
ExFreePoolWithTag(v13, 0);
}
}
}
ZwClose((_HANDLE)Handle);
if( v8 < 0 )
{
if( v10 )
ExFreePoolWithTag(v10, 0);
}
else if( v10 )
{
IopInitHalResources = v10;
}
else
{
PoolWithTag = ExAllocatePoolWithTag(1ui64, v4, 538996816i64);
IopInitHalResources = PoolWithTag;
if( PoolWithTag )
memmove(PoolWithTag, RawResourceList, v4);
else
return -1073741670;
}
}
return v8;
}Referenced by:
HalpReportResourceUsage