//
// Copyright (c) 2004 Microsoft Corporation. All Rights Reserved.
//
// Abstract:
//
// Interface definition file for the RDP Screen Sharing API.
//
// Author:  WilhelmS
//
// Date:    06/24/2004
//

#include <olectl.h>

//
// This file will be processed by the MIDL tool to
// produce the type library (rdpcomapi.tlb) and marshalling code.
//

import "oaidl.idl";
import "ocidl.idl";

const int DISPID_RDPSRAPI_METHOD_OPEN                            = 100;
const int DISPID_RDPSRAPI_METHOD_CLOSE                           = 101;
const int DISPID_RDPSRAPI_METHOD_SETSHAREDRECT                   = 102;
const int DISPID_RDPSRAPI_METHOD_GETSHAREDRECT                   = 103;
const int DISPID_RDPSRAPI_METHOD_VIEWERCONNECT                   = 104;
const int DISPID_RDPSRAPI_METHOD_VIEWERDISCONNECT                = 105;
const int DISPID_RDPSRAPI_METHOD_TERMINATE_CONNECTION            = 106;
const int DISPID_RDPSRAPI_METHOD_CREATE_INVITATION               = 107;
const int DISPID_RDPSRAPI_METHOD_REQUEST_CONTROL                 = 108;
const int DISPID_RDPSRAPI_METHOD_VIRTUAL_CHANNEL_CREATE          = 109;
const int DISPID_RDPSRAPI_METHOD_VIRTUAL_CHANNEL_SEND_DATA       = 110;
const int DISPID_RDPSRAPI_METHOD_VIRTUAL_CHANNEL_SET_ACCESS      = 111;
const int DISPID_RDPSRAPI_METHOD_PAUSE                           = 112;
const int DISPID_RDPSRAPI_METHOD_RESUME                          = 113;
const int DISPID_RDPSRAPI_METHOD_SHOW_WINDOW                     = 114;
const int DISPID_RDPSRAPI_METHOD_REQUEST_COLOR_DEPTH_CHANGE      = 115;
const int DISPID_RDPSRAPI_METHOD_STARTREVCONNECTLISTENER         = 116;
const int DISPID_RDPSRAPI_METHOD_CONNECTTOCLIENT                 = 117;

const int DISPID_RDPSRAPI_PROP_DISPIDVALUE                          = 200;
const int DISPID_RDPSRAPI_PROP_ID                                   = 201;
const int DISPID_RDPSRAPI_PROP_SESSION_PROPERTIES                   = 202;
const int DISPID_RDPSRAPI_PROP_ATTENDEES                            = 203;
const int DISPID_RDPSRAPI_PROP_INVITATIONS                          = 204;
const int DISPID_RDPSRAPI_PROP_INVITATION                           = 205;
const int DISPID_RDPSRAPI_PROP_CHANNELMANAGER                       = 206;
const int DISPID_RDPSRAPI_PROP_VIRTUAL_CHANNEL_GETNAME              = 207;
const int DISPID_RDPSRAPI_PROP_VIRTUAL_CHANNEL_GETFLAGS             = 208;
const int DISPID_RDPSRAPI_PROP_VIRTUAL_CHANNEL_GETPRIORITY          = 209;
const int DISPID_RDPSRAPI_PROP_WINDOWID                             = 210;
const int DISPID_RDPSRAPI_PROP_APPLICATION                          = 211;
const int DISPID_RDPSRAPI_PROP_WINDOWSHARED                         = 212;
const int DISPID_RDPSRAPI_PROP_WINDOWNAME                           = 213;
const int DISPID_RDPSRAPI_PROP_APPNAME                              = 214;
const int DISPID_RDPSRAPI_PROP_APPLICATION_FILTER                   = 215;
const int DISPID_RDPSRAPI_PROP_WINDOW_LIST                          = 216;
const int DISPID_RDPSRAPI_PROP_APPLICATION_LIST                     = 217;
const int DISPID_RDPSRAPI_PROP_APPFILTER_ENABLED                    = 218;
const int DISPID_RDPSRAPI_PROP_APPFILTERENABLED                     = 219;
const int DISPID_RDPSRAPI_PROP_SHARED                               = 220;
const int DISPID_RDPSRAPI_PROP_INVITATIONITEM                       = 221;
const int DISPID_RDPSRAPI_PROP_DBG_CLX_CMDLINE                      = 222;
const int DISPID_RDPSRAPI_PROP_APPFLAGS                             = 223;
const int DISPID_RDPSRAPI_PROP_WNDFLAGS                             = 224;
const int DISPID_RDPSRAPI_PROP_PROTOCOL_TYPE                        = 225;
const int DISPID_RDPSRAPI_PROP_LOCAL_PORT                           = 226;
const int DISPID_RDPSRAPI_PROP_LOCAL_IP                             = 227;
const int DISPID_RDPSRAPI_PROP_PEER_PORT                            = 228;
const int DISPID_RDPSRAPI_PROP_PEER_IP                              = 229;
const int DISPID_RDPSRAPI_PROP_ATTENDEE_FLAGS                       = 230;
const int DISPID_RDPSRAPI_PROP_CONINFO                              = 231;
const int DISPID_RDPSRAPI_PROP_CONNECTION_STRING                    = 232;
const int DISPID_RDPSRAPI_PROP_GROUP_NAME                           = 233;
const int DISPID_RDPSRAPI_PROP_PASSWORD                             = 234;
const int DISPID_RDPSRAPI_PROP_ATTENDEELIMIT                        = 235;
const int DISPID_RDPSRAPI_PROP_REVOKED                              = 236;
const int DISPID_RDPSRAPI_PROP_DISCONNECTED_STRING                  = 237;
const int DISPID_RDPSRAPI_PROP_USESMARTSIZING                       = 238;
const int DISPID_RDPSRAPI_PROP_SESSION_COLORDEPTH                   = 239;
const int DISPID_RDPSRAPI_PROP_REASON                               = 240;
const int DISPID_RDPSRAPI_PROP_CODE                                 = 241;
const int DISPID_RDPSRAPI_PROP_CTRL_LEVEL                           = 242;
const int DISPID_RDPSRAPI_PROP_REMOTENAME                           = 243;
const int DISPID_RDPSRAPI_PROP_COUNT                                = 244;


