Change startup order c# - windows

How do I change the startup list? Basically I have a program that is a computer locking system and when I enter it into the registry to start up when login, it is like the last thing to open.

Which startup list are you using to launch your application?
There are actually quite a few startup lists (see below). The order of application launch within a given list is not configurable (e.g. there is no way to choose which application in the Startup Folder launch first) but, the order in which the startup lists are iterated is fixed (e.g. Applications in the Common Startup Folder will always launch first, before applications in the Startup Folder).
It sounds like you want to launch your application on user login, so listing your application path in the All Users-Run registry key should ensure that it launches fairly soon after logon.
Add a string (REG_SZ) value to the HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Run registry key with the path to your application as the data.
(Aside: Background reading on the arcane terminology of the Windows registry)
STARTUP ORDER FOR WINDOWS 9X/ME
config.sys
autoexec.bat
wininit.ini
winstart.bat
system.ini
win.ini
All Users-RunOnce (HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\RunServicesOnce)
All Users-RunServices
(HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\RunServices)
All Users-RunOnce
(HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\RunOnce)
All Users-Run
(HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Run)
All Users-RunOnceEx
(HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\RunOnceEx)
All Users-RunEx
(HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\RunEx)
Current User-RunOnce
(HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\RunOnce)
Current User-Run
(HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Run)
Current User-RunOnceEx
(HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\RunOnceEx)
Current User-RunEx
(HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\RunEx)
Common Startup Folder
Startup Folder
STARTUP ORDER FOR WINDOWS NT4/2000/XP
BootExecute
(`HKLM\SYSTEM\CurrentControlSet\Control\Session Manager\BootExecute
Services
User enters a password and logon to the system
UserInit
(HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon\UserInit)
Shell
(HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon\Shell)
All Users-RunOnce
(HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\RunOnce)
All Users-Run
(HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Run)
All Users-RunOnceEx
(HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\RunOnceEx)
All Users-RunEx
(HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\RunEx)
Current User-RunOnce
(HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\RunOnce)
Current User-Run
(HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Run)
Current User-RunOnceEx
(HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\RunOnceEx)
Current User-RunEx
(HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\RunEx)
Common Startup Folder
Startup Folder
(Source)

Related

What user profile the system uses when runs a service in windows

All,
I have no idea how Windows service works, just curious when we register a windows service(such as auto run a server after reboot), if it requires a user profile to load info(such as pulling data from somewhere else), what user profile does it load?
Thanks,
You can select what user run each service registered and the system comes with users assigned per service. The most used by the system is SYSTEM.
To check this you have to:
Go to services.
Right click on the desired service and properties.
Go to the Log on tab and check.
If the Local System account is selected the username is SYSTEM which has special permissions on almost all folder and Windows sections including users' profiles data.
By the other hand if you would like to do something special with an specific account you can tell the system the service will start with the account specified. Just make sure to update the password information every time the user change it.
Regards,
Luis

How to detect Active Setup in MSI

i have a MSI installation package that is installed as SYSTEM User and adds an active setup entry to the registry. This setup makes sure when a new user(new = that has not executed this setup until now) is logging on msiexec adds all missing registry entries.
In the MSIEXEC i need to do a net use to mount the users home directory. This cannot be done as system user and needs to be done in the user context.
However i seem to be completely unable to detect that the setup is currently running on the user context. Thats why i thought it would be nice to give additional parameters to the StubPath in the active setup entry. I tried NETUSE=1. This however did nothing. The setup just ignored this parameter and uses the parameter given during installation. So NETUSE stays 0.
Any ideas what kind of condition i could use for my custom net-use action?
Why is an MSI mounting a users home directory? I would write a small utility to do all this work and just have the MSI put it in the Run registry key. Install once per machine as System and then when the user logs in the utility gets called and does whatever per-user work you need to have done.
If the installer legitimately needs to populate per user registry data then that is fine to continue the active setup pattern.
You can try to use your own custom action configured to run only when the LogonUser property is different tan SYSTEM.

adding registry key for Windows local SYSTEM user

I am somewhat new to Registry Keys in Windows. What I want to do is add a registry key ONCE that will take effect on the local SYSTEM user (for as long as my program is installed). This registry key will need to be added through a batch file while logged on as a regular user (not the SYSTEM user). What I am doing exactly is running a batch script that creates a windows service. This service is running as the local system user. The service is trying to do something that requires a registry key to be set. I tried manually setting the registry key in HKEY_LOCAL_MACHINE but I am still hitting the roadblock when my service is run. Is this the correct place to change registry keys so that the local system account will see them? Any knowledge on the subject would be greatly appreciated!

Detecting System Startup Event

I would like to execute a procedure that should be fired only upon windows system startup, and startup here does not mean program startup. Is there anything that I can do to trigger my procedure. If possible, i would like to avoid messing with the registry. I am using delphi 2010.
There are many options, but all will involve settings that require admin rights. These options include:
Put your routine in a service that is set to start automatically. This will start up when the system starts up and before any user has logged on.
Add an entry to HKLM\Software\Microsoft\Windows\CurrentVersion\Run. This will execute when an interactive user logs on.
Add a scheduled task with an appropriate trigger, e.g. At startup.

give full control folder access to one process in Windows

I've got an important resource folder (that can not be embeded in exe file) and I want to limit access of all Windows users except Admin Group ones. My program runs in normal (not Admin) user and I want give resource folder access only to this process. I can ask Admin user's password once, but I don't know is it possible or not?
You can start an elevated rights process from you application, do whatever is needed with admin rights and end it after.
Take a look here: http://victorhurdugaci.com/using-uac-with-c-part-1/

Resources