Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

I have a VB6 application using zip32.dll and unzip32.dll that zips and unzip files (of course!)

 

after converting it to VB.NET i get a StackOverflowException in my VBUnzip Function in the red line:

 

Public Function VBUnzip(ByRef sZipFileName As Object, ByRef sUnzipDirectory As String, ByRef iExtractNewer As Short, ByRef iSpaceUnderScore As Short, ByRef iPromptOverwrite As Short, ByRef iQuiet As Short, ByRef iWriteStdOut As Short, ByRef iTestZip As Short, ByRef iExtractList As Short, ByRef iExtractOnlyNewer As Short, ByRef iDisplayComment As Short, ByRef iHonorDirectories As Short, ByRef iOverwriteFiles As Short, ByRef iConvertCR_CRLF As Short, ByRef iVerbose As Short, ByRef iCaseSensitivty As Short, ByRef iPrivilege As Short) As Integer

       On Error GoTo vbErrorHandler

       Dim lRet As Integer
       Dim UZDCL As DCLIST
       Dim UZUSER As USERFUNCTION
       Dim UZVER As UZPVER
       UZVER.Initialize()
       Dim uExcludeNames As UNZIPnames
       uExcludeNames.Initialize()
       Dim uZipNames As UNZIPnames
       uZipNames.Initialize()
  
       msOutput = ""

       uExcludeNames.uzFiles(0) = vbNullString
       uZipNames.uzFiles(0) = vbNullString
       uZipNumber = 0
       uZipMessage = vbNullString
       uZipInfo = vbNullString
       uVBSkip = 0

       With UZDCL
           .ExtractOnlyNewer = iExtractOnlyNewer
           .SpaceToUnderScore = iSpaceUnderScore
           .PromptToOverwrite = iPromptOverwrite
           .fQuiet = iQuiet
           .ncflag = iWriteStdOut
           .ntflag = iTestZip
           .nvflag = iExtractList
           .nUflag = iExtractNewer
           .nzflag = iDisplayComment
           .ndflag = iHonorDirectories
           .noflag = iOverwriteFiles
           .naflag = iConvertCR_CRLF
           .nZIflag = iVerbose
           .C_flag = iCaseSensitivty
           .fPrivilege = iPrivilege
           .Zip = sZipFileName
           .ExtractDir = sUnzipDirectory
       End With

       With UZUSER
           .UZDLLPrnt = AddressOf UZDLLPrnt
           .UZDLLSND = 0
           .UZDLLREPLACE = AddressOf UZDLLRep
           .UZDLLPASSWORD = AddressOf UZDLLPass
           .UZDLLMESSAGE = AddressOf UZReceiveDLLMessage
           .UZDLLSERVICE = AddressOf UZDLLServ
       End With

       With UZVER
           .structlen = Len(UZVER)
           .beta = Space(9) & vbNullChar
           .date_Renamed = Space(19) & vbNullChar
           .zlib = Space(9) & vbNullChar
       End With

       [color=DarkRed]UzpVersion2(UZVER)[/color]

       lRet = Wiz_SingleEntryUnzip(0, uZipNames, 0, uExcludeNames, UZDCL, UZUSER)
       VBUnzip = lRet

       Exit Function

vbErrorHandler:
       Err.Raise(Err.Number, "CodeModule::VBUnzip", Err.Description)

   End Function

 

Why is the Exception thrown in this line? In VB6 it worked without any problem.

 

Do you need some other code to help me?

  • *Experts*
Posted

Have you seen this?

 

I got it working in about two hours, about 1.5 of that was reading the docs and looking at a couple of samples.

 

It should save you from having to convert all those APIs yourself.

 

-ner

"I want to stand as close to the edge as I can without going over. Out on the edge you see all the kinds of things you can't see from the center." - Kurt Vonnegut
Posted

yes, i know this.

 

but i'm working here on my diploma and should compare converting and making new.

 

but if making new is so fast as you say, it will make absolutely no sense to try updating.

  • *Experts*
Posted

When I said I spent 2 hours, I meant getting the existing Zip/Unzip code working. I wrote a quick wrapper to unzip a single file that I knew existed inside a zip file. Another wrapper would extract all files with a given extension.

 

If I understand, you are trying to get the pre-compiled DLLs to work from within .NET? Maybe from a learning perspective it makes sense, but the link I showed gives you actual source to what the pre-compiled DLLs have. It's the equivalent of writing your own string class based on the char datatype to provide the exact same functionality that's provided in .NET's string type.

 

If you still want help getting the API translation to work in .NET, you'll probably have to include a sample project instead of just a code snippet as debugging API code can be tricky and, I would guess, no one wants to redeclare the APIs that you've already done - especially since it appears as though something isn't quite right.

 

-Ner

"I want to stand as close to the edge as I can without going over. Out on the edge you see all the kinds of things you can't see from the center." - Kurt Vonnegut
Posted

i tried #zipLib.

works great.

 

for my diploma i should test if it's worth do a upgrade. If it's to difficult to do in a short time i should find a better solution for .net.

 

changing code and using #zipLib is much faster.

 

thank you for your tip.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...