correcting updater and plugin start keeping
authorVolker Birk <vb@pep-project.org>
Thu, 08 Dec 2016 14:32:21 +0100
changeset 2283419c95178c0
parent 227 5bc3d8cb9415
child 229 c294e5a60ceb
correcting updater and plugin start keeping
GateKeeper.cpp
GateKeeper.h
     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  
     2.1 --- a/GateKeeper.h	Wed Dec 07 20:53:29 2016 +0100
     2.2 +++ b/GateKeeper.h	Thu Dec 08 14:32:21 2016 +0100
     2.3 @@ -60,7 +60,6 @@
     2.4          bool cu_open;
     2.5          HKEY cu;
     2.6          HKEY hkUpdater;
     2.7 -        HKEY hkPluginStart;
     2.8          HINTERNET internet;
     2.9          BCRYPT_ALG_HANDLE hAES;
    2.10          BCRYPT_ALG_HANDLE hRSA;