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
e1169dfa
Commit
e1169dfa
authored
Nov 28, 2022
by
Mohamad Al-Jaf
Committed by
Alexandre Julliard
Jan 27, 2023
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
windows.system.profile.systemmanufacturers: Implement ISmbiosInformationStatics_get_SerialNumber.
Wine-Bug:
https://bugs.winehq.org/show_bug.cgi?id=53747
parent
d58a24d9
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
65 additions
and
5 deletions
+65
-5
Makefile.in
dlls/windows.system.profile.systemmanufacturers/Makefile.in
+1
-1
main.c
dlls/windows.system.profile.systemmanufacturers/main.c
+60
-2
private.h
dlls/windows.system.profile.systemmanufacturers/private.h
+2
-0
smbios.c
...windows.system.profile.systemmanufacturers/tests/smbios.c
+2
-2
No files found.
dlls/windows.system.profile.systemmanufacturers/Makefile.in
View file @
e1169dfa
MODULE
=
windows.system.profile.systemmanufacturers.dll
MODULE
=
windows.system.profile.systemmanufacturers.dll
IMPORTS
=
combase
IMPORTS
=
combase
oleaut32
C_SRCS
=
\
C_SRCS
=
\
main.c
main.c
...
...
dlls/windows.system.profile.systemmanufacturers/main.c
View file @
e1169dfa
...
@@ -128,10 +128,68 @@ static const struct IActivationFactoryVtbl factory_vtbl =
...
@@ -128,10 +128,68 @@ static const struct IActivationFactoryVtbl factory_vtbl =
DEFINE_IINSPECTABLE
(
statics
,
ISmbiosInformationStatics
,
struct
smbios_statics
,
IActivationFactory_iface
)
DEFINE_IINSPECTABLE
(
statics
,
ISmbiosInformationStatics
,
struct
smbios_statics
,
IActivationFactory_iface
)
static
HRESULT
get_bios_serialnumber
(
BSTR
*
value
)
{
const
WCHAR
*
class
=
L"Win32_BIOS"
;
IEnumWbemClassObject
*
wbem_enum
;
IWbemClassObject
*
wbem_class
;
IWbemServices
*
wbem_service
;
IWbemLocator
*
wbem_locator
;
VARIANT
serial
;
ULONG
count
;
HRESULT
hr
;
BSTR
bstr
;
hr
=
CoCreateInstance
(
&
CLSID_WbemLocator
,
NULL
,
CLSCTX_INPROC_SERVER
,
&
IID_IWbemLocator
,
(
void
**
)
&
wbem_locator
);
if
(
FAILED
(
hr
))
return
hr
;
bstr
=
SysAllocString
(
L"ROOT
\\
CIMV2"
);
if
(
!
bstr
)
{
IWbemLocator_Release
(
wbem_locator
);
return
E_OUTOFMEMORY
;
}
hr
=
IWbemLocator_ConnectServer
(
wbem_locator
,
bstr
,
NULL
,
NULL
,
NULL
,
0
,
NULL
,
NULL
,
&
wbem_service
);
IWbemLocator_Release
(
wbem_locator
);
SysFreeString
(
bstr
);
if
(
FAILED
(
hr
))
return
hr
;
bstr
=
SysAllocString
(
class
);
if
(
!
bstr
)
{
IWbemServices_Release
(
wbem_service
);
return
E_OUTOFMEMORY
;
}
hr
=
IWbemServices_CreateInstanceEnum
(
wbem_service
,
bstr
,
WBEM_FLAG_SYSTEM_ONLY
,
NULL
,
&
wbem_enum
);
IWbemServices_Release
(
wbem_service
);
SysFreeString
(
bstr
);
if
(
FAILED
(
hr
))
return
hr
;
hr
=
IEnumWbemClassObject_Next
(
wbem_enum
,
1000
,
1
,
&
wbem_class
,
&
count
);
IEnumWbemClassObject_Release
(
wbem_enum
);
if
(
FAILED
(
hr
))
return
hr
;
hr
=
IWbemClassObject_Get
(
wbem_class
,
L"SerialNumber"
,
0
,
&
serial
,
NULL
,
NULL
);
IWbemClassObject_Release
(
wbem_class
);
if
(
FAILED
(
hr
))
return
hr
;
*
value
=
V_BSTR
(
&
serial
);
VariantClear
(
&
serial
);
return
hr
;
}
static
HRESULT
WINAPI
statics_get_SerialNumber
(
ISmbiosInformationStatics
*
iface
,
HSTRING
*
value
)
static
HRESULT
WINAPI
statics_get_SerialNumber
(
ISmbiosInformationStatics
*
iface
,
HSTRING
*
value
)
{
{
FIXME
(
"iface %p, value %p stub!
\n
"
,
iface
,
value
);
BSTR
serial
;
return
E_NOTIMPL
;
HRESULT
hr
;
TRACE
(
"iface %p, value %p.
\n
"
,
iface
,
value
);
if
(
FAILED
(
hr
=
get_bios_serialnumber
(
&
serial
)
))
return
hr
;
if
(
FAILED
(
hr
=
WindowsCreateString
(
serial
,
wcslen
(
serial
),
value
)
))
return
hr
;
TRACE
(
"Returning serial number: %s.
\n
"
,
debugstr_w
(
serial
)
);
return
hr
;
}
}
static
const
struct
ISmbiosInformationStaticsVtbl
statics_vtbl
=
static
const
struct
ISmbiosInformationStaticsVtbl
statics_vtbl
=
...
...
dlls/windows.system.profile.systemmanufacturers/private.h
View file @
e1169dfa
...
@@ -30,6 +30,8 @@
...
@@ -30,6 +30,8 @@
#define WIDL_using_Windows_System_Profile_SystemManufacturers
#define WIDL_using_Windows_System_Profile_SystemManufacturers
#include "windows.system.profile.systemmanufacturers.h"
#include "windows.system.profile.systemmanufacturers.h"
#include "wbemcli.h"
#define DEFINE_IINSPECTABLE_( pfx, iface_type, impl_type, impl_from, iface_mem, expr ) \
#define DEFINE_IINSPECTABLE_( pfx, iface_type, impl_type, impl_from, iface_mem, expr ) \
static inline impl_type *impl_from( iface_type *iface ) \
static inline impl_type *impl_from( iface_type *iface ) \
{ \
{ \
...
...
dlls/windows.system.profile.systemmanufacturers/tests/smbios.c
View file @
e1169dfa
...
@@ -75,11 +75,11 @@ static void test_Smbios_Statics(void)
...
@@ -75,11 +75,11 @@ static void test_Smbios_Statics(void)
if
(
0
)
/* Win8 Crash */
if
(
0
)
/* Win8 Crash */
{
{
hr
=
ISmbiosInformationStatics_get_SerialNumber
(
smbios_statics
,
&
serial
);
hr
=
ISmbiosInformationStatics_get_SerialNumber
(
smbios_statics
,
&
serial
);
todo_wine
ok
(
hr
==
S_OK
||
broken
(
hr
==
E_UNEXPECTED
),
"got hr %#lx.
\n
"
,
hr
);
ok
(
hr
==
S_OK
||
broken
(
hr
==
E_UNEXPECTED
),
"got hr %#lx.
\n
"
,
hr
);
if
(
hr
==
S_OK
)
if
(
hr
==
S_OK
)
{
{
buf
=
WindowsGetStringRawBuffer
(
serial
,
&
len
);
buf
=
WindowsGetStringRawBuffer
(
serial
,
&
len
);
todo_wine
ok
(
buf
!=
NULL
&&
len
>
0
,
"WindowsGetStringRawBuffer returned buf %p, len %u
\n
"
,
buf
,
len
);
ok
(
buf
!=
NULL
&&
len
>
0
,
"WindowsGetStringRawBuffer returned buf %p, len %u
\n
"
,
buf
,
len
);
WindowsDeleteString
(
serial
);
WindowsDeleteString
(
serial
);
}
}
}
}
...
...
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