/[rdesktop]/sourceforge.net/trunk/seamlessrdp/ServerExe/HookDll/hookdll.cpp
This is repository of my old source code which isn't updated any more. Go to git.rot13.org for current projects!
ViewVC logotype

Annotation of /sourceforge.net/trunk/seamlessrdp/ServerExe/HookDll/hookdll.cpp

Parent Directory Parent Directory | Revision Log Revision Log


Revision 997 - (hide annotations)
Mon Aug 29 09:31:51 2005 UTC (18 years, 9 months ago) by astrand
File size: 18305 byte(s)
Added hack to silence WM_WINDOWPOSCHANGED for the language bar and the
Office XP speech/handwriting recognition.

1 astrand 930 //
2 astrand 938 // Copyright (C) 2004-2005 Martin Wickett
3 astrand 930 //
4    
5     #include "hookdll.h"
6     #include <windows.h>
7     #include <winuser.h>
8 astrand 995 #include <stdio.h>
9 astrand 930
10     #include "wtsapi32.h"
11     #include "Cchannel.h"
12    
13 astrand 993 #define DLL_EXPORT extern "C" __declspec(dllexport)
14 astrand 930
15     // Shared DATA
16     #pragma data_seg ( "SHAREDDATA" )
17    
18 astrand 937 // this is the total number of processes this dll is currently attached to
19 astrand 933 int iInstanceCount = 0;
20     HWND hWnd = 0;
21 astrand 930
22     #pragma data_seg ()
23    
24     #pragma comment(linker, "/section:SHAREDDATA,rws")
25    
26 astrand 933 bool bHooked = false;
27     bool bHooked2 = false;
28     bool bHooked3 = false;
29 astrand 994 HHOOK hhook = 0; //cbt
30     HHOOK hhook2 = 0; //shell
31     HHOOK hhook3 = 0; //wnd proc
32 astrand 933 HINSTANCE hInst = 0;
33     HANDLE m_vcHandle = 0;
34 astrand 930
35 astrand 994 BOOL APIENTRY DllMain( HINSTANCE hinstDLL, DWORD ul_reason_for_call, LPVOID lpReserved )
36 astrand 930 {
37 astrand 993 switch ( ul_reason_for_call ) {
38     case DLL_PROCESS_ATTACH: {
39 astrand 933 // remember our instance handle
40     hInst = hinstDLL;
41     ++iInstanceCount;
42     OpenVirtualChannel();
43     break;
44     }
45 astrand 993
46     case DLL_THREAD_ATTACH:
47 astrand 933 break;
48 astrand 993 case DLL_THREAD_DETACH:
49 astrand 933 break;
50 astrand 993 case DLL_PROCESS_DETACH: {
51 astrand 933 --iInstanceCount;
52     CloseVirtualChannel();
53     }
54     break;
55 astrand 930 }
56 astrand 993
57 astrand 930 return TRUE;
58     }
59    
60 astrand 993 LRESULT CALLBACK CallWndProc( int nCode, WPARAM wParam, LPARAM lParam )
61 astrand 930 {
62 astrand 993 if ( nCode < 0 ) {
63     return CallNextHookEx( hhook3, nCode, wParam, lParam );
64 astrand 933 }
65 astrand 993
66 astrand 933 PCHAR buffer = NULL;
67 astrand 993 char windowTitle[ 150 ] = { ""
68     };
69 astrand 933 HWND windowHandle = NULL;
70 astrand 994 HWND windowHandle2 = NULL;
71 astrand 993 char result[ 255 ] = { ""
72     };
73     char strWindowId[ 25 ];
74     char type[ 25 ];
75    
76 astrand 933 LONG b, t, l, r;
77 astrand 994 char strX[ 5 ];
78     char strY[ 5 ];
79     char strW[ 5 ];
80     char strH[ 5 ];
81 astrand 933 RECT rect;
82 astrand 993
83     CWPSTRUCT *details = ( CWPSTRUCT * ) lParam;
84 astrand 995 CREATESTRUCT *cs = ( CREATESTRUCT * ) details->lParam;
85     LONG dwStyle = GetWindowLong( details->hwnd, GWL_STYLE );
86 astrand 997 WINDOWPOS *wp = (WINDOWPOS *) details->lParam;
87 astrand 993
88     switch ( details->message ) {
89     case WM_SIZING:
90 astrand 994 windowHandle = details->hwnd;
91     //get win name
92     GetWindowText( windowHandle, windowTitle, 150 );
93    
94     //get an id for it
95     itoa( ( int ) windowHandle, strWindowId, 10 );
96    
97     //get coords
98     GetWindowRect( windowHandle, &rect );
99     b = rect.bottom;
100     t = rect.top;
101     l = rect.left;
102     r = rect.right;
103     ltoa( b - t, strH, 10 );
104     ltoa( t, strY, 10 );
105     ltoa( r - l, strW, 10 );
106     ltoa( l, strX, 10 );
107    
108     ////setup return string
109     strcat( result, "MSG=CALLWNDPROC_WM_SIZING;OP=6;" );
110     strcat( result, "ID=" );
111     strcat( result, strWindowId );
112     strcat( result, ";" );
113     strcat( result, "TITLE=" );
114     strcat( result, windowTitle );
115     strcat( result, ";" );
116     strcat( result, "X=" );
117     strcat( result, strX );
118     strcat( result, ";" );
119     strcat( result, "Y=" );
120     strcat( result, strY );
121     strcat( result, ";" );
122     strcat( result, "H=" );
123     strcat( result, strH );
124     strcat( result, ";" );
125     strcat( result, "W=" );
126     strcat( result, strW );
127     strcat( result, "." );
128    
129     buffer = result;
130    
131     break;
132 astrand 993 case WM_MOVING:
133    
134 astrand 933 windowHandle = details->hwnd;
135     //get win name
136 astrand 993 GetWindowText( windowHandle, windowTitle, 150 );
137    
138 astrand 933 //get an id for it
139 astrand 993 itoa( ( int ) windowHandle, strWindowId, 10 );
140    
141 astrand 933 //get coords
142 astrand 993 GetWindowRect( windowHandle, &rect );
143 astrand 933 b = rect.bottom;
144     t = rect.top;
145     l = rect.left;
146     r = rect.right;
147 astrand 994 ltoa( b - t, strH, 10 );
148     ltoa( t, strY, 10 );
149     ltoa( r - l, strW, 10 );
150     ltoa( l, strX, 10 );
151 astrand 993
152 astrand 933 ////setup return string
153 astrand 994 strcat( result, "MSG=CALLWNDPROC_WM_MOVING;OP=2;" );
154 astrand 993 strcat( result, "ID=" );
155     strcat( result, strWindowId );
156     strcat( result, ";" );
157     strcat( result, "TITLE=" );
158     strcat( result, windowTitle );
159     strcat( result, ";" );
160 astrand 994 strcat( result, "X=" );
161     strcat( result, strX );
162 astrand 993 strcat( result, ";" );
163 astrand 994 strcat( result, "Y=" );
164     strcat( result, strY );
165     strcat( result, ";" );
166     strcat( result, "H=" );
167     strcat( result, strH );
168     strcat( result, ";" );
169     strcat( result, "W=" );
170     strcat( result, strW );
171     strcat( result, "." );
172 astrand 993
173 astrand 933 buffer = result;
174 astrand 993
175 astrand 933 break;
176 astrand 993
177 astrand 994 case WM_WINDOWPOSCHANGED:
178    
179     windowHandle = details->hwnd;
180     //windowHandle2 = details->hwndInsertAfter;
181     //get win name
182     GetWindowText( windowHandle, windowTitle, 150 );
183    
184     //get an id for it
185     itoa( ( int ) windowHandle, strWindowId, 10 );
186    
187     //get coords
188     GetWindowRect( windowHandle, &rect );
189     b = rect.bottom;
190     t = rect.top;
191     l = rect.left;
192     r = rect.right;
193     ltoa( b - t, strH, 10 );
194     ltoa( t, strY, 10 );
195     ltoa( r - l, strW, 10 );
196     ltoa( l, strX, 10 );
197 astrand 997
198     // FIXME: This is a crude hack to shut up the language bar and
199     // the Office XP speech/handwriting recognition.
200     if (!strcmp(windowTitle, "TF_FloatingLangBar_WndTitle") ||
201     !strcmp(windowTitle, "CiceroUIWndFrame")) {
202     break;
203     }
204 astrand 994
205     ////setup return string
206 astrand 997 //sprintf( result, "WM_WINDOWPOSCHANGED: title=%s, flags=0x%lx", windowTitle, wp->flags);
207 astrand 994 strcat( result, "MSG=CALLWNDPROC_WM_WINDOWPOSCHANGED;OP=8;" );
208     strcat( result, "ID=" );
209     strcat( result, strWindowId );
210     strcat( result, ";" );
211     strcat( result, "TITLE=" );
212     strcat( result, windowTitle );
213     strcat( result, ";" );
214     strcat( result, "X=" );
215     strcat( result, strX );
216     strcat( result, ";" );
217     strcat( result, "Y=" );
218     strcat( result, strY );
219     strcat( result, ";" );
220     strcat( result, "H=" );
221     strcat( result, strH );
222     strcat( result, ";" );
223     strcat( result, "W=" );
224     strcat( result, strW );
225     strcat( result, "." );
226    
227     buffer = result;
228    
229     break;
230    
231 astrand 995
232     case WM_CREATE:
233     if ( cs->style & WS_DLGFRAME ) {
234     sprintf( result, "DEBUG:WM_CREATE:%dx%d at %d,%d, title=%s, menu=%p, window=%p, WS_BORDER=%d, WS_DLGFRAME=%d, WS_POPUP=%d",
235     cs->cx, cs->cy, cs->x, cs->y, cs->lpszName, cs->hMenu, details->hwnd,
236     cs->style & WS_BORDER, cs->style & WS_DLGFRAME,
237     cs->style & WS_POPUP );
238     buffer = result;
239     }
240    
241     break;
242    
243    
244     case WM_DESTROY:
245     if ( dwStyle & WS_DLGFRAME ) {
246     sprintf( result, "WM_DESTROY:%p", details->hwnd );
247     buffer = result;
248     }
249    
250     break;
251    
252 astrand 993 default:
253 astrand 933 break;
254     }
255 astrand 993
256     if ( ChannelIsOpen() ) {
257     if ( buffer != NULL ) {
258     WriteToChannel( buffer );
259 astrand 933 }
260     }
261 astrand 993
262     return CallNextHookEx( hhook3, nCode, wParam, lParam );
263 astrand 930 }
264    
265 astrand 993 LRESULT CALLBACK CbtProc( int nCode, WPARAM wParam, LPARAM lParam )
266 astrand 930 {
267 astrand 993 if ( nCode < 0 ) {
268     return CallNextHookEx( hhook, nCode, wParam, lParam );
269 astrand 933 }
270 astrand 993
271    
272 astrand 933 PCHAR buffer = NULL;
273 astrand 993
274    
275     char windowTitle[ 150 ] = { ""
276     };
277 astrand 933 HWND windowHandle = NULL;
278 astrand 993 char result[ 255 ] = { ""
279     };
280     char strWindowId[ 25 ];
281     char type[ 25 ];
282    
283    
284 astrand 933 LONG b, t, l, r;
285 astrand 994 char strW[ 5 ];
286     char strY[ 5 ];
287     char strX[ 5 ];
288     char strH[ 5 ];
289 astrand 933 RECT rect;
290 astrand 993
291 astrand 994 int i = 0; //tmp
292 astrand 993
293     switch ( nCode ) {
294     case HCBT_MINMAX:
295    
296     windowHandle = ( HWND ) wParam;
297 astrand 933 //get win name
298 astrand 993 GetWindowText( windowHandle, windowTitle, 150 );
299    
300 astrand 933 //get an id for it
301 astrand 993 itoa( ( int ) windowHandle, strWindowId, 10 );
302    
303 astrand 933 //get operation type(min,max). if max, do not clip at all,if min use window's previous coords
304     //codes are:
305 astrand 993
306 astrand 937 // SW_HIDE= 0 SW_SHOWNORMAL=1 SW_NORMAL=1 SW_SHOWMINIMIZED=2 SW_SHOWMAXIMIZED=3 SW_MAXIMIZE=3
307     // SW_SHOWNOACTIVATE=4 SW_SHOW=5 SW_MINIMIZE=6 SW_SHOWMINNOACTIVE=7 SW_SHOWNA=8 SW_RESTORE=9
308     // SW_SHOWDEFAULT=10 SW_FORCEMINIMIZE=11 SW_MAX=11
309 astrand 993
310     itoa( ( int ) lParam, type, 10 );
311    
312 astrand 933 //get coords
313 astrand 993 GetWindowRect( windowHandle, &rect );
314 astrand 933 b = rect.bottom;
315     t = rect.top;
316     l = rect.left;
317     r = rect.right;
318 astrand 994 ltoa( b - t, strW, 10 );
319     ltoa( t, strY, 10 );
320     ltoa( r - l, strH, 10 );
321     ltoa( l, strX, 10 );
322 astrand 993
323 astrand 933 //get name
324 astrand 993 GetWindowText( windowHandle, windowTitle, 150 );
325    
326 astrand 933 ////setup return string
327 astrand 994 strcat( result, "MSG=HCBT_MINMAX;OP=4;" );
328    
329     // SW_SHOWNOACTIVATE=4 SW_SHOW=5 SW_MINIMIZE=6 SW_SHOWMINNOACTIVE=7 SW_SHOWNA=8 SW_RESTORE=9
330     // SW_SHOWDEFAULT=10 SW_FORCEMINIMIZE=11 SW_MAX=11
331 astrand 993 strcat( result, "ID=" );
332     strcat( result, strWindowId );
333     strcat( result, ";" );
334     strcat( result, "TITLE=" );
335     strcat( result, windowTitle );
336     strcat( result, ";" );
337 astrand 994 strcat( result, "X=" );
338     strcat( result, strX );
339 astrand 993 strcat( result, ";" );
340 astrand 994 strcat( result, "Y=" );
341     strcat( result, strY );
342     strcat( result, ";" );
343     strcat( result, "H=" );
344     strcat( result, strH );
345     strcat( result, ";" );
346     strcat( result, "W=" );
347     strcat( result, strW );
348     strcat( result, ";" );
349 astrand 993 strcat( result, "TYPE=" );
350     strcat( result, type );
351 astrand 994 strcat( result, "." );
352 astrand 993
353 astrand 933 //-------------------------------------------------------------------------------------------------
354     // code to prevent minimising windows (can be removed once minimise has been implemented)
355 astrand 994 //i = (int)lParam;
356 astrand 933 //if (i==0 || i==2 || i==6 || i==7 || i==8 || i==11)
357 astrand 994 //if ( i==2 || i==6 )
358     //{
359     // MessageBox(0,"Minimising windows is not allowed in this version. Sorry!","TS Window Clipper", MB_OK);
360     // return 1;
361     //}
362 astrand 933 //-----------------------------------------------------------------------------------------
363 astrand 993
364 astrand 933 //-------------------------------------------------------------------------------------------------
365     // code to prevent maximising windows (can be removed once maximise has been implemented)
366 astrand 994 //i = (int)lParam;
367 astrand 933 //if (i==3 || i==9 || i==11)
368 astrand 994 //if (i==3 || i==11)
369     //{
370     // MessageBox(0,"Maximising windows is not allowed in this version. Sorry!","TS Window Clipper", MB_OK);
371     // return 1;
372     //}
373 astrand 933 //-----------------------------------------------------------------------------------------
374 astrand 993
375 astrand 933 buffer = result;
376 astrand 993
377 astrand 933 break;
378 astrand 993
379     case HCBT_MOVESIZE:
380    
381     windowHandle = ( HWND ) wParam;
382 astrand 933 //get win name
383 astrand 993 GetWindowText( windowHandle, windowTitle, 150 );
384    
385 astrand 933 //get an id for it
386 astrand 993 itoa( ( int ) windowHandle, strWindowId, 10 );
387    
388 astrand 933 //get coords
389 astrand 993 GetWindowRect( windowHandle, &rect );
390 astrand 933 b = rect.bottom;
391     t = rect.top;
392     l = rect.left;
393     r = rect.right;
394 astrand 994 ltoa( b - t, strH, 10 );
395     ltoa( t, strY, 10 );
396     ltoa( r - l, strW, 10 );
397     ltoa( l, strX, 10 );
398 astrand 993
399 astrand 933 //get name
400 astrand 993 GetWindowText( windowHandle, windowTitle, 150 );
401    
402 astrand 933 ////setup return string
403 astrand 994 strcat( result, "MSG=HCBT_MOVESIZE;OP=5;" );
404 astrand 993 strcat( result, "ID=" );
405     strcat( result, strWindowId );
406     strcat( result, ";" );
407     strcat( result, "TITLE=" );
408     strcat( result, windowTitle );
409     strcat( result, ";" );
410 astrand 994 strcat( result, "X=" );
411     strcat( result, strX );
412 astrand 993 strcat( result, ";" );
413 astrand 994 strcat( result, "Y=" );
414     strcat( result, strY );
415     strcat( result, ";" );
416     strcat( result, "H=" );
417     strcat( result, strH );
418     strcat( result, ";" );
419     strcat( result, "W=" );
420     strcat( result, strW );
421     strcat( result, "." );
422 astrand 993
423 astrand 933 buffer = result;
424 astrand 993
425 astrand 933 break;
426 astrand 993 case HCBT_SETFOCUS:
427 astrand 933 //buffer = "HCBT_SETFOCUS";
428     //not needed yet
429     break;
430 astrand 993 default:
431 astrand 933 break;
432     }
433 astrand 993
434     if ( ChannelIsOpen() ) {
435     if ( buffer != NULL ) {
436     WriteToChannel( buffer );
437 astrand 933 }
438     }
439 astrand 993
440     return CallNextHookEx( hhook, nCode, wParam, lParam );
441 astrand 930 }
442    
443    
444 astrand 993 LRESULT CALLBACK ShellProc( int nCode, WPARAM wParam, LPARAM lParam )
445 astrand 930 {
446 astrand 993 if ( nCode < 0 ) {
447     return CallNextHookEx( hhook, nCode, wParam, lParam );
448 astrand 933 }
449 astrand 993
450     if ( ChannelIsOpen() ) {
451 astrand 933 PCHAR buffer = NULL;
452 astrand 993
453     char windowTitle[ 150 ] = { ""
454     };
455 astrand 933 HWND windowHandle = NULL;
456 astrand 993 char result[ 255 ] = { ""
457     };
458     char strWindowId[ 25 ];
459 astrand 933 LONG b, t, l, r;
460 astrand 994 char strW[ 5 ];
461     char strY[ 5 ];
462     char strX[ 5 ];
463     char strH[ 5 ];
464 astrand 933 RECT rect;
465 astrand 993
466     switch ( nCode ) {
467     case HSHELL_WINDOWCREATED:
468    
469 astrand 933 //get window id
470 astrand 993 windowHandle = ( HWND ) wParam;
471     itoa( ( int ) windowHandle, strWindowId, 10 );
472    
473 astrand 933 //get coords
474 astrand 993 GetWindowRect( windowHandle, &rect );
475 astrand 933 b = rect.bottom;
476     t = rect.top;
477     l = rect.left;
478     r = rect.right;
479 astrand 994 ltoa( b - t, strH, 10 );
480     ltoa( t, strY, 10 );
481     ltoa( r - l, strW, 10 );
482     ltoa( l, strX, 10 );
483 astrand 993
484 astrand 933 //get name
485 astrand 993 GetWindowText( windowHandle, windowTitle, 150 );
486    
487 astrand 933 ////setup return string
488 astrand 994 strcat( result, "MSG=HSHELL_WINDOWCREATED;OP=0;" );
489 astrand 993 strcat( result, "ID=" );
490     strcat( result, strWindowId );
491     strcat( result, ";" );
492     strcat( result, "TITLE=" );
493     strcat( result, windowTitle );
494     strcat( result, ";" );
495 astrand 994 strcat( result, "X=" );
496     strcat( result, strX );
497 astrand 993 strcat( result, ";" );
498 astrand 994 strcat( result, "Y=" );
499     strcat( result, strY );
500     strcat( result, ";" );
501     strcat( result, "H=" );
502     strcat( result, strH );
503     strcat( result, ";" );
504     strcat( result, "W=" );
505     strcat( result, strW );
506     strcat( result, "." );
507 astrand 993
508 astrand 933 buffer = result;
509 astrand 993
510 astrand 933 break;
511 astrand 993
512     case HSHELL_WINDOWDESTROYED:
513    
514 astrand 933 //get window id
515 astrand 993 windowHandle = ( HWND ) wParam;
516     itoa( ( int ) windowHandle, strWindowId, 10 );
517    
518 astrand 994 //get coords
519     GetWindowRect( windowHandle, &rect );
520     b = rect.bottom;
521     t = rect.top;
522     l = rect.left;
523     r = rect.right;
524     ltoa( b - t, strH, 10 );
525     ltoa( t, strY, 10 );
526     ltoa( r - l, strW, 10 );
527     ltoa( l, strX, 10 );
528    
529 astrand 933 //get name
530 astrand 993 GetWindowText( windowHandle, windowTitle, 150 );
531    
532 astrand 933 ////setup return string
533 astrand 994 strcat( result, "MSG=HSHELL_WINDOWDESTROYED;OP=1;" );
534 astrand 993 strcat( result, "ID=" );
535     strcat( result, strWindowId );
536     strcat( result, ";" );
537     strcat( result, "TITLE=" );
538     strcat( result, windowTitle );
539     strcat( result, ";" );
540 astrand 994 strcat( result, "X=" );
541     strcat( result, strX );
542     strcat( result, ";" );
543     strcat( result, "Y=" );
544     strcat( result, strY );
545     strcat( result, ";" );
546     strcat( result, "H=" );
547     strcat( result, strH );
548     strcat( result, ";" );
549     strcat( result, "W=" );
550     strcat( result, strW );
551     strcat( result, "." );
552 astrand 993
553 astrand 933 buffer = result;
554 astrand 993
555 astrand 933 break;
556 astrand 993 default:
557 astrand 933 break;
558     }
559 astrand 993
560     if ( buffer != NULL ) {
561     WriteToChannel( buffer );
562 astrand 933 }
563     }
564 astrand 993
565     return CallNextHookEx( hhook, nCode, wParam, lParam );
566 astrand 930 }
567    
568 astrand 993 DLL_EXPORT void SetCbtHook( void )
569 astrand 930 {
570 astrand 993 if ( !bHooked ) {
571 astrand 994 hhook = SetWindowsHookEx( WH_CBT, ( HOOKPROC ) CbtProc, hInst, ( DWORD ) NULL );
572 astrand 933 bHooked = true;
573     }
574 astrand 993
575     if ( !bHooked2 ) {
576 astrand 994 hhook2 = SetWindowsHookEx( WH_SHELL, ( HOOKPROC ) ShellProc, hInst, ( DWORD ) NULL );
577 astrand 933 bHooked2 = true;
578     }
579 astrand 993
580     if ( !bHooked3 ) {
581 astrand 994 hhook3 = SetWindowsHookEx( WH_CALLWNDPROC, ( HOOKPROC ) CallWndProc, hInst, ( DWORD ) NULL );
582 astrand 933 bHooked3 = true;
583     }
584 astrand 930 }
585    
586 astrand 993 DLL_EXPORT void RemoveCbtHook( void )
587 astrand 930 {
588 astrand 993 if ( bHooked ) {
589     UnhookWindowsHookEx( hhook );
590 astrand 933 bHooked = false;
591     }
592 astrand 993
593     if ( bHooked2 ) {
594     UnhookWindowsHookEx( hhook2 );
595 astrand 933 bHooked2 = false;
596     }
597 astrand 993
598     if ( bHooked3 ) {
599     UnhookWindowsHookEx( hhook3 );
600 astrand 933 bHooked3 = false;
601     }
602 astrand 930 }
603    
604     DLL_EXPORT int GetInstanceCount()
605     {
606 astrand 933 return iInstanceCount;
607 astrand 930 }
608    
609     int OpenVirtualChannel()
610     {
611 astrand 994 m_vcHandle = WTSVirtualChannelOpen( WTS_CURRENT_SERVER_HANDLE, WTS_CURRENT_SESSION, CHANNELNAME );
612    
613 astrand 993 if ( m_vcHandle == NULL ) {
614 astrand 933 return 0;
615 astrand 937 } else {
616 astrand 933 return 1;
617     }
618 astrand 930 }
619    
620     int CloseVirtualChannel()
621     {
622 astrand 993 BOOL result = WTSVirtualChannelClose( m_vcHandle );
623    
624 astrand 933 m_vcHandle = NULL;
625 astrand 993
626     if ( result ) {
627 astrand 933 return 1;
628 astrand 937 } else {
629 astrand 933 return 0;
630     }
631 astrand 930 }
632    
633     int ChannelIsOpen()
634     {
635 astrand 993 if ( m_vcHandle == NULL ) {
636 astrand 933 return 0;
637 astrand 937 } else {
638 astrand 933 return 1;
639     }
640 astrand 930 }
641    
642 astrand 993 int WriteToChannel( PCHAR buffer )
643 astrand 930 {
644 astrand 933 PULONG bytesRead = 0;
645     PULONG pBytesWritten = 0;
646 astrand 993
647 astrand 994 BOOL result = WTSVirtualChannelWrite( m_vcHandle, buffer, ( ULONG ) strlen( buffer ), pBytesWritten );
648    
649 astrand 993 if ( result ) {
650 astrand 933 return 1;
651 astrand 937 } else {
652 astrand 933 return 0;
653     }
654 astrand 930 }

  ViewVC Help
Powered by ViewVC 1.1.26