Previous page

Next page

Locate page in Contents

Obtaining a Problem Report

If you are experiencing a problem with a virtual machine, you can obtain a problem report from the Parallels Service. The report can then be sent to the Parallels technical support for evaluation. A problem report contains technical data about your Parallels product installation, log data, and other technical details that can be used to determine the source of the problem and to develop a solution. The following example demonstrates how to obtain the report.

PRL_RESULT GetProblemReport(PRL_HANDLE hServer)

{

    PRL_HANDLE hJob = PRL_INVALID_HANDLE;

    PRL_HANDLE hJobResult = PRL_INVALID_HANDLE;

    

    PRL_RESULT ret = PRL_ERR_UNINITIALIZED;

    PRL_RESULT nJobReturnCode = PRL_ERR_UNINITIALIZED;

    

    // Get problem report from the host.

    hJob = PrlSrv_GetProblemReport(hServer);

    

    // Wait for the job to complete.

    ret = PrlJob_Wait(hJob, 1000);

    if (PRL_FAILED(ret))

    {

        // Handle the error...

        return -1;

    }

    

    // Analyze the result of PrlSrv_GetProblemReport.

    ret = PrlJob_GetRetCode(hJob, &nJobReturnCode);

    if (PRL_FAILED(ret))

    {

        // Handle the error...

        PrlHandle_Free(hJob);

        return -1;

    }

    // Check the job return code.

    if (PRL_FAILED(nJobReturnCode))

    {

        // Handle the error...

        PrlHandle_Free(hJob);

        return -1;

    }

    

    // Get job result.

    ret = PrlJob_GetResult(hJob, &hJobResult);

    PrlHandle_Free(hJob);

    if (PRL_FAILED(ret))

    {

        // Handle the error...

        return -1;

    }

    

    // Get the string containing the report data.

    // First, get the required buffer size.

    PRL_UINT32 nBufSize = 0;

    ret = PrlResult_GetParamAsString(hJobResult, NULL, &nBufSize);

    if (PRL_FAILED(ret))

    {

        // Handle the error...

        PrlHandle_Free(hJobResult);

        return -1;

    }

  

    // Second, initialize the buffer and get the report.

    char* sReportData =(PRL_STR)malloc(nBufSize);

    ret = PrlResult_GetParamAsString(hJobResult, sReportData, &nBufSize);

  

    if (PRL_FAILED(ret))

    {

        // Handle the error...

        PrlHandle_Free(hJobResult);

        return ret;

    }

  

    

    printf("%s", sReportData);

    PrlHandle_Free(hJobResult);

    free(sReportData);

  

    return 0;

}