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
f4da96bb
Commit
f4da96bb
authored
Jun 04, 2013
by
Hans Leidekker
Committed by
Alexandre Julliard
Jun 04, 2013
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
wbemprox: Rewrite IWbemServices::ExecMethod with low-level functions so we can…
wbemprox: Rewrite IWbemServices::ExecMethod with low-level functions so we can reuse the object instance.
parent
9a14d5d0
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
54 additions
and
31 deletions
+54
-31
query.c
dlls/wbemprox/query.c
+5
-7
services.c
dlls/wbemprox/services.c
+46
-24
wbemprox_private.h
dlls/wbemprox/wbemprox_private.h
+3
-0
No files found.
dlls/wbemprox/query.c
View file @
f4da96bb
...
...
@@ -238,7 +238,7 @@ HRESULT eval_cond( const struct table *table, UINT row, const struct expr *cond,
return
WBEM_E_INVALID_QUERY
;
}
static
HRESULT
execute_view
(
struct
view
*
view
)
HRESULT
execute_view
(
struct
view
*
view
)
{
UINT
i
,
j
=
0
,
len
;
...
...
@@ -272,7 +272,7 @@ static HRESULT execute_view( struct view *view )
return
S_OK
;
}
st
atic
st
ruct
query
*
create_query
(
void
)
struct
query
*
create_query
(
void
)
{
struct
query
*
query
;
...
...
@@ -282,15 +282,13 @@ static struct query *create_query(void)
return
query
;
}
static
void
free_query
(
struct
query
*
query
)
void
free_query
(
struct
query
*
query
)
{
struct
list
*
mem
,
*
next
;
if
(
!
query
)
return
;
destroy_view
(
query
->
view
);
LIST_FOR_EACH_SAFE
(
mem
,
next
,
&
query
->
mem
)
{
heap_free
(
mem
);
}
LIST_FOR_EACH_SAFE
(
mem
,
next
,
&
query
->
mem
)
{
heap_free
(
mem
);
}
heap_free
(
query
);
}
...
...
dlls/wbemprox/services.c
View file @
f4da96bb
...
...
@@ -377,7 +377,7 @@ static void free_path( struct path *path )
heap_free
(
path
);
}
static
HRESULT
create_instance_enum
(
const
struct
path
*
path
,
IEnumWbemClassObject
**
iter
)
static
WCHAR
*
query_from_path
(
const
struct
path
*
path
)
{
static
const
WCHAR
selectW
[]
=
{
'S'
,
'E'
,
'L'
,
'E'
,
'C'
,
'T'
,
' '
,
'*'
,
' '
,
'F'
,
'R'
,
'O'
,
'M'
,
' '
,
'%'
,
's'
,
' '
,
...
...
@@ -385,22 +385,30 @@ static HRESULT create_instance_enum( const struct path *path, IEnumWbemClassObje
static
const
WCHAR
select_allW
[]
=
{
'S'
,
'E'
,
'L'
,
'E'
,
'C'
,
'T'
,
' '
,
'*'
,
' '
,
'F'
,
'R'
,
'O'
,
'M'
,
' '
,
0
};
WCHAR
*
query
;
HRESULT
hr
;
UINT
len
;
if
(
path
->
filter
)
{
len
=
path
->
class_len
+
path
->
filter_len
+
SIZEOF
(
selectW
);
if
(
!
(
query
=
heap_alloc
(
len
*
sizeof
(
WCHAR
)
)))
return
E_OUTOFMEMORY
;
if
(
!
(
query
=
heap_alloc
(
len
*
sizeof
(
WCHAR
)
)))
return
NULL
;
sprintfW
(
query
,
selectW
,
path
->
class
,
path
->
filter
);
}
else
{
len
=
path
->
class_len
+
SIZEOF
(
select_allW
);
if
(
!
(
query
=
heap_alloc
(
len
*
sizeof
(
WCHAR
)
)))
return
E_OUTOFMEMORY
;
if
(
!
(
query
=
heap_alloc
(
len
*
sizeof
(
WCHAR
)
)))
return
NULL
;
strcpyW
(
query
,
select_allW
);
strcatW
(
query
,
path
->
class
);
}
return
query
;
}
static
HRESULT
create_instance_enum
(
const
struct
path
*
path
,
IEnumWbemClassObject
**
iter
)
{
WCHAR
*
query
;
HRESULT
hr
;
if
(
!
(
query
=
query_from_path
(
path
)))
return
E_OUTOFMEMORY
;
hr
=
exec_query
(
query
,
iter
);
heap_free
(
query
);
return
hr
;
...
...
@@ -778,10 +786,12 @@ static HRESULT WINAPI wbem_services_ExecMethod(
IWbemClassObject
**
ppOutParams
,
IWbemCallResult
**
ppCallResult
)
{
I
WbemClassObject
*
obj
;
struct
table
*
table
;
class_method
*
func
;
I
EnumWbemClassObject
*
result
=
NULL
;
IWbemClassObject
*
obj
=
NULL
;
struct
query
*
query
=
NULL
;
struct
path
*
path
;
WCHAR
*
str
;
class_method
*
func
;
HRESULT
hr
;
TRACE
(
"%p, %s, %s, %08x, %p, %p, %p, %p
\n
"
,
iface
,
debugstr_w
(
strObjectPath
),
...
...
@@ -789,28 +799,40 @@ static HRESULT WINAPI wbem_services_ExecMethod(
if
(
lFlags
)
FIXME
(
"flags %08x not supported
\n
"
,
lFlags
);
if
((
hr
=
get_object
(
strObjectPath
,
&
obj
))
)
return
hr
;
if
(
(
hr
=
parse_path
(
strObjectPath
,
&
path
))
!=
S_OK
)
if
((
hr
=
parse_path
(
strObjectPath
,
&
path
))
!=
S_OK
)
return
hr
;
if
(
!
(
str
=
query_from_path
(
path
))
)
{
IWbemClassObject_Release
(
obj
);
return
hr
;
}
table
=
grab_table
(
path
->
class
);
free_path
(
path
);
if
(
!
table
)
{
IWbemClassObject_Release
(
obj
);
return
WBEM_E_NOT_FOUND
;
hr
=
E_OUTOFMEMORY
;
goto
done
;
}
hr
=
get_method
(
table
,
strMethodName
,
&
func
);
release_table
(
table
);
if
(
hr
!=
S_OK
)
if
(
!
(
query
=
create_query
()))
{
IWbemClassObject_Release
(
obj
)
;
return
hr
;
hr
=
E_OUTOFMEMORY
;
goto
done
;
}
hr
=
parse_query
(
str
,
&
query
->
view
,
&
query
->
mem
);
if
(
hr
!=
S_OK
)
goto
done
;
hr
=
execute_view
(
query
->
view
);
if
(
hr
!=
S_OK
)
goto
done
;
hr
=
EnumWbemClassObject_create
(
NULL
,
query
,
(
void
**
)
&
result
);
if
(
hr
!=
S_OK
)
goto
done
;
hr
=
create_class_object
(
query
->
view
->
table
->
name
,
result
,
0
,
NULL
,
&
obj
);
if
(
hr
!=
S_OK
)
goto
done
;
hr
=
get_method
(
query
->
view
->
table
,
strMethodName
,
&
func
);
if
(
hr
!=
S_OK
)
goto
done
;
hr
=
func
(
obj
,
pInParams
,
ppOutParams
);
IWbemClassObject_Release
(
obj
);
done:
if
(
result
)
IEnumWbemClassObject_Release
(
result
);
if
(
obj
)
IWbemClassObject_Release
(
obj
);
free_query
(
query
);
free_path
(
path
);
heap_free
(
str
);
return
hr
;
}
...
...
dlls/wbemprox/wbemprox_private.h
View file @
f4da96bb
...
...
@@ -163,6 +163,8 @@ struct query
struct
list
mem
;
};
struct
query
*
create_query
(
void
)
DECLSPEC_HIDDEN
;
void
free_query
(
struct
query
*
)
DECLSPEC_HIDDEN
;
struct
query
*
addref_query
(
struct
query
*
)
DECLSPEC_HIDDEN
;
void
release_query
(
struct
query
*
query
)
DECLSPEC_HIDDEN
;
HRESULT
exec_query
(
const
WCHAR
*
,
IEnumWbemClassObject
**
)
DECLSPEC_HIDDEN
;
...
...
@@ -170,6 +172,7 @@ HRESULT parse_query( const WCHAR *, struct view **, struct list * ) DECLSPEC_HID
HRESULT
create_view
(
const
struct
property
*
,
const
WCHAR
*
,
const
struct
expr
*
,
struct
view
**
)
DECLSPEC_HIDDEN
;
void
destroy_view
(
struct
view
*
)
DECLSPEC_HIDDEN
;
HRESULT
execute_view
(
struct
view
*
)
DECLSPEC_HIDDEN
;
void
init_table_list
(
void
)
DECLSPEC_HIDDEN
;
struct
table
*
grab_table
(
const
WCHAR
*
)
DECLSPEC_HIDDEN
;
struct
table
*
addref_table
(
struct
table
*
)
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