comctrl6
comctrl6

Reputation:

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.

Upvotes: 8

Views: 24900

Answers (5)

malhal
malhal

Reputation: 30754

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.

enter image description here

Upvotes: 1

Louis Gerbarg
Louis Gerbarg

Reputation: 43462

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.

Upvotes: 2

Jens Ayton
Jens Ayton

Reputation: 14558

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.

Upvotes: 0

Brian Webster
Brian Webster

Reputation: 12055

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

Upvotes: 7

Timothy Walters
Timothy Walters

Reputation: 16884

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.

Upvotes: 1

Related Questions