Click here to Skip to main content
15,867,963 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I inherited a program written for Windows XP. On XP, it loaded and ran just fine. Now that all our XP machines have been decommissioned, this program needs to run on Win7 and Win8 in user mode. There is no obvious functional reason that this program should require administrator privileges.

I unpacked the source and loaded it into Visual Studio. I set the mode to Debug and pressed F10 to see where it would start. It didn't. Instead, it said that the "requested operation requires elevation."

How can I determine what "operation" is requiring elevation? I need to either bypass this operation or create a user-mode replacement.

Thank you.
Posted

1 solution

Other than running the code under the debugger on the O/S that your users are using, there's really no other way that's going to be quick and easy.

Now, the usual checklist is:

1) are you writing values to the registry under HKEY_LOCAL_MACHINE?

2) are you trying to write to files anywhere under Program Files?

3) are you trying to write to files in the root of C:\?
 
Share this answer
 
Comments
Sergey Alexandrovich Kryukov 9-Mar-15 19:09pm    
5ed, but in addition to your check list, I would say: this is rather the list of things to avoid, instead of doing under elevated privileges. I feel the inquirer understands that though.
—SA
Dave Kreskowiak 9-Mar-15 23:18pm    
Yeah, the solution isn't so much as finding the "thing" that is causing the app to require admin priv's as much as it is reviewing the complete project and understanding the code. There's no telling how much stuff is done wrong in the code.
Jalapeno Bob 10-Mar-15 11:07am    
Dave,
As to your checklist, no, no and no. This program does not need any of these functions. Other programs I inherited that don't run might, however. I have not gotten there yet. Thank you for the information.

I was hoping that someone has a quick way to identify the cause of the need for elevated privileges. I (and especially my boss) want to get these programs up and running again without me having to go through the code - often now, spaghetti code, after numerous patches and revisions - and understanding it. I will probably find that in many cases, I might as well rewrite it in a more object oriented design: the budget, however, will not support it.

I wish Microsoft or some other software developer had written some tool to at least identify why Windows would flag a program as requiring elevated privileges. Identifying where in the program would be gravy. Even a simple, complete list of causes would help, at least a little.

Dave and Sergey,
Thank you for your prompt replies.
Dave Kreskowiak 10-Mar-15 12:59pm    
There isn't a tool simply because the problem is innumerable. There are too many ways to do something that requires admin priv's that other code just cannot detect because the code under suspicion can build things, like paths to user-readonly files and locations, in many different ways that just cannot be detected.
Jalapeno Bob 11-Mar-15 16:44pm    
The loader obviously knows because, it asks for the administrative credentials. Another program could be written that looks at the .exe and the related .dlls, makes the same determination and prints out descriptive messages. I am surprised that one has not been written.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS


CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900