vb@rchiv
VB Classic
VB.NET
ADO.NET
VBA
C#
sevAniGif - als kostenlose Vollversion auf unserer vb@rchiv CD Vol.5  
 vb@rchiv Quick-Search: Suche startenErweiterte Suche starten   Impressum  | Datenschutz  | vb@rchiv CD Vol.6  | Shop Copyright ©2000-2025
 
zurück

 Sie sind aktuell nicht angemeldet.Funktionen: Einloggen  |  Neu registrieren  |  Suchen

Allgemeine Diskussionen
Re: Unrar.dll 
Autor: DA rUla
Datum: 09.08.02 13:01

Hi, ist zwar mit spanischen Kommentaren, aber ich denke das wird dir helfen

Gruss

-DA rUla-


‘ Programa que le permite
extraer fichero RAR, soporta protección por clave


‘ declaraciones

Option Explicit
‘ Necesita la DLL UNRAR
‘ Constantes para abrir
Private Const RAR_OM_LIST As Byte = 0
Private Const RAR_OM_EXTRACT As Byte = 1
' Constantes de errores
Private Const ERAR_NO_MEMORY As Byte = 11
Private Const ERAR_BAD_DATA As Byte = 12
Private Const ERAR_BAD_ARCHIVE As Byte = 13
Private Const ERAR_EOPEN As Byte = 15
Private Const ERAR_UNKNOWN_FORMAT As Byte = 14
Private Const ERAR_SMALL_BUF As Byte = 20
Private Const ERAR_ECLOSE As Byte = 17
Private Const ERAR_END_ARCHIVE As Byte = 10
Private Const ERAR_ECREATE As Byte = 16
Private Const ERAR_EREAD As Byte = 18
Private Const ERAR_EWRITE As Byte = 19
' Constantes operaciones
Private Const RAR_SKIP As Byte = 0
Private Const RAR_TEST As Byte = 1
Private Const RAR_EXTRACT As Byte = 2
' Constantes del volumen
Private Const RAR_VOL_ASK As Byte = 0
Private Const RAR_VOL_NOTIFY As Byte = 1
' User Defined Types
Private Type RARHeaderData
    ArcName As String * 260
    FileName As String * 260
    Flags As Long
    PackSize As Long
    UnpSize As Long
    HostOS As Long
    FileCRC As Long
    FileTime As Long
    UnpVer As Long
    Method As Long
    FileAttr As Long
    CmtBuf As String    ' Pointer (char *CmtBuf in C)
    CmtBufSize As Long
    CmtSize As Long
    CmtState As Long
End Type
Private Type RAROpenArchiveData
    ArcName As String   ' Pointer (char *ArcName in C)
    OpenMode As Long
    OpenResult As Long
    CmtBuf As String    ' Pointer (char *CmtBuf in C)
    CmtBufSize As Long
    CmtSize As Long
    CmtState As Long
End Type
' RAR DLL
Public Declare Function RAROpen Lib "UnRAR.dll" Alias
"RAROpenArchive" (ByRef RAROpenData As RAROpenArchiveData) As Long
Public Declare Function RARClose Lib "UnRAR.dll" Alias
"RARCloseArchive" (ByVal HandleToArchive As Long) As Long
Public Declare Function RARReadHdr Lib "UnRAR.dll" Alias
"RARReadHeader" (ByVal HandleToArcRecord As Long, ByRef ArcHeaderRead
As RARHeaderData) As Long
Public Declare Function RARProcFile Lib "UnRAR.dll" Alias
"RARProcessFile" (ByVal HandleToArcHeader As Long, ByVal Operation As
Long, ByVal DestPath As String, ByVal DestName As String) As Long
Public Declare Sub RARSetChangeVolProc Lib "UnRAR.dll" (ByVal
HandleToArchive As Long, ByVal Mode As Long)
Public Declare Sub RARSetPassword Lib "UnRAR.dll" (ByVal
HandleToArchive As Long, ByVal Password As String)

‘ código

Function RARExtract(ByVal sRARArchive As String, ByVal sDestPath As
String, Optional ByVal sPassword As String) As Integer
' Parámetros
' sRARArchive   = nombre del fichero RAR
' sDestPath     = Directorio de destino
' sPassword     = Clave
(Opcional)
' REtorna
' Entero       = 0 
Falla
'                 -1 Fallo al
abrir el fichero RAR
'                 >0
Número de ficheros extraidos
   
Dim lHandle As Long
Dim lStatus As Long
Dim uRAR As RAROpenArchiveData
Dim uHeader As RARHeaderData
Dim iFileCount As Integer
   
    RARExtract = -1
   
    ' Open the RAR
    uRAR.ArcName = sRARArchive
    uRAR.OpenMode =
RAR_OM_EXTRACT
    lHandle = RAROpen(uRAR)
    ' Failed to open RAR ?
    If uRAR.OpenResult <> 0
Then Exit Function
   
    ' Password ?
   
    If sPassword <>
"" Then
        RARSetPassword lHandle,
sPassword
    End If
   
    ' Extract file(s)...
   
    iFileCount = 0
    ' Is there at lease one
archived file to extract ?
    lStatus = RARReadHdr(lHandle,
uHeader)
    Do Until lStatus <> 0
        ' Process (extract) the
current file within the archive
        If RARProcFile(lHandle,
RAR_EXTRACT, "", sDestPath + uHeader.FileName) = 0 Then
            iFileCount =
iFileCount + 1
        End If
        ' Is there another
archived file in this RAR ?
        lStatus =
RARReadHdr(lHandle, uHeader)
    Loop
    ' Close the RAR
    RARClose lHandle
    ' Return
    RARExtract = iFileCount
End Function
alle Nachrichten anzeigenGesamtübersicht  |  Zum Thema  |  Suchen

 ThemaViews  AutorDatum
Unrar.dll93BlaseHase30.06.02 12:07
Re: Unrar.dll918unbekannt01.07.02 00:50
Re: Unrar.dll117BlaseHase01.07.02 13:53
Re: Unrar.dll984ModeratorDieter01.07.02 14:07
Re: Unrar.dll63DA rUla09.08.02 13:01
Re: Unrar.dll48BlaseHase20.08.02 09:26
Fehler ?89BlaseHase21.08.02 10:52
Re: Fehler ?67DA rUla22.08.02 15:50
Re: Fehler ?63BlaseHase22.08.02 15:55
Re: Fehler ?56BlaseHase22.08.02 15:56
Re: Fehler ?41BlaseHase22.08.02 15:56
Re: Fehler ?46DA rUla23.08.02 08:57
WinRAR 346BlaseHase23.08.02 09:22
Re: WinRAR 353DA rUla23.08.02 12:09
UnRAR49BlaseHase23.08.02 12:15

Sie sind nicht angemeldet!
Um auf diesen Beitrag zu antworten oder neue Beiträge schreiben zu können, müssen Sie sich zunächst anmelden.

Einloggen  |  Neu registrieren

Funktionen:  Zum Thema  |  GesamtübersichtSuchen 

nach obenzurück
 
   

Copyright ©2000-2025 vb@rchiv Dieter Otter
Alle Rechte vorbehalten.
Microsoft, Windows und Visual Basic sind entweder eingetragene Marken oder Marken der Microsoft Corporation in den USA und/oder anderen Ländern. Weitere auf dieser Homepage aufgeführten Produkt- und Firmennamen können geschützte Marken ihrer jeweiligen Inhaber sein.

Diese Seiten wurden optimiert für eine Bildschirmauflösung von mind. 1280x1024 Pixel