modified porting-tools/mstscax/mstscax.cpp

modified   porting-tools/mstscax/stdafx.h
   Added support for aggregation (ActiveX controls are expected to be aggregable)
   Added IMsRdpClientAdvancedSettings4 stub
   Added some other minor stubs

added      porting-tools/rdesktop-core-tester/activex.cpp
modified   porting-tools/rdesktop-core-tester/stdafx.h
modified   porting-tools/rdesktop-core-tester/rdesktop-core-tester.vcproj
   Full stubs for RDP client ActiveX control

added      porting-tools/rdesktop-core-tester/mstsclib.idl
added      porting-tools/rdesktop-core-tester/mstsclib.rc
added      porting-tools/rdesktop-core-tester/mstsclib_h.h
added      porting-tools/rdesktop-core-tester/mstsclib_i.c
   IDL definition file and type library resource for the ActiveX control. MIDL-generated files temporarily committed

modified   porting-tools/rdesktop-core-tester/rdesktop-core-tester.cpp
   Overall cleanup
   GDI code now uses SaveDC/RestoreDC instead of multiple calls
   Virtual Channel API stubs

modified   rdesktop/bitmap.c
   Re-enable optimizations

modified   rdesktop/channels.c
   Magic numbers are evil

modified   rdesktop/mcs.c
modified   rdesktop/rdesktop.h
   MCS channel ids were superfluous

modified   rdesktop/rdesktop-core.vcproj
modified   rdesktop/secure.c
modified   rdesktop/types.h
   Removed virtual channels implementation, preparing to replace with extensible, multithreaded, Windows-compatible implementation

svn path=/trunk/; revision=23417
This commit is contained in:
Michele Cicciotti 2006-08-02 14:21:45 +00:00
parent 2a4389576a
commit 6556fec93f
17 changed files with 14737 additions and 487 deletions

View file

