12 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
13 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
14 |
* GNU General Public License for more details. |
* GNU General Public License for more details. |
|
* |
|
|
* You should have received a copy of the GNU Lesser General Public License |
|
|
* along with GPGOE; if not, write to the Free Software Foundation, |
|
|
* Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA |
|
15 |
*/ |
*/ |
16 |
|
|
17 |
#ifdef HAVE_CONFIG_H |
#ifdef HAVE_CONFIG_H |
42 |
/* Global module handle. */ |
/* Global module handle. */ |
43 |
static HINSTANCE glob_hinst = NULL; |
static HINSTANCE glob_hinst = NULL; |
44 |
|
|
45 |
|
|
46 |
|
/* Valid options for the plug-in. */ |
47 |
struct { |
struct { |
48 |
int decrypt_replies; |
int decrypt_replies; |
49 |
int cache_passwd; |
int cache_passwd; |
68 |
PROCESSENTRY32 pe; |
PROCESSENTRY32 pe; |
69 |
HANDLE hd; |
HANDLE hd; |
70 |
BOOL next; |
BOOL next; |
71 |
int fnd = 0; |
size_t i; |
72 |
|
int fnd; |
73 |
|
|
74 |
hd = CreateToolhelp32Snapshot (TH32CS_SNAPPROCESS, 0); |
hd = CreateToolhelp32Snapshot (TH32CS_SNAPPROCESS, 0); |
75 |
if (hd == (HANDLE)-1) |
if (hd == (HANDLE)-1) |
78 |
memset (&pe, 0, sizeof (pe)); |
memset (&pe, 0, sizeof (pe)); |
79 |
pe.dwSize = sizeof (pe); |
pe.dwSize = sizeof (pe); |
80 |
next = Process32First (hd, &pe); |
next = Process32First (hd, &pe); |
81 |
|
fnd = 0; |
82 |
while (next) { |
while (next) { |
|
size_t i; |
|
|
|
|
83 |
for (i=0; i < strlen (pe.szExeFile); i++) |
for (i=0; i < strlen (pe.szExeFile); i++) |
84 |
pe.szExeFile[i] = (char)toupper (pe.szExeFile[i]); |
pe.szExeFile[i] = (char)toupper (pe.szExeFile[i]); |
85 |
for (i=0; conflict_apps[i] != NULL; i++) { |
for (i=0; conflict_apps[i] != NULL; i++) { |
89 |
} |
} |
90 |
} |
} |
91 |
next = Process32Next (hd, &pe); |
next = Process32Next (hd, &pe); |
|
if (!next) |
|
|
break; |
|
92 |
} |
} |
93 |
CloseHandle (hd); |
CloseHandle (hd); |
94 |
return fnd; |
return fnd; |
231 |
/* Main window procedure for the taskbar program. */ |
/* Main window procedure for the taskbar program. */ |
232 |
LRESULT CALLBACK |
LRESULT CALLBACK |
233 |
gpgoe_main_proc (HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam) |
gpgoe_main_proc (HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam) |
234 |
{ |
{ |
|
|
|
235 |
NOTIFYICONDATA NID; |
NOTIFYICONDATA NID; |
236 |
POINT p; |
POINT p; |
237 |
HMENU hm, popup; |
HMENU hm, popup; |
244 |
NID.uCallbackMessage = WM_USER; |
NID.uCallbackMessage = WM_USER; |
245 |
NID.hWnd = hwnd; |
NID.hWnd = hwnd; |
246 |
NID.hIcon = LoadIcon (glob_hinst, MAKEINTRESOURCE (IDI_GPGOE)); |
NID.hIcon = LoadIcon (glob_hinst, MAKEINTRESOURCE (IDI_GPGOE)); |
247 |
strcpy(NID.szTip, "GPG for Outlook Express"); |
strcpy (NID.szTip, "GPG for Outlook Express"); |
248 |
Shell_NotifyIcon (NIM_ADD, &NID); |
Shell_NotifyIcon (NIM_ADD, &NID); |
249 |
DestroyIcon (NID.hIcon); |
DestroyIcon (NID.hIcon); |
250 |
|
|
255 |
if (opt.cache_passwd) |
if (opt.cache_passwd) |
256 |
gpgoe_set_active_modes (GPGOE_MODE_CACHEPASS); |
gpgoe_set_active_modes (GPGOE_MODE_CACHEPASS); |
257 |
if (gpgoe_initialize ()) { |
if (gpgoe_initialize ()) { |
258 |
MessageBox (hwnd, "Couldn't register GPG OE hook", "Error", MB_ICONERROR|MB_OK); |
MessageBox (hwnd, "Could not register GPG OE hook", |
259 |
|
"Error", MB_ICONERROR|MB_OK); |
260 |
ExitProcess (0); |
ExitProcess (0); |
261 |
} |
} |
262 |
break; |
break; |
288 |
switch (lparam) { |
switch (lparam) { |
289 |
case WM_LBUTTONDBLCLK: |
case WM_LBUTTONDBLCLK: |
290 |
SetForegroundWindow (hwnd); |
SetForegroundWindow (hwnd); |
291 |
id = MessageBox (NULL, "Remove the GPG OE plug-in from the system?", |
id = MessageBox (NULL, |
292 |
|
"Remove the GPG OE plug-in from the system?", |
293 |
"Are you sure?", MB_YESNO|MB_ICONINFORMATION); |
"Are you sure?", MB_YESNO|MB_ICONINFORMATION); |
294 |
if (id == IDYES) |
if (id == IDYES) |
295 |
SendMessage (hwnd, WM_DESTROY, 0, 0); |
SendMessage (hwnd, WM_DESTROY, 0, 0); |
354 |
return 1; |
return 1; |
355 |
} |
} |
356 |
|
|
357 |
hwnd = CreateWindow ("GPGOE", "GPGOE", 0, 0, 0, 0, 0, NULL, NULL, hinst, NULL); |
hwnd = CreateWindow ("GPGOE", "GPGOE", 0, 0, 0, 0, 0, |
358 |
|
NULL, NULL, hinst, NULL); |
359 |
if (!hwnd) { |
if (!hwnd) { |
360 |
MessageBox (NULL, "Couldn't create window", "Error", MB_ICONERROR|MB_OK); |
MessageBox (NULL, "Could not create window", |
361 |
|
"Error", MB_ICONERROR|MB_OK); |
362 |
return 1; |
return 1; |
363 |
} |
} |
364 |
UpdateWindow (hwnd); |
UpdateWindow (hwnd); |