Jump to content
kara2004

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

Recommended Posts

kara2004

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

 

Share this post


Link to post
Share on other sites
Jos

@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


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

Share this post


Link to post
Share on other sites
jpm

Yes I did,

sorry my bad I was thinking the previous setting was always true

Share this post


Link to post
Share on other sites
jpm

There are 2 places

Share this post


Link to post
Share on other sites
kara2004

Hello Jos & jpm,

that's a really quick fix.

Thank you very much.

kara2004

:thumbsup:

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

×