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
3b8266d2
Commit
3b8266d2
authored
Oct 12, 2012
by
Hans Leidekker
Committed by
Alexandre Julliard
Oct 12, 2012
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
wbemprox: Always convert from BSTR.
parent
dca427fd
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
40 additions
and
14 deletions
+40
-14
class.c
dlls/wbemprox/class.c
+16
-5
query.c
dlls/wbemprox/query.c
+21
-9
wbemprox_private.h
dlls/wbemprox/wbemprox_private.h
+3
-0
No files found.
dlls/wbemprox/class.c
View file @
3b8266d2
...
...
@@ -232,6 +232,20 @@ static struct record *create_record( const struct column *columns, UINT num_cols
return
record
;
}
void
destroy_array
(
struct
array
*
array
,
CIMTYPE
type
)
{
UINT
i
,
size
;
if
(
!
array
)
return
;
if
(
type
==
CIM_STRING
||
type
==
CIM_DATETIME
)
{
size
=
get_type_size
(
type
);
for
(
i
=
0
;
i
<
array
->
count
;
i
++
)
heap_free
(
*
(
WCHAR
**
)((
char
*
)
array
->
ptr
+
i
*
size
)
);
}
heap_free
(
array
->
ptr
);
heap_free
(
array
);
}
static
void
destroy_record
(
struct
record
*
record
)
{
UINT
i
;
...
...
@@ -241,11 +255,8 @@ static void destroy_record( struct record *record )
{
if
(
record
->
fields
[
i
].
type
==
CIM_STRING
||
record
->
fields
[
i
].
type
==
CIM_DATETIME
)
heap_free
(
record
->
fields
[
i
].
u
.
sval
);
else
if
((
record
->
fields
[
i
].
type
&
CIM_FLAG_ARRAY
)
&&
record
->
fields
[
i
].
u
.
aval
)
{
heap_free
(
record
->
fields
[
i
].
u
.
aval
->
ptr
);
heap_free
(
record
->
fields
[
i
].
u
.
aval
);
}
else
if
(
record
->
fields
[
i
].
type
&
CIM_FLAG_ARRAY
)
destroy_array
(
record
->
fields
[
i
].
u
.
aval
,
record
->
fields
[
i
].
type
&
CIM_TYPE_MASK
);
}
heap_free
(
record
->
fields
);
heap_free
(
record
);
...
...
dlls/wbemprox/query.c
View file @
3b8266d2
...
...
@@ -639,8 +639,6 @@ static void set_variant( VARTYPE type, LONGLONG val, void *val_ptr, VARIANT *ret
V_VT
(
ret
)
=
type
;
}
#define CIM_TYPE_MASK 0xfff
HRESULT
get_propval
(
const
struct
view
*
view
,
UINT
index
,
const
WCHAR
*
name
,
VARIANT
*
ret
,
CIMTYPE
*
type
,
LONG
*
flavor
)
{
...
...
@@ -750,19 +748,33 @@ static struct array *to_array( VARIANT *var, CIMTYPE *type )
ret
->
count
=
bound
+
1
;
size
=
get_type_size
(
basetype
);
if
(
!
(
ret
->
ptr
=
heap_alloc
(
ret
->
count
*
size
)))
if
(
!
(
ret
->
ptr
=
heap_alloc
_zero
(
ret
->
count
*
size
)))
{
heap_free
(
ret
);
return
NULL
;
}
for
(
i
=
0
;
i
<
ret
->
count
;
i
++
)
{
if
(
SafeArrayGetElement
(
V_ARRAY
(
var
),
&
i
,
(
char
*
)
ret
->
ptr
+
i
*
size
)
!=
S_OK
)
void
*
ptr
=
(
char
*
)
ret
->
ptr
+
i
*
size
;
if
(
vartype
==
VT_BSTR
)
{
BSTR
str
;
if
(
SafeArrayGetElement
(
V_ARRAY
(
var
),
&
i
,
&
str
)
!=
S_OK
)
{
destroy_array
(
ret
,
basetype
);
return
NULL
;
}
*
(
WCHAR
**
)
ptr
=
heap_strdupW
(
str
);
SysFreeString
(
str
);
if
(
!*
(
WCHAR
**
)
ptr
)
{
destroy_array
(
ret
,
basetype
);
return
NULL
;
}
}
else
if
(
SafeArrayGetElement
(
V_ARRAY
(
var
),
&
i
,
ptr
)
!=
S_OK
)
{
if
(
vartype
==
VT_BSTR
)
for
(
i
--
;
i
>=
0
;
i
--
)
SysFreeString
(
*
(
BSTR
*
)(
char
*
)
ret
->
ptr
+
i
*
size
);
heap_free
(
ret
->
ptr
);
heap_free
(
ret
);
destroy_array
(
ret
,
basetype
);
return
NULL
;
}
}
...
...
@@ -790,7 +802,7 @@ HRESULT to_longlong( VARIANT *var, LONGLONG *val, CIMTYPE *type )
*
type
=
CIM_BOOLEAN
;
break
;
case
VT_BSTR
:
*
val
=
(
INT_PTR
)
SysAllocString
(
V_BSTR
(
var
)
);
*
val
=
(
INT_PTR
)
heap_strdupW
(
V_BSTR
(
var
)
);
if
(
!*
val
)
return
E_OUTOFMEMORY
;
*
type
=
CIM_STRING
;
break
;
...
...
dlls/wbemprox/wbemprox_private.h
View file @
3b8266d2
...
...
@@ -31,6 +31,8 @@ enum param_direction
PARAM_IN
=
1
};
#define CIM_TYPE_MASK 0x00000fff
#define COL_TYPE_MASK 0x0000ffff
#define COL_FLAG_DYNAMIC 0x00010000
#define COL_FLAG_KEY 0x00020000
...
...
@@ -177,6 +179,7 @@ HRESULT get_propval( const struct view *, UINT, const WCHAR *, VARIANT *,
HRESULT
put_propval
(
const
struct
view
*
,
UINT
,
const
WCHAR
*
,
VARIANT
*
,
CIMTYPE
)
DECLSPEC_HIDDEN
;
HRESULT
to_longlong
(
VARIANT
*
,
LONGLONG
*
,
CIMTYPE
*
)
DECLSPEC_HIDDEN
;
SAFEARRAY
*
to_safearray
(
const
struct
array
*
,
CIMTYPE
)
DECLSPEC_HIDDEN
;
void
destroy_array
(
struct
array
*
,
CIMTYPE
)
DECLSPEC_HIDDEN
;
HRESULT
get_properties
(
const
struct
view
*
,
SAFEARRAY
**
)
DECLSPEC_HIDDEN
;
HRESULT
get_object
(
const
WCHAR
*
,
IWbemClassObject
**
)
DECLSPEC_HIDDEN
;
BSTR
get_method_name
(
const
WCHAR
*
,
UINT
)
DECLSPEC_HIDDEN
;
...
...
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