How can I hide the removable drive e.g. flash memory from the user in the MS Windows explorer ?
I want to hide the removable drive from the user and then do some operation on that e.g. delete some files or read some files from that and then show the drive to the user .
I was try to block the drive but when it become blocked I can't do any operations on it so I changed my approach to only hide the drive from the user .
I must do this with pure c and win32 api if needed .
Thanks a lot , good luck .
Asked
Active
Viewed 463 times
2

user31587
- 145
- 1
- 9
-
Are you looking to hide a specific drive letter, *any* removable drive, or a specific USB ID? – Kevin Richardson Apr 13 '13 at 16:21
-
@ Kevin Richardson , specific drive letter is better approach for me :) . thanks a lot for your help . – user31587 Apr 13 '13 at 16:28
-
@ David Heffernan , would you please give me some tutorial ? thanks a lot for your help . – user31587 Apr 13 '13 at 17:21
-
1Is that all you want to do? Unmap a drive. I ask because I could imagine the question morphing into, "How do I detect when a drive was inserted?" "How do I block a user mapping the drive?" And so on. Also, what's the purpose of doing this? It might help if you gave us some context. – David Heffernan Apr 13 '13 at 18:32
-
@ David Heffernan , i want to hide the removable drive from the user and then do some operation on that e.g. delete some files or read some files from that and then show the drive to the user . i try to block the drive but when it become blocked i can't do any operations on it so i changed my approach to only hide the drive from the user . thanks a lot for your help . – user31587 Apr 13 '13 at 18:41
-
The typical way to hide specific drive letters is via the registry, shown here: http://support.microsoft.com/kb/555438 – Kevin Richardson Apr 13 '13 at 19:48
-
However, I'm not sure it will provide the sort of quick hide/show functionality you're seeking. – Kevin Richardson Apr 13 '13 at 19:49
-
@ Kevin Richardson , but editing the registry need system restart unfortunately . thanks a lot for your help . – user31587 Apr 13 '13 at 19:58
-
@user52005 Why don't you describe your actual problem in the question? You've probably hit on the wrong solution. Long term, best is to get the right solution. – David Heffernan Apr 13 '13 at 21:54
1 Answers
0
It should be pretty simple. There's a registry entry that is a 32 bit number that has a 1 in place where a drive should be shown. If you can extract the drive letter that you want, it should be as easy as then just editing this registry entry (which can be done with winapi i believe).
Above is the winapi functions for editing registry. Just change it to hide the drive after extracting the letter.
Then edit this value:
http://www.howtogeek.com/howto/windows-vista/hide-drives-from-your-computer-in-windows-vista/
And then change the registry value again to show the drive. You don't want to unmap the drive, because that's a different concept than hiding the drive.

KrisSodroski
- 2,796
- 3
- 24
- 39