Ejemplo n.º 1
0
        internal PMLToXMLConverter(string procMonExeLocation, string pmlFile, bool shouldRetryOnceOnFailure = false)
        {
            if (!AuthentiCodeTools.IsTrusted(procMonExeLocation))
            {
                throw new ArgumentException(string.Format("ProcessMonitor (ProcMon) executable at location {0} is not a trusted binary.", procMonExeLocation));
            }
            if (!SignerInfo.IsSignedBy(procMonExeLocation, "CN=Microsoft Code Signing PCA, O=Microsoft Corporation, L=Redmond, S=Washington, C=US", true))
            {
                throw new ArgumentException(string.Format("ProcessMonitor (ProcMon) executable at location {0} does not meet expected digital signing requirements.", procMonExeLocation));
            }
            this.shouldRetryOnceOnFailure = shouldRetryOnceOnFailure;
            PMLFile = pmlFile;
            XMLFile = FSUtils.CreateOuputFileNameFromInput(pmlFile, ".xml");

            StringBuilder sbArgs = new StringBuilder("/quiet /minimized /saveas2 ");

            sbArgs.Append(XMLFile);
            sbArgs.Append(" /openlog ");
            sbArgs.Append(PMLFile);
            // [BIB]:  http://forum.sysinternals.com/forum_posts.asp?TID=13843&PID=74632&title=producing-csv-from-process-monitor-via-script#74632
            procMon = new ProcessEx(procMonExeLocation, sbArgs.ToString());
        }