p≡p COM server adapter
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

84 lines
2.0 KiB

2 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
  1. #include "stdafx.h"
  2. class CpEpCOMServerAdapterModule;
  3. using namespace std;
  4. namespace pEp {
  5. #ifdef UNICODE
  6. typedef wstring tstring;
  7. typedef wregex tregex;
  8. typedef wsmatch tsmatch;
  9. #else
  10. typedef string tstring;
  11. typedef regex tregex;
  12. typedef smatch tsmatch;
  13. #endif
  14. class GateKeeper {
  15. public:
  16. typedef pair<tstring, tstring> product;
  17. typedef vector< product > product_list;
  18. union aeskey_t {
  19. uint8_t c_key[32];
  20. uint16_t w_key[16];
  21. uint32_t dw_key[8];
  22. uint64_t qw_key[4];
  23. };
  24. GateKeeper(CpEpCOMServerAdapterModule * self);
  25. ~GateKeeper();
  26. CpEpCOMServerAdapterModule * const module() const
  27. {
  28. return _self;
  29. }
  30. void keep();
  31. product_list registered_products();
  32. bool update_product(product p, DWORD context = 0);
  33. bool update_enabled();
  34. void enable_update();
  35. void disable_update();
  36. void update_now();
  37. void show_notification(tstring title, tstring text);
  38. static GateKeeper *gatekeeper() { return the_gatekeeper; }
  39. protected:
  40. static const LPCTSTR plugin_reg_path;
  41. static const LPCTSTR plugin_reg_value_name;
  42. static const LPCTSTR updater_reg_path;
  43. static const time_t cycle;
  44. static const time_t fraction;
  45. static const DWORD waiting;
  46. static time_t time_diff();
  47. void keep_plugin();
  48. void execute_file(tstring filename);
  49. string update_key();
  50. BCRYPT_KEY_HANDLE delivery_key();
  51. string wrapped_delivery_key(BCRYPT_KEY_HANDLE hDeliveryKey);
  52. static tstring get_lockFile();
  53. static GateKeeper *the_gatekeeper;
  54. private:
  55. time_t now;
  56. time_t next;
  57. bool cu_open;
  58. HKEY cu;
  59. HKEY hkUpdater;
  60. HINTERNET internet;
  61. BCRYPT_ALG_HANDLE hAES;
  62. BCRYPT_ALG_HANDLE hRSA;
  63. CpEpCOMServerAdapterModule * _self;
  64. };
  65. }