GateKeeper.cpp
changeset 228 3419c95178c0
parent 225 9db6ab24dee7
child 269 26c8597fe860
     1.1 --- a/GateKeeper.cpp	Wed Dec 07 20:53:29 2016 +0100
     1.2 +++ b/GateKeeper.cpp	Thu Dec 08 14:32:21 2016 +0100
     1.3 @@ -119,7 +119,7 @@
     1.4      const DWORD GateKeeper::waiting = 10000; // 10000 ms is 10 sec
     1.5  
     1.6      GateKeeper::GateKeeper(CpEpCOMServerAdapterModule * self)
     1.7 -        : _self(self), now(time(NULL)), next(now /*+ time_diff()*/), hkUpdater(NULL), hkPluginStart(NULL),
     1.8 +        : _self(self), now(time(NULL)), next(now /*+ time_diff()*/), hkUpdater(NULL),
     1.9              internet(NULL), hAES(NULL), hRSA(NULL)
    1.10      {
    1.11  		DeleteFile(get_lockFile().c_str());
    1.12 @@ -133,16 +133,9 @@
    1.13  
    1.14          if (cu_open) {
    1.15              LONG lResult = RegOpenKeyEx(cu, updater_reg_path, 0, KEY_READ, &hkUpdater);
    1.16 -            assert(lResult == ERROR_SUCCESS);
    1.17 -            if (lResult != ERROR_SUCCESS)
    1.18 -                return;
    1.19 -
    1.20 -            lResult = RegOpenKeyEx(cu, plugin_reg_path, 0, KEY_WRITE, &hkPluginStart);
    1.21 -            assert(lResult == ERROR_SUCCESS);
    1.22 -            if (lResult != ERROR_SUCCESS)
    1.23 -                return;
    1.24 -            RegCloseKey(hkPluginStart);
    1.25 -        }
    1.26 +			if (lResult != ERROR_SUCCESS)
    1.27 +				RegCreateKeyEx(cu, updater_reg_path, 0, NULL, REG_OPTION_NON_VOLATILE, KEY_READ, NULL, &hkUpdater, NULL);
    1.28 +		}
    1.29      }
    1.30      
    1.31      GateKeeper::~GateKeeper()
    1.32 @@ -192,11 +185,9 @@
    1.33  
    1.34      void GateKeeper::keep_plugin()
    1.35      {
    1.36 -        if (!hkPluginStart)
    1.37 -            return;
    1.38 +		HKEY hkPluginStart = NULL;
    1.39  
    1.40          LONG lResult = RegOpenKeyEx(cu, plugin_reg_path, 0, KEY_WRITE, &hkPluginStart);
    1.41 -        assert(lResult == ERROR_SUCCESS);
    1.42          if (lResult != ERROR_SUCCESS)
    1.43              return;
    1.44