Jacek777

Code Snippet
This is code from your sample aplication (C:\Program Files\Microsoft SDKs\Windows\v6.0\Samples\WinBase\imapi\imapi2sample). I get 2 errors:

Code Snippet

[...]
hr = image->put_MultisessionInterfaces(multiSession); // return IMAPI_E_NO_COMPATIBLE_MULTISESSION_TYPE
if (FAILED(hr))
{
printf("Failed image->put_MultisessionInterfaces\n");
PrintHR(hr);
if (multiSession != NULL)
{
SafeArrayDestroy(multiSession);
}
}
multiSession = NULL;
}

hr = image->ImportFileSystem(&fileSystems); // return IMAPI_E_MULTISESSION_NOT_SET
[...]


What should do I. I want detect first error (it's trivial), cal something to avoid second error. But I dont known what to call.


Re: Optical Platform Discussion error IMAPI_E_MULTISESSION_NOT_SET

Garrett - MSFT

Hello Jacek777,

The real issue here is the first error, which is causing the MultisessionInterfaces property to never get set properly. This property must be set before you can do an import, or the filesystem doesn't know exactly how to do the import or format the output!

The interesting part is where are you getting the multiSession variable from that you are attempting to 'put' into this property It should be coming from an IDiscFormat2Data interface. Is that where you are getting it from

Please let me know if this helps fix your problem or if you still encounter any errors...

thanks,

Garrett Jacobson

SDE, Optical Platform Group






Re: Optical Platform Discussion error IMAPI_E_MULTISESSION_NOT_SET

Jacek777

Yes, I getting multiSession variable from IDiscFormat2Data interface, but value seems be wrong.

Code Snippet

[...]
IDiscFormat2Data* dataWriter = NULL;
[...]
// ImportFileSystem - Import file data from disc
if (SUCCEEDED(hr))
{
FsiFileSystems fileSystems;
SAFEARRAY* multiSession = NULL;

// Get mutlisession interface to set in image
if (SUCCEEDED(hr))
{
hr = dataWriter->get_MultisessionInterfaces(&multiSession);

if (FAILED(hr))
{
printf("Failed dataWriter->MultisessionInterfaces\n");
PrintHR(hr);
}
}

// Set the multisession interface in the image
if (SUCCEEDED(hr))
{
hr = image->put_MultisessionInterfaces(multiSession); // error
if (FAILED(hr))
{
printf("Failed image->put_MultisessionInterfaces\n");
PrintHR(hr);
if (multiSession != NULL)
{
SafeArrayDestroy(multiSession);
}
}
multiSession = NULL;
}

hr = image->ImportFileSystem(&fileSystems); // error
if (FAILED(hr))
{
if (hr == IMAPI_E_EMPTY_DISC)
{
printf("Empty Disc\n");
hr = S_OK;
}
else
{
printf("Failed to ImportFileSystem\n");
PrintHR(hr);
}
}
}






Re: Optical Platform Discussion error IMAPI_E_MULTISESSION_NOT_SET

David Burg - MSFT

Could it be that you are using rewritable DVD or dual layer DVD on whose IMAPI2 does not support multi-session




Re: Optical Platform Discussion error IMAPI_E_MULTISESSION_NOT_SET

Jacek777

I use DVD+RW (EMTEC 4,7GB// 120min// 1-4x).

Jacek




Re: Optical Platform Discussion error IMAPI_E_MULTISESSION_NOT_SET

David Burg - MSFT

IMAPI2 does not support currently multi-session on rewritable DVDs, including DVD+RW, DVD-RW, DVD-RAM. Hence the failure of no compatible multi-session earlier in this thread. You should use CD-R, CD-RW, single layer DVD-R, or single layer DVD+R if you want to use multi-session.




Re: Optical Platform Discussion error IMAPI_E_MULTISESSION_NOT_SET

Jacek777

Ok I try DVD-R (Verbatim 16x// 4,7gb// 120min) and CD-RW(Esperanza 12x// 700mb// 80min) but still errors occurs (and whole operation failed).




Re: Optical Platform Discussion error IMAPI_E_MULTISESSION_NOT_SET

David Burg - MSFT

Could you specifically say which error Where your discs blank or did they contain previous session(s)






Re: Optical Platform Discussion error IMAPI_E_MULTISESSION_NOT_SET

Jacek777

My discs are blank. Errors are: IMAPI_E_IMPORT_SEEK_FAILURE and IMAPI_E_MULTISESSION_NOT_SET

// ImportFileSystem - Import file data from disc
if (SUCCEEDED(hr))
{
FsiFileSystems fileSystems;
SAFEARRAY* multiSession = NULL;

// Get mutlisession interface to set in image
if (SUCCEEDED(hr))
{
hr = dataWriter->get_MultisessionInterfaces(&multiSession);

if (FAILED(hr))
{
m_LastError = "Failed dataWriter->MultisessionInterfaces\n";
}
}

// Set the multisession interface in the image
if (SUCCEEDED(hr))
{
hr = m_Image->put_MultisessionInterfaces(multiSession); // error:IMAPI_E_IMPORT_SEEK_FAILURE


if (FAILED(hr))
{
m_LastError = "Failed image->put_MultisessionInterfaces\n";
if (multiSession != NULL)
{
SafeArrayDestroy(multiSession);
}
}
multiSession = NULL;
}

hr = m_Image->ImportFileSystem(&fileSystems); // error:IMAPI_E_MULTISESSION_NOT_SET
if (FAILED(hr))
{
if (hr == IMAPI_E_EMPTY_DISC)
{
m_LastError = "Empty Disc\n";
hr = S_OK;
}
else
{
m_LastError = "Failed to ImportFileSystem\n";
}
}
}




Re: Optical Platform Discussion error IMAPI_E_MULTISESSION_NOT_SET

David Burg - MSFT

Yes, you cannot import from blank disc. IMAPI_E_IMPORT_SEEK_FAILURE is the clumsy way IMAPI tells the disc is blank and it thus can't import the previous session. It is a known bug that put_MultisessionInterfaces returns IMAPI_E_IMPORT_SEEK_FAILURE for blank instead of succeeded (and letting ImportFileSystem fail instead). We are fixing this issue for the next major release of IMAPI, however in the mean time you will need to workaround the flaw by checking for the IMAPI_E_IMPORT_SEEK_FAILURE error code. I apologize for the inconvenience this created for you.




Re: Optical Platform Discussion error IMAPI_E_MULTISESSION_NOT_SET

Jacek777

So, there is any way to write multisesion disk I disable above code, write first sesion, enable this code, and try write second sesion, then E_IMAPI_DF2DATA_INVALID_MEDIA_STATE occurs in function

[...]
IDiscFormat2Data* dataWriter = NULL;
[...]
LONG value = 0;
hr = dataWriter->get_StartAddressOfPreviousSession(&value);
[...]

I use CD-RW (MediaStore 700mb// 80min// 12x) this time.




Re: Optical Platform Discussion error IMAPI_E_MULTISESSION_NOT_SET

Garrett - MSFT

Hello Jacek777,

That should work just fine. Please use the get_CurrentMediaStatus to determine what IMAPIv2 thinks is the current media state and we should be able to help identify why it thinks it is not in a valid state for multi-session. Is there a chance you finalized the disc during the first burn

The media state will tell us what state the disc is in and why the API is failing though....

thanks,

garrett jacobson

sde, optical platform group






Re: Optical Platform Discussion error IMAPI_E_MULTISESSION_NOT_SET

Jacek777

get_CurrentMediaStatus return (0x4800) IMAPI_FORMAT2_DATA_MEDIA_STATE_FINALIZED and IMAPI_FORMAT2_DATA_MEDIA_STATE_ERASE_REQUIRED. I dont known how this disk is finalized (my code is modified sample app C:\Program Files\Microsoft SDKs\Windows\v6.0\Samples\WinBase\imapi\imapi2sample).




Re: Optical Platform Discussion error IMAPI_E_MULTISESSION_NOT_SET

David Burg - MSFT

imapi2sample does have the -close command line parameter that will close/finalize the disc. You might have provided this parameter or your code modification might enable that section of code.




Re: Optical Platform Discussion error IMAPI_E_MULTISESSION_NOT_SET

Brooks Brown

I don't think that's what's going here. The problem is that the multisession interfaces don't get set on the IFileSystemImage instance, so Jacek777 is not able to burn a CD that will accept multiple sessions. If you handle the error and go ahead with the burn, you won't be able to append any more data to the CD.