Jump to content
Sign in to follow this  

Help with 7-Zip32.dll

Recommended Posts

Ok im using 7-zip32.dll and trying to get a detailed list of files in any given archive.

im using the command line "l -slt" this fine for archives with only a few files but crashes Autoit v3 with archives that have a lot of files.

it does'nt appear the size in disk space of the archive matter but rather the number of files.

I was able to track it down a problem with it's return value, when ever it's set to return more then 65544 bytes it crashes.

the sample archive i was using was "cedt-241-portable.zip", which is crimson editor 2.41.

the contents of the archive is 715 Files, 9 Folders, but does'nt matter whats in the archive or their size.. only how big the output back to autoit is.

it appears when the DLL is called it returns what would have normally been written to the console window if you did this with 7za.exe back in ARRAY[3]

i've included 2 files in a zip file.. 1 is a "l -slt" output using 7za.exe, the other is the max i can safely get back using the dll.

here is the line of code im using

$RETURN = DllCall("7-zip32.dll", "int", "SevenZip", "hwnd", 0, "str", '"' & "l -slt " & ".\zip\cedt-241-portable.zip" & '"', "str", "", "int",  65544)

"65544" is the amount of bytes the dll will return to autoit.. if it's set to 0 for example it will not return any of what normal would be written to the console window back to auto it.

65544 appears to the be most i can pull out without autoit crashing.. and when i say crashing i mean crashing not an Code/Error window.

When successful the output would be returned to autoit in the array RETURN[3]

im using Autoit v3 ( on WinXP x86

the DLL is listed as V9.20.0.2

can anyone tell me what im doing wrong? or a way around this other then switching to using 7za.exe? which is a bit messy when you need to read the contents of 100's if not 1000's of zip's in a single execution.

Thanks in advance.


Share this post

Link to post
Share on other sites

Make the buffer yourself. That way you can specify whatever the size. Currently you are using internal char buffer (str) with fixed size of 65536 bytes.

oh.. so im guessing the 64kb limitation is in Autoit not the dll then right?

so how would i go about setting up another buffer?

i assume it would have to do with "_szOutput" but i can't figure out a way to shift to buffer to something else another variable to serve as the return i guess?

i've attached the english API for the dll.. it's original documents was in Japanese.

i dont need you write it for me but if you could at least give me some clues as to how to go about it.

this is only my 2nd experience with autoit and dll's so i dont fully understand their usage.

my 1st experience was with inpout32.dll which lets you control the parallel port.



Edited by JoeSixpack

Share this post

Link to post
Share on other sites

Something like this:

; Make the buffer:
$tBuffer = DllStructCreate("byte[" & $iWhateverSize & "]") ; or char buffer if that's what you want

; Call function:
DllCall(..., "ptr", DllStructGetPtr($tBuffer), "dword", $iWhateverSize)

; Collect data from the buffer:
$sData = DllStructGetData($tBuffer)
Edited by trancexx




Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.

  • Create New...