Verfasst: 03.11.2006 21:43
war doch nur ein scherz.
Übrigens, ich glaub ich hab mal sowas in der art im CodeArchiv gesehen.
Übrigens, ich glaub ich hab mal sowas in der art im CodeArchiv gesehen.
Glauben heißt nichts wissen - und in diesem Fall dann einfach "Finger weg von der Tastatur"Übrigens, ich glaub ich hab mal sowas in der art im CodeArchiv gesehen.
Code: Alles auswählen
;PB_unRAR - Paul Leischow, Sept.6, 2002
;RAR Archive extractor that uses the free UNRAR.DLL
;
#RAR_OM_LIST=0
#RAR_OM_EXTRACT=1
#RAR_SKIP=0
#RAR_TEST=1
#RAR_EXTRACT=2
#RAR_VOL_ASK=0
#RAR_VOL_NOTIFY=1
#RAR_DLL_VERSION=3
Structure RARHeaderData
ArcName.b[260]
FileName.b[260]
Flags.l
PackSize.l
UnpSize.l
HostOS.l
FileCRC.l
FileTime.l
UnpVer.l
Method.l
FileAttr.l
*CmtBuf.s
CmtBufSize.l
CmtSize.l
CmtState.l
EndStructure
rarheader.RARHeaderData
Structure RAROpenArchiveData
*ArcName.s
OpenMode.l
OpenResult.l
*CmtBuf.s
CmtBufSize.l
CmtSize.l
CmtState.l
EndStructure
raropen.RAROpenArchiveData
OpenLibrary(0,"unrar.dll")
*RAROpenArchive=IsFunction(0,"RAROpenArchive")
*RARCloseArchive=IsFunction(0,"RARCloseArchive")
*RARReadHeader=IsFunction(0,"RARReadHeader")
*RARProcessFile=IsFunction(0,"RARProcessFile")
*RARGetDllVersion=IsFunction(0,"RARGetDllVersion")
raropen\ArcName="test.rar"
raropen\OpenMode=#RAR_OM_EXTRACT
hRAR=CallFunctionFast(*RAROpenArchive,@raropen)
If raropen\OpenResult
MessageRequester("Error","Could Not Open RAR File",#MB_ICONERROR)
Else
Repeat
stat=CallFunctionFast(*RARReadHeader,hRAR,@rarheader)
If stat=0
filelist.s+PeekS(@rarheader\FileName[0])+Chr(10)
res=CallFunctionFast(*RARProcessFile,hRAR,#RAR_EXTRACT,"c:",@rarheader\FileName[0])
EndIf
Until stat<>0
MessageRequester("Files Extracted",filelist,#MB_ICONINFORMATION)
EndIf
CallFunctionFast(*RARCloseArchive,hRAR)
CloseLibrary(0)
DestPath
This parameter should point to a zero terminated string containing the
destination directory to which to extract files to. If DestPath is equal
to NULL it means extract to the current directory. This parameter has
meaning only if DestName is NULL.
DestName
This parameter should point to a string containing the full path and name
of the file to be extracted or NULL as default. If DestName is defined
(not NULL) it overrides the original file name saved in the archive and
DestPath setting.
Both DestPath and DestName must be in OEM encoding. If necessary,
use CharToOem to convert text to OEM before passing to this function.
Code: Alles auswählen
CallFunctionFast(*RARProcessFile,hRAR,#RAR_EXTRACT,"c:",@rarheader\FileName[0])
hat auch nicht geholfen, ich denke man darf nicht einfach den pfad in "" schreiben:Scarabol hat geschrieben:Vielleicht nur ein Schreibfehler aber wenn du das Verzeichnis C meinst musst du C:\ schreiben oder?
Code: Alles auswählen
Both DestPath and DestName must be in OEM encoding. If necessary,
use CharToOem to convert text to OEM before passing to this function.
Code: Alles auswählen
Global len.l
Structure RAROpenArchiveData
ArcName.s
OpenMode.l
OpenResult.l
CmtBuf.s
CmtBufSize.l
CmtSize.l
CmtState.l
EndStructure
Structure RARHeaderData
; ArcName As String * 260
; FileName As String * 260
ArcName.b[260]
Filename.b[260]
flags.l
PckSize.l
UnpSize.l
HostOS.l
FileCRC.l
FileTime.l
UnpVer.l
Method.l
FileAttr.l
CmtBuf.s
CmtBufSize.l
CmtSize.l
CmtState.l
EndStructure
Procedure.l CallBackRAR(msg.l,UserData.l,p1.l,p2.l)
;Debug msg
;Debug UserData
;Debug p1
len+p2
Debug "Current UnpackSize = " +Str(len)
EndProcedure
Procedure.l UnRarFile(RarArchive$,PackFile$,DestPath$)
x.l=0
lHandle.l
iStatus.l
uRAR.RAROpenArchiveData
uHeader.RARHeaderData
sStat.s
Ret.l
uRAR\ArcName = RarArchive$
uRAR\CmtBuf = Space(16384)
uRAR\CmtBufSize = 16384
uRAR\OpenMode = 1 ; 1 = Entpacken / 0 = Liste
If Right(DestPath$,1)<>"\" : DestPath$+"\" : EndIf
If OpenLibrary(0, "c:\unrar.dll") ; <---- Pfad nicht vergessen anzugeben!!!
*RAROpenArchive.l = GetFunction(0, "RAROpenArchive")
*RARCloseArchive.l = GetFunction(0, "RARCloseArchive")
*RARReadHeader.l = GetFunction(0, "RARReadHeader")
*RARProcessFile.l = GetFunction(0, "RARProcessFile")
*RARSetChangeVolProc.l = GetFunction(0, "RARSetChangeVolProc")
*RARSetPassword.l = GetFunction(0, "RARSetPassword")
*RARSetCallback.l = GetFunction(0, "RARSetCallback")
lHandle = CallFunctionFast(*RAROpenArchive,@uRAR)
CallFunctionFast(*RARSetCallback,lHandle,@CallBackRAR(),0)
If uRAR\OpenResult = 0
Repeat
iStatus = CallFunctionFast(*RARReadHeader,lHandle, @uHeader)
If iStatus=0
sStat = PeekS(@uHeader\Filename)
If LCase(sStat) = LCase(PackFile$)
Ret = CallFunctionFast(*RARProcessFile,lHandle, 2, "", DestPath$+GetFilePart(PackFile$))
x=1
Else
Ret = CallFunctionFast(*RARProcessFile,lHandle, 0, "", "")
EndIf
EndIf
Until iStatus<>0
CallFunctionFast(*RARCloseArchive, lHandle)
EndIf
CloseLibrary(0)
EndIf
ProcedureReturn x
EndProcedure
UnRarFile("c:\zzz.rar","test4","c:\aaa\")
Code: Alles auswählen
res=CallFunctionFast(*RARProcessFile,hRAR,#RAR_EXTRACT,@"C:",@rarheader\FileName[0])