IEDiagnosticsAdapter::IEDiagnosticsAdapter(_In_ LPCWSTR rootPath) :
    m_rootPath(rootPath),
    m_port(9222)
{
    // Create our message window used to handle window messages
    HWND createdWindow = this->Create(HWND_MESSAGE);
    ATLENSURE_THROW(createdWindow != NULL, E_FAIL);

    // Allow messages from the proxy
    ::ChangeWindowMessageFilterEx(m_hWnd, WM_COPYDATA, MSGFLT_ALLOW, 0);
    ::ChangeWindowMessageFilterEx(m_hWnd, Get_WM_SET_CONNECTION_HWND(), MSGFLT_ALLOW, 0);

    // Initialize the websocket server
    m_server.clear_access_channels(websocketpp::log::alevel::all);

    m_server.set_http_handler(std::bind(&IEDiagnosticsAdapter::OnHttp, this, std::placeholders::_1));
    m_server.set_validate_handler(std::bind(&IEDiagnosticsAdapter::OnValidate, this, std::placeholders::_1));
    m_server.set_message_handler(std::bind(&IEDiagnosticsAdapter::OnMessage, this, std::placeholders::_1, std::placeholders::_2));
    m_server.set_close_handler(std::bind(&IEDiagnosticsAdapter::OnClose, this, std::placeholders::_1));

    stringstream port;
    port << m_port;

    m_server.init_asio();
    m_server.listen("127.0.0.1", port.str());
    m_server.start_accept();

    cout << "Proxy server listening on port " << port.str() << "..." << endl;

    // Begin polling for data (we poll so we can respond to window messages too)
    this->Poll();
}
Esempio n. 2
0
    /**
     * Caller has requested the IShellView object associated with this folder.
     */
    virtual ATL::CComPtr<IShellView> folder_view(HWND hwnd)
    {
        TRACE("Request: IShellView");

        SFV_CREATE sfvdata = { sizeof(sfvdata), 0 };

        // Create a pointer to this IShellFolder to pass to view
        ATL::CComPtr<IShellFolder> this_folder = this;
        ATLENSURE_THROW(this_folder, E_NOINTERFACE);
        sfvdata.pshf = this_folder;

        // Get the callback object for this folder view, if any.
        // Must hold reference to it in this CComPtr over the
        // ::SHCreateShellFolderView() call in case folder_view_callback()
        // also creates it (hands back the only pointer to it).
        ATL::CComPtr<IShellFolderViewCB> callback = folder_view_callback(hwnd);
        sfvdata.psfvcb = callback;

        // Create Default Shell Folder View object
        ATL::CComPtr<IShellView> view;
        HRESULT hr = ::SHCreateShellFolderView(&sfvdata, &view);
        if (FAILED(hr))
            BOOST_THROW_EXCEPTION(comet::com_error(hr));

        return view;
    }