Click here to Skip to main content
Sign Up to vote bad
good
Hello
I am doing computer engineering and i needed some guidance
regarding my project.
1st of all i want to know whether it is possible to disable usb ports
and CD rom "POWER" through VC++.
If yes then could you please guide me on it?
Thanks
Posted 22 Aug '08 - 2:09

Comments
Pranit Kothari - 16 Dec '11 - 10:07
All solutions I have seen here are OK! (Just OK!), because user (like us) can easily manipulate registry. If you are playing with Power User, s/he will beat you!

5 solutions

I don't know about removing power but you can lock volumes with DeviceIoControl() with the FSCTL_LOCK_VOLUME which means that your process has exclusive access to that volume. Take a look at the documentation here. You could do this with the CD drive.

You can disable USB ports from the registry (which can be done programatically); take a look at this article for more info.

Hope this helps,
--Perspx

  Permalink  
Comments
Pranit Kothari - 16 Dec '11 - 10:08
DeviceIoControl solution is good my 5! But other is easy to hack.
ameyakoshti wrote:
1st of all i want to know whether it is possible to disable usb ports


To disable USB ports, check this[^]. You have to programatically access the registry and set the key.

ameyakoshti wrote:
and CD rom "POWER" through VC++.

I hope someone else will shed light on this. [rolleyes]

Regards,
Jijo.

  Permalink  
  Permalink  
Comments
Pranit Kothari - 16 Dec '11 - 10:07
Modifying register is simple, so anyone can do this.
I found a way to disable the CD ROM using regedit. Now I am not sure how you can use it in VC++ but you can atleast havea look at the way of disabling it through regedit
 
To Disable CD-Rom
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\CDRom
Double Click on AutoRun and change the value to 0
This will stop it from automatically starting.
If you double click on start and change the Value to 0, it should disable it.
 

Also I found the following link where there is a discussion and a zip file which explains how to disable CD ROM using VB.NET. Ma be that will also of some help.
 
http://jo0ls-dotnet-stuff.blogspot.com/2009/01/enabledisable-device-programmatically.html[^]
 
Hope this was helpful.
 
--
AJ
  Permalink  
//Disable Usb in c# 
Microsoft.Win32.Registry.SetValue(@"HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\USBSTOR", "Start", 4, Microsoft.Win32.RegistryValueKind.DWord);
 
//enable USB storage...in c#
Microsoft.Win32.Registry.SetValue(@"HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\USBSTOR", "Start", 3, Microsoft.Win32.RegistryValueKind.DWord);
  Permalink  
Comments
Wes Aday - 17 Jul '12 - 9:55
Do you seriously think that the OP has been waiting for 4 years when the question has already been answered?
  Print Answers RSS
Your Filters
Interested
Ignored
     
0 Sergey Alexandrovich Kryukov 8,356
1 OriginalGriff 6,571
2 CPallini 3,533
3 Rohan Leuva 2,703
4 Maciej Los 2,234


Advertise | Privacy | Mobile
Web04 | 2.6.130516.1 | Last Updated 17 Jul 2012
Copyright © CodeProject, 1999-2013
All Rights Reserved. Terms of Use
Layout: fixed | fluid