//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // // Zip Studio 2.5 COPYRIGHT 1993- 1995 HEXANET - Written By Denis CHEVRON - All rights reserved // //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // // Zip functions declarations header file for Basic and Basic like languages // // To use the Zip VBX, put ZDLL20A.DLL, ZDLL20B.DLL and UZDLL20.DLL in your application directory // or into the Windows/System directory. // Also, don' t forget to redistribute the ZIPSTD20.VBX with your application... // // If you choose the DLLs functions instead of the VBX interface: // ->To Zip, Put ZDLL20A.DLL and ZDLL20B.DLL in the current dir and define _GOZIP. // ->To UnZip, Put UZDLL20.DLL in the current dir and define _GOUNZIP. // // The [2.0] means the routine is new. // //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// #define _GOZIP // to remove? #define _ZIP20 #define _GOUNZIP // to remove? #define _UNZIP20 #ifndef _zip_h #define _zip_h #ifdef __cplusplus extern "C" { #endif #ifdef _GOZIP //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // // Zip functions // //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// /* Errors constants */ #define ZERROR_OK 0 // No error #define ZERROR_WARNING 1 // Just a warning (not an error) #define ZERROR_DESTFILE 2 // Destfile ( *.ZIP ) error #define ZERROR_INTERNAL 3 // Internal error #define ZERROR_FORMAT 4 // Not a Zip file #define ZERROR_NOMEM 5 // Not enough memory #define ZERROR_NOFILE 6 // Nothing to do ( can be just a warning ) #define ZERROR_NODLL 7 // Can' t find required DLLs #define ZERROR_COMMENT 8 // Comment missing or NULL #define ZERROR_NOCRYPT 9 // Can' t encrypt the files [2.0] /* Overwrite mode */ #define OVERWRITE_ALWAYS 0 // Always overwrite ( always zip files ) (default) #define OVERWRITE_NEVER 1 // Never overwrite #define OVERWRITE_PROMPT 2 // Ask the user #define OVERWRITE_UPDATE 3 // Overwrite if external file is newer /* Language mode ( for the replace dialog box )*/ #define LANGUAGE_FRENCH 0 // French mode #define LANGUAGE_ENGLISH 1 // US Mode ( default ) #define LANGUAGE_GERMAN 2 // German mode #define LANGUAGE_NONE 3 // No language (used with ZN_REPLACE) ** NEW! ** /* More easy to use with AddFileToZip */ #define STOREPATH_NO 0 // Don' t store paths #define STOREPATH_YES 1 // Store paths #define RECURSE_NO 0 // Don' t recurse sub dirs #define RECURSE_YES 1 // Recurse sub dirs /* Notification messages */ #define ZN_ZIPPING WM_USER + 46 // Zipping a file, WP = compressed size in K, LP = current file name #define ZN_FILEZIPPED WM_USER + 45 // File is zipped, WP = compress rate, LP = file name #define ZN_WRITING WM_USER + 48 // Replacing the Zip file, LP = zip file name #define ZN_DELETING WM_USER + 47 // Deleting a file , LP = current file name #define ZN_REPARING WM_USER + 49 // Reparing a Zip file, WP = (int)state // step = 1 : Read / Write , LP = current file name // step = 3 : Checking zip file, LP = zip file name #define ZN_COMPUTE WM_USER + 52 // Before zip read, WP = zip files ( over 500, computing can be very long ) #define ZN_REPLACE WM_USER + 53 // The replace dialog box is opened #define ZN_ENCRYPT WM_USER + 66 // Encrypt a file, WP= RATE, LP = filename [2.0] #define ZN_NETREAD WM_USER + 67 // Reading a file from the network, WP = rate, LP = file name [2.0] #define ZN_NETWRITE WM_USER + 68 // Writing the ZIP file to the network, WP = rate, LP = file name [2.0] /* Main functions */ extern void WINAPI ZipInit( LPCSTR szYourName, LPCSTR szPassword ); // Init the Zip DLL extern int WINAPI AddFileToZip( LPCSTR szZipFile, LPCSTR szMask, int OverwriteMode, BOOL bStorePath, BOOL bRecurse, HWND hParentWnd, LPCSTR szPassword ); // Zip a file [2.0] extern int WINAPI ZipDeleteFiles( LPCSTR szZipFile, LPCSTR szFiles, HWND hParentWnd ); // Delete files in a Zip extern int WINAPI ZipRepare( LPCSTR szZipFile, HWND hParentWnd ); // Recreate the Zip file extern int WINAPI ZipSetComment( LPCSTR szZipFile, LPCSTR szComment, HWND hParentWnd ); // Set the Zip Comment /* Helpers */ extern BOOL WINAPI ZipSetLanguage( UINT cZipLanguage ); // Set the Language extern int WINAPI ZipGetReplaceFlag( void ); // Return the current overwrite mode extern BOOL WINAPI ZipSetReplaceText( LPCSTR szDialogTitle, LPCSTR szDialogText, LPCSTR szYesBtn, LPCSTR szNoBtn, LPCSTR szAlwaysBtn, LPCSTR szNeverBtn ); // Set the replace dialog box labels, used with // the LANGUAGE_NONE mode and the ZN_REPLACE notification message.. /* New routines */ #define ZMODE_NORMAL 0 #define ZMODE_FAST 1 #define ZMODE_SLOW 2 #define ZMODE_STORE 3 extern BOOL WINAPI ZipSetMode( int zMode ); // [2.0] Specify the compression method (ZMODE_..) extern void WINAPI ZipCancel( BOOL bCancel ); // [2.0] Stop the current Zip action ASAP /* Split [2.0] */ extern int WINAPI ZipSplit( HWND hParent, LPCSTR szZipName, LPCSTR szDestDir, long lFirstSize, long lNextSize, BOOL bDiskettePause, LPCSTR szTitle, LPCSTR szMsg ); // [2.0] Split an existing Zip file #define SPLIT_OK 0 // ZipSplit result [2.0] #define SPLIT_NOFILE 1 #define SPLIT_NOMEM 2 #define SPLIT_IOERROR 3 #define SPLIT_TOOBIG 4 #define SPLIT_ACCESSDENIED 5 #define SPLIT_USERABORT 6 #define SPLIT_FILETOOSMALL 7 #define ZN_SPLITTING WM_USER + 61 // Splitting in process, wp = size (kb), lp = piece name [2.0] #define ZN_SPLITTED WM_USER + 62 // A zip part is done, wp = part number, lp = size ( in bytes ) [2.0] #endif // _GOZIP #ifdef _GOUNZIP //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // // UnZip functions // //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// /* Initialisation function */ extern void WINAPI UnzipInit( LPCSTR szYourName, LPCSTR szPassword ); // required, if you are not a registered user szYourName = "TEST" /* Interface constants */ #ifndef LANGUAGE_FRENCH #define LANGUAGE_FRENCH 0 // french language will be used in the replace dialog box #endif #ifndef LANGUAGE_ENGLISH #define LANGUAGE_ENGLISH 1 // English language will be used in the replace dialog box ( default ) #endif #ifndef LANGUAGE_GERMAN #define LANGUAGE_GERMAN 2 // German mode #endif #ifndef LANGUAGE_NONE #define LANGUAGE_NONE 3 // No language (used with ZN_REPLACE) #endif /* Interface setting functions */ extern BOOL WINAPI UnzipSetMsgBoxTitle( LPCSTR szNewTitle ); // Set the replace dialog box title ( default = "Replace..."); extern void WINAPI UnzipSetLanguage( UINT iLanguage ); // Set the language for the replace dialog box extern BOOL WINAPI UnzipSetReceivingWindow( HWND hWnd ); // Set the window for notification messages extern void WINAPI UnzipSetBackgroundMode( BOOL bBackGroundMode ); // if TRUE, activate the multitask mode ( default ) extern BOOL WINAPI UnzipSetReplaceText( LPCSTR szDialogTitle, LPCSTR szDialogText, LPCSTR szYesBtn, LPCSTR szNoBtn, LPCSTR szAlwaysBtn, LPCSTR szNeverBtn ); // Set the replace dialog box labels, used with // the LANGUAGE_NONE mode and the ZN_REPLACE notification message.. /* Zip method constants */ #define ZMETHOD_STORED 0 #define ZMETHOD_SHRUNK 1 #define ZMETHOD_REDUCE1 2 #define ZMETHOD_REDUCE2 3 #define ZMETHOD_REDUCE3 4 #define ZMETHOD_REDUCE4 5 #define ZMETHOD_IMPLODE 6 #define ZMETHOD_TOKEN 7 #define ZMETHOD_DEFLATE 8 #define ZMETHOD_UNKNOWN 9 #define ZMETHOD_ERROR 10 /* Information functions ( Zip ) */ extern BOOL WINAPI IsFileInZip( LPCSTR szZIPFileName, LPCSTR szFileName); // Return TRUE if the file is in the ZIP file extern int WINAPI CountFileInZip( LPCSTR szFileName ); // Return number of files in this Zip File extern LPSTR WINAPI GetFileNameFromZIP( LPCSTR szFileName, UINT iFileNumber ); // Return the name of the iFileNumber file in this Zip File extern long WINAPI GetZFileOriginalSize( LPCSTR szZIPFileName, LPCSTR szFileName ); // Return the not compressed size of szFileName in octets. extern long WINAPI GetZFileCompressedSize( LPCSTR szZIPFileName, LPCSTR szFileName ); // Return the compressed size of szFileName in octets. extern LPSTR WINAPI GetZFileDate( LPCSTR szZIPFileName, LPCSTR szFileName ); // Return the date of a file in a Zip extern LPSTR WINAPI GetZFileTime( LPCSTR szZIPFileName, LPCSTR szFileName ); // Return the time of a file in a Zip extern UINT WINAPI GetZCompressMethod( LPCSTR szZipFileName, LPCSTR szFileName ); // Return the Zip method for a file ( ZMETHOD_* ) extern BOOL WINAPI GetZFullInfos( LPCSTR szZipFileName, LPCSTR szFileName, LPSTR szResult ); // Fill with all informations extern BOOL WINAPI GetZFileIsDir( LPCSTR szZIPFileName, LPCSTR szFileName ); // TRUE is the file is a directory specification extern BOOL WINAPI GetZFileIsEncrypted( LPCSTR szZIPFileName, LPCSTR szFileName ); // TRUE if the file is encrypted [2.0] extern BOOL WINAPI IsThisFileAZipFile( LPCSTR szFileName, BOOL bQuickTest ); // return TRUE if this file seems to be a zip file [2.0] extern BOOL WINAPI IsFileUnzipable( LPCSTR szFileName ); // return TRUE if this file name can be reproduce under DOS extern UINT WINAPI GetZipCommentLength( LPCSTR szFileName ); // return the size of the zip file comment in octets extern BOOL WINAPI GetZipComment( LPCSTR szFileName, LPSTR szBuffer ); // Put the zip comment in buffer /* Information functions ( General ) */ extern BOOL WINAPI bDoesFileExist( LPCSTR szFileName ); // True if this file exists extern LPSTR WINAPI GetShortFileName( LPCSTR szFileName ); // Return filename without any path extern LPSTR WINAPI GetPathFromFileName( LPCSTR szFileName ); // Return the path without the file name extern BOOL WINAPI IsFileNameInFilter( LPCSTR szFileName, LPCSTR szMask ); // Return TRUE if filename is in specified filter /* Extraction function result constants */ #define ZEXTRACT_OK 0 #define ZEXTRACT_INTERNALERROR 1 #define ZEXTRACT_FILENOTFOUND 2 #define ZEXTRACT_CORRUPTED 3 #define ZEXTRACT_EMPTY 4 #define ZEXTRACT_ERRORINZIPFILE 5 #define ZEXTRACT_NOMEM 6 #define ZEXTRACT_DISKFULL 8 #define ZEXTRACT_WARNING 10 /* Helper constants */ #define OVERWRITE_FALSE 0 #define OVERWRITE_TRUE 1 #define OVERWRITE_QUERY 2 #define CREATEDIR_FALSE 0 #define CREATEDIR_TRUE 1 /* Extraction functions */ extern UINT WINAPI ExtractZipFiles( LPCSTR szFileName, LPCSTR szMask, LPCSTR szDestDir, UINT bOverwrite, BOOL bCreateDir ); extern int WINAPI GetQueryFlag( void ); // Return the overwrite mode the user asked for /* Notification messages for UNZIP and VIEW*/ #define ZN_OPENFILE WM_USER + 38 // Open a file, WP = TRUE if Ok, LP = filename #define ZN_EXPANDING WM_USER + 39 // Unzipping a file, WP = file current rate, LP = filename #define ZN_CLOSEFILE WM_USER + 40 // Close a file, WP = TRUE if Ok, LP = filename #ifndef ZN_REPLACE #define ZN_REPLACE WM_USER +53 // The replace dialog box is opened ** NEW! ** #endif #define ZN_NEWPASSWORD WM_USER + 65 // A new password is required, WP= 0, LP = filename + tab key + current password [2.0] #define ZN_TEST WM_USER + 69 // Send by IsThisFile..., WP = TRUE if ok, LP = tested file name [2.0] /* View function */ extern BOOL WINAPI ViewFileFromZip( LPCSTR szZipFile, LPCSTR szMask, BOOL bTextOnly ); // view one or several files in a Zip /* ZIP files list [2.0]*/ typedef struct TAGZIPITEM // A Zip file item [2.0] { char szName[50]; // The file name without any path char szDir[260]; // The relative directory BOOL bIsDir; // TRUE if this item specifies a directory BOOL bIsEncrypted; // TRUE if this item is encrypted int iMethod; // The compression method int iDay; // Date: The Day int iMonth; // Date: The month int iYear; // Date: The year (no century specification) int iHour; // Time: The hour int iMin; // Time: The minutes long lOriginalSize; // The original size in bytes int iRate; // The compression rate } ZIPITEM; #define ZSORT_BYFULLNAME 0 // The files list sort method [2.0] #define ZSORT_BYNAME 1 #define ZSORT_BYDIR 2 #define ZSORT_BYDATE 3 #define ZSORT_BYSIZE 4 #define ZSORT_BYRATE 5 #define ZSORT_NONE 6 extern int WINAPI GetZList( LPCSTR szZipName, register HWND hListWnd, unsigned int iFrom, int iSortMode, BOOL bBackGnd ); // Build the files list extern BOOL WINAPI GetZipItem( register HWND hListWnd, int iIndex, ZIPITEM FAR* zItem ); // Retrive an item from this list extern BOOL WINAPI UnzipSortZList( register HWND hListWnd, int iSortMode, BOOL bBackGnd ); // Sort the list again /* New routines [2.0] */ extern BOOL WINAPI UnzipSetPassword( LPCSTR szPassword ); // Specify the password to use to extract the encrypted file(s) [2.0] extern void WINAPI SetAskPassword( BOOL bAsk ); // TRUE if you want Zip Studio asks the user for a password [2.0] extern BOOL WINAPI UnzipSetPasswordText( LPCSTR szDialogTitle, LPCSTR szDialogText, LPCSTR szPasswordLabel, LPCSTR szYesBtn, LPCSTR szNoBtn, LPCSTR szNeverBtn ); // Set the password dialog box labels, used with ZN_NEWPASSWORD [2.0] extern void WINAPI UnzipCancel( BOOL bCancel ); // Set or Reset the Cancel flag for the UNZIP process: // You must reset this flag before you call any UNZIP function: // (eg UnzipCancel(FALSE) ... ) [2.0] /* Join function [2.0] */ extern int WINAPI ZipJoin( HWND hParent, LPCSTR szName, LPCSTR szDestDir, BOOL bSendMsg, LPCSTR szTitle, LPCSTR szMsg ); // Join a splitted Zip file [2.0] #define JOIN_OK 0 // ZipJoin result code [2.0] #define JOIN_NOFILE 1 #define JOIN_NOMEM 2 #define JOIN_IOERROR 3 #define JOIN_ACCESSDENIED 4 #define JOIN_USERABORT 5 #define JOIN_NOTASPLITTEDFILE 7 #define JOIN_ZIPEXIST 8 #define ZN_JOINING WM_USER + 41 // Split in process, wp = size in Kbytes, lp = file name #define ZN_JOINED WM_USER + 42 // A zip part is done, wp = part number, lp = size ( in bytes ) #define ZN_JOINDONESIZE WM_USER + 43 // Split is done for all the ZIP files, lp = total size in bytes #define ZN_JOINDONENAME WM_USER + 44 // Split is done for all the ZIP files, lp = zip name #endif // _GOUNZIP #ifdef __cplusplus } #endif /* ---------------------------------------- End of file ------------------------------------------*/ #endif