-
Notifications
You must be signed in to change notification settings - Fork 35
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
6b7c664
commit 5153a25
Showing
17 changed files
with
1,842 additions
and
121 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
#ifndef MSRDPEX_AX_HOST_H | ||
#define MSRDPEX_AX_HOST_H | ||
|
||
#include <MsRdpEx/MsRdpEx.h> | ||
|
||
int MsRdpEx_AxHost_WinMain( | ||
HINSTANCE hInstance, | ||
HINSTANCE hPrevInstance, | ||
LPWSTR lpCmdLine, | ||
int nCmdShow); | ||
|
||
#endif /* MSRDPEX_AX_HOST_H */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
#ifndef MSRDPEX_COM_HELPER_H | ||
#define MSRDPEX_COM_HELPER_H | ||
|
||
#include <MsRdpEx/MsRdpEx.h> | ||
|
||
#include <atlbase.h> | ||
#include <oleidl.h> | ||
#include <commctrl.h> | ||
|
||
#ifndef SafeRelease | ||
#define SafeRelease(_x) { if ((_x) != nullptr) { (_x)->Release(); (_x) = nullptr; } } | ||
#endif | ||
|
||
#ifndef ToVariantBool | ||
#define ToVariantBool(_b) ((_b) ? VARIANT_TRUE : VARIANT_FALSE) | ||
#endif | ||
|
||
#include "../com/mstscax.tlh" | ||
using namespace MSTSCLib; | ||
|
||
#endif /* MSRDPEX_COM_HELPER_H */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,174 @@ | ||
|
||
#include "RdpEventSink.h" | ||
|
||
// IUnknown methods | ||
STDMETHODIMP CRdpEventSink::QueryInterface(REFIID riid, void** ppv) | ||
{ | ||
HRESULT hr = S_OK; | ||
|
||
if (!ppv) | ||
return E_INVALIDARG; | ||
|
||
*ppv = NULL; | ||
|
||
if (riid == IID_IUnknown) { | ||
*ppv = this; | ||
} | ||
else if (riid == IID_IDispatch) { | ||
*ppv = this; | ||
} | ||
else if (riid == DIID_IMsTscAxEvents) { | ||
*ppv = this; | ||
} | ||
|
||
if (nullptr != *ppv) { | ||
((IUnknown*)*ppv)->AddRef(); | ||
} | ||
else { | ||
hr = E_NOINTERFACE; | ||
} | ||
|
||
return hr; | ||
} | ||
|
||
STDMETHODIMP_(ULONG) CRdpEventSink::AddRef(void) | ||
{ | ||
return InterlockedIncrement(&m_refCount); | ||
} | ||
|
||
STDMETHODIMP_(ULONG) CRdpEventSink::Release(void) | ||
{ | ||
ULONG refCount = InterlockedDecrement(&m_refCount); | ||
|
||
if (refCount != 0) { | ||
return refCount; | ||
} | ||
|
||
delete this; | ||
return 0; | ||
} | ||
|
||
// IDispatch methods | ||
STDMETHODIMP CRdpEventSink::GetTypeInfoCount(UINT* pctinfo) | ||
{ | ||
*pctinfo = 0; | ||
return S_OK; | ||
} | ||
|
||
STDMETHODIMP CRdpEventSink::GetTypeInfo(UINT iTInfo, LCID lcid, ITypeInfo** ppTInfo) | ||
{ | ||
return E_NOTIMPL; | ||
} | ||
|
||
STDMETHODIMP CRdpEventSink::GetIDsOfNames(REFIID riid, LPOLESTR* rgszNames, UINT cNames, | ||
LCID lcid, DISPID* rgDispId) | ||
{ | ||
return E_NOTIMPL; | ||
} | ||
|
||
STDMETHODIMP CRdpEventSink::Invoke(DISPID dispIdMember, | ||
REFIID riid, LCID lcid, WORD wFlags, | ||
DISPPARAMS* pDispParams, VARIANT* pVarResult, | ||
EXCEPINFO* pExcepInfo, UINT* puArgErr) | ||
{ | ||
HRESULT hr = E_NOTIMPL; | ||
|
||
switch (dispIdMember) | ||
{ | ||
case IMsTscAxEvents_OnConnectingId: | ||
hr = OnConnecting(); | ||
break; | ||
|
||
case IMsTscAxEvents_OnConnectedId: | ||
hr = OnConnected(); | ||
break; | ||
|
||
case IMsTscAxEvents_OnLoginCompleteId: | ||
hr = OnLoginComplete(); | ||
break; | ||
|
||
case IMsTscAxEvents_OnDisconnectedId: | ||
hr = OnDisconnected(pDispParams->rgvarg->lVal); | ||
break; | ||
|
||
case IMsTscAxEvents_OnEnterFullScreenModeId: | ||
hr = OnEnterFullScreenMode(); | ||
break; | ||
|
||
case IMsTscAxEvents_OnLeaveFullScreenModeId: | ||
hr = OnLeaveFullScreenMode(); | ||
break; | ||
|
||
case IMsTscAxEvents_OnRemoteDesktopSizeChangeId: | ||
hr = OnRemoteDesktopSizeChange(pDispParams->rgvarg[1].lVal, pDispParams->rgvarg[0].lVal); | ||
break; | ||
|
||
case IMsTscAxEvents_OnRequestContainerMinimizeId: | ||
hr = OnRequestContainerMinimize(); | ||
break; | ||
|
||
case IMsTscAxEvents_OnConfirmCloseId: | ||
hr = OnConfirmClose(pDispParams->rgvarg[0].pboolVal); | ||
break; | ||
} | ||
|
||
return hr; | ||
} | ||
|
||
// IMsTscAxEvents methods | ||
STDMETHODIMP CRdpEventSink::OnConnecting() | ||
{ | ||
return S_OK; | ||
} | ||
|
||
STDMETHODIMP CRdpEventSink::OnConnected() | ||
{ | ||
return S_OK; | ||
} | ||
|
||
STDMETHODIMP CRdpEventSink::OnLoginComplete() | ||
{ | ||
return S_OK; | ||
} | ||
|
||
STDMETHODIMP CRdpEventSink::OnDisconnected(long discReason) | ||
{ | ||
return S_OK; | ||
} | ||
|
||
STDMETHODIMP CRdpEventSink::OnEnterFullScreenMode() | ||
{ | ||
return S_OK; | ||
} | ||
|
||
STDMETHODIMP CRdpEventSink::OnLeaveFullScreenMode() | ||
{ | ||
return S_OK; | ||
} | ||
|
||
STDMETHODIMP CRdpEventSink::OnRemoteDesktopSizeChange(long width, long height) | ||
{ | ||
return S_OK; | ||
} | ||
|
||
STDMETHODIMP CRdpEventSink::OnRequestContainerMinimize() | ||
{ | ||
return S_OK; | ||
} | ||
|
||
STDMETHODIMP CRdpEventSink::OnConfirmClose(VARIANT_BOOL* pfAllowClose) | ||
{ | ||
*pfAllowClose = VARIANT_TRUE; | ||
return S_OK; | ||
} | ||
|
||
CRdpEventSink::CRdpEventSink(HWND hWndParent) | ||
{ | ||
m_refCount = 0; | ||
m_hWndParent = hWndParent; | ||
} | ||
|
||
CRdpEventSink::~CRdpEventSink() | ||
{ | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,79 @@ | ||
#ifndef MSRDPEX_EVENT_SINK_H | ||
#define MSRDPEX_EVENT_SINK_H | ||
|
||
#include <MsRdpEx/MsRdpEx.h> | ||
|
||
#include "RdpComBase.h" | ||
|
||
#define IMsTscAxEvents_OnConnectingId 0x00000001 | ||
#define IMsTscAxEvents_OnConnectedId 0x00000002 | ||
#define IMsTscAxEvents_OnLoginCompleteId 0x00000003 | ||
#define IMsTscAxEvents_OnDisconnectedId 0x00000004 | ||
#define IMsTscAxEvents_OnEnterFullScreenModeId 0x00000005 | ||
#define IMsTscAxEvents_OnLeaveFullScreenModeId 0x00000006 | ||
#define IMsTscAxEvents_OnChannelReceivedDataId 0x00000007 | ||
#define IMsTscAxEvents_OnRequestGoFullScreenId 0x00000008 | ||
#define IMsTscAxEvents_OnRequestLeaveFullScreenId 0x00000009 | ||
#define IMsTscAxEvents_OnFatalErrorId 0x0000000a | ||
#define IMsTscAxEvents_OnWarningId 0x0000000b | ||
#define IMsTscAxEvents_OnRemoteDesktopSizeChangeId 0x0000000c | ||
#define IMsTscAxEvents_OnIdleTimeoutNotificationId 0x0000000d | ||
#define IMsTscAxEvents_OnRequestContainerMinimizeId 0x0000000e | ||
#define IMsTscAxEvents_OnConfirmCloseId 0x0000000f | ||
#define IMsTscAxEvents_OnReceivedTSPublicKeyId 0x00000010 | ||
#define IMsTscAxEvents_OnAutoReconnectingId 0x00000011 | ||
#define IMsTscAxEvents_OnAuthenticationWarningDisplayedId 0x00000012 | ||
#define IMsTscAxEvents_OnAuthenticationWarningDismissedId 0x00000013 | ||
#define IMsTscAxEvents_OnRemoteProgramResultId 0x00000014 | ||
#define IMsTscAxEvents_OnRemoteProgramDisplayedId 0x00000015 | ||
#define IMsTscAxEvents_OnRemoteWindowDisplayedId 0x00000016 | ||
#define IMsTscAxEvents_OnLogonErrorId 0x00000017 | ||
#define IMsTscAxEvents_OnFocusReleasedId 0x00000018 | ||
#define IMsTscAxEvents_OnUserNameAcquiredId 0x00000019 | ||
#define IMsTscAxEvents_OnMouseInputModeChangedId 0x0000001a | ||
#define IMsTscAxEvents_OnServiceMessageReceivedId 0x0000001b | ||
#define IMsTscAxEvents_OnConnectionBarPullDownId 0x0000001c | ||
#define IMsTscAxEvents_OnNetworkStatusChangedId 0x0000001d | ||
#define IMsTscAxEvents_OnDevicesButtonPressedId 0x0000001e | ||
#define IMsTscAxEvents_OnAutoReconnectedId 0x0000001f | ||
#define IMsTscAxEvents_OnAutoReconnecting2Id 0x00000020 | ||
|
||
class CRdpEventSink : public IMsTscAxEvents | ||
{ | ||
public: | ||
// Constructor and Destructor | ||
CRdpEventSink(HWND hWndParent); | ||
virtual ~CRdpEventSink(); | ||
|
||
// IUnknown methods | ||
STDMETHOD(QueryInterface)(REFIID riid, void** ppv) override; | ||
STDMETHOD_(ULONG, AddRef)(void) override; | ||
STDMETHOD_(ULONG, Release)(void) override; | ||
|
||
// IDispatch methods | ||
STDMETHOD(GetTypeInfoCount)(UINT* pctinfo) override; | ||
STDMETHOD(GetTypeInfo)(UINT iTInfo, LCID lcid, ITypeInfo** ppTInfo) override; | ||
STDMETHOD(GetIDsOfNames)(REFIID riid, | ||
LPOLESTR* rgszNames, UINT cNames, LCID lcid, DISPID* rgDispId) override; | ||
STDMETHOD(Invoke)(DISPID dispIdMember, | ||
REFIID riid, LCID lcid, WORD wFlags, | ||
DISPPARAMS* pDispParams, VARIANT* pVarResult, | ||
EXCEPINFO* pExcepInfo, UINT* puArgErr) override; | ||
|
||
// IMsTscAxEvents methods | ||
STDMETHOD(OnConnecting)(void); | ||
STDMETHOD(OnConnected)(void); | ||
STDMETHOD(OnLoginComplete)(void); | ||
STDMETHOD(OnDisconnected)(long discReason); | ||
STDMETHOD(OnEnterFullScreenMode)(void); | ||
STDMETHOD(OnLeaveFullScreenMode)(void); | ||
STDMETHOD(OnRemoteDesktopSizeChange)(long width, long height); | ||
STDMETHOD(OnRequestContainerMinimize)(void); | ||
STDMETHOD(OnConfirmClose)(VARIANT_BOOL* pfAllowClose); | ||
|
||
private: | ||
ULONG m_refCount; | ||
HWND m_hWndParent; | ||
}; | ||
|
||
#endif /* MSRDPEX_EVENT_SINK_H */ |
Oops, something went wrong.