CVS: seamlessrdp/ServerExe/HookDll hook.cpp,1.7,1.8 hook.h,1.7,1.8 hookdll.cpp,1.28,1.29

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-serv5190/HookDll

Modified Files:
	hook.cpp hook.h hookdll.cpp 
Log Message:
Run indent-all on the server source.


Index: hook.cpp
===================================================================
RCS file: /cvsroot/rdesktop/seamlessrdp/ServerExe/HookDll/hook.cpp,v
retrieving revision 1.7
retrieving revision 1.8
diff -C2 -d -r1.7 -r1.8
*** hook.cpp	30 Aug 2005 12:04:08 -0000	1.7
--- hook.cpp	8 Mar 2006 16:12:49 -0000	1.8
***************
*** 14,23 ****
      if ( mHookDllHinst )
          return true;
!         
      while ( true ) {
          // try to load hookdll.dll
          if ( !( mHookDllHinst = LoadLibrary( "hookdll.dll" ) ) )
              break;
!             
          // check number of instances
          if ( !
--- 14,23 ----
      if ( mHookDllHinst )
          return true;
! 
      while ( true ) {
          // try to load hookdll.dll
          if ( !( mHookDllHinst = LoadLibrary( "hookdll.dll" ) ) )
              break;
! 
          // check number of instances
          if ( !
***************
*** 26,31 ****
                                                             "GetInstanceCount" ) ) )
              break;
!             
!             
          // get our hook function
          if ( !
--- 26,31 ----
                                                             "GetInstanceCount" ) ) )
              break;
! 
! 
          // get our hook function
          if ( !
***************
*** 33,37 ****
                        ( SETHOOKS ) GetProcAddress( mHookDllHinst, "SetHooks" ) ) )
              break;
!             
          // get our unkook function
          if ( !
--- 33,37 ----
                        ( SETHOOKS ) GetProcAddress( mHookDllHinst, "SetHooks" ) ) )
              break;
! 
          // get our unkook function
          if ( !
***************
*** 39,47 ****
                        ( REMOVEHOOKS ) GetProcAddress( mHookDllHinst, "RemoveHooks" ) ) )
              break;
!             
          // report success
          return true;
      }
!     
      // if we got here something went wrong
      if ( mHookDllHinst ) {
--- 39,47 ----
                        ( REMOVEHOOKS ) GetProcAddress( mHookDllHinst, "RemoveHooks" ) ) )
              break;
! 
          // report success
          return true;
      }
! 
      // if we got here something went wrong
      if ( mHookDllHinst ) {
***************
*** 49,53 ****
          mHookDllHinst = 0;
      }
!     
      return false;
  }
--- 49,53 ----
          mHookDllHinst = 0;
      }
! 
      return false;
  }

Index: hook.h
===================================================================
RCS file: /cvsroot/rdesktop/seamlessrdp/ServerExe/HookDll/hook.h,v
retrieving revision 1.7
retrieving revision 1.8
diff -C2 -d -r1.7 -r1.8
*** hook.h	30 Aug 2005 12:04:08 -0000	1.7
--- hook.h	8 Mar 2006 16:12:49 -0000	1.8
***************
*** 19,23 ****
          static REMOVEHOOKS mRemoveHooks;
          static GETINSTANCECOUNT mGetInstanceCount;
!         
      public:
          static bool Init();
--- 19,23 ----
          static REMOVEHOOKS mRemoveHooks;
          static GETINSTANCECOUNT mGetInstanceCount;
! 
      public:
          static bool Init();
***************
*** 27,31 ****
                  FreeLibrary( mHookDllHinst );
          }
!         
          static void SetHooks()
          {
--- 27,31 ----
                  FreeLibrary( mHookDllHinst );
          }
! 
          static void SetHooks()
          {
***************
*** 33,37 ****
                  mSetHooks();
          }
!         
          static void RemoveHooks()
          {
--- 33,37 ----
                  mSetHooks();
          }
! 
          static void RemoveHooks()
          {
***************
*** 39,43 ****
                  mRemoveHooks();
          }
!         
          static int GetInstanceCount()
          {
--- 39,43 ----
                  mRemoveHooks();
          }
