IVssBackupComponents :: InitializeForBackup失敗,並顯示E_UNEXPECTED錯誤。 而在事件查看器有兩個誤區:IVssBackupComponents :: InitializeForBackup失敗
錯誤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
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服務正在運行。