I know there are startup folders and certain registry keys I need to look into. But how to do that using Windows API? I'm interested to know for Windows XP and Vista. Thanks for your time.
views:
184answers:
2I am not sure such an API exists. Nevertheless you can write a function to do that.
The startup process names and location are stored in following location in registry:
HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Run
<Name> <Location of EXE>
You can write small function to open the above registry and read the startup process details.
There is no single API to get all the programs that run while the system is starting up. Consider all the things that Autoruns shows. Updates to that program occasionally allow it to show new classes of programs, and since those are updates to the program and not to the OS, it's obviously not some API that's changing to include more things. Rather, it's the program that's gradually expanding its notion of what an "auto-run program" is.
Work out what you wish to consider to be a "startup process," and then you can determine what APIs or other techniques you can combine to find out what all those processes are.
Among the places to look include the following:
- The "run" registry key, like AJ mentioned.
- The "startup" menu, as given by various constants used with
ShGetFolderPath
and some of its related functions. - Tasks scheduled to run on login.
- Services.
Each bullet point includes at least one link to a page on MSDN that should get you started. If you need more, consider asking some more specific questions.