Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

extracting cab files 1

Status
Not open for further replies.

Elena

Technical User
Oct 20, 2000
112
US
Hi,

I have a set of test logs that are stored in a cab file. I want to extract all the logs to a temporary directory and then scan them all to make sure they all passed. I was using the expand command, but it doesn't seem to like long filenames and I have long filenames. Is there a way in VB to do this without shelling out to an exe?

If not, I am still very open to suggestions. Any help would be appreciated.

Thanks,
Elena
 
Hi, I think that there are third party tool that can unzip cab files.

John
 

Look in the setup1 project (where you have vb installed). MS has given the programmer the ability to make their own custom installer. Within that code is is an API ExtractFileFromCab...

[tt]
Public Declare Function ExtractFileFromCab Lib "vb6stkit.dll" (ByVal Cab As String, ByVal File As String, ByVal Dest As String, ByVal iCab As Long, ByVal sSrc As String) As Long
[/tt]

seems pretty straight forward to me.

Good Luck.
 
vb5prgrmr,

Thanks for the info. I think this will do it for me. Just a couple of questions, as I am not all that familiar with the API. What are iCab and sSrc for? I could glean the rest of them, but those are kinda non-intuitive. I tried to run it without them, but I got an error that they are not optional.

Also, where can I find information describing this type of thing?

Thanks,
Elena
 
Hi,

Well, I have been working on this almost all week now and I still haven't figured it out. I looked in the setup1.vbp and I think I figured out some of the arguments. The only one I can't seem to grasp is the icabs argument. I can see in the setup1 file that it is a global variable, but I can't find where it is being set to anything. I found one place, where it was tested against the number 1. I tried it with just putting numbers in there and I get a "can't access memory" error. I have looked everywhere for documentation on the vb6stkit.dll file and found nothing. I only found that I could distribute it. (In case you can't tell, I'm getting frustrated.) Any help in this area would be appreciated. Is it possible that I am having problem because my system is Windows 2000?

I also found some other things that could possibly work, but I don't have enough experience to understand them fully. There is the "SetupIterateCabinet" function in the setup API, but it requires a 'callback function' and I don't understand quite what that is supposed to do. Also, I couldn't find anything about what the notifications were from that function. (If I understand correctly, which is not very likely and we didn't expect it, the callback function uses the notifications from the SetupIterateCabinet function to track what it is doing, right?) How can I find out what those notifications are? Can someone give me the novice explanation of a callback function?

Aside from that, I am still open to other suggestions. I just want to extract some log files from a cab file and then open them up and read them. I have also tried using cabarc.exe and expand.exe, but I don't think I can distribute those, can I? Even if I could, I don't know how to detect errors from either of them, and the shell function doesn't finish before my next line of code starts processing.

I would really appreciate some advice. And I apologize for the rambling.

Thanks and best regards,
Elena Quinn
 
Well to give you an example I will have to look for some old code, but you have brought up a better potential solution with the SetupIterateCabinet function. I have been checking into it and I will see if I can come up with an example to archive and unarchive. I find this potential solution very interesting.

To create a call back function use the AddressOf function with the call to the API.

I believe you can distribute those exe's but search MS first.

Instead of using shell look up ShellExecute and ShellExecuteEx.

Here are some links that I have found that may help.

article


code for article


origional binaries


source code
ftp://ftp.info-zip.org/pub/infozip/src/


devx article



Compression code
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top