1

I have tried to disable com port by using

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
);

but doesn't work in 64 bit pc.

Is there any other solution to disable com port in 64 bit?

Alok Sharma
  • 85
  • 1
  • 5

1 Answers1

0

Eugh. Don't do this. Use SetupDiSetClassInstallParams or WMI + devcon or really anything other than editing the registry!

But to use registry you need to specify RegistryView.Registry64, or clear the Prefer 32 bit flag in the project properties

Community
  • 1
  • 1
Mitch
  • 21,223
  • 6
  • 63
  • 86
  • Is there any programminmg way we can disablecom port in 64 bit. If i would like to use registry how i will do that. – Alok Sharma Apr 04 '16 at 07:14