39 |
/* Outlook Express window handle. */ |
/* Outlook Express window handle. */ |
40 |
static HWND oe_hwnd = NULL; |
static HWND oe_hwnd = NULL; |
41 |
|
|
42 |
|
/* We need a shared section to define variables which |
43 |
|
will keep their values in all address spaces. */ |
44 |
|
#ifdef __GNUC__ |
45 |
|
#define ATTR_SEC __attribute__((section (".SHARDAT"), shared)) |
46 |
|
#else |
47 |
|
#define ATTR_SEC |
48 |
|
#pragma data_seg(".SHARDAT") |
49 |
|
#endif |
50 |
|
static int gpgoe_active_modes ATTR_SEC = 0; |
51 |
|
#ifndef __GNUC__ |
52 |
|
#pragma data_seg() |
53 |
|
#endif |
54 |
|
#undef ATTR_SEC |
55 |
|
|
56 |
|
|
57 |
|
/* Supported plug-in modes. */ |
58 |
|
enum gpgoe_mode_t { |
59 |
|
GPGOE_MODE_NORMAL = 0, |
60 |
|
GPGOE_MODE_PLAINREPLY = 1 /* decrypt mails before a reply. */ |
61 |
|
}; |
62 |
|
|
63 |
|
|
64 |
/* Main DLL entry point. */ |
/* Main DLL entry point. */ |
65 |
BOOL WINAPI |
BOOL WINAPI |
133 |
oe_hwnd = hwnd; |
oe_hwnd = hwnd; |
134 |
} |
} |
135 |
|
|
136 |
if (!strcmp (wclass, "Outlook Express Browser Class")) { |
if ((gpgoe_active_modes & GPGOE_MODE_PLAINREPLY) && |
137 |
|
!strcmp (wclass, "Outlook Express Browser Class")) { |
138 |
oe_main_proc_old = (WNDPROC)GetWindowLong (hwnd, GWL_WNDPROC); |
oe_main_proc_old = (WNDPROC)GetWindowLong (hwnd, GWL_WNDPROC); |
139 |
if (!oe_main_proc_old) |
if (!oe_main_proc_old) |
140 |
show_error (NULL, "GPGOE", MB_ICONERROR|MB_OK, |
show_error (NULL, "GPGOE", MB_ICONERROR|MB_OK, |
147 |
} |
} |
148 |
break; |
break; |
149 |
|
|
|
case HCBT_ACTIVATE: |
|
150 |
#if 0 |
#if 0 |
151 |
|
case HCBT_ACTIVATE: |
152 |
if (plugin_active != NULL && |
if (plugin_active != NULL && |
153 |
WaitForSingleObject (plugin_active, 0) == WAIT_OBJECT_0) { |
WaitForSingleObject (plugin_active, 0) == WAIT_OBJECT_0) { |
154 |
char wclass[200]; |
char wclass[200]; |
159 |
of_proc_old = (WNDPROC)GetWindowLong (hwnd, GWL_WNDPROC); |
of_proc_old = (WNDPROC)GetWindowLong (hwnd, GWL_WNDPROC); |
160 |
SetWindowLong (hwnd, GWL_WNDPROC, (LONG)(WNDPROC)of_proc); |
SetWindowLong (hwnd, GWL_WNDPROC, (LONG)(WNDPROC)of_proc); |
161 |
} |
} |
|
#endif |
|
162 |
break; |
break; |
163 |
|
#endif |
164 |
} |
} |
165 |
return CallNextHookEx (ctb_hook, code, wparam, lparam); |
return CallNextHookEx (ctb_hook, code, wparam, lparam); |
166 |
} |
} |
197 |
rc = UnhookWindowsHookEx (ctb_hook); |
rc = UnhookWindowsHookEx (ctb_hook); |
198 |
return rc ? 0 : (int)GetLastError (); |
return rc ? 0 : (int)GetLastError (); |
199 |
} |
} |
200 |
|
|
201 |
|
|
202 |
|
/* Change the active plug-in modes, enable mode @mode. */ |
203 |
|
void |
204 |
|
gpgoe_set_active_modes (int mode) |
205 |
|
{ |
206 |
|
gpgoe_active_modes = mode; |
207 |
|
} |
208 |
|
|
209 |
|
|
210 |
|
int |
211 |
|
gpgoe_get_active_modes (void) |
212 |
|
{ |
213 |
|
return gpgoe_active_modes; |
214 |
|
} |
215 |
|
|