GateKeeper.h
author Volker Birk <vb@pep-project.org>
Sun, 19 Jun 2016 08:17:04 +0200
changeset 89 56b26b1c4f3b
parent 88 659d0fc5bc30
child 94 59e25c32911a
permissions -rw-r--r--
starting gatekeeper after init of module
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@89
    16
    CpEpCOMServerAdapterModule * const module() const
vb@89
    17
    {
vb@89
    18
        return _self;
vb@89
    19
    }
vb@89
    20
vb@88
    21
    void keep();
vb@88
    22
vb@88
    23
protected:
vb@88
    24
    static const LPCTSTR plugin_reg_path;
vb@88
    25
    static const LPCTSTR plugin_reg_value_name;
vb@88
    26
    static const time_t cycle;
vb@88
    27
    static const DWORD waiting;
vb@88
    28
vb@88
    29
    static time_t time_diff();
vb@88
    30
    void keep_plugin();
vb@88
    31
    void keep_updated();
vb@88
    32
vb@88
    33
private:
vb@88
    34
    time_t now;
vb@88
    35
    time_t next;
vb@88
    36
    HKEY cu;
vb@88
    37
vb@88
    38
    CpEpCOMServerAdapterModule * const _self;
vb@88
    39
};