Saturday, May 12, 2007

Vista troubles

As anyone with even a tiny experience in upgrading from one OS to another would expect, going from Windows XP to Vista is not a trivial task. I installed Vista on one computer so that I could use it as a test-bed for upgrading my software ‘Viewbox’. Installation went fine except for the very frustrating fact that Vista Home Premium cannot be installed as an upgrade to XP Professional. You will need Vista Business or Ultimate to do that. So a clean install was done, requiring re-installation of a large number of software afterwards.
Then came the task of making Viewbox run on Vista (I already knew that Viewbox aborted on loading). I installed Delphi 2007 Professional and recompiled but the problem still persisted, flagging the error: ‘the computer does not have HTML Help support’. I knew this was not possible, because HTML Help support is built into Internet Explorer and depends on ‘hhctrl.ocx’, which is installed with Vista. The problem was that Viewbox could not find the ocx file. After a bit of googling, I found out that the file has changed location. If you want to find it, you should not rely on the registry entry, but you should look into the Windows folder. See the web page of The Helpware Group for more info.
However, even after solving this problem, Viewbox would not load. The problem was that I was using a TImageList component with a width of zero. Apparently, Windows XP has no problems with that, but Vista cannot tolerate it and shuts down the offending software. Fixing this was easy. Of course, you may ask why I was using a TImageList of zero width. That is another story.
After these changes, Viewbox seems to be running just fine under Vista. However, new security measures have been implemented in Vista. They include the User Account Control (UAC) system (for a detailed explanation, try this doc from Microsoft: WindowsVistaUACDevReqs.doc). The UAC does not allow writing of files in the C:\Program Files folder. This is a problem, because Viewbox saves its various settings in the Program Files\Viewbox folder as an INI file. I am not going to explain the details of the UAC (read the doc mentioned above). What you should know if you are programming in Delphi 2007, is that the XPManifest now includes an entry for the security level, as follows:
<trustInfo xmlns="urn:schemas-microsoft-com:asm.v3">
Setting ‘level’ equal to ‘asInvoker’ tells Vista not to implement virtualizing, so if your software tries to write to C:\Program Files\ it will fail. I have not figured out how to make Delphi change the Manifest contents so that virtualizing of files is possible.


  1. Anonymous10:50 AM

    This is what happens when you rely on Microsoft software. Windows was written as a single user operating system and does not have capability to handle multiple users and files with user-specific permission, as UNIX and LINUX do.

    I guess you could create a directory in the user account, where you would have permission to write.

    Or you can modify the permission settings in the C:Applications Folder that your program needs to modify, so that any user can write files there. The command in unix is: chmod

    At some point either Windows will become LINUX (but will never admit it did) or LINUX will replace Windows and we will all live happily ever after.


  2. Anonymous1:51 PM

    You can use a modified manifest resource. You change the "Level=asInvoker" to "Level=requireAdministrator" compile the resource to .RES file
    with RC.exe. the RC should get a .RC file as a parameter, build a one line file that contain the line

    1 24 myManifestTextFile.txt

    name this file myNewManifest
    and run RC MyNewManifest
    you will get new file MyNewManifest.res
    include it to your project
    {$R myNewManifest.res}
    Dont forget to sidcard the standard XPManifest

    Discard the XPManifest