/[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

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

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1066 by ossman_, Wed Mar 8 16:55:02 2006 UTC revision 1067 by ossman_, Wed Mar 8 17:14:42 2006 UTC
# Line 38  void SendDebug( char *format, ... ) Line 38  void SendDebug( char *format, ... )
38      va_list argp;      va_list argp;
39      char buf [ 256 ];      char buf [ 256 ];
40    
41        sprintf( buf, "DEBUG1," );
42    
43      va_start( argp, format );      va_start( argp, format );
44      vsprintf( buf, format, argp );      vsnprintf( buf + sizeof( "DEBUG1," ) - 1,
45                   sizeof( buf ) - sizeof( "DEBUG1," ) + 1, format, argp );
46      va_end( argp );      va_end( argp );
47    
     WriteToChannel( "DEBUG1," );  
48      WriteToChannel( buf );      WriteToChannel( buf );
     WriteToChannel( "\n" );  
49  }  }
50    
51    
# Line 117  LRESULT CALLBACK CallWndProc( int nCode, Line 118  LRESULT CALLBACK CallWndProc( int nCode,
118          if ( wp->flags & SWP_SHOWWINDOW ) {          if ( wp->flags & SWP_SHOWWINDOW ) {
119              // FIXME: Now, just like create!              // FIXME: Now, just like create!
120              SendDebug("SWP_SHOWWINDOW for %p!", details->hwnd);              SendDebug("SWP_SHOWWINDOW for %p!", details->hwnd);
121                WriteToChannel( "CREATE1,0x%p,0x%x", details->hwnd, 0 );
             snprintf( result, sizeof( result ),  
                       "CREATE1,0x%p,0x%x\n",  
                       details->hwnd, 0 );  
             result[ sizeof( result ) - 1 ] = '\0';  
             WriteToChannel( result );  
122    
123              // FIXME: SETSTATE              // FIXME: SETSTATE
124    
# Line 130  LRESULT CALLBACK CallWndProc( int nCode, Line 126  LRESULT CALLBACK CallWndProc( int nCode,
126                  SendDebug( "GetWindowRect failed!\n" );                  SendDebug( "GetWindowRect failed!\n" );
127                  break;                  break;
128              }              }
129              snprintf( result, sizeof( result ),              WriteToChannel( "POSITION1,0x%p,%d,%d,%d,%d,0x%x",
130                        "POSITION1,0x%p,%d,%d,%d,%d,0x%x\n",                              details->hwnd,
131                        details->hwnd,                              rect.left, rect.top,
132                        rect.left, rect.top,                              rect.right - rect.left,
133                        rect.right - rect.left,                              rect.bottom - rect.top,
134                        rect.bottom - rect.top,                              0 );
                       0 );  
             result[ sizeof( result ) - 1 ] = '\0';  
             WriteToChannel( result );  
   
135          }          }
136    
137    
138          if ( wp->flags & SWP_HIDEWINDOW ) {          if ( wp->flags & SWP_HIDEWINDOW )
139              snprintf( result, sizeof( result ),              WriteToChannel( "DESTROY1,0x%p,0x%x", details->hwnd, 0 );
                       "DESTROY1,0x%p,0x%x\n",  
                       details->hwnd, 0 );  
             result[ sizeof( result ) - 1 ] = '\0';  
             WriteToChannel( result );  
   
         }  
140    
141    
142          if ( !( dwStyle & WS_VISIBLE ) )          if ( !( dwStyle & WS_VISIBLE ) )
# Line 164  LRESULT CALLBACK CallWndProc( int nCode, Line 150  LRESULT CALLBACK CallWndProc( int nCode,
150              break;              break;
151          }          }
152    
153          snprintf( result, sizeof( result ),          WriteToChannel( "POSITION1,0x%p,%d,%d,%d,%d,0x%x",
154                    "POSITION1,0x%p,%d,%d,%d,%d,0x%x\n",                          details->hwnd,
155                    details->hwnd,                          rect.left, rect.top,
156                    rect.left, rect.top,                          rect.right - rect.left,
157                    rect.right - rect.left,                          rect.bottom - rect.top,
158                    rect.bottom - rect.top,                          0 );
                   0 );  
         result[ sizeof( result ) - 1 ] = '\0';  
         WriteToChannel( result );  
