38 |
typedef void (*remove_hooks_proc_t) (); |
typedef void (*remove_hooks_proc_t) (); |
39 |
typedef int (*get_instance_count_proc_t) (); |
typedef int (*get_instance_count_proc_t) (); |
40 |
|
|
41 |
|
typedef void (*move_window_proc_t) (HWND hwnd, int x, int y, int width, int height); |
42 |
|
|
43 |
|
static move_window_proc_t g_move_window_fn = NULL; |
44 |
|
|
45 |
static void |
static void |
46 |
message(const char *text) |
message(const char *text) |
47 |
{ |
{ |
148 |
static void |
static void |
149 |
do_position(HWND hwnd, int x, int y, int width, int height) |
do_position(HWND hwnd, int x, int y, int width, int height) |
150 |
{ |
{ |
151 |
SetWindowPos(hwnd, NULL, x, y, width, height, SWP_NOACTIVATE | SWP_NOZORDER); |
g_move_window_fn(hwnd, x, y, width, height); |
152 |
} |
} |
153 |
|
|
154 |
static void |
static void |
169 |
|
|
170 |
while ((size = vchannel_read(line, sizeof(line))) >= 0) |
while ((size = vchannel_read(line, sizeof(line))) >= 0) |
171 |
{ |
{ |
|
debug("Got: %s", line); |
|
|
|
|
172 |
p = line; |
p = line; |
173 |
|
|
174 |
tok1 = get_token(&p); |
tok1 = get_token(&p); |
214 |
set_hooks_fn = (set_hooks_proc_t) GetProcAddress(hookdll, "SetHooks"); |
set_hooks_fn = (set_hooks_proc_t) GetProcAddress(hookdll, "SetHooks"); |
215 |
remove_hooks_fn = (remove_hooks_proc_t) GetProcAddress(hookdll, "RemoveHooks"); |
remove_hooks_fn = (remove_hooks_proc_t) GetProcAddress(hookdll, "RemoveHooks"); |
216 |
instance_count_fn = (get_instance_count_proc_t) GetProcAddress(hookdll, "GetInstanceCount"); |
instance_count_fn = (get_instance_count_proc_t) GetProcAddress(hookdll, "GetInstanceCount"); |
217 |
|
g_move_window_fn = (move_window_proc_t) GetProcAddress(hookdll, "SafeMoveWindow"); |
218 |
|
|
219 |
if (!set_hooks_fn || !remove_hooks_fn || !instance_count_fn) |
if (!set_hooks_fn || !remove_hooks_fn || !instance_count_fn || !g_move_window_fn) |
220 |
{ |
{ |
221 |
FreeLibrary(hookdll); |
FreeLibrary(hookdll); |
222 |
message("Hook DLL doesn't contain the correct functions. Unable to continue."); |
message("Hook DLL doesn't contain the correct functions. Unable to continue."); |