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 00139 #define TPI_INFO_HANDLE_ON_COMMAND 0x1001 00147 #define TPI_COMMAND_CREATE 0x0001 00148 #define TPI_COMMAND_ADD 0x0002 00149 #define TPI_COMMAND_EXTRACT 0x0004 00150 #define TPI_COMMAND_DELETE 0x0008 00151 #define TPI_COMMAND_UPDATE 0x0010 00152 #define TPI_COMMAND_TEST 0x0020 00153 #define TPI_COMMAND_REPAIR 0x0040 00154 #define TPI_COMMAND_MOVE 0x0080 00155 #define TPI_COMMAND_SFX 0x0100 00156 #define TPI_COMMAND_UNSFX 0x0200 00167 #define TPI_NOTIFY_COMMON 0x0001 00168 #define TPI_NOTIFY_SETPARAM 0x0002 00181 #define TPI_MESSAGE_STATUS 0x0001 00182 00184 #define TPI_MESSAGE_ASK 0x0002 00185 00187 #define TPI_MESSAGE_ERROR 0x1000 00188 #define TPI_MESSAGE_WARNING 0x1001 00198 #define TPI_STATUS_OPENARCHIVE 0x0001 00199 #define TPI_STATUS_CLOSEARCHIVE 0x0002 00200 #define TPI_STATUS_SEEKFILE 0x0003 00201 #define TPI_STATUS_BEGINPROCESS 0x0004 00202 #define TPI_STATUS_INPROCESS 0x0005 00203 #define TPI_STATUS_ENDPROCESS 0x0006 00204 #define TPI_STATUS_TESTARCHIVE 0x0007 00205 #define TPI_STATUS_COPYARCHIVE 0x0008 00215 #define TPI_PARAM_PASSWORD 0x0001 00216 #define TPI_PARAM_NEXTVOLUME 0x0002 00217 #define TPI_PARAM_DEST 0x0003 00226 #define TPI_CALLBACK_CONTINUE TRUE 00227 #define TPI_CALLBACK_CANCEL 0x1000 00228 #define TPI_CALLBACK_SKIP 0x1001 00229 #define TPI_CALLBACK_UNSUPPORTED 0x1002 00238 #define TPI_ATTRIBUTE_READONLY 0x00000001 00239 #define TPI_ATTRIBUTE_HIDDEN 0x00000002 00240 #define TPI_ATTRIBUTE_SYSTEM 0x00000004 00241 #define TPI_ATTRIBUTE_DIRECTORY 0x00000010 00242 #define TPI_ATTRIBUTE_ARCHIVE 0x00000020 00243 #define TPI_ATTRIBUTE_ENCRYPTED 0x00004000 00245 00246 00247 // ***************************************************************************** 00250 // ***************************************************************************** 00251 00252 #pragma pack(1) 00253 00254 typedef struct _TPI_tagFORMATINFO 00255 { 00256 bool fArchive; 00257 bool fComment; 00258 bool fCompressHeader; 00259 bool fEncryptKeyFile; 00260 bool fEncryptPassword; 00261 bool fEncryptHeader; 00262 bool fMMOptimize; 00263 bool fMultiVolume; 00264 bool fSFX; 00265 bool fSolid; 00266 unsigned short nCompressLevelMin; 00267 unsigned short nCompressLevelMax; 00268 unsigned short nRecoveryRecordMin; 00269 unsigned short nRecoveryRecordMax; 00270 wxULongLong_t nTypeId; 00271 wxULongLong_t eSupportedCommand; 00272 wxString szTypeName; 00273 wxString szSuffix; 00274 wxString szEngineName; 00275 wxString szTPIName; 00276 void * pCustomInfo; 00277 } TPI_FORMATINFO; 00278 00280 typedef struct _TPI_tagFILEINFO 00281 { 00282 unsigned short eDanger; 00283 unsigned short eOSType; 00284 unsigned short wCompressRatio; 00285 unsigned short wPermission; 00288 unsigned long dwAttribute; 00289 unsigned long dwCRC32; 00290 wxULongLong_t nPackedSize; 00291 wxULongLong_t nUnpackedSize; 00292 wxULongLong_t nFileId; 00293 wxDateTime tmAccess; 00294 wxDateTime tmCreate; 00295 wxDateTime tmModify; 00296 wxFileName fnFileName; 00297 wxString szStoredName; 00298 wxString szMethod; 00299 wxString szComment; 00300 wxString szUser; 00301 wxString szGroup; 00302 void * pCustomInfo; 00303 } TPI_FILEINFO; 00304 00306 typedef struct _TPI_tagARCHIVEINFO 00307 { 00308 bool fSFX; 00309 bool fSolid; 00310 bool fMMOptimize; 00311 bool fEncryptData; 00312 bool fEncryptHeader; 00313 bool fCompressHeader; 00314 unsigned short eOSType; 00315 unsigned short nCompressLevel; 00316 unsigned short nRecoveryRecord; 00317 unsigned short wCompressRatio; 00318 wxULongLong_t nFileSize; 00319 wxULongLong_t nPackedSize; 00320 wxULongLong_t nReadSize; 00321 wxULongLong_t nUnpackedSize; 00322 wxULongLong_t nSplitSize; 00323 wxDateTime tmAccess; 00324 wxDateTime tmCreate; 00325 wxDateTime tmModify; 00326 wxFileName fnArchive; 00327 wxString szComment; 00328 TPI_FORMATINFO fiInfo; 00329 void * pCustomInfo; 00330 } TPI_ARCHIVEINFO; 00331 00333 typedef struct _TPI_tagSWITCHES 00334 { 00335 bool fStoreDirectoryPathes; 00336 bool fMakeSFX; 00337 bool fSolid; 00338 bool fMMOptimize; 00339 bool fEncryptHeader; 00340 bool fCompressHeader; 00341 unsigned short nCompressLevel; 00342 unsigned short nRecoveryRecord; 00343 wxULongLong_t nArchiveType; 00344 wxULongLong_t nSplitSize; 00345 wxFileName fnDestinationDirectory; 00346 wxString szPassword; 00347 wxString szKeyFile; 00348 wxString szComment; 00349 wxString szArcName; 00350 void * pCustomSwitches; 00351 } TPI_SWITCHES; 00352 00354 typedef struct _TPI_tagPROCESSINFO 00355 { 00358 unsigned int eMessage; 00361 unsigned int eStatus; 00362 TPI_FILEINFO fiInfo; 00363 wxULongLong_t nProcessedSize; 00364 wxFileName fnDestination; 00365 wxString szParam; 00366 void * pCustomInfo; 00367 } TPI_PROCESSINFO; 00368 00370 00371 // ***************************************************************************** 00374 // ***************************************************************************** 00375 00383 typedef int(__stdcall * TPI_PROC)(unsigned int _eMsg, void * _pInfo); 00384 00386 00387 #pragma pack() 00388 00389 // ***************************************************************************** 00392 // ***************************************************************************** 00393 00394 #ifdef __cplusplus 00395 extern "C" 00396 { 00397 #endif 00398 00406 int __stdcall GetPluginInformation 00407 ( 00408 unsigned int _eInfoId, 00409 wxULongLong_t _nSubOption, 00410 void * _pPtr 00411 ); 00412 00419 int __stdcall GetFormatInformation 00420 ( 00421 TPI_FORMATINFO * _fiInfo, 00422 bool _bFirst = false 00423 ); 00424 00431 int __stdcall LoadPlugin 00432 ( 00433 const wxString & _szArcName, 00434 TPI_PROC _prProc, 00435 wxULongLong_t _nTypeId = 0 00436 ); 00437 00442 int __stdcall FreePlugin 00443 ( 00444 void * _pReserved = NULL 00445 ); 00446 00453 int __stdcall OpenArchive 00454 ( 00455 const wxString & _szArcName, 00456 void * * _hArchive, 00457 wxULongLong_t * _nFileCount = NULL 00458 ); 00459 00464 int __stdcall CloseArchive 00465 ( 00466 void * _hArchive 00467 ); 00468 00475 int __stdcall GetFileInformation 00476 ( 00477 void * _hArchive, 00478 TPI_FILEINFO * _fiInfo, 00479 bool _bFirst = false 00480 ); 00481 00487 int __stdcall GetArchiveInformation 00488 ( 00489 void * _hArchive, 00490 TPI_ARCHIVEINFO * _aiInfo 00491 ); 00492 00501 int __stdcall Command 00502 ( 00503 wxULongLong_t _eCommand, 00504 TPI_SWITCHES * _swInfo, 00505 void * _hArchive, 00506 const wxArrayString & _szFiles 00507 ); 00508 00509 #ifdef __cplusplus 00510 } 00511 #endif 00512 00514 00515 #endif /* __TPI_API_SPEC */