8
votes

if you compile a program in D2010 a manifest .res file is automatically generated. is it included in your program by default? or you have to include it yourself?if yes what level of privilage is given to you? my program modifies a registery key would it be able to do so with out any modifications to .res file?if no what modifications i need to do?
a side question: is there a component/expert(prefably free) that can generate/include .res file in my delphi 7 and delphi 2007 projects automatically just like delphi 2010?
edit: forgot to mention i do not have win7 or vista nor have i ever used them
edit2:i have included a manifest file just in case following this tutorial but the tutorial only talks about windows vista and not 7 would the .xml(manifest) file in this tutorial make my app capable of dealing with win7 UAC too
edit3 if i include my own manifest file and delphi is including it by default as well that will make 2 manifest files(1 with admin previlages and 2nd without) would this cause any problems/unpredictable behaviour

1
Why does your program need to modify an administrative-level registry key? If your program needs to do that, it will have trouble running on older Windows versions, too, unless your customers have all their users run with administrative privileges, which would be foolish. Also, if you're going to support newer versions of Windows, it would be worth your while to buy a copy so you can test your software on the platforms you claim to support.Rob Kennedy
@rob kennedy: the situation is not what you think actually i got a internship offer, my first interview went well but they asked me to submit a demo program one of the things they asked for is that my program should be able to run every time windows starts my solution to this is to modify 'Software\Microsoft\Windows\CurrentVersion\Run' to make it start up on windows startup i fear if they test it on windows7 under a normal user account my software would fail :(Omair Iqbal
If you modify that registry setting in HKey_Current_User, you shouldn't have any problem. Or if you place a shortcut to your program in the Startup folder of the Start menu, that should work, too. I think it would be worse for you to require admin privileges for your program if the rest of its duties don't require it. Besides, I'm sure you can just tell them when you submit your program that you don't have access to Windows 7 and so you couldn't test it there; that's a perfectly understandable situation for a student. They'll test it on Windows XP instead.Rob Kennedy
"If you modify that registry setting in HKey_Current_User, you shouldn't have any problem"if i do that UAC wont pop up or would it still pop up? "Or if you place a shortcut to your program in the Startup folder"tried that before but whenever i do that my anti virus says may program is behaving like a trojan ,deletes it and creates a backup copy "I'm sure you can just tell them when you submit your program that you don't have access to Windows 7" another one of their reqiurment was that my program should runs on xp,vista and 7.Omair Iqbal

1 Answers

8
votes

The manifest generated by delphi gives your process the lowest privileges (that is the default by the way).

You have to modify the manifest file in order for it to ASK for permission to be run under administrative rights (Called elevation).

Your application with the standard privileges should read/write to HKEY_CURRENT_USER without elevation.

Accessing %programfiles% and HKEY_LOCAL_MACHINE requires elevation. (Not so sure about the other registry hives)

This is a PDF that will help you A LOT with what you're up to.

http://pascalfonteneau.developpez.com/articles/delphi/vista/uac/VistaUACandDelphi.pdf