예제 #1
0
 public static void SubscribeToTerminate(rdpContext *context, TerminateEventHandlerDelegate handler)
 {
     if (NativeMethods.PubSub_Subscribe(context->pubSub, "Terminate", Marshal.GetFunctionPointerForDelegate(handler)) != 0)
     {
         throw new FreeRdpException("Failed to subscribe to Terminate event");
     }
 }
예제 #2
0
        public RDP()
        {
            string assemblyPath = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);

            if (_winsock == -1)
            {
                _winsock = Tcp.WSAStartup();
            }


            _freerdp = NativeMethods.freerdp_new();
            if (_freerdp == null)
            {
                throw new FreeRdpException("FreeRDP create failed");
            }

            _iUpdate          = null;
            _iPrimaryUpdate   = null;
            _iSecondaryUpdate = null;
            _iAltSecUpdate    = null;

            _terminateEventHandlerDelegate = new TerminateEventHandlerDelegate(TerminateEvent);
            _errorInfoEventHandlerDelegate = new ErrorInfoEventHandlerDelegate(ErrorInfoEvent);

            _hContextNew  = new pContextNew(ContextNew);
            _hContextFree = new pContextFree(ContextFree);

            _freerdp->ContextNew  = Marshal.GetFunctionPointerForDelegate(_hContextNew);
            _freerdp->ContextFree = Marshal.GetFunctionPointerForDelegate(_hContextFree);

            _hAuthenticate      = new pAuthenticate(Authenticate);
            _hVerifyCertificate = new pVerifyCertificate(VerifyCertificate);

            _freerdp->Authenticate      = Marshal.GetFunctionPointerForDelegate(_hAuthenticate);
            _freerdp->VerifyCertificate = Marshal.GetFunctionPointerForDelegate(_hVerifyCertificate);

            //NativeMethods.freerdp_context_new(_freerdp);

            //_settings = _freerdp->settings;
        }
예제 #3
0
 public static void UnSubscribeToTerminate(rdpContext *context, TerminateEventHandlerDelegate handler)
 {
     NativeMethods.PubSub_Unsubscribe(context->pubSub, "Terminate", Marshal.GetFunctionPointerForDelegate(handler));
 }