c++ - IVssBackupComponents::InitializeForBackup 失败

标签 c++ c winapi windows-10

IVssBackupComponents::InitializeForBackup 失败并出现 E_UNEXPECTED 错误。 在事件查看器中有两个错误:

错误 1

Volume Shadow Copy Service error: A critical component required by
    the Volume Shadow Copy service is not registered. This might
    happened if an error occurred during Windows setup or during
    installation of a Shadow Copy provider. 

   The error returned from
        CoCreateInstance on class with CLSID
        {e579ab5f-1cc4-44b4-bed9-de0991ff0623} and Name IVssCoordinatorEx2
        is [0x80040154, Class not registered ].

    Operation:
       Instantiating VSS server

错误 2

Volume Shadow Copy Service error: Unexpected error calling routine
    CoCreateInstance.  hr = 0x80040154, Class not registered.

    Operation:
      Instantiating VSS server

我创建了简单的“hello world”VSS 程序:

#include "vss.h"
#include "vswriter.h"
#include <VsBackup.h>
#include <stdio.h>

int main()
{
#define CHECK_PRINT(result) printf("%s %#08x\n",result==S_OK?"S_OK":"error", result)
  HRESULT  result = CoInitialize(NULL);
  CHECK_PRINT(result);
  IVssBackupComponents *VssHandle;
  result = CreateVssBackupComponents(&VssHandle);
  CHECK_PRINT(result);
  result = VssHandle->InitializeForBackup();
  CHECK_PRINT(result);
  return 0;
}

它报告相同的输出 S_OK 00000000 S_OK 00000000 错误 0x80042302

在我的主要开发 Windows 10 PC 和全新安装的虚拟 Windows10 上。 VSS、swprv 服务正在运行。

最佳答案

嗯。通过查看进程监视器来调试反汇编表明,在我的情况下,问题是缺少注册表项

"HKEY_CLASSES_ROOT\Wow6432Node\CLSID\{F2C2787D-95AB-40D4-942D-298F5F757874}"

google 告诉我这个值应该是

[HKEY_CLASSES_ROOT\Wow6432Node\CLSID\{F2C2787D-95AB-40D4-942D-298F5F757874}]
@="PSFactoryBuffer"

[HKEY_CLASSES_ROOT\Wow6432Node\CLSID\{F2C2787D-95AB-40D4-942D-298F5F757874}\InProcServer32]
@=hex(2):25,00,73,00,79,00,73,00,74,00,65,00,6d,00,72,00,6f,00,6f,00,74,00,25,\
00,5c,00,53,00,79,00,73,00,57,00,4f,00,57,00,36,00,34,00,5c,00,76,00,73,00,\
73,00,5f,00,70,00,73,00,2e,00,64,00,6c,00,6c,00,00,00
"ThreadingModel"="Both"

关于c++ - IVssBackupComponents::InitializeForBackup 失败,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40735655/

相关文章:

c++ - 为什么我的 C++ 除法程序不能编译

c++ - 前向声明问题

c++ - 在文本编辑器显示链中使用双缓冲有多大意义?

C代码打印数组的唯一数字

c - 向内存映射文件添加新字节

c# - P/Invoke 调用失败

c++ - 为什么我可以通过返回类型推导从函数外部访问函数内部定义的结构?

C++ 析构函数 : when the memory gets freed?

c - 如何避免重新定义 VERSION、PACKAGE 等

C 如何在用户按空格时获取字符串