! 
          static int GetInstanceCount()
          {

Index: hookdll.cpp
===================================================================
RCS file: /cvsroot/rdesktop/seamlessrdp/ServerExe/HookDll/hookdll.cpp,v
retrieving revision 1.28
retrieving revision 1.29
diff -C2 -d -r1.28 -r1.29
*** hookdll.cpp	8 Mar 2006 15:52:38 -0000	1.28
--- hookdll.cpp	8 Mar 2006 16:12:49 -0000	1.29
***************
*** 38,46 ****
      va_list argp;
      char buf [ 256 ];
!     
      va_start( argp, format );
      vsprintf( buf, format, argp );
      va_end( argp );
!     
      WriteToChannel( "DEBUG1," );
      WriteToChannel( buf );
--- 38,46 ----
      va_list argp;
      char buf [ 256 ];
! 
      va_start( argp, format );
      vsprintf( buf, format, argp );
      va_end( argp );
! 
      WriteToChannel( "DEBUG1," );
      WriteToChannel( buf );
***************
*** 53,57 ****
  {
      switch ( ul_reason_for_call ) {
!         case DLL_PROCESS_ATTACH: {
              // remember our instance handle
              hInst = hinstDLL;
--- 53,57 ----
  {
      switch ( ul_reason_for_call ) {
!     case DLL_PROCESS_ATTACH: {
              // remember our instance handle
              hInst = hinstDLL;
***************
*** 60,69 ****
              break;
          }
!         
!         case DLL_THREAD_ATTACH:
          break;
!         case DLL_THREAD_DETACH:
          break;
!         case DLL_PROCESS_DETACH: {
              --iInstanceCount;
              CloseVirtualChannel();
--- 60,69 ----
              break;
          }
! 
!     case DLL_THREAD_ATTACH:
          break;
!     case DLL_THREAD_DETACH:
          break;
!     case DLL_PROCESS_DETACH: {
              --iInstanceCount;
              CloseVirtualChannel();
***************
*** 71,75 ****
          break;
      }
!     
      return TRUE;
  }
--- 71,75 ----
          break;
      }
! 
      return TRUE;
  }
***************
*** 80,84 ****
          return CallNextHookEx( hWndProc, nCode, wParam, lParam );
      }
!     
      char windowTitle[ 150 ] = { ""
                                };
--- 80,84 ----
          return CallNextHookEx( hWndProc, nCode, wParam, lParam );
      }
! 
      char windowTitle[ 150 ] = { ""
                                };
***************
*** 92,153 ****
      WINDOWPOS *wp = ( WINDOWPOS * ) details->lParam;
      RECT rect;
!     
      switch ( details->message ) {
-     
-         case WM_WINDOWPOSCHANGED:
- 	    if ( dwStyle & WS_CHILD)
- 		break;
  
  
- 	    if ( wp->flags & SWP_SHOWWINDOW ) {
- 		// FIXME: Now, just like create!
- 		SendDebug("SWP_SHOWWINDOW for %p!", details->hwnd);
- 		
- 		snprintf( result, sizeof( result ),
- 			  "CREATE1,0x%p,0x%x\n",
- 			  details->hwnd, 0 );
- 		result[ sizeof( result ) - 1 ] = '\0';
- 		WriteToChannel( result );
  
! 		// FIXME: SETSTATE
! 	    
! 		if ( !GetWindowRect( details->hwnd, &rect ) ) {
! 		    SendDebug( "GetWindowRect failed!\n" );
! 		    break;
! 		}
! 		snprintf( result, sizeof( result ),
! 			  "POSITION1,0x%p,%d,%d,%d,%d,0x%x\n",
! 			  details->hwnd,
! 			  rect.left, rect.top,
! 			  rect.right - rect.left,
! 			  rect.bottom - rect.top,
! 			  0 );
! 		result[ sizeof( result ) - 1 ] = '\0';
! 		WriteToChannel( result );
  
! 	    }
  
  
! 	    if ( wp->flags & SWP_HIDEWINDOW ) {
! 		snprintf( result, sizeof( result ),
! 			  "DESTROY1,0x%p,0x%x\n",
! 			  details->hwnd, 0 );
! 		result[ sizeof( result ) - 1 ] = '\0';
! 		WriteToChannel( result );
  
! 	    }
  
  
! 	if ( !( dwStyle & WS_VISIBLE ) )
! 		break;
!             
          if ( wp->flags & SWP_NOMOVE && wp->flags & SWP_NOSIZE )
              break;
!             
          if ( !GetWindowRect( details->hwnd, &rect ) ) {
              SendDebug( "GetWindowRect failed!\n" );
              break;
          }
!         
          snprintf( result, sizeof( result ),
                    "POSITION1,0x%p,%d,%d,%d,%d,0x%x\n",
--- 92,153 ----
      WINDOWPOS *wp = ( WINDOWPOS * ) details->lParam;
      RECT rect;
! 
      switch ( details->message ) {
  
+     case WM_WINDOWPOSCHANGED:
+         if ( dwStyle & WS_CHILD)
+             break;
  
  
!         if ( wp->flags & SWP_SHOWWINDOW ) {
!             // FIXME: Now, just like create!
!             SendDebug("SWP_SHOWWINDOW for %p!", details->hwnd);
  
!             snprintf( result, sizeof( result ),
!                       "CREATE1,0x%p,0x%x\n",
!                       details->hwnd, 0 );
!             result[ sizeof( result ) - 1 ] = '\0';
!             WriteToChannel( result );
  
+             // FIXME: SETSTATE
  
!             if ( !GetWindowRect( details->hwnd, &rect ) ) {
!                 SendDebug( "GetWindowRect failed!\n" );
!                 break;
!             }
!             snprintf( result, sizeof( result ),
!                       "POSITION1,0x%p,%d,%d,%d,%d,0x%x\n",
!                       details->hwnd,
!                       rect.left, rect.top,
!                       rect.right - rect.left,
!                       rect.bottom - rect.top,
!                       0 );
!             result[ sizeof( result ) - 1 ] = '\0';
!             WriteToChannel( result );
  
!         }
  
  
!         if ( wp->flags & SWP_HIDEWINDOW ) {
!             snprintf( result, sizeof( result ),
!                       "DESTROY1,0x%p,0x%x\n",
!                       details->hwnd, 0 );
!             result[ sizeof( result ) - 1 ] = '\0';
!             WriteToChannel( result );
! 
!         }
! 
! 
!         if ( !( dwStyle & WS_VISIBLE ) )
!             break;
! 
          if ( wp->flags & SWP_NOMOVE && wp->flags & SWP_NOSIZE )
              break;
! 
          if ( !GetWindowRect( details->hwnd, &rect ) ) {
              SendDebug( "GetWindowRect failed!\n" );
              break;
          }
! 
          snprintf( result, sizeof( result ),
                    "POSITION1,0x%p,%d,%d,%d,%d,0x%x\n",
***************
*** 159,166 ****
          result[ sizeof( result ) - 1 ] = '\0';
          WriteToChannel( result );
!         
          break;
!         
!         
          /* Note: WM_WINDOWPOSCHANGING/WM_WINDOWPOSCHANGED are
          strange. Sometimes, for example when bringing up the
--- 159,166 ----
          result[ sizeof( result ) - 1 ] = '\0';
          WriteToChannel( result );
! 
          break;
! 
! 
          /* Note: WM_WINDOWPOSCHANGING/WM_WINDOWPOSCHANGED are
          strange. Sometimes, for example when bringing up the
***************
*** 171,181 ****
          WM_WINDOWPOSCHANGING event is sent which looks just like
          the event that was sent when the About dialog was opened...  */
!         case WM_WINDOWPOSCHANGING:
! 	    if ( dwStyle & WS_CHILD)
! 		break;
  
- 	    if ( !( dwStyle & WS_VISIBLE ) )
- 		break;
-             
          if ( !( wp->flags & SWP_NOZORDER ) ) {
              snprintf( result, sizeof( result ),
--- 171,181 ----
          WM_WINDOWPOSCHANGING event is sent which looks just like
          the event that was sent when the About dialog was opened...  */
!     case WM_WINDOWPOSCHANGING:
!         if ( dwStyle & WS_CHILD)
!             break;
! 
!         if ( !( dwStyle & WS_VISIBLE ) )
!             break;
  
          if ( !( wp->flags & SWP_NOZORDER ) ) {
              snprintf( result, sizeof( result ),
***************
*** 188,212 ****
          }
          break;
-         
-        
-       
-         
-         case WM_DESTROY:
- 	    if ( dwStyle & WS_CHILD)
- 		break;
  
!             snprintf( result, sizeof( result ),
!                       "DESTROY1,0x%p,0x%x\n",
!                       details->hwnd, 0 );
!             result[ sizeof( result ) - 1 ] = '\0';
!             WriteToChannel( result );
!         
          break;
  
!       
!         default:
          break;
      }
!     
      return CallNextHookEx( hWndProc, nCode, wParam, lParam );
  }
--- 188,212 ----
          }
          break;
  
! 
! 
! 
!     case WM_DESTROY:
!         if ( dwStyle & WS_CHILD)
!             break;
! 
!         snprintf( result, sizeof( result ),
!                   "DESTROY1,0x%p,0x%x\n",
!                   details->hwnd, 0 );
!         result[ sizeof( result ) - 1 ] = '\0';
!         WriteToChannel( result );
! 
          break;
  
! 
!     default:
          break;
      }
! 
      return CallNextHookEx( hWndProc, nCode, wParam, lParam );
  }
***************
*** 217,221 ****
          return CallNextHookEx( hCbtProc, nCode, wParam, lParam );
      }
!     
      char windowTitle[ 150 ] = { ""
                                };
--- 217,221 ----
          return CallNextHookEx( hCbtProc, nCode, wParam, lParam );
      }
! 
      char windowTitle[ 150 ] = { ""
                                };
***************
*** 224,229 ****
                           };
      switch ( nCode ) {
!         case HCBT_MINMAX:
!         
          if ( ( LOWORD( lParam ) == SW_SHOWMINIMIZED )
                  || ( LOWORD( lParam ) == SW_MINIMIZE ) ) {
--- 224,229 ----
                           };
      switch ( nCode ) {
!     case HCBT_MINMAX:
! 
          if ( ( LOWORD( lParam ) == SW_SHOWMINIMIZED )
                  || ( LOWORD( lParam ) == SW_MINIMIZE ) ) {
***************
*** 231,237 ****
              return 1;
          }
!         
          GetWindowText( ( HWND ) wParam, windowTitle, 150 );
!         
          snprintf( result, sizeof( result ),
                    "SETSTATE1,0x%p,%s,0x%x,0x%x\n",
--- 231,237 ----
              return 1;
          }
! 
          GetWindowText( ( HWND ) wParam, windowTitle, 150 );
! 
          snprintf( result, sizeof( result ),
                    "SETSTATE1,0x%p,%s,0x%x,0x%x\n",
***************
*** 243,254 ****
          WriteToChannel( result );
          break;
!         
!         
!         default:
          break;
      }
!     
!     
!     
      return CallNextHookEx( hCbtProc, nCode, wParam, lParam );
  }
--- 243,254 ----
          WriteToChannel( result );
          break;
! 
! 
!     default:
          break;
      }
