本文整理汇总了C++中Stream_Buffer函数的典型用法代码示例。如果您正苦于以下问题:C++ Stream_Buffer函数的具体用法?C++ Stream_Buffer怎么用?C++ Stream_Buffer使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了Stream_Buffer函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: rpc_http_send_replacement_out_channel_request
int rpc_http_send_replacement_out_channel_request(rdpRpc* rpc)
{
wStream* s;
int content_length;
content_length = 120;
s = rpc_ntlm_http_request(rpc, NULL, content_length, TSG_CHANNEL_OUT);
WLog_DBG(TAG, "\n%s", Stream_Buffer(s));
rpc_out_write(rpc, Stream_Buffer(s), Stream_Length(s));
Stream_Free(s, TRUE);
return 0;
}
示例2: rpc_ncacn_http_send_out_channel_request
int rpc_ncacn_http_send_out_channel_request(rdpRpc* rpc, RpcOutChannel* outChannel, BOOL replacement)
{
wStream* s;
int status;
int contentLength;
BOOL continueNeeded;
rdpNtlm* ntlm = outChannel->ntlm;
HttpContext* http = outChannel->http;
continueNeeded = ntlm_authenticate(ntlm);
if (!replacement)
contentLength = (continueNeeded) ? 0 : 76;
else
contentLength = (continueNeeded) ? 0 : 120;
s = rpc_ntlm_http_request(rpc, http, "RPC_OUT_DATA", contentLength, &ntlm->outputBuffer[0]);
if (!s)
return -1;
status = rpc_out_channel_write(outChannel, Stream_Buffer(s), Stream_Length(s));
Stream_Free(s, TRUE);
return (status > 0) ? 1 : -1;
}
示例3: TsProxyCloseTunnelReadResponse
BOOL TsProxyCloseTunnelReadResponse(rdpTsg* tsg)
{
RPC_PDU* pdu;
BYTE* buffer;
UINT32 length;
UINT32 offset;
rdpRpc* rpc = tsg->rpc;
pdu = rpc_recv_dequeue_pdu(rpc);
if (!pdu)
return FALSE;
length = Stream_Length(pdu->s);
buffer = Stream_Buffer(pdu->s);
if (!(pdu->Flags & RPC_PDU_FLAG_STUB))
buffer = &buffer[24];
offset = 0;
rpc_client_receive_pool_return(rpc, pdu);
return TRUE;
}
示例4: rdpdr_server_send_client_id_confirm
static int rdpdr_server_send_client_id_confirm(RdpdrServerContext* context)
{
wStream* s;
BOOL status;
RDPDR_HEADER header;
ULONG written;
CLOG_DBG("RdpdrServerSendClientIdConfirm\n");
header.Component = RDPDR_CTYP_CORE;
header.PacketId = PAKID_CORE_CLIENTID_CONFIRM;
s = Stream_New(NULL, RDPDR_HEADER_LENGTH + 8);
Stream_Write_UINT16(s, header.Component); /* Component (2 bytes) */
Stream_Write_UINT16(s, header.PacketId); /* PacketId (2 bytes) */
Stream_Write_UINT16(s, context->priv->VersionMajor); /* VersionMajor (2 bytes) */
Stream_Write_UINT16(s, context->priv->VersionMinor); /* VersionMinor (2 bytes) */
Stream_Write_UINT32(s, context->priv->ClientId); /* ClientId (4 bytes) */
Stream_SealLength(s);
status = WTSVirtualChannelWrite(context->priv->ChannelHandle, (PCHAR) Stream_Buffer(s), Stream_Length(s), &written);
Stream_Free(s, TRUE);
return 0;
}
示例5: audin_server_send_open
/**
* Function description
*
* @return 0 on success, otherwise a Win32 error code
*/
static UINT audin_server_send_open(audin_server* audin, wStream* s)
{
ULONG written;
if (audin->context.selected_client_format < 0)
{
WLog_ERR(TAG, "audin->context.selected_client_format = %d",
audin->context.selected_client_format);
return ERROR_INVALID_DATA;
}
audin->opened = TRUE;
Stream_SetPosition(s, 0);
Stream_Write_UINT8(s, MSG_SNDIN_OPEN);
Stream_Write_UINT32(s, audin->context.frames_per_packet); /* FramesPerPacket (4 bytes) */
Stream_Write_UINT32(s, audin->context.selected_client_format); /* initialFormat (4 bytes) */
/*
* [MS-RDPEAI] 3.2.5.1.6
* The second format specify the format that SHOULD be used to capture data from
* the actual audio input device.
*/
Stream_Write_UINT16(s, 1); /* wFormatTag = PCM */
Stream_Write_UINT16(s, 2); /* nChannels */
Stream_Write_UINT32(s, 44100); /* nSamplesPerSec */
Stream_Write_UINT32(s, 44100 * 2 * 2); /* nAvgBytesPerSec */
Stream_Write_UINT16(s, 4); /* nBlockAlign */
Stream_Write_UINT16(s, 16); /* wBitsPerSample */
Stream_Write_UINT16(s, 0); /* cbSize */
return WTSVirtualChannelWrite(audin->audin_channel, (PCHAR) Stream_Buffer(s), Stream_GetPosition(s), &written) ? CHANNEL_RC_OK : ERROR_INTERNAL_ERROR;
}
示例6: rdpdr_server_send_user_logged_on
static int rdpdr_server_send_user_logged_on(RdpdrServerContext* context)
{
wStream* s;
BOOL status;
RDPDR_HEADER header;
ULONG written;
CLOG_DBG("%s\n", __FUNCTION__);
header.Component = RDPDR_CTYP_CORE;
header.PacketId = PAKID_CORE_USER_LOGGEDON;
s = Stream_New(NULL, RDPDR_HEADER_LENGTH);
Stream_Write_UINT16(s, header.Component); /* Component (2 bytes) */
Stream_Write_UINT16(s, header.PacketId); /* PacketId (2 bytes) */
Stream_SealLength(s);
status = WTSVirtualChannelWrite(context->priv->ChannelHandle, (PCHAR) Stream_Buffer(s), Stream_Length(s), &written);
Stream_Free(s, TRUE);
return 0;
}
示例7: rpc_recv_dequeue_pdu
RPC_PDU* rpc_recv_dequeue_pdu(rdpRpc* rpc)
{
RPC_PDU* pdu;
DWORD dwMilliseconds;
DWORD result;
dwMilliseconds = rpc->client->SynchronousReceive ? SYNCHRONOUS_TIMEOUT * 4 : 0;
result = WaitForSingleObject(Queue_Event(rpc->client->ReceiveQueue), dwMilliseconds);
if (result == WAIT_TIMEOUT)
{
WLog_ERR(TAG, "timed out waiting for receive event");
return NULL;
}
if (result != WAIT_OBJECT_0)
return NULL;
pdu = (RPC_PDU*)Queue_Dequeue(rpc->client->ReceiveQueue);
#ifdef WITH_DEBUG_TSG
if (pdu)
{
WLog_DBG(TAG, "Receiving PDU (length: %d, CallId: %d)", pdu->s->length, pdu->CallId);
winpr_HexDump(TAG, WLOG_DEBUG, Stream_Buffer(pdu->s), Stream_Length(pdu->s));
}
else
{
WLog_DBG(TAG, "Receiving a NULL PDU");
}
#endif
return pdu;
}
示例8: WTSProcessChannelData
static BOOL WTSProcessChannelData(rdpPeerChannel* channel, UINT16 channelId, BYTE* data, int size, int flags, int totalSize)
{
BOOL ret = TRUE;
if (flags & CHANNEL_FLAG_FIRST)
{
Stream_SetPosition(channel->receiveData, 0);
}
if (!Stream_EnsureRemainingCapacity(channel->receiveData, size))
return FALSE;
Stream_Write(channel->receiveData, data, size);
if (flags & CHANNEL_FLAG_LAST)
{
if (Stream_GetPosition(channel->receiveData) != totalSize)
{
WLog_ERR(TAG, "read error");
}
if (channel == channel->vcm->drdynvc_channel)
{
ret = wts_read_drdynvc_pdu(channel);
}
else
{
ret = wts_queue_receive_data(channel, Stream_Buffer(channel->receiveData), Stream_GetPosition(channel->receiveData));
}
Stream_SetPosition(channel->receiveData, 0);
}
return ret;
}
示例9: rdpei_server_resume
int rdpei_server_resume(RdpeiServerContext *context)
{
ULONG written;
RdpeiServerPrivate *priv = context->priv;
switch (priv->automataState)
{
case STATE_WAITING_FRAME:
fprintf(stderr, "%s: not suspended\n", __FUNCTION__);
return 0;
case STATE_SUSPENDED:
break;
default:
fprintf(stderr, "%s: called from unexpected state %d\n", __FUNCTION__, priv->automataState);
return -1;
}
Stream_SetPosition(priv->outputStream, 0);
Stream_EnsureCapacity(priv->outputStream, RDPINPUT_HEADER_LENGTH);
Stream_Write_UINT16(priv->outputStream, EVENTID_RESUME_TOUCH);
Stream_Write_UINT32(priv->outputStream, RDPINPUT_HEADER_LENGTH);
if (!WTSVirtualChannelWrite(priv->channelHandle, (PCHAR)Stream_Buffer(priv->outputStream),
Stream_GetPosition(priv->outputStream), &written))
{
fprintf(stderr, "%s: error writing resumeTouch message\n", __FUNCTION__);
return -1;
}
priv->automataState = STATE_WAITING_FRAME;
return 0;
}
示例10: drdynvc_send
/**
* Function description
*
* @return 0 on success, otherwise a Win32 error code
*/
static UINT drdynvc_send(drdynvcPlugin* drdynvc, wStream* s)
{
UINT status;
if (!drdynvc)
status = CHANNEL_RC_BAD_CHANNEL_HANDLE;
else
{
status = drdynvc->channelEntryPoints.pVirtualChannelWriteEx(drdynvc->InitHandle,
drdynvc->OpenHandle, Stream_Buffer(s), (UINT32) Stream_GetPosition(s), s);
}
switch (status)
{
case CHANNEL_RC_OK:
return CHANNEL_RC_OK;
case CHANNEL_RC_NOT_CONNECTED:
Stream_Free(s, TRUE);
return CHANNEL_RC_OK;
case CHANNEL_RC_BAD_CHANNEL_HANDLE:
Stream_Free(s, TRUE);
WLog_ERR(TAG, "VirtualChannelWriteEx failed with CHANNEL_RC_BAD_CHANNEL_HANDLE");
return status;
default:
Stream_Free(s, TRUE);
WLog_Print(drdynvc->log, WLOG_ERROR, "VirtualChannelWriteEx failed with %s [%08"PRIX32"]",
WTSErrorToString(status),
status);
return status;
}
}
示例11: wts_read_drdynvc_data
static BOOL wts_read_drdynvc_data(rdpPeerChannel* channel, wStream* s, UINT32 length)
{
BOOL ret = FALSE;
if (channel->dvc_total_length > 0)
{
if (Stream_GetPosition(channel->receiveData) + length > channel->dvc_total_length)
{
channel->dvc_total_length = 0;
WLog_ERR(TAG, "incorrect fragment data, discarded.");
return FALSE;
}
Stream_Write(channel->receiveData, Stream_Pointer(s), length);
if (Stream_GetPosition(channel->receiveData) >= (int) channel->dvc_total_length)
{
ret = wts_queue_receive_data(channel, Stream_Buffer(channel->receiveData), channel->dvc_total_length);
channel->dvc_total_length = 0;
}
}
else
{
ret = wts_queue_receive_data(channel, Stream_Pointer(s), length);
}
return ret;
}
示例12: test_nsc_encode
void test_nsc_encode(void)
{
int i;
BYTE* rgb_data;
wStream* enc_stream;
NSC_CONTEXT* context;
rgb_data = (BYTE *) malloc(64 * 64 * 3);
for (i = 0; i < 64; i++)
memcpy(rgb_data + i * 64 * 3, rgb_scanline_data, 64 * 3);
context = nsc_context_new();
nsc_context_set_pixel_format(context, RDP_PIXEL_FORMAT_R8G8B8);
enc_stream = stream_new(65536);
stream_clear(enc_stream);
for (i = 0; i < 30000; i++)
{
Stream_SetPosition(enc_stream, 0);
nsc_compose_message(context, enc_stream, rgb_data, 64, 64, 64 * 3);
}
/*winpr_HexDump(Stream_Buffer(enc_stream), Stream_GetPosition(enc_stream));*/
nsc_process_message(context, 32, 64, 64, Stream_Buffer(enc_stream), Stream_GetPosition(enc_stream));
/*winpr_HexDump(context->bmpdata, 64 * 64 * 4);*/
stream_free(enc_stream);
nsc_context_free(context);
}
示例13: TsProxyCreateChannelReadResponse
BOOL TsProxyCreateChannelReadResponse(rdpTsg* tsg, RPC_PDU* pdu)
{
BYTE* buffer;
UINT32 length;
UINT32 offset;
rdpRpc* rpc = tsg->rpc;
if (!pdu)
return FALSE;
length = Stream_Length(pdu->s);
buffer = Stream_Buffer(pdu->s);
if (!(pdu->Flags & RPC_PDU_FLAG_STUB))
buffer = &buffer[24];
offset = 0;
/* ChannelContext (20 bytes) */
CopyMemory(&tsg->ChannelContext.ContextType, &buffer[offset], 4); /* ContextType (4 bytes) */
CopyMemory(tsg->ChannelContext.ContextUuid, &buffer[offset + 4], 16); /* ContextUuid (16 bytes) */
#ifdef WITH_DEBUG_TSG
fprintf(stderr, "ChannelContext:\n");
winpr_HexDump((void*) &tsg->ChannelContext, 20);
fprintf(stderr, "\n");
#endif
rpc_client_receive_pool_return(rpc, pdu);
return TRUE;
}
示例14: rdpgfx_send_qoe_frame_acknowledge_pdu
static UINT rdpgfx_send_qoe_frame_acknowledge_pdu(RDPGFX_CHANNEL_CALLBACK* callback,
const RDPGFX_QOE_FRAME_ACKNOWLEDGE_PDU* pdu)
{
UINT error;
wStream* s;
RDPGFX_HEADER header;
RDPGFX_PLUGIN* gfx = (RDPGFX_PLUGIN*) callback->plugin;
header.flags = 0;
header.cmdId = RDPGFX_CMDID_QOEFRAMEACKNOWLEDGE;
header.pduLength = RDPGFX_HEADER_SIZE + 12;
WLog_Print(gfx->log, WLOG_DEBUG, "SendQoeFrameAcknowledgePdu: %"PRIu32"", pdu->frameId);
s = Stream_New(NULL, header.pduLength);
if (!s)
{
WLog_ERR(TAG, "Stream_New failed!");
return CHANNEL_RC_NO_MEMORY;
}
if ((error = rdpgfx_write_header(s, &header)))
goto fail;
/* RDPGFX_FRAME_ACKNOWLEDGE_PDU */
Stream_Write_UINT32(s, pdu->frameId);
Stream_Write_UINT32(s, pdu->timestamp);
Stream_Write_UINT16(s, pdu->timeDiffSE);
Stream_Write_UINT16(s, pdu->timeDiffEDR);
error = callback->channel->Write(callback->channel, (UINT32) Stream_Length(s),
Stream_Buffer(s), NULL);
fail:
Stream_Free(s, TRUE);
return error;
}
示例15: rdpgfx_send_frame_acknowledge_pdu
/**
* Function description
*
* @return 0 on success, otherwise a Win32 error code
*/
static UINT rdpgfx_send_frame_acknowledge_pdu(RDPGFX_CHANNEL_CALLBACK* callback,
RDPGFX_FRAME_ACKNOWLEDGE_PDU* pdu)
{
UINT error;
wStream* s;
RDPGFX_HEADER header;
header.flags = 0;
header.cmdId = RDPGFX_CMDID_FRAMEACKNOWLEDGE;
header.pduLength = RDPGFX_HEADER_SIZE + 12;
WLog_DBG(TAG, "SendFrameAcknowledgePdu: %d", pdu->frameId);
s = Stream_New(NULL, header.pduLength);
if (!s)
{
WLog_ERR(TAG, "Stream_New failed!");
return CHANNEL_RC_NO_MEMORY;
}
if ((error = rdpgfx_write_header(s, &header)))
{
WLog_ERR(TAG, "rdpgfx_write_header failed with error %u!", error);
return error;
}
/* RDPGFX_FRAME_ACKNOWLEDGE_PDU */
Stream_Write_UINT32(s, pdu->queueDepth); /* queueDepth (4 bytes) */
Stream_Write_UINT32(s, pdu->frameId); /* frameId (4 bytes) */
Stream_Write_UINT32(s,
pdu->totalFramesDecoded); /* totalFramesDecoded (4 bytes) */
error = callback->channel->Write(callback->channel, (UINT32) Stream_Length(s),
Stream_Buffer(s), NULL);
Stream_Free(s, TRUE);
return error;
}