p≡p COM server adapter
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

50 lines
1.3 KiB

// pEpCOMServerAdapter.cpp : Implementation of WinMain
#include "stdafx.h"
#include "resource.h"
#include "xdlldata.h"
#include "GateKeeper.h"
#include "pEpCOMServerAdapter.h"
#include "LocalJSONAdapter.h"
using namespace ATL;
using namespace std;
void CpEpCOMServerAdapterModule::gatekeeper(CpEpCOMServerAdapterModule * self)
{
pEp::GateKeeper keeper(self);
keeper.keep();
}
CpEpCOMServerAdapterModule _AtlModule;
LocalJSONAdapter* ljs = nullptr;
pEp::PassphraseCache cache;
extern "C" int WINAPI _tWinMain(HINSTANCE hInstance, HINSTANCE /*hPrevInstance*/,
LPTSTR lpCmdLine, int nShowCmd)
{
_AtlModule.hModule(hInstance);
_AtlModule.start_gatekeeper();
PEP_SESSION first_session;
PEP_STATUS status = ::init(&first_session, NULL, NULL);
if (!boost::algorithm::iequals(lpCmdLine, "/regserver")) {
ljs = &LocalJSONAdapter::createInstance();
ljs->startup(pEp::CallbackDispatcher::messageToSend);
pEp::callback_dispatcher.add(JsonAdapter::messageToSend, JsonAdapter::notifyHandshake);
}
auto rv = _AtlModule.WinMain(nShowCmd);
if (ljs) {
pEp::callback_dispatcher.remove(JsonAdapter::messageToSend);
ljs->shutdown_now();
}
::release(first_session);
ExitProcess(rv);
return rv;
}