Source file: /~heha/hs/cdcat1plugin.zip/src-linux/fsplugin.h

/* This is Christian Ghislers Total Commander File System Plugin API
 with changes by haftmann#software:
*220502	#include <windows.h> resolves BOOL, HANDLE, MAX_PATH, WINAPI
	#define to enum
	__stdcall to WINAPI
	const specifiers
	reference specifiers (C++ only)
*/
#ifdef WIN32
# include <windows.h>	// BOOL, HANDLE
# pragma intrinsic(memcpy,memset)
#else
typedef unsigned BOOL,DWORD;
typedef unsigned short WORD;
typedef struct{}*HANDLE;
#define INVALID_HANDLE_VALUE ((HANDLE)-1)
//typedef wchar_t WCHAR;
struct FILETIME {DWORD dwLowDateTime,dwHighDateTime;};
struct WIN32_FIND_DATA {
 DWORD dwFileAttributes;
 FILETIME ftCreationTime,ftLastAccessTime,ftLastWriteTime;
 DWORD nFileSizeHigh,nFileSizeLow, dwReserved0, dwReserved1;
 char cFileName[260],cAlternateFileName[14];
};
enum{
 FILE_ATTRIBUTE_READONLY=0x01,
 FILE_ATTRIBUTE_HIDDEN=0x02,
 FILE_ATTRIBUTE_SYSTEM=0x04,
 FILE_ATTRIBUTE_DIRECTORY=0x10,
 FILE_ATTRIBUTE_ARCHIVE=0x20,
};
#define WINAPI
#define EXPORT(ret) extern "C" __attribute__((visibility("default"))) ret WINAPI
#endif

enum{
// ids for FsGetFile
 FS_FILE_OK=0,
 FS_FILE_EXISTS=1,
 FS_FILE_NOTFOUND=2,
 FS_FILE_READERROR=3,
 FS_FILE_WRITEERROR=4,
 FS_FILE_USERABORT=5,
 FS_FILE_NOTSUPPORTED=6,
 FS_FILE_EXISTSRESUMEALLOWED=7,

 FS_EXEC_OK=0,
 FS_EXEC_ERROR=1,
 FS_EXEC_YOURSELF=-1,
 FS_EXEC_SYMLINK=-2,

 FS_COPYFLAGS_OVERWRITE=1,
 FS_COPYFLAGS_RESUME=2,
 FS_COPYFLAGS_MOVE=4,
 FS_COPYFLAGS_EXISTS_SAMECASE=8,
 FS_COPYFLAGS_EXISTS_DIFFERENTCASE=16,
 
// flags for tRequestProc
 RT_Other=0,
 RT_UserName=1,
 RT_Password=2,
 RT_Account=3,
 RT_UserNameFirewall=4,
 RT_PasswordFirewall=5,
 RT_TargetDir=6,
 RT_URL=7,
 RT_MsgOK=8,
 RT_MsgYesNo=9,
 RT_MsgOKCancel=10,

// flags for tLogProc
 MSGTYPE_CONNECT=1,
 MSGTYPE_DISCONNECT=2,
 MSGTYPE_DETAILS=3,
 MSGTYPE_TRANSFERCOMPLETE=4,
 MSGTYPE_CONNECTCOMPLETE=5,
 MSGTYPE_IMPORTANTERROR=6,
 MSGTYPE_OPERATIONCOMPLETE=7,

// flags for FsStatusInfo
 FS_STATUS_START=0,
 FS_STATUS_END=1,

 FS_STATUS_OP_LIST=1,
 FS_STATUS_OP_GET_SINGLE=2,
 FS_STATUS_OP_GET_MULTI=3,
 FS_STATUS_OP_PUT_SINGLE=4,
 FS_STATUS_OP_PUT_MULTI=5,
 FS_STATUS_OP_RENMOV_SINGLE=6,
 FS_STATUS_OP_RENMOV_MULTI=7,
 FS_STATUS_OP_DELETE=8,
 FS_STATUS_OP_ATTRIB=9,
 FS_STATUS_OP_MKDIR=10,
 FS_STATUS_OP_EXEC=11,
 FS_STATUS_OP_CALCSIZE=12,
 FS_STATUS_OP_SEARCH=13,
 FS_STATUS_OP_SEARCH_TEXT=14,
 FS_STATUS_OP_SYNC_SEARCH=15,
 FS_STATUS_OP_SYNC_GET=16,
 FS_STATUS_OP_SYNC_PUT=17,
 FS_STATUS_OP_SYNC_DELETE=18,

 FS_ICONFLAG_SMALL=1,
 FS_ICONFLAG_BACKGROUND=2,

 FS_ICON_USEDEFAULT=0,
 FS_ICON_EXTRACTED=1,
 FS_ICON_EXTRACTED_DESTROY=2,
 FS_ICON_DELAYED=3,

