wbemprox: Implement IWbemClassObject::GetMethod.
[wine/multimedia.git] / dlls / wbemprox / wbemprox_private.h
bloba5f0a42beee91a283bfd2f61e43fdef75add9497
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 IClientSecurity client_security;
23 struct list *table_list;
25 #define SIZEOF(array) (sizeof(array)/sizeof((array)[0]))
27 enum param_direction
29 PARAM_OUT = -1,
30 PARAM_INOUT = 0,
31 PARAM_IN = 1
34 #define COL_TYPE_MASK 0x0000ffff
35 #define COL_FLAG_DYNAMIC 0x00010000
36 #define COL_FLAG_KEY 0x00020000
37 #define COL_FLAG_METHOD 0x00040000
39 typedef HRESULT (class_method)(IWbemClassObject *, IWbemClassObject **);
41 struct column
43 const WCHAR *name;
44 UINT type;
45 VARTYPE vartype; /* 0 for default mapping */
48 #define TABLE_FLAG_DYNAMIC 0x00000001
50 struct table
52 const WCHAR *name;
53 UINT num_cols;
54 const struct column *columns;
55 UINT num_rows;
56 BYTE *data;
57 void (*fill)(struct table *);
58 UINT flags;
59 struct list entry;
62 struct property
64 const WCHAR *name;
65 const WCHAR *class;
66 const struct property *next;
69 enum operator
71 OP_EQ = 1,
72 OP_AND = 2,
73 OP_OR = 3,
74 OP_GT = 4,
75 OP_LT = 5,
76 OP_LE = 6,
77 OP_GE = 7,
78 OP_NE = 8,
79 OP_ISNULL = 9,
80 OP_NOTNULL = 10,
81 OP_LIKE = 11
84 struct expr;
85 struct complex_expr
87 enum operator op;
88 struct expr *left;
89 struct expr *right;
92 enum expr_type
94 EXPR_COMPLEX = 1,
95 EXPR_UNARY = 2,
96 EXPR_PROPVAL = 3,
97 EXPR_SVAL = 4,
98 EXPR_IVAL = 5,
99 EXPR_BVAL = 6
102 struct expr
104 enum expr_type type;
105 union
107 struct complex_expr expr;
108 const struct property *propval;
109 const WCHAR *sval;
110 int ival;
111 } u;
114 struct view
116 const struct property *proplist;
117 struct table *table;
118 const struct expr *cond;
119 UINT *result;
120 UINT count;
123 struct query
125 LONG refs;
126 struct view *view;
127 struct list mem;
130 void addref_query( struct query * ) DECLSPEC_HIDDEN;
131 void release_query( struct query *query ) DECLSPEC_HIDDEN;
132 HRESULT exec_query( const WCHAR *, IEnumWbemClassObject ** ) DECLSPEC_HIDDEN;
133 HRESULT parse_query( const WCHAR *, struct view **, struct list * ) DECLSPEC_HIDDEN;
134 HRESULT create_view( const struct property *, const WCHAR *, const struct expr *,
135 struct view ** ) DECLSPEC_HIDDEN;
136 void destroy_view( struct view * ) DECLSPEC_HIDDEN;
137 void init_table_list( void ) DECLSPEC_HIDDEN;
138 struct table *get_table( const WCHAR * ) DECLSPEC_HIDDEN;
139 struct table *create_table( const WCHAR *, UINT, const struct column *, UINT,
140 BYTE *, void (*)(struct table *)) DECLSPEC_HIDDEN;
141 BOOL add_table( struct table * ) DECLSPEC_HIDDEN;
142 void free_columns( struct column *, UINT ) DECLSPEC_HIDDEN;
143 void free_table( struct table * ) DECLSPEC_HIDDEN;
144 UINT get_type_size( CIMTYPE ) DECLSPEC_HIDDEN;
145 HRESULT get_column_index( const struct table *, const WCHAR *, UINT * ) DECLSPEC_HIDDEN;
146 HRESULT get_value( const struct table *, UINT, UINT, LONGLONG * ) DECLSPEC_HIDDEN;
147 BSTR get_value_bstr( const struct table *, UINT, UINT ) DECLSPEC_HIDDEN;
148 HRESULT set_value( const struct table *, UINT, UINT, LONGLONG, CIMTYPE ) DECLSPEC_HIDDEN;
149 HRESULT get_propval( const struct view *, UINT, const WCHAR *, VARIANT *,
150 CIMTYPE *, LONG * ) DECLSPEC_HIDDEN;
151 HRESULT put_propval( const struct view *, UINT, const WCHAR *, VARIANT *, CIMTYPE ) DECLSPEC_HIDDEN;
152 HRESULT get_properties( const struct view *, SAFEARRAY ** ) DECLSPEC_HIDDEN;
153 HRESULT get_object( const WCHAR *, IWbemClassObject ** ) DECLSPEC_HIDDEN;
155 HRESULT WbemLocator_create(IUnknown *, LPVOID *) DECLSPEC_HIDDEN;
156 HRESULT WbemServices_create(IUnknown *, const WCHAR *, LPVOID *) DECLSPEC_HIDDEN;
157 HRESULT WbemClassObject_create(IUnknown *, IEnumWbemClassObject *, UINT, LPVOID *) DECLSPEC_HIDDEN;
158 HRESULT EnumWbemClassObject_create(IUnknown *, struct query *, LPVOID *) DECLSPEC_HIDDEN;
160 static void *heap_alloc( size_t len ) __WINE_ALLOC_SIZE(1);
161 static inline void *heap_alloc( size_t len )
163 return HeapAlloc( GetProcessHeap(), 0, len );
166 static void *heap_realloc( void *mem, size_t len ) __WINE_ALLOC_SIZE(2);
167 static inline void *heap_realloc( void *mem, size_t len )
169 return HeapReAlloc( GetProcessHeap(), 0, mem, len );
172 static void *heap_alloc_zero( size_t len ) __WINE_ALLOC_SIZE(1);
173 static inline void *heap_alloc_zero( size_t len )
175 return HeapAlloc( GetProcessHeap(), HEAP_ZERO_MEMORY, len );
178 static inline BOOL heap_free( void *mem )
180 return HeapFree( GetProcessHeap(), 0, mem );
183 static inline WCHAR *heap_strdupW( const WCHAR *src )
185 WCHAR *dst;
186 if (!src) return NULL;
187 if ((dst = heap_alloc( (strlenW( src ) + 1) * sizeof(WCHAR) ))) strcpyW( dst, src );
188 return dst;