blob: 2ef2ee080ba827c9f8209db73a762027633b9f71 [file] [log] [blame]
Constantin Kaplinsky729598c2006-05-25 05:12:25 +00001/* Copyright (C) 2002-2005 RealVNC Ltd. All Rights Reserved.
2 *
3 * This is free software; you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License as published by
5 * the Free Software Foundation; either version 2 of the License, or
6 * (at your option) any later version.
7 *
8 * This software is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this software; if not, write to the Free Software
15 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
16 * USA.
17 */
18
19// -=- WinVNC Version 4.0 Service-Mode implementation
20
21#include <winvnc/VNCServerService.h>
22#include <rfb_win32/OSVersion.h>
23
24using namespace winvnc;
25using namespace rfb;
26using namespace win32;
27
28const TCHAR* winvnc::VNCServerService::Name = _T("WinVNC4");
29
30
31VNCServerService::VNCServerService(VNCServerWin32& s)
32 : Service(Name), server(s) {
33 // - Set the service-mode logging defaults
34 // These will be overridden by the Log option in the
35 // registry, if present.
36 if (osVersion.isPlatformNT)
37 logParams.setParam("*:EventLog:0,Connections:EventLog:100");
38 else
39 logParams.setParam("*:file:0,Connections:file:100");
40}
41
42
43DWORD VNCServerService::serviceMain(int argc, TCHAR* argv[]) {
44 setStatus(SERVICE_RUNNING);
45 int result = server.run();
46 setStatus(SERVICE_STOP_PENDING);
47 return result;
48}
49
50void VNCServerService::stop() {
51 server.stop();
52}