Billy Pilgrim
Billy Pilgrim

Reputation: 1852

Boost Filesystem -- enumerating devices?

All,

I am trying to write a cross platform (hence: boost) method/function that will enumerate all of the storage devices on a system. From what I have found, the Boost docs mention multiple root file systems, but does not elaborate on how to handle them. I assume that a Windows machine with a hard disk, CD/DVD drive, a USB drive, etc, would be considered a 'multiple root system' -- correct? If not, what is the root?

I assume that in Linux, there is a single root (e.g., /dev), but I'm not sure how to do it for a multi-root system (e.g., Window) using Boost. Is there a Boost method to enumerate devices?

Help?

Thank you very much,

:bp:

Upvotes: 0

Views: 665

Answers (1)

user541686
user541686

Reputation: 210705

Windows is a single-root system, rooted at \, but they're not "file" systems -- they're other kinds of objects. (Devices, drivers, files, directories, object types, events, mutants, event pairs, window stations, security tokens, semaphores, timers, sessions, memory sections, ...)

(See WinObj.)

I don't think there's any Boost method for enumerating these, since people frown at you if you use the native NT API. (The Win32 subsystem doesn't expose these; it only exposes the \??\ directory.) Nevertheless, you can use functions like NtOpenDirectoryObject to enumerate these.

Upvotes: 1

Related Questions