]> git.sur5r.net Git - bacula/bacula/blob - bacula/src/filed/win32/winservice.h
Fix problem of accents with new Win32 code.
[bacula/bacula] / bacula / src / filed / win32 / winservice.h
1 //  Copyright (C) 1999 AT&T Laboratories Cambridge. All Rights Reserved.
2 //
3 //  This file was part of the ups system.
4 //
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.
9 //
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.
14 //
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,
18 //  USA.
19 //
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.
23 //
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.
27 //
28 // Copyright (C) 2000-2006 Kern E. Sibbald
29 //
30
31
32 // winservice.cpp
33
34 // SERVICE-MODE CODE
35
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.
39
40 class bacService;
41
42 #if (!defined(_win_bacService))
43 #define _win_bacService
44
45 // The NT-specific code wrapper class
46 class bacService
47 {
48 public:
49         bacService();
50
51    // SERVICE INSTALL & START FUNCTIONS
52
53    // Routine called by WinMain to cause Bacula to be installed
54    // as a service.
55    static int BaculaServiceMain();
56
57    // Routine to install the Apcupsd service on the local machine
58    static int InstallService();
59
60    // Routine to remove the Apcupsd service from the local machine
61    static int RemoveService();
62
63    // SERVICE SUPPORT FUNCTIONS
64
65    // Routine to establish and return the currently logged in user name
66    static BOOL CurrentUser(char *buffer, UINT size);
67
68    // Routine to post a message to the currently running Apcupsd server
69    // to pass it a handle to the current user
70    static BOOL PostUserHelperMessage();
71    // Routine to process a user helper message
72    static BOOL ProcessUserHelperMessage(WPARAM wParam, LPARAM lParam);
73
74    // Routines to establish which OS we're running on
75    static BOOL IsWin95();
76    static BOOL IsWinNT();
77
78    // Routine to establish whether the current instance is running
79    // as a service or not
80    static BOOL RunningAsService();
81
82    // Routine to kill any other running copy of Apcupsd
83    static BOOL KillRunningCopy();
84
85    // Routine to set the current thread into the given desktop
86    static BOOL SelectHDESK(HDESK newdesktop);
87
88    // Routine to set the current thread into the named desktop,
89    // or the input desktop if no name is given
90    static BOOL SelectDesktop(char *name);
91
92    // Routine to establish whether the current thread desktop is the
93    // current user input one
94    static BOOL InputDesktopSelected();
95
96    // Routine to fake a CtrlAltDel to winlogon when required.
97    // *** This is a nasty little hack...
98    static BOOL SimulateCtrlAltDel();
99
100    // Routine to make any currently running version of Apcupsd show its
101    // Properties dialog, to allow the user to make changes to their settings
102    static BOOL ShowProperties();
103
104    // Routine to make any currently running version of Apcupsd show the
105    // Properties dialog for the default settings, so the user can make changes
106    static BOOL ShowDefaultProperties();
107
108    // Routine to make the an already running copy of Apcupsd bring up its
109    // About box so you can check the version!
110    static BOOL ShowAboutBox();
111
112    // Routine to make the an already running copy of Apcupsd bring up its
113    // Status dialog
114    static BOOL ShowStatus();
115
116    // Routine to make the an already running copy of Apcupsd bring up its
117    // Events dialog
118    static BOOL ShowEvents();
119
120    // Routine to make an already running copy of Apcupsd form an outgoing
121    // connection to a new ups client
122    static BOOL PostAddNewClient(unsigned long ipaddress);
123 };
124
125 #endif