CmSetDeviceMappedPropertyFromDriverKeyRegValue
__int64 __fastcall CmSetDeviceMappedPropertyFromDriverKeyRegValue(
__int64 a1,
const wchar_t *a2,
__int64 a3,
unsigned int a4,
PLARGE_INTEGER Time,
ULONG a6){
int v8;
DEVPROPKEY **v9;
unsigned int i;
DEVPROPKEY *v13;
DEVPROPKEY **v14;
__int64 v15;
int v16;
int v17;
NTSTATUS v18;
__int64 v20;
int v21;
HANDLE Handle;
size_t pcchLength;
struct _TIME_FIELDS TimeFields;
wchar_t pszDest[12];
Handle = 0i64;
pcchLength = 0i64;
v8 = *(_DWORD *)(a3 + 16);
v9 = &off_140986950;
TimeFields = 0i64;
for( i = 0; i < 0xD; ++i )
{
v13 = *v9;
v14 = v9;
if( v8 == (*v9)->pid )
{
v15 = *(_QWORD *)a3 - *(_QWORD *)&v13->fmtid.Data1;
if( *(_QWORD *)a3 == *(_QWORD *)&v13->fmtid.Data1 )
v15 = *(_QWORD *)(a3 + 8) - *(_QWORD *)v13->fmtid.Data4;
if( !v15 )
break;
}
v14 = 0i64;
v9 += 4;
}
if( !v14 )
return(unsigned int)-1073741802;
v16 = *((_DWORD *)v14 + 2);
if( a4 != v16 )
{
if( a4 == 25 )
{
if( v16 == 18 )
goto LABEL_10;
}
else if( a4 < 2 )
{
goto LABEL_10;
}
return(unsigned int)-1073741811;
}
LABEL_10:
v17 = CmOpenDeviceRegKey(a1, a2, 18, 0, 2, 1, (__int64)&Handle, 0i64);
if( v17 >= 0 )
{
v18 = RegRtlSetValue(Handle, (const WCHAR *)v14[2], *((_DWORD *)v14 + 6), Time, a6);
if( v18 == -1073741444 )
{
v17 = -1073741772;
}
else if( v18 < 0 )
{
v17 = v18;
}
else if( *(_DWORD *)(a3 + 16) == 2 )
{
v20 = *(_QWORD *)a3 - *(_QWORD *)&DEVPKEY_Device_DriverDate.fmtid.Data1;
if( *(_QWORD *)a3 == *(_QWORD *)&DEVPKEY_Device_DriverDate.fmtid.Data1 )
v20 = *(_QWORD *)(a3 + 8) - *(_QWORD *)DEVPKEY_Device_DriverDate.fmtid.Data4;
if( !v20 )
{
RtlTimeToTimeFields(Time, &TimeFields);
RtlStringCchPrintfW(pszDest, 0xBui64, (WCHAR *)L"%d-%d-%d");
if( v21 >= 0 && RtlUnalignedStringCchLengthW(pszDest, 0xBui64, &pcchLength) >= 0 )
RegRtlSetValue(Handle, L"DriverDate", 1u, pszDest, 2 * (pcchLength + 1));
}
}
}
if( Handle )
ZwClose(Handle);
return(unsigned int)v17;
}Referenced by:
CmSetDeviceMappedProperty