Deskflow 1.22.0.197
Keyboard and mouse sharing utility
Loading...
Searching...
No Matches
ArchMiscWindows Class Reference

Miscellaneous win32 functions. More...

#include <ArchMiscWindows.h>

Public Types

enum  EValueType {
  kUNKNOWN , kNO_VALUE , kUINT , kSTRING ,
  kBINARY
}
enum  EBusyModes { kIDLE = 0x0000 , kSYSTEM = 0x0001 , kDISPLAY = 0x0002 }
using RunFunc = std::function<int(void)>

Static Public Member Functions

static void init ()
 Initialize.
static int runDaemon (RunFunc runFunc)
 Run the daemon.
static void daemonRunning (bool running)
 Indicate daemon is in main loop.
static void daemonFailed (int result)
 Indicate failure of running daemon.
static UINT getDaemonQuitMessage ()
 Get daemon quit message.
static HKEY openKey (HKEY parent, const TCHAR *child)
 Open and return a registry key, closing the parent key.
static HKEY openKey (HKEY parent, const TCHAR *const *keyPath)
 Open and return a registry key, closing the parent key.
static HKEY addKey (HKEY parent, const TCHAR *child)
 Open/create and return a registry key, closing the parent key.
static HKEY addKey (HKEY parent, const TCHAR *const *keyPath)
 Open/create and return a registry key, closing the parent key.
static void closeKey (HKEY)
 Close a key.
static void deleteKey (HKEY parent, const TCHAR *name)
 Delete a key (which should have no subkeys)
static EValueType typeOfValue (HKEY key, const TCHAR *name)
 Get type of value.
static void setValue (HKEY key, const TCHAR *name, const std::string &value)
 Set a string value in the registry.
static void setValue (HKEY key, const TCHAR *name, DWORD value)
 Set a DWORD value in the registry.
static std::string readValueString (HKEY, const TCHAR *name)
 Read a string value from the registry.
static DWORD readValueInt (HKEY, const TCHAR *name)
 Read a DWORD value from the registry.
static void addBusyState (DWORD busyModes)
 Disable power saving.
static void removeBusyState (DWORD busyModes)
 Enable power saving.
static void wakeupDisplay ()
 Briefly interrupt power saving.
static bool wasLaunchedAsService ()
 Returns true if this process was launched via NT service host.
static bool getParentProcessName (std::string &name)
 Returns true if we got the parent process name.
static void guardRuntimeVersion ()
 Prevent hard to troubleshoot errors, e.g. access violations.
static HINSTANCE instanceWin32 ()
 Gets the window instance saved at program start.
static void setInstanceWin32 (HINSTANCE instance)
 Saves the window instance for later use.
static std::string getActiveDesktopName ()
 Get the name of the active input desktop.
static bool isProcessElevated ()
 Returns true if the process is running with elevated privileges (i.e. as admin).

Detailed Description

Miscellaneous win32 functions.

Member Typedef Documentation

◆ RunFunc

using ArchMiscWindows::RunFunc = std::function<int(void)>

Member Enumeration Documentation

◆ EBusyModes

Enumerator
kIDLE 
kSYSTEM 
kDISPLAY 

◆ EValueType

Enumerator
kUNKNOWN 
kNO_VALUE 
kUINT 
kSTRING 
kBINARY 

Member Function Documentation

◆ addBusyState()

void ArchMiscWindows::addBusyState ( DWORD busyModes)
static

Disable power saving.

◆ addKey() [1/2]

HKEY ArchMiscWindows::addKey ( HKEY parent,
const TCHAR * child )
static

Open/create and return a registry key, closing the parent key.

◆ addKey() [2/2]

HKEY ArchMiscWindows::addKey ( HKEY parent,
const TCHAR *const * keyPath )
static

Open/create and return a registry key, closing the parent key.

◆ closeKey()

void ArchMiscWindows::closeKey ( HKEY key)
static

Close a key.

◆ daemonFailed()

void ArchMiscWindows::daemonFailed ( int result)
static

Indicate failure of running daemon.

Delegates to ArchDaemonWindows.

◆ daemonRunning()

void ArchMiscWindows::daemonRunning ( bool running)
static

Indicate daemon is in main loop.

Delegates to ArchDaemonWindows.

◆ deleteKey()

void ArchMiscWindows::deleteKey ( HKEY parent,
const TCHAR * name )
static

Delete a key (which should have no subkeys)

◆ getActiveDesktopName()

std::string ArchMiscWindows::getActiveDesktopName ( )
static

Get the name of the active input desktop.

◆ getDaemonQuitMessage()

UINT ArchMiscWindows::getDaemonQuitMessage ( )
static

Get daemon quit message.

Delegates to ArchDaemonWindows.

◆ getParentProcessName()

bool ArchMiscWindows::getParentProcessName ( std::string & name)
static

Returns true if we got the parent process name.

◆ guardRuntimeVersion()

void ArchMiscWindows::guardRuntimeVersion ( )
static

Prevent hard to troubleshoot errors, e.g. access violations.

◆ init()

void ArchMiscWindows::init ( )
static

Initialize.

◆ instanceWin32()

HINSTANCE ArchMiscWindows::instanceWin32 ( )
static

Gets the window instance saved at program start.

e.g. Used by GetModuleFileName which is used when installing the daemon.

◆ isProcessElevated()

bool ArchMiscWindows::isProcessElevated ( )
static

Returns true if the process is running with elevated privileges (i.e. as admin).

◆ openKey() [1/2]

HKEY ArchMiscWindows::openKey ( HKEY parent,
const TCHAR * child )
static

Open and return a registry key, closing the parent key.

◆ openKey() [2/2]

HKEY ArchMiscWindows::openKey ( HKEY parent,
const TCHAR *const * keyPath )
static

Open and return a registry key, closing the parent key.

◆ readValueInt()

DWORD ArchMiscWindows::readValueInt ( HKEY key,
const TCHAR * name )
static

Read a DWORD value from the registry.

◆ readValueString()

std::string ArchMiscWindows::readValueString ( HKEY key,
const TCHAR * name )
static

Read a string value from the registry.

◆ removeBusyState()

void ArchMiscWindows::removeBusyState ( DWORD busyModes)
static

Enable power saving.

◆ runDaemon()

int ArchMiscWindows::runDaemon ( RunFunc runFunc)
static

Run the daemon.

Delegates to ArchDaemonWindows.

◆ setInstanceWin32()

void ArchMiscWindows::setInstanceWin32 ( HINSTANCE instance)
static

Saves the window instance for later use.

◆ setValue() [1/2]

void ArchMiscWindows::setValue ( HKEY key,
const TCHAR * name,
const std::string & value )
static

Set a string value in the registry.

◆ setValue() [2/2]

void ArchMiscWindows::setValue ( HKEY key,
const TCHAR * name,
DWORD value )
static

Set a DWORD value in the registry.

◆ typeOfValue()

ArchMiscWindows::EValueType ArchMiscWindows::typeOfValue ( HKEY key,
const TCHAR * name )
static

Get type of value.

◆ wakeupDisplay()

void ArchMiscWindows::wakeupDisplay ( )
static

Briefly interrupt power saving.

◆ wasLaunchedAsService()

bool ArchMiscWindows::wasLaunchedAsService ( )
static

Returns true if this process was launched via NT service host.


The documentation for this class was generated from the following files: