aboutsummaryrefslogtreecommitdiff
path: root/lib/UnrarXLib/UnrarX.hpp
blob: c2f7c036972310dbdf09942c444370ad4e5115e1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
#ifndef _xbox_unrar_interface_
#define _xbox_unrar_interface_


/* This structure is used for listing archive content                       */
struct RAR20_archive_entry                  /* These infos about files are  */
{                                           /* stored in RAR v2.0 archives  */
  char          *Name;
  wchar_t       *NameW;
  unsigned short NameSize;
  unsigned long  PackSize;
  int64_t        UnpSize;
  unsigned char  HostOS;                    /* MSDOS=0,OS2=1,WIN32=2,UNIX=3 */
  unsigned long  FileCRC;
  unsigned long  FileTime;
  unsigned char  UnpVer;
  unsigned char  Method;
  unsigned long  FileAttr;
  int64_t        iOffset;
};

/* used to list archives */
typedef struct archivelist
{
  struct RAR20_archive_entry item;
  struct archivelist *next;
} ArchiveList_struct;

/*-------------------------------------------------------------------------*\
  Extract a RAR file
  rarfile      - Name of the RAR file to uncompress
  targetPath    - The path to which we want to uncompress
  fileToExtract - The file inside the archive we want to uncompress,
          or NULL for all files.
  libpassword   - Password (for encrypted archives)
\*-------------------------------------------------------------------------*/
int urarlib_get(char *rarfile, char *targetPath, char *fileToExtract, char *libpassword = NULL, int64_t* iOffset=NULL, bool bShowProgress=false);

/*-------------------------------------------------------------------------*\
  List the files in a RAR file
  rarfile    - Name of the RAR file to uncompress
  list      - Output. A list of file data of the files in the archive.
                The list should be freed with urarlib_freelist().
  libpassword - Password (for encrypted archives)
\*-------------------------------------------------------------------------*/
int urarlib_list(char *rarfile, ArchiveList_struct **ppList, char *libpassword = NULL, bool stopattwo=false);

/*-------------------------------------------------------------------------*\
  Free the file list returned by urarlib_list()
  list - The output from urarlib_list()
\*-------------------------------------------------------------------------*/
void urarlib_freelist(ArchiveList_struct *list);

/*-------------------------------------------------------------------------*\
  Function used internally to change filenames if
  they are fatx incompatible - unnedded and unused
\*-------------------------------------------------------------------------*/
void MakeNameUsable(char* szPath,bool KeepExtension, bool IsFatx);

#endif /* _xbox_unrar_interface_ */