-1

I would like to create a functionality for hiding a device, such as a DISK ON KEY, under explorer (for instance making E drive invisible).

I should emphasize I only want to HIDE the device (or drive letter) under my computer, and not entirely unmount it. just so the user does not see it.

How do I programmatically do this, without forcing a restart or killing explorer for the change to take effect?

RanH
  • 740
  • 1
  • 11
  • 31

3 Answers3

2

You can hide a drive in the explorer using this registry value: NoDrives. However it will be accessible if someone types its drive letter.

Sergey Podobry
  • 7,101
  • 1
  • 41
  • 51
  • i tried that (manually adding the reg key) and it didn't seem to work. does it work on windows 7? 8? anything else needs to be done to enable it? I will also try windows tool that does it – RanH Jan 30 '14 at 07:21
  • Did you restart the explorer? I tried it on Windows 7 and it worked. – Sergey Podobry Jan 30 '14 at 15:52
  • This hides drive D: [HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Policies\Explorer] "NoDrives"=dword:00000008 – Sergey Podobry Jan 30 '14 at 15:52
  • Thanks Sergey, it does indeed work well. yet, I would like an option that does not require restarting the computer (or killing explorer). I should have stated that. – RanH Feb 02 '14 at 07:52
2

The easiest solution is to unassign the drive letter: DeleteVolumeMountPoint("E:\").

MSalters
  • 173,980
  • 10
  • 155
  • 350
  • Thanks, this is useful indeed, yet it makes the drive entirely inaccessible. any idea for how to simply hide the volume under my computer? (without restart or killing explorer) – RanH Feb 04 '14 at 11:38
0

You can have fine-grain control over access to the disks using a filter driver. You can write a minifilter yourself or there exist solutions such as our CallbackFilter that let you implement your business logic in user mode.

Eugene Mayevski 'Callback
  • 45,135
  • 8
  • 71
  • 121
  • Thanks for the filter-driver reference, yet That does not answer my question of how to hide a device exactly. – RanH Feb 02 '14 at 07:55
  • @antisane I was answering the "how to make it inaccessible" part. – Eugene Mayevski 'Callback Feb 02 '14 at 08:12
  • @antisane BTW what kind of blocking do you need? Do you want the drive to be inaccessible only to explorer or accessible only to particular application(s) or ...? – Eugene Mayevski 'Callback Feb 02 '14 at 08:15
  • I would like to make the drive invisible to the user. I have a driver that uses it so making it fully inaccessibly is no good. I just don't want the user NOT to see it (at least not under My Computer) – RanH Feb 03 '14 at 07:22
  • @antisane You see, processes work under user account so it's not easy to distinguish between "visible to user" and "visible to process". Windows kernel doesn't expect the device to be invisible to some processes. So I don't clearly see, how such task can be solved. Yes you can hide the drive letter from Explorer but there exist other file managers as well. – Eugene Mayevski 'Callback Feb 03 '14 at 10:34