@ -6,6 +6,8 @@
#include <string>
#include <sstream>
#include <algorithm>
#include <iterator>
#define WIN32_LEAN_AND_MEAN
#define STRICT
@ -15,12 +17,17 @@
#include <objbase.h>
#include <objsafe.h>
#include <ocidl.h>
#include <strsafe.h>
//#pragma warning(push)
//#pragma warning(disable:4192)
#import <mstscax.dll> named_guids exclude("LONG_PTR", "UINT_PTR")
//#pragma warning(pop)
#import "./rdesktop-core-tester.tlb" \
exclude("LONG_PTR", "UINT_PTR", "wireHWND", "_RemotableHandle", "__MIDL_IWinTypes_0009") \
named_guids \
no_implementation \
no_smart_pointers \
raw_dispinterfaces \
raw_interfaces_only \
raw_native_types
// EOF

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,772 @@
[
uuid(8C11EFA1-92C3-11D1-BC1E-00C04FA31489),
version(1.0)
]
library MSTSCLib
{
importlib("stdole32.tlb");
dispinterface IMsTscAxEvents;
interface IMsTscAx;
interface IMsRdpClient;
interface IMsRdpClient2;
interface IMsRdpClient3;
interface IMsRdpClient4;
interface IMsTscNonScriptable;
interface IMsRdpClientNonScriptable;
interface IMsRdpClientNonScriptable2;
interface IMsTscAdvancedSettings;
interface IMsRdpClientAdvancedSettings;
interface IMsRdpClientAdvancedSettings2;
interface IMsRdpClientAdvancedSettings3;
interface IMsRdpClientAdvancedSettings4;
interface IMsTscSecuredSettings;
interface IMsRdpClientSecuredSettings;
interface IMsTscDebug;
typedef [public]
enum __MIDL___MIDL_itf_mstsax_0275_0001 {
autoReconnectContinueAutomatic = 0,
autoReconnectContinueStop = 1,
autoReconnectContinueManual = 2
} AutoReconnectContinueState;
typedef [public]
enum __MIDL_IMsRdpClient_0001 {
exDiscReasonNoInfo = 0,
exDiscReasonAPIInitiatedDisconnect = 1,
exDiscReasonAPIInitiatedLogoff = 2,
exDiscReasonServerIdleTimeout = 3,
exDiscReasonServerLogonTimeout = 4,
exDiscReasonReplacedByOtherConnection = 5,
exDiscReasonOutOfMemory = 6,
exDiscReasonServerDeniedConnection = 7,
exDiscReasonServerDeniedConnectionFips = 8,
exDiscReasonLicenseInternal = 256,
exDiscReasonLicenseNoLicenseServer = 257,
exDiscReasonLicenseNoLicense = 258,
exDiscReasonLicenseErrClientMsg = 259,
exDiscReasonLicenseHwidDoesntMatchLicense = 260,
exDiscReasonLicenseErrClientLicense = 261,
exDiscReasonLicenseCantFinishProtocol = 262,
exDiscReasonLicenseClientEndedProtocol = 263,
exDiscReasonLicenseErrClientEncryption = 264,
exDiscReasonLicenseCantUpgradeLicense = 265,
exDiscReasonLicenseNoRemoteConnections = 266,
exDiscReasonProtocolRangeStart = 4096,
exDiscReasonProtocolRangeEnd = 32767
} ExtendedDisconnectReasonCode;
typedef [public]
enum __MIDL_IMsRdpClient_0002 {
controlCloseCanProceed = 0,
controlCloseWaitForEvents = 1
} ControlCloseStatus;
typedef [public]
unsigned __int3264 UINT_PTR;
typedef [public]
__int3264 LONG_PTR;
[uuid(336D5562-EFA8-482E-8CB3-C5C0FC7A7DB6)]
dispinterface IMsTscAxEvents {
properties:
methods:
[id(0x00000001)]
void OnConnecting();
[id(0x00000002)]
void OnConnected();
[id(0x00000003)]
void OnLoginComplete();
[id(0x00000004)]
void OnDisconnected([in] long discReason);
[id(0x00000005)]
void OnEnterFullScreenMode();
[id(0x00000006)]
void OnLeaveFullScreenMode();
[id(0x00000007)]
void OnChannelReceivedData(
[in] BSTR chanName,
[in] BSTR data);
[id(0x00000008)]
void OnRequestGoFullScreen();
[id(0x00000009)]
void OnRequestLeaveFullScreen();
[id(0x0000000a)]
void OnFatalError([in] long errorCode);
[id(0x0000000b)]
void OnWarning([in] long warningCode);
[id(0x0000000c)]
void OnRemoteDesktopSizeChange(
[in] long width,
[in] long height);
[id(0x0000000d)]
void OnIdleTimeoutNotification();
[id(0x0000000e)]
void OnRequestContainerMinimize();
[id(0x0000000f)]
void OnConfirmClose([out, retval] VARIANT_BOOL* pfAllowClose);
[id(0x00000010)]
void OnReceivedTSPublicKey(
[in] BSTR publicKey,
[out, retval] VARIANT_BOOL* pfContinueLogon);
[id(0x00000011)]
void OnAutoReconnecting(
[in] long disconnectReason,
[in] long attemptCount,
[out, retval] AutoReconnectContinueState* pArcContinueStatus);
[id(0x00000012)]
void OnAuthenticationWarningDisplayed();
[id(0x00000013)]
void OnAuthenticationWarningDismissed();
};
[
uuid(8C11EFAE-92C3-11D1-BC1E-00C04FA31489),
dual,
oleautomation
]
interface IMsTscAx : IDispatch {
[id(0x00000001), propput]
HRESULT Server([in] BSTR pServer);
[id(0x00000001), propget]
HRESULT Server([out, retval] BSTR* pServer);
[id(0x00000002), propput]
HRESULT Domain([in] BSTR pDomain);
[id(0x00000002), propget]
HRESULT Domain([out, retval] BSTR* pDomain);
[id(0x00000003), propput]
HRESULT UserName([in] BSTR pUserName);
[id(0x00000003), propget]
HRESULT UserName([out, retval] BSTR* pUserName);
[id(0x00000004), propput]
HRESULT DisconnectedText([in] BSTR pDisconnectedText);
[id(0x00000004), propget]
HRESULT DisconnectedText([out, retval] BSTR* pDisconnectedText);
[id(0x00000005), propput]
HRESULT ConnectingText([in] BSTR pConnectingText);
[id(0x00000005), propget]
HRESULT ConnectingText([out, retval] BSTR* pConnectingText);
[id(0x00000006), propget]
HRESULT Connected([out, retval] short* pIsConnected);
[id(0x0000000c), propput]
HRESULT DesktopWidth([in] long pVal);
[id(0x0000000c), propget]
HRESULT DesktopWidth([out, retval] long* pVal);
[id(0x0000000d), propput]
HRESULT DesktopHeight([in] long pVal);
[id(0x0000000d), propget]
HRESULT DesktopHeight([out, retval] long* pVal);
[id(0x00000010), propput]
HRESULT StartConnected([in] long pfStartConnected);
[id(0x00000010), propget]
HRESULT StartConnected([out, retval] long* pfStartConnected);
[id(0x00000011), propget]
HRESULT HorizontalScrollBarVisible([out, retval] long* pfHScrollVisible);
[id(0x00000012), propget]
HRESULT VerticalScrollBarVisible([out, retval] long* pfVScrollVisible);
[id(0x00000013), propput]
HRESULT FullScreenTitle([in] BSTR rhs);
[id(0x00000014), propget]
HRESULT CipherStrength([out, retval] long* pCipherStrength);
[id(0x00000015), propget]
HRESULT Version([out, retval] BSTR* pVersion);
[id(0x00000016), propget]
HRESULT SecuredSettingsEnabled([out, retval] long* pSecuredSettingsEnabled);
[id(0x00000061), propget]
HRESULT SecuredSettings([out, retval] IMsTscSecuredSettings** ppSecuredSettings);
[id(0x00000062), propget]
HRESULT AdvancedSettings([out, retval] IMsTscAdvancedSettings** ppAdvSettings);
[id(0x00000063), propget, hidden]
HRESULT Debugger([out, retval] IMsTscDebug** ppDebugger);
[id(0x0000001e)]
HRESULT Connect();
[id(0x0000001f)]
HRESULT Disconnect();
[id(0x00000021)]
HRESULT CreateVirtualChannels([in] BSTR newVal);
[id(0x00000022)]
HRESULT SendOnVirtualChannel(
[in] BSTR chanName,
[in] BSTR ChanData);
};
[
uuid(92B4A539-7115-4B7C-A5A9-E5D9EFC2780A),
dual,
oleautomation
]
interface IMsRdpClient : IMsTscAx {
[id(0x00000064), propput]
HRESULT ColorDepth([in] long pcolorDepth);
[id(0x00000064), propget]
HRESULT ColorDepth([out, retval] long* pcolorDepth);
[id(0x00000065), propget]
HRESULT AdvancedSettings2([out, retval] IMsRdpClientAdvancedSettings** ppAdvSettings);
[id(0x00000066), propget]
HRESULT SecuredSettings2([out, retval] IMsRdpClientSecuredSettings** ppSecuredSettings);
[id(0x00000067), propget]
HRESULT ExtendedDisconnectReason([out, retval] ExtendedDisconnectReasonCode* pExtendedDisconnectReason);
[id(0x00000068), propput]
HRESULT FullScreen([in] VARIANT_BOOL pfFullScreen);
[id(0x00000068), propget]
HRESULT FullScreen([out, retval] VARIANT_BOOL* pfFullScreen);
[id(0x00000023)]
HRESULT SetVirtualChannelOptions(
[in] BSTR chanName,
[in] long chanOptions);
[id(0x00000024)]
HRESULT GetVirtualChannelOptions(
[in] BSTR chanName,
[out, retval] long* pChanOptions);
[id(0x00000025)]
HRESULT RequestClose([out, retval] ControlCloseStatus* pCloseStatus);
};
[
uuid(E7E17DC4-3B71-4BA7-A8E6-281FFADCA28F),
dual,
oleautomation
]
interface IMsRdpClient2 : IMsRdpClient {
[id(0x000000c8), propget]
HRESULT AdvancedSettings3([out, retval] IMsRdpClientAdvancedSettings2** ppAdvSettings);
[id(0x000000c9), propput]
HRESULT ConnectedStatusText([in] BSTR pConnectedStatusText);
[id(0x000000c9), propget]
HRESULT ConnectedStatusText([out, retval] BSTR* pConnectedStatusText);
};
[
uuid(91B7CBC5-A72E-4FA0-9300-D647D7E897FF),
dual,
oleautomation
]
interface IMsRdpClient3 : IMsRdpClient2 {
[id(0x0000012c), propget]
HRESULT AdvancedSettings4([out, retval] IMsRdpClientAdvancedSettings3** ppAdvSettings);
};
[
uuid(095E0738-D97D-488B-B9F6-DD0E8D66C0DE),
dual,
oleautomation
]
interface IMsRdpClient4 : IMsRdpClient3 {
[id(0x00000190), propget]
HRESULT AdvancedSettings5([out, retval] IMsRdpClientAdvancedSettings4** ppAdvSettings5);
};
[uuid(C1E6743A-41C1-4A74-832A-0DD06C1C7A0E)]
interface IMsTscNonScriptable : IUnknown {
[propput]
HRESULT __stdcall ClearTextPassword([in] BSTR rhs);
[propput]
HRESULT __stdcall PortablePassword([in] BSTR pPortablePass);
[propget]
HRESULT __stdcall PortablePassword([out, retval] BSTR* pPortablePass);
[propput]
HRESULT __stdcall PortableSalt([in] BSTR pPortableSalt);
[propget]
HRESULT __stdcall PortableSalt([out, retval] BSTR* pPortableSalt);
[propput]
HRESULT __stdcall BinaryPassword([in] BSTR pBinaryPassword);
[propget]
HRESULT __stdcall BinaryPassword([out, retval] BSTR* pBinaryPassword);
[propput]
HRESULT __stdcall BinarySalt([in] BSTR pSalt);
[propget]
HRESULT __stdcall BinarySalt([out, retval] BSTR* pSalt);
HRESULT __stdcall ResetPassword();
};
[uuid(2F079C4C-87B2-4AFD-97AB-20CDB43038AE)]
interface IMsRdpClientNonScriptable : IMsTscNonScriptable {
HRESULT __stdcall NotifyRedirectDeviceChange(
[in] UINT_PTR wParam,
[in] LONG_PTR lParam);
HRESULT __stdcall SendKeys(
[in] long numKeys,
[in] VARIANT_BOOL* pbArrayKeyUp,
[in] long* plKeyData);
};
[uuid(17A5E535-4072-4FA4-AF32-C8D0D47345E9)]
interface IMsRdpClientNonScriptable2 : IMsRdpClientNonScriptable {
[propput]
HRESULT __stdcall UIParentWindowHandle([in] HWND phwndUIParentWindowHandle);
[propget]
HRESULT __stdcall UIParentWindowHandle([out, retval] HWND* phwndUIParentWindowHandle);
};
[
uuid(809945CC-4B3B-4A92-A6B0-DBF9B5F2EF2D),
dual,
oleautomation
]
interface IMsTscAdvancedSettings : IDispatch {
[id(0x00000079), propput]
HRESULT Compress([in] long pcompress);
[id(0x00000079), propget]
HRESULT Compress([out, retval] long* pcompress);
[id(0x0000007a), propput]
HRESULT BitmapPeristence([in] long pbitmapPeristence);
[id(0x0000007a), propget]
HRESULT BitmapPeristence([out, retval] long* pbitmapPeristence);
[id(0x000000a1), propput]
HRESULT allowBackgroundInput([in] long pallowBackgroundInput);
[id(0x000000a1), propget]
HRESULT allowBackgroundInput([out, retval] long* pallowBackgroundInput);
[id(0x000000a2), propput]
HRESULT KeyBoardLayoutStr([in] BSTR rhs);
[id(0x000000aa), propput]
HRESULT PluginDlls([in] BSTR rhs);
[id(0x000000ab), propput]
HRESULT IconFile([in] BSTR rhs);
[id(0x000000ac), propput]
HRESULT IconIndex([in] long rhs);
[id(0x000000ad), propput]
HRESULT ContainerHandledFullScreen([in] long pContainerHandledFullScreen);
[id(0x000000ad), propget]
HRESULT ContainerHandledFullScreen([out, retval] long* pContainerHandledFullScreen);
[id(0x000000ae), propput]
HRESULT DisableRdpdr([in] long pDisableRdpdr);
[id(0x000000ae), propget]
HRESULT DisableRdpdr([out, retval] long* pDisableRdpdr);
};
[
uuid(3C65B4AB-12B3-465B-ACD4-B8DAD3BFF9E2),
dual,
oleautomation
]
interface IMsRdpClientAdvancedSettings : IMsTscAdvancedSettings {
[id(0x00000065), propput]
HRESULT SmoothScroll([in] long psmoothScroll);
[id(0x00000065), propget]
HRESULT SmoothScroll([out, retval] long* psmoothScroll);
[id(0x00000066), propput]
HRESULT AcceleratorPassthrough([in] long pacceleratorPassthrough);
[id(0x00000066), propget]
HRESULT AcceleratorPassthrough([out, retval] long* pacceleratorPassthrough);
[id(0x00000067), propput]
HRESULT ShadowBitmap([in] long pshadowBitmap);
[id(0x00000067), propget]
HRESULT ShadowBitmap([out, retval] long* pshadowBitmap);
[id(0x00000068), propput]
HRESULT TransportType([in] long ptransportType);
[id(0x00000068), propget]
HRESULT TransportType([out, retval] long* ptransportType);
[id(0x00000069), propput]
HRESULT SasSequence([in] long psasSequence);
[id(0x00000069), propget]
HRESULT SasSequence([out, retval] long* psasSequence);
[id(0x0000006a), propput]
HRESULT EncryptionEnabled([in] long pencryptionEnabled);
[id(0x0000006a), propget]
HRESULT EncryptionEnabled([out, retval] long* pencryptionEnabled);
[id(0x0000006b), propput]
HRESULT DedicatedTerminal([in] long pdedicatedTerminal);
[id(0x0000006b), propget]
HRESULT DedicatedTerminal([out, retval] long* pdedicatedTerminal);
[id(0x0000006c), propput]
HRESULT RDPPort([in] long prdpPort);
[id(0x0000006c), propget]
HRESULT RDPPort([out, retval] long* prdpPort);
[id(0x0000006d), propput]
HRESULT EnableMouse([in] long penableMouse);
[id(0x0000006d), propget]
HRESULT EnableMouse([out, retval] long* penableMouse);
[id(0x0000006e), propput]
HRESULT DisableCtrlAltDel([in] long pdisableCtrlAltDel);
[id(0x0000006e), propget]
HRESULT DisableCtrlAltDel([out, retval] long* pdisableCtrlAltDel);
[id(0x0000006f), propput]
HRESULT EnableWindowsKey([in] long penableWindowsKey);
[id(0x0000006f), propget]
HRESULT EnableWindowsKey([out, retval] long* penableWindowsKey);
[id(0x00000070), propput]
HRESULT DoubleClickDetect([in] long pdoubleClickDetect);
[id(0x00000070), propget]
HRESULT DoubleClickDetect([out, retval] long* pdoubleClickDetect);
[id(0x00000071), propput]
HRESULT MaximizeShell([in] long pmaximizeShell);
[id(0x00000071), propget]
HRESULT MaximizeShell([out, retval] long* pmaximizeShell);
[id(0x00000072), propput]
HRESULT HotKeyFullScreen([in] long photKeyFullScreen);
[id(0x00000072), propget]
HRESULT HotKeyFullScreen([out, retval] long* photKeyFullScreen);
[id(0x00000073), propput]
HRESULT HotKeyCtrlEsc([in] long photKeyCtrlEsc);
[id(0x00000073), propget]
HRESULT HotKeyCtrlEsc([out, retval] long* photKeyCtrlEsc);
[id(0x00000074), propput]
HRESULT HotKeyAltEsc([in] long photKeyAltEsc);
[id(0x00000074), propget]
HRESULT HotKeyAltEsc([out, retval] long* photKeyAltEsc);
[id(0x00000075), propput]
HRESULT HotKeyAltTab([in] long photKeyAltTab);
[id(0x00000075), propget]
HRESULT HotKeyAltTab([out, retval] long* photKeyAltTab);
[id(0x00000076), propput]
HRESULT HotKeyAltShiftTab([in] long photKeyAltShiftTab);
[id(0x00000076), propget]
HRESULT HotKeyAltShiftTab([out, retval] long* photKeyAltShiftTab);
[id(0x00000077), propput]
HRESULT HotKeyAltSpace([in] long photKeyAltSpace);
[id(0x00000077), propget]
HRESULT HotKeyAltSpace([out, retval] long* photKeyAltSpace);
[id(0x00000078), propput]
HRESULT HotKeyCtrlAltDel([in] long photKeyCtrlAltDel);
[id(0x00000078), propget]
HRESULT HotKeyCtrlAltDel([out, retval] long* photKeyCtrlAltDel);
[id(0x0000007b), propput]
HRESULT orderDrawThreshold([in] long porderDrawThreshold);
[id(0x0000007b), propget]
HRESULT orderDrawThreshold([out, retval] long* porderDrawThreshold);
[id(0x0000007c), propput]
HRESULT BitmapCacheSize([in] long pbitmapCacheSize);
[id(0x0000007c), propget]
HRESULT BitmapCacheSize([out, retval] long* pbitmapCacheSize);
[id(0x0000007d), propput]
HRESULT BitmapVirtualCacheSize([in] long pbitmapVirtualCacheSize);
[id(0x0000007d), propget]
HRESULT BitmapVirtualCacheSize([out, retval] long* pbitmapVirtualCacheSize);
[id(0x000000af), propput]
HRESULT ScaleBitmapCachesByBPP([in] long pbScale);
[id(0x000000af), propget]
HRESULT ScaleBitmapCachesByBPP([out, retval] long* pbScale);
[id(0x0000007e), propput]
HRESULT NumBitmapCaches([in] long pnumBitmapCaches);
[id(0x0000007e), propget]
HRESULT NumBitmapCaches([out, retval] long* pnumBitmapCaches);
[id(0x0000007f), propput]
HRESULT CachePersistenceActive([in] long pcachePersistenceActive);
[id(0x0000007f), propget]
HRESULT CachePersistenceActive([out, retval] long* pcachePersistenceActive);
[id(0x0000008a), propput]
HRESULT PersistCacheDirectory([in] BSTR rhs);
[id(0x0000009c), propput]
HRESULT brushSupportLevel([in] long pbrushSupportLevel);
[id(0x0000009c), propget]
HRESULT brushSupportLevel([out, retval] long* pbrushSupportLevel);
[id(0x0000009d), propput]
HRESULT minInputSendInterval([in] long pminInputSendInterval);
[id(0x0000009d), propget]
HRESULT minInputSendInterval([out, retval] long* pminInputSendInterval);
[id(0x0000009e), propput]
HRESULT InputEventsAtOnce([in] long pinputEventsAtOnce);
[id(0x0000009e), propget]
HRESULT InputEventsAtOnce([out, retval] long* pinputEventsAtOnce);
[id(0x0000009f), propput]
HRESULT maxEventCount([in] long pmaxEventCount);
[id(0x0000009f), propget]
HRESULT maxEventCount([out, retval] long* pmaxEventCount);
[id(0x000000a0), propput]
HRESULT keepAliveInterval([in] long pkeepAliveInterval);
[id(0x000000a0), propget]
HRESULT keepAliveInterval([out, retval] long* pkeepAliveInterval);
[id(0x000000a3), propput]
HRESULT shutdownTimeout([in] long pshutdownTimeout);
[id(0x000000a3), propget]
HRESULT shutdownTimeout([out, retval] long* pshutdownTimeout);
[id(0x000000a4), propput]
HRESULT overallConnectionTimeout([in] long poverallConnectionTimeout);
[id(0x000000a4), propget]
HRESULT overallConnectionTimeout([out, retval] long* poverallConnectionTimeout);
[id(0x000000a5), propput]
HRESULT singleConnectionTimeout([in] long psingleConnectionTimeout);
[id(0x000000a5), propget]
HRESULT singleConnectionTimeout([out, retval] long* psingleConnectionTimeout);
[id(0x000000a6), propput]
HRESULT KeyboardType([in] long pkeyboardType);
[id(0x000000a6), propget]
HRESULT KeyboardType([out, retval] long* pkeyboardType);
[id(0x000000a7), propput]
HRESULT KeyboardSubType([in] long pkeyboardSubType);
[id(0x000000a7), propget]
HRESULT KeyboardSubType([out, retval] long* pkeyboardSubType);
[id(0x000000a8), propput]
HRESULT KeyboardFunctionKey([in] long pkeyboardFunctionKey);
[id(0x000000a8), propget]
HRESULT KeyboardFunctionKey([out, retval] long* pkeyboardFunctionKey);
[id(0x000000a9), propput]
HRESULT WinceFixedPalette([in] long pwinceFixedPalette);
[id(0x000000a9), propget]
HRESULT WinceFixedPalette([out, retval] long* pwinceFixedPalette);
[id(0x000000b2), propput]
HRESULT ConnectToServerConsole([in] VARIANT_BOOL pConnectToConsole);
[id(0x000000b2), propget]
HRESULT ConnectToServerConsole([out, retval] VARIANT_BOOL* pConnectToConsole);
[id(0x000000b6), propput]
HRESULT BitmapPersistence([in] long pbitmapPersistence);
[id(0x000000b6), propget]
HRESULT BitmapPersistence([out, retval] long* pbitmapPersistence);
[id(0x000000b7), propput]
HRESULT MinutesToIdleTimeout([in] long pminutesToIdleTimeout);
[id(0x000000b7), propget]
HRESULT MinutesToIdleTimeout([out, retval] long* pminutesToIdleTimeout);
[id(0x000000b8), propput]
HRESULT SmartSizing([in] VARIANT_BOOL pfSmartSizing);
[id(0x000000b8), propget]
HRESULT SmartSizing([out, retval] VARIANT_BOOL* pfSmartSizing);
[id(0x000000b9), propput]
HRESULT RdpdrLocalPrintingDocName([in] BSTR pLocalPrintingDocName);
[id(0x000000b9), propget]
HRESULT RdpdrLocalPrintingDocName([out, retval] BSTR* pLocalPrintingDocName);
[id(0x000000c9), propput]
HRESULT RdpdrClipCleanTempDirString([in] BSTR clipCleanTempDirString);
[id(0x000000c9), propget]
HRESULT RdpdrClipCleanTempDirString([out, retval] BSTR* clipCleanTempDirString);
[id(0x000000ca), propput]
HRESULT RdpdrClipPasteInfoString([in] BSTR clipPasteInfoString);
[id(0x000000ca), propget]
HRESULT RdpdrClipPasteInfoString([out, retval] BSTR* clipPasteInfoString);
[id(0x000000ba), propput]
HRESULT ClearTextPassword([in] BSTR rhs);
[id(0x000000bb), propput]
HRESULT DisplayConnectionBar([in] VARIANT_BOOL pDisplayConnectionBar);
[id(0x000000bb), propget]
HRESULT DisplayConnectionBar([out, retval] VARIANT_BOOL* pDisplayConnectionBar);
[id(0x000000bc), propput]
HRESULT PinConnectionBar([in] VARIANT_BOOL pPinConnectionBar);
[id(0x000000bc), propget]
HRESULT PinConnectionBar([out, retval] VARIANT_BOOL* pPinConnectionBar);
[id(0x000000bd), propput]
HRESULT GrabFocusOnConnect([in] VARIANT_BOOL pfGrabFocusOnConnect);
[id(0x000000bd), propget]
HRESULT GrabFocusOnConnect([out, retval] VARIANT_BOOL* pfGrabFocusOnConnect);
[id(0x000000be), propput]
HRESULT LoadBalanceInfo([in] BSTR pLBInfo);
[id(0x000000be), propget]
HRESULT LoadBalanceInfo([out, retval] BSTR* pLBInfo);
[id(0x000000bf), propput]
HRESULT RedirectDrives([in] VARIANT_BOOL pRedirectDrives);
[id(0x000000bf), propget]
HRESULT RedirectDrives([out, retval] VARIANT_BOOL* pRedirectDrives);
[id(0x000000c0), propput]
HRESULT RedirectPrinters([in] VARIANT_BOOL pRedirectPrinters);
[id(0x000000c0), propget]
HRESULT RedirectPrinters([out, retval] VARIANT_BOOL* pRedirectPrinters);
[id(0x000000c1), propput]
HRESULT RedirectPorts([in] VARIANT_BOOL pRedirectPorts);
[id(0x000000c1), propget]
HRESULT RedirectPorts([out, retval] VARIANT_BOOL* pRedirectPorts);
[id(0x000000c2), propput]
HRESULT RedirectSmartCards([in] VARIANT_BOOL pRedirectSmartCards);
[id(0x000000c2), propget]
HRESULT RedirectSmartCards([out, retval] VARIANT_BOOL* pRedirectSmartCards);
[id(0x000000c3), propput]
HRESULT BitmapVirtualCache16BppSize([in] long pBitmapVirtualCache16BppSize);
[id(0x000000c3), propget]
HRESULT BitmapVirtualCache16BppSize([out, retval] long* pBitmapVirtualCache16BppSize);
[id(0x000000c4), propput]
HRESULT BitmapVirtualCache24BppSize([in] long pBitmapVirtualCache24BppSize);
[id(0x000000c4), propget]
HRESULT BitmapVirtualCache24BppSize([out, retval] long* pBitmapVirtualCache24BppSize);
[id(0x000000c8), propput]
HRESULT PerformanceFlags([in] long pDisableList);
[id(0x000000c8), propget]
HRESULT PerformanceFlags([out, retval] long* pDisableList);
[id(0x000000cb), propput]
HRESULT ConnectWithEndpoint([in] VARIANT* rhs);
[id(0x000000cc), propput]
HRESULT NotifyTSPublicKey([in] VARIANT_BOOL pfNotify);
[id(0x000000cc), propget]
HRESULT NotifyTSPublicKey([out, retval] VARIANT_BOOL* pfNotify);
};
[
uuid(9AC42117-2B76-4320-AA44-0E616AB8437B),
dual,
oleautomation
]
interface IMsRdpClientAdvancedSettings2 : IMsRdpClientAdvancedSettings {
[id(0x000000cd), propget]
HRESULT CanAutoReconnect([out, retval] VARIANT_BOOL* pfCanAutoReconnect);
[id(0x000000ce), propput]
HRESULT EnableAutoReconnect([in] VARIANT_BOOL pfEnableAutoReconnect);
[id(0x000000ce), propget]
HRESULT EnableAutoReconnect([out, retval] VARIANT_BOOL* pfEnableAutoReconnect);
[id(0x000000cf), propput]
HRESULT MaxReconnectAttempts([in] long pMaxReconnectAttempts);
[id(0x000000cf), propget]
HRESULT MaxReconnectAttempts([out, retval] long* pMaxReconnectAttempts);
};
[
uuid(19CD856B-C542-4C53-ACEE-F127E3BE1A59),
dual,
oleautomation
]
interface IMsRdpClientAdvancedSettings3 : IMsRdpClientAdvancedSettings2 {
[id(0x000000d2), propput]
HRESULT ConnectionBarShowMinimizeButton([in] VARIANT_BOOL pfShowMinimize);
[id(0x000000d2), propget]
HRESULT ConnectionBarShowMinimizeButton([out, retval] VARIANT_BOOL* pfShowMinimize);
[id(0x000000d3), propput]
HRESULT ConnectionBarShowRestoreButton([in] VARIANT_BOOL pfShowRestore);
[id(0x000000d3), propget]
HRESULT ConnectionBarShowRestoreButton([out, retval] VARIANT_BOOL* pfShowRestore);
};
[
uuid(FBA7F64E-7345-4405-AE50-FA4A763DC0DE),
dual,
oleautomation
]
interface IMsRdpClientAdvancedSettings4 : IMsRdpClientAdvancedSettings3 {
[id(0x000000d4), propput]
HRESULT AuthenticationLevel([in] unsigned int puiAuthLevel);
[id(0x000000d4), propget]
HRESULT AuthenticationLevel([out, retval] unsigned int* puiAuthLevel);
};
[
uuid(C9D65442-A0F9-45B2-8F73-D61D2DB8CBB6),
dual,
oleautomation
]
interface IMsTscSecuredSettings : IDispatch {
[id(0x00000001), propput]
HRESULT StartProgram([in] BSTR pStartProgram);
[id(0x00000001), propget]
HRESULT StartProgram([out, retval] BSTR* pStartProgram);
[id(0x00000002), propput]
HRESULT WorkDir([in] BSTR pWorkDir);
[id(0x00000002), propget]
HRESULT WorkDir([out, retval] BSTR* pWorkDir);
[id(0x00000003), propput]
HRESULT FullScreen([in] long pfFullScreen);
[id(0x00000003), propget]
HRESULT FullScreen([out, retval] long* pfFullScreen);
};
[
uuid(605BEFCF-39C1-45CC-A811-068FB7BE346D),
dual,
oleautomation
]
interface IMsRdpClientSecuredSettings : IMsTscSecuredSettings {
[id(0x00000004), propput]
HRESULT KeyboardHookMode([in] long pkeyboardHookMode);
[id(0x00000004), propget]
HRESULT KeyboardHookMode([out, retval] long* pkeyboardHookMode);
[id(0x00000005), propput]
HRESULT AudioRedirectionMode([in] long pAudioRedirectionMode);
[id(0x00000005), propget]
HRESULT AudioRedirectionMode([out, retval] long* pAudioRedirectionMode);
};
[
uuid(209D0EB9-6254-47B1-9033-A98DAE55BB27),
hidden,
dual,
oleautomation
]
interface IMsTscDebug : IDispatch {
[id(0x000000c8), propput]
HRESULT HatchBitmapPDU([in] long phatchBitmapPDU);
[id(0x000000c8), propget]
HRESULT HatchBitmapPDU([out, retval] long* phatchBitmapPDU);
[id(0x000000c9), propput]
HRESULT HatchSSBOrder([in] long phatchSSBOrder);
[id(0x000000c9), propget]
HRESULT HatchSSBOrder([out, retval] long* phatchSSBOrder);
[id(0x000000ca), propput]
HRESULT HatchMembltOrder([in] long phatchMembltOrder);
[id(0x000000ca), propget]
HRESULT HatchMembltOrder([out, retval] long* phatchMembltOrder);
[id(0x000000cb), propput]
HRESULT HatchIndexPDU([in] long phatchIndexPDU);
[id(0x000000cb), propget]
HRESULT HatchIndexPDU([out, retval] long* phatchIndexPDU);
[id(0x000000cc), propput]
HRESULT LabelMemblt([in] long plabelMemblt);
[id(0x000000cc), propget]
HRESULT LabelMemblt([out, retval] long* plabelMemblt);
[id(0x000000cd), propput]
HRESULT BitmapCacheMonitor([in] long pbitmapCacheMonitor);
[id(0x000000cd), propget]
HRESULT BitmapCacheMonitor([out, retval] long* pbitmapCacheMonitor);
[id(0x000000ce), propput]
HRESULT MallocFailuresPercent([in] long pmallocFailuresPercent);
[id(0x000000ce), propget]
HRESULT MallocFailuresPercent([out, retval] long* pmallocFailuresPercent);
[id(0x000000cf), propput]
HRESULT MallocHugeFailuresPercent([in] long pmallocHugeFailuresPercent);
[id(0x000000cf), propget]
HRESULT MallocHugeFailuresPercent([out, retval] long* pmallocHugeFailuresPercent);
[id(0x000000d0), propput]
HRESULT NetThroughput([in] long NetThroughput);
[id(0x000000d0), propget]
HRESULT NetThroughput([out, retval] long* NetThroughput);
[id(0x000000d1), propput]
HRESULT CLXCmdLine([in] BSTR pCLXCmdLine);
[id(0x000000d1), propget]
HRESULT CLXCmdLine([out, retval] BSTR* pCLXCmdLine);
[id(0x000000d2), propput]
HRESULT CLXDll([in] BSTR pCLXDll);
[id(0x000000d2), propget]
HRESULT CLXDll([out, retval] BSTR* pCLXDll);
};
[uuid(A41A4187-5A86-4E26-B40A-856F9035D9CB)]
coclass MsTscAx {
interface IMsRdpClient;
[default] interface IMsTscAx;
[default, source] dispinterface IMsTscAxEvents;
interface IMsTscNonScriptable;
interface IMsRdpClientNonScriptable;
};
[uuid(7CACBD7B-0D99-468F-AC33-22E495C0AFE5)]
coclass MsRdpClient {
[default] interface IMsRdpClient;
interface IMsTscAx;
[default, source] dispinterface IMsTscAxEvents;
interface IMsTscNonScriptable;
interface IMsRdpClientNonScriptable;
};
[uuid(3523C2FB-4031-44E4-9A3B-F1E94986EE7F)]
coclass MsRdpClient2 {
[default] interface IMsRdpClient2;
interface IMsRdpClient;
interface IMsTscAx;
[default, source] dispinterface IMsTscAxEvents;
interface IMsTscNonScriptable;
interface IMsRdpClientNonScriptable;
};
[uuid(ACE575FD-1FCF-4074-9401-EBAB990FA9DE)]
coclass MsRdpClient3 {
[default] interface IMsRdpClient3;
interface IMsRdpClient2;
interface IMsRdpClient;
interface IMsTscAx;
[default, source] dispinterface IMsTscAxEvents;
interface IMsTscNonScriptable;
interface IMsRdpClientNonScriptable;
};
[uuid(6AE29350-321B-42BE-BBE5-12FB5270C0DE)]
coclass MsRdpClient4 {
[default] interface IMsRdpClient4;
interface IMsRdpClient3;
interface IMsRdpClient2;
interface IMsRdpClient;
interface IMsTscAx;
[default, source] dispinterface IMsTscAxEvents;
interface IMsTscNonScriptable;
interface IMsRdpClientNonScriptable;
interface IMsRdpClientNonScriptable2;
};
};

