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
fb675cef
Commit
fb675cef
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 get_smbios_from_iokit().
Signed-off-by:
Brendan Shanks
<
bshanks@codeweavers.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
2868881c
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
63 additions
and
55 deletions
+63
-55
system.c
dlls/ntdll/unix/system.c
+63
-55
No files found.
dlls/ntdll/unix/system.c
View file @
fb675cef
...
...
@@ -1634,72 +1634,80 @@ static NTSTATUS get_firmware_info( SYSTEM_FIRMWARE_TABLE_INFORMATION *sfti, ULON
#elif defined(__APPLE__)
static
NTSTATUS
get_
firmware_info
(
SYSTEM_FIRMWARE_TABLE_INFORMATION
*
sfti
,
ULONG
available_len
,
ULONG
*
required_len
)
static
NTSTATUS
get_
smbios_from_iokit
(
SYSTEM_FIRMWARE_TABLE_INFORMATION
*
sfti
,
ULONG
available_len
,
ULONG
*
required_len
)
{
switch
(
sfti
->
ProviderSignature
)
io_service_t
service
;
CFDataRef
data
;
const
UInt8
*
ptr
;
CFIndex
len
;
struct
smbios_prologue
*
prologue
;
BYTE
major_version
=
2
,
minor_version
=
0
;
if
(
!
(
service
=
IOServiceGetMatchingService
(
kIOMasterPortDefault
,
IOServiceMatching
(
"AppleSMBIOS"
))))
{
case
RSMB
:
WARN
(
"can't find AppleSMBIOS service
\n
"
);
return
STATUS_NO_MEMORY
;
}
if
(
!
(
data
=
IORegistryEntryCreateCFProperty
(
service
,
CFSTR
(
"SMBIOS-EPS"
),
kCFAllocatorDefault
,
0
)))
{
io_service_t
service
;
CFDataRef
data
;
const
UInt8
*
ptr
;
CFIndex
len
;
struct
smbios_prologue
*
prologue
;
BYTE
major_version
=
2
,
minor_version
=
0
;
WARN
(
"can't find SMBIOS entry point
\n
"
);
IOObjectRelease
(
service
);
return
STATUS_NO_MEMORY
;
}
if
(
!
(
service
=
IOServiceGetMatchingService
(
kIOMasterPortDefault
,
IOServiceMatching
(
"AppleSMBIOS"
))))
{
WARN
(
"can't find AppleSMBIOS service
\n
"
);
return
STATUS_NO_MEMORY
;
}
len
=
CFDataGetLength
(
data
);
ptr
=
CFDataGetBytePtr
(
data
);
if
(
len
>=
8
&&
!
memcmp
(
ptr
,
"_SM_"
,
4
))
{
major_version
=
ptr
[
6
];
minor_version
=
ptr
[
7
];
}
CFRelease
(
data
);
if
(
!
(
data
=
IORegistryEntryCreateCFProperty
(
service
,
CFSTR
(
"SMBIOS-EP
S"
),
kCFAllocatorDefault
,
0
)))
{
WARN
(
"can't find SMBIOS entry point
\n
"
);
IOObjectRelease
(
service
);
return
STATUS_NO_MEMORY
;
}
if
(
!
(
data
=
IORegistryEntryCreateCFProperty
(
service
,
CFSTR
(
"SMBIO
S"
),
kCFAllocatorDefault
,
0
)))
{
WARN
(
"can't find SMBIOS table
\n
"
);
IOObjectRelease
(
service
);
return
STATUS_NO_MEMORY
;
}
len
=
CFDataGetLength
(
data
);
ptr
=
CFDataGetBytePtr
(
data
);
if
(
len
>=
8
&&
!
memcmp
(
ptr
,
"_SM_"
,
4
))
{
major_version
=
ptr
[
6
];
minor_version
=
ptr
[
7
];
}
len
=
CFDataGetLength
(
data
);
ptr
=
CFDataGetBytePtr
(
data
);
sfti
->
TableBufferLength
=
sizeof
(
*
prologue
)
+
len
;
*
required_len
=
sfti
->
TableBufferLength
+
FIELD_OFFSET
(
SYSTEM_FIRMWARE_TABLE_INFORMATION
,
TableBuffer
);
if
(
available_len
<
*
required_len
)
{
CFRelease
(
data
);
IOObjectRelease
(
service
);
return
STATUS_BUFFER_TOO_SMALL
;
}
if
(
!
(
data
=
IORegistryEntryCreateCFProperty
(
service
,
CFSTR
(
"SMBIOS"
),
kCFAllocatorDefault
,
0
)))
{
WARN
(
"can't find SMBIOS table
\n
"
);
IOObjectRelease
(
service
);
return
STATUS_NO_MEMORY
;
}
len
=
CFDataGetLength
(
data
);
ptr
=
CFDataGetBytePtr
(
data
);
sfti
->
TableBufferLength
=
sizeof
(
*
prologue
)
+
len
;
*
required_len
=
sfti
->
TableBufferLength
+
FIELD_OFFSET
(
SYSTEM_FIRMWARE_TABLE_INFORMATION
,
TableBuffer
);
if
(
available_len
<
*
required_len
)
{
CFRelease
(
data
);
IOObjectRelease
(
service
);
return
STATUS_BUFFER_TOO_SMALL
;
}
prologue
=
(
struct
smbios_prologue
*
)
sfti
->
TableBuffer
;
prologue
->
calling_method
=
0
;
prologue
->
major_version
=
major_version
;
prologue
->
minor_version
=
minor_version
;
prologue
->
revision
=
0
;
prologue
->
length
=
sfti
->
TableBufferLength
-
sizeof
(
*
prologue
);
prologue
=
(
struct
smbios_prologue
*
)
sfti
->
TableBuffer
;
prologue
->
calling_method
=
0
;
prologue
->
major_version
=
major_version
;
prologue
->
minor_version
=
minor_version
;
prologue
->
revision
=
0
;
prologue
->
length
=
sfti
->
TableBufferLength
-
sizeof
(
*
prologue
);
memcpy
(
sfti
->
TableBuffer
+
sizeof
(
*
prologue
),
ptr
,
len
);
memcpy
(
sfti
->
TableBuffer
+
sizeof
(
*
prologue
),
ptr
,
len
);
CFRelease
(
data
);
IOObjectRelease
(
service
);
return
STATUS_SUCCESS
;
}
CFRelease
(
data
);
IOObjectRelease
(
service
);
return
STATUS_SUCCESS
;
static
NTSTATUS
get_firmware_info
(
SYSTEM_FIRMWARE_TABLE_INFORMATION
*
sfti
,
ULONG
available_len
,
ULONG
*
required_len
)
{
switch
(
sfti
->
ProviderSignature
)
{
case
RSMB
:
{
NTSTATUS
ret
;
ret
=
get_smbios_from_iokit
(
sfti
,
available_len
,
required_len
);
return
ret
;
}
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