! 
! 
! 
      return CallNextHookEx( hCbtProc, nCode, wParam, lParam );
  }
***************
*** 260,264 ****
          return CallNextHookEx( hShellProc, nCode, wParam, lParam );
      }
!     
      char windowTitle[ 150 ] = { ""
                                };
--- 260,264 ----
          return CallNextHookEx( hShellProc, nCode, wParam, lParam );
      }
! 
      char windowTitle[ 150 ] = { ""
                                };
***************
*** 273,284 ****
      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 );
--- 273,284 ----
      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 );
***************
*** 291,298 ****
          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;" );
--- 291,298 ----
          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;" );
***************
*** 317,327 ****
          WriteToChannel( result );
          break;
!         
!         case HSHELL_WINDOWDESTROYED:
!         
          //get window id
          windowHandle = ( HWND ) wParam;
          itoa( ( int ) windowHandle, strWindowId, 10 );
!         
          //get coords
          GetWindowRect( windowHandle, &rect );
--- 317,327 ----
          WriteToChannel( result );
          break;
! 
!     case HSHELL_WINDOWDESTROYED:
! 
          //get window id
          windowHandle = ( HWND ) wParam;
          itoa( ( int ) windowHandle, strWindowId, 10 );
! 
          //get coords
          GetWindowRect( windowHandle, &rect );
