CmGetDeviceInterfaceRegKeyPath
__int64 __fastcall CmGetDeviceInterfaceRegKeyPath(
__int64 a1,
const WCHAR *a2,
int a3,
int a4,
int a5,
__int64 a6,
size_t cchDest,
__int64 a8){
__int16 v9;
wchar_t *v11;
unsigned int v12;
char v13;
__int64 v14;
__int64 v15;
unsigned __int64 v16;
wchar_t *PoolWithTag;
__int64 v18;
int DeviceInterfaceSubkeyPath;
WCHAR **v20;
int v21;
__int64 v22;
__int64 v23;
unsigned __int64 v24;
int v25;
__int64 v27;
WCHAR **v28;
__int64 v29;
UINT64 *dwFlags;
UINT64 *dwFlagsa;
NTSTRSAFE_PCWSTR pszFormat;
NTSTRSAFE_PCWSTR pszFormata;
__int16 v34[40];
v9 = a3;
v11 = 0i64;
if( !a3 || (a3 & 0xFFFFFCCC) != 0 )
goto LABEL_54;
v12 = (unsigned __int8)a3;
if( (((unsigned __int8)a3 - 48) & 0xFFFFFFFD) != 0 )
{
if( (unsigned __int8)a3 != 49 )
return(unsigned int)-1073741811;
v13 = 0;
}
else
{
v13 = 1;
}
v14 = -1i64;
v15 = -1i64;
do
++v15;
while( a2[v15] );
v16 = 2 * v15 + 6;
if( v16 > 0xFFFFFFFF )
return(unsigned int)-1073741675;
PoolWithTag = (wchar_t *)ExAllocatePoolWithTag(PagedPool, (unsigned int)v16, 0x52504E50ui64);
v11 = PoolWithTag;
if( !PoolWithTag )
return(unsigned int)-1073741801;
DeviceInterfaceSubkeyPath = CmGetDeviceInterfaceSubkeyPath(
v18,
a2,
v13,
(wchar_t *)v34,
PoolWithTag,
(unsigned int)v16 >> 1);
if( DeviceInterfaceSubkeyPath < 0 )
goto LABEL_27;
v21 = v9 & 0x200;
if( !v21 )
{
v22 = -1i64;
do
++v22;
while( v34[v22] );
v23 = v22 + 48;
goto LABEL_14;
}
if( !a4 )
{
v27 = -1i64;
do
++v27;
while( v34[v27] );
v23 = v27 + 99;
goto LABEL_14;
}
if( a4 == -1 )
{
LABEL_54:
DeviceInterfaceSubkeyPath = -1073741811;
goto LABEL_27;
}
v29 = -1i64;
do
++v29;
while( v34[v29] );
v23 = v29 + 96;
do
LABEL_14:
++v14;
while( v11[v14] );
v24 = v23 + v14 + 1;
if( v12 < 0x30 )
goto LABEL_51;
if( v12 <= 0x31 )
goto LABEL_17;
if( v12 == 50 )
v24 += 18i64;
else
LABEL_51:
DeviceInterfaceSubkeyPath = -1073741811;
LABEL_17:
if( DeviceInterfaceSubkeyPath >= 0 )
{
if( v24 > 0xFFFFFFFF )
{
DeviceInterfaceSubkeyPath = -1073741675;
}
else
{
DeviceInterfaceSubkeyPath = 0;
if( a8 )
*(_DWORD *)a8 = v24;
if( (unsigned int)v24 <= (unsigned int)cchDest )
{
if( v21 )
{
if( a4 )
{
if( a4 == -1 )
goto LABEL_25;
LODWORD(dwFlags) = 2048;
RtlStringCchPrintfExW(
(WCHAR *)a6,
(unsigned int)cchDest,
0i64,
0i64,
(UINT64)dwFlags,
L"%s\\%04u\\%s\\%s\\%s");
}
else
{
LODWORD(dwFlags) = 2048;
RtlStringCchPrintfExW((WCHAR *)a6, (unsigned int)cchDest, 0i64, 0i64, (UINT64)dwFlags, L"%s\\%s\\%s\\%s");
}
}
else
{
LODWORD(dwFlags) = 2048;
RtlStringCchPrintfExW(
(WCHAR *)a6,
(unsigned int)cchDest,
0i64,
0i64,
(UINT64)dwFlags,
(const WCHAR *)L"%s\\%s\\%s");
}
DeviceInterfaceSubkeyPath = v25;
LABEL_25:
if( DeviceInterfaceSubkeyPath >= 0 && v12 == 50 )
{
DeviceInterfaceSubkeyPath = RtlStringCchCatExW(
(WCHAR *)a6,
(unsigned int)cchDest,
L"\\",
v20,
dwFlags,
(UINT64)pszFormat);
if( DeviceInterfaceSubkeyPath >= 0 )
DeviceInterfaceSubkeyPath = RtlStringCchCatExW(
(WCHAR *)a6,
(unsigned int)cchDest,
L"Device Parameters",
v28,
dwFlagsa,
(UINT64)pszFormata);
}
goto LABEL_27;
}
DeviceInterfaceSubkeyPath = -1073741789;
}
}
LABEL_27:
if( v11 )
ExFreePoolWithTag(v11, 0);
return(unsigned int)DeviceInterfaceSubkeyPath;
}Referenced by:
CmDeleteDeviceInterfaceRegKeyWorker
CmOpenDeviceInterfaceRegKeyWorker
PiDqGetRelativeObjectRegPath