I encountered and partially fixed a problem with hdiutil (and the tools
that rely upon it, like DiskCopy and mounting a CD-R), DiskImages
plug-ins, and Virtual PC. I couldn't find any references to it on the
Net, so I thought I'd post my experiences to see if anyone else can add
to my understanding. (Or maybe someone else has the same problem and
hasn't figured it out yet).

The symptoms were these: whenever I would insert a blank CD-R or
attempt to mount a .DMG file (by double-clicking it), it would fail. In
the case of mounting a CD-R, the crash log read, in part:

Command: hdiutil
PID: 580

Exception: EXC_BAD_ACCESS (0x0001)
Codes: KERN_INVALID_ADDRESS (0x0001) at 0x0016f7e0

Thread 0 Crashed:
#0 0x0016f7e0 in 0x16f7e0
#1 0x0016f654 in 0x16f654
#2 0x95ac78fc in DIUnloadCFPlugIns
#3 0x95ac990c in CCFPlugInDiskImage::copyPropertiesDict()
#4 0x95ac1da4 in DIInitialize

(I also got a type 11 error, which is often associated with a hardware
failure)

In the case of trying to mount a .DMG file, I got, in part:

Command: Disk Copy
PID: 739

Exception: EXC_BAD_ACCESS (0x0001)
Codes: KERN_INVALID_ADDRESS (0x0001) at 0x0026a7e0

Thread 0 Crashed:
#0 0x0026a7e0 in 0x26a7e0
#1 0x0026a654 in 0x26a654
#2 0x95ac78fc in DIUnloadCFPlugIns
#3 0x95ac990c in CCFPlugInDiskImage::copyPropertiesDict()
#4 0x95ac1da4 in DIInitialize


I knew it wasn't a hardware error, because I could do these operations
in a different account on the same machine. It must have been something
about my account config.

I started playing around with hdiutil -debug. In the accounts where it
worked, hdiutil -debug produced tons of output. In the account where it
failed, it didn't produce a single line of output, just "segmentation
fault" and the crash log.

To make a long story short, I started trying to trace the work of
hdiutil. By watching the debug output in the account where things
worked, I knew that hdiutil was looking in
/Library/Plug-ins/DiskImages/VirtualPCDiskImagePlugin.bundle/ for the
Virtual PC disk image plug-in. Then the man page said it also looked in
~/Library/Plug-ins. When I looked THERE, I found another, apparently
identical, copy of the Virtual PC Disk Image plugin (that is, identical
to the version in /Library). When I moved THAT folder (the one in
~/Library) out of the way, things started working again.

But then I started up VirtualPC to see if it still worked, and it did.
But THEN, mounting images started to fail again. Virtual PC had created
a whole new version of the DiskImage plugin in ~/Library. Again, moving
it out of the way helped.

So, some questions.

Does anyone know why having multiple identical (?) version of a
diskimage plugin in two different locations would cause such a hard
failure? hdiutil seemed totally unprepared for it, as did Disk Copy.
Judging by the Crash Logs, the offending code is in
DIInitialize->CCFPlugInDiskImage::copyPropertiesDict()->
DIUnloadCFPlugIns, which they both appear to use.

Does anyone know why Virtual PC recreated the diskimage plugin?

Does anyone know how to prevent this problem in a more sustainable way?

MacOS X is in nearly all ways better than Mac OS 9, but they've
generally taken a step backwars it seems when it comes to applications
checking return values and things like that.

I don't read this forum closely, so I'd appreciate an email response if
you are so inclined.

Thanks much for any assistance.

Shawn