***************
*** 334,341 ****
          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;" );
--- 334,341 ----
          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;" );
***************
*** 360,370 ****
          WriteToChannel( result );
          break;
!         
!         
!         default:
          break;
      }
!     
!     
      return CallNextHookEx( hShellProc, nCode, wParam, lParam );
  }
--- 360,370 ----
          WriteToChannel( result );
          break;
! 
! 
!     default:
          break;
      }
! 
! 
      return CallNextHookEx( hShellProc, nCode, wParam, lParam );
  }
***************
*** 375,379 ****
          hCbtProc = SetWindowsHookEx( WH_CBT, ( HOOKPROC ) CbtProc, hInst, ( DWORD ) NULL );
      }
!     
  #if 0
      if ( !hShellProc ) {
--- 375,379 ----
          hCbtProc = SetWindowsHookEx( WH_CBT, ( HOOKPROC ) CbtProc, hInst, ( DWORD ) NULL );
      }
! 
  #if 0
      if ( !hShellProc ) {
***************
*** 381,385 ****
      }
  #endif
!     
      if ( !hWndProc ) {
          hWndProc = SetWindowsHookEx( WH_CALLWNDPROC, ( HOOKPROC ) CallWndProc, hInst, ( DWORD ) NULL );
--- 381,385 ----
      }
  #endif
