while (frames > 0)
{
- status = WaitForSingleObject(alsa->stopEvent, 0);
+ status = WaitForSingleObject(alsa->stopEvent, 0);
- if (status == WAIT_FAILED)
- {
- ret = GetLastError();
- WLog_ERR(TAG, "WaitForSingleObject failed with error %lu!", ret);
- break;
- }
+ if (status == WAIT_FAILED)
+ {
+ ret = GetLastError();
+ WLog_ERR(TAG, "WaitForSingleObject failed with error %lu!", ret);
+ break;
+ }
if (status == WAIT_OBJECT_0)
break;
encoded_size = alsa->buffer_frames * tbytes_per_frame;
}
- status = WaitForSingleObject(alsa->stopEvent, 0);
+ status = WaitForSingleObject(alsa->stopEvent, 0);
- if (status == WAIT_FAILED)
- {
- ret = GetLastError();
- WLog_ERR(TAG, "WaitForSingleObject failed with error %lu!", ret);
- break;
- }
+ if (status == WAIT_FAILED)
+ {
+ ret = GetLastError();
+ WLog_ERR(TAG, "WaitForSingleObject failed with error %lu!", ret);
+ break;
+ }
- if (status == WAIT_OBJECT_0)
+ if (status == WAIT_OBJECT_0)
break;
else
{
int tbytes_per_frame;
snd_pcm_t* capture_handle = NULL;
AudinALSADevice* alsa = (AudinALSADevice*) arg;
- DWORD status;
+ DWORD status;
DEBUG_DVC("in");
+ freerdp_channel_init_thread_context(alsa->rdpcontext);
+
rbytes_per_frame = alsa->actual_channels * alsa->bytes_per_channel;
tbytes_per_frame = alsa->target_channels * alsa->bytes_per_channel;
buffer = (BYTE*) calloc(1, rbytes_per_frame * alsa->frames_per_packet);
if (!buffer)
{
WLog_ERR(TAG, "calloc failed!");
- error = CHANNEL_RC_NO_MEMORY;
+ error = CHANNEL_RC_NO_MEMORY;
if (alsa->rdpcontext)
setChannelError(alsa->rdpcontext, error, "calloc failed!");
- goto out;
+ goto out;
}
freerdp_dsp_context_reset_adpcm(alsa->dsp_context);
if ((error = snd_pcm_open(&capture_handle, alsa->device_name, SND_PCM_STREAM_CAPTURE, 0)) < 0)
{
- WLog_ERR(TAG, "snd_pcm_open (%s)", snd_strerror(error));
- goto out;
+ WLog_ERR(TAG, "snd_pcm_open (%s)", snd_strerror(error));
+ goto out;
}
if (!audin_alsa_set_params(alsa, capture_handle))
{
- WLog_ERR(TAG, "audin_alsa_set_params failed");
- goto out;
+ WLog_ERR(TAG, "audin_alsa_set_params failed");
+ goto out;
}
while(1)
{
- status = WaitForSingleObject(alsa->stopEvent, 0);
-
- if (status == WAIT_FAILED)
- {
- error = GetLastError();
- WLog_ERR(TAG, "WaitForSingleObject failed with error %lu!", error);
- break;
- }
-
- if (status == WAIT_OBJECT_0)
- break;
-
- error = snd_pcm_readi(capture_handle, buffer, alsa->frames_per_packet);
-
- if (error == -EPIPE)
- {
- snd_pcm_recover(capture_handle, error, 0);
- continue;
- }
- else if (error < 0)
- {
- WLog_ERR(TAG, "snd_pcm_readi (%s)", snd_strerror(error));
- break;
- }
-
- if ((error = audin_alsa_thread_receive(alsa, buffer, error * rbytes_per_frame)))
- {
- WLog_ERR(TAG, "audin_alsa_thread_receive failed with error %lu", error);
- break;
- }
+ status = WaitForSingleObject(alsa->stopEvent, 0);
+
+ if (status == WAIT_FAILED)
+ {
+ error = GetLastError();
+ WLog_ERR(TAG, "WaitForSingleObject failed with error %lu!", error);
+ break;
+ }
+
+ if (status == WAIT_OBJECT_0)
+ break;
+
+ error = snd_pcm_readi(capture_handle, buffer, alsa->frames_per_packet);
+
+ if (error == -EPIPE)
+ {
+ snd_pcm_recover(capture_handle, error, 0);
+ continue;
+ }
+ else if (error < 0)
+ {
+ WLog_ERR(TAG, "snd_pcm_readi (%s)", snd_strerror(error));
+ break;
+ }
+
+ if ((error = audin_alsa_thread_receive(alsa, buffer, error * rbytes_per_frame)))
+ {
+ WLog_ERR(TAG, "audin_alsa_thread_receive failed with error %lu", error);
+ break;
+ }
}
return ERROR_NOT_ENOUGH_MEMORY;
}
alsa->buffer_frames = 0;
-
+
if (!(alsa->stopEvent = CreateEvent(NULL, TRUE, FALSE, NULL)))
{
WLog_ERR(TAG, "CreateEvent failed!");
{
SetEvent(alsa->stopEvent);
if (WaitForSingleObject(alsa->thread, INFINITE) == WAIT_FAILED)
- {
- error = GetLastError();
- WLog_ERR(TAG, "WaitForSingleObject failed with error %lu", error);
- return error;
- }
+ {
+ error = GetLastError();
+ WLog_ERR(TAG, "WaitForSingleObject failed with error %lu", error);
+ return error;
+ }
CloseHandle(alsa->stopEvent);
alsa->stopEvent = NULL;
goto err_out;
}
+ freerdp_channel_init_thread_context(oss->rdpcontext);
+
if (oss->dev_unit != -1)
{
sprintf_s(dev_name, (PATH_MAX - 1), "/dev/dsp%i", oss->dev_unit);
IFCALLRET(audin->context.Opening, success, &audin->context);
if (success)
- WLog_ERR(TAG, "context.Opening failed with error %lu", success);
+ WLog_ERR(TAG, "context.Opening failed with error %lu", success);
return success;
}
IFCALLRET(audin->context.OpenResult, success, &audin->context, Result);
if (success)
- WLog_ERR(TAG, "context.OpenResult failed with error %lu", success);
+ WLog_ERR(TAG, "context.OpenResult failed with error %lu", success);
return success;
}
IFCALLRET(audin->context.ReceiveSamples, success, &audin->context, src, frames);
if (success)
- WLog_ERR(TAG, "context.ReceiveSamples failed with error %lu", success);
+ WLog_ERR(TAG, "context.ReceiveSamples failed with error %lu", success);
return success;
}
BytesReturned = 0;
ChannelEvent = NULL;
+ freerdp_channel_init_thread_context(audin->context.rdpcontext);
if (WTSVirtualChannelQuery(audin->audin_channel, WTSVirtualEventHandle, &buffer, &BytesReturned) == TRUE)
{
if (BytesReturned == sizeof(HANDLE))
if (status == WAIT_FAILED)
{
- error = GetLastError();
+ error = GetLastError();
WLog_ERR(TAG, "WaitForMultipleObjects failed with error %lu", error);
goto out;
}
if (status == WAIT_FAILED)
{
- error = GetLastError();
- WLog_ERR(TAG, "WaitForMultipleObjects failed with error %lu", error);
- goto out;
+ error = GetLastError();
+ WLog_ERR(TAG, "WaitForMultipleObjects failed with error %lu", error);
+ goto out;
}
Stream_SetPosition(s, 0);
case MSG_SNDIN_VERSION:
if ((error = audin_server_recv_version(audin, s, BytesReturned)))
{
- WLog_ERR(TAG, "audin_server_recv_version failed with error %lu!", error);
- goto out_capacity;
- }
+ WLog_ERR(TAG, "audin_server_recv_version failed with error %lu!", error);
+ goto out_capacity;
+ }
if ((error = audin_server_send_formats(audin, s)))
{
WLog_ERR(TAG, "audin_server_send_formats failed with error %lu!", error);
{
SetEvent(audin->stopEvent);
if (WaitForSingleObject(audin->thread, INFINITE) == WAIT_FAILED)
- {
- WLog_ERR(TAG, "WaitForSingleObject failed with error %lu", GetLastError());
- return FALSE;
- }
+ {
+ WLog_ERR(TAG, "WaitForSingleObject failed with error %lu", GetLastError());
+ return FALSE;
+ }
CloseHandle(audin->thread);
CloseHandle(audin->stopEvent);
}
static wStream* cliprdr_packet_new(UINT16 msgType, UINT16 msgFlags,
- UINT32 dataLen)
+ UINT32 dataLen)
{
wStream* s;
s = Stream_New(NULL, dataLen + 8);
else
{
status = cliprdr->channelEntryPoints.pVirtualChannelWrite(cliprdr->OpenHandle,
- Stream_Buffer(s), (UINT32) Stream_GetPosition(s), s);
+ Stream_Buffer(s), (UINT32) Stream_GetPosition(s), s);
}
if (status != CHANNEL_RC_OK)
WLog_ERR(TAG, "VirtualChannelWrite failed with %s [%08X]",
- WTSErrorToString(status), status);
+ WTSErrorToString(status), status);
return status;
}
* @return 0 on success, otherwise a Win32 error code
*/
static UINT cliprdr_process_general_capability(cliprdrPlugin* cliprdr,
- wStream* s)
+ wStream* s)
{
UINT32 version;
UINT32 generalFlags;
if (cliprdr->useLongFormatNames)
cliprdr->useLongFormatNames = (generalFlags & CB_USE_LONG_FORMAT_NAMES) ? TRUE :
- FALSE;
+ FALSE;
if (cliprdr->streamFileClipEnabled)
cliprdr->streamFileClipEnabled = (generalFlags & CB_STREAM_FILECLIP_ENABLED) ?
- TRUE : FALSE;
+ TRUE : FALSE;
if (cliprdr->fileClipNoFilePaths)
cliprdr->fileClipNoFilePaths = (generalFlags & CB_FILECLIP_NO_FILE_PATHS) ?
- TRUE : FALSE;
+ TRUE : FALSE;
if (cliprdr->canLockClipData)
cliprdr->canLockClipData = (generalFlags & CB_CAN_LOCK_CLIPDATA) ? TRUE : FALSE;
capabilities.cCapabilitiesSets = 1;
capabilities.capabilitySets = (CLIPRDR_CAPABILITY_SET*) &
- (generalCapabilitySet);
+ (generalCapabilitySet);
generalCapabilitySet.capabilitySetType = CB_CAPSTYPE_GENERAL;
generalCapabilitySet.capabilitySetLength = 12;
generalCapabilitySet.version = version;
* @return 0 on success, otherwise a Win32 error code
*/
static UINT cliprdr_process_clip_caps(cliprdrPlugin* cliprdr, wStream* s,
- UINT16 length, UINT16 flags)
+ UINT16 length, UINT16 flags)
{
UINT16 index;
UINT16 lengthCapability;
if ((error = cliprdr_process_general_capability(cliprdr, s)))
{
WLog_ERR(TAG, "cliprdr_process_general_capability failed with error %lu!",
- error);
+ error);
return error;
}
* @return 0 on success, otherwise a Win32 error code
*/
static UINT cliprdr_process_monitor_ready(cliprdrPlugin* cliprdr, wStream* s,
- UINT16 length, UINT16 flags)
+ UINT16 length, UINT16 flags)
{
CLIPRDR_MONITOR_READY monitorReady;
CliprdrClientContext* context = cliprdr_get_client_interface(cliprdr);
* @return 0 on success, otherwise a Win32 error code
*/
static UINT cliprdr_process_filecontents_request(cliprdrPlugin* cliprdr,
- wStream* s, UINT32 length, UINT16 flags)
+ wStream* s, UINT32 length, UINT16 flags)
{
CLIPRDR_FILE_CONTENTS_REQUEST request;
CliprdrClientContext* context = cliprdr_get_client_interface(cliprdr);
* @return 0 on success, otherwise a Win32 error code
*/
static UINT cliprdr_process_filecontents_response(cliprdrPlugin* cliprdr,
- wStream* s, UINT32 length, UINT16 flags)
+ wStream* s, UINT32 length, UINT16 flags)
{
CLIPRDR_FILE_CONTENTS_RESPONSE response;
CliprdrClientContext* context = cliprdr_get_client_interface(cliprdr);
* @return 0 on success, otherwise a Win32 error code
*/
static UINT cliprdr_process_lock_clipdata(cliprdrPlugin* cliprdr, wStream* s,
- UINT32 length, UINT16 flags)
+ UINT32 length, UINT16 flags)
{
CLIPRDR_LOCK_CLIPBOARD_DATA lockClipboardData;
CliprdrClientContext* context = cliprdr_get_client_interface(cliprdr);
* @return 0 on success, otherwise a Win32 error code
*/
static UINT cliprdr_process_unlock_clipdata(cliprdrPlugin* cliprdr, wStream* s,
- UINT32 length, UINT16 flags)
+ UINT32 length, UINT16 flags)
{
CLIPRDR_UNLOCK_CLIPBOARD_DATA unlockClipboardData;
CliprdrClientContext* context = cliprdr_get_client_interface(cliprdr);
unlockClipboardData.msgFlags = flags;
unlockClipboardData.dataLen = length;
Stream_Read_UINT32(s,
- unlockClipboardData.clipDataId); /* clipDataId (4 bytes) */
+ unlockClipboardData.clipDataId); /* clipDataId (4 bytes) */
IFCALLRET(context->ServerUnlockClipboardData, error, context,
- &unlockClipboardData);
+ &unlockClipboardData);
if (error)
WLog_ERR(TAG, "ServerUnlockClipboardData failed with error %lu!", error);
Stream_Read_UINT32(s, dataLen); /* dataLen (4 bytes) */
#ifdef WITH_DEBUG_CLIPRDR
WLog_DBG(TAG, "msgType: %s (%d), msgFlags: %d dataLen: %d",
- CB_MSG_TYPE_STRINGS[msgType], msgType, msgFlags, dataLen);
+ CB_MSG_TYPE_STRINGS[msgType], msgType, msgFlags, dataLen);
winpr_HexDump(TAG, WLOG_DEBUG, Stream_Buffer(s), dataLen + 8);
#endif
case CB_FORMAT_LIST_RESPONSE:
if ((error = cliprdr_process_format_list_response(cliprdr, s, dataLen,
- msgFlags)))
+ msgFlags)))
WLog_ERR(TAG, "cliprdr_process_format_list_response failed with error %lu!",
- error);
+ error);
break;
case CB_FORMAT_DATA_REQUEST:
if ((error = cliprdr_process_format_data_request(cliprdr, s, dataLen,
- msgFlags)))
+ msgFlags)))
WLog_ERR(TAG, "cliprdr_process_format_data_request failed with error %lu!",
- error);
+ error);
break;
case CB_FORMAT_DATA_RESPONSE:
if ((error = cliprdr_process_format_data_response(cliprdr, s, dataLen,
- msgFlags)))
+ msgFlags)))
WLog_ERR(TAG, "cliprdr_process_format_data_response failed with error %lu!",
- error);
+ error);
break;
case CB_FILECONTENTS_REQUEST:
if ((error = cliprdr_process_filecontents_request(cliprdr, s, dataLen,
- msgFlags)))
+ msgFlags)))
WLog_ERR(TAG, "cliprdr_process_filecontents_request failed with error %lu!",
- error);
+ error);
break;
case CB_FILECONTENTS_RESPONSE:
if ((error = cliprdr_process_filecontents_response(cliprdr, s, dataLen,
- msgFlags)))
+ msgFlags)))
WLog_ERR(TAG, "cliprdr_process_filecontents_response failed with error %lu!",
- error);
+ error);
break;
* @return 0 on success, otherwise a Win32 error code
*/
static UINT cliprdr_client_capabilities(CliprdrClientContext* context,
- CLIPRDR_CAPABILITIES* capabilities)
+ CLIPRDR_CAPABILITIES* capabilities)
{
wStream* s;
CLIPRDR_GENERAL_CAPABILITY_SET* generalCapabilitySet;
Stream_Write_UINT16(s, 1); /* cCapabilitiesSets */
Stream_Write_UINT16(s, 0); /* pad1 */
generalCapabilitySet = (CLIPRDR_GENERAL_CAPABILITY_SET*)
- capabilities->capabilitySets;
+ capabilities->capabilitySets;
Stream_Write_UINT16(s,
- generalCapabilitySet->capabilitySetType); /* capabilitySetType */
+ generalCapabilitySet->capabilitySetType); /* capabilitySetType */
Stream_Write_UINT16(s,
- generalCapabilitySet->capabilitySetLength); /* lengthCapability */
+ generalCapabilitySet->capabilitySetLength); /* lengthCapability */
Stream_Write_UINT32(s, generalCapabilitySet->version); /* version */
Stream_Write_UINT32(s, generalCapabilitySet->generalFlags); /* generalFlags */
WLog_Print(cliprdr->log, WLOG_DEBUG, "ClientCapabilities");
* @return 0 on success, otherwise a Win32 error code
*/
static UINT cliprdr_temp_directory(CliprdrClientContext* context,
- CLIPRDR_TEMP_DIRECTORY* tempDirectory)
+ CLIPRDR_TEMP_DIRECTORY* tempDirectory)
{
int length;
wStream* s;
}
length = ConvertToUnicode(CP_UTF8, 0, tempDirectory->szTempDir, -1, &wszTempDir,
- 0);
+ 0);
if (length < 0)
return ERROR_INTERNAL_ERROR;
Stream_Zero(s, (520 - length) * 2);
free(wszTempDir);
WLog_Print(cliprdr->log, WLOG_DEBUG, "TempDirectory: %s",
- tempDirectory->szTempDir);
+ tempDirectory->szTempDir);
return cliprdr_packet_send(cliprdr, s);
}
* @return 0 on success, otherwise a Win32 error code
*/
static UINT cliprdr_client_format_list(CliprdrClientContext* context,
- CLIPRDR_FORMAT_LIST* formatList)
+ CLIPRDR_FORMAT_LIST* formatList)
{
wStream* s;
UINT32 index;
if (szFormatName)
formatNameSize = ConvertToUnicode(CP_UTF8, 0, szFormatName, -1, &wszFormatName,
- 0);
+ 0);
if (formatNameSize > 15)
formatNameSize = 15;
if (format->formatName)
formatNameSize = MultiByteToWideChar(CP_UTF8, 0, format->formatName, -1, NULL,
- 0) * 2;
+ 0) * 2;
length += formatNameSize;
}
lpWideCharStr = (LPWSTR) Stream_Pointer(s);
cchWideChar = (Stream_Capacity(s) - Stream_GetPosition(s)) / 2;
formatNameSize = MultiByteToWideChar(CP_UTF8, 0,
- format->formatName, -1, lpWideCharStr, cchWideChar) * 2;
+ format->formatName, -1, lpWideCharStr, cchWideChar) * 2;
Stream_Seek(s, formatNameSize);
}
else
}
WLog_Print(cliprdr->log, WLOG_DEBUG, "ClientFormatList: numFormats: %d",
- formatList->numFormats);
+ formatList->numFormats);
return cliprdr_packet_send(cliprdr, s);
}
* @return 0 on success, otherwise a Win32 error code
*/
static UINT cliprdr_client_format_list_response(CliprdrClientContext* context,
- CLIPRDR_FORMAT_LIST_RESPONSE* formatListResponse)
+ CLIPRDR_FORMAT_LIST_RESPONSE* formatListResponse)
{
wStream* s;
cliprdrPlugin* cliprdr = (cliprdrPlugin*) context->handle;
formatListResponse->msgType = CB_FORMAT_LIST_RESPONSE;
formatListResponse->dataLen = 0;
s = cliprdr_packet_new(formatListResponse->msgType,
- formatListResponse->msgFlags, formatListResponse->dataLen);
+ formatListResponse->msgFlags, formatListResponse->dataLen);
if (!s)
{
* @return 0 on success, otherwise a Win32 error code
*/
static UINT cliprdr_client_lock_clipboard_data(CliprdrClientContext* context,
- CLIPRDR_LOCK_CLIPBOARD_DATA* lockClipboardData)
+ CLIPRDR_LOCK_CLIPBOARD_DATA* lockClipboardData)
{
wStream* s;
cliprdrPlugin* cliprdr = (cliprdrPlugin*) context->handle;
}
Stream_Write_UINT32(s,
- lockClipboardData->clipDataId); /* clipDataId (4 bytes) */
+ lockClipboardData->clipDataId); /* clipDataId (4 bytes) */
WLog_Print(cliprdr->log, WLOG_DEBUG,
- "ClientLockClipboardData: clipDataId: 0x%04X",
- lockClipboardData->clipDataId);
+ "ClientLockClipboardData: clipDataId: 0x%04X",
+ lockClipboardData->clipDataId);
return cliprdr_packet_send(cliprdr, s);;
}
* @return 0 on success, otherwise a Win32 error code
*/
static UINT cliprdr_client_unlock_clipboard_data(CliprdrClientContext* context,
- CLIPRDR_UNLOCK_CLIPBOARD_DATA* unlockClipboardData)
+ CLIPRDR_UNLOCK_CLIPBOARD_DATA* unlockClipboardData)
{
wStream* s;
cliprdrPlugin* cliprdr = (cliprdrPlugin*) context->handle;
}
Stream_Write_UINT32(s,
- unlockClipboardData->clipDataId); /* clipDataId (4 bytes) */
+ unlockClipboardData->clipDataId); /* clipDataId (4 bytes) */
WLog_Print(cliprdr->log, WLOG_DEBUG,
- "ClientUnlockClipboardData: clipDataId: 0x%04X",
- unlockClipboardData->clipDataId);
+ "ClientUnlockClipboardData: clipDataId: 0x%04X",
+ unlockClipboardData->clipDataId);
return cliprdr_packet_send(cliprdr, s);
}
* @return 0 on success, otherwise a Win32 error code
*/
static UINT cliprdr_client_format_data_request(CliprdrClientContext* context,
- CLIPRDR_FORMAT_DATA_REQUEST* formatDataRequest)
+ CLIPRDR_FORMAT_DATA_REQUEST* formatDataRequest)
{
wStream* s;
cliprdrPlugin* cliprdr = (cliprdrPlugin*) context->handle;
formatDataRequest->msgFlags = 0;
formatDataRequest->dataLen = 4;
s = cliprdr_packet_new(formatDataRequest->msgType, formatDataRequest->msgFlags,
- formatDataRequest->dataLen);
+ formatDataRequest->dataLen);
if (!s)
{
}
Stream_Write_UINT32(s,
- formatDataRequest->requestedFormatId); /* requestedFormatId (4 bytes) */
+ formatDataRequest->requestedFormatId); /* requestedFormatId (4 bytes) */
WLog_Print(cliprdr->log, WLOG_DEBUG, "ClientFormatDataRequest");
return cliprdr_packet_send(cliprdr, s);
}
* @return 0 on success, otherwise a Win32 error code
*/
static UINT cliprdr_client_format_data_response(CliprdrClientContext* context,
- CLIPRDR_FORMAT_DATA_RESPONSE* formatDataResponse)
+ CLIPRDR_FORMAT_DATA_RESPONSE* formatDataResponse)
{
wStream* s;
cliprdrPlugin* cliprdr = (cliprdrPlugin*) context->handle;
formatDataResponse->msgType = CB_FORMAT_DATA_RESPONSE;
s = cliprdr_packet_new(formatDataResponse->msgType,
- formatDataResponse->msgFlags, formatDataResponse->dataLen);
+ formatDataResponse->msgFlags, formatDataResponse->dataLen);
if (!s)
{
}
Stream_Write(s, formatDataResponse->requestedFormatData,
- formatDataResponse->dataLen);
+ formatDataResponse->dataLen);
WLog_Print(cliprdr->log, WLOG_DEBUG, "ClientFormatDataResponse");
return cliprdr_packet_send(cliprdr, s);
}
* @return 0 on success, otherwise a Win32 error code
*/
static UINT cliprdr_client_file_contents_request(CliprdrClientContext* context,
- CLIPRDR_FILE_CONTENTS_REQUEST* fileContentsRequest)
+ CLIPRDR_FILE_CONTENTS_REQUEST* fileContentsRequest)
{
wStream* s;
cliprdrPlugin* cliprdr = (cliprdrPlugin*) context->handle;
Stream_Write_UINT32(s, fileContentsRequest->streamId); /* streamId (4 bytes) */
Stream_Write_UINT32(s,
- fileContentsRequest->listIndex); /* listIndex (4 bytes) */
+ fileContentsRequest->listIndex); /* listIndex (4 bytes) */
Stream_Write_UINT32(s, fileContentsRequest->dwFlags); /* dwFlags (4 bytes) */
Stream_Write_UINT32(s,
- fileContentsRequest->nPositionLow); /* nPositionLow (4 bytes) */
+ fileContentsRequest->nPositionLow); /* nPositionLow (4 bytes) */
Stream_Write_UINT32(s,
- fileContentsRequest->nPositionHigh); /* nPositionHigh (4 bytes) */
+ fileContentsRequest->nPositionHigh); /* nPositionHigh (4 bytes) */
Stream_Write_UINT32(s,
- fileContentsRequest->cbRequested); /* cbRequested (4 bytes) */
+ fileContentsRequest->cbRequested); /* cbRequested (4 bytes) */
Stream_Write_UINT32(s,
- fileContentsRequest->clipDataId); /* clipDataId (4 bytes) */
+ fileContentsRequest->clipDataId); /* clipDataId (4 bytes) */
WLog_Print(cliprdr->log, WLOG_DEBUG,
- "ClientFileContentsRequest: streamId: 0x%04X",
- fileContentsRequest->streamId);
+ "ClientFileContentsRequest: streamId: 0x%04X",
+ fileContentsRequest->streamId);
return cliprdr_packet_send(cliprdr, s);
}
* @return 0 on success, otherwise a Win32 error code
*/
static UINT cliprdr_client_file_contents_response(CliprdrClientContext* context,
- CLIPRDR_FILE_CONTENTS_RESPONSE* fileContentsResponse)
+ CLIPRDR_FILE_CONTENTS_RESPONSE* fileContentsResponse)
{
wStream* s;
cliprdrPlugin* cliprdr = (cliprdrPlugin*) context->handle;
fileContentsResponse->cbRequested = sizeof(UINT64);
s = cliprdr_packet_new(CB_FILECONTENTS_RESPONSE, fileContentsResponse->msgFlags,
- 4 + fileContentsResponse->cbRequested);
+ 4 + fileContentsResponse->cbRequested);
if (!s)
{
* FILECONTENTS_RANGE: file data from requested range
*/
Stream_Write(s, fileContentsResponse->requestedData,
- fileContentsResponse->cbRequested);
+ fileContentsResponse->cbRequested);
WLog_Print(cliprdr->log, WLOG_DEBUG,
- "ClientFileContentsResponse: streamId: 0x%04X",
- fileContentsResponse->streamId);
+ "ClientFileContentsResponse: streamId: 0x%04X",
+ fileContentsResponse->streamId);
return cliprdr_packet_send(cliprdr, s);
}
* @return 0 on success, otherwise a Win32 error code
*/
static UINT cliprdr_virtual_channel_event_data_received(cliprdrPlugin* cliprdr,
- void* pData, UINT32 dataLength, UINT32 totalLength, UINT32 dataFlags)
+ void* pData, UINT32 dataLength, UINT32 totalLength, UINT32 dataFlags)
{
wStream* data_in;
}
static VOID VCAPITYPE cliprdr_virtual_channel_open_event(DWORD openHandle,
- UINT event,
- LPVOID pData, UINT32 dataLength, UINT32 totalLength, UINT32 dataFlags)
+ UINT event,
+ LPVOID pData, UINT32 dataLength, UINT32 totalLength, UINT32 dataFlags)
{
cliprdrPlugin* cliprdr = s_TLSPluginContext;
UINT error = CHANNEL_RC_OK;
{
case CHANNEL_EVENT_DATA_RECEIVED:
error = cliprdr_virtual_channel_event_data_received(cliprdr, pData, dataLength,
- totalLength, dataFlags);
+ totalLength, dataFlags);
break;
case CHANNEL_EVENT_WRITE_COMPLETE:
if (error && cliprdr->context->rdpcontext)
setChannelError(cliprdr->context->rdpcontext, error,
- "cliprdr_virtual_channel_open_event reported an error");
+ "cliprdr_virtual_channel_open_event reported an error");
}
static void* cliprdr_virtual_channel_client_thread(void* arg)
cliprdrPlugin* cliprdr = (cliprdrPlugin*) arg;
UINT error = CHANNEL_RC_OK;
+ freerdp_channel_init_thread_context(cliprdr->context->rdpcontext);
+
while (1)
{
if (!MessageQueue_Wait(cliprdr->queue))
if (error && cliprdr->context->rdpcontext)
setChannelError(cliprdr->context->rdpcontext, error,
- "cliprdr_virtual_channel_client_thread reported an error");
+ "cliprdr_virtual_channel_client_thread reported an error");
ExitThread((DWORD)error);
return NULL;
* @return 0 on success, otherwise a Win32 error code
*/
static UINT cliprdr_virtual_channel_event_connected(cliprdrPlugin* cliprdr,
- LPVOID pData, UINT32 dataLength)
+ LPVOID pData, UINT32 dataLength)
{
UINT32 status;
status = cliprdr->channelEntryPoints.pVirtualChannelOpen(cliprdr->InitHandle,
- &cliprdr->OpenHandle, cliprdr->channelDef.name,
- cliprdr_virtual_channel_open_event);
+ &cliprdr->OpenHandle, cliprdr->channelDef.name,
+ cliprdr_virtual_channel_open_event);
if (status != CHANNEL_RC_OK)
{
WLog_ERR(TAG, "pVirtualChannelOpen failed with %s [%08X]",
- WTSErrorToString(status), status);
+ WTSErrorToString(status), status);
return status;
}
}
if (!(cliprdr->thread = CreateThread(NULL, 0,
- (LPTHREAD_START_ROUTINE) cliprdr_virtual_channel_client_thread, (void*) cliprdr,
- 0, NULL)))
+ (LPTHREAD_START_ROUTINE) cliprdr_virtual_channel_client_thread, (void*) cliprdr,
+ 0, NULL)))
{
WLog_ERR(TAG, "CreateThread failed!");
MessageQueue_Free(cliprdr->queue);
if (CHANNEL_RC_OK != rc)
{
WLog_ERR(TAG, "pVirtualChannelClose failed with %s [%08X]",
- WTSErrorToString(rc), rc);
+ WTSErrorToString(rc), rc);
return rc;
}
}
static VOID VCAPITYPE cliprdr_virtual_channel_init_event(LPVOID pInitHandle,
- UINT event, LPVOID pData,
- UINT dataLength)
+ UINT event, LPVOID pData,
+ UINT dataLength)
{
cliprdrPlugin* cliprdr = s_TLSPluginContext;
UINT error = CHANNEL_RC_OK;
{
case CHANNEL_EVENT_CONNECTED:
if ((error = cliprdr_virtual_channel_event_connected(cliprdr, pData,
- dataLength)))
+ dataLength)))
WLog_ERR(TAG, "cliprdr_virtual_channel_event_connected failed with error %lu!",
- error);
+ error);
break;
case CHANNEL_EVENT_DISCONNECTED:
if ((error = cliprdr_virtual_channel_event_disconnected(cliprdr)))
WLog_ERR(TAG,
- "cliprdr_virtual_channel_event_disconnected failed with error %lu!", error);
+ "cliprdr_virtual_channel_event_disconnected failed with error %lu!", error);
break;
case CHANNEL_EVENT_TERMINATED:
if ((error = cliprdr_virtual_channel_event_terminated(cliprdr)))
WLog_ERR(TAG, "cliprdr_virtual_channel_event_terminated failed with error %lu!",
- error);
+ error);
break;
}
if (error && cliprdr->context->rdpcontext)
setChannelError(cliprdr->context->rdpcontext, error,
- "cliprdr_virtual_channel_init_event reported an error");
+ "cliprdr_virtual_channel_init_event reported an error");
}
/* cliprdr is always built-in */
cliprdr->canLockClipData = FALSE;
WLog_Print(cliprdr->log, WLOG_DEBUG, "VirtualChannelEntry");
CopyMemory(&(cliprdr->channelEntryPoints), pEntryPoints,
- sizeof(CHANNEL_ENTRY_POINTS_FREERDP));
+ sizeof(CHANNEL_ENTRY_POINTS_FREERDP));
rc = cliprdr->channelEntryPoints.pVirtualChannelInit(&cliprdr->InitHandle,
- &cliprdr->channelDef, 1, VIRTUAL_CHANNEL_VERSION_WIN2000,
- cliprdr_virtual_channel_init_event);
+ &cliprdr->channelDef, 1, VIRTUAL_CHANNEL_VERSION_WIN2000,
+ cliprdr_virtual_channel_init_event);
if (CHANNEL_RC_OK != rc)
{
WLog_ERR(TAG, "pVirtualChannelInit failed with %s [%08X]",
- WTSErrorToString(rc), rc);
+ WTSErrorToString(rc), rc);
free(cliprdr->context);
free(cliprdr);
return FALSE;
}
cliprdr->channelEntryPoints.pInterface = *
- (cliprdr->channelEntryPoints.ppInterface);
+ (cliprdr->channelEntryPoints.ppInterface);
cliprdr->channelEntryPoints.ppInterface = &
- (cliprdr->channelEntryPoints.pInterface);
+ (cliprdr->channelEntryPoints.pInterface);
s_TLSPluginContext = cliprdr;
return TRUE;
}
BytesReturned = 0;
BytesToRead = CLIPRDR_HEADER_LENGTH - Stream_GetPosition(s);
- status = WaitForSingleObject(cliprdr->ChannelEvent, 0);
+ status = WaitForSingleObject(cliprdr->ChannelEvent, 0);
if (status == WAIT_FAILED)
- {
- error = GetLastError();
- WLog_ERR(TAG, "WaitForSingleObject failed with error %lu", error);
- return error;
- }
+ {
+ error = GetLastError();
+ WLog_ERR(TAG, "WaitForSingleObject failed with error %lu", error);
+ return error;
+ }
- if (status == WAIT_TIMEOUT)
- return CHANNEL_RC_OK;
+ if (status == WAIT_TIMEOUT)
+ return CHANNEL_RC_OK;
if (!WTSVirtualChannelRead(cliprdr->ChannelHandle, 0,
(PCHAR) Stream_Pointer(s), BytesToRead, &BytesReturned))
BytesReturned = 0;
BytesToRead = (header.dataLen + CLIPRDR_HEADER_LENGTH) - Stream_GetPosition(s);
- status = WaitForSingleObject(cliprdr->ChannelEvent, 0);
+ status = WaitForSingleObject(cliprdr->ChannelEvent, 0);
- if (status == WAIT_FAILED)
- {
- error = GetLastError();
- WLog_ERR(TAG, "WaitForSingleObject failed with error %lu", error);
- return error;
- }
+ if (status == WAIT_FAILED)
+ {
+ error = GetLastError();
+ WLog_ERR(TAG, "WaitForSingleObject failed with error %lu", error);
+ return error;
+ }
- if (status == WAIT_TIMEOUT)
- return CHANNEL_RC_OK;
+ if (status == WAIT_TIMEOUT)
+ return CHANNEL_RC_OK;
if (!WTSVirtualChannelRead(cliprdr->ChannelHandle, 0,
(PCHAR) Stream_Pointer(s), BytesToRead, &BytesReturned))
/* check for trailing zero bytes */
- status = WaitForSingleObject(cliprdr->ChannelEvent, 0);
+ status = WaitForSingleObject(cliprdr->ChannelEvent, 0);
- if (status == WAIT_FAILED)
- {
- error = GetLastError();
- WLog_ERR(TAG, "WaitForSingleObject failed with error %lu", error);
- return error;
- }
+ if (status == WAIT_FAILED)
+ {
+ error = GetLastError();
+ WLog_ERR(TAG, "WaitForSingleObject failed with error %lu", error);
+ return error;
+ }
- if (status == WAIT_TIMEOUT)
- return CHANNEL_RC_OK;
+ if (status == WAIT_TIMEOUT)
+ return CHANNEL_RC_OK;
BytesReturned = 0;
BytesToRead = 4;
CliprdrServerPrivate* cliprdr = (CliprdrServerPrivate*) context->handle;
UINT error;
+ freerdp_channel_init_thread_context(context->rdpcontext);
ChannelEvent = context->GetEventHandle(context);
nCount = 0;
if (status == WAIT_FAILED)
{
- error = GetLastError();
- WLog_ERR(TAG, "WaitForMultipleObjects failed with error %lu", error);
- goto out;
+ error = GetLastError();
+ WLog_ERR(TAG, "WaitForMultipleObjects failed with error %lu", error);
+ goto out;
}
- status = WaitForSingleObject(cliprdr->StopEvent, 0);
+ status = WaitForSingleObject(cliprdr->StopEvent, 0);
- if (status == WAIT_FAILED)
- {
- error = GetLastError();
- WLog_ERR(TAG, "WaitForSingleObject failed with error %lu", error);
- goto out;
- }
+ if (status == WAIT_FAILED)
+ {
+ error = GetLastError();
+ WLog_ERR(TAG, "WaitForSingleObject failed with error %lu", error);
+ goto out;
+ }
if (status == WAIT_OBJECT_0)
break;
- status = WaitForSingleObject(ChannelEvent, 0);
+ status = WaitForSingleObject(ChannelEvent, 0);
- if (status == WAIT_FAILED)
- {
- error = GetLastError();
- WLog_ERR(TAG, "WaitForSingleObject failed with error %lu", error);
- goto out;
- }
+ if (status == WAIT_FAILED)
+ {
+ error = GetLastError();
+ WLog_ERR(TAG, "WaitForSingleObject failed with error %lu", error);
+ goto out;
+ }
if (status == WAIT_OBJECT_0)
{
{
SetEvent(cliprdr->StopEvent);
if (WaitForSingleObject(cliprdr->Thread, INFINITE) == WAIT_FAILED)
- {
- error = GetLastError();
- WLog_ERR(TAG, "WaitForSingleObject failed with error %lu", error);
- return error;
- }
+ {
+ error = GetLastError();
+ WLog_ERR(TAG, "WaitForSingleObject failed with error %lu", error);
+ return error;
+ }
CloseHandle(cliprdr->Thread);
CloseHandle(cliprdr->StopEvent);
}
BytesReturned = 0;
ChannelEvent = NULL;
+ freerdp_channel_init_thread_context(context->rdpcontext);
s = Stream_New(NULL, 4096);
if (!s)
{
if (WaitForSingleObject(context->priv->Thread, INFINITE) == WAIT_FAILED)
{
- error = GetLastError();
- WLog_ERR(TAG, "WaitForSingleObject failed with error %lu!", error);
- return error;
+ error = GetLastError();
+ WLog_ERR(TAG, "WaitForSingleObject failed with error %lu!", error);
+ return error;
}
CloseHandle(context->priv->Thread);
DRIVE_DEVICE* drive = (DRIVE_DEVICE*) arg;
UINT error = CHANNEL_RC_OK;
+ freerdp_channel_init_thread_context(drive->rdpcontext);
while (1)
{
if (!MessageQueue_Wait(drive->IrpQueue))
if (MessageQueue_PostQuit(drive->IrpQueue, 0) && (WaitForSingleObject(drive->thread, INFINITE) == WAIT_FAILED))
{
- error = GetLastError();
- WLog_ERR(TAG, "WaitForSingleObject failed with error %lu", error);
- return error;
+ error = GetLastError();
+ WLog_ERR(TAG, "WaitForSingleObject failed with error %lu", error);
+ return error;
}
CloseHandle(drive->thread);
while (echo->echo_channel == NULL)
{
if (WaitForSingleObject(hEvent, 1000) == WAIT_FAILED)
- {
- Error = GetLastError();
- WLog_ERR(TAG, "WaitForSingleObject failed with error %lu!", Error);
- return Error;
- }
+ {
+ Error = GetLastError();
+ WLog_ERR(TAG, "WaitForSingleObject failed with error %lu!", Error);
+ return Error;
+ }
echo->echo_channel = WTSVirtualChannelOpenEx(echo->SessionId,
"ECHO", WTS_CHANNEL_OPTION_DYNAMIC);
UINT error;
DWORD status;
+ freerdp_channel_init_thread_context(echo->context.rdpcontext);
if ((error = echo_server_open_channel(echo)))
{
UINT error2 = 0;
while (ready)
{
- status = WaitForMultipleObjects(nCount, events, FALSE, INFINITE);
+ status = WaitForMultipleObjects(nCount, events, FALSE, INFINITE);
- if (status == WAIT_FAILED)
- {
- error = GetLastError();
- WLog_ERR(TAG, "WaitForMultipleObjects failed with error %lu", error);
- break;
- }
+ if (status == WAIT_FAILED)
+ {
+ error = GetLastError();
+ WLog_ERR(TAG, "WaitForMultipleObjects failed with error %lu", error);
+ break;
+ }
- if (status == WAIT_OBJECT_0)
+ if (status == WAIT_OBJECT_0)
break;
Stream_SetPosition(s, 0);
SetEvent(echo->stopEvent);
if (WaitForSingleObject(echo->thread, INFINITE) == WAIT_FAILED)
- {
- error = GetLastError();
- WLog_ERR(TAG, "WaitForSingleObject failed with error %lu", error);
- return error;
- }
+ {
+ error = GetLastError();
+ WLog_ERR(TAG, "WaitForSingleObject failed with error %lu", error);
+ return error;
+ }
CloseHandle(echo->thread);
CloseHandle(echo->stopEvent);
winpr_HexDump(Stream_Buffer(s), Stream_Length(s));
#endif
status = encomsp->channelEntryPoints.pVirtualChannelWrite(encomsp->OpenHandle,
- Stream_Buffer(s), (UINT32) Stream_Length(s), s);
+ Stream_Buffer(s), (UINT32) Stream_Length(s), s);
if (status != CHANNEL_RC_OK)
WLog_ERR(TAG, "VirtualChannelWrite failed with %s [%08X]",
- WTSErrorToString(status), status);
+ WTSErrorToString(status), status);
return status;
}
* @return 0 on success, otherwise a Win32 error code
*/
static UINT encomsp_recv_filter_updated_pdu(encomspPlugin* encomsp, wStream* s,
- ENCOMSP_ORDER_HEADER* header)
+ ENCOMSP_ORDER_HEADER* header)
{
int beg, end;
EncomspClientContext* context;
* @return 0 on success, otherwise a Win32 error code
*/
static UINT encomsp_recv_application_created_pdu(encomspPlugin* encomsp,
- wStream* s, ENCOMSP_ORDER_HEADER* header)
+ wStream* s, ENCOMSP_ORDER_HEADER* header)
{
int beg, end;
EncomspClientContext* context;
* @return 0 on success, otherwise a Win32 error code
*/
static UINT encomsp_recv_application_removed_pdu(encomspPlugin* encomsp,
- wStream* s, ENCOMSP_ORDER_HEADER* header)
+ wStream* s, ENCOMSP_ORDER_HEADER* header)
{
int beg, end;
EncomspClientContext* context;
* @return 0 on success, otherwise a Win32 error code
*/
static UINT encomsp_recv_window_created_pdu(encomspPlugin* encomsp, wStream* s,
- ENCOMSP_ORDER_HEADER* header)
+ ENCOMSP_ORDER_HEADER* header)
{
int beg, end;
EncomspClientContext* context;
* @return 0 on success, otherwise a Win32 error code
*/
static UINT encomsp_recv_window_removed_pdu(encomspPlugin* encomsp, wStream* s,
- ENCOMSP_ORDER_HEADER* header)
+ ENCOMSP_ORDER_HEADER* header)
{
int beg, end;
EncomspClientContext* context;
* @return 0 on success, otherwise a Win32 error code
*/
static UINT encomsp_recv_show_window_pdu(encomspPlugin* encomsp, wStream* s,
- ENCOMSP_ORDER_HEADER* header)
+ ENCOMSP_ORDER_HEADER* header)
{
int beg, end;
EncomspClientContext* context;
* @return 0 on success, otherwise a Win32 error code
*/
static UINT encomsp_recv_participant_created_pdu(encomspPlugin* encomsp,
- wStream* s, ENCOMSP_ORDER_HEADER* header)
+ wStream* s, ENCOMSP_ORDER_HEADER* header)
{
int beg, end;
EncomspClientContext* context;
* @return 0 on success, otherwise a Win32 error code
*/
static UINT encomsp_recv_participant_removed_pdu(encomspPlugin* encomsp,
- wStream* s, ENCOMSP_ORDER_HEADER* header)
+ wStream* s, ENCOMSP_ORDER_HEADER* header)
{
int beg, end;
EncomspClientContext* context;
if (error)
WLog_ERR(TAG, "context->ChangeParticipantControlLevel failed with error %lu",
- error);
+ error);
return error;
}
* @return 0 on success, otherwise a Win32 error code
*/
static UINT encomsp_recv_graphics_stream_paused_pdu(encomspPlugin* encomsp,
- wStream* s, ENCOMSP_ORDER_HEADER* header)
+ wStream* s, ENCOMSP_ORDER_HEADER* header)
{
int beg, end;
EncomspClientContext* context;
* @return 0 on success, otherwise a Win32 error code
*/
static UINT encomsp_recv_graphics_stream_resumed_pdu(encomspPlugin* encomsp,
- wStream* s, ENCOMSP_ORDER_HEADER* header)
+ wStream* s, ENCOMSP_ORDER_HEADER* header)
{
int beg, end;
EncomspClientContext* context;
if ((error = encomsp_recv_application_removed_pdu(encomsp, s, &header)))
{
WLog_ERR(TAG, "encomsp_recv_application_removed_pdu failed with error %lu!",
- error);
+ error);
return error;
}
if ((error = encomsp_recv_application_created_pdu(encomsp, s, &header)))
{
WLog_ERR(TAG, "encomsp_recv_application_removed_pdu failed with error %lu!",
- error);
+ error);
return error;
}
if ((error = encomsp_recv_participant_removed_pdu(encomsp, s, &header)))
{
WLog_ERR(TAG, "encomsp_recv_participant_removed_pdu failed with error %lu!",
- error);
+ error);
return error;
}
if ((error = encomsp_recv_participant_created_pdu(encomsp, s, &header)))
{
WLog_ERR(TAG, "encomsp_recv_participant_created_pdu failed with error %lu!",
- error);
+ error);
return error;
}
case ODTYPE_PARTICIPANT_CTRL_CHANGED:
if ((error = encomsp_recv_change_participant_control_level_pdu(encomsp, s,
- &header)))
+ &header)))
{
WLog_ERR(TAG,
- "encomsp_recv_change_participant_control_level_pdu failed with error %lu!",
- error);
+ "encomsp_recv_change_participant_control_level_pdu failed with error %lu!",
+ error);
return error;
}
if ((error = encomsp_recv_graphics_stream_paused_pdu(encomsp, s, &header)))
{
WLog_ERR(TAG, "encomsp_recv_graphics_stream_paused_pdu failed with error %lu!",
- error);
+ error);
return error;
}
if ((error = encomsp_recv_graphics_stream_resumed_pdu(encomsp, s, &header)))
{
WLog_ERR(TAG, "encomsp_recv_graphics_stream_resumed_pdu failed with error %lu!",
- error);
+ error);
return error;
}
else
{
status = plugin->channelEntryPoints.pVirtualChannelWrite(plugin->OpenHandle,
- Stream_Buffer(s), (UINT32) Stream_GetPosition(s), s);
+ Stream_Buffer(s), (UINT32) Stream_GetPosition(s), s);
}
if (status != CHANNEL_RC_OK)
{
Stream_Free(s, TRUE);
WLog_ERR(TAG, "VirtualChannelWrite failed with %s [%08X]",
- WTSErrorToString(status), status);
+ WTSErrorToString(status), status);
}
return status;
* @return 0 on success, otherwise a Win32 error code
*/
static UINT encomsp_virtual_channel_event_data_received(encomspPlugin* encomsp,
- void* pData, UINT32 dataLength, UINT32 totalLength, UINT32 dataFlags)
+ void* pData, UINT32 dataLength, UINT32 totalLength, UINT32 dataFlags)
{
wStream* data_in;
}
static VOID VCAPITYPE encomsp_virtual_channel_open_event(DWORD openHandle,
- UINT event,
- LPVOID pData, UINT32 dataLength, UINT32 totalLength, UINT32 dataFlags)
+ UINT event,
+ LPVOID pData, UINT32 dataLength, UINT32 totalLength, UINT32 dataFlags)
{
encomspPlugin* encomsp = s_TLSPluginContext;
UINT error = CHANNEL_RC_OK;
{
case CHANNEL_EVENT_DATA_RECEIVED:
if ((error = encomsp_virtual_channel_event_data_received(encomsp, pData,
- dataLength, totalLength, dataFlags)))
+ dataLength, totalLength, dataFlags)))
WLog_ERR(TAG,
- "encomsp_virtual_channel_event_data_received failed with error %lu", error);
+ "encomsp_virtual_channel_event_data_received failed with error %lu", error);
break;
if (error && encomsp->rdpcontext)
setChannelError(encomsp->rdpcontext, error,
- "encomsp_virtual_channel_open_event reported an error");
+ "encomsp_virtual_channel_open_event reported an error");
return;
}
wMessage message;
encomspPlugin* encomsp = (encomspPlugin*) arg;
UINT error = CHANNEL_RC_OK;
+
+ freerdp_channel_init_thread_context(encomsp->rdpcontext);
encomsp_process_connect(encomsp);
while (1)
if (error && encomsp->rdpcontext)
setChannelError(encomsp->rdpcontext, error,
- "encomsp_virtual_channel_client_thread reported an error");
+ "encomsp_virtual_channel_client_thread reported an error");
ExitThread((DWORD)error);
return NULL;
* @return 0 on success, otherwise a Win32 error code
*/
static UINT encomsp_virtual_channel_event_connected(encomspPlugin* encomsp,
- LPVOID pData, UINT32 dataLength)
+ LPVOID pData, UINT32 dataLength)
{
UINT32 status;
status = encomsp->channelEntryPoints.pVirtualChannelOpen(encomsp->InitHandle,
- &encomsp->OpenHandle, encomsp->channelDef.name,
- encomsp_virtual_channel_open_event);
+ &encomsp->OpenHandle, encomsp->channelDef.name,
+ encomsp_virtual_channel_open_event);
if (status != CHANNEL_RC_OK)
{
WLog_ERR(TAG, "pVirtualChannelOpen failed with %s [%08X]",
- WTSErrorToString(status), status);
+ WTSErrorToString(status), status);
return status;
}
}
if (!(encomsp->thread = CreateThread(NULL, 0,
- (LPTHREAD_START_ROUTINE) encomsp_virtual_channel_client_thread, (void*) encomsp,
- 0, NULL)))
+ (LPTHREAD_START_ROUTINE) encomsp_virtual_channel_client_thread, (void*) encomsp,
+ 0, NULL)))
{
WLog_ERR(TAG, "CreateThread failed!");
MessageQueue_Free(encomsp->queue);
if (CHANNEL_RC_OK != rc)
{
WLog_ERR(TAG, "pVirtualChannelClose failed with %s [%08X]",
- WTSErrorToString(rc), rc);
+ WTSErrorToString(rc), rc);
return rc;
}
}
static VOID VCAPITYPE encomsp_virtual_channel_init_event(LPVOID pInitHandle,
- UINT event, LPVOID pData,
- UINT dataLength)
+ UINT event, LPVOID pData,
+ UINT dataLength)
{
encomspPlugin* encomsp = s_TLSPluginContext;
UINT error = CHANNEL_RC_OK;
{
case CHANNEL_EVENT_CONNECTED:
if ((error = encomsp_virtual_channel_event_connected(encomsp, pData,
- dataLength)))
+ dataLength)))
WLog_ERR(TAG, "encomsp_virtual_channel_event_connected failed with error %lu",
- error);
+ error);
break;
case CHANNEL_EVENT_DISCONNECTED:
if ((error = encomsp_virtual_channel_event_disconnected(encomsp)))
WLog_ERR(TAG,
- "encomsp_virtual_channel_event_disconnected failed with error %lu", error);
+ "encomsp_virtual_channel_event_disconnected failed with error %lu", error);
break;
if (error && encomsp->rdpcontext)
setChannelError(encomsp->rdpcontext, error,
- "encomsp_virtual_channel_init_event reported an error");
+ "encomsp_virtual_channel_init_event reported an error");
}
/* encomsp is always built-in */
}
CopyMemory(&(encomsp->channelEntryPoints), pEntryPoints,
- sizeof(CHANNEL_ENTRY_POINTS_FREERDP));
+ sizeof(CHANNEL_ENTRY_POINTS_FREERDP));
rc = encomsp->channelEntryPoints.pVirtualChannelInit(&encomsp->InitHandle,
- &encomsp->channelDef, 1, VIRTUAL_CHANNEL_VERSION_WIN2000,
- encomsp_virtual_channel_init_event);
+ &encomsp->channelDef, 1, VIRTUAL_CHANNEL_VERSION_WIN2000,
+ encomsp_virtual_channel_init_event);
if (CHANNEL_RC_OK != rc)
{
WLog_ERR(TAG, "pVirtualChannelInit failed with %s [%08X]",
- WTSErrorToString(rc), rc);
+ WTSErrorToString(rc), rc);
goto error_out;
}
encomsp->channelEntryPoints.pInterface = *
- (encomsp->channelEntryPoints.ppInterface);
+ (encomsp->channelEntryPoints.ppInterface);
encomsp->channelEntryPoints.ppInterface = &
- (encomsp->channelEntryPoints.pInterface);
+ (encomsp->channelEntryPoints.pInterface);
s_TLSPluginContext = encomsp;
return TRUE;
error_out:
context = (EncomspServerContext*) arg;
+ freerdp_channel_init_thread_context(context->rdpcontext);
buffer = NULL;
BytesReturned = 0;
ChannelEvent = NULL;
while (1)
{
- status = WaitForMultipleObjects(nCount, events, FALSE, INFINITE);
+ status = WaitForMultipleObjects(nCount, events, FALSE, INFINITE);
- if (status == WAIT_FAILED)
- {
- error = GetLastError();
- WLog_ERR(TAG, "WaitForMultipleObjects failed with error %lu", error);
- break;
- }
+ if (status == WAIT_FAILED)
+ {
+ error = GetLastError();
+ WLog_ERR(TAG, "WaitForMultipleObjects failed with error %lu", error);
+ break;
+ }
- status = WaitForSingleObject(context->priv->StopEvent, 0);
+ status = WaitForSingleObject(context->priv->StopEvent, 0);
- if (status == WAIT_FAILED)
- {
- error = GetLastError();
- WLog_ERR(TAG, "WaitForSingleObject failed with error %lu", error);
- break;
- }
+ if (status == WAIT_FAILED)
+ {
+ error = GetLastError();
+ WLog_ERR(TAG, "WaitForSingleObject failed with error %lu", error);
+ break;
+ }
if (status == WAIT_OBJECT_0)
{
if (WaitForSingleObject(context->priv->Thread, INFINITE) == WAIT_FAILED)
{
- error = GetLastError();
- WLog_ERR(TAG, "WaitForSingleObject failed with error %lu", error);
- return error;
+ error = GetLastError();
+ WLog_ERR(TAG, "WaitForSingleObject failed with error %lu", error);
+ return error;
}
CloseHandle(context->priv->Thread);
PARALLEL_DEVICE* parallel = (PARALLEL_DEVICE*) arg;
UINT error = CHANNEL_RC_OK;
+ freerdp_channel_init_thread_context(parallel->rdpcontext);
while (1)
{
if (!MessageQueue_Wait(parallel->queue))
if (MessageQueue_PostQuit(parallel->queue, 0) && (WaitForSingleObject(parallel->thread, INFINITE) == WAIT_FAILED))
{
- error = GetLastError();
- WLog_ERR(TAG, "WaitForSingleObject failed with error %lu!", error);
- return error;
+ error = GetLastError();
+ WLog_ERR(TAG, "WaitForSingleObject failed with error %lu!", error);
+ return error;
}
CloseHandle(parallel->thread);
HANDLE obj[] = {printer_dev->event, printer_dev->stopEvent};
UINT error = CHANNEL_RC_OK;
+ freerdp_channel_init_thread_context(printer_dev->rdpcontext);
while (1)
{
DWORD rc = WaitForMultipleObjects(2, obj, FALSE, INFINITE);
- if (rc == WAIT_FAILED)
- {
- error = GetLastError();
- WLog_ERR(TAG, "WaitForMultipleObjects failed with error %lu!", error);
- break;
- }
+ if (rc == WAIT_FAILED)
+ {
+ error = GetLastError();
+ WLog_ERR(TAG, "WaitForMultipleObjects failed with error %lu!", error);
+ break;
+ }
if (rc == WAIT_OBJECT_0 + 1)
break;
SetEvent(printer_dev->stopEvent);
if (WaitForSingleObject(printer_dev->thread, INFINITE) == WAIT_FAILED)
{
- error = GetLastError();
- WLog_ERR(TAG, "WaitForSingleObject failed with error %lu", error);
- return error;
+ error = GetLastError();
+ WLog_ERR(TAG, "WaitForSingleObject failed with error %lu", error);
+ return error;
}
while ((irp = (IRP*) InterlockedPopEntrySList(printer_dev->pIrpList)) != NULL)
else
{
status = rail->channelEntryPoints.pVirtualChannelWrite(rail->OpenHandle,
- Stream_Buffer(s), (UINT32) Stream_GetPosition(s), s);
+ Stream_Buffer(s), (UINT32) Stream_GetPosition(s), s);
}
if (status != CHANNEL_RC_OK)
{
Stream_Free(s, TRUE);
WLog_ERR(TAG, "VirtualChannelWrite failed with %s [%08X]",
- WTSErrorToString(status), status);
+ WTSErrorToString(status), status);
}
return status;
* @return 0 on success, otherwise a Win32 error code
*/
static UINT rail_client_execute(RailClientContext* context,
- RAIL_EXEC_ORDER* exec)
+ RAIL_EXEC_ORDER* exec)
{
char* exeOrFile;
railPlugin* rail = (railPlugin*) context->handle;
}
rail_string_to_unicode_string(exec->RemoteApplicationProgram,
- &exec->exeOrFile); /* RemoteApplicationProgram */
+ &exec->exeOrFile); /* RemoteApplicationProgram */
rail_string_to_unicode_string(exec->RemoteApplicationWorkingDir,
- &exec->workingDir); /* ShellWorkingDirectory */
+ &exec->workingDir); /* ShellWorkingDirectory */
rail_string_to_unicode_string(exec->RemoteApplicationArguments,
- &exec->arguments); /* RemoteApplicationCmdLine */
+ &exec->arguments); /* RemoteApplicationCmdLine */
return rail_send_client_exec_order(rail, exec);
}
* @return 0 on success, otherwise a Win32 error code
*/
static UINT rail_client_activate(RailClientContext* context,
- RAIL_ACTIVATE_ORDER* activate)
+ RAIL_ACTIVATE_ORDER* activate)
{
railPlugin* rail = (railPlugin*) context->handle;
return rail_send_client_activate_order(rail, activate);
* @return 0 on success, otherwise a Win32 error code
*/
static UINT rail_send_client_sysparam(RailClientContext* context,
- RAIL_SYSPARAM_ORDER* sysparam)
+ RAIL_SYSPARAM_ORDER* sysparam)
{
wStream* s;
int length;
* @return 0 on success, otherwise a Win32 error code
*/
static UINT rail_client_system_param(RailClientContext* context,
- RAIL_SYSPARAM_ORDER* sysparam)
+ RAIL_SYSPARAM_ORDER* sysparam)
{
UINT error = CHANNEL_RC_OK;
* @return 0 on success, otherwise a Win32 error code
*/
static UINT rail_server_system_param(RailClientContext* context,
- RAIL_SYSPARAM_ORDER* sysparam)
+ RAIL_SYSPARAM_ORDER* sysparam)
{
return CHANNEL_RC_OK; /* stub - should be registered by client */
}
* @return 0 on success, otherwise a Win32 error code
*/
static UINT rail_client_system_command(RailClientContext* context,
- RAIL_SYSCOMMAND_ORDER* syscommand)
+ RAIL_SYSCOMMAND_ORDER* syscommand)
{
railPlugin* rail = (railPlugin*) context->handle;
return rail_send_client_syscommand_order(rail, syscommand);
* @return 0 on success, otherwise a Win32 error code
*/
static UINT rail_client_handshake(RailClientContext* context,
- RAIL_HANDSHAKE_ORDER* handshake)
+ RAIL_HANDSHAKE_ORDER* handshake)
{
railPlugin* rail = (railPlugin*) context->handle;
return rail_send_handshake_order(rail, handshake);
* @return 0 on success, otherwise a Win32 error code
*/
static UINT rail_server_handshake(RailClientContext* context,
- RAIL_HANDSHAKE_ORDER* handshake)
+ RAIL_HANDSHAKE_ORDER* handshake)
{
return CHANNEL_RC_OK; /* stub - should be registered by client */
}
* @return 0 on success, otherwise a Win32 error code
*/
static UINT rail_client_handshake_ex(RailClientContext* context,
- RAIL_HANDSHAKE_EX_ORDER* handshakeEx)
+ RAIL_HANDSHAKE_EX_ORDER* handshakeEx)
{
railPlugin* rail = (railPlugin*) context->handle;
return rail_send_handshake_ex_order(rail, handshakeEx);
* @return 0 on success, otherwise a Win32 error code
*/
static UINT rail_server_handshake_ex(RailClientContext* context,
- RAIL_HANDSHAKE_EX_ORDER* handshakeEx)
+ RAIL_HANDSHAKE_EX_ORDER* handshakeEx)
{
return CHANNEL_RC_OK; /* stub - should be registered by client */
}
* @return 0 on success, otherwise a Win32 error code
*/
static UINT rail_client_notify_event(RailClientContext* context,
- RAIL_NOTIFY_EVENT_ORDER* notifyEvent)
+ RAIL_NOTIFY_EVENT_ORDER* notifyEvent)
{
railPlugin* rail = (railPlugin*) context->handle;
return rail_send_client_notify_event_order(rail, notifyEvent);
* @return 0 on success, otherwise a Win32 error code
*/
static UINT rail_client_window_move(RailClientContext* context,
- RAIL_WINDOW_MOVE_ORDER* windowMove)
+ RAIL_WINDOW_MOVE_ORDER* windowMove)
{
railPlugin* rail = (railPlugin*) context->handle;
return rail_send_client_window_move_order(rail, windowMove);
* @return 0 on success, otherwise a Win32 error code
*/
static UINT rail_server_local_move_size(RailClientContext* context,
- RAIL_LOCALMOVESIZE_ORDER* localMoveSize)
+ RAIL_LOCALMOVESIZE_ORDER* localMoveSize)
{
return CHANNEL_RC_OK; /* stub - should be registered by client */
}
* @return 0 on success, otherwise a Win32 error code
*/
static UINT rail_server_min_max_info(RailClientContext* context,
- RAIL_MINMAXINFO_ORDER* minMaxInfo)
+ RAIL_MINMAXINFO_ORDER* minMaxInfo)
{
return CHANNEL_RC_OK; /* stub - should be registered by client */
}
* @return 0 on success, otherwise a Win32 error code
*/
static UINT rail_client_information(RailClientContext* context,
- RAIL_CLIENT_STATUS_ORDER* clientStatus)
+ RAIL_CLIENT_STATUS_ORDER* clientStatus)
{
railPlugin* rail = (railPlugin*) context->handle;
return rail_send_client_status_order(rail, clientStatus);
* @return 0 on success, otherwise a Win32 error code
*/
static UINT rail_client_system_menu(RailClientContext* context,
- RAIL_SYSMENU_ORDER* sysmenu)
+ RAIL_SYSMENU_ORDER* sysmenu)
{
railPlugin* rail = (railPlugin*) context->handle;
return rail_send_client_sysmenu_order(rail, sysmenu);
* @return 0 on success, otherwise a Win32 error code
*/
static UINT rail_client_language_bar_info(RailClientContext* context,
- RAIL_LANGBAR_INFO_ORDER* langBarInfo)
+ RAIL_LANGBAR_INFO_ORDER* langBarInfo)
{
railPlugin* rail = (railPlugin*) context->handle;
return rail_send_client_langbar_info_order(rail, langBarInfo);
* @return 0 on success, otherwise a Win32 error code
*/
static UINT rail_server_language_bar_info(RailClientContext* context,
- RAIL_LANGBAR_INFO_ORDER* langBarInfo)
+ RAIL_LANGBAR_INFO_ORDER* langBarInfo)
{
return CHANNEL_RC_OK; /* stub - should be registered by client */
}
* @return 0 on success, otherwise a Win32 error code
*/
static UINT rail_server_execute_result(RailClientContext* context,
- RAIL_EXEC_RESULT_ORDER* execResult)
+ RAIL_EXEC_RESULT_ORDER* execResult)
{
return CHANNEL_RC_OK; /* stub - should be registered by client */
}
* @return 0 on success, otherwise a Win32 error code
*/
static UINT rail_client_get_appid_request(RailClientContext* context,
- RAIL_GET_APPID_REQ_ORDER* getAppIdReq)
+ RAIL_GET_APPID_REQ_ORDER* getAppIdReq)
{
railPlugin* rail = (railPlugin*) context->handle;
return rail_send_client_get_appid_req_order(rail, getAppIdReq);
* @return 0 on success, otherwise a Win32 error code
*/
static UINT rail_server_get_appid_response(RailClientContext* context,
- RAIL_GET_APPID_RESP_ORDER* getAppIdResp)
+ RAIL_GET_APPID_RESP_ORDER* getAppIdResp)
{
return CHANNEL_RC_OK; /* stub - should be registered by client */
}
* @return 0 on success, otherwise a Win32 error code
*/
static UINT rail_virtual_channel_event_data_received(railPlugin* rail,
- void* pData, UINT32 dataLength, UINT32 totalLength, UINT32 dataFlags)
+ void* pData, UINT32 dataLength, UINT32 totalLength, UINT32 dataFlags)
{
wStream* data_in;
}
static VOID VCAPITYPE rail_virtual_channel_open_event(DWORD openHandle,
- UINT event,
- LPVOID pData, UINT32 dataLength, UINT32 totalLength, UINT32 dataFlags)
+ UINT event,
+ LPVOID pData, UINT32 dataLength, UINT32 totalLength, UINT32 dataFlags)
{
railPlugin* rail = s_TLSPluginContext;
UINT error = CHANNEL_RC_OK;
{
case CHANNEL_EVENT_DATA_RECEIVED:
if ((error = rail_virtual_channel_event_data_received(rail, pData, dataLength,
- totalLength, dataFlags)))
+ totalLength, dataFlags)))
WLog_ERR(TAG, "rail_virtual_channel_event_data_received failed with error %lu!",
- error);
+ error);
break;
if (error && rail->rdpcontext)
setChannelError(rail->rdpcontext, error,
- "rail_virtual_channel_open_event reported an error");
+ "rail_virtual_channel_open_event reported an error");
return;
}
railPlugin* rail = (railPlugin*) arg;
UINT error = CHANNEL_RC_OK;
+ freerdp_channel_init_thread_context(rail->rdpcontext);
while (1)
{
if (!MessageQueue_Wait(rail->queue))
if (error && rail->rdpcontext)
setChannelError(rail->rdpcontext, error,
- "rail_virtual_channel_client_thread reported an error");
+ "rail_virtual_channel_client_thread reported an error");
ExitThread((DWORD)error);
return NULL;
* @return 0 on success, otherwise a Win32 error code
*/
static UINT rail_virtual_channel_event_connected(railPlugin* rail, LPVOID pData,
- UINT32 dataLength)
+ UINT32 dataLength)
{
UINT status;
status = rail->channelEntryPoints.pVirtualChannelOpen(rail->InitHandle,
- &rail->OpenHandle, rail->channelDef.name, rail_virtual_channel_open_event);
+ &rail->OpenHandle, rail->channelDef.name, rail_virtual_channel_open_event);
if (status != CHANNEL_RC_OK)
{
WLog_ERR(TAG, "pVirtualChannelOpen failed with %s [%08X]",
- WTSErrorToString(status), status);
+ WTSErrorToString(status), status);
return status;
}
}
if (!(rail->thread = CreateThread(NULL, 0,
- (LPTHREAD_START_ROUTINE) rail_virtual_channel_client_thread, (void*) rail, 0,
- NULL)))
+ (LPTHREAD_START_ROUTINE) rail_virtual_channel_client_thread, (void*) rail, 0,
+ NULL)))
{
WLog_ERR(TAG, "CreateThread failed!");
MessageQueue_Free(rail->queue);
if (CHANNEL_RC_OK != rc)
{
WLog_ERR(TAG, "pVirtualChannelClose failed with %s [%08X]",
- WTSErrorToString(rc), rc);
+ WTSErrorToString(rc), rc);
return rc;
}
}
static VOID VCAPITYPE rail_virtual_channel_init_event(LPVOID pInitHandle,
- UINT event, LPVOID pData, UINT dataLength)
+ UINT event, LPVOID pData, UINT dataLength)
{
railPlugin* rail = s_TLSPluginContext;
UINT error = CHANNEL_RC_OK;
case CHANNEL_EVENT_CONNECTED:
if ((error = rail_virtual_channel_event_connected(rail, pData, dataLength)))
WLog_ERR(TAG, "rail_virtual_channel_event_connected failed with error %lu!",
- error);
+ error);
break;
case CHANNEL_EVENT_DISCONNECTED:
if ((error = rail_virtual_channel_event_disconnected(rail)))
WLog_ERR(TAG, "rail_virtual_channel_event_disconnected failed with error %lu!",
- error);
+ error);
break;
if (error && rail->rdpcontext)
setChannelError(rail->rdpcontext, error,
- "rail_virtual_channel_init_event reported an error");
+ "rail_virtual_channel_init_event reported an error");
}
/* rail is always built-in */
rail->log = WLog_Get("com.freerdp.channels.rail.client");
WLog_Print(rail->log, WLOG_DEBUG, "VirtualChannelEntry");
CopyMemory(&(rail->channelEntryPoints), pEntryPoints,
- sizeof(CHANNEL_ENTRY_POINTS_FREERDP));
+ sizeof(CHANNEL_ENTRY_POINTS_FREERDP));
rc = rail->channelEntryPoints.pVirtualChannelInit(&rail->InitHandle,
- &rail->channelDef, 1, VIRTUAL_CHANNEL_VERSION_WIN2000,
- rail_virtual_channel_init_event);
+ &rail->channelDef, 1, VIRTUAL_CHANNEL_VERSION_WIN2000,
+ rail_virtual_channel_init_event);
if (CHANNEL_RC_OK != rc)
{
WLog_ERR(TAG, "pVirtualChannelInit failed with %s [%08X]",
- WTSErrorToString(rc), rc);
+ WTSErrorToString(rc), rc);
goto error_out;
}
* @return 0 on success, otherwise a Win32 error code
*/
static UINT rdpdr_send_device_list_announce_request(rdpdrPlugin* rdpdr,
- BOOL userLoggedOn);
+ BOOL userLoggedOn);
/**
* Function description
* @return 0 on success, otherwise a Win32 error code
*/
static UINT rdpdr_send_device_list_remove_request(rdpdrPlugin* rdpdr,
- UINT32 count, UINT32 ids[])
+ UINT32 count, UINT32 ids[])
{
UINT32 i;
wStream* s;
drive_path[1] = '\0';
drive->Name = _strdup(drive_path);
devman_load_device_service(rdpdr->devman, (RDPDR_DEVICE*)drive,
- rdpdr->rdpcontext);
+ rdpdr->rdpcontext);
}
}
drive_path[1] = '\0';
drive->Name = _strdup(drive_path);
devman_load_device_service(rdpdr->devman, (RDPDR_DEVICE*)drive,
- rdpdr->rdpcontext);
+ rdpdr->rdpcontext);
rdpdr_send_device_list_announce_request(rdpdr, TRUE);
}
}
for (j = 0; j < count; j++)
{
device_ext = (DEVICE_DRIVE_EXT*)ListDictionary_GetItemValue(
- rdpdr->devman->devices, (void*)keys[j]);
+ rdpdr->devman->devices, (void*)keys[j]);
if (device_ext->path[0] == drive_name_upper
|| device_ext->path[0] == drive_name_lower)
{
// dont end on error, just report ?
WLog_ERR(TAG, "rdpdr_send_device_list_remove_request failed with error %lu!",
- error);
+ error);
}
break;
RegisterClassEx(&wnd_cls);
/* create window */
hwnd = CreateWindowEx(0, L"DRIVE_HOTPLUG", NULL,
- 0, 0, 0, 0, 0,
- NULL, NULL, NULL, NULL);
+ 0, 0, 0, 0, 0,
+ NULL, NULL, NULL, NULL);
SetWindowLongPtr(hwnd, GWLP_USERDATA, (LONG_PTR)rdpdr);
rdpdr->hotplug_wnd = hwnd;
/* register device interface to hwnd */
NotificationFilter.dbch_size = sizeof(DEV_BROADCAST_HANDLE);
NotificationFilter.dbch_devicetype = DBT_DEVTYP_HANDLE;
hDevNotify = RegisterDeviceNotification(hwnd, &NotificationFilter,
- DEVICE_NOTIFY_WINDOW_HANDLE);
+ DEVICE_NOTIFY_WINDOW_HANDLE);
/* message loop */
while ((bRet = GetMessage(&msg, 0, 0, 0)) != 0)
{
BOOL dev_found = FALSE;
device_ext = (DEVICE_DRIVE_EXT*)ListDictionary_GetItemValue(
- rdpdr->devman->devices, (void*)keys[j]);
+ rdpdr->devman->devices, (void*)keys[j]);
if (!device_ext)
continue;
if ((error = rdpdr_send_device_list_remove_request(rdpdr, 1, ids)))
{
WLog_ERR(TAG, "rdpdr_send_device_list_remove_request failed with error %lu!",
- error);
+ error);
goto cleanup;
}
}
}
if ((error = devman_load_device_service(rdpdr->devman, (RDPDR_DEVICE*)drive,
- rdpdr->rdpcontext)))
+ rdpdr->rdpcontext)))
{
WLog_ERR(TAG, "devman_load_device_service failed!");
free(drive->Path);
static void drive_hotplug_fsevent_callback(ConstFSEventStreamRef streamRef,
- void* clientCallBackInfo,
- size_t numEvents, void* eventPaths, const FSEventStreamEventFlags eventFlags[],
- const FSEventStreamEventId eventIds[])
+ void* clientCallBackInfo,
+ size_t numEvents, void* eventPaths, const FSEventStreamEventFlags eventFlags[],
+ const FSEventStreamEventId eventIds[])
{
rdpdrPlugin* rdpdr;
int i;
rdpdr = (rdpdrPlugin*) arg;
CFStringRef path = CFSTR("/Volumes/");
CFArrayRef pathsToWatch = CFArrayCreate(kCFAllocatorMalloc, (const void**)&path,
- 1, NULL);
+ 1, NULL);
FSEventStreamContext ctx;
ZeroMemory(&ctx, sizeof(ctx));
ctx.info = arg;
fsev = FSEventStreamCreate(kCFAllocatorMalloc, drive_hotplug_fsevent_callback,
- &ctx, pathsToWatch, kFSEventStreamEventIdSinceNow, 1,
- kFSEventStreamCreateFlagNone);
+ &ctx, pathsToWatch, kFSEventStreamEventIdSinceNow, 1,
+ kFSEventStreamCreateFlagNone);
rdpdr->runLoop = CFRunLoopGetCurrent();
FSEventStreamScheduleWithRunLoop(fsev, rdpdr->runLoop, kCFRunLoopDefaultMode);
FSEventStreamStart(fsev);
{
BOOL dev_found = FALSE;
device_ext = (DEVICE_DRIVE_EXT*)ListDictionary_GetItemValue(
- rdpdr->devman->devices, (void*)keys[j]);
+ rdpdr->devman->devices, (void*)keys[j]);
if (!device_ext || !device_ext->path)
continue;
if ((error = rdpdr_send_device_list_remove_request(rdpdr, 1, ids)))
{
WLog_ERR(TAG, "rdpdr_send_device_list_remove_request failed with error %lu!",
- error);
+ error);
goto cleanup;
}
}
}
if ((error = devman_load_device_service(rdpdr->devman, (RDPDR_DEVICE*)drive,
- rdpdr->rdpcontext)))
+ rdpdr->rdpcontext)))
{
WLog_ERR(TAG, "devman_load_device_service failed!");
free(drive->Path);
DWORD status;
rdpdr = (rdpdrPlugin*) arg;
+ freerdp_channel_init_thread_context(rdpdr->rdpcontext);
if (!(rdpdr->stopEvent = CreateEvent(NULL, TRUE, FALSE, NULL)))
{
WLog_ERR(TAG, "CreateEvent failed!");
if (error && rdpdr->rdpcontext)
setChannelError(rdpdr->rdpcontext, error,
- "drive_hotplug_thread_func reported an error");
+ "drive_hotplug_thread_func reported an error");
CloseHandle(rdpdr->stopEvent);
ExitThread((DWORD)error);
if (settings->ClientHostname)
strncpy(rdpdr->computerName, settings->ClientHostname,
- sizeof(rdpdr->computerName) - 1);
+ sizeof(rdpdr->computerName) - 1);
else
strncpy(rdpdr->computerName, settings->ComputerName,
- sizeof(rdpdr->computerName) - 1);
+ sizeof(rdpdr->computerName) - 1);
for (index = 0; index < settings->DeviceCount; index++)
{
first_hotplug(rdpdr);
if (!(rdpdr->hotplugThread = CreateThread(NULL, 0,
- (LPTHREAD_START_ROUTINE) drive_hotplug_thread_func, rdpdr, 0, NULL)))
+ (LPTHREAD_START_ROUTINE) drive_hotplug_thread_func, rdpdr, 0, NULL)))
{
WLog_ERR(TAG, "CreateThread failed!");
return ERROR_INTERNAL_ERROR;
}
if ((error = devman_load_device_service(rdpdr->devman, device,
- rdpdr->rdpcontext)))
+ rdpdr->rdpcontext)))
{
WLog_ERR(TAG, "devman_load_device_service failed with error %lu!", error);
return error;
}
static UINT rdpdr_process_server_announce_request(rdpdrPlugin* rdpdr,
- wStream* s)
+ wStream* s)
{
if (Stream_GetRemainingLength(s) < 8)
return ERROR_INVALID_DATA;
gethostname(rdpdr->computerName, sizeof(rdpdr->computerName) - 1);
computerNameLenW = ConvertToUnicode(CP_UTF8, 0, rdpdr->computerName, -1,
- &computerNameW, 0) * 2;
+ &computerNameW, 0) * 2;
s = Stream_New(NULL, 16 + computerNameLenW + 2);
if (!s)
Stream_Write_UINT32(s, 1); /* unicodeFlag, 0 for ASCII and 1 for Unicode */
Stream_Write_UINT32(s, 0); /* codePage, must be set to zero */
Stream_Write_UINT32(s, computerNameLenW +
- 2); /* computerNameLen, including null terminator */
+ 2); /* computerNameLen, including null terminator */
Stream_Write(s, computerNameW, computerNameLenW);
Stream_Write_UINT16(s, 0); /* null terminator */
free(computerNameW);
}
static UINT rdpdr_process_server_clientid_confirm(rdpdrPlugin* rdpdr,
- wStream* s)
+ wStream* s)
{
UINT16 versionMajor;
UINT16 versionMinor;
* @return 0 on success, otherwise a Win32 error code
*/
static UINT rdpdr_send_device_list_announce_request(rdpdrPlugin* rdpdr,
- BOOL userLoggedOn)
+ BOOL userLoggedOn)
{
int i;
BYTE c;
for (index = 0; index < keyCount; index++)
{
device = (DEVICE*) ListDictionary_GetItemValue(rdpdr->devman->devices,
- (void*) pKeys[index]);
+ (void*) pKeys[index]);
/**
* 1. versionMinor 0x0005 doesn't send PAKID_CORE_USER_LOGGEDON
count++;
WLog_INFO(TAG, "registered device #%d: %s (type=%d id=%d)",
- count, device->name, device->type, device->id);
+ count, device->name, device->type, device->id);
}
}
for (index = 0; index < keyCount; index++)
{
device = (DEVICE*) ListDictionary_GetItemValue(rdpdr->devman->devices,
- (void*) pKeys[index]);
+ (void*) pKeys[index]);
IFCALLRET(device->Init, error, device);
if (error != CHANNEL_RC_OK)
if ((error = rdpdr_send_device_list_announce_request(rdpdr, FALSE)))
{
WLog_ERR(TAG, "rdpdr_send_device_list_announce_request failed with error %lu",
- error);
+ error);
return error;
}
if ((error = rdpdr_send_device_list_announce_request(rdpdr, TRUE)))
{
WLog_ERR(TAG, "rdpdr_send_device_list_announce_request failed with error %lu",
- error);
+ error);
return error;
}
Stream_Read_UINT32(s, eventID);
WLog_ERR(TAG,
- "Ignoring unhandled message PAKID_PRN_CACHE_DATA (EventID: 0x%04X)", eventID);
+ "Ignoring unhandled message PAKID_PRN_CACHE_DATA (EventID: 0x%04X)", eventID);
}
break;
else
{
WLog_ERR(TAG, "Unknown message: Component: 0x%04X PacketId: 0x%04X", component,
- packetId);
+ packetId);
return ERROR_INVALID_DATA;
}
else
{
status = plugin->channelEntryPoints.pVirtualChannelWrite(plugin->OpenHandle,
- Stream_Buffer(s), (UINT32) Stream_GetPosition(s), s);
+ Stream_Buffer(s), (UINT32) Stream_GetPosition(s), s);
}
if (status != CHANNEL_RC_OK)
{
Stream_Free(s, TRUE);
WLog_ERR(TAG, "VirtualChannelWrite failed with %s [%08X]",
- WTSErrorToString(status), status);
+ WTSErrorToString(status), status);
}
return status;
* @return 0 on success, otherwise a Win32 error code
*/
static UINT rdpdr_virtual_channel_event_data_received(rdpdrPlugin* rdpdr,
- void* pData, UINT32 dataLength, UINT32 totalLength, UINT32 dataFlags)
+ void* pData, UINT32 dataLength, UINT32 totalLength, UINT32 dataFlags)
{
wStream* data_in;
}
static VOID VCAPITYPE rdpdr_virtual_channel_open_event(DWORD openHandle,
- UINT event,
- LPVOID pData, UINT32 dataLength, UINT32 totalLength, UINT32 dataFlags)
+ UINT event,
+ LPVOID pData, UINT32 dataLength, UINT32 totalLength, UINT32 dataFlags)
{
rdpdrPlugin* rdpdr = s_TLSPluginContext;
UINT error = CHANNEL_RC_OK;
{
case CHANNEL_EVENT_DATA_RECEIVED:
if ((error = rdpdr_virtual_channel_event_data_received(rdpdr, pData,
- dataLength, totalLength, dataFlags)))
+ dataLength, totalLength, dataFlags)))
WLog_ERR(TAG,
- "rdpdr_virtual_channel_event_data_received failed with error %lu!", error);
+ "rdpdr_virtual_channel_event_data_received failed with error %lu!", error);
break;
if (error && rdpdr->rdpcontext)
setChannelError(rdpdr->rdpcontext, error,
- "rdpdr_virtual_channel_open_event reported an error");
+ "rdpdr_virtual_channel_open_event reported an error");
return;
}
return NULL;
}
+ freerdp_channel_init_thread_context(rdpdr->rdpcontext);
+ s_TLSPluginContext = rdpdr;
if ((error = rdpdr_process_connect(rdpdr)))
{
WLog_ERR(TAG, "rdpdr_process_connect failed with error %lu!", error);
if (rdpdr->rdpcontext)
setChannelError(rdpdr->rdpcontext, error,
- "rdpdr_virtual_channel_client_thread reported an error");
+ "rdpdr_virtual_channel_client_thread reported an error");
ExitThread((DWORD) error);
return NULL;
if (rdpdr->rdpcontext)
setChannelError(rdpdr->rdpcontext, error,
- "rdpdr_virtual_channel_client_thread reported an error");
+ "rdpdr_virtual_channel_client_thread reported an error");
ExitThread((DWORD) error);
return NULL;
* @return 0 on success, otherwise a Win32 error code
*/
static UINT rdpdr_virtual_channel_event_connected(rdpdrPlugin* rdpdr,
- LPVOID pData, UINT32 dataLength)
+ LPVOID pData, UINT32 dataLength)
{
UINT32 status;
status = rdpdr->channelEntryPoints.pVirtualChannelOpen(rdpdr->InitHandle,
- &rdpdr->OpenHandle, rdpdr->channelDef.name, rdpdr_virtual_channel_open_event);
+ &rdpdr->OpenHandle, rdpdr->channelDef.name, rdpdr_virtual_channel_open_event);
if (status != CHANNEL_RC_OK)
{
WLog_ERR(TAG, "pVirtualChannelOpen failed with %s [%08X]",
- WTSErrorToString(status), status);
+ WTSErrorToString(status), status);
return status;
}
}
if (!(rdpdr->thread = CreateThread(NULL, 0,
- (LPTHREAD_START_ROUTINE) rdpdr_virtual_channel_client_thread, (void*) rdpdr, 0,
- NULL)))
+ (LPTHREAD_START_ROUTINE) rdpdr_virtual_channel_client_thread, (void*) rdpdr, 0,
+ NULL)))
{
WLog_ERR(TAG, "CreateThread failed!");
return ERROR_INTERNAL_ERROR;
if (CHANNEL_RC_OK != error)
{
WLog_ERR(TAG, "pVirtualChannelClose failed with %s [%08X]",
- WTSErrorToString(error), error);
+ WTSErrorToString(error), error);
}
rdpdr->OpenHandle = 0;
}
static VOID VCAPITYPE rdpdr_virtual_channel_init_event(LPVOID pInitHandle,
- UINT event,
- LPVOID pData, UINT dataLength)
+ UINT event,
+ LPVOID pData, UINT dataLength)
{
rdpdrPlugin* rdpdr = s_TLSPluginContext;
UINT error = CHANNEL_RC_OK;
case CHANNEL_EVENT_CONNECTED:
if ((error = rdpdr_virtual_channel_event_connected(rdpdr, pData, dataLength)))
WLog_ERR(TAG, "rdpdr_virtual_channel_event_connected failed with error %lu!",
- error);
+ error);
break;
case CHANNEL_EVENT_DISCONNECTED:
if ((error = rdpdr_virtual_channel_event_disconnected(rdpdr)))
WLog_ERR(TAG, "rdpdr_virtual_channel_event_disconnected failed with error %lu!",
- error);
+ error);
break;
if (error && rdpdr->rdpcontext)
setChannelError(rdpdr->rdpcontext, error,
- "rdpdr_virtual_channel_init_event reported an error");
+ "rdpdr_virtual_channel_init_event reported an error");
}
/* rdpdr is always built-in */
}
CopyMemory(&(rdpdr->channelEntryPoints), pEntryPoints,
- sizeof(CHANNEL_ENTRY_POINTS_FREERDP));
+ sizeof(CHANNEL_ENTRY_POINTS_FREERDP));
rc = rdpdr->channelEntryPoints.pVirtualChannelInit(&rdpdr->InitHandle,
- &rdpdr->channelDef, 1, VIRTUAL_CHANNEL_VERSION_WIN2000,
- rdpdr_virtual_channel_init_event);
+ &rdpdr->channelDef, 1, VIRTUAL_CHANNEL_VERSION_WIN2000,
+ rdpdr_virtual_channel_init_event);
if (CHANNEL_RC_OK != rc)
{
WLog_ERR(TAG, "pVirtualChannelInit failed with %s [%08X]",
- WTSErrorToString(rc), rc);
+ WTSErrorToString(rc), rc);
free(rdpdr);
return FALSE;
}
BytesReturned = 0;
ChannelEvent = NULL;
+ freerdp_channel_init_thread_context(context->rdpcontext);
s = Stream_New(NULL, 4096);
if (!s)
{
BytesReturned = 0;
status = WaitForMultipleObjects(nCount, events, FALSE, INFINITE);
- if (status == WAIT_FAILED)
- {
- error = GetLastError();
- WLog_ERR(TAG, "WaitForMultipleObjects failed with error %lu!", error);
- goto out_stream;
- }
+ if (status == WAIT_FAILED)
+ {
+ error = GetLastError();
+ WLog_ERR(TAG, "WaitForMultipleObjects failed with error %lu!", error);
+ goto out_stream;
+ }
- status = WaitForSingleObject(context->priv->StopEvent, 0);
+ status = WaitForSingleObject(context->priv->StopEvent, 0);
- if (status == WAIT_FAILED)
- {
- error = GetLastError();
- WLog_ERR(TAG, "WaitForSingleObject failed with error %lu!", error);
- goto out_stream;
- }
+ if (status == WAIT_FAILED)
+ {
+ error = GetLastError();
+ WLog_ERR(TAG, "WaitForSingleObject failed with error %lu!", error);
+ goto out_stream;
+ }
- if (status == WAIT_OBJECT_0)
+ if (status == WAIT_OBJECT_0)
break;
if (!WTSVirtualChannelRead(context->priv->ChannelHandle, 0,
{
SetEvent(context->priv->StopEvent);
if (WaitForSingleObject(context->priv->Thread, INFINITE) == WAIT_FAILED)
- {
- error = GetLastError();
- WLog_ERR(TAG, "WaitForSingleObject failed with error %lu!", error);
- return error;
- }
+ {
+ error = GetLastError();
+ WLog_ERR(TAG, "WaitForSingleObject failed with error %lu!", error);
+ return error;
+ }
CloseHandle(context->priv->Thread);
context->priv->Thread = NULL;
CloseHandle(context->priv->StopEvent);
HANDLE hdl[] = {rdpei->event, rdpei->stopEvent};
UINT error = CHANNEL_RC_OK;
+ freerdp_channel_init_thread_context(rdpei->rdpcontext);
if (!rdpei)
{
error = ERROR_INVALID_PARAMETER;
{
status = WaitForMultipleObjects(2, hdl, FALSE, 20);
- if (status == WAIT_FAILED)
- {
- error = GetLastError();
- WLog_ERR(TAG, "WaitForMultipleObjects failed with error %lu!", error);
- break;
- }
+ if (status == WAIT_FAILED)
+ {
+ error = GetLastError();
+ WLog_ERR(TAG, "WaitForMultipleObjects failed with error %lu!", error);
+ break;
+ }
if (status == WAIT_OBJECT_0 + 1)
break;
if (WaitForSingleObject(rdpei->thread, INFINITE) == WAIT_FAILED)
{
- error = GetLastError();
- WLog_ERR(TAG, "WaitForSingleObject failed with error %lu!", error);
- return error;
+ error = GetLastError();
+ WLog_ERR(TAG, "WaitForSingleObject failed with error %lu!", error);
+ return error;
}
CloseHandle(rdpei->stopEvent);
buffer = NULL;
BytesReturned = 0;
nCount = 0;
+
+ freerdp_channel_init_thread_context(context->rdpcontext);
events[nCount++] = priv->stopEvent;
events[nCount++] = priv->channelEvent;
HANDLE events[2];
UINT error = CHANNEL_RC_OK;
DWORD status;
+
+ freerdp_channel_init_thread_context(rdpsnd->rdpcontext);
events[0] = MessageQueue_Event(rdpsnd->MsgPipe->Out);
events[1] = rdpsnd->stopEvent;
if (error && rdpsnd->rdpcontext)
setChannelError(rdpsnd->rdpcontext, error,
- "rdpsnd_schedule_thread reported an error");
+ "rdpsnd_schedule_thread reported an error");
ExitThread((DWORD)error);
return NULL;
return;
rdpsnd->ClientFormats = (AUDIO_FORMAT*) malloc(sizeof(AUDIO_FORMAT) *
- rdpsnd->NumberOfServerFormats);
+ rdpsnd->NumberOfServerFormats);
for (index = 0; index < (int) rdpsnd->NumberOfServerFormats; index++)
{
#if 0
WLog_ERR(TAG, "Server ");
rdpsnd_print_audio_formats(rdpsnd->ServerFormats,
- rdpsnd->NumberOfServerFormats);
+ rdpsnd->NumberOfServerFormats);
WLog_ERR(TAG, "");
WLog_ERR(TAG, "Client ");
rdpsnd_print_audio_formats(rdpsnd->ClientFormats,
- rdpsnd->NumberOfClientFormats);
+ rdpsnd->NumberOfClientFormats);
WLog_ERR(TAG, "");
#endif
}
* @return 0 on success, otherwise a Win32 error code
*/
static UINT rdpsnd_recv_server_audio_formats_pdu(rdpsndPlugin* rdpsnd,
- wStream* s)
+ wStream* s)
{
int index;
UINT16 wVersion;
return ERROR_BAD_LENGTH;
rdpsnd->ServerFormats = (AUDIO_FORMAT*) calloc(wNumberOfFormats,
- sizeof(AUDIO_FORMAT));
+ sizeof(AUDIO_FORMAT));
if (!rdpsnd->ServerFormats)
return CHANNEL_RC_NO_MEMORY;
* @return 0 on success, otherwise a Win32 error code
*/
static UINT rdpsnd_send_training_confirm_pdu(rdpsndPlugin* rdpsnd,
- UINT16 wTimeStamp, UINT16 wPackSize)
+ UINT16 wTimeStamp, UINT16 wPackSize)
{
wStream* pdu;
pdu = Stream_New(NULL, 8);
Stream_Write_UINT16(pdu, wTimeStamp);
Stream_Write_UINT16(pdu, wPackSize);
WLog_Print(rdpsnd->log, WLOG_DEBUG,
- "Training Response: wTimeStamp: %d wPackSize: %d",
- wTimeStamp, wPackSize);
+ "Training Response: wTimeStamp: %d wPackSize: %d",
+ wTimeStamp, wPackSize);
return rdpsnd_virtual_channel_write(rdpsnd, pdu);
}
Stream_Read_UINT16(s, wTimeStamp);
Stream_Read_UINT16(s, wPackSize);
WLog_Print(rdpsnd->log, WLOG_DEBUG,
- "Training Request: wTimeStamp: %d wPackSize: %d",
- wTimeStamp, wPackSize);
+ "Training Request: wTimeStamp: %d wPackSize: %d",
+ wTimeStamp, wPackSize);
return rdpsnd_send_training_confirm_pdu(rdpsnd, wTimeStamp, wPackSize);
}
* @return 0 on success, otherwise a Win32 error code
*/
static UINT rdpsnd_recv_wave_info_pdu(rdpsndPlugin* rdpsnd, wStream* s,
- UINT16 BodySize)
+ UINT16 BodySize)
{
UINT16 wFormatNo;
AUDIO_FORMAT* format;
rdpsnd->waveDataSize = BodySize - 8;
format = &rdpsnd->ClientFormats[wFormatNo];
WLog_Print(rdpsnd->log, WLOG_DEBUG, "WaveInfo: cBlockNo: %d wFormatNo: %d",
- rdpsnd->cBlockNo, wFormatNo);
+ rdpsnd->cBlockNo, wFormatNo);
if (!rdpsnd->isOpen)
{
* @return 0 on success, otherwise a Win32 error code
*/
static UINT rdpsnd_send_wave_confirm_pdu(rdpsndPlugin* rdpsnd,
- UINT16 wTimeStamp, BYTE cConfirmedBlockNo)
+ UINT16 wTimeStamp, BYTE cConfirmedBlockNo)
{
wStream* pdu;
pdu = Stream_New(NULL, 8);
static UINT rdpsnd_confirm_wave(rdpsndPlugin* rdpsnd, RDPSND_WAVE* wave)
{
WLog_Print(rdpsnd->log, WLOG_DEBUG,
- "WaveConfirm: cBlockNo: %d wTimeStamp: %d wTimeDiff: %d",
- wave->cBlockNo, wave->wTimeStampB, wave->wTimeStampB - wave->wTimeStampA);
+ "WaveConfirm: cBlockNo: %d wTimeStamp: %d wTimeDiff: %d",
+ wave->cBlockNo, wave->wTimeStampB, wave->wTimeStampB - wave->wTimeStampA);
return rdpsnd_send_wave_confirm_pdu(rdpsnd, wave->wTimeStampB, wave->cBlockNo);
}
* @return 0 on success, otherwise a Win32 error code
*/
static UINT rdpsnd_device_send_wave_confirm_pdu(rdpsndDevicePlugin* device,
- RDPSND_WAVE* wave)
+ RDPSND_WAVE* wave)
{
if (device->DisableConfirmThread)
return rdpsnd_confirm_wave(device->rdpsnd, wave);
if (!MessageQueue_Post(device->rdpsnd->MsgPipe->Out, NULL, 0, (void*) wave,
- NULL))
+ NULL))
{
WLog_ERR(TAG, "MessageQueue_Post failed!");
return ERROR_INTERNAL_ERROR;
format = &rdpsnd->ClientFormats[rdpsnd->wCurrentFormatNo];
wave->wAudioLength = rdpsnd_compute_audio_time_length(format, size);
WLog_Print(rdpsnd->log, WLOG_DEBUG, "Wave: cBlockNo: %d wTimeStamp: %d",
- wave->cBlockNo, wave->wTimeStampA);
+ wave->cBlockNo, wave->wTimeStampA);
if (!rdpsnd->device)
{
}
static void rdpsnd_register_device_plugin(rdpsndPlugin* rdpsnd,
- rdpsndDevicePlugin* device)
+ rdpsndDevicePlugin* device)
{
if (rdpsnd->device)
{
* @return 0 on success, otherwise a Win32 error code
*/
static UINT rdpsnd_load_device_plugin(rdpsndPlugin* rdpsnd, const char* name,
- ADDIN_ARGV* args)
+ ADDIN_ARGV* args)
{
PFREERDP_RDPSND_DEVICE_ENTRY entry;
FREERDP_RDPSND_DEVICE_ENTRY_POINTS entryPoints;
\
UINT error;
entry = (PFREERDP_RDPSND_DEVICE_ENTRY)
- freerdp_load_channel_addin_entry("rdpsnd", (LPSTR) name, NULL, 0);
+ freerdp_load_channel_addin_entry("rdpsnd", (LPSTR) name, NULL, 0);
if (!entry)
return ERROR_INTERNAL_ERROR;
{
flags = COMMAND_LINE_SIGIL_NONE | COMMAND_LINE_SEPARATOR_COLON;
status = CommandLineParseArgumentsA(args->argc, (const char**) args->argv,
- rdpsnd_args, flags, rdpsnd, NULL, NULL);
+ rdpsnd_args, flags, rdpsnd, NULL, NULL);
if (status < 0)
return CHANNEL_RC_INITIALIZATION_ERROR;
if ((status = rdpsnd_load_device_plugin(rdpsnd, rdpsnd->subsystem, args)))
{
WLog_ERR(TAG, "unable to load the %s subsystem plugin because of error %lu",
- rdpsnd->subsystem, status);
+ rdpsnd->subsystem, status);
return status;
}
}
if ((status = rdpsnd_load_device_plugin(rdpsnd, subsystem_name, args)))
WLog_ERR(TAG, "unable to load the %s subsystem plugin because of error %lu",
- subsystem_name, status);
+ subsystem_name, status);
}
#endif
if ((status = rdpsnd_load_device_plugin(rdpsnd, subsystem_name, args)))
WLog_ERR(TAG, "unable to load the %s subsystem plugin because of error %lu",
- subsystem_name, status);
+ subsystem_name, status);
}
#endif
if ((status = rdpsnd_load_device_plugin(rdpsnd, subsystem_name, args)))
WLog_ERR(TAG, "unable to load the %s subsystem plugin because of error %lu",
- subsystem_name, status);
+ subsystem_name, status);
}
#endif
if ((status = rdpsnd_load_device_plugin(rdpsnd, subsystem_name, args)))
WLog_ERR(TAG, "unable to load the %s subsystem plugin because of error %lu",
- subsystem_name, status);
+ subsystem_name, status);
}
#endif
if ((status = rdpsnd_load_device_plugin(rdpsnd, subsystem_name, args)))
WLog_ERR(TAG, "unable to load the %s subsystem plugin because of error %lu",
- subsystem_name, status);
+ subsystem_name, status);
}
#endif
if ((status = rdpsnd_load_device_plugin(rdpsnd, subsystem_name, args)))
WLog_ERR(TAG, "unable to load the %s subsystem plugin because of error %lu",
- subsystem_name, status);
+ subsystem_name, status);
}
#endif
if ((status = rdpsnd_load_device_plugin(rdpsnd, subsystem_name, args)))
WLog_ERR(TAG, "unable to load the %s subsystem plugin because of error %lu",
- subsystem_name, status);
+ subsystem_name, status);
}
#endif
}
rdpsnd->ScheduleThread = CreateThread(NULL, 0,
- (LPTHREAD_START_ROUTINE) rdpsnd_schedule_thread,
- (void*) rdpsnd, 0, NULL);
+ (LPTHREAD_START_ROUTINE) rdpsnd_schedule_thread,
+ (void*) rdpsnd, 0, NULL);
if (!rdpsnd->ScheduleThread)
{
else
{
status = rdpsnd->channelEntryPoints.pVirtualChannelWrite(rdpsnd->OpenHandle,
- Stream_Buffer(s), (UINT32) Stream_GetPosition(s), s);
+ Stream_Buffer(s), (UINT32) Stream_GetPosition(s), s);
}
if (status != CHANNEL_RC_OK)
{
Stream_Free(s, TRUE);
WLog_ERR(TAG, "VirtualChannelWrite failed with %s [%08X]",
- WTSErrorToString(status), status);
+ WTSErrorToString(status), status);
}
return status;
* @return 0 on success, otherwise a Win32 error code
*/
static UINT rdpsnd_virtual_channel_event_data_received(rdpsndPlugin* plugin,
- void* pData, UINT32 dataLength, UINT32 totalLength, UINT32 dataFlags)
+ void* pData, UINT32 dataLength, UINT32 totalLength, UINT32 dataFlags)
{
wStream* s;
}
static VOID VCAPITYPE rdpsnd_virtual_channel_open_event(DWORD openHandle,
- UINT event,
- LPVOID pData, UINT32 dataLength, UINT32 totalLength, UINT32 dataFlags)
+ UINT event,
+ LPVOID pData, UINT32 dataLength, UINT32 totalLength, UINT32 dataFlags)
{
rdpsndPlugin* rdpsnd = s_TLSPluginContext;
UINT error = CHANNEL_RC_OK;
{
case CHANNEL_EVENT_DATA_RECEIVED:
if ((error = rdpsnd_virtual_channel_event_data_received(rdpsnd, pData,
- dataLength, totalLength, dataFlags)))
+ dataLength, totalLength, dataFlags)))
WLog_ERR(TAG,
- "rdpsnd_virtual_channel_event_data_received failed with error %lu", error);
+ "rdpsnd_virtual_channel_event_data_received failed with error %lu", error);
break;
if (error && rdpsnd->rdpcontext)
setChannelError(rdpsnd->rdpcontext, error,
- "rdpsnd_virtual_channel_open_event reported an error");
+ "rdpsnd_virtual_channel_open_event reported an error");
}
static void* rdpsnd_virtual_channel_client_thread(void* arg)
rdpsndPlugin* rdpsnd = (rdpsndPlugin*) arg;
UINT error;
+ freerdp_channel_init_thread_context(rdpsnd->rdpcontext);
if ((error = rdpsnd_process_connect(rdpsnd)))
{
WLog_ERR(TAG, "error connecting sound channel");
if (error && rdpsnd->rdpcontext)
setChannelError(rdpsnd->rdpcontext, error,
- "rdpsnd_virtual_channel_client_thread reported an error");
+ "rdpsnd_virtual_channel_client_thread reported an error");
rdpsnd_process_disconnect(rdpsnd);
ExitThread((DWORD)error);
* @return 0 on success, otherwise a Win32 error code
*/
static UINT rdpsnd_virtual_channel_event_connected(rdpsndPlugin* plugin,
- LPVOID pData, UINT32 dataLength)
+ LPVOID pData, UINT32 dataLength)
{
UINT32 status;
status = plugin->channelEntryPoints.pVirtualChannelOpen(plugin->InitHandle,
- &plugin->OpenHandle, plugin->channelDef.name,
- rdpsnd_virtual_channel_open_event);
+ &plugin->OpenHandle, plugin->channelDef.name,
+ rdpsnd_virtual_channel_open_event);
if (status != CHANNEL_RC_OK)
{
WLog_ERR(TAG, "pVirtualChannelOpen failed with %s [%08X]",
- WTSErrorToString(status), status);
+ WTSErrorToString(status), status);
return status;
}
}
plugin->thread = CreateThread(NULL, 0,
- (LPTHREAD_START_ROUTINE) rdpsnd_virtual_channel_client_thread, (void*) plugin,
- 0, NULL);
+ (LPTHREAD_START_ROUTINE) rdpsnd_virtual_channel_client_thread, (void*) plugin,
+ 0, NULL);
if (!plugin->thread)
{
if (CHANNEL_RC_OK != error)
{
WLog_ERR(TAG, "pVirtualChannelClose failed with %s [%08X]",
- WTSErrorToString(error), error);
+ WTSErrorToString(error), error);
return error;
}
}
static VOID VCAPITYPE rdpsnd_virtual_channel_init_event(LPVOID pInitHandle,
- UINT event, LPVOID pData, UINT dataLength)
+ UINT event, LPVOID pData, UINT dataLength)
{
rdpsndPlugin* plugin = s_TLSPluginContext;
UINT error = CHANNEL_RC_OK;
case CHANNEL_EVENT_CONNECTED:
if ((error = rdpsnd_virtual_channel_event_connected(plugin, pData, dataLength)))
WLog_ERR(TAG, "rdpsnd_virtual_channel_event_connected failed with error %lu!",
- error);
+ error);
break;
case CHANNEL_EVENT_DISCONNECTED:
if ((error = rdpsnd_virtual_channel_event_disconnected(plugin)))
WLog_ERR(TAG,
- "rdpsnd_virtual_channel_event_disconnected failed with error %lu!", error);
+ "rdpsnd_virtual_channel_event_disconnected failed with error %lu!", error);
break;
if (error && plugin->rdpcontext)
setChannelError(plugin->rdpcontext, error,
- "rdpsnd_virtual_channel_init_event reported an error");
+ "rdpsnd_virtual_channel_init_event reported an error");
}
/* rdpsnd is always built-in */
}
CopyMemory(&(rdpsnd->channelEntryPoints), pEntryPoints,
- sizeof(CHANNEL_ENTRY_POINTS_FREERDP));
+ sizeof(CHANNEL_ENTRY_POINTS_FREERDP));
rdpsnd->log = WLog_Get("com.freerdp.channels.rdpsnd.client");
rc = rdpsnd->channelEntryPoints.pVirtualChannelInit(&rdpsnd->InitHandle,
- &rdpsnd->channelDef, 1, VIRTUAL_CHANNEL_VERSION_WIN2000,
- rdpsnd_virtual_channel_init_event);
+ &rdpsnd->channelDef, 1, VIRTUAL_CHANNEL_VERSION_WIN2000,
+ rdpsnd_virtual_channel_init_event);
if (CHANNEL_RC_OK != rc)
{
WLog_ERR(TAG, "pVirtualChannelInit failed with %s [%08X]",
- WTSErrorToString(rc), rc);
+ WTSErrorToString(rc), rc);
free(rdpsnd);
return FALSE;
}
Stream_Write_UINT8(s, context->block_no); /* cLastBlockConfirmed */
Stream_Write_UINT16(s, 0x06); /* wVersion */
Stream_Write_UINT8(s, 0); /* bPad */
-
+
for (i = 0; i < context->num_server_formats; i++)
{
Stream_Write_UINT16(s, context->server_formats[i].wFormatTag); /* wFormatTag (WAVE_FORMAT_PCM) */
static UINT rdpsnd_server_recv_quality_mode(RdpsndServerContext* context, wStream* s)
{
UINT16 quality;
-
+
if (Stream_GetRemainingLength(s) < 4)
{
WLog_ERR(TAG, "not enought data in stream!");
UINT error = CHANNEL_RC_OK;
context = (RdpsndServerContext *)arg;
+
+ freerdp_channel_init_thread_context(context->rdpcontext);
nCount = 0;
events[nCount++] = context->priv->channelEvent;
events[nCount++] = context->priv->StopEvent;
{
status = WaitForMultipleObjects(nCount, events, FALSE, INFINITE);
- if (status == WAIT_FAILED)
- {
- error = GetLastError();
- WLog_ERR(TAG, "WaitForMultipleObjects failed with error %lu!", error);
- break;
- }
+ if (status == WAIT_FAILED)
+ {
+ error = GetLastError();
+ WLog_ERR(TAG, "WaitForMultipleObjects failed with error %lu!", error);
+ break;
+ }
- status = WaitForSingleObject(context->priv->StopEvent, 0);
+ status = WaitForSingleObject(context->priv->StopEvent, 0);
- if (status == WAIT_FAILED)
- {
- error = GetLastError();
- WLog_ERR(TAG, "WaitForSingleObject failed with error %lu!", error);
- break;
- }
+ if (status == WAIT_FAILED)
+ {
+ error = GetLastError();
+ WLog_ERR(TAG, "WaitForSingleObject failed with error %lu!", error);
+ break;
+ }
if (status == WAIT_OBJECT_0)
WLog_ERR(TAG, "index %d is not correct.", client_format_index);
return ERROR_INVALID_DATA;
}
-
+
EnterCriticalSection(&context->priv->lock);
context->priv->src_bytes_per_sample = context->src_format.wBitsPerSample / 8;
context->selected_client_format = client_format_index;
format = &context->client_formats[client_format_index];
-
+
if (format->nSamplesPerSec == 0)
{
WLog_ERR(TAG, "invalid Client Sound Format!!");
context->priv->out_pending_frames = 0;
out_buffer_size = context->priv->out_frames * context->priv->src_bytes_per_frame;
-
+
if (context->priv->out_buffer_size < out_buffer_size)
{
BYTE *newBuffer;
{
WLog_ERR(TAG, "Pending audio frame exists while no format selected.");
error = ERROR_INVALID_DATA;
- }
+ }
else if ((error = rdpsnd_server_send_audio_pdu(context, 0)))
{
WLog_ERR(TAG, "rdpsnd_server_send_audio_pdu failed with error %lu", error);
SetEvent(context->priv->StopEvent);
if (WaitForSingleObject(context->priv->Thread, INFINITE) == WAIT_FAILED)
- {
- error = GetLastError();
- WLog_ERR(TAG, "WaitForSingleObject failed with error %lu!", error);
- return error;
- }
+ {
+ error = GetLastError();
+ WLog_ERR(TAG, "WaitForSingleObject failed with error %lu!", error);
+ return error;
+ }
CloseHandle(context->priv->Thread);
CloseHandle(context->priv->StopEvent);
}
}
status = remdesk->channelEntryPoints.pVirtualChannelWrite(remdesk->OpenHandle,
- Stream_Buffer(s), (UINT32) Stream_Length(s), s);
+ Stream_Buffer(s), (UINT32) Stream_Length(s), s);
if (status != CHANNEL_RC_OK)
WLog_ERR(TAG, "VirtualChannelWrite failed with %s [%08X]",
- WTSErrorToString(status), status);
+ WTSErrorToString(status), status);
return status;
}
name = "Expert";
remdesk->EncryptedPassStub = freerdp_assistance_encrypt_pass_stub(password,
- settings->RemoteAssistancePassStub, &(remdesk->EncryptedPassStubSize));
+ settings->RemoteAssistancePassStub, &(remdesk->EncryptedPassStubSize));
if (!remdesk->EncryptedPassStub)
{
}
pass = freerdp_assistance_bin_to_hex_string(remdesk->EncryptedPassStub,
- remdesk->EncryptedPassStubSize);
+ remdesk->EncryptedPassStubSize);
if (!pass)
{
* @return 0 on success, otherwise a Win32 error code
*/
static UINT remdesk_read_channel_header(wStream* s,
- REMDESK_CHANNEL_HEADER* header)
+ REMDESK_CHANNEL_HEADER* header)
{
int status;
UINT32 ChannelNameLen;
ZeroMemory(header->ChannelName, sizeof(header->ChannelName));
pChannelName = (char*) header->ChannelName;
status = ConvertFromUnicode(CP_UTF8, 0, (WCHAR*) Stream_Pointer(s),
- ChannelNameLen / 2, &pChannelName, 32, NULL, NULL);
+ ChannelNameLen / 2, &pChannelName, 32, NULL, NULL);
Stream_Seek(s, ChannelNameLen);
if (status <= 0)
* @return 0 on success, otherwise a Win32 error code
*/
static UINT remdesk_write_channel_header(wStream* s,
- REMDESK_CHANNEL_HEADER* header)
+ REMDESK_CHANNEL_HEADER* header)
{
int index;
UINT32 ChannelNameLen;
* @return 0 on success, otherwise a Win32 error code
*/
static UINT remdesk_prepare_ctl_header(REMDESK_CTL_HEADER* ctlHeader,
- UINT32 msgType, UINT32 msgSize)
+ UINT32 msgType, UINT32 msgSize)
{
ctlHeader->msgType = msgType;
strcpy(ctlHeader->ChannelName, REMDESK_CHANNEL_CTL_NAME);
* @return 0 on success, otherwise a Win32 error code
*/
static UINT remdesk_recv_ctl_server_announce_pdu(remdeskPlugin* remdesk,
- wStream* s, REMDESK_CHANNEL_HEADER* header)
+ wStream* s, REMDESK_CHANNEL_HEADER* header)
{
return CHANNEL_RC_OK;
}
* @return 0 on success, otherwise a Win32 error code
*/
static UINT remdesk_recv_ctl_version_info_pdu(remdeskPlugin* remdesk,
- wStream* s, REMDESK_CHANNEL_HEADER* header)
+ wStream* s, REMDESK_CHANNEL_HEADER* header)
{
UINT32 versionMajor;
UINT32 versionMinor;
* @return 0 on success, otherwise a Win32 error code
*/
static UINT remdesk_recv_ctl_result_pdu(remdeskPlugin* remdesk, wStream* s,
- REMDESK_CHANNEL_HEADER* header, UINT32* pResult)
+ REMDESK_CHANNEL_HEADER* header, UINT32* pResult)
{
UINT32 result;
pdu.expertBlob = remdesk->ExpertBlob;
pdu.raConnectionString = remdesk->settings->RemoteAssistanceRCTicket;
status = ConvertToUnicode(CP_UTF8, 0, pdu.raConnectionString, -1,
- &raConnectionStringW, 0);
+ &raConnectionStringW, 0);
if (status <= 0)
{
cbExpertBlobW = status * 2;
remdesk_prepare_ctl_header(&(pdu.ctlHeader), REMDESK_CTL_AUTHENTICATE,
- cbRaConnectionStringW + cbExpertBlobW);
+ cbRaConnectionStringW + cbExpertBlobW);
s = Stream_New(NULL, REMDESK_CHANNEL_CTL_SIZE + pdu.ctlHeader.DataLength);
if (!s)
REMDESK_CTL_REMOTE_CONTROL_DESKTOP_PDU pdu;
pdu.raConnectionString = remdesk->settings->RemoteAssistanceRCTicket;
status = ConvertToUnicode(CP_UTF8, 0, pdu.raConnectionString, -1,
- &raConnectionStringW, 0);
+ &raConnectionStringW, 0);
if (status <= 0)
{
cbRaConnectionStringW = status * 2;
remdesk_prepare_ctl_header(&(pdu.ctlHeader), REMDESK_CTL_REMOTE_CONTROL_DESKTOP,
- cbRaConnectionStringW);
+ cbRaConnectionStringW);
s = Stream_New(NULL, REMDESK_CHANNEL_CTL_SIZE + pdu.ctlHeader.DataLength);
if (!s)
cbExpertBlobW = status * 2;
remdesk_prepare_ctl_header(&(pdu.ctlHeader), REMDESK_CTL_VERIFY_PASSWORD,
- cbExpertBlobW);
+ cbExpertBlobW);
s = Stream_New(NULL, REMDESK_CHANNEL_CTL_SIZE + pdu.ctlHeader.DataLength);
if (!s)
pdu.EncryptedPasswordLength = remdesk->EncryptedPassStubSize;
pdu.EncryptedPassword = remdesk->EncryptedPassStub;
remdesk_prepare_ctl_header(&(pdu.ctlHeader), REMDESK_CTL_EXPERT_ON_VISTA,
- pdu.EncryptedPasswordLength);
+ pdu.EncryptedPasswordLength);
s = Stream_New(NULL, REMDESK_CHANNEL_CTL_SIZE + pdu.ctlHeader.DataLength);
if (!s)
* @return 0 on success, otherwise a Win32 error code
*/
static UINT remdesk_recv_ctl_pdu(remdeskPlugin* remdesk, wStream* s,
- REMDESK_CHANNEL_HEADER* header)
+ REMDESK_CHANNEL_HEADER* header)
{
UINT error = CHANNEL_RC_OK;
UINT32 msgType = 0;
case REMDESK_CTL_SERVER_ANNOUNCE:
if ((error = remdesk_recv_ctl_server_announce_pdu(remdesk, s, header)))
WLog_ERR(TAG, "remdesk_recv_ctl_server_announce_pdu failed with error %lu",
- error);
+ error);
break;
if ((error = remdesk_send_ctl_remote_control_desktop_pdu(remdesk)))
{
WLog_ERR(TAG,
- "remdesk_send_ctl_remote_control_desktop_pdu failed with error %lu", error);
+ "remdesk_send_ctl_remote_control_desktop_pdu failed with error %lu", error);
break;
}
}
if ((error = remdesk_send_ctl_expert_on_vista_pdu(remdesk)))
{
WLog_ERR(TAG, "remdesk_send_ctl_expert_on_vista_pdu failed with error %lu",
- error);
+ error);
break;
}
if ((error = remdesk_send_ctl_verify_password_pdu(remdesk)))
{
WLog_ERR(TAG, "remdesk_send_ctl_verify_password_pdu failed with error %lu",
- error);
+ error);
break;
}
}
else
{
status = plugin->channelEntryPoints.pVirtualChannelWrite(plugin->OpenHandle,
- Stream_Buffer(s), (UINT32) Stream_GetPosition(s), s);
+ Stream_Buffer(s), (UINT32) Stream_GetPosition(s), s);
}
if (status != CHANNEL_RC_OK)
{
Stream_Free(s, TRUE);
WLog_ERR(TAG, "VirtualChannelWrite failed with %s [%08X]",
- WTSErrorToString(status), status);
+ WTSErrorToString(status), status);
}
return status;
* @return 0 on success, otherwise a Win32 error code
*/
static UINT remdesk_virtual_channel_event_data_received(remdeskPlugin* remdesk,
- void* pData, UINT32 dataLength, UINT32 totalLength, UINT32 dataFlags)
+ void* pData, UINT32 dataLength, UINT32 totalLength, UINT32 dataFlags)
{
wStream* data_in;
}
static VOID VCAPITYPE remdesk_virtual_channel_open_event(DWORD openHandle,
- UINT event,
- LPVOID pData, UINT32 dataLength, UINT32 totalLength, UINT32 dataFlags)
+ UINT event,
+ LPVOID pData, UINT32 dataLength, UINT32 totalLength, UINT32 dataFlags)
{
remdeskPlugin* remdesk = s_TLSPluginContext;
UINT error = CHANNEL_RC_OK;
{
case CHANNEL_EVENT_DATA_RECEIVED:
if ((error = remdesk_virtual_channel_event_data_received(remdesk, pData,
- dataLength, totalLength, dataFlags)))
+ dataLength, totalLength, dataFlags)))
WLog_ERR(TAG,
- "remdesk_virtual_channel_event_data_received failed with error %lu!", error);
+ "remdesk_virtual_channel_event_data_received failed with error %lu!", error);
break;
if (error && remdesk->rdpcontext)
setChannelError(remdesk->rdpcontext, error,
- "remdesk_virtual_channel_open_event reported an error");
+ "remdesk_virtual_channel_open_event reported an error");
}
static void* remdesk_virtual_channel_client_thread(void* arg)
wMessage message;
remdeskPlugin* remdesk = (remdeskPlugin*) arg;
UINT error = CHANNEL_RC_OK;
+
+ freerdp_channel_init_thread_context(remdesk->rdpcontext);
remdesk_process_connect(remdesk);
while (1)
if (error && remdesk->rdpcontext)
setChannelError(remdesk->rdpcontext, error,
- "remdesk_virtual_channel_client_thread reported an error");
+ "remdesk_virtual_channel_client_thread reported an error");
ExitThread((DWORD)error);
return NULL;
* @return 0 on success, otherwise a Win32 error code
*/
static UINT remdesk_virtual_channel_event_connected(remdeskPlugin* remdesk,
- LPVOID pData, UINT32 dataLength)
+ LPVOID pData, UINT32 dataLength)
{
UINT32 status;
UINT error;
status = remdesk->channelEntryPoints.pVirtualChannelOpen(remdesk->InitHandle,
- &remdesk->OpenHandle, remdesk->channelDef.name,
- remdesk_virtual_channel_open_event);
+ &remdesk->OpenHandle, remdesk->channelDef.name,
+ remdesk_virtual_channel_open_event);
if (status != CHANNEL_RC_OK)
{
WLog_ERR(TAG, "pVirtualChannelOpen failed with %s [%08X]",
- WTSErrorToString(status), status);
+ WTSErrorToString(status), status);
return status;
}
}
remdesk->thread = CreateThread(NULL, 0,
- (LPTHREAD_START_ROUTINE) remdesk_virtual_channel_client_thread, (void*) remdesk,
- 0, NULL);
+ (LPTHREAD_START_ROUTINE) remdesk_virtual_channel_client_thread, (void*) remdesk,
+ 0, NULL);
if (!remdesk->thread)
{
if (CHANNEL_RC_OK != rc)
{
WLog_ERR(TAG, "pVirtualChannelClose failed with %s [%08X]",
- WTSErrorToString(rc), rc);
+ WTSErrorToString(rc), rc);
}
remdesk->OpenHandle = 0;
}
static VOID VCAPITYPE remdesk_virtual_channel_init_event(LPVOID pInitHandle,
- UINT event, LPVOID pData,
- UINT dataLength)
+ UINT event, LPVOID pData,
+ UINT dataLength)
{
remdeskPlugin* remdesk = s_TLSPluginContext;
UINT error = CHANNEL_RC_OK;
{
case CHANNEL_EVENT_CONNECTED:
if ((error = remdesk_virtual_channel_event_connected(remdesk, pData,
- dataLength)))
+ dataLength)))
WLog_ERR(TAG, "remdesk_virtual_channel_event_connected failed with error %lu",
- error);
+ error);
break;
case CHANNEL_EVENT_DISCONNECTED:
if ((error = remdesk_virtual_channel_event_disconnected(remdesk)))
WLog_ERR(TAG,
- "remdesk_virtual_channel_event_disconnected failed with error %lu", error);
+ "remdesk_virtual_channel_event_disconnected failed with error %lu", error);
break;
if (error && remdesk->rdpcontext)
setChannelError(remdesk->rdpcontext, error,
- "remdesk_virtual_channel_init_event reported an error");
+ "remdesk_virtual_channel_init_event reported an error");
}
/* remdesk is always built-in */
}
CopyMemory(&(remdesk->channelEntryPoints), pEntryPoints,
- sizeof(CHANNEL_ENTRY_POINTS_FREERDP));
+ sizeof(CHANNEL_ENTRY_POINTS_FREERDP));
rc = remdesk->channelEntryPoints.pVirtualChannelInit(&remdesk->InitHandle,
- &remdesk->channelDef, 1, VIRTUAL_CHANNEL_VERSION_WIN2000,
- remdesk_virtual_channel_init_event);
+ &remdesk->channelDef, 1, VIRTUAL_CHANNEL_VERSION_WIN2000,
+ remdesk_virtual_channel_init_event);
if (CHANNEL_RC_OK != rc)
{
WLog_ERR(TAG, "pVirtualChannelInit failed with %s [%08X]",
- WTSErrorToString(rc), rc);
+ WTSErrorToString(rc), rc);
goto error_out;
}
remdesk->channelEntryPoints.pInterface = *
- (remdesk->channelEntryPoints.ppInterface);
+ (remdesk->channelEntryPoints.ppInterface);
remdesk->channelEntryPoints.ppInterface = &
- (remdesk->channelEntryPoints.pInterface);
+ (remdesk->channelEntryPoints.pInterface);
s_TLSPluginContext = remdesk;
return TRUE;
error_out:
context = (RemdeskServerContext*) arg;
+ freerdp_channel_init_thread_context(context->rdpcontext);
buffer = NULL;
BytesReturned = 0;
ChannelEvent = NULL;
{
status = WaitForMultipleObjects(nCount, events, FALSE, INFINITE);
- if (status == WAIT_FAILED)
- {
- error = GetLastError();
- WLog_ERR(TAG, "WaitForMultipleObjects failed with error %lu", error);
- break;
- }
+ if (status == WAIT_FAILED)
+ {
+ error = GetLastError();
+ WLog_ERR(TAG, "WaitForMultipleObjects failed with error %lu", error);
+ break;
+ }
- status = WaitForSingleObject(context->priv->StopEvent, 0);
+ status = WaitForSingleObject(context->priv->StopEvent, 0);
- if (status == WAIT_FAILED)
- {
- error = GetLastError();
- WLog_ERR(TAG, "WaitForSingleObject failed with error %lu", error);
- break;
- }
+ if (status == WAIT_FAILED)
+ {
+ error = GetLastError();
+ WLog_ERR(TAG, "WaitForSingleObject failed with error %lu", error);
+ break;
+ }
if (status == WAIT_OBJECT_0)
if (WaitForSingleObject(context->priv->Thread, INFINITE) == WAIT_FAILED)
{
- error = GetLastError();
- WLog_ERR(TAG, "WaitForSingleObject failed with error %lu!", error);
- return error;
+ error = GetLastError();
+ WLog_ERR(TAG, "WaitForSingleObject failed with error %lu!", error);
+ return error;
}
CloseHandle(context->priv->Thread);
/* TODO: all #ifdef __linux__ could be removed once only some generic
* functions will be used. Replace CommReadFile by ReadFile,
* CommWriteFile by WriteFile etc.. */
-#if defined __linux__ && !defined ANDROID
+#if defined __linux__ && !defined ANDROID
#define MAX_IRP_THREADS 5
IRP_THREAD_DATA *data = (IRP_THREAD_DATA*)arg;
UINT error;
+ freerdp_channel_init_thread_context(data->serial->rdpcontext);
+
/* blocks until the end of the request */
if ((error = serial_process_irp(data->serial, data->irp)))
{
serial->IrpThreadToBeTerminatedCount--;
}
else if (waitResult != WAIT_TIMEOUT)
- {
+ {
/* unexpected thread state */
WLog_Print(serial->log, WLOG_WARN, "WaitForSingleObject, got an unexpected result=0x%lX\n", waitResult);
TerminateThread(irpThread, 0);
if (WaitForSingleObject(irpThread, INFINITE) == WAIT_FAILED)
- {
- WLog_ERR(TAG,"WaitForSingleObject failed!");
- continue;
- }
+ {
+ WLog_ERR(TAG,"WaitForSingleObject failed!");
+ continue;
+ }
CloseHandle(irpThread);
SERIAL_DEVICE* serial = (SERIAL_DEVICE*) arg;
UINT error = CHANNEL_RC_OK;
+ freerdp_channel_init_thread_context(serial->rdpcontext);
while (1)
{
if (!MessageQueue_Wait(serial->MainIrpQueue))
MessageQueue_PostQuit(serial->MainIrpQueue, 0);
if (WaitForSingleObject(serial->MainThread, INFINITE) == WAIT_FAILED)
{
- error = GetLastError();
- WLog_ERR(TAG, "WaitForSingleObject failed with error %lu!", error);
- return error;
+ error = GetLastError();
+ WLog_ERR(TAG, "WaitForSingleObject failed with error %lu!", error);
+ return error;
}
CloseHandle(serial->MainThread);
UINT error = CHANNEL_RC_OK;
smartcard = pContext->smartcard;
+ freerdp_channel_init_thread_context(smartcard->rdpcontext);
nCount = 0;
hEvents[nCount++] = MessageQueue_Event(pContext->IrpQueue);
SMARTCARD_DEVICE* smartcard = (SMARTCARD_DEVICE*) arg;
UINT error = CHANNEL_RC_OK;
+ freerdp_channel_init_thread_context(smartcard->rdpcontext);
+
nCount = 0;
hEvents[nCount++] = MessageQueue_Event(smartcard->IrpQueue);
hEvents[nCount++] = Queue_Event(smartcard->CompletedIrpQueue);
UINT32 bits_per_sample;
/* The start time of last played sample */
- UINT64 last_start_time;
+ UINT64 last_start_time;
/* The end_time of last played sample */
UINT64 last_end_time;
/* Next sample should not start before this system time. */
* render times. So, we try to adjust timestamps on the video buffer to match those on the audio buffer.
*/
if (stream->major_type == TSMF_MAJOR_TYPE_VIDEO)
- {
+ {
TSMF_STREAM* temp_stream = NULL;
TSMF_PRESENTATION* presentation = stream->presentation;
ArrayList_Lock(presentation->stream_list);
UINT error = CHANNEL_RC_OK;
DEBUG_TSMF("in %d", stream->stream_id);
+ freerdp_channel_init_thread_context(stream->rdpcontext);
hdl[0] = stream->stopEvent;
hdl[1] = Queue_Event(stream->sample_ack_list);
DEBUG_TSMF("in %d", stream->stream_id);
+ freerdp_channel_init_thread_context(stream->rdpcontext);
+
if (stream->major_type == TSMF_MAJOR_TYPE_AUDIO &&
stream->sample_rate && stream->channels && stream->bits_per_sample)
{
if (!width || !height)
return TRUE;
- /* Streams can be added/removed from the presentation and the server will resend geometry info when a new stream is
+ /* Streams can be added/removed from the presentation and the server will resend geometry info when a new stream is
* added to the presentation. Also, num_rects is used to indicate whether or not the window is visible.
* So, always process a valid message with unchanged position/size and/or no visibility rects.
*/
presentation->y = y;
presentation->width = width;
presentation->height = height;
-
+
tmp_rects = realloc(presentation->rects, sizeof(RDP_RECT) * num_rects);
presentation->nr_rects = num_rects;