ExpConvertArcName

INT64 __fastcall ExpConvertArcName(
        UINT64 OutputType,
        _FILE_PATH *OutputPath,
        UINT64 *OutputPathLength,
        WCHAR *pDeviceName,
        WCHAR *pPathName,
        UINT64 DeviceNameCount){
  unsigned int v9; 
  unsigned int v10; 
  WCHAR *PoolWithTag; 
  WCHAR *v12; 
  NTSTATUS v14; 
  NTSTATUS OutputNT; 
  wchar_t *Buffer; 
  unsigned int v17; 
  __int64 v18; 
  ULONG v19; 
  _FILE_PATH *v20; 
  _FILE_PATH *v21; 
  char *FilePath; 
  WCHAR *v23; 
  UNICODE_STRING ResultName; 
  unsigned int OutputTypea; 
  OutputTypea = OutputType;
  v9 = DeviceNameCount + 10;
  v10 = 2 * (DeviceNameCount + 10);
  ResultName = 0i64;
  PoolWithTag = (WCHAR *)ExAllocatePoolWithTag(NonPagedPoolNx, v10, 0x72766E45ui64);
  v12 = PoolWithTag;
  if( !PoolWithTag )
    return 3221225626i64;
  wcscpy_s(PoolWithTag, v9, (PWCHAR)L"\\ArcName\\");
  wcsncat_s(v12, v9, pDeviceName, (unsigned int)DeviceNameCount);
  v12[(unsigned int)(DeviceNameCount + 9)] = 0;
  if( OutputTypea != 3 )
  {
    v17 = v10 + 12;
    if( pPathName )
    {
      v18 = -1i64;
      do
        ++v18;
      while( pPathName[v18] );
      v17 += 2 * v18;
    }
    v19 = v17 + 2;
    v20 = (_FILE_PATH *)ExAllocatePoolWithTag(NonPagedPoolNx, v19, 0x72766E45ui64);
    v21 = v20;
    if( !v20 )
    {
      ExFreePoolWithTag(v12, 0);
      return 3221225626i64;
    }
    FilePath = v20->FilePath;
    v20->Version = 1;
    v20->Length = v19;
    v20->Type = 3;
    wcscpy_s((PWCHAR)v20->FilePath, (unsigned __int64)(v19 - 12) >> 1, v12);
    v23 = (WCHAR *)&FilePath[v10];
    ExFreePoolWithTag(v12, 0);
    if( pPathName )
      wcscpy_s(v23, (unsigned __int64)(v19 - v10 - 12) >> 1, pPathName);
    else
      *v23 = 0;
    OutputNT = ExpTranslateNtPath(v21, OutputTypea, OutputPath, OutputPathLength);
    Buffer = (wchar_t *)v21;
    goto LABEL_16;
  }
  v14 = ExpTranslateSymbolicLink(v12, &ResultName);
  ExFreePoolWithTag(v12, 0);
  if( v14 >= 0 )
  {
    OutputNT = ExpCreateOutputNT((INT64)OutputPath, OutputPathLength, (const WCHAR **)&ResultName, pPathName);
    Buffer = ResultName.Buffer;
LABEL_16:
    v14 = OutputNT;
    ExFreePoolWithTag(Buffer, 0);
  }
  return(unsigned int)v14;
}

Referenced by:

ExpTranslateArcPath