Получение данных о модулях оперативной памяти (SPD)

Discussion in 'С/С++, C#, Rust, Swift, Go, Java, Perl, Ruby' started by -Linux-, 19 Jul 2011.

  1. -Linux-

    -Linux- New Member

    Joined:
    18 Jul 2011
    Messages:
    3
    Likes Received:
    0
    Reputations:
    0
    Помогите кто чем может.
    Необходимо вытащить из оперативки её название и тип, по возможности частоту.
    По SPD нашёл немного информации, но без готовых реализаций. Распарсить выходной файл от CPU-Z не вариант, точнее вариант, но на самый крайний случай.
    Если у кого-то есть какие-то наработки был бы рад увидеть. Единственно с Asm'ом проблемы, так что желательно C/C++.
     
  2. NetSter

    NetSter Moderator

    Joined:
    30 Jul 2007
    Messages:
    810
    Likes Received:
    414
    Reputations:
    62
    вот глянь мож поможет)
    писал когда то )) криво но покатит что бы разобраться))

    PHP:
    private void TypeDetail()
            {
               if (
    InvokeRequired)
                {
                
    BeginInvoke(new MethodInvoker(() => 
                {
                
    Int32 TypeDetail;
                
    ManagementScope typedetMs = new ManagementScope();
                
    ObjectQuery typedetQuery = new ObjectQuery("SELECT TypeDetail FROM Win32_PhysicalMemory");
                
    ManagementObjectSearcher typedetSearcher = new ManagementObjectSearcher(typedetMstypedetQuery);
                
    ManagementObjectCollection typedetReturnCollection typedetSearcher.Get();
                foreach (
    ManagementObject typedetReturn in typedetReturnCollection)
                {
                    
    TypeDetail Convert.ToInt32(typedetReturn["TypeDetail"]);
                    switch (
    TypeDetail)
                    {
                        case 
    1:
                            
    textBox6.Text = ("Reserved");
                            break;
                        case 
    2:
                            
    textBox6.Text = ("Other");
                            break;
                        case 
    4:
                            
    textBox6.Text = ("Unknown");
                            break;
                        case 
    8:
                            
    textBox6.Text = ("Fast-paged");
                            break;
                        case 
    16:
                            
    textBox6.Text = ("Static column");
                            break;
                        case 
    32:
                            
    textBox6.Text = ("Pseudo-static");
                            break;
                        case 
    64:
                            
    textBox6.Text = ("RAMBUS");
                            break;
                        case 
    128:
                            
    textBox6.Text = ("Synchronous");
                            break;
                        case 
    256:
                            
    textBox6.Text = ("CMOS");
                            break;
                        case 
    512:
                            
    textBox6.Text = ("EDO");
                            break;
                        case 
    1024:
                            
    textBox6.Text = ("Window DRAM");
                            break;
                        case 
    2048:
                            
    textBox6.Text = ("Cache DRAM");
                            break;
                        case 
    4096:
                            
    textBox6.Text = ("Nonvolatile");
                            break;
                        default:
                            
    textBox6.Text = ("ERROR");
                            break;
                    }
                }
                }));
                }
            }
    PHP:
      private void socketDDR()
            {
                if (
    InvokeRequired)
                {
                
    BeginInvoke(new MethodInvoker(() => 
                {
                    
    textBox5.Text "";
                
    ManagementScope socketMs = new ManagementScope();
                
    ObjectQuery socketQuery = new ObjectQuery("SELECT DeviceLocator FROM Win32_PhysicalMemory");
                
    ManagementObjectSearcher socketSearcher = new ManagementObjectSearcher(socketMssocketQuery);
                
    ManagementObjectCollection socketReturnCollection socketSearcher.Get();
                foreach (
    ManagementObject socketReturn in socketReturnCollection)
                  {
                    
    textBox5.Text += string.Format(socketReturn["DeviceLocator"] + "; ");
                  }
                }));
                }
            }

            private 
    void memoryType()
            {
                if (
    InvokeRequired)
                {
                
    BeginInvoke(new MethodInvoker(() => 
                {
                
    Int32 memoryType;
                
    ManagementScope type = new ManagementScope();
                
    ObjectQuery typeQuery = new ObjectQuery("SELECT MemoryType FROM Win32_PhysicalMemory");
                
    ManagementObjectSearcher typeSearcher = new ManagementObjectSearcher(typetypeQuery);
                
    ManagementObjectCollection typeReturnCollection typeSearcher.Get();
                foreach (
    ManagementObject typeReturn in typeReturnCollection)
                {
                    
    memoryType Convert.ToInt32(typeReturn["MemoryType"]);
                    switch (
    memoryType)
                    {
                        case 
    0:
                            
    textBox4.Text = ("Unknown");
                            break;
                        case 
    1:
                            
    textBox4.Text = ("Other");
                            break;
                        case 
    2:
                            
    textBox4.Text = ("DRAM");
                            break;
                        case 
    3:
                            
    textBox4.Text = ("Synchronous DRAM");
                            break;
                        case 
    4:
                            
    textBox4.Text = ("Cache DRAM");
                            break;
                        case 
    5:
                            
    textBox4.Text = ("EDO");
                            break;
                        case 
    6:
                            
    textBox4.Text = ("EDRAM");
                            break;
                        case 
    7:
                            
    textBox4.Text = ("VRAM");
                            break;
                        case 
    8:
                            
    textBox4.Text = ("SRAM");
                            break;
                        case 
    9:
                            
    textBox4.Text = ("RAM");
                            break;
                        case 
    10:
                            
    textBox4.Text = ("ROM");
                            break;
                        case 
    11:
                            
    textBox4.Text = ("Flash");
                            break;
                        case 
    12:
                            
    textBox4.Text = ("EEPROM");
                            break;
                        case 
    13:
                            
    textBox4.Text = ("FEPROM");
                            break;
                        case 
    14:
                            
    textBox4.Text = ("EPROM");
                            break;
                        case 
    15:
                            
    textBox4.Text = ("CDRAM");
                            break;
                        case 
    16:
                            
    textBox4.Text = ("3DRAM");
                            break;
                        case 
    17:
                            
    textBox4.Text = ("SDRAM");
                            break;
                        case 
    18:
                            
    textBox4.Text = ("SGRAM");
                            break;
                        case 
    19:
                            
    textBox4.Text = ("RDRAM");
                            break;
                        case 
    20:
                            
    textBox4.Text = ("DDR");
                            break;
                        case 
    21:
                            
    textBox4.Text = ("DDR-2");
                            break;
                        default:
                            
    textBox4.Text = ("Unknown Type");
                            break;
                    }
                }
               }));
             }
            }

            private 
    void ddrFormFactor()
            {
                if (
    InvokeRequired)
                {
                    
    BeginInvoke(new MethodInvoker(() =>
                    {
                        
    Int32 formFactor;
                        
    ManagementScope ddr = new ManagementScope();
                        
    ObjectQuery ddrQuery = new ObjectQuery("SELECT FormFactor FROM Win32_PhysicalMemory");
                        
    ManagementObjectSearcher ddrSearcher = new ManagementObjectSearcher(ddrddrQuery);
                        
    ManagementObjectCollection ddrReturnCollection ddrSearcher.Get();
                        foreach (
    ManagementObject ddrReturn in ddrReturnCollection)
                        {
                            
    formFactor Convert.ToInt32(ddrReturn["FormFactor"]);
                            switch (
    formFactor)
                            {
                                case 
    0:
                                    
    textBox3.Text = ("Unknown");
                                    break;
                                case 
    1:
                                    
    textBox3.Text = ("Other");
                                    break;
                                case 
    2:
                                    
    textBox3.Text = ("SIP");
                                    break;
                                case 
    3:
                                    
    textBox3.Text = ("DIP");
                                    break;
                                case 
    4:
                                    
    textBox3.Text = ("ZIP");
                                    break;
                                case 
    5:
                                    
    textBox3.Text = ("SOJ");
                                    break;
                                case 
    6:
                                    
    textBox3.Text = ("Proprietary");
                                    break;
                                case 
    7:
                                    
    textBox3.Text = ("SIMM");
                                    break;
                                case 
    8:
                                    
    textBox3.Text = ("DIMM");
                                    break;
                                case 
    9:
                                    
    textBox3.Text = ("TSOP");
                                    break;
                                case 
    10:
                                    
    textBox3.Text = ("PGA");
                                    break;
                                case 
    11:
                                    
    textBox3.Text = ("RIMM");
                                    break;
                                case 
    12:
                                    
    textBox3.Text = ("SODIMM");
                                    break;
                                case 
    13:
                                    
    textBox3.Text = ("SRIMM");
                                    break;
                                case 
    14:
                                    
    textBox3.Text = ("SMD");
                                    break;
                                case 
    15:
                                    
    textBox3.Text = ("SSMP");
                                    break;
                                case 
    16:
                                    
    textBox3.Text = ("QFP");
                                    break;
                                case 
    17:
                                    
    textBox3.Text = ("TQFP");
                                    break;
                                case 
    18:
                                    
    textBox3.Text = ("SOIC");
                                    break;
                                case 
    19:
                                    
    textBox3.Text = ("LCC");
                                    break;
                                case 
    20:
                                    
    textBox3.Text = ("PLCC");
                                    break;
                                case 
    21:
                                    
    textBox3.Text = ("BGA");
                                    break;
                                case 
    22:
                                    
    textBox3.Text = ("FPBGA");
                                    break;
                                case 
    23:
                                    
    textBox3.Text = ("LGA");
                                    break;
                                default:
                                    
    textBox3.Text = ("Unknown Type");
                                    break;
                            }
                        }
                    }));
                }
            }
    PHP:
     private void realMemory()
            {
                if (
    InvokeRequired)
                {
                    
    BeginInvoke(new MethodInvoker(() => 
                    {
                        
    int i 0;
                        
    //int capacity=0;
                        
    ManagementScope oMs = new ManagementScope();
                        
    ObjectQuery oQuery = new ObjectQuery("SELECT Capacity FROM Win32_PhysicalMemory");
                        
    ManagementObjectSearcher oSearcher = new ManagementObjectSearcher(oMsoQuery);
                        
    ManagementObjectCollection oReturnCollection oSearcher.Get();
                        foreach (
    ManagementObject oReturn in oReturnCollection)
                        {
                            
    i++;
                            
    capacity += (Convert.ToInt32(oReturn["Capacity"]) / 1048576);
                        }
                        
    textBox2.Text string.Format(capacity " MB");
                     }));
                }
            }

            private 
    void aviableMemory()
            {
                if (
    InvokeRequired)
                {
                    
    BeginInvoke(new MethodInvoker(() => 
                    {
                        
    performanceCounter1.CategoryName "Memory";
                        
    performanceCounter1.CounterName "Available Mbytes";
                        
    performanceCounter1.InstanceName null;
                        
    aviMB performanceCounter1.RawValue;
                        
    textBox1.Text string.Format("{0} MB \n"aviMB);
                    }));
                }
            }
     
    _________________________
    #2 NetSter, 19 Jul 2011
    Last edited: 19 Jul 2011
  3. xophet

    xophet Member

    Joined:
    16 Apr 2011
    Messages:
    617
    Likes Received:
    49
    Reputations:
    5
    Слишком много строк, разбей на 2 тега
     
    1 person likes this.
  4. sn0w

    sn0w Статус пользователя:

    Joined:
    26 Jul 2005
    Messages:
    1,023
    Likes Received:
    1,309
    Reputations:
    327
    http://www.cpuid-pro.com/licenses-pricing.php

    думаю неплохое подспорье. единственно - дается 20 дневка триальная. но при правильном векторе мысли, думаю понимаешь что происходит ;)
     
  5. -Linux-

    -Linux- New Member

    Joined:
    18 Jul 2011
    Messages:
    3
    Likes Received:
    0
    Reputations:
    0
    С Win32_ разобрался, но нужной информации там нет.

    http://www.cpuid-pro.com/
    был бы идеальным вариантом если бы не стоимость ) а из триалки ничего не вытащить полезного.
    Вроде бы в Memtest86 было что-то такое, надо покопаться, там вроде исходники открытые.
    Спасибо за подсказки.
     
  6. tim-oleksii

    tim-oleksii Member

    Joined:
    14 Mar 2011
    Messages:
    199
    Likes Received:
    10
    Reputations:
    0
    hwinfo скачай исходники.
     
  7. -Linux-

    -Linux- New Member

    Joined:
    18 Jul 2011
    Messages:
    3
    Likes Received:
    0
    Reputations:
    0
    Там данные берутся из другого места :) под Win переделать не получится :-(
     
    #7 -Linux-, 20 Jul 2011
    Last edited: 20 Jul 2011