Beispiel #1
0
        public static IEnumerable <SmbShare> EnumerateInstances(
            string computerName           = ".",
            NetworkCredential credentials = default)
        {
            var classInfo = typeof(SmbShare).GetCustomAttribute <ManagementObjectAttribute>();

            foreach (var o in WMI.Query(classInfo.GetQuery(), classInfo.GetScope(computerName, credentials)))
            {
                yield return(WMI.Bind <SmbShare>((ManagementObject)o));
            }
        }
Beispiel #2
0
        private void Debug()
        {
            Application.Current.Dispatcher.Invoke(new Action(() =>
            {
                SetControlsState(false);
            }));

            result = $"{System.Windows.Forms.Application.ProductName} {System.Windows.Forms.Application.ProductVersion} Debug Report" +
                     Environment.NewLine +
                     Environment.NewLine;

            Type type = SI.GetType();

            PropertyInfo[] properties = type.GetProperties();

            AddHeading("System Info");
            try
            {
                AddLine("OS: " + new ComputerInfo().OSFullName);

                foreach (PropertyInfo property in properties)
                {
                    if (property.Name == "CpuId" || property.Name == "PatchLevel")
                    {
                        AddLine(property.Name + ": " + $"{property.GetValue(SI, null):X8}");
                    }
                    else if (property.Name == "SmuVersion")
                    {
                        AddLine(property.Name + ": " + SI.GetSmuVersionString());
                    }
                    else
                    {
                        AddLine(property.Name + ": " + property.GetValue(SI, null));
                    }
                }
            }
            catch
            {
                AddLine("<FAILED>");
            }
            AddLine();

            // DRAM modules info
            AddHeading("Memory Modules");

            foreach (MemoryModule module in modules)
            {
                AddLine($"{module.BankLabel} | {module.DeviceLocator}");
                AddLine($"-- {module.Manufacturer}");
                AddLine($"-- {module.PartNumber} {module.Capacity / 1024 / (1024 * 1024)}GB {module.ClockSpeed}MHz");
                AddLine();
            }

            PrintChannels();

            // Memory timings info
            AddHeading("Memory Config");
            type       = MEMCFG.GetType();
            properties = type.GetProperties();

            try
            {
                AddLine($"DRAM Base Address: {baseAddress:X8}");
                foreach (PropertyInfo property in properties)
                {
                    AddLine(property.Name + ": " + property.GetValue(MEMCFG, null));
                }
            }
            catch
            {
                AddLine("<FAILED>");
            }
            AddLine();

            // Configured DRAM memory controller settings from BIOS
            AddHeading("BIOS: Memory Controller Config");
            try
            {
                for (int i = 0; i < BMC.Table.Length; ++i)
                {
                    AddLine($"Index {i:D3}: {BMC.Table[i]:X2} ({BMC.Table[i]})");
                }
            }
            catch
            {
                AddLine("<FAILED>");
            }
            AddLine();

            // SMU power table
            AddHeading("SMU: Power Table");
            try
            {
                for (int i = 0; i < PT.Table.Length; ++i)
                {
                    byte[] temp = BitConverter.GetBytes(PT.Table[i]);
                    AddLine($"Offset {i * 0x4:X3}: {BitConverter.ToSingle(temp, 0):F8}");
                }
            }
            catch
            {
                AddLine("<FAILED>");
            }
            AddLine();

            // SMU power table
            AddHeading("SMU: Power Table Detected Values");
            try
            {
                /*type = PT.GetType();
                 * properties = type.GetProperties();
                 *
                 * foreach (PropertyInfo property in properties)
                 *  AddLine(property.Name + ": " + property.GetValue(PT, null));*/

                AddLine($"MCLK: {PT.MCLK}");
                AddLine($"FCLK: {PT.FCLK}");
                AddLine($"UCLK: {PT.UCLK}");
                AddLine($"VSOC_SMU: {PT.VDDCR_SOC}");
                AddLine($"CLDO_VDDP: {PT.CLDO_VDDP}");
                AddLine($"CLDO_VDDG: {PT.CLDO_VDDG_IOD}");
                AddLine($"CLDO_VDDG: {PT.CLDO_VDDG_CCD}");
            }
            catch
            {
                AddLine("<FAILED>");
            }
            AddLine();

            // All WMI classes in root namespace

            /*AddHeading("WMI: Root Classes");
             * List<string> namespaces = WMI.GetClassNamesWithinWmiNamespace(wmiScope);
             *
             * foreach (var ns in namespaces)
             * {
             *  AddLine(ns);
             * }
             * AddLine();*/

            // Check if AMD_ACPI class exists
            AddHeading("WMI: AMD_ACPI");
            if (WMI.Query(wmiScope, wmiAMDACPI) != null)
            {
                AddLine("OK");
            }
            else
            {
                AddLine("<FAILED>");
            }
            AddLine();

            AddHeading("WMI: Instance Name");
            try
            {
                var wmiInstanceName = GetWmiInstanceName();
                if (wmiInstanceName.Length == 0)
                {
                    wmiInstanceName = "<FAILED>";
                }
                AddLine(wmiInstanceName);
            }
            catch
            {
                AddLine("<FAILED>");
            }
            AddLine();

            PrintWmiFunctions();
            AddLine();

            AddHeading("SVI2: PCI Range");
            try
            {
                uint startAddress = 0x0005A000;
                uint endAddress   = 0x0005A0FF;

                if (OPS.Smu.SMU_TYPE == SMU.SmuType.TYPE_APU1)
                {
                    startAddress = 0x0006F000;
                    endAddress   = 0x0006F0FF;
                }

                while (startAddress <= endAddress)
                {
                    var data = OPS.ReadDword(startAddress);
                    if (data != 0xFFFFFFFF)
                    {
                        AddLine($"0x{startAddress:X8}: 0x{data:X8}");
                    }
                    startAddress += 4;
                }
            }
            catch
            {
                AddLine("<FAILED>");
            }

            Application.Current.Dispatcher.Invoke(new Action(() =>
            {
                textBoxDebugOutput.Text = result;
                SetControlsState();
            }));
        }