Interface to native library (library containing fast versions of several cryptographic functions).
        internal static void ProtectProcessWithDacl()
        {
            try
            {
                if (NativeLib.IsUnix())
                {
                    return;
                }

                if (IntPtr.Size == 4)
                {
                    ProtectProcessWithDacl32();
                }
                else
                {
                    ProtectProcessWithDacl64();
                }
            }
            catch (Exception) { Debug.Assert(false); }
        }
Esempio n. 2
0
        private static bool XSelSetText(string str, bool bMayBlock)
        {
            if (!XSelInit())
            {
                return(false);
            }

            string strOpt = (bMayBlock ? XSelND : string.Empty);

            // xsel with an empty input can hang, thus use --clear
            if (str.Length == 0)
            {
                return(NativeLib.RunConsoleApp(XSel, XSelC + strOpt,
                                               null, XSelWF) != null);
            }

            // Use --nodetach to prevent clipboard corruption;
            // https://sourceforge.net/p/keepass/bugs/1603/
            return(NativeLib.RunConsoleApp(XSel, XSelW + strOpt,
                                           str, XSelWF) != null);
        }