 FS_BITMAP_NONE=0,
 FS_BITMAP_EXTRACTED=1,
 FS_BITMAP_EXTRACT_YOURSELF=2,
 FS_BITMAP_EXTRACT_YOURSELF_ANDDELETE=3,
 FS_BITMAP_CACHE=256,
 FS_CRYPT_SAVE_PASSWORD=1,
 FS_CRYPT_LOAD_PASSWORD=2,
 FS_CRYPT_LOAD_PASSWORD_NO_UI=3,// Load password only if master password has already been entered!
 FS_CRYPT_COPY_PASSWORD=4,	// Copy encrypted password to new connection name
 FS_CRYPT_MOVE_PASSWORD=5,	// Move password when renaming a connection
 FS_CRYPT_DELETE_PASSWORD=6,	// Delete password

 FS_CRYPTOPT_MASTERPASS_SET=1,	// The user already has a master password defined
};

struct RemoteInfoStruct{
 DWORD SizeLow,SizeHigh;
 FILETIME LastWriteTime;
 int Attr;
};

struct FsDefaultParamStruct{
 int size;
 DWORD PluginInterfaceVersionLow;
 DWORD PluginInterfaceVersionHi;
 char DefaultIniName[260];
};

// callback functions
typedef int (WINAPI*tProgressProc)(int PluginNr,const char*SourceName,
	const char*TargetName,int PercentDone);
typedef void (WINAPI*tLogProc)(int PluginNr,int MsgType,const char*LogString);

typedef BOOL (WINAPI*tRequestProc)(int PluginNr,int RequestType,const char*CustomTitle,
	const char* CustomText,char* ReturnedText,int buflen);
typedef int (WINAPI*tCryptProc)(int PluginNr,int CryptoNr,int Mode,
	const char* ConnectionName,char*Password,int passlen);

// Function prototypes
EXPORT(int) FsInit(int PluginNr,tProgressProc pProgressProc,
	tLogProc pLogProc,tRequestProc pRequestProc);
void WINAPI FsSetCryptCallback(tCryptProc pCryptProc,int CryptoNr,int Flags);
EXPORT(HANDLE) FsFindFirst(const char*Path,WIN32_FIND_DATA&FindData);

EXPORT(BOOL) FsFindNext(HANDLE Hdl,WIN32_FIND_DATA&FindData);
EXPORT(int) FsFindClose(HANDLE Hdl);
BOOL WINAPI FsMkDir(const char*Path);
int WINAPI FsExecuteFile(HANDLE MainWin,const char* RemoteName,char* Verb);
int WINAPI FsRenMovFile(const char*OldName,const char*NewName,BOOL Move,
                           BOOL OverWrite,RemoteInfoStruct*ri);
int WINAPI FsGetFile(const char*RemoteName,const char*LocalName,int CopyFlags,
                        RemoteInfoStruct* ri);

int WINAPI FsPutFile(const char*,const char*,int CopyFlags);
BOOL WINAPI FsDeleteFile(const char*);
BOOL WINAPI FsRemoveDir(const char*);
BOOL WINAPI FsDisconnect(const char*);
BOOL WINAPI FsSetAttr(const char*,int NewAttr);
BOOL WINAPI FsSetTime(const char*,const FILETIME*,const FILETIME*,const FILETIME*);
void WINAPI FsStatusInfo(const char*,int InfoStartEnd,int InfoOperation);
void WINAPI FsGetDefRootName(const char*DefRootName,int maxlen);
EXPORT(int) FsExtractCustomIcon(const char*,int ExtractFlags,int&TheIcon);
EXPORT(void) FsSetDefaultParams(FsDefaultParamStruct&dps);

int WINAPI FsGetPreviewBitmap(const char*RemoteName,int width,int height,int*ReturnedBitmap);
BOOL WINAPI FsLinksToLocalFiles();
BOOL WINAPI FsGetLocalName(const char*,int maxlen);

// ************************** content plugin extension ****************************
#ifdef WIN32
typedef int (WINAPI*tProgressProcW)(int PluginNr,const WCHAR*SourceName,const WCHAR* TargetName,int PercentDone);
typedef void (WINAPI*tLogProcW)(int PluginNr,int MsgType,const WCHAR*LogString);
typedef BOOL (WINAPI*tRequestProcW)(int PluginNr,int RequestType,const WCHAR*CustomTitle,const WCHAR*CustomText,WCHAR* ReturnedText,int buflen);
typedef int (WINAPI*tCryptProcW)(int PluginNr,int CryptoNr,int Mode,const WCHAR*ConnectionName,WCHAR* Password,int passlen);