! 
      if ( !hWndProc ) {
          hWndProc = SetWindowsHookEx( WH_CALLWNDPROC, ( HOOKPROC ) CallWndProc, hInst, ( DWORD ) NULL );
***************
*** 392,400 ****
          UnhookWindowsHookEx( hCbtProc );
      }
!     
      if ( hShellProc ) {
          UnhookWindowsHookEx( hShellProc );
      }
!     
      if ( hWndProc ) {
          UnhookWindowsHookEx( hWndProc );
--- 392,400 ----
          UnhookWindowsHookEx( hCbtProc );
      }
! 
      if ( hShellProc ) {
          UnhookWindowsHookEx( hShellProc );
      }
! 
      if ( hWndProc ) {
          UnhookWindowsHookEx( hWndProc );
***************
*** 410,414 ****
  {
      m_vcHandle = WTSVirtualChannelOpen( WTS_CURRENT_SERVER_HANDLE, WTS_CURRENT_SESSION, CHANNELNAME );
!     
      if ( m_vcHandle == NULL ) {
          return 0;
--- 410,414 ----
  {
      m_vcHandle = WTSVirtualChannelOpen( WTS_CURRENT_SERVER_HANDLE, WTS_CURRENT_SESSION, CHANNELNAME );
! 
      if ( m_vcHandle == NULL ) {
          return 0;
***************
*** 421,427 ****
  {
      BOOL result = WTSVirtualChannelClose( m_vcHandle );
!     
      m_vcHandle = NULL;
!     
      if ( result ) {
          return 1;
--- 421,427 ----
  {
      BOOL result = WTSVirtualChannelClose( m_vcHandle );
! 
      m_vcHandle = NULL;
! 
      if ( result ) {
          return 1;
***************
*** 444,453 ****
      PULONG bytesRead = 0;
      PULONG pBytesWritten = 0;
!     
      if ( !ChannelIsOpen() )
          return 1;
!         
      BOOL result = WTSVirtualChannelWrite( m_vcHandle, buffer, ( ULONG ) strlen( buffer ), pBytesWritten );
!     
      if ( result ) {
          return 1;
--- 444,453 ----
      PULONG bytesRead = 0;
      PULONG pBytesWritten = 0;
! 
      if ( !ChannelIsOpen() )
          return 1;
! 
      BOOL result = WTSVirtualChannelWrite( m_vcHandle, buffer, ( ULONG ) strlen( buffer ), pBytesWritten );
! 
      if ( result ) {
          return 1;



-------------------------------------------------------
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.