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
f9300859
Commit
f9300859
authored
Jul 25, 2012
by
Hans Leidekker
Committed by
Alexandre Julliard
Jul 25, 2012
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
wbemprox: Implement IWbemClassObject::GetMethod.
parent
317d0028
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
194 additions
and
7 deletions
+194
-7
class.c
dlls/wbemprox/class.c
+170
-2
table.c
dlls/wbemprox/table.c
+10
-5
wbemprox_private.h
dlls/wbemprox/wbemprox_private.h
+14
-0
No files found.
dlls/wbemprox/class.c
View file @
f9300859
...
@@ -441,6 +441,163 @@ static HRESULT WINAPI class_object_InheritsFrom(
...
@@ -441,6 +441,163 @@ static HRESULT WINAPI class_object_InheritsFrom(
return
E_NOTIMPL
;
return
E_NOTIMPL
;
}
}
static
UINT
count_instances
(
IEnumWbemClassObject
*
iter
)
{
UINT
count
=
0
;
while
(
!
IEnumWbemClassObject_Skip
(
iter
,
WBEM_INFINITE
,
1
))
count
++
;
IEnumWbemClassObject_Reset
(
iter
);
return
count
;
}
static
void
set_default_value
(
CIMTYPE
type
,
UINT
val
,
BYTE
*
ptr
)
{
switch
(
type
)
{
case
CIM_SINT16
:
*
(
INT16
*
)
ptr
=
val
;
break
;
case
CIM_UINT16
:
*
(
UINT16
*
)
ptr
=
val
;
break
;
case
CIM_SINT32
:
*
(
INT32
*
)
ptr
=
val
;
break
;
case
CIM_UINT32
:
*
(
UINT32
*
)
ptr
=
val
;
break
;
default:
FIXME
(
"unhandled type %u
\n
"
,
type
);
break
;
}
}
HRESULT
create_signature_columns_and_data
(
IEnumWbemClassObject
*
iter
,
UINT
*
num_cols
,
struct
column
**
cols
,
BYTE
**
data
)
{
static
const
WCHAR
parameterW
[]
=
{
'P'
,
'a'
,
'r'
,
'a'
,
'm'
,
'e'
,
't'
,
'e'
,
'r'
,
0
};
static
const
WCHAR
typeW
[]
=
{
'T'
,
'y'
,
'p'
,
'e'
,
0
};
static
const
WCHAR
defaultvalueW
[]
=
{
'D'
,
'e'
,
'f'
,
'a'
,
'u'
,
'l'
,
't'
,
'V'
,
'a'
,
'l'
,
'u'
,
'e'
,
0
};
struct
column
*
columns
;
BYTE
*
row
;
IWbemClassObject
*
param
;
VARIANT
val
;
HRESULT
hr
=
E_OUTOFMEMORY
;
UINT
offset
=
0
;
ULONG
count
;
int
i
=
0
;
count
=
count_instances
(
iter
);
if
(
!
(
columns
=
heap_alloc
(
count
*
sizeof
(
struct
column
)
)))
return
E_OUTOFMEMORY
;
if
(
!
(
row
=
heap_alloc_zero
(
count
*
sizeof
(
LONGLONG
)
)))
goto
error
;
for
(;;)
{
IEnumWbemClassObject_Next
(
iter
,
WBEM_INFINITE
,
1
,
&
param
,
&
count
);
if
(
!
count
)
break
;
hr
=
IWbemClassObject_Get
(
param
,
parameterW
,
0
,
&
val
,
NULL
,
NULL
);
if
(
hr
!=
S_OK
)
goto
error
;
columns
[
i
].
name
=
heap_strdupW
(
V_BSTR
(
&
val
)
);
VariantClear
(
&
val
);
hr
=
IWbemClassObject_Get
(
param
,
typeW
,
0
,
&
val
,
NULL
,
NULL
);
if
(
hr
!=
S_OK
)
goto
error
;
columns
[
i
].
type
=
V_UI4
(
&
val
);
columns
[
i
].
vartype
=
0
;
hr
=
IWbemClassObject_Get
(
param
,
defaultvalueW
,
0
,
&
val
,
NULL
,
NULL
);
if
(
hr
!=
S_OK
)
goto
error
;
if
(
V_UI4
(
&
val
))
set_default_value
(
columns
[
i
].
type
,
V_UI4
(
&
val
),
row
+
offset
);
offset
+=
get_type_size
(
columns
[
i
].
type
);
IWbemClassObject_Release
(
param
);
i
++
;
}
*
num_cols
=
i
;
*
cols
=
columns
;
*
data
=
row
;
return
S_OK
;
error:
for
(;
i
>=
0
;
i
--
)
heap_free
(
(
WCHAR
*
)
columns
[
i
].
name
);
heap_free
(
columns
);
heap_free
(
row
);
return
hr
;
}
HRESULT
create_signature_table
(
IEnumWbemClassObject
*
iter
,
WCHAR
*
name
)
{
HRESULT
hr
;
struct
table
*
table
;
struct
column
*
columns
;
UINT
num_cols
;
BYTE
*
row
;
hr
=
create_signature_columns_and_data
(
iter
,
&
num_cols
,
&
columns
,
&
row
);
if
(
hr
!=
S_OK
)
return
hr
;
if
(
!
(
table
=
create_table
(
name
,
num_cols
,
columns
,
1
,
row
,
NULL
)))
{
free_columns
(
columns
,
num_cols
);
heap_free
(
row
);
return
E_OUTOFMEMORY
;
}
if
(
!
add_table
(
table
))
free_table
(
table
);
/* already exists */
return
S_OK
;
}
WCHAR
*
build_signature_table_name
(
const
WCHAR
*
class
,
const
WCHAR
*
method
,
enum
param_direction
dir
)
{
static
const
WCHAR
fmtW
[]
=
{
'_'
,
'_'
,
'%'
,
's'
,
'_'
,
'%'
,
's'
,
'_'
,
'%'
,
's'
,
0
};
static
const
WCHAR
outW
[]
=
{
'O'
,
'U'
,
'T'
,
0
};
static
const
WCHAR
inW
[]
=
{
'I'
,
'N'
,
0
};
UINT
len
=
SIZEOF
(
fmtW
)
+
SIZEOF
(
outW
)
+
strlenW
(
class
)
+
strlenW
(
method
);
WCHAR
*
ret
;
if
(
!
(
ret
=
heap_alloc
(
len
*
sizeof
(
WCHAR
)
)))
return
NULL
;
sprintfW
(
ret
,
fmtW
,
class
,
method
,
dir
==
PARAM_IN
?
inW
:
outW
);
return
struprW
(
ret
);
}
static
HRESULT
create_signature
(
const
WCHAR
*
class
,
const
WCHAR
*
method
,
enum
param_direction
dir
,
IWbemClassObject
**
sig
)
{
static
const
WCHAR
selectW
[]
=
{
'S'
,
'E'
,
'L'
,
'E'
,
'C'
,
'T'
,
' '
,
'*'
,
' '
,
'F'
,
'R'
,
'O'
,
'M'
,
' '
,
'_'
,
'_'
,
'P'
,
'A'
,
'R'
,
'A'
,
'M'
,
'E'
,
'T'
,
'E'
,
'R'
,
'S'
,
' '
,
'W'
,
'H'
,
'E'
,
'R'
,
'E'
,
' '
,
'C'
,
'l'
,
'a'
,
's'
,
's'
,
'='
,
'\''
,
'%'
,
's'
,
'\''
,
' '
,
'A'
,
'N'
,
'D'
,
' '
,
'M'
,
'e'
,
't'
,
'h'
,
'o'
,
'd'
,
'='
,
'\''
,
'%'
,
's'
,
'\''
,
' '
,
'A'
,
'N'
,
'D'
,
' '
,
'D'
,
'i'
,
'r'
,
'e'
,
'c'
,
't'
,
'i'
,
'o'
,
'n'
,
'%'
,
's'
,
0
};
static
const
WCHAR
geW
[]
=
{
'>'
,
'='
,
'0'
,
0
};
static
const
WCHAR
leW
[]
=
{
'<'
,
'='
,
'0'
,
0
};
UINT
len
=
SIZEOF
(
selectW
)
+
SIZEOF
(
geW
);
IEnumWbemClassObject
*
iter
;
WCHAR
*
query
,
*
name
;
HRESULT
hr
;
len
+=
strlenW
(
class
)
+
strlenW
(
method
);
if
(
!
(
query
=
heap_alloc
(
len
*
sizeof
(
WCHAR
)
)))
return
E_OUTOFMEMORY
;
sprintfW
(
query
,
selectW
,
class
,
method
,
dir
>=
0
?
geW
:
leW
);
hr
=
exec_query
(
query
,
&
iter
);
heap_free
(
query
);
if
(
hr
!=
S_OK
)
return
hr
;
if
(
!
(
name
=
build_signature_table_name
(
class
,
method
,
dir
)))
{
IEnumWbemClassObject_Release
(
iter
);
return
E_OUTOFMEMORY
;
}
hr
=
create_signature_table
(
iter
,
name
);
IEnumWbemClassObject_Release
(
iter
);
if
(
hr
!=
S_OK
)
{
heap_free
(
name
);
return
hr
;
}
return
get_object
(
name
,
sig
);
}
static
HRESULT
WINAPI
class_object_GetMethod
(
static
HRESULT
WINAPI
class_object_GetMethod
(
IWbemClassObject
*
iface
,
IWbemClassObject
*
iface
,
LPCWSTR
wszName
,
LPCWSTR
wszName
,
...
@@ -448,8 +605,19 @@ static HRESULT WINAPI class_object_GetMethod(
...
@@ -448,8 +605,19 @@ static HRESULT WINAPI class_object_GetMethod(
IWbemClassObject
**
ppInSignature
,
IWbemClassObject
**
ppInSignature
,
IWbemClassObject
**
ppOutSignature
)
IWbemClassObject
**
ppOutSignature
)
{
{
FIXME
(
"%p, %s, %08x, %p, %p
\n
"
,
iface
,
debugstr_w
(
wszName
),
lFlags
,
ppInSignature
,
ppOutSignature
);
struct
class_object
*
co
=
impl_from_IWbemClassObject
(
iface
);
return
E_NOTIMPL
;
struct
enum_class_object
*
ec
=
impl_from_IEnumWbemClassObject
(
co
->
iter
);
struct
view
*
view
=
ec
->
query
->
view
;
HRESULT
hr
;
TRACE
(
"%p, %s, %08x, %p, %p
\n
"
,
iface
,
debugstr_w
(
wszName
),
lFlags
,
ppInSignature
,
ppOutSignature
);
hr
=
create_signature
(
view
->
table
->
name
,
wszName
,
PARAM_IN
,
ppInSignature
);
if
(
hr
!=
S_OK
)
return
hr
;
hr
=
create_signature
(
view
->
table
->
name
,
wszName
,
PARAM_OUT
,
ppOutSignature
);
if
(
hr
!=
S_OK
)
IWbemClassObject_Release
(
*
ppInSignature
);
return
hr
;
}
}
static
HRESULT
WINAPI
class_object_PutMethod
(
static
HRESULT
WINAPI
class_object_PutMethod
(
...
...
dlls/wbemprox/table.c
View file @
f9300859
...
@@ -44,11 +44,11 @@ HRESULT get_column_index( const struct table *table, const WCHAR *name, UINT *co
...
@@ -44,11 +44,11 @@ HRESULT get_column_index( const struct table *table, const WCHAR *name, UINT *co
return
WBEM_E_INVALID_QUERY
;
return
WBEM_E_INVALID_QUERY
;
}
}
static
UINT
get_column_size
(
const
struct
table
*
table
,
UINT
column
)
UINT
get_type_size
(
CIMTYPE
type
)
{
{
if
(
t
able
->
columns
[
column
].
t
ype
&
CIM_FLAG_ARRAY
)
return
sizeof
(
void
*
);
if
(
type
&
CIM_FLAG_ARRAY
)
return
sizeof
(
void
*
);
switch
(
t
able
->
columns
[
column
].
type
&
COL_TYPE_MASK
)
switch
(
t
ype
)
{
{
case
CIM_SINT16
:
case
CIM_SINT16
:
case
CIM_UINT16
:
case
CIM_UINT16
:
...
@@ -63,10 +63,15 @@ static UINT get_column_size( const struct table *table, UINT column )
...
@@ -63,10 +63,15 @@ static UINT get_column_size( const struct table *table, UINT column )
case
CIM_STRING
:
case
CIM_STRING
:
return
sizeof
(
WCHAR
*
);
return
sizeof
(
WCHAR
*
);
default:
default:
ERR
(
"un
known column type %u
\n
"
,
table
->
columns
[
column
].
type
&
COL_TYPE_MASK
);
ERR
(
"un
handled type %u
\n
"
,
type
);
break
;
break
;
}
}
return
sizeof
(
INT32
);
return
sizeof
(
LONGLONG
);
}
static
UINT
get_column_size
(
const
struct
table
*
table
,
UINT
column
)
{
return
get_type_size
(
table
->
columns
[
column
].
type
&
COL_TYPE_MASK
);
}
}
static
UINT
get_column_offset
(
const
struct
table
*
table
,
UINT
column
)
static
UINT
get_column_offset
(
const
struct
table
*
table
,
UINT
column
)
...
...
dlls/wbemprox/wbemprox_private.h
View file @
f9300859
...
@@ -24,6 +24,13 @@ struct list *table_list;
...
@@ -24,6 +24,13 @@ struct list *table_list;
#define SIZEOF(array) (sizeof(array)/sizeof((array)[0]))
#define SIZEOF(array) (sizeof(array)/sizeof((array)[0]))
enum
param_direction
{
PARAM_OUT
=
-
1
,
PARAM_INOUT
=
0
,
PARAM_IN
=
1
};
#define COL_TYPE_MASK 0x0000ffff
#define COL_TYPE_MASK 0x0000ffff
#define COL_FLAG_DYNAMIC 0x00010000
#define COL_FLAG_DYNAMIC 0x00010000
#define COL_FLAG_KEY 0x00020000
#define COL_FLAG_KEY 0x00020000
...
@@ -134,6 +141,7 @@ struct table *create_table( const WCHAR *, UINT, const struct column *, UINT,
...
@@ -134,6 +141,7 @@ struct table *create_table( const WCHAR *, UINT, const struct column *, UINT,
BOOL
add_table
(
struct
table
*
)
DECLSPEC_HIDDEN
;
BOOL
add_table
(
struct
table
*
)
DECLSPEC_HIDDEN
;
void
free_columns
(
struct
column
*
,
UINT
)
DECLSPEC_HIDDEN
;
void
free_columns
(
struct
column
*
,
UINT
)
DECLSPEC_HIDDEN
;
void
free_table
(
struct
table
*
)
DECLSPEC_HIDDEN
;
void
free_table
(
struct
table
*
)
DECLSPEC_HIDDEN
;
UINT
get_type_size
(
CIMTYPE
)
DECLSPEC_HIDDEN
;
HRESULT
get_column_index
(
const
struct
table
*
,
const
WCHAR
*
,
UINT
*
)
DECLSPEC_HIDDEN
;
HRESULT
get_column_index
(
const
struct
table
*
,
const
WCHAR
*
,
UINT
*
)
DECLSPEC_HIDDEN
;
HRESULT
get_value
(
const
struct
table
*
,
UINT
,
UINT
,
LONGLONG
*
)
DECLSPEC_HIDDEN
;
HRESULT
get_value
(
const
struct
table
*
,
UINT
,
UINT
,
LONGLONG
*
)
DECLSPEC_HIDDEN
;
BSTR
get_value_bstr
(
const
struct
table
*
,
UINT
,
UINT
)
DECLSPEC_HIDDEN
;
BSTR
get_value_bstr
(
const
struct
table
*
,
UINT
,
UINT
)
DECLSPEC_HIDDEN
;
...
@@ -161,6 +169,12 @@ static inline void *heap_realloc( void *mem, size_t len )
...
@@ -161,6 +169,12 @@ static inline void *heap_realloc( void *mem, size_t len )
return
HeapReAlloc
(
GetProcessHeap
(),
0
,
mem
,
len
);
return
HeapReAlloc
(
GetProcessHeap
(),
0
,
mem
,
len
);
}
}
static
void
*
heap_alloc_zero
(
size_t
len
)
__WINE_ALLOC_SIZE
(
1
);
static
inline
void
*
heap_alloc_zero
(
size_t
len
)
{
return
HeapAlloc
(
GetProcessHeap
(),
HEAP_ZERO_MEMORY
,
len
);
}
static
inline
BOOL
heap_free
(
void
*
mem
)
static
inline
BOOL
heap_free
(
void
*
mem
)
{
{
return
HeapFree
(
GetProcessHeap
(),
0
,
mem
);
return
HeapFree
(
GetProcessHeap
(),
0
,
mem
);
...
...
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