Version Information Limits

| | Comments (3)

Here's something that's perilously not documented, and the IDE doesn't currently restrict: the length of the different pieces of version information on Windows.

FileVersion: 39 bytes
Region: 21 bytes
Release: 11 bytes
PackageInfo: 253 bytes
LongVersion: 79 bytes
ShortVersion: 39 bytes

Some of these don't really matter, such as file version or release. Release doesn't matter because the longest string possible is Development which is 11 bytes. File version doesn't matter because none of the version parts can exceed 255, so that means (including periods) the max string can be 255.255.255.255 which is a measly 15 bytes.

But some of them do matter, like long version, short version and package info. If you exceed the number of bytes, the compiler blindly copies your string into the executable and corrupts it. That's right.... corrupts it. So it won't launch, and depending on the corruption, strange things may happen. It may throw an assertion on launch. It may silently terminate. It may give an OS error dialog while launching. It could blue screen.

Hopefully these limits will be gone in the future, but they're the current limits imposed on your Win32 REALbasic applications (and have been since 5.0 I believe). So be aware of them!

[Edit (9:30pm):] Some people seem to be confused by this posting, so I'd like to clear something up. This was a bug I ran across when a user mentioned their application wouldn't launch on Windows depending on the version information they included. This is by no means intended behavior and is most definately a bug. For starters, the IDE should let you know about the limitation when you try to enter something out of bounds. Secondly, the compiler should truncate your version information (or throw an error) if it's going to cause a problem. Thirdly, the limitation shouldn't even be there to begin with, it's not an OS limitation but an arbitrary one we placed on the user when rewriting the compiler. Once a true PE32 linker is created (and along with it, a resource compiler), the limitation will go away. Sorry if the post confused people into thinking that this was intended or sanctioned behavior. I simply meant it as a warning to people until there's a release with the bug fixed.

3 Comments

Ugly as the problem may be, can't the compiler -and- IDE both check for too-long strings and notify us? That way it will catch old projects with incorrect info and prevent creation of newer ones.

Yeah, it seems like the obvious solution is just to change the 'maxlength' property of the version fields in the IDE.

It certain is possible, and it'll be fixed in a future release. But that still doesn't help anyone using 5.2.4 or 5.5.5 for example. The information is still relevant for them, hence the reason I posted it. :-)

Leave a comment

Disclaimer

I'm currently an employee of REAL Software. My blog is mine. The opinions represented in this blog are mine as well and may not represent my employer's opinions. All original material is copyrighted and property of the author.

REALbasic® is a registered trademark of REAL Software, Inc. REAL SQL Server™ and Lingua™ are pending trademarks of REAL Software, Inc. All rights reserved.