Adjusted channelID and server SetVolume data types

This commit is contained in:
Armin Novak 2021-12-17 17:26:29 +01:00 committed by akallabeth
parent a0fa7307bd
commit 0fb83a304d
4 changed files with 23 additions and 13 deletions

View File

@ -28,6 +28,7 @@
#include <string.h>
#include <winpr/crt.h>
#include <winpr/assert.h>
#include <winpr/print.h>
#include <winpr/stream.h>
@ -595,23 +596,32 @@ out:
*
* @return 0 on success, otherwise a Win32 error code
*/
static UINT rdpsnd_server_set_volume(RdpsndServerContext* context, int left, int right)
static UINT rdpsnd_server_set_volume(RdpsndServerContext* context, UINT16 left, UINT16 right)
{
size_t pos;
size_t len;
BOOL status;
ULONG written;
wStream* s = context->priv->rdpsnd_pdu;
wStream* s;
WINPR_ASSERT(context);
WINPR_ASSERT(context->priv);
s = context->priv->rdpsnd_pdu;
WINPR_ASSERT(s);
Stream_SetPosition(s, 0);
if (!Stream_EnsureRemainingCapacity(s, 8))
return ERROR_NOT_ENOUGH_MEMORY;
Stream_Write_UINT8(s, SNDC_SETVOLUME);
Stream_Write_UINT8(s, 0);
Stream_Seek_UINT16(s);
Stream_Write_UINT16(s, 4); /* Payload length */
Stream_Write_UINT16(s, left);
Stream_Write_UINT16(s, right);
pos = Stream_GetPosition(s);
Stream_SetPosition(s, 2);
Stream_Write_UINT16(s, pos - 4);
Stream_SetPosition(s, pos);
len = Stream_GetPosition(s);
status = WTSVirtualChannelWrite(context->priv->ChannelHandle, (PCHAR)Stream_Buffer(s),
Stream_GetPosition(s), &written);
(ULONG)len, &written);
Stream_SetPosition(s, 0);
return status ? CHANNEL_RC_OK : ERROR_INTERNAL_ERROR;
}

View File

@ -39,7 +39,7 @@ typedef UINT (*psRdpsndServerSendSamples)(RdpsndServerContext* context, const vo
size_t nframes, UINT16 wTimestamp);
typedef UINT (*psRdpsndServerConfirmBlock)(RdpsndServerContext* context, BYTE confirmBlockNum,
UINT16 wtimestamp);
typedef UINT (*psRdpsndServerSetVolume)(RdpsndServerContext* context, int left, int right);
typedef UINT (*psRdpsndServerSetVolume)(RdpsndServerContext* context, UINT16 left, UINT16 right);
typedef UINT (*psRdpsndServerClose)(RdpsndServerContext* context);
typedef void (*psRdpsndServerActivated)(RdpsndServerContext* context);

View File

@ -276,8 +276,8 @@ typedef struct _SHADOW_MSG_OUT_AUDIO_OUT_SAMPLES SHADOW_MSG_OUT_AUDIO_OUT_SAMPLE
struct _SHADOW_MSG_OUT_AUDIO_OUT_VOLUME
{
SHADOW_MSG_OUT common;
int left;
int right;
UINT16 left;
UINT16 right;
};
typedef struct _SHADOW_MSG_OUT_AUDIO_OUT_VOLUME SHADOW_MSG_OUT_AUDIO_OUT_VOLUME;

View File

@ -121,7 +121,7 @@ struct rdp_mcs_channel
{
char Name[CHANNEL_NAME_LEN + 1];
UINT32 options;
int ChannelId;
UINT16 ChannelId;
BOOL joined;
void* handle;
};