file system redirection: resolved merge conflicts
This commit is contained in:
commit
ca61050b74
@ -6,6 +6,12 @@ else
|
|||||||
FREERDPDIR =
|
FREERDPDIR =
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
if XRDP_NEUTRINORDP
|
||||||
|
NEUTRINORDPDIR = neutrinordp
|
||||||
|
else
|
||||||
|
NEUTRINORDPDIR =
|
||||||
|
endif
|
||||||
|
|
||||||
if XRDP_XRDPVR
|
if XRDP_XRDPVR
|
||||||
XRDPVRDIR = xrdpvr
|
XRDPVRDIR = xrdpvr
|
||||||
else
|
else
|
||||||
@ -19,6 +25,7 @@ SUBDIRS = \
|
|||||||
xup \
|
xup \
|
||||||
mc \
|
mc \
|
||||||
$(FREERDPDIR) \
|
$(FREERDPDIR) \
|
||||||
|
$(NEUTRINORDPDIR) \
|
||||||
libxrdp \
|
libxrdp \
|
||||||
xrdp \
|
xrdp \
|
||||||
sesman \
|
sesman \
|
||||||
|
@ -37,4 +37,8 @@
|
|||||||
#define XRDP_SHARE_PATH "/usr/local/share/xrdp"
|
#define XRDP_SHARE_PATH "/usr/local/share/xrdp"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if !defined(XRDP_LIB_PATH)
|
||||||
|
#define XRDP_LIB_PATH "/usr/local/lib/xrdp"
|
||||||
|
#endif
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -308,7 +308,7 @@ struct stream
|
|||||||
* @param _s opaque handle to the new stream
|
* @param _s opaque handle to the new stream
|
||||||
* @param _l length of new stream
|
* @param _l length of new stream
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
#define stream_new(_s, _l) \
|
#define xstream_new(_s, _l) \
|
||||||
do \
|
do \
|
||||||
{ \
|
{ \
|
||||||
make_stream((_s)); \
|
make_stream((_s)); \
|
||||||
@ -320,25 +320,25 @@ do \
|
|||||||
*
|
*
|
||||||
* @param _s opaque handle returned by stream_new()
|
* @param _s opaque handle returned by stream_new()
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
#define stream_free(_s) free_stream(_s)
|
#define xstream_free(_s) free_stream(_s)
|
||||||
|
|
||||||
#define stream_rd_u8(_s, _var) in_uint8(_s, _var)
|
#define xstream_rd_u8(_s, _var) in_uint8(_s, _var)
|
||||||
#define stream_rd_u16_le(_s, _var) in_uint16_le(_s, _var)
|
#define xstream_rd_u16_le(_s, _var) in_uint16_le(_s, _var)
|
||||||
#define stream_rd_u32_le(_s, _var) in_uint32_le(_s, _var)
|
#define xstream_rd_u32_le(_s, _var) in_uint32_le(_s, _var)
|
||||||
|
|
||||||
#define stream_rd_s8_le(_s, _var) in_sint8(_s, _var)
|
#define xstream_rd_s8_le(_s, _var) in_sint8(_s, _var)
|
||||||
#define stream_rd_s16_le(_s, _var) in_sint16_le(_s, _var)
|
#define xstream_rd_s16_le(_s, _var) in_sint16_le(_s, _var)
|
||||||
#define stream_rd_s32_le(_s, _var) TODO
|
#define xstream_rd_s32_le(_s, _var) TODO
|
||||||
|
|
||||||
#define stream_wr_u8(_s, _var) out_uint8(_s, _var)
|
#define xstream_wr_u8(_s, _var) out_uint8(_s, _var)
|
||||||
#define stream_wr_u16_le(_s, _var) out_uint16_le(_s, _var)
|
#define xstream_wr_u16_le(_s, _var) out_uint16_le(_s, _var)
|
||||||
#define stream_wr_u32_le(_s, _var) out_uint32_le(_s, _var)
|
#define xstream_wr_u32_le(_s, _var) out_uint32_le(_s, _var)
|
||||||
|
|
||||||
#define stream_wr_s8(_s, _var) TODO
|
#define xstream_wr_s8(_s, _var) TODO
|
||||||
#define stream_wr_s16_le(_s, _var) TODO
|
#define xstream_wr_s16_le(_s, _var) TODO
|
||||||
#define stream_wr_s32_le(_s, _var) TODO
|
#define xstream_wr_s32_le(_s, _var) TODO
|
||||||
|
|
||||||
#define stream_rd_u64_le(_s, _v) \
|
#define xstream_rd_u64_le(_s, _v) \
|
||||||
do \
|
do \
|
||||||
{ \
|
{ \
|
||||||
_v = \
|
_v = \
|
||||||
@ -353,7 +353,7 @@ do \
|
|||||||
_s->p += 8; \
|
_s->p += 8; \
|
||||||
} while (0)
|
} while (0)
|
||||||
|
|
||||||
#define stream_wr_u64_le(_s, _v) \
|
#define xstream_wr_u64_le(_s, _v) \
|
||||||
do \
|
do \
|
||||||
{ \
|
{ \
|
||||||
*(((unsigned char *) _s->p) + 0) = (unsigned char) ((_v >> 0) & 0xff); \
|
*(((unsigned char *) _s->p) + 0) = (unsigned char) ((_v >> 0) & 0xff); \
|
||||||
@ -368,36 +368,36 @@ do \
|
|||||||
} while (0)
|
} while (0)
|
||||||
|
|
||||||
/* copy data into stream */
|
/* copy data into stream */
|
||||||
#define stream_copyin(_s, _dest, _len) \
|
#define xstream_copyin(_s, _dest, _len) \
|
||||||
do \
|
do \
|
||||||
{ \
|
{ \
|
||||||
memcpy((_s)->p, (_dest), (_len)); \
|
g_memcpy((_s)->p, (_dest), (_len)); \
|
||||||
(_s)->p += (_len); \
|
(_s)->p += (_len); \
|
||||||
} while (0)
|
} while (0)
|
||||||
|
|
||||||
/* copy data out of stream */
|
/* copy data out of stream */
|
||||||
#define stream_copyout(_dest, _s, _len) \
|
#define xstream_copyout(_dest, _s, _len) \
|
||||||
{ \
|
{ \
|
||||||
do \
|
do \
|
||||||
memcpy((_dest), (_s)->p, (_len)); \
|
g_memcpy((_dest), (_s)->p, (_len)); \
|
||||||
(_s)->p += (_len); \
|
(_s)->p += (_len); \
|
||||||
} while (0)
|
} while (0)
|
||||||
|
|
||||||
#define stream_rd_string(_dest, _s, _len) \
|
#define xstream_rd_string(_dest, _s, _len) \
|
||||||
do \
|
do \
|
||||||
{ \
|
{ \
|
||||||
memcpy((_dest), (_s)->p, (_len)); \
|
g_memcpy((_dest), (_s)->p, (_len)); \
|
||||||
(_s)->p += (_len); \
|
(_s)->p += (_len); \
|
||||||
} while (0)
|
} while (0)
|
||||||
|
|
||||||
#define stream_wr_string(_s, _src, _len) \
|
#define xstream_wr_string(_s, _src, _len) \
|
||||||
do \
|
do \
|
||||||
{ \
|
{ \
|
||||||
memcpy((_s)->p, (_src), (_len)); \
|
g_memcpy((_s)->p, (_src), (_len)); \
|
||||||
(_s)->p += (_len); \
|
(_s)->p += (_len); \
|
||||||
} while (0)
|
} while (0)
|
||||||
|
|
||||||
#define stream_len(_s) (int) ((_s)->p - (_s)->data)
|
#define xstream_len(_s) (int) ((_s)->p - (_s)->data)
|
||||||
#define stream_seek(_s, _len) (_s)->p += (_len)
|
#define xstream_seek(_s, _len) (_s)->p += (_len)
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -35,6 +35,10 @@ AC_ARG_ENABLE(freerdp1, AS_HELP_STRING([--enable-freerdp1],
|
|||||||
[Build freerdp1 module (default: no)]),
|
[Build freerdp1 module (default: no)]),
|
||||||
[freerdp1=true], [freerdp1=false])
|
[freerdp1=true], [freerdp1=false])
|
||||||
AM_CONDITIONAL(XRDP_FREERDP1, [test x$freerdp1 = xtrue])
|
AM_CONDITIONAL(XRDP_FREERDP1, [test x$freerdp1 = xtrue])
|
||||||
|
AC_ARG_ENABLE(neutrinordp, AS_HELP_STRING([--enable-neutrinordp],
|
||||||
|
[Build neutrinordp module (default: no)]),
|
||||||
|
[neutrinordp=true], [neutrinordp=false])
|
||||||
|
AM_CONDITIONAL(XRDP_NEUTRINORDP, [test x$neutrinordp = xtrue])
|
||||||
AC_ARG_ENABLE(jpeg, AS_HELP_STRING([--enable-jpeg],
|
AC_ARG_ENABLE(jpeg, AS_HELP_STRING([--enable-jpeg],
|
||||||
[Build jpeg module (default: no)]),
|
[Build jpeg module (default: no)]),
|
||||||
[jpeg=true], [jpeg=false])
|
[jpeg=true], [jpeg=false])
|
||||||
@ -81,6 +85,8 @@ fi
|
|||||||
|
|
||||||
AS_IF( [test "x$enable_freerdp1" = "xyes"] , [PKG_CHECK_MODULES(FREERDP, freerdp >= 1.0.0)] )
|
AS_IF( [test "x$enable_freerdp1" = "xyes"] , [PKG_CHECK_MODULES(FREERDP, freerdp >= 1.0.0)] )
|
||||||
|
|
||||||
|
AS_IF( [test "x$enable_neutrinordp" = "xyes"] , [PKG_CHECK_MODULES(FREERDP, freerdp >= 1.0.0)] )
|
||||||
|
|
||||||
# checking for libjpeg
|
# checking for libjpeg
|
||||||
if ! test -z "$enable_jpeg"
|
if ! test -z "$enable_jpeg"
|
||||||
then
|
then
|
||||||
@ -123,6 +129,7 @@ AC_CONFIG_FILES([Makefile
|
|||||||
xup/Makefile
|
xup/Makefile
|
||||||
mc/Makefile
|
mc/Makefile
|
||||||
freerdp1/Makefile
|
freerdp1/Makefile
|
||||||
|
neutrinordp/Makefile
|
||||||
xrdp/Makefile
|
xrdp/Makefile
|
||||||
sesman/Makefile
|
sesman/Makefile
|
||||||
sesman/libscp/Makefile
|
sesman/libscp/Makefile
|
||||||
|
28
neutrinordp/Makefile.am
Normal file
28
neutrinordp/Makefile.am
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
EXTRA_DIST = xrdp-neutrinordp.h
|
||||||
|
EXTRA_DEFINES =
|
||||||
|
|
||||||
|
if XRDP_DEBUG
|
||||||
|
EXTRA_DEFINES += -DXRDP_DEBUG
|
||||||
|
else
|
||||||
|
EXTRA_DEFINES += -DXRDP_NODEBUG
|
||||||
|
endif
|
||||||
|
|
||||||
|
AM_CFLAGS = \
|
||||||
|
-DXRDP_CFG_PATH=\"${sysconfdir}/xrdp\" \
|
||||||
|
-DXRDP_SBIN_PATH=\"${sbindir}\" \
|
||||||
|
-DXRDP_SHARE_PATH=\"${datadir}/xrdp\" \
|
||||||
|
-DXRDP_PID_PATH=\"${localstatedir}/run\" \
|
||||||
|
$(EXTRA_DEFINES)
|
||||||
|
|
||||||
|
INCLUDES = \
|
||||||
|
-I$(top_srcdir)/common \
|
||||||
|
$(FREERDP_CFLAGS)
|
||||||
|
|
||||||
|
lib_LTLIBRARIES = \
|
||||||
|
libxrdpneutrinordp.la
|
||||||
|
|
||||||
|
libxrdpneutrinordp_la_SOURCES = xrdp-neutrinordp.c xrdp-color.c
|
||||||
|
|
||||||
|
libxrdpneutrinordp_la_LIBADD = \
|
||||||
|
$(top_builddir)/common/libcommon.la \
|
||||||
|
$(FREERDP_LIBS)
|
313
neutrinordp/xrdp-color.c
Normal file
313
neutrinordp/xrdp-color.c
Normal file
@ -0,0 +1,313 @@
|
|||||||
|
/**
|
||||||
|
* FreeRDP: A Remote Desktop Protocol Server
|
||||||
|
* freerdp wrapper
|
||||||
|
*
|
||||||
|
* Copyright 2011-2012 Jay Sorg
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "xrdp-neutrinordp.h"
|
||||||
|
|
||||||
|
char *APP_CC
|
||||||
|
convert_bitmap(int in_bpp, int out_bpp, char *bmpdata,
|
||||||
|
int width, int height, int *palette)
|
||||||
|
{
|
||||||
|
char *out;
|
||||||
|
char *src;
|
||||||
|
char *dst;
|
||||||
|
int i;
|
||||||
|
int j;
|
||||||
|
int red;
|
||||||
|
int green;
|
||||||
|
int blue;
|
||||||
|
int pixel;
|
||||||
|
|
||||||
|
if ((in_bpp == 8) && (out_bpp == 8))
|
||||||
|
{
|
||||||
|
out = (char *)g_malloc(width * height, 0);
|
||||||
|
src = bmpdata;
|
||||||
|
dst = out;
|
||||||
|
|
||||||
|
for (i = 0; i < height; i++)
|
||||||
|
{
|
||||||
|
for (j = 0; j < width; j++)
|
||||||
|
{
|
||||||
|
pixel = *((tui8 *)src);
|
||||||
|
pixel = palette[pixel];
|
||||||
|
SPLITCOLOR32(red, green, blue, pixel);
|
||||||
|
pixel = COLOR8(red, green, blue);
|
||||||
|
*dst = pixel;
|
||||||
|
src++;
|
||||||
|
dst++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return out;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ((in_bpp == 8) && (out_bpp == 16))
|
||||||
|
{
|
||||||
|
out = (char *)g_malloc(width * height * 2, 0);
|
||||||
|
src = bmpdata;
|
||||||
|
dst = out;
|
||||||
|
|
||||||
|
for (i = 0; i < height; i++)
|
||||||
|
{
|
||||||
|
for (j = 0; j < width; j++)
|
||||||
|
{
|
||||||
|
pixel = *((tui8 *)src);
|
||||||
|
pixel = palette[pixel];
|
||||||
|
SPLITCOLOR32(red, green, blue, pixel);
|
||||||
|
pixel = COLOR16(red, green, blue);
|
||||||
|
*((tui16 *)dst) = pixel;
|
||||||
|
src++;
|
||||||
|
dst += 2;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return out;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ((in_bpp == 8) && (out_bpp == 24))
|
||||||
|
{
|
||||||
|
out = (char *)g_malloc(width * height * 4, 0);
|
||||||
|
src = bmpdata;
|
||||||
|
dst = out;
|
||||||
|
|
||||||
|
for (i = 0; i < height; i++)
|
||||||
|
{
|
||||||
|
for (j = 0; j < width; j++)
|
||||||
|
{
|
||||||
|
pixel = *((tui8 *)src);
|
||||||
|
pixel = palette[pixel];
|
||||||
|
SPLITCOLOR32(red, green, blue, pixel);
|
||||||
|
pixel = COLOR24RGB(red, green, blue);
|
||||||
|
*((tui32 *)dst) = pixel;
|
||||||
|
src++;
|
||||||
|
dst += 4;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return out;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ((in_bpp == 15) && (out_bpp == 16))
|
||||||
|
{
|
||||||
|
out = (char *)g_malloc(width * height * 2, 0);
|
||||||
|
src = bmpdata;
|
||||||
|
dst = out;
|
||||||
|
|
||||||
|
for (i = 0; i < height; i++)
|
||||||
|
{
|
||||||
|
for (j = 0; j < width; j++)
|
||||||
|
{
|
||||||
|
pixel = *((tui16 *)src);
|
||||||
|
SPLITCOLOR15(red, green, blue, pixel);
|
||||||
|
pixel = COLOR16(red, green, blue);
|
||||||
|
*((tui16 *)dst) = pixel;
|
||||||
|
src += 2;
|
||||||
|
dst += 2;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return out;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ((in_bpp == 15) && (out_bpp == 24))
|
||||||
|
{
|
||||||
|
out = (char *)g_malloc(width * height * 4, 0);
|
||||||
|
src = bmpdata;
|
||||||
|
dst = out;
|
||||||
|
|
||||||
|
for (i = 0; i < height; i++)
|
||||||
|
{
|
||||||
|
for (j = 0; j < width; j++)
|
||||||
|
{
|
||||||
|
pixel = *((tui16 *)src);
|
||||||
|
SPLITCOLOR15(red, green, blue, pixel);
|
||||||
|
pixel = COLOR24RGB(red, green, blue);
|
||||||
|
*((tui32 *)dst) = pixel;
|
||||||
|
src += 2;
|
||||||
|
dst += 4;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return out;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ((in_bpp == 15) && (out_bpp == 15))
|
||||||
|
{
|
||||||
|
return bmpdata;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ((in_bpp == 16) && (out_bpp == 16))
|
||||||
|
{
|
||||||
|
return bmpdata;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ((in_bpp == 16) && (out_bpp == 24))
|
||||||
|
{
|
||||||
|
out = (char *)g_malloc(width * height * 4, 0);
|
||||||
|
src = bmpdata;
|
||||||
|
dst = out;
|
||||||
|
|
||||||
|
for (i = 0; i < height; i++)
|
||||||
|
{
|
||||||
|
for (j = 0; j < width; j++)
|
||||||
|
{
|
||||||
|
pixel = *((tui16 *)src);
|
||||||
|
SPLITCOLOR16(red, green, blue, pixel);
|
||||||
|
pixel = COLOR24RGB(red, green, blue);
|
||||||
|
*((tui32 *)dst) = pixel;
|
||||||
|
src += 2;
|
||||||
|
dst += 4;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return out;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ((in_bpp == 24) && (out_bpp == 24))
|
||||||
|
{
|
||||||
|
out = (char *)g_malloc(width * height * 4, 0);
|
||||||
|
src = bmpdata;
|
||||||
|
dst = out;
|
||||||
|
|
||||||
|
for (i = 0; i < height; i++)
|
||||||
|
{
|
||||||
|
for (j = 0; j < width; j++)
|
||||||
|
{
|
||||||
|
blue = *((tui8 *)src);
|
||||||
|
src++;
|
||||||
|
green = *((tui8 *)src);
|
||||||
|
src++;
|
||||||
|
red = *((tui8 *)src);
|
||||||
|
src++;
|
||||||
|
pixel = COLOR24RGB(red, green, blue);
|
||||||
|
*((tui32 *)dst) = pixel;
|
||||||
|
dst += 4;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return out;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ((in_bpp == 32) && (out_bpp == 24))
|
||||||
|
{
|
||||||
|
return bmpdata;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ((in_bpp == 32) && (out_bpp == 32))
|
||||||
|
{
|
||||||
|
return bmpdata;
|
||||||
|
}
|
||||||
|
|
||||||
|
g_writeln("convert_bitmap: error unknown conversion from %d to %d",
|
||||||
|
in_bpp, out_bpp);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*****************************************************************************/
|
||||||
|
/* returns color or 0 */
|
||||||
|
int APP_CC
|
||||||
|
convert_color(int in_bpp, int out_bpp, int in_color, int *palette)
|
||||||
|
{
|
||||||
|
int pixel;
|
||||||
|
int red;
|
||||||
|
int green;
|
||||||
|
int blue;
|
||||||
|
|
||||||
|
if ((in_bpp == 1) && (out_bpp == 24))
|
||||||
|
{
|
||||||
|
pixel = in_color == 0 ? 0 : 0xffffff;
|
||||||
|
return pixel;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ((in_bpp == 8) && (out_bpp == 8))
|
||||||
|
{
|
||||||
|
pixel = palette[in_color];
|
||||||
|
SPLITCOLOR32(red, green, blue, pixel);
|
||||||
|
pixel = COLOR8(red, green, blue);
|
||||||
|
return pixel;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ((in_bpp == 8) && (out_bpp == 16))
|
||||||
|
{
|
||||||
|
pixel = palette[in_color];
|
||||||
|
SPLITCOLOR32(red, green, blue, pixel);
|
||||||
|
pixel = COLOR16(red, green, blue);
|
||||||
|
return pixel;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ((in_bpp == 8) && (out_bpp == 24))
|
||||||
|
{
|
||||||
|
pixel = palette[in_color];
|
||||||
|
SPLITCOLOR32(red, green, blue, pixel);
|
||||||
|
pixel = COLOR24BGR(red, green, blue);
|
||||||
|
return pixel;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ((in_bpp == 15) && (out_bpp == 16))
|
||||||
|
{
|
||||||
|
pixel = in_color;
|
||||||
|
SPLITCOLOR15(red, green, blue, pixel);
|
||||||
|
pixel = COLOR16(red, green, blue);
|
||||||
|
return pixel;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ((in_bpp == 15) && (out_bpp == 24))
|
||||||
|
{
|
||||||
|
pixel = in_color;
|
||||||
|
SPLITCOLOR15(red, green, blue, pixel);
|
||||||
|
pixel = COLOR24BGR(red, green, blue);
|
||||||
|
return pixel;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ((in_bpp == 15) && (out_bpp == 15))
|
||||||
|
{
|
||||||
|
return in_color;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ((in_bpp == 16) && (out_bpp == 16))
|
||||||
|
{
|
||||||
|
return in_color;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ((in_bpp == 16) && (out_bpp == 24))
|
||||||
|
{
|
||||||
|
pixel = in_color;
|
||||||
|
SPLITCOLOR16(red, green, blue, pixel);
|
||||||
|
pixel = COLOR24BGR(red, green, blue);
|
||||||
|
return pixel;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ((in_bpp == 24) && (out_bpp == 24))
|
||||||
|
{
|
||||||
|
return in_color;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ((in_bpp == 32) && (out_bpp == 24))
|
||||||
|
{
|
||||||
|
return in_color;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ((in_bpp == 32) && (out_bpp == 32))
|
||||||
|
{
|
||||||
|
return in_color;
|
||||||
|
}
|
||||||
|
|
||||||
|
g_writeln("convert_color: error unknown conversion from %d to %d",
|
||||||
|
in_bpp, out_bpp);
|
||||||
|
return 0;
|
||||||
|
}
|
29
neutrinordp/xrdp-color.h
Normal file
29
neutrinordp/xrdp-color.h
Normal file
@ -0,0 +1,29 @@
|
|||||||
|
/**
|
||||||
|
* FreeRDP: A Remote Desktop Protocol Server
|
||||||
|
* freerdp wrapper
|
||||||
|
*
|
||||||
|
* Copyright 2011-2012 Jay Sorg
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef __XRDP_COLOR_H
|
||||||
|
#define __XRDP_COLOR_H
|
||||||
|
|
||||||
|
char* APP_CC
|
||||||
|
convert_bitmap(int in_bpp, int out_bpp, char* bmpdata,
|
||||||
|
int width, int height, int* palette);
|
||||||
|
int APP_CC
|
||||||
|
convert_color(int in_bpp, int out_bpp, int in_color, int* palette);
|
||||||
|
|
||||||
|
#endif
|
1872
neutrinordp/xrdp-neutrinordp.c
Normal file
1872
neutrinordp/xrdp-neutrinordp.c
Normal file
File diff suppressed because it is too large
Load Diff
180
neutrinordp/xrdp-neutrinordp.h
Normal file
180
neutrinordp/xrdp-neutrinordp.h
Normal file
@ -0,0 +1,180 @@
|
|||||||
|
/**
|
||||||
|
* FreeRDP: A Remote Desktop Protocol Server
|
||||||
|
* freerdp wrapper
|
||||||
|
*
|
||||||
|
* Copyright 2011-2013 Jay Sorg
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/* include other h files */
|
||||||
|
#include "arch.h"
|
||||||
|
#include "parse.h"
|
||||||
|
#include "os_calls.h"
|
||||||
|
#include "defines.h"
|
||||||
|
#include "xrdp_rail.h"
|
||||||
|
#include "xrdp_client_info.h"
|
||||||
|
|
||||||
|
/* this is the freerdp main header */
|
||||||
|
#include <freerdp/freerdp.h>
|
||||||
|
#include <freerdp/rail.h>
|
||||||
|
#include <freerdp/rail/rail.h>
|
||||||
|
#include <freerdp/codec/bitmap.h>
|
||||||
|
//#include <freerdp/utils/memory.h>
|
||||||
|
//#include "/home/jay/git/jsorg71/staging/include/freerdp/freerdp.h"
|
||||||
|
|
||||||
|
struct bitmap_item
|
||||||
|
{
|
||||||
|
int width;
|
||||||
|
int height;
|
||||||
|
char* data;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct brush_item
|
||||||
|
{
|
||||||
|
int bpp;
|
||||||
|
int width;
|
||||||
|
int height;
|
||||||
|
char* data;
|
||||||
|
char b8x8[8];
|
||||||
|
};
|
||||||
|
|
||||||
|
struct pointer_item
|
||||||
|
{
|
||||||
|
int hotx;
|
||||||
|
int hoty;
|
||||||
|
char data[32 * 32 * 3];
|
||||||
|
char mask[32 * 32 / 8];
|
||||||
|
};
|
||||||
|
|
||||||
|
#define CURRENT_MOD_VER 2
|
||||||
|
|
||||||
|
struct mod
|
||||||
|
{
|
||||||
|
int size; /* size of this struct */
|
||||||
|
int version; /* internal version */
|
||||||
|
/* client functions */
|
||||||
|
int (*mod_start)(struct mod* v, int w, int h, int bpp);
|
||||||
|
int (*mod_connect)(struct mod* v);
|
||||||
|
int (*mod_event)(struct mod* v, int msg, long param1, long param2,
|
||||||
|
long param3, long param4);
|
||||||
|
int (*mod_signal)(struct mod* v);
|
||||||
|
int (*mod_end)(struct mod* v);
|
||||||
|
int (*mod_set_param)(struct mod* v, char* name, char* value);
|
||||||
|
int (*mod_session_change)(struct mod* v, int, int);
|
||||||
|
int (*mod_get_wait_objs)(struct mod* v, tbus* read_objs, int* rcount,
|
||||||
|
tbus* write_objs, int* wcount, int* timeout);
|
||||||
|
int (*mod_check_wait_objs)(struct mod* v);
|
||||||
|
long mod_dumby[100 - 9]; /* align, 100 minus the number of mod
|
||||||
|
functions above */
|
||||||
|
/* server functions */
|
||||||
|
int (*server_begin_update)(struct mod* v);
|
||||||
|
int (*server_end_update)(struct mod* v);
|
||||||
|
int (*server_fill_rect)(struct mod* v, int x, int y, int cx, int cy);
|
||||||
|
int (*server_screen_blt)(struct mod* v, int x, int y, int cx, int cy,
|
||||||
|
int srcx, int srcy);
|
||||||
|
int (*server_paint_rect)(struct mod* v, int x, int y, int cx, int cy,
|
||||||
|
char* data, int width, int height, int srcx, int srcy);
|
||||||
|
int (*server_set_pointer)(struct mod* v, int x, int y, char* data, char* mask);
|
||||||
|
int (*server_palette)(struct mod* v, int* palette);
|
||||||
|
int (*server_msg)(struct mod* v, char* msg, int code);
|
||||||
|
int (*server_is_term)(struct mod* v);
|
||||||
|
int (*server_set_clip)(struct mod* v, int x, int y, int cx, int cy);
|
||||||
|
int (*server_reset_clip)(struct mod* v);
|
||||||
|
int (*server_set_fgcolor)(struct mod* v, int fgcolor);
|
||||||
|
int (*server_set_bgcolor)(struct mod* v, int bgcolor);
|
||||||
|
int (*server_set_opcode)(struct mod* v, int opcode);
|
||||||
|
int (*server_set_mixmode)(struct mod* v, int mixmode);
|
||||||
|
int (*server_set_brush)(struct mod* v, int x_orgin, int y_orgin,
|
||||||
|
int style, char* pattern);
|
||||||
|
int (*server_set_pen)(struct mod* v, int style,
|
||||||
|
int width);
|
||||||
|
int (*server_draw_line)(struct mod* v, int x1, int y1, int x2, int y2);
|
||||||
|
int (*server_add_char)(struct mod* v, int font, int charactor,
|
||||||
|
int offset, int baseline,
|
||||||
|
int width, int height, char* data);
|
||||||
|
int (*server_draw_text)(struct mod* v, int font,
|
||||||
|
int flags, int mixmode, int clip_left, int clip_top,
|
||||||
|
int clip_right, int clip_bottom,
|
||||||
|
int box_left, int box_top,
|
||||||
|
int box_right, int box_bottom,
|
||||||
|
int x, int y, char* data, int data_len);
|
||||||
|
int (*server_reset)(struct mod* v, int width, int height, int bpp);
|
||||||
|
int (*server_query_channel)(struct mod* v, int index,
|
||||||
|
char* channel_name,
|
||||||
|
int* channel_flags);
|
||||||
|
int (*server_get_channel_id)(struct mod* v, char* name);
|
||||||
|
int (*server_send_to_channel)(struct mod* v, int channel_id,
|
||||||
|
char* data, int data_len,
|
||||||
|
int total_data_len, int flags);
|
||||||
|
int (*server_bell_trigger)(struct mod* v);
|
||||||
|
/* off screen bitmaps */
|
||||||
|
int (*server_create_os_surface)(struct mod* v, int rdpindex,
|
||||||
|
int width, int height);
|
||||||
|
int (*server_switch_os_surface)(struct mod* v, int rdpindex);
|
||||||
|
int (*server_delete_os_surface)(struct mod* v, int rdpindex);
|
||||||
|
int (*server_paint_rect_os)(struct mod* mod, int x, int y,
|
||||||
|
int cx, int cy,
|
||||||
|
int rdpindex, int srcx, int srcy);
|
||||||
|
int (*server_set_hints)(struct mod* mod, int hints, int mask);
|
||||||
|
/* rail */
|
||||||
|
int (*server_window_new_update)(struct mod* mod, int window_id,
|
||||||
|
struct rail_window_state_order* window_state,
|
||||||
|
int flags);
|
||||||
|
int (*server_window_delete)(struct mod* mod, int window_id);
|
||||||
|
int (*server_window_icon)(struct mod* mod,
|
||||||
|
int window_id, int cache_entry, int cache_id,
|
||||||
|
struct rail_icon_info* icon_info,
|
||||||
|
int flags);
|
||||||
|
int (*server_window_cached_icon)(struct mod* mod,
|
||||||
|
int window_id, int cache_entry,
|
||||||
|
int cache_id, int flags);
|
||||||
|
int (*server_notify_new_update)(struct mod* mod,
|
||||||
|
int window_id, int notify_id,
|
||||||
|
struct rail_notify_state_order* notify_state,
|
||||||
|
int flags);
|
||||||
|
int (*server_notify_delete)(struct mod* mod, int window_id,
|
||||||
|
int notify_id);
|
||||||
|
int (*server_monitored_desktop)(struct mod* mod,
|
||||||
|
struct rail_monitored_desktop_order* mdo,
|
||||||
|
int flags);
|
||||||
|
|
||||||
|
long server_dumby[100 - 37]; /* align, 100 minus the number of server
|
||||||
|
functions above */
|
||||||
|
/* common */
|
||||||
|
tbus handle; /* pointer to self as long */
|
||||||
|
tbus wm;
|
||||||
|
tbus painter;
|
||||||
|
int sck;
|
||||||
|
/* mod data */
|
||||||
|
int width;
|
||||||
|
int height;
|
||||||
|
int bpp;
|
||||||
|
int colormap[256];
|
||||||
|
char* chan_buf;
|
||||||
|
int chan_buf_valid;
|
||||||
|
int chan_buf_bytes;
|
||||||
|
int vmaj;
|
||||||
|
int vmin;
|
||||||
|
int vrev;
|
||||||
|
char username[256];
|
||||||
|
char password[256];
|
||||||
|
|
||||||
|
struct xrdp_client_info client_info;
|
||||||
|
|
||||||
|
struct rdp_freerdp* inst;
|
||||||
|
struct bitmap_item bitmap_cache[4][4096];
|
||||||
|
struct brush_item brush_cache[64];
|
||||||
|
struct pointer_item pointer_cache[32];
|
||||||
|
|
||||||
|
};
|
@ -1619,7 +1619,7 @@ done:
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (!fip)
|
if (!fip)
|
||||||
log_error("fip is NULL");
|
printf("###### %s : %s : %d: fip is NULL\n", __FILE__, __func__, __LINE__);
|
||||||
|
|
||||||
if (fip)
|
if (fip)
|
||||||
free(fip);
|
free(fip);
|
||||||
@ -1826,14 +1826,10 @@ void xfuse_devredir_cb_write_file(void *vp, char *buf, size_t length)
|
|||||||
XRDP_INODE *xinode;
|
XRDP_INODE *xinode;
|
||||||
XFUSE_INFO *fip;
|
XFUSE_INFO *fip;
|
||||||
|
|
||||||
log_debug("entered: length=%lld", (long long) length);
|
|
||||||
|
|
||||||
fip = (XFUSE_INFO *) vp;
|
fip = (XFUSE_INFO *) vp;
|
||||||
if (fip == NULL)
|
if (fip == NULL)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
log_debug("letting FUSE know that we wrote %lld bytes", (long long) length);
|
|
||||||
|
|
||||||
fuse_reply_write(fip->req, length);
|
fuse_reply_write(fip->req, length);
|
||||||
|
|
||||||
/* update file size */
|
/* update file size */
|
||||||
@ -1893,7 +1889,6 @@ void xfuse_devredir_cb_rename_file(void *vp, tui32 IoStatus)
|
|||||||
|
|
||||||
if (IoStatus != 0)
|
if (IoStatus != 0)
|
||||||
{
|
{
|
||||||
log_debug("rename failed with IoStatus=0x%x", IoStatus);
|
|
||||||
fuse_reply_err(fip->req, EEXIST);
|
fuse_reply_err(fip->req, EEXIST);
|
||||||
free(fip);
|
free(fip);
|
||||||
return;
|
return;
|
||||||
@ -1920,7 +1915,6 @@ void xfuse_devredir_cb_rename_file(void *vp, tui32 IoStatus)
|
|||||||
old_xinode = xfuse_get_inode_from_pinode_name(fip->inode, fip->name);
|
old_xinode = xfuse_get_inode_from_pinode_name(fip->inode, fip->name);
|
||||||
if (old_xinode == NULL)
|
if (old_xinode == NULL)
|
||||||
{
|
{
|
||||||
log_debug("rename failed");
|
|
||||||
fuse_reply_err(fip->req, EBADF);
|
fuse_reply_err(fip->req, EBADF);
|
||||||
free(fip);
|
free(fip);
|
||||||
return;
|
return;
|
||||||
@ -1960,7 +1954,7 @@ void xfuse_devredir_cb_file_close(void *vp)
|
|||||||
|
|
||||||
if ((xinode->nopen == 0) && fip->fi && fip->fi->fh)
|
if ((xinode->nopen == 0) && fip->fi && fip->fi->fh)
|
||||||
{
|
{
|
||||||
free((char *) fip->fi->fh);
|
free((char *) (tintptr) (fip->fi->fh));
|
||||||
fip->fi->fh = NULL;
|
fip->fi->fh = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2680,7 +2674,7 @@ static void xfuse_cb_flush(fuse_req_t req, fuse_ino_t ino, struct
|
|||||||
fuse_file_info *fi)
|
fuse_file_info *fi)
|
||||||
{
|
{
|
||||||
XFUSE_INFO *fip = NULL;
|
XFUSE_INFO *fip = NULL;
|
||||||
XFUSE_HANDLE *handle = (XFUSE_HANDLE *) fi->fh;
|
XFUSE_HANDLE *handle = (XFUSE_HANDLE *) (tintptr) (fi->fh);
|
||||||
|
|
||||||
log_debug("ino=%d", (int) ino);
|
log_debug("ino=%d", (int) ino);
|
||||||
|
|
||||||
|
@ -83,20 +83,20 @@ dev_redir_init(void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* setup stream */
|
/* setup stream */
|
||||||
stream_new(s, 1024);
|
xstream_new(s, 1024);
|
||||||
|
|
||||||
/* initiate drive redirection protocol by sending Server Announce Req */
|
/* initiate drive redirection protocol by sending Server Announce Req */
|
||||||
stream_wr_u16_le(s, RDPDR_CTYP_CORE);
|
xstream_wr_u16_le(s, RDPDR_CTYP_CORE);
|
||||||
stream_wr_u16_le(s, PAKID_CORE_SERVER_ANNOUNCE);
|
xstream_wr_u16_le(s, PAKID_CORE_SERVER_ANNOUNCE);
|
||||||
stream_wr_u16_le(s, 0x0001); /* server major ver */
|
xstream_wr_u16_le(s, 0x0001); /* server major ver */
|
||||||
stream_wr_u16_le(s, 0x000C); /* server minor ver - pretend 2 b Win 7 */
|
xstream_wr_u16_le(s, 0x000C); /* server minor ver - pretend 2 b Win 7 */
|
||||||
stream_wr_u32_le(s, u.clientID); /* unique ClientID */
|
xstream_wr_u32_le(s, u.clientID); /* unique ClientID */
|
||||||
|
|
||||||
/* send data to client */
|
/* send data to client */
|
||||||
bytes = stream_len(s);
|
bytes = xstream_len(s);
|
||||||
send_channel_data(g_rdpdr_chan_id, s->data, bytes);
|
send_channel_data(g_rdpdr_chan_id, s->data, bytes);
|
||||||
|
|
||||||
stream_free(s);
|
xstream_free(s);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -135,9 +135,9 @@ dev_redir_data_in(struct stream *s, int chan_id, int chan_flags, int length,
|
|||||||
{
|
{
|
||||||
/* is this is the first packet? */
|
/* is this is the first packet? */
|
||||||
if (chan_flags & 1)
|
if (chan_flags & 1)
|
||||||
stream_new(g_input_stream, total_length);
|
xstream_new(g_input_stream, total_length);
|
||||||
|
|
||||||
stream_copyin(g_input_stream, s->p, length);
|
xstream_copyin(g_input_stream, s->p, length);
|
||||||
|
|
||||||
/* in last packet, chan_flags & 0x02 will be true */
|
/* in last packet, chan_flags & 0x02 will be true */
|
||||||
if ((chan_flags & 2) == 0)
|
if ((chan_flags & 2) == 0)
|
||||||
@ -148,8 +148,8 @@ dev_redir_data_in(struct stream *s, int chan_id, int chan_flags, int length,
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* read header from incoming data */
|
/* read header from incoming data */
|
||||||
stream_rd_u16_le(ls, comp_type);
|
xstream_rd_u16_le(ls, comp_type);
|
||||||
stream_rd_u16_le(ls, pktID);
|
xstream_rd_u16_le(ls, pktID);
|
||||||
|
|
||||||
/* for now we only handle core type, not printers */
|
/* for now we only handle core type, not printers */
|
||||||
if (comp_type != RDPDR_CTYP_CORE)
|
if (comp_type != RDPDR_CTYP_CORE)
|
||||||
@ -165,9 +165,9 @@ dev_redir_data_in(struct stream *s, int chan_id, int chan_flags, int length,
|
|||||||
switch (pktID)
|
switch (pktID)
|
||||||
{
|
{
|
||||||
case PAKID_CORE_CLIENTID_CONFIRM:
|
case PAKID_CORE_CLIENTID_CONFIRM:
|
||||||
stream_seek(ls, 2); /* major version, we ignore it */
|
xstream_seek(ls, 2); /* major version, we ignore it */
|
||||||
stream_rd_u16_le(ls, minor_ver);
|
xstream_rd_u16_le(ls, minor_ver);
|
||||||
stream_rd_u32_le(ls, g_clientID);
|
xstream_rd_u32_le(ls, g_clientID);
|
||||||
|
|
||||||
g_client_rdp_version = minor_ver;
|
g_client_rdp_version = minor_ver;
|
||||||
|
|
||||||
@ -223,7 +223,7 @@ done:
|
|||||||
|
|
||||||
if (g_input_stream)
|
if (g_input_stream)
|
||||||
{
|
{
|
||||||
stream_free(g_input_stream);
|
xstream_free(g_input_stream);
|
||||||
g_input_stream = NULL;
|
g_input_stream = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -253,59 +253,59 @@ void dev_redir_send_server_core_cap_req()
|
|||||||
struct stream *s;
|
struct stream *s;
|
||||||
int bytes;
|
int bytes;
|
||||||
|
|
||||||
stream_new(s, 1024);
|
xstream_new(s, 1024);
|
||||||
|
|
||||||
/* setup header */
|
/* setup header */
|
||||||
stream_wr_u16_le(s, RDPDR_CTYP_CORE);
|
xstream_wr_u16_le(s, RDPDR_CTYP_CORE);
|
||||||
stream_wr_u16_le(s, PAKID_CORE_SERVER_CAPABILITY);
|
xstream_wr_u16_le(s, PAKID_CORE_SERVER_CAPABILITY);
|
||||||
|
|
||||||
stream_wr_u16_le(s, 5); /* num of caps we are sending */
|
xstream_wr_u16_le(s, 5); /* num of caps we are sending */
|
||||||
stream_wr_u16_le(s, 0x0000); /* padding */
|
xstream_wr_u16_le(s, 0x0000); /* padding */
|
||||||
|
|
||||||
/* setup general capability */
|
/* setup general capability */
|
||||||
stream_wr_u16_le(s, CAP_GENERAL_TYPE); /* CapabilityType */
|
xstream_wr_u16_le(s, CAP_GENERAL_TYPE); /* CapabilityType */
|
||||||
stream_wr_u16_le(s, 44); /* CapabilityLength - len of this */
|
xstream_wr_u16_le(s, 44); /* CapabilityLength - len of this */
|
||||||
/* CAPABILITY_SET in bytes, inc */
|
/* CAPABILITY_SET in bytes, inc */
|
||||||
/* the header */
|
/* the header */
|
||||||
stream_wr_u32_le(s, 2); /* Version */
|
xstream_wr_u32_le(s, 2); /* Version */
|
||||||
stream_wr_u32_le(s, 2); /* O.S type */
|
xstream_wr_u32_le(s, 2); /* O.S type */
|
||||||
stream_wr_u32_le(s, 0); /* O.S version */
|
xstream_wr_u32_le(s, 0); /* O.S version */
|
||||||
stream_wr_u16_le(s, 1); /* protocol major version */
|
xstream_wr_u16_le(s, 1); /* protocol major version */
|
||||||
stream_wr_u16_le(s, g_client_rdp_version); /* protocol minor version */
|
xstream_wr_u16_le(s, g_client_rdp_version); /* protocol minor version */
|
||||||
stream_wr_u32_le(s, 0xffff); /* I/O code 1 */
|
xstream_wr_u32_le(s, 0xffff); /* I/O code 1 */
|
||||||
stream_wr_u32_le(s, 0); /* I/O code 2 */
|
xstream_wr_u32_le(s, 0); /* I/O code 2 */
|
||||||
stream_wr_u32_le(s, 7); /* Extended PDU */
|
xstream_wr_u32_le(s, 7); /* Extended PDU */
|
||||||
stream_wr_u32_le(s, 0); /* extra flags 1 */
|
xstream_wr_u32_le(s, 0); /* extra flags 1 */
|
||||||
stream_wr_u32_le(s, 0); /* extra flags 2 */
|
xstream_wr_u32_le(s, 0); /* extra flags 2 */
|
||||||
stream_wr_u32_le(s, 2); /* special type device cap */
|
xstream_wr_u32_le(s, 2); /* special type device cap */
|
||||||
|
|
||||||
/* setup printer capability */
|
/* setup printer capability */
|
||||||
stream_wr_u16_le(s, CAP_PRINTER_TYPE);
|
xstream_wr_u16_le(s, CAP_PRINTER_TYPE);
|
||||||
stream_wr_u16_le(s, 8);
|
xstream_wr_u16_le(s, 8);
|
||||||
stream_wr_u32_le(s, 1);
|
xstream_wr_u32_le(s, 1);
|
||||||
|
|
||||||
/* setup serial port capability */
|
/* setup serial port capability */
|
||||||
stream_wr_u16_le(s, CAP_PORT_TYPE);
|
xstream_wr_u16_le(s, CAP_PORT_TYPE);
|
||||||
stream_wr_u16_le(s, 8);
|
xstream_wr_u16_le(s, 8);
|
||||||
stream_wr_u32_le(s, 1);
|
xstream_wr_u32_le(s, 1);
|
||||||
|
|
||||||
/* setup file system capability */
|
/* setup file system capability */
|
||||||
stream_wr_u16_le(s, CAP_DRIVE_TYPE); /* CapabilityType */
|
xstream_wr_u16_le(s, CAP_DRIVE_TYPE); /* CapabilityType */
|
||||||
stream_wr_u16_le(s, 8); /* CapabilityLength - len of this */
|
xstream_wr_u16_le(s, 8); /* CapabilityLength - len of this */
|
||||||
/* CAPABILITY_SET in bytes, inc */
|
/* CAPABILITY_SET in bytes, inc */
|
||||||
/* the header */
|
/* the header */
|
||||||
stream_wr_u32_le(s, 2); /* Version */
|
xstream_wr_u32_le(s, 2); /* Version */
|
||||||
|
|
||||||
/* setup smart card capability */
|
/* setup smart card capability */
|
||||||
stream_wr_u16_le(s, CAP_SMARTCARD_TYPE);
|
xstream_wr_u16_le(s, CAP_SMARTCARD_TYPE);
|
||||||
stream_wr_u16_le(s, 8);
|
xstream_wr_u16_le(s, 8);
|
||||||
stream_wr_u32_le(s, 1);
|
xstream_wr_u32_le(s, 1);
|
||||||
|
|
||||||
/* send to client */
|
/* send to client */
|
||||||
bytes = stream_len(s);
|
bytes = xstream_len(s);
|
||||||
send_channel_data(g_rdpdr_chan_id, s->data, bytes);
|
send_channel_data(g_rdpdr_chan_id, s->data, bytes);
|
||||||
|
|
||||||
stream_free(s);
|
xstream_free(s);
|
||||||
}
|
}
|
||||||
|
|
||||||
void dev_redir_send_server_clientID_confirm()
|
void dev_redir_send_server_clientID_confirm()
|
||||||
@ -313,20 +313,20 @@ void dev_redir_send_server_clientID_confirm()
|
|||||||
struct stream *s;
|
struct stream *s;
|
||||||
int bytes;
|
int bytes;
|
||||||
|
|
||||||
stream_new(s, 1024);
|
xstream_new(s, 1024);
|
||||||
|
|
||||||
/* setup stream */
|
/* setup stream */
|
||||||
stream_wr_u16_le(s, RDPDR_CTYP_CORE);
|
xstream_wr_u16_le(s, RDPDR_CTYP_CORE);
|
||||||
stream_wr_u16_le(s, PAKID_CORE_CLIENTID_CONFIRM);
|
xstream_wr_u16_le(s, PAKID_CORE_CLIENTID_CONFIRM);
|
||||||
stream_wr_u16_le(s, 0x0001);
|
xstream_wr_u16_le(s, 0x0001);
|
||||||
stream_wr_u16_le(s, g_client_rdp_version);
|
xstream_wr_u16_le(s, g_client_rdp_version);
|
||||||
stream_wr_u32_le(s, g_clientID);
|
xstream_wr_u32_le(s, g_clientID);
|
||||||
|
|
||||||
/* send to client */
|
/* send to client */
|
||||||
bytes = stream_len(s);
|
bytes = xstream_len(s);
|
||||||
send_channel_data(g_rdpdr_chan_id, s->data, bytes);
|
send_channel_data(g_rdpdr_chan_id, s->data, bytes);
|
||||||
|
|
||||||
stream_free(s);
|
xstream_free(s);
|
||||||
}
|
}
|
||||||
|
|
||||||
void dev_redir_send_server_user_logged_on()
|
void dev_redir_send_server_user_logged_on()
|
||||||
@ -334,17 +334,17 @@ void dev_redir_send_server_user_logged_on()
|
|||||||
struct stream *s;
|
struct stream *s;
|
||||||
int bytes;
|
int bytes;
|
||||||
|
|
||||||
stream_new(s, 1024);
|
xstream_new(s, 1024);
|
||||||
|
|
||||||
/* setup stream */
|
/* setup stream */
|
||||||
stream_wr_u16_le(s, RDPDR_CTYP_CORE);
|
xstream_wr_u16_le(s, RDPDR_CTYP_CORE);
|
||||||
stream_wr_u16_le(s, PAKID_CORE_USER_LOGGEDON);
|
xstream_wr_u16_le(s, PAKID_CORE_USER_LOGGEDON);
|
||||||
|
|
||||||
/* send to client */
|
/* send to client */
|
||||||
bytes = stream_len(s);
|
bytes = xstream_len(s);
|
||||||
send_channel_data(g_rdpdr_chan_id, s->data, bytes);
|
send_channel_data(g_rdpdr_chan_id, s->data, bytes);
|
||||||
|
|
||||||
stream_free(s);
|
xstream_free(s);
|
||||||
}
|
}
|
||||||
|
|
||||||
void dev_redir_send_server_device_announce_resp(tui32 device_id)
|
void dev_redir_send_server_device_announce_resp(tui32 device_id)
|
||||||
@ -352,19 +352,19 @@ void dev_redir_send_server_device_announce_resp(tui32 device_id)
|
|||||||
struct stream *s;
|
struct stream *s;
|
||||||
int bytes;
|
int bytes;
|
||||||
|
|
||||||
stream_new(s, 1024);
|
xstream_new(s, 1024);
|
||||||
|
|
||||||
/* setup stream */
|
/* setup stream */
|
||||||
stream_wr_u16_le(s, RDPDR_CTYP_CORE);
|
xstream_wr_u16_le(s, RDPDR_CTYP_CORE);
|
||||||
stream_wr_u16_le(s, PAKID_CORE_DEVICE_REPLY);
|
xstream_wr_u16_le(s, PAKID_CORE_DEVICE_REPLY);
|
||||||
stream_wr_u32_le(s, device_id);
|
xstream_wr_u32_le(s, device_id);
|
||||||
stream_wr_u32_le(s, 0); /* ResultCode */
|
xstream_wr_u32_le(s, 0); /* ResultCode */
|
||||||
|
|
||||||
/* send to client */
|
/* send to client */
|
||||||
bytes = stream_len(s);
|
bytes = xstream_len(s);
|
||||||
send_channel_data(g_rdpdr_chan_id, s->data, bytes);
|
send_channel_data(g_rdpdr_chan_id, s->data, bytes);
|
||||||
|
|
||||||
stream_free(s);
|
xstream_free(s);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -387,7 +387,7 @@ int dev_redir_send_drive_create_request(tui32 device_id, char *path,
|
|||||||
/* to store path as unicode */
|
/* to store path as unicode */
|
||||||
len = strlen(path) * 2 + 2;
|
len = strlen(path) * 2 + 2;
|
||||||
|
|
||||||
stream_new(s, 1024 + len);
|
xstream_new(s, 1024 + len);
|
||||||
|
|
||||||
dev_redir_insert_dev_io_req_header(s,
|
dev_redir_insert_dev_io_req_header(s,
|
||||||
device_id,
|
device_id,
|
||||||
@ -396,22 +396,22 @@ int dev_redir_send_drive_create_request(tui32 device_id, char *path,
|
|||||||
IRP_MJ_CREATE,
|
IRP_MJ_CREATE,
|
||||||
0);
|
0);
|
||||||
|
|
||||||
stream_wr_u32_le(s, DesiredAccess); /* DesiredAccess */
|
xstream_wr_u32_le(s, DesiredAccess); /* DesiredAccess */
|
||||||
stream_wr_u32_le(s, 0); /* AllocationSize high unused */
|
xstream_wr_u32_le(s, 0); /* AllocationSize high unused */
|
||||||
stream_wr_u32_le(s, 0); /* AllocationSize low unused */
|
xstream_wr_u32_le(s, 0); /* AllocationSize low unused */
|
||||||
stream_wr_u32_le(s, 0); /* FileAttributes */
|
xstream_wr_u32_le(s, 0); /* FileAttributes */
|
||||||
stream_wr_u32_le(s, 3); /* SharedAccess LK_TODO */
|
xstream_wr_u32_le(s, 3); /* SharedAccess LK_TODO */
|
||||||
stream_wr_u32_le(s, CreateDisposition); /* CreateDisposition */
|
xstream_wr_u32_le(s, CreateDisposition); /* CreateDisposition */
|
||||||
stream_wr_u32_le(s, CreateOptions); /* CreateOptions */
|
xstream_wr_u32_le(s, CreateOptions); /* CreateOptions */
|
||||||
stream_wr_u32_le(s, len); /* PathLength */
|
xstream_wr_u32_le(s, len); /* PathLength */
|
||||||
devredir_cvt_to_unicode(s->p, path); /* path in unicode */
|
devredir_cvt_to_unicode(s->p, path); /* path in unicode */
|
||||||
stream_seek(s, len);
|
xstream_seek(s, len);
|
||||||
|
|
||||||
/* send to client */
|
/* send to client */
|
||||||
bytes = stream_len(s);
|
bytes = xstream_len(s);
|
||||||
send_channel_data(g_rdpdr_chan_id, s->data, bytes);
|
send_channel_data(g_rdpdr_chan_id, s->data, bytes);
|
||||||
|
|
||||||
stream_free(s);
|
xstream_free(s);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -430,19 +430,19 @@ int dev_redir_send_drive_close_request(tui16 Component, tui16 PacketId,
|
|||||||
struct stream *s;
|
struct stream *s;
|
||||||
int bytes;
|
int bytes;
|
||||||
|
|
||||||
stream_new(s, 1024);
|
xstream_new(s, 1024);
|
||||||
|
|
||||||
dev_redir_insert_dev_io_req_header(s, DeviceId, FileId, CompletionId,
|
dev_redir_insert_dev_io_req_header(s, DeviceId, FileId, CompletionId,
|
||||||
MajorFunction, MinorFunc);
|
MajorFunction, MinorFunc);
|
||||||
|
|
||||||
if (pad_len)
|
if (pad_len)
|
||||||
stream_seek(s, pad_len);
|
xstream_seek(s, pad_len);
|
||||||
|
|
||||||
/* send to client */
|
/* send to client */
|
||||||
bytes = stream_len(s);
|
bytes = xstream_len(s);
|
||||||
send_channel_data(g_rdpdr_chan_id, s->data, bytes);
|
send_channel_data(g_rdpdr_chan_id, s->data, bytes);
|
||||||
|
|
||||||
stream_free(s);
|
xstream_free(s);
|
||||||
log_debug("sent close request; expect CID_FILE_CLOSE");
|
log_debug("sent close request; expect CID_FILE_CLOSE");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -473,7 +473,7 @@ void dev_redir_send_drive_dir_request(IRP *irp, tui32 device_id,
|
|||||||
devredir_cvt_to_unicode(upath, Path);
|
devredir_cvt_to_unicode(upath, Path);
|
||||||
}
|
}
|
||||||
|
|
||||||
stream_new(s, 1024 + path_len);
|
xstream_new(s, 1024 + path_len);
|
||||||
|
|
||||||
irp->completion_type = CID_DIRECTORY_CONTROL;
|
irp->completion_type = CID_DIRECTORY_CONTROL;
|
||||||
dev_redir_insert_dev_io_req_header(s,
|
dev_redir_insert_dev_io_req_header(s,
|
||||||
@ -484,29 +484,29 @@ void dev_redir_send_drive_dir_request(IRP *irp, tui32 device_id,
|
|||||||
IRP_MN_QUERY_DIRECTORY);
|
IRP_MN_QUERY_DIRECTORY);
|
||||||
|
|
||||||
#ifdef USE_SHORT_NAMES_IN_DIR_LISTING
|
#ifdef USE_SHORT_NAMES_IN_DIR_LISTING
|
||||||
stream_wr_u32_le(s, FileBothDirectoryInformation); /* FsInformationClass */
|
xstream_wr_u32_le(s, FileBothDirectoryInformation); /* FsInformationClass */
|
||||||
#else
|
#else
|
||||||
stream_wr_u32_le(s, FileDirectoryInformation); /* FsInformationClass */
|
xstream_wr_u32_le(s, FileDirectoryInformation); /* FsInformationClass */
|
||||||
#endif
|
#endif
|
||||||
stream_wr_u8(s, InitialQuery); /* InitialQuery */
|
xstream_wr_u8(s, InitialQuery); /* InitialQuery */
|
||||||
|
|
||||||
if (!InitialQuery)
|
if (!InitialQuery)
|
||||||
{
|
{
|
||||||
stream_wr_u32_le(s, 0); /* PathLength */
|
xstream_wr_u32_le(s, 0); /* PathLength */
|
||||||
stream_seek(s, 23);
|
xstream_seek(s, 23);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
stream_wr_u32_le(s, path_len); /* PathLength */
|
xstream_wr_u32_le(s, path_len); /* PathLength */
|
||||||
stream_seek(s, 23); /* Padding */
|
xstream_seek(s, 23); /* Padding */
|
||||||
stream_wr_string(s, upath, path_len);
|
xstream_wr_string(s, upath, path_len);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* send to client */
|
/* send to client */
|
||||||
bytes = stream_len(s);
|
bytes = xstream_len(s);
|
||||||
send_channel_data(g_rdpdr_chan_id, s->data, bytes);
|
send_channel_data(g_rdpdr_chan_id, s->data, bytes);
|
||||||
|
|
||||||
stream_free(s);
|
xstream_free(s);
|
||||||
}
|
}
|
||||||
|
|
||||||
/******************************************************************************
|
/******************************************************************************
|
||||||
@ -526,14 +526,14 @@ void dev_redir_proc_client_core_cap_resp(struct stream *s)
|
|||||||
tui16 cap_len;
|
tui16 cap_len;
|
||||||
tui32 cap_version;
|
tui32 cap_version;
|
||||||
|
|
||||||
stream_rd_u16_le(s, num_caps);
|
xstream_rd_u16_le(s, num_caps);
|
||||||
stream_seek(s, 2); /* padding */
|
xstream_seek(s, 2); /* padding */
|
||||||
|
|
||||||
for (i = 0; i < num_caps; i++)
|
for (i = 0; i < num_caps; i++)
|
||||||
{
|
{
|
||||||
stream_rd_u16_le(s, cap_type);
|
xstream_rd_u16_le(s, cap_type);
|
||||||
stream_rd_u16_le(s, cap_len);
|
xstream_rd_u16_le(s, cap_len);
|
||||||
stream_rd_u32_le(s, cap_version);
|
xstream_rd_u32_le(s, cap_version);
|
||||||
|
|
||||||
/* remove header length and version */
|
/* remove header length and version */
|
||||||
cap_len -= 8;
|
cap_len -= 8;
|
||||||
@ -542,19 +542,19 @@ void dev_redir_proc_client_core_cap_resp(struct stream *s)
|
|||||||
{
|
{
|
||||||
case CAP_GENERAL_TYPE:
|
case CAP_GENERAL_TYPE:
|
||||||
log_debug("got CAP_GENERAL_TYPE");
|
log_debug("got CAP_GENERAL_TYPE");
|
||||||
stream_seek(s, cap_len);
|
xstream_seek(s, cap_len);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case CAP_PRINTER_TYPE:
|
case CAP_PRINTER_TYPE:
|
||||||
log_debug("got CAP_PRINTER_TYPE");
|
log_debug("got CAP_PRINTER_TYPE");
|
||||||
g_is_printer_redir_supported = 1;
|
g_is_printer_redir_supported = 1;
|
||||||
stream_seek(s, cap_len);
|
xstream_seek(s, cap_len);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case CAP_PORT_TYPE:
|
case CAP_PORT_TYPE:
|
||||||
log_debug("got CAP_PORT_TYPE");
|
log_debug("got CAP_PORT_TYPE");
|
||||||
g_is_port_redir_supported = 1;
|
g_is_port_redir_supported = 1;
|
||||||
stream_seek(s, cap_len);
|
xstream_seek(s, cap_len);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case CAP_DRIVE_TYPE:
|
case CAP_DRIVE_TYPE:
|
||||||
@ -562,13 +562,13 @@ void dev_redir_proc_client_core_cap_resp(struct stream *s)
|
|||||||
g_is_drive_redir_supported = 1;
|
g_is_drive_redir_supported = 1;
|
||||||
if (cap_version == 2)
|
if (cap_version == 2)
|
||||||
g_drive_redir_version = 2;
|
g_drive_redir_version = 2;
|
||||||
stream_seek(s, cap_len);
|
xstream_seek(s, cap_len);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case CAP_SMARTCARD_TYPE:
|
case CAP_SMARTCARD_TYPE:
|
||||||
log_debug("got CAP_SMARTCARD_TYPE");
|
log_debug("got CAP_SMARTCARD_TYPE");
|
||||||
g_is_smartcard_redir_supported = 1;
|
g_is_smartcard_redir_supported = 1;
|
||||||
stream_seek(s, cap_len);
|
xstream_seek(s, cap_len);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -583,14 +583,14 @@ void dev_redir_proc_client_devlist_announce_req(struct stream *s)
|
|||||||
tui32 device_data_len;
|
tui32 device_data_len;
|
||||||
|
|
||||||
/* get number of devices being announced */
|
/* get number of devices being announced */
|
||||||
stream_rd_u32_le(s, device_count);
|
xstream_rd_u32_le(s, device_count);
|
||||||
|
|
||||||
log_debug("num of devices announced: %d", device_count);
|
log_debug("num of devices announced: %d", device_count);
|
||||||
|
|
||||||
for (i = 0; i < device_count; i++)
|
for (i = 0; i < device_count; i++)
|
||||||
{
|
{
|
||||||
stream_rd_u32_le(s, device_type);
|
xstream_rd_u32_le(s, device_type);
|
||||||
stream_rd_u32_le(s, g_device_id); /* LK_TODO need to support */
|
xstream_rd_u32_le(s, g_device_id); /* LK_TODO need to support */
|
||||||
/* multiple drives */
|
/* multiple drives */
|
||||||
|
|
||||||
switch (device_type)
|
switch (device_type)
|
||||||
@ -609,10 +609,10 @@ void dev_redir_proc_client_devlist_announce_req(struct stream *s)
|
|||||||
/* see section 2.2.1.3 of the protocol documentation */
|
/* see section 2.2.1.3 of the protocol documentation */
|
||||||
|
|
||||||
/* get device data len */
|
/* get device data len */
|
||||||
stream_rd_u32_le(s, device_data_len);
|
xstream_rd_u32_le(s, device_data_len);
|
||||||
if (device_data_len)
|
if (device_data_len)
|
||||||
{
|
{
|
||||||
stream_rd_string(g_full_name_for_filesystem, s,
|
xstream_rd_string(g_full_name_for_filesystem, s,
|
||||||
device_data_len);
|
device_data_len);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -650,9 +650,9 @@ void dev_redir_proc_device_iocompletion(struct stream *s)
|
|||||||
tui32 IoStatus;
|
tui32 IoStatus;
|
||||||
tui32 Length;
|
tui32 Length;
|
||||||
|
|
||||||
stream_rd_u32_le(s, DeviceId);
|
xstream_rd_u32_le(s, DeviceId);
|
||||||
stream_rd_u32_le(s, CompletionId);
|
xstream_rd_u32_le(s, CompletionId);
|
||||||
stream_rd_u32_le(s, IoStatus);
|
xstream_rd_u32_le(s, IoStatus);
|
||||||
|
|
||||||
/* LK_TODO need to check for IoStatus */
|
/* LK_TODO need to check for IoStatus */
|
||||||
|
|
||||||
@ -683,7 +683,7 @@ void dev_redir_proc_device_iocompletion(struct stream *s)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
stream_rd_u32_le(s, irp->FileId);
|
xstream_rd_u32_le(s, irp->FileId);
|
||||||
log_debug("got CID_CREATE_DIR_REQ IoStatus=0x%x FileId=%d",
|
log_debug("got CID_CREATE_DIR_REQ IoStatus=0x%x FileId=%d",
|
||||||
IoStatus, irp->FileId);
|
IoStatus, irp->FileId);
|
||||||
|
|
||||||
@ -691,7 +691,7 @@ void dev_redir_proc_device_iocompletion(struct stream *s)
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case CID_CREATE_OPEN_REQ:
|
case CID_CREATE_OPEN_REQ:
|
||||||
stream_rd_u32_le(s, irp->FileId);
|
xstream_rd_u32_le(s, irp->FileId);
|
||||||
log_debug("got CID_CREATE_OPEN_REQ IoStatus=0x%x FileId=%d",
|
log_debug("got CID_CREATE_OPEN_REQ IoStatus=0x%x FileId=%d",
|
||||||
IoStatus, irp->FileId);
|
IoStatus, irp->FileId);
|
||||||
fuse_data = dev_redir_fuse_data_dequeue(irp);
|
fuse_data = dev_redir_fuse_data_dequeue(irp);
|
||||||
@ -703,14 +703,14 @@ void dev_redir_proc_device_iocompletion(struct stream *s)
|
|||||||
|
|
||||||
case CID_READ:
|
case CID_READ:
|
||||||
log_debug("got CID_READ");
|
log_debug("got CID_READ");
|
||||||
stream_rd_u32_le(s, Length);
|
xstream_rd_u32_le(s, Length);
|
||||||
fuse_data = dev_redir_fuse_data_dequeue(irp);
|
fuse_data = dev_redir_fuse_data_dequeue(irp);
|
||||||
xfuse_devredir_cb_read_file(fuse_data->data_ptr, s->p, Length);
|
xfuse_devredir_cb_read_file(fuse_data->data_ptr, s->p, Length);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case CID_WRITE:
|
case CID_WRITE:
|
||||||
log_debug("got CID_WRITE");
|
log_debug("got CID_WRITE");
|
||||||
stream_rd_u32_le(s, Length);
|
xstream_rd_u32_le(s, Length);
|
||||||
fuse_data = dev_redir_fuse_data_dequeue(irp);
|
fuse_data = dev_redir_fuse_data_dequeue(irp);
|
||||||
xfuse_devredir_cb_write_file(fuse_data->data_ptr, s->p, Length);
|
xfuse_devredir_cb_write_file(fuse_data->data_ptr, s->p, Length);
|
||||||
break;
|
break;
|
||||||
@ -738,7 +738,7 @@ void dev_redir_proc_device_iocompletion(struct stream *s)
|
|||||||
|
|
||||||
case CID_RMDIR_OR_FILE:
|
case CID_RMDIR_OR_FILE:
|
||||||
log_debug("got CID_RMDIR_OR_FILE");
|
log_debug("got CID_RMDIR_OR_FILE");
|
||||||
stream_rd_u32_le(s, irp->FileId);
|
xstream_rd_u32_le(s, irp->FileId);
|
||||||
devredir_proc_cid_rmdir_or_file(irp, IoStatus);
|
devredir_proc_cid_rmdir_or_file(irp, IoStatus);
|
||||||
return;
|
return;
|
||||||
break;
|
break;
|
||||||
@ -750,7 +750,7 @@ void dev_redir_proc_device_iocompletion(struct stream *s)
|
|||||||
|
|
||||||
case CID_RENAME_FILE:
|
case CID_RENAME_FILE:
|
||||||
log_debug("got CID_RENAME_FILE");
|
log_debug("got CID_RENAME_FILE");
|
||||||
stream_rd_u32_le(s, irp->FileId);
|
xstream_rd_u32_le(s, irp->FileId);
|
||||||
devredir_proc_cid_rename_file(irp, IoStatus);
|
devredir_proc_cid_rename_file(irp, IoStatus);
|
||||||
return;
|
return;
|
||||||
break;
|
break;
|
||||||
@ -802,7 +802,7 @@ void dev_redir_proc_query_dir_response(IRP *irp,
|
|||||||
char filename[256];
|
char filename[256];
|
||||||
int i = 0;
|
int i = 0;
|
||||||
|
|
||||||
stream_rd_u32_le(s_in, Length);
|
xstream_rd_u32_le(s_in, Length);
|
||||||
|
|
||||||
if ((IoStatus == NT_STATUS_UNSUCCESSFUL) ||
|
if ((IoStatus == NT_STATUS_UNSUCCESSFUL) ||
|
||||||
(IoStatus == STATUS_NO_MORE_FILES))
|
(IoStatus == STATUS_NO_MORE_FILES))
|
||||||
@ -828,22 +828,22 @@ void dev_redir_proc_query_dir_response(IRP *irp,
|
|||||||
{
|
{
|
||||||
log_debug("processing FILE_DIRECTORY_INFORMATION structs");
|
log_debug("processing FILE_DIRECTORY_INFORMATION structs");
|
||||||
|
|
||||||
stream_rd_u32_le(s_in, NextEntryOffset);
|
xstream_rd_u32_le(s_in, NextEntryOffset);
|
||||||
stream_seek(s_in, 4); /* FileIndex */
|
xstream_seek(s_in, 4); /* FileIndex */
|
||||||
stream_rd_u64_le(s_in, CreationTime);
|
xstream_rd_u64_le(s_in, CreationTime);
|
||||||
stream_rd_u64_le(s_in, LastAccessTime);
|
xstream_rd_u64_le(s_in, LastAccessTime);
|
||||||
stream_rd_u64_le(s_in, LastWriteTime);
|
xstream_rd_u64_le(s_in, LastWriteTime);
|
||||||
stream_rd_u64_le(s_in, ChangeTime);
|
xstream_rd_u64_le(s_in, ChangeTime);
|
||||||
stream_rd_u64_le(s_in, EndOfFile);
|
xstream_rd_u64_le(s_in, EndOfFile);
|
||||||
stream_seek(s_in, 8); /* AllocationSize */
|
xstream_seek(s_in, 8); /* AllocationSize */
|
||||||
stream_rd_u32_le(s_in, FileAttributes);
|
xstream_rd_u32_le(s_in, FileAttributes);
|
||||||
stream_rd_u32_le(s_in, FileNameLength);
|
xstream_rd_u32_le(s_in, FileNameLength);
|
||||||
|
|
||||||
#ifdef USE_SHORT_NAMES_IN_DIR_LISTING
|
#ifdef USE_SHORT_NAMES_IN_DIR_LISTING
|
||||||
stream_rd_u32_le(s_in, EaSize);
|
xstream_rd_u32_le(s_in, EaSize);
|
||||||
stream_rd_u8(s_in, ShortNameLength);
|
xstream_rd_u8(s_in, ShortNameLength);
|
||||||
stream_rd_u8(s_in, Reserved);
|
xstream_rd_u8(s_in, Reserved);
|
||||||
stream_seek(s_in, 23); /* ShortName in Unicode */
|
xstream_seek(s_in, 23); /* ShortName in Unicode */
|
||||||
#endif
|
#endif
|
||||||
devredir_cvt_from_unicode_len(filename, s_in->p, FileNameLength);
|
devredir_cvt_from_unicode_len(filename, s_in->p, FileNameLength);
|
||||||
|
|
||||||
@ -1097,7 +1097,7 @@ int dev_redir_file_read(void *fusep, tui32 DeviceId, tui32 FileId,
|
|||||||
IRP *irp;
|
IRP *irp;
|
||||||
int bytes;
|
int bytes;
|
||||||
|
|
||||||
stream_new(s, 1024);
|
xstream_new(s, 1024);
|
||||||
|
|
||||||
if ((irp = dev_redir_irp_find_by_fileid(FileId)) == NULL)
|
if ((irp = dev_redir_irp_find_by_fileid(FileId)) == NULL)
|
||||||
{
|
{
|
||||||
@ -1115,14 +1115,14 @@ int dev_redir_file_read(void *fusep, tui32 DeviceId, tui32 FileId,
|
|||||||
IRP_MJ_READ,
|
IRP_MJ_READ,
|
||||||
0);
|
0);
|
||||||
|
|
||||||
stream_wr_u32_le(s, Length);
|
xstream_wr_u32_le(s, Length);
|
||||||
stream_wr_u64_le(s, Offset);
|
xstream_wr_u64_le(s, Offset);
|
||||||
stream_seek(s, 20);
|
xstream_seek(s, 20);
|
||||||
|
|
||||||
/* send to client */
|
/* send to client */
|
||||||
bytes = stream_len(s);
|
bytes = xstream_len(s);
|
||||||
send_channel_data(g_rdpdr_chan_id, s->data, bytes);
|
send_channel_data(g_rdpdr_chan_id, s->data, bytes);
|
||||||
stream_free(s);
|
xstream_free(s);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -1137,7 +1137,7 @@ int dev_redir_file_write(void *fusep, tui32 DeviceId, tui32 FileId,
|
|||||||
log_debug("DeviceId=%d FileId=%d Length=%d Offset=%lld",
|
log_debug("DeviceId=%d FileId=%d Length=%d Offset=%lld",
|
||||||
DeviceId, FileId, Length, Offset);
|
DeviceId, FileId, Length, Offset);
|
||||||
|
|
||||||
stream_new(s, 1024 + Length);
|
xstream_new(s, 1024 + Length);
|
||||||
|
|
||||||
if ((irp = dev_redir_irp_find_by_fileid(FileId)) == NULL)
|
if ((irp = dev_redir_irp_find_by_fileid(FileId)) == NULL)
|
||||||
{
|
{
|
||||||
@ -1155,17 +1155,17 @@ int dev_redir_file_write(void *fusep, tui32 DeviceId, tui32 FileId,
|
|||||||
IRP_MJ_WRITE,
|
IRP_MJ_WRITE,
|
||||||
0);
|
0);
|
||||||
|
|
||||||
stream_wr_u32_le(s, Length);
|
xstream_wr_u32_le(s, Length);
|
||||||
stream_wr_u64_le(s, Offset);
|
xstream_wr_u64_le(s, Offset);
|
||||||
stream_seek(s, 20); /* padding */
|
xstream_seek(s, 20); /* padding */
|
||||||
|
|
||||||
/* now insert real data */
|
/* now insert real data */
|
||||||
stream_copyin(s, buf, Length);
|
xstream_copyin(s, buf, Length);
|
||||||
|
|
||||||
/* send to client */
|
/* send to client */
|
||||||
bytes = stream_len(s);
|
bytes = xstream_len(s);
|
||||||
send_channel_data(g_rdpdr_chan_id, s->data, bytes);
|
send_channel_data(g_rdpdr_chan_id, s->data, bytes);
|
||||||
stream_free(s);
|
xstream_free(s);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -1432,13 +1432,13 @@ void dev_redir_insert_dev_io_req_header(struct stream *s,
|
|||||||
tui32 MinorFunction)
|
tui32 MinorFunction)
|
||||||
{
|
{
|
||||||
/* setup DR_DEVICE_IOREQUEST header */
|
/* setup DR_DEVICE_IOREQUEST header */
|
||||||
stream_wr_u16_le(s, RDPDR_CTYP_CORE);
|
xstream_wr_u16_le(s, RDPDR_CTYP_CORE);
|
||||||
stream_wr_u16_le(s, PAKID_CORE_DEVICE_IOREQUEST);
|
xstream_wr_u16_le(s, PAKID_CORE_DEVICE_IOREQUEST);
|
||||||
stream_wr_u32_le(s, DeviceId);
|
xstream_wr_u32_le(s, DeviceId);
|
||||||
stream_wr_u32_le(s, FileId);
|
xstream_wr_u32_le(s, FileId);
|
||||||
stream_wr_u32_le(s, CompletionId);
|
xstream_wr_u32_le(s, CompletionId);
|
||||||
stream_wr_u32_le(s, MajorFunction);
|
xstream_wr_u32_le(s, MajorFunction);
|
||||||
stream_wr_u32_le(s, MinorFunction);
|
xstream_wr_u32_le(s, MinorFunction);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -1495,8 +1495,8 @@ int dev_redir_string_ends_with(char *string, char c)
|
|||||||
void dev_redir_insert_rdpdr_header(struct stream *s, tui16 Component,
|
void dev_redir_insert_rdpdr_header(struct stream *s, tui16 Component,
|
||||||
tui16 PacketId)
|
tui16 PacketId)
|
||||||
{
|
{
|
||||||
stream_wr_u16_le(s, Component);
|
xstream_wr_u16_le(s, Component);
|
||||||
stream_wr_u16_le(s, PacketId);
|
xstream_wr_u16_le(s, PacketId);
|
||||||
}
|
}
|
||||||
|
|
||||||
void devredir_proc_cid_rmdir_or_file(IRP *irp, tui32 IoStatus)
|
void devredir_proc_cid_rmdir_or_file(IRP *irp, tui32 IoStatus)
|
||||||
@ -1516,21 +1516,21 @@ void devredir_proc_cid_rmdir_or_file(IRP *irp, tui32 IoStatus)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
stream_new(s, 1024);
|
xstream_new(s, 1024);
|
||||||
|
|
||||||
irp->completion_type = CID_RMDIR_OR_FILE_RESP;
|
irp->completion_type = CID_RMDIR_OR_FILE_RESP;
|
||||||
dev_redir_insert_dev_io_req_header(s, irp->device_id, irp->FileId,
|
dev_redir_insert_dev_io_req_header(s, irp->device_id, irp->FileId,
|
||||||
irp->completion_id,
|
irp->completion_id,
|
||||||
IRP_MJ_SET_INFORMATION, 0);
|
IRP_MJ_SET_INFORMATION, 0);
|
||||||
|
|
||||||
stream_wr_u32_le(s, FileDispositionInformation);
|
xstream_wr_u32_le(s, FileDispositionInformation);
|
||||||
stream_wr_u32_le(s, 0); /* length is zero */
|
xstream_wr_u32_le(s, 0); /* length is zero */
|
||||||
stream_seek(s, 24); /* padding */
|
xstream_seek(s, 24); /* padding */
|
||||||
|
|
||||||
/* send to client */
|
/* send to client */
|
||||||
bytes = stream_len(s);
|
bytes = xstream_len(s);
|
||||||
send_channel_data(g_rdpdr_chan_id, s->data, bytes);
|
send_channel_data(g_rdpdr_chan_id, s->data, bytes);
|
||||||
stream_free(s);
|
xstream_free(s);
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -1583,7 +1583,7 @@ void devredir_proc_cid_rename_file(IRP *irp, tui32 IoStatus)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
stream_new(s, 1024);
|
xstream_new(s, 1024);
|
||||||
|
|
||||||
irp->completion_type = CID_RENAME_FILE_RESP;
|
irp->completion_type = CID_RENAME_FILE_RESP;
|
||||||
dev_redir_insert_dev_io_req_header(s, irp->device_id, irp->FileId,
|
dev_redir_insert_dev_io_req_header(s, irp->device_id, irp->FileId,
|
||||||
@ -1593,21 +1593,21 @@ void devredir_proc_cid_rename_file(IRP *irp, tui32 IoStatus)
|
|||||||
flen = strlen(irp->gen_buf) * 2 + 2;
|
flen = strlen(irp->gen_buf) * 2 + 2;
|
||||||
sblen = 6 + flen;
|
sblen = 6 + flen;
|
||||||
|
|
||||||
stream_wr_u32_le(s, FileRenameInformation);
|
xstream_wr_u32_le(s, FileRenameInformation);
|
||||||
stream_wr_u32_le(s, sblen); /* Length */
|
xstream_wr_u32_le(s, sblen); /* Length */
|
||||||
stream_seek(s, 24); /* padding */
|
xstream_seek(s, 24); /* padding */
|
||||||
stream_wr_u8(s, 1); /* ReplaceIfExists */
|
xstream_wr_u8(s, 1); /* ReplaceIfExists */
|
||||||
stream_wr_u8(s, 0); /* RootDirectory */
|
xstream_wr_u8(s, 0); /* RootDirectory */
|
||||||
stream_wr_u32_le(s, flen); /* FileNameLength */
|
xstream_wr_u32_le(s, flen); /* FileNameLength */
|
||||||
|
|
||||||
/* filename in unicode */
|
/* filename in unicode */
|
||||||
devredir_cvt_to_unicode(s->p, irp->gen_buf);
|
devredir_cvt_to_unicode(s->p, irp->gen_buf);
|
||||||
stream_seek(s, flen);
|
xstream_seek(s, flen);
|
||||||
|
|
||||||
/* send to client */
|
/* send to client */
|
||||||
bytes = stream_len(s);
|
bytes = xstream_len(s);
|
||||||
send_channel_data(g_rdpdr_chan_id, s->data, bytes);
|
send_channel_data(g_rdpdr_chan_id, s->data, bytes);
|
||||||
stream_free(s);
|
xstream_free(s);
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -108,6 +108,8 @@ static const char* const valid_modargs[] = {
|
|||||||
NULL
|
NULL
|
||||||
};
|
};
|
||||||
|
|
||||||
|
static int close_send(struct userdata *u);
|
||||||
|
|
||||||
static int sink_process_msg(pa_msgobject *o, int code, void *data,
|
static int sink_process_msg(pa_msgobject *o, int code, void *data,
|
||||||
int64_t offset, pa_memchunk *chunk) {
|
int64_t offset, pa_memchunk *chunk) {
|
||||||
|
|
||||||
@ -141,6 +143,7 @@ static int sink_process_msg(pa_msgobject *o, int code, void *data,
|
|||||||
u->timestamp = pa_rtclock_now();
|
u->timestamp = pa_rtclock_now();
|
||||||
} else {
|
} else {
|
||||||
pa_log("sink_process_msg: not running");
|
pa_log("sink_process_msg: not running");
|
||||||
|
close_send(u);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@ -330,6 +333,28 @@ static int data_send(struct userdata *u, pa_memchunk *chunk) {
|
|||||||
return sent;
|
return sent;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int close_send(struct userdata *u) {
|
||||||
|
struct header h;
|
||||||
|
|
||||||
|
pa_log("close_send:");
|
||||||
|
if (u->fd == 0) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
h.code = 1;
|
||||||
|
h.bytes = 8;
|
||||||
|
if (send(u->fd, &h, 8, 0) != 8) {
|
||||||
|
pa_log("close_send: send failed");
|
||||||
|
close(u->fd);
|
||||||
|
u->fd = 0;
|
||||||
|
return 0;
|
||||||
|
} else {
|
||||||
|
//pa_log("close_send: sent header ok");
|
||||||
|
}
|
||||||
|
|
||||||
|
return 8;
|
||||||
|
}
|
||||||
|
|
||||||
static void process_render(struct userdata *u, pa_usec_t now) {
|
static void process_render(struct userdata *u, pa_usec_t now) {
|
||||||
pa_memchunk chunk;
|
pa_memchunk chunk;
|
||||||
int request_bytes;
|
int request_bytes;
|
||||||
|
@ -212,6 +212,31 @@ sound_send_wave_data(char *data, int data_bytes)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*****************************************************************************/
|
||||||
|
static int
|
||||||
|
sound_send_close(void)
|
||||||
|
{
|
||||||
|
struct stream *s;
|
||||||
|
int bytes;
|
||||||
|
char *size_ptr;
|
||||||
|
|
||||||
|
print_got_here();
|
||||||
|
|
||||||
|
make_stream(s);
|
||||||
|
init_stream(s, 8182);
|
||||||
|
out_uint16_le(s, SNDC_CLOSE);
|
||||||
|
size_ptr = s->p;
|
||||||
|
out_uint16_le(s, 0); /* size, set later */
|
||||||
|
s_mark_end(s);
|
||||||
|
bytes = (int)((s->end - s->data) - 4);
|
||||||
|
size_ptr[0] = bytes;
|
||||||
|
size_ptr[1] = bytes >> 8;
|
||||||
|
bytes = (int)(s->end - s->data);
|
||||||
|
send_channel_data(g_rdpsnd_chan_id, s->data, bytes);
|
||||||
|
free_stream(s);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
static int APP_CC
|
static int APP_CC
|
||||||
sound_process_training(struct stream *s, int size)
|
sound_process_training(struct stream *s, int size)
|
||||||
@ -249,7 +274,18 @@ process_pcm_message(int id, int size, struct stream *s)
|
|||||||
{
|
{
|
||||||
print_got_here();
|
print_got_here();
|
||||||
|
|
||||||
|
switch (id)
|
||||||
|
{
|
||||||
|
case 0:
|
||||||
sound_send_wave_data(s->p, size);
|
sound_send_wave_data(s->p, size);
|
||||||
|
break;
|
||||||
|
case 1:
|
||||||
|
sound_send_close();
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
LOG(0, ("process_pcm_message: unknown id %d", id));
|
||||||
|
break;
|
||||||
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -277,7 +313,7 @@ sound_trans_audio_data_in(struct trans *trans)
|
|||||||
in_uint32_le(s, id);
|
in_uint32_le(s, id);
|
||||||
in_uint32_le(s, size);
|
in_uint32_le(s, size);
|
||||||
|
|
||||||
if ((id != 0) || (size > 128 * 1024 + 8) || (size < 8))
|
if ((id & ~3) || (size > 128 * 1024 + 8) || (size < 8))
|
||||||
{
|
{
|
||||||
LOG(0, ("sound_trans_audio_data_in: bad message id %d size %d", id, size));
|
LOG(0, ("sound_trans_audio_data_in: bad message id %d size %d", id, size));
|
||||||
return 1;
|
return 1;
|
||||||
|
@ -4,3 +4,23 @@ if [ -r /etc/default/locale ]; then
|
|||||||
export LANG LANGUAGE
|
export LANG LANGUAGE
|
||||||
fi
|
fi
|
||||||
. /etc/X11/Xsession
|
. /etc/X11/Xsession
|
||||||
|
|
||||||
|
# debian
|
||||||
|
if [ -r /etc/X11/Xsession ]; then
|
||||||
|
. /etc/X11/Xsession
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
# el
|
||||||
|
if [ -r /etc/X11/xinit/Xsession ]; then
|
||||||
|
. /etc/X11/xinit/Xsession
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
# suse
|
||||||
|
if [ -r /etc/X11/xdm/Xsession ]; then
|
||||||
|
. /etc/X11/xdm/Xsession
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
xterm
|
||||||
|
@ -11,6 +11,7 @@ AM_CFLAGS = \
|
|||||||
-DXRDP_SBIN_PATH=\"${sbindir}\" \
|
-DXRDP_SBIN_PATH=\"${sbindir}\" \
|
||||||
-DXRDP_SHARE_PATH=\"${datadir}/xrdp\" \
|
-DXRDP_SHARE_PATH=\"${datadir}/xrdp\" \
|
||||||
-DXRDP_PID_PATH=\"${localstatedir}/run\" \
|
-DXRDP_PID_PATH=\"${localstatedir}/run\" \
|
||||||
|
-DXRDP_LIB_PATH=\"${libdir}\" \
|
||||||
$(EXTRA_DEFINES)
|
$(EXTRA_DEFINES)
|
||||||
|
|
||||||
INCLUDES = \
|
INCLUDES = \
|
||||||
|
@ -63,6 +63,7 @@ password=ask
|
|||||||
ip=127.0.0.1
|
ip=127.0.0.1
|
||||||
port=-1
|
port=-1
|
||||||
xserverbpp=24
|
xserverbpp=24
|
||||||
|
code=10
|
||||||
|
|
||||||
[xrdp2]
|
[xrdp2]
|
||||||
name=sesman-Xvnc
|
name=sesman-Xvnc
|
||||||
|
@ -17,6 +17,7 @@
|
|||||||
*
|
*
|
||||||
* module manager
|
* module manager
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <config_ac.h>
|
#include <config_ac.h>
|
||||||
#define ACCESS
|
#define ACCESS
|
||||||
#include "xrdp.h"
|
#include "xrdp.h"
|
||||||
@ -148,13 +149,10 @@ xrdp_mm_send_login(struct xrdp_mm *self)
|
|||||||
{
|
{
|
||||||
password = value;
|
password = value;
|
||||||
}
|
}
|
||||||
else if (g_strcasecmp(name, "lib") == 0)
|
else if (g_strcasecmp(name, "code") == 0)
|
||||||
{
|
{
|
||||||
if ((g_strcasecmp(value, "libxup.so") == 0) ||
|
/* this code is either 0 for Xvnc or 10 for X11rdp */
|
||||||
(g_strcasecmp(value, "xup.dll") == 0))
|
self->code = g_atoi(value);
|
||||||
{
|
|
||||||
self->code = 10;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else if (g_strcasecmp(name, "xserverbpp") == 0)
|
else if (g_strcasecmp(name, "xserverbpp") == 0)
|
||||||
{
|
{
|
||||||
@ -311,8 +309,9 @@ xrdp_mm_setup_mod1(struct xrdp_mm *self)
|
|||||||
|
|
||||||
if (self->mod_handle == 0)
|
if (self->mod_handle == 0)
|
||||||
{
|
{
|
||||||
|
g_snprintf(text, 255, "%s/%s", XRDP_LIB_PATH, lib);
|
||||||
/* Let the main thread load the lib,*/
|
/* Let the main thread load the lib,*/
|
||||||
self->mod_handle = g_xrdp_sync(xrdp_mm_sync_load, (long)lib, 0);
|
self->mod_handle = g_xrdp_sync(xrdp_mm_sync_load, (tintptr)text, 0);
|
||||||
|
|
||||||
if (self->mod_handle != 0)
|
if (self->mod_handle != 0)
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user