ReactOS 0.4.16-dev-197-g92996da
wbemprox_private.h
Go to the documentation of this file.
1/*
2 * Copyright 2009 Hans Leidekker for CodeWeavers
3 *
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 2.1 of the License, or (at your option) any later version.
8 *
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Lesser General Public License for more details.
13 *
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with this library; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
17 */
18
19#pragma once
20
21#include "wine/debug.h"
22#include "wine/heap.h"
23#include "wine/list.h"
24#ifdef __REACTOS__
25#include <winnls.h>
26#endif
27
30
32{
35 PARAM_IN = 1
36};
37
38#define CIM_TYPE_MASK 0x00000fff
39
40#define COL_TYPE_MASK 0x0000ffff
41#define COL_FLAG_DYNAMIC 0x00010000
42#define COL_FLAG_KEY 0x00020000
43#define COL_FLAG_METHOD 0x00040000
44
46
47enum operator
48{
49 OP_EQ = 1,
50 OP_AND = 2,
51 OP_OR = 3,
52 OP_GT = 4,
53 OP_LT = 5,
54 OP_LE = 6,
55 OP_GE = 7,
56 OP_NE = 8,
59 OP_LIKE = 11,
60 OP_NOT = 12
61};
62
63struct expr;
64struct complex_expr
65{
66 enum operator op;
67 struct expr *left;
68 struct expr *right;
69};
70
72{
78 EXPR_BVAL = 6
79};
80
81struct expr
82{
84 union
85 {
86 struct complex_expr expr;
87 const struct property *propval;
88 const WCHAR *sval;
89 int ival;
90 } u;
91};
92
93struct column
94{
95 const WCHAR *name;
97};
98
100{
105
106#define TABLE_FLAG_DYNAMIC 0x00000001
107
108struct table
109{
110 const WCHAR *name;
112 const struct column *columns;
116 enum fill_status (*fill)(struct table *, const struct expr *cond);
118 struct list entry;
120};
121
122struct property
123{
124 const WCHAR *name;
125 const WCHAR *class;
126 const struct property *next;
127};
128
129struct array
130{
133 void *ptr;
134};
135
136struct field
137{
139 union
140 {
143 struct array *aval;
144 } u;
145};
146
147struct record
148{
150 struct field *fields;
151 struct table *table;
152};
153
154struct keyword
155{
156 const WCHAR *name;
157 const WCHAR *value;
158 const struct keyword *next;
159};
160
162{
165};
166
167struct view
168{
170 const WCHAR *path; /* ASSOCIATORS OF query */
171 const struct keyword *keywordlist;
172 const struct property *proplist; /* SELECT query */
173 const struct expr *cond;
175 struct table **table;
178};
179
180struct query
181{
183 struct view *view;
184 struct list mem;
185};
186
187struct path
188{
189 WCHAR *class;
193};
194
195HRESULT parse_path( const WCHAR *, struct path ** ) DECLSPEC_HIDDEN;
196void free_path( struct path * ) DECLSPEC_HIDDEN;
197WCHAR *query_from_path( const struct path * ) DECLSPEC_HIDDEN;
198
200void free_query( struct query * ) DECLSPEC_HIDDEN;
201struct query *addref_query( struct query * ) DECLSPEC_HIDDEN;
204HRESULT parse_query( const WCHAR *, struct view **, struct list * ) DECLSPEC_HIDDEN;
205HRESULT create_view( enum view_type, const WCHAR *, const struct keyword *, const WCHAR *, const struct property *,
206 const struct expr *, struct view ** ) DECLSPEC_HIDDEN;
207void destroy_view( struct view * ) DECLSPEC_HIDDEN;
209struct table *get_view_table( const struct view *, UINT ) DECLSPEC_HIDDEN;
211struct table *grab_table( const WCHAR * ) DECLSPEC_HIDDEN;
212struct table *addref_table( struct table * ) DECLSPEC_HIDDEN;
213void release_table( struct table * ) DECLSPEC_HIDDEN;
214struct table *create_table( const WCHAR *, UINT, const struct column *, UINT, UINT, BYTE *,
215 enum fill_status (*)(struct table *, const struct expr *) ) DECLSPEC_HIDDEN;
217void free_columns( struct column *, UINT ) DECLSPEC_HIDDEN;
218void free_row_values( const struct table *, UINT ) DECLSPEC_HIDDEN;
219void clear_table( struct table * ) DECLSPEC_HIDDEN;
220void free_table( struct table * ) DECLSPEC_HIDDEN;
222HRESULT eval_cond( const struct table *, UINT, const struct expr *, LONGLONG *, UINT * ) DECLSPEC_HIDDEN;
223HRESULT get_column_index( const struct table *, const WCHAR *, UINT * ) DECLSPEC_HIDDEN;
227BOOL is_method( const struct table *, UINT ) DECLSPEC_HIDDEN;
228HRESULT get_method( const struct table *, const WCHAR *, class_method ** ) DECLSPEC_HIDDEN;
229HRESULT get_propval( const struct view *, UINT, const WCHAR *, VARIANT *, CIMTYPE *, LONG * ) DECLSPEC_HIDDEN;
230HRESULT put_propval( const struct view *, UINT, const WCHAR *, VARIANT *, CIMTYPE ) DECLSPEC_HIDDEN;
235BOOL is_result_prop( const struct view *, const WCHAR * ) DECLSPEC_HIDDEN;
240HRESULT create_signature( const WCHAR *, const WCHAR *, enum param_direction,
242
249
261
262static inline WCHAR *heap_strdupW( const WCHAR *src )
263{
264 WCHAR *dst;
265 if (!src) return NULL;
266 if ((dst = heap_alloc( (lstrlenW( src ) + 1) * sizeof(WCHAR) ))) lstrcpyW( dst, src );
267 return dst;
268}
269
270static inline WCHAR *heap_strdupAW( const char *src )
271{
272 int len;
273 WCHAR *dst;
274 if (!src) return NULL;
275 len = MultiByteToWideChar( CP_ACP, 0, src, -1, NULL, 0 );
276 if ((dst = heap_alloc( len * sizeof(*dst) ))) MultiByteToWideChar( CP_ACP, 0, src, -1, dst, len );
277 return dst;
278}
279
280static const WCHAR class_processW[] = {'W','i','n','3','2','_','P','r','o','c','e','s','s',0};
281static const WCHAR class_serviceW[] = {'W','i','n','3','2','_','S','e','r','v','i','c','e',0};
282static const WCHAR class_stdregprovW[] = {'S','t','d','R','e','g','P','r','o','v',0};
283static const WCHAR class_systemsecurityW[] = {'_','_','S','y','s','t','e','m','S','e','c','u','r','i','t','y',0};
284
285static const WCHAR prop_nameW[] = {'N','a','m','e',0};
286
287static const WCHAR method_createkeyW[] = {'C','r','e','a','t','e','K','e','y',0};
288static const WCHAR method_enumkeyW[] = {'E','n','u','m','K','e','y',0};
289static const WCHAR method_enumvaluesW[] = {'E','n','u','m','V','a','l','u','e','s',0};
290static const WCHAR method_getownerW[] = {'G','e','t','O','w','n','e','r',0};
291static const WCHAR method_getsdW[] = {'G','e','t','S','D',0};
292static const WCHAR method_getstringvalueW[] = {'G','e','t','S','t','r','i','n','g','V','a','l','u','e',0};
293static const WCHAR method_pauseserviceW[] = {'P','a','u','s','e','S','e','r','v','i','c','e',0};
294static const WCHAR method_resumeserviceW[] = {'R','e','s','u','m','e','S','e','r','v','i','c','e',0};
295static const WCHAR method_setsdW[] = {'S','e','t','S','D',0};
296static const WCHAR method_startserviceW[] = {'S','t','a','r','t','S','e','r','v','i','c','e',0};
297static const WCHAR method_stopserviceW[] = {'S','t','o','p','S','e','r','v','i','c','e',0};
298
299static const WCHAR param_defkeyW[] = {'h','D','e','f','K','e','y',0};
300static const WCHAR param_domainW[] = {'D','o','m','a','i','n',0};
301static const WCHAR param_namesW[] = {'s','N','a','m','e','s',0};
302static const WCHAR param_returnvalueW[] = {'R','e','t','u','r','n','V','a','l','u','e',0};
303static const WCHAR param_sdW[] = {'S','D',0};
304static const WCHAR param_subkeynameW[] = {'s','S','u','b','K','e','y','N','a','m','e',0};
305static const WCHAR param_typesW[] = {'T','y','p','e','s',0};
306static const WCHAR param_userW[] = {'U','s','e','r',0};
307static const WCHAR param_valueW[] = {'s','V','a','l','u','e',0};
308static const WCHAR param_valuenameW[] = {'s','V','a','l','u','e','N','a','m','e',0};
static void * heap_alloc(size_t len)
Definition: appwiz.h:66
Definition: list.h:37
#define NULL
Definition: types.h:112
#define CP_ACP
Definition: compat.h:109
OLECHAR * BSTR
Definition: compat.h:2293
unsigned short VARTYPE
Definition: compat.h:2254
#define lstrcpyW
Definition: compat.h:749
#define MultiByteToWideChar
Definition: compat.h:110
#define lstrlenW
Definition: compat.h:750
struct list * table_list
Definition: main.c:38
unsigned int BOOL
Definition: ntddk_ex.h:94
GLenum src
Definition: glext.h:6340
GLenum GLenum dst
Definition: glext.h:6340
GLenum GLsizei len
Definition: glext.h:6722
unsigned int UINT
Definition: ndis.h:50
long LONG
Definition: pedump.c:60
UINT elem_size
void * ptr
const WCHAR * name
struct expr * left
Definition: query.h:67
enum operator op
struct expr * right
Definition: query.h:68
Definition: query.h:86
enum expr_type type
const WCHAR * sval
const struct property * propval
union expr::@506 u
Definition: parser.c:44
struct array * aval
LONGLONG ival
union field::@592 u
WCHAR * sval
const WCHAR * value
const WCHAR * name
Definition: tokenize.c:34
const struct keyword * next
Definition: mem.c:156
WCHAR * filter
UINT class_len
UINT filter_len
const struct property * next
const WCHAR * name
struct view * view
struct table * table
struct field * fields
UINT num_rows
enum fill_status(* fill)(struct table *, const struct expr *cond)
const struct column * columns
const WCHAR * name
UINT num_cols
UINT num_rows_allocated
struct list entry
BYTE * data
UINT * result
UINT table_count
UINT result_count
struct table ** table
const WCHAR * path
const struct property * proplist
const struct expr * cond
const struct keyword * keywordlist
enum view_type type
int64_t LONGLONG
Definition: typedefs.h:68
long CIMTYPE
Definition: wbemcli.idl:258
void free_table(struct table *) DECLSPEC_HIDDEN
Definition: table.c:338
void free_columns(struct column *, UINT) DECLSPEC_HIDDEN
Definition: table.c:330
struct query * create_query(void) DECLSPEC_HIDDEN
Definition: query.c:755
static const WCHAR method_enumvaluesW[]
void destroy_view(struct view *) DECLSPEC_HIDDEN
Definition: query.c:83
HRESULT security_set_sd(IWbemClassObject *, IWbemClassObject *, IWbemClassObject **) DECLSPEC_HIDDEN
Definition: security.c:187
struct query * addref_query(struct query *) DECLSPEC_HIDDEN
Definition: query.c:775
HRESULT create_signature(const WCHAR *, const WCHAR *, enum param_direction, IWbemClassObject **) DECLSPEC_HIDDEN
Definition: class.c:819
WCHAR * query_from_path(const struct path *) DECLSPEC_HIDDEN
Definition: services.c:421
static const WCHAR param_valuenameW[]
static const WCHAR class_serviceW[]
HRESULT() class_method(IWbemClassObject *, IWbemClassObject *, IWbemClassObject **)
HRESULT WbemServices_create(const WCHAR *, LPVOID *) DECLSPEC_HIDDEN
Definition: services.c:925
static const WCHAR param_userW[]
HRESULT service_stop_service(IWbemClassObject *, IWbemClassObject *, IWbemClassObject **) DECLSPEC_HIDDEN
Definition: service.c:238
BSTR get_method_name(const WCHAR *, UINT) DECLSPEC_HIDDEN
Definition: table.c:417
void init_table_list(void) DECLSPEC_HIDDEN
Definition: builtin.c:4605
HRESULT get_column_index(const struct table *, const WCHAR *, UINT *) DECLSPEC_HIDDEN
Definition: table.c:35
HRESULT get_method(const struct table *, const WCHAR *, class_method **) DECLSPEC_HIDDEN
Definition: table.c:269
void release_table(struct table *) DECLSPEC_HIDDEN
Definition: table.c:354
static WCHAR * heap_strdupAW(const char *src)
struct table * get_view_table(const struct view *, UINT) DECLSPEC_HIDDEN
Definition: query.c:1161
HRESULT WbemQualifierSet_create(const WCHAR *, const WCHAR *, LPVOID *) DECLSPEC_HIDDEN
Definition: qualifier.c:293
static const WCHAR method_getownerW[]
HRESULT WbemLocator_create(LPVOID *) DECLSPEC_HIDDEN
Definition: wbemlocator.c:212
static const WCHAR method_pauseserviceW[]
static const WCHAR method_enumkeyW[]
expr_type
@ EXPR_SVAL
@ EXPR_UNARY
@ EXPR_IVAL
@ EXPR_PROPVAL
@ EXPR_BVAL
@ EXPR_COMPLEX
static const WCHAR param_namesW[]
static const WCHAR method_setsdW[]
param_direction
@ PARAM_OUT
@ PARAM_INOUT
@ PARAM_IN
HRESULT reg_enum_values(IWbemClassObject *, IWbemClassObject *, IWbemClassObject **) DECLSPEC_HIDDEN
Definition: reg.c:308
static const WCHAR method_startserviceW[]
HRESULT exec_query(const WCHAR *, IEnumWbemClassObject **) DECLSPEC_HIDDEN
Definition: query.c:786
static const WCHAR class_stdregprovW[]
static const WCHAR param_typesW[]
static const WCHAR method_createkeyW[]
static const WCHAR method_resumeserviceW[]
static const WCHAR param_valueW[]
static const WCHAR class_processW[]
void free_row_values(const struct table *, UINT) DECLSPEC_HIDDEN
Definition: table.c:292
HRESULT put_propval(const struct view *, UINT, const WCHAR *, VARIANT *, CIMTYPE) DECLSPEC_HIDDEN
Definition: query.c:1375
static const WCHAR method_getstringvalueW[]
HRESULT get_value(const struct table *, UINT, UINT, LONGLONG *) DECLSPEC_HIDDEN
Definition: table.c:99
HRESULT service_resume_service(IWbemClassObject *, IWbemClassObject *, IWbemClassObject **) DECLSPEC_HIDDEN
Definition: service.c:124
HRESULT parse_query(const WCHAR *, struct view **, struct list *) DECLSPEC_HIDDEN
BOOL add_table(struct table *) DECLSPEC_HIDDEN
Definition: table.c:400
SAFEARRAY * to_safearray(const struct array *, CIMTYPE) DECLSPEC_HIDDEN
Definition: query.c:1062
static const WCHAR param_returnvalueW[]
HRESULT parse_path(const WCHAR *, struct path **) DECLSPEC_HIDDEN
Definition: services.c:326
void release_query(struct query *query) DECLSPEC_HIDDEN
Definition: query.c:781
void set_variant(VARTYPE, LONGLONG, void *, VARIANT *) DECLSPEC_HIDDEN
Definition: query.c:1093
VARTYPE to_vartype(CIMTYPE) DECLSPEC_HIDDEN
Definition: query.c:1032
struct table * grab_table(const WCHAR *) DECLSPEC_HIDDEN
Definition: table.c:365
BSTR get_value_bstr(const struct table *, UINT, UINT) DECLSPEC_HIDDEN
Definition: table.c:158
view_type
@ VIEW_TYPE_ASSOCIATORS
@ VIEW_TYPE_SELECT
UINT get_type_size(CIMTYPE) DECLSPEC_HIDDEN
Definition: table.c:49
HRESULT get_propval(const struct view *, UINT, const WCHAR *, VARIANT *, CIMTYPE *, LONG *) DECLSPEC_HIDDEN
Definition: query.c:1177
HRESULT reg_create_key(IWbemClassObject *, IWbemClassObject *, IWbemClassObject **) DECLSPEC_HIDDEN
Definition: reg.c:99
BOOL is_method(const struct table *, UINT) DECLSPEC_HIDDEN
Definition: query.c:917
struct table * addref_table(struct table *) DECLSPEC_HIDDEN
Definition: table.c:359
HRESULT to_longlong(VARIANT *, LONGLONG *, CIMTYPE *) DECLSPEC_HIDDEN
Definition: query.c:1325
static const WCHAR param_sdW[]
static const WCHAR class_systemsecurityW[]
HRESULT service_start_service(IWbemClassObject *, IWbemClassObject *, IWbemClassObject **) DECLSPEC_HIDDEN
Definition: service.c:193
static const WCHAR param_domainW[]
HRESULT process_get_owner(IWbemClassObject *, IWbemClassObject *, IWbemClassObject **) DECLSPEC_HIDDEN
Definition: process.c:65
fill_status
@ FILL_STATUS_UNFILTERED
@ FILL_STATUS_FAILED
@ FILL_STATUS_FILTERED
@ OP_LIKE
@ OP_NE
@ OP_EQ
@ OP_ISNULL
@ OP_GE
@ OP_NOT
@ OP_LT
@ OP_GT
@ OP_NOTNULL
@ OP_LE
@ OP_AND
@ OP_OR
void clear_table(struct table *) DECLSPEC_HIDDEN
Definition: table.c:314
HRESULT eval_cond(const struct table *, UINT, const struct expr *, LONGLONG *, UINT *) DECLSPEC_HIDDEN
Definition: query.c:440
static const WCHAR prop_nameW[]
static const WCHAR method_getsdW[]
void free_path(struct path *) DECLSPEC_HIDDEN
Definition: services.c:413
HRESULT get_object(const WCHAR *, IWbemClassObject **) DECLSPEC_HIDDEN
Definition: services.c:458
struct table * create_table(const WCHAR *, UINT, const struct column *, UINT, UINT, BYTE *, enum fill_status(*)(struct table *, const struct expr *)) DECLSPEC_HIDDEN
IClientSecurity client_security DECLSPEC_HIDDEN
static WCHAR * heap_strdupW(const WCHAR *src)
HRESULT create_class_object(const WCHAR *, IEnumWbemClassObject *, UINT, struct record *, IWbemClassObject **) DECLSPEC_HIDDEN
Definition: class.c:1021
HRESULT set_value(const struct table *, UINT, UINT, LONGLONG, CIMTYPE) DECLSPEC_HIDDEN
Definition: table.c:219
void free_query(struct query *) DECLSPEC_HIDDEN
Definition: query.c:765
static const WCHAR param_defkeyW[]
static const WCHAR method_stopserviceW[]
HRESULT execute_view(struct view *) DECLSPEC_HIDDEN
Definition: query.c:739
HRESULT security_get_sd(IWbemClassObject *, IWbemClassObject *, IWbemClassObject **) DECLSPEC_HIDDEN
Definition: security.c:132
HRESULT reg_enum_key(IWbemClassObject *, IWbemClassObject *, IWbemClassObject **) DECLSPEC_HIDDEN
Definition: reg.c:198
static const WCHAR param_subkeynameW[]
HRESULT EnumWbemClassObject_create(struct query *, LPVOID *) DECLSPEC_HIDDEN
Definition: class.c:199
void destroy_array(struct array *, CIMTYPE) DECLSPEC_HIDDEN
Definition: class.c:240
BOOL is_result_prop(const struct view *, const WCHAR *) DECLSPEC_HIDDEN
Definition: query.c:804
HRESULT service_pause_service(IWbemClassObject *, IWbemClassObject *, IWbemClassObject **) DECLSPEC_HIDDEN
Definition: service.c:79
HRESULT get_properties(const struct view *, UINT, LONG, SAFEARRAY **) DECLSPEC_HIDDEN
Definition: query.c:1401
HRESULT reg_get_stringvalue(IWbemClassObject *, IWbemClassObject *, IWbemClassObject **) DECLSPEC_HIDDEN
Definition: reg.c:391
#define HRESULT
Definition: msvc.h:7
__wchar_t WCHAR
Definition: xmlstorage.h:180
unsigned char BYTE
Definition: xxhash.c:193