summaryrefslogtreecommitdiffstats
path: root/sesman
diff options
context:
space:
mode:
Diffstat (limited to 'sesman')
-rw-r--r--sesman/chansrv/Makefile.am5
-rw-r--r--sesman/chansrv/chansrv_fuse.c5
-rw-r--r--sesman/chansrv/clipboard_file.c6
-rw-r--r--sesman/chansrv/sound.c219
-rw-r--r--sesman/chansrv/wave-format-server.txt467
-rw-r--r--sesman/env.c47
-rw-r--r--sesman/env.h2
-rw-r--r--sesman/session.c51
8 files changed, 738 insertions, 64 deletions
diff --git a/sesman/chansrv/Makefile.am b/sesman/chansrv/Makefile.am
index 45597e12..c4cd1a3f 100644
--- a/sesman/chansrv/Makefile.am
+++ b/sesman/chansrv/Makefile.am
@@ -13,6 +13,11 @@ EXTRA_DEFINES += -DXRDP_OPUS
EXTRA_LIBS += -lopus
endif
+if XRDP_MP3LAME
+EXTRA_DEFINES += -DXRDP_MP3LAME
+EXTRA_LIBS += -lmp3lame
+endif
+
AM_CPPFLAGS = \
-DXRDP_CFG_PATH=\"${sysconfdir}/xrdp\" \
-DXRDP_SBIN_PATH=\"${sbindir}\" \
diff --git a/sesman/chansrv/chansrv_fuse.c b/sesman/chansrv/chansrv_fuse.c
index 0bb9ceff..80bde674 100644
--- a/sesman/chansrv/chansrv_fuse.c
+++ b/sesman/chansrv/chansrv_fuse.c
@@ -780,6 +780,11 @@ int xfuse_add_clip_dir_item(char *filename, int flags, int size, int lindex)
2, /* parent inode */
filename,
S_IFREG);
+ if (xinode == NULL)
+ {
+ log_debug("failed to create file in xrdp filesystem");
+ return -1;
+ }
xinode->size = size;
xinode->lindex = lindex;
xinode->is_loc_resource = 1;
diff --git a/sesman/chansrv/clipboard_file.c b/sesman/chansrv/clipboard_file.c
index 562ee82d..8c2f2189 100644
--- a/sesman/chansrv/clipboard_file.c
+++ b/sesman/chansrv/clipboard_file.c
@@ -660,7 +660,11 @@ clipboard_c2s_in_files(struct stream *s, char *file_list)
"supported [%s]", cfd->cFileName);
continue;
}
- xfuse_add_clip_dir_item(cfd->cFileName, 0, cfd->fileSizeLow, lindex);
+ if (xfuse_add_clip_dir_item(cfd->cFileName, 0, cfd->fileSizeLow, lindex) == -1)
+ {
+ log_error("clipboard_c2s_in_files: failed to add clip dir item");
+ continue;
+ }
if (file_count > 0)
{
diff --git a/sesman/chansrv/sound.c b/sesman/chansrv/sound.c
index 66108651..e2b6f53b 100644
--- a/sesman/chansrv/sound.c
+++ b/sesman/chansrv/sound.c
@@ -35,6 +35,11 @@
static OpusEncoder *g_opus_encoder = 0;
#endif
+#if defined(XRDP_MP3LAME)
+#include <lame/lame.h>
+static lame_global_flags *g_lame_encoder = 0;
+#endif
+
extern int g_rdpsnd_chan_id; /* in chansrv.c */
extern int g_display_num; /* in chansrv.c */
@@ -72,12 +77,12 @@ struct xr_wave_format_ex
int nBlockAlign;
int wBitsPerSample;
int cbSize;
- char *data;
+ tui8 *data;
};
/* output formats */
-static char g_pcm_22050_data[] = { 0 };
+static tui8 g_pcm_22050_data[] = { 0 };
static struct xr_wave_format_ex g_pcm_22050 =
{
1, /* wFormatTag - WAVE_FORMAT_PCM */
@@ -90,7 +95,7 @@ static struct xr_wave_format_ex g_pcm_22050 =
g_pcm_22050_data /* data */
};
-static char g_pcm_44100_data[] = { 0 };
+static tui8 g_pcm_44100_data[] = { 0 };
static struct xr_wave_format_ex g_pcm_44100 =
{
1, /* wFormatTag - WAVE_FORMAT_PCM */
@@ -104,7 +109,7 @@ static struct xr_wave_format_ex g_pcm_44100 =
};
#if defined(XRDP_OPUS)
-static char g_opus_44100_data[] = { 0 };
+static tui8 g_opus_44100_data[] = { 0 };
static struct xr_wave_format_ex g_opus_44100 =
{
0x0069, /* wFormatTag - WAVE_FORMAT_OPUS */
@@ -118,27 +123,40 @@ static struct xr_wave_format_ex g_opus_44100 =
};
#endif
-
-#if defined(XRDP_OPUS)
-#define SND_NUM_OUTP_FORMATS 3
-static struct xr_wave_format_ex *g_wave_outp_formats[SND_NUM_OUTP_FORMATS] =
+#if defined(XRDP_MP3LAME)
+static tui8 g_mp3lame_44100_data[] = { 0x01, 0x00, 0x02, 0x00, 0x00, 0x00, 0xb6, 0x00, 0x01, 0x00, 0x71, 0x05 };
+static struct xr_wave_format_ex g_mp3lame_44100 =
{
- &g_pcm_44100,
- &g_pcm_22050,
- &g_opus_44100
+ 0x0055, /* wFormatTag - WAVE_FORMAT_MPEGLAYER3 */
+ 2, /* num of channels */
+ 44100, /* samples per sec */
+ 176400, /* avg bytes per sec */
+ 4, /* block align */
+ 0, /* bits per sample */
+ 12, /* data size */
+ g_mp3lame_44100_data /* data */
};
-#else
-#define SND_NUM_OUTP_FORMATS 2
-static struct xr_wave_format_ex *g_wave_outp_formats[SND_NUM_OUTP_FORMATS] =
+#endif
+
+static struct xr_wave_format_ex *g_wave_outp_formats[] =
{
&g_pcm_44100,
- &g_pcm_22050
-};
+ &g_pcm_22050,
+#if defined(XRDP_OPUS)
+ &g_opus_44100,
+#endif
+#if defined(XRDP_MP3LAME)
+ &g_mp3lame_44100,
#endif
+ 0
+};
static int g_client_does_opus = 0;
static int g_client_opus_index = 0;
+static int g_client_does_mp3lame = 0;
+static int g_client_mp3lame_index = 0;
+
/* index into list from client */
static int g_current_client_format_index = 0;
@@ -147,7 +165,7 @@ static int g_current_server_format_index = 0;
/* input formats */
-static char g_pcm_inp_22050_data[] = { 0 };
+static tui8 g_pcm_inp_22050_data[] = { 0 };
static struct xr_wave_format_ex g_pcm_inp_22050 =
{
1, /* wFormatTag - WAVE_FORMAT_PCM */
@@ -160,7 +178,7 @@ static struct xr_wave_format_ex g_pcm_inp_22050 =
g_pcm_inp_22050_data /* data */
};
-static char g_pcm_inp_44100_data[] = { 0 };
+static tui8 g_pcm_inp_44100_data[] = { 0 };
static struct xr_wave_format_ex g_pcm_inp_44100 =
{
1, /* wFormatTag - WAVE_FORMAT_PCM */
@@ -173,11 +191,11 @@ static struct xr_wave_format_ex g_pcm_inp_44100 =
g_pcm_inp_44100_data /* data */
};
-#define SND_NUM_INP_FORMATS 2
-static struct xr_wave_format_ex *g_wave_inp_formats[SND_NUM_INP_FORMATS] =
+static struct xr_wave_format_ex *g_wave_inp_formats[] =
{
&g_pcm_inp_44100,
- &g_pcm_inp_22050
+ &g_pcm_inp_22050,
+ 0
};
static int g_client_input_format_index = 0;
@@ -204,8 +222,13 @@ sound_send_server_output_formats(void)
struct stream *s;
int bytes;
int index;
+ int num_formats;
char *size_ptr;
+ num_formats = sizeof(g_wave_outp_formats) /
+ sizeof(g_wave_outp_formats[0]) - 1;
+ LOG(10, ("sound_send_server_output_formats: num_formats %d", num_formats));
+
make_stream(s);
init_stream(s, 8182);
out_uint16_le(s, SNDC_FORMATS);
@@ -215,9 +238,9 @@ sound_send_server_output_formats(void)
out_uint32_le(s, 0); /* dwVolume */
out_uint32_le(s, 0); /* dwPitch */
out_uint16_le(s, 0); /* wDGramPort */
- out_uint16_le(s, SND_NUM_OUTP_FORMATS); /* wNumberOfFormats */
+ out_uint16_le(s, num_formats); /* wNumberOfFormats */
out_uint8(s, g_cBlockNo); /* cLastBlockConfirmed */
- out_uint16_le(s, 2); /* wVersion */
+ out_uint16_le(s, 5); /* wVersion */
out_uint8(s, 0); /* bPad */
/* sndFormats */
@@ -239,7 +262,7 @@ sound_send_server_output_formats(void)
00 00
*/
- for (index = 0; index < SND_NUM_OUTP_FORMATS; index++)
+ for (index = 0; index < num_formats; index++)
{
out_uint16_le(s, g_wave_outp_formats[index]->wFormatTag);
out_uint16_le(s, g_wave_outp_formats[index]->nChannels);
@@ -341,10 +364,18 @@ sound_process_output_format(int aindex, int wFormatTag, int nChannels,
if (wFormatTag == 0x0069)
{
+ LOG(0, ("wFormatTag, opus"));
g_client_does_opus = 1;
g_client_opus_index = aindex;
g_bbuf_size = 11520;
}
+ else if (wFormatTag == 0x0055)
+ {
+ LOG(0, ("wFormatTag, mp3"));
+ g_client_does_mp3lame = 1;
+ g_client_mp3lame_index = aindex;
+ g_bbuf_size = 11520;
+ }
return 0;
}
@@ -403,7 +434,7 @@ sound_process_output_formats(struct stream *s, int size)
/*****************************************************************************/
static int
-sound_wave_compress(char *data, int data_bytes, int *format_index)
+sound_wave_compress_opus(char *data, int data_bytes, int *format_index)
{
unsigned char *cdata;
int cdata_bytes;
@@ -428,7 +459,7 @@ sound_wave_compress(char *data, int data_bytes, int *format_index)
&error);
if (g_opus_encoder == 0)
{
- LOG(0, ("sound_wave_compress: opus_encoder_create failed"));
+ LOG(0, ("sound_wave_compress_opus: opus_encoder_create failed"));
return data_bytes;
}
}
@@ -465,7 +496,95 @@ sound_wave_compress(char *data, int data_bytes, int *format_index)
/*****************************************************************************/
static int
-sound_wave_compress(char *data, int data_bytes, int *format_index)
+sound_wave_compress_opus(char *data, int data_bytes, int *format_index)
+{
+ return data_bytes;
+}
+
+#endif
+
+#if defined(XRDP_MP3LAME)
+
+/*****************************************************************************/
+static int
+sound_wave_compress_mp3lame(char *data, int data_bytes, int *format_index)
+{
+ int rv;
+ int cdata_bytes;
+ int odata_bytes;
+ unsigned char *cdata;
+
+ cdata = NULL;
+ rv = data_bytes;
+
+ if (g_client_does_mp3lame == 0)
+ {
+ return rv;
+ }
+
+ if (g_lame_encoder == 0)
+ {
+ /* init mp3 lame encoder */
+ LOG(0, ("sound_wave_compress_mp3lame: using mp3lame"));
+
+ g_lame_encoder = lame_init();
+ if (g_lame_encoder == 0)
+ {
+ LOG(0, ("sound_wave_compress_mp3lame: lame_init() failed"));
+ return rv;
+ }
+ lame_set_num_channels(g_lame_encoder, g_mp3lame_44100.nChannels);
+ lame_set_in_samplerate(g_lame_encoder, g_mp3lame_44100.nSamplesPerSec);
+ if (lame_init_params(g_lame_encoder) == -1)
+ {
+ LOG(0, ("sound_wave_compress_mp3lame: lame_init_params() failed"));
+ return rv;
+ }
+
+ LOG(0, ("sound_wave_compress_mp3lame: lame config:"));
+ LOG(0, (" brate : %d", lame_get_brate(g_lame_encoder)));
+ LOG(0, (" compression ratio: %f", lame_get_compression_ratio(g_lame_encoder)));
+ LOG(0, (" encoder delay : %d", lame_get_encoder_delay(g_lame_encoder)));
+ LOG(0, (" frame size : %d", lame_get_framesize(g_lame_encoder)));
+ LOG(0, (" encoder padding : %d", lame_get_encoder_padding(g_lame_encoder)));
+ LOG(0, (" mode : %d", lame_get_mode(g_lame_encoder)));
+ }
+
+ odata_bytes = data_bytes;
+ cdata_bytes = data_bytes;
+ cdata = (unsigned char *) g_malloc(cdata_bytes, 0);
+ if (data_bytes < g_bbuf_size)
+ {
+ g_memset(data + data_bytes, 0, g_bbuf_size - data_bytes);
+ data_bytes = g_bbuf_size;
+ }
+ cdata_bytes = lame_encode_buffer_interleaved(g_lame_encoder,
+ (short int *) data,
+ data_bytes / 4,
+ cdata,
+ cdata_bytes);
+ if (cdata_bytes < 0)
+ {
+ LOG(0, ("sound_wave_compress: lame_encode_buffer_interleaved() "
+ "failed, error %d", cdata_bytes));
+ return rv;
+ }
+ if ((cdata_bytes > 0) && (cdata_bytes < odata_bytes))
+ {
+ *format_index = g_client_mp3lame_index;
+ g_memcpy(data, cdata, cdata_bytes);
+ rv = cdata_bytes;
+ }
+
+ g_free(cdata);
+ return rv;
+}
+
+#else
+
+/*****************************************************************************/
+static int
+sound_wave_compress_mp3lame(char *data, int data_bytes, int *format_index)
{
return data_bytes;
}
@@ -473,6 +592,21 @@ sound_wave_compress(char *data, int data_bytes, int *format_index)
#endif
/*****************************************************************************/
+static int
+sound_wave_compress(char *data, int data_bytes, int *format_index)
+{
+ if (g_client_does_opus)
+ {
+ return sound_wave_compress_opus(data, data_bytes, format_index);
+ }
+ else if (g_client_does_mp3lame)
+ {
+ return sound_wave_compress_mp3lame(data, data_bytes, format_index);
+ }
+ return data_bytes;
+}
+
+/*****************************************************************************/
/* send wave message to client */
static int
sound_send_wave_data_chunk(char *data, int data_bytes)
@@ -820,6 +954,9 @@ sound_init(void)
g_client_does_opus = 0;
g_client_opus_index = 0;
+ g_client_does_mp3lame = 0;
+ g_client_mp3lame_index = 0;
+
return 0;
}
@@ -852,6 +989,15 @@ sound_deinit(void)
g_audio_c_trans_in = 0;
}
+#if defined(XRDP_MP3LAME)
+ if (g_lame_encoder)
+ {
+ lame_close(g_lame_encoder);
+ g_lame_encoder = 0;
+ g_client_does_mp3lame = 0;
+ }
+#endif
+
fifo_deinit(&g_in_fifo);
return 0;
@@ -1014,10 +1160,15 @@ sound_check_wait_objs(void)
static int APP_CC
sound_send_server_input_formats(void)
{
- struct stream* s;
- int bytes;
- int index;
- char* size_ptr;
+ struct stream *s;
+ int bytes;
+ int index;
+ int num_formats;
+ char *size_ptr;
+
+ num_formats = sizeof(g_wave_inp_formats) /
+ sizeof(g_wave_inp_formats[0]) - 1;
+ LOG(10, ("sound_send_server_input_formats: num_formats %d", num_formats));
make_stream(s);
init_stream(s, 8182);
@@ -1026,8 +1177,8 @@ sound_send_server_input_formats(void)
out_uint16_le(s, 0); /* size, set later */
out_uint32_le(s, 0); /* unused */
out_uint32_le(s, 0); /* unused */
- out_uint16_le(s, SND_NUM_INP_FORMATS); /* wNumberOfFormats */
- out_uint16_le(s, 2); /* wVersion */
+ out_uint16_le(s, num_formats); /* wNumberOfFormats */
+ out_uint16_le(s, 5); /* wVersion */
/*
wFormatTag 2 byte offset 0
@@ -1040,7 +1191,7 @@ sound_send_server_input_formats(void)
data variable offset 18
*/
- for (index = 0; index < SND_NUM_INP_FORMATS; index++)
+ for (index = 0; index < num_formats; index++)
{
out_uint16_le(s, g_wave_inp_formats[index]->wFormatTag);
out_uint16_le(s, g_wave_inp_formats[index]->nChannels);
diff --git a/sesman/chansrv/wave-format-server.txt b/sesman/chansrv/wave-format-server.txt
index 1d0bb91e..3a197a71 100644
--- a/sesman/chansrv/wave-format-server.txt
+++ b/sesman/chansrv/wave-format-server.txt
@@ -464,3 +464,470 @@ wFormatTag=353 nChannels=1 nSamplesPerSec=8000 nAvgBytesPerSec=750 nBlockAlign=4
?
wFormatTag=66 nChannels=1 nSamplesPerSec=8000 nAvgBytesPerSec=666 nBlockAlign=20 wBitsPerSample=0 cbSize=10
0000 03 00 ce 9a 32 f7 a2 ae de ac ....2.....
+
+
+
+//***************************************************************
+// Windows 7 SP1 x64 Server Formats
+WAVE_FORMAT_PCM:
+wFormatTag: 0x0001 nChannels: 2 nSamplesPerSec: 44100 nAvgBytesPerSec: 176400 nBlockAlign: 4 wBitsPerSample: 16 cbSize: 0
+
+WAVE_FORMAT_ADPCM:
+wFormatTag: 0x0002 nChannels: 2 nSamplesPerSec: 44100 nAvgBytesPerSec: 44359 nBlockAlign: 2048 wBitsPerSample: 4 cbSize: 32
+
+WAVE_FORMAT_DVI_ADPCM:
+wFormatTag: 0x0011 nChannels: 2 nSamplesPerSec: 44100 nAvgBytesPerSec: 44251 nBlockAlign: 2048 wBitsPerSample: 4 cbSize: 2
+
+WAVE_FORMAT_ALAW:
+wFormatTag: 0x0006 nChannels: 2 nSamplesPerSec: 22050 nAvgBytesPerSec: 44100 nBlockAlign: 2 wBitsPerSample: 8 cbSize: 0
+
+WAVE_FORMAT_ADPCM:
+wFormatTag: 0x0002 nChannels: 2 nSamplesPerSec: 22050 nAvgBytesPerSec: 22311 nBlockAlign: 1024 wBitsPerSample: 4 cbSize: 32
+
+WAVE_FORMAT_DVI_ADPCM:
+wFormatTag: 0x0011 nChannels: 2 nSamplesPerSec: 22050 nAvgBytesPerSec: 22201 nBlockAlign: 1024 wBitsPerSample: 4 cbSize: 2
+
+WAVE_FORMAT_ADPCM:
+wFormatTag: 0x0002 nChannels: 1 nSamplesPerSec: 44100 nAvgBytesPerSec: 22179 nBlockAlign: 1024 wBitsPerSample: 4 cbSize: 32
+
+WAVE_FORMAT_DVI_ADPCM:
+wFormatTag: 0x0011 nChannels: 1 nSamplesPerSec: 44100 nAvgBytesPerSec: 22125 nBlockAlign: 1024 wBitsPerSample: 4 cbSize: 2
+
+WAVE_FORMAT_ADPCM:
+wFormatTag: 0x0002 nChannels: 2 nSamplesPerSec: 11025 nAvgBytesPerSec: 11289 nBlockAlign: 512 wBitsPerSample: 4 cbSize: 32
+
+WAVE_FORMAT_DVI_ADPCM:
+wFormatTag: 0x0011 nChannels: 2 nSamplesPerSec: 11025 nAvgBytesPerSec: 11177 nBlockAlign: 512 wBitsPerSample: 4 cbSize: 2
+
+WAVE_FORMAT_ADPCM:
+wFormatTag: 0x0002 nChannels: 1 nSamplesPerSec: 22050 nAvgBytesPerSec: 11155 nBlockAlign: 512 wBitsPerSample: 4 cbSize: 32
+
+WAVE_FORMAT_DVI_ADPCM:
+wFormatTag: 0x0011 nChannels: 1 nSamplesPerSec: 22050 nAvgBytesPerSec: 11100 nBlockAlign: 512 wBitsPerSample: 4 cbSize: 2
+
+WAVE_FORMAT_GSM610:
+wFormatTag: 0x0031 nChannels: 1 nSamplesPerSec: 44100 nAvgBytesPerSec: 8957 nBlockAlign: 65 wBitsPerSample: 0 cbSize: 2
+
+WAVE_FORMAT_ADPCM:
+wFormatTag: 0x0002 nChannels: 2 nSamplesPerSec: 8000 nAvgBytesPerSec: 8192 nBlockAlign: 512 wBitsPerSample: 4 cbSize: 32
+
+WAVE_FORMAT_DVI_ADPCM:
+wFormatTag: 0x0011 nChannels: 2 nSamplesPerSec: 8000 nAvgBytesPerSec: 8110 nBlockAlign: 512 wBitsPerSample: 4 cbSize: 2
+
+WAVE_FORMAT_ADPCM:
+wFormatTag: 0x0002 nChannels: 1 nSamplesPerSec: 11025 nAvgBytesPerSec: 5644 nBlockAlign: 256 wBitsPerSample: 4 cbSize: 32
+
+WAVE_FORMAT_DVI_ADPCM:
+wFormatTag: 0x0011 nChannels: 1 nSamplesPerSec: 11025 nAvgBytesPerSec: 5588 nBlockAlign: 256 wBitsPerSample: 4 cbSize: 2
+
+WAVE_FORMAT_GSM610:
+wFormatTag: 0x0031 nChannels: 1 nSamplesPerSec: 22050 nAvgBytesPerSec: 4478 nBlockAlign: 65 wBitsPerSample: 0 cbSize: 2
+
+WAVE_FORMAT_ADPCM:
+wFormatTag: 0x0002 nChannels: 1 nSamplesPerSec: 8000 nAvgBytesPerSec: 4096 nBlockAlign: 256 wBitsPerSample: 4 cbSize: 32
+
+WAVE_FORMAT_DVI_ADPCM:
+wFormatTag: 0x0011 nChannels: 1 nSamplesPerSec: 8000 nAvgBytesPerSec: 4055 nBlockAlign: 256 wBitsPerSample: 4 cbSize: 2
+
+WAVE_FORMAT_GSM610:
+wFormatTag: 0x0031 nChannels: 1 nSamplesPerSec: 11025 nAvgBytesPerSec: 2239 nBlockAlign: 65 wBitsPerSample: 0 cbSize: 2
+
+WAVE_FORMAT_GSM610:
+wFormatTag: 0x0031 nChannels: 1 nSamplesPerSec: 8000 nAvgBytesPerSec: 1625 nBlockAlign: 65 wBitsPerSample: 0 cbSize: 2
+
+
+//***************************************************************
+// Windows 10 10586 x64 Server Formats
+WAVE_FORMAT_AAC_MS:
+wFormatTag: 0xA106 nChannels: 2 nSamplesPerSec: 44100 nAvgBytesPerSec: 24000 nBlockAlign: 4 wBitsPerSample: 16 cbSize: 0
+
+WAVE_FORMAT_AAC_MS:
+wFormatTag: 0xA106 nChannels: 2 nSamplesPerSec: 44100 nAvgBytesPerSec: 20000 nBlockAlign: 4 wBitsPerSample: 16 cbSize: 0
+
+WAVE_FORMAT_AAC_MS:
+wFormatTag: 0xA106 nChannels: 2 nSamplesPerSec: 44100 nAvgBytesPerSec: 16000 nBlockAlign: 4 wBitsPerSample: 16 cbSize: 0
+
+WAVE_FORMAT_AAC_MS:
+wFormatTag: 0xA106 nChannels: 2 nSamplesPerSec: 44100 nAvgBytesPerSec: 12000 nBlockAlign: 4 wBitsPerSample: 16 cbSize: 0
+
+WAVE_FORMAT_PCM:
+wFormatTag: 0x0001 nChannels: 2 nSamplesPerSec: 44100 nAvgBytesPerSec: 176400 nBlockAlign: 4 wBitsPerSample: 16 cbSize: 0
+
+WAVE_FORMAT_ADPCM:
+wFormatTag: 0x0002 nChannels: 2 nSamplesPerSec: 44100 nAvgBytesPerSec: 44359 nBlockAlign: 2048 wBitsPerSample: 4 cbSize: 32
+
+WAVE_FORMAT_DVI_ADPCM:
+wFormatTag: 0x0011 nChannels: 2 nSamplesPerSec: 44100 nAvgBytesPerSec: 44251 nBlockAlign: 2048 wBitsPerSample: 4 cbSize: 2
+
+WAVE_FORMAT_ALAW:
+wFormatTag: 0x0006 nChannels: 2 nSamplesPerSec: 22050 nAvgBytesPerSec: 44100 nBlockAlign: 2 wBitsPerSample: 8 cbSize: 0
+
+WAVE_FORMAT_ADPCM:
+wFormatTag: 0x0002 nChannels: 2 nSamplesPerSec: 22050 nAvgBytesPerSec: 22311 nBlockAlign: 1024 wBitsPerSample: 4 cbSize: 32
+
+WAVE_FORMAT_DVI_ADPCM:
+wFormatTag: 0x0011 nChannels: 2 nSamplesPerSec: 22050 nAvgBytesPerSec: 22201 nBlockAlign: 1024 wBitsPerSample: 4 cbSize: 2
+
+WAVE_FORMAT_ADPCM:
+wFormatTag: 0x0002 nChannels: 1 nSamplesPerSec: 44100 nAvgBytesPerSec: 22179 nBlockAlign: 1024 wBitsPerSample: 4 cbSize: 32
+
+WAVE_FORMAT_DVI_ADPCM:
+wFormatTag: 0x0011 nChannels: 1 nSamplesPerSec: 44100 nAvgBytesPerSec: 22125 nBlockAlign: 1024 wBitsPerSample: 4 cbSize: 2
+
+WAVE_FORMAT_ADPCM:
+wFormatTag: 0x0002 nChannels: 2 nSamplesPerSec: 11025 nAvgBytesPerSec: 11289 nBlockAlign: 512 wBitsPerSample: 4 cbSize: 32
+
+WAVE_FORMAT_DVI_ADPCM:
+wFormatTag: 0x0011 nChannels: 2 nSamplesPerSec: 11025 nAvgBytesPerSec: 11177 nBlockAlign: 512 wBitsPerSample: 4 cbSize: 2
+
+WAVE_FORMAT_ADPCM:
+wFormatTag: 0x0002 nChannels: 1 nSamplesPerSec: 22050 nAvgBytesPerSec: 11155 nBlockAlign: 512 wBitsPerSample: 4 cbSize: 32
+
+WAVE_FORMAT_DVI_ADPCM:
+wFormatTag: 0x0011 nChannels: 1 nSamplesPerSec: 22050 nAvgBytesPerSec: 11100 nBlockAlign: 512 wBitsPerSample: 4 cbSize: 2
+
+WAVE_FORMAT_GSM610:
+wFormatTag: 0x0031 nChannels: 1 nSamplesPerSec: 44100 nAvgBytesPerSec: 8957 nBlockAlign: 65 wBitsPerSample: 0 cbSize: 2
+
+WAVE_FORMAT_ADPCM:
+wFormatTag: 0x0002 nChannels: 2 nSamplesPerSec: 8000 nAvgBytesPerSec: 8192 nBlockAlign: 512 wBitsPerSample: 4 cbSize: 32
+
+WAVE_FORMAT_DVI_ADPCM:
+wFormatTag: 0x0011 nChannels: 2 nSamplesPerSec: 8000 nAvgBytesPerSec: 8110 nBlockAlign: 512 wBitsPerSample: 4 cbSize: 2
+
+WAVE_FORMAT_ADPCM:
+wFormatTag: 0x0002 nChannels: 1 nSamplesPerSec: 11025 nAvgBytesPerSec: 5644 nBlockAlign: 256 wBitsPerSample: 4 cbSize: 32
+
+WAVE_FORMAT_DVI_ADPCM:
+wFormatTag: 0x0011 nChannels: 1 nSamplesPerSec: 11025 nAvgBytesPerSec: 5588 nBlockAlign: 256 wBitsPerSample: 4 cbSize: 2
+
+WAVE_FORMAT_GSM610:
+wFormatTag: 0x0031 nChannels: 1 nSamplesPerSec: 22050 nAvgBytesPerSec: 4478 nBlockAlign: 65 wBitsPerSample: 0 cbSize: 2
+
+WAVE_FORMAT_ADPCM:
+wFormatTag: 0x0002 nChannels: 1 nSamplesPerSec: 8000 nAvgBytesPerSec: 4096 nBlockAlign: 256 wBitsPerSample: 4 cbSize: 32
+
+WAVE_FORMAT_DVI_ADPCM:
+wFormatTag: 0x0011 nChannels: 1 nSamplesPerSec: 8000 nAvgBytesPerSec: 4055 nBlockAlign: 256 wBitsPerSample: 4 cbSize: 2
+
+WAVE_FORMAT_GSM610:
+wFormatTag: 0x0031 nChannels: 1 nSamplesPerSec: 11025 nAvgBytesPerSec: 2239 nBlockAlign: 65 wBitsPerSample: 0 cbSize: 2
+
+WAVE_FORMAT_GSM610:
+wFormatTag: 0x0031 nChannels: 1 nSamplesPerSec: 8000 nAvgBytesPerSec: 1625 nBlockAlign: 65 wBitsPerSample: 0 cbSize: 2
+
+
+//***************************************************************
+// Windows Server 2016 TP4 x64 Server Formats
+WAVE_FORMAT_AAC_MS:
+wFormatTag: 0xA106 nChannels: 2 nSamplesPerSec: 44100 nAvgBytesPerSec: 24000 nBlockAlign: 4 wBitsPerSample: 16 cbSize: 0
+
+WAVE_FORMAT_AAC_MS:
+wFormatTag: 0xA106 nChannels: 2 nSamplesPerSec: 44100 nAvgBytesPerSec: 20000 nBlockAlign: 4 wBitsPerSample: 16 cbSize: 0
+
+WAVE_FORMAT_AAC_MS:
+wFormatTag: 0xA106 nChannels: 2 nSamplesPerSec: 44100 nAvgBytesPerSec: 16000 nBlockAlign: 4 wBitsPerSample: 16 cbSize: 0
+
+WAVE_FORMAT_AAC_MS:
+wFormatTag: 0xA106 nChannels: 2 nSamplesPerSec: 44100 nAvgBytesPerSec: 12000 nBlockAlign: 4 wBitsPerSample: 16 cbSize: 0
+
+WAVE_FORMAT_PCM:
+wFormatTag: 0x0001 nChannels: 2 nSamplesPerSec: 44100 nAvgBytesPerSec: 176400 nBlockAlign: 4 wBitsPerSample: 16 cbSize: 0
+
+WAVE_FORMAT_ADPCM:
+wFormatTag: 0x0002 nChannels: 2 nSamplesPerSec: 44100 nAvgBytesPerSec: 44359 nBlockAlign: 2048 wBitsPerSample: 4 cbSize: 32
+
+WAVE_FORMAT_DVI_ADPCM:
+wFormatTag: 0x0011 nChannels: 2 nSamplesPerSec: 44100 nAvgBytesPerSec: 44251 nBlockAlign: 2048 wBitsPerSample: 4 cbSize: 2
+
+WAVE_FORMAT_ALAW:
+wFormatTag: 0x0006 nChannels: 2 nSamplesPerSec: 22050 nAvgBytesPerSec: 44100 nBlockAlign: 2 wBitsPerSample: 8 cbSize: 0
+
+WAVE_FORMAT_ADPCM:
+wFormatTag: 0x0002 nChannels: 2 nSamplesPerSec: 22050 nAvgBytesPerSec: 22311 nBlockAlign: 1024 wBitsPerSample: 4 cbSize: 32
+
+WAVE_FORMAT_DVI_ADPCM:
+wFormatTag: 0x0011 nChannels: 2 nSamplesPerSec: 22050 nAvgBytesPerSec: 22201 nBlockAlign: 1024 wBitsPerSample: 4 cbSize: 2
+
+WAVE_FORMAT_ADPCM:
+wFormatTag: 0x0002 nChannels: 1 nSamplesPerSec: 44100 nAvgBytesPerSec: 22179 nBlockAlign: 1024 wBitsPerSample: 4 cbSize: 32
+
+WAVE_FORMAT_DVI_ADPCM:
+wFormatTag: 0x0011 nChannels: 1 nSamplesPerSec: 44100 nAvgBytesPerSec: 22125 nBlockAlign: 1024 wBitsPerSample: 4 cbSize: 2
+
+WAVE_FORMAT_ADPCM:
+wFormatTag: 0x0002 nChannels: 2 nSamplesPerSec: 11025 nAvgBytesPerSec: 11289 nBlockAlign: 512 wBitsPerSample: 4 cbSize: 32
+
+WAVE_FORMAT_DVI_ADPCM:
+wFormatTag: 0x0011 nChannels: 2 nSamplesPerSec: 11025 nAvgBytesPerSec: 11177 nBlockAlign: 512 wBitsPerSample: 4 cbSize: 2
+
+WAVE_FORMAT_ADPCM:
+wFormatTag: 0x0002 nChannels: 1 nSamplesPerSec: 22050 nAvgBytesPerSec: 11155 nBlockAlign: 512 wBitsPerSample: 4 cbSize: 32
+
+WAVE_FORMAT_DVI_ADPCM:
+wFormatTag: 0x0011 nChannels: 1 nSamplesPerSec: 22050 nAvgBytesPerSec: 11100 nBlockAlign: 512 wBitsPerSample: 4 cbSize: 2
+
+WAVE_FORMAT_GSM610:
+wFormatTag: 0x0031 nChannels: 1 nSamplesPerSec: 44100 nAvgBytesPerSec: 8957 nBlockAlign: 65 wBitsPerSample: 0 cbSize: 2
+
+WAVE_FORMAT_ADPCM:
+wFormatTag: 0x0002 nChannels: 2 nSamplesPerSec: 8000 nAvgBytesPerSec: 8192 nBlockAlign: 512 wBitsPerSample: 4 cbSize: 32
+
+WAVE_FORMAT_DVI_ADPCM:
+wFormatTag: 0x0011 nChannels: 2 nSamplesPerSec: 8000 nAvgBytesPerSec: 8110 nBlockAlign: 512 wBitsPerSample: 4 cbSize: 2
+
+WAVE_FORMAT_ADPCM:
+wFormatTag: 0x0002 nChannels: 1 nSamplesPerSec: 11025 nAvgBytesPerSec: 5644 nBlockAlign: 256 wBitsPerSample: 4 cbSize: 32
+
+WAVE_FORMAT_DVI_ADPCM:
+wFormatTag: 0x0011 nChannels: 1 nSamplesPerSec: 11025 nAvgBytesPerSec: 5588 nBlockAlign: 256 wBitsPerSample: 4 cbSize: 2
+
+WAVE_FORMAT_GSM610:
+wFormatTag: 0x0031 nChannels: 1 nSamplesPerSec: 22050 nAvgBytesPerSec: 4478 nBlockAlign: 65 wBitsPerSample: 0 cbSize: 2
+
+WAVE_FORMAT_ADPCM:
+wFormatTag: 0x0002 nChannels: 1 nSamplesPerSec: 8000 nAvgBytesPerSec: 4096 nBlockAlign: 256 wBitsPerSample: 4 cbSize: 32
+
+WAVE_FORMAT_DVI_ADPCM:
+wFormatTag: 0x0011 nChannels: 1 nSamplesPerSec: 8000 nAvgBytesPerSec: 4055 nBlockAlign: 256 wBitsPerSample: 4 cbSize: 2
+
+WAVE_FORMAT_GSM610:
+wFormatTag: 0x0031 nChannels: 1 nSamplesPerSec: 11025 nAvgBytesPerSec: 2239 nBlockAlign: 65 wBitsPerSample: 0 cbSize: 2
+
+WAVE_FORMAT_GSM610:
+wFormatTag: 0x0031 nChannels: 1 nSamplesPerSec: 8000 nAvgBytesPerSec: 1625 nBlockAlign: 65 wBitsPerSample: 0 cbSize: 2
+
+
+
+
+
+//***************************************************************
+// Windows XP SP3 x86 Server Formats
+WAVE_FORMAT_PCM:
+wFormatTag: 0x0001 nChannels: 2 nSamplesPerSec: 22050 nAvgBytesPerSec: 88200 nBlockAlign: 4 wBitsPerSample: 16 cbSize: 0
+
+WAVE_FORMAT_ALAW:
+wFormatTag: 0x0006 nChannels: 2 nSamplesPerSec: 22050 nAvgBytesPerSec: 44100 nBlockAlign: 2 wBitsPerSample: 8 cbSize: 0
+
+WAVE_FORMAT_MULAW:
+wFormatTag: 0x0007 nChannels: 2 nSamplesPerSec: 22050 nAvgBytesPerSec: 44100 nBlockAlign: 2 wBitsPerSample: 8 cbSize: 0
+
+WAVE_FORMAT_ADPCM:
+wFormatTag: 0x0002 nChannels: 2 nSamplesPerSec: 22050 nAvgBytesPerSec: 22311 nBlockAlign: 1024 wBitsPerSample: 4 cbSize: 32
+
+WAVE_FORMAT_DVI_ADPCM:
+wFormatTag: 0x0011 nChannels: 2 nSamplesPerSec: 22050 nAvgBytesPerSec: 22201 nBlockAlign: 1024 wBitsPerSample: 4 cbSize: 2
+
+WAVE_FORMAT_ALAW:
+wFormatTag: 0x0006 nChannels: 2 nSamplesPerSec: 11025 nAvgBytesPerSec: 22050 nBlockAlign: 2 wBitsPerSample: 8 cbSize: 0
+
+WAVE_FORMAT_ALAW:
+wFormatTag: 0x0006 nChannels: 1 nSamplesPerSec: 22050 nAvgBytesPerSec: 22050 nBlockAlign: 1 wBitsPerSample: 8 cbSize: 0
+
+WAVE_FORMAT_MULAW:
+wFormatTag: 0x0007 nChannels: 2 nSamplesPerSec: 11025 nAvgBytesPerSec: 22050 nBlockAlign: 2 wBitsPerSample: 8 cbSize: 0
+
+WAVE_FORMAT_MULAW:
+wFormatTag: 0x0007 nChannels: 1 nSamplesPerSec: 22050 nAvgBytesPerSec: 22050 nBlockAlign: 1 wBitsPerSample: 8 cbSize: 0
+
+WAVE_FORMAT_ALAW:
+wFormatTag: 0x0006 nChannels: 2 nSamplesPerSec: 8000 nAvgBytesPerSec: 16000 nBlockAlign: 2 wBitsPerSample: 8 cbSize: 0
+
+WAVE_FORMAT_MULAW:
+wFormatTag: 0x0007 nChannels: 2 nSamplesPerSec: 8000 nAvgBytesPerSec: 16000 nBlockAlign: 2 wBitsPerSample: 8 cbSize: 0
+
+WAVE_FORMAT_ADPCM:
+wFormatTag: 0x0002 nChannels: 2 nSamplesPerSec: 11025 nAvgBytesPerSec: 11289 nBlockAlign: 512 wBitsPerSample: 4 cbSize: 32
+
+WAVE_FORMAT_DVI_ADPCM:
+wFormatTag: 0x0011 nChannels: 2 nSamplesPerSec: 11025 nAvgBytesPerSec: 11177 nBlockAlign: 512 wBitsPerSample: 4 cbSize: 2
+
+WAVE_FORMAT_ADPCM:
+wFormatTag: 0x0002 nChannels: 1 nSamplesPerSec: 22050 nAvgBytesPerSec: 11155 nBlockAlign: 512 wBitsPerSample: 4 cbSize: 32
+
+WAVE_FORMAT_DVI_ADPCM:
+wFormatTag: 0x0011 nChannels: 1 nSamplesPerSec: 22050 nAvgBytesPerSec: 11100 nBlockAlign: 512 wBitsPerSample: 4 cbSize: 2
+
+WAVE_FORMAT_ALAW:
+wFormatTag: 0x0006 nChannels: 1 nSamplesPerSec: 11025 nAvgBytesPerSec: 11025 nBlockAlign: 1 wBitsPerSample: 8 cbSize: 0
+
+WAVE_FORMAT_MULAW:
+wFormatTag: 0x0007 nChannels: 1 nSamplesPerSec: 11025 nAvgBytesPerSec: 11025 nBlockAlign: 1 wBitsPerSample: 8 cbSize: 0
+
+WAVE_FORMAT_ADPCM:
+wFormatTag: 0x0002 nChannels: 2 nSamplesPerSec: 8000 nAvgBytesPerSec: 8192 nBlockAlign: 512 wBitsPerSample: 4 cbSize: 32
+
+WAVE_FORMAT_DVI_ADPCM:
+wFormatTag: 0x0011 nChannels: 2 nSamplesPerSec: 8000 nAvgBytesPerSec: 8110 nBlockAlign: 512 wBitsPerSample: 4 cbSize: 2
+
+WAVE_FORMAT_ALAW:
+wFormatTag: 0x0006 nChannels: 1 nSamplesPerSec: 8000 nAvgBytesPerSec: 8000 nBlockAlign: 1 wBitsPerSample: 8 cbSize: 0
+
+WAVE_FORMAT_MULAW:
+wFormatTag: 0x0007 nChannels: 1 nSamplesPerSec: 8000 nAvgBytesPerSec: 8000 nBlockAlign: 1 wBitsPerSample: 8 cbSize: 0
+
+WAVE_FORMAT_MPEGLAYER3:
+wFormatTag: 0x0055 nChannels: 2 nSamplesPerSec: 22050 nAvgBytesPerSec: 7000 nBlockAlign: 1 wBitsPerSample: 0 cbSize: 12
+
+WAVE_FORMAT_MPEGLAYER3:
+wFormatTag: 0x0055 nChannels: 2 nSamplesPerSec: 16000 nAvgBytesPerSec: 7000 nBlockAlign: 1 wBitsPerSample: 0 cbSize: 12
+
+WAVE_FORMAT_MPEGLAYER3:
+wFormatTag: 0x0055 nChannels: 2 nSamplesPerSec: 22050 nAvgBytesPerSec: 6000 nBlockAlign: 1 wBitsPerSample: 0 cbSize: 12
+
+WAVE_FORMAT_MPEGLAYER3:
+wFormatTag: 0x0055 nChannels: 2 nSamplesPerSec: 16000 nAvgBytesPerSec: 6000 nBlockAlign: 1 wBitsPerSample: 0 cbSize: 12
+
+WAVE_FORMAT_ADPCM:
+wFormatTag: 0x0002 nChannels: 1 nSamplesPerSec: 11025 nAvgBytesPerSec: 5644 nBlockAlign: 256 wBitsPerSample: 4 cbSize: 32
+
+WAVE_FORMAT_DVI_ADPCM:
+wFormatTag: 0x0011 nChannels: 1 nSamplesPerSec: 11025 nAvgBytesPerSec: 5588 nBlockAlign: 256 wBitsPerSample: 4 cbSize: 2
+
+WAVE_FORMAT_MPEGLAYER3:
+wFormatTag: 0x0055 nChannels: 2 nSamplesPerSec: 22050 nAvgBytesPerSec: 5000 nBlockAlign: 1 wBitsPerSample: 0 cbSize: 12
+
+WAVE_FORMAT_MPEGLAYER3:
+wFormatTag: 0x0055 nChannels: 2 nSamplesPerSec: 16000 nAvgBytesPerSec: 5000 nBlockAlign: 1 wBitsPerSample: 0 cbSize: 12
+
+WAVE_FORMAT_GSM610:
+wFormatTag: 0x0031 nChannels: 1 nSamplesPerSec: 22050 nAvgBytesPerSec: 4478 nBlockAlign: 65 wBitsPerSample: 0 cbSize: 2
+
+WAVE_FORMAT_ADPCM:
+wFormatTag: 0x0002 nChannels: 1 nSamplesPerSec: 8000 nAvgBytesPerSec: 4096 nBlockAlign: 256 wBitsPerSample: 4 cbSize: 32
+
+WAVE_FORMAT_DVI_ADPCM:
+wFormatTag: 0x0011 nChannels: 1 nSamplesPerSec: 8000 nAvgBytesPerSec: 4055 nBlockAlign: 256 wBitsPerSample: 4 cbSize: 2
+
+WAVE_FORMAT_WMAUDIO2:
+wFormatTag: 0x0161 nChannels: 2 nSamplesPerSec: 22050 nAvgBytesPerSec: 4005 nBlockAlign: 186 wBitsPerSample: 16 cbSize: 47
+
+WAVE_FORMAT_MPEGLAYER3:
+wFormatTag: 0x0055 nChannels: 2 nSamplesPerSec: 16000 nAvgBytesPerSec: 4000 nBlockAlign: 1 wBitsPerSample: 0 cbSize: 12
+
+WAVE_FORMAT_MPEGLAYER3:
+wFormatTag: 0x0055 nChannels: 2 nSamplesPerSec: 12000 nAvgBytesPerSec: 4000 nBlockAlign: 1 wBitsPerSample: 0 cbSize: 12
+
+WAVE_FORMAT_MPEGLAYER3:
+wFormatTag: 0x0055 nChannels: 2 nSamplesPerSec: 11025 nAvgBytesPerSec: 4000 nBlockAlign: 1 wBitsPerSample: 0 cbSize: 12
+
+WAVE_FORMAT_MPEGLAYER3:
+wFormatTag: 0x0055 nChannels: 2 nSamplesPerSec: 8000 nAvgBytesPerSec: 4000 nBlockAlign: 1 wBitsPerSample: 0 cbSize: 12
+
+WAVE_FORMAT_MPEGLAYER3:
+wFormatTag: 0x0055 nChannels: 1 nSamplesPerSec: 22050 nAvgBytesPerSec: 4000 nBlockAlign: 1 wBitsPerSample: 0 cbSize: 12
+
+WAVE_FORMAT_MPEGLAYER3:
+wFormatTag: 0x0055 nChannels: 1 nSamplesPerSec: 16000 nAvgBytesPerSec: 4000 nBlockAlign: 1 wBitsPerSample: 0 cbSize: 12
+
+WAVE_FORMAT_MPEGLAYER3:
+wFormatTag: 0x0055 nChannels: 2 nSamplesPerSec: 12000 nAvgBytesPerSec: 3000 nBlockAlign: 1 wBitsPerSample: 0 cbSize: 12
+
+WAVE_FORMAT_MPEGLAYER3:
+wFormatTag: 0x0055 nChannels: 2 nSamplesPerSec: 11025 nAvgBytesPerSec: 3000 nBlockAlign: 1 wBitsPerSample: 0 cbSize: 12
+
+WAVE_FORMAT_MPEGLAYER3:
+wFormatTag: 0x0055 nChannels: 2 nSamplesPerSec: 8000 nAvgBytesPerSec: 3000 nBlockAlign: 1 wBitsPerSample: 0 cbSize: 12
+
+WAVE_FORMAT_MPEGLAYER3:
+wFormatTag: 0x0055 nChannels: 1 nSamplesPerSec: 22050 nAvgBytesPerSec: 3000 nBlockAlign: 1 wBitsPerSample: 0 cbSize: 12
+
+WAVE_FORMAT_MPEGLAYER3:
+wFormatTag: 0x0055 nChannels: 1 nSamplesPerSec: 16000 nAvgBytesPerSec: 3000 nBlockAlign: 1 wBitsPerSample: 0 cbSize: 12
+
+WAVE_FORMAT_WMAUDIO2:
+wFormatTag: 0x0161 nChannels: 1 nSamplesPerSec: 22050 nAvgBytesPerSec: 2519 nBlockAlign: 117 wBitsPerSample: 16 cbSize: 47
+
+WAVE_FORMAT_WMAUDIO2:
+wFormatTag: 0x0161 nChannels: 2 nSamplesPerSec: 22050 nAvgBytesPerSec: 2519 nBlockAlign: 117 wBitsPerSample: 16 cbSize: 47
+
+WAVE_FORMAT_MPEGLAYER3:
+wFormatTag: 0x0055 nChannels: 2 nSamplesPerSec: 12000 nAvgBytesPerSec: 2500 nBlockAlign: 1 wBitsPerSample: 0 cbSize: 12
+
+WAVE_FORMAT_MPEGLAYER3:
+wFormatTag: 0x0055 nChannels: 2 nSamplesPerSec: 11025 nAvgBytesPerSec: 2500 nBlockAlign: 1 wBitsPerSample: 0 cbSize: 12
+
+WAVE_FORMAT_MPEGLAYER3:
+wFormatTag: 0x0055 nChannels: 2 nSamplesPerSec: 8000 nAvgBytesPerSec: 2500 nBlockAlign: 1 wBitsPerSample: 0 cbSize: 12
+
+WAVE_FORMAT_MPEGLAYER3:
+wFormatTag: 0x0055 nChannels: 1 nSamplesPerSec: 16000 nAvgBytesPerSec: 2500 nBlockAlign: 1 wBitsPerSample: 0 cbSize: 12
+
+WAVE_FORMAT_MPEGLAYER3:
+wFormatTag: 0x0055 nChannels: 1 nSamplesPerSec: 12000 nAvgBytesPerSec: 2500 nBlockAlign: 1 wBitsPerSample: 0 cbSize: 12
+
+WAVE_FORMAT_MPEGLAYER3:
+wFormatTag: 0x0055 nChannels: 1 nSamplesPerSec: 11025 nAvgBytesPerSec: 2500 nBlockAlign: 1 wBitsPerSample: 0 cbSize: 12
+
+WAVE_FORMAT_MPEGLAYER3:
+wFormatTag: 0x0055 nChannels: 2 nSamplesPerSec: 12000 nAvgBytesPerSec: 2250 nBlockAlign: 1 wBitsPerSample: 0 cbSize: 12
+
+WAVE_FORMAT_MPEGLAYER3:
+wFormatTag: 0x0055 nChannels: 2 nSamplesPerSec: 11025 nAvgBytesPerSec: 2250 nBlockAlign: 1 wBitsPerSample: 0 cbSize: 12
+
+WAVE_FORMAT_MPEGLAYER3:
+wFormatTag: 0x0055 nChannels: 2 nSamplesPerSec: 8000 nAvgBytesPerSec: 2250 nBlockAlign: 1 wBitsPerSample: 0 cbSize: 12
+
+WAVE_FORMAT_MPEGLAYER3:
+wFormatTag: 0x0055 nChannels: 1 nSamplesPerSec: 16000 nAvgBytesPerSec: 2250 nBlockAlign: 1 wBitsPerSample: 0 cbSize: 12
+
+WAVE_FORMAT_MPEGLAYER3:
+wFormatTag: 0x0055 nChannels: 1 nSamplesPerSec: 12000 nAvgBytesPerSec: 2250 nBlockAlign: 1 wBitsPerSample: 0 cbSize: 12
+
+WAVE_FORMAT_MPEGLAYER3:
+wFormatTag: 0x0055 nChannels: 1 nSamplesPerSec: 11025 nAvgBytesPerSec: 2250 nBlockAlign: 1 wBitsPerSample: 0 cbSize: 12
+
+WAVE_FORMAT_GSM610:
+wFormatTag: 0x0031 nChannels: 1 nSamplesPerSec: 11025 nAvgBytesPerSec: 2239 nBlockAlign: 65 wBitsPerSample: 0 cbSize: 2
+
+WAVE_FORMAT_WMAUDIO2:
+wFormatTag: 0x0161 nChannels: 1 nSamplesPerSec: 16000 nAvgBytesPerSec: 2000 nBlockAlign: 64 wBitsPerSample: 16 cbSize: 47
+
+WAVE_FORMAT_MPEGLAYER3:
+wFormatTag: 0x0055 nChannels: 1 nSamplesPerSec: 16000 nAvgBytesPerSec: 2000 nBlockAlign: 1 wBitsPerSample: 0 cbSize: 12
+
+WAVE_FORMAT_MPEGLAYER3:
+wFormatTag: 0x0055 nChannels: 1 nSamplesPerSec: 12000 nAvgBytesPerSec: 2000 nBlockAlign: 1 wBitsPerSample: 0 cbSize: 12
+
+WAVE_FORMAT_MPEGLAYER3:
+wFormatTag: 0x0055 nChannels: 1 nSamplesPerSec: 11025 nAvgBytesPerSec: 2000 nBlockAlign: 1 wBitsPerSample: 0 cbSize: 12
+
+WAVE_FORMAT_MPEGLAYER3:
+wFormatTag: 0x0055 nChannels: 1 nSamplesPerSec: 8000 nAvgBytesPerSec: 2000 nBlockAlign: 1 wBitsPerSample: 0 cbSize: 12
+
+WAVE_FORMAT_GSM610:
+wFormatTag: 0x0031 nChannels: 1 nSamplesPerSec: 8000 nAvgBytesPerSec: 1625 nBlockAlign: 65 wBitsPerSample: 0 cbSize: 2
+
+WAVE_FORMAT_WMAUDIO2:
+wFormatTag: 0x0161 nChannels: 2 nSamplesPerSec: 8000 nAvgBytesPerSec: 1500 nBlockAlign: 96 wBitsPerSample: 16 cbSize: 47
+
+WAVE_FORMAT_WMAUDIO2:
+wFormatTag: 0x0161 nChannels: 1 nSamplesPerSec: 11025 nAvgBytesPerSec: 1249 nBlockAlign: 58 wBitsPerSample: 16 cbSize: 47
+
+WAVE_FORMAT_DSPGROUP_TRUESPEECH :
+wFormatTag: 0x0022 nChannels: 1 nSamplesPerSec: 8000 nAvgBytesPerSec: 1067 nBlockAlign: 32 wBitsPerSample: 1 cbSize: 32
+
+WAVE_FORMAT_WMAUDIO2:
+wFormatTag: 0x0161 nChannels: 1 nSamplesPerSec: 11025 nAvgBytesPerSec: 1012 nBlockAlign: 47 wBitsPerSample: 16 cbSize: 47
+
+WAVE_FORMAT_WMAUDIO2:
+wFormatTag: 0x0161 nChannels: 1 nSamplesPerSec: 8000 nAvgBytesPerSec: 1000 nBlockAlign: 64 wBitsPerSample: 16 cbSize: 47
+
+WAVE_FORMAT_MPEGLAYER3:
+wFormatTag: 0x0055 nChannels: 1 nSamplesPerSec: 12000 nAvgBytesPerSec: 1000 nBlockAlign: 1 wBitsPerSample: 0 cbSize: 12
+
+WAVE_FORMAT_MPEGLAYER3:
+wFormatTag: 0x0055 nChannels: 1 nSamplesPerSec: 11025 nAvgBytesPerSec: 1000 nBlockAlign: 1 wBitsPerSample: 0 cbSize: 12
+
+WAVE_FORMAT_MPEGLAYER3:
+wFormatTag: 0x0055 nChannels: 1 nSamplesPerSec: 8000 nAvgBytesPerSec: 1000 nBlockAlign: 1 wBitsPerSample: 0 cbSize: 12
+
+WAVE_FORMAT_MSG723:
+wFormatTag: 0x0042 nChannels: 1 nSamplesPerSec: 8000 nAvgBytesPerSec: 800 nBlockAlign: 24 wBitsPerSample: 0 cbSize: 10
+
+WAVE_FORMAT_WMAUDIO2:
+wFormatTag: 0x0161 nChannels: 1 nSamplesPerSec: 8000 nAvgBytesPerSec: 750 nBlockAlign: 48 wBitsPerSample: 16 cbSize: 47
+
+WAVE_FORMAT_MSG723:
+wFormatTag: 0x0042 nChannels: 1 nSamplesPerSec: 8000 nAvgBytesPerSec: 666 nBlockAlign: 20 wBitsPerSample: 0 cbSize: 10
+
diff --git a/sesman/env.c b/sesman/env.c
index 6bad2c4f..d8bb1e98 100644
--- a/sesman/env.c
+++ b/sesman/env.c
@@ -81,8 +81,9 @@ env_check_password_file(char *filename, char *passwd)
}
/******************************************************************************/
+/* its the responsibility of the caller to free passwd_file */
int DEFAULT_CC
-env_set_user(char *username, char *passwd_file, int display,
+env_set_user(char *username, char **passwd_file, int display,
struct list *env_names, struct list* env_values)
{
int error;
@@ -90,15 +91,17 @@ env_set_user(char *username, char *passwd_file, int display,
int pw_gid;
int uid;
int index;
+ int len;
char *name;
char *value;
- char pw_shell[256];
- char pw_dir[256];
- char pw_gecos[256];
+ char *pw_shell;
+ char *pw_dir;
char text[256];
- error = g_getuser_info(username, &pw_gid, &pw_uid, pw_shell, pw_dir,
- pw_gecos);
+ pw_shell = 0;
+ pw_dir = 0;
+
+ error = g_getuser_info(username, &pw_gid, &pw_uid, &pw_shell, &pw_dir, 0);
if (error == 0)
{
@@ -147,28 +150,48 @@ env_set_user(char *username, char *passwd_file, int display,
if (0 == g_cfg->auth_file_path)
{
/* if no auth_file_path is set, then we go for
- $HOME/.vnc/sesman_username_passwd */
+ $HOME/.vnc/sesman_username_passwd */
if (g_mkdir(".vnc") < 0)
{
log_message(LOG_LEVEL_ERROR,
- "env_set_user: error creating .vnc dir");
+ "env_set_user: error creating .vnc dir");
+ }
+
+ len = g_snprintf(NULL, 0, "%s/.vnc/sesman_%s_passwd", pw_dir, username);
+
+ *passwd_file = (char *) g_malloc(len + 1, 1);
+ if (*passwd_file != NULL)
+ {
+ g_sprintf(*passwd_file, "%s/.vnc/sesman_%s_passwd", pw_dir, username);
}
- g_sprintf(passwd_file, "%s/.vnc/sesman_%s_passwd", pw_dir, username);
}
else
{
/* we use auth_file_path as requested */
- g_sprintf(passwd_file, g_cfg->auth_file_path, username);
+ len = g_snprintf(NULL, 0, g_cfg->auth_file_path, username);
+
+ *passwd_file = (char *) g_malloc(len + 1, 1);
+ if (*passwd_file != NULL)
+ {
+ g_sprintf(*passwd_file, g_cfg->auth_file_path, username);
+ }
}
- LOG_DBG("pass file: %s", passwd_file);
+ if (*passwd_file != NULL)
+ {
+ LOG_DBG("pass file: %s", *passwd_file);
+ }
}
+
+ g_free(pw_dir);
+ g_free(pw_shell);
}
}
else
{
log_message(LOG_LEVEL_ERROR,
- "error getting user info for user %s", username);
+ "error getting user info for user %s",
+ username);
}
return error;
diff --git a/sesman/env.h b/sesman/env.h
index 378e7fd1..23828080 100644
--- a/sesman/env.h
+++ b/sesman/env.h
@@ -50,7 +50,7 @@ env_check_password_file(char* filename, char* password);
*
*/
int DEFAULT_CC
-env_set_user(char* username, char* passwd_file, int display,
+env_set_user(char* username, char** passwd_file, int display,
struct list *env_names, struct list* env_values);
#endif
diff --git a/sesman/session.c b/sesman/session.c
index 02bb6fa7..ebd7e382 100644
--- a/sesman/session.c
+++ b/sesman/session.c
@@ -284,8 +284,11 @@ session_start_sessvc(int xpid, int wmpid, long data, char *username, int display
list_add_item(sessvc_params, (tintptr)g_strdup(wmpid_str));
list_add_item(sessvc_params, 0); /* mandatory */
- env_set_user(username, 0, display,
- g_cfg->session_variables1, g_cfg->session_variables2);
+ env_set_user(username,
+ 0,
+ display,
+ g_cfg->session_variables1,
+ g_cfg->session_variables2);
/* executing sessvc */
g_execvp(exe_path, ((char **)sessvc_params->items));
@@ -412,19 +415,18 @@ session_start_fork(int width, int height, int bpp, char *username,
int pampid = 0;
int xpid = 0;
int i = 0;
- char *xserver; /* absolute/relative path to Xorg/X11rdp/Xvnc */
char geometry[32];
char depth[32];
char screen[32]; /* display number */
char text[256];
- char passwd_file[256];
- char *pfile;
+ char execvpparams[2048];
+ char *xserver; /* absolute/relative path to Xorg/X11rdp/Xvnc */
+ char *passwd_file;
char **pp1 = (char **)NULL;
struct session_chain *temp = (struct session_chain *)NULL;
struct list *xserver_params = (struct list *)NULL;
- time_t ltime;
struct tm stime;
- char execvpparams[2048];
+ time_t ltime;
/* initialize (zero out) local variables: */
g_memset(&ltime, 0, sizeof(time_t));
@@ -433,7 +435,8 @@ session_start_fork(int width, int height, int bpp, char *username,
g_memset(depth, 0, sizeof(char) * 32);
g_memset(screen, 0, sizeof(char) * 32);
g_memset(text, 0, sizeof(char) * 256);
- g_memset(passwd_file, 0, sizeof(char) * 256);
+
+ passwd_file = 0;
/* check to limit concurrent sessions */
if (g_session_count >= g_cfg->sess.max_sessions)
@@ -537,7 +540,9 @@ session_start_fork(int width, int height, int bpp, char *username,
}
else if (pampid == 0)
{
- env_set_user(username, 0, display,
+ env_set_user(username,
+ 0,
+ display,
g_cfg->session_variables1,
g_cfg->session_variables2);
if (x_server_running(display))
@@ -632,14 +637,23 @@ session_start_fork(int width, int height, int bpp, char *username,
}
else if (xpid == 0) /* child */
{
- pfile = 0;
if (type == SESMAN_SESSION_TYPE_XVNC)
{
- pfile = passwd_file;
+ env_set_user(username,
+ &passwd_file,
+ display,
+ g_cfg->session_variables1,
+ g_cfg->session_variables2);
}
- env_set_user(username, pfile, display,
- g_cfg->session_variables1,
- g_cfg->session_variables2);
+ else
+ {
+ env_set_user(username,
+ 0,
+ display,
+ g_cfg->session_variables1,
+ g_cfg->session_variables2);
+ }
+
g_snprintf(text, 255, "%d", g_cfg->sess.max_idle_time);
g_setenv("XRDP_SESMAN_MAX_IDLE_TIME", text, 1);
@@ -701,6 +715,8 @@ session_start_fork(int width, int height, int bpp, char *username,
list_add_item(xserver_params, (tintptr)g_strdup("-rfbauth"));
list_add_item(xserver_params, (tintptr)g_strdup(passwd_file));
+ g_free(passwd_file);
+
/* additional parameters from sesman.ini file */
//config_read_xserver_params(SESMAN_SESSION_TYPE_XVNC,
// xserver_params);
@@ -829,8 +845,11 @@ session_reconnect_fork(int display, char *username)
}
else if (pid == 0)
{
- env_set_user(username, 0, display,
- g_cfg->session_variables1, g_cfg->session_variables2);
+ env_set_user(username,
+ 0,
+ display,
+ g_cfg->session_variables1,
+ g_cfg->session_variables2);
g_snprintf(text, 255, "%s/%s", XRDP_CFG_PATH, "reconnectwm.sh");
if (g_file_exist(text))