Ascend4nt Posted May 28, 2011 Share Posted May 28, 2011 (edited) Okay, I'm totally confused about the 'align' directive now (testing now on 3.3.7.4). Once a 2nd align is encountered, whether inside a nested Struct/EndStruct, the rest of the inner and outer structs follow the alignment. Examples - 1st results in 11 bytes, 2nd result (without the 2nd align) is 16 bytes: $sStruct="double outer1; STRUCT; byte inner1; align 1;char inner2; ENDSTRUCT; char outer2" $stStr = DllStructCreate($sStruct) ConsoleWrite("Structure size:"&DllStructGetSize($stStr)&@CRLF) $sStruct="double outer1; STRUCT; byte inner1; char inner2; ENDSTRUCT; char outer2" $stStr = DllStructCreate($sStruct) ConsoleWrite("Structure size:"&DllStructGetSize($stStr)&@CRLF) *edit: Note - Remove the Struct/EndStruct directives and the same size is returned Edited May 28, 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) Link to comment Share on other sites More sharing options...
Administrators Jon Posted May 28, 2011 Author Administrators Share Posted May 28, 2011 Yeah. From previous discussions there are two options: 1. "pop" the align at the end of a struct (what I was doing) 2. Keep the align (what I am doing now) The C compilers seemed to be doing 2. Deployment Blog: https://www.autoitconsulting.com/site/blog/ SCCM SDK Programming: https://www.autoitconsulting.com/site/sccm-sdk/ Link to comment Share on other sites More sharing options...
Administrators Jon Posted May 28, 2011 Author Administrators Share Posted May 28, 2011 Oh, so it's a bug in AutoIt itself in one of the betas that only happens with x64? In other words, AutoIt is broke, not the script.Yeah, totally. The only things that should ever break x64 scripts are bad structs and dllcalls really. </in theory>Urgh. Found the 6 lines that cause the problem - except they are correct so it makes no sense >.< Deployment Blog: https://www.autoitconsulting.com/site/blog/ SCCM SDK Programming: https://www.autoitconsulting.com/site/sccm-sdk/ Link to comment Share on other sites More sharing options...
Administrators Jon Posted May 28, 2011 Author Administrators Share Posted May 28, 2011 So, StringFormat is fatally broken in 3.3.7.4 - I'll release an update in the next half an hour or so. It was actually broken on both x86 and x64 but due to flukes it wasn't manifesting on x86 (on my machine at least). Deployment Blog: https://www.autoitconsulting.com/site/blog/ SCCM SDK Programming: https://www.autoitconsulting.com/site/sccm-sdk/ Link to comment Share on other sites More sharing options...
Administrators Jon Posted May 28, 2011 Author Administrators Share Posted May 28, 2011 3.3.7.5 (28th May, 2011) (Beta) - Fixed: StringFormat memory error introduced in 3.3.7.3. Deployment Blog: https://www.autoitconsulting.com/site/blog/ SCCM SDK Programming: https://www.autoitconsulting.com/site/sccm-sdk/ Link to comment Share on other sites More sharing options...
Richard Robertson Posted May 28, 2011 Share Posted May 28, 2011 I'm interested to know what you mean by fatally. Link to comment Share on other sites More sharing options...
Administrators Jon Posted May 28, 2011 Author Administrators Share Posted May 28, 2011 I'm interested to know what you mean by fatally.It shouldn't work, and only does by chance memory corruption. Deployment Blog: https://www.autoitconsulting.com/site/blog/ SCCM SDK Programming: https://www.autoitconsulting.com/site/sccm-sdk/ Link to comment Share on other sites More sharing options...
Richard Robertson Posted May 29, 2011 Share Posted May 29, 2011 (edited) How long has it been broken? Just in that revision? Edited May 29, 2011 by Richard Robertson Link to comment Share on other sites More sharing options...
water Posted May 29, 2011 Share Posted May 29, 2011 According to Jon's it was introduced with 3.3.7.3. My UDFs and Tutorials: Spoiler UDFs: Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs: Excel - Example Scripts - Wiki Word - Wiki Tutorials: ADO - Wiki WebDriver - Wiki Link to comment Share on other sites More sharing options...
Yashied Posted May 29, 2011 Share Posted May 29, 2011 (edited) What is wrong with Label? If you pass an empty string and does not specify the height (fifth parameter), the size will be wrong. GUICreate('MyGUI', 200, 100) GUICtrlCreateLabel('', 10, 10, 180) GUICtrlSetBkColor(-1, 0xFF0000) GUISetState() Do Until GUIGetMsg() = -3 Edited May 29, 2011 by Yashied My UDFs: iKey | FTP Uploader | Battery Checker | Boot Manager | Font Viewer | UDF Keyword Manager | Run Dialog Replacement | USBProtect | 3D Axis | Calculator | Sleep | iSwitcher | TM | NetHelper | File Types Manager | Control Viewer | SynFolders | DLL Helper Animated Tray Icons UDF Library | Hotkeys UDF Library | Hotkeys Input Control UDF Library | Caret Shape UDF Library | Context Help UDF Library | Most Recently Used List UDF Library | Icons UDF Library | FTP UDF Library | Script Communications UDF Library | Color Chooser UDF Library | Color Picker Control UDF Library | IPHelper (Vista/7) UDF Library | WinAPI Extended UDF Library | WinAPIVhd UDF Library | Icon Chooser UDF Library | Copy UDF Library | Restart UDF Library | Event Log UDF Library | NotifyBox UDF Library | Pop-up Windows UDF Library | TVExplorer UDF Library | GuiHotKey UDF Library | GuiSysLink UDF Library | Package UDF Library | Skin UDF Library | AITray UDF Library | RDC UDF Library Appropriate path | Button text color | Gaussian random numbers | Header's styles (Vista/7) | ICON resource enumeration | Menu & INI | Tabbed string size | Tab's skin | Pop-up circular menu | Progress Bar without animation (Vista/7) | Registry export | Registry path jumping | Unique hardware ID | Windows alignment More... Link to comment Share on other sites More sharing options...
Administrators Jon Posted May 29, 2011 Author Administrators Share Posted May 29, 2011 What is wrong with Label? If you pass an empty string and does not specify the height (fifth parameter), the size will be wrong. GUICreate('MyGUI', 200, 100) GUICtrlCreateLabel('', 10, 10, 180) GUICtrlSetBkColor(-1, 0xFF0000) GUISetState() Do Until GUIGetMsg() = -3 Hmm, at a loss on this one. I just reverted my source tree back to the production version and recompiled and it doesn't work there either. Maybe it's an old hidden bug that's now being shown up in the new compiler... Deployment Blog: https://www.autoitconsulting.com/site/blog/ SCCM SDK Programming: https://www.autoitconsulting.com/site/sccm-sdk/ Link to comment Share on other sites More sharing options...
Administrators Jon Posted May 29, 2011 Author Administrators Share Posted May 29, 2011 Hmm, at a loss on this one. I just reverted my source tree back to the production version and recompiled and it doesn't work there either. Maybe it's an old hidden bug that's now being shown up in the new compiler...Yes, this was the case. An uninitialised variable was usually 0 on the old compiler, it wasn't on the new one and so bad things happened. Deployment Blog: https://www.autoitconsulting.com/site/blog/ SCCM SDK Programming: https://www.autoitconsulting.com/site/sccm-sdk/ Link to comment Share on other sites More sharing options...
Zedna Posted May 29, 2011 Share Posted May 29, 2011 Yes, this was the case. An uninitialised variable was usually 0 on the old compiler, it wasn't on the new one and so bad things happened.This kind of expecting 0 as unitialized value can be on many places I think. Resources UDF ResourcesEx UDF AutoIt Forum Search Link to comment Share on other sites More sharing options...
czardas Posted May 29, 2011 Share Posted May 29, 2011 Yes, this was the case. An uninitialised variable was usually 0 on the old compiler, it wasn't on the new one and so bad things happened.Out of curiosity, what value (if any ) does an uninitialised variable have on the new compiler? operator64 ArrayWorkshop Link to comment Share on other sites More sharing options...
ProgAndy Posted May 29, 2011 Share Posted May 29, 2011 Out of curiosity, what value (if any ) does an uninitialised variable have on the new compiler? An uninitialised variable just reserves some memory. Since the part of the memory can contain remains of old data, this will be the "value". Maybe an implicit "initialise to zero" was dropped in favor of speed in the new compiler. *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 Link to comment Share on other sites More sharing options...
czardas Posted May 29, 2011 Share Posted May 29, 2011 An uninitialised variable just reserves some memory. Since the part of the memory can contain remains of old data, this will be the "value". Maybe an implicit "initialise to zero" was dropped in favor of speed in the new compiler.Thanks, that's a very clear answer. operator64 ArrayWorkshop Link to comment Share on other sites More sharing options...
Administrators Jon Posted May 29, 2011 Author Administrators Share Posted May 29, 2011 The old compiler didn't actively zero variables either, it's all just pure chance. Deployment Blog: https://www.autoitconsulting.com/site/blog/ SCCM SDK Programming: https://www.autoitconsulting.com/site/sccm-sdk/ Link to comment Share on other sites More sharing options...
James Posted May 29, 2011 Share Posted May 29, 2011 The old compiler didn't actively zero variables either, it's all just pure chance.So what you're saying is using VC10 to compile AutoIt will produce loads of errors because you weren't forewarned by them in the previous versions?Does this mean AutoIt is now potentially flawed in several places? Blog - Seriously epic web hosting - Twitter - GitHub - Cachet HQ Link to comment Share on other sites More sharing options...
Administrators Jon Posted May 29, 2011 Author Administrators Share Posted May 29, 2011 (edited) No, I'm saying that AutoIt (as all C programs) may have subtle bugs because some variables were left uninitialised and have yet to be discovered due to pure chance of the combination of OS/Compiler/Memory/Previous exes ran. In this case it looks like the author thought that this variable didn't need initialising because the logic of the following code would always assign it a value. That assumption was incorrect if it was passed a blank string.VC9 didn't initialise variables to 0 either, it's just luck that in this case, for whatever reason, it consistently picked an area of memory that just happened to be 0 to store the variable. We had similar bugs whenever we moved from compiler to compiler before.But as least we don't have to worry about running another program on our code to check for these sorts of errors, eh, James? (Edit: Or was it Richard who made that comment? I forget) Edited May 29, 2011 by Jon Deployment Blog: https://www.autoitconsulting.com/site/blog/ SCCM SDK Programming: https://www.autoitconsulting.com/site/sccm-sdk/ Link to comment Share on other sites More sharing options...
Administrators Jon Posted May 29, 2011 Author Administrators Share Posted May 29, 2011 3.3.7.6 (29th May, 2011) (Beta) - Fixed: Include parsing bug introduced in 3.3.7.3 - Fixed: GUICtrlCreateLabel() related text sizing bug when no height was used. Deployment Blog: https://www.autoitconsulting.com/site/blog/ SCCM SDK Programming: https://www.autoitconsulting.com/site/sccm-sdk/ Link to comment Share on other sites More sharing options...
Recommended Posts