Skip to main content

 none
IMAPI v2 HRESULT E_FAIL When Calling MsftDiscFormat2Data.Write() API RRS feed

  • Question

  • Hey, 

    I am writing DVD-Rs on Windows 7 using the MsftDiscFormat2Data Write() API. The API on occasion (once every 20 times or so) returns a HRESULT E_FAIL halfway through burning and no other indication of what went wrong. Retrying to burn the same content onto the next disc of the same type succeeds. I am confident there is nothing wrong on our code side and the same discs using the same burner with other burning APIs haven't displayed the same error rate. Any ideas on what could be causing this error?

    The MSDN source just states E_FAIL to be an "Unspecified failure" and isn't helpful in my case. Is there some way of predicting the error or even some discussion around it would be appreciated? Has anyone else encountered something similar?

    I am validating the discs and the writer beforehand and I have attached a snippet leading up to the error
                try
                {
                    var mediaFileImage = new IMAPI2FS.MsftFileSystemImage();
                    var fsRecord = _recorder as IMAPI2FS.IDiscRecorder2;
                    mediaFileImage.ChooseImageDefaults(fsRecord);
    
                    //_writer is an instance of MsftDiscFormat2Data initialized properly
                    dynamic writer = _writer;
                    var progressUpdateHandler = new DDiscFormat2DataEvents_UpdateEventHandler(ProgressUpdate);
                    writer.Update += progressUpdateHandler;
    
                    //Set file system format to ISO9660/Joliet as required.
                    mediaFileImage.FileSystemsToCreate = IMAPI2FS.FsiFileSystems.FsiFileSystemISO9660 + (int)IMAPI2FS.FsiFileSystems.FsiFileSystemJoliet;
    
                    mediaFileImage.Root.AddTree(sourcePath, false);
                    var outputStream = mediaFileImage.CreateResultImage().ImageStream as IStream;
    
                    writer.Write(outputStream);
                }
                catch (Exception e)
                {
                    return new MediaResult { Status = false, Message = e.Message };
                }

    • Edited by theOneAm Wednesday, October 10, 2018 1:04 AM
    Wednesday, October 10, 2018 12:56 AM