159    
160          break;          break;
161    
# Line 192  LRESULT CALLBACK CallWndProc( int nCode, Line 175  LRESULT CALLBACK CallWndProc( int nCode,
175          if ( !( dwStyle & WS_VISIBLE ) )          if ( !( dwStyle & WS_VISIBLE ) )
176              break;              break;
177    
178          if ( !( wp->flags & SWP_NOZORDER ) ) {          if ( !( wp->flags & SWP_NOZORDER ) )
179              snprintf( result, sizeof( result ),              WriteToChannel( "ZCHANGE1,0x%p,0x%p,0x%x",
180                        "ZCHANGE1,0x%p,0x%p,0x%x\n",                              details->hwnd,
181                        details->hwnd,                              wp->flags & SWP_NOACTIVATE ? wp->hwndInsertAfter : 0,
182                        wp->flags & SWP_NOACTIVATE ? wp->hwndInsertAfter : 0,                              0 );
183                        0 );  
             result[ sizeof( result ) - 1 ] = '\0';  
             WriteToChannel( result );  
         }  
184          break;          break;
185    
186    
# Line 210  LRESULT CALLBACK CallWndProc( int nCode, Line 190  LRESULT CALLBACK CallWndProc( int nCode,
190          if ( dwStyle & WS_CHILD)          if ( dwStyle & WS_CHILD)
191              break;              break;
192    
193          snprintf( result, sizeof( result ),          WriteToChannel( "DESTROY1,0x%p,0x%x", details->hwnd, 0 );
                   "DESTROY1,0x%p,0x%x\n",  
                   details->hwnd, 0 );  
         result[ sizeof( result ) - 1 ] = '\0';  
         WriteToChannel( result );  
194    
195          break;          break;
196    
# Line 248  LRESULT CALLBACK CbtProc( int nCode, WPA Line 224  LRESULT CALLBACK CbtProc( int nCode, WPA
224    
225          GetWindowText( ( HWND ) wParam, windowTitle, 150 );          GetWindowText( ( HWND ) wParam, windowTitle, 150 );
226    
227          snprintf( result, sizeof( result ),          WriteToChannel( "SETSTATE1,0x%p,%s,0x%x,0x%x",
228                    "SETSTATE1,0x%p,%s,0x%x,0x%x\n",                          ( HWND ) wParam,
229                    ( HWND ) wParam,                          windowTitle,
230                    windowTitle,                          LOWORD( lParam ),
231                    LOWORD( lParam ),                          0 );
                   0 );  
         result[ sizeof( result ) - 1 ] = '\0';  
         WriteToChannel( result );  
232          break;          break;
233    
234    
# Line 454  int ChannelIsOpen() Line 427  int ChannelIsOpen()
427      }      }
428  }  }
429    
430  int WriteToChannel( PCHAR buffer )  int WriteToChannel( char *format, ... )
431  {  {
432      BOOL result;      BOOL result;
433        va_list argp;
434        char buf [ 1024 ];
435        int size;
436      PULONG bytesRead = 0;      PULONG bytesRead = 0;
437      PULONG pBytesWritten = 0;      PULONG pBytesWritten = 0;
438    
439      if ( !ChannelIsOpen() )      if ( !ChannelIsOpen() )
440          return 1;          return 1;
441    
442        va_start( argp, format );
443        size = vsnprintf( buf, sizeof( buf ), format, argp );
444        va_end( argp );
445    
446        if ( size >= sizeof( buf ) )
447            return 0;
448    
449      WaitForSingleObject( hMutex, INFINITE );      WaitForSingleObject( hMutex, INFINITE );
450      result = WTSVirtualChannelWrite( m_vcHandle, buffer, ( ULONG ) strlen( buffer ), pBytesWritten );      result = WTSVirtualChannelWrite( m_vcHandle, buf, ( ULONG ) strlen( buf ), pBytesWritten );
451        result = WTSVirtualChannelWrite( m_vcHandle, "\n", ( ULONG ) 1, pBytesWritten );
452      ReleaseMutex( hMutex );      ReleaseMutex( hMutex );
453    
454      if ( result ) {      if ( result ) {

Legend:
Removed from v.1066  
changed lines
  Added in v.1067

  ViewVC Help
Powered by ViewVC 1.1.26