DrvDbGetDriverDatabaseMappedProperty
VOID __fastcall DrvDbGetDriverDatabaseMappedProperty(
INT64 a1,
WCHAR *a2,
VOID *a3,
INT64 a4,
INT64 PropertyType,
INT64 PropertyBuffer,
INT64 BufferSize,
INT64 PropertySize){
const UNICODE_STRING *v11;
int v12;
__int64 v13;
int v14;
unsigned int v15;
__int64 **v16;
__int64 *v17;
__int64(**v18)[3];
__int64(**v19)[3];
unsigned int v20;
__int64(*v21)[3];
const UNICODE_STRING **v22;
int v23;
void *v24;
__int64 v25;
__int64 v26;
unsigned int v27;
int DatabaseNode;
int v29;
__int64 v30;
_BYTE *v31;
bool v32;
__int64 v33;
__int64 v34;
char v35;
__int64 v36;
__int64 v37;
__int64 v38;
__int64(**v39)[3];
unsigned int v40;
__int64(*v41)[3];
__int64 v42;
INT64 a5;
const UNICODE_STRING *v44;
HANDLE Handle;
Handle = 0i64;
v44 = 0i64;
*(_DWORD *)PropertyType = 0;
*(_DWORD *)PropertySize = 0;
v11 = 0i64;
v12 = wcsicmp(a2, L"*");
v13 = 0i64;
if( !v12 )
goto LABEL_23;
v14 = *(_DWORD *)(a4 + 16);
if( v14 == 2 )
{
v25 = *(_QWORD *)a4 - DEVPKEY_NODE;
if( *(_QWORD *)a4 == DEVPKEY_NODE )
v25 = *(_QWORD *)(a4 + 8) + 0x5008C7D4C8250077i64;
if( !v25 )
{
*(_DWORD *)PropertyType = 18;
v26 = -1i64;
do
++v26;
while( a2[v26] );
v27 = 2 * v26 + 2;
*(_DWORD *)PropertySize = v27;
if( PropertyBuffer && (unsigned int)BufferSize >= v27 )
memmove((UINT8 *)PropertyBuffer, (UINT8 *)a2, v27);
goto LABEL_23;
}
}
v15 = 0;
v16 = off_140C02C70;
while( 1 )
{
v17 = *v16;
if( *((_DWORD *)*v16 + 4) == v14 )
{
v13 = *v17 - *(_QWORD *)a4;
if( *v17 == *(_QWORD *)a4 )
v13 = v17[1] - *(_QWORD *)(a4 + 8);
if( !v13 )
break;
}
++v15;
++v16;
if( v15 >= 7 )
{
v18 = 0i64;
v19 = &off_140001FC0;
v20 = 0;
while( 1 )
{
v21 = *v19;
if( LODWORD((**v19)[2]) == v14 )
{
v13 = (*v21)[0] - *(_QWORD *)a4;
if( (*v21)[0] == *(_QWORD *)a4 )
v13 = (*v21)[1] - *(_QWORD *)(a4 + 8);
if( !v13 )
break;
}
++v20;
v19 += 5;
if( v20 >= 0xC )
goto LABEL_14;
}
v13 = 5i64 * v20;
v18 = &off_140001FC0 + 5 * v20;
LABEL_14:
if( v18 )
{
v22 = (const UNICODE_STRING **)a1;
LABEL_16:
if( a3 && (!v11 || ((__int64)v11[3].Buffer & 0x10) == 0)
|| (!v11 || ((__int64)v11[3].Buffer & 0x10) == 0 ? (v23 = DrvDbOpenDriverDatabaseRegKey(
v22,
a2,
1u,
0,
&Handle,
0i64)) : (LODWORD(a5) = 1,
v23 = DrvDbOpenObjectRegKey(
(INT64 *)v22,
v22[4],
1i64,
a2,
a5,
0,
(INT64)&Handle,
0i64,
0i64)),
v23 >= 0) )
{
v24 = a3;
if( Handle )
v24 = Handle;
DrvDbGetRegValueMappedProperty(
v13,
v24,
(__int64)v18,
(_DWORD *)PropertyType,
(_WORD *)PropertyBuffer,
BufferSize,
(_DWORD *)PropertySize);
}
}
else
{
v18 = 0i64;
v39 = &off_140009A30;
v40 = 0;
while( 1 )
{
v41 = *v39;
if( LODWORD((**v39)[2]) == v14 )
{
v42 = (*v41)[0] - *(_QWORD *)a4;
if( (*v41)[0] == *(_QWORD *)a4 )
v42 = (*v41)[1] - *(_QWORD *)(a4 + 8);
if( !v42 )
break;
}
++v40;
v39 += 5;
if( v40 >= 4 )
goto LABEL_94;
}
v18 = &off_140009A30 + 5 * v40;
LABEL_94:
if( v18 )
{
v22 = (const UNICODE_STRING **)a1;
if( (int)DrvDbFindDatabaseNode(a1, a2, &v44) >= 0 )
{
v11 = v44;
goto LABEL_16;
}
}
}
goto LABEL_23;
}
}
DatabaseNode = DrvDbFindDatabaseNode(a1, a2, &v44);
if( DatabaseNode < 0 )
goto LABEL_23;
v29 = *(_DWORD *)(a4 + 16);
switch( v29 )
{
case 5:
v30 = *(_QWORD *)a4 - DEVPKEY_DriverDatabase_Loaded;
if( *(_QWORD *)a4 == DEVPKEY_DriverDatabase_Loaded )
v30 = *(_QWORD *)(a4 + 8) + 0x4524B8338B5D1E6Ci64;
if( v30 )
break;
v31 = (_BYTE *)PropertyBuffer;
*(_DWORD *)PropertyType = 17;
*(_DWORD *)PropertySize = 1;
if( !PropertyBuffer || !(_DWORD)BufferSize )
break;
v32 = v44[5].Buffer != 0i64;
LABEL_65:
*v31 = -v32;
break;
case 6:
v33 = *(_QWORD *)a4 - DEVPKEY_DriverDatabase_Selected;
if( *(_QWORD *)a4 == DEVPKEY_DriverDatabase_Selected )
v33 = *(_QWORD *)(a4 + 8) + 0x4524B8338B5D1E6Ci64;
if( !v33 )
{
*(_DWORD *)PropertyType = 17;
*(_DWORD *)PropertySize = 1;
if( PropertyBuffer )
{
if( (_DWORD)BufferSize )
*(_BYTE *)PropertyBuffer = (*(_QWORD *)(a1 + 40) != (_QWORD)v44) - 1;
}
}
break;
case 7:
v34 = *(_QWORD *)a4 - DEVPKEY_DriverDatabase_Disabled;
if( *(_QWORD *)a4 == DEVPKEY_DriverDatabase_Disabled )
v34 = *(_QWORD *)(a4 + 8) + 0x4524B8338B5D1E6Ci64;
if( v34 )
break;
v31 = (_BYTE *)PropertyBuffer;
*(_DWORD *)PropertyType = 17;
*(_DWORD *)PropertySize = 1;
if( !PropertyBuffer || !(_DWORD)BufferSize )
break;
v35 = (__int64)v44[3].Buffer & 4;
goto LABEL_64;
case 11:
v36 = *(_QWORD *)a4 - DEVPKEY_DriverDatabase_AccessMask;
if( *(_QWORD *)a4 == DEVPKEY_DriverDatabase_AccessMask )
v36 = *(_QWORD *)(a4 + 8) + 0x4524B8338B5D1E6Ci64;
if( !v36 )
{
*(_DWORD *)PropertyType = 7;
*(_DWORD *)PropertySize = 4;
if( PropertyBuffer )
{
if( (unsigned int)BufferSize >= 4 )
*(_DWORD *)PropertyBuffer = *(_DWORD *)(a1 + 12);
}
}
break;
case 15:
v37 = *(_QWORD *)a4 - DEVPKEY_DriverDatabase_LoadStatus;
if( *(_QWORD *)a4 == DEVPKEY_DriverDatabase_LoadStatus )
v37 = *(_QWORD *)(a4 + 8) + 0x4524B8338B5D1E6Ci64;
if( !v37 )
{
*(_DWORD *)PropertyType = 24;
*(_DWORD *)PropertySize = 4;
if( PropertyBuffer )
{
if( (unsigned int)BufferSize >= 4 )
*(_DWORD *)PropertyBuffer = v44[9].Buffer;
}
}
break;
case 23:
v38 = *(_QWORD *)a4 - DEVPKEY_DriverDatabase_Extended;
if( *(_QWORD *)a4 == DEVPKEY_DriverDatabase_Extended )
v38 = *(_QWORD *)(a4 + 8) + 0x4524B8338B5D1E6Ci64;
if( !v38 )
{
v31 = (_BYTE *)PropertyBuffer;
*(_DWORD *)PropertyType = 17;
*(_DWORD *)PropertySize = 1;
if( PropertyBuffer )
{
if( (_DWORD)BufferSize )
{
v35 = (__int64)v44[3].Buffer & 0x10;
LABEL_64:
v32 = v35 != 0;
goto LABEL_65;
}
}
}
break;
}
LABEL_23:
if( Handle )
ZwClose(Handle);
}Referenced by:
DrvDbDispatchDriverDatabase
DrvDbLoadDatabaseNode