UAC and restarting an external service in my MFC app
-
Hi, I have an MFC app that is dependant on an external windows service. The need to restart that service occasionally arises. I do this using some boilerplate code, heavily derivative of that appearing in an article on MSDN. When I run the application on Vista as a non-administrator, a call to OpenSCManager() returns NULL. I must run the application as an administrator for the process to succeed. Can I make a UAC dialog automatically appear on Vista/7 in the event of needing to access administrative functions like this? I have similar problems in the same application when calling code that uses boost.asio to ping a remote server. I'm not sure if it's relevant, but here is my application manifest security entry:
<!-- Identify the application security requirements. -->
<ms_asmv2:trustInfo xmlns:ms_asmv2="urn:schemas-microsoft-
com:asm.v2">
<ms_asmv2:security>
<ms_asmv2:requestedPrivileges>
<ms_asmv2:requestedExecutionLevel level="highestAvailable">
</ms_asmv2:requestedExecutionLevel>
</ms_asmv2:requestedPrivileges>
</ms_asmv2:security>
</ms_asmv2:trustInfo>Thanks a lot, Sternocera
-
Hi, I have an MFC app that is dependant on an external windows service. The need to restart that service occasionally arises. I do this using some boilerplate code, heavily derivative of that appearing in an article on MSDN. When I run the application on Vista as a non-administrator, a call to OpenSCManager() returns NULL. I must run the application as an administrator for the process to succeed. Can I make a UAC dialog automatically appear on Vista/7 in the event of needing to access administrative functions like this? I have similar problems in the same application when calling code that uses boost.asio to ping a remote server. I'm not sure if it's relevant, but here is my application manifest security entry:
<!-- Identify the application security requirements. -->
<ms_asmv2:trustInfo xmlns:ms_asmv2="urn:schemas-microsoft-
com:asm.v2">
<ms_asmv2:security>
<ms_asmv2:requestedPrivileges>
<ms_asmv2:requestedExecutionLevel level="highestAvailable">
</ms_asmv2:requestedExecutionLevel>
</ms_asmv2:requestedPrivileges>
</ms_asmv2:security>
</ms_asmv2:trustInfo>Thanks a lot, Sternocera
This one might help
Sternocera wrote:
ms_asmv2:requestedExecutionLevel level="highestAvailable"
change to ms_asmv2:requestedExecutionLevel level="highestAvailable" uiAccess="true"
-
This one might help
Sternocera wrote:
ms_asmv2:requestedExecutionLevel level="highestAvailable"
change to ms_asmv2:requestedExecutionLevel level="highestAvailable" uiAccess="true"
For that, you must set UAC options for your projects. linker option in the Visual Studio development environment must be changed. ->Open the project's Property Pages dialog box. ->Expand the Configuration Properties node. ->Expand the Linker node. ->Select the Manifest File property page. Modify the 1.Enable User Account Control (UAC)-Yes 2.UAC Execution Level-highestAvailable 3.UAC Bypass UI Protection properties-Yes BIJU
-
This one might help
Sternocera wrote:
ms_asmv2:requestedExecutionLevel level="highestAvailable"
change to ms_asmv2:requestedExecutionLevel level="highestAvailable" uiAccess="true"
Hi, Doing so doesn't make any discernible difference, Regards, Sterncera