none
I am trying to implement RCT(HyperV) for windows 2016 Tech Preview 4 in C\C++ platform RRS feed

  • Question


  • I am facing the following problems .

    1) After creating checkpoint and converting it to a reference point , we have problems in fetching the RCT ID of the disc to supply as arguement to QueryChangesVirtualDisk().To fetch RCT ID we used GetVirtualDiskInformation() function with version set to GET_VIRTUAL_DISK_INFO_CHANGE_TRACKING_STATE . 
    On execution of the function the machine crashes every time . 

     Tried giving the instance ID  of the class msvm_VirtualSystemReferencePoint for the particular reference point ,which also failed .

    2) I have no idea on how to clear the reference points .They keep on growing . Is there any specific function that serves this purpose . 

    3) I dont have any idea in giving predefined names to checkpoints . Any Insights on this would be helpful .

    Detailed help documentation of RCT implementation might be of great help .Are they available ?

    SourceCode:

    HANDLE handle;

    VIRTUAL_STORAGE_TYPE pVirStor = {};

    pVirStor.DeviceId = 3;

    cout << "check1" << endl;

    pVirStor.VendorId = { 0xec984aec, 0xa0f9, 0x47e9,{ 0x90, 0x1f, 0x71, 0x41, 0x5a, 0x66, 0x34, 0x5b } };

    POPEN_VIRTUAL_DISK_PARAMETERS pVirDiskPar = NULL;

    //Call OpenVirtualDisk method.
    DWORD ret = OpenVirtualDisk(&pVirStor,
    DiskPath,
    VIRTUAL_DISK_ACCESS_GET_INFO,
    OPEN_VIRTUAL_DISK_FLAG_NO_PARENTS,
    pVirDiskPar,

    &handle);

    if (ret == 0)

    {

    ULONG diskInfoSize; PGET_VIRTUAL_DISK_INFO virtDiskInfo;

    virtDiskInfo = NULL;

    diskInfoSize = sizeof(GET_VIRTUAL_DISK_INFO);

    virtDiskInfo = (PGET_VIRTUAL_DISK_INFO)malloc(diskInfoSize);

    if (virtDiskInfo == NULL) {

    return;

    }

    virtDiskInfo->Version = GET_VIRTUAL_DISK_INFO_CHANGE_TRACKING_STATE;

    ULONG ptr = NULL;

    ULONGLONG virSize;

    DWORD ret1 = GetVirtualDiskInformation(handle, &diskInfoSize, virtDiskInfo,&ptr);

    if (ret1 == ERROR_SUCCESS)

    {

    wcout<<"virtDiskInfo.version.ChangeTrackingState.Enabled ::" <<virtDiskInfo->ChangeTrackingState.Enabled; wcout << "virtDiskInfo.version.ChangeTrackingState.MostRecentId ::" <<virtDiskInfo->ChangeTrackingStateMostRecentId;

    }

    PQUERY_CHANGES_VIRTUAL_DISK_RANGE qUERY_CHANGES_VIRTUAL_DISK_RANGE = NULL; PULONG rangCount = NULL;

    PULONG64 totalNumOfByteProceed = NULL ;

    BSTR str = refRct.bstrVal;

    //str is Msvm_VirtualSystemReferencePoint

    Class InstanceID. Eg Microsoft:F8EE7B7D-E1C4-4E1A-A490-9CF1DEA82D19 wstring w = str; wstring::size_type pos = w.find(L':');

    wstring b1 = w.substr(pos+1,w.length()).c_str();

    wstring b2 = w.substr(pos + 1).c_str();

    //Call QueryChangesVirtualDisk() method

    DWORD queryRet = QueryChangesVirtualDisk (

    handle,

    b2.c_str(),

    virSize,

    QUERY_CHANGES_VIRTUAL_DISK_FLAG_NONE,

    qUERY_CHANGES_VIRTUAL_DISK_RANGE,

    rangCount, totalNumOfByteProceed );

    cout << "queryRet " << queryRet << endl; }



     




    Thursday, April 21, 2016 7:30 AM

All replies

  • Did you resolve this problem? Do you have sample code to how to create a checkpoint and converting it to a reference point? Thanks in advance.
    Monday, July 11, 2016 10:45 PM
  • The buffer passed for GET_VIRTUAL_DISK_INFO_CHANGE_TRACKING_STATE is small which could be causing the API to crash.

    Could you please try passing sufficient buffer here sizeof(GET_VIRTUAL_DISK_INFO) + RCT Id length.

    On an earlier side you could also try something similar as below. RCTID is generally 50 chars.

    WCHAR changeTrackingInfo[2048];
    ZeroMemory(changeTrackingInfo, sizeof(changeTrackingInfo));
    _GET_VIRTUAL_DISK_INFO * virtualDiskInfoPtr = (_GET_VIRTUAL_DISK_INFO *)changeTrackingInfo;
    virtualDiskInfoPtr->Version = (GET_VIRTUAL_DISK_INFO_VERSION) GET_VIRTUAL_DISK_INFO_CHANGE_TRACKING_STATE;
    virtualDiskInfoSize = sizeof(changeTrackingInfo);
    ret = GetVirtualDiskInformation(m_vhdxHandle, &virtualDiskInfoSize, virtualDiskInfoPtr, &sizeUsed);

    Thanks

     

    Sunday, July 17, 2016 8:55 PM
  • Thanks sanjay ,

    I have retrieved the RCT Tracking ID thanks to your solution . Now I have problem while calling QueryChangesVirtualDisk() . It returns value 5 (Access_denied) . 





    Monday, August 1, 2016 8:11 AM
  • Same issue, I am also facing Accese_denied issue with QueryChangesVirtualDisk. What is the solution? any help is appreciated.
    Wednesday, March 22, 2017 5:52 AM
  • Facing the same problem. Has anyone been able to solve this problem? QueryChangesVirtualDisk returns
    ERROR_ACCESS_DENIED 5 (0x5) Access is denied.
    Wednesday, May 3, 2017 2:21 PM
  • I am too facing the same problem. while i execute QueryChangeVirtualDisk function am getting the error ERROR_ACCESS_DENIED.
    Friday, May 5, 2017 10:53 AM
  • facing the same problem . have you resolved it? if you have resolved then how?
    Monday, May 28, 2018 6:51 AM
  • Facing the same problem. if you have resolved then how?

    Thanks


    Friday, October 26, 2018 8:03 AM
  • sir,would you have resolved it or shared?

    thanks

    Monday, November 5, 2018 6:51 AM
  • Hi,shawetankssy

    Facing the same problem.I belived that you resoved it, could you give me some guidence?

    Best Wishes.

    Wednesday, November 21, 2018 8:02 AM
  • Hi Chaplin,

    I am trying to implement the same, Creation of snapshot is successful but I am not able to convert snapshot to reference point. Getting Job parameter as NULL. Any suggestions or sample code will be helpful.

    Best regards,

    Hari

    Monday, September 2, 2019 2:38 PM