CVS: seamlessrdp/ServerExe/HookDll hookdll.c,1.2,1.3 hookdll.vcproj,1.2,1.3 hookdll.h,1.11,NONE

Pierre Ossman <[email protected]>
Newsgroups gmane.network.rdesktop.cvs
Message-ID <[email protected]>
Update of /cvsroot/rdesktop/seamlessrdp/ServerExe/HookDll
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv3038/HookDll

Modified Files:
	hookdll.c hookdll.vcproj 
Removed Files:
	hookdll.h 
Log Message:
Put virtual channel handling into a separate file since both the DLL and
the main program will use it.


Index: hookdll.c
===================================================================
RCS file: /cvsroot/rdesktop/seamlessrdp/ServerExe/HookDll/hookdll.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** hookdll.c	9 Mar 2006 12:00:15 -0000	1.2
--- hookdll.c	9 Mar 2006 12:26:31 -0000	1.3
***************
*** 28,35 ****
  #include <windows.h>
  #include <winuser.h>
- #include <wtsapi32.h>
- #include <cchannel.h>
  
! #include "hookdll.h"
  
  #define DLL_EXPORT __declspec(dllexport)
--- 28,33 ----
  #include <windows.h>
  #include <winuser.h>
  
! #include "../vchannel.h"
  
  #define DLL_EXPORT __declspec(dllexport)
***************
*** 52,72 ****
  static HANDLE g_mutex = NULL;
  
- static HANDLE g_vchannel = NULL;
- 
- static void
- debug(char *format, ...)
- {
- 	va_list argp;
- 	char buf[256];
- 
- 	sprintf(buf, "DEBUG1,");
- 
- 	va_start(argp, format);
- 	_vsnprintf(buf + sizeof("DEBUG1,") - 1, sizeof(buf) - sizeof("DEBUG1,") + 1, format, argp);
- 	va_end(argp);
- 
- 	vchannel_write(buf);
- }
- 
  static LRESULT CALLBACK
  wndproc_hook_proc(int code, WPARAM cur_thread, LPARAM details)
--- 50,53 ----
***************
*** 220,289 ****
  }
  
- int
- vchannel_open()
- {
- 	g_vchannel = WTSVirtualChannelOpen(WTS_CURRENT_SERVER_HANDLE,
- 					   WTS_CURRENT_SESSION, CHANNELNAME);
- 
- 	if (g_vchannel == NULL)
- 		return 0;
- 	else
- 		return 1;
- }
- 
- int
- vchannel_close()
- {
- 	BOOL result;
- 
- 	result = WTSVirtualChannelClose(g_vchannel);
- 
- 	g_vchannel = NULL;
- 
- 	if (result)
- 		return 1;
- 	else
- 		return 0;
- }
- 
- int
- vchannel_is_open()
- {
- 	if (g_vchannel == NULL)
- 		return 0;
- 	else
- 		return 1;
- }
- 
- int
- vchannel_write(char *format, ...)
- {
- 	BOOL result;
- 	va_list argp;
- 	char buf[1024];
- 	int size;
- 	ULONG bytes_written;
- 
- 	if (!vchannel_is_open())
- 		return 1;
- 
- 	va_start(argp, format);
- 	size = _vsnprintf(buf, sizeof(buf), format, argp);
- 	va_end(argp);
- 
- 	if (size >= sizeof(buf))
- 		return 0;
- 
- 	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);
- 
- 	if (result)
- 		return 1;
- 	else
- 		return 0;
- }
- 
  DLL_EXPORT void
  SetHooks(void)
--- 201,204 ----
***************
*** 321,325 ****
  			g_instance = hinstDLL;
  
! 			g_mutex = CreateMutex(NULL, FALSE, "Local\\Seamless");
  			if (!g_mutex)
  				return FALSE;
--- 236,240 ----
  			g_instance = hinstDLL;
  
! 			g_mutex = CreateMutex(NULL, FALSE, "Local\\SeamlessDLL");
  			if (!g_mutex)
  				return FALSE;

Index: hookdll.vcproj
===================================================================
RCS file: /cvsroot/rdesktop/seamlessrdp/ServerExe/HookDll/hookdll.vcproj,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** hookdll.vcproj	9 Mar 2006 09:46:30 -0000	1.2
--- hookdll.vcproj	9 Mar 2006 12:26:31 -0000	1.3
***************
*** 126,130 ****
  		</File>
  		<File
! 			RelativePath="hookdll.h">
  		</File>
  	</Files>
--- 126,133 ----
  		</File>
  		<File
! 			RelativePath="..\vchannel.c">
! 		</File>
! 		<File
! 			RelativePath="..\vchannel.h">
  		</File>
  	</Files>

--- hookdll.h DELETED ---



-------------------------------------------------------
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
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.