From: mayayana on
> > * There's cabinet.dll but the calls are all cdecl and
> > I'm not experienced enough with C++ and typelibs
> > to try Matthew Curland's cdecl-in-VB methods.
>
> My advice would be to study it for a while and see if you can
> overcome that limitation.
>
> At least that way you'd be in control of the whole process.
>
That tip made me reconsider and look at the FDI
functions in cabinet.dll, but they're monsters. It
seems to require a number of functions, with
numerous callbacks, in order to extract from a CAB.

It's odd how many CAB options there are and how
poor most of them are. A lot of the programs and code
around date back to a time when only MSZIP compression
was used. And the PDW VB6STKIT.dll
actually has an extraction function, but I couldn't get
it working. When I tried running Filemon to see what
was going on it turned out that the DLL is hard-coded
to look for the CAB in the %WIN% folder, despite one
of the parameters being the CAB path!

For some reason it seems that MS doesn't want CAB
access to be easy.


From: mayayana on
Problem: DOS window flashing with command-line EXE.

I've managed to cobble together some C++
sample code and created a command-line
EXE that works fine to extract files from CABs.
It just takes a command line parameter of
CAB file and path, unpacks the CAB, then
quits. Just one catch: A DOS screen flashes by
when it runs? What might cause that? I'm not
writing any output.


From: Karl E. Peterson on
mayayana <mayaXXyana1a(a)mindXXspring.com> wrote:
> Problem: DOS window flashing with command-line EXE.
>
> I've managed to cobble together some C++
> sample code and created a command-line
> EXE that works fine to extract files from CABs.
> It just takes a command line parameter of
> CAB file and path, unpacks the CAB, then
> quits. Just one catch: A DOS screen flashes by
> when it runs? What might cause that? I'm not
> writing any output.

You create a console application (in C++), and then ask (in a VB group!) why it
creates a console???
--
..NET: It's About Trust!
http://vfred.mvps.org


From: mayayana on

> You create a console application (in C++), and then ask (in a VB group!)
why it
> creates a console???
> --

:) Yes, I think I might have worked that out. I didn't
realize there was a difference between a "Win32
Console Applcation" and a "Win32 Application".

It's a VC++ issue but I've been working on a VB
solution. I think I have it now. MS has a sample package
called "cabview" that provides barebones C++
code for using cabinet.dll to extract from CABs.
It was fairly simple to adapt that code. Ironically,
though, I only came across it after 3 days of searching,
and it was on a Chinese download site!

It may be that no one else really needs this, but
I'll be happy to share the code samples if anyone does.
What I came up with was a small commandline
EXE that extracts all of the CAB contents to curdir.
(My C++ is not good enough to do much more than that.)

It seems that the CDECL functions in cabinet.dll
are really the only realistic way to extract. I had fairly
good luck with parsing the actual binary structure of
CABs, which turned out not to be so hard. But the trouble
with that was that there are several variations on the
compression method that can be used. So I could
extract the compressed file streams but then I'd need
several decompression routines (and their support
files) to deal with the next step. With cabinet.dll the
compression type can be ignored.

For anyone who's interested, *don't waste your time
with SetupIterateCabinet*. It works beautifully, but
only on CABs compressed with MSZIP. On others
the extraction callback returns error 13 on the first file.


From: Karl E. Peterson on
mayayana <mayaXXyana1a(a)mindXXspring.com> wrote:
>> You create a console application (in C++), and then ask (in a VB group!) why it
>> creates a console???
>
> :) Yes, I think I might have worked that out. I didn't
> realize there was a difference between a "Win32
> Console Applcation" and a "Win32 Application".

Ah yes, that _is_ a crucial distinction. <g>
--
..NET: It's About Trust!
http://vfred.mvps.org