elhacker.net cabecera Bienvenido(a), Visitante. Por favor Ingresar o Registrarse
¿Perdiste tu email de activación?.

 

 


Tema destacado: Usando Git para manipular el directorio de trabajo, el índice y commits (segunda parte)


+  Foro de elhacker.net
|-+  Programación
| |-+  Programación General
| | |-+  .NET (C#, VB.NET, ASP)
| | | |-+  Programación Visual Basic (Moderadores: LeandroA, seba123neo)
| | | | |-+  Read ZIP file info
0 Usuarios y 1 Visitante están viendo este tema.
Páginas: [1] Ir Abajo Respuesta Imprimir
Autor Tema: Read ZIP file info  (Leído 1,600 veces)
cobein


Desconectado Desconectado

Mensajes: 759



Ver Perfil WWW
Read ZIP file info
« en: 12 Octubre 2010, 19:55 pm »

Mirando el ultimo proyecto de Leandeo me dio curiosidad el tema de leer el contenido de los zip y arme un mudulo super simple para listar las carpetas y archivos (solo las rutas).

Código:
'---------------------------------------------------------------------------------------
' Module      : mZIPInfo
' DateTime    : 10/12/2010 10:45
' Author      : Cobein
' Mail        : cobein27@hotmail.com
' WebPage     : http://www.advancevb.com.ar
' Purpose     : Read file/folder info from zip files
' Usage       : At your own risk
' Requirements: None
' Distribution: You can freely use this code in your own
'               applications, but you may not reproduce
'               or publish this code on any web site,
'               online service, or distribute as source
'               on any media without express permission.
'
' Reference   : http://www.pkware.com/documents/casestudies/APPNOTE.TXT
'
' History     : 10/12/2010 First Cut....................................................
'---------------------------------------------------------------------------------------
Option Explicit

Private Const ZIP_SIGNATURE As Long = &H4034B50

Private Type tZipHeader
    Signature   As Long
    Version     As Integer
    Flag        As Integer
    Compression As Integer
    FileTime    As Integer
    FileDate    As Integer
    CRC         As Long
    CompZise    As Long
    UncompSize  As Long
    NameLength  As Integer
    ExtraLength As Integer
End Type

Public Function ReadZipInfo(ByVal sFile As String) As Collection
    Dim iFile   As Integer
    Dim tHead   As tZipHeader
    Dim sName   As String
    Dim sExtra  As String
    Dim lOffset As Long
    Dim cNames  As New Collection
   
    On Local Error GoTo ReadZipInfo_Error

    iFile = FreeFile
    lOffset = 1
   
    Open sFile For Binary Access Read As iFile
NextHead:
    Get iFile, lOffset, tHead
    With tHead
        If .Signature = ZIP_SIGNATURE Then
            sName = Space(.NameLength)
            Get iFile, , sName
            sExtra = Space(.ExtraLength)
            Get iFile, , sExtra
            Call cNames.Add(sName)
            lOffset = lOffset + .CompZise + 30 + .ExtraLength + .NameLength
            GoTo NextHead:
        End If
    End With
    Close iFile
    Set ReadZipInfo = cNames

    On Error GoTo 0
    Exit Function

ReadZipInfo_Error:
    Close iFile
    Set ReadZipInfo = cNames
End Function


En línea

http://www.advancevb.com.ar
Más Argentino que el morcipan
Aguante el Uvita tinto, Tigre, Ford y seba123neo
Karcrack es un capo.
ranslsad


Desconectado Desconectado

Mensajes: 492


Dim Ranslsad as String * :P - Que Vicio!


Ver Perfil WWW
Re: Read ZIP file info
« Respuesta #1 en: 13 Octubre 2010, 11:16 am »

Muy bueno!
En cuanto tenga de nuevo mi PC para mi libreria! :D

Salu2

Ranslsad


En línea

Páginas: [1] Ir Arriba Respuesta Imprimir 

Ir a:  

Mensajes similares
Asunto Iniciado por Respuestas Vistas Último mensaje
Read/WriteProcessMemory Windows 7 Vb.Net
Hacking
Keyen Night 0 2,530 Último mensaje 21 Febrero 2011, 20:38 pm
por Keyen Night
Pendrive Modo Read Only
Hardware
skarih 0 1,779 Último mensaje 4 Octubre 2015, 00:07 am
por skarih
comando read
Scripting
puchi 6 3,531 Último mensaje 28 Diciembre 2016, 20:59 pm
por puchi
Por que read no funciona con system?
Programación C/C++
Lieutenant McFarley 4 2,752 Último mensaje 24 Marzo 2022, 23:45 pm
por RayR
WAP2 - Aviso Legal - Powered by SMF 1.1.21 | SMF © 2006-2008, Simple Machines