Jump to content

_ClipBoard_GetPriorityFormat DLLStructSetData() Returns Error


Recommended Posts

Hi All,

Recently my previously functioning script has stopped working. Apparently a function included in AutoIt is erroring out.

 

I've trimmed down my code to the minimum reproducible on my device:

#include <Clipboard.au3>

Local $aFormats[2] = [$CF_UNICODETEXT, $CF_TEXT]

While 1
    If _ClipBoard_GetPriorityFormat($aFormats) = -1 Then ContinueLoop
    ;;; Other stuff
WEnd

 

This returns:

>Running:(3.3.14.5):C:\Program Files (x86)\AutoIt3\autoit3.exe "C:\Users\[REDACTED]\Desktop\Development\clipboard_err.au3"    
+>Setting Hotkeys...--> Press Ctrl+Alt+Break to Restart or Ctrl+Break to Stop
"C:\Program Files (x86)\AutoIt3\Include\Clipboard.au3" (248) : ==> Array variable has incorrect number of subscripts or subscript dimension range exceeded.:
DllStructSetData($tData, 1, $aFormats[$iI], $iI)
DllStructSetData($tData, 1, ^ ERROR
->08:32:27 AutoIt3.exe ended.rc:1
+>08:32:27 AutoIt3Wrapper Finished.
>Exit code: 1    Time: 0.7714

 

It should be noted that this seemingly occurred following an update via SCCM.

I'm on Windows 10 Enterprise 64 Bit Version 1809 Build 17763.864 for any reproduction. If anyone can provide a workaround for this issue, it'd be appreciated.

Edited by rcmaehl

My UDFs are generally for me. If they aren't updated for a while, it means I'm not using them myself. As soon as I start using them again, they'll get updated.

My Projects

WhyNotWin11
Cisco FinesseGithubIRC UDFWindowEx UDF

 

Link to post
Share on other sites

Sounds like a bug in the _ClipBoard_GetPriorityFormat function, did you check how many times the loop iterates before the error occurs?

By the way, you might want to change the title of the topic to something like "_ClipBoard_GetPriorityFormat bug/crash" instead of the whole error line which is hard to read :)

EasyCodeIt - A cross-platform AutoIt implementation - Fund the development! (GitHub will double your donations for a limited time)

DcodingTheWeb Forum - Follow for updates and Join for discussion

Link to post
Share on other sites
2 minutes ago, TheDcoder said:

Sounds like a bug in the _ClipBoard_GetPriorityFormat function, did you check how many times the loop iterates before the error occurs?

By the way, you might want to change the title of the topic to something like "_ClipBoard_GetPriorityFormat bug/crash" instead of the whole error line which is hard to read :)

Throwing a ConsoleWrite() shows that it crashes immediately on the first call. Also title has been updated 

My UDFs are generally for me. If they aren't updated for a while, it means I'm not using them myself. As soon as I start using them again, they'll get updated.

My Projects

WhyNotWin11
Cisco FinesseGithubIRC UDFWindowEx UDF

 

Link to post
Share on other sites
2 minutes ago, rcmaehl said:

Throwing a ConsoleWrite() shows that it crashes immediately on the first call.

Okay, so not an issue with something in the loop. The next natural step is to investigate what WinAPI functions are being called and which one of them is returning an error.

Unfortuately I cannot do that step as my Windows box is down and it takes a long time to start it. Hopefully someone else more qualified will check the functions.

Oh! And don't forget to check the authors of that function in Clipboard.au3 and tag them here if they are still active in the forum :D

EasyCodeIt - A cross-platform AutoIt implementation - Fund the development! (GitHub will double your donations for a limited time)

DcodingTheWeb Forum - Follow for updates and Join for discussion

Link to post
Share on other sites
#include <Clipboard.au3>
#include <Array.au3>
HotKeySet("{ESC}", "_Exit")

Local $aFormats[3] = [2, $CF_UNICODETEXT, $CF_TEXT]
_ArrayDisplay($aFormats)


While True
    If _ClipBoard_GetPriorityFormat($aFormats) = -1 Then ContinueLoop
    ;;; Other stuff
WEnd

Func _Exit()
    Exit
EndFunc   ;==>_Exit

EDIT : @Danp2 was a bit faster ;)

Edited by Musashi

Musashi-C64.png

"In the beginning the Universe was created. This has made a lot of people very angry and been widely regarded as a bad move."

Link to post
Share on other sites
12 minutes ago, TheDcoder said:

Okay, so not an issue with something in the loop. The next natural step is to investigate what WinAPI functions are being called and which one of them is returning an error.

Unfortuately I cannot do that step as my Windows box is down and it takes a long time to start it. Hopefully someone else more qualified will check the functions.

Oh! And don't forget to check the authors of that function in Clipboard.au3 and tag them here if they are still active in the forum :D

No need. I found the issue. I took the advice here and didn't realize I compiled the changes.

This went from $i = 1 to $CF_TEXT (1) which caused no error, to $i = 1 to $CF_UNICODETEXT (13), which caused an error. I've been too focused on not trusting my own users' input for arrays that I didn't format my own array correctly for the UDF.

Edited by rcmaehl
s/to/too/

My UDFs are generally for me. If they aren't updated for a while, it means I'm not using them myself. As soon as I start using them again, they'll get updated.

My Projects

WhyNotWin11
Cisco FinesseGithubIRC UDFWindowEx UDF

 

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
  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...