| 1 | /* | 
|---|
| 2 | * synergy -- mouse and keyboard sharing utility | 
|---|
| 3 | * Copyright (C) 2002 Chris Schoeneman | 
|---|
| 4 | * | 
|---|
| 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. | 
|---|
| 8 | * | 
|---|
| 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. | 
|---|
| 13 | */ | 
|---|
| 14 |  | 
|---|
| 15 | #ifndef CAUTOSTART_H | 
|---|
| 16 | #define CAUTOSTART_H | 
|---|
| 17 |  | 
|---|
| 18 | #include "CString.h" | 
|---|
| 19 |  | 
|---|
| 20 | #define WINDOWS_LEAN_AND_MEAN | 
|---|
| 21 | #include <windows.h> | 
|---|
| 22 |  | 
|---|
| 23 | //! Auto start dialog for Microsoft Windows launcher | 
|---|
| 24 | class CAutoStart { | 
|---|
| 25 | public: | 
|---|
| 26 | CAutoStart(HWND parent, bool isServer, const CString& cmdLine); | 
|---|
| 27 | ~CAutoStart(); | 
|---|
| 28 |  | 
|---|
| 29 | //! @name manipulators | 
|---|
| 30 | //@{ | 
|---|
| 31 |  | 
|---|
| 32 | //! Run dialog | 
|---|
| 33 | /*! | 
|---|
| 34 | Display and handle the dialog until closed by the user. | 
|---|
| 35 | */ | 
|---|
| 36 | void                            doModal(); | 
|---|
| 37 |  | 
|---|
| 38 | //! Reinstall daemon | 
|---|
| 39 | /*! | 
|---|
| 40 | Reinstalls the currently installed daemon. | 
|---|
| 41 | */ | 
|---|
| 42 | static void                     reinstallDaemon(bool isClient, const CString& cmdLine); | 
|---|
| 43 |  | 
|---|
| 44 | //! Uninstalls daemon | 
|---|
| 45 | /*! | 
|---|
| 46 | Uninstalls all installed client (\p client is \c true) or server daemons. | 
|---|
| 47 | */ | 
|---|
| 48 | static void                     uninstallDaemons(bool client); | 
|---|
| 49 |  | 
|---|
| 50 | //! Starts an installed daemon | 
|---|
| 51 | /*! | 
|---|
| 52 | Returns \c true iff a daemon was started.  This will only start daemons | 
|---|
| 53 | installed for all users. | 
|---|
| 54 | */ | 
|---|
| 55 | static bool                     startDaemon(); | 
|---|
| 56 |  | 
|---|
| 57 | //@} | 
|---|
| 58 | //! @name accessors | 
|---|
| 59 | //@{ | 
|---|
| 60 |  | 
|---|
| 61 | //! Tests if any daemons are installed | 
|---|
| 62 | /*! | 
|---|
| 63 | Returns \c true if any daemons are installed. | 
|---|
| 64 | */ | 
|---|
| 65 | static bool                     isDaemonInstalled(); | 
|---|
| 66 |  | 
|---|
| 67 | //@} | 
|---|
| 68 |  | 
|---|
| 69 | private: | 
|---|
| 70 | void                            update(); | 
|---|
| 71 | bool                            onInstall(bool allUsers); | 
|---|
| 72 | bool                            onUninstall(bool allUsers); | 
|---|
| 73 |  | 
|---|
| 74 | // message handling | 
|---|
| 75 | BOOL                            doDlgProc(HWND, UINT, WPARAM, LPARAM); | 
|---|
| 76 | static BOOL CALLBACK dlgProc(HWND, UINT, WPARAM, LPARAM); | 
|---|
| 77 |  | 
|---|
| 78 | private: | 
|---|
| 79 | static CAutoStart*      s_singleton; | 
|---|
| 80 |  | 
|---|
| 81 | HWND                            m_parent; | 
|---|
| 82 | bool                            m_isServer; | 
|---|
| 83 | CString                         m_cmdLine; | 
|---|
| 84 | CString                         m_name; | 
|---|
| 85 | HWND                            m_hwnd; | 
|---|
| 86 | bool                            m_install; | 
|---|
| 87 | CString                         m_errorMessage; | 
|---|
| 88 | }; | 
|---|
| 89 |  | 
|---|
| 90 | #endif | 
|---|