2 * Copyright 2012 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
28 #include "wine/debug.h"
29 #include "wbemprox_private.h"
31 WINE_DEFAULT_DEBUG_CHANNEL(wbemprox
);
33 HRESULT
create_view( const struct property
*proplist
, const WCHAR
*class,
34 const struct expr
*cond
, struct view
**ret
)
36 struct view
*view
= heap_alloc( sizeof(struct view
) );
38 if (!view
) return E_OUTOFMEMORY
;
39 view
->proplist
= proplist
;
40 view
->table
= get_table( class );
46 void destroy_view( struct view
*view
)
51 static struct query
*alloc_query(void)
55 if (!(query
= heap_alloc( sizeof(*query
) ))) return NULL
;
56 list_init( &query
->mem
);
60 void free_query( struct query
*query
)
62 struct list
*mem
, *next
;
64 destroy_view( query
->view
);
65 LIST_FOR_EACH_SAFE( mem
, next
, &query
->mem
)
72 HRESULT
exec_query( const WCHAR
*str
, IEnumWbemClassObject
**result
)
78 if (!(query
= alloc_query())) return E_OUTOFMEMORY
;
79 hr
= parse_query( str
, &query
->view
, &query
->mem
);
85 hr
= EnumWbemClassObject_create( NULL
, query
, (void **)result
);
86 if (hr
!= S_OK
) free_query( query
);