/[rdesktop]/sourceforge.net/trunk/seamlessrdp/ServerExe/HookDll/hookdll.c
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.c

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

revision 1134 by ossman_, Wed Mar 15 13:19:54 2006 UTC revision 1145 by ossman_, Thu Mar 16 13:24:18 2006 UTC
# Line 32  Line 32 
32    
33  #define DLL_EXPORT __declspec(dllexport)  #define DLL_EXPORT __declspec(dllexport)
34    
35    #ifdef __GNUC__
36    #define SHARED __attribute__((section ("SHAREDDATA"), shared))
37    #else
38    #define SHARED
39    #endif
40    
41  // Shared DATA  // Shared DATA
42  #pragma data_seg ( "SHAREDDATA" )  #pragma data_seg ( "SHAREDDATA" )
43    
44  // this is the total number of processes this dll is currently attached to  // this is the total number of processes this dll is currently attached to
45  int g_instance_count = 0;  int g_instance_count SHARED = 0;
46    
47    // blocks for locally generated events
48    RECT g_block_move SHARED = { 0, 0, 0, 0 };
49    
50  #pragma data_seg ()  #pragma data_seg ()
51    
# Line 53  static HANDLE g_mutex = NULL; Line 62  static HANDLE g_mutex = NULL;
62  static void  static void
63  update_position(HWND hwnd)  update_position(HWND hwnd)
64  {  {
65          RECT rect;          RECT rect, blocked;
66    
67          if (!GetWindowRect(hwnd, &rect))          if (!GetWindowRect(hwnd, &rect))
68          {          {
# Line 61  update_position(HWND hwnd) Line 70  update_position(HWND hwnd)
70                  return;                  return;
71          }          }
72    
73            WaitForSingleObject(g_mutex, INFINITE);
74            memcpy(&blocked, &g_block_move, sizeof(RECT));
75            ReleaseMutex(g_mutex);
76    
77            if ((rect.left == blocked.left) && (rect.top == blocked.top)
78                && (rect.right == blocked.right) && (rect.bottom == blocked.bottom))
79                    return;
80    
81          vchannel_write("POSITION,0x%p,%d,%d,%d,%d,0x%x",          vchannel_write("POSITION,0x%p,%d,%d,%d,%d,0x%x",
82                         hwnd,                         hwnd,
83                         rect.left, rect.top, rect.right - rect.left, rect.bottom - rect.top, 0);                         rect.left, rect.top, rect.right - rect.left, rect.bottom - rect.top, 0);
# Line 290  RemoveHooks(void) Line 307  RemoveHooks(void)
307                  UnhookWindowsHookEx(g_wndprocret_hook);                  UnhookWindowsHookEx(g_wndprocret_hook);
308  }  }
309    
310    DLL_EXPORT void
311    SafeMoveWindow(HWND hwnd, int x, int y, int width, int height)
312    {
313            WaitForSingleObject(g_mutex, INFINITE);
314            g_block_move.left = x;
315            g_block_move.top = y;
316            g_block_move.right = x + width;
317            g_block_move.bottom = y + height;
318            ReleaseMutex(g_mutex);
319    
320            SetWindowPos(hwnd, NULL, x, y, width, height, SWP_NOACTIVATE | SWP_NOZORDER);
321    
322            WaitForSingleObject(g_mutex, INFINITE);
323            memset(&g_block_move, 0, sizeof(RECT));
324            ReleaseMutex(g_mutex);
325    }
326    
327  DLL_EXPORT int  DLL_EXPORT int
328  GetInstanceCount()  GetInstanceCount()
329  {  {

Legend:
Removed from v.1134  
changed lines
  Added in v.1145

  ViewVC Help
Powered by ViewVC 1.1.26