win32 "before gui" app?
I'm working on an application that I need to have run before the GUI starts under Win2k/XP so I can have direct access to the filesystem (much like chkdsk, or partition managers).
I presume it's nothing more than just writing a console-based application and inserting something into the registry to have it run, but I've searched Google and haven't really found any leads. I guess it also helps to know what these types of applications are called anyway.
Does anyone have any information about writing such an application?
If you need to gain direct system access, you better download the DDK first, because there is no way in hell, Windows is going to grant a UserLevel privileged application to gain direct access to the HDD.
It also depends how 'dependant' your application of said application is. You might be able to see if it's loaded, and if not, start it and wait till it's running.
Toolmaker
It also depends how 'dependant' your application of said application is. You might be able to see if it's loaded, and if not, start it and wait till it's running.
Toolmaker
Quote:Original post by Toolmaker
If you need to gain direct system access, you better download the DDK first, because there is no way in hell, Windows is going to grant a UserLevel privileged application to gain direct access to the HDD.
Actually, it's rather easy to access a HDD's contents in user mode. Just call CreateFile with a device name of \\.\PhysicalDrive0. You can then do read/writes at will, as long as the person executing the application has Administrator access.
The problem with this method is that files that are opened, and certain parts of the MFT cannot be directly modified since they are in use. The drive must be "locked" to obtain direct access. However the drive obviously can't be locked if Windows is running on it, hence the reason chkdsk and the like ask you "We can't do this now, so how about we reboot and do it before the GUI starts?".
Like I said, I imagine it's just as easy as inserting a registry entry somewhere to instruct Windows to execute it before starting the GUI. I just don't know what to Google for to find out more information about this...
well, i'd guess you check out the sysinternals tools, especially the pagedefrag tool, as it will set itself to run before gui-boot (so you have something to quickly use and find again), and autoruns, wich show up all sort of things that get booted at different parts of the boot process. pagedefrag should show up in autoruns after you chose to start it at next boot, and so you should get the info where to write in trough autoruns.
it may even be possible to get the source of page defrag, but i'm unsure about that. not sure if it's really just a console app...
it may even be possible to get the source of page defrag, but i'm unsure about that. not sure if it's really just a console app...
looks like it's that path:
HKLM\System\CurrentControlSet\Control\Session Manager\BootExecute
and in my autoruns, there's one entry there:
autocheck autochk *
Auto Check Utility
Microsoft Corporation
c:\windows\system32\autochk.exe
hope that helps
HKLM\System\CurrentControlSet\Control\Session Manager\BootExecute
and in my autoruns, there's one entry there:
autocheck autochk *
Auto Check Utility
Microsoft Corporation
c:\windows\system32\autochk.exe
hope that helps
Quote:Original post by davepermen
looks like it's that path:
HKLM\System\CurrentControlSet\Control\Session Manager\BootExecute
Interesting -- that just might be it, since I'm pretty sure seen that "autochk" name from chkdsk before.
I'll try making a console app and see if I can print "Hello World!" to the screen by adding it there. :)
Thanks!
It's a bit more complicated than simply writing a Win32 Console app. To get something to run on startup like that, it needs to be a native application. I would suggest checking out some of the articles at Sysinternals, such as this one.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement