PiBuildDeviceNodeInstancePath
NTSTATUS __stdcall PiBuildDeviceNodeInstancePath(
_DEVICE_NODE *DeviceNode,
WCHAR *BusID,
WCHAR *DeviceID,
WCHAR *InstanceID){
wchar_t *v8;
__int64 v9;
__int64 v10;
__int64 v11;
int v12;
UINT64 v13;
VOID **PoolWithTag;
int v15;
wchar_t *Buffer;
v8 = 0i64;
if( BusID && DeviceID && InstanceID )
{
if( DeviceNode->InstancePath.Buffer && ((DeviceNode->Flags & 0x2000) == 0 || DeviceNode->Problem != 42) )
PnpCleanupDeviceRegistryValues(&DeviceNode->InstancePath);
v9 = -1i64;
v10 = -1i64;
do
++v10;
while( BusID[v10] );
v11 = -1i64;
do
++v11;
while( DeviceID[v11] );
v12 = v11 + v10;
do
++v9;
while( InstanceID[v9] );
v13 = (unsigned int)(2 * (v9 + v12) + 6);
PoolWithTag = ExAllocatePoolWithTag(0x200ui64, v13, 1232105040i64);
v8 = (wchar_t *)PoolWithTag;
if( !PoolWithTag )
return -1073741670;
v15 = RtlStringCbPrintfW((WCHAR *)PoolWithTag, (unsigned int)v13, (WCHAR *)L"%s\\%s\\%s");
if( v15 >= 0 )
{
Buffer = DeviceNode->InstancePath.Buffer;
if( !Buffer || wcsicmp(Buffer, v8) )
{
PnpFreeDeviceInstancePath((__int64)DeviceNode);
RtlInitUnicodeString(&DeviceNode->InstancePath, v8);
return v15;
}
}
}
else
{
v15 = -1073741823;
}
if( v8 )
ExFreePoolWithTag(v8, 0x49706E50u);
return v15;
}Referenced by:
PiProcessNewDeviceNode