View file

@ -0,0 +1,9 @@
#define TOSTRING_(X) # X
#define TOSTRING(X) TOSTRING_(X)
LANGUAGE 0, 0
// NOTE: TYPELIB_PATH__ is defined on the command line (-D TYPELIB_PATH__=<path>)
1 TYPELIB TOSTRING(TYPELIB_PATH__)
// EOF

View file

@ -0,0 +1,145 @@
/* this ALWAYS GENERATED file contains the IIDs and CLSIDs */
/* link this file in with the server and any clients */
/* File created by MIDL compiler version 7.00.0493 */
/* at Mon Jul 31 17:27:49 2006
*/
/* Compiler settings for .\mstsclib.idl:
Oicf, W1, Zp8, env=Win32 (32b run)
protocol : dce , ms_ext, c_ext, robust
error checks: allocation ref bounds_check enum stub_data
VC __declspec() decoration level:
__declspec(uuid()), __declspec(selectany), __declspec(novtable)
DECLSPEC_UUID(), MIDL_INTERFACE()
*/
//@@MIDL_FILE_HEADING( )
#pragma warning( disable: 4049 ) /* more than 64k source lines */
#ifdef __cplusplus
extern "C"{
#endif
#include <rpc.h>
#include <rpcndr.h>
#ifdef _MIDL_USE_GUIDDEF_
#ifndef INITGUID
#define INITGUID
#include <guiddef.h>
#undef INITGUID
#else
#include <guiddef.h>
#endif
#define MIDL_DEFINE_GUID(type,name,l,w1,w2,b1,b2,b3,b4,b5,b6,b7,b8) \
DEFINE_GUID(name,l,w1,w2,b1,b2,b3,b4,b5,b6,b7,b8)
#else // !_MIDL_USE_GUIDDEF_
#ifndef __IID_DEFINED__
#define __IID_DEFINED__
typedef struct _IID
{
unsigned long x;
unsigned short s1;
unsigned short s2;
unsigned char c[8];
} IID;
#endif // __IID_DEFINED__
#ifndef CLSID_DEFINED
#define CLSID_DEFINED
typedef IID CLSID;
#endif // CLSID_DEFINED
#define MIDL_DEFINE_GUID(type,name,l,w1,w2,b1,b2,b3,b4,b5,b6,b7,b8) \
const type name = {l,w1,w2,{b1,b2,b3,b4,b5,b6,b7,b8}}
#endif !_MIDL_USE_GUIDDEF_
MIDL_DEFINE_GUID(IID, LIBID_MSTSCLib,0x8C11EFA1,0x92C3,0x11D1,0xBC,0x1E,0x00,0xC0,0x4F,0xA3,0x14,0x89);
MIDL_DEFINE_GUID(IID, DIID_IMsTscAxEvents,0x336D5562,0xEFA8,0x482E,0x8C,0xB3,0xC5,0xC0,0xFC,0x7A,0x7D,0xB6);
MIDL_DEFINE_GUID(IID, IID_IMsTscAx,0x8C11EFAE,0x92C3,0x11D1,0xBC,0x1E,0x00,0xC0,0x4F,0xA3,0x14,0x89);
MIDL_DEFINE_GUID(IID, IID_IMsRdpClient,0x92B4A539,0x7115,0x4B7C,0xA5,0xA9,0xE5,0xD9,0xEF,0xC2,0x78,0x0A);
MIDL_DEFINE_GUID(IID, IID_IMsRdpClient2,0xE7E17DC4,0x3B71,0x4BA7,0xA8,0xE6,0x28,0x1F,0xFA,0xDC,0xA2,0x8F);
MIDL_DEFINE_GUID(IID, IID_IMsRdpClient3,0x91B7CBC5,0xA72E,0x4FA0,0x93,0x00,0xD6,0x47,0xD7,0xE8,0x97,0xFF);
MIDL_DEFINE_GUID(IID, IID_IMsRdpClient4,0x095E0738,0xD97D,0x488B,0xB9,0xF6,0xDD,0x0E,0x8D,0x66,0xC0,0xDE);
MIDL_DEFINE_GUID(IID, IID_IMsTscNonScriptable,0xC1E6743A,0x41C1,0x4A74,0x83,0x2A,0x0D,0xD0,0x6C,0x1C,0x7A,0x0E);
MIDL_DEFINE_GUID(IID, IID_IMsRdpClientNonScriptable,0x2F079C4C,0x87B2,0x4AFD,0x97,0xAB,0x20,0xCD,0xB4,0x30,0x38,0xAE);
MIDL_DEFINE_GUID(IID, IID_IMsRdpClientNonScriptable2,0x17A5E535,0x4072,0x4FA4,0xAF,0x32,0xC8,0xD0,0xD4,0x73,0x45,0xE9);
MIDL_DEFINE_GUID(IID, IID_IMsTscAdvancedSettings,0x809945CC,0x4B3B,0x4A92,0xA6,0xB0,0xDB,0xF9,0xB5,0xF2,0xEF,0x2D);
MIDL_DEFINE_GUID(IID, IID_IMsRdpClientAdvancedSettings,0x3C65B4AB,0x12B3,0x465B,0xAC,0xD4,0xB8,0xDA,0xD3,0xBF,0xF9,0xE2);
MIDL_DEFINE_GUID(IID, IID_IMsRdpClientAdvancedSettings2,0x9AC42117,0x2B76,0x4320,0xAA,0x44,0x0E,0x61,0x6A,0xB8,0x43,0x7B);
MIDL_DEFINE_GUID(IID, IID_IMsRdpClientAdvancedSettings3,0x19CD856B,0xC542,0x4C53,0xAC,0xEE,0xF1,0x27,0xE3,0xBE,0x1A,0x59);
MIDL_DEFINE_GUID(IID, IID_IMsRdpClientAdvancedSettings4,0xFBA7F64E,0x7345,0x4405,0xAE,0x50,0xFA,0x4A,0x76,0x3D,0xC0,0xDE);
MIDL_DEFINE_GUID(IID, IID_IMsTscSecuredSettings,0xC9D65442,0xA0F9,0x45B2,0x8F,0x73,0xD6,0x1D,0x2D,0xB8,0xCB,0xB6);
MIDL_DEFINE_GUID(IID, IID_IMsRdpClientSecuredSettings,0x605BEFCF,0x39C1,0x45CC,0xA8,0x11,0x06,0x8F,0xB7,0xBE,0x34,0x6D);
MIDL_DEFINE_GUID(IID, IID_IMsTscDebug,0x209D0EB9,0x6254,0x47B1,0x90,0x33,0xA9,0x8D,0xAE,0x55,0xBB,0x27);
MIDL_DEFINE_GUID(CLSID, CLSID_MsTscAx,0xA41A4187,0x5A86,0x4E26,0xB4,0x0A,0x85,0x6F,0x90,0x35,0xD9,0xCB);
MIDL_DEFINE_GUID(CLSID, CLSID_MsRdpClient,0x7CACBD7B,0x0D99,0x468F,0xAC,0x33,0x22,0xE4,0x95,0xC0,0xAF,0xE5);
MIDL_DEFINE_GUID(CLSID, CLSID_MsRdpClient2,0x3523C2FB,0x4031,0x44E4,0x9A,0x3B,0xF1,0xE9,0x49,0x86,0xEE,0x7F);
MIDL_DEFINE_GUID(CLSID, CLSID_MsRdpClient3,0xACE575FD,0x1FCF,0x4074,0x94,0x01,0xEB,0xAB,0x99,0x0F,0xA9,0xDE);
MIDL_DEFINE_GUID(CLSID, CLSID_MsRdpClient4,0x6AE29350,0x321B,0x42BE,0xBB,0xE5,0x12,0xFB,0x52,0x70,0xC0,0xDE);
#undef MIDL_DEFINE_GUID
#ifdef __cplusplus
}
#endif

