Exemplo n.º 1
0
        public static bool ReceiveTransmission(Windows.MainWindow window, IntPtr remoteWindow, System.Diagnostics.Process remoteProcess, Windows.COPYDATASTRUCT cds)
        {
            Session session = Sessions.FirstOrDefault(q => q.RemoteWindow == remoteWindow && q.Process.Id == remoteProcess.Id);

            if (session == null)
            {
                session = new Session(remoteWindow, remoteProcess);
                Sessions.Add(session);
            }

            switch ((long)cds.dwData)
            {
            case 10:
                if (!App.Settings.HasPasswordMasterKey)
                {
                    return(false);
                }
                session.ReceivePublicKeyTransmission(cds);
                session.TransmitPublicKey(window, false);
                session.TransmitEncryptedMasterKey(window);
                return(true);

            case 11:
                session.ReceiveEncryptedMasterKeyTransmission(cds);
                return(true);

            case 12:
                session.ReceivePublicKeyTransmission(cds);
                return(true);
            }

            return(false);
        }
Exemplo n.º 2
0
            public void TransmitEncryptedMasterKey(Windows.MainWindow localWindow)
            {
                Windows.COPYDATASTRUCT cds    = GetEncryptedMasterKeyTransmission();
                HwndSource             source = PresentationSource.FromVisual(localWindow) as HwndSource;

                Windows.MainWindow.SendMessage(this.RemoteWindow, Windows.MainWindow.WM_COPYDATA, source.Handle, ref cds);
                Marshal.FreeHGlobal(cds.lpData);
            }
Exemplo n.º 3
0
        /// <summary>
        /// Request Master Key from Master Instance
        /// </summary>
        /// <param name="window"></param>
        /// <param name="remoteWindow"></param>
        /// <param name="remoteProcess"></param>
        public static void RequestMasterKey(Windows.MainWindow window, IntPtr remoteWindow, System.Diagnostics.Process remoteProcess)
        {
            Session session = Sessions.FirstOrDefault(q => q.RemoteWindow == remoteWindow && q.Process.Id == remoteProcess.Id);

            if (session == null)
            {
                session = new Session(remoteWindow, remoteProcess);
                Sessions.Add(session);
            }

            session.TransmitPublicKey(window, true);
        }
Exemplo n.º 4
0
 public void setView(Windows.MainWindow mainWindow)
 {
     this.view = mainWindow;
 }