DrvDbSetDriverPackageMappedProperty
__int64 __fastcall DrvDbSetDriverPackageMappedProperty(
__int64 *a1,
__int64 a2,
void *a3,
__int64 a4,
int a5,
void *Src,
int a7){
int v8;
_WORD *v10;
PVOID v12;
unsigned int v13;
__int64(**i)[3];
__int64(*v15)[3];
int v16;
__int64 v17;
__int64(**v18)[3];
int v19;
int v20;
const wchar_t *v21;
int v22;
int *v23;
__int64 v24;
HANDLE v25;
NTSTATUS v26;
_OWORD *PoolWithTag;
bool v29;
HANDLE v30;
int v31;
UINT8 *v32;
HANDLE v33;
__int64 v34;
__int64 v35;
int v36;
__int64 v37;
char *v38;
__int64 v39;
__int64 v40;
__int64 v41;
__int64 v42;
__int64 v43;
char *v44;
HANDLE v45;
HANDLE v46;
HANDLE v47;
__int64 v48;
__int64 v49;
const wchar_t *v50;
HANDLE v51;
HANDLE v52;
HANDLE v53;
HANDLE v54;
int v55;
int v56;
HANDLE Handle;
PVOID v58;
PVOID P;
__int64 v62;
v8 = *(_DWORD *)(a4 + 16);
Handle = 0i64;
v10 = (_WORD *)a2;
P = 0i64;
v56 = 0;
v12 = 0i64;
v55 = 0;
v58 = 0i64;
LODWORD(v62) = 0;
if( v8 == 2 )
{
v34 = *(_QWORD *)a4 - DEVPKEY_NODE;
if( *(_QWORD *)a4 == DEVPKEY_NODE )
v34 = *(_QWORD *)(a4 + 8) + 0x5008C7D4C8250077i64;
if( !v34 )
return(unsigned int)-1073741790;
}
if( v8 == 18 )
{
v39 = *(_QWORD *)a4 - DEVPKEY_DriverPackage_Configurable;
if( *(_QWORD *)a4 == DEVPKEY_DriverPackage_Configurable )
v39 = *(_QWORD *)(a4 + 8) + 0x4524B8338B5D1E6Ci64;
if( !v39 )
return(unsigned int)-1073741790;
}
if( v8 == 29 )
{
v40 = *(_QWORD *)a4 - DEVPKEY_DriverPackage_Configurations;
if( *(_QWORD *)a4 == DEVPKEY_DriverPackage_Configurations )
v40 = *(_QWORD *)(a4 + 8) + 0x4524B8338B5D1E6Ci64;
if( !v40 )
return(unsigned int)-1073741790;
}
if( v8 == 30 )
{
v41 = *(_QWORD *)a4 - DEVPKEY_DriverPackage_ConfigurationScopes;
if( *(_QWORD *)a4 == DEVPKEY_DriverPackage_ConfigurationScopes )
v41 = *(_QWORD *)(a4 + 8) + 0x4524B8338B5D1E6Ci64;
if( !v41 )
return(unsigned int)-1073741790;
}
if( v8 == 33 )
{
v42 = *(_QWORD *)a4 - DEVPKEY_DriverPackage_FamilyId;
if( *(_QWORD *)a4 == DEVPKEY_DriverPackage_FamilyId )
v42 = *(_QWORD *)(a4 + 8) + 0x4524B8338B5D1E6Ci64;
if( !v42 )
return(unsigned int)-1073741790;
}
if( v8 == 40 )
{
v43 = *(_QWORD *)a4 - DEVPKEY_DriverPackage_Primitive;
if( *(_QWORD *)a4 == DEVPKEY_DriverPackage_Primitive )
v43 = *(_QWORD *)(a4 + 8) + 0x4524B8338B5D1E6Ci64;
if( !v43 )
return(unsigned int)-1073741790;
}
v13 = 0;
for( i = &off_140001760; ; i += 5 )
{
v15 = *i;
if( LODWORD((**i)[2]) == v8 )
{
v17 = (*v15)[0] - *(_QWORD *)a4;
if( (*v15)[0] == *(_QWORD *)a4 )
v17 = (*v15)[1] - *(_QWORD *)(a4 + 8);
if( !v17 )
break;
}
if( ++v13 >= 0x20 )
return(unsigned int)-1073741802;
}
v18 = &off_140001760 + 5 * v13;
if( !v18 )
return(unsigned int)-1073741802;
v19 = a5;
if( a5 != *((_DWORD *)v18 + 2) && a5 )
return(unsigned int)-1073741811;
if( !a3 )
{
v16 = DrvDbOpenDriverPackageRegKey(a1, (INT64)v10, 3i64, 0, (INT64)&Handle, 0i64);
if( v16 < 0 )
goto LABEL_31;
v10 = (_WORD *)a2;
}
v20 = *((_DWORD *)v18 + 8);
if( v20 )
{
if( v19 )
v29 = a7 == v20;
else
v29 = a7 == 0;
if( !v29 )
{
v16 = -1073741823;
goto LABEL_31;
}
LODWORD(v62) = 48;
PoolWithTag = ExAllocatePoolWithTag(PagedPool, 0x30ui64, 0x42444450ui64);
if( PoolWithTag )
{
v30 = Handle;
if( a3 )
v30 = a3;
v31 = RegRtlQueryValue(v30, L"Version", &v56, PoolWithTag, (__int64)&v62);
v16 = v31;
if( v31 == -1073741772 )
{
*PoolWithTag = 0i64;
PoolWithTag[1] = 0i64;
PoolWithTag[2] = 0i64;
}
else
{
if( v31 == -1073741789 )
{
v16 = -1073741595;
goto LABEL_27;
}
if( v31 < 0 )
{
LABEL_27:
if( PoolWithTag )
ExFreePoolWithTag(PoolWithTag, 0);
if( v12 )
ExFreePoolWithTag(v12, 0);
goto LABEL_31;
}
if( v56 != 3 || (_DWORD)v62 != 48 )
{
v16 = -1073741823;
goto LABEL_27;
}
}
v32 = (UINT8 *)PoolWithTag + *((unsigned int *)v18 + 7);
if( v19 )
memmove(v32, (UINT8 *)Src, *((unsigned int *)v18 + 8));
else
memset((INT64)v32, 0i64);
v33 = Handle;
if( a3 )
v33 = a3;
v26 = RegRtlSetValue(v33, L"Version", 3u, PoolWithTag, 0x30u);
LABEL_26:
v16 = v26;
goto LABEL_27;
}
goto LABEL_99;
}
v21 = L"Microsoft Windows";
v22 = a7;
v23 = (int *)Src;
if( *(_DWORD *)(a4 + 16) != 7 )
{
v24 = 0i64;
goto LABEL_22;
}
v35 = *(_QWORD *)a4 - *(_QWORD *)&DEVPKEY_DriverPackage_SignerName;
if( *(_QWORD *)a4 == *(_QWORD *)&DEVPKEY_DriverPackage_SignerName )
v35 = *(_QWORD *)(a4 + 8) + 0x4524B8338B5D1E6Ci64;
v24 = 0i64;
if( v35
|| v19 != 18
|| (unsigned int)a7 <= 2
|| !Src
|| *((_WORD *)Src + ((unsigned __int64)(unsigned int)a7 >> 1) - 1)
|| (v36 = wcsicmp((const wchar_t *)Src, L"Microsoft Windows"), v24 = 0i64, v36) )
{
LABEL_22:
if( *(_DWORD *)(a4 + 16) != 8 )
goto LABEL_23;
v37 = *(_QWORD *)a4 - *(_QWORD *)&DEVPKEY_DriverPackage_SignerScore;
if( *(_QWORD *)a4 == *(_QWORD *)&DEVPKEY_DriverPackage_SignerScore )
v37 = *(_QWORD *)(a4 + 8) + 0x4524B8338B5D1E6Ci64;
if( v37 )
goto LABEL_23;
if( v19 == 7 )
{
if( v22 == 4 && v23 )
{
if( *v23 != 218103811 )
goto LABEL_70;
v47 = Handle;
if( a3 )
v47 = a3;
if( (unsigned int)DrvDbGetDriverPackageSignerName(0i64, (__int64)v21, v47, 0i64, 0, (unsigned int *)&v62) == -1073741789
&& (_DWORD)v62 == 18 )
{
v58 = ExAllocatePoolWithTag(PagedPool, 0x24ui64, 0x42444450ui64);
v50 = (const wchar_t *)v58;
if( v58 )
{
v51 = Handle;
if( a3 )
v51 = a3;
if( (int)DrvDbGetDriverPackageSignerName(v49, v48, v51, v58, 18, (unsigned int *)&v62) >= 0
&& (_DWORD)v62
&& !v50[(unsigned int)(v62 - 1)]
&& !wcsicmp(v50, L"Microsoft Windows") )
{
v52 = Handle;
if( a3 )
v52 = a3;
DrvDbSetDriverPackageMappedProperty(a1, a2, v52, (__int64)&DEVPKEY_DriverPackage_SignerName, 0, 0i64, 0);
}
goto LABEL_23;
}
LABEL_99:
v16 = -1073741801;
goto LABEL_31;
}
}
}
else if( !v19 )
{
LABEL_70:
v38 = (char *)Handle;
if( a3 )
v38 = (char *)a3;
if( (int)DrvDbGetDriverPackageSignerScore(a1, (_WORD *)a2, v38, (wchar_t *)&v55) >= 0 && v55 == 218103811 )
{
v53 = Handle;
if( a3 )
v53 = a3;
if( (unsigned int)DrvDbGetDriverPackageSignerName(v24, 0i64, v53, 0i64, 0, (unsigned int *)&v62) == -1073741275 )
{
v54 = Handle;
if( a3 )
v54 = a3;
v16 = DrvDbSetRegValueMappedProperty(v24, v54, (__int64)v18, v19, v23, v22);
if( v16 < 0 )
goto LABEL_31;
v46 = Handle;
if( a3 )
v46 = a3;
DrvDbSetDriverPackageMappedProperty(
a1,
a2,
v46,
(__int64)&DEVPKEY_DriverPackage_SignerName,
18,
(void *)L"Microsoft Windows",
36);
goto LABEL_114;
}
}
}
LABEL_23:
v25 = Handle;
if( a3 )
v25 = a3;
v26 = DrvDbSetRegValueMappedProperty(v24, v25, (__int64)v18, v19, v23, v22);
PoolWithTag = P;
v12 = v58;
goto LABEL_26;
}
v44 = (char *)Handle;
if( a3 )
v44 = (char *)a3;
if( (int)DrvDbGetDriverPackageSignerScore(a1, v10, v44, (wchar_t *)&v55) < 0 || v55 != 218103811 )
goto LABEL_23;
v45 = Handle;
if( a3 )
v45 = a3;
v16 = DrvDbSetRegValueMappedProperty(v24, v45, (__int64)v18, 0, 0i64, 0);
if( v16 != -1073741275 )
goto LABEL_31;
LABEL_114:
v16 = 0;
LABEL_31:
if( Handle )
ZwClose(Handle);
return(unsigned int)v16;
}Referenced by:
DrvDbDispatchDriverPackage
DrvDbSetDriverPackageMappedProperty