home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
DOS/V Power Report 2002 July
/
VPR0207A.ISO
/
OLS
/
UNRAR32007
/
unrar32007.lzh
/
src.lzh
/
src
/
unrarapi.h
< prev
next >
Wrap
C/C++ Source or Header
|
2001-01-06
|
3KB
|
96 lines
/*
* Copyright (c) 1998-2001 T. Kamei (kamei@jsdlab.co.jp)
*
* Permission to use, copy, modify, and distribute this software
* and its documentation for any purpose is hereby granted provided
* that the above copyright notice and this permission notice appear
* in all copies of the software and related documentation.
*
* NO WARRANTY
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY WARRANTIES;
* WITHOUT EVEN THE IMPLIED WARRANTIES OF MERCHANTABILITY OR FITNESS
* FOR A PARTICULAR PURPOSE.
*/
#ifndef _UNRARAPI_H_
#define _UNRARAPI_H_
extern "C"
{
#include "UnRAR.h"
}
#define FRAR_PREVVOL 1
#define FRAR_NEXTVOL 2
#define FRAR_ENCRYPTED 4
#define FRAR_COMMENT 8
#define FRAR_SOLID 16
class rarOpenArchiveData: public RAROpenArchiveData
{
public:
rarOpenArchiveData (const char *path, int mode,
char *buf = 0, int size = 0)
{
ArcName = (char *)path;
CmtBuf = buf;
CmtBufSize = size;
OpenMode = mode;
}
};
class rarHeaderData: public RARHeaderData
{
public:
rarHeaderData ()
{
CmtBuf = 0;
CmtBufSize = 0;
}
rarHeaderData (char *buf, int size)
{
CmtBuf = buf;
CmtBufSize = size;
}
};
#ifndef EXTERN
#define EXTERN extern
#endif
EXTERN HANDLE (__stdcall *rarOpenArchive)(RAROpenArchiveData *);
EXTERN int (__stdcall *rarCloseArchive)(HANDLE);
EXTERN int (__stdcall *rarReadHeader)(HANDLE, RARHeaderData *);
EXTERN int (__stdcall *rarProcessFile)(HANDLE, int, char *, char *);
EXTERN void (__stdcall *rarSetChangeVolProc)(HANDLE, int (__cdecl *)(char *, int));
EXTERN void (__stdcall *rarSetProcessDataProc)(HANDLE, int (__cdecl *)(unsigned char *, int));
EXTERN void (__stdcall *rarSetPassword)(HANDLE, const char *);
class rarData
{
public:
HANDLE h;
RAROpenArchiveData oad;
RARHeaderData hd;
rarData () : h (0) {}
~rarData () {close ();}
int open (const char *, int, char * = 0, int = 0);
int close ();
int read_header () {return rarReadHeader (h, &hd);}
int skip () const {return rarProcessFile (h, RAR_SKIP, 0, 0);}
int test () const {return rarProcessFile (h, RAR_TEST, 0, 0);}
int extract (const char *path, const char *name) const
{return rarProcessFile (h, RAR_EXTRACT, (char *)path, (char *)name);}
};
HINSTANCE load_rarapi ();
int file_executable_p (const char *);
int calc_ratio (u_long, u_long);
const char *method_string (int);
int os_type (int);
const char *attr_string (int);
#endif