218 lines
5.5 KiB
C
218 lines
5.5 KiB
C
|
|
#if !defined(__FILTERSUPPORT_H__)
|
|
#define __FILTERSUPPORT_H__
|
|
|
|
|
|
#if defined(WIN32) && !defined(_WINDOWS)
|
|
#define _WINDOWS
|
|
#endif
|
|
#include <time.h>
|
|
|
|
#ifdef _WINDOWS
|
|
|
|
#include <windows.h>
|
|
#include <winbase.h>
|
|
#include <assert.h>
|
|
#include <io.h>
|
|
#include <direct.h>
|
|
|
|
#else
|
|
|
|
#define VDK_UNIX
|
|
|
|
#define _access access
|
|
#define _mkdir mkdir
|
|
#define GetPrivateProfileString myGetPrivateProfileString
|
|
|
|
#include <errno.h>
|
|
#include <signal.h>
|
|
#include <sys/wait.h>
|
|
|
|
#endif
|
|
#include "kvtypes.h"
|
|
|
|
|
|
#if defined (_SSOL26) || (_AOSF40) || (_IRIX62) || (_RS6K43) || (_ILNX21) || (_HPUX64i) || (_LNX64i) || (_XLNX64) || (_FBSD32i) || (_SOL64X) || (_SOL32X) || (_LNXPPC)
|
|
#include <dlfcn.h>
|
|
#elif defined (_HPUX11)
|
|
#include <dl.h>
|
|
#endif
|
|
|
|
|
|
|
|
#if defined (_HPUX11) || (_ILNX21) || (_RS6K43) || (_SSOL26) || (_HPUX64i) || (_LNX64i) || (_XLNX64) || (_FBSD32i) || (_SOL64X) || (_SOL32X) || (_LNXPPC)
|
|
#define wsprintf sprintf
|
|
#define LONGLONG long long
|
|
#endif
|
|
|
|
// Set your platform endian and 64-bit integer here
|
|
|
|
#if defined(_WIN32_INTEL) /* Windows 32 bit Intel X86 */
|
|
#endif
|
|
|
|
#if defined(_WIN64_IA64) /* Windows 64 bit Intel Itanium IA64 */
|
|
#endif
|
|
|
|
#if defined(_WIN64_INTEL) /* Windows 64 bit Intel X86_64 */
|
|
#endif
|
|
|
|
#if defined(_HPUX11) /* HPUX 32 bit RISC */
|
|
# define KV_BIG_ENDIAN
|
|
#endif
|
|
|
|
#if defined(HPUX_R64) /* HPUX 64 bit RISC */
|
|
# define KV_BIG_ENDIAN
|
|
# define KV_SIZEOF_LONG_IS_64_BITS
|
|
#endif
|
|
|
|
#if defined(_HPUX64i) /* HPUX 64 bit Intel Itanium IA64 */
|
|
# define KV_BIG_ENDIAN
|
|
# define KV_SIZEOF_LONG_IS_64_BITS
|
|
#endif
|
|
|
|
#if defined(_FBSD32i) /* Free BSD 32 bit Intel */
|
|
#endif
|
|
|
|
#if defined(_ILNX21) /* Linux 32 bit Intel */
|
|
#endif
|
|
|
|
#if defined(_LNXPPC) /* Linux 32 bit PowerPC */
|
|
# define KV_BIG_ENDIAN
|
|
#endif
|
|
|
|
#if defined(_LNXZ31) /* Linux 31 bit zOS */
|
|
# define KV_BIG_ENDIAN
|
|
#endif
|
|
|
|
#if defined(_LNXZ64) /* Linux 64 bit zOS */
|
|
# define KV_BIG_ENDIAN
|
|
# define KV_SIZEOF_LONG_IS_64_BITS
|
|
#endif
|
|
|
|
#if defined(_LNX64i) /* Linux 64 bit Intel Itanium IA64 */
|
|
# define KV_SIZEOF_LONG_IS_64_BITS
|
|
#endif
|
|
|
|
#if defined(_XLNX64) /* Linux 64 bit Intel X86_64 */
|
|
# define KV_SIZEOF_LONG_IS_64_BITS
|
|
#endif
|
|
|
|
#if defined(_SSOL26) /* Solaris 32 bit SPARC */
|
|
# define KV_BIG_ENDIAN
|
|
# define KV_CTIME_R_40
|
|
#endif
|
|
|
|
#if defined(_SOL32X) /* Solaris 32 bit Intel */
|
|
# define KV_CTIME_R_40
|
|
#endif
|
|
|
|
#if defined(SOL_S64) /* Solaris 64 bit SPARC */
|
|
# define KV_BIG_ENDIAN
|
|
# define KV_SIZEOF_LONG_IS_64_BITS
|
|
#endif
|
|
|
|
#if defined(_SOL64X) /* Solaris 64 bit Intel */
|
|
# define KV_SIZEOF_LONG_IS_64_BITS
|
|
# define KV_CTIME_R_40
|
|
#endif
|
|
|
|
|
|
#if defined(_RS6K43) /* AIX 32 bit PowerPC */
|
|
# define KV_BIG_ENDIAN
|
|
#endif
|
|
|
|
#if defined(AIX_P64) /* AIX 64 bit PowerPC */
|
|
# define KV_BIG_ENDIAN
|
|
# define KV_SIZEOF_LONG_IS_64_BITS
|
|
#endif
|
|
|
|
#if defined (OSX_U32) /* Mac 32 bit Intel/Power PC Universal binaries */
|
|
# if !defined (__LITTLE_ENDIAN__)
|
|
# define KV_BIG_ENDIAN
|
|
# endif
|
|
#endif
|
|
|
|
#if defined (OSX_U64) /* Mac 64 bit Intel/Power PC Universal binaries */
|
|
# if !defined (__LITTLE_ENDIAN__)
|
|
# define KV_BIG_ENDIAN
|
|
# endif
|
|
# define KV_SIZEOF_LONG_IS_64_BITS
|
|
#endif
|
|
|
|
|
|
#include "kvfilt.h"
|
|
|
|
#define GPPSTRINGMAXSIZE 0x00000800
|
|
|
|
|
|
KVFltInterfaceEx FilterFunc;
|
|
|
|
|
|
typedef struct
|
|
{
|
|
FILE *fp;
|
|
char *pszName;
|
|
}
|
|
MyOpenInfo;
|
|
|
|
|
|
|
|
typedef struct
|
|
{
|
|
char *pszSrcFile;
|
|
char *pszTrgFile;
|
|
int dwFlags;
|
|
LPDF_DIRECTION lpdfDirection;
|
|
int gbSummary;
|
|
int gbKWAD;
|
|
int gbStreamBased;
|
|
int AddInputFileName;
|
|
char szXMLConfigFile[_MAX_PATH];
|
|
char szTempDir[_MAX_PATH];
|
|
char szSrcPassword[MAX_PASSWORD_LEN];
|
|
KVErrorCodeEx(pascal *fpKV_GetKvErrorCodeEx)(void *);
|
|
int(pascal *fpKV_FilterConfig)(void *, int, int, void *);
|
|
BOOL bInclRMark;
|
|
BOOL bShowHiddenText;
|
|
BOOL bNoComments;
|
|
UINT gbXmp;
|
|
|
|
} FilterLsv;
|
|
|
|
|
|
|
|
KVErrorCode AutoDetectFile(void*, char*);
|
|
KVErrorCode AutoDetectStream(void*, char*);
|
|
static void pascal DoSummaryInfo(void*, KVFltInterfaceEx*, char*, char*);
|
|
static void pascal DoSummaryInfoStream(void*, KVFltInterfaceEx*, KVInputStream*, FILE*);
|
|
static int pascal FilterFile(void*, char*, char*, FilterLsv*);
|
|
static int pascal FilterStream(void*, char*, char*, FilterLsv*);
|
|
void FileTimeToUnixTime(LONGLONG, time_t*);
|
|
ENdocFmt FindFormatID(char*);
|
|
BOOL FreeKVXConfigInfo(KVXConfigInfo*);
|
|
void FileTimeToUnixTime(LONGLONG, time_t*);
|
|
int filterText(char*, char*, char*, FilterLsv*);
|
|
int filterArchive(void*, char*, char*);
|
|
BOOL GetKVXConfigInfo(FilterLsv*, KVXConfigInfo*, int);
|
|
void LocateINIFile(char*, char*);
|
|
|
|
BOOL pascal myOpen(struct tag_InputStream*);
|
|
UINT pascal myRead(struct tag_InputStream*, BYTE*, UINT);
|
|
BOOL pascal mySeek(struct tag_InputStream*, long, int);
|
|
long pascal myTell(struct tag_InputStream*);
|
|
BOOL pascal myClose(struct tag_InputStream*);
|
|
void * pascal myMalloc(struct tag_MemoryStream*, size_t);
|
|
void pascal myFree(struct tag_MemoryStream*, void*);
|
|
void * pascal myRealloc(struct tag_MemoryStream*, void*, size_t);
|
|
void * pascal myCalloc(struct tag_MemoryStream*, size_t, size_t);
|
|
HINSTANCE myLoadLibrary(char*);
|
|
//void myFreeLibrary(HINSTANCE);
|
|
void * myGetProcAddress(HINSTANCE, char*);
|
|
static void pascal PrintSummaryInfo(KVSummaryInfoEx*, FILE*);
|
|
void PrintFilterErrMsg(char*, KVErrorCode);
|
|
|
|
char* SaveINIFileString(char*);
|
|
void ShowUsage(char*);
|
|
|
|
#endif
|