tags:

views:

93

answers:

3

I have a flash drive which has an application whose code is written VC++ 2008 , the application works fine in xp , but the problem arises when i plug in the drive to a windows 7 machine , it doesn't run properly. is there any way that i can make it compatible to windows by writing a code.

i dont want to set the compatibility tab in windows 7 to run the program..

i want to code it in the program , more like a patch.

A: 

You probably need to add an Application Manifest to your application to request the appropriate security permissions to allow your application to do what it needs to do.

This may cause a UAC prompt to be shown to the user if elevated permissions are needed, but then your code will be allowed to do whatever Windows 7 is currently blocking.

Jason Williams
+1 for suggesting the manifest as the problem, -1 for not pointing at the setting in Visual Studio's project properties that changes this without requiring somebody to write an explicit manifest. Total: 0.
Billy ONeal
@rajivpradeep: Project Properties -> Linker -> Manifest File -> UAC Execution Level. Change it to "RequireAdministrator"
Billy ONeal
Sorry, the kids decided I needed an early morning and the C++ tag didn't impinge on my brain :-)
Jason Williams
@rajivpradeep: Then you'll need to use MACT (see my answer) to tell exactly why the app fails without Windows XP virtualization. You'll still need Mr. Williams' answer to ask for administrative rights, but you need to address compatibility issues with your code itself. Hopefully it's something simple like the "VersionLie" shim.
Billy ONeal
+1  A: 

You can use the Microsoft Application Compatibility Toolkit, which will tell you exactly which Windows XP compatibility shims are used by your code when you run your application under Windows XP mode.

You simply run your application and disable various shims until your code once again behaves incorrectly. The last shim you disabled is the cause of the incorrect behavior. You can then research the exact consequences of each shim as well as exactly what your code will have to do to fix the bugs it has that force it to run in Windows XP Compatibility Mode.

Billy ONeal
A: 

If you know that the problem exists and know that UAC / etc ... / Manifest on Win7 don't solve your problem and that it's not connected with 32/64 bit issues, try a different approach.

I guess you know what goes wrong with your app on Windows 7. If you're not sure exactly, at least you should know where (in which logical block) your problem is located (e.g IO block, Disk read/write block, Gui, etc.

Now stick to the debugger. Hope your program isn't that big that you can't analyze it and find the source of your problem. You could have your problems because of some functions working not as expected or something like that.

Then, I guess, you could rethink / remanage your code and change it the way it works on both platform. If there is no universal solution, use #ifdefs to determine your current platform (the worst case actually, because you would have to have different binary files for different windows versions).

Kotti