How to run a C # application in a guest account as administrator

I did not get the right answer and received many answers, such as “we cannot do this” for my previous questions.

That's why I decided to explain my problem in detail, please help me if you can or ask your friend who can answer this question.

Now my problem is:

Step 1:

I created a C # program that edits various Windows registrars. To edit Windows registries, we must have administrator privileges. My program works fine in admin mode without any problems.

Step 2:

I want my program to also run in limited user mode. If some people didn’t get what I am saying, this is what I want to run my above C # code in guest mode. In guest mode, there is a limitation that we cannot modify Windows registries. Since I am running my application, I receive one notification requesting an administrator password. After inserting the admin password, my application works fine.

Step 3:

I want my application not to ask for an administrator password every time in a guest / limited account. I also want my application to work in guest mode. I also want my guest application to have access and modify Windows registries in guest mode.

Step 4:

Many people told me that we cannot do this in guest mode, since Windows restricts users to editing window registries for security purposes. Therefore, please, if you also feel this, then please do not answer this question. I answer those people that any good antivirus running in guest mode has access to Windows registries.

Step 5:

  • Since I know the administrator password, is there any way to save the administrator password in our C # code and a pop-up message asking for the administrator password again and again.

  • Is it possible to instruct Windows in some way that our application will work in administrator mode and not ask for an administrator password again and again.

  • As a guest application, Antivirus performs the entire operation, for example, removing a virus from the system32 folder and dropping the registry after a virus attack. This antivirus application never asks for "We detected a virus in the System32 folder, since I work in guest mode and cannot delete the virus, so enter the administrator password so that I can delete the virus"

I hope you understand what I want to ask?

I want to develop a C # application that should run in any mode (Admin / Guest / Limited) and should be able to create, edit and delete Windows registries.

Note. Please do not respond to this by right-clicking and “Run as administrator”.

+4
source share
2 answers

As far as I know, antivirus software solves this problem by running two (or more) processes: a user interface program running as a guest user, and a privileged process (usually a Windows service). A user program cannot actually manage resources with limited rights (such as protected registry bushes) - instead, it interacts with a privileged process (I hope in some secure way), and a privileged process performs a privileged action on behalf of the user.

This is the same method by which programs access privileged resources, such as hardware. Your user-level process (usually) does not have the right to perform various hardware actions, such as reassigning memory in the MMU, but the OS works, and you can force the OS to do what you want by asking it. Thunk system calls to kernel mode, which is fully privileged. However, the system call interface limits the types of privileged actions you can take.

+2
source

I cannot help, but I say: "No, you cannot administer under the guest account." And you cannot programmatically bypass UAC.

Perhaps the following 2 workarounds are of interest to you?

I believe that antivirus software runs under the System account (can only be installed by the administrator). For your application, you can create a server / client architecture (both do not have the same computer), where the server is installed by the administrator (as part of the entire package) and starts by default in the System account. Then you can use the client on the quest account to send commands to the server.

Another solution may be not to use the registry directly, but to use another basic data store available by the guest account and synchronize this on demand with the registry (start and end?), So you only need to log in once to log in or twice during the launch of your application.

+1
source

All Articles