Results 1 to 9 of 9

Thread: [RESOLVED] how to get crc from zip

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Aug 2019
    Posts
    194

    Resolved [RESOLVED] how to get crc from zip

    i have the code to open zip and se its contents but how do i check each file crc?
    am not at home now so please share what you can thank you.

  2. #2
    VB-aholic & Lovin' It LaVolpe's Avatar
    Join Date
    Oct 2007
    Location
    Beside Waldo
    Posts
    19,541

    Re: how to get crc from zip

    Computing the crc for a file is a well-established algorithm. You can many examples on this site. While your aware from home, you may want to try this google search: crc file site:vbforums.com
    Insomnia is just a byproduct of, "It can't be done"

    Classics Enthusiast? Here's my 1969 Mustang Mach I Fastback. Her sister '67 Coupe has been adopted

    Newbie? Novice? Bored? Spend a few minutes browsing the FAQ section of the forum.
    Read the HitchHiker's Guide to Getting Help on the Forums.
    Here is the list of TAGs you can use to format your posts
    Here are VB6 Help Files online


    {Alpha Image Control} {Memory Leak FAQ} {Unicode Open/Save Dialog} {Resource Image Viewer/Extractor}
    {VB and DPI Tutorial} {Manifest Creator} {UserControl Button Template} {stdPicture Render Usage}

  3. #3

    Thread Starter
    Addicted Member
    Join Date
    Aug 2019
    Posts
    194

    Re: how to get crc from zip

    Quote Originally Posted by LaVolpe View Post
    Computing the crc for a file is a well-established algorithm. You can many examples on this site. While your aware from home, you may want to try this google search: crc file site:vbforums.com
    thanks

  4. #4
    PowerPoster wqweto's Avatar
    Join Date
    May 2011
    Location
    Sofia, Bulgaria
    Posts
    6,194

    Re: how to get crc from zip

    JFYI, the original cZipArchive class has a public CalcCrc32Array function that is based on libdeflate's crc32_slice4 implementation and I'm 99% sure this can beat any VB6 implementation in benchmarking (left 1% for if Olaf chimes in:-)).

    cheers,
    </wqw>

  5. #5
    PowerPoster dilettante's Avatar
    Join Date
    Feb 2006
    Posts
    24,487

    Re: how to get crc from zip

    If you make use of zlibwapi.dll you can get the CRC along with the Name (and other things if you really want them) of each item.

    Here's a wrapper class for the purpose.

    Name:  sshot.png
Views: 571
Size:  3.2 KB

    You'll need a version of zlibwapi.dll in the EXE folder, or somewhere along the paths in the PATH environment variable, or a path spelled out in a manifest, etc. Somewhere that the DLL search can find it.
    Attached Files Attached Files

  6. #6
    Addicted Member Wolfgang Enzinger's Avatar
    Join Date
    Apr 2014
    Location
    Munich, Germany
    Posts
    160

    Re: how to get crc from zip

    The easiest way that I'm aware of is described here.

    Wolfgang

  7. #7

    Thread Starter
    Addicted Member
    Join Date
    Aug 2019
    Posts
    194

    Re: how to get crc from zip

    Quote Originally Posted by dilettante View Post
    If you make use of zlibwapi.dll you can get the CRC along with the Name (and other things if you really want them) of each item.

    Here's a wrapper class for the purpose.

    Name:  sshot.png
Views: 571
Size:  3.2 KB

    You'll need a version of zlibwapi.dll in the EXE folder, or somewhere along the paths in the PATH environment variable, or a path spelled out in a manifest, etc. Somewhere that the DLL search can find it.
    thank you so much.

  8. #8
    PowerPoster
    Join Date
    Jan 2020
    Posts
    5,541

    Re: how to get crc from zip

    Quote Originally Posted by dilettante View Post
    If you make use of zlibwapi.dll you can get the CRC along with the Name (and other things if you really want them) of each item.

    Here's a wrapper class for the purpose.

    Name:  sshot.png
Views: 571
Size:  3.2 KB

    You'll need a version of zlibwapi.dll in the EXE folder, or somewhere along the paths in the PATH environment variable, or a path spelled out in a manifest, etc. Somewhere that the DLL search can find it.
    how to get file byte from DLL API?

    LIKE THIS?
    How to unpack a ZIP file using the library zlibwapi.dll ?-VBForums
    https://www.vbforums.com/showthread....y-zlibwapi-dll


    Code:
    Sub GetFileList(FileList() As String) 
        Dim crc As Long
        Dim Path As String
        Dim Listc As New Collection
        FirstFile Path, crc
        Do While Len(Path)
            Listc.Add Path
            NextFile Path, crc
        Loop
        If Listc.Count > 0 Then
            ReDim FileList(Listc.Count - 1)
            Dim v
            Dim ID As Long
             ID = 0
            For Each v In Listc
                FileList(ID) = v
                ID = ID + 1
            Next
        Else
            ReDim FileList(-1 To -1)
        End If
    End Sub

  9. #9
    Fanatic Member HackerVlad's Avatar
    Join Date
    Nov 2023
    Posts
    681

    Re: [RESOLVED] how to get crc from zip

    Code:
    Option Explicit
    Private Declare Function RtlComputeCrc32 Lib "ntdll.dll" (ByVal dwInitial As Long, ByVal pData As Long, ByVal iLen As Long) As Long
    
    Private Function Crc32Api(tBuff() As Byte) As Long
        Crc32Api = RtlComputeCrc32(0, VarPtr(tBuff(0)), UBound(tBuff) + 1)
    End Function

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width