GateKeeper.h
author Volker Birk <vb@pep-project.org>
Sun, 19 Jun 2016 07:59:43 +0200
changeset 88 659d0fc5bc30
child 89 56b26b1c4f3b
permissions -rw-r--r--
nicer
vb@88
     1
class CpEpCOMServerAdapterModule;
vb@88
     2
vb@88
     3
class GateKeeper {
vb@88
     4
public:
vb@88
     5
    GateKeeper(CpEpCOMServerAdapterModule * const self) : _self(self), now(time(NULL)), next(now + time_diff())
vb@88
     6
    {
vb@88
     7
        LONG lResult = RegOpenCurrentUser(KEY_READ, &cu);
vb@88
     8
        assert(lResult == ERROR_SUCCESS);
vb@88
     9
    }
vb@88
    10
vb@88
    11
    ~GateKeeper()
vb@88
    12
    {
vb@88
    13
        RegCloseKey(cu);
vb@88
    14
    }
vb@88
    15
vb@88
    16
    void keep();
vb@88
    17
vb@88
    18
protected:
vb@88
    19
    static const LPCTSTR plugin_reg_path;
vb@88
    20
    static const LPCTSTR plugin_reg_value_name;
vb@88
    21
    static const time_t cycle;
vb@88
    22
    static const DWORD waiting;
vb@88
    23
vb@88
    24
    static time_t time_diff();
vb@88
    25
    void keep_plugin();
vb@88
    26
    void keep_updated();
vb@88
    27
vb@88
    28
private:
vb@88
    29
    time_t now;
vb@88
    30
    time_t next;
vb@88
    31
    HKEY cu;
vb@88
    32
vb@88
    33
    CpEpCOMServerAdapterModule * const _self;
vb@88
    34
};