wbemprox: Add a partial Win32_Process class implementation.
[wine/multimedia.git] / dlls / wbemprox / wbemprox_private.h
blob15a7146b031e3a335ebb86bb1c55d145205fdb21
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/list.h"
20 #include "wine/unicode.h"
22 #define SIZEOF(array) (sizeof(array)/sizeof((array)[0]))
24 struct column
26 const WCHAR *name;
27 CIMTYPE_ENUMERATION type;
30 struct table
32 const WCHAR *name;
33 UINT num_cols;
34 const struct column *columns;
35 UINT num_rows;
36 BYTE *data;
37 void (*fill)(struct table *);
40 struct property
42 const WCHAR *name;
43 const WCHAR *class;
44 const struct property *next;
47 enum operator
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,
57 OP_ISNULL = 9,
58 OP_NOTNULL = 10,
59 OP_LIKE = 11
62 struct expr;
63 struct complex_expr
65 enum operator op;
66 struct expr *left;
67 struct expr *right;
70 enum expr_type
72 EXPR_COMPLEX = 1,
73 EXPR_UNARY = 2,
74 EXPR_PROPVAL = 3,
75 EXPR_SVAL = 4,
76 EXPR_IVAL = 5,
77 EXPR_BVAL = 6
80 struct expr
82 enum expr_type type;
83 union
85 struct complex_expr expr;
86 const struct property *propval;
87 const WCHAR *sval;
88 int ival;
89 } u;
92 struct view
94 const struct property *proplist;
95 struct table *table;
96 const struct expr *cond;
97 UINT *result;
98 UINT count;
99 UINT index;
102 struct query
104 struct view *view;
105 struct list mem;
108 void free_query( struct query * ) DECLSPEC_HIDDEN;
109 HRESULT exec_query( const WCHAR *, IEnumWbemClassObject ** ) DECLSPEC_HIDDEN;
110 HRESULT parse_query( const WCHAR *, struct view **, struct list * ) DECLSPEC_HIDDEN;
111 HRESULT create_view( const struct property *, const WCHAR *, const struct expr *,
112 struct view ** ) DECLSPEC_HIDDEN;
113 void destroy_view( struct view * ) DECLSPEC_HIDDEN;
114 struct table *get_table( const WCHAR * ) DECLSPEC_HIDDEN;
115 HRESULT get_propval( const struct view *, UINT, const WCHAR *, VARIANT *,
116 CIMTYPE * ) DECLSPEC_HIDDEN;
118 HRESULT WbemLocator_create(IUnknown *, LPVOID *) DECLSPEC_HIDDEN;
119 HRESULT WbemServices_create(IUnknown *, LPVOID *) DECLSPEC_HIDDEN;
120 HRESULT WbemClassObject_create(IUnknown *, IEnumWbemClassObject *, UINT, LPVOID *) DECLSPEC_HIDDEN;
121 HRESULT EnumWbemClassObject_create(IUnknown *, struct query *, LPVOID *) DECLSPEC_HIDDEN;
123 static void *heap_alloc( size_t len ) __WINE_ALLOC_SIZE(1);
124 static inline void *heap_alloc( size_t len )
126 return HeapAlloc( GetProcessHeap(), 0, len );
129 static void *heap_realloc( void *mem, size_t len ) __WINE_ALLOC_SIZE(2);
130 static inline void *heap_realloc( void *mem, size_t len )
132 return HeapReAlloc( GetProcessHeap(), 0, mem, len );
135 static inline BOOL heap_free( void *mem )
137 return HeapFree( GetProcessHeap(), 0, mem );
140 static inline WCHAR *heap_strdupW( const WCHAR *src )
142 WCHAR *dst;
143 if (!src) return NULL;
144 if ((dst = heap_alloc( (strlenW( src ) + 1) * sizeof(WCHAR) ))) strcpyW( dst, src );
145 return dst;