PipUpdateDeviceProducts
VOID __stdcall PipUpdateDeviceProducts(VOID *a1){
unsigned int v1;
void *v2;
VOID **v3;
WCHAR *v4;
VOID **v5;
HPNPCTX *v6;
INT64 v7;
INT64 v8;
int v9;
__int64 v10;
unsigned int v11;
unsigned int v12;
ULONG v13;
int v14;
VOID **v15;
ULONG v16;
NTSTATUS v17;
int v18;
HPNPCTX *v19;
HPNPCTX *v20;
unsigned int *DesiredAccess;
INT64 a6;
INT64 a6a;
INT64 a7;
INT64 a8;
INT64 v26;
UINT64 RegType;
VOID **v28;
PVOID P;
_HANDLE v30[2];
unsigned int v31;
_DWORD pSecurityDescriptor[3];
_LARGE_INTEGER BootTime;
INT64 v34;
unsigned int v35;
INT64 a5;
_HANDLE v37[2];
INT64 PoolWithTag;
UINT64 BootTimeBias;
wchar_t Str1[8];
v1 = 0;
P = a1;
v2 = a1;
BootTime.QuadPart = 0i64;
BootTimeBias = 0i64;
v3 = 0i64;
v34 = 0i64;
v4 = 0i64;
*(_QWORD *)v30 = 0i64;
PoolWithTag = 0i64;
v5 = 0i64;
*(_QWORD *)v37 = 0i64;
LODWORD(v26) = 0;
v31 = 0;
memset(pSecurityDescriptor, 0, sizeof(pSecurityDescriptor));
v35 = 0;
a5 = 0i64;
LODWORD(RegType) = 0;
v28 = 0i64;
if( PnpCtxGetCachedContextBaseKey(
*(&stru_140CF2E80 + 607),
PNPCTX_BASE_KEY_TYPE_MAX|PNPCTX_BASE_KEY_TYPE_SOFTWARE,
(VOID **)&PoolWithTag) < 0
|| (LODWORD(DesiredAccess) = 131097,
PnpCtxRegOpenKey(
0i64,
(VOID *)PoolWithTag,
(WCHAR *)L"Current\\ProductIds",
0i64,
(UINT64)DesiredAccess,
(VOID **)v37) == -1073741772)
|| (LODWORD(a6) = 0,
RtlGetPersistedStateLocation(
(WCHAR *)L"DynamicInstalledProducts",
0i64,
L"\\Registry\\Machine\\Software\\Microsoft\\Windows NT\\CurrentVersion\\Update\\TargetingInfo\\DynamicInstalled",
0i64,
0i64,
a6,
(INT64)&v26) != -2147483643) )
{
v15 = 0i64;
goto LABEL_36;
}
v9 = v26;
PoolWithTag = (INT64)ExAllocatePoolWithTag(1ui64, (unsigned int)v26, 1852403792i64);
v4 = (WCHAR *)PoolWithTag;
if( !PoolWithTag )
goto LABEL_72;
LODWORD(a6) = v9;
if( RtlGetPersistedStateLocation(
(WCHAR *)L"DynamicInstalledProducts",
0i64,
L"\\Registry\\Machine\\Software\\Microsoft\\Windows NT\\CurrentVersion\\Update\\TargetingInfo\\DynamicInstalled",
0i64,
(VOID *)PoolWithTag,
a6,
(INT64)&v26) < 0 )
goto LABEL_72;
LODWORD(DesiredAccess) = 131103;
if( PnpCtxRegCreateTree(0i64, 0i64, v4, 0i64, (UINT64)DesiredAccess, 0i64, (VOID **)&v34, 0i64) )
goto LABEL_72;
KeQueryBootTimeValues((_LARGE_INTEGER *)&v26, &BootTime, &BootTimeBias);
BootTime.QuadPart -= BootTimeBias;
if( (unsigned int)PnpCtxRegQueryInfoKey(v10, (VOID *)v34, &v35, &v31, 0i64, 0i64, 0i64) )
goto LABEL_72;
v11 = v35;
if( !v35 )
goto LABEL_22;
v12 = v31 + 1;
v5 = ExAllocatePoolWithTag(1ui64, 2i64 * (v31 + 1), 1852403792i64);
if( !v5 )
{
LABEL_72:
v15 = 0i64;
goto LABEL_35;
}
if( !v11 )
goto LABEL_22;
do
{
v31 = v12;
if( *(_QWORD *)v30 )
{
PnpCtxRegCloseKey(v6, *(VOID **)v30, v7, v8, (INT64)DesiredAccess, a6, a7, a8);
*(_QWORD *)v30 = 0i64;
}
DesiredAccess = &v31;
if( PnpCtxRegEnumKey(v6, v34, (WCHAR *)v1, (UINT64 *)v5) >= 0 )
{
LODWORD(DesiredAccess) = 131103;
if( PnpCtxRegOpenKey(0i64, (VOID *)v34, (WCHAR *)v5, 0i64, (UINT64)DesiredAccess, (VOID **)v30) >= 0 )
{
LODWORD(v26) = 14;
if( PnpCtxRegQueryValue(v6, *(VOID **)v30, (WCHAR *)L"Source", &RegType, Str1, (UINT64 *)&v26) >= 0
&& (_DWORD)RegType == 1
&& (_DWORD)v26 == 14
&& !wcsicmp(Str1, L"SMBIOS") )
{
LODWORD(v26) = 0;
if( PnpCtxRegQueryValue(v6, *(VOID **)v37, (WCHAR *)v5, 0i64, 0i64, (UINT64 *)&v26) == -1073741772 )
{
if( v3 )
{
ExFreePoolWithTag(v3, 0);
v3 = 0i64;
}
LODWORD(v26) = 0;
v17 = PnpCtxRegQueryValue(v6, *(VOID **)v30, (WCHAR *)L"Version", &RegType, v3, (UINT64 *)&v26);
if( v17 == -1073741789 )
{
v18 = v26;
v3 = ExAllocatePoolWithTag(1ui64, (unsigned int)v26, 1852403792i64);
if( !v3 )
{
LABEL_66:
LODWORD(a6) = 8;
PnpCtxRegSetValue(v6, *(VOID **)v30, (WCHAR *)L"DeactivationTime", 3ui64, &BootTime, a6);
if( v3 )
{
LODWORD(a6) = v18;
PnpCtxRegSetValue(v19, *(VOID **)v30, (WCHAR *)L"DeactivationVersion", 1ui64, v3, a6);
}
PnpCtxRegDeleteValue(v19, *(VOID **)v30, (WCHAR *)L"Version");
goto LABEL_20;
}
v17 = PnpCtxRegQueryValue(v6, *(VOID **)v30, (WCHAR *)L"Version", &RegType, v3, (UINT64 *)&v26);
}
if( v17 == -1073741772 )
goto LABEL_20;
v18 = v26;
if( (v17 < 0 || (_DWORD)RegType != 1 || (unsigned int)v26 < 2) && v3 )
{
ExFreePoolWithTag(v3, 0);
v3 = 0i64;
}
goto LABEL_66;
}
}
}
}
LABEL_20:
++v1;
}
while( v1 < v11 );
v4 = (WCHAR *)PoolWithTag;
LABEL_22:
if( (unsigned int)PnpCtxRegQueryInfoKey((__int64)v6, *(VOID **)v37, 0i64, 0i64, &a5, pSecurityDescriptor, 0i64)
|| (v13 = a5) == 0 )
{
v15 = v28;
}
else
{
v14 = pSecurityDescriptor[0] + 1;
v15 = ExAllocatePoolWithTag(1ui64, 2i64 * (unsigned int)(pSecurityDescriptor[0] + 1), 1852403792i64);
if( v15 )
{
v16 = 0;
if( v13 )
{
do
{
pSecurityDescriptor[0] = v14;
if( *(_QWORD *)&pSecurityDescriptor[1] )
{
PnpCtxRegCloseKey(v6, *(VOID **)&pSecurityDescriptor[1], v7, v8, (INT64)DesiredAccess, a6, a7, a8);
*(_QWORD *)&pSecurityDescriptor[1] = 0i64;
}
a8 = 0i64;
if( PnpCtxRegEnumValue((__int64)v6, v37[0], v16, v15, (INT64)pSecurityDescriptor, 0i64, 0i64) >= 0 )
{
LODWORD(DesiredAccess) = 131078;
if( PnpCtxRegCreateKey(
0i64,
(VOID *)v34,
(WCHAR *)v15,
0i64,
(UINT64)DesiredAccess,
0i64,
(VOID **)&pSecurityDescriptor[1],
(UINT64 *)((char *)&a5 + 4)) >= 0 )
{
if( HIDWORD(a5) == 1 )
{
LODWORD(a6) = 8;
PnpCtxRegSetValue(v6, *(VOID **)&pSecurityDescriptor[1], (WCHAR *)L"CreationTime", 3ui64, &BootTime, a6);
}
LODWORD(v26) = 0;
if( PnpCtxRegQueryValue(
v6,
*(VOID **)&pSecurityDescriptor[1],
(WCHAR *)L"Version",
0i64,
0i64,
(UINT64 *)&v26) == -1073741772 )
{
LODWORD(a6) = 16;
if( PnpCtxRegSetValue(
v6,
*(VOID **)&pSecurityDescriptor[1],
(WCHAR *)L"Version",
1ui64,
L"0.0.0.0",
a6) >= 0 )
{
LODWORD(a6) = 8;
PnpCtxRegSetValue(
v6,
*(VOID **)&pSecurityDescriptor[1],
(WCHAR *)L"ActivationTime",
3ui64,
&BootTime,
a6);
LODWORD(a6a) = 14;
PnpCtxRegSetValue(
v20,
*(VOID **)&pSecurityDescriptor[1],
(WCHAR *)L"Source",
1ui64,
(VOID *const)L"SMBIOS",
a6a);
}
}
}
}
++v16;
}
while( v16 < v13 );
v4 = (WCHAR *)PoolWithTag;
}
}
}
LABEL_35:
v2 = P;
LABEL_36:
if( *(_QWORD *)&pSecurityDescriptor[1] )
PnpCtxRegCloseKey(v6, *(VOID **)&pSecurityDescriptor[1], v7, v8, (INT64)DesiredAccess, a6, a7, a8);
if( *(_QWORD *)v37 )
PnpCtxRegCloseKey(v6, *(VOID **)v37, v7, v8, (INT64)DesiredAccess, a6, a7, a8);
if( *(_QWORD *)v30 )
PnpCtxRegCloseKey(v6, *(VOID **)v30, v7, v8, (INT64)DesiredAccess, a6, a7, a8);
if( v34 )
PnpCtxRegCloseKey(v6, (VOID *)v34, v7, v8, (INT64)DesiredAccess, a6, a7, a8);
if( v15 )
ExFreePoolWithTag(v15, 0);
if( v5 )
ExFreePoolWithTag(v5, 0);
if( v3 )
ExFreePoolWithTag(v3, 0);
if( v4 )
ExFreePoolWithTag(v4, 0);
if( v2 )
ExFreePoolWithTag(v2, 0);
}Referenced by:
No references.