C# Windows Adding SE_BACKUP_NAME - windows

I have an app that runs as LOCALSYSTEM (full rights). I need to add SE_BACKUP_NAME and SE_RESTORE_NAME privileges to the app. How do I accomplish this in c#?

Related

How to open the app in non-admin window after the installer run with Admin privileges

Background:
The installation of our application requires Admin privileges.
After the installer has finished we are calling the newly installed program from the installer, and it opens in an Admin window. (This is at least how it works on Windows)
Then when we click on the icon to run the program, it opens another window (thus two instances of the app are running -- not a good thing.)
Is it possible run both the installer and the app from a batch file, so that only after the installer is closed, the app opens in an non-admin window?
(In our app the installer asks for the admin privileges, so the batch file should not do that.)
I tried experimenting with this using "Everything.exe" (an excellent app that requires admin privileges).
REM Test batchfile for opening two apps
"C:\Program Files (x86)\Everything\Everything.exe"
Notepad.exe
unfortunately as soon as Admin privileges are granted to "Everything.exe", Everything loads in the Admin window, and the Notepad loads in the non-admin window.
Is there a way to open the app in non-admin windows after the installer exits?"
You should be able to use MSI (Windows Installer) to install the product with "elevated rights" as opposed to "administrator rights". Windows Installer features a built-in mechanism to impersonate an administrator for the installation transaction when the setup is launched in a regular users login session (there are some policy settings that have to be enabled).
It should also be possible to run an MSI with administrator rights and launch an application from the final setup dialog with regular user rights (perhaps not if launched from an admin rights cmd.exe - not sure, it should launch the msi by right click run as admin) This is possible because the MSI GUI never runs with elevated privileges - it is the installation transaction launched by the GUI that has elevated rights. Once the transaction is complete, the control returns to the GUI running with regular rights. From here you can launch the app via a button click.
This description is somewhat simplified, I'll leave it at that since MSI might not be an option for you.

How to know if Internet Explorer in Windows 7 runs with Administrative Privileges?

I use IE on Windows 7(With UAC) to run some ActiveX that installs our client product.
My problem is that I want to check if the explorer runs with administrative privileges prior to ActiveX installation, and if not to pop message box to our clients that they need to run the IE with 'Run As Administrator'
Thanks
The user doesn't have to run Internet Explorer as in administrative use.
Inside your digitally signed cab file, you will have an .inf file that will instruct Internet Explorer to register the ActiveX:
CohenSoft.inf:
[version]
signature="$CHICAGO$"
AdvancedINF=2.0
[Add.Code]
CohenSoft.ocx=CohenSoft.ocx
[CohenSoft.ocx]
file-win32-x86=thiscab
clsid={de8530cf-d204-4877-9cab-f052bf1f661f}
FileVersion=1,12,47,660
RegisterServer=yes
Internet Explorer will automatically prompt the user for UAC elevation:
And your ActiveX will be installed as an administrator.

visual studio 2005 setup project from xp to windows 7

I've been developing in VS 2005 on an XP machine for the past 3 years. We're now getting new PCs with Windows 7. What I've noticed is my setup projects require admin rights to run. This is a problem for me because no users (including me) have admin rights, only helpdesk support staff.
I'd like to run my Windows installer setup projects without admin rights- is that possible?
Also, I'd like to continue to create installer files that users without admin rights can run. Is that possible, or will all my setups now need to be installed by someone with admin rights?
I've looked into ClickOnce deployment, but I don't have a web server available for installations.
Also, I've looked into digital certificates, but I have no budget. Is there a way to get a certificate for free? All my applications are for internal use, and I understand these security issues are for web applications.
Is free deployment of internal applications no longer supported?
Thanks for your input,
-Beth
It is possible to run Windows Installer setup without admin rights. Look at Single Package Authoring article for an overview how to create a package that support that. You can also prepare a package that will run only in non-admin mode. Note however, you will not be able to write to Program Files and other system-protected areas when installer runs in non-admin mode.
You can use self-signed certificate to add digital signature to whatever you want. The only thing is that this certificate will not be trusted by default. However, it's not issue when used internally: it can be installed as trusted on machines where it's required. See makecert.exe and signcode.exe tools.

VS 2010: Is there a workaround for the administrator requirement?

Aside from running as a administrator, is there any workaround for this requirement?
xxx.vbproj : error : The Web
Application Project XXX is configured
to use IIS. To access local IIS Web
sites, you must install the following
IIS components:
In addition, you must run Visual
Studio in the context of an
administrator account.
If you do not want to run as an administrator, then host using the Developer Web Server (Cassini) rather than IIS.
One option - though not recommended by Microsoft - is to turn off User Account Control (UAC):
Disable User Account Control (UAC) in Windows 7
You can active Administrator account and use that account you never get this issue. you can find this post which also works in windws7.
http://knowledgebaseworld.blogspot.com/2009/05/how-to-login-as-administrator-in.html
imran
You need to open your Visual Studio as a administrator (Right click o)

COM Deployment for VISTA

What is the COM interface that need to be implemented in order to deploy COM dll in a vista/win7 machine. I heard that there is something to deal with UAC accounts with COM,
but I could not find MSDN page for this, Please help.
Thank you
All you have to do to register a COM object is write the appropriate keys to the registry. There is no special interface to implement on Vista; however you need to make sure your installer has Administrative rights so it can actually write to the registry. By default programs will run as medium integrity level applications, which can't write to HKLM and HKCR (in general). If you install using MSI (look into the WiX toolkit; it makes registering COM objects easy) then the OS will automatically prompt the user for elevation at install time.
If you are deploying a COM control, it is probably as part of an application install.
In which case it is possible to use an application manifest to achieve Registration free COM. (The linked article is in the .NET section not the Windows section of MSDN, but applies to Win32 development and deployment).
There is no special COM interface, but you have to have elevated rights in order to run regsvr32.exe to register your COM dll. If you use an MSI to install, then Vista should automatically prompt for UAC elevation when your installer tries to register your COM dll.
There's some more information here about the UAC issue on Vista
http://blogs.msdn.com/vcblog/archive/2006/09/06/742187.aspx

Resources