当前位置: 首页>>代码示例>>C#>>正文


C# ProcessHandle.IsWow64方法代码示例

本文整理汇总了C#中ProcessHandle.IsWow64方法的典型用法代码示例。如果您正苦于以下问题:C# ProcessHandle.IsWow64方法的具体用法?C# ProcessHandle.IsWow64怎么用?C# ProcessHandle.IsWow64使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ProcessHandle的用法示例。


在下文中一共展示了ProcessHandle.IsWow64方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: UpdateProcessProperties

        private void UpdateProcessProperties()
        {
            try
            {
                string fileName;

                if (_pid == 4)
                    fileName = Windows.KernelFileName;
                else
                    fileName = _processItem.FileName;

                if (fileName == null)
                {
                    pictureIcon.Image = _processImage = ProcessHacker.Properties.Resources.Process.ToBitmap();
                    return;
                }

                FileVersionInfo info = _processItem.VersionInfo;

                textFileDescription.Text = info.FileDescription;
                textFileCompany.Text = info.CompanyName;
                textFileVersion.Text = info.FileVersion;
                fileImage.Text = info.FileName;

                try
                {
                    pictureIcon.Image = _processImage = _processItem.LargeIcon.ToBitmap();
                }
                catch
                {
                    pictureIcon.Image = _processImage = ProcessHacker.Properties.Resources.Process.ToBitmap();
                }

                var verifyResult = _processItem.VerifyResult;

                if (verifyResult == VerifyResult.Unknown)
                    textFileCompany.Text += "";
                else if (verifyResult == VerifyResult.Trusted)
                    textFileCompany.Text += " (verified)";
                else if (verifyResult == VerifyResult.TrustedInstaller)
                    textFileCompany.Text += " (verified, Windows component)";
                else if (verifyResult == VerifyResult.NoSignature)
                    textFileCompany.Text += " (not verified, no signature)";
                else if (verifyResult == VerifyResult.Distrust)
                    textFileCompany.Text += " (not verified, distrusted)";
                else if (verifyResult == VerifyResult.Expired)
                    textFileCompany.Text += " (not verified, expired)";
                else if (verifyResult == VerifyResult.Revoked)
                    textFileCompany.Text += " (not verified, revoked)";
                else if (verifyResult == VerifyResult.SecuritySettings)
                    textFileCompany.Text += " (not verified, security settings)";
                else
                    textFileCompany.Text += " (not verified)";
            }
            catch
            {
                fileImage.Text = _processItem.FileName;
                textFileDescription.Text = "";
                textFileCompany.Text = "";
            }

            if (IntPtr.Size == 4)
            {

                labelProcessType.Visible = false;
                labelProcessTypeValue.Visible = false;
            }
            else
            {

                labelProcessType.Visible = true;
                labelProcessTypeValue.Visible = true;

                try
                {
                    using (ProcessHandle phandle = new ProcessHandle(_pid, Program.MinProcessQueryRights))
                    {
                        labelProcessTypeValue.Text = phandle.IsWow64() ? "32-bit" : "64-bit";
                    }
                }
                catch (Exception ex)
                {
                    labelProcessTypeValue.Text = "(" + ex.Message + ")";
                }
            }

            if (_pid <= 0)
                return;

            if (_processItem.CmdLine != null)
                textCmdLine.Text = _processItem.CmdLine.Replace("\0", "");

            try
            {
                DateTime startTime = DateTime.FromFileTime(_processItem.Process.CreateTime);

                textStartTime.Text = Utils.FormatRelativeDateTime(startTime) +
                    " (" + startTime.ToString() + ")";
            }
            catch (Exception ex)
//.........这里部分代码省略.........
开发者ID:RoDaniel,项目名称:featurehouse,代码行数:101,代码来源:ProcessWindow.cs

示例2: UpdateProcessProperties

        private void UpdateProcessProperties()
        {
            try
            {
                string fileName;

                if (_pid == 4)
                    fileName = Windows.KernelFileName;
                else
                    fileName = _processItem.FileName;

                if (fileName == null)
                {
                    pictureIcon.Image = _processImage = ProcessHacker.Properties.Resources.Process.ToBitmap();
                    return;
                }

                var info = _processItem.VersionInfo;

                textFileDescription.Text = info.FileDescription;
                textFileCompany.Text = info.CompanyName;
                textFileVersion.Text = info.FileVersion;
                fileImage.Text = info.FileName;

                try
                {
                    pictureIcon.Image = _processImage = _processItem.LargeIcon.ToBitmap();
                }
                catch 
                {
                    pictureIcon.Image = _processImage = ProcessHacker.Properties.Resources.Process.ToBitmap();
                }

                var verifyResult = _processItem.VerifyResult;

                if (verifyResult == VerifyResult.Trusted && !string.IsNullOrEmpty(_processItem.VerifySignerName))
                    textFileCompany.Text = _processItem.VerifySignerName;

                if (verifyResult == VerifyResult.Unknown)
                    textFileCompany.Text += "";
                else if (verifyResult == VerifyResult.Trusted)
                    textFileCompany.Text += " (verified)";
                else if (verifyResult == VerifyResult.NoSignature)
                    textFileCompany.Text += " (not verified, no signature)";
                else if (verifyResult == VerifyResult.Distrust)
                    textFileCompany.Text += " (not verified, distrusted)";
                else if (verifyResult == VerifyResult.Expired)
                    textFileCompany.Text += " (not verified, expired)";
                else if (verifyResult == VerifyResult.Revoked)
                    textFileCompany.Text += " (not verified, revoked)";
                else if (verifyResult == VerifyResult.SecuritySettings)
                    textFileCompany.Text += " (not verified, security settings)";
                else
                    textFileCompany.Text += " (not verified)";
            }
            catch
            {
                fileImage.Text = _processItem.FileName;
                textFileDescription.Text = "";
                textFileCompany.Text = "";
            }

            // Update WOW64 info.
            if (OSVersion.Architecture == OSArch.I386)
            {
                // 32-bit. Hide the labels.
                labelProcessType.Visible = false;
                labelProcessTypeValue.Visible = false;
            }
            else
            {
                // 64-bit. Show the label.
                labelProcessType.Visible = true;
                labelProcessTypeValue.Visible = true;

                try
                {
                    using (ProcessHandle phandle = new ProcessHandle(_pid, Program.MinProcessQueryRights))
                    {
                        labelProcessTypeValue.Text = phandle.IsWow64() ? "32-bit" : "64-bit";
                    }
                }
                catch (Exception ex)
                {
                    labelProcessTypeValue.Text = "(" + ex.Message + ")";
                }
            }

            if (_pid <= 0)
                return;

            if (_processItem.CmdLine != null)
                textCmdLine.Text = _processItem.CmdLine.Replace("\0", "");

            try
            {
                DateTime startTime = DateTime.FromFileTime(_processItem.Process.CreateTime);

                textStartTime.Text = Utils.FormatRelativeDateTime(startTime) +
                    " (" + startTime.ToString() + ")";
//.........这里部分代码省略.........
开发者ID:andyvand,项目名称:ProcessHacker,代码行数:101,代码来源:ProcessWindow.cs


注:本文中的ProcessHandle.IsWow64方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。