Create fake flash drive programmatically - windows

I want to create a fake flash drive programmatically under Mac OSX and Windows.
It should behave like a normal drive, that means it should appear in explorer/finder, should be unmountable,.. If someone puts some data in it, it should be handled in a backend software.
Is that possible?

I'm not aware of any existing cross-platform frameworks. For Windows, the documentation for writing device drivers is here: http://msdn.microsoft.com/en-us/library/ff557573. See also http://msdn.microsoft.com/en-us/windows/hardware/gg463062 but note that this is hard-core stuff.

Related

Add various multiboot options just like WinPE by Strelec on flash drive

So I've been wanting to put a windows 10 ISO on my flash drive, but I have WinPe by strelec already on it. I don't know how I can a windows installer on top of it and I don't even know if that's even possible at all... Please send help I'm a newbie when it comes to software
Unfortunately no, it is not possible to have multiple bootable OSes if something is already present, (at least to the extent of my knowledge) but if you'd like to dualboot on a clean USB drive, (erase your existing one, even) there exist several tools that can do that, such as Easyboot, syslinux, or even grub4dos. Some other helpful resources can also be found at Reboot.pro. However, if you are currently running Windows, I recommend WinSetupFromUSB as an easy way to get a multiboot USB drive going.
Yes It's possible just use ventoy and You can have multiple ISO's in the same usb, boot from USB and choose the want to boot, https: //www.ventoy.net/

Is there any way Not to detect USB from windows PC?

Is there any way Not to detect USB from windows PC?
The USB device should not mount on windows PC ,It should be handled by my application..
Suggestions please...
As far as I know there is no way of stopping the mount on the windows PC, however, you could set it up to autorun so that when it is plugged it in attempts to launch your application. This answer has some information on how to do this: https://stackoverflow.com/a/255067
There is also the option to hide a drive in windows by removing is drive letter (http://www.howtogeek.com/97203/how-to-hide-a-drive-in-windows-so-that-no-one-will-know-its-there/) however, this is almost certainly going to stop your application from reading it too.
If this is for a specific security reason then perhaps you could look at encrypting the drive and allowing only the application to decrypt the data. Thus, whilst mounted in windows it will be of little use.
Sorry I couldn't be of much more help.
Microsoft provides a utility called devcon for free download.
It's a "Command Line Uility Alternative to Device Manager".
It can actually do many things that I won't get into here, but removing a plug & play device is a simple operation once you know the unique name of the device you want to manipulate.
Refer this to check how to work with it.
It sounds like you don't want your device to show up as a drive in My Computer. In that case, why are you using the Mass Storage Device class at all? You could make a custom, vendor-specific device and talk to it using control/interrupt/bulk transfers with WinUSB. You would need to change the Device's USB descriptors to indicate it is a vendor-specific device and not a mass-storage device.

Gamepad and joystick support on Mac OS X in user space

I have been searching through how to do gamepad and joystick support on Mac for some days and all resources that I found seems to suggest a pre-installed driver along with using Apple's HID API, which works.
The drawback about this approach is that each joystick and gamepad will require another kernel extension to be loaded, so it can be recognized by HID manager, or at least a code less Info.plist saying it conforms to the earlier installed driver. For instance, when I have an 360 Xbox driver KEXT in house, the Xbox controller from Microsoft will work, but not the Logitech one (I tried F710).
As Apple suggests the application that uses a gamepad or joystick should be able to do themselves at user space without introducing any KEXT stuff. Is there a way to do it?
The thing I had in mind was something like using IORegistry or IOUSB API to get the device when they get plugged in (USB Prober shows it at least). Then somehow get the description of the device, then use that description to register the device as a HID one. Then the whole HID manager can be used.
Am I on the right track? Or is there any other way to do this?
Since IOKit API actually provided keywords like kHIDUsage_GD_Joystick, and there's an ForceFeedback.h library, I suppose Apple designed their HID API with joystick and force feedback in mind. That's the slim hope I had that this might work.
Some reference documentation and open source project:
Colin Munro's 360 driver
HID API Documents
DDHID Project
After revisiting this, I found out the solution to be operating directly on the file descriptors of the device. libusb is an excellent library which greatly simplify your life on this and they have Mac supported.
xboxdrv link is a great example on how to operate on file socket using libusb.
In pseudo code, it should look like this:
enumerate device
detect kernel driver and detach it if possible
open device
file off a initial transfer
wait on the callback function to handle msg and error properly
start run loop or select on fd to call libusb_event_handle
Check libusb for more info link.

How would I go about implementing an OSX (desktop) Core Location provider?

I want to use Mac OSX for a location application, but want to provide fake location data (via a GPS log file). How would I go about implementing this? I've looked at http://developer.apple.com/library/mac/#documentation/CoreLocation/Reference/CoreLocation_Framework/index.html but it only talks about USING the framework, not about how it gets its location information. I've implemented location providers for the Android platform, but seen nothing so far about core location.
There is clearly an interface for it: if it is copied from iOS I know there is a super-secret Bluetooth GPS protocol to provide location information from GPS devices (there is at least one device that does so) and I expect a similar hook is somewhere in OSX.
Thanks.

How to create virtual CD drive on Mac OS X

How does one go about creating a virtual CD driver on Mac OS X programatically?
I can't find any relevant Cocoa APIs or any pure C BSD solutions.
Any help or information is appreciated.
You would need to use the I/O Kit framework to develop your own device driver that would emulate a virtual CD drive. Here are some links to the relevant APIs to get you started.
I/O Kit Fundamentals
I/O Kit Device Driver Guidelines
Kernel Extension Programming Topics
There are several different answers people have proposed here. The issue at hand is what are you trying to accomplish. If you really want to emulate a CD ROM (down to the commandset) you will need to write a device driver. If your goal is merely to emulate a block device with contents similiar to a CD you can create a disk image using disk utility and let the builtin disk image driver handle it for you.
MacFUSE is useful if you want to present some sort of custom filesystem functionality, but if what you are looking for is something that has the same semantics as an optical disc (whether that is and block or command set level) it is the wrong tool.
If you're simply looking to mount an ISO or something then it's done through the Disk Utility, simply drag it into the side-bar and then select it and choose mount.
If you want to do it from code you can issue the hdiutil command, as shown here. I'm not sure if there's an API call to do it, but getting that command to do the work is quite painless.
The simplest way to mount a custom volume is MacFUSE. It handles the IOKit details for you and lets you write the implementation in user space. However, I don’t think you can make a MacFUSE “look like” a CD; you’d have to modify FUSE to achieve that.
I had a nosey around DAEMON Tools for Mac's driver:
/Library/Extensions/DAEMONToolsVirtualSCSIBus.kext/Contents/MacOS/DAEMONToolsVirtualSCSIBus
I disassembled the binary using Hopper and discovered they are using
IOSCSIProtocolServices.

Resources