Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-winehq
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-winehq
Commits
2868881c
Commit
2868881c
authored
Sep 17, 2021
by
Brendan Shanks
Committed by
Alexandre Julliard
Sep 20, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ntdll: Factor out SMBIOS table creation.
Signed-off-by:
Brendan Shanks
<
bshanks@codeweavers.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
7c4941d0
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
283 additions
and
195 deletions
+283
-195
system.c
dlls/ntdll/unix/system.c
+283
-195
No files found.
dlls/ntdll/unix/system.c
View file @
2868881c
...
...
@@ -166,6 +166,60 @@ struct smbios_boot_info
#include "poppack.h"
struct
smbios_bios_args
{
const
char
*
vendor
;
size_t
vendor_len
;
const
char
*
version
;
size_t
version_len
;
const
char
*
date
;
size_t
date_len
;
};
struct
smbios_system_args
{
const
char
*
vendor
;
size_t
vendor_len
;
const
char
*
product
;
size_t
product_len
;
const
char
*
version
;
size_t
version_len
;
const
char
*
serial
;
size_t
serial_len
;
GUID
uuid
;
const
char
*
sku
;
size_t
sku_len
;
const
char
*
family
;
size_t
family_len
;
};
struct
smbios_board_args
{
const
char
*
vendor
;
size_t
vendor_len
;
const
char
*
product
;
size_t
product_len
;
const
char
*
version
;
size_t
version_len
;
const
char
*
serial
;
size_t
serial_len
;
const
char
*
asset_tag
;
size_t
asset_tag_len
;
};
struct
smbios_chassis_args
{
const
char
*
vendor
;
size_t
vendor_len
;
BYTE
type
;
const
char
*
version
;
size_t
version_len
;
const
char
*
serial
;
size_t
serial_len
;
const
char
*
asset_tag
;
size_t
asset_tag_len
;
};
/* Firmware table providers */
#define ACPI 0x41435049
#define FIRM 0x4649524D
...
...
@@ -1264,13 +1318,194 @@ static NTSTATUS create_cpuset_info(SYSTEM_CPU_SET_INFORMATION *info)
#ifdef linux
static
void
copy_smbios_string
(
char
**
buffer
,
char
*
s
,
size_t
len
)
static
void
copy_smbios_string
(
char
**
buffer
,
c
onst
c
har
*
s
,
size_t
len
)
{
if
(
!
len
)
return
;
memcpy
(
*
buffer
,
s
,
len
+
1
);
*
buffer
+=
len
+
1
;
}
static
NTSTATUS
create_smbios_tables
(
SYSTEM_FIRMWARE_TABLE_INFORMATION
*
sfti
,
ULONG
available_len
,
ULONG
*
required_len
,
const
struct
smbios_bios_args
*
bios_args
,
const
struct
smbios_system_args
*
system_args
,
const
struct
smbios_board_args
*
board_args
,
const
struct
smbios_chassis_args
*
chassis_args
)
{
char
*
buffer
=
(
char
*
)
sfti
->
TableBuffer
;
BYTE
string_count
;
BYTE
handle_count
=
0
;
struct
smbios_prologue
*
prologue
;
struct
smbios_bios
*
bios
;
struct
smbios_system
*
system
;
struct
smbios_board
*
board
;
struct
smbios_chassis
*
chassis
;
struct
smbios_boot_info
*
boot_info
;
struct
smbios_header
*
end_of_table
;
*
required_len
=
sizeof
(
struct
smbios_prologue
);
#define L(l) (l + (l ? 1 : 0))
*
required_len
+=
sizeof
(
struct
smbios_bios
);
*
required_len
+=
max
(
L
(
bios_args
->
vendor_len
)
+
L
(
bios_args
->
version_len
)
+
L
(
bios_args
->
date_len
)
+
1
,
2
);
*
required_len
+=
sizeof
(
struct
smbios_system
);
*
required_len
+=
max
(
L
(
system_args
->
vendor_len
)
+
L
(
system_args
->
product_len
)
+
L
(
system_args
->
version_len
)
+
L
(
system_args
->
serial_len
)
+
L
(
system_args
->
sku_len
)
+
L
(
system_args
->
family_len
)
+
1
,
2
);
*
required_len
+=
sizeof
(
struct
smbios_board
);
*
required_len
+=
max
(
L
(
board_args
->
vendor_len
)
+
L
(
board_args
->
product_len
)
+
L
(
board_args
->
version_len
)
+
L
(
board_args
->
serial_len
)
+
L
(
board_args
->
asset_tag_len
)
+
1
,
2
);
*
required_len
+=
sizeof
(
struct
smbios_chassis
);
*
required_len
+=
max
(
L
(
chassis_args
->
vendor_len
)
+
L
(
chassis_args
->
version_len
)
+
L
(
chassis_args
->
serial_len
)
+
L
(
chassis_args
->
asset_tag_len
)
+
1
,
2
);
*
required_len
+=
sizeof
(
struct
smbios_boot_info
);
*
required_len
+=
2
;
*
required_len
+=
sizeof
(
struct
smbios_header
);
*
required_len
+=
2
;
#undef L
sfti
->
TableBufferLength
=
*
required_len
;
*
required_len
+=
FIELD_OFFSET
(
SYSTEM_FIRMWARE_TABLE_INFORMATION
,
TableBuffer
);
if
(
available_len
<
*
required_len
)
return
STATUS_BUFFER_TOO_SMALL
;
prologue
=
(
struct
smbios_prologue
*
)
buffer
;
prologue
->
calling_method
=
0
;
prologue
->
major_version
=
2
;
prologue
->
minor_version
=
4
;
prologue
->
revision
=
0
;
prologue
->
length
=
sfti
->
TableBufferLength
-
sizeof
(
struct
smbios_prologue
);
buffer
+=
sizeof
(
struct
smbios_prologue
);
string_count
=
0
;
bios
=
(
struct
smbios_bios
*
)
buffer
;
bios
->
hdr
.
type
=
0
;
bios
->
hdr
.
length
=
sizeof
(
struct
smbios_bios
);
bios
->
hdr
.
handle
=
handle_count
++
;
bios
->
vendor
=
bios_args
->
vendor_len
?
++
string_count
:
0
;
bios
->
version
=
bios_args
->
version_len
?
++
string_count
:
0
;
bios
->
start
=
0
;
bios
->
date
=
bios_args
->
date_len
?
++
string_count
:
0
;
bios
->
size
=
0
;
bios
->
characteristics
=
0x4
;
/* not supported */
bios
->
characteristics_ext
[
0
]
=
0
;
bios
->
characteristics_ext
[
1
]
=
0
;
bios
->
system_bios_major_release
=
0xFF
;
/* not supported */
bios
->
system_bios_minor_release
=
0xFF
;
/* not supported */
bios
->
ec_firmware_major_release
=
0xFF
;
/* not supported */
bios
->
ec_firmware_minor_release
=
0xFF
;
/* not supported */
buffer
+=
sizeof
(
struct
smbios_bios
);
copy_smbios_string
(
&
buffer
,
bios_args
->
vendor
,
bios_args
->
vendor_len
);
copy_smbios_string
(
&
buffer
,
bios_args
->
version
,
bios_args
->
version_len
);
copy_smbios_string
(
&
buffer
,
bios_args
->
date
,
bios_args
->
date_len
);
if
(
!
string_count
)
*
buffer
++
=
0
;
*
buffer
++
=
0
;
string_count
=
0
;
system
=
(
struct
smbios_system
*
)
buffer
;
system
->
hdr
.
type
=
1
;
system
->
hdr
.
length
=
sizeof
(
struct
smbios_system
);
system
->
hdr
.
handle
=
handle_count
++
;
system
->
vendor
=
system_args
->
vendor_len
?
++
string_count
:
0
;
system
->
product
=
system_args
->
product_len
?
++
string_count
:
0
;
system
->
version
=
system_args
->
version_len
?
++
string_count
:
0
;
system
->
serial
=
system_args
->
serial_len
?
++
string_count
:
0
;
memcpy
(
system
->
uuid
,
&
system_args
->
uuid
,
sizeof
(
GUID
)
);
system
->
wake_up_type
=
0x02
;
/* unknown */
system
->
sku_number
=
system_args
->
sku_len
?
++
string_count
:
0
;
system
->
family
=
system_args
->
family_len
?
++
string_count
:
0
;
buffer
+=
sizeof
(
struct
smbios_system
);
copy_smbios_string
(
&
buffer
,
system_args
->
vendor
,
system_args
->
vendor_len
);
copy_smbios_string
(
&
buffer
,
system_args
->
product
,
system_args
->
product_len
);
copy_smbios_string
(
&
buffer
,
system_args
->
version
,
system_args
->
version_len
);
copy_smbios_string
(
&
buffer
,
system_args
->
serial
,
system_args
->
serial_len
);
copy_smbios_string
(
&
buffer
,
system_args
->
sku
,
system_args
->
sku_len
);
copy_smbios_string
(
&
buffer
,
system_args
->
family
,
system_args
->
family_len
);
if
(
!
string_count
)
*
buffer
++
=
0
;
*
buffer
++
=
0
;
string_count
=
0
;
chassis
=
(
struct
smbios_chassis
*
)
buffer
;
chassis
->
hdr
.
type
=
3
;
chassis
->
hdr
.
length
=
sizeof
(
struct
smbios_chassis
);
chassis
->
hdr
.
handle
=
handle_count
++
;
chassis
->
vendor
=
chassis_args
->
vendor_len
?
++
string_count
:
0
;
chassis
->
type
=
chassis_args
->
type
;
chassis
->
version
=
chassis_args
->
version_len
?
++
string_count
:
0
;
chassis
->
serial
=
chassis_args
->
serial_len
?
++
string_count
:
0
;
chassis
->
asset_tag
=
chassis_args
->
asset_tag_len
?
++
string_count
:
0
;
chassis
->
boot_state
=
0x02
;
/* unknown */
chassis
->
power_supply_state
=
0x02
;
/* unknown */
chassis
->
thermal_state
=
0x02
;
/* unknown */
chassis
->
security_status
=
0x02
;
/* unknown */
chassis
->
oem_defined
=
0
;
chassis
->
height
=
0
;
/* undefined */
chassis
->
num_power_cords
=
0
;
/* unspecified */
chassis
->
num_contained_elements
=
0
;
chassis
->
contained_element_rec_length
=
3
;
buffer
+=
sizeof
(
struct
smbios_chassis
);
copy_smbios_string
(
&
buffer
,
chassis_args
->
vendor
,
chassis_args
->
vendor_len
);
copy_smbios_string
(
&
buffer
,
chassis_args
->
version
,
chassis_args
->
version_len
);
copy_smbios_string
(
&
buffer
,
chassis_args
->
serial
,
chassis_args
->
serial_len
);
copy_smbios_string
(
&
buffer
,
chassis_args
->
asset_tag
,
chassis_args
->
asset_tag_len
);
if
(
!
string_count
)
*
buffer
++
=
0
;
*
buffer
++
=
0
;
string_count
=
0
;
board
=
(
struct
smbios_board
*
)
buffer
;
board
->
hdr
.
type
=
2
;
board
->
hdr
.
length
=
sizeof
(
struct
smbios_board
);
board
->
hdr
.
handle
=
handle_count
++
;
board
->
vendor
=
board_args
->
vendor_len
?
++
string_count
:
0
;
board
->
product
=
board_args
->
product_len
?
++
string_count
:
0
;
board
->
version
=
board_args
->
version_len
?
++
string_count
:
0
;
board
->
serial
=
board_args
->
serial_len
?
++
string_count
:
0
;
board
->
asset_tag
=
board_args
->
asset_tag_len
?
++
string_count
:
0
;
board
->
feature_flags
=
0x5
;
/* hosting board, removable */
board
->
location
=
0
;
board
->
chassis_handle
=
chassis
->
hdr
.
handle
;
board
->
board_type
=
0xa
;
/* motherboard */
board
->
num_contained_handles
=
0
;
buffer
+=
sizeof
(
struct
smbios_board
);
copy_smbios_string
(
&
buffer
,
board_args
->
vendor
,
board_args
->
vendor_len
);
copy_smbios_string
(
&
buffer
,
board_args
->
product
,
board_args
->
product_len
);
copy_smbios_string
(
&
buffer
,
board_args
->
version
,
board_args
->
version_len
);
copy_smbios_string
(
&
buffer
,
board_args
->
serial
,
board_args
->
serial_len
);
copy_smbios_string
(
&
buffer
,
board_args
->
asset_tag
,
board_args
->
asset_tag_len
);
if
(
!
string_count
)
*
buffer
++
=
0
;
*
buffer
++
=
0
;
boot_info
=
(
struct
smbios_boot_info
*
)
buffer
;
boot_info
->
hdr
.
type
=
32
;
boot_info
->
hdr
.
length
=
sizeof
(
struct
smbios_boot_info
);
boot_info
->
hdr
.
handle
=
handle_count
++
;
memset
(
boot_info
->
reserved
,
0
,
sizeof
(
boot_info
->
reserved
));
memset
(
boot_info
->
boot_status
,
0
,
sizeof
(
boot_info
->
boot_status
));
/* no errors detected */
buffer
+=
sizeof
(
struct
smbios_boot_info
);
*
buffer
++
=
0
;
*
buffer
++
=
0
;
end_of_table
=
(
struct
smbios_header
*
)
buffer
;
end_of_table
->
type
=
127
;
end_of_table
->
length
=
sizeof
(
struct
smbios_header
);
end_of_table
->
handle
=
handle_count
++
;
buffer
+=
sizeof
(
struct
smbios_header
);
*
buffer
++
=
0
;
*
buffer
++
=
0
;
return
STATUS_SUCCESS
;
}
static
size_t
get_smbios_string
(
const
char
*
path
,
char
*
str
,
size_t
size
)
{
FILE
*
file
;
...
...
@@ -1333,210 +1568,63 @@ static NTSTATUS get_firmware_info( SYSTEM_FIRMWARE_TABLE_INFORMATION *sfti, ULON
case
RSMB
:
{
char
bios_vendor
[
128
],
bios_version
[
128
],
bios_date
[
128
];
s
ize_t
bios_vendor_len
,
bios_version_len
,
bios_date_len
;
s
truct
smbios_bios_args
bios_args
;
char
system_vendor
[
128
],
system_product
[
128
],
system_version
[
128
],
system_serial
[
128
];
size_t
system_vendor_len
,
system_product_len
,
system_version_len
,
system_serial_len
;
char
system_sku
[
128
],
system_family
[
128
];
s
ize_t
system_sku_len
,
system_family_len
;
s
truct
smbios_system_args
system_args
;
char
board_vendor
[
128
],
board_product
[
128
],
board_version
[
128
],
board_serial
[
128
],
board_asset_tag
[
128
];
s
ize_t
board_vendor_len
,
board_product_len
,
board_version_len
,
board_serial_len
,
board_asset_tag_len
;
s
truct
smbios_board_args
board_args
;
char
chassis_vendor
[
128
],
chassis_version
[
128
],
chassis_serial
[
128
],
chassis_asset_tag
[
128
];
char
chassis_type
[
11
]
=
"2"
;
/* unknown */
size_t
chassis_vendor_len
,
chassis_version_len
,
chassis_serial_len
,
chassis_asset_tag_len
;
char
*
buffer
=
(
char
*
)
sfti
->
TableBuffer
;
BYTE
string_count
;
BYTE
handle_count
=
0
;
struct
smbios_prologue
*
prologue
;
struct
smbios_bios
*
bios
;
struct
smbios_system
*
system
;
struct
smbios_board
*
board
;
struct
smbios_chassis
*
chassis
;
struct
smbios_boot_info
*
boot_info
;
struct
smbios_header
*
end_of_table
;
struct
smbios_chassis_args
chassis_args
;
#define S(s) s, sizeof(s)
bios_vendor_len
=
get_smbios_string
(
"/sys/class/dmi/id/bios_vendor"
,
S
(
bios_vendor
));
bios_version_len
=
get_smbios_string
(
"/sys/class/dmi/id/bios_version"
,
S
(
bios_version
));
bios_date_len
=
get_smbios_string
(
"/sys/class/dmi/id/bios_date"
,
S
(
bios_date
));
system_vendor_len
=
get_smbios_string
(
"/sys/class/dmi/id/sys_vendor"
,
S
(
system_vendor
));
system_product_len
=
get_smbios_string
(
"/sys/class/dmi/id/product_name"
,
S
(
system_product
));
system_version_len
=
get_smbios_string
(
"/sys/class/dmi/id/product_version"
,
S
(
system_version
));
system_serial_len
=
get_smbios_string
(
"/sys/class/dmi/id/product_serial"
,
S
(
system_serial
));
system_sku_len
=
get_smbios_string
(
"/sys/class/dmi/id/product_sku"
,
S
(
system_sku
));
system_family_len
=
get_smbios_string
(
"/sys/class/dmi/id/product_family"
,
S
(
system_family
));
board_vendor_len
=
get_smbios_string
(
"/sys/class/dmi/id/board_vendor"
,
S
(
board_vendor
));
board_product_len
=
get_smbios_string
(
"/sys/class/dmi/id/board_name"
,
S
(
board_product
));
board_version_len
=
get_smbios_string
(
"/sys/class/dmi/id/board_version"
,
S
(
board_version
));
board_serial_len
=
get_smbios_string
(
"/sys/class/dmi/id/board_serial"
,
S
(
board_serial
));
board_asset_tag_len
=
get_smbios_string
(
"/sys/class/dmi/id/board_asset_tag"
,
S
(
board_asset_tag
));
chassis_vendor_len
=
get_smbios_string
(
"/sys/class/dmi/id/chassis_vendor"
,
S
(
chassis_vendor
));
chassis_version_len
=
get_smbios_string
(
"/sys/class/dmi/id/chassis_version"
,
S
(
chassis_version
));
chassis_serial_len
=
get_smbios_string
(
"/sys/class/dmi/id/chassis_serial"
,
S
(
chassis_serial
));
chassis_asset_tag_len
=
get_smbios_string
(
"/sys/class/dmi/id/chassis_tag"
,
S
(
chassis_asset_tag
));
bios_args
.
vendor_len
=
get_smbios_string
(
"/sys/class/dmi/id/bios_vendor"
,
S
(
bios_vendor
));
bios_args
.
vendor
=
bios_vendor
;
bios_args
.
version_len
=
get_smbios_string
(
"/sys/class/dmi/id/bios_version"
,
S
(
bios_version
));
bios_args
.
version
=
bios_version
;
bios_args
.
date_len
=
get_smbios_string
(
"/sys/class/dmi/id/bios_date"
,
S
(
bios_date
));
bios_args
.
date
=
bios_date
;
system_args
.
vendor_len
=
get_smbios_string
(
"/sys/class/dmi/id/sys_vendor"
,
S
(
system_vendor
));
system_args
.
vendor
=
system_vendor
;
system_args
.
product_len
=
get_smbios_string
(
"/sys/class/dmi/id/product_name"
,
S
(
system_product
));
system_args
.
product
=
system_product
;
system_args
.
version_len
=
get_smbios_string
(
"/sys/class/dmi/id/product_version"
,
S
(
system_version
));
system_args
.
version
=
system_version
;
system_args
.
serial_len
=
get_smbios_string
(
"/sys/class/dmi/id/product_serial"
,
S
(
system_serial
));
system_args
.
serial
=
system_serial
;
get_system_uuid
(
&
system_args
.
uuid
);
system_args
.
sku_len
=
get_smbios_string
(
"/sys/class/dmi/id/product_sku"
,
S
(
system_sku
));
system_args
.
sku
=
system_sku
;
system_args
.
family_len
=
get_smbios_string
(
"/sys/class/dmi/id/product_family"
,
S
(
system_family
));
system_args
.
family
=
system_family
;
board_args
.
vendor_len
=
get_smbios_string
(
"/sys/class/dmi/id/board_vendor"
,
S
(
board_vendor
));
board_args
.
vendor
=
board_vendor
;
board_args
.
product_len
=
get_smbios_string
(
"/sys/class/dmi/id/board_name"
,
S
(
board_product
));
board_args
.
product
=
board_product
;
board_args
.
version_len
=
get_smbios_string
(
"/sys/class/dmi/id/board_version"
,
S
(
board_version
));
board_args
.
version
=
board_version
;
board_args
.
serial_len
=
get_smbios_string
(
"/sys/class/dmi/id/board_serial"
,
S
(
board_serial
));
board_args
.
serial
=
board_serial
;
board_args
.
asset_tag_len
=
get_smbios_string
(
"/sys/class/dmi/id/board_asset_tag"
,
S
(
board_asset_tag
));
board_args
.
asset_tag
=
board_asset_tag
;
chassis_args
.
vendor_len
=
get_smbios_string
(
"/sys/class/dmi/id/chassis_vendor"
,
S
(
chassis_vendor
));
chassis_args
.
vendor
=
chassis_vendor
;
get_smbios_string
(
"/sys/class/dmi/id/chassis_type"
,
S
(
chassis_type
));
chassis_args
.
type
=
atoi
(
chassis_type
);
chassis_args
.
version_len
=
get_smbios_string
(
"/sys/class/dmi/id/chassis_version"
,
S
(
chassis_version
));
chassis_args
.
version
=
chassis_version
;
chassis_args
.
serial_len
=
get_smbios_string
(
"/sys/class/dmi/id/chassis_serial"
,
S
(
chassis_serial
));
chassis_args
.
serial
=
chassis_serial
;
chassis_args
.
asset_tag_len
=
get_smbios_string
(
"/sys/class/dmi/id/chassis_tag"
,
S
(
chassis_asset_tag
));
chassis_args
.
asset_tag
=
chassis_asset_tag
;
#undef S
*
required_len
=
sizeof
(
struct
smbios_prologue
);
#define L(l) (l + (l ? 1 : 0))
*
required_len
+=
sizeof
(
struct
smbios_bios
);
*
required_len
+=
max
(
L
(
bios_vendor_len
)
+
L
(
bios_version_len
)
+
L
(
bios_date_len
)
+
1
,
2
);
*
required_len
+=
sizeof
(
struct
smbios_system
);
*
required_len
+=
max
(
L
(
system_vendor_len
)
+
L
(
system_product_len
)
+
L
(
system_version_len
)
+
L
(
system_serial_len
)
+
L
(
system_sku_len
)
+
L
(
system_family_len
)
+
1
,
2
);
*
required_len
+=
sizeof
(
struct
smbios_board
);
*
required_len
+=
max
(
L
(
board_vendor_len
)
+
L
(
board_product_len
)
+
L
(
board_version_len
)
+
L
(
board_serial_len
)
+
L
(
board_asset_tag_len
)
+
1
,
2
);
*
required_len
+=
sizeof
(
struct
smbios_chassis
);
*
required_len
+=
max
(
L
(
chassis_vendor_len
)
+
L
(
chassis_version_len
)
+
L
(
chassis_serial_len
)
+
L
(
chassis_asset_tag_len
)
+
1
,
2
);
*
required_len
+=
sizeof
(
struct
smbios_boot_info
);
*
required_len
+=
2
;
*
required_len
+=
sizeof
(
struct
smbios_header
);
*
required_len
+=
2
;
#undef L
sfti
->
TableBufferLength
=
*
required_len
;
*
required_len
+=
FIELD_OFFSET
(
SYSTEM_FIRMWARE_TABLE_INFORMATION
,
TableBuffer
);
if
(
available_len
<
*
required_len
)
return
STATUS_BUFFER_TOO_SMALL
;
prologue
=
(
struct
smbios_prologue
*
)
buffer
;
prologue
->
calling_method
=
0
;
prologue
->
major_version
=
2
;
prologue
->
minor_version
=
4
;
prologue
->
revision
=
0
;
prologue
->
length
=
sfti
->
TableBufferLength
-
sizeof
(
struct
smbios_prologue
);
buffer
+=
sizeof
(
struct
smbios_prologue
);
string_count
=
0
;
bios
=
(
struct
smbios_bios
*
)
buffer
;
bios
->
hdr
.
type
=
0
;
bios
->
hdr
.
length
=
sizeof
(
struct
smbios_bios
);
bios
->
hdr
.
handle
=
handle_count
++
;
bios
->
vendor
=
bios_vendor_len
?
++
string_count
:
0
;
bios
->
version
=
bios_version_len
?
++
string_count
:
0
;
bios
->
start
=
0
;
bios
->
date
=
bios_date_len
?
++
string_count
:
0
;
bios
->
size
=
0
;
bios
->
characteristics
=
0x4
;
/* not supported */
bios
->
characteristics_ext
[
0
]
=
0
;
bios
->
characteristics_ext
[
1
]
=
0
;
bios
->
system_bios_major_release
=
0xFF
;
/* not supported */
bios
->
system_bios_minor_release
=
0xFF
;
/* not supported */
bios
->
ec_firmware_major_release
=
0xFF
;
/* not supported */
bios
->
ec_firmware_minor_release
=
0xFF
;
/* not supported */
buffer
+=
sizeof
(
struct
smbios_bios
);
copy_smbios_string
(
&
buffer
,
bios_vendor
,
bios_vendor_len
);
copy_smbios_string
(
&
buffer
,
bios_version
,
bios_version_len
);
copy_smbios_string
(
&
buffer
,
bios_date
,
bios_date_len
);
if
(
!
string_count
)
*
buffer
++
=
0
;
*
buffer
++
=
0
;
string_count
=
0
;
system
=
(
struct
smbios_system
*
)
buffer
;
system
->
hdr
.
type
=
1
;
system
->
hdr
.
length
=
sizeof
(
struct
smbios_system
);
system
->
hdr
.
handle
=
handle_count
++
;
system
->
vendor
=
system_vendor_len
?
++
string_count
:
0
;
system
->
product
=
system_product_len
?
++
string_count
:
0
;
system
->
version
=
system_version_len
?
++
string_count
:
0
;
system
->
serial
=
system_serial_len
?
++
string_count
:
0
;
get_system_uuid
(
(
GUID
*
)
system
->
uuid
);
system
->
wake_up_type
=
0x02
;
/* unknown */
system
->
sku_number
=
system_sku_len
?
++
string_count
:
0
;
system
->
family
=
system_family_len
?
++
string_count
:
0
;
buffer
+=
sizeof
(
struct
smbios_system
);
copy_smbios_string
(
&
buffer
,
system_vendor
,
system_vendor_len
);
copy_smbios_string
(
&
buffer
,
system_product
,
system_product_len
);
copy_smbios_string
(
&
buffer
,
system_version
,
system_version_len
);
copy_smbios_string
(
&
buffer
,
system_serial
,
system_serial_len
);
copy_smbios_string
(
&
buffer
,
system_sku
,
system_sku_len
);
copy_smbios_string
(
&
buffer
,
system_family
,
system_family_len
);
if
(
!
string_count
)
*
buffer
++
=
0
;
*
buffer
++
=
0
;
string_count
=
0
;
chassis
=
(
struct
smbios_chassis
*
)
buffer
;
chassis
->
hdr
.
type
=
3
;
chassis
->
hdr
.
length
=
sizeof
(
struct
smbios_chassis
);
chassis
->
hdr
.
handle
=
handle_count
++
;
chassis
->
vendor
=
chassis_vendor_len
?
++
string_count
:
0
;
chassis
->
type
=
atoi
(
chassis_type
);
chassis
->
version
=
chassis_version_len
?
++
string_count
:
0
;
chassis
->
serial
=
chassis_serial_len
?
++
string_count
:
0
;
chassis
->
asset_tag
=
chassis_asset_tag_len
?
++
string_count
:
0
;
chassis
->
boot_state
=
0x02
;
/* unknown */
chassis
->
power_supply_state
=
0x02
;
/* unknown */
chassis
->
thermal_state
=
0x02
;
/* unknown */
chassis
->
security_status
=
0x02
;
/* unknown */
chassis
->
oem_defined
=
0
;
chassis
->
height
=
0
;
/* undefined */
chassis
->
num_power_cords
=
0
;
/* unspecified */
chassis
->
num_contained_elements
=
0
;
chassis
->
contained_element_rec_length
=
3
;
buffer
+=
sizeof
(
struct
smbios_chassis
);
copy_smbios_string
(
&
buffer
,
chassis_vendor
,
chassis_vendor_len
);
copy_smbios_string
(
&
buffer
,
chassis_version
,
chassis_version_len
);
copy_smbios_string
(
&
buffer
,
chassis_serial
,
chassis_serial_len
);
copy_smbios_string
(
&
buffer
,
chassis_asset_tag
,
chassis_asset_tag_len
);
if
(
!
string_count
)
*
buffer
++
=
0
;
*
buffer
++
=
0
;
string_count
=
0
;
board
=
(
struct
smbios_board
*
)
buffer
;
board
->
hdr
.
type
=
2
;
board
->
hdr
.
length
=
sizeof
(
struct
smbios_board
);
board
->
hdr
.
handle
=
handle_count
++
;
board
->
vendor
=
board_vendor_len
?
++
string_count
:
0
;
board
->
product
=
board_product_len
?
++
string_count
:
0
;
board
->
version
=
board_version_len
?
++
string_count
:
0
;
board
->
serial
=
board_serial_len
?
++
string_count
:
0
;
board
->
asset_tag
=
board_asset_tag_len
?
++
string_count
:
0
;
board
->
feature_flags
=
0x5
;
/* hosting board, removable */
board
->
location
=
0
;
board
->
chassis_handle
=
chassis
->
hdr
.
handle
;
board
->
board_type
=
0xa
;
/* motherboard */
board
->
num_contained_handles
=
0
;
buffer
+=
sizeof
(
struct
smbios_board
);
copy_smbios_string
(
&
buffer
,
board_vendor
,
board_vendor_len
);
copy_smbios_string
(
&
buffer
,
board_product
,
board_product_len
);
copy_smbios_string
(
&
buffer
,
board_version
,
board_version_len
);
copy_smbios_string
(
&
buffer
,
board_serial
,
board_serial_len
);
copy_smbios_string
(
&
buffer
,
board_asset_tag
,
board_asset_tag_len
);
if
(
!
string_count
)
*
buffer
++
=
0
;
*
buffer
++
=
0
;
boot_info
=
(
struct
smbios_boot_info
*
)
buffer
;
boot_info
->
hdr
.
type
=
32
;
boot_info
->
hdr
.
length
=
sizeof
(
struct
smbios_boot_info
);
boot_info
->
hdr
.
handle
=
handle_count
++
;
memset
(
boot_info
->
reserved
,
0
,
sizeof
(
boot_info
->
reserved
));
memset
(
boot_info
->
boot_status
,
0
,
sizeof
(
boot_info
->
boot_status
));
/* no errors detected */
buffer
+=
sizeof
(
struct
smbios_boot_info
);
*
buffer
++
=
0
;
*
buffer
++
=
0
;
end_of_table
=
(
struct
smbios_header
*
)
buffer
;
end_of_table
->
type
=
127
;
end_of_table
->
length
=
sizeof
(
struct
smbios_header
);
end_of_table
->
handle
=
handle_count
++
;
buffer
+=
sizeof
(
struct
smbios_header
);
*
buffer
++
=
0
;
*
buffer
++
=
0
;
return
STATUS_SUCCESS
;
return
create_smbios_tables
(
sfti
,
available_len
,
required_len
,
&
bios_args
,
&
system_args
,
&
board_args
,
&
chassis_args
);
}
default
:
FIXME
(
"info_class SYSTEM_FIRMWARE_TABLE_INFORMATION provider %08x
\n
"
,
sfti
->
ProviderSignature
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment