chromium/third_party/unrar/src/filefn.cpp

#include "rar.hpp"

MKDIR_CODE MakeDir(const std::wstring &Name,bool SetAttr,uint Attr)
{}


// Simplified version of MakeDir().
bool CreateDir(const std::wstring &Name)
{}


bool CreatePath(const std::wstring &Path,bool SkipLastName,bool Silent)
{}


void SetDirTime(const std::wstring &Name,RarTime *ftm,RarTime *ftc,RarTime *fta)
{}


bool IsRemovable(const std::wstring &Name)
{}


#ifndef SFX_MODULE
int64 GetFreeDisk(const std::wstring &Name)
{}
#endif


#if defined(_WIN_ALL) && !defined(SFX_MODULE) && !defined(SILENT)
// Return 'true' for FAT and FAT32, so we can adjust the maximum supported
// file size to 4 GB for these file systems.
bool IsFAT(const std::wstring &Name)
{
  std::wstring Root;
  GetPathRoot(Name,Root);
  wchar FileSystem[MAX_PATH+1];
  // Root can be empty, when we create volumes with -v in the current folder.
  if (GetVolumeInformation(Root.empty() ? NULL:Root.c_str(),NULL,0,NULL,NULL,NULL,FileSystem,ASIZE(FileSystem)))
    return wcscmp(FileSystem,L"FAT")==0 || wcscmp(FileSystem,L"FAT32")==0;
  return false;
}
#endif


bool FileExist(const std::wstring &Name)
{}
 

bool WildFileExist(const std::wstring &Name)
{}


bool IsDir(uint Attr)
{}


bool IsUnreadable(uint Attr)
{}


bool IsLink(uint Attr)
{}






bool IsDeleteAllowed(uint FileAttr)
{}


void PrepareToDelete(const std::wstring &Name)
{}


uint GetFileAttr(const std::wstring &Name)
{}


bool SetFileAttr(const std::wstring &Name,uint Attr)
{}


wchar* MkTemp(wchar *Name,size_t MaxSize)
{}


bool MkTemp(std::wstring &Name)
{}


#if !defined(SFX_MODULE)
void CalcFileSum(File *SrcFile,uint *CRC32,byte *Blake2,uint Threads,int64 Size,uint Flags)
{}
#endif


bool RenameFile(const std::wstring &SrcName,const std::wstring &DestName)
{}


bool DelFile(const std::wstring &Name)
{}


bool DelDir(const std::wstring &Name)
{}


#if defined(_WIN_ALL) && !defined(SFX_MODULE)
bool SetFileCompression(const std::wstring &Name,bool State)
{
  HANDLE hFile=CreateFile(Name.c_str(),FILE_READ_DATA|FILE_WRITE_DATA,
                 FILE_SHARE_READ|FILE_SHARE_WRITE,NULL,OPEN_EXISTING,
                 FILE_FLAG_BACKUP_SEMANTICS|FILE_FLAG_SEQUENTIAL_SCAN,NULL);
  if (hFile==INVALID_HANDLE_VALUE)
  {
    std::wstring LongName;
    if (GetWinLongPath(Name,LongName))
      hFile=CreateFile(LongName.c_str(),FILE_READ_DATA|FILE_WRITE_DATA,
                 FILE_SHARE_READ|FILE_SHARE_WRITE,NULL,OPEN_EXISTING,
                 FILE_FLAG_BACKUP_SEMANTICS|FILE_FLAG_SEQUENTIAL_SCAN,NULL);
  }
  if (hFile==INVALID_HANDLE_VALUE)
    return false;
  SHORT NewState=State ? COMPRESSION_FORMAT_DEFAULT:COMPRESSION_FORMAT_NONE;
  DWORD Result;
  int RetCode=DeviceIoControl(hFile,FSCTL_SET_COMPRESSION,&NewState,
                              sizeof(NewState),NULL,0,&Result,NULL);
  CloseHandle(hFile);
  return RetCode!=0;
}


void ResetFileCache(const std::wstring &Name)
{
  // To reset file cache in Windows it is enough to open it with
  // FILE_FLAG_NO_BUFFERING and then close it.
  HANDLE hSrc=CreateFile(Name.c_str(),GENERIC_READ,
                         FILE_SHARE_READ|FILE_SHARE_WRITE,
                         NULL,OPEN_EXISTING,FILE_FLAG_NO_BUFFERING,NULL);
  if (hSrc!=INVALID_HANDLE_VALUE)
    CloseHandle(hSrc);
}
#endif












// Delete symbolic links in file path, if any, and replace them by directories.
// Prevents extracting files outside of destination folder with symlink chains.
bool LinksToDirs(const std::wstring &SrcName,const std::wstring &SkipPart,std::wstring &LastChecked)
{}