I'm trying to finalize a Live File System (or "Live UDF") optical disc in C#. From what I understand from reading MSDN and TechNet articles along with various forum postings, the Image Mastering API (or IMAPI) does not support this type of filesystem, and in my coding efforts I have been unsuccessful at finalizing a LiveUDF disc using IMAPI. As a result, I'm using the DeviceIoControl function using the FSCTL_MAKE_MEDIA_COMPATIBLE control code.
First, I was calling DeviceIoControl synchronously but the function would return 1117 and the disc would eventually become finalized minutes later. This outcome is unacceptable as I need the process to return only upon ultimate failure or actual success.
Next, I moved on to calling DeviceIoControl asynchronously by opening the device handle with CreateFile with the FILE_FLAG_OVERLAPPED (0x40000000) dwFlagsAndAttributes flag and passing a NativeOverlapped object to the DeviceIoControl call. Before that, obviously, I set up a IOCompletionCallback to handle any Overlapped events.
With calling DeviceIoControl asynchronously as described, it still returns 1117 almost immediately (as it does when called synchronously), the IOCompletionCallback method is never invoked and the disc becomes finalized minutes later.
My question is: How do I finalized a Live File System (or "Live UDF") optical disc in C# on the Windows 7 platform using C# and DeviceIoControl (either synchronously or asynchronously, with the ability to "wait" for its process to complete to capture the ultimate success or failure result)?
Much thanks in advance.