How do I find out if drive (possibly WITHOUT file system) exists?

T

Tony Bansten

Assume I have a partition (under WIn2000/WInXP) which is possibly NOT
formatted with a files system (e.g. NTFS). This could be a partition on an external
USB harddisc.

How do I find out if this partition exist?

Notice that "normal" program code that refers to the root directory or a file system do
not work.

The C++ or C code should use not use .NET functions.

Tony
 
W

Walter Roberson

Assume I have a partition (under WIn2000/WInXP) which is possibly NOT
formatted with a files system (e.g. NTFS). This could be a partition on an external
USB harddisc.
How do I find out if this partition exist?

The C and C++ languages do not know themselves anything about
partitions. You should ask in a Windows newsgroup.



FYI, there are some traditional approaches to this problem --
approaches which might or might not be applicable to Windows:

a) Wander through the operating system's mount table to figure out
whether the partition is -already- mounted

b) Ask the operating system to mount it for you. If the response
is that it doesn't exist, then you know it doesn't exist.
If the response is that you don't have permission to mount it,
then you need to know the OS-specific checking sequence: on
some OS's, it would be an indication that it has determined that
a filesystem is there, whereas on other OS's, it would be an
indication that you don't have enough privilege to mount -any-
filesystem.

c) Research technical details about each filesystem type you
might want to deal with. Ask the operating system to allow you raw
access to the blocks that make up the partition. Check through
the blocks, looking for the "magic numbers" that signal various
different filesystem types. Note: on Unix systems, you would
normally be disallowed access to the raw partition blocks unless
you were privileged; I don't know whether the same is true for Windows.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,576
Members
45,054
Latest member
LucyCarper

Latest Threads

Top