Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-cw
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-cw
Commits
3995b5ec
Commit
3995b5ec
authored
Aug 27, 2019
by
Hans Leidekker
Committed by
Alexandre Julliard
Aug 27, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
wbemprox: Store the element size in struct array.
Signed-off-by:
Hans Leidekker
<
hans@codeweavers.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
4e71e867
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
33 additions
and
31 deletions
+33
-31
builtin.c
dlls/wbemprox/builtin.c
+25
-20
class.c
dlls/wbemprox/class.c
+2
-4
query.c
dlls/wbemprox/query.c
+5
-7
wbemprox_private.h
dlls/wbemprox/wbemprox_private.h
+1
-0
No files found.
dlls/wbemprox/builtin.c
View file @
3995b5ec
...
...
@@ -1251,6 +1251,7 @@ static UINT16 systemenclosure_chassistypes[] =
};
static
const
struct
array
systemenclosure_chassistypes_array
=
{
sizeof
(
*
systemenclosure_chassistypes
),
ARRAY_SIZE
(
systemenclosure_chassistypes
),
&
systemenclosure_chassistypes
};
...
...
@@ -2484,8 +2485,9 @@ static struct array *get_defaultipgateway( IP_ADAPTER_GATEWAY_ADDRESS *list )
return
NULL
;
}
}
ret
->
count
=
count
;
ret
->
ptr
=
ptr
;
ret
->
elem_size
=
sizeof
(
*
ptr
);
ret
->
count
=
count
;
ret
->
ptr
=
ptr
;
return
ret
;
}
static
struct
array
*
get_dnsserversearchorder
(
IP_ADAPTER_DNS_SERVER_ADDRESS
*
list
)
...
...
@@ -2517,8 +2519,9 @@ static struct array *get_dnsserversearchorder( IP_ADAPTER_DNS_SERVER_ADDRESS *li
}
if
((
p
=
wcsrchr
(
ptr
[
i
-
1
],
':'
)))
*
p
=
0
;
}
ret
->
count
=
count
;
ret
->
ptr
=
ptr
;
ret
->
elem_size
=
sizeof
(
*
ptr
);
ret
->
count
=
count
;
ret
->
ptr
=
ptr
;
return
ret
;
}
static
struct
array
*
get_ipaddress
(
IP_ADAPTER_UNICAST_ADDRESS_LH
*
list
)
...
...
@@ -2549,8 +2552,9 @@ static struct array *get_ipaddress( IP_ADAPTER_UNICAST_ADDRESS_LH *list )
return
NULL
;
}
}
ret
->
count
=
count
;
ret
->
ptr
=
ptr
;
ret
->
elem_size
=
sizeof
(
*
ptr
);
ret
->
count
=
count
;
ret
->
ptr
=
ptr
;
return
ret
;
}
static
struct
array
*
get_ipsubnet
(
IP_ADAPTER_UNICAST_ADDRESS_LH
*
list
)
...
...
@@ -2601,8 +2605,9 @@ static struct array *get_ipsubnet( IP_ADAPTER_UNICAST_ADDRESS_LH *list )
return
NULL
;
}
}
ret
->
count
=
count
;
ret
->
ptr
=
ptr
;
ret
->
elem_size
=
sizeof
(
*
ptr
);
ret
->
count
=
count
;
ret
->
ptr
=
ptr
;
return
ret
;
}
static
WCHAR
*
get_settingid
(
UINT32
index
)
...
...
@@ -3458,20 +3463,20 @@ static WCHAR *get_accountname( LSA_TRANSLATED_NAME *name )
}
static
struct
array
*
get_binaryrepresentation
(
PSID
sid
,
UINT
len
)
{
struct
array
*
array
=
heap_alloc
(
sizeof
(
struct
array
)
);
if
(
array
)
struct
array
*
ret
;
UINT8
*
ptr
;
if
(
!
(
ret
=
heap_alloc
(
sizeof
(
*
ret
)
)))
return
NULL
;
if
(
!
(
ptr
=
heap_alloc
(
len
)))
{
UINT8
*
ret
=
heap_alloc
(
len
);
if
(
ret
)
{
memcpy
(
ret
,
sid
,
len
);
array
->
count
=
len
;
array
->
ptr
=
ret
;
return
array
;
}
heap_free
(
array
);
heap_free
(
ret
);
return
NULL
;
}
return
NULL
;
memcpy
(
ptr
,
sid
,
len
);
ret
->
elem_size
=
sizeof
(
*
ptr
);
ret
->
count
=
len
;
ret
->
ptr
=
ptr
;
return
ret
;
}
static
WCHAR
*
get_referenceddomainname
(
LSA_REFERENCED_DOMAIN_LIST
*
domain
)
{
...
...
dlls/wbemprox/class.c
View file @
3995b5ec
...
...
@@ -235,13 +235,11 @@ static struct record *create_record( struct table *table )
void
destroy_array
(
struct
array
*
array
,
CIMTYPE
type
)
{
UINT
i
,
size
;
UINT
i
;
if
(
!
array
)
return
;
if
(
type
==
CIM_STRING
||
type
==
CIM_DATETIME
||
type
==
CIM_REFERENCE
)
{
size
=
get_type_size
(
type
);
for
(
i
=
0
;
i
<
array
->
count
;
i
++
)
heap_free
(
*
(
WCHAR
**
)((
char
*
)
array
->
ptr
+
i
*
size
)
);
for
(
i
=
0
;
i
<
array
->
count
;
i
++
)
heap_free
(
*
(
WCHAR
**
)((
char
*
)
array
->
ptr
+
i
*
array
->
elem_size
)
);
}
heap_free
(
array
->
ptr
);
heap_free
(
array
);
...
...
dlls/wbemprox/query.c
View file @
3995b5ec
...
...
@@ -765,7 +765,6 @@ VARTYPE to_vartype( CIMTYPE type )
SAFEARRAY
*
to_safearray
(
const
struct
array
*
array
,
CIMTYPE
type
)
{
SAFEARRAY
*
ret
;
UINT
size
=
get_type_size
(
type
);
VARTYPE
vartype
=
to_vartype
(
type
);
LONG
i
;
...
...
@@ -773,7 +772,7 @@ SAFEARRAY *to_safearray( const struct array *array, CIMTYPE type )
for
(
i
=
0
;
i
<
array
->
count
;
i
++
)
{
void
*
ptr
=
(
char
*
)
array
->
ptr
+
i
*
size
;
void
*
ptr
=
(
char
*
)
array
->
ptr
+
i
*
array
->
elem_
size
;
if
(
vartype
==
VT_BSTR
)
{
BSTR
str
=
SysAllocString
(
*
(
const
WCHAR
**
)
ptr
);
...
...
@@ -951,23 +950,22 @@ static struct array *to_array( VARIANT *var, CIMTYPE *type )
LONG
bound
,
i
;
VARTYPE
vartype
;
CIMTYPE
basetype
;
UINT
size
;
if
(
SafeArrayGetVartype
(
V_ARRAY
(
var
),
&
vartype
)
!=
S_OK
)
return
NULL
;
if
(
!
(
basetype
=
to_cimtype
(
vartype
)))
return
NULL
;
if
(
SafeArrayGetUBound
(
V_ARRAY
(
var
),
1
,
&
bound
)
!=
S_OK
)
return
NULL
;
if
(
!
(
ret
=
heap_alloc
(
sizeof
(
struct
array
)
)))
return
NULL
;
ret
->
count
=
bound
+
1
;
size
=
get_type_size
(
basetype
);
if
(
!
(
ret
->
ptr
=
heap_alloc_zero
(
ret
->
count
*
size
)))
ret
->
count
=
bound
+
1
;
ret
->
elem_
size
=
get_type_size
(
basetype
);
if
(
!
(
ret
->
ptr
=
heap_alloc_zero
(
ret
->
count
*
ret
->
elem_
size
)))
{
heap_free
(
ret
);
return
NULL
;
}
for
(
i
=
0
;
i
<
ret
->
count
;
i
++
)
{
void
*
ptr
=
(
char
*
)
ret
->
ptr
+
i
*
size
;
void
*
ptr
=
(
char
*
)
ret
->
ptr
+
i
*
ret
->
elem_
size
;
if
(
vartype
==
VT_BSTR
)
{
BSTR
str
;
...
...
dlls/wbemprox/wbemprox_private.h
View file @
3995b5ec
...
...
@@ -124,6 +124,7 @@ struct property
struct
array
{
UINT
elem_size
;
UINT
count
;
void
*
ptr
;
};
...
...
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