Disable All I/O Ports on a Windows PC Using C?
Is 开发者_StackOverflowit possible to disable all the I/O ports of the Windows PC my program is running on? If so, can that be done using C?
The goal is that the user should not be able to interact with the PC through any path except for the network card while my program is running.
I doubt it's possible, and if it was you wouldn't want to do it anyway. First of, quite a few I/O ports are used for communication within the computer itself, so if you could disable them all, the computer would quickly quit working. The network adapter normally uses at least a couple, so if you did it, the network would quit working anyway.
There are also (at least potentially) memory mapped peripherals anyway, so it wouldn't necessarily be effective -- other than the minor detail that the computer would almost certainly quit working until it was restarted, at which point the user would swear at you as he removed your software from his machine and vowed to never again use anything you developed.
I don't see it now, but wasn't something about "blatantly offensive" once one of the reasons for voting to close a question? I'm not sure this qualifies, but it seems pretty close...
No. I/O ports are controlled by drivers, not programs.
Also, please note that the concept of "I/O ports" is not black and white. Is the USB bus an I/O port? Is the PCI-e bus? HDMI? And if you could shut down the USB bus, how's an USB WiFi network interface going to work?
精彩评论