bugfix: RegEnumValue
authorVolker Birk <vb@pep-project.org>
Sat, 02 Jul 2016 23:59:59 +0200
changeset 138053a45ab31e6
parent 137 58bb251fab53
child 139 70232b0fba50
bugfix: RegEnumValue
GateKeeper.cpp
     1.1 --- a/GateKeeper.cpp	Fri Jul 01 17:18:13 2016 +0200
     1.2 +++ b/GateKeeper.cpp	Sat Jul 02 23:59:59 2016 +0200
     1.3 @@ -337,15 +337,16 @@
     1.4          static product_list products;
     1.5  
     1.6          // https://msdn.microsoft.com/en-us/library/windows/desktop/ms724872(v=vs.85).aspx
     1.7 -        static TCHAR value_name[16384];
     1.8 +        TCHAR value_name[16384];
     1.9          DWORD value_name_size;
    1.10 -        static TCHAR value[L_MAX_URL_LENGTH + 1];
    1.11 +        TCHAR value[L_MAX_URL_LENGTH + 1];
    1.12          DWORD value_size;
    1.13  
    1.14          products.empty();
    1.15  
    1.16          LONG lResult = ERROR_SUCCESS;
    1.17          for (DWORD i = 0; lResult == ERROR_SUCCESS; i++) {
    1.18 +            value_name_size = 16383;
    1.19              value_size = L_MAX_URL_LENGTH + 1;
    1.20              lResult = RegEnumValue(hkUpdater, 0, value_name, &value_name_size, NULL, NULL, (LPBYTE) value, &value_size);
    1.21              if (lResult == ERROR_SUCCESS)
    1.22 @@ -382,6 +383,9 @@
    1.23          UCHAR iv[12];
    1.24          UCHAR nonce[sizeof(iv)];
    1.25          UCHAR tag[16];
    1.26 +        tstring filename;
    1.27 +        HANDLE hFile = NULL;
    1.28 +        char *unencrypted_buffer = NULL;
    1.29  
    1.30          try {
    1.31              DWORD reading;
    1.32 @@ -395,8 +399,8 @@
    1.33                  crypted += string(buffer, reading);
    1.34              } while (1);
    1.35          }
    1.36 -        catch (exception& e) {
    1.37 -            MessageBox(NULL, utility::utf16_string(e.what()).c_str(), _T("exception"), MB_ICONSTOP);
    1.38 +        catch (exception&) {
    1.39 +            goto closing;
    1.40          }
    1.41  
    1.42          InternetCloseHandle(hUrl);
    1.43 @@ -404,10 +408,6 @@
    1.44  
    1.45          memcpy(nonce, iv, sizeof(iv));
    1.46  
    1.47 -        tstring filename;
    1.48 -        HANDLE hFile = NULL;
    1.49 -        char *unencrypted_buffer = NULL;
    1.50 -
    1.51          BCRYPT_AUTHENTICATED_CIPHER_MODE_INFO authInfo;
    1.52          BCRYPT_INIT_AUTH_MODE_INFO(authInfo);
    1.53          authInfo.pbNonce = nonce;
    1.54 @@ -482,6 +482,7 @@
    1.55  
    1.56          product_list& products = registered_products();
    1.57          DWORD context = 0;
    1.58 +
    1.59          for (auto i = products.begin(); i != products.end(); i++) {
    1.60              try {
    1.61                  update_product(*i, context++);