*** stunnel-4.04\prototypes.h	Wed Jan 01 08:33:54 2003
--- prototypes.h	Fri Jan 24 15:15:39 2003
***************
*** 118,127 ****
--- 118,129 ----
  
          /* Win32 specific data for gui.c */
  #ifdef USE_WIN32
      char *win32_service;
      char *win32_name;
+     BOOL ShowOnTray;                        /* When yes will show the icon  */
+                                             /* in the icon tray */
  #endif
  
          /* logging-support data for log.c */
      int debug_level;                               /* debug level for syslog */
  #ifndef USE_WIN32
*** stunnel-4.04\gui.c	Wed Jan 01 08:33:24 2003
--- gui.c	Mon Feb 17 11:12:48 2003
***************
*** 157,169 ****
      wc.lpszClassName=classname;
      wc.hIconSm=LoadImage(hInstance, MAKEINTRESOURCE(IDI_MYICON), IMAGE_ICON,
          GetSystemMetrics(SM_CXSMICON), GetSystemMetrics(SM_CYSMICON), 0);
      RegisterClassEx(&wc);
  
      /* create main window */
-     htraymenu=LoadMenu(ghInst, MAKEINTRESOURCE(IDM_TRAYMENU));
-     hpopup=GetSubMenu(htraymenu, 0);
      hmainmenu=LoadMenu(ghInst, MAKEINTRESOURCE(IDM_MAINMENU));
      hwnd=CreateWindow(classname, options.win32_name, WS_TILEDWINDOW,
          CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT,
          NULL, hmainmenu, hInstance, NULL);
  
--- 157,171 ----
      wc.lpszClassName=classname;
      wc.hIconSm=LoadImage(hInstance, MAKEINTRESOURCE(IDI_MYICON), IMAGE_ICON,
          GetSystemMetrics(SM_CXSMICON), GetSystemMetrics(SM_CYSMICON), 0);
      RegisterClassEx(&wc);
  
+     if (options.ShowOnTray) {/* Save menu resources if not showing the icon on the tray */
+         htraymenu=LoadMenu(ghInst, MAKEINTRESOURCE(IDM_TRAYMENU));
+         hpopup=GetSubMenu(htraymenu, 0);
+     }
      /* create main window */
      hmainmenu=LoadMenu(ghInst, MAKEINTRESOURCE(IDM_MAINMENU));
      hwnd=CreateWindow(classname, options.win32_name, WS_TILEDWINDOW,
          CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT,
          NULL, hmainmenu, hInstance, NULL);
  
***************
*** 232,242 ****
      if(message!=WM_CTLCOLORSTATIC && message!=WM_TIMER)
          log(LOG_DEBUG, "Window message: %d", message);
  #endif
      switch (message) {
      case WM_CREATE:
!         SetTimer(hwnd, 0x29a, 1000, NULL); /* 1-second timer */
          return TRUE;
  
      case WM_SIZE:
          GetClientRect(hwnd, &rect);
          MoveWindow(EditControl, 0, 0, rect.right, rect.bottom, TRUE);
--- 234,245 ----
      if(message!=WM_CTLCOLORSTATIC && message!=WM_TIMER)
          log(LOG_DEBUG, "Window message: %d", message);
  #endif
      switch (message) {
      case WM_CREATE:
!         if (options.ShowOnTray)		/* Do not need the time if not showing the icon on the tray */
!             SetTimer(hwnd, 0x29a, 1000, NULL); /* 1-second timer */
          return TRUE;
  
      case WM_SIZE:
          GetClientRect(hwnd, &rect);
          MoveWindow(EditControl, 0, 0, rect.right, rect.bottom, TRUE);
*** stunnel-4.04\options.c	Wed Jan 01 08:21:58 2003
--- options.c	Fri Jan 24 15:15:23 2003
***************
*** 553,562 ****
--- 553,587 ----
          log_raw("%18slevel 3 - verify peer with locally installed certificate",
          "");
          break;
      }
  
+     /* ShowOnTray */
+ #ifdef USE_WIN32
+     switch(cmd) {
+     case CMD_INIT:
+         options.ShowOnTray=1;
+         break;
+     case CMD_EXEC:
+         if(strcasecmp(opt, "ShowOnTray"))
+             break;
+         if(!strcasecmp(arg, "yes"))
+             options.ShowOnTray=1;
+         else if(!strcasecmp(arg, "no"))
+             options.ShowOnTray=0;
+         else
+             return "argument should be either 'yes' or 'no'";
+         return NULL; /* OK */
+     case CMD_DEFAULT:
+         log_raw("%-15s = yes", "ShowOnTray");
+         break;
+     case CMD_HELP:
+         log_raw("%-15s = yes|no Show Icon on Tray option", "ShowOnTray");
+         break;
+     }
+ #endif
+ 
      if(cmd==CMD_EXEC)
          return option_not_found;
      return NULL; /* OK */
  }
