TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
anurag dikshit
NA
1
2.2k
I need to disable USB Interface of the win7 64bit using c#
Feb 21 2013 5:15 AM
I need to bolck USB interface mouse and keyboard . but these ways only work for 32 bit and nothing work on 64 bit...
below is the solution which is working for 32 bit windows but not working 64 bit ... I need a same function which can do the same thing for 64 bit ....
//disable USB storage...
Microsoft.Win32.Registry.SetValue(@"HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\USBSTOR", "Start", 4, Microsoft.Win32.RegistryValueKind.DWord);
//enable USB storage...
Microsoft.Win32.Registry.SetValue(@"HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\USBSTOR", "Start", 3, Microsoft.Win32.RegistryValueKind.DWord);
// Diable/ enable keyboard and mouse
[System.Runtime.InteropServices.
DllImportAttribute
(
"user32.dll"
, EntryPoint =
"BlockInput"
)] [
return
: System.Runtime.InteropServices.
MarshalAsAttribute
(System.Runtime.InteropServices.
UnmanagedType
.Bool)]
public
static
extern
bool
BlockInput([System.Runtime.InteropServices.
MarshalAsAttribute
(System.Runtime.InteropServices.
UnmanagedType
.Bool)]
bool
fBlockIt);
i can read the value on windows 64 bit but can not write the value....
RegistryKey registryKey = RegistryKey.OpenBaseKey(Microsoft.Win32.RegistryHive.LocalMachine, RegistryView.Registry64);
Console.WriteLine("registryKey" + registryKey);
registryKey = registryKey.OpenSubKey(@"SYSTEM\CurrentControlSet\Services\USBSTOR");
Object val = registryKey.GetValue("Start");
Console.WriteLine("The val is:" + val);
here i am getting the current val which is set ...
but when i try to open in write mode...
registryKey = registryKey.OpenSubKey(@"SYSTEM\CurrentControlSet\Services\USBSTOR", true);
and try to set a value 4 to disable it cant work...
registryKey.SetValue("Start", 4);
please help me to guide me...
thanks
Reply
Answers (
0
)
Customised tooltip for asp.net imagebutton in JQuery?
How to print in EPSON Thermal Printer using C#.Net?