5/15/13
Delphi | The Road to Delphi - a Blog about programming
PROJECTS
MISC
CATEGORIES
ABOUT
CONTRIBUTIONS
THE ROAD TO DELPHI – A BLOG ABOUT PROGRAMMING Delphi – Lazarus – Delphi Prism
CATEGORY ARCHI VES: DELPHI
April 25, 2013 7 Comments
Added support for RAD Studio XE4 in the Delphi IDE Theme Editor. This entry is just for announce which the Delphi IDE Theme Editor now supports RAD Studio XE4.
theroadtodelphi.wordpress.com/category/delphi/
1/22
5/15/13
Delphi | The Road to Delphi - a Blog about programming
.Net ADO Applications Bing API C# COM
Delphi
Delphi-News Delphi 2010 Delphi Prism Delphi XE Delphi XE2 Delphi XE3 DWM FreePascal Geolocation Google Api Google labs JEDI API json Lazarus Networking RTTI SMBios StackOverflow
Installer of the Delphi IDE Theme Editor
VCL Styles WinApi
WMI
XML XPath
Categories: Delphi, Tools | Tags: Delphi, tools | Permalink.
TRANSLATE Translate this blog into different languages... April 12, 2013
اﻟﻌﺮﺑﯿﺔ
2 Comments
Български
Added support to TSMBIOS for SMBIOS 2.8 spec. A few weeks ago (3 Apr 2013) a new update to the System Management BIOS (SMBIOS) Reference
中文(简体) 中文(繁體) Hrvatski Česky Dansk Nederlands
Specification was introduced by the DMTF. So the
Suomi
TSMBIOS project was updated to support the
Français
SMBIOS 2.8.
Deutsch
The following changes was added to the 2.8 version:
Ελληνική ह द Italiano 日本語 한국어
Processor Information (Type 4):
Norsk Polski
1. SMBIOSCR00106: processor family name correction (48h)
Português
2. SMBIOSCR00107: new processor family types
Español
Română Русский Svenska
3. SMBIOSCR00108: new processor family type theroadtodelphi.wordpress.com/category/delphi/
2/22
5/15/13
Delphi | The Road to Delphi - a Blog about programming
4. SMBIOSCR00110: correct typo in table 24 (processor upgrade) 5. SMBIOSCR00118: new processor family types 6. SMBIOSCR00121: new processor family type 7. SMBIOSCR00122: new processor upgrade type 8. SMBIOSCR00125: add new Intel socket type Memory Device (Type 17):
1. SMBIOSCR00109: add minimum, maximum and configured voltages 2. SMBIOSCR00114: add LRDIMM to memory device list Other:
1. SMBIOSCR00116: correct/clarify structure length fields 2. SMBIOSCR00120: add new supported processor architectures 3. SMBIOSCR00123: update referenced specifications 4. Wording updates for clarity and consistency Categories: Delphi, FreePascal, SMBios | Tags: Delphi, FPC, SMBIOS | Permalink.
ARCHI VES April 2013 (2) March 2013 (4)
March 27, 2013
February 2013 (3)
Leave a comment
December 2012 (1)
Getting Processor Info using Object Pascal (Delphi / FPC) and the TSMBIOS
November 2012 (1) September 2012 (11) August 2012 (3) July 2012 (1) June 2012 (2) May 2012 (2)
theroadtodelphi.wordpress.com/category/delphi/
3/22
5/15/13
Delphi | The Road to Delphi - a Blog about programming
The SMBIOS expose the info
April 2012 (3)
about the installed processors in March 2012 (6) the table type 4. Check the next
February 2012 (3)
snippet that shows how obtain
January 2012 (4)
such data using the TSMBIOS (remember, if you
December 2011 (2)
are using FPC, you can use this library in Windows
November 2011 (7)
and Linux).
October 2011 (11) September 2011 (3)
{$IFDEF FPC}{$mode objfpc}{$H+} {$ELSE} {$APPTYPE CONSOLE} {$ENDIF}
August 2011 (1)
uses Classes, TypInfo, SysUtils, uSMBIOS;
April 2011 (3)
July 2011 (5) June 2011 (5) May 2011 (3)
March 2011 (5) February 2011 (6) January 2011 (1) December 2010 (6)
function SetToString(Info: PTypeInfo; November const V2010 alue ): String; (6) var October 2010 (9) LTypeInfo : PTypeInfo; August 2010 (4) LIntegerSet: TIntegerSet; I: Integer; June 2010 (1) begin Result := '';
April 2010 (1) March 2010 (2) February 2010 (4)
Integer(LIntegerSet) := 0; January 2010 (1) case GetTypeData(Info)^.OrdType of December 2009 (5) otSByte, otUByte: Integer(LIntegerSet) := Byte(Value); November 2009 (3) otSWord, otUWord: Integer(LInteg erSet) := Word(Value); October 2009: (16) otSLong, otULong: Integer(LIntegerSet) = Integer(Value end; September 2009 (17)
LTypeInfo := GetTypeData(Info)^.CompType{$IFNDEF FPC}^{$END for I := 0 to SizeOf(Integer) * 8 - 1 do if I in LIntegerSet then BLOGROLL begin Andy’s Blog Tools if Result <> '' then Result := R esult +and ',' ; Result := Result + GetEnumName(L TypeI fo, I); Delphi –n Neftali end; Delphi Haven – Chris end; Rolliston Blog Delphi sorcery – Stefan Glienke's Blog
procedure GetProcessorInfo; Delphifeeds.com Var Felix J COLIBRI SMBios : TSMBios; LProcessorInfo : TProcessorInformation; theroadtodelphi.wordpress.com/category/delphi/
4/22
5/15/13
Delphi | The Road to Delphi - a Blog about programming
Hallvard's Blog LSRAMTypes : TCacheSRAMTypes ; begin Hey, Scripting Guy! Blog SMBios:=TSMBios.Create; JEDI Windows API try Peter WriteLn('Processor Information') ; Johnson's DelphiDabbler.com if SMBios.HasProcessorInfo then Reinvent The Wheel for LProcessorInfo in SMBios.Pro cessor Inf o do begin RemObject Blog WriteLn('Manufacturer '+LProcessorInfo.Processor Rudy's Delphi Corner WriteLn('Socket Designation '+LProcessorInfo.SocketDes Scott Hanselman WriteLn('Type '+ LPro cessorIBlog nfo.Processor Sip from the WriteLn('Familiy '+ LPr oce ssFirehose orInfo.Processor WriteLn('Version '+ LPr oc es sorInfo.Processor The Art of Delphi WriteLn(Format('Processor ID Programming %x',[LProcessorInfo WriteLn(Format('Voltaje %n',[LProcessorInfo The Delphi Geek WriteLn(Format('External Clock %d Mhz',[LProcesso The Old New Thing WriteLn(Format('Maximum proces sor speed %d Mhz',[LPro The Oracle atd Delphi WriteLn(Format('Current proces sor spee %d Mhz',[LPro WriteLn('Processor Upgrade ' +LPr ces sorInfo.Processo YAPB –o Alex Ciobanu WriteLn(Format('External Clock %d Mhz',[LProcesso Blog
if SMBios.SmbiosVersion>='2.3' then begin WriteLn('Serial Number '+LProPOSTS cessorInfo.SerialN RECENT WriteLn('Asset Tag '+LProcessorInfo.AssetTa Added support for WriteLn('Part Number '+ LProc essor Info.PartNum RAD Studio XE4 in the if SMBios.SmbiosVersion>='2.5' then Delphi IDE begin Theme Editor. WriteLn(Format('Core Count %d',[LProcessor Added support to WriteLn(Format('Cores Enabled %d' ,[LProcessor TSMBIOS for SMBIOS WriteLn(Format('Threads Count %d',[LProcessor 2.8 spec. WriteLn(Format('Processor Characteristics %.4x',[L Getting Processor end; Info using Object end; Pascal (Delphi / FPC) Writeln; and the TSMBIOS
Vcl Styles Utils if (LProcessorInfo.RAWProcessorI nf orma tion^.L1CacheHan updated to fix QC begin #114040, #114032 WriteLn('L1 Cache Handle Info' ); (XE2 and XE3) WriteLn('--------------------'); Memory WriteLn(' Socket DesignationGetting '+ LProcessorInfo.L1 Device Info using WriteLn(Format(' Cache Configuration %.4x',[LProc Object Pascal (Delphi / WriteLn(Format(' Maximum Cach eS ize %d Kb',[LPro FPC) and WriteLn(Format(' Installed Ca chTSMBIOS e Size %d Kb',[LPro the LSRAMTypes:=LProcessorInfo.L1Chache.GetSupportedSRAM WriteLn(Format(' Supported SRAM Type [%s]',[SetTo LSRAMTypes:=LProcessorInfo.L1Chache.GetCurrentSRAMTy WriteLn(Format(' Current SR AM TypeES [%s]',[SetTo CATEGORI
.Net (14) WriteLn(Format(' Error Corr ect ion Type %s',[ErrorCo WriteLn(Format(' System Cac he T ype %s',[SystemC ADO (2) theroadtodelphi.wordpress.com/category/delphi/
5/22
5/15/13
Delphi | The Road to Delphi - a Blog about programming
ADSI WriteLn(Format(' Associativ ity(1) %s',[LProces end; Applications (13) Bing API (3)
if (LProcessorInfo.RAWProcessorInformation^.L2CacheHan C# (2) begin WriteLn('L2 Cache Handle Inf C++ o') Builder ; (1) WriteLn('------------------' ) ; COM (8) WriteLn(' Socket Designation '+LProcessorInfo.L2 Cpp (1) WriteLn(Format(' Cache Configuration %.4x',[LProc Delphi (154) WriteLn(Format(' Maximum Ca che S ize %d Kb',[LPro WriteLn(Format(' Installed Delphi Cache Si ze %d Kb',[LPro 2010 (7) LSRAMTypes:=LProcessorInfo.L 2 C h a c h e . etSupportedSRAM Delphi PrismG (13) WriteLn(Format(' Supported SRAM Type [%s]',[SetTo Delphi XE (7) LSRAMTypes:=LProcessorInfo.L2Chache.GetCurrentSRAMTy Delphi XE2 WriteLn(Format(' Current SR AM Ty pe(24) [%s]',[SetTo Delphi XE3 (12)
WriteLn(Format(' Error Corr ection Type %s',[ErrorCo Delphi-News (12) WriteLn(Format(' System Cache Type %s',[SystemC DWM (3) WriteLn(Format(' Associativity %s',[LProces Firebird (1) end; FireMonkey (1)
if (LProcessorInfo.RAWProcessorInformation^.L3CacheHan FreePascal (8) begin Geolocation (3) WriteLn('L3 Cache Handle Inf o'); Google WriteLn('-------------------'); Api (8) WriteLn(' Socket Designatio n '+L ProcessorInfo.L3 Google labs (2) WriteLn(Format(' Cache Configuration %.4x',[LProc InnoSetup (1) WriteLn(Format(' Maximum Cache Size %d Kb',[LPro Javascript (1) WriteLn(Format(' Installed Cache Size %d Kb',[LPro LSRAMTypes:=LProcessorInfo.L JEDI 3Ch API ach (2) e.GetSupportedSRAM WriteLn(Format(' Supported json SRA(2) M Type [%s]',[SetTo LSRAMTypes:=LProcessorInfo.L3Chache.GetCurrentSRAMTy Lazarus (6) WriteLn(Format(' Current SRAM Type [%s]',[SetTo Networking (11)
WriteLn(Format(' Error Corr ection Type PreviewHandler (1)%s',[ErrorCo WriteLn(Format(' System Cac he (1) Type %s',[SystemC Rest WriteLn(Format(' Associativity %s',[LProces RTTI (4) end; SMBios (6)
Readln; SQL CLR (1) end Sql Server (1) else StackOverflow (2) Writeln('No Processor Info was f ound'); Tools (2) finally SMBios.Free; TWebBrowser (2) end; Uncategorized (1) end; VCL Styles (23) WinApi (16) WinInet (1) WMI (36) theroadtodelphi.wordpress.com/category/delphi/
6/22
5/15/13
Delphi | The Road to Delphi - a Blog about programming
WUA (1) XML (2) XPath (2)
TWI TTER UPDATES RT @MacinCloud: #RAD Studio #PAServer XE4 #Delphi Platform Assistant Server now available on all MacinCloud Servers. Develop... http://t.… 1 day ago Pascal still an advantage for some iOS, Android developers zdnet.com/pascal-stilla… 1 day ago RT @ttdummy: WebFMX 1.0 Released! cybelesoft.com/blog/we bfmx-1-… 5 days ago
Categories: Delphi, FreePascal, SMBios | Tags: Delphi, FPC, SMBIOS | Permalink.
The TSMBIOS project now supports older #Delphi versions 5,6 7. code.google.com/p/tsm bios/ 1 week ago WmiDelphCodeCreator Revision 158: Improved Vcl Styles support: Changed Paths: @Modify /trunk/Install er.... bit.ly/13exprz 1 week ago
March 21, 2013 2 Comments
Vcl Styles Utils updated to fix QC #114040, #114032 (XE2 and XE3)
VI SI TORS TO THI S SI TE
I just commit in the Vcl Styles Project two new fixes to patch the QC 114040 and QC 114032 (these issues exist in Delphi XE2 and XE3), both reports are related to the Highlight colors used to draw the TColorBox and TComboBoxEx components when the Vcl Styles are active.
DELPHI FEEDS theroadtodelphi.wordpress.com/category/delphi/
7/22
5/15/13
Delphi | The Road to Delphi - a Blog about programming
QC 114032 As you can see in the below image the TColorBox component doesn’t use the proper highlight color, but the TColorListBox uses the highlight color of the current Vcl Style.
Delphi XE4 IDE videos by José León May 14, 2013 Marco's Tech Blog (marcocantu) Be-Delphi Event 3.0 May 14, 2013 Behind the connection (François Piette) iOS app dev with Delphi XE4 and FireMonkey 3 is a quantum leap beyond XE2… May 14, 2013 Sip from the Firehose (David Intersimone) My Delphi STOMP Client is now compatibile with iOS May 14, 2013 Daniele Teti's programming blog (Daniele Teti)
The TColorBox control doesn’t use a Style Hook, so the fix was done using a interposer class. To apply the path just add the Vcl.Styles.Fixes unit to your uses list after of the Vcl.ExtCtrls unit. And the result will be
A few notes on Delphi, WSDL and SOAP: passing nil values, Document/Literal versus RPC Encoded May 14, 2013 The Wiert Corner (jpluimers) C++Builder XE4 use case: (I need to) Build a MultiDevice, Multi-Tier Master/Detail database application May 13, 2013 Sip from the Firehose (David Intersimone) How to get the latest FireDAC update 8.0.3.3291 May 13, 2013 Delphi Insider (Tim Del Chiaro) Immutable strings… in Delphi? May 13, 2013 DelphiTools (Eric) Internet Explorer Automation Part 3 May 12, 2013 Behind the connection (François Piette)
QC 114040
Work in progress: dwsLinq extension for DWS May 11, 2013 TURBU Tech (Mason Wheeler)
The TComboBoxEx control have a similar issue. theroadtodelphi.wordpress.com/category/delphi/
8/22
5/15/13
Delphi | The Road to Delphi - a Blog about programming
STACKOVERFLOW DELPHI QUESTI ONS How to get a single Arabic letter in a string with its Unicode transformation value in DELPHI? May 15, 2013 Hasan How do I ignore the response of a POST request? May 15, 2013 Benjamin Weiss trapping drag-and-drop at design time in Delphi for a TCustomGroupBox descendant May 15, 2013 user2383818
In this case fixing the Style Hook related to the TComboBoxEx control was the key.
When do I need synchronize in TThread? May 15, 2013 Benjamin Weiss Delphi 'private' clause (directive) does not work May 15, 2013 Yevgeniy Afanasyev Rad Studio XE4 vs Delphi XE4 May 15, 2013 Cape Cod Gunny using windows key press to break out of loop (non keyPress event) May 14, 2013 Jake Snake How to pull a MDI child window out of the main form? May 14, 2013 EASI Convert JSON String to Image to send by SQL May 14, 2013 Ricardo Pascoal
To apply this fix, just register the TComboBoxExStyleHookFix style hook located in
Delphi 6 cursor not changing May 14, 2013 GeoffM
the Vcl.Styles.Fixes unit.
Categories: Delphi, Delphi XE2, Delphi XE3, VCL Styles | Tags: Delphi, Vcl Styles | Permalink.
THE NEW OLD THI NG Microspeak: booked The secret lair of Administrative Assistants How can I display a live
theroadtodelphi.wordpress.com/category/delphi/
9/22
5/15/13
Delphi | The Road to Delphi - a Blog about programming
screenshot of a piece of another application?
March 18, 2013 6 Comments
Getting Memory Device Info using Object Pascal (Delphi / FPC) and the TSMBIOS
If you want to use a name for your file mapping, don't just use the name of the file itself
Why am I getting LNK2019 unresolved external for my inline If you need to know what type of function?
RAM is installed in your system
Mathematical formulas are designed to be your memory device, you can try pretty, not to be suitable for computation
or how is the manufacturer of reading the SPD (Serial presence detect) info
directly (but not all the memory devices exposes the SPD info and reading the SPD require Kernel Mode access) , use the Win32_PhysicalMemory WMI class (but depending of the manufacturer the WMI fails to get info about some memory properties like the memory type) or using the SMBIOS. Using the SMBIOS you can get most of the info related to the memory devices installed like manufacturer, type, speed, serial number and so on. The next snippet show how using the TSMBIOS
How to tell the poseurs from the actual Windows developers Extending process attribute inheritance beyond its current boundaries Reading mouse input from a console program, and programmatically turning off Quick Edit mode Creating a simple pidl: For the times you care enough to send the very fake
and Delphi (or FPC) you can retrieve such data. {$IFDEF FPC}{$mode objfpc}{$H+} {$ELSE} {$APPTYPE CONSOLE} {$ENDIF} uses Classes, SysUtils, uSMBIOS;
REI NVENT THE WHEEL An error has occurred; the feed is probably down. Try again later.
COMMUNI TY
procedure GetMemoryDeviceInfo; Var SMBios : TSMBios; LMemoryDevice : TMemoryDeviceInformation; begin SMBios:=TSMBios.Create; try WriteLn('Memory Device Information'); WriteLn('-------------------------'); theroadtodelphi.wordpress.com/category/delphi/
10/22
5/15/13
Delphi | The Road to Delphi - a Blog about programming
if SMBios.HasMemoryDeviceInfo then for LMemoryDevice in SMBios.MemoryDeviceInformation do begin WriteLn(Format('Total Width %d bits',[LMemoryDevice WriteLn(Format('Data Width %d bits',[LMemoryDevice TOP &sPAGES WriteLn(Format('Size %dPOSTS Mbyte ',[LMemoryDevi WriteLn(Format('Form Factor %s',[LMemoryDevice.GetF WMI Delphi Code WriteLn(Format('Device Locator %s',[LMemoryDevice.GetD Creator WriteLn(Format('Bank Locator %s',[LMemoryDevice.GetB the Google Maps WriteLn(Format('Memory Type Using %s' ,[LMemoryDevice.GetM API V3 from Delphi - Part WriteLn(Format('Speed %d MHz',[LMemoryDevice. I Basic functionality WriteLn(Format('Manufacturer %s',[LMemoryDevice.Manu Delphi -evice.Seri WriteLn(Format('Serial Number Exploring %s',[L MemoXE2 ryD VCL Styles Part I WriteLn(Format('Asset Tag %s',[LMemoryDevice.Asse Changing the color of WriteLn(Format('Part Number %s',[L Me mory Device.Part WriteLn;
Edit Controls with VCL Styles Enabled
Delphi IDE Theme Editor
if LMemoryDevice.RAWMemoryDevi ceInfo ^.Phy sicalMemoryAr Compile, Debug and begin Run your Pascal code online. WriteLn(' Physical Memory A rray'); WriteLn(' -------------------'); Using the Google Maps WriteLn(' Location '+L Me mor yDevi e.Physical API V3 from Delphi –c Part WriteLn(' Use III '+ Getting LMemo the ryD latitude evice.Physical and longitude of WriteLn(' Error Correction '+LMemoryDeavice.Physical mouse click if LMemoryDevice.PhysicalMem oryAr ray.RAWPhysicalMemo WriteLn(Format(' Maximum Generating Capacity d Kb',[LMemory Qr% Codes with delphi else WriteLn(Format(' Maximum Generating Capacity %d bytes',[LMem a "unique" hardware ID using
WriteLn(Format(' Memory dev delphi icesand % the d' WMI ,[LMemoryDevic end; Vcl Styles - Adding WriteLn; background images and end colors to Delphi forms else Writeln('No Memory Device Info was found'); finally SMBios.Free; Tweets by @RRUZ end; !function(d,s,id){var end; js,fjs=d.getElementsByTagName(s) [0];if(!d.getElementById(id))
begin {js=d.createElement(s);js.id=id;js.src= try (document,"script","twitterGetMemoryDeviceInfo; wjs"); except on E:Exception do Writeln(E.Classname, ':', E.Message); end; Writeln('Press Enter to exit'); Readln; theroadtodelphi.wordpress.com/category/delphi/
11/22
5/15/13
Delphi | The Road to Delphi - a Blog about programming
end.
Note: Remember if you uses FPC, you can use this library in linux as well :)
Categories: Delphi, SMBios | Tags: Delphi, FPC, SMBIOS | Permalink.
March 12, 2013 2 Comments
Added new vcl style hook to the Vcl Styles Utils to fix QC #108678, #108875 (XE2 and XE3) I just added a new vcl style hook (TListViewStyleHookFix) for the TListView component in the Vcl Styles Utils project to fix the QC #108678, #108875 (XE2 and XE3) The issue reported in both reports, is that the images are not displayed in the TListView header with the VCL Styles enabled. When you uses the Windows Theme in a TListView with images in the header will look like so
theroadtodelphi.wordpress.com/category/delphi/
12/22
5/15/13
Delphi | The Road to Delphi - a Blog about programming
But if you enable the Vcl Styles, the images in the header are lost.
The issue is located in the TListViewStyleHook.DrawHeaderSection method,
this method must paint the image and text of each section of the header of the ListView. This is part of the code with the bug
... ... ImageList := SendMessage(Handle, HDM_GETIMAGELIST, 0, 0); Item.Mask := HDI_FORMAT or HDI_IMAGE; InflateRect(R, -2, -2); if (ImageList <> 0) and Header_GetItem(Handle, Index, Item) begin if Item.fmt and HDF_IMAGE = HDF_IMAGE then ImageList_Draw(ImageList, Item.iImage, Canvas.Handle, R. ImageList_GetIconSize(ImageList, IconWidth, IconHeight); Inc(R.Left, IconWidth + 5); end; ... ... The problem with the above code is that the SendMessage function with the HDM_GETIMAGELIST message (which is used to get the current imagelist) is not using the proper Handle. The above code is passing the handle of theroadtodelphi.wordpress.com/category/delphi/
13/22
5/15/13
Delphi | The Road to Delphi - a Blog about programming
the ListView, but must pass the handle of the Header control, the same applies to the call to the Header_GetItem method. The TListViewStyleHookFix introduces a new DrawHeaderSection method which passes the
handle of the header control and fix the issue. You can use this Stylehook adding Vcl.Styles.Fixes unit to you uses clause and then register the hook on this way.
initialization TStyleManager.Engine.RegisterStyleHook(TListView, TListView
Categories: Delphi, Delphi XE2, Delphi XE3, VCL Styles | Tags: Delphi, Vcl Styles | Permalink.
February 19, 2013 Leave a comment
How distinguish when Windows was installed in Legacy BIOS or UEFI mode using Delphi? As part of the TSMBIOS project, I needed a method to distinguish when Windows was installed in Legacy BIOS or UEFI mode. The solution was provided by the GetFirmwareEnvironmentVariable function. The msdn documentation states
theroadtodelphi.wordpress.com/category/delphi/
14/22
5/15/13
Delphi | The Road to Delphi - a Blog about programming
Firmware variables are not supported on a legacy BIOS-based system. The GetFirmwareEnvironmentVariable function will always fail on a legacy BIOS-based system, or if Windows was installed using legacy BIOS on a system that supports both legacy BIOS and UEFI. To identify these conditions, call the function with a dummy firmware environment name such as an empty string (“”) for the lpName parameter and a dummy GUID such as “{00000000-0000-0000-0000000000000000}” for the lpGuid parameter. On a legacy BIOS-based system, or on a system that supports both legacy BIOS and UEFI where Windows was installed using legacy BIOS, the function will fail with ERROR_INVALID_FUNCTION. On a UEFI-based system, the function will fail with an error specific to the firmware, such as ERROR_NOACCESS, to indicate that the dummy GUID namespace does not exist. . So the Delphi code to detect such condition will be something like so {$APPTYPE CONSOLE} uses Windows, SysUtils;
function GetFirmwareEnvironmentVariableA(lpName, lpGuid: LPCST nSize: DWORD): DWORD; stdcall; external kernel32 name 'GetFi theroadtodelphi.wordpress.com/category/delphi/
15/22
5/15/13
Delphi | The Road to Delphi - a Blog about programming
begin try GetFirmwareEnvironmentVariableA('','{00000000-0000-0000-00 if (GetLastError = ERROR_INVALID_FUNCTION) then Writeln('Legacy BIOS') else Writeln('UEFI Boot Mode'); except on E: Exception do Writeln(E.ClassName, ': ', E.Message); end; Readln; end.
Categories: Delphi, WinApi | Tags: Delphi, UEFI, winapi | Permalink.
February 18, 2013 Leave a comment
Added Linux support to the TSMBIOS Project Great news for the Free Pascal developers, I just added Linux support to the TSMBIOS project.
Note : The TSMBIOS read the SMBIOS info using the /dev/mem device file which provides access to system physical memory, so the code must be theroadtodelphi.wordpress.com/category/delphi/
16/22
5/15/13
Delphi | The Road to Delphi - a Blog about programming
executed using a user with the proper permissions.
Categories: Delphi, FreePascal, SMBios, Tools | Tags: Delphi, FPC, SMBIOS | Permalink.
February 12, 2013 5 Comments
Introducing TSMBIOS A few weeks ago I started a new project called TSMBIOS, this is a library which allows access the SMBIOS using the Object Pascal language (Delphi or Free Pascal).
What is the SMBIOS? SMBIOS stands for System Management BIOS , this standard is tightly related and developed by the DMTF (Desktop Management Task Force). The SMBIOS contains a description of the system’s hardware components, the information stored in the SMBIOS typically includes system manufacturer, model name, serial numbers, BIOS version, asset tag, processors, ports, device memory installed and so on. Note : The amount and accuracy of the SMBIOS information depends on the computer manufacturer.
Which are the advantages of use the SMBIOS? You can retrieve the information without theroadtodelphi.wordpress.com/category/delphi/
17/22
5/15/13
Delphi | The Road to Delphi - a Blog about programming
having to probe for the actual hardware. this is a good point in terms of speed and safeness. The SMBIOS information is very well documented. You can avoid the use of undocumented functions to get hardware info (for example the RAM type and manufacturer). Useful for create a Hardware ID (machine fingerprint).
How it works? The BIOS typically populates the SMBIOS structures at system boot time, and is not in control when the OS is running. Therefore, dynamically changing data is rarely represented in SMBIOS tables. The SMBIOS Entry Point is located somewhere between the addresses 0xF0000 and 0xFFFFF, in early Windows systems (Win95, Win98) it was possible access this space address directly, but after with the introduction of the NT Systems and the new security changes the BIOS was accessible through section \Device\PhysicalMemory, but this last method was disabled as well in Windows Server 2003 Service Pack 1, and replaced with 2 new WinApi functions the EnumSystemFirmwareTables and GetSystemFirmwareTable, Additionally the WMI supports reading the entire contents of SMBIOS data i using the MSSMBios_RawSMBiosTables class inside of the root\wmi namespace. Note : you can find more information about the SMBIOS Support in Windows on this link. The TSMBIOS can be compiled using a WinApi mode (uses the GetSystemFirmwareTable function) or using the WMI Mode (uses the MSSMBios_RawSMBiosTables class) theroadtodelphi.wordpress.com/category/delphi/
18/22
5/15/13
Delphi | The Road to Delphi - a Blog about programming
If you uses the WinApi Mode you don’t need use COM and the final size of the Application will be smaller, but the WinAPI functions was introduced in Windows Vista and Windows XP x64 (So in Windows Xp x86 will fail). Otherwise using the WMI mode you will need use COM ( CoInitialize and CoUninitialize), but also you will get two additional advantages 1) The WMI will work even in Windows Xp x86 systems, 2) You can read then SMBIOS data of local and remote computers. In order to use the TSMBIOS in your application only you must add the uSMBIOS unit to your uses clause, then create a instance for the TSMBios class using the proper constructor
// Default constructor, used for populate the TSMBIOS class u constructor Create; overload; // Use this constructor to load the SMBIOS data from a previou constructor Create(const FileName : string); overload; {$IFDEF USEWMI} // Use this constructor to read the SMBIOS from a remote machi constructor Create(const RemoteMachine, UserName, Password : s {$ENDIF} and finally use the property which expose the SMBIOS info which you need. In this case as is show in the sample code the BatteryInformation property is used to get all the info of the batteries installed on the system. {$APPTYPE CONSOLE} uses Classes, SysUtils, uSMBIOS in '..\..\Common\uSMBIOS.pas'; procedure GetBatteryInfo; Var SMBios : TSMBios; LBatteryInfo : TBatteryInformation; begin SMBios:=TSMBios.Create; theroadtodelphi.wordpress.com/category/delphi/
19/22
5/15/13
Delphi | The Road to Delphi - a Blog about programming
try
WriteLn('Battery Information'); WriteLn('-------------------'); if SMBios.HasBatteryInfo then for LBatteryInfo in SMBios.BatteryInformation do begin WriteLn('Location '+LBatteryInfo.GetLocation WriteLn('Manufacturer '+LBatteryInfo.GetManufact WriteLn('Manufacturer Date '+LBatteryInfo.GetManufact WriteLn('Serial Number '+LBatteryInfo.GetSerialNu WriteLn('Device Name '+LBatteryInfo.GetDeviceNa WriteLn('Device Chemistry '+LBatteryInfo.GetDeviceCh WriteLn(Format('Design Capacity %d mWatt/hours',[LB WriteLn(Format('Design Voltage %d mVolts',[LBatter WriteLn('SBDS Version Number '+LBatteryInfo.GetSBDSVe WriteLn(Format('Maximum Error in Battery Data %d%%',[L WriteLn(Format('SBDS Version Number %.4x',[L WriteLn('SBDS Manufacture Date '+LBatteryInfo.GetSBDS WriteLn('SBDS Device Chemistry '+LBatteryInfo.GetSBDS WriteLn(Format('OEM Specific %.8x',[L WriteLn; end else Writeln('No Battery Info was found'); finally SMBios.Free; end; end; begin try GetBatteryInfo; except on E:Exception do Writeln(E.Classname, ':', E.Message); end; Writeln('Press Enter to exit'); Readln; end.
TSMBIOS Features Source Full documented compatible with the help insight feature, available since Delphi 2005. Supports SMBIOS Version from 2.1 to 2.7.1 Supports Delphi 5, 6, 7, 2005, BDS/Turbo 2006 and RAD Studio 2007, 2009, 2010, XE, XE2, XE3, XE4. theroadtodelphi.wordpress.com/category/delphi/
20/22
5/15/13
Delphi | The Road to Delphi - a Blog about programming
Compatible with FPC 2.6.0 (Windows and Linux) SMBIOS Data can be obtained using WinApi, WMI or loading a saved SMBIOS dump SMBIOS Data can be saved and load to a file SMBIOS Data can be obtained from remote machines
SMBIOS Tables supported BIOS Information (Type 0) System Information (Type 1) Baseboard (or Module) Information (Type 2) System Enclosure or Chassis (Type 3) Processor Information (Type 4) Cache Information (Type 7) Port Connector Information (Type 8) System Slots (Type 9) OEM Strings (Type 11) System Configuration Options (Type 12) BIOS Language Information (Type 13) Physical Memory Array (Type 16) Memory Device (Type 17) Memory Array Mapped Address (Type 19) Memory Device Mapped Address (Type 20) Built-in Pointing Device (Type 21) Portable Battery (Type 22) Voltage Probe (Type 26) Cooling Device (Type 27) Temperature Probe (Type 28) Electrical Current Probe (Type 29)
The TSMBIOS is a Open Source project is hosted in the code google site. Categories: Delphi, FreePascal, SMBios | Tags: Delphi, FPC, SMBIOS | Permalink.
December 17, 2012 theroadtodelphi.wordpress.com/category/delphi/
21/22
5/15/13
Delphi | The Road to Delphi - a Blog about programming
Leave a comment
Delphi XE3 – Vcl Styles Additions Alexey Sharagin from Embarcadero just wrote a blog article titled Tuning VCL Styles for Forms and Controls , which shows some features related to the
VCL Styles introduced in Delphi XE3.
Categories: Delphi, Delphi XE3, VCL Styles | Tags: Delphi, Vcl Styles | Permalink.
← Older posts
Blog at WordPress.com. | Theme: Yoko by Elmastudio Top
theroadtodelphi.wordpress.com/category/delphi/
22/22