1 // Copyright (C) 1999 AT&T Laboratories Cambridge. All Rights Reserved.
3 // This file was part of the ups system.
5 // The ups system is free software; you can redistribute it and/or modify
6 // it under the terms of the GNU General Public License as published by
7 // the Free Software Foundation; either version 2 of the License, or
8 // (at your option) any later version.
10 // This program is distributed in the hope that it will be useful,
11 // but WITHOUT ANY WARRANTY; without even the implied warranty of
12 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 // GNU General Public License for more details.
15 // You should have received a copy of the GNU General Public License
16 // along with this program; if not, write to the Free Software
17 // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
20 // If the source code for the ups system is not available from the place
21 // whence you received this file, check http://www.uk.research.att.com/vnc or contact
22 // the authors on ups@uk.research.att.com for information on obtaining it.
24 // This file has been adapted to the Win32 version of Bacula
25 // by Kern E. Sibbald. Many thanks to ATT and James Weatherall,
26 // the original author, for providing an excellent template.
28 // Copyright (2000) Kern E. Sibbald
36 // This class provides access to service-oriented routines, under both
37 // Windows NT and Windows 95. Some routines only operate under one
38 // OS, others operate under any OS.
40 #if (!defined(_win_bacService))
41 #define _win_bacService
43 // The NT-specific code wrapper class
49 // SERVICE INSTALL & START FUNCTIONS
51 // Routine called by WinMain to cause Bacula to be installed
53 static int BaculaServiceMain();
55 // Routine to install the Apcupsd service on the local machine
56 static int InstallService();
58 // Routine to remove the Apcupsd service from the local machine
59 static int RemoveService();
61 // SERVICE SUPPORT FUNCTIONS
63 // Routine to establish and return the currently logged in user name
64 static BOOL CurrentUser(char *buffer, UINT size);
66 // Routine to post a message to the currently running Apcupsd server
67 // to pass it a handle to the current user
68 static BOOL PostUserHelperMessage();
69 // Routine to process a user helper message
70 static BOOL ProcessUserHelperMessage(WPARAM wParam, LPARAM lParam);
72 // Routines to establish which OS we're running on
73 static BOOL IsWin95();
74 static BOOL IsWinNT();
76 // Routine to establish whether the current instance is running
77 // as a service or not
78 static BOOL RunningAsService();
80 // Routine to kill any other running copy of Apcupsd
81 static BOOL KillRunningCopy();
83 // Routine to set the current thread into the given desktop
84 static BOOL SelectHDESK(HDESK newdesktop);
86 // Routine to set the current thread into the named desktop,
87 // or the input desktop if no name is given
88 static BOOL SelectDesktop(char *name);
90 // Routine to establish whether the current thread desktop is the
91 // current user input one
92 static BOOL InputDesktopSelected();
94 // Routine to fake a CtrlAltDel to winlogon when required.
95 // *** This is a nasty little hack...
96 static BOOL SimulateCtrlAltDel();
98 // Routine to make any currently running version of Apcupsd show its
99 // Properties dialog, to allow the user to make changes to their settings
100 static BOOL ShowProperties();
102 // Routine to make any currently running version of Apcupsd show the
103 // Properties dialog for the default settings, so the user can make changes
104 static BOOL ShowDefaultProperties();
106 // Routine to make the an already running copy of Apcupsd bring up its
107 // About box so you can check the version!
108 static BOOL ShowAboutBox();
110 // Routine to make the an already running copy of Apcupsd bring up its
112 static BOOL ShowStatus();
114 // Routine to make the an already running copy of Apcupsd bring up its
116 static BOOL ShowEvents();
118 // Routine to make an already running copy of Apcupsd form an outgoing
119 // connection to a new ups client
120 static BOOL PostAddNewClient(unsigned long ipaddress);