*   Version $Id$
  */
 /*
-   Copyright (C) 2000, 2001, 2002 Kern Sibbald and John Walker
+   Copyright (C) 2000-2005 Kern Sibbald
 
    This program is free software; you can redistribute it and/or
-   modify it under the terms of the GNU General Public License as
-   published by the Free Software Foundation; either version 2 of
-   the License, or (at your option) any later version.
+   modify it under the terms of the GNU General Public License
+   version 2 as amended with additional clauses defined in the
+   file LICENSE in the main source directory.
 
    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-   General Public License for more details.
-
-   You should have received a copy of the GNU General Public
-   License along with this program; if not, write to the Free
-   Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
-   MA 02111-1307, USA.
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 
+   the file LICENSE for additional details.
 
  */
 
-
 #include "bacula.h"
 #include "filed.h"
 
 
   return TRUE;
 }
 
-#ifdef xxx_needed
-// Static routine to show the Events dialog for a currently-running
-// copy of Bacula, (usually a servicified version.)
-
-BOOL
-bacService::ShowEvents()
-{
-  // Post to the Bacula menu window
-  if (!PostToBacula(MENU_EVENTS_SHOW, 0, 0)) {
-     MessageBox(NULL, "No existing instance of Bacula could be contacted", szAppName, MB_ICONEXCLAMATION | MB_OK);
-     return FALSE;
-  }
-  return TRUE;
-}
-
-
-// Static routine to tell a locally-running instance of the server
-// to connect out to a new client
-
-BOOL
-bacService::PostAddNewClient(unsigned long ipaddress)
-{
-  // Post to the Bacula menu window
-  if (!PostToBacula(MENU_ADD_CLIENT_MSG, 0, ipaddress)) {
-     MessageBox(NULL, "No existing instance of Bacula could be contacted", szAppName, MB_ICONEXCLAMATION | MB_OK);
-     return FALSE;
-  }
-
-  return TRUE;
-}
-#endif
-
 // SERVICE-MODE ROUTINES
 
 // Service-mode defines:
   return TRUE;
 }
 
-#ifdef xxx_needed
-
-// ROUTINE TO POST THE HANDLE OF THE CURRENT USER TO THE RUNNING Bacula, IN ORDER
-// THAT IT CAN LOAD THE APPROPRIATE SETTINGS.  THIS IS USED ONLY BY THE SVCHELPER
-// OPTION, WHEN RUNNING UNDER NT
-BOOL
-bacService::PostUserHelperMessage()
-{
-  // - Check the platform type
-  if (!IsWinNT()) {
-     return TRUE;
-  }
-
-  // - Get the current process ID
-  DWORD processId = GetCurrentProcessId();
-
-  // - Post it to the existing Bacula
-  if (!PostToBacula(MENU_SERVICEHELPER_MSG, 0, (LPARAM)processId)) {
-     return FALSE;
-  }
-
-  // - Wait until it's been used
-  return TRUE;
-}
-
-// ROUTINE TO PROCESS AN INCOMING INSTANCE OF THE ABOVE MESSAGE
-BOOL
-bacService::ProcessUserHelperMessage(WPARAM wParam, LPARAM lParam) {
-   return TRUE;
-}
-
-#endif
-
 // SERVICE MAIN ROUTINE
 int
 bacService::BaculaServiceMain()
       CloseServiceHandle(hsrvmanager);
       CloseServiceHandle(hservice);
 
+#ifdef xxx_needed
       // Now install the servicehelper registry setting...
       // Locate the RunService registry entry
       HKEY runapps;
              RegCloseKey(runapps);
          }
       }
+#endif
 
       // Everything went fine
       MessageBox(NULL,
       SC_HANDLE   hservice;
       SC_HANDLE   hsrvmanager;
 
+#ifdef xxx_needed
       // Attempt to remove the service-helper hook
       HKEY runapps;
       if (RegOpenKey(HKEY_LOCAL_MACHINE, "Software\\Microsoft\\Windows\\CurrentVersion\\Run",
          }
          RegCloseKey(runapps);
       }
+#endif
 
       // Open the SCM
       hsrvmanager = OpenSCManager(
  
     sdBuf.lpDescription = lpDesc;
 
-    if(!ChangeServiceDescription(
+    if (!ChangeServiceDescription(
          hService,                   // handle to service
          SERVICE_CONFIG_DESCRIPTION, // change: description
          &sdBuf) ) {                 // value: new description
        log_error_message("ChangeServiceConfig2");
-    } else {
-       printf("ChangeServiceConfig2 SUCCESS\n");
     }
 
     // Release the database lock. 
 
    {"description",           store_str,  ITEM(res_dir.hdr.desc),     0, 0, 0},
    {"sdaddress",             store_addresses_address,  ITEM(res_store.sdaddrs),     0, ITEM_DEFAULT, 9103},
    {"sdaddresses",           store_addresses,  ITEM(res_store.sdaddrs), 0, ITEM_DEFAULT, 9103},
-   {"messages",              store_res,  ITEM(res_store.messages),   0, R_MSGS, 0},
+   {"messages",              store_res,  ITEM(res_store.messages),   R_MSGS, 0, 0},
    {"sdport",                store_addresses_port,  ITEM(res_store.sdaddrs),     0, ITEM_DEFAULT, 9103},
    {"workingdirectory",      store_dir,  ITEM(res_store.working_directory), 0, ITEM_REQUIRED, 0},
    {"piddirectory",          store_dir,  ITEM(res_store.pid_directory), 0, ITEM_REQUIRED, 0},
 
    Copyright (C) 2000-2005 Kern Sibbald
 
    This program is free software; you can redistribute it and/or
-   modify it under the terms of the GNU General Public License as
-   published by the Free Software Foundation; either version 2 of
-   the License, or (at your option) any later version.
+   modify it under the terms of the GNU General Public License
+   version 2 as amended with additional clauses defined in the
+   file LICENSE in the main source directory.
 
    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-   General Public License for more details.
-
-   You should have received a copy of the GNU General Public
-   License along with this program; if not, write to the Free
-   Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
-   MA 02111-1307, USA.
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 
+   the file LICENSE for additional details.
 
  */
 
 
 /* */
 #undef  VERSION
 #define VERSION "1.37.32"
-#define BDATE   "22 July 2005"
-#define LSMDATE "22Jul05"
+#define BDATE   "24 July 2005"
+#define LSMDATE "24Jul05"
 
 /* Debug flags */
 #undef  DEBUG
 
   StrCmp $6 0 NoCygwin
   StrCpy $INSTDIR "c:\cygwin\bacula"
  NoCygwin:
-; IfFileExists "c:\cygwin" Cygwin ReallyNoCygwin
+; IfFileExists "c:\cygwin\bin\cygwin1.dll" Cygwin ReallyNoCygwin
 ;Cygwin:
 ; StrCpy $INSTDIR "c:\cygwin\bacula"
 ;ReallyNoCygwin:
   IfFileExists "$INSTDIR\bin\bacula-fd.conf" Upgrade NoUpgrade
  Upgrade:
     StrCpy $7 1
-    ; Shutdown any baculas that could be running
+    ; Shutdown any bacula that could be running
     ExecWait '"$INSTDIR\bin\bacula-fd.exe" /kill'
     ; give it some time to shutdown
     Sleep 1000