1

I am using the IShellFolder interface to enumermate the Shell namespace objects. Doing this I am getting my mapped network drives, of which some are connected and available and others are not.

I would to know how I can detect whether or not a particular mapped drive is available. Is there some method, shell function or attribute that I can use?

I am using IShellFolder.GetAttributesOf() method to get various attributes on the drive, but do not see anything there that would indicate this.

Elan
  • 6,084
  • 12
  • 64
  • 84

1 Answers1

1

If a mapped drive is disconnected it will not appear in the bitmask returned by the GetLogicalDrives function.

For example,

wchar_t wchDriveLetter = L'P'; // example
int iDriveNumber = towupper(wchDriveLetter) - L'A';
bool fIsDisconnected = ( GetLogicalDrives() & ( 1 << iDriveNumber ) ) == 0;
Jonathan Potter
  • 36,172
  • 4
  • 64
  • 79