I am trying to make a program that when a usb is plugged into the computer it will lock the usb, so it is not accessable, and then when the user enters the correct password the usb will be accessable.
Is this possible?
Any help would be appreciated,
Thanks.
I found several articles by googling "usb policy c#". Here's the first one and it looks straightforward. The results also showed some CodeProject hits, which you can usually download and learn from.
What you are talking about is called "device control" in the security world. Commercial solutions exist in many flavours (Google it or take the question to SF/SU) but unfortunately I think it's quite complicated to implement on your own. In particular I think you would need to modify the device drivers in the USB layer, which in turn might disqualify C#. You would also need to whitelist certain devices or types of devices, for example your keyboard.
You could perhaps disable USB completely (in the BIOS for example), if it's a notebook and you don't strictly need USB for a keyboard or anything.
Use something like http://www.truecrypt.org/ - it ensures all data is inaccessible until correct password is entered.
I've noticed in other secure USB thumb drives that the encrypted, inaccessible portion is not considered a removable device (it shows up as another hard drive). The part that launches the executable to "login" to the encrypted drive is on a removable device.
FYI the device is a Imation PivotPlus.
Related
I have an application that needs different hotkeys depending on the microphone type (handheld vs headset). Right now I am checking display name, but sometimes a handheld is registered under a generic name. So, I need something more definitive, but I have searched and cannot find any way to determine this difference from Windows. Is there any API that will let me know this difference or not?
No, it's not. Consider the case that you have a mic plugged in via the 3.5mm mic port on the front of the computer, instead of a USB mic. The only thing that goes over that wire is the audio data; no metadata. It could be a headset, a handheld mic, or a line in from a record player.
You can make your best guess first (e.g. might be your current method, or just assume "headset" if that's the most common), but then you should let your user configure it to work how they want it to work. This is the only definitive way to do this "correctly".
Just a quick one, if anyone knows:
Is it possible to display a TomTom devices screen on a computer (so I can interface with it's navigation ability?)
They have an SDK, however that does not have any useful information on this question, but TomTom Home can do it - so can I? C# / C++ / Whatever.
Cheers
TomTom is running linux so you can get the raw image data from /dev/raw.
cat /dev/fb > /mnt/sdcard/screenshot.raw
on the device should do it
Then you need to transfer it to your computer (needs to be done quickly).
This should be possible to do over Bluetooth, over USB or possibly by using a Eye-Fi SD card.
I don't think it is possible to do it any other way.
Access the device by Bluetooth console
I'm messing with the idea of writing a small program to mirror output of a video capture device. If you buy a video capture device you can only use it with one program at a time because the device gets locked. Instead of buying a second capture card id like to write a program to accept input from my capture device and expose the output to other applications.
Capture Device----->Program---->Flash Media Encoder
I've never done this type of thing before. Is it device driver related? Can I make my program look like a capture device to other programs without digging in device driver dev?
If someone could point me in the right direction that would be great.
Can I make my program look like a capture device to other programs without digging in device driver dev?
-No, I'm afraid not. You'd need to do exactly that, write a driver or capture source of your own. You could make some interface to serve up image to multiple apps (what a great idea!) but then it would need to be standardised, and you'd need other companies or developers to use that interface. Again a great idea but you'd need to agree on the feature set - and each developer would likely want something new or different.
(If you are talking about particular/specific other programs, they might have a particular interface you can work with already..)
(I was also assuming you were talking about realtime video capture: if you're talking about photo capture etc, you could write an image file to disk, and then import into the other apps ... not as joined up or integrated as ideal though)
Hope that helps - not an ideal situation though!
I will not say it is impossible, but I will say it is impossible in C# because this will require you to write a device driver software which can emulate virtual capture devices which your other program can use and your program can capture actual capture device and mirror or split the data to virtual capture devices that your device driver will create.
Very much same to Virtual CD Rom Drives that we can create with some software, you will need windows device driver kit for that.
You can write combination of application, one device driver and you can have some sort of C# api or program to control the operation.
How do you query the status of all detected devices?
Where devices are USB connected hardware ( cameras, credit card readers ), PCI bus connected hardware, or hard drives. Anything that can show up as errored in the Device Manager is of interest.
WMI works, but it's pretty slow and there are a lot of moving parts to go wrong. If you need faster/more reliable access, try the SetupDI APIs (see this). pinvoke.net can get you started with the C# declarations.
While I've never tried it before, I think what you want to use is WMI: Windows Management Instrumentation. Specifically, you should look at the System.Management namespace.
Here's a tutorial I found that shows you how to query for hard drives connected to a system, and also how to query for running processes: --> http://msdn.microsoft.com/en-us/library/system.management.aspx
Let me know if this helps. I've considered using WMI before for simple windows management tasks, but I've always ended up using simple registry scripts instead.
Is there an easy way to programmatically determine the speed (or version) of a USB port? I'm looking to control the speed of data sent to a usb port based its maximum bandwidth.
If you need a solution for Windows this should be a good start:
http://msdn.microsoft.com/en-us/library/ms793313.aspx
Basically you should try this:
Enumerate the USB devices and the symbolic names to their drivers
Open a handle to the USB device driver through its symbolic name via CreateFile
Perform a DeviceIoControl on the driver handle with the control code IOCTL_USB_GET_NODE_CONNECTION_INFORMATION_EX. This will have you returned the structure USB_NODE_CONNECTION_INFORMATION_EX. There you have a member there called Speed of the type USB_DEVICE_SPEED.
(Close the driver handle)
This could also be interesting for you: CodeProject: Enumerate Properties of an Installed Device
To answer your question, I'm sure that there are ways of getting the information you need. I don't know the answer for windows, but Linux has files you can read within the sysfs directory structure.
Speed control is usually taken care of by the drivers and the hardware controlling the bus. Most modern USB controllers really have 2 controllers per port connected. 1 for the slower speed 12Mbps USB 1.0, and another for the higher pseed 480Mbps USB 2.0. There is a magic switch inside that connects it properly. The driver itself makes sure that everything is enumerated properly, controls the flow, etc. A higher level "user-space" application typically doesn't need to worry about these things.
Also, if you have a device that is capable of running at faster than 12Mbps, and you plug it into a 12Mbps port, it'll get dragged down to 12Mbps whether you like it or not. Is it that you want to know that is got dragged down?