home *** CD-ROM | disk | FTP | other *** search
/ DOS/V Power Report 1999 October / VPR9910A.BIN / OLS / unrar32005 / unrar32005.lzh / src / unrarapi.h < prev    next >
C/C++ Source or Header  |  1998-04-03  |  3KB  |  96 lines

  1. /*
  2.  *   Copyright (c) 1998 T. Kamei (kamei@jsdlab.co.jp)
  3.  *
  4.  *   Permission to use, copy, modify, and distribute this software
  5.  * and its documentation for any purpose is hereby granted provided
  6.  * that the above copyright notice and this permission notice appear
  7.  * in all copies of the software and related documentation.
  8.  *
  9.  *                          NO WARRANTY
  10.  *
  11.  *   THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY WARRANTIES;
  12.  * WITHOUT EVEN THE IMPLIED WARRANTIES OF MERCHANTABILITY OR FITNESS
  13.  * FOR A PARTICULAR PURPOSE.
  14.  */
  15.  
  16. #ifndef _UNRARAPI_H_
  17. #define _UNRARAPI_H_
  18.  
  19. extern "C"
  20. {
  21. #include "UnRAR.h"
  22. }
  23.  
  24. #define FRAR_PREVVOL 1
  25. #define FRAR_NEXTVOL 2
  26. #define FRAR_ENCRYPTED 4
  27. #define FRAR_COMMENT 8
  28. #define FRAR_SOLID 16
  29.  
  30. class rarOpenArchiveData: public RAROpenArchiveData
  31. {
  32. public:
  33.   rarOpenArchiveData (const char *path, int mode,
  34.                       char *buf = 0, int size = 0)
  35.     {
  36.       ArcName = (char *)path;
  37.       CmtBuf = buf;
  38.       CmtBufSize = size;
  39.       OpenMode = mode;
  40.     }
  41. };
  42.  
  43. class rarHeaderData: public RARHeaderData
  44. {
  45. public:
  46.   rarHeaderData ()
  47.     {
  48.       CmtBuf = 0;
  49.       CmtBufSize = 0;
  50.     }
  51.   rarHeaderData (char *buf, int size)
  52.     {
  53.       CmtBuf = buf;
  54.       CmtBufSize = size;
  55.     }
  56. };
  57.  
  58. #ifndef EXTERN
  59. #define EXTERN extern
  60. #endif
  61.  
  62. EXTERN HANDLE (__stdcall *rarOpenArchive)(RAROpenArchiveData *);
  63. EXTERN int (__stdcall *rarCloseArchive)(HANDLE);
  64. EXTERN int (__stdcall *rarReadHeader)(HANDLE, RARHeaderData *);
  65. EXTERN int (__stdcall *rarProcessFile)(HANDLE, int, char *, char *);
  66. EXTERN void (__stdcall *rarSetChangeVolProc)(HANDLE, int (__cdecl *)(char *, int));
  67. EXTERN void (__stdcall *rarSetProcessDataProc)(HANDLE, int (__cdecl *)(unsigned char *, int));
  68. EXTERN void (__stdcall *rarSetPassword)(HANDLE, const char *);
  69.  
  70. class rarData
  71. {
  72. public:
  73.   HANDLE h;
  74.   RAROpenArchiveData oad;
  75.   RARHeaderData hd;
  76.  
  77.   rarData () : h (0) {}
  78.   ~rarData () {close ();}
  79.   int open (const char *, int, char * = 0, int = 0);
  80.   int close ();
  81.   int read_header () {return rarReadHeader (h, &hd);}
  82.   int skip () const {return rarProcessFile (h, RAR_SKIP, 0, 0);}
  83.   int test () const {return rarProcessFile (h, RAR_TEST, 0, 0);}
  84.   int extract (const char *path, const char *name) const
  85.     {return rarProcessFile (h, RAR_EXTRACT, (char *)path, (char *)name);}
  86. };
  87.  
  88. HINSTANCE load_rarapi ();
  89. int file_executable_p (const char *);
  90. int calc_ratio (u_long, u_long);
  91. const char *method_string (int);
  92. int os_type (int);
  93. const char *attr_string (int);
  94.  
  95. #endif
  96.