protected static string getPartitionId(string driveLetter)
        {
            string            command = getDCCon() + @" -enum";
            ExecuteParameters eparams = new ExecuteParameters(command, "DC enum");
            string            output  = ProcessControl.CommandOutputSync(eparams);

            string[] lines = output.Split('\n');
            foreach (string line in lines)
            {
                if (line.Contains("reboot you system"))
                {
                    return(null);
                }

                if (line.Contains("is not compatible with the version of Windows"))
                {
                    return(null);
                }

                string[] parts = line.Split('|');
                if (parts.Length != 4)
                {
                    continue;
                }
                string drivePart = parts[1];
                if (drivePart.Contains(" " + driveLetter + ": "))
                {
                    string partitionIdPart = parts[0];
                    return(partitionIdPart.Trim());
                }
            }
            return(null);
        }
        protected static void installDC()
        {
            string            command = getDCInst() + @" -setup";
            ExecuteParameters eparams = new ExecuteParameters(command, "DC install");

            ProcessControl.CommandOutputSync(eparams);
        }
        protected static void deconfigureDC()
        {
            string            command = getDCCon() + @" -deconfig-mydlp";
            ExecuteParameters eparams = new ExecuteParameters(command, "DC deconfig mydlp");

            ProcessControl.CommandOutputSync(eparams);
        }
        protected static void cleanupMemory()
        {
            string            command = getDCCon() + @" -clean";
            ExecuteParameters eparams = new ExecuteParameters(command, "DC clean");

            ProcessControl.CommandOutputSync(eparams);
        }
        protected static void unmountAllEncryptedPartitions()
        {
            string            command = getDCCon() + @" -unmountall -f";
            ExecuteParameters eparams = new ExecuteParameters(command, "DC unmountall");

            ProcessControl.CommandOutputSync(eparams);
        }
        protected static void unmountPartition(string partitionId)
        {
            string            command = getDCCon() + @" -unmount " + partitionId + " -f";
            ExecuteParameters eparams = new ExecuteParameters(command, "DC unmount");

            ProcessControl.CommandOutputSync(eparams);
        }
        protected static void mountAllEncryptedPartitions()
        {
            string keyfile = Engine.GetShortPath(SeapClient.GetKeyfile());

            if (File.Exists(keyfile))
            {
                string            command = getDCCon() + @" -mountall -p mydlp -kf " + keyfile;
                ExecuteParameters eparams = new ExecuteParameters(command, "DC mountall");
                ProcessControl.CommandOutputSync(eparams);
                File.Delete(keyfile);
            }
        }
        protected static void formatPartition(string partitionId, string fsType)
        {
            string keyfile = Engine.GetShortPath(SeapClient.GetKeyfile());

            if (File.Exists(keyfile))
            {
                string            command = getDCCon() + @" -format " + partitionId + " -q -" + fsType + " -a -p mydlp -kf " + keyfile;
                ExecuteParameters eparams = new ExecuteParameters(command, "DC format");
                ProcessControl.CommandOutputSync(eparams);
                File.Delete(keyfile);
            }
        }
        protected static bool isEncrypted(string partitionId)
        {
            string            command = getDCCon() + @" -info " + partitionId;
            ExecuteParameters eparams = new ExecuteParameters(command, "DC isEncrypted");
            string            output  = ProcessControl.CommandOutputSync(eparams);

            string[] lines = output.Split('\n');
            foreach (string line in lines)
            {
                if (line.StartsWith("Cipher:"))
                {
                    return(true);
                }
            }
            return(false);
        }
Esempio n. 10
0
        protected static bool doesNeedFormatting(string partitionId)
        {
            string            command = getDCCon() + @" -info " + partitionId;
            ExecuteParameters eparams = new ExecuteParameters(command, "DC doesNeedFormatting");
            string            output  = ProcessControl.CommandOutputSync(eparams);

            string[] lines = output.Split('\n');
            foreach (string line in lines)
            {
                if (line.StartsWith("Status:") &&
                    (line.Contains("boot") || line.Contains("system"))
                    )
                {
                    return(false);
                }

                if (line.StartsWith("Device:") && line.Contains(@"\\Device\CdRom"))
                {
                    return(false);
                }


                if (line.StartsWith("Cipher:"))
                {
                    return(false);
                }

                if (line.Contains("reboot you system"))
                {
                    return(false);
                }

                if (line.Contains("is not compatible with the version of Windows"))
                {
                    return(false);
                }
            }
            return(true);
        }