diff --git a/CpEpEngine.cpp b/CpEpEngine.cpp
index 4cc2040..d53c7c2 100644
--- a/CpEpEngine.cpp
+++ b/CpEpEngine.cpp
@@ -620,7 +620,7 @@ STDMETHODIMP CpEpEngine::MIMEDecodeMessage(BSTR mimeText, TextMessage *msg)
{
assert(mimeText);
- if (!mimeText)
+ if (!mimeText)
return E_INVALIDARG;
string _mimeText = utf8_string(mimeText);
@@ -635,7 +635,7 @@ STDMETHODIMP CpEpEngine::MIMEDecodeMessage(BSTR mimeText, TextMessage *msg)
if (status != PEP_STATUS_OK)
return FAIL(L"mime_decode_message", status);
- if (_msg)
+ if (_msg)
text_message_from_C(msg, _msg);
free_message(_msg);
@@ -648,7 +648,7 @@ STDMETHODIMP CpEpEngine::MIMEEncodeMessage(TextMessage *msg, VARIANT_BOOL omitFi
{
assert(msg);
- if (!msg)
+ if (!msg)
return E_INVALIDARG;
::message *_msg = NULL;
@@ -2075,7 +2075,7 @@ STDMETHODIMP CpEpEngine::ShutDownSync()
return S_OK;
}
-STDMETHODIMP CpEpEngine::ConfigPassphrase(BSTR passphrase)
+STDMETHODIMP CpEpEngine::ConfigPassphrase(BSTR passphrase)
{
string _passphrase = "";
@@ -2089,23 +2089,23 @@ STDMETHODIMP CpEpEngine::ConfigPassphrase(BSTR passphrase)
else if (status == PEP_OUT_OF_MEMORY)
return E_OUTOFMEMORY;
else
- return FAIL(L"ConfigPassphrase", status);
-}
-
-STDMETHODIMP CpEpEngine::ConfigPassphraseForNewKeys(VARIANT_BOOL enable, BSTR passphrase)
-{
+ return FAIL(L"ConfigPassphrase", status);
+}
+
+STDMETHODIMP CpEpEngine::ConfigPassphraseForNewKeys(VARIANT_BOOL enable, BSTR passphrase)
+{
string _passphrase = "";
if (passphrase)
_passphrase = utf8_string(passphrase);
passphrase_for_new_keys = _passphrase;
- PEP_STATUS status = ::config_passphrase_for_new_keys(session(), enable && _passphrase != "", _passphrase.c_str());
+ PEP_STATUS status = ::config_passphrase_for_new_keys(session(), enable, cache.add(_passphrase));
if (status == PEP_STATUS_OK)
return S_OK;
else if (status == PEP_OUT_OF_MEMORY)
return E_OUTOFMEMORY;
else
- return FAIL(L"ConfigPassphraseForNewKeys", status);
+ return FAIL(L"ConfigPassphraseForNewKeys", status);
}
\ No newline at end of file
diff --git a/pEpCOMServerAdapter.cpp b/pEpCOMServerAdapter.cpp
index 45c57d2..98a16e7 100644
--- a/pEpCOMServerAdapter.cpp
+++ b/pEpCOMServerAdapter.cpp
@@ -7,6 +7,7 @@
#include "GateKeeper.h"
#include "pEpCOMServerAdapter.h"
+#include "LocalJSONAdapter.h"
using namespace ATL;
using namespace std;
@@ -21,10 +22,28 @@ CpEpCOMServerAdapterModule _AtlModule;
//
extern "C" int WINAPI _tWinMain(HINSTANCE hInstance, HINSTANCE /*hPrevInstance*/,
- LPTSTR /*lpCmdLine*/, int nShowCmd)
+ LPTSTR lpCmdLine, int nShowCmd)
{
_AtlModule.hModule(hInstance);
_AtlModule.start_gatekeeper();
- return _AtlModule.WinMain(nShowCmd);
+ PEP_SESSION first_session;
+ PEP_STATUS status = ::init(&first_session, NULL, NULL);
+
+ LocalJSONAdapter* ljs = nullptr;
+ SessionRegistry* sr = nullptr;
+
+ if (!boost::algorithm::iequals(lpCmdLine, "/regserver"))
+ ljs= &LocalJSONAdapter::createInstance();
+
+ if (ljs)
+ ljs->startup();
+
+ auto rv = _AtlModule.WinMain(nShowCmd);
+
+ if (ljs)
+ ljs->shutdown_now();
+
+ ::release(first_session);
+ return rv;
}
diff --git a/pEpCOMServerAdapter.vcxproj b/pEpCOMServerAdapter.vcxproj
index cb033a7..8196397 100644
--- a/pEpCOMServerAdapter.vcxproj
+++ b/pEpCOMServerAdapter.vcxproj
@@ -41,14 +41,14 @@
true
true
- $(ProjectDir)..\;$(ProjectDir)..\pEpEngine\src;$(IncludePath)
+ $(SolutionDir)pEpJSONServerAdapter\server;$(ProjectDir)..\;$(ProjectDir)..\pEpEngine\src;$(IncludePath)
C:\Program Files (x86)\Microsoft Visual Studio 14.0\Team Tools\Static Analysis Tools\Rule Sets\NativeRecommendedRules.ruleset
false
true
false
- $(ProjectDir)..\;$(ProjectDir)..\pEpEngine\src;$(IncludePath)
+ $(SolutionDir)pEpJSONServerAdapter\server;$(ProjectDir)..\;$(ProjectDir)..\pEpEngine\src;$(IncludePath)
C:\Program Files (x86)\Microsoft Visual Studio 14.0\Team Tools\Static Analysis Tools\Rule Sets\NativeRecommendedRules.ruleset
false
@@ -70,7 +70,7 @@ xcopy /y "..\Dependencies\zlib\zlib1.dll" "$(OutDir)"
Use
Level3
Disabled
- WIN32;_WINDOWS;_DEBUG;%(PreprocessorDefinitions)
+ JSON_ADAPTER_LIBRARY;DEBUG_ENABLED;WIN32;_WINDOWS;_DEBUG;%(PreprocessorDefinitions)
true
false
@@ -104,7 +104,7 @@ xcopy /y "..\Dependencies\zlib\zlib1.dll" "$(OutDir)"
Use
Level3
MaxSpeed
- WIN32;_WINDOWS;NDEBUG;%(PreprocessorDefinitions)
+ JSON_ADAPTER_LIBRARY;DEBUG_ENABLED;WIN32;_WINDOWS;NDEBUG;%(PreprocessorDefinitions)
true
false
@@ -137,6 +137,7 @@ xcopy /y "..\Dependencies\zlib\zlib1.dll" "$(OutDir)"
+
false
@@ -162,8 +163,10 @@ xcopy /y "..\Dependencies\zlib\zlib1.dll" "$(OutDir)"
+
+
@@ -182,6 +185,7 @@ xcopy /y "..\Dependencies\zlib\zlib1.dll" "$(OutDir)"
+
@@ -197,7 +201,28 @@ xcopy /y "..\Dependencies\zlib\zlib1.dll" "$(OutDir)"
{146e69f8-e1da-456a-b048-6dd29d9acf6b}
+
+
+
+
+
+
+
+
+
+
+
+
+ This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/pEpCOMServerAdapter.vcxproj.filters b/pEpCOMServerAdapter.vcxproj.filters
index 19eec0a..be8b70e 100644
--- a/pEpCOMServerAdapter.vcxproj.filters
+++ b/pEpCOMServerAdapter.vcxproj.filters
@@ -43,6 +43,9 @@
Source Files
+
+ Source Files
+
@@ -75,6 +78,12 @@
Header Files
+
+ Header Files
+
+
+ Header Files
+
@@ -96,10 +105,15 @@
Resource Files
+
Source Files
+
+
+
+
\ No newline at end of file
diff --git a/stdafx.h b/stdafx.h
index eb0147e..29eca89 100644
--- a/stdafx.h
+++ b/stdafx.h
@@ -59,3 +59,4 @@
#include
#include
+#include
\ No newline at end of file