SMBIOS ver 1.0

This commit is contained in:
2024-12-19 20:58:54 +09:00
parent a271945eae
commit ed58fc0eea
11 changed files with 9133 additions and 1 deletions
+185
View File
@@ -0,0 +1,185 @@
object frmMain: TfrmMain
Left = 0
Top = 0
BorderIcons = [biSystemMenu]
Caption = 'SMBIOS '#49368#54540
ClientHeight = 583
ClientWidth = 504
Color = clBtnFace
Font.Charset = DEFAULT_CHARSET
Font.Color = clWindowText
Font.Height = -12
Font.Name = 'Segoe UI'
Font.Style = []
Position = poDesktopCenter
TextHeight = 15
object lcMain: TdxLayoutControl
Left = 0
Top = 0
Width = 504
Height = 583
Align = alClient
TabOrder = 0
LayoutLookAndFeel = dxLayoutSkinLookAndFeel1
ExplicitWidth = 531
ExplicitHeight = 466
object btnGetSn: TcxButton
Left = 12
Top = 526
Width = 480
Height = 35
Caption = #49884#47532#50620#45336#48260' '#52628#52636
TabOrder = 5
OnClick = btnGetSnClick
end
object teCpuSerialNum: TcxTextEdit
Left = 75
Top = 88
AutoSize = False
Style.HotTrack = False
Style.TransparentBorder = False
TabOrder = 0
Height = 25
Width = 417
end
object teMbSerialNum: TcxTextEdit
Left = 75
Top = 120
AutoSize = False
Style.HotTrack = False
Style.TransparentBorder = False
TabOrder = 1
Height = 25
Width = 417
end
object teHddSerialNum: TcxTextEdit
Left = 75
Top = 152
AutoSize = False
Style.HotTrack = False
Style.TransparentBorder = False
TabOrder = 2
Height = 25
Width = 417
end
object teNetworkMac: TcxTextEdit
Left = 75
Top = 184
AutoSize = False
Style.HotTrack = False
Style.TransparentBorder = False
TabOrder = 3
Height = 25
Width = 417
end
object mmLog: TcxMemo
Left = 12
Top = 226
Properties.ScrollBars = ssVertical
Style.HotTrack = False
Style.TransparentBorder = False
TabOrder = 4
Height = 266
Width = 480
end
object lgRoot: TdxLayoutGroup
AlignHorz = ahClient
AlignVert = avClient
Hidden = True
ItemIndex = 5
ShowBorder = False
Index = -1
end
object dxLayoutItem1: TdxLayoutItem
Parent = lgRoot
Padding.Bottom = 10
Padding.AssignedValues = [lpavBottom]
CaptionOptions.Text = 'cxButton1'
CaptionOptions.Visible = False
Control = btnGetSn
ControlOptions.OriginalHeight = 35
ControlOptions.OriginalWidth = 75
ControlOptions.ShowBorder = False
Index = 7
end
object dxLayoutItem2: TdxLayoutItem
Parent = lgRoot
CaptionOptions.Text = 'CPU'
Control = teCpuSerialNum
ControlOptions.OriginalHeight = 25
ControlOptions.OriginalWidth = 121
ControlOptions.ShowBorder = False
Index = 1
end
object dxLayoutItem3: TdxLayoutItem
Parent = lgRoot
CaptionOptions.Text = 'Mainboard'
Control = teMbSerialNum
ControlOptions.OriginalHeight = 25
ControlOptions.OriginalWidth = 121
ControlOptions.ShowBorder = False
Index = 2
end
object dxLayoutItem4: TdxLayoutItem
Parent = lgRoot
CaptionOptions.Text = 'HDD'
Control = teHddSerialNum
ControlOptions.OriginalHeight = 25
ControlOptions.OriginalWidth = 121
ControlOptions.ShowBorder = False
Index = 3
end
object dxLayoutLabeledItem1: TdxLayoutLabeledItem
Parent = lgRoot
Padding.Bottom = 10
Padding.Top = 10
Padding.AssignedValues = [lpavBottom, lpavTop]
CaptionOptions.AlignHorz = taCenter
CaptionOptions.Text = '[SIZE=20][B]SMBIOS '#49884#47532#50620' '#45336#48260'[/B][/SIZE]'
Index = 0
end
object dxLayoutEmptySpaceItem1: TdxLayoutEmptySpaceItem
Parent = lgRoot
SizeOptions.Height = 20
SizeOptions.Width = 10
CaptionOptions.Text = 'Empty Space Item'
Index = 6
end
object dxLayoutItem5: TdxLayoutItem
Parent = lgRoot
CaptionOptions.Text = 'LAN'
Control = teNetworkMac
ControlOptions.OriginalHeight = 25
ControlOptions.OriginalWidth = 121
ControlOptions.ShowBorder = False
Index = 4
end
object dxLayoutItem6: TdxLayoutItem
Parent = lgRoot
AlignVert = avClient
Padding.Top = 10
Padding.AssignedValues = [lpavTop]
CaptionOptions.Text = 'cxMemo1'
CaptionOptions.Visible = False
Control = mmLog
ControlOptions.OriginalHeight = 89
ControlOptions.OriginalWidth = 185
ControlOptions.ShowBorder = False
Index = 5
end
end
object dxLayoutLookAndFeelList: TdxLayoutLookAndFeelList
Left = 56
Top = 16
object dxLayoutSkinLookAndFeel1: TdxLayoutSkinLookAndFeel
PixelsPerInch = 96
end
end
object scMain: TdxSkinController
NativeStyle = False
SkinName = 'WXI'
SkinPaletteName = 'Clearness'
Left = 16
Top = 16
end
end
+62
View File
@@ -0,0 +1,62 @@
unit MainForm;
interface
uses
Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes,
Vcl.Graphics, Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.StdCtrls, Vcl.Menus,
{ DevExpress}
cxGraphics, dxUIAClasses, cxControls, cxLookAndFeels, cxLookAndFeelPainters,
dxSkinsCore, dxSkinWXI, dxLayoutControlAdapters, dxLayoutcxEditAdapters, cxContainer,
cxEdit, dxLayoutContainer, cxTextEdit, cxButtons, cxClasses, dxLayoutControl,
dxCore, dxSkinsForm, dxLayoutLookAndFeels, cxMemo;
type
TfrmMain = class(TForm)
lgRoot: TdxLayoutGroup;
lcMain: TdxLayoutControl;
btnGetSn: TcxButton;
dxLayoutItem1: TdxLayoutItem;
teCpuSerialNum: TcxTextEdit;
dxLayoutItem2: TdxLayoutItem;
teMbSerialNum: TcxTextEdit;
dxLayoutItem3: TdxLayoutItem;
teHddSerialNum: TcxTextEdit;
dxLayoutItem4: TdxLayoutItem;
dxLayoutLabeledItem1: TdxLayoutLabeledItem;
dxLayoutEmptySpaceItem1: TdxLayoutEmptySpaceItem;
teNetworkMac: TcxTextEdit;
dxLayoutItem5: TdxLayoutItem;
dxLayoutLookAndFeelList: TdxLayoutLookAndFeelList;
dxLayoutSkinLookAndFeel1: TdxLayoutSkinLookAndFeel;
scMain: TdxSkinController;
mmLog: TcxMemo;
dxLayoutItem6: TdxLayoutItem;
procedure btnGetSnClick(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
frmMain: TfrmMain;
implementation
{$R *.dfm}
uses
GO2.SMBios;
procedure TfrmMain.btnGetSnClick(Sender: TObject);
begin
teCpuSerialNum.Text:= GetCPUSerialNumber;
teMbSerialNum.Text:= GetMainboardSerialNumber;
teHddSerialNum.Text:= GetHDDSerialNumber;
teNetworkMac.Text:= GetNetworkAdapterSerialNumber;
mmLog.Text:= GetHardwareInformation;
end;
end.
+20 -1
View File
@@ -1,3 +1,22 @@
# SMBIOS
각종 디바이스 시리얼 넘버 구하기
SMBIOS(System Management BIOS)는 [SMBIOS](http://www.dmtf.org/standards/smbios) DMTF에서 개발한 표준입니다.
![logo](https://github.com/RRUZ/tsmbios/blob/master/images/logo.png) [tsmbios](https://github.com/RRUZ/tsmbios) 델파이 라이브러리를 쉽게 사용하기 위해 델파이 언어로 개발되었습니다.
## Features
* 2024.12.19 버전 1.0으로 샘플을 개발되었습니다.
* 불법 KMS 인증 OS는 CPU가 똑 같은 시리얼을 제공하는것을 발견하였습니다.
## Sample source code
제공되는 함수는 아래와 같습니다.
네트워크는 MAC Address로 제공되며 기본은 유선LAN이며 True면 무선LAN 제공합니다.
``` delphi
function GetCPUSerialNumber: string;
function GetMainboardSerialNumber: string;
function GetHDDSerialNumber: string;
function GetNetworkAdapterSerialNumber(IncludeWireless: Boolean = False): string;
function GetHardwareInformation: string;
```
+16
View File
@@ -0,0 +1,16 @@
program SMBIOS_Sample;
uses
Vcl.Forms,
MainForm in 'Form\MainForm.pas' {frmMain},
GO2.SMBios in 'Utility\GO2.SMBios.pas',
RRUZ.SMBIOS in 'Utility\RRUZ.SMBIOS.pas';
{$R *.res}
begin
Application.Initialize;
Application.MainFormOnTaskbar := True;
Application.CreateForm(TfrmMain, frmMain);
Application.Run;
end.
+1119
View File
File diff suppressed because it is too large Load Diff
+14
View File
@@ -0,0 +1,14 @@
<?xml version="1.0" encoding="utf-8"?>
<BorlandProject>
<Transactions>
<Transaction>1899-12-30 00:00:00.000.759,=D:\Embarcadero\projects\Unit1.pas</Transaction>
<Transaction>1899-12-30 00:00:00.000.690,=D:\Embarcadero\projects\Unit1.pas</Transaction>
<Transaction>1899-12-30 00:00:00.000.251,D:\Embarcadero\projects\Unit1.pas=D:\Embarcadero\projects\SMBIOS\source\Form\MainForm.pas</Transaction>
<Transaction>1899-12-30 00:00:00.000.141,D:\Embarcadero\projects\Project1.dproj=D:\Embarcadero\projects\SMBIOS\source\SMBIOS_Sample.dproj</Transaction>
<Transaction>1899-12-30 00:00:00.000.251,D:\Embarcadero\projects\Unit1.dfm=D:\Embarcadero\projects\SMBIOS\source\Form\MainForm.dfm</Transaction>
<Transaction>1899-12-30 00:00:00.000.716,=D:\Embarcadero\projects\SMBIOS\source\Unit1.pas</Transaction>
<Transaction>1899-12-30 00:00:00.000.447,=D:\Embarcadero\projects\Unit1.pas</Transaction>
<Transaction>1899-12-30 00:00:00.000.509,D:\Embarcadero\projects\SMBIOS\source\Unit1.pas=D:\Embarcadero\projects\SMBIOS\source\Utility\GO2.SMBios.pas</Transaction>
<Transaction>2024-12-19 17:45:07.018,=D:\Embarcadero\projects\SMBIOS\source\Utility\RRUZ.SMBIOS.pas</Transaction>
</Transactions>
</BorlandProject>
Binary file not shown.
BIN
View File
Binary file not shown.
+61
View File
@@ -0,0 +1,61 @@
[ExpressSkins]
Default=0
ShowNotifications=0
Enabled=1
dxSkinBasic=0
dxSkinBlack=0
dxSkinBlue=0
dxSkinBlueprint=0
dxSkinCaramel=0
dxSkinCoffee=0
dxSkinDarkroom=0
dxSkinDarkSide=0
dxSkinDevExpressDarkStyle=0
dxSkinDevExpressStyle=0
dxSkinFoggy=0
dxSkinGlassOceans=0
dxSkinHighContrast=0
dxSkiniMaginary=0
dxSkinLilian=0
dxSkinLiquidSky=0
dxSkinLondonLiquidSky=0
dxSkinMcSkin=0
dxSkinMetropolis=0
dxSkinMetropolisDark=0
dxSkinMoneyTwins=0
dxSkinOffice2007Black=0
dxSkinOffice2007Blue=0
dxSkinOffice2007Green=0
dxSkinOffice2007Pink=0
dxSkinOffice2007Silver=0
dxSkinOffice2010Black=0
dxSkinOffice2010Blue=0
dxSkinOffice2010Silver=0
dxSkinOffice2013DarkGray=0
dxSkinOffice2013LightGray=0
dxSkinOffice2013White=0
dxSkinOffice2016Colorful=0
dxSkinOffice2016Dark=0
dxSkinOffice2019Black=0
dxSkinOffice2019Colorful=0
dxSkinOffice2019DarkGray=0
dxSkinOffice2019White=0
dxSkinPumpkin=0
dxSkinSeven=0
dxSkinSevenClassic=0
dxSkinSharp=0
dxSkinSharpPlus=0
dxSkinSilver=0
dxSkinSpringtime=0
dxSkinStardust=0
dxSkinSummer2008=0
dxSkinTheAsphaltWorld=0
dxSkinTheBezier=0
dxSkinValentine=0
dxSkinVisualStudio2013Blue=0
dxSkinVisualStudio2013Dark=0
dxSkinVisualStudio2013Light=0
dxSkinVS2010=0
dxSkinWhiteprint=0
dxSkinWXI=1
dxSkinXmas2008Blue=0
+183
View File
@@ -0,0 +1,183 @@
// **************************************************************************************************
//
// CPU, HDD, MB 시리얼 넘버를 얻는 많은 방법중
// WMI 서비스를 이용하여 심플하게 받아오는 쉬운방법도 있지만
// 해당 서비스가 실행되고 있어야 하며 관리자권한 및 느리다는 단점이 있다.
//
// 아래 소스는 RRUZ.SMBIOS 라이브러리를 바탕으로
// System Management BIOS 통해 시스템 정보를 읽어 오는 방법이다.
//
// 혹자가 테스트 해 봤을때 불법 KMS로 인증받은 OS는 똑 같은 시리얼이 나온다.
//
// 2024.12.19 by 0GO2
//
// **************************************************************************************************
unit GO2.SMBios;
interface
uses
Winapi.Windows,
Winapi.IpHlpApi,
Winapi.IpTypes,
System.SysUtils;
function GetCPUSerialNumber: string;
function GetMainboardSerialNumber: string;
function GetHDDSerialNumber: string;
function GetNetworkAdapterSerialNumber(IncludeWireless: Boolean = False): string;
function GetHardwareInformation: string;
implementation
uses
RRUZ.SMBIOS;
function GetCPUSerialNumber: string;
var
SMBios: TSMBios;
ProcessorInfo: TProcessorInformation;
begin
Result := '';
SMBios := TSMBios.Create;
try
// ProcessorInfo 정보 가져오기
for ProcessorInfo in SMBios.ProcessorInfo do
begin
// ProcessorID를 16진수 문자열로 변환
Result := IntToHex(ProcessorInfo.RAWProcessorInformation^.ProcessorID, 16);
// 첫 번째 프로세서 정보만 가져오고 종료
Break;
end;
finally
SMBios.Free;
end;
end;
function GetMainboardSerialNumber: string;
var
SMBios: TSMBios;
BaseBoardInfo: TBaseBoardInformation;
begin
Result := '';
SMBios := TSMBios.Create;
try
for BaseBoardInfo in SMBios.BaseBoardInfo do
begin
Result := BaseBoardInfo.SerialNumberStr;
Break;
end;
finally
SMBios.Free;
end;
end;
function GetHDDSerialNumber: string;
var
Drive: string;
SerialNumber: array[0..255] of Char;
VolumeSerialNumber: DWORD;
MaxComponentLength: DWORD;
FileSystemFlags: DWORD;
begin
Drive := 'C:\';
if GetVolumeInformation(PChar(Drive), nil, 0, @VolumeSerialNumber,
MaxComponentLength, FileSystemFlags, nil, 0) then
begin
Result := IntToHex(VolumeSerialNumber, 8);
end
else
Result := '';
end;
function GetNetworkAdapterSerialNumber(IncludeWireless: Boolean = False): string;
const
MIB_IF_TYPE_ETHERNET = 6; // 유선 이더넷
IF_TYPE_IEEE80211 = 71; // 무선 네트워크
var
AdapterInfo: PIP_ADAPTER_INFO;
LongSize: ULONG;
Status: DWORD;
Adapter: PIP_ADAPTER_INFO;
begin
Result := '';
LongSize := 0;
GetAdaptersInfo(nil, LongSize);
if LongSize = 0 then
Exit;
GetMem(AdapterInfo, LongSize);
try
Status := GetAdaptersInfo(AdapterInfo, LongSize);
if Status = ERROR_SUCCESS then
begin
Adapter := AdapterInfo;
while Adapter <> nil do
begin
// 이더넷 또는 무선 어댑터 확인
if (Adapter^.Type_ = MIB_IF_TYPE_ETHERNET) or
(IncludeWireless and (Adapter^.Type_ = IF_TYPE_IEEE80211)) then
begin
Result := Format('%.2x%.2x%.2x%.2x%.2x%.2x',
[Adapter^.Address[0],
Adapter^.Address[1],
Adapter^.Address[2],
Adapter^.Address[3],
Adapter^.Address[4],
Adapter^.Address[5]]);
Break;
end;
Adapter := Adapter^.Next;
end;
end;
finally
FreeMem(AdapterInfo);
end;
end;
function GetHardwareInformation: string;
var
SMBios: TSMBios;
BaseBoardInfo: TBaseBoardInformation;
ProcessorInfo: TProcessorInformation;
begin
Result := '';
SMBios := TSMBios.Create;
try
// CPU 정보
for ProcessorInfo in SMBios.ProcessorInfo do
begin
Result := Result + 'CPU Information:' + #13#10;
// SerialNumberStr는 SMBIOS Type 4의 Serial Number 필드를 읽어오는데,
// 대부분의 CPU는 이 필드를 지원하지 않아 'Unknown'으로 표시된다.
Result := Result + ' Serial Number: ' + IntToHex(ProcessorInfo.RAWProcessorInformation^.ProcessorID, 16) + #13#10;
Result := Result + ' Manufacturer: ' + ProcessorInfo.ProcessorManufacturerStr + #13#10;
Result := Result + ' Version: ' + ProcessorInfo.ProcessorVersionStr + #13#10;
Break;
end;
// 메인보드 정보
for BaseBoardInfo in SMBios.BaseBoardInfo do
begin
Result := Result + #13#10 + 'Mainboard Information:' + #13#10;
Result := Result + ' Serial Number: ' + BaseBoardInfo.SerialNumberStr + #13#10;
Result := Result + ' Manufacturer: ' + BaseBoardInfo.ManufacturerStr + #13#10;
Result := Result + ' Product: ' + BaseBoardInfo.ProductStr + #13#10;
Break;
end;
// HDD 정보
Result := Result + #13#10 + 'HDD Information:' + #13#10;
Result := Result + ' Serial Number: ' + GetHDDSerialNumber + #13#10;
// 네트워크 어댑터 정보
Result := Result + #13#10 + 'Network Adapter Information:' + #13#10;
Result := Result + ' MAC Address (Wired): ' + GetNetworkAdapterSerialNumber + #13#10;
Result := Result + ' MAC Address (All): ' + GetNetworkAdapterSerialNumber(True);
finally
SMBios.Free;
end;
end;
end.
File diff suppressed because it is too large Load Diff