Code Monkey home page Code Monkey logo

tsmbios's Introduction

The SMBIOS (System Management BIOS) is a standard developed by the DMTF. The information stored in the SMBIOS includes devices manufacturer, model name, serial number, BIOS version, asset tag, processors, ports and device memory installed.

logoThe TSMBIOS libary allows access the System Management BIOS (SMBIOS) using the Object Pascal language (Delphi or Free Pascal).

Features

  • Fully documented (XMLDoc), compatible with the Help Insight feature, available since Delphi 2005.
  • Supports SMBIOS Version 2.1 to 2.8.
  • Compatible with Delphi 5 through Delphi 11 Alexandria.
  • Works with FPC 2.4.0 or later.
  • Supports Windows and Linux.
  • Can read SMBIOS data from remote machines using WMI.

SMBIOS Tables supported

Sample source code

This code demonstrates how to retrieve information related to the memory devices installed on the system.

{$APPTYPE CONSOLE}

{$R *.res}

uses
  Classes,
  SysUtils,
  uSMBIOS in '..\..\Common\uSMBIOS.pas';

procedure GetMemoryDeviceInfo;
Var
  SMBios: TSMBios;
  LMemoryDevice: TMemoryDeviceInformation;
begin
  SMBios := TSMBios.Create;
  try
      WriteLn('Memory Device Information');
      WriteLn('-------------------------');

      if SMBios.HasPhysicalMemoryArrayInfo then
      for LMemoryDevice in SMBios.MemoryDeviceInformation do
      begin
        WriteLn(Format('Total Width    %d bits',[LMemoryDevice.RAWMemoryDeviceInfo.TotalWidth]));
        WriteLn(Format('Data Width     %d bits',[LMemoryDevice.RAWMemoryDeviceInfo.DataWidth]));
        WriteLn(Format('Size           %d Mbytes',[LMemoryDevice.GetSize]));
        WriteLn(Format('Form Factor    %s',[LMemoryDevice.GetFormFactor]));
        WriteLn(Format('Device Locator %s',[LMemoryDevice.GetDeviceLocatorStr]));
        WriteLn(Format('Bank Locator   %s',[LMemoryDevice.GetBankLocatorStr]));
        WriteLn(Format('Memory Type    %s',[LMemoryDevice.GetMemoryTypeStr]));
        WriteLn(Format('Speed          %d MHz',[LMemoryDevice.RAWMemoryDeviceInfo.Speed]));
        WriteLn(Format('Manufacturer   %s',[LMemoryDevice.ManufacturerStr]));
        WriteLn(Format('Serial Number  %s',[LMemoryDevice.SerialNumberStr]));
        WriteLn(Format('Asset Tag      %s',[LMemoryDevice.AssetTagStr]));
        WriteLn(Format('Part Number    %s',[LMemoryDevice.PartNumberStr]));

        WriteLn;

        if LMemoryDevice.RAWMemoryDeviceInfo.PhysicalMemoryArrayHandle>0 then
        begin
          WriteLn('  Physical Memory Array');
          WriteLn('  ---------------------');
          WriteLn('  Location         '+LMemoryDevice.PhysicalMemoryArray.GetLocationStr);
          WriteLn('  Use              '+LMemoryDevice.PhysicalMemoryArray.GetUseStr);
          WriteLn('  Error Correction '+LMemoryDevice.PhysicalMemoryArray.GetErrorCorrectionStr);
          if LMemoryDevice.PhysicalMemoryArray.RAWPhysicalMemoryArrayInformation.MaximumCapacity<>$80000000 then
            WriteLn(Format('  Maximum Capacity %d Kb',[LMemoryDevice.PhysicalMemoryArray.RAWPhysicalMemoryArrayInformation.MaximumCapacity]))
          else
            WriteLn(Format('  Maximum Capacity %d bytes',[LMemoryDevice.PhysicalMemoryArray.RAWPhysicalMemoryArrayInformation.ExtendedMaximumCapacity]));

          WriteLn(Format('  Memory devices   %d',[LMemoryDevice.PhysicalMemoryArray.RAWPhysicalMemoryArrayInformation.NumberofMemoryDevices]));
        end;
        WriteLn;
      end
      else
      Writeln('No Memory Device Info was found');
  finally
   SMBios.Free;
  end;
end;


begin
 try
    GetMemoryDeviceInfo;
 except
    on E:Exception do
        Writeln(E.Classname, ':', E.Message);
 end;
 Writeln('Press Enter to exit');
 Readln;
end.

Help Insight

Help Insight

Other

You can install Delphinus package manager and install TSMBIOS as a package there. (Delphinus-Support)

tsmbios's People

Contributors

pawe1 avatar rruz avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

tsmbios's Issues

auto inviter

What steps will reproduce the problem?
1.
2.
3.

What is the expected output? What do you see instead?


What version of the product are you using? On what operating system?


Please provide any additional information below.


