Click here to Skip to main content
15,884,099 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Recently we started using new Resilient Change Tracking (RCT 2016) APIs. We are facing issue with QueryChangesVirtualDisk API. We are following steps as mentioned in MSDN. Anyone has any suggestions if it is working for them?
C++
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);
}


What I have tried:

After my test, the handle of the open virtual disk is changed from VIRTUAL_DISK_ACCEES_GET_INFO to VIRTUAL_DISK_ACCESS_ALL, it's work. But here is a new problem: the virtual machine can't boot or the virtual machine is powered on, QueryChangesVirtualDisk() returns 32 (0x20)( the file is in proceeding).
Posted
Updated 28-Nov-18 4:34am
v2
Comments
Michael Haephrati 7-Jan-19 11:32am    
This is a bug reported to Microsoft. See: https://social.msdn.microsoft.com/Forums/en-US/fe8f0860-d705-4d55-8d17-7891ab0ffea2/msft-api-querychangesvirtualdisk-retruns-accessdenied-error-0x5?forum=servervirtualization
[no name] 26-Feb-19 0:43am    
thank you very much
[no name] 27-Feb-19 20:07pm    
But, i used to reply the question on MSDN

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900