Parallels Virtualization SDK
ContentsIndex
Example
PrlSrv_StartSearchVms Function
PRL_HANDLE hStringList;
PrlApi_CreateStringsList( &hStringList );
PrlStrList_AddItem( hStringList, "/Users/Shared/Parallels/" );

hJob =
PrlSrv_StartSearchVms( hServer, hStringList );
PrlJob_Wait( hJob, 10000 );

PrlJob_GetResult( hJob, &hJobResult );
PrlHandle_Free( hJob );

PRL_UINT32 nIndex, nCount;
PrlResult_GetParamsCount( hJobResult, &nCount );
for( nIndex = 0; nIndex < nCount ; nIndex++ )
{
    PRL_HANDLE hParam;
    PrlResult_GetParamByIndex( hJobResult, nIndex, &hParam );

    PRL_HANDLE_TYPE nHandleType;
    PrlHandle_GetType( hParam, &nHandleType );

    printf( "Handle Type: %s\n",
        PRL_HANDLE_TYPE_TO_STRING( nHandleType ));

    PRL_CHAR sBuf[1024];
    PRL_UINT32 nBufSize = sizeof( sBuf );

    nRetCode =
    PrlFoundVmInfo_GetName( hParam, sBuf, &nBufSize );

    if ( PRL_SUCCEEDED( nRetCode ))
        printf( "VM name: %s\n.", sBuf );
    else
        fprintf( stderr, "PrlFoundVmInfo_GetName failed, error: %s. \n",
            PRL_RESULT_TO_STRING( nRetCode ));

    PrlHandle_Free( hParam );
}
PrlHandle_Free( hJobResult );
PrlHandle_Free( hStringList );
© 2021 Parallels International GmbH. All rights reserved.