Valik Posted May 25, 2011 Posted May 25, 2011 Here's a common pitfall: Not understanding the C++ standard. Prior to VC10, VC gave you non-const iterators when working with a std::set giving the illusion that the set was mutable. This was wrong and non-standard. VC10 corrected this issue, however, it turns out that tylo was relying on the incorrect mutability of a set to implement something in Au3Check. When we started compiling Au3Check with VC10 we received compiler errors. My first fix was not right. My second fix changed from a std::set to a std::map which are mutable. The compiler is now happy, the code doesn't crash (at least on the example where it previously crashed) and it seems to function correctly.So rule #1: When using a standard library, understand how the library works regardless of what the compiler lets you do.
MvGulik Posted May 25, 2011 Posted May 25, 2011 #1932I think I'll change that so that the beta doesn't touch those keys.Did no think of that one. ... Would it in that case not also make sens to let the beta install (no SciTE4AutoIt3 install present.) Not overwrite the production Def files. ("<AutoIt>\SciTE\au3.keywords.properties" and "<AutoIt>\SciTE\api\au3.api") But just to put them in the "<AutoIt>\Beta\SciTE\*". location. "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 ...
Administrators Jon Posted May 25, 2011 Author Administrators Posted May 25, 2011 3.3.7.2 (25th May, 2011) (Beta)Some extensive changes to DllStructs implemented. Watch for bugs.- Added: Struct/EndStruct in DllStructCreate() to solve X86/X64 data alignment.- Changed: Compiling with VC10. Added workarounds for Win2000/XP RTM to allow execution of AutoIt, Aut2Exe, Au3Info, Au3Check and AutoItHelp.- Fixed #1860: DriveStatus Returns Ready with blank value.- Fixed #1854: StringIsFloat returns 1 on non float numbers.- Fixed #1910: Please change $TTN_GETDISPINFO to $TTN_GETDISPINFOW.- Fixed #1844: SplashTextOn crops variable when used with opt 32 and @CRLF / @LF.- Fixed #1932: Uninstaller, windows-register, App Paths. (+beta).- Fixed #1929: SetMenuColor() does not work on 64bit OS.- Fixed #1479: X64 ListView WM_NOTIFY Message.UDFs:- Fixed #1920: Script crashes with error reported in Security.au3 at line 85- Fixed #1895: Bugs in _GUIScrollBars_Init().- Fixed #1891: _ArrayDisplay (......,i$iTranspose,...) wrong description. Deployment Blog: https://www.autoitconsulting.com/site/blog/ SCCM SDK Programming: https://www.autoitconsulting.com/site/sccm-sdk/
guinness Posted May 25, 2011 Posted May 25, 2011 - Fixed #1479: X64 ListView WM_NOTIFY Message.Brilliant, Thanks! UDF List: _AdapterConnections() • _AlwaysRun() • _AppMon() • _AppMonEx() • _ArrayFilter/_ArrayReduce • _BinaryBin() • _CheckMsgBox() • _CmdLineRaw() • _ContextMenu() • _ConvertLHWebColor()/_ConvertSHWebColor() • _DesktopDimensions() • _DisplayPassword() • _DotNet_Load()/_DotNet_Unload() • _Fibonacci() • _FileCompare() • _FileCompareContents() • _FileNameByHandle() • _FilePrefix/SRE() • _FindInFile() • _GetBackgroundColor()/_SetBackgroundColor() • _GetConrolID() • _GetCtrlClass() • _GetDirectoryFormat() • _GetDriveMediaType() • _GetFilename()/_GetFilenameExt() • _GetHardwareID() • _GetIP() • _GetIP_Country() • _GetOSLanguage() • _GetSavedSource() • _GetStringSize() • _GetSystemPaths() • _GetURLImage() • _GIFImage() • _GoogleWeather() • _GUICtrlCreateGroup() • _GUICtrlListBox_CreateArray() • _GUICtrlListView_CreateArray() • _GUICtrlListView_SaveCSV() • _GUICtrlListView_SaveHTML() • _GUICtrlListView_SaveTxt() • _GUICtrlListView_SaveXML() • _GUICtrlMenu_Recent() • _GUICtrlMenu_SetItemImage() • _GUICtrlTreeView_CreateArray() • _GUIDisable() • _GUIImageList_SetIconFromHandle() • _GUIRegisterMsg() • _GUISetIcon() • _Icon_Clear()/_Icon_Set() • _IdleTime() • _InetGet() • _InetGetGUI() • _InetGetProgress() • _IPDetails() • _IsFileOlder() • _IsGUID() • _IsHex() • _IsPalindrome() • _IsRegKey() • _IsStringRegExp() • _IsSystemDrive() • _IsUPX() • _IsValidType() • _IsWebColor() • _Language() • _Log() • _MicrosoftInternetConnectivity() • _MSDNDataType() • _PathFull/GetRelative/Split() • _PathSplitEx() • _PrintFromArray() • _ProgressSetMarquee() • _ReDim() • _RockPaperScissors()/_RockPaperScissorsLizardSpock() • _ScrollingCredits • _SelfDelete() • _SelfRename() • _SelfUpdate() • _SendTo() • _ShellAll() • _ShellFile() • _ShellFolder() • _SingletonHWID() • _SingletonPID() • _Startup() • _StringCompact() • _StringIsValid() • _StringRegExpMetaCharacters() • _StringReplaceWholeWord() • _StringStripChars() • _Temperature() • _TrialPeriod() • _UKToUSDate()/_USToUKDate() • _WinAPI_Create_CTL_CODE() • _WinAPI_CreateGUID() • _WMIDateStringToDate()/_DateToWMIDateString() • Au3 script parsing • AutoIt Search • AutoIt3 Portable • AutoIt3WrapperToPragma • AutoItWinGetTitle()/AutoItWinSetTitle() • Coding • DirToHTML5 • FileInstallr • FileReadLastChars() • GeoIP database • GUI - Only Close Button • GUI Examples • GUICtrlDeleteImage() • GUICtrlGetBkColor() • GUICtrlGetStyle() • GUIEvents • GUIGetBkColor() • Int_Parse() & Int_TryParse() • IsISBN() • LockFile() • Mapping CtrlIDs • OOP in AutoIt • ParseHeadersToSciTE() • PasswordValid • PasteBin • Posts Per Day • PreExpand • Protect Globals • Queue() • Resource Update • ResourcesEx • SciTE Jump • Settings INI • SHELLHOOK • Shunting-Yard • Signature Creator • Stack() • Stopwatch() • StringAddLF()/StringStripLF() • StringEOLToCRLF() • VSCROLL • WM_COPYDATA • More Examples... Updated: 22/04/2018
wraithdu Posted May 25, 2011 Posted May 25, 2011 (edited) Could we get a more in depth explanation of the structure changes and how exactly the new 'struct' and 'endstruct' keywords influence internal alignment? I'm reading the help file and I just can't put the picture together in my head. For example, how is this 32 bytes in x64? DllStructCreate("int;STRUCT;ptr;int;ENDSTRUCT;int") ; structure is 32 bytes under a Windows 64-Bit and 16 under Windows 32-Bit Edited May 25, 2011 by wraithdu
Administrators Jon Posted May 25, 2011 Author Administrators Posted May 25, 2011 Could we get a more in depth explanation of the structure changes and how exactly the new 'struct' and 'endstruct' keywords influence internal alignment? I'm reading the help file and I just can't put the picture together in my head. For example, how is this 32 bytes in x64? DllStructCreate("int;STRUCT;ptr;int;ENDSTRUCT;int") ; structure is 32 bytes under a Windows 64-Bit and 16 under Windows 32-Bit It's really hard to explain, but the details are sort of described: http://en.wikipedia.org/wiki/Data_structure_alignment#Data_structure_padding The basics of it is that when you include a "struct" within a struct (like many Win32 structs) then you have to "pad" the various members to fit certain alignments. In previous versions of autoit we aligned members but didn't properly align nested structs. This only really became apparent on x64 but there were x86 bugs too. Deployment Blog: https://www.autoitconsulting.com/site/blog/ SCCM SDK Programming: https://www.autoitconsulting.com/site/sccm-sdk/
guinness Posted May 25, 2011 Posted May 25, 2011 I don't know if this is worthy of a bug report, but the UPX exe that was shipped with the latest beta was V3.05, yet V3.07 is available. UDF List: _AdapterConnections() • _AlwaysRun() • _AppMon() • _AppMonEx() • _ArrayFilter/_ArrayReduce • _BinaryBin() • _CheckMsgBox() • _CmdLineRaw() • _ContextMenu() • _ConvertLHWebColor()/_ConvertSHWebColor() • _DesktopDimensions() • _DisplayPassword() • _DotNet_Load()/_DotNet_Unload() • _Fibonacci() • _FileCompare() • _FileCompareContents() • _FileNameByHandle() • _FilePrefix/SRE() • _FindInFile() • _GetBackgroundColor()/_SetBackgroundColor() • _GetConrolID() • _GetCtrlClass() • _GetDirectoryFormat() • _GetDriveMediaType() • _GetFilename()/_GetFilenameExt() • _GetHardwareID() • _GetIP() • _GetIP_Country() • _GetOSLanguage() • _GetSavedSource() • _GetStringSize() • _GetSystemPaths() • _GetURLImage() • _GIFImage() • _GoogleWeather() • _GUICtrlCreateGroup() • _GUICtrlListBox_CreateArray() • _GUICtrlListView_CreateArray() • _GUICtrlListView_SaveCSV() • _GUICtrlListView_SaveHTML() • _GUICtrlListView_SaveTxt() • _GUICtrlListView_SaveXML() • _GUICtrlMenu_Recent() • _GUICtrlMenu_SetItemImage() • _GUICtrlTreeView_CreateArray() • _GUIDisable() • _GUIImageList_SetIconFromHandle() • _GUIRegisterMsg() • _GUISetIcon() • _Icon_Clear()/_Icon_Set() • _IdleTime() • _InetGet() • _InetGetGUI() • _InetGetProgress() • _IPDetails() • _IsFileOlder() • _IsGUID() • _IsHex() • _IsPalindrome() • _IsRegKey() • _IsStringRegExp() • _IsSystemDrive() • _IsUPX() • _IsValidType() • _IsWebColor() • _Language() • _Log() • _MicrosoftInternetConnectivity() • _MSDNDataType() • _PathFull/GetRelative/Split() • _PathSplitEx() • _PrintFromArray() • _ProgressSetMarquee() • _ReDim() • _RockPaperScissors()/_RockPaperScissorsLizardSpock() • _ScrollingCredits • _SelfDelete() • _SelfRename() • _SelfUpdate() • _SendTo() • _ShellAll() • _ShellFile() • _ShellFolder() • _SingletonHWID() • _SingletonPID() • _Startup() • _StringCompact() • _StringIsValid() • _StringRegExpMetaCharacters() • _StringReplaceWholeWord() • _StringStripChars() • _Temperature() • _TrialPeriod() • _UKToUSDate()/_USToUKDate() • _WinAPI_Create_CTL_CODE() • _WinAPI_CreateGUID() • _WMIDateStringToDate()/_DateToWMIDateString() • Au3 script parsing • AutoIt Search • AutoIt3 Portable • AutoIt3WrapperToPragma • AutoItWinGetTitle()/AutoItWinSetTitle() • Coding • DirToHTML5 • FileInstallr • FileReadLastChars() • GeoIP database • GUI - Only Close Button • GUI Examples • GUICtrlDeleteImage() • GUICtrlGetBkColor() • GUICtrlGetStyle() • GUIEvents • GUIGetBkColor() • Int_Parse() & Int_TryParse() • IsISBN() • LockFile() • Mapping CtrlIDs • OOP in AutoIt • ParseHeadersToSciTE() • PasswordValid • PasteBin • Posts Per Day • PreExpand • Protect Globals • Queue() • Resource Update • ResourcesEx • SciTE Jump • Settings INI • SHELLHOOK • Shunting-Yard • Signature Creator • Stack() • Stopwatch() • StringAddLF()/StringStripLF() • StringEOLToCRLF() • VSCROLL • WM_COPYDATA • More Examples... Updated: 22/04/2018
ProgAndy Posted May 25, 2011 Posted May 25, 2011 - Added: Struct/EndStruct in DllStructCreate() to solve X86/X64 data alignment.It's not bad, but I would prefer a more hierarchical approach. (including array of structures, accessing of substructure values via member.value, different alignment for the subsrtucture, and nested subsrtuctures) Maybe I ask for too much for a scripting language *GERMAN* [note: you are not allowed to remove author / modified info from my UDFs]My UDFs:[_SetImageBinaryToCtrl] [_TaskDialog] [AutoItObject] [Animated GIF (GDI+)] [ClipPut for Image] [FreeImage] [GDI32 UDFs] [GDIPlus Progressbar] [Hotkey-Selector] [Multiline Inputbox] [MySQL without ODBC] [RichEdit UDFs] [SpeechAPI Example] [WinHTTP]UDFs included in AutoIt: FTP_Ex (as FTPEx), _WinAPI_SetLayeredWindowAttributes
Mat Posted May 25, 2011 Posted May 25, 2011 (edited) I think you ask too much for a language that implements structures using strings... The most you can hope for at the moment is possibly adding '.' to the list of allowed characters (currently just alphanumeric or underscore). I don't see any reason why not, and it would give the same effect... That said, how about this: $t = DllStructCreate("int Num; (int X; int Y) Point") DllStructSetData($t, "Point.X", 42) And ultimately: $t = DllStructCreate("int Num; (int X; int Y) Point[2]") DllStructSetData($t, "Point[1].X", 42) Edited May 26, 2011 by Mat AutoIt Project Listing
Administrators Jon Posted May 25, 2011 Author Administrators Posted May 25, 2011 Jon, you're not tagging these beta releases.Crap, I thought I was missing something. Deployment Blog: https://www.autoitconsulting.com/site/blog/ SCCM SDK Programming: https://www.autoitconsulting.com/site/sccm-sdk/
wraithdu Posted May 26, 2011 Posted May 26, 2011 It's really hard to explain, but the details are sort of described: http://en.wikipedia.org/wiki/Data_structure_alignment#Data_structure_paddingThe basics of it is that when you include a "struct" within a struct (like many Win32 structs) then you have to "pad" the various members to fit certain alignments. In previous versions of autoit we aligned members but didn't properly align nested structs. This only really became apparent on x64 but there were x86 bugs too.So I looked through the StructureConstants.au3 file and a bit of that article, and I think I understand a bit better. How did you decide which structs to wrap in struct/endstruct though? For non-nested structs, I would have thought it would have been all or none. In fact, the help file implies that wrapping the entire struct in struct/endstruct has no effect. Is that the case?
Ascend4nt Posted May 26, 2011 Posted May 26, 2011 (edited) Two things:1. Verified that the latest beta works on Windows 2000. Good work Jon 2. Messed around with new DLLStruct Struct/EndStruct directives, they appear to work, although I'm still unsure I understand alignment completely. Does it make sense for a structure to be an odd number of bytes (with types such as word, ptr, etc followed by a terminating 'byte')?I just updated my debugging tool which now works with Struct/EndStruct and reports end-of-structure padding if it helps anyone.*edit: clarification of 2nd thing Edited May 26, 2011 by Ascend4nt My contributions: Performance Counters in Windows - Measure CPU, Disk, Network etc Performance | Network Interface Info, Statistics, and Traffic | CPU Multi-Processor Usage w/o Performance Counters | Disk and Device Read/Write Statistics | Atom Table Functions | Process, Thread, & DLL Functions UDFs | Process CPU Usage Trackers | PE File Overlay Extraction | A3X Script Extract | File + Process Imports/Exports Information | Windows Desktop Dimmer Shade | Spotlight + Focus GUI - Highlight and Dim for Eyestrain Relief | CrossHairs (FullScreen) | Rubber-Band Boxes using GUI's (_GUIBox) | GUI Fun! | IE Embedded Control Versioning (use IE9+ and HTML5 in a GUI) | Magnifier (Vista+) Functions UDF | _DLLStructDisplay (Debug!) | _EnumChildWindows (controls etc) | _FileFindEx | _ClipGetHTML | _ClipPutHTML + ClipPutHyperlink | _FileGetShortcutEx | _FilePropertiesDialog | I/O Port Functions | File(s) Drag & Drop | _RunWithReducedPrivileges | _ShellExecuteWithReducedPrivileges | _WinAPI_GetSystemInfo | dotNETGetVersions | Drive(s) Power Status | _WinGetDesktopHandle | _StringParseParameters | Screensaver, Sleep, Desktop Lock Disable | Full-Screen Crash Recovery Wrappers/Modifications of others' contributions: _DOSWildcardsToPCRegEx (original code: RobSaunder's) | WinGetAltTabWinList (original: Authenticity) UDF's added support/programming to: _ExplorerWinGetSelectedItems | MIDIEx UDF (original code: eynstyne) (All personal code/wrappers centrally located at Ascend4nt's AutoIT Code)
Administrators Jon Posted May 26, 2011 Author Administrators Posted May 26, 2011 So I looked through the StructureConstants.au3 file and a bit of that article, and I think I understand a bit better. How did you decide which structs to wrap in struct/endstruct though? For non-nested structs, I would have thought it would have been all or none. In fact, the help file implies that wrapping the entire struct in struct/endstruct has no effect. Is that the case?JP did the constants, it looked like he wrapped the structs that were getting used within other structs. struct/endstruct is implied at the "top" level, so adding it in there does nothing additional, yes. Deployment Blog: https://www.autoitconsulting.com/site/blog/ SCCM SDK Programming: https://www.autoitconsulting.com/site/sccm-sdk/
Administrators Jon Posted May 26, 2011 Author Administrators Posted May 26, 2011 2. Messed around with new DLLStruct Struct/EndStruct directives, they appear to work, although I'm still unsure I understand alignment completely. Does it make sense for a structure to be an odd number of bytes (with types such as word, ptr, etc followed by a terminating 'byte')?No, it should never be an odd number of bytes if it's got members like word in it. Got an example? Deployment Blog: https://www.autoitconsulting.com/site/blog/ SCCM SDK Programming: https://www.autoitconsulting.com/site/sccm-sdk/
Ascend4nt Posted May 26, 2011 Posted May 26, 2011 No, it should never be an odd number of bytes if it's got members like word in it. Got an example? Hmm.. seems to happen when I use 'align' with anything other than 8. For example, this returns 33 bytes: $sStruct='align 4;short;ptr;Struct;ptr;byte;EndStruct;byte' $stStr=DllStructCreate($sStruct) ConsoleWrite("Struct size:"&DllStructGetSize($stStr)&@CRLF) My contributions: Performance Counters in Windows - Measure CPU, Disk, Network etc Performance | Network Interface Info, Statistics, and Traffic | CPU Multi-Processor Usage w/o Performance Counters | Disk and Device Read/Write Statistics | Atom Table Functions | Process, Thread, & DLL Functions UDFs | Process CPU Usage Trackers | PE File Overlay Extraction | A3X Script Extract | File + Process Imports/Exports Information | Windows Desktop Dimmer Shade | Spotlight + Focus GUI - Highlight and Dim for Eyestrain Relief | CrossHairs (FullScreen) | Rubber-Band Boxes using GUI's (_GUIBox) | GUI Fun! | IE Embedded Control Versioning (use IE9+ and HTML5 in a GUI) | Magnifier (Vista+) Functions UDF | _DLLStructDisplay (Debug!) | _EnumChildWindows (controls etc) | _FileFindEx | _ClipGetHTML | _ClipPutHTML + ClipPutHyperlink | _FileGetShortcutEx | _FilePropertiesDialog | I/O Port Functions | File(s) Drag & Drop | _RunWithReducedPrivileges | _ShellExecuteWithReducedPrivileges | _WinAPI_GetSystemInfo | dotNETGetVersions | Drive(s) Power Status | _WinGetDesktopHandle | _StringParseParameters | Screensaver, Sleep, Desktop Lock Disable | Full-Screen Crash Recovery Wrappers/Modifications of others' contributions: _DOSWildcardsToPCRegEx (original code: RobSaunder's) | WinGetAltTabWinList (original: Authenticity) UDF's added support/programming to: _ExplorerWinGetSelectedItems | MIDIEx UDF (original code: eynstyne) (All personal code/wrappers centrally located at Ascend4nt's AutoIT Code)
Administrators Jon Posted May 26, 2011 Author Administrators Posted May 26, 2011 Hmm.. seems to happen when I use 'align' with anything other than 8. For example, this returns 33 bytes: $sStruct='align 4;short;ptr;Struct;ptr;byte;EndStruct;byte' $stStr=DllStructCreate($sStruct) ConsoleWrite("Struct size:"&DllStructGetSize($stStr)&@CRLF) Ah yes, that's a part of the code we've been discussing. There's a check in there that only pads when using the default alignment of 8. I'm pretty sure it should always pad but I'm struggling to find exactly how align should affect the end padding. All the docs I've looked at just say "changing align also has an effect on the end padding" but don't say how. Deployment Blog: https://www.autoitconsulting.com/site/blog/ SCCM SDK Programming: https://www.autoitconsulting.com/site/sccm-sdk/
jchd Posted May 26, 2011 Posted May 26, 2011 (edited) Nitpick about Struct doc: a few typos.This needs to be done to respect alignment inside the entire structure creation. No need if all datatypes are in the defined structure as an implicit structure alignment is done.Structure size is an integral multiple of its alignment, which requires padding after the last member. missing double quotes (in bold red) in the first 2 DllStructCreate dicussionDllStructCreate("int;STRUCT;ptr;int;ENDSTRUCT;int") ; structure is 32 bytes under a Windows 64-Bit and 16 under Windows 32-BitDllStructCreate("int;ptr;int;int") ; structure is 24 bytes under a Windows 64-Bit and 16 under Windows 32-Bit Edited May 26, 2011 by jchd This wonderful site allows debugging and testing regular expressions (many flavors available). An absolute must have in your bookmarks.Another excellent RegExp tutorial. Don't forget downloading your copy of up-to-date pcretest.exe and pcregrep.exe hereRegExp tutorial: enough to get startedPCRE v8.33 regexp documentation latest available release and currently implemented in AutoIt beta. SQLitespeed is another feature-rich premier SQLite manager (includes import/export). Well worth a try.SQLite Expert (freeware Personal Edition or payware Pro version) is a very useful SQLite database manager.An excellent eBook covering almost every aspect of SQLite3: a must-read for anyone doing serious work.SQL tutorial (covers "generic" SQL, but most of it applies to SQLite as well)A work-in-progress SQLite3 tutorial. Don't miss other LxyzTHW pages!SQLite official website with full documentation (may be newer than the SQLite library that comes standard with AutoIt)
James Posted May 26, 2011 Posted May 26, 2011 Oh god, if Jon doesn't understand this new structure stuff, how are we supposed to? I'd really, really like to see what Mat was talking about #410 that would be sweet! But asking too much. Blog - Seriously epic web hosting - Twitter - GitHub - Cachet HQ
ProgAndy Posted May 26, 2011 Posted May 26, 2011 (edited) Ah yes, that's a part of the code we've been discussing. There's a check in there that only pads when using the default alignment of 8. I'm pretty sure it should always pad but I'm struggling to find exactly how align should affect the end padding. All the docs I've looked at just say "changing align also has an effect on the end padding" but don't say how.The padding should be fairly simple: Consider the substruct as one block of bytes and pad it respectively. At least, that is what I do here and it seems to work: Edit: Sorry, this works only if the Substruct is already starting at a correct address so ignore this post. Edited May 26, 2011 by ProgAndy *GERMAN* [note: you are not allowed to remove author / modified info from my UDFs]My UDFs:[_SetImageBinaryToCtrl] [_TaskDialog] [AutoItObject] [Animated GIF (GDI+)] [ClipPut for Image] [FreeImage] [GDI32 UDFs] [GDIPlus Progressbar] [Hotkey-Selector] [Multiline Inputbox] [MySQL without ODBC] [RichEdit UDFs] [SpeechAPI Example] [WinHTTP]UDFs included in AutoIt: FTP_Ex (as FTPEx), _WinAPI_SetLayeredWindowAttributes
Recommended Posts