Original issue reported on code.google.com by [email protected] on 2 Feb 2014 at 4:17

Attachments:

SMBIOS UUID Does not Match WMI UUID - Appears Inaccurate

If I issue wmic csproduct get uuid (WMI get SMBIOS UUID) it returns the following string:
81462904-7B5D-E111-ADCD-2C27D725B21D

Delphi uSMBIOS returns: 042946815D7B11E1ADCD2C27D725B21D

The last 16 bytes are always the same but the first 16 and different.

For example:
814629047B5DE111-ADCD2C27D725B21D
042946815D7B11E1-ADCD2C27D725B21D

Can you please assist? Is this a bug?

StrLen Warning

Hello,

Please note this warning:

[dcc32 Warning] uSMBIOS.pas(4597): W1000 Symbol 'StrLen' is deprecated: 'Moved to the AnsiStrings unit'

Best regards.

Lazarus 1.8.4 FPC 3.0.4.

Lazarus 1.8.4 FPC 3.0.4.
ActiveX issue when using WMIDephiCodeCreator.
Also found it in the old closed issues on a different version.

The code (WMI delphi code creator).

procedure GetWin32_ComputerSystemInfo;
const
WbemUser ='';
WbemPassword ='';
WbemComputer ='localhost';
wbemFlagForwardOnly = $00000020;
var
FSWbemLocator : OLEVariant;
FWMIService : OLEVariant;
FWbemObjectSet: OLEVariant;
FWbemObject : Variant;
oEnum : IEnumvariant;
sValue : string;
begin;
FSWbemLocator := CreateOleObject('WbemScripting.SWbemLocator');
FWMIService := FSWbemLocator.ConnectServer(WbemComputer, 'root\CIMV2', WbemUser, WbemPassword);
FWbemObjectSet:= FWMIService.ExecQuery('SELECT * FROM Win32_ComputerSystem','WQL',wbemFlagForwardOnly);
oEnum := IUnknown(FWbemObjectSet.NewEnum) as IEnumVariant;
while oEnum.Next(1, FWbemObject, nil) = 0 do
begin
sValue:= FWbemObject.Properties.Item('Model').Value;
Writeln(Format('Model %s',[sValue]));// String

Writeln('');
FWbemObject:=Unassigned;
end;
end;

Compiler log:

Free Pascal Compiler version 3.0.4 [2018/05/19] for x86_64
Copyright (c) 1993-2017 by Florian Klaempfl and others
Target OS: Win64 for x64
Compiling C:\FPC\FPC\test_delphi.pp
test_delphi.pp(47,39) Error: Call by var for arg no. 3 has to match exactly: Got
"Pointer" expected "LongWord"
test_delphi.pp(69,4) Fatal: There were 1 errors compiling module, stopping
Fatal: Compilation aborted

"uSMBIOS.pas(4040,66) Error: range check error in set constructor or duplicate set element"

Hi!

Amazing project !!

I've tried to compiled one of examples in Lazarus PASCAL and I get this error:

"uSMBIOS.pas(4040,66) Error: range check error in set constructor or duplicate set element"

in line:

SMBIOS_INTERMEDIATE_ANCHOR_STRING_VALUE = [$5F, $44, $4D, $49, $5F];

I understand it is not possible to put $F5 twice. What's the right values?

Thanks in advanced

TSMBIOS and Lazarus 1.0.10

What steps will reproduce the problem?
1. Add "usmbios.pas" to any project in Lazarus 1.0.10
2. Add the creator procedure to the code.
2. Try to compile it

What is the expected output? What do you see instead?
After the application executes:
"Project xxx raised exception class 'EVariantError' with message:
Invalid variant type cast". Debugger points to line 4426 which is 
"LoadSMBIOSWMI" procedure.

What version of the product are you using? On what operating system?
Lazarus 1.0.10 (FPC 2.6.2) + Windows 7 x86.

Please provide any additional information below.
Sample program attached. Lazarus examples from the SVN are not even want to 
open in new Lazarus.

Original issue reported on code.google.com by [email protected] on 8 Aug 2013 at 10:38

Attachments:

Can’t take the address of constant expressions

I am using codetyphoon 32 bit ( 
http://www.pilotlogic.com/sitejoom/index.php/codetyphon ) on Ubuntu Linux ( 32 
bit) when I try to compile I get the following error :

uSMBIOS.pas(4084,24) Error: Can’t take the address of constant expressions



Original issue reported on code.google.com by [email protected] on 20 Mar 2013 at 8:50

EOleException with message ‘Invalid query'

From time to time, I have error, when I use uSMBIOS
“… EOleException with message ‘Invalid query’.
in uSMBIOS unit in line
5184: FWbemObjectSet := FWMIService.ExecQuery(‘SELECT * FROM 
MSSmBios_RawSMBiosTables’, ‘WQL’, wbemFlagForwardOnly);

Windows 7 Ultimate x64 SP1, Delphi 2007.

