CVS: seamlessrdp/ServerExe/HookDll hookdll.cpp,1.16,1.17

Peter Åstrand <[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-serv15142

Modified Files:
	hookdll.cpp 
Log Message:
Moved usage of ChannelIsOpen into WriteToChannel.


Index: hookdll.cpp
===================================================================
RCS file: /cvsroot/rdesktop/seamlessrdp/ServerExe/HookDll/hookdll.cpp,v
retrieving revision 1.16
retrieving revision 1.17
diff -C2 -d -r1.16 -r1.17
*** hookdll.cpp	30 Aug 2005 11:22:46 -0000	1.16
--- hookdll.cpp	30 Aug 2005 11:28:55 -0000	1.17
***************
*** 46,54 ****
      va_end( argp );
      
!     if ( ChannelIsOpen() ) {
!         WriteToChannel( "DEBUG1," );
!         WriteToChannel( buf );
!         WriteToChannel( "\n" );
!     }
  }
  
--- 46,52 ----
      va_end( argp );
      
!     WriteToChannel( "DEBUG1," );
!     WriteToChannel( buf );
!     WriteToChannel( "\n" );
  }
  
***************
*** 169,176 ****
      }
      
!     if ( ChannelIsOpen() ) {
!         if ( result[ 0 ] != '\0' ) {
!             WriteToChannel( result );
!         }
      }
      
--- 167,172 ----
      }
      
!     if ( result[ 0 ] != '\0' ) {
!         WriteToChannel( result );
      }
      
***************
*** 213,220 ****
      }
      
!     if ( ChannelIsOpen() ) {
!         if ( result[ 0 ] != '\0' ) {
!             WriteToChannel( result );
!         }
      }
      
--- 209,214 ----
      }
      
!     if ( result[ 0 ] != '\0' ) {
!         WriteToChannel( result );
      }
      
***************
*** 229,339 ****
      }
      
!     if ( ChannelIsOpen() ) {
!         char windowTitle[ 150 ] = { ""
!                                   };
!         HWND windowHandle = NULL;
!         char result[ 255 ] = { ""
!                              };
!         char strWindowId[ 25 ];
!         LONG b, t, l, r;
!         char strW[ 5 ];
!         char strY[ 5 ];
!         char strX[ 5 ];
!         char strH[ 5 ];
!         RECT rect;
          
!         switch ( nCode ) {
!             case HSHELL_WINDOWCREATED:
!             
!             //get window id
!             windowHandle = ( HWND ) wParam;
!             itoa( ( int ) windowHandle, strWindowId, 10 );
!             
!             //get coords
!             GetWindowRect( windowHandle, &rect );
!             b = rect.bottom;
!             t = rect.top;
!             l = rect.left;
!             r = rect.right;
!             ltoa( b - t, strH, 10 );
!             ltoa( t, strY, 10 );
!             ltoa( r - l, strW, 10 );
!             ltoa( l, strX, 10 );
!             
!             //get name
!             GetWindowText( windowHandle, windowTitle, 150 );
!             
!             ////setup return string
!             strcat( result, "MSG=HSHELL_WINDOWCREATED;OP=0;" );
!             strcat( result, "ID=" );
!             strcat( result, strWindowId );
!             strcat( result, ";" );
!             strcat( result, "TITLE=" );
!             strcat( result, windowTitle );
!             strcat( result, ";" );
!             strcat( result, "X=" );
!             strcat( result, strX );
!             strcat( result, ";" );
!             strcat( result, "Y=" );
!             strcat( result, strY );
!             strcat( result, ";" );
!             strcat( result, "H=" );
!             strcat( result, strH );
!             strcat( result, ";" );
!             strcat( result, "W=" );
!             strcat( result, strW );
!             strcat( result, "." );
!             
!             break;
!             
!             case HSHELL_WINDOWDESTROYED:
!             
!             //get window id
!             windowHandle = ( HWND ) wParam;
!             itoa( ( int ) windowHandle, strWindowId, 10 );
!             
!             //get coords
!             GetWindowRect( windowHandle, &rect );
!             b = rect.bottom;
!             t = rect.top;
!             l = rect.left;
!             r = rect.right;
!             ltoa( b - t, strH, 10 );
!             ltoa( t, strY, 10 );
!             ltoa( r - l, strW, 10 );
!             ltoa( l, strX, 10 );
!             
!             //get name
!             GetWindowText( windowHandle, windowTitle, 150 );
!             
!             ////setup return string
!             strcat( result, "MSG=HSHELL_WINDOWDESTROYED;OP=1;" );
!             strcat( result, "ID=" );
!             strcat( result, strWindowId );
!             strcat( result, ";" );
!             strcat( result, "TITLE=" );
!             strcat( result, windowTitle );
!             strcat( result, ";" );
!             strcat( result, "X=" );
!             strcat( result, strX );
!             strcat( result, ";" );
!             strcat( result, "Y=" );
!             strcat( result, strY );
!             strcat( result, ";" );
!             strcat( result, "H=" );
!             strcat( result, strH );
!             strcat( result, ";" );
!             strcat( result, "W=" );
!             strcat( result, strW );
!             strcat( result, "." );
!             
!             break;
!             default:
!             break;
!         }
          
!         if ( result[ 0 ] != '\0' ) {
!             WriteToChannel( result );
!         }
      }
      
