/[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 1081 by ossman_, Thu Mar 9 16:13:26 2006 UTC revision 1100 by ossman_, Fri Mar 10 12:56:37 2006 UTC
# Line 60  update_position(HWND hwnd) Line 60  update_position(HWND hwnd)
60                  return;                  return;
61          }          }
62    
63          vchannel_write("POSITION1,0x%p,%d,%d,%d,%d,0x%x",          vchannel_write("POSITION,0x%p,%d,%d,%d,%d,0x%x",
64                         hwnd,                         hwnd,
65                         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);
66  }  }
# Line 68  update_position(HWND hwnd) Line 68  update_position(HWND hwnd)
68  static LRESULT CALLBACK  static LRESULT CALLBACK
69  wndproc_hook_proc(int code, WPARAM cur_thread, LPARAM details)  wndproc_hook_proc(int code, WPARAM cur_thread, LPARAM details)
70  {  {
71          HWND hwnd;          HWND hwnd, parent;
72          UINT msg;          UINT msg;
73          WPARAM wparam;          WPARAM wparam;
74          LPARAM lparam;          LPARAM lparam;
# Line 85  wndproc_hook_proc(int code, WPARAM cur_t Line 85  wndproc_hook_proc(int code, WPARAM cur_t
85    
86          style = GetWindowLong(hwnd, GWL_STYLE);          style = GetWindowLong(hwnd, GWL_STYLE);
87    
88          if (style & WS_CHILD)          /* Docs say that WS_CHILD and WS_POPUP is an illegal combination,
89               but they exist nonetheless. */
90            if ((style & WS_CHILD) && !(style & WS_POPUP))
91                  goto end;                  goto end;
92    
93            if (style & WS_POPUP)
94                    parent = (HWND) GetWindowLong(hwnd, GWL_HWNDPARENT);
95            else
96                    parent = NULL;
97    
98          switch (msg)          switch (msg)
99          {          {
100    
# Line 97  wndproc_hook_proc(int code, WPARAM cur_t Line 104  wndproc_hook_proc(int code, WPARAM cur_t
104    
105                                  if (wp->flags & SWP_SHOWWINDOW)                                  if (wp->flags & SWP_SHOWWINDOW)
106                                  {                                  {
107                                          // FIXME: Now, just like create!                                          char title[150];
108                                          debug("SWP_SHOWWINDOW for %p!", hwnd);                                          int state;
109                                          vchannel_write("CREATE1,0x%p,0x%x", hwnd, 0);  
110                                            vchannel_write("CREATE,0x%p,0x%p,0x%x", hwnd, parent, 0);
111    
112                                            GetWindowText(hwnd, title, sizeof(title));
113    
114                                            /* FIXME: Strip title of dangerous characters */
115    
116                                            vchannel_write("TITLE,0x%x,%s,0x%x", hwnd, title, 0);
117    
118                                          // FIXME: SETSTATE                                          if (style & WS_MAXIMIZE)
119                                                    state = 2;
120                                            else if (style & WS_MINIMIZE)
121                                                    state = 1;
122                                            else
123                                                    state = 0;
124    
125                                            vchannel_write("STATE,0x%p,0x%x,0x%x", hwnd, state, 0);
126    
127                                          update_position(hwnd);                                          update_position(hwnd);
128    
129                                            /* FIXME: Figure out z order */
130                                  }                                  }
131    
132                                  if (wp->flags & SWP_HIDEWINDOW)                                  if (wp->flags & SWP_HIDEWINDOW)
133                                          vchannel_write("DESTROY1,0x%p,0x%x", hwnd, 0);                                          vchannel_write("DESTROY,0x%p,0x%x", hwnd, 0);
134    
135                                  if (!(style & WS_VISIBLE))                                  if (!(style & WS_VISIBLE))
136                                          break;                                          break;
# Line 117  wndproc_hook_proc(int code, WPARAM cur_t Line 140  wndproc_hook_proc(int code, WPARAM cur_t
140    
141                                  if (!(wp->flags & SWP_NOZORDER))                                  if (!(wp->flags & SWP_NOZORDER))
142                                  {                                  {
143                                          vchannel_write("ZCHANGE1,0x%p,0x%p,0x%x",                                          vchannel_write("ZCHANGE,0x%p,0x%p,0x%x",
144                                                         hwnd,                                                         hwnd,
145                                                         wp->flags & SWP_NOACTIVATE ? wp->                                                         wp->flags & SWP_NOACTIVATE ? wp->
146                                                         hwndInsertAfter : 0, 0);                                                         hwndInsertAfter : 0, 0);
# Line 127  wndproc_hook_proc(int code, WPARAM cur_t Line 150  wndproc_hook_proc(int code, WPARAM cur_t
150                          }                          }
151    
152                  case WM_SIZE:                  case WM_SIZE:
153                            if (!(style & WS_VISIBLE))
154                                    break;
155                          update_position(hwnd);                          update_position(hwnd);
156                          break;                          break;
157    
158                  case WM_MOVE:                  case WM_MOVE:
159                            if (!(style & WS_VISIBLE))
160                                    break;
161                          update_position(hwnd);                          update_position(hwnd);
162                          break;                          break;
163    
164                  case WM_DESTROY:                  case WM_DESTROY:
165                          vchannel_write("DESTROY1,0x%p,0x%x", hwnd, 0);                          if (!(style & WS_VISIBLE))
166                                    break;
167                            vchannel_write("DESTROY,0x%p,0x%x", hwnd, 0);
168                          break;                          break;
169    
170                  default:                  default:
# Line 149  wndproc_hook_proc(int code, WPARAM cur_t Line 178  wndproc_hook_proc(int code, WPARAM cur_t
178  static LRESULT CALLBACK  static LRESULT CALLBACK
179  cbt_hook_proc(int code, WPARAM wparam, LPARAM lparam)  cbt_hook_proc(int code, WPARAM wparam, LPARAM lparam)
180  {  {
         char title[150];  
   
181          if (code < 0)          if (code < 0)
182                  goto end;                  goto end;
183    
# Line 162  cbt_hook_proc(int code, WPARAM wparam, L Line 189  cbt_hook_proc(int code, WPARAM wparam, L
189    
190                                  show = LOWORD(lparam);                                  show = LOWORD(lparam);
191    
                                 if ((show == SW_SHOWMINIMIZED) || (show == SW_MINIMIZE))  
                                 {  
                                         MessageBox(0,  
                                                    "Minimizing windows is not allowed in this version. Sorry!",  
                                                    "SeamlessRDP", MB_OK);  
                                         return 1;  
                                 }  
   
                                 GetWindowText((HWND) wparam, title, sizeof(title));  
   
                                 /* FIXME: Strip title of dangerous characters */  
   
192                                  if (show == SW_SHOWNORMAL)                                  if (show == SW_SHOWNORMAL)
193                                          state = 0;                                          state = 0;
194                                  else if (show == SW_SHOWMINIMIZED)                                  else if (show == SW_SHOWMINIMIZED)
195                                          state = 1;                                          state = 1;
196                                  else if (show == SW_SHOWMAXIMIZED)                                  else if (show == SW_SHOWMAXIMIZED)
197                                          state = 2;                                          state = 2;
198                                  vchannel_write("SETSTATE1,0x%p,%s,0x%x,0x%x",                                  else
199                                                 (HWND) wparam, title, state, 0);                                          break;
200                                    vchannel_write("STATE,0x%p,0x%x,0x%x", (HWND) wparam, state, 0);
201                                  break;                                  break;
202                          }                          }
203    

Legend:
Removed from v.1081  
changed lines
  Added in v.1100

  ViewVC Help
Powered by ViewVC 1.1.26