2
* synergy -- mouse and keyboard sharing utility
3
* Copyright (C) 2002 Chris Schoeneman
5
* This package is free software; you can redistribute it and/or
6
* modify it under the terms of the GNU General Public License
7
* found in the file COPYING that should have accompanied this file.
9
* This package is distributed in the hope that it will be useful,
10
* but WITHOUT ANY WARRANTY; without even the implied warranty of
11
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12
* GNU General Public License for more details.
15
#ifndef CARCHMISCWINDOWS_H
16
#define CARCHMISCWINDOWS_H
18
#define WIN32_LEAN_AND_MEAN
21
#include "stdstring.h"
24
//! Miscellaneous win32 functions.
25
class CArchMiscWindows {
27
typedef int (*RunFunc)(void);
29
//! Test if windows 95, et al.
31
Returns true iff the platform is win95/98/me.
33
static bool isWindows95Family();
37
Delegates to CArchDaemonWindows.
39
static int runDaemon(RunFunc runFunc);
41
//! Indicate daemon is in main loop
43
Delegates to CArchDaemonWindows.
45
static void daemonRunning(bool running);
47
//! Indicate failure of running daemon
49
Delegates to CArchDaemonWindows.
51
static void daemonFailed(int result);
53
//! Open and return a registry key, closing the parent key
54
static HKEY openKey(HKEY parent, const TCHAR* child);
56
//! Open and return a registry key, closing the parent key
57
static HKEY openKey(HKEY parent, const TCHAR* const* keyPath);
60
static void closeKey(HKEY);
62
//! Delete a key (which should have no subkeys)
63
static void deleteKey(HKEY parent, const TCHAR* name);
66
static void deleteValue(HKEY parent, const TCHAR* name);
68
//! Test if a value exists
69
static bool hasValue(HKEY key, const TCHAR* name);
71
//! Set a string value in the registry
72
static void setValue(HKEY key, const TCHAR* name,
73
const std::string& value);
75
//! Set a DWORD value in the registry
76
static void setValue(HKEY key, const TCHAR* name, DWORD value);
78
//! Read a string value from the registry
79
static std::string readValueString(HKEY, const TCHAR* name);
81
//! Read a DWORD value from the registry
82
static DWORD readValueInt(HKEY, const TCHAR* name);