Windows 7 and Application Compatibilty

I’m updating my blog after a long time since I’ve been tied up in doing a large number of Windows 7 Application Compatibility workshops all across India with a number of Independent Software Vendors (ISVs) for their products. We’re basically testing out their products on the Windows 7 RC to see any issues that might surface and what they need to do to resolve them.

Most application run just fine on Windows 7. However, in the cases where there is an issue, it almost invariably turns out that the product has not been tested on Windows Vista and therefore it also fails on Windows XP. Vista and 7 have a tighter security mechanism called UAC that needs to be addressed in applications – and is something that many developers face problems with.

So here are two of the biggest issues that I’ve seen and their solutions:

Installers Using BAT/CMD/WSH scripts

Many applications perform certain install steps using DOS batch commands or in VBScript/JScript WSH files. Normally when Windows detects an installer running, it automatically elevates the installer so that the process has the necessary privileges to write into the %ProgramFiles% and %SystemRoot% folders and the registry at HKLM. However, if the installer is based on a script like the ones mentioned, they do not get elevated. Due to this, any file writes they do to protected folders or registry gets virtualized by Windowss. When the application starts up, it can’t find the required entries and fails.

Ideally the installer should use just the install process itself to do these tasks. However, if you do need to keep some part of it as a batch file or WSH script, you will need to elevate them. You can achieve this by using the ELEVATE.EXE tool from Wintellect available here. Download and extract the EXE from the Release folder and include it as part of your install. Now whenever you want to elevate a batch file issue the command:

ELEVATE File.bat

In the case of a WSH script, you will need to elevate the CSCRIPT file itself as in:

ELEVATE cscript.exe file.vbs

Writing settings on Application startup

There’s actually nothing wrong in doing this – in fact it’s recommended. What many products do wrong is the location to which they write these settings. A lot of apps try to write application or user level settings to their install folder under %ProgramFiles% or %WinDir% or %SystemDrive%. These are now protected areas and not allowed for writing. Most of these will also cause file virtualization to kick in and the settings file getting saved in the current user’s VirtualStore folder.

To avoid this, follow the simple rules given below:

For Type Location
User Setting User’s Local Appdata folder
User Data User’s data folders under profile (Documents, Music, etc.
Everyone Settings %ProgramData% folder
Everyone Data Under “Public” user’s profile

Follow these rules and you will never have any issues with folder privileges and virtualization.


Tags: , ,
Categories: Windows 7 | Tips | Development

8 Comments
Actions: E-mail | Permalink | Comment RSSRSS comment feed

Comments

Pingback from nqyf.com

Windows 7 and Application Compatibilty | Fashion e Music Blog

June 25. 2009 11:02 | nqyf.com |

I am surprised by your "Most application run just fine " .
In my experience all software for govt. related tax filings just fail to run even in XP if you are not an administrator. Check out the popular TDS / Income Tax returns packages. They install their data files under "Program Files" and these can not be updated unless you run as administrator. What about interacting with them and making the life of us computer technicians easy .

June 25. 2009 14:36 | Ravi Krishnan India |

I agree about the state of many of the Indian govt. applications. Unfortunately, NIC is not an ISV and I can't really interact with them directly. If Microsoft does get me to talk to them, I sure can.

However, they should still work with virtualization as well unless it's been turned off. Will need to check this out. Do you have a link to download these apps so that I can take a look at them?

July 1. 2009 12:04 | Vinod Unny India |

these are not govt. products - private but meant to facilitate govt. tax returns

check www.cynosuretech.com/products/taxstudio.aspx
even e-tds softwares from http://www.webtel.in/ were requiring administrator rights for usage - their support staff used to always insist of administrator rights for the user

July 3. 2009 17:45 | Ravi Krishnan India |

Then that is bad design practise by the application developer. They haven't really read the best practice documents for developing on Windows. And I agree even large ISVs (whom I cannot name) do the same type of mistakes.

Requiring Admin rights for running an application is completely nonsensical. It is good that MS is now forcing developers to write better code.

July 3. 2009 18:20 | Vinod Unny India |

Pretty good post. I just stumbled upon your blog and wanted to say that I have really enjoyed reading your blog posts. Any way I'll be subscribing to your feed and I hope you post again soon.

June 30. 2009 12:03 | sulumits retsambew United States |

Article on Windows 7 Application compatibility coming in August issue of PCQuest

July 13. 2009 08:52 | Vinod Unny India |

thanks for this nice info, it's so useful for me.

July 19. 2009 20:40 | sulumits retsambew United States |

Comments are closed