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 #define COL_TYPE_MASK 0x0000ffff
25 #define COL_FLAG_DYNAMIC 0x00010000
26 #define COL_FLAG_KEY 0x00020000
38 const struct column *columns;
41 void (*fill)(struct table *);
48 const struct property *next;
89 struct complex_expr expr;
90 const struct property *propval;
98 const struct property *proplist;
100 const struct expr *cond;
111 void free_query( struct query * ) DECLSPEC_HIDDEN;
112 HRESULT exec_query( const WCHAR *, IEnumWbemClassObject ** ) DECLSPEC_HIDDEN;
113 HRESULT parse_query( const WCHAR *, struct view **, struct list * ) DECLSPEC_HIDDEN;
114 HRESULT create_view( const struct property *, const WCHAR *, const struct expr *,
115 struct view ** ) DECLSPEC_HIDDEN;
116 void destroy_view( struct view * ) DECLSPEC_HIDDEN;
117 struct table *get_table( const WCHAR * ) DECLSPEC_HIDDEN;
118 HRESULT get_propval( const struct view *, UINT, const WCHAR *, VARIANT *,
119 CIMTYPE * ) DECLSPEC_HIDDEN;
120 HRESULT get_properties( const struct view *, SAFEARRAY ** ) DECLSPEC_HIDDEN;
122 HRESULT WbemLocator_create(IUnknown *, LPVOID *) DECLSPEC_HIDDEN;
123 HRESULT WbemServices_create(IUnknown *, const WCHAR *, LPVOID *) DECLSPEC_HIDDEN;
124 HRESULT WbemClassObject_create(IUnknown *, IEnumWbemClassObject *, UINT, LPVOID *) DECLSPEC_HIDDEN;
125 HRESULT EnumWbemClassObject_create(IUnknown *, struct query *, LPVOID *) DECLSPEC_HIDDEN;
127 static void *heap_alloc( size_t len ) __WINE_ALLOC_SIZE(1);
128 static inline void *heap_alloc( size_t len )
130 return HeapAlloc( GetProcessHeap(), 0, len );
133 static void *heap_realloc( void *mem, size_t len ) __WINE_ALLOC_SIZE(2);
134 static inline void *heap_realloc( void *mem, size_t len )
136 return HeapReAlloc( GetProcessHeap(), 0, mem, len );
139 static inline BOOL heap_free( void *mem )
141 return HeapFree( GetProcessHeap(), 0, mem );
144 static inline WCHAR *heap_strdupW( const WCHAR *src )
147 if (!src) return NULL;
148 if ((dst = heap_alloc( (strlenW( src ) + 1) * sizeof(WCHAR) ))) strcpyW( dst, src );