IMAPI:发生 COMException 内部文件系统错误 [-1062555360]

IMAPI: COMException Internal file system error occurred [-1062555360 ]

我正在编写 CD/DVD 将 IMAPI 与 C#.NET windows 应用程序结合使用。 我在 CD 上写入的数据包含一个可执行文件 (test.exe),该文件也是使用 C#.NET 和 使用 Turbo Virtualization Studio 虚拟化 (sandobx) 开发的。 所有要写入光盘的数据都放在C盘的一个文件夹(源路径)中。

以下是一小段代码:-

IStream stream = null;
try
{
    System.Diagnostics.Debug.Print("Adding - " + thisFileItem.SourcePath);
    if (thisFileItem.SourcePath != null)
    Win32.SHCreateStreamOnFile(thisFileItem.SourcePath, Win32.STGM_READ | Win32.STGM_SHARE_DENY_WRITE, ref stream);
    if (stream != null)
    {
        fileSystemImage.Root.AddFile(thisFileItem.DestPath + thisFileItem.DisplayName, stream);
    }
}
finally
{
    if (stream != null)
    {
        Marshal.FinalReleaseComObject(stream);
    }
}

添加时调用 "fileSystemImage.Root.AddFile" 方法 test.exe 抛出 COMException -1062555360 "Internal file system error occurred." 所有其他文件正确添加和写入。

异常详情:-

COMException -1062555360
Internal file system error occurred.
   at ImapiInterop.IFsiDirectoryItem.AddFile(String path, IStream fileData)
   at ImapiImplementation.CDWriter.objBackgroundWorker_DoWork(Object sender, DoWorkEventArgs e) in C:\.........\CDWriter.cs:line 405

如果我将源文件夹放在其他位置(桌面或 D 驱动器),所有写入过程(包括 test.exe)都会正常进行,不会出错。

我怀疑问题是由于虚拟化引起的,但不确定。 请帮忙

IMAPI 返回的错误消息不正确,这就是所有混乱的原因。 参考以下 link.

social.msdn.microsoft.com

以下是从上述站点的答案(来自 Dmitri)复制的文本:-

IMAPI supports the ISupportErrorInfo interface, and we are aware of the issue of mismatching error messages in your scenario.

Internally, IMAPI creates rollback objects to undo add/remove file actions. We've had an issue where the rollback action was created prematurely, so after the return code for IFsiDirectoryItem::AddFile was already set, the rollback action was to remove the file from the image. Since the file hasn't been added, IMAPI_E_FSI_INTERNAL_ERROR exception was thrown, which changed the IErrorInfo message to the one you're seeing.

We are aware of this issue, and it will be fixed in the next release of IMAPI. Unfortunately, it is not serious enough to be addressed in a hotfix.