Original issue reported on code.google.com by [email protected] on 19 Mar 2014 at 6:44

Feature request: determine OS

In issue #1 user expressed his concern about this already and I have to agree 
with him/her.
It would be very suggested to implement a fallback scenario.
For example - order could be provider when creating TSMBios class:
WMI first, but if error occured then fallback to WINAPI.
or
WINAPI first, but if GetSystemFirmwareTable function was not found then 
fallback to WMI.

When using WMI an error can occur if application is running on limited account 
(guest for example) - access denied.

Compiler directives could be used to force only WMI or WINAPI with no fallback 
scenario.

Original issue reported on code.google.com by [email protected] on 11 Apr 2014 at 10:24

Access violoation in TSMBios.GetSMBiosTablesCount

What steps will reproduce the problem?

While trying out your cool lib I get some access violations using it in my code 
and also using the example projects.

function TSMBios.GetSMBiosTablesCount: Integer;
Var
  Index : DWORD;
  Header: TSmBiosTableHeader;
begin
  Result    := 0;
  Index     := 0;
  repeat
    {$IFDEF FPC}{$HINTS OFF}{$ENDIF}
    Move(FRawSMBIOSData.SMBIOSTableData^[Index], Header, SizeOf(Header));

--> Error occours here with an access violation because of 
FRawSMBIOSData.SMBIOSTableData is nil

    .
    .
    .


What version of the product are you using? On what operating system?
Revision 105, updated today by google code svn repository, running on Windows 
8.1 Pro, using Delphi XE 4

Please provide any additional information below.
If you need further information, please contact me, [email protected]

kind regard
Michael

Original issue reported on code.google.com by [email protected] on 19 Oct 2013 at 12:35

access violation in TProcessorInformation.ProcessorManufacturerStr

Some of my clients are reporting that they get access violation.

I tried asking one of the clients to help me debug this and i narrowed it down 
to:

TProcessorInformation.ProcessorManufacturerStr

specifically @RAWProcessorInformation^ is throwing access violation in that 
function.

The user has Windows 8 (64-bit) build 9200

I put {$DEFINE NOGENERICS} and commented out the {$DEFINE USEWMI}, but still 
same issue.

Original issue reported on code.google.com by [email protected] on 4 Apr 2014 at 9:39

"not found" window

On windows XP i have window with this message. Debuger trigger this 
"  if (RemoteMachine='') then
  FWMIService := FSWbemLocator.ConnectServer('localhost', 'root\WMI', '', '')"


I guess too old comp, just inform about this window.


Original issue reported on code.google.com by [email protected] on 12 Aug 2014 at 12:41

FPC Linux Ubuntu 12.04) will not compile

fpc "uSMBIOS.pas" (in directory: /home/vms/usmbios)
Free Pascal Compiler version 2.6.0 [2012/08/24] for i386
Copyright (c) 1993-2011 by Florian Klaempfl and others
Target OS: Linux for i386
Compiling uSMBIOS.pas
uSMBIOS.pas(628,3) Error: Identifier not found "class"
uSMBIOS.pas(628,3) Error: Error in type definition
uSMBIOS.pas(628,3) Fatal: Syntax error, ";" expected but "identifier PUBLIC" 
found
Fatal: Compilation aborted
Error: /usr/bin/ppc386 returned an error exitcode (normal if you did not 
specify a source file to be compiled)
Compilation failed.

Original issue reported on code.google.com by [email protected] on 10 Mar 2014 at 2:36

tsmbios needs a Lazarus package

It would be very nice if you provide a Lazarus package for tsmbios. That way, not only provided demos but also my projects will be able to find uSMBIOS.pas unit.

Thank you!

Samples cannot be compiled on D5 and D7

The feature description states:

Supports Delphi 5, 6, 7, 2005, BDS/Turbo 2006 and RAD Studio 2007, 2009, 2010, XE, XE2, XE3, XE4, XE5, XE6, XE7

Unfortunately all the examples cannot be compiled in Delphi 5 and 7. In 90% of cases because of such a line of code:

  for LBaseBoard in SMBios.BaseBoardInfo do

The code will work if the line is changed to something like this:

  for i := Low (SMBios.BaseBoardInfo) to High(SMBios.BaseBoardInfo) do
  begin
    LBaseBoard := SMBios.BaseBoardInfo[i];

Compile error on FPC 3.0 (lazarus 1.6)

This code does not work for FPC 3.0 (lazarus 1.6).

uSMBIOS.pas error on line number 5188
if {$IFDEF FPC} oEnum.Next(1, FWbemObject,nil) {$ELSE} oEnum.Next(1, FWbemObject, iValue) {$ENDIF} = 0 then

uSMBIOS.pas(5188,48) Error: Call by var for arg no. 3 has to match exactly: Got "Pointer" expected "LongWord"

I think the FPC unit (ActiveX) changed.

Best regards.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.