Archive Support In Progress

Share your advanced PureBasic knowledge/code with the community.
BackupUser
PureBasic Guru
PureBasic Guru
Posts: 16777133
Joined: Tue Apr 22, 2003 7:42 pm

Post by BackupUser »

Restored from previous forum. Originally posted by Inner.

Searching the forums for support for things like RAR/ZIP/ACE/LHA/ZOO/ARJ/Etc. I found 1 for RAR, which I'd already by that time coded myself, so I won't bother posting that unless it's wanted.

If anyone can find DLL's for the older achive forms I would be greatful, amd top start off LHA.
BackupUser
PureBasic Guru
PureBasic Guru
Posts: 16777133
Joined: Tue Apr 22, 2003 7:42 pm

Archive Support In Progress

Post by BackupUser »

Code updated For 5.20+

Restored from previous forum. Originally posted by Inner.

DLL Located here;
http://www2.nsknet.or.jp/~micco/unlhae.htm br /

Code: Select all

;/* UNLHA32.H, Micco, Jan.15,1998
;**
;** LH 2.02a
;** Copyright (c) 1988-90 by Haruyasu Yoshizaki  All rights reserved.
;**
;** Win/WinNT-SFX
;** Copyright (c) 1995-96 by mH        All rights reserved.
;**
;** UNLHA32.DLL
;** Copyright (c) 1995-97 by Micco     All rights reserved.
;**
;** UnLha32e.pb                         3/30/2003 8:14AM
;**                       by Inner T.J.Rougton.
;*/
#UNLHA32_VERSION	=97
#FNAME_MAX32		=512
#LHA_OPENLIB        =300

