SdbpCheckMatchingDir

INT64 __fastcall SdbpCheckMatchingDir(UINT64 *a1, INT64 a2, RTL_RUN_ONCE *a3, INT64 a4, UINT64 a5, WCHAR *P){
  UINT64 *v7; 
  int v8; 
  unsigned int DoesDirectoryExistNtPath; 
  unsigned int FirstTag; 
  INT64 StringTagPtr; 
  __int64 v12; 
  INT64 v13; 
  const WCHAR *v14; 
  __int64 v15; 
  WCHAR *v16; 
  int *v17; 
  WCHAR *v18; 
  unsigned __int64 v19; 
  __int64 v20; 
  INT64 result; 
  v7 = a1;
  v8 = 0;
  DoesDirectoryExistNtPath = 0;
  FirstTag = SdbFindFirstTag((INT64)a3, (unsigned int)a5, 24577);
  if( FirstTag )
  {
    StringTagPtr = SdbGetStringTagPtr(a3, FirstTag);
    v14 = (const WCHAR *)StringTagPtr;
    if( StringTagPtr )
    {
      v15 = -1i64;
      do
        ++v15;
      while( *(_WORD *)(StringTagPtr + 2 * v15) );
      v16 = P;
      if( (*(_DWORD *)P & 1) != 0 || (unsigned int)SdbpInitializeSearchDBContext((__int64)P, v12, v13) )
      {
        v17 = (int *)*((_QWORD *)v16 + 9);
        if( *v17 <= 0 )
        {
LABEL_17:
          v19 = *v14;
          LOWORD(v19) = v19 - 37;
          if( (unsigned __int16)v19 <= 0x37u )
          {
            v20 = 0x80000000000201i64;
            if( _bittest64(&v20, v19) )
              *((_DWORD *)v16 + 20) = 1;
          }
        }
        else
        {
          while( 1 )
          {
            P = 0i64;
            if( !(unsigned int)SdbpResolveMatchingFile(
                                  a2,
                                  (INT64)v16,
                                  v14,
                                  (unsigned int)v15,
                                  (INT64)&v17[12 * v8 + 2],
                                  &P) )
              break;
            v18 = P;
            DoesDirectoryExistNtPath = AslDoesDirectoryExistNtPath(P);
            if( v18 )
              ExFreePoolWithTag(v18, 0x74705041u);
            if( DoesDirectoryExistNtPath )
            {
              if( v8 > 0 )
                *((_DWORD *)v16 + 20) = 1;
LABEL_16:
              v7 = a1;
              goto LABEL_17;
            }
            if( ++v8 >= *v17 )
              goto LABEL_16;
          }
          AslLogCallPrintf(1ui64, "SdbpCheckMatchingDir", 0x91Cui64, "Failed to resolve matching dir");
          v7 = a1;
        }
      }
      else
      {
        AslLogCallPrintf(1ui64, "SdbpCheckMatchingDir", 0x904ui64, "Failed to initialize SEARCHDBCONTEXT");
      }
    }
    else
    {
      AslLogCallPrintf(1ui64, "SdbpCheckMatchingDir", 0x8F7ui64, "Failed to get the string from the database");
    }
  }
  result = DoesDirectoryExistNtPath;
  *(_DWORD *)v7 = DoesDirectoryExistNtPath;
  return result;
}

Referenced by:

No references.