zoukankan      html  css  js  c++  java
  • 获取BIOS信息

    procedure TForm1.BiosInfo;  
    const  
    Subkey: string = ''Hardware\description\system'';  
    var  
    hkSB: HKEY;  
    rType: LongInt;  
    ValueSize, OrigSize: Longint;  
    ValueBuf: array[0..1000] of char;  
    procedure ParseValueBuf(const VersionType: string);  
    var  
    I, Line: Cardinal;  
    S: string;  
    begin  
    i := 0;  
    Line := 0;  
    while ValueBuf[i] <> #0 do  
    begin  
    S := StrPas(@ValueBuf[i]); // move the Pchar into a string  
    Inc(Line);  
    Memo1.Lines.Append(Format(''%s Line %d = %s'',  
    [VersionType, Line, S])); // add it to a Memo  
    inc(i, Length(S) + 1);  
    // to point to next sz, or to #0 if at  
    end  
    end;  
    end;  

    begin  
    if RegOpenKeyEx(HKEY_LOCAL_MACHINE, PChar(Subkey), 0,  
    KEY_READ, hkSB) = ERROR_SUCCESS then  
    try  
    OrigSize := sizeof(ValueBuf);  
    ValueSize := OrigSize;  
    rType := REG_MULTI_SZ;  
    if RegQueryValueEx(hkSB, ''SystemBiosVersion'', nil, @rType,  
    @ValueBuf, @ValueSize) = ERROR_SUCCESS then  
    ParseValueBuf(''System BIOS Version'');  

    ValueSize := OrigSize;  
    rType := REG_SZ;  
    if RegQueryValueEx(hkSB, ''SystemBIOSDate'', nil, @rType,  
    @ValueBuf, @ValueSize) = ERROR_SUCCESS then  
    Memo1.Lines.Append(''System BIOS Date '' + ValueBuf);  

    ValueSize := OrigSize;  
    rType := REG_MULTI_SZ;  
    if RegQueryValueEx(hkSB, ''VideoBiosVersion'', nil, @rType,  
    @ValueBuf, @ValueSize) = ERROR_SUCCESS then  
    ParseValueBuf(''Video BIOS Version'');  

    ValueSize := OrigSize;  
    rType := REG_SZ;  
    if RegQueryValueEx(hkSB, ''VideoBIOSDate'', nil, @rType,  
    @ValueBuf, @ValueSize) = ERROR_SUCCESS then  
    Memo1.Lines.Append(''Video BIOS Date '' + ValueBuf);  
    finally  
    RegCloseKey(hkSB);  
    end;  
    end;

  • 相关阅读:
    二分查找练习
    Linux中Buffer和Cache的区别
    c++设计模式之单例模式
    c++设计模式之工厂模式
    C++中内存泄漏的几种情况
    snprintf
    命名空间和模块化编程1
    避免内存泄漏
    静态对象强制类型转换
    副本构造器
  • 原文地址:https://www.cnblogs.com/martian6125/p/9631357.html
Copyright © 2011-2022 走看看