Jump to content

Error in latest AutoIt3Wrapper.au3 (Version 17.224.935.11 from 2018-03-03 18:22)


Recommended Posts

Hi Jos,

using your latest AutoIt3Wrapper-Script for compliing leads me to an error in line 2150:

"...

"C:\Program Files (x86)\AutoIt3\SciTE\AutoIt3Wrapper\AutoIt3Wrapper_new.au3" (2150) : ==> Subscript used on non-accessible variable.:
If $result[0] <> 1 Then __ConsoleWrite("+ UpdateResources other: $result[0] = " & $result[0] & " - LastError:" & _WinAPI_GetLastError() & ":" & _WinAPI_GetLastErrorMessage() & @CRLF)
If $result^ ERROR"

I added a debug line (MsgBox) after the command which shows me the vars used for DLL call and the return code:

Case Else ; 10, 16, 24 *** RT_RCDATA, RT_VERSION and RT_MANIFEST *** and Other
            $tSize = FileGetSize($InpResFile)
            $tBuffer = DllStructCreate("byte Text[" & $tSize & "]") ; Create the buffer.
            $pBuffer = DllStructGetPtr($tBuffer)
            _WinAPI_ReadFile($hFile, $pBuffer, $tSize, $bread, 0)
            If $hFile Then _WinAPI_CloseHandle($hFile)
            If $bread > 0 Then
                $result = DllCall("kernel32.dll", "int", "UpdateResourceW", "ptr", $rh, $RType_Type, $RType, $RName_Type, $RName, "ushort", $RLanguage, "ptr", $pBuffer, "dword", $tSize)
                MsgBox(0, "DEBUG", "ts=" & $tSize & " rh=" & $rh & " rtt=" & $RType_Type & " rt=" & $RType & " rnt=" & $RName_Type & " rn=" & $RName & " rlng=" & $RLanguage & " -->" & @error)
                If $result[0] <> 1 Then __ConsoleWrite("+ UpdateResources other: $result[0] = " & $result[0] & " - LastError:" & _WinAPI_GetLastError() & ":" & _WinAPI_GetLastErrorMessage() & @CRLF)
                Return $result[0]
            EndIf
            Return 0
    EndSwitch

Result is a missing value ($RType_Type) which leads to error 1 in DllCall:

"ts=568 rh=0x001C009C rtt= rt=16 rnt=long rn=1 rlng=1031 -->1"

Using the same debug output in the previous version I get a correct value an the expected Array containing the results:

"ts=568 rh=0x00E100F4 rtt=long rt=16 rnt=long rn=1 rlng=1031 -->0"

Searching a little bit in the script I found two lines commented out for some reasons at line 1828 and 1829:

; set parameter types
    If IsString($RType) Then
        $RType_Type = "wstr"
        $RType = StringReplace(StringUpper($RType), "RT_", "")
        ;   Else
        ;       $RType_Type = "long"
    EndIf

After re-enabling them to

; set parameter types
    If IsString($RType) Then
        $RType_Type = "wstr"
        $RType = StringReplace(StringUpper($RType), "RT_", "")
    Else
        $RType_Type = "long"
    EndIf

the script works as before.

If this solution is correct, please fix it - otherwise you have to take a look at your script whats going wrong.

Greetings

kara2004

 

Link to comment
Share on other sites

  • Developers

@jpm,
Why did you comment this part in your update as that seems to cause issues? Is there a reason which we need to look at?

@kara2004,
Thanks for reporting. I have restored those 2 lines in the current Beta.

Jos

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

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...