View file

@ -15,16 +15,6 @@ template<class T, class U> T alignup(const T& X, const U& align)
return aligndown(X + (align - 1), align);
}
#ifdef _WIN64
#else
#undef InterlockedExchangePointer
#define InterlockedExchangePointer(Target, Value) \
LongToPtr(InterlockedExchange((LONG volatile *)(Target), PtrToLong(Value)))
#endif
extern "C"
{
/* ==== BEGIN POOP ==== */
@ -325,65 +315,6 @@ extern "C"
HDC hdcBuffer;
UINT wmZMouseWheel;
#if 0
// NOTE: we don't really need these with rdesktop.c out of the picture
BOOL
ui_init(RDPCLIENT * This)
{
return 0;
}
void
ui_deinit(RDPCLIENT * This)
{
}
BOOL
ui_create_window(RDPCLIENT * This)
{
return 0;
}
#endif
void
ui_resize_window(RDPCLIENT * This)
{
// TODO
}
#if 0
void
ui_destroy_window(RDPCLIENT * This)
{
}
#endif
int
ui_select(RDPCLIENT * This, int rdp_socket)
{
return 1; // TODO: return 0 for user quit. Or just kill this silly function
}
void
ui_move_pointer(RDPCLIENT * This, int x, int y)
{
POINT point;
point.x = x;
point.y = y;
ClientToScreen(hwnd, &point);
SetCursorPos(point.x, point.y);
}
HCURSOR hcursor;
struct Bitmap
{
int width;
int height;
uint8 data[1];
};
static
HBITMAP
win32_create_dib(LONG width, LONG height, WORD bitcount, const BYTE * data)
@ -430,6 +361,7 @@ extern "C"
uint8 *
win32_convert_scanlines(int width, int height, int bitcount, int fromalign, int toalign, const uint8 * data, uint8 ** buffer)
{
// TBD: profile & optimize the most common cases
assert(width > 0);
assert(height);
assert(bitcount && bitcount <= 32);
@ -477,6 +409,31 @@ extern "C"
return dibits;
}
void
ui_resize_window(RDPCLIENT * This)
{
SetWindowPos(hwnd, NULL, 0, 0, This->width, This->height, SWP_ASYNCWINDOWPOS | SWP_NOACTIVATE | SWP_NOCOPYBITS | SWP_NOMOVE);
}
int
ui_select(RDPCLIENT * This, int rdp_socket)
{
return 1; // TODO: return 0 for user quit. Or just kill this silly function
}
void
ui_move_pointer(RDPCLIENT * This, int x, int y)
{
POINT point;
point.x = x;
point.y = y;
ClientToScreen(hwnd, &point);
SetCursorPos(point.x, point.y);
}
HCURSOR hcursor;
HBITMAP
ui_create_bitmap(RDPCLIENT * This, int width, int height, uint8 * data)
{
@ -706,44 +663,13 @@ extern "C"
InvalidateRgn(hwnd, NULL, FALSE);
}
void
ui_paint_bitmap(RDPCLIENT * This, int x, int y, int cx, int cy, int width, int height, uint8 * data)
{
GdiFlush();
int Bpp = This->server_depth / 8;
int fromstride = alignup(width * Bpp, 4);
int tostride = alignup(This->width * Bpp, 4);
int sizex = cx * Bpp;
const uint8 * src = data;
uint8 * dst = (uint8 *)pBuffer + (This->height - y - cy) * tostride + x * Bpp;
for(int i = 0; i < cy; ++ i)
{
memcpy(dst, src, sizex);
src += fromstride;
dst += tostride;
}
win32_repaint_area(This, x, y, cx, cy);
}
void
ui_destblt(RDPCLIENT * This, uint8 opcode,
/* dest */ int x, int y, int cx, int cy)
{
HGDIOBJ holdbrush = SelectObject(hdcBuffer, GetStockObject(BLACK_BRUSH));
PatBlt(hdcBuffer, x, y, cx, cy, MAKELONG(0, opcode));
SelectObject(hdcBuffer, holdbrush);
win32_repaint_area(This, x, y, cx, cy);
}
static
HBRUSH
win32_create_brush(RDPCLIENT * This, BRUSH * brush, COLORREF fgcolour)
{
if(brush == NULL)
return (HBRUSH)GetStockObject(NULL_BRUSH);
switch(brush->style)
{
case BS_SOLID:
@ -774,7 +700,7 @@ extern "C"
uint16 pattern[8];
for(size_t i = 0; i < 8; ++ i)
pattern[7 - i] = brush->pattern[i];
pattern[i] = brush->pattern[i];
HBITMAP hpattern = CreateBitmap(8, 8, 1, 1, pattern);
HBRUSH hbr = CreatePatternBrush(hpattern);
@ -786,6 +712,45 @@ extern "C"
}
}
void
ui_paint_bitmap(RDPCLIENT * This, int x, int y, int cx, int cy, int width, int height, uint8 * data)
{
assert(This->server_depth >= 8);
assert(rcClip.left == 0 && rcClip.top == 0 && rcClip.right == This->width + 1 && rcClip.bottom == This->height + 1);
GdiFlush();
// TBD: we can cache these values
int Bpp = alignup(This->server_depth, 8) / 8;
int tostride = alignup(This->width * Bpp, 4);
int fromstride = alignup(width * Bpp, 4);
int sizex = cx * Bpp;
const uint8 * src = data;
uint8 * dst = (uint8 *)pBuffer + (This->height - y - cy) * tostride + x * Bpp;
for(int i = 0; i < cy; ++ i)
{
memcpy(dst, src, sizex);
src += fromstride;
dst += tostride;
}
win32_repaint_area(This, x, y, cx, cy);
}
void
ui_destblt(RDPCLIENT * This, uint8 opcode,
/* dest */ int x, int y, int cx, int cy)
{
int dcsave = SaveDC(hdcBuffer);
SelectObject(hdcBuffer, GetStockObject(BLACK_BRUSH));
PatBlt(hdcBuffer, x, y, cx, cy, MAKELONG(0, opcode));
RestoreDC(hdcBuffer, dcsave);
win32_repaint_area(This, x, y, cx, cy);
}
void
ui_patblt(RDPCLIENT * This, uint8 opcode,
/* dest */ int x, int y, int cx, int cy,
@ -793,17 +758,16 @@ extern "C"
{
HBRUSH hbr = win32_create_brush(This, brush, fgcolour);
int oldbkcolor = SetBkColor(hdcBuffer, bgcolour);
int oldtextcolor = SetTextColor(hdcBuffer, fgcolour);
POINT oldbrushorg; SetBrushOrgEx(hdcBuffer, brush->xorigin, brush->yorigin, &oldbrushorg);
HGDIOBJ holdbrush = SelectObject(hdcBuffer, hbr);
int dcsave = SaveDC(hdcBuffer);
SetBkColor(hdcBuffer, bgcolour);
SetTextColor(hdcBuffer, fgcolour);
SetBrushOrgEx(hdcBuffer, brush->xorigin, brush->yorigin, NULL);
SelectObject(hdcBuffer, hbr);
PatBlt(hdcBuffer, x, y, cx, cy, MAKELONG(0, opcode));
SelectObject(hdcBuffer, holdbrush);
SetBrushOrgEx(hdcBuffer, oldbrushorg.x, oldbrushorg.y, NULL);
SetTextColor(hdcBuffer, oldtextcolor);
SetBkColor(hdcBuffer, oldbkcolor);
RestoreDC(hdcBuffer, dcsave);
DeleteObject(hbr);
@ -841,6 +805,7 @@ extern "C"
/* src */ HBITMAP src, int srcx, int srcy,
/* brush */ BRUSH * brush, int bgcolour, int fgcolour)
{
// TODO
HDC hdcSrc = CreateCompatibleDC(hdcBuffer);
HGDIOBJ hOld = SelectObject(hdcSrc, src);
@ -863,15 +828,15 @@ extern "C"
{
HPEN hpen = CreatePen(pen->style, pen->width, pen->colour);
int oldROP2 = SetROP2(hdcBuffer, opcode);
HGDIOBJ holdpen = SelectObject(hdcBuffer, hpen);
POINT oldpos; MoveToEx(hdcBuffer, startx, starty, &oldpos);
int dcsave = SaveDC(hdcBuffer);
SetROP2(hdcBuffer, opcode);
SelectObject(hdcBuffer, hpen);
MoveToEx(hdcBuffer, startx, starty, NULL);
LineTo(hdcBuffer, endx, endy);
MoveToEx(hdcBuffer, oldpos.x, oldpos.y, NULL);
SelectObject(hdcBuffer, holdpen);
SetROP2(hdcBuffer, oldROP2);
RestoreDC(hdcBuffer, dcsave);
DeleteObject(hpen);
@ -910,14 +875,15 @@ extern "C"
{
HBRUSH hbr = CreateSolidBrush(colour);
HGDIOBJ holdbrush = SelectObject(hdcBuffer, hbr);
HGDIOBJ holdpen = SelectObject(hdcBuffer, GetStockObject(NULL_PEN));
int dcsave = SaveDC(hdcBuffer);
SelectObject(hdcBuffer, hbr);
SelectObject(hdcBuffer, GetStockObject(NULL_PEN));
Rectangle(hdcBuffer, x, y, x + cx + 1, y + cy + 1);
SelectObject(hdcBuffer, holdpen);
SelectObject(hdcBuffer, holdbrush);
RestoreDC(hdcBuffer, dcsave);
DeleteObject(hbr);
win32_repaint_area(This, x, y, cx, cy);
@ -931,17 +897,16 @@ extern "C"
{
HBRUSH hbr = win32_create_brush(This, brush, fgcolour);
int oldbkcolor = SetBkColor(hdcBuffer, bgcolour);
int oldtextcolor = SetTextColor(hdcBuffer, fgcolour);
int oldFillMode = SetPolyFillMode(hdcBuffer, fillmode);
HGDIOBJ holdbrush = SelectObject(hdcBuffer, hbr);
int dcsave = SaveDC(hdcBuffer);
SetBkColor(hdcBuffer, bgcolour);
SetTextColor(hdcBuffer, fgcolour);
SetPolyFillMode(hdcBuffer, fillmode);
SelectObject(hdcBuffer, hbr);
Polygon(hdcBuffer, point, npoints);
SelectObject(hdcBuffer, holdbrush);
SetPolyFillMode(hdcBuffer, oldFillMode);
SetTextColor(hdcBuffer, oldtextcolor);
SetBkColor(hdcBuffer, oldbkcolor);
RestoreDC(hdcBuffer, dcsave);
win32_repaint_poly(This, point, npoints, 0);
}
@ -962,13 +927,14 @@ extern "C"
HPEN hpen = CreatePen(pen->style, pen->width, pen->colour);
int oldROP2 = SetROP2(hdcBuffer, opcode);
HGDIOBJ holdpen = SelectObject(hdcBuffer, hpen);
int dcsave = SaveDC(hdcBuffer);
SetROP2(hdcBuffer, opcode);
SelectObject(hdcBuffer, hpen);
Polyline(hdcBuffer, points, npoints);
SelectObject(hdcBuffer, holdpen);
SetROP2(hdcBuffer, oldROP2);
RestoreDC(hdcBuffer, dcsave);
DeleteObject(hpen);
@ -981,33 +947,12 @@ extern "C"
/* dest */ int x, int y, int cx, int cy,
/* brush */ BRUSH * brush, int bgcolour, int fgcolour)
{
switch(fillmode)
{
case 0: // outline
{
HPEN hpen = CreatePen(PS_SOLID, 1, fgcolour);
int oldROP2 = SetROP2(hdcBuffer, opcode);
HGDIOBJ holdPen = SelectObject(hdcBuffer, hpen);
Ellipse(hdcBuffer, x, y, x + cx, y + cy);
SelectObject(hdcBuffer, holdPen);
SetROP2(hdcBuffer, oldROP2);
DeleteObject(hpen);
}
break;
case 1:
// TODO
break;
}
// TODO
win32_repaint_area(This, x, y, cx, cy);
}
// TBD: optimize text drawing
void
ui_draw_glyph(RDPCLIENT * This, int mixmode,
/* dest */ int x, int y, int cx, int cy,
@ -1018,6 +963,8 @@ extern "C"
HDC hdcGlyph = CreateCompatibleDC(hdcBuffer);
HGDIOBJ hOld = SelectObject(hdcGlyph, hbmGlyph);
int dcsave = SaveDC(hdcBuffer);
switch(mixmode)
{
case MIX_TRANSPARENT:
@ -1030,9 +977,8 @@ extern "C"
This paints a transparent glyph in the specified color
*/
HBRUSH hbr = CreateSolidBrush(fgcolour);
HGDIOBJ holdbrush = SelectObject(hdcBuffer, hbr);
SelectObject(hdcBuffer, hbr);
BitBlt(hdcBuffer, x, y, cx, cy, hdcGlyph, srcx, srcy, MAKELONG(0, 0xe2));
SelectObject(hdcBuffer, holdbrush);
DeleteObject(hbr);
}
@ -1041,22 +987,23 @@ extern "C"
case MIX_OPAQUE:
{
/* Curiously, glyphs are inverted (white-on-black) */
int oldbkcolor = SetBkColor(hdcBuffer, fgcolour);
int oldtextcolor = SetTextColor(hdcBuffer, bgcolour);
SetBkColor(hdcBuffer, fgcolour);
SetTextColor(hdcBuffer, bgcolour);
BitBlt(hdcBuffer, x, y, cx, cy, hdcGlyph, srcx, srcy, SRCCOPY);
SetTextColor(hdcBuffer, oldtextcolor);
SetBkColor(hdcBuffer, oldbkcolor);
}
break;
}
RestoreDC(hdcBuffer, dcsave);
SelectObject(hdcGlyph, hOld);
DeleteDC(hdcGlyph);
win32_repaint_area(This, x, y, cx, cy);
}
// TBD: a clean-up would be nice, too...
#define DO_GLYPH(ttext,idx) \
{\
glyph = cache_get_font (This, font, ttext[idx]);\
@ -1189,26 +1136,48 @@ extern "C"
void
ui_desktop_save(RDPCLIENT * This, uint32 offset, int x, int y, int cx, int cy)
{
// TODO
GdiFlush();
int Bpp = alignup(This->server_depth, 8) / 8;
int stride = alignup(This->width * Bpp, 4);
uint8 * data = (uint8 *)pBuffer + x * Bpp + (This->height - y - cy) * stride;
cache_put_desktop(This, offset * Bpp, cx, cy, stride, Bpp, data);
}
void
ui_desktop_restore(RDPCLIENT * This, uint32 offset, int x, int y, int cx, int cy)
{
// TODO
win32_repaint_whole(This);
// TBD: we can cache these values
int Bpp = alignup(This->server_depth, 8) / 8;
int tostride = alignup(This->width * Bpp, 4);
int fromstride = cx * Bpp;
const uint8 * src = cache_get_desktop(This, offset, cx, cy, Bpp);
uint8 * dst = (uint8 *)pBuffer + x * Bpp + (This->height - y - cy) * tostride;
GdiFlush();
for(int i = 0; i < cy; ++ i)
{
memcpy(dst, src, fromstride);
src += fromstride;
dst += tostride;
}
win32_repaint_area(This, x, y, cx, cy);
}
int nSavedDC;
void
ui_begin_update(RDPCLIENT * This)
{
// TODO? use a mutex to arbitrate access to the off-screen buffer?
nSavedDC = SaveDC(hdcBuffer);
}
void
ui_end_update(RDPCLIENT * This)
{
// TODO? use a mutex to arbitrate access to the off-screen buffer?
RestoreDC(hdcBuffer, nSavedDC);
}
};
@ -1233,13 +1202,7 @@ mstsc_mousewheel(RDPCLIENT * This, int value, LPARAM lparam)
static
LRESULT
CALLBACK
mstsc_WndProc
(
HWND hwnd,
UINT uMsg,
WPARAM wparam,
LPARAM lparam
)
mstsc_WndProc(HWND hwnd, UINT uMsg, WPARAM wparam, LPARAM lparam)
{
// BUGBUG: LongToPtr & PtrToLong will break on Win64
@ -1396,8 +1359,8 @@ mstsc_ProtocolIOThread
uint32 flags = RDP_LOGON_NORMAL | RDP_LOGON_COMPRESSION | RDP_LOGON_COMPRESSION2;
//rdp_connect(This, "10.0.0.3", flags, "", "", "", "");
rdp_connect(This, "192.168.7.232", flags, "", "", "", "");
rdp_connect(This, "10.0.0.3", flags, "", "", "", "");
//rdp_connect(This, "192.168.7.232", flags, "", "", "", "");
hdcBuffer = CreateCompatibleDC(NULL);
@ -1420,8 +1383,8 @@ mstsc_ProtocolIOThread
rcClip.left = 0;
rcClip.top = 0;
rcClip.right = This->width;
rcClip.bottom = This->height;
rcClip.right = This->width + 1;
rcClip.bottom = This->height + 1;
BOOL deactivated;
uint32 ext_disc_reason;
@ -1433,6 +1396,142 @@ mstsc_ProtocolIOThread
return 0;
}
/* Virtual channel stuff */
extern "C" void channel_process(RDPCLIENT * This, STREAM s, uint16 mcs_channel)
{
}
DWORD tlsIndex;
typedef struct CHANNEL_HANDLE_
{
RDPCLIENT * client;
int channel;
}
CHANNEL_HANDLE;
static
UINT
VCAPITYPE
VirtualChannelInit
(
LPVOID * ppInitHandle,
PCHANNEL_DEF pChannel,
INT channelCount,
ULONG versionRequested,
PCHANNEL_INIT_EVENT_FN pChannelInitEventProc
)
{
if(channelCount <= 0)
return CHANNEL_RC_BAD_CHANNEL;
if(ppInitHandle == NULL)
return CHANNEL_RC_BAD_INIT_HANDLE;
if(pChannel == NULL)
return CHANNEL_RC_BAD_CHANNEL;
if(pChannelInitEventProc == NULL)
return CHANNEL_RC_BAD_PROC;
RDPCLIENT * This = (RDPCLIENT *)TlsGetValue(tlsIndex);
if(This == NULL)
return CHANNEL_RC_NOT_IN_VIRTUALCHANNELENTRY;
if(This->num_channels + channelCount > CHANNEL_MAX_COUNT)
return CHANNEL_RC_TOO_MANY_CHANNELS;
for(INT i = 0; i < channelCount; ++ i)
{
if(strlen(pChannel[i].name) > CHANNEL_NAME_LEN)
return CHANNEL_RC_BAD_CHANNEL;
}
memcpy(This->channel_defs + This->num_channels, pChannel, sizeof(*pChannel) * channelCount);
for(INT i = 0; i < channelCount; ++ i)
{
pChannel[i].options |= CHANNEL_OPTION_INITIALIZED;
int j = This->num_channels + i;
This->channel_data[j].opened = 0;
This->channel_data[j].pChannelInitEventProc = pChannelInitEventProc;
This->channel_data[j].pChannelOpenEventProc = NULL;
}
This->num_channels += channelCount;
*ppInitHandle = This;
return CHANNEL_RC_OK;
}
UINT
VCAPITYPE
VirtualChannelOpen
(
LPVOID pInitHandle,
LPDWORD pOpenHandle,
PCHAR pChannelName,
PCHANNEL_OPEN_EVENT_FN pChannelOpenEventProc
)
{
if(pInitHandle == NULL)
return CHANNEL_RC_BAD_INIT_HANDLE;
if(pOpenHandle == NULL)
return CHANNEL_RC_BAD_CHANNEL_HANDLE;
if(pChannelName == NULL)
return CHANNEL_RC_UNKNOWN_CHANNEL_NAME;
if(pChannelOpenEventProc == NULL)
return CHANNEL_RC_BAD_PROC;
RDPCLIENT * This = (RDPCLIENT *)pInitHandle;
for(unsigned i = 0; i < This->num_channels; ++ i)
{
if(strcmp(pChannelName, This->channel_defs[i].name) == 0)
{
if(This->channel_data[i].opened)
return CHANNEL_RC_ALREADY_OPEN;
This->channel_data[i].opened = 1;
This->channel_data[i].pChannelOpenEventProc = pChannelOpenEventProc;
// TODO: allocate a handle here
*pOpenHandle = 0;
break;
}
}
return CHANNEL_RC_OK;
}
UINT VCAPITYPE VirtualChannelClose
(
DWORD openHandle
)
{
// TODO: channel handle management
return CHANNEL_RC_BAD_CHANNEL_HANDLE;
}
UINT VCAPITYPE VirtualChannelWrite
(
DWORD openHandle,
LPVOID pData,
ULONG dataLength,
LPVOID pUserData
)
{
// TODO
return CHANNEL_RC_BAD_CHANNEL_HANDLE;
}
int wmain()
{
WSADATA wsd;
@ -1459,8 +1558,8 @@ int wmain()
This->keyboard_type = 0x4;
This->keyboard_subtype = 0x0;
This->keyboard_functionkeys = 0xc;
This->width = 1024;
This->height = 768;
This->width = 800;
This->height = 600;
This->server_depth = 24;
This->bitmap_compression = True;
This->sendmotion = True;
@ -1469,7 +1568,7 @@ int wmain()
This->bitmap_cache_precache = True;
This->encryption = True;
This->packet_encryption = True;
This->desktop_save = False; // True;
This->desktop_save = True;
This->polygon_ellipse_orders = False; // = True;
This->fullscreen = False;
This->grab_keyboard = True;

View file

@ -36,6 +36,7 @@
/>
<Tool
Name="VCMIDLTool"
WarningLevel="1"
/>
<Tool
Name="VCCLCompilerTool"
@ -115,6 +116,7 @@
/>
<Tool
Name="VCMIDLTool"
WarningLevel="2"
/>
<Tool
Name="VCCLCompilerTool"
@ -184,6 +186,10 @@
Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
>
<File
RelativePath=".\activex.cpp"
>
</File>
<File
RelativePath=".\rdesktop-core-tester.cpp"
>
@ -225,6 +231,66 @@
UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}"
>
</Filter>
<Filter
Name="MIDL"
>
<File
RelativePath=".\mstsclib.idl"
>
<FileConfiguration
Name="Debug|Win32"
>
<Tool
Name="VCMIDLTool"
TypeLibraryName="$(IntDir)/mstsclib.tlb"
/>
</FileConfiguration>
<FileConfiguration
Name="Release|Win32"
>
<Tool
Name="VCMIDLTool"
TypeLibraryName="$(IntDir)/mstsclib.tlb"
/>
</FileConfiguration>
</File>
<File
RelativePath=".\mstsclib.rc"
>
<FileConfiguration
Name="Debug|Win32"
>
<Tool
Name="VCResourceCompilerTool"
PreprocessorDefinitions="TYPELIB_PATH__=./$(IntDir)/mstsclib.tlb"
/>
</FileConfiguration>
<FileConfiguration
Name="Release|Win32"
>
<Tool
Name="VCResourceCompilerTool"
PreprocessorDefinitions="TYPELIB_PATH__=./$(IntDir)/mstsclib.tlb"
/>
</FileConfiguration>
</File>
<File
RelativePath=".\mstsclib_h.h"
>
</File>
<File
RelativePath=".\mstsclib_i.c"
>
<FileConfiguration
Name="Debug|Win32"
>
<Tool
Name="VCCLCompilerTool"
UsePrecompiledHeader="0"
/>
</FileConfiguration>
</File>
</Filter>
</Files>
<Globals>
</Globals>

View file

@ -20,4 +20,9 @@
#include <windows.h>
#include <winsock2.h>
#include <objbase.h>
#include <oleauto.h>
#include <ocidl.h>
#include <objsafe.h>
// EOF

View file

@ -23,7 +23,7 @@
/* comment out #define BITMAP_SPEED_OVER_SIZE below for one slower function */
/* j@american-data.com */
//#define BITMAP_SPEED_OVER_SIZE
#define BITMAP_SPEED_OVER_SIZE
/* indent is confused by this file */
/* *INDENT-OFF* */

View file

@ -81,7 +81,7 @@ channel_send(RDPCLIENT * This, STREAM s, VCHANNEL * channel)
/* first fragment sent in-place */
s_pop_layer(s, channel_hdr);
length = s->end - s->p - 8;
length = s->end - s->p - sizeof(CHANNEL_PDU_HEADER);
DEBUG_CHANNEL(("channel_send, length = %d\n", length));

View file

@ -397,7 +397,7 @@ mcs_connect(RDPCLIENT * This, char *server, STREAM mcs_data, char *username)
for (i = 0; i < This->num_channels; i++)
{
mcs_send_cjrq(This, This->channels[i].mcs_id);
mcs_send_cjrq(This, MCS_GLOBAL_CHANNEL + 1 + i);
if (!mcs_recv_cjcf(This))
goto error;
}
@ -438,7 +438,7 @@ mcs_reconnect(RDPCLIENT * This, char *server, STREAM mcs_data)
for (i = 0; i < This->num_channels; i++)
{
mcs_send_cjrq(This, This->channels[i].mcs_id);
mcs_send_cjrq(This, MCS_GLOBAL_CHANNEL + 1 + i);
if (!mcs_recv_cjcf(This))
goto error;
}

View file

@ -204,10 +204,6 @@
RelativePath=".\cache.c"
>
</File>
<File
RelativePath=".\channels.c"
>
</File>
<File
RelativePath=".\iso.c"
>

View file

@ -191,12 +191,20 @@ typedef struct _seamless_window
} seamless_window;
#endif
typedef struct CHANNEL_PRIVATE_
{
int opened;
PCHANNEL_INIT_EVENT_FN pChannelInitEventProc;
PCHANNEL_OPEN_EVENT_FN pChannelOpenEventProc;
}
CHANNEL_PRIVATE;
/* holds the whole state of the RDP client */
struct rdpclient
{
/* channels.c */
#define MAX_CHANNELS 6
VCHANNEL channels[MAX_CHANNELS];
CHANNEL_DEF channel_defs[CHANNEL_MAX_COUNT];
CHANNEL_PRIVATE channel_data[CHANNEL_MAX_COUNT];
unsigned int num_channels;
/* licence.c */

View file

@ -318,6 +318,8 @@ sec_init(RDPCLIENT * This, uint32 flags, int maxlen)
}
/* Transmit secure transport packet over specified channel */
// !!! we need a lock here !!!
void
sec_send_to_channel(RDPCLIENT * This, STREAM s, uint32 flags, uint16 channel)
{
@ -333,8 +335,8 @@ sec_send_to_channel(RDPCLIENT * This, STREAM s, uint32 flags, uint16 channel)
datalen = s->end - s->p - 8;
#if WITH_DEBUG
//DEBUG(("Sending encrypted packet:\n"));
//hexdump(s->p + 8, datalen);
DEBUG(("Sending encrypted packet:\n"));
hexdump(s->p + 8, datalen);
#endif
sec_sign(s->p, 8, This->secure.sign_key, This->secure.rc4_key_len, s->p + 8, datalen);
@ -454,8 +456,8 @@ sec_out_mcs_data(RDPCLIENT * This, STREAM s)
for (i = 0; i < This->num_channels; i++)
{
DEBUG_RDP5(("Requesting channel %s\n", This->channels[i].name));
out_uint8a(s, This->channels[i].name, 8);
out_uint32_be(s, This->channels[i].flags);
out_uint8a(s, This->channel_defs[i].name, 8);
out_uint32_be(s, This->channel_defs[i].options);
}
}

View file

@ -132,12 +132,10 @@ typedef struct _key_translation
}
key_translation;
// TODO: semi-nuke, wrap CHANNEL_DEF
typedef struct _VCHANNEL
{
CHANNEL_DEF def;
uint16 mcs_id;
char name[8];
uint32 flags;
struct stream in;
void (*process) (RDPCLIENT *, STREAM);
}