Possible Duplicate:
How can I start a program even before Windows starts itself?

I want Windows to run a command line program before it even loads the login (or Welcome) screen. If you've ever seen this screen, you know what I mean: enter image description here

I want this program to be executed exactly at the above stage/screen (before any driver is loaded). The reason and purpose are too complicated to explain here. But is this possible?

  • This screen actually appears AFTER (at least some) drivers have loaded, or else Windows wouldn't be able to recognize the drive's file system to run the disk check. – Ƭᴇcʜιᴇ007 Jul 26 '11 at 13:03
  • What version of XP are you running? Pro or Home? – KCotreau Jul 26 '11 at 13:27
  • 1
    @techie007: Burdges is correct. Driver is not loaded yet at that stage. Chkdsk must be able to read the C: volume in RAW mode. This is only possible if there's no file in it is open. That's why chkdsk can't run with the /r switch on drive C: in Win32 environment. – Larssend Jul 26 '11 at 13:33
  • @Larssend - You can't run /F or /R on a system drive while windows is (fully) running due to locked/in-use system files (page file, etc.). (At least) the Kernel drivers need to be loaded, or else Windows couldn't use the hardware, let alone the file system (RAW or otherwise). Think of a RAID that XP doesn't have native support for, how are you going use or check a drive that Windows can't see because you didn't give it the F6 driver? :) – Ƭᴇcʜιᴇ007 Jul 26 '11 at 13:44
  • 1
    @techie007: Yes, you're just providing detail to my answer. – Larssend Jul 26 '11 at 13:47

Unfortunately, you can not run just any program at that stage. Only applications that use the 'native' NT API (provided by NTDLL.dll) can be run before Win32 subsystem is loaded.

To check if a program can be run at that particular stage, do the following:

  1. Run Registry Editor (regedit.exe).
  2. Navigate to HKLM\SYSTEM\CurrentControlSet\Control\Session Manager and locate a multi-string (REG_MULTI_SZ) entry called BootExecute.
  3. Double click the entry and Add the name of the executable you want to test excluding path. The executable must be located in %windir%\system32.
  4. Reboot.

If the program runs in the Native NT environment, you win. Otherwise, there's nothing you can do about it unless you have access to the program's source code.

Read this Technet Article for more information about Native NT application.

| improve this answer | |
  • 1
    Yup, have fun with that one! It sure isnt going to be a cake walk to test. – surfasb Jul 26 '11 at 13:27

Not the answer you're looking for? Browse other questions tagged or ask your own question.