const int DISPID_RDPSRAPI_EVENT_ON_ATTENDEE_CONNECTED               = 301;
const int DISPID_RDPSRAPI_EVENT_ON_ATTENDEE_DISCONNECTED            = 302;
const int DISPID_RDPSRAPI_EVENT_ON_ATTENDEE_UPDATE                  = 303;
const int DISPID_RDPSRAPI_EVENT_ON_ERROR                            = 304;
const int DISPID_RDPSRAPI_EVENT_ON_VIEWER_CONNECTED                 = 305;
const int DISPID_RDPSRAPI_EVENT_ON_VIEWER_DISCONNECTED              = 306;
const int DISPID_RDPSRAPI_EVENT_ON_VIEWER_AUTHENTICATED             = 307;
const int DISPID_RDPSRAPI_EVENT_ON_VIEWER_CONNECTFAILED             = 308;
const int DISPID_RDPSRAPI_EVENT_ON_CTRLLEVEL_CHANGE_REQUEST         = 309;
const int DISPID_RDPSRAPI_EVENT_ON_GRAPHICS_STREAM_PAUSED           = 310;
const int DISPID_RDPSRAPI_EVENT_ON_GRAPHICS_STREAM_RESUMED          = 311;
const int DISPID_RDPSRAPI_EVENT_ON_VIRTUAL_CHANNEL_JOIN             = 312;
const int DISPID_RDPSRAPI_EVENT_ON_VIRTUAL_CHANNEL_LEAVE            = 313;
const int DISPID_RDPSRAPI_EVENT_ON_VIRTUAL_CHANNEL_DATARECEIVED     = 314;
const int DISPID_RDPSRAPI_EVENT_ON_VIRTUAL_CHANNEL_SENDCOMPLETED    = 315;
const int DISPID_RDPSRAPI_EVENT_ON_APPLICATION_OPEN                 = 316;
const int DISPID_RDPSRAPI_EVENT_ON_APPLICATION_CLOSE                = 317;
const int DISPID_RDPSRAPI_EVENT_ON_APPLICATION_UPDATE               = 318;
const int DISPID_RDPSRAPI_EVENT_ON_WINDOW_OPEN                      = 319;
const int DISPID_RDPSRAPI_EVENT_ON_WINDOW_CLOSE                     = 320;
const int DISPID_RDPSRAPI_EVENT_ON_WINDOW_UPDATE                    = 321;
const int DISPID_RDPSRAPI_EVENT_ON_APPFILTER_UPDATE                 = 322;
const int DISPID_RDPSRAPI_EVENT_ON_SHARED_RECT_CHANGED              = 323;
const int DISPID_RDPSRAPI_EVENT_ON_FOCUSRELEASED                    = 324;
const int DISPID_RDPSRAPI_EVENT_ON_SHARED_DESKTOP_SETTINGS_CHANGED  = 325;

[
    object,
    uuid(aa1e42b5-496d-4ca4-a690-348dcb2ec4ad),
    hidden,
    pointer_default(unique)
]
interface IRDPSRAPIDebug : IUnknown
{
    [
        propput,
        id(DISPID_RDPSRAPI_PROP_DBG_CLX_CMDLINE)
    ]
    HRESULT
    CLXCmdLine(
        [in] BSTR  CLXCmdLine
        );

    [
        propget,
        id(DISPID_RDPSRAPI_PROP_DBG_CLX_CMDLINE)
    ]
    HRESULT CLXCmdLine(
        [out, retval] BSTR* pCLXCmdLine
        );

}; // IRDPSRAPIDebug


