pEpCOMServerAdapter.h
author Markus Schaber <markus@pep-security.net>
Tue, 04 Oct 2016 23:07:42 +0200
branchkeysync
changeset 178 9f30e2a5f72c
parent 140 3975758c4320
child 215 033aa489f9d6
permissions -rw-r--r--
COM-30 COM-24: Refactorings
Drop unused enum.
     1 #include "stdafx.h"
     2 
     3 #include "pEpCOMServerAdapter_i.h"
     4 
     5 using namespace ATL;
     6 using namespace std;
     7 
     8 class CpEpCOMServerAdapterModule : public ATL::CAtlExeModuleT< CpEpCOMServerAdapterModule > {
     9 public:
    10     CpEpCOMServerAdapterModule() : ATL::CAtlExeModuleT< CpEpCOMServerAdapterModule >(), gatekeeper_thread(NULL), _hModule(NULL)
    11     {
    12     }
    13 
    14     DECLARE_LIBID(LIBID_pEpCOMServerAdapterLib)
    15     DECLARE_REGISTRY_APPID_RESOURCEID(IDR_PEPCOMSERVERADAPTER, "{B3480081-82C0-4EE4-9AA1-3F513C9D78DD}")
    16 
    17     HMODULE hModule()
    18     {
    19         return _hModule;
    20     }
    21 
    22     void hModule(HMODULE m)
    23     {
    24         _hModule = m;
    25     }
    26 
    27     void start_gatekeeper()
    28     {
    29         this->Lock(); // never exit
    30 
    31         try {
    32             gatekeeper_thread = new thread(gatekeeper, this);
    33             gatekeeper_thread->detach();
    34         }
    35         catch (system_error&) {
    36 
    37         }
    38     }
    39 
    40 protected:
    41     static void gatekeeper(CpEpCOMServerAdapterModule * self);
    42 
    43 private:
    44     thread *gatekeeper_thread;
    45     HMODULE _hModule;
    46 };