--- 223,331 ----
      }
      
!     char windowTitle[ 150 ] = { ""
!                               };
!     HWND windowHandle = NULL;
!     char result[ 255 ] = { ""
!                          };
!     char strWindowId[ 25 ];
!     LONG b, t, l, r;
!     char strW[ 5 ];
!     char strY[ 5 ];
!     char strX[ 5 ];
!     char strH[ 5 ];
!     RECT rect;
!     
!     switch ( nCode ) {
!         case HSHELL_WINDOWCREATED:
          
!         //get window id
!         windowHandle = ( HWND ) wParam;
!         itoa( ( int ) windowHandle, strWindowId, 10 );
          
!         //get coords
!         GetWindowRect( windowHandle, &rect );
!         b = rect.bottom;
!         t = rect.top;
!         l = rect.left;
!         r = rect.right;
!         ltoa( b - t, strH, 10 );
!         ltoa( t, strY, 10 );
!         ltoa( r - l, strW, 10 );
!         ltoa( l, strX, 10 );
!         
!         //get name
!         GetWindowText( windowHandle, windowTitle, 150 );
!         
!         ////setup return string
!         strcat( result, "MSG=HSHELL_WINDOWCREATED;OP=0;" );
!         strcat( result, "ID=" );
!         strcat( result, strWindowId );
!         strcat( result, ";" );
!         strcat( result, "TITLE=" );
!         strcat( result, windowTitle );
!         strcat( result, ";" );
!         strcat( result, "X=" );
!         strcat( result, strX );
!         strcat( result, ";" );
!         strcat( result, "Y=" );
!         strcat( result, strY );
!         strcat( result, ";" );
!         strcat( result, "H=" );
!         strcat( result, strH );
!         strcat( result, ";" );
!         strcat( result, "W=" );
!         strcat( result, strW );
!         strcat( result, "." );
!         
!         break;
!         
!         case HSHELL_WINDOWDESTROYED:
!         
!         //get window id
!         windowHandle = ( HWND ) wParam;
!         itoa( ( int ) windowHandle, strWindowId, 10 );
!         
!         //get coords
!         GetWindowRect( windowHandle, &rect );
!         b = rect.bottom;
!         t = rect.top;
!         l = rect.left;
!         r = rect.right;
!         ltoa( b - t, strH, 10 );
!         ltoa( t, strY, 10 );
!         ltoa( r - l, strW, 10 );
!         ltoa( l, strX, 10 );
!         
!         //get name
!         GetWindowText( windowHandle, windowTitle, 150 );
!         
!         ////setup return string
!         strcat( result, "MSG=HSHELL_WINDOWDESTROYED;OP=1;" );
!         strcat( result, "ID=" );
!         strcat( result, strWindowId );
!         strcat( result, ";" );
!         strcat( result, "TITLE=" );
!         strcat( result, windowTitle );
!         strcat( result, ";" );
!         strcat( result, "X=" );
!         strcat( result, strX );
!         strcat( result, ";" );
!         strcat( result, "Y=" );
!         strcat( result, strY );
!         strcat( result, ";" );
!         strcat( result, "H=" );
!         strcat( result, strH );
!         strcat( result, ";" );
!         strcat( result, "W=" );
!         strcat( result, strW );
!         strcat( result, "." );
!         
!         break;
!         default:
!         break;
!     }
!     
!     if ( result[ 0 ] != '\0' ) {
!         WriteToChannel( result );
      }
      
***************
*** 420,423 ****
--- 412,418 ----
      PULONG pBytesWritten = 0;
      
+     if ( !ChannelIsOpen() )
+         return 1;
+         
      BOOL result = WTSVirtualChannelWrite( m_vcHandle, buffer, ( ULONG ) strlen( buffer ), pBytesWritten );
      



-------------------------------------------------------
SF.Net email is Sponsored by the Better Software Conference & EXPO
September 19-22, 2005 * San Francisco, CA * Development Lifecycle Practices
Agile & Plan-Driven Development * Managing Projects & Teams * Testing & QA
Security * Process Improvement & Measurement * http://www.sqe.com/bsce5sf
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.