/[gpgoe]/trunk/init/GPGOEInit.c
ViewVC logotype

Diff of /trunk/init/GPGOEInit.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 22 by twoaday, Sun Jun 4 10:12:47 2006 UTC revision 23 by twoaday, Sat Aug 18 10:55:14 2007 UTC
# Line 12  Line 12 
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
# Line 46  int  gpgoe_get_active_modes (void); Line 42  int  gpgoe_get_active_modes (void);
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;
# Line 70  check_for_conflict_apps (void) Line 68  check_for_conflict_apps (void)
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)
# Line 79  check_for_conflict_apps (void) Line 78  check_for_conflict_apps (void)
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++) {
# Line 91  check_for_conflict_apps (void) Line 89  check_for_conflict_apps (void)
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;
# Line 235  prefs_dlg_proc (HWND dlg, UINT msg, WPAR Line 231  prefs_dlg_proc (HWND dlg, UINT msg, WPAR
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;
# Line 249  gpgoe_main_proc (HWND hwnd, UINT msg, WP Line 244  gpgoe_main_proc (HWND hwnd, UINT msg, WP
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    
# Line 260  gpgoe_main_proc (HWND hwnd, UINT msg, WP Line 255  gpgoe_main_proc (HWND hwnd, UINT msg, WP
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;
# Line 292  gpgoe_main_proc (HWND hwnd, UINT msg, WP Line 288  gpgoe_main_proc (HWND hwnd, UINT msg, WP
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);
# Line 357  WinMain (HINSTANCE hinst, HINSTANCE prev Line 354  WinMain (HINSTANCE hinst, HINSTANCE prev
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);

Legend:
Removed from v.22  
changed lines
  Added in v.23

[email protected]
ViewVC Help
Powered by ViewVC 1.1.26