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
f6be2110
Commit
f6be2110
authored
Jun 15, 2012
by
Hans Leidekker
Committed by
Alexandre Julliard
Jun 15, 2012
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
wbemprox: Add support for parsing WQL queries.
parent
52363aef
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
181 additions
and
5 deletions
+181
-5
.gitignore
.gitignore
+2
-0
Makefile.in
dlls/wbemprox/Makefile.in
+3
-0
class.c
dlls/wbemprox/class.c
+4
-1
query.c
dlls/wbemprox/query.c
+87
-0
services.c
dlls/wbemprox/services.c
+9
-4
wbemprox_private.h
dlls/wbemprox/wbemprox_private.h
+76
-0
wql.y
dlls/wbemprox/wql.y
+0
-0
No files found.
.gitignore
View file @
f6be2110
...
...
@@ -135,6 +135,8 @@ dlls/vbscript/parser.tab.c
dlls/vbscript/parser.tab.h
dlls/vbscript/vbscript_classes.h
dlls/vbscript/vbsglobal.h
dlls/wbemprox/wql.tab.c
dlls/wbemprox/wql.tab.h
dlls/windowscodecs/windowscodecs_wincodec.h
dlls/windowscodecs/windowscodecs_wincodec_p.c
dlls/wshom.ocx/tests/wshom.h
...
...
dlls/wbemprox/Makefile.in
View file @
f6be2110
...
...
@@ -4,9 +4,12 @@ IMPORTS = ole32 advapi32
C_SRCS
=
\
class.c
\
main.c
\
query.c
\
services.c
\
wbemlocator.c
IDL_R_SRCS
=
wbemprox.idl
BISON_SRCS
=
wql.y
@MAKE_DLL_RULES@
dlls/wbemprox/class.c
View file @
f6be2110
...
...
@@ -35,6 +35,7 @@ struct enum_class_object
{
IEnumWbemClassObject
IEnumWbemClassObject_iface
;
LONG
refs
;
struct
query
*
query
;
};
static
inline
struct
enum_class_object
*
impl_from_IEnumWbemClassObject
(
...
...
@@ -58,6 +59,7 @@ static ULONG WINAPI enum_class_object_Release(
if
(
!
refs
)
{
TRACE
(
"destroying %p
\n
"
,
ec
);
free_query
(
ec
->
query
);
heap_free
(
ec
);
}
return
refs
;
...
...
@@ -143,7 +145,7 @@ static const IEnumWbemClassObjectVtbl enum_class_object_vtbl =
};
HRESULT
EnumWbemClassObject_create
(
IUnknown
*
pUnkOuter
,
LPVOID
*
ppObj
)
IUnknown
*
pUnkOuter
,
struct
query
*
query
,
LPVOID
*
ppObj
)
{
struct
enum_class_object
*
ec
;
...
...
@@ -154,6 +156,7 @@ HRESULT EnumWbemClassObject_create(
ec
->
IEnumWbemClassObject_iface
.
lpVtbl
=
&
enum_class_object_vtbl
;
ec
->
refs
=
1
;
ec
->
query
=
query
;
*
ppObj
=
&
ec
->
IEnumWbemClassObject_iface
;
...
...
dlls/wbemprox/query.c
0 → 100644
View file @
f6be2110
/*
* Copyright 2012 Hans Leidekker for CodeWeavers
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
#define COBJMACROS
#include "config.h"
#include <stdarg.h>
#include "windef.h"
#include "winbase.h"
#include "wbemcli.h"
#include "wine/debug.h"
#include "wbemprox_private.h"
WINE_DEFAULT_DEBUG_CHANNEL
(
wbemprox
);
HRESULT
create_view
(
const
struct
property
*
proplist
,
const
WCHAR
*
class
,
const
struct
expr
*
cond
,
struct
view
**
ret
)
{
struct
view
*
view
=
heap_alloc
(
sizeof
(
struct
view
)
);
if
(
!
view
)
return
E_OUTOFMEMORY
;
view
->
proplist
=
proplist
;
view
->
cond
=
cond
;
*
ret
=
view
;
return
S_OK
;
}
void
destroy_view
(
struct
view
*
view
)
{
heap_free
(
view
);
}
static
struct
query
*
alloc_query
(
void
)
{
struct
query
*
query
;
if
(
!
(
query
=
heap_alloc
(
sizeof
(
*
query
)
)))
return
NULL
;
list_init
(
&
query
->
mem
);
return
query
;
}
void
free_query
(
struct
query
*
query
)
{
struct
list
*
mem
,
*
next
;
destroy_view
(
query
->
view
);
LIST_FOR_EACH_SAFE
(
mem
,
next
,
&
query
->
mem
)
{
heap_free
(
mem
);
}
heap_free
(
query
);
}
HRESULT
exec_query
(
const
WCHAR
*
str
,
IEnumWbemClassObject
**
result
)
{
HRESULT
hr
;
struct
query
*
query
;
*
result
=
NULL
;
if
(
!
(
query
=
alloc_query
()))
return
E_OUTOFMEMORY
;
hr
=
parse_query
(
str
,
&
query
->
view
,
&
query
->
mem
);
if
(
hr
!=
S_OK
)
{
free_query
(
query
);
return
hr
;
}
hr
=
EnumWbemClassObject_create
(
NULL
,
query
,
(
void
**
)
result
);
if
(
hr
!=
S_OK
)
free_query
(
query
);
return
hr
;
}
dlls/wbemprox/services.c
View file @
f6be2110
...
...
@@ -158,7 +158,7 @@ static ULONG WINAPI wbem_services_Release(
if
(
!
refs
)
{
TRACE
(
"destroying %p
\n
"
,
ws
);
HeapFree
(
GetProcessHeap
(),
0
,
ws
);
heap_free
(
ws
);
}
return
refs
;
}
...
...
@@ -383,9 +383,14 @@ static HRESULT WINAPI wbem_services_ExecQuery(
IWbemContext
*
pCtx
,
IEnumWbemClassObject
**
ppEnum
)
{
FIXME
(
"%p, %s, %s, 0x%08x, %p, %p
\n
"
,
iface
,
debugstr_w
(
strQueryLanguage
),
static
const
WCHAR
wqlW
[]
=
{
'W'
,
'Q'
,
'L'
,
0
};
TRACE
(
"%p, %s, %s, 0x%08x, %p, %p
\n
"
,
iface
,
debugstr_w
(
strQueryLanguage
),
debugstr_w
(
strQuery
),
lFlags
,
pCtx
,
ppEnum
);
return
WBEM_E_FAILED
;
if
(
!
strQueryLanguage
||
!
strQuery
)
return
WBEM_E_INVALID_PARAMETER
;
if
(
strcmpiW
(
strQueryLanguage
,
wqlW
))
return
WBEM_E_INVALID_QUERY_TYPE
;
return
exec_query
(
strQuery
,
ppEnum
);
}
static
HRESULT
WINAPI
wbem_services_ExecQueryAsync
(
...
...
@@ -487,7 +492,7 @@ HRESULT WbemServices_create( IUnknown *pUnkOuter, LPVOID *ppObj )
TRACE
(
"(%p,%p)
\n
"
,
pUnkOuter
,
ppObj
);
ws
=
HeapAlloc
(
GetProcessHeap
(),
0
,
sizeof
(
*
ws
)
);
ws
=
heap_alloc
(
sizeof
(
*
ws
)
);
if
(
!
ws
)
return
E_OUTOFMEMORY
;
ws
->
IWbemServices_iface
.
lpVtbl
=
&
wbem_services_vtbl
;
...
...
dlls/wbemprox/wbemprox_private.h
View file @
f6be2110
...
...
@@ -16,8 +16,84 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
#include "wine/list.h"
#define SIZEOF(array) (sizeof(array)/sizeof((array)[0]))
struct
property
{
const
WCHAR
*
name
;
const
WCHAR
*
class
;
const
struct
property
*
next
;
};
enum
operator
{
OP_EQ
=
1
,
OP_AND
=
2
,
OP_OR
=
3
,
OP_GT
=
4
,
OP_LT
=
5
,
OP_LE
=
6
,
OP_GE
=
7
,
OP_NE
=
8
,
OP_ISNULL
=
9
,
OP_NOTNULL
=
10
,
OP_LIKE
=
11
};
struct
expr
;
struct
complex_expr
{
enum
operator
op
;
struct
expr
*
left
;
struct
expr
*
right
;
};
enum
expr_type
{
EXPR_COMPLEX
=
1
,
EXPR_UNARY
=
2
,
EXPR_PROPVAL
=
3
,
EXPR_SVAL
=
4
,
EXPR_IVAL
=
5
,
EXPR_BVAL
=
6
};
struct
expr
{
enum
expr_type
type
;
union
{
struct
complex_expr
expr
;
const
struct
property
*
propval
;
const
WCHAR
*
sval
;
int
ival
;
}
u
;
};
struct
view
{
const
struct
property
*
proplist
;
const
struct
expr
*
cond
;
};
struct
query
{
struct
view
*
view
;
struct
list
mem
;
};
void
free_query
(
struct
query
*
)
DECLSPEC_HIDDEN
;
HRESULT
exec_query
(
const
WCHAR
*
,
IEnumWbemClassObject
**
)
DECLSPEC_HIDDEN
;
HRESULT
parse_query
(
const
WCHAR
*
,
struct
view
**
,
struct
list
*
)
DECLSPEC_HIDDEN
;
HRESULT
create_view
(
const
struct
property
*
,
const
WCHAR
*
,
const
struct
expr
*
,
struct
view
**
)
DECLSPEC_HIDDEN
;
void
destroy_view
(
struct
view
*
)
DECLSPEC_HIDDEN
;
HRESULT
WbemLocator_create
(
IUnknown
*
,
LPVOID
*
)
DECLSPEC_HIDDEN
;
HRESULT
WbemServices_create
(
IUnknown
*
,
LPVOID
*
)
DECLSPEC_HIDDEN
;
HRESULT
EnumWbemClassObject_create
(
IUnknown
*
,
struct
query
*
,
LPVOID
*
)
DECLSPEC_HIDDEN
;
static
void
*
heap_alloc
(
size_t
len
)
__WINE_ALLOC_SIZE
(
1
);
static
inline
void
*
heap_alloc
(
size_t
len
)
...
...
dlls/wbemprox/wql.y
0 → 100644
View file @
f6be2110
This diff is collapsed.
Click to expand it.
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