/[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 1109 by ossman_, Fri Mar 10 15:12:28 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            {
95                    parent = (HWND) GetWindowLong(hwnd, GWL_HWNDPARENT);
96                    if (!parent)
97                            parent = (HWND) - 1;
98            }
99            else
100                    parent = NULL;
101    
102          switch (msg)          switch (msg)
103          {          {
104    
# Line 97  wndproc_hook_proc(int code, WPARAM cur_t Line 108  wndproc_hook_proc(int code, WPARAM cur_t
108    
109                                  if (wp->flags & SWP_SHOWWINDOW)                                  if (wp->flags & SWP_SHOWWINDOW)
110                                  {                                  {
111                                          // FIXME: Now, just like create!                                          char title[150];
112                                          debug("SWP_SHOWWINDOW for %p!", hwnd);                                          int state;
113                                          vchannel_write("CREATE1,0x%p,0x%x", hwnd, 0);  
114                                            vchannel_write("CREATE,0x%p,0x%p,0x%x", hwnd, parent, 0);
115    
116                                            GetWindowText(hwnd, title, sizeof(title));
117    
118                                            /* FIXME: Strip title of dangerous characters */
119    
120                                          // FIXME: SETSTATE                                          vchannel_write("TITLE,0x%x,%s,0x%x", hwnd, title, 0);
121    
122                                            if (style & WS_MAXIMIZE)
123                                                    state = 2;
124                                            else if (style & WS_MINIMIZE)
125                                                    state = 1;
126                                            else
127                                                    state = 0;
128    
129                                            vchannel_write("STATE,0x%p,0x%x,0x%x", hwnd, state, 0);
130    
131                                          update_position(hwnd);                                          update_position(hwnd);
132    
133                                            /* FIXME: Figure out z order */
134                                  }                                  }
135    
136                                  if (wp->flags & SWP_HIDEWINDOW)                                  if (wp->flags & SWP_HIDEWINDOW)
137                                          vchannel_write("DESTROY1,0x%p,0x%x", hwnd, 0);                                          vchannel_write("DESTROY,0x%p,0x%x", hwnd, 0);
138    
139                                  if (!(style & WS_VISIBLE))                                  if (!(style & WS_VISIBLE) || (style & WS_MINIMIZE))
140                                          break;                                          break;
141    
142                                  if (!(wp->flags & SWP_NOMOVE && wp->flags & SWP_NOSIZE))                                  if (!(wp->flags & SWP_NOMOVE && wp->flags & SWP_NOSIZE))
# Line 117  wndproc_hook_proc(int code, WPARAM cur_t Line 144  wndproc_hook_proc(int code, WPARAM cur_t
144    
145                                  if (!(wp->flags & SWP_NOZORDER))                                  if (!(wp->flags & SWP_NOZORDER))
146                                  {                                  {
147                                          vchannel_write("ZCHANGE1,0x%p,0x%p,0x%x",                                          vchannel_write("ZCHANGE,0x%p,0x%p,0x%x",
148                                                         hwnd,                                                         hwnd,
149                                                         wp->flags & SWP_NOACTIVATE ? wp->                                                         wp->flags & SWP_NOACTIVATE ? wp->
150                                                         hwndInsertAfter : 0, 0);                                                         hwndInsertAfter : 0, 0);
# Line 127  wndproc_hook_proc(int code, WPARAM cur_t Line 154  wndproc_hook_proc(int code, WPARAM cur_t
154                          }                          }
155    
156                  case WM_SIZE:                  case WM_SIZE:
157                            if (!(style & WS_VISIBLE) || (style & WS_MINIMIZE))
158                                    break;
159                          update_position(hwnd);                          update_position(hwnd);
160                          break;                          break;
161    
162                  case WM_MOVE:                  case WM_MOVE:
163                            if (!(style & WS_VISIBLE) || (style & WS_MINIMIZE))
164                                    break;
165                          update_position(hwnd);                          update_position(hwnd);
166                          break;                          break;
167    
168                    case WM_SETTEXT:
169                            if (!(style & WS_VISIBLE))
170                                    break;
171                            /* FIXME: Strip title of dangerous characters */
172                            vchannel_write("TITLE,0x%p,%s,0x%x", hwnd, (char *) lparam, 0);
173                            break;
174    
175                  case WM_DESTROY:                  case WM_DESTROY:
176                          vchannel_write("DESTROY1,0x%p,0x%x", hwnd, 0);                          if (!(style & WS_VISIBLE))
177                                    break;
178                            vchannel_write("DESTROY,0x%p,0x%x", hwnd, 0);
179                          break;                          break;
180    
181                  default:                  default:
# Line 149  wndproc_hook_proc(int code, WPARAM cur_t Line 189  wndproc_hook_proc(int code, WPARAM cur_t
189  static LRESULT CALLBACK  static LRESULT CALLBACK
190  cbt_hook_proc(int code, WPARAM wparam, LPARAM lparam)  cbt_hook_proc(int code, WPARAM wparam, LPARAM lparam)
191  {  {
         char title[150];  
   
192          if (code < 0)          if (code < 0)
193                  goto end;                  goto end;
194    
# Line 162  cbt_hook_proc(int code, WPARAM wparam, L Line 200  cbt_hook_proc(int code, WPARAM wparam, L
200    
201                                  show = LOWORD(lparam);                                  show = LOWORD(lparam);
202    
203                                  if ((show == SW_SHOWMINIMIZED) || (show == SW_MINIMIZE))                                  if ((show == SW_NORMAL) || (show == SW_SHOWNORMAL))
                                 {  
                                         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 */  
   
                                 if (show == SW_SHOWNORMAL)  
204                                          state = 0;                                          state = 0;
205                                  else if (show == SW_SHOWMINIMIZED)                                  else if ((show == SW_MINIMIZE) || (show == SW_SHOWMINIMIZED))
206                                          state = 1;                                          state = 1;
207                                  else if (show == SW_SHOWMAXIMIZED)                                  else if ((show == SW_MAXIMIZE) || (show == SW_SHOWMAXIMIZED))
208                                          state = 2;                                          state = 2;
209                                  vchannel_write("SETSTATE1,0x%p,%s,0x%x,0x%x",                                  else
210                                                 (HWND) wparam, title, state, 0);                                  {
211                                            debug("Unexpected show: %d", show);
212                                            break;
213                                    }
214                                    vchannel_write("STATE,0x%p,0x%x,0x%x", (HWND) wparam, state, 0);
215                                  break;                                  break;
216                          }                          }
217    

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

  ViewVC Help
Powered by ViewVC 1.1.26