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
97b9d8dd
Commit
97b9d8dd
authored
Nov 23, 2022
by
Paul Gofman
Committed by
Alexandre Julliard
Nov 24, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
wmic: Handle VariantChangeType() failures.
wmic currently crashes on, e. g., VT_EMPTY or VT_ARRAY types returned.
parent
85b84a94
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
2 deletions
+15
-2
main.c
programs/wmic/main.c
+15
-2
No files found.
programs/wmic/main.c
View file @
97b9d8dd
...
...
@@ -165,6 +165,19 @@ static HRESULT process_property_list( IWbemClassObject *obj, const WCHAR *propli
return
hr
;
}
static
void
convert_to_bstr
(
VARIANT
*
v
)
{
VARTYPE
vt
;
if
(
SUCCEEDED
(
VariantChangeType
(
v
,
v
,
0
,
VT_BSTR
)))
return
;
vt
=
V_VT
(
v
);
VariantClear
(
v
);
V_VT
(
v
)
=
VT_BSTR
;
V_BSTR
(
v
)
=
SysAllocString
(
L""
);
if
(
vt
!=
VT_NULL
&&
vt
!=
VT_EMPTY
)
WINE_FIXME
(
"Could not convert variant, vt %u.
\n
"
,
vt
);
}
static
int
query_prop
(
const
WCHAR
*
class
,
const
WCHAR
*
propnames
)
{
HRESULT
hr
;
...
...
@@ -227,7 +240,7 @@ static int query_prop( const WCHAR *class, const WCHAR *propnames )
IWbemClassObject_BeginEnumeration
(
obj
,
0
);
while
(
IWbemClassObject_Next
(
obj
,
0
,
&
name
,
&
v
,
NULL
,
NULL
)
==
S_OK
)
{
VariantChangeType
(
&
v
,
&
v
,
0
,
VT_BSTR
);
convert_to_bstr
(
&
v
);
width
=
max
(
lstrlenW
(
V_BSTR
(
&
v
)
),
width
);
VariantClear
(
&
v
);
SysFreeString
(
name
);
...
...
@@ -261,7 +274,7 @@ static int query_prop( const WCHAR *class, const WCHAR *propnames )
IWbemClassObject_BeginEnumeration
(
obj
,
0
);
while
(
IWbemClassObject_Next
(
obj
,
0
,
NULL
,
&
v
,
NULL
,
NULL
)
==
S_OK
)
{
VariantChangeType
(
&
v
,
&
v
,
0
,
VT_BSTR
);
convert_to_bstr
(
&
v
);
output_text
(
V_BSTR
(
&
v
),
width
);
VariantClear
(
&
v
);
}
...
...
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