BiTranslateSymbolicLinkFile

INT64 __stdcall BiTranslateSymbolicLinkFile(WCHAR *FileName, WCHAR **ResultName){
  UINT8 *v4; 
  WCHAR *v5; 
  UINT8 *v6; 
  char v7; 
  UINT8 *v8; 
  int v9; 
  __int64 v10; 
  __int64 v11; 
  UINT64 v12; 
  WCHAR *PoolWithTag; 
  WCHAR *v14; 
  unsigned int v15; 
  unsigned int Size; 
  void *Src; 
  Src = 0i64;
  v4 = 0i64;
  if( FileName && ResultName )
  {
    *ResultName = 0i64;
    v5 = FileName;
    v6 = 0i64;
    v7 = 0;
    while( 1 )
    {
      v8 = (UINT8 *)wcsrchr(v5, 0x5Cu);
      if( v6 )
        *(_WORD *)v6 = 92;
      if( !v8 )
        break;
      *(_WORD *)v8 = 0;
      v9 = BiTranslateSymbolicLink(v5, (WCHAR **)&Src);
      v4 = (UINT8 *)Src;
      if( v9 >= 0 )
      {
        v7 = 1;
        *(_WORD *)v8 = 92;
        v10 = -1i64;
        v11 = -1i64;
        do
          ++v11;
        while( *(_WORD *)&v4[2 * v11] );
        v12 = (unsigned int)(2 * v11);
        do
          ++v10;
        while( *(_WORD *)&v8[2 * v10] );
        Size = 2 * v10 + 2;
        PoolWithTag = (WCHAR *)ExAllocatePoolWithTag(PagedPool, (unsigned int)v12 + Size, 0x4B444342ui64);
        *ResultName = PoolWithTag;
        v14 = PoolWithTag;
        if( !PoolWithTag )
        {
          v15 = -1073741801;
          goto LABEL_20;
        }
        memmove((UINT8 *)PoolWithTag, v4, v12);
        memmove((UINT8 *)v14 + v12, v8, Size);
        if( v5 != FileName )
        {
          ExFreePoolWithTag(v5, 0x4B444342u);
          v14 = *ResultName;
        }
        v8 = (UINT8 *)v14 + v12;
        v5 = v14;
        *(WCHAR *)((char *)v14 + v12) = 0;
      }
      v6 = v8;
    }
    v15 = v7 == 0 ? 0xC0000001 : 0;
  }
  else
  {
    v15 = -1073741811;
  }
LABEL_20:
  if( v4 )
    ExFreePoolWithTag(v4, 0x4B444342u);
  return v15;
}

Referenced by:

BiGetPartitionVhdFilePathFromUnicodeString