winemac.drv: Don't filter non active displays out.
[wine/zf.git] / dlls / wbemprox / wbemprox_private.h
blobfec67f47e1b3681062ef3c4bffa4e47d04e9f17b
1 /*
2 * Copyright 2009 Hans Leidekker for CodeWeavers
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.
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.
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
19 #include "wine/debug.h"
20 #include "wine/heap.h"
21 #include "wine/list.h"
23 extern IClientSecurity client_security DECLSPEC_HIDDEN;
24 extern struct list *table_list DECLSPEC_HIDDEN;
26 enum param_direction
28 PARAM_OUT = -1,
29 PARAM_INOUT = 0,
30 PARAM_IN = 1
33 #define CIM_TYPE_MASK 0x00000fff
35 #define COL_TYPE_MASK 0x0000ffff
36 #define COL_FLAG_DYNAMIC 0x00010000
37 #define COL_FLAG_KEY 0x00020000
38 #define COL_FLAG_METHOD 0x00040000
40 typedef HRESULT (class_method)(IWbemClassObject *object, IWbemContext *context, IWbemClassObject *in_params,
41 IWbemClassObject **out_params);
43 enum operator
45 OP_EQ = 1,
46 OP_AND = 2,
47 OP_OR = 3,
48 OP_GT = 4,
49 OP_LT = 5,
50 OP_LE = 6,
51 OP_GE = 7,
52 OP_NE = 8,
53 OP_ISNULL = 9,
54 OP_NOTNULL = 10,
55 OP_LIKE = 11,
56 OP_NOT = 12
59 struct expr;
60 struct complex_expr
62 enum operator op;
63 struct expr *left;
64 struct expr *right;
67 enum expr_type
69 EXPR_COMPLEX = 1,
70 EXPR_UNARY = 2,
71 EXPR_PROPVAL = 3,
72 EXPR_SVAL = 4,
73 EXPR_IVAL = 5,
74 EXPR_BVAL = 6
77 struct expr
79 enum expr_type type;
80 union
82 struct complex_expr expr;
83 const struct property *propval;
84 const WCHAR *sval;
85 int ival;
86 } u;
89 struct column
91 const WCHAR *name;
92 UINT type;
95 enum fill_status
97 FILL_STATUS_FAILED = -1,
98 FILL_STATUS_UNFILTERED,
99 FILL_STATUS_FILTERED
102 #define TABLE_FLAG_DYNAMIC 0x00000001
104 struct table
106 const WCHAR *name;
107 UINT num_cols;
108 const struct column *columns;
109 UINT num_rows;
110 UINT num_rows_allocated;
111 BYTE *data;
112 enum fill_status (*fill)(struct table *, const struct expr *cond);
113 UINT flags;
114 struct list entry;
115 LONG refs;
118 struct property
120 const WCHAR *name;
121 const WCHAR *class;
122 const struct property *next;
125 struct array
127 UINT elem_size;
128 UINT count;
129 void *ptr;
132 struct field
134 UINT type;
135 union
137 LONGLONG ival;
138 WCHAR *sval;
139 struct array *aval;
140 } u;
143 struct record
145 UINT count;
146 struct field *fields;
147 struct table *table;
150 struct keyword
152 const WCHAR *name;
153 const WCHAR *value;
154 const struct keyword *next;
157 enum view_type
159 VIEW_TYPE_SELECT,
160 VIEW_TYPE_ASSOCIATORS,
163 struct view
165 enum view_type type;
166 const WCHAR *path; /* ASSOCIATORS OF query */
167 const struct keyword *keywordlist;
168 const struct property *proplist; /* SELECT query */
169 const struct expr *cond;
170 UINT table_count;
171 struct table **table;
172 UINT result_count;
173 UINT *result;
176 struct query
178 LONG refs;
179 struct view *view;
180 struct list mem;
183 struct path
185 WCHAR *class;
186 UINT class_len;
187 WCHAR *filter;
188 UINT filter_len;
191 HRESULT parse_path( const WCHAR *, struct path ** ) DECLSPEC_HIDDEN;
192 void free_path( struct path * ) DECLSPEC_HIDDEN;
193 WCHAR *query_from_path( const struct path * ) DECLSPEC_HIDDEN;
195 struct query *create_query(void) DECLSPEC_HIDDEN;
196 void free_query( struct query * ) DECLSPEC_HIDDEN;
197 struct query *addref_query( struct query * ) DECLSPEC_HIDDEN;
198 void release_query( struct query *query ) DECLSPEC_HIDDEN;
199 HRESULT exec_query( const WCHAR *, IEnumWbemClassObject ** ) DECLSPEC_HIDDEN;
200 HRESULT parse_query( const WCHAR *, struct view **, struct list * ) DECLSPEC_HIDDEN;
201 HRESULT create_view( enum view_type, const WCHAR *, const struct keyword *, const WCHAR *, const struct property *,
202 const struct expr *, struct view ** ) DECLSPEC_HIDDEN;
203 void destroy_view( struct view * ) DECLSPEC_HIDDEN;
204 HRESULT execute_view( struct view * ) DECLSPEC_HIDDEN;
205 struct table *get_view_table( const struct view *, UINT ) DECLSPEC_HIDDEN;
206 void init_table_list( void ) DECLSPEC_HIDDEN;
207 struct table *grab_table( const WCHAR * ) DECLSPEC_HIDDEN;
208 struct table *addref_table( struct table * ) DECLSPEC_HIDDEN;
209 void release_table( struct table * ) DECLSPEC_HIDDEN;
210 struct table *create_table( const WCHAR *, UINT, const struct column *, UINT, UINT, BYTE *,
211 enum fill_status (*)(struct table *, const struct expr *) ) DECLSPEC_HIDDEN;
212 BOOL add_table( struct table * ) DECLSPEC_HIDDEN;
213 void free_columns( struct column *, UINT ) DECLSPEC_HIDDEN;
214 void free_row_values( const struct table *, UINT ) DECLSPEC_HIDDEN;
215 void clear_table( struct table * ) DECLSPEC_HIDDEN;
216 void free_table( struct table * ) DECLSPEC_HIDDEN;
217 UINT get_type_size( CIMTYPE ) DECLSPEC_HIDDEN;
218 HRESULT eval_cond( const struct table *, UINT, const struct expr *, LONGLONG *, UINT * ) DECLSPEC_HIDDEN;
219 HRESULT get_column_index( const struct table *, const WCHAR *, UINT * ) DECLSPEC_HIDDEN;
220 HRESULT get_value( const struct table *, UINT, UINT, LONGLONG * ) DECLSPEC_HIDDEN;
221 BSTR get_value_bstr( const struct table *, UINT, UINT ) DECLSPEC_HIDDEN;
222 HRESULT set_value( const struct table *, UINT, UINT, LONGLONG, CIMTYPE ) DECLSPEC_HIDDEN;
223 BOOL is_method( const struct table *, UINT ) DECLSPEC_HIDDEN;
224 HRESULT get_method( const struct table *, const WCHAR *, class_method ** ) DECLSPEC_HIDDEN;
225 HRESULT get_propval( const struct view *, UINT, const WCHAR *, VARIANT *, CIMTYPE *, LONG * ) DECLSPEC_HIDDEN;
226 HRESULT put_propval( const struct view *, UINT, const WCHAR *, VARIANT *, CIMTYPE ) DECLSPEC_HIDDEN;
227 HRESULT to_longlong( VARIANT *, LONGLONG *, CIMTYPE * ) DECLSPEC_HIDDEN;
228 SAFEARRAY *to_safearray( const struct array *, CIMTYPE ) DECLSPEC_HIDDEN;
229 VARTYPE to_vartype( CIMTYPE ) DECLSPEC_HIDDEN;
230 void destroy_array( struct array *, CIMTYPE ) DECLSPEC_HIDDEN;
231 BOOL is_result_prop( const struct view *, const WCHAR * ) DECLSPEC_HIDDEN;
232 HRESULT get_properties( const struct view *, UINT, LONG, SAFEARRAY ** ) DECLSPEC_HIDDEN;
233 HRESULT get_object( const WCHAR *, IWbemClassObject ** ) DECLSPEC_HIDDEN;
234 BSTR get_method_name( const WCHAR *, UINT ) DECLSPEC_HIDDEN;
235 void set_variant( VARTYPE, LONGLONG, void *, VARIANT * ) DECLSPEC_HIDDEN;
236 HRESULT create_signature( const WCHAR *, const WCHAR *, enum param_direction,
237 IWbemClassObject ** ) DECLSPEC_HIDDEN;
239 HRESULT WbemLocator_create(LPVOID *) DECLSPEC_HIDDEN;
240 HRESULT WbemServices_create(const WCHAR *, IWbemContext *, LPVOID *) DECLSPEC_HIDDEN;
241 HRESULT WbemContext_create(void **) DECLSPEC_HIDDEN;
242 HRESULT create_class_object(const WCHAR *, IEnumWbemClassObject *, UINT,
243 struct record *, IWbemClassObject **) DECLSPEC_HIDDEN;
244 HRESULT EnumWbemClassObject_create(struct query *, LPVOID *) DECLSPEC_HIDDEN;
245 HRESULT WbemQualifierSet_create(const WCHAR *, const WCHAR *, LPVOID *) DECLSPEC_HIDDEN;
247 HRESULT process_get_owner(IWbemClassObject *obj, IWbemContext *context, IWbemClassObject *in, IWbemClassObject **out) DECLSPEC_HIDDEN;
248 HRESULT reg_create_key(IWbemClassObject *obj, IWbemContext *context, IWbemClassObject *in, IWbemClassObject **out) DECLSPEC_HIDDEN;
249 HRESULT reg_enum_key(IWbemClassObject *obj, IWbemContext *context, IWbemClassObject *in, IWbemClassObject **out) DECLSPEC_HIDDEN;
250 HRESULT reg_enum_values(IWbemClassObject *obj, IWbemContext *context, IWbemClassObject *in, IWbemClassObject **out) DECLSPEC_HIDDEN;
251 HRESULT reg_get_stringvalue(IWbemClassObject *obj, IWbemContext *context, IWbemClassObject *in, IWbemClassObject **out) DECLSPEC_HIDDEN;
252 HRESULT reg_set_stringvalue(IWbemClassObject *obj, IWbemContext *context, IWbemClassObject *in, IWbemClassObject **out) DECLSPEC_HIDDEN;
253 HRESULT reg_set_dwordvalue(IWbemClassObject *obj, IWbemContext *context, IWbemClassObject *in, IWbemClassObject **out) DECLSPEC_HIDDEN;
254 HRESULT reg_delete_key(IWbemClassObject *obj, IWbemContext *context, IWbemClassObject *in, IWbemClassObject **out) DECLSPEC_HIDDEN;
255 HRESULT service_pause_service(IWbemClassObject *obj, IWbemContext *context, IWbemClassObject *in, IWbemClassObject **out) DECLSPEC_HIDDEN;
256 HRESULT service_resume_service(IWbemClassObject *obj, IWbemContext *context, IWbemClassObject *in, IWbemClassObject **out) DECLSPEC_HIDDEN;
257 HRESULT service_start_service(IWbemClassObject *obj, IWbemContext *context, IWbemClassObject *in, IWbemClassObject **out) DECLSPEC_HIDDEN;
258 HRESULT service_stop_service(IWbemClassObject *obj, IWbemContext *context, IWbemClassObject *in, IWbemClassObject **out) DECLSPEC_HIDDEN;
259 HRESULT security_get_sd(IWbemClassObject *obj, IWbemContext *context, IWbemClassObject *in, IWbemClassObject **out) DECLSPEC_HIDDEN;
260 HRESULT security_set_sd(IWbemClassObject *obj, IWbemContext *context, IWbemClassObject *in, IWbemClassObject **out) DECLSPEC_HIDDEN;
261 HRESULT sysrestore_create(IWbemClassObject *obj, IWbemContext *context, IWbemClassObject *in, IWbemClassObject **out) DECLSPEC_HIDDEN;
262 HRESULT sysrestore_disable(IWbemClassObject *obj, IWbemContext *context, IWbemClassObject *in, IWbemClassObject **out) DECLSPEC_HIDDEN;
263 HRESULT sysrestore_enable(IWbemClassObject *obj, IWbemContext *context, IWbemClassObject *in, IWbemClassObject **out) DECLSPEC_HIDDEN;
264 HRESULT sysrestore_get_last_status(IWbemClassObject *obj, IWbemContext *context, IWbemClassObject *in, IWbemClassObject **out) DECLSPEC_HIDDEN;
265 HRESULT sysrestore_restore(IWbemClassObject *obj, IWbemContext *context, IWbemClassObject *in, IWbemClassObject **out) DECLSPEC_HIDDEN;
267 static inline WCHAR *heap_strdupW( const WCHAR *src )
269 WCHAR *dst;
270 if (!src) return NULL;
271 if ((dst = heap_alloc( (lstrlenW( src ) + 1) * sizeof(WCHAR) ))) lstrcpyW( dst, src );
272 return dst;
275 static inline WCHAR *heap_strdupAW( const char *src )
277 int len;
278 WCHAR *dst;
279 if (!src) return NULL;
280 len = MultiByteToWideChar( CP_ACP, 0, src, -1, NULL, 0 );
281 if ((dst = heap_alloc( len * sizeof(*dst) ))) MultiByteToWideChar( CP_ACP, 0, src, -1, dst, len );
282 return dst;
285 static inline BOOL is_digit(WCHAR c)
287 return '0' <= c && c <= '9';