ExpConvertArcName

NTSTATUS __stdcall ExpConvertArcName(
        UINT64 OutputType,
        _FILE_PATH *OutputPath,
        UINT64 *OutputPathLength,
        WCHAR *pDeviceName,
        WCHAR *pPathName,
        UINT64 DeviceNameCount){
  unsigned int v9; 
  unsigned int v10; 
  VOID **PoolWithTag; 
  WCHAR *v12; 
  int v14; 
  NTSTATUS OutputNT; 
  wchar_t *Buffer; 
  unsigned int v17; 
  __int64 v18; 
  unsigned int v19; 
  VOID **v20; 
  _FILE_PATH *v21; 
  char *v22; 
  wchar_t *v23; 
  _UNICODE_STRING ResultName[3]; 
  unsigned int OutputTypea; 

  OutputTypea = OutputType;
  v9 = DeviceNameCount + 10;
  v10 = 2 * (DeviceNameCount + 10);
  ResultName[0] = 0i64;
  PoolWithTag = ExAllocatePoolWithTag(0x200ui64, v10, 1920364101i64);
  v12 = (WCHAR *)PoolWithTag;
  if( !PoolWithTag )
    return -1073741670;
  wcscpy_s((PWCHAR)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 = ExAllocatePoolWithTag(0x200ui64, v19, 1920364101i64);
    v21 = (_FILE_PATH *)v20;
    if( !v20 )
    {
      ExFreePoolWithTag(v12, 0);
      return -1073741670;
    }
    v22 = (char *)v20 + 12;
    *(_DWORD *)v20 = 1;
    *((_DWORD *)v20 + 1) = v19;
    *((_DWORD *)v20 + 2) = 3;
    wcscpy_s((PWCHAR)v20 + 6, (unsigned __int64)(v19 - 12) >> 1, v12);
    v23 = (wchar_t *)&v22[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(OutputPath, OutputPathLength, ResultName, pPathName);
    Buffer = ResultName[0].Buffer;
LABEL_16:
    v14 = OutputNT;
    ExFreePoolWithTag(Buffer, 0);
  }
  return v14;
}

Referenced by:

ExpTranslateArcPath