Run NSIS installer from a C++ application with out prompting UAC permission - c++

I have C++ application running as service. And I want to start my NSIS installer silently from that service. Is it possible? If yes how can I achieve this?

If you want to start the installer as the same user as your service and this service runs at integrity level high or system then you can just use CreateProcess or ShellExecute to start the installer.
If you want to start the installer as a user that is currently logged in you need to use CreateProcessAsUser but things get complicated if you go this route. There might not be any logged in users or there might be more than one. Once you have decided which user you want to start the process as then you can get their token with WTSQueryUserToken.

Related

Auto Deauthorize from a system by RingCentral

I have RingCentral Desktop app installed on my system which I need to Deauthorize from my system.
If I uninstall the application, will it automatically Deauthorize it from the system?
If not, what is the manual process in doing so? Also if there an API available for the process to Deauthorize the application which I can use?
I tried searching and finding the answers, I couldn't get the answers
No there is no automated way of De-authorizing the application from the system.
All you need to do manually by going into application's Setting --> Phone and number section.
Here is full way of doing :
https://support.ringcentral.com/s/article/4219?language=en_US
Also there is no RingCentral API available currently for the process

C++ windows service program called DLL is not working properly

I wrote a websocket server program running on Windows service.According to project needs, a DLL is called. This DLL needs to read my computer shagn a file under my document.However, the windows service program called DLL can succeed, but DLL failed to read the file under my document. When the server is not running as the windows service, DLL can read the files under my document successfully. I'm so depressed, I don't know why.Who can help me.Thank you
When several users using the same PC, each regular user have a My Document dir, and can't access other user's My Document.
When You run a service, it run by default as Local System or Local Service which are restrict users, and doesn't have access to your My Document dir.
You must think: how the service can choose from all other users in your PC which is the user it should take the file from?
The simple solution is to run the service as your user. You can try it manually by open the service Properties (on services, right click and choose Properties, or double click), choose Log On tab, and fill the acount username and password to your username and password.
A real solution is to place the file in a fixed place, like %LocalAppData%\AppName, not depending on any user.

Execute command as Normal user

I am using IIS 8 in my machine.
I want to execute the appcmd command in command prompt as Normal user.
While executing this command I got the error as below,
c:\Windows\System32\inetsrv>appcmd.exe list wp
I get this error message:
The WAS service is not available - try starting the service first.
It works if I open the command prompt as administrator.
How can I achieve this as normal user?
Is there a way to get the application pool name of a worker process from C++ ?
Appcmd is not intended for non-admin use:
Appcmd.exe is intended for local management of the Web server [...]
and requires the user to have administrative privileges when using it.
If you require remote management or the ability to configure the Web
server without being an administrator on the server, you need to use
the remote delegation support that IIS Manager provides.
from Internet Information Services (IIS) 7.0 Resource Kit by
Volodarsky et al., Microsoft Press (2008).
To solve your problem, you will probably be interested to investigate the remote delegation features they mention.

Storing user's application preferences in Terminal Services Server session. Managed C++

Sorry if my question is silly, but I have no experience at all with terminal server and am having a problem on how to store user preferences for an app.
The application was originally designed to run in individual, independent, computers. The installer has the option to install for all users or the current user but it always stores some xml in a subdirectory of the commonapp folder of the computer. It does store it here to be able to write to it later on under Windows vista upward.
Now, the company is running terminal server and the users don't have an independent computer anymore. They log into a session of terminal server and the administrator decides what software they can use. As the app is now, it installs in the server and offers all the users the same preferences from the commonapp. If the preferences are changed for an user, they all will have the change...
Please, could someone illustrate me on this? Initially, I though that by choosing 'to all users' when installing, the terminal server system would use the roaming folder of the user to store the preferences but I was wrong...
I don't know what users are going to use the app and cannot install directly to their folder either.
Is this a terminal server settings thing or do I have to write some code in the app that checks if the user has the xml in its folder and copy it and use it if it doesn’t?
Do not store application preferences in its directory. Instead, store it in user's roaming directory - use Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) (since you tagged the post as managed). Then it can be installed once, but run multiple times by multiple users and each of them will get his set of settings.

Is it possible to run ATL service as user application

I have to develop ATL app that is meant to run as service most the time, however we need to deploy it as user application in few environments
I believe that the answer is no, but I could easily be wrong - in either case however this probably isn't the approach I would take. Personally in your situation I would either:
Develop 2 apps, a service and a user application, or
Develop a console application and use the Windows Server 2003 resource kit to run it as a service.
See here for instructions on how to run any Application as a Windows service (I'm sure there are better guides out there, but I'm struggling to find them at the moment)