How do i run task at boot time and wait for it's completion? I know chkdsk and some other programs are doing that, but how? Update: i found a way. Native API, if anyone's curious.
2 Answers
Windows have a "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\BootExecute" key, programs in it are executed before any subsystem is started, i.e. before win32,LSA, etc. The only API avaliable at that time is NativeAPI. Most of it's functions can compromise security and stability of the system (This API can close handles, hide registry keys and more). Of course, a lot of it's functions are undocumented, but guys at http://undocumented.ntinternals.net/ have documented a lot of them.

- 59
- 6
Here is another method (not sure if this "Native API" is the same but you can use the Windows Task Schedular. There is a On Computer Start on or a User Login option too.
How to install/wrapper (Just for more info): Windows Task Scheduler Installer

- 1
- 1

- 1,501
- 1
- 11
- 19
-
-
1@YaD as you might want to explictly say that. Also give details about the Native API – Brad Semrad Feb 10 '12 at 21:19