TPI
|
00001 00009 /******************************************************************************* 00010 TPI - flexible but useless plug-in framework. 00011 Copyright (C) 2002-2009 Silky 00012 00013 This library is free software; you can redistribute it and/or modify it under 00014 the terms of the GNU Lesser General Public License as published by the Free 00015 Software Foundation; either version 2.1 of the License, or (at your option) 00016 any later version. 00017 00018 This library is distributed in the hope that it will be useful, but WITHOUT 00019 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 00020 FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License 00021 for more details. 00022 00023 You should have received a copy of the GNU Lesser General Public License along 00024 with this library; if not, write to the Free Software Foundation, Inc., 00025 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 00026 *******************************************************************************/ 00027 00031 #define wxUSE_UNICODE 1 00032 00035 #include <wx/wx.h> 00036 #include <wx/filename.h> 00037 00038 #ifndef __TPI_API_SPEC 00039 #define __TPI_API_SPEC 00040 00041 #ifdef __GNUC__ 00042 #define __stdcall __attribute__((__stdcall__)) 00043 #endif 00044 00045 // ***************************************************************************** 00048 // ***************************************************************************** 00049 00061 #define TPI_ERROR_SUCCESS 1000 00062 #define TPI_ERROR_S_ENDOFDATA TPI_ERROR_SUCCESS + 1 00071 #define TPI_ERROR_UNDEFINED 2000 00072 #define TPI_ERROR_U_LOAD_LIBRARY TPI_ERROR_UNDEFINED + 1 00073 #define TPI_ERROR_U_USE_LIBRARY TPI_ERROR_UNDEFINED + 2 00074 #define TPI_ERROR_U_FREE_LIBRARY TPI_ERROR_UNDEFINED + 3 00083 #define TPI_ERROR_DEFINED 3000 00084 #define TPI_ERROR_D_PARAMETER TPI_ERROR_DEFINED + 1 00085 #define TPI_ERROR_D_UNSUPPORTED TPI_ERROR_DEFINED + 2 00086 #define TPI_ERROR_D_SKIPPED TPI_ERROR_DEFINED + 3 00087 #define TPI_ERROR_D_OUTOFMEMORY TPI_ERROR_DEFINED + 4 00088 #define TPI_ERROR_D_USEMEMORY TPI_ERROR_DEFINED + 5 00098 #define TPI_ERROR_T_IO_MISC 0 00099 #define TPI_ERROR_T_IO_ARCHIVE TPI_ERROR_T_IO_MISC + 100 00100 #define TPI_ERROR_T_IO_FILE TPI_ERROR_T_IO_MISC + 200 00101 #define TPI_ERROR_T_IO_WORKING TPI_ERROR_T_IO_MISC + 300 00102 #define TPI_ERROR_T_IO_DIRECTORY TPI_ERROR_T_IO_MISC + 400 00105 #define TPI_ERROR_IO_MISC 4000 00106 #define TPI_ERROR_IO_NOTFOUND TPI_ERROR_IO_MISC + 1 00107 #define TPI_ERROR_IO_ACCESS TPI_ERROR_IO_MISC + 2 00108 #define TPI_ERROR_IO_OPEN TPI_ERROR_IO_MISC + 3 00109 #define TPI_ERROR_IO_CLOSE TPI_ERROR_IO_MISC + 4 00110 #define TPI_ERROR_IO_READ TPI_ERROR_IO_MISC + 5 00111 #define TPI_ERROR_IO_WRITE TPI_ERROR_IO_MISC + 6 00112 #define TPI_ERROR_IO_GETINFO TPI_ERROR_IO_MISC + 7 00113 #define TPI_ERROR_IO_POINT TPI_ERROR_IO_MISC + 8 00114 #define TPI_ERROR_IO_COPY TPI_ERROR_IO_MISC + 9 00115 #define TPI_ERROR_IO_MOVE TPI_ERROR_IO_MISC + 10 00116 #define TPI_ERROR_IO_DELETE TPI_ERROR_IO_MISC + 11 00117 #define TPI_ERROR_IO_SETINFO TPI_ERROR_IO_MISC + 12 00119 #define TPI_ERROR_ARC_MISC TPI_ERROR_IO_MISC + TPI_ERROR_T_IO_ARCHIVE + 20 00120 #define TPI_ERROR_ARC_UNSUPPORTED TPI_ERROR_ARC_MISC + 1 00121 #define TPI_ERROR_ARC_ENCRYPTED TPI_ERROR_ARC_MISC + 2 00122 #define TPI_ERROR_ARC_DANGER TPI_ERROR_ARC_MISC + 3 00123 #define TPI_ERROR_ARC_BROKEN_MISC TPI_ERROR_IO_MISC + TPI_ERROR_T_IO_ARCHIVE + 30 00124 #define TPI_ERROR_ARC_BROKEN_SUM TPI_ERROR_ARC_BROKEN_MISC + 1 00125 #define TPI_ERROR_ARC_BROKEN_SIZE TPI_ERROR_ARC_BROKEN_MISC + 2 00126 #define TPI_ERROR_ARC_BROKEN_HEADER TPI_ERROR_ARC_BROKEN_MISC + 3 00136 #define TPI_INFO_VERSION_MAJOR 0x0001 00137 #define TPI_INFO_VERSION_MINOR 0x0002 00138 #define TPI_INFO_VERSION_API 0x0003 00146 #define TPI_COMMAND_CREATE 0x0001 00147 #define TPI_COMMAND_ADD 0x0002 00148 #define TPI_COMMAND_EXTRACT 0x0004 00149 #define TPI_COMMAND_DELETE 0x0008 00150 #define TPI_COMMAND_UPDATE 0x0010 00151 #define TPI_COMMAND_TEST 0x0020 00152 #define TPI_COMMAND_REPAIR 0x0040 00153 #define TPI_COMMAND_MOVE 0x0080 00154 #define TPI_COMMAND_SFX 0x0100 00155 #define TPI_COMMAND_UNSFX 0x0200 00166 #define TPI_NOTIFY_COMMON 0x0001 00167 #define TPI_NOTIFY_SETPARAM 0x0002 00180 #define TPI_MESSAGE_STATUS 0x0001 00181 00183 #define TPI_MESSAGE_ASK 0x0002 00184 00186 #define TPI_MESSAGE_ERROR 0x1000 00187 #define TPI_MESSAGE_WARNING 0x1001 00197 #define TPI_STATUS_OPENARCHIVE 0x0001 00198 #define TPI_STATUS_CLOSEARCHIVE 0x0002 00199 #define TPI_STATUS_SEEKFILE 0x0003 00200 #define TPI_STATUS_BEGINPROCESS 0x0004 00201 #define TPI_STATUS_INPROCESS 0x0005 00202 #define TPI_STATUS_ENDPROCESS 0x0006 00203 #define TPI_STATUS_TESTARCHIVE 0x0007 00204 #define TPI_STATUS_COPYARCHIVE 0x0008 00214 #define TPI_PARAM_PASSWORD 0x0001 00215 #define TPI_PARAM_NEXTVOLUME 0x0002 00216 #define TPI_PARAM_DEST 0x0003 00225 #define TPI_CALLBACK_CONTINUE TRUE 00226 #define TPI_CALLBACK_CANCEL 0x1000 00227 #define TPI_CALLBACK_SKIP 0x1001 00228 #define TPI_CALLBACK_UNSUPPORTED 0x1002 00237 #define TPI_ATTRIBUTE_READONLY 0x00000001 00238 #define TPI_ATTRIBUTE_HIDDEN 0x00000002 00239 #define TPI_ATTRIBUTE_SYSTEM 0x00000004 00240 #define TPI_ATTRIBUTE_DIRECTORY 0x00000010 00241 #define TPI_ATTRIBUTE_ARCHIVE 0x00000020 00242 #define TPI_ATTRIBUTE_ENCRYPTED 0x00004000 00244 00245 00246 // ***************************************************************************** 00249 // ***************************************************************************** 00250 00251 #pragma pack(1) 00252 00253 typedef struct _TPI_tagFORMATINFO 00254 { 00255 bool fArchive; 00256 bool fComment; 00257 bool fCompressHeader; 00258 bool fEncryptKeyFile; 00259 bool fEncryptPassword; 00260 bool fEncryptHeader; 00261 bool fMMOptimize; 00262 bool fMultiVolume; 00263 bool fSFX; 00264 bool fSolid; 00265 unsigned short nCompressLevelMin; 00266 unsigned short nCompressLevelMax; 00267 unsigned short nRecoveryRecordMin; 00268 unsigned short nRecoveryRecordMax; 00269 wxULongLong_t nTypeId; 00270 wxULongLong_t eSupportedCommand; 00271 wxString szTypeName; 00272 wxString szSuffix; 00273 wxString szEngineName; 00274 wxString szTPIName; 00275 void * pCustomInfo; 00276 } TPI_FORMATINFO; 00277 00279 typedef struct _TPI_tagFILEINFO 00280 { 00281 unsigned short eDanger; 00282 unsigned short eOSType; 00283 unsigned short wCompressRatio; 00284 unsigned short wPermission; 00287 unsigned long dwAttribute; 00288 unsigned long dwCRC32; 00289 wxULongLong_t nPackedSize; 00290 wxULongLong_t nUnpackedSize; 00291 wxULongLong_t nFileId; 00292 wxDateTime tmAccess; 00293 wxDateTime tmCreate; 00294 wxDateTime tmModify; 00295 wxFileName fnFileName; 00296 wxString szStoredName; 00297 wxString szMethod; 00298 wxString szComment; 00299 wxString szUser; 00300 wxString szGroup; 00301 void * pCustomInfo; 00302 } TPI_FILEINFO; 00303 00305 typedef struct _TPI_tagARCHIVEINFO 00306 { 00307 bool fSFX; 00308 bool fSolid; 00309 bool fMMOptimize; 00310 bool fEncryptData; 00311 bool fEncryptHeader; 00312 bool fCompressHeader; 00313 unsigned short eOSType; 00314 unsigned short nCompressLevel; 00315 unsigned short nRecoveryRecord; 00316 unsigned short wCompressRatio; 00317 wxULongLong_t nFileSize; 00318 wxULongLong_t nPackedSize; 00319 wxULongLong_t nReadSize; 00320 wxULongLong_t nUnpackedSize; 00321 wxULongLong_t nSplitSize; 00322 wxDateTime tmAccess; 00323 wxDateTime tmCreate; 00324 wxDateTime tmModify; 00325 wxFileName fnArchive; 00326 wxString szComment; 00327 TPI_FORMATINFO fiInfo; 00328 void * pCustomInfo; 00329 } TPI_ARCHIVEINFO; 00330 00332 typedef struct _TPI_tagSWITCHES 00333 { 00334 bool fStoreDirectoryPathes; 00335 bool fMakeSFX; 00336 bool fSolid; 00337 bool fMMOptimize; 00338 bool fEncryptHeader; 00339 bool fCompressHeader; 00340 unsigned short nCompressLevel; 00341 unsigned short nRecoveryRecord; 00342 wxULongLong_t nArchiveType; 00343 wxULongLong_t nSplitSize; 00344 wxFileName fnDestinationDirectory; 00345 wxString szPassword; 00346 wxString szKeyFile; 00347 wxString szComment; 00348 void * pCustomSwitches; 00349 } TPI_SWITCHES; 00350 00352 typedef struct _TPI_tagPROCESSINFO 00353 { 00356 unsigned int eMessage; 00359 unsigned int eStatus; 00360 TPI_FILEINFO fiInfo; 00361 wxULongLong_t nProcessedSize; 00362 wxFileName fnDestination; 00363 wxString szParam; 00364 void * pCustomInfo; 00365 } TPI_PROCESSINFO; 00366 00368 00369 // ***************************************************************************** 00372 // ***************************************************************************** 00373 00381 typedef int(__stdcall * TPI_PROC)(unsigned int _eMsg, void * _pInfo); 00382 00384 00385 #pragma pack() 00386 00387 // ***************************************************************************** 00390 // ***************************************************************************** 00391 00392 #ifdef __cplusplus 00393 extern "C" 00394 { 00395 #endif 00396 00404 int __stdcall GetPluginInformation 00405 ( 00406 unsigned int _eInfoId, 00407 wxULongLong_t _nSubOption, 00408 void * _pPtr 00409 ); 00410 00417 int __stdcall GetFormatInformation 00418 ( 00419 TPI_FORMATINFO * _fiInfo, 00420 bool _bFirst = false 00421 ); 00422 00429 int __stdcall LoadPlugin 00430 ( 00431 const wxString & _szArcName, 00432 TPI_PROC _prProc, 00433 wxULongLong_t _nTypeId = 0 00434 ); 00435 00440 int __stdcall FreePlugin 00441 ( 00442 void * _pReserved = NULL 00443 ); 00444 00451 int __stdcall OpenArchive 00452 ( 00453 const wxString & _szArcName, 00454 void * * _hArchive, 00455 wxULongLong_t * _nFileCount = NULL 00456 ); 00457 00462 int __stdcall CloseArchive 00463 ( 00464 void * _hArchive 00465 ); 00466 00473 int __stdcall GetFileInformation 00474 ( 00475 void * _hArchive, 00476 TPI_FILEINFO * _fiInfo, 00477 bool _bFirst = false 00478 ); 00479 00485 int __stdcall GetArchiveInformation 00486 ( 00487 void * _hArchive, 00488 TPI_ARCHIVEINFO * _aiInfo 00489 ); 00490 00499 int __stdcall Command 00500 ( 00501 wxULongLong_t _eCommand, 00502 TPI_SWITCHES * _swInfo, 00503 const wxString & _szArcName, 00504 const wxArrayString & _szFiles 00505 ); 00506 00507 #ifdef __cplusplus 00508 } 00509 #endif 00510 00512 00513 #endif /* __TPI_API_SPEC */