How to get the real bootdrive?


I need to know the ABSOLUTE bootdrive Windows 95 or Windows NT uses. I need it for being able to automatically change the startup logo (logo.sys in the bootdirectory, if not there, it's in io.sys) of Windows. When there's only one disk, it's in C:\, when there's a doublespacedrive, it's usually H:\, but, if not, it's possible to get it from C:\drives.dat. (when windir is subdir of c:, otherwise: ?:\drives.dat.) DRIVES.DAT comes up as soon as DRVSPACE or DBLSPACE is loaded via Windows.
But where to find it when there are more (primary) partitions, more drives and the bootdrive is (for example) c:\ and windows is in d:\windows and/or there's also a doublespace host? Maybe the combination of getting HostWinBootDrv out of MSDOS.SYS (but I'm not sure what HostWinBootDrv means in absolute sense) and doublespace drive out of DRIVES.DAT (hopefully in the rootdrive mentioned in MSDOS.SYS) is enough. I cannot tell for sure and I haven't got enough test-cases to try all the possibilities. When you have documentation on how to get the drive/directory I need to put LOGO.SYS in, please tell me. I want to know it and it has to be proof for every situation with win95/winNT.

Please, help me out,

LVL 39
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Let me understand

* You are making a Vb Program that must be able to change the logo.sys file located into the windows dir of some drive that could be in any hard disk.
* You need to locate the file and do what it needs to, no matter if the hd is with TroubleSpace or Stacker or something else

i am right?
has olx said use the DIR command to locate the logo.sys file and them change it.
In any pc system the boot drive is c: allways, no matter how many drives or partitions you have.  If your app is a win app (i am sure it is) you can get the windows system directory with no problems at all.  

Big Business Goals? Which KPIs Will Help You

The most successful MSPs rely on metrics – known as key performance indicators (KPIs) – for making informed decisions that help their businesses thrive, rather than just survive. This eBook provides an overview of the most important KPIs used by top MSPs.

abelAuthor Commented:
Sorry, but what you say is partly true. It is possible to create another bootdrive then C:. I know, because I've tried it. With dblspace it's a little bit different. Dblspace creates a huge file with it's own structure in the bootdrive. It acts H: (or another drive) is your boot and c: is your logical working drive, and windows' startup-logo (usually in c:) is now in H:(not really off course, but when your computer has booted, it is). So far so good. I can trace down the H:-drive (even when it has another driveletter). With more REAL logical drives it's more difficult. I don't know where to find the drives then, because I haven't tested it. It's not that easy, since the place where you boot does not have to be the same place where the windows-dir is (that is tracable via GetWindowsDir).

Answer to olx: With more partitions or more drives it IS possible (quite easy actually) to have more bootdrives. The first sector will be read from c: (the master-drive), but with an optional boot-menu, you can start the rest of your boot from another drive. That is quite normal if you have Unix/Linux, (MS)DOS, Windows (95) and/or any other combination of OS's on your system.


Any answer/comment will be still welcome

Thanks for your efforts
In Windows NT: Use the SystemDrive environment string to get the drive that NT loads files from. The boot drive is always C: in Windows NT.
abelAuthor Commented:

Most computers the program will run on are Windows 95 computers. I have finally made a testcase with a D:-partition (Windows 95 on D:, C: was doublespaced and host of C: was H:). Conclusion, the way I mentioned does not work. I need to know some other way to find out the drive which should contain IO.SYS and perhaps, when there's a new logo, the startup LOGO.SYS file. The problem with doublespaced drives is that they have a IO.SYS in C: and H:. I just don't know how to figure out (in code) how to get the real bootdir I need for LOGO.SYS.
On Windows NT I will try the proposal of y96andha, although I'm not certain that the boodrive is ALWAYS C:. Theoratically and practically it's possible to have a multiple/dual boot-system, even with NT. That means that the drive after the first startup will change and the boot continues on another drive. I know a few systems which have a dual boot, but I don't have permission to use them, so I can't test things there. I will continue trying to find it on my own system by reconfiguring the partition table, but that takes a lot of time.
If someone knows or hears a solution I will be very thankfull!


the comspec environment var points to the command shell processor, it maybe helps you.  Normally (people not running special configurations like you said with dual boot)

¿Is there a problem if you check en c:\ d:\ e:\ f:\ g:\ h:\ for this file?
¿Is there the posibility to put an option saying "DEAR USER, PLEASE INDICATE YOUR BOOT DRIVE: _____ "? (while you get the answer to do this via code)

Check the following in the Registry:

My Coumputer\HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Setup

Key:  BootDir = "C:\"

This should get the Boot Drive For you!

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
abelAuthor Commented:
I've tried to find some documentation of that key in "Special Ed. Using the Windows 95 Registry" by J. Honeycutt (which is - I think - one of the most comprehensive databases about the Registry) but found little usefull information. I've tried it a few times, and it seems to work! I'm not completely sure since the documentation is so short about it. I've tried it with quite unusual configurations and it still works. So, many thanks to you, Tward. I greatly appreciate this one since it seems to be the absolute booting dir (so far). When it won't work, I'll fire my question again, but I think we're finally on the right way to go.

Thanks again.

It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic Classic

From novice to tech pro — start learning today.