CVS: seamlessrdp/ServerExe vchannel.vcproj,NONE,1.1 Makefile,1.7,1.8 clipper.vcproj,1.10,1.11 main.c,1.23,1.24 vchannel.c,1.10,1.11 vchannel.h,1.6,1.7
Pierre Ossman <[email protected]> Mon, 20 Mar 2006 02:30:52 -0800
| Newsgroups | gmane.network.rdesktop.cvs |
|---|---|
| Message-ID | <[email protected]> |
Update of /cvsroot/rdesktop/seamlessrdp/ServerExe
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv27823/ServerExe
Modified Files:
Makefile clipper.vcproj main.c vchannel.c vchannel.h
Added Files:
vchannel.vcproj
Log Message:
Add serial numbers to protocol.
--- NEW FILE: vchannel.vcproj ---
(This appears to be a binary file; contents omitted.)
Index: Makefile
===================================================================
RCS file: /cvsroot/rdesktop/seamlessrdp/ServerExe/Makefile,v
retrieving revision 1.7
retrieving revision 1.8
diff -C2 -d -r1.7 -r1.8
*** Makefile 9 Mar 2006 16:42:26 -0000 1.7
--- Makefile 20 Mar 2006 10:30:25 -0000 1.8
***************
*** 11,24 ****
default: seamlessrdpshell.exe HookDll/seamlessrdp.dll
! seamlessrdpshell.exe: main.c vchannel.o
$(CC) $(CFLAGS) -mwindows -o $@ $^ -lwtsapi32
! vchannel.o: vchannel.c vchannel.h
! $(CC) $(CFLAGS) -c -o $@ vchannel.c
!
! HookDll/seamlessrdp.dll: HookDll/hookdll.c vchannel.o
$(CC) $(CFLAGS) -shared -o $@ $^ -lwtsapi32
clean:
-rm -f *.o HookDll/*.o
! -rm -f seamlessrdpshell.exe HookDll/seamlessrdp.dll
--- 11,24 ----
default: seamlessrdpshell.exe HookDll/seamlessrdp.dll
! seamlessrdpshell.exe: main.c vchannel.dll
$(CC) $(CFLAGS) -mwindows -o $@ $^ -lwtsapi32
! vchannel.dll: vchannel.c
$(CC) $(CFLAGS) -shared -o $@ $^ -lwtsapi32
+ HookDll/seamlessrdp.dll: HookDll/hookdll.c vchannel.dll
+ $(CC) $(CFLAGS) -shared -o $@ $^
+
clean:
-rm -f *.o HookDll/*.o
! -rm -f seamlessrdpshell.exe vchannel.dll HookDll/seamlessrdp.dll
Index: clipper.vcproj
===================================================================
RCS file: /cvsroot/rdesktop/seamlessrdp/ServerExe/clipper.vcproj,v
retrieving revision 1.10
retrieving revision 1.11
diff -C2 -d -r1.10 -r1.11
*** clipper.vcproj 9 Mar 2006 12:26:30 -0000 1.10
--- clipper.vcproj 20 Mar 2006 10:30:25 -0000 1.11
***************
*** 153,162 ****
RelativePath=".\resource.h">
</File>
- <File
- RelativePath=".\vchannel.c">
- </File>
- <File
- RelativePath=".\vchannel.h">
- </File>
</Files>
<Globals>
--- 153,156 ----
Index: main.c
===================================================================
RCS file: /cvsroot/rdesktop/seamlessrdp/ServerExe/main.c,v
retrieving revision 1.23
retrieving revision 1.24
diff -C2 -d -r1.23 -r1.24
*** main.c 17 Mar 2006 16:23:08 -0000 1.23
--- main.c 20 Mar 2006 10:30:25 -0000 1.24
***************
*** 107,111 ****
parent = NULL;
! vchannel_write("CREATE,0x%p,0x%p,0x%x", hwnd, parent, 0);
if (!GetWindowRect(hwnd, &rect))
--- 107,111 ----
parent = NULL;
! vchannel_write("CREATE", "0x%p,0x%p,0x%x", hwnd, parent, 0);
if (!GetWindowRect(hwnd, &rect))
***************
*** 115,119 ****
}
! vchannel_write("POSITION,0x%p,%d,%d,%d,%d,0x%x",
hwnd,
rect.left, rect.top, rect.right - rect.left, rect.bottom - rect.top, 0);
--- 115,119 ----
}
! vchannel_write("POSITION", "0x%p,%d,%d,%d,%d,0x%x",
hwnd,
rect.left, rect.top, rect.right - rect.left, rect.bottom - rect.top, 0);
***************
*** 121,125 ****
GetWindowTextW(hwnd, title, sizeof(title) / sizeof(*title));
! vchannel_write("TITLE,0x%x,%s,0x%x", hwnd, vchannel_strfilter_unicode(title), 0);
if (styles & WS_MAXIMIZE)
--- 121,125 ----
GetWindowTextW(hwnd, title, sizeof(title) / sizeof(*title));
! vchannel_write("TITLE", "0x%x,%s,0x%x", hwnd, vchannel_strfilter_unicode(title), 0);
if (styles & WS_MAXIMIZE)
***************
*** 130,134 ****
state = 0;
! vchannel_write("STATE,0x%p,0x%x,0x%x", hwnd, state, 0);
return TRUE;
--- 130,134 ----
state = 0;
! vchannel_write("STATE", "0x%p,0x%x,0x%x", hwnd, state, 0);
return TRUE;
***************
*** 140,148 ****
vchannel_block();
! vchannel_write("SYNCBEGIN,0x0");
EnumWindows(enum_cb, 0);
! vchannel_write("SYNCEND,0x0");
vchannel_unblock();
--- 140,148 ----
vchannel_block();
! vchannel_write("SYNCBEGIN", "0x0");
EnumWindows(enum_cb, 0);
! vchannel_write("SYNCEND", "0x0");
vchannel_unblock();
***************
*** 150,154 ****
static void
! do_state(HWND hwnd, int state)
{
g_set_state_fn(hwnd, state);
--- 150,154 ----
static void
! do_state(unsigned int serial, HWND hwnd, int state)
{
g_set_state_fn(hwnd, state);
***************
*** 156,160 ****
static void
! do_position(HWND hwnd, int x, int y, int width, int height)
{
g_move_window_fn(hwnd, x, y, width, height);
--- 156,160 ----
static void
! do_position(unsigned int serial, HWND hwnd, int x, int y, int width, int height)
{
g_move_window_fn(hwnd, x, y, width, height);
***************
*** 162,166 ****
static void
! do_zchange(HWND hwnd, HWND behind)
{
g_zchange_fn(hwnd, behind);
--- 162,166 ----
static void
! do_zchange(unsigned int serial, HWND hwnd, HWND behind)
{
g_zchange_fn(hwnd, behind);
***************
*** 168,172 ****
static void
! do_focus(HWND hwnd)
{
g_focus_fn(hwnd);
--- 168,172 ----
static void
! do_focus(unsigned int serial, HWND hwnd)
{
g_focus_fn(hwnd);
***************
*** 197,209 ****
do_sync();
else if (strcmp(tok1, "STATE") == 0)
! do_state((HWND) strtoul(tok2, NULL, 0), strtol(tok3, NULL, 0));
else if (strcmp(tok1, "POSITION") == 0)
! do_position((HWND) strtoul(tok2, NULL, 0), strtol(tok3, NULL, 0),
strtol(tok4, NULL, 0), strtol(tok5, NULL, 0), strtol(tok6, NULL,
! 0));
else if (strcmp(tok1, "ZCHANGE") == 0)
! do_zchange((HWND) strtoul(tok2, NULL, 0), (HWND) strtoul(tok3, NULL, 0));
else if (strcmp(tok1, "FOCUS") == 0)
! do_focus((HWND) strtoul(tok2, NULL, 0));
}
}
--- 197,212 ----
do_sync();
else if (strcmp(tok1, "STATE") == 0)
! do_state(strtoul(tok2, NULL, 0), (HWND) strtoul(tok3, NULL, 0),
! strtol(tok4, NULL, 0));
else if (strcmp(tok1, "POSITION") == 0)
! do_position(strtoul(tok2, NULL, 0), (HWND) strtoul(tok3, NULL, 0),
strtol(tok4, NULL, 0), strtol(tok5, NULL, 0), strtol(tok6, NULL,
! 0),
! strtol(tok7, NULL, 0));
else if (strcmp(tok1, "ZCHANGE") == 0)
! do_zchange(strtoul(tok2, NULL, 0), (HWND) strtoul(tok3, NULL, 0),
! (HWND) strtoul(tok4, NULL, 0));
else if (strcmp(tok1, "FOCUS") == 0)
! do_focus(strtoul(tok2, NULL, 0), (HWND) strtoul(tok3, NULL, 0));
}
}
***************
*** 219,223 ****
SystemParametersInfo(SPI_SETDRAGFULLWINDOWS, TRUE, NULL, 0);
SystemParametersInfo(SPI_SETSCREENSAVEACTIVE, FALSE, NULL, 0);
! vchannel_write("HELLO,0x%08x", 1);
}
}
--- 222,226 ----
SystemParametersInfo(SPI_SETDRAGFULLWINDOWS, TRUE, NULL, 0);
SystemParametersInfo(SPI_SETSCREENSAVEACTIVE, FALSE, NULL, 0);
! vchannel_write("HELLO", "0x%08x", 1);
}
}
***************
*** 314,318 ****
vchannel_open();
! vchannel_write("HELLO,0x%08x", 0);
set_hooks_fn();
--- 317,321 ----
vchannel_open();
! vchannel_write("HELLO", "0x%08x", 0);
set_hooks_fn();
Index: vchannel.c
===================================================================
RCS file: /cvsroot/rdesktop/seamlessrdp/ServerExe/vchannel.c,v
retrieving revision 1.10
retrieving revision 1.11
diff -C2 -d -r1.10 -r1.11
*** vchannel.c 17 Mar 2006 09:54:17 -0000 1.10
--- vchannel.c 20 Mar 2006 10:30:25 -0000 1.11
***************
*** 36,43 ****
#define REPLACEMENT_CHAR '_'
static HANDLE g_mutex = NULL;
static HANDLE g_vchannel = NULL;
! void
debug(char *format, ...)
{
--- 36,58 ----
#define REPLACEMENT_CHAR '_'
+ #ifdef __GNUC__
+ #define SHARED __attribute__((section ("SHAREDDATA"), shared))
+ #else
+ #define SHARED
+ #endif
+
+ // Shared DATA
+ #pragma data_seg ( "SHAREDDATA" )
+
+ unsigned int g_vchannel_serial SHARED = 0;
+
+ #pragma data_seg ()
+
+ #pragma comment(linker, "/section:SHAREDDATA,rws")
+
static HANDLE g_mutex = NULL;
static HANDLE g_vchannel = NULL;
! DLL_EXPORT void
debug(char *format, ...)
{
***************
*** 45,57 ****
char buf[256];
- sprintf(buf, "DEBUG,");
-
va_start(argp, format);
! _vsnprintf(buf + sizeof("DEBUG,") - 1, sizeof(buf) - sizeof("DEBUG,") + 1, format, argp);
va_end(argp);
! vchannel_strfilter(buf + sizeof("DEBUG,"));
! vchannel_write(buf);
}
--- 60,70 ----
char buf[256];
va_start(argp, format);
! _vsnprintf(buf, sizeof(buf), format, argp);
va_end(argp);
! vchannel_strfilter(buf);
! vchannel_write("DEBUG", buf);
}
***************
*** 59,63 ****
static char convert_buffer[CONVERT_BUFFER_SIZE];
! const char *
unicode_to_utf8(const unsigned short *string)
{
--- 72,76 ----
static char convert_buffer[CONVERT_BUFFER_SIZE];
! DLL_EXPORT const char *
unicode_to_utf8(const unsigned short *string)
{
***************
*** 104,108 ****
}
! int
vchannel_open()
{
--- 117,121 ----
}
! DLL_EXPORT int
vchannel_open()
{
***************
*** 124,128 ****
}
! void
vchannel_close()
{
--- 137,141 ----
}
! DLL_EXPORT void
vchannel_close()
{
***************
*** 137,141 ****
}
! int
vchannel_is_open()
{
--- 150,154 ----
}
! DLL_EXPORT int
vchannel_is_open()
{
***************
*** 146,150 ****
}
! int
vchannel_read(char *line, size_t length)
{
--- 159,163 ----
}
! DLL_EXPORT int
vchannel_read(char *line, size_t length)
{
***************
*** 216,221 ****
}
! int
! vchannel_write(const char *format, ...)
{
BOOL result;
--- 229,234 ----
}
! DLL_EXPORT int
! vchannel_write(const char *command, const char *format, ...)
{
BOOL result;
***************
*** 227,239 ****
assert(vchannel_is_open());
va_start(argp, format);
! size = _vsnprintf(buf, sizeof(buf), format, argp);
va_end(argp);
assert(size < sizeof(buf));
- WaitForSingleObject(g_mutex, INFINITE);
result = WTSVirtualChannelWrite(g_vchannel, buf, (ULONG) strlen(buf), &bytes_written);
result = WTSVirtualChannelWrite(g_vchannel, "\n", (ULONG) 1, &bytes_written);
ReleaseMutex(g_mutex);
--- 240,260 ----
assert(vchannel_is_open());
+ WaitForSingleObject(g_mutex, INFINITE);
+
+ size = _snprintf(buf, sizeof(buf), "%s,%u,", command, g_vchannel_serial);
+
+ assert(size < sizeof(buf));
+
va_start(argp, format);
! size += _vsnprintf(buf + size, sizeof(buf) - size, format, argp);
va_end(argp);
assert(size < sizeof(buf));
result = WTSVirtualChannelWrite(g_vchannel, buf, (ULONG) strlen(buf), &bytes_written);
result = WTSVirtualChannelWrite(g_vchannel, "\n", (ULONG) 1, &bytes_written);
+
+ g_vchannel_serial++;
+
ReleaseMutex(g_mutex);
***************
*** 244,248 ****
}
! void
vchannel_block()
{
--- 265,269 ----
}
! DLL_EXPORT void
vchannel_block()
{
***************
*** 250,254 ****
}
! void
vchannel_unblock()
{
--- 271,275 ----
}
! DLL_EXPORT void
vchannel_unblock()
{
***************
*** 256,260 ****
}
! const char *
vchannel_strfilter(char *string)
{
--- 277,281 ----
}
! DLL_EXPORT const char *
vchannel_strfilter(char *string)
{
***************
*** 270,274 ****
}
! const char *
vchannel_strfilter_unicode(const unsigned short *string)
{
--- 291,295 ----
}
! DLL_EXPORT const char *
vchannel_strfilter_unicode(const unsigned short *string)
{
Index: vchannel.h
===================================================================
RCS file: /cvsroot/rdesktop/seamlessrdp/ServerExe/vchannel.h,v
retrieving revision 1.6
retrieving revision 1.7
diff -C2 -d -r1.6 -r1.7
*** vchannel.h 15 Mar 2006 13:19:53 -0000 1.6
--- vchannel.h 20 Mar 2006 10:30:25 -0000 1.7
***************
*** 23,46 ****
#define __VCHANNEL_H__
#define VCHANNEL_MAX_LINE 1024
! void debug(char *format, ...);
! const char *unicode_to_utf8(const unsigned short *string);
! int vchannel_open();
! void vchannel_close();
! int vchannel_is_open();
/* read may only be used by a single process. write is completely safe */
! int vchannel_read(char *line, size_t length);
! int vchannel_write(const char *format, ...);
! void vchannel_block();
! void vchannel_unblock();
! const char *vchannel_strfilter(char *string);
! const char *vchannel_strfilter_unicode(const unsigned short *string);
#endif
--- 23,48 ----
#define __VCHANNEL_H__
+ #define DLL_EXPORT __declspec(dllexport)
+
#define VCHANNEL_MAX_LINE 1024
! DLL_EXPORT void debug(char *format, ...);
! DLL_EXPORT const char *unicode_to_utf8(const unsigned short *string);
! DLL_EXPORT int vchannel_open();
! DLL_EXPORT void vchannel_close();
! DLL_EXPORT int vchannel_is_open();
/* read may only be used by a single process. write is completely safe */
! DLL_EXPORT int vchannel_read(char *line, size_t length);
! DLL_EXPORT int vchannel_write(const char *command, const char *format, ...);
! DLL_EXPORT void vchannel_block();
! DLL_EXPORT void vchannel_unblock();
! DLL_EXPORT const char *vchannel_strfilter(char *string);
! DLL_EXPORT const char *vchannel_strfilter_unicode(const unsigned short *string);
#endif
-------------------------------------------------------
This SF.Net email is sponsored by xPML, a groundbreaking scripting language
that extends applications into web and mobile media. Attend the live webcast
and join the prime developer group breaking into this new coding territory!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642