DrvDbOpenObjectRegKey
NTSTATUS __stdcall DrvDbOpenObjectRegKey(
_DRVDB_CONTEXT *pDrvDbCtx,
_UNICODE_STRING *DatabaseNode,
_DRVDB_BASE_KEY_TYPE BaseKeyType,
WCHAR *ObjectName,
_ACCESS_MASK Create,
UINT8 BaseKeyHandle,
VOID **Disposition,
UINT64 *a8){
NTSTATUS ObjectDatabaseNode;
_DRVDB_BASE_KEY_TYPE v12;
_UNICODE_STRING *v13;
int Tree;
_DRVDB_NODE *i;
NTSTATUS v16;
_DRVDB_BASE_KEY_TYPE v17;
NTSTATUS v19;
HPNPCTX *v20;
NTSTATUS v21;
_SECURITY_IMPERSONATION_LEVEL DesiredAccess;
UINT64 DesiredAccessa;
PVOID hKey;
UINT8 EffectiveOnly[8];
WCHAR *CopyOnOpen;
_UNICODE_STRING **v28;
CopyOnOpen = ObjectName;
hKey = 0i64;
*(_QWORD *)EffectiveOnly = 0i64;
ObjectDatabaseNode = DrvDbGetObjectDatabaseNode(
(_ETHREAD *)pDrvDbCtx,
ObjectName,
(UINT8)&CopyOnOpen,
(UINT8)EffectiveOnly,
DesiredAccess);
v13 = *(_UNICODE_STRING **)EffectiveOnly;
Tree = ObjectDatabaseNode;
if( ObjectDatabaseNode < 0 )
goto LABEL_12;
if( !*(_QWORD *)EffectiveOnly )
{
v13 = DatabaseNode;
if( !DatabaseNode )
{
for( i = (_DRVDB_NODE *)*((_QWORD *)pDrvDbCtx + 2); i != pDrvDbCtx + 4; i = *(_DRVDB_NODE **)i )
{
v13 = (_UNICODE_STRING *)i;
v16 = DrvDbAcquireDatabaseNodeBaseKey(pDrvDbCtx, i, BaseKeyType, &hKey);
Tree = v16;
if( v16 == -1073740697 )
{
Tree = -1073741772;
}
else
{
if( v16 < 0 )
break;
LODWORD(DesiredAccessa) = Create;
Tree = PnpCtxRegOpenKey(*(HPNPCTX **)pDrvDbCtx, hKey, CopyOnOpen, 0i64, DesiredAccessa, Disposition);
DrvDbReleaseDatabaseNodeBaseKey(pDrvDbCtx, i, v17, hKey);
hKey = 0i64;
if( Tree != -1073741772 )
goto LABEL_9;
}
}
if( Tree == -1073741772 )
{
if( !BaseKeyHandle )
goto LABEL_12;
v13 = (_UNICODE_STRING *)*((_QWORD *)pDrvDbCtx + 4);
v21 = DrvDbAcquireDatabaseNodeBaseKey(pDrvDbCtx, (_DRVDB_NODE *)v13, BaseKeyType, &hKey);
Tree = v21;
if( v21 < 0 )
{
if( v21 == -1073740697 )
Tree = -1073741662;
goto LABEL_12;
}
LODWORD(DesiredAccessa) = Create;
Tree = PnpCtxRegCreateTree(
*(HPNPCTX **)pDrvDbCtx,
hKey,
CopyOnOpen,
0i64,
DesiredAccessa,
0i64,
Disposition,
0i64);
if( Tree < 0 )
goto LABEL_12;
}
LABEL_9:
if( Tree >= 0 && v28 )
*v28 = v13;
goto LABEL_12;
}
}
v19 = DrvDbAcquireDatabaseNodeBaseKey(pDrvDbCtx, (_DRVDB_NODE *)v13, BaseKeyType, &hKey);
Tree = v19;
if( v19 >= 0 )
{
v20 = *(HPNPCTX **)pDrvDbCtx;
if( BaseKeyHandle )
{
LODWORD(DesiredAccessa) = Create;
Tree = PnpCtxRegCreateTree(v20, hKey, CopyOnOpen, 0i64, DesiredAccessa, 0i64, Disposition, a8);
}
else
{
LODWORD(DesiredAccessa) = Create;
Tree = PnpCtxRegOpenKey(v20, hKey, CopyOnOpen, 0i64, DesiredAccessa, Disposition);
if( Tree < 0 )
goto LABEL_12;
if( a8 )
*(_DWORD *)a8 = 2;
}
goto LABEL_9;
}
if( v19 == -1073740697 )
Tree = -1073741772;
LABEL_12:
if( hKey )
DrvDbReleaseDatabaseNodeBaseKey(pDrvDbCtx, (_DRVDB_NODE *)v13, v12, hKey);
return Tree;
}Referenced by:
DrvDbCreateDatabaseNode
DrvDbGetDeviceIdMappedProperty
DrvDbGetDriverDatabaseMappedProperty
DrvDbGetDriverDatabaseMappedPropertyKeys
DrvDbGetDriverPackageMappedProperty
DrvDbGetObjectDatabaseNodeName
DrvDbOpenDeviceIdRegKey
DrvDbOpenDriverFileRegKey
DrvDbOpenDriverInfFileRegKey
DrvDbOpenDriverPackageRegKey
DrvDbSetDriverDatabaseMappedProperty