c++ - QueryChangesVirtualDisk() 正在返回 Access_Denied (5)?
问题描述
// QueryChangesVirtualDisk
PCWSTR changeTrackingId = virtualDiskInfo->ChangeTrackingState.MostRecentId;
ULONG64 byteOffset = 0L;
ULONG64 byteLength = virtualDiskInfoSize;
PQUERY_CHANGES_VIRTUAL_DISK_RANGE pQueryChangeRange = NULL;
ULONG rangeCount = 0L;
ULONG64 processedLength = 0L;
openStatus = QueryChangesVirtualDisk(
vhdHandle, // A handle to the open VHD
changeTrackingId, // A pointer to a string that specifies the change tracking identifier
byteOffset, // Specifies the distance from the start of the VHD to the beginning of the area of the VHD
byteLength, // Specifies the length of the area of the VHD that you want to check for changes
QUERY_CHANGES_VIRTUAL_DISK_FLAG_NONE, // Reserved
pQueryChangeRange, // Indicates the areas of the virtual disk that have changed
&rangeCount, // The number of QUERY_CHANGES_VIRTUAL_DISK_RANGE structures that the array that the Ranges parameter points to can hold
&processedLength // Indicates the total number of bytes that the method processed
);
if (openStatus != ERROR_SUCCESS)
{
wprintf(L"Failed to call method(QueryChangesVirtualDisk), Erorr code: %ld\n", openStatus);
wprintf(L"Virtual disk path: %s\n", virtualDiskPath);
wprintf(L"%s\n", changeTrackingId);
wprintf(L"Start offset: %llu\n", byteOffset);
wprintf(L"End offset: %lu\n", virtualDiskInfoSize);
getchar();
return 1;
}
cout << "Succeeded to call method(QueryChangesVirtualDisk)." << endl;
if (vhdHandle != NULL)
{
CloseHandle(vhdHandle);
}
最近我们开始使用新的弹性变更跟踪 (RCT 2016) API。我们正面临 QueryChangesVirtualDisk API 的问题。我们按照 MSDN 中提到的步骤进行操作。如果它对他们有用,有人有什么建议吗?
解决方案
openStatus = OpenVirtualDisk(
&storageType,
virtualDiskPath,
//VIRTUAL_DISK_ACCESS_GET_INFO,
VIRTUAL_DISK_ACCESS_ALL,
OPEN_VIRTUAL_DISK_FLAG_NO_PARENTS,
openParameters,
&vhdHandle
);
经过我的测试,打开的虚拟磁盘的句柄从VIRTUAL_DISK_ACCEES_GET_INFO更改为VIRTUAL_DISK_ACCESS_ALL,它的工作。但是这里出现了一个新问题:虚拟机无法启动或虚拟机上电,QueryChangesVirtualDisk() 返回 32 (0x20)(文件正在处理中)。
怎么回事?!我觉得很累,很。
推荐阅读
- hl7 - 如何使用 HAPI 2.4 创建 HL7 消息 ORU_R01 类型
- jquery - 使用 JSON 数据填充 INPUT 和 SELECT
- forms - Xamarin 表单控件值不可见
- c# - 如何依赖注入数据访问层,它在其构造函数中采用数据库设置?
- html - 我的 HTML 没有链接到我的 CSS
- nginx - 带有 http2 的 nginx 后面的 asp.net 核心 - 远程 ip 始终为 127.0.0.1
- r - 在R中绘制风上升?
- android - cancelAll() 和 cancel() 不会关闭我的通知
- avro - 为具有多种记录类型的数组创建 avro 模式?
- sql - 使用或不使用 Key 作为 FK 和 PK