SdbpGetMatchingTextAttributes

NTSTATUS __stdcall SdbpGetMatchingTextAttributes(
        VOID *pdb,
        UINT64 tiMatchingText,
        WCHAR **pwszFilePathOut,
        VOID **pContainsTextOut,
        UINT64 *pdwContainsTextLengthBytesOut,
        UINT64 *pdwFileEncodingOut,
        UINT64 *pdwMaxSizeOut){
  NTSTATUS v7; 
  int v8; 
  unsigned int v9; 
  void *v11; 
  unsigned int FirstTag; 
  INT8 *v13; 
  UINT64 v14; 
  WCHAR *StringTagPtr; 
  WCHAR *v16; 
  unsigned int v17; 
  unsigned int v18; 
  unsigned int TagDataSize; 
  VOID *v20; 
  INT64 v21; 
  unsigned int v22; 
  VOID *v23; 
  UINT64 v24; 
  INT8 *v25; 
  unsigned int v26; 
  int DWORDTag; 
  unsigned int v28; 

  v7 = 0;
  *pwszFilePathOut = 0i64;
  v8 = 0x2000;
  *pContainsTextOut = 0i64;
  v9 = tiMatchingText;
  *(_DWORD *)pdwContainsTextLengthBytesOut = 0;
  v11 = 0i64;
  *(_DWORD *)pdwFileEncodingOut = 0;
  *(_DWORD *)pdwMaxSizeOut = 0x2000;
  FirstTag = SdbFindFirstTag((_DB *)pdb, tiMatchingText, 0x6001u);
  if( !FirstTag )
  {
    v13 = (INT8 *)"Failed to get MATCHING_TEXT file path";
    v14 = 1562i64;
LABEL_3:
    AslLogCallPrintf(1ui64, (INT8 *)"SdbpGetMatchingTextAttributes", v14, v13);
    return v7;
  }
  StringTagPtr = SdbGetStringTagPtr(pdb, FirstTag);
  v16 = StringTagPtr;
  if( !StringTagPtr || !*StringTagPtr )
  {
    v24 = 1568i64;
    v25 = (INT8 *)"Failed to read MATCHING_TEXT file path";
LABEL_22:
    AslLogCallPrintf(1ui64, (INT8 *)"SdbpGetMatchingTextAttributes", v24, v25);
    if( v11 )
      ExFreePoolWithTag(v11, 0x74705041u);
    return v7;
  }
  v17 = SdbFindFirstTag((_DB *)pdb, v9, 0x9013u);
  v18 = v17;
  if( !v17 )
  {
    v13 = "Failed to read text to match";
    v14 = 1577i64;
    goto LABEL_3;
  }
  TagDataSize = SdbGetTagDataSize((_DB *)pdb, v17);
  v22 = TagDataSize;
  if( !TagDataSize )
  {
    v13 = "Failed to get text to match blob";
    v14 = 1583i64;
    goto LABEL_3;
  }
  v23 = AslAlloc(v20, TagDataSize + 2, v21);
  v11 = v23;
  if( !v23 )
  {
    v13 = "Failed to allocate memory for text blob";
    v14 = 1589i64;
    goto LABEL_3;
  }
  if( !SdbReadBinaryTag((_DB *)pdb, v18, v23, v22) )
  {
    v24 = 1594i64;
    v25 = "Failed to read matching text blob";
    goto LABEL_22;
  }
  v26 = SdbFindFirstTag((_DB *)pdb, v9, 0x4053u);
  if( !v26 )
  {
    v24 = 1603i64;
    v25 = "Failed to read text encoding";
    goto LABEL_22;
  }
  DWORDTag = SdbReadDWORDTag((_DB *)pdb, v26, 0);
  if( !DWORDTag )
  {
    v24 = 1609i64;
    v25 = "Failed to read encoding type";
    goto LABEL_22;
  }
  v28 = SdbFindFirstTag((_DB *)pdb, v9, 0x4001u);
  if( v28 )
    v8 = SdbReadDWORDTag((_DB *)pdb, v28, 0x2000u);
  v7 = 1;
  *pwszFilePathOut = v16;
  *pContainsTextOut = v11;
  *(_DWORD *)pdwContainsTextLengthBytesOut = v22;
  *(_DWORD *)pdwFileEncodingOut = DWORDTag;
  *(_DWORD *)pdwMaxSizeOut = v8;
  return v7;
}

Referenced by:

SdbpCheckMatchingText