cleanup sync
authorVolker Birk <vb@pep.foundation>
Sun, 21 Oct 2018 14:20:19 +0200
branchsync
changeset 302b3444780fa9f
parent 301 1c2024f3dedc
child 303 c9b7a1d0d160
cleanup
GateKeeper.cpp
pEpCOMServerAdapter.vcxproj
pEp_utility.cpp
pEp_utility.h
     1.1 --- a/GateKeeper.cpp	Sun Oct 21 13:50:00 2018 +0200
     1.2 +++ b/GateKeeper.cpp	Sun Oct 21 14:20:19 2018 +0200
     1.3 @@ -293,7 +293,7 @@
     1.4  
     1.5          HRESULT hResult = ImportRsaPublicKey(hRSA, _uk, &hUpdateKey);
     1.6          LocalFree(_uk);
     1.7 -        if (!SUCCEEDED(hResult))
     1.8 +        if (!hUpdateKey)
     1.9              throw runtime_error("ImportRsaPublicKey");
    1.10  
    1.11          ULONG psize;
    1.12 @@ -301,6 +301,8 @@
    1.13          char *prop = new char[psize];
    1.14          TCHAR *_prop = (TCHAR *)prop;
    1.15          status = BCryptGetProperty(hUpdateKey, BCRYPT_ALGORITHM_NAME, (PUCHAR)prop, psize, &psize, 0);
    1.16 +        if (status)
    1.17 +            throw runtime_error("BCryptGetProperty: BCRYPT_ALGORITHM_NAME");
    1.18  
    1.19          ULONG export_size;
    1.20          status = BCryptExportKey(hDeliveryKey, NULL, BCRYPT_KEY_DATA_BLOB, NULL, NULL,
     2.1 --- a/pEpCOMServerAdapter.vcxproj	Sun Oct 21 13:50:00 2018 +0200
     2.2 +++ b/pEpCOMServerAdapter.vcxproj	Sun Oct 21 14:20:19 2018 +0200
     2.3 @@ -43,14 +43,14 @@
     2.4      <LinkIncremental>true</LinkIncremental>
     2.5      <IncludePath>C:\Users\vb\Documents\Visual Studio 2015\Projects\pEp_for_Outlook_Solution;C:\Users\vb\Documents\Visual Studio 2015\Projects\pEp_for_Outlook_Solution\pEpEngine\src;$(IncludePath)</IncludePath>
     2.6      <CodeAnalysisRuleSet>C:\Program Files (x86)\Microsoft Visual Studio 14.0\Team Tools\Static Analysis Tools\Rule Sets\NativeRecommendedRules.ruleset</CodeAnalysisRuleSet>
     2.7 -    <RunCodeAnalysis>true</RunCodeAnalysis>
     2.8 +    <RunCodeAnalysis>false</RunCodeAnalysis>
     2.9    </PropertyGroup>
    2.10    <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
    2.11      <IgnoreImportLibrary>true</IgnoreImportLibrary>
    2.12      <LinkIncremental>false</LinkIncremental>
    2.13      <IncludePath>C:\Users\vb\Documents\Visual Studio 2015\Projects\pEp_for_Outlook_Solution;C:\Users\vb\Documents\Visual Studio 2015\Projects\pEp_for_Outlook_Solution\pEpEngine\src;$(IncludePath)</IncludePath>
    2.14      <CodeAnalysisRuleSet>C:\Program Files (x86)\Microsoft Visual Studio 14.0\Team Tools\Static Analysis Tools\Rule Sets\NativeRecommendedRules.ruleset</CodeAnalysisRuleSet>
    2.15 -    <RunCodeAnalysis>true</RunCodeAnalysis>
    2.16 +    <RunCodeAnalysis>false</RunCodeAnalysis>
    2.17    </PropertyGroup>
    2.18    <ItemDefinitionGroup Condition="'$(Platform)'=='Win32'">
    2.19      <PostBuildEvent>
    2.20 @@ -72,7 +72,7 @@
    2.21        <Optimization>Disabled</Optimization>
    2.22        <PreprocessorDefinitions>WIN32;_WINDOWS;_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
    2.23        <SDLCheck>true</SDLCheck>
    2.24 -      <EnablePREfast>true</EnablePREfast>
    2.25 +      <EnablePREfast>false</EnablePREfast>
    2.26      </ClCompile>
    2.27      <Midl>
    2.28        <MkTypLibCompatible>false</MkTypLibCompatible>
    2.29 @@ -106,7 +106,7 @@
    2.30        <Optimization>MaxSpeed</Optimization>
    2.31        <PreprocessorDefinitions>WIN32;_WINDOWS;NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
    2.32        <SDLCheck>true</SDLCheck>
    2.33 -      <EnablePREfast>true</EnablePREfast>
    2.34 +      <EnablePREfast>false</EnablePREfast>
    2.35      </ClCompile>
    2.36      <Midl>
    2.37        <MkTypLibCompatible>false</MkTypLibCompatible>
     3.1 --- a/pEp_utility.cpp	Sun Oct 21 13:50:00 2018 +0200
     3.2 +++ b/pEp_utility.cpp	Sun Oct 21 14:20:19 2018 +0200
     3.3 @@ -217,8 +217,11 @@
     3.4              SafeArrayGetUBound(sa, 1, &ubound);
     3.5  
     3.6              T *_tl = tl;
     3.7 -            for (LONG i = lbound; i <= ubound; _tl = _tl->next, i++)
     3.8 -                SafeArrayPutElement(sa, &i, from_C<T2 *, T>(_tl));
     3.9 +            for (LONG i = lbound; i <= ubound; _tl = _tl->next, i++) {
    3.10 +                HRESULT result = SafeArrayPutElement(sa, &i, from_C<T2 *, T>(_tl));
    3.11 +                if (!SUCCEEDED(result))
    3.12 +                    throw bad_alloc();
    3.13 +            }
    3.14  
    3.15              return sa;
    3.16          }
     4.1 --- a/pEp_utility.h	Sun Oct 21 13:50:00 2018 +0200
     4.2 +++ b/pEp_utility.h	Sun Oct 21 14:20:19 2018 +0200
     4.3 @@ -52,15 +52,20 @@
     4.4              LPTYPEINFO pTypeInfo = NULL;
     4.5              LPSAFEARRAY psaUDType = NULL;
     4.6              IRecordInfo* pRecInfo = NULL;
     4.7 +            HRESULT hr;
     4.8  
     4.9              // Fetch the IRecordInfo interface describing the UDT
    4.10 -            if (pTypelib == NULL)
    4.11 -                LoadRegTypeLib(LIBID_pEpCOMServerAdapterLib, 1, 0, GetUserDefaultLCID(), &pTypelib);
    4.12 +            if (pTypelib == NULL) {
    4.13 +                hr = LoadRegTypeLib(LIBID_pEpCOMServerAdapterLib, 1, 0, GetUserDefaultLCID(), &pTypelib);
    4.14 +                assert(SUCCEEDED(hr));
    4.15 +                if (!SUCCEEDED(hr))
    4.16 +                    throw runtime_error("getRecordInfo(): LoadRegTypeLib cannot load LIBID_pEpCOMServerAdapterLib");
    4.17 +            }
    4.18  
    4.19              assert(pTypelib);
    4.20  
    4.21              GUID guid = __uuidof(UDType);
    4.22 -            HRESULT hr = pTypelib->GetTypeInfoOfGuid(guid, &pTypeInfo);
    4.23 +            hr = pTypelib->GetTypeInfoOfGuid(guid, &pTypeInfo);
    4.24              assert(SUCCEEDED(hr) && pTypeInfo);
    4.25              hr = GetRecordInfoFromTypeInfo(pTypeInfo, &pRecInfo);
    4.26              assert(SUCCEEDED(hr) && pRecInfo);