looks good
authorVolker Birk <vb@pep-project.org>
Wed, 29 Jun 2016 14:12:48 +0200
changeset 1343929bfe563d5
parent 133 e258d39e1a61
child 135 88bca039da23
looks good
GateKeeper.cpp
     1.1 --- a/GateKeeper.cpp	Wed Jun 29 13:50:38 2016 +0200
     1.2 +++ b/GateKeeper.cpp	Wed Jun 29 14:12:48 2016 +0200
     1.3 @@ -171,10 +171,10 @@
     1.4              now = time(NULL);
     1.5              assert(now != -1);
     1.6  
     1.7 -            //if (now > next) {
     1.8 +            if (now > next) {
     1.9                  next = now + GateKeeper::cycle;
    1.10                  keep_updated();
    1.11 -            //}
    1.12 +            }
    1.13  
    1.14              Sleep(waiting);
    1.15          }
    1.16 @@ -358,7 +358,7 @@
    1.17  
    1.18      void GateKeeper::install_msi(tstring filename)
    1.19      {
    1.20 -
    1.21 +        ShellExecute(NULL, _T("open"), filename.c_str(), NULL, NULL, SW_SHOW);
    1.22      }
    1.23  
    1.24      void GateKeeper::update_product(product p, DWORD context)
    1.25 @@ -432,6 +432,8 @@
    1.26          if (status)
    1.27              goto closing;
    1.28  
    1.29 +        BCryptDestroyKey(dk);
    1.30 +
    1.31          TCHAR temp_path[MAX_PATH + 1];
    1.32          GetTempPath(MAX_PATH, temp_path);
    1.33          filename = temp_path;
    1.34 @@ -448,8 +450,6 @@
    1.35  
    1.36          install_msi(filename);
    1.37  
    1.38 -        DeleteFile(filename.c_str());
    1.39 -        BCryptDestroyKey(dk);
    1.40          return;
    1.41  
    1.42      closing:
    1.43 @@ -459,15 +459,11 @@
    1.44              CloseHandle(hFile);
    1.45          if (hUrl)
    1.46              InternetCloseHandle(hUrl);
    1.47 -        if (filename.length())
    1.48 -            DeleteFile(filename.c_str());
    1.49          BCryptDestroyKey(dk);
    1.50      }
    1.51  
    1.52      void GateKeeper::keep_updated()
    1.53      {
    1.54 -        // return; // disabled for now
    1.55 -
    1.56          NTSTATUS status = BCryptOpenAlgorithmProvider(&hAES, BCRYPT_AES_ALGORITHM, MS_PRIMITIVE_PROVIDER, 0);
    1.57          assert(status == 0);
    1.58          if (status)