DrvDbUnloadDatabaseNode

NTSTATUS __stdcall DrvDbUnloadDatabaseNode(_DRVDB_CONTEXT *pDrvDbCtx, _DRVDB_NODE *DatabaseNode){
  __int64(__fastcall *v2)(_DRVDB_CONTEXT *, _QWORD, __int64); 
  int v3; 
  int v6; 
  NTSTATUS v7; 
  unsigned int v9; 
  _DRVDB_NODE *v10; 
  _DRVDB_NODE *v11; 

  v2 = (__int64(__fastcall *)(_DRVDB_CONTEXT *, _QWORD, __int64))*((_QWORD *)DatabaseNode + 9);
  v3 = 0;
  v11 = 0i64;
  if( v2 )
  {
    v11 = DatabaseNode + 22;
    v6 = ((__int64(__fastcall *)(_DRVDB_CONTEXT *, _QWORD, __int64, __int64, _DRVDB_NODE **, _QWORD))v2)(
           pDrvDbCtx,
           *((_QWORD *)DatabaseNode + 3),
           2i64,
           1i64,
           &v11,
           *((_QWORD *)DatabaseNode + 10));
    if( v6 == -1073741822 )
    {
      v2 = 0i64;
    }
    else if( v6 < 0 )
    {
      v3 = v6;
      goto LABEL_5;
    }
  }
  if( *((_QWORD *)DatabaseNode + 11) )
  {
    if( (DatabaseNode[14] & 2) != 0 )
    {
      v9 = 0;
      v10 = DatabaseNode + 24;
      do
      {
        if( *(_QWORD *)v10 )
        {
          v3 = ZwClose(*(_QWORD *)v10);
          if( v3 < 0 )
            goto LABEL_5;
          *(_QWORD *)v10 = 0i64;
        }
        ++v9;
        v10 += 2;
      }
      while( v9 < 6 );
    }
    v3 = ZwClose(*((_QWORD *)DatabaseNode + 11));
    if( v3 >= 0 )
      *((_QWORD *)DatabaseNode + 11) = 0i64;
  }
LABEL_5:
  if( v2 )
  {
    v7 = v2(pDrvDbCtx, *((_QWORD *)DatabaseNode + 3), 2i64);
    if( (int)(v7 + 0x80000000) >= 0 && v7 != -1073741822 && !v3 )
      return v7;
  }
  return v3;
}

Referenced by:

DrvDbDestroyDatabaseNode
DrvDbLoadDatabaseNode
DrvDbOpenDriverDatabaseRegKey
DrvDbReleaseDatabaseNodeBaseKey
DrvDbSetDriverDatabaseMappedProperty