The PrlSrv_AttachToLostTask function allows to obtain a handle to a running task after the connection to the Parallels Service was lost.
PRL_HANDLE PrlSrv_AttachToLostTask( PRL_HANDLE hServer, PRL_CONST_STR sTaskId );
PrlApiDisp.h
A handle of type PHT_JOB containing the results of this asynchronous operation, or PRL_INVALID_HANDLE if there's not enough memory to instantiate the job object. The returned PHT_JOB object will be attached to the specified task.
If you've started a long asynchronous operation and then lost a connection with the Parallels Service, you may use this function to get a handle to the task after reconnecting to the Parallels Service. In order to do that, log in to the Parallels Service using the PrlSrv_Login or the PrlSrv_LoginLocal function passing the UUID of the session that you've lost. The returned PHT_LOGIN_RESPONSE object will contain the list of the tasks that belong to the lost session and are still running. Select a task that you want to get a handle to and pass its ID to the PrlSrv_AttachToLostTask function. The function will return a handle of type PHT_JOB which you may use to continue controlling and monitoring the task as usual.
To get the return code from the PHT_JOB object, use the PrlJob_GetRetCode function. Possible values are:
PRL_ERR_INVALID_ARG - invalid handle or null pointer was passed.
PRL_ERR_SUCCESS - function completed successfully.