65.9K
CodeProject is changing. Read more.
Home

Bienz.SysInfo - System Information the .NET way

starIconstarIconstarIconstarIconstarIcon

5.00/5 (12 votes)

Jun 16, 2002

1 min read

viewsIcon

70468

downloadIcon

1414

A library that assists in gathering system information such as disk volumes, labels and even disk icons.

Sample Image Bienz.SysInfo

Preface

I have noticed other articles where users are attempting to gain access to system information available only via old Win32 APIs. Although it is easy enough to obtain this information, I have noticed it occurring rather frequently.

This library was developed to group some of these APIs and make them more accessible in the .NET way - the way I feel Microsoft should have included them in the first place.

As of the writing of this article, the only class in the library deals with storage APIs. I plan to eventually expand this library to deal with many other system APIs. Currently, Bienz.SysInfo provides access to the following information:

  • Volume Type (Removable, Fixed, Remote / Network, CD-ROM, RAMDisk, etc.)
  • Volume Label
  • Volume Serial Number
  • UNC Network Path (even if constructed from mapped drive letter)
  • Large Icon as presented by the Shell (32x32)
  • Small Icon as presented by the Shell (16x16)
  • Supporting Properties (such as SupportsCompression and SupportsEncryption)

The VolumeInfo Class

Public Static (Shared) Properties

  • CurrentVolume

Public Instance Properties

  • CaseSensitive
  • Compressed
  • Flags
  • Label
  • LargeIcon
  • MaxComponentLen
  • PersistentACLS
  • PreservesCase
  • ReadOnly
  • SerialNumber
  • SmallIcon
  • SupportsEncryption
  • SupportsFileCompression
  • SupportsNamedStreams
  • SupportsObjectIDs
  • SupportsQuotas
  • SupportsReparsePoints
  • SupportsSparseFiles
  • SupportsUnicodeOnVolume
  • UncPath
  • Uri
  • VolumeType

VolumeFlags enumeration

  • Unknown
  • CaseSensitive
  • Compressed
  • PersistentACLS
  • PreservesCase
  • ReadOnly
  • SupportsEncryption
  • SupportsFileCompression
  • SupportsNamedStreams
  • SupportsObjectIDs
  • SupportsQuotas
  • SupportsReparsePoints
  • SupportsSparseFiles
  • SupportsUnicodeOnVolume

VolumeTypes enumeration

  • Unknown
  • Invalid
  • Removable
  • Fixed
  • Remote
  • CDROM
  • RAMDisk

For an example use of this library, please check out my Bienz.UI library. Bienz.UI includes a drive drop-down control that displays all drives in the system as well as their labels and icons. The SelectedItem property of this control returns an instance of the VolumeInformation class from Bienz.SysInfo.