[
    uuid(CC802D05-AE07-4C15-B496-DB9D22AA0A84),
    version(1.0)
]
library RDPCOMAPILib
{
    importlib("stdole32.tlb");
    importlib("stdole2.tlb");

    typedef enum {
        CTRL_LEVEL_MIN           = 0,
        CTRL_LEVEL_INVALID       = 0,
        CTRL_LEVEL_NONE          = 1,
        CTRL_LEVEL_VIEW          = 2,
        CTRL_LEVEL_INTERACTIVE   = 3,
        CTRL_LEVEL_MAX           = 3
    } CTRL_LEVEL;

    typedef enum {
        ATTENDEE_DISCONNECT_REASON_MIN = 0,
        ATTENDEE_DISCONNECT_REASON_APP = 0,
        ATTENDEE_DISCONNECT_REASON_ERR = 1,
        ATTENDEE_DISCONNECT_REASON_CLI = 2,
        ATTENDEE_DISCONNECT_REASON_MAX = 2
    } ATTENDEE_DISCONNECT_REASON;

    typedef enum {
        CHANNEL_PRIORITY_LO,
        CHANNEL_PRIORITY_MED,
        CHANNEL_PRIORITY_HI
    }   CHANNEL_PRIORITY;

    typedef enum {
        CHANNEL_FLAGS_LEGACY       = 0x01,
        CHANNEL_FLAGS_UNCOMPRESSED = 0x02
    } CHANNEL_FLAGS;

    typedef enum {
        CHANNEL_ACCESS_ENUM_NONE,
        CHANNEL_ACCESS_ENUM_SENDRECEIVE
    } CHANNEL_ACCESS_ENUM;

    typedef enum {
        CONST_MAX_CHANNEL_MESSAGE_SIZE          = 1024,
        CONST_MAX_CHANNEL_NAME_LEN              = 8,
        CONST_MAX_LEGACY_CHANNEL_MESSAGE_SIZE   = 409600,
        CONST_ATTENDEE_ID_EVERYONE              = -1,
        CONST_ATTENDEE_ID_HOST                  = 0, 
        CONST_CONN_INTERVAL                     = 50
    } RDPENCOMAPI_CONSTANTS;

    typedef enum {
        ATTENDEE_FLAGS_LOCAL = 1
    } RDPENCOMAPI_ATTENDEE_FLAGS;

    typedef enum {
        WND_FLAG_PRIVILEGED = 1
    } RDPSRAPI_WND_FLAGS;

    typedef enum {
        APP_FLAG_PRIVILEGED = 1
    } RDPSRAPI_APP_FLAGS;

    [
        uuid(98a97042-6698-40e9-8efd-b3200990004b)
    ]
    dispinterface _IRDPSessionEvents
    {
        properties:
        methods:
        
        [
            id(DISPID_RDPSRAPI_EVENT_ON_ATTENDEE_CONNECTED)
        ]
        void 
        OnAttendeeConnected(
            [in] IDispatch* pAttendee
            );
            
        [
            id(DISPID_RDPSRAPI_EVENT_ON_ATTENDEE_DISCONNECTED)
        ]
        void 
        OnAttendeeDisconnected(
            [in] IDispatch* pDisconnectInfo
            );

        [
            id(DISPID_RDPSRAPI_EVENT_ON_ATTENDEE_UPDATE)
        ]
        void 
        OnAttendeeUpdate(
            [in] IDispatch* pAttendee
            );

        [
            id(DISPID_RDPSRAPI_EVENT_ON_VIEWER_CONNECTED)
        ]
        void 
        OnConnectionEstablished();

        [
            id(DISPID_RDPSRAPI_EVENT_ON_VIEWER_CONNECTFAILED)
        ]
        void 
        OnConnectionFailed();        

        [
            id(DISPID_RDPSRAPI_EVENT_ON_VIEWER_DISCONNECTED)
        ]
        void 
        OnConnectionTerminated(
            [in] long discReason, 
            [in] long ExtendedInfo
            );

        [
            id(DISPID_RDPSRAPI_EVENT_ON_VIEWER_AUTHENTICATED)
        ]
        void 
        OnConnectionAuthenticated();
            
        [
            id(DISPID_RDPSRAPI_EVENT_ON_ERROR)
        ]
        void 
        OnError(
            [in] VARIANT ErrorInfo
            );

        [
            id(DISPID_RDPSRAPI_EVENT_ON_APPLICATION_OPEN)
        ]
        void 
        OnApplicationOpen(
            [in] IDispatch* pApplication
            );
            
        [
            id(DISPID_RDPSRAPI_EVENT_ON_APPLICATION_CLOSE)
        ]
        void 
        OnApplicationClose(
            [in] IDispatch* pApplication
            );

        [
            id(DISPID_RDPSRAPI_EVENT_ON_APPLICATION_UPDATE)
        ]
        void 
        OnApplicationUpdate(
            [in] IDispatch* pApplication
            );
            
        [
            id(DISPID_RDPSRAPI_EVENT_ON_WINDOW_OPEN)
        ]
        void 
        OnWindowOpen(
            [in] IDispatch* pWindow
            );

        [
            id(DISPID_RDPSRAPI_EVENT_ON_WINDOW_CLOSE)
        ]
        void 
        OnWindowClose(
            [in] IDispatch* pWindow
            );

        [
            id(DISPID_RDPSRAPI_EVENT_ON_WINDOW_UPDATE)
        ]
        void 
        OnWindowUpdate(
            [in] IDispatch* pWindow
            );

        [
            id(DISPID_RDPSRAPI_EVENT_ON_CTRLLEVEL_CHANGE_REQUEST)
        ]
        void 
        OnControlLevelChangeRequest(
            [in] IDispatch* pAttendee,
            [in] CTRL_LEVEL RequestedLevel
            );

        [
            id(DISPID_RDPSRAPI_EVENT_ON_GRAPHICS_STREAM_PAUSED)
        ]
        void 
        OnGraphicsStreamPaused();

        [
            id(DISPID_RDPSRAPI_EVENT_ON_GRAPHICS_STREAM_RESUMED)
        ]
        void 
        OnGraphicsStreamResumed();

        [
            id(DISPID_RDPSRAPI_EVENT_ON_VIRTUAL_CHANNEL_DATARECEIVED)
        ]
        void OnChannelDataReceived(
            [in] IUnknown*        pChannel,
            [in] long             lAttendeeId,
            [in] BSTR             bstrData
            );

        [
            id(DISPID_RDPSRAPI_EVENT_ON_VIRTUAL_CHANNEL_SENDCOMPLETED)
        ]
        void OnChannelDataSent(
            [in] IUnknown* pChannel,
            [in] long      lAttendeeId,            
            [in] long      BytesSent  
            );

        [
            id(DISPID_RDPSRAPI_EVENT_ON_SHARED_RECT_CHANGED)
        ]
        void OnSharedRectChanged(
            [in] long      left,            
            [in] long      top,
            [in] long      right,
            [in] long      bottom
            );

        [
            id(DISPID_RDPSRAPI_EVENT_ON_FOCUSRELEASED)
        ]
        void OnFocusReleased(
            [in] int iDirection
            );

        [
            id(DISPID_RDPSRAPI_EVENT_ON_SHARED_DESKTOP_SETTINGS_CHANGED)
        ]
        void OnSharedDesktopSettingsChanged(
            [in] long width,
            [in] long height,
            [in] long colordepth
            );
            
    }; // _IRDPSessionEvents

    ///////////////////////////////////////////////////////////////////////////
    // REV 2.0 definitions. 
    ///////////////////////////////////////////////////////////////////////////
    interface IRDPSRAPIApplication;

    [
        object,
        uuid(beafe0f9-c77b-4933-ba9f-a24cddcc27cf),
        dual,
        pointer_default(unique)
    ]
    interface IRDPSRAPIWindow: IDispatch
    {
        [
            propget, 
            id(DISPID_RDPSRAPI_PROP_ID)
        ]
        HRESULT 
        Id(
            [out, retval] long* pRetVal
            );

        [
            propget, 
            id(DISPID_RDPSRAPI_PROP_APPLICATION)
        ]
        HRESULT 
        Application(
            [out, retval] IRDPSRAPIApplication** pApplication
            );
            
        [
            propget, 
            id(DISPID_RDPSRAPI_PROP_SHARED)
        ]
        HRESULT 
        Shared(
            [out, retval] VARIANT_BOOL* pRetVal
            );
        
        [
            propput, 
            id(DISPID_RDPSRAPI_PROP_SHARED)
        ]
        HRESULT 
        Shared(
            [in] VARIANT_BOOL NewVal
            );
            
        [
            propget, 
            id(DISPID_RDPSRAPI_PROP_WINDOWNAME)
        ]
        HRESULT 
        Name(
            [out, retval] BSTR* pRetVal
            );

        [
            id(DISPID_RDPSRAPI_METHOD_SHOW_WINDOW)
        ]
        HRESULT 
        Show();

        [
            propget, 
            id(DISPID_RDPSRAPI_PROP_WNDFLAGS)
        ]
        HRESULT
        Flags(
            [out, retval] unsigned long* pdwFlags
            );
            
    }; // IRDPSRAPIWindow

    [
        object,
        uuid(8a05ce44-715a-4116-a189-a118f30a07bd),
        dual,
        pointer_default(unique)
    ]
    interface IRDPSRAPIWindowList: IDispatch
    {       
        [
            propget, 
            restricted, 
            id(DISPID_NEWENUM)
        ]
        HRESULT 
        _NewEnum(
            [out, retval] IUnknown** retval
            );
            
        [
            propget, 
            id(DISPID_VALUE)
        ]
        HRESULT 
        Item(
            [in] long item, 
            [out, retval] IRDPSRAPIWindow** pWindow
            );

    }; // IRDPSRAPIWindowList

    [
        object,
        uuid(41e7a09d-eb7a-436e-935d-780ca2628324),
        dual,
        pointer_default(unique)
    ]
    interface IRDPSRAPIApplication: IDispatch
    {
        [
            propget, 
            id(DISPID_VALUE)
        ]
        HRESULT 
        Windows(
            [out, retval] IRDPSRAPIWindowList** pWindowList
            );

        [
            propget, 
            id(DISPID_RDPSRAPI_PROP_ID)
        ]
        HRESULT 
        Id(
            [out, retval] long* pRetVal
            );

        [
            propget, 
            id(DISPID_RDPSRAPI_PROP_SHARED)
        ]
        HRESULT 
        Shared(
            [out, retval] VARIANT_BOOL* pRetVal
            );

        [
            propput, 
            id(DISPID_RDPSRAPI_PROP_SHARED)
        ]
        HRESULT Shared(
            [in] VARIANT_BOOL NewVal
            ); 

        [
            propget, 
            id(DISPID_RDPSRAPI_PROP_APPNAME)
        ]
        HRESULT Name(
            [out, retval] BSTR* pRetVal
            );

        [
            propget, 
            id(DISPID_RDPSRAPI_PROP_APPFLAGS)
        ]
        HRESULT
        Flags(
            [out, retval] unsigned long* pdwFlags
            );

    }; // IRDPSRAPIApplication

    [
        object,
        uuid(d4b4aeb3-22dc-4837-b3b6-42ea2517849a),
        dual,
        pointer_default(unique)
    ]
    interface IRDPSRAPIApplicationList: IDispatch
    {
        [
            propget, 
            restricted, 
            id(DISPID_NEWENUM)
        ]
        HRESULT 
        _NewEnum(
            [out, retval] IUnknown** retval
            );

        [
            propget, 
            id(DISPID_VALUE)
        ]
        HRESULT 
        Item(
            [in] long item, 
            [out, retval] IRDPSRAPIApplication** pApplication
            );

    }; // IRDPSRAPIApplicationList

    [
        object,
        uuid(d20f10ca-6637-4f06-b1d5-277ea7e5160d),
        dual,
        pointer_default(unique)
    ]
    interface IRDPSRAPIApplicationFilter: IDispatch
    {
        [
            propget, 
            id(DISPID_RDPSRAPI_PROP_APPLICATION_LIST)
        ]
        HRESULT 
        Applications(
            [out, retval] IRDPSRAPIApplicationList** pApplications
            );

        [
            propget, 
            id(DISPID_RDPSRAPI_PROP_WINDOW_LIST)
        ]
        HRESULT 
        Windows(
            [out, retval] IRDPSRAPIWindowList** pWindows
            );
            
        [
            propget, 
            id(DISPID_RDPSRAPI_PROP_APPFILTERENABLED)
        ]
        HRESULT 
        Enabled(
            [out, retval] VARIANT_BOOL* pRetVal
            );

        [
            propput, 
            id(DISPID_RDPSRAPI_PROP_APPFILTERENABLED)
        ]
        HRESULT 
        Enabled(
            [in] VARIANT_BOOL NewVal
            );

    }; // IRDPSRAPIApplicationFilter

    [
        object,
        uuid(339b24f2-9bc0-4f16-9aac-f165433d13d4),
        dual,
        pointer_default(unique)
    ]
    interface IRDPSRAPISessionProperties: IDispatch
    {
        [
            propget, 
            id(DISPID_VALUE)
        ] 
        HRESULT 
        Property(
            [in] BSTR PropertyName, 
            [out, retval] VARIANT *pVal
            );
        
        [
            propput, 
            id(DISPID_VALUE)
        ]
        HRESULT 
        Property(
            [in] BSTR PropertyName, 
            [in] VARIANT newVal
            );
    };

    [
        object,
        uuid(4fac1d43-fc51-45bb-b1b4-2b53aa562fa3),
        dual,
        pointer_default(unique)
    ]
    interface IRDPSRAPIInvitation: IDispatch
    {

        [
            propget, 
            id(DISPID_RDPSRAPI_PROP_CONNECTION_STRING)
        ] 
        HRESULT 
        ConnectionString(
            [out, retval] BSTR *pbstrVal
            );

        [
            propget, 
            id(DISPID_RDPSRAPI_PROP_GROUP_NAME)
        ] 
        HRESULT 
        GroupName(
            [out, retval] BSTR *pbstrVal
            );

        [
            propget, 
            id(DISPID_RDPSRAPI_PROP_PASSWORD)
        ] 
        HRESULT 
        Password(
            [out, retval] BSTR *pbstrVal
            );

        [
            propget, 
            id(DISPID_RDPSRAPI_PROP_ATTENDEELIMIT)
        ]
        HRESULT 
        AttendeeLimit(
            [out, retval] long* pRetVal
            );

        [
            propput, 
            id(DISPID_RDPSRAPI_PROP_ATTENDEELIMIT)
        ]
        HRESULT 
        AttendeeLimit(
            [in] long NewVal
            );

        [
            propget, 
            id(DISPID_RDPSRAPI_PROP_REVOKED)
        ]
        HRESULT 
        Revoked(
            [out, retval] VARIANT_BOOL* pRetVal
            );

        [
            propput, 
            id(DISPID_RDPSRAPI_PROP_REVOKED)
        ]
        HRESULT 
        Revoked(
            [in] VARIANT_BOOL NewVal
            );
            
    }; // IRDPSRAPIInvitation

    [
        object,
        uuid(4722b049-92c3-4c2d-8a65-f7348f644dcf),
        dual,
        pointer_default(unique)
    ]
    interface IRDPSRAPIInvitationManager: IDispatch
    {

        [
            propget, 
            restricted, 
            id(DISPID_NEWENUM)
        ]
        HRESULT 
        _NewEnum(
            [out, retval] IUnknown** retval
            );

        [
            propget, 
            id(DISPID_VALUE)
        ]
        HRESULT 
        Item(
            [in] VARIANT item,  
            [out, retval] IRDPSRAPIInvitation** ppInvitation
            );

        [
            propget, 
            id(DISPID_RDPSRAPI_PROP_COUNT)
        ] 
        HRESULT 
        Count(
            [out, retval] long *pRetVal
            );
    
        [
            id(DISPID_RDPSRAPI_METHOD_CREATE_INVITATION)
        ]
        HRESULT 
        CreateInvitation(
            [in] BSTR bstrAuthString,
            [in] BSTR bstrGroupName,
            [in] BSTR bstrPassword,
            [in] long AttendeeLimit,
            [out, retval] IRDPSRAPIInvitation** ppInvitation
            );
            
    }; // IRDPSRAPIInvitationManager

    [
        object,
        uuid(f74049a4-3d06-4028-8193-0a8c29bc2452),
        dual,
        pointer_default(unique)
    ]
    interface IRDPSRAPITcpConnectionInfo : IDispatch
    {
        [
            propget, 
            id(DISPID_RDPSRAPI_PROP_PROTOCOL_TYPE)
        ] 
        HRESULT 
        Protocol(
            [out, retval] long* plProtocol
            );

        [
            propget, 
            id(DISPID_RDPSRAPI_PROP_LOCAL_PORT)
        ] 
        HRESULT 
        LocalPort(
            [out, retval] long* plPort
            );

        [
            propget, 
            id(DISPID_RDPSRAPI_PROP_LOCAL_IP)
        ] 
        HRESULT 
        LocalIP(
            [out, retval] BSTR* pbsrLocalIP
            );

        [
            propget, 
            id(DISPID_RDPSRAPI_PROP_PEER_PORT)
        ] 
        HRESULT 
        PeerPort(
            [out, retval] long* plPort
            );

        [
            propget, 
            id(DISPID_RDPSRAPI_PROP_PEER_IP)
        ] 
        HRESULT 
        PeerIP(
            [out, retval] BSTR* pbstrIP
            );
            
    }; // IRDPSRAPITcpConnectionInfo


    [
        object,
        uuid(ec0671b3-1b78-4b80-a464-9132247543e3),
        dual,
        pointer_default(unique)
    ]
    interface IRDPSRAPIAttendee : IDispatch
    {
        [
            propget, 
            id(DISPID_RDPSRAPI_PROP_ID)
        ]
        HRESULT 
        Id(
            [out, retval] long* pId
            );
        
        [
            propget, 
            id(DISPID_RDPSRAPI_PROP_REMOTENAME)
        ] 
        HRESULT 
        RemoteName(
            [out, retval] BSTR *pVal
            );

        [
            propget, 
            id(DISPID_RDPSRAPI_PROP_CTRL_LEVEL)
        ] 
        HRESULT 
        ControlLevel(
            [out, retval] CTRL_LEVEL *pVal
            );

        [
            propput, 
            id(DISPID_RDPSRAPI_PROP_CTRL_LEVEL)
        ]
        HRESULT 
        ControlLevel(
            [in] CTRL_LEVEL pNewVal
            );

        [
            propget, 
            id(DISPID_RDPSRAPI_PROP_INVITATION)
        ] 
        HRESULT 
        Invitation(
            [out, retval] IRDPSRAPIInvitation** ppVal
            );
            
        [
            id(DISPID_RDPSRAPI_METHOD_TERMINATE_CONNECTION)
        ]
        HRESULT 
        TerminateConnection();


        [
            propget, 
            id(DISPID_RDPSRAPI_PROP_ATTENDEE_FLAGS)
        ] 
        HRESULT 
        Flags(
            [out, retval] long* plFlags
            );

        [
            propget, 
            id(DISPID_RDPSRAPI_PROP_CONINFO)
        ] 
        HRESULT 
        ConnectivityInfo(
            [out, retval] IUnknown** ppVal
            );
            
    }; // IRDPSRAPIAttendee

    [
        object,
        uuid(ba3a37e8-33da-4749-8da0-07fa34da7944),
        dual,
        pointer_default(unique)
    ]
    interface IRDPSRAPIAttendeeManager : IDispatch
    {
        [
            propget, 
            restricted, 
            id(DISPID_NEWENUM)
        ]
        HRESULT 
        _NewEnum(
            [out, retval] IUnknown** retval
            );

        [
            propget, 
            id(DISPID_VALUE)
        ]
        HRESULT 
        Item(
            [in] long id, 
            [out, retval] IRDPSRAPIAttendee** ppItem
            );
    }; // IAttendeeManager

    [
        object,
        uuid(c187689f-447c-44a1-9c14-fffbb3b7ec17),
        dual,
        pointer_default(unique)
    ]
    interface IRDPSRAPIAttendeeDisconnectInfo : IDispatch
    {

        [
            propget, 
            id(DISPID_VALUE)
        ]
        HRESULT 
        Attendee(
            [out, retval] IRDPSRAPIAttendee** retval
            );
            
        [
            propget, 
            id(DISPID_RDPSRAPI_PROP_REASON)
        ]
        HRESULT 
        Reason(
            [out, retval] ATTENDEE_DISCONNECT_REASON* pReason
            );

        [
            propget, 
            id(DISPID_RDPSRAPI_PROP_CODE)
        ]
        HRESULT 
        Code(
            [out, retval] long* pVal
            );    

    };

    [
        object,
        uuid(05e12f95-28b3-4c9a-8780-d0248574a1e0),
        dual,
        pointer_default(unique)
    ]
    interface IRDPSRAPIVirtualChannel : IDispatch
    {
        [
            id(DISPID_RDPSRAPI_METHOD_VIRTUAL_CHANNEL_SEND_DATA)
        ]
        HRESULT
        SendData(
            [in] BSTR             bstrData,
            [in] long             lAttendeeId,
            [in] unsigned long    ChannelSendFlags 
            );

        [
            id(DISPID_RDPSRAPI_METHOD_VIRTUAL_CHANNEL_SET_ACCESS)
        ]
        HRESULT
        SetAccess(
            [in] long                lAttendeeId,
            [in] CHANNEL_ACCESS_ENUM AccessType
            );
           
        [
            propget,
            id(DISPID_RDPSRAPI_PROP_VIRTUAL_CHANNEL_GETNAME)
        ]
        HRESULT
        Name(
            [out, retval] BSTR* pbstrName
            );
            
        [
            propget,
            id(DISPID_RDPSRAPI_PROP_VIRTUAL_CHANNEL_GETFLAGS)
        ]
        HRESULT
        Flags(
            [out, retval] long* plFlags
            );

        [
            propget,
            id(DISPID_RDPSRAPI_PROP_VIRTUAL_CHANNEL_GETPRIORITY)
        ]
        HRESULT
        Priority(
            [out, retval] CHANNEL_PRIORITY* pPriority
            );    
    }; //IVirtual Channel

    [
        object,
        uuid(0d11c661-5d0d-4ee4-89df-2166ae1fdfed),
        dual,
        pointer_default(unique)
    ]
    interface IRDPSRAPIVirtualChannelManager : IDispatch
    {
        [
            propget, 
            restricted, 
            id(DISPID_NEWENUM)
        ]
        HRESULT 
        _NewEnum(
            [out, retval] IUnknown** retval
            );

        [
            propget, 
            id(DISPID_VALUE)
        ]
        HRESULT 
        Item(
            [in] VARIANT  item,
            [out, retval] IRDPSRAPIVirtualChannel** pChannel
            );

        [
            id(DISPID_RDPSRAPI_METHOD_VIRTUAL_CHANNEL_CREATE) 
        ]
        HRESULT
        CreateVirtualChannel(
            [in] BSTR                               bstrChannelName,
            [in] CHANNEL_PRIORITY                   Priority,
            [in] unsigned long                      ChannelFlags,
            [out, retval] IRDPSRAPIVirtualChannel** ppChannel
            );

    }; //IRDPSRAPIVirtualChannelList

    [
        object,
        uuid(eeb20886-e470-4cf6-842b-2739c0ec5cfb),
        dual,
        pointer_default(unique)
    ]
    interface IRDPSRAPISharingSession : IDispatch
    {
        [
            id(DISPID_RDPSRAPI_METHOD_OPEN)
        ]
        HRESULT 
        Open();        

        [
          id(DISPID_RDPSRAPI_METHOD_CLOSE)
        ]
        HRESULT 
        Close();
        
        [
            propput, 
            id(DISPID_RDPSRAPI_PROP_SESSION_COLORDEPTH)
        ]
        HRESULT 
        ColorDepth(
            [in] long colorDepth
            );

        [
            propget, 
            id(DISPID_RDPSRAPI_PROP_SESSION_COLORDEPTH)
        ]
        HRESULT 
        ColorDepth(
            [out, retval] long* pColorDepth
            );


        [
            propget, 
            id(DISPID_RDPSRAPI_PROP_SESSION_PROPERTIES)
        ]
        HRESULT 
        Properties(
            [out, retval] IRDPSRAPISessionProperties **ppVal
            );
            
        [
            propget, 
            id(DISPID_RDPSRAPI_PROP_ATTENDEES)
        ]
        HRESULT 
        Attendees(
            [out, retval] IRDPSRAPIAttendeeManager **ppVal
            );
        
        [
            propget, 
            id(DISPID_RDPSRAPI_PROP_INVITATIONS)
        ]
        HRESULT
        Invitations(
            [out, retval] IRDPSRAPIInvitationManager **ppVal
            );

        [
            propget, 
            id(DISPID_RDPSRAPI_PROP_APPLICATION_FILTER)
        ]
        HRESULT 
        ApplicationFilter(
            [out, retval] IRDPSRAPIApplicationFilter **ppVal
            );

        [
            propget, 
            id(DISPID_RDPSRAPI_PROP_CHANNELMANAGER)
        ]
        HRESULT 
        VirtualChannelManager(
            [out, retval] IRDPSRAPIVirtualChannelManager** ppVal
            );

        [
            id(DISPID_RDPSRAPI_METHOD_PAUSE)
        ]
        HRESULT
        Pause();

        [
            id(DISPID_RDPSRAPI_METHOD_RESUME)
        ]
        HRESULT
        Resume();

        [
            id(DISPID_RDPSRAPI_METHOD_CONNECTTOCLIENT)
        ]
        HRESULT 
        ConnectToClient(
            [in] BSTR bstrConnectionString
            );

        [
            id(DISPID_RDPSRAPI_METHOD_SETSHAREDRECT)
        ]
        HRESULT 
        SetDesktopSharedRect(
            [in] long left, 
            [in] long top, 
            [in] long right, 
            [in] long bottom
            );

        [
            id(DISPID_RDPSRAPI_METHOD_GETSHAREDRECT)
        ]
        HRESULT 
        GetDesktopSharedRect(
            [out] long* pleft, 
            [out] long* ptop, 
            [out] long* pright,
            [out] long* pbottom
            );            
    };

    [
        object,
        uuid(c6bfcd38-8ce9-404d-8ae8-f31d00c65cb5),
        dual,
        pointer_default(unique)
    ]
    interface IRDPSRAPIViewer : IDispatch
    {

        [
            id(DISPID_RDPSRAPI_METHOD_VIEWERCONNECT)
        ]
        HRESULT 
        Connect(
            [in] BSTR bstrConnectionString,
            [in] BSTR bstrName,
            [in] BSTR bstrPassword
            );
            
        [
            id(DISPID_RDPSRAPI_METHOD_VIEWERDISCONNECT)
        ]
        HRESULT 
        Disconnect();
    
        [
            propget, 
            id(DISPID_RDPSRAPI_PROP_ATTENDEES)
        ]
        HRESULT 
        Attendees(
            [out, retval] IRDPSRAPIAttendeeManager **ppVal
            );
        
        [
            propget, 
            id(DISPID_RDPSRAPI_PROP_INVITATIONS)
        ]
        HRESULT
        Invitations(
            [out, retval] IRDPSRAPIInvitationManager **ppVal
            );

        [
            propget, 
            id(DISPID_RDPSRAPI_PROP_APPLICATION_FILTER)
        ]
        HRESULT 
        ApplicationFilter(
            [out, retval] IRDPSRAPIApplicationFilter **ppVal
            );

        [
            propget, 
            id(DISPID_RDPSRAPI_PROP_CHANNELMANAGER)
        ]
        HRESULT 
        VirtualChannelManager(
            [out, retval] IRDPSRAPIVirtualChannelManager** ppVal
            );


        [
            propput, 
            id(DISPID_RDPSRAPI_PROP_USESMARTSIZING)
        ]
        HRESULT 
        SmartSizing(
            [in] VARIANT_BOOL vbSmartSizing
            );
        
        [
            propget, 
            id(DISPID_RDPSRAPI_PROP_USESMARTSIZING)
        ]
        HRESULT 
        SmartSizing(
            [out, retval] VARIANT_BOOL* pvbSmartSizing
            );

        [
            id(DISPID_RDPSRAPI_METHOD_REQUEST_CONTROL)
        ]
        HRESULT 
        RequestControl(
            [in] CTRL_LEVEL CtrlLevel
            );

        [
            propput,
            id(DISPID_RDPSRAPI_PROP_DISCONNECTED_STRING)
        ]
        HRESULT 
        DisconnectedText(
            [in] BSTR bstrDisconnectedText
            );

        [
            propget,
            id(DISPID_RDPSRAPI_PROP_DISCONNECTED_STRING)
        ]
        HRESULT
        DisconnectedText(
            [out, retval] BSTR* pbstrDisconnectedText
            );



        [
            id(DISPID_RDPSRAPI_METHOD_REQUEST_COLOR_DEPTH_CHANGE)
        ]
        HRESULT 
        RequestColorDepthChange(
            [in] long Bpp
            );

        [
            propget, 
            id(DISPID_RDPSRAPI_PROP_SESSION_PROPERTIES)
        ]
        HRESULT 
        Properties(
            [out, retval] IRDPSRAPISessionProperties **ppVal
            );

        [
            id(DISPID_RDPSRAPI_METHOD_STARTREVCONNECTLISTENER)
        ]
        HRESULT 
        StartReverseConnectListener(
            [in]          BSTR  bstrConnectionString,
            [in]          BSTR  bstrUserName,
            [in]          BSTR  bstrPassword,            
            [out, retval] BSTR* pbstrReverseConnectString
            );
            
    }; // IRDPSRAPIViewer

    //
    // CoClasses
    //
    [
        uuid(32be5ed2-5c86-480f-a914-0ff8885a1b3f)
    ]
    coclass RDPViewer
    {
        [default]         interface     IRDPSRAPIViewer;
        [default, source] dispinterface _IRDPSessionEvents;
    };

    [
        uuid(9B78F0E6-3E05-4A5B-B2E8-E743A8956B65)
    ]
    coclass RDPSession
    {
        [default]         interface     IRDPSRAPISharingSession;
        [default, source] dispinterface _IRDPSessionEvents;
    };

    ///////////////////////////////////////////////////////////////////////////
    // REV 2.0 co classes
    ///////////////////////////////////////////////////////////////////////////

    [
        uuid(dd7594ff-ea2a-4c06-8fdf-132de48b6510),
        noncreatable
    ]
    coclass RDPSRAPISessionProperties
    {
        [default] interface IRDPSRAPISessionProperties;
    };

    [
        uuid(53d9c9db-75ab-4271-948a-4c4eb36a8f2b),
        noncreatable
    ]
    coclass RDPSRAPIInvitationManager
    {
        [default] interface IRDPSRAPIInvitationManager;
    };

    [
        uuid(49174dc6-0731-4b5e-8ee1-83a63d3868fa),
        noncreatable
    ]
    coclass RDPSRAPIInvitation
    {
        [default] interface IRDPSRAPIInvitation;
    };

    [
        uuid(d7b13a01-f7d4-42a6-8595-12fc8c24e851),
        noncreatable
    ]
    coclass RDPSRAPIAttendeeManager
    {
        [default] interface IRDPSRAPIAttendeeManager;
    };

    [
        uuid(74f93bb5-755f-488e-8a29-2390108aef55),
        noncreatable
    ]
    coclass RDPSRAPIAttendee
    {
        [default] interface IRDPSRAPIAttendee;
    };

    [
        uuid(b47d7250-5bdb-405d-b487-caad9c56f4f8),
        noncreatable
    ]
    coclass RDPSRAPIAttendeeDisconnectInfo
    {
        [default] interface IRDPSRAPIAttendeeDisconnectInfo;
    };

    [
        uuid(e35ace89-c7e8-427e-a4f9-b9da072826bd),
        noncreatable
    ]
    coclass RDPSRAPIApplicationFilter
    {
        [default] interface IRDPSRAPIApplicationFilter;
    };

    [
        uuid(9e31c815-7433-4876-97fb-ed59fe2baa22),
        noncreatable
    ]
    coclass RDPSRAPIApplicationList
    {
        [default] interface IRDPSRAPIApplicationList;
    };

    [
        uuid(c116a484-4b25-4b9f-8a54-b934b06e57fa),
        noncreatable
    ]
    coclass RDPSRAPIApplication
    {
        [default] interface IRDPSRAPIApplication;
    };

    [
        uuid(9c21e2b8-5dd4-42cc-81ba-1c099852e6fa),
        noncreatable
    ]
    coclass RDPSRAPIWindowList
    {
        [default] interface IRDPSRAPIWindowList;
    };

    [
        uuid(03cf46db-ce45-4d36-86ed-ed28b74398bf),
        noncreatable
    ]
    coclass RDPSRAPIWindow
    {
        [default] interface IRDPSRAPIWindow;
    };

    [
        uuid(be49db3f-ebb6-4278-8ce0-d5455833eaee),
        noncreatable
    ]
    coclass RDPSRAPITcpConnectionInfo
    {
        [default] interface IRDPSRAPITcpConnectionInfo;
    };
    

}; // RDPCOMAPILib


