IMAPI2: Error while importing UDF file system using ImportFileSystem

0

I am writing CD recording program, and faced with multi-session burning. The problem is the import UDF file system.

Operating system:windows 7 x64
CD media: dvd+rw
I do not have Windows Feature Pack and my os windows 7 x 64

I have a problem ImportFileSystem method, it returns an error.

VARIANT_BOOL rt=VARIANT_FALSE;
    HRESULT jj=discformatdata2->get_MediaHeuristicallyBlank(&rt);
    if (SUCCEEDED(jj))
    {
        if (rt==VARIANT_FALSE)  //multi-session
        {
            FsiFileSystems fss;
            res=image->ChooseImageDefaults(recorder2);
            if (SUCCEEDED(res))
            {
                fss=FsiFileSystems(FsiFileSystemUDF);
                res=image->put_FileSystemsToCreate(fss);
                if (SUCCEEDED(res))
                {
                    SAFEARRAY *val=NULL;
                    HRESULT ok=discformatdata2->get_MultisessionInterfaces(&val);
                    if (SUCCEEDED(ok))
                    {
                        ok=image->put_MultisessionInterfaces(val);
                        if (SUCCEEDED(ok))
                        {
                            printf("ok2\n");
                            BSTR metka;

                            ok=image->ImportFileSystem(&fss);
                            if(SUCCEEDED(ok))
                            {
                                printf("ok3\n");
                            }
                            else
                            {
                                printf("oshibkaIMPORTFIELSYSTEM=0x%08x\n\n",ok);
                                exit(0);
                            }
                            HRESULT rx=image->get_ImportedVolumeName(&metka);
                            if (!SUCCEEDED(rx))
                            {
                                printf("okkkk1\n");
                            }
                            res=image->put_VolumeName(metka);
                            if (!SUCCEEDED(res))
                            {

                                printf("okkkk2\n");
                                ok=false;
                            }

                        }
                    }
                }
            }           
        }
        if (rt==VARIANT_TRUE)   //disc empty
        {
           if (fss==IMAPI_MEDIA_TYPE_DVDPLUSRW)
           {
               res=image->ChooseImageDefaults(recorder2);
               if (SUCCEEDED(res))
               {
                   FsiFileSystems fs=FsiFileSystems(FsiFileSystemUDF);
                    res=image->put_FileSystemsToCreate(fs);
                    if (SUCCEEDED(res))
                    {
                        printf("11111\n");
                    }
               }
           }
           BSTR mt=BSTR(L"333");
           res=image->put_VolumeName(mt);
           if (SUCCEEDED(res))
           {
               printf("metkaok\n");
           }
        }
    }

Following is the error:

oshibkaIMPORTFIELSYSTEM=0xc0aab151
IMAPI_E_NO_SUPPORTED_FILE_SYSTEM

This error appears only when FsiFileSystems fs=FsiFileSystems(FsiFileSystemUDF);

What could be the problem?

dvd-burning
imapi
cd-burning
asked on Stack Overflow Jan 6, 2017 by макс • edited Jan 30, 2020 by Amit Joshi

1 Answer

0

Our development languages are different; I work on C#. I still hope this may help you because underlying IMAPI interface is same.

You need to assign disk recorder to your file system. Also, you need to set default file systems to create. So it should be something like below in C#:

fileSystemImage.ChooseImageDefaults(discRecorder);
fileSystemImage.FileSystemsToCreate = FsiFileSystems.FsiFileSystemJoliet | FsiFileSystems.FsiFileSystemISO9660 | FsiFileSystems.FsiFileSystemUDF;
if(!discFormatData.MediaHeuristicallyBlank)
{
    fileSystemImage.MultisessionInterfaces = discFormatData.MultisessionInterfaces;
    fileSystemImage.ImportFileSystem();
}

Following is BAD TRANSLATION to C++:

FsiFileSystems fs;
fs = ChooseImageDefaults(discRecorder);
fs.FileSystemsToCreate = FsiFileSystems.FsiFileSystemJoliet | FsiFileSystems.FsiFileSystemISO9660 | FsiFileSystems.FsiFileSystemUDF;
ok=image->ImportFileSystem(&fs);

IMAPI will only try to import file systems those are assigned default to it.

Also make sure you have not closed earlier session. Property ForceMediaToBeClosed should be set to false while writing fresh new CD; then only it will allow to write it again.

Edit 1:

Refer this link. Try installing all applicable windows updates to your system.

I just discovered that IMAPI_E_NO_SUPPORTED_FILE_SYSTEM error code is returned only on systems with Windows Feature Pack for Storage 1.0 installed. On Windows XP systems with KB932716 update, all works as expected: I'm importing previous UDF session and burn new session without any problems.

answered on Stack Overflow Jan 18, 2017 by Amit Joshi • edited Jun 20, 2020 by Community

User contributions licensed under CC BY-SA 3.0