user2379024
user2379024

Reputation: 21

How do I find (and remove) locations in my code that require administrator privileges?

I have a multi-process application that was originally developed in XP and was originally designed with no regard to administrator privileges. We used to configure and sell computers with the software. We are now selling the application by itself, without the hardware, to be installed on user systems in a corporate environment. Currently our software package requires our users to run in administrator mode, which is not making us popular with our customers IT departments.

I have been working to remove items that obviously require administrator privileges (writing to HKLM in the registry, writing to the Program Files folders). However, Windows continues to require administrator rights to run the software. If I deny the rights, it closes with no logs. It has a lot of legacy code and so hints to find where the administrator access is happening has proven difficult.

Is there an easy way to see what is being accessed or done that is hitting Windows 10 admin requirements?

Currently I have removed moved writing of data files I could identify to the Program Data folder or to user documents. (depending on whether I want users to be able to easily find them or not).

Configuration files have been moved to user folders.

Registry key access has been kept to HKLU or read-only in HKLM.

Upvotes: 1

Views: 53

Answers (1)

user2379024
user2379024

Reputation: 21

Thank you all for the help. I ended up finding the answer in the C# based launcher for our software, which was starting all processes with the verb "runas" set:

        try
        {
            myProcess.StartInfo.Verb = "runas";
            myProcess.StartInfo.FileName = command;
            myProcess.StartInfo.WorkingDirectory = workingDir;
            myProcess.StartInfo.Arguments = prams;
            myProcess.Start();

} catch (Exception ex){}

I removed the "runas" verb and now the system is not requesting admin privileges on the started pieces of code.

I found the cause when I tried to setup a debug run from the Program Files directory and started the code without going through the launcher. (started in a debugger) The system did not request administrative permissions which led me back to the launcher. I recently got the launcher to run without needing administrative permissions and so I had assumed that the problem was in the other processes. Seems I was mistaken.

Upvotes: 0

Related Questions