Sign in to follow this  
Followers 0
Kealper

An interesting exit code...

14 posts in this topic

#1 ·  Posted (edited)

Well, I'm working on a telnet remote console module for an IRC bot that I'm making, and it's worked just fine for quite a while, until I started doing some overhauling of some old, messy code(It continued to work after the main overhaul, so that doesn't appear to be the problem). As of yesterday, I broke it somehow, and after starting it up through SciTE to see what line is causing the crash, it shows this:

!>20:16:09 AutoIT3.exe ended.rc:-1073741819
+>20:16:11 AutoIt3Wrapper Finished
>Exit code: -1073741819    Time: 22.316

Now, I've never seen anything like that, and it has an exit code of -1073741819...Anyone ever seen this before?

It might be something stupid that I did late last night to break the script without realizing it, but as of right now, I'm stumped :mellow:

EDIT: Oh, yea and I think AutoIt is actually crashing, as the icon stays in the system tray. A normal "crash" throws an error in a message box, tells you what went wrong, and closes properly after pressing Ok, this just dies instantly with that strange error/exit code.

Edited by Kealper

Share this post


Link to post
Share on other sites



#3 ·  Posted (edited)

Yea, sorry, didn't occur to me :mellow:

You can delete the topic if you want :(

Edited by Kealper

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

Ok, I searched for about an hour and a half, but could not find any definitive answer on what this error is. So I did some real in-depth debugging and finally nailed the problem in my script, and was able to recreate the hard crash with the simple script below. (maybe it can help others find the problem in their programs quicker, should they make the same mistake.)

This hard crashes AutoIt 100% of the time on a WinXP SP2 x86 machine and a Win7 x64 machine.

It appears to happen when you have a ContinueCase on the last case of both a Switch or a Select

For $i = 1 To 3
    Switch $i
        Case 1
            ConsoleWrite("$i = " & $i & @CRLF)
        Case 2
            ConsoleWrite("$i = " & $i & @CRLF)
        Case Else
            If $i = 3 Then ContinueCase
    EndSwitch
Next
Edited by Kealper

Share this post


Link to post
Share on other sites

Shouldn't that be caught at compile time then?

Share this post


Link to post
Share on other sites

#6 ·  Posted (edited)

I would have thought that too, but it will compile fine, show no problems until it gets to that specific thing, then crashes.

EDIT: just checked, passes Tidy and everything :mellow:

Edited by Kealper

Share this post


Link to post
Share on other sites

#7 ·  Posted (edited)

whatever Edited by MvGulik

"Straight_and_Crooked_Thinking" : A "classic guide to ferreting out untruths, half-truths, and other distortions of facts in political and social discussions."
"The Secrets of Quantum Physics" : New and excellent 2 part documentary on Quantum Physics by Jim Al-Khalili. (Dec 2014)

"Believing what you know ain't so" ...

Knock Knock ...
 

Share this post


Link to post
Share on other sites

I've never reported a bug before, but ok, there's a first time for everything :mellow:

*sigh* I really should be more active on here...lol


Share this post


Link to post
Share on other sites

#10 ·  Posted (edited)

whatever Edited by MvGulik

"Straight_and_Crooked_Thinking" : A "classic guide to ferreting out untruths, half-truths, and other distortions of facts in political and social discussions."
"The Secrets of Quantum Physics" : New and excellent 2 part documentary on Quantum Physics by Jim Al-Khalili. (Dec 2014)

"Believing what you know ain't so" ...

Knock Knock ...
 

Share this post


Link to post
Share on other sites

Than its most likely a differant problem.

The exit value -1073741819 is not a crash PID, that would be ... to easy.

This number means a 0xC0000005 access violation occured.

Visit the SciTE4AutoIt3 Download page for the latest versions        Beta files                                                          Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites

#13 ·  Posted (edited)

whatever Edited by MvGulik

"Straight_and_Crooked_Thinking" : A "classic guide to ferreting out untruths, half-truths, and other distortions of facts in political and social discussions."
"The Secrets of Quantum Physics" : New and excellent 2 part documentary on Quantum Physics by Jim Al-Khalili. (Dec 2014)

"Believing what you know ain't so" ...

Knock Knock ...
 

Share this post


Link to post
Share on other sites

The code is something I found here on the forum while searching how to do it

#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <Sound.au3>

HotKeySet('!{ENTER}', 'FullScreen') ; Alt + Enter toggles fullscreen

Opt("GuiOnEventMode",1)

Global $vID, $Fullscreen

$GUI = GUICreate("Video Control", 400, 335 , -1, -1, BitOr($WS_OVERLAPPEDWINDOW,$WS_CLIPCHILDREN))
GUISetOnEvent($GUI_EVENT_CLOSE , "Event")

$Play = GUICtrlCreateButton("Play", 5, 305, 40, 25)
GUICtrlSetOnEvent(-1 , "Event")
GuiCtrlSetState(-1, $GUI_DISABLE)

$Stop = GUICtrlCreateButton("Stop", 50, 305, 40, 25)
GUICtrlSetOnEvent(-1 , "Event")
GuiCtrlSetState(-1, $GUI_DISABLE)

$Open = GUICtrlCreateButton("Load", 95, 305, 40, 25)
GUICtrlSetOnEvent(-1 , "Event")

GuiSetState(@SW_SHOW, $GUI)

While 1
    Sleep(100)
WEnd

Func Event()
    Switch @GUI_CtrlId
        Case $GUI_EVENT_CLOSE
            _SoundClose($vID)
            Exit
        Case $Play
            If _SoundStatus($vID) = "playing" Then
                _SoundPause($vID)
               GUICtrlSetData($Play, 'Play')
            ElseIf _SoundStatus($vID) = "paused" Then
                _SoundResume($vID)
                GUICtrlSetData($Play, 'Pause')
            ElseIf _SoundStatus($vID) = "stopped" Then
                _VidPlay($vID, 0)
                GUICtrlSetData($Play, 'Pause')
            EndIf
        Case $Stop
            If _SoundStatus($vID) = "playing" Then
                _SoundStop($vID)
                GUICtrlSetData($Play, 'Play')
            EndIf
        Case $Open
            $file = FileOpenDialog("OPEN","","Video (*.avi;*.mpg)")
            If @error <> 1 Then
                If _SoundStatus($vID) <> "" Then
                    _SoundClose($vID)
                    GUICtrlSetData($Play, 'Play')
                EndIf
                $vID = _VidOpen($file, "", $GUI, 0, 0, 400, 300)
                If $vID <> "" Then
                    _VidPlay($vID, 0)
                    GUICtrlSetData($Play, 'Pause')
                    GuiCtrlSetState($Play, $GUI_ENABLE)
                    GuiCtrlSetState($Stop, $GUI_ENABLE)
                EndIf
            EndIf
    EndSwitch
EndFunc

Func FullScreen()
    If $Fullscreen = 0 Then
        _VidPlay($vid, 1)
        $Fullscreen = 1
    ElseIf $Fullscreen = 1 Then
        _VidPlay($vid, 0)
        $Fullscreen = 0
    EndIf
EndFunc

;===============================================================================
;
; Function Name:   _VidOpen($vFile, $vAlias, $guID, $vX1, $vY1, $vX2, $vY2)
; Description::    Opens a Video file as a control in a gui for use with other _Vid/_Sound functions
; Parameter(s):    $vFile - The full path to video file (spaces in path/file name is fine)
;                  $vAlias - a name such as sound1 (must contain no spaces), use "" and it is randomly generated
;                  $guID - The gui handle that the video control will be displayed in
;                  $vX1 - Left position in the gui (set as 0 for left edge of GUI)
;                  $vY1 - Top position in the gui (set as 0 for Top edge of GUI, flush to Title bar if one exists)
;                  $vX2 - Width of the video
;                  $vY2 - Height of the video
; Requirement(s):  AutoIt 3.2 ++
; Return Value(s): string(the alias video id for use in other _Vid/_Sound functions) - Success
;                  0 - Failure
;                  @extended <> 0 - open failed
;                  @error = 2 - File doesn't exist
;                  @error = 3 - alias contains whitespace
;                  @error = 4 - gui handle is not valid
;                  @error = 5 - Failed to render video to GUI
;                  @error = 6 - Failed to place video at the deignated location in GUI
; Author(s):       smashly (modified from RazorM sound udf for video open)
;
;
;===============================================================================
;
Func _VidOpen($vFile, $vAlias, $guID, $vX1, $vY1, $vX2, $vY2)
    ;Declare variables
    Local $vID, $iCurrentPos, $gId, $vRet, $vWin, $vLoc
    ;check for file
    If Not FileExists($vFile) Then Return SetError(2, 0, 0)
    ;search for whitespace by character
    For $iCurrentPos = 1 To StringLen($vAlias)
        If StringIsSpace(StringMid($vAlias, $iCurrentPos, 1)) Then Return SetError(3, 0, 0)
    Next
    ;create random alias if one is not supplied
    If $vAlias = "" Then
        $vID = RandomStr(10)
    Else
        $vID = $vAlias
    EndIf
    ;check and translate the gui handle into a ASCII numeric equivalent
    If StringLeft($guID, 2) = '0x' And StringIsXDigit(StringTrimLeft($guID, 2)) = 1 Then
        $gId = Dec(StringTrimLeft($guID,2))
    Else
        Return SetError(4, 0, 0)
    EndIf
    ;open video file in the gui at desired location and size
    $vRet = mciSendString("open " & FileGetShortName($vFile) & " alias " & $vID)
    $vWin = mciSendString("window " & $vID & " handle " & $gId)
    If $vWin <> 0 Then
        mciSendString("close " & $vID)
        Return SetError(5, 0, 0)
    EndIf
    $vLoc = mciSendString("put " & $vID & " destination at " & $vX1 & " " & $vY1 & " " & $vX2 & " " & $vY2)
    If $vLoc <> 0 Then
        mciSendString("close " & $vID)
        Return SetError(6, 0, 0)
    EndIf
    Return SetError(0, $vRet, $vID)
EndFunc   ;==>_VidOpen

;===============================================================================
;
; Function Name:   _VidPlay($vID, $fScreen)
; Description::    Plays a Video from the current position (beginning is the default)
; Parameter(s):    $vID - Video ID returned by _VidOpen
;                  $fScreen [Optional] - If set to 1 the will be played in FullScreen (no gui or Controls displayed)
;                                      - If set to 0 the video will play in the gui as specified in _VidOpen
;                                      - If omitted then 0 will be used (play in the gui as specified in _VidOpen)
; Requirement(s):  AutoIt 3.2 ++
; Return Value(s): 1 - Success, 0 - Failure
;                  @error = 1 - play failed
; Author(s):       smashly (modified from RazorM sound udf for video play)
;
;===============================================================================
;
Func _VidPlay($vID, $fScreen = 0)
    ;Declare variables
    Local $vRet
    ;if sound has finished, seek to start
    If _SoundPos($vID, 2) = _SoundLength($vID, 2) Then mciSendString("seek " & $vID & " to start")
    If $fScreen = 1 Then
        $vRet = mciSendString("play " & $vID & " fullscreen")
    Else
        $vRet = mciSendString("play " & $vID)
    EndIf
    ;return
    If $vRet = 0 Then
        Return 1
    Else
        Return SetError(1, 0, 0)
    EndIf
EndFunc   ;==>_VidPlay

Func mciSendString($string)
Local $iRet
$iRet = DllCall("winmm.dll", "int", "mciSendStringA", "str", $string, "str", "", "int", 65534, "hwnd", 0)
If Not @error Then Return $iRet[2]
EndFunc ;==>mciSendString

Func RandomStr($len)
Local $string
For $iCurrentPos = 1 To $len
$string &= Chr(Random(97, 122, 1))
Next
Return $string
EndFunc ;==>RandomStr

And its happened, with every xvid avi file I tried.


AutoIt Absolute Beginners    Require a serial    Pause Script    Video Tutorials by Morthawt   ipify 

Monkey's are, like, natures humans.

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  
Followers 0