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.
Related
I would like to prevent malware for spreading itself to any USB devices that might connect to the system. For that I thought about an "firewall" approach based on executable names. E.g: only the process iexplorer.exe can write to a USB device, any other process is blocked.
The solution needs to work in W10 using .NET technologies.
I search on internet and I found USBFilter but only works in Linux.
https://www.usenix.org/conference/usenixsecurity16/technical-sessions/presentation/tian
for windows, I found the library http://libusb.sourceforge.net/api-1.0/ but I does not have filtering capabilities.
Does anyone know any way to achieve this goal?
First of all, yes, i have read all other similar questions.
Secondly, i am developing app (WP 8.1 WinRT), which must use Beacons. I read a lot about it, and i know, that generally connection with BLE device is not possible without pairing it first. But hope dies last, so i want to ask about any possibilities I have. It is possible to pair devices in code (according to articles I have read - its not, but maybe someone know the way)? Or just obtain nearby Beacons Id or Name, or ANY information about them? All posts i have found are outdated (from last year, maybe MS or somebody released some update/api?) I search for any kind of solution, api or just idea how to avoid pairing problem. Pairing it manually won't work - 1. not sure if it is possible to pair beacons, 2. its too many of them (beacons I need)
I look for anyway to communicate or even obtain beacons.
I would be grateful for any option or idea
While I have not tried it yet, there a developer has built an HCI layer to talk directly to bluetooth dongles on pre-Windows 10 machines. It is available here: WinBeacon
This will only work on desktop machines, and not with mobile phones. If you are interested in mobile phones with Windows 8.x, I do not believe there is any solution. I have spoken with Microsoft engineers who have confirmed this to me.
The fundamental problem with Windows 8.x on mobile devices is that any Bluetooth LE scan operation (which is what must be done to search for beacons) must be initiated by the operating system. There is no public API and no known private API that can be used to initiate a Bluetooth LE scan. Pairing with the device will not help -- it is the scan that is important and iBeacon and similar BLE beacon types do not use pairing at all for their primary proximity detection purpose.
Microsoft engineers have told me there are no plans to add this feature to 8.x, as they want to push folks to Windows 10.
While I know this does not help for Windows 8.x, I will note for the record that for the upcoming Windows 10 release, we are working on a port of the Android Beacon Library to Windows here.
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 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.
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?