int WINAPI FsInitW(int PluginNr,tProgressProcW p1,tLogProcW p2,tRequestProcW p3);
void WINAPI FsSetCryptCallbackW(tCryptProcW pCryptProcW,int CryptoNr,int Flags);
HANDLE WINAPI FsFindFirstW(WCHAR* Path,WIN32_FIND_DATAW&FindData);
BOOL WINAPI FsFindNextW(HANDLE Hdl,WIN32_FIND_DATAW&FindData);
BOOL WINAPI FsMkDirW(const WCHAR*Path);
int WINAPI FsExecuteFileW(HWND MainWin,const WCHAR* RemoteName,WCHAR* Verb);
BOOL WINAPI FsDeleteFileW(const WCHAR*);
int WINAPI FsRenMovFileW(const WCHAR*OldName,const WCHAR*NewName,BOOL Move,BOOL,RemoteInfoStruct*ri);
int WINAPI FsGetFileW(const WCHAR*RemoteName,const WCHAR*LocalName,int CopyFlags,RemoteInfoStruct* ri);
int WINAPI FsPutFileW(const WCHAR*,const WCHAR*,int CopyFlags);
BOOL WINAPI FsRemoveDirW(const WCHAR*);
BOOL WINAPI FsDisconnectW(const WCHAR*);
BOOL WINAPI FsSetAttrW(const WCHAR*,int NewAttr);
BOOL WINAPI FsSetTimeW(const WCHAR*,const FILETIME*,const FILETIME*,const FILETIME*);
void WINAPI FsStatusInfoW(const WCHAR*,int InfoStartEnd,int InfoOperation);
int WINAPI FsExtractCustomIconW(WCHAR*,int ExtractFlags,HICON* TheIcon);
int WINAPI FsGetPreviewBitmapW(WCHAR* RemoteName,int width,int height,HBITMAP* ReturnedBitmap);
BOOL WINAPI FsGetLocalNameW(const WCHAR*,int maxlen);
#endif

enum{
 ft_nomorefields=0,
 ft_numeric_32=1,
 ft_numeric_64=2,
 ft_numeric_floating=3,
 ft_date=4,
 ft_time=5,
 ft_boolean=6,
 ft_multiplechoice=7,
 ft_string=8,
 ft_fulltext=9,
 ft_datetime=10,
 ft_stringw=11,       // Should only be returned by Unicode function

// for FsContentGetValue
 ft_nosuchfield=-1,   // error, invalid field number given
 ft_fileerror=-2,     // file i/o error
 ft_fieldempty=-3,    // field valid, but empty

 ft_ondemand=-4,      // field will be retrieved only when user presses <SPACEBAR>
 ft_delayed=0,        // field takes a long time to extract -> try again in background

// for FsContentSetValue
 ft_setsuccess=0,     // setting of the attribute succeeded

// for FsContentGetSupportedFieldFlags
 contflags_edit=1,
 contflags_substsize=2,
 contflags_substdatetime=4,
 contflags_substdate=6,
 contflags_substtime=8,
 contflags_substattributes=10,

 contflags_substattributestr=12,
 contflags_substmask=14,

// for FsContentSetValue
 setflags_first_attribute=1,     // First attribute of this file
 setflags_last_attribute=2,     // Last attribute of this file
 setflags_only_date=4,     // Only set the date of the datetime value!
 CONTENT_DELAYIFSLOW=1,  // ContentGetValue called in foreground
};

struct ContentDefaultParamStruct{
 int size;
 DWORD PluginInterfaceVersionLow;
 DWORD PluginInterfaceVersionHi;
 char DefaultIniName[260];
};

typedef struct tdateformat{
 WORD wYear;
 WORD wMonth;
 WORD wDay;
}*pdateformat;

typedef struct ttimeformat{
 WORD wHour;
 WORD wMinute;
 WORD wSecond;
}*ptimeformat;

int WINAPI FsContentGetSupportedField(int FieldIndex,char* FieldName,char* Units,int maxlen);
int WINAPI FsContentGetValue(char* FileName,int FieldIndex,int UnitIndex,void* FieldValue,int maxlen,int flags);
//int WINAPI FsContentGetValueW(WCHAR* FileName,int FieldIndex,int UnitIndex,void* FieldValue,int maxlen,int flags);


void WINAPI FsContentStopGetValue(char* FileName);
//void WINAPI FsContentStopGetValueW(WCHAR* FileName);
int WINAPI FsContentGetDefaultSortOrder(int FieldIndex);
void WINAPI FsContentPluginUnloading(void);
int WINAPI FsContentGetSupportedFieldFlags(int FieldIndex);
int WINAPI FsContentSetValue(char* FileName,int FieldIndex,int UnitIndex,int FieldType,void* FieldValue,int flags);
//int WINAPI FsContentSetValueW(WCHAR* FileName,int FieldIndex,int UnitIndex,int FieldType,void* FieldValue,int flags);

BOOL WINAPI FsContentGetDefaultView(char* ViewContents,char* ViewHeaders,char* ViewWidths,char* ViewOptions,int maxlen);
//BOOL WINAPI FsContentGetDefaultViewW(WCHAR* ViewContents,WCHAR* ViewHeaders,WCHAR* ViewWidths,WCHAR* ViewOptions,int maxlen);
Detected encoding: UTF-80