Structure INDIVIDUALINFO
	dwOriginalSize.l
 	dwCompressedSize.l
	dwCRC.l
	uFlag.l
	uOSType.l
	wRatio.w
	wDate.w
	wTime.w
	szFileName.b[#FNAME_MAX32+1]
	dummy1.b[3]
	szAttribute.b[ 8]
	szMode.b[ 8]
EndStructure

Structure EXTRACTINGINFO
	dwFileSize.l
	dwWriteSize.l
	szSourceFileName.b[#FNAME_MAX32+1]
	dummy1.b[3]
	szDestFileName.b[#FNAME_MAX32+1]
	dummy.b[3]
EndStructure

Structure EXTRACTINGINFOEX
	*exinfo.EXTRACTINGINFO
	dwCompressedSize.l
	dwCRC.l
	uOSType.l
	wRatio.w
	wDate.w
	wTime.w
	szAttribute.b[ 8]
	szMode.b[ 8]
EndStructure

#CHECKARCHIVE_RAPID		=0
#CHECKARCHIVE_BASIC		=1
#CHECKARCHIVE_FULLCRC	=2
#CHECKARCHIVE_RECOVERY	=4
#CHECKARCHIVE_SFX		=8
#CHECKARCHIVE_ALL		=16

#UNPACK_CONFIG_MODE		=1
#PACK_CONFIG_MODE		=2

#ISARC_FUNCTION_START			=0
#ISARC							=0	;/* Unlha */
#ISARC_GET_VERSION				=1	;/* UnlhaGetVersion */
#ISARC_GET_CURSOR_INTERVAL		=2	;/* UnlhaGetCursorInterval */
#ISARC_SET_CURSOR_INTERVAL		=3	;/* UnlhaSetCursorInterval */
#ISARC_GET_BACK_GROUND_MODE		=4	;/* UnlhaGetBackGroundMode */
#ISARC_SET_BACK_GROUND_MODE		=5	;/* UnlhaSetBackGroundMode */
#ISARC_GET_CURSOR_MODE			=6	;/* UnlhaGetCursorMode */
#ISARC_SET_CURSOR_MODE			=7	;/* UnlhaSetCursorMode */
#ISARC_GET_RUNNING				=8	;/* UnlhaGetRunning */
#ISARC_CHECK_ARCHIVE            =16	;/* UnlhaCheckArchive */
#ISARC_CONFIG_DIALOG            =17	;/* UnlhaConfigDialog */
#ISARC_GET_FILE_COUNT           =18	;/* UnlhaGetFileCount */
#ISARC_QUERY_FUNCTION_LIST      =19	;/* UnlhaQueryFunctionList */
#ISARC_HOUT						=20	;/* (UnlhaHOut) */
#ISARC_STRUCTOUT				=21	;/* (UnlhaStructOut) */
#ISARC_GET_ARC_FILE_INFO		=22	;/* UnlhaGetArcFileInfo */
#ISARC_OPEN_ARCHIVE				=23	;/* UnlhaOpenArchive */
#ISARC_CLOSE_ARCHIVE			=24	;/* UnlhaCloseArchive */
#ISARC_FIND_FIRST				=25	;/* UnlhaFindFirst */
#ISARC_FIND_NEXT				=26	;/* UnlhaFindNext */
#ISARC_EXTRACT					=27	;/* (UnlhaExtract) */
#ISARC_ADD						=28	;/* (UnlhaAdd) */
#ISARC_MOVE						=29	;/* (UnlhaMove) */
#ISARC_DELETE					=30	;/* (UnlhaDelete) */
#ISARC_GET_ARC_FILE_NAME		=40	;/* UnlhaGetArcFileName */
#ISARC_GET_ARC_FILE_SIZE		=41	;/* UnlhaGetArcFileSize */
#ISARC_GET_ARC_ORIGINAL_SIZE	=42	;/* UnlhaArcOriginalSize */
#ISARC_GET_ARC_COMPRESSED_SIZE	=43	;/* UnlhaGetArcCompressedSize */
#ISARC_GET_ARC_RATIO			=44	;/* UnlhaGetArcRatio */
#ISARC_GET_ARC_DATE				=45	;/* UnlhaGetArcDate */
#ISARC_GET_ARC_TIME				=46	;/* UnlhaGetArcTime */
#ISARC_GET_ARC_OS_TYPE			=47	;/* UnlhaGetArcOSType */
#ISARC_GET_ARC_IS_SFX_FILE		=48	;/* UnlhaGetArcIsSFXFile */
#ISARC_GET_FILE_NAME			=57	;/* UnlhaGetFileName */
#ISARC_GET_ORIGINAL_SIZE		=58	;/* UnlhaGetOriginalSize */
#ISARC_GET_COMPRESSED_SIZE		=59	;/* UnlhaGetCompressedSize */
#ISARC_GET_RATIO				=60	;/* UnlhaGetRatio */
#ISARC_GET_DATE					=61	;/* UnlhaGetDate */
#ISARC_GET_TIME					=62	;/* UnlhaGetTime */
#ISARC_GET_CRC					=63	;/* UnlhaGetCRC */
#ISARC_GET_ATTRIBUTE			=64	;/* UnlhaGetAttribute */
#ISARC_GET_OS_TYPE				=65	;/* UnlhaGetOSType */
#ISARC_GET_METHOD				=66	;/* UnlhaGetMethod */
#ISARC_GET_WRITE_TIME			=67	;/* UnlhaGetWriteTime */
#ISARC_GET_CREATE_TIME			=68	;/* UnlhaGetCreateTime */
#ISARC_GET_ACCESS_TIME			=69	;/* UnlhaGetAccessTime */
#ISARC_FUNCTION_END				=69

#WM_ARCEXTRACT$         ="wm_arcextract"

#ARCEXTRACT_BEGIN		=0
#ARCEXTRACT_INPROCESS	=1
#ARCEXTRACT_END			=2
#ARCEXTRACT_OPEN		=3
#ARCEXTRACT_COPY		=4

;/* MODE (for UnarjOpenArchive) */
#M_INIT_FILE_USE		=$00000001
#M_REGARDLESS_INIT_FILE	=$00000002
#M_CHECK_ALL_PATH		=$00000100
#M_CHECK_FILENAME_ONLY	=$00000200
#M_USE_DRIVE_LETTER		=$00001000
#M_NOT_USE_DRIVE_LETTER	=$00002000
#M_ERROR_MESSAGE_ON		=$00400000
#M_ERROR_MESSAGE_OFF	=$00800000
#M_RECOVERY_ON			=$08000000

#EXTRACT_FOUND_FILE		=$40000000
#EXTRACT_NAMED_FILE		=$80000000

#SFX_NOT				=0
#SFX_DOS_213S			=1
#SFX_DOS_250S			=2
#SFX_DOS_265S			=3
#SFX_DOS_213L			=51
#SFX_DOS_250L			=52
#SFX_DOS_265L			=53
#SFX_WIN16_213			=1001
#SFX_WIN16_213_1		=1001
#SFX_WIN16_213_2		=1002
#SFX_WIN16_213_3		=1003
#SFX_WIN16_250_1		=1011
#SFX_WIN16_255_1		=1021
#SFX_WIN32_213			=2001
#SFX_WIN32_213_1		=2001
#SFX_WIN32_213_3		=2002
#SFX_WIN32_250			=2011
#SFX_WIN32_250_1		=2011
#SFX_WIN32_250_6		=2012
#SFX_LZHSFX_1002		=2051
#SFX_LZHSFX_1100		=2052
#SFX_LZHAUTO_0002		=2101
#SFX_LZHAUTO_1002		=2102
#SFX_LZHAUTO_1100		=2103

;/* Attribute */
#FA_RDONLY                  =$01
#FA_HIDDEN                  =$02
#FA_SYSTEM                  =$04
#FA_LABEL                   =$08
#FA_DIREC                   =$10
#FA_ARCH                    =$20
#ERROR_START		        =$8000
#ERROR_DISK_SPACE		    =$8005
#ERROR_READ_ONLY		    =$8006
#ERROR_USER_SKIP		    =$8007
#ERROR_UNKNOWN_TYPE		    =$8008
#ERROR_METHOD			    =$8009
#ERROR_PASSWORD_FILE	    =$800A
#ERROR_VERSION			    =$800B
#ERROR_FILE_CRC			    =$800C
#ERROR_FILE_OPEN		    =$800D
#ERROR_MORE_FRESH		    =$800E
#ERROR_NOT_EXIST		    =$800F
#ERROR_ALREADY_EXIST	    =$8010
#ERROR_TOO_MANY_FILES	    =$8011

;/* ERROR */
#ERROR_MAKEDIRECTORY	    =$8012
#ERROR_CANNOT_WRITE		    =$8013
#ERROR_HUFFMAN_CODE		    =$8014
#ERROR_COMMENT_HEADER	    =$8015
#ERROR_HEADER_CRC		    =$8016
#ERROR_HEADER_BROKEN	    =$8017
#ERROR_ARC_FILE_OPEN	    =$8018
#ERROR_NOT_ARC_FILE		    =$8019
#ERROR_CANNOT_READ		    =$801A
#ERROR_FILE_STYLE		    =$801B
#ERROR_COMMAND_NAME		    =$801C
#ERROR_MORE_HEAP_MEMORY	    =$801D
#ERROR_ENOUGH_MEMORY	    =$801E
#ERROR_ALREADY_RUNNING	    =$801F
#ERROR_USER_CANCEL		    =$8020
#ERROR_HARC_ISNOT_OPENED	=$8021
#ERROR_NOT_SEARCH_MODE	    =$8022
#ERROR_NOT_SUPPORT		    =$8023
#ERROR_TIME_STAMP		    =$8024
#ERROR_TMP_OPEN			    =$8025
#ERROR_LONG_FILE_NAME	    =$8026
#ERROR_ARC_READ_ONLY	    =$8027
#ERROR_SAME_NAME_FILE	    =$8028
#ERROR_NOT_FIND_ARC_FILE    =$8029
#ERROR_RESPONSE_READ	    =$802A
#ERROR_NOT_FILENAME		    =$802B
#ERROR_TMP_COPY			    =$802C
#ERROR_EOF				    =$802D
;-----------------------------------------------------------------------------
; functions
;-----------------------------------------------------------------------------
Procedure UnlhaGetVersion()
    ProcedureReturn CallFunction(#LHA_OPENLIB,"UnlhaGetVersion")
EndProcedure

Procedure UnlhaOpenArchive(hwnd.l,_szFileName.s,_dwMode.l)
    ProcedureReturn CallFunction(#LHA_OPENLIB,"UnlhaOpenArchive",hwnd,@_szFileName,_dwMode)
EndProcedure

Procedure UnlhaCloseArchive(_harc.l)
    ProcedureReturn CallFunction(#LHA_OPENLIB,"UnlhaCloseArchive",_harc)
EndProcedure

Procedure UnlhaFindFirst(_harc.l,_szWildName.s,individualinfo.l)
    ProcedureReturn CallFunction(#LHA_OPENLIB,"UnlhaFindFirst",_harc,@_szWildName,individualinfo)
EndProcedure

Procedure UnlhaFindNext(_harc.l,individualinfo.l)
    ProcedureReturn CallFunction(#LHA_OPENLIB,"UnlhaFindNext",_harc,individualinfo)
EndProcedure

Procedure.l LHAOpenLibrary()
    Ret_=#TRUE
    If(OpenLibrary(#LHA_OPENLIB,"unlha32.DLL")=0)
        Ret_=#FALSE
    EndIf
    ProcedureReturn Ret_
EndProcedure

Procedure LHACloseLibrary()
    CloseLibrary(#LHA_OPENLIB)
EndProcedure

Procedure Test_List(filename.s)
    idinfo.INDIVIDUALINFO
    If(LHAOpenLibrary()=#TRUE)
        Debug(UnlhaGetVersion())
        hLhaArc=UnlhaOpenArchive(0,filename,#M_REGARDLESS_INIT_FILE)
        If(hLhaArc)
            Debug(UnlhaFindFirst(hLhaArc,"*.*",@idinfo))              
            Debug(PeekS(@idinfo\szFileName[0]))
            While(UnlhaFindNext(hLhaArc,@idinfo)=0)
                Debug(PeekS(@idinfo\szFileName[0]))
            Wend
            UnlhaCloseArchive(hLhaArc)
        EndIf
        LHACloseLibrary()
    EndIf
EndProcedure
;Test_List("tools.lzh") ; uncomment this line with LHA file you have
p.s naughty 8 balls :)
BackupUser
PureBasic Guru
PureBasic Guru
Posts: 16777133
Joined: Tue Apr 22, 2003 7:42 pm

Post by BackupUser »

Restored from previous forum. Originally posted by Fangbeast.

That's pretty good. Try this link for compressions sources and possibly DLL's. http://datacompression.info/SourceCode.shtml

Maybe some day somebody will give me CAB/UNCAB support :):)

We are Dyslexic of Borg, prepare to have your ass laminated!
BackupUser
PureBasic Guru
PureBasic Guru
Posts: 16777133
Joined: Tue Apr 22, 2003 7:42 pm

Post by BackupUser »

Restored from previous forum. Originally posted by H.Brill.

hi,
here is an Link too :

http://www.onid.orst.edu/~reeset/html/other/cab.html

(CAB and ZIP)
BackupUser
PureBasic Guru
PureBasic Guru
Posts: 16777133
Joined: Tue Apr 22, 2003 7:42 pm

Post by BackupUser »

Restored from previous forum. Originally posted by Inner.

Thanks for the links,

@Fangbeast: I shall work on it real soon.
BackupUser
PureBasic Guru
PureBasic Guru
Posts: 16777133
Joined: Tue Apr 22, 2003 7:42 pm

Post by BackupUser »

Restored from previous forum. Originally posted by Fangbeast.

If I were a woman, I'd offer to have your children :):) (I need cab) ROFLMAO!!

We are Dyslexic of Borg, prepare to have your ass laminated!
Post Reply