locked
[How TO] Determine whether a media is blank or not RRS feed

  • Question

  • The method I determine whether a media is blank is as the following code:

     

    Code Snippet
      IMAPI_FORMAT2_DATA_MEDIA_STATE value = IMAPI_FORMAT2_DATA_MEDIA_STATE_UNKNOWN;
      hr = discFormatData.GetInterface()->get_CurrentMediaStatus(&value);
      if (SUCCEEDED(hr))
      {
       if (IMAPI_FORMAT2_DATA_MEDIA_STATE_BLANK & value)
       {
        //Blank
       }
       else
       {
        // Not Blank
        
       }

     

     


    With a unused CD-R, it works well.

     

    But with a used DVD+RW, no matter I how I erased it (Nero erase, IMAPI2 full erase and unfull erase),

    (IMAPI_FORMAT2_DATA_MEDIA_STATE_BLANK & value ) always FALSE and the value = 0x00000009.

     

    Is the method wrong?

     

    Also, the erased DVD+RW (by three erase method) can't be writed by

    HRESULT hr = m_discFormatData->Write(m_streamData);
    hr returns 0xc0aa0405(E_IMAPI_DF2DATA_MEDIA_NOT_BLANK), the description is:

    Overwriting non-blank media is not allowed without the ForceOverwrite property set to VARIANT_TRUE.

    How can i make it to be blank?

     

     

    Thanks!

     

     

    Friday, June 27, 2008 5:25 AM

Answers

  • DVD+RW (and DVD-RAM, BD-RE) unlike CD-RW and DVD-RW do not support at the device level the 'erase' functionality. Instead, burning software like IMAPI and Nero that you mentionned will emulate a physical erase by writting zeroes over the file system anchor points. Then the disc will appear empty. However physically it is still formatted / different from a brand new disc. The device can't distinguish a media with data from a media with zeroes.

     

    The interface you mentioned is reflecting the device's opinion of the disc's blank status. But you should use get_MediaHeuristicallyBlank Method of the IDiscFormat2 Interface instead. This method will check not only if the disc is physically blank, it will also check for DVD+RW and alike if there is no file system anchor (in which case it will claim the disc is blank).

     

    Sunday, June 29, 2008 2:28 AM

All replies

  • It is weird.

     

    Now the HRESULT hr = m_discFormatData->Write(m_streamData); works well on the IMAPI2 unfull erased DVD+RW, while (IMAPI_FORMAT2_DATA_MEDIA_STATE_BLANK & value ) still FALSE and the value = 0x00000009.

     

    So my problem still exists: how can i dertermine whether the media is blank or not. It's every important to my program.

    Friday, June 27, 2008 9:24 AM
  • DVD+RW (and DVD-RAM, BD-RE) unlike CD-RW and DVD-RW do not support at the device level the 'erase' functionality. Instead, burning software like IMAPI and Nero that you mentionned will emulate a physical erase by writting zeroes over the file system anchor points. Then the disc will appear empty. However physically it is still formatted / different from a brand new disc. The device can't distinguish a media with data from a media with zeroes.

     

    The interface you mentioned is reflecting the device's opinion of the disc's blank status. But you should use get_MediaHeuristicallyBlank Method of the IDiscFormat2 Interface instead. This method will check not only if the disc is physically blank, it will also check for DVD+RW and alike if there is no file system anchor (in which case it will claim the disc is blank).

     

    Sunday, June 29, 2008 2:28 AM
  •  

    Thanks for your detailed reply!
    Tuesday, July 1, 2008 6:53 AM
  • Hello David,

    I have a similar problem with IMAPI 2 on Windows XP.

    I am using it for writing files on DVD+R discs successfully but IMAPI2 does not allow to to write anything at an erased DVD+RW. By erased I mean that the DVD+RW disc was first written by IMAPI2 and then erased. I can successfully write to a new unused DVD+RW, but refueses to write anyting on a unsed one, no matter how I erase it.

    I see that you suggest using get_MediaHeuristicallyBlank method to check if the disc is blank, but it also tells me that the disc is not blank. Even if I skip this check and try to write the disc directly it still fails.

    I noticed that there is no way to write on such a disc even with the integrated Windows Wizard. Am I doing something wrong or it is just impossible to write on such a disc. I would be very happy to see an example for writing to a used DVD+RW.

    Borislav
    Wednesday, July 9, 2008 7:49 AM
  • Is there anyone that can help?

    Borislav
    Wednesday, August 6, 2008 5:23 AM
  • You said: By erased I mean that the DVD+RW disc was first written by IMAPI2 and then erased.

    Did you erased the DVD+RW by IMAPI2?

    If YES, it's weird. It also happened to me at the begining. But it's OK now.

    IF NO, you must erase it by IMAPI2.

    Wednesday, August 6, 2008 6:18 AM