views:

486

answers:

3

I am trying to debug an application in Delphi 2007 on a Vista machine. The application was originally written for XP so it must be run with administrator privileges. I know that I could put some information into the manifest or update the code but I am looking for a quick fix that can be used in all my projects.

Does anyone know if there is an easy way to get Delphi to launch an application as administrator in Vista?

+4  A: 

I suppose if you run Delphi under administrator privileges all child processes will run with the same privileges as Delphi itself.

pani
+2  A: 

You might consider how your application is normally going to run - by requesting elevation. It would seem if you spawn your application at normal security, and then it spawns itself at an elevated level, then you would still be debugging the elevated executable. Then you would be debugging the actual use case.

Jim McKeeth
This is a good point. However, in my situation the code is going to run on a locked-down tablet pc running Window 2000 or XP embedded. My dev box runs Vista and I just wanted a quick and dirty way to launch the apps.
Lawrence Barsanti
+1  A: 

Under Vista you can elevate to administrator privileges. This link shows you how to start an Executable from within Delphi with those.

Note that Microsoft uses the word elevate, not escalate.

The problem is: you have to restart your process for this, so you cannot debug the restarted child process (if you could debug an elevated process from a non-elevated one, that would be a potential security hole).

Jeroen Pluimers
I knew escalte was wrong, but couldn't remember the right one. Thanks!
Jim McKeeth
@Jim: you are welcome.
Jeroen Pluimers