Jump to content

AutoIT has detected the stack has become corrupt


Recommended Posts

Hello,

I am using the 7-zip.dll to extract cabinets. Using the beta v3.2.3.2 I am now suddendly getting the error message "AutoIT has detected the stack has become corrupt". Here is the code:

$dll = DllOpen($lib)
    $check = DllCall($dll, "int", "SevenZip", "hwnd", 0, "str", 'x ' & $ExtraParams & ' -o' & $Target & ' ' & $CabFile & ' ' & $filter, "int", 0)
    DllClose($dll)

    If @error Then ; unexpected error
        If $Debug = "1" Or $Debug = "2" Then ProgressOn($title, "Cleaning up...", "Removing partial folders. Please hold...")
        DirRemove($Target & "\" & $Dir, 1)
        If $Debug = "1" Or $Debug = "2" Then ProgressSet(100)
        If $Debug = "1" Or $Debug = "2" Then Sleep(500)
        If $Debug = "1" Or $Debug = "2" Then ProgressOff()
        CError("Transfer error.")
    ElseIf $check[0] = "32800" Then ; user has pressed the Cancel button
        If $Debug = "1" Or $Debug = "2" Then ProgressOn($title, "Cleaning up...", "Removing partial folders. Please hold...")
        DirRemove($Target & "\" & $Dir, 1)
        If $Debug = "1" Or $Debug = "2" Then ProgressSet(100)
        If $Debug = "1" Or $Debug = "2" Then Sleep(500)
        If $Debug = "1" Or $Debug = "2" Then ProgressOff()
        CError("Transfer interrupted.")
    EndIf

What should I change so as to continue using this code with the beta version?

Also why AU3 produces that critical error since I use Opt("RunErrorsFatal", 0) in my script?

P.S. You can find the DLL here and the related post is here.

Edited by erebus
Link to comment
Share on other sites

$dll = DllOpen($lib)
    $check = DllCall($dll, "int:cdecl", "SevenZip", "hwnd", 0, "str", 'x ' & $ExtraParams & ' -o' & $Target & ' ' & $CabFile & ' ' & $filter, "int", 0)
    DllClose($dll)

    If @error Then ; unexpected error
        If $Debug = "1" Or $Debug = "2" Then ProgressOn($title, "Cleaning up...", "Removing partial folders. Please hold...")
        DirRemove($Target & "\" & $Dir, 1)
        If $Debug = "1" Or $Debug = "2" Then ProgressSet(100)
        If $Debug = "1" Or $Debug = "2" Then Sleep(500)
        If $Debug = "1" Or $Debug = "2" Then ProgressOff()
        CError("Transfer error.")
    ElseIf $check[0] = "32800" Then ; user has pressed the Cancel button
        If $Debug = "1" Or $Debug = "2" Then ProgressOn($title, "Cleaning up...", "Removing partial folders. Please hold...")
        DirRemove($Target & "\" & $Dir, 1)
        If $Debug = "1" Or $Debug = "2" Then ProgressSet(100)
        If $Debug = "1" Or $Debug = "2" Then Sleep(500)
        If $Debug = "1" Or $Debug = "2" Then ProgressOff()
        CError("Transfer interrupted.")
    EndIf

Did that work?

Link to comment
Share on other sites

wrong number of parameters, try this:

$dll = DllOpen($lib)
; int   WINAPI SevenZip(const HWND _hwnd, LPCSTR _szCmdLine, LPSTR _szOutput, const DWORD _dwSize);
$check = DllCall($dll, "int", "SevenZip", _
                        "hwnd", 0, _
                        "str", 'x ' & $ExtraParams & ' -o' & $Target & ' ' & $CabFile & ' ' & $filter, _
                        "str", "", _
                        "int", 65535)
DllClose($dll)

If @error Then ; unexpected error
    If $Debug = "1" Or $Debug = "2" Then ProgressOn($title, "Cleaning up...", "Removing partial folders. Please hold...")
    DirRemove($Target & "\" & $Dir, 1)
    If $Debug = "1" Or $Debug = "2" Then ProgressSet(100)
    If $Debug = "1" Or $Debug = "2" Then Sleep(500)
    If $Debug = "1" Or $Debug = "2" Then ProgressOff()
    CError ("Transfer error.")
ElseIf $check[0] = "32800" Then ; user has pressed the Cancel button
    If $Debug = "1" Or $Debug = "2" Then ProgressOn($title, "Cleaning up...", "Removing partial folders. Please hold...")
    DirRemove($Target & "\" & $Dir, 1)
    If $Debug = "1" Or $Debug = "2" Then ProgressSet(100)
    If $Debug = "1" Or $Debug = "2" Then Sleep(500)
    If $Debug = "1" Or $Debug = "2" Then ProgressOff()
    CError ("Transfer interrupted.")
EndIf

Just if you don't have them already, there is a English translation of the docs:

http://www.csdinc.co.jp/archiver/lib/7-zip32api-en.txt

CoProc Multi Process Helper libraryTrashBin.nfshost.com store your AutoIt related files here!AutoIt User Map
Link to comment
Share on other sites

You are a life saver! Thank you very much, it seems to work well!

The truth is I knew the site with the EN docs, however my knowledge of the Dll* functions in AutoIT and DLLs in general is very limited, so I cannot debug such problems myself easily.

Thank you very much again for your response, I really appreciate it.

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...