I want to provide Administrator priviliage to my dll for vista.
Please suggest
Launch the Process loading the Dll with administrator privileges.
Update:
You could try for a manifest.
http://en.wikipedia.org/wiki/User_Account_Control#Requesting_elevation
same as in exe files
set it to what you want in your manifest file
< requestedExecutionLevel level="asInvoker|highestAvailable|requireAdministrator"
uiAccess="true|false"/ />
Related
I have to be able to start or stop an windows service (written in C#) from a C++ application say App.exe after the application has been started. I know I can give admin privileges to the app using a manifest before the application has been started. But can I do the same programmtically in C++ program in App.exe after the application has been started?
I put the following command in a .bat file
SUBINACL /SERVICE /GRANT=S-1-5-32-545=TO > %1
and ran the bat file while installing the application from setup.exe.
It resolved the issue.
Thanks for your comments #Harry Johnston
I have built a Windows service app that's installed and running. During debugging while the service is running, I have found that when I import the properties.settings.default and modify it, it is not saved to the app.config file in my project folder. I could not find this app.config file in [user]/%appdata%/Local/ either..
Where does properties.settings.default.save() save to?
I'm running Windows 7 if that helps.
You will find the APPDATA folder for system accounts at:
C:\windows\system32\config\systemprofile
Or (for x86 apps on Win7 64):
C:\Windows\SysWOW64\config\systemprofile
I created a simple Win32 console application to say "hello world.exe". When I open the EXE file, it doesn't have administrator rights but when I run it as administrator the console path gets changed to some C:\sys rather that the path of the "hello world.exe".
How do I give the administrator rights with normal open or change the path to "hello world.exe" when running it as administrator?
You can add an application manifest which requests Administrator privileges. This is the recommended approach.
I have made an installer using izpack which is packaged as an executable jar file.
Normally when I double click the jar/installer file the windows 7 UAC box pops up and I grant temporary administrator rights when installing the application (my UAC level is second lowest).
But for some reason this box no longer pops up when I double click the jar file. As a consequence I get an error "Access Denied" when the installer tries to install a windows service (during this process some keys are set in the registration database).
Any ideas on how I get windows to recognize the jar file as an installer and pop up the UAC box as previously?
It works fine if I open cmd in administrator mode and cd to the jar file and run it from there. But it could be nice to make it work the other way (correct way).
Izpack/izpack2exe will prompt for UAC privilege elevation if you add the element <run-privileged/> to the <info> section of the config file.
Or, if you name the installation executable to include "setup.exe" or "install.exe", Vista and Win7 should automagically prompt for UAC privs. (But this isn't foolproof, as an end-user may download your app and change the name, or if you use a JAR distribution...)
I have an installer written in Java using Izpack. It works OK on Windows XP, however on Windows 7 it cannot write to c:\Program Files. Strangely enough, as a user running this installer I can create folders under c:\program files, but not from the installer itself.
What am I missing ?
in order to write to this path, the installer would need to ask for and been granted run as adminsitrator privledges.
For Java:
Run the CMD prompt as admin or powershell as admin and navigate to JAVA's Bin dir....and run java.exe -jar #Full path of your jar file# that will get it the privledges
Add
<run-privileged/>
to the info part of your installer.xml.
For example::
<info>
<appname>IzPack</appname>
<appversion>4.2.0</appversion>
<authors>
<author email="" name="Julien Ponge (project founder)"/>
<author email="" name="The fantastic IzPack developers and contributors"/>
</authors>
<url>http://izpack.org/</url>
<javaversion>1.5</javaversion>
<requiresjdk>no</requiresjdk>
<run-privileged condition="izpack.windowsinstall.vista|izpack.macinstall"/>
<summarylogfilepath>$INSTALL_PATH/installinfo/Summary.htm</summarylogfilepath>
</info>
You need to run the installer as admin. Only admin can write to the Program Files directory. Usually when a user tries to make changes, the UAC asks if you're sure. This isn't necessarily true for a program.
Have you tried with Run As... Administrator option ?
Run cmd with administrative privileges
java -jar ***.jar