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
= grab_table( class );
48 void destroy_view( struct view
*view
)
51 if (view
->table
) release_table( view
->table
);
52 heap_free( view
->result
);
56 static BOOL
eval_like( const WCHAR
*lstr
, const WCHAR
*rstr
)
58 const WCHAR
*p
= lstr
, *q
= rstr
;
64 while (*q
== '%') q
++;
66 while (*p
&& toupperW( p
[1] ) != toupperW( q
[1] )) p
++;
69 if (toupperW( *p
++ ) != toupperW( *q
++ )) return FALSE
;
74 static HRESULT
eval_strcmp( UINT op
, const WCHAR
*lstr
, const WCHAR
*rstr
, LONGLONG
*val
)
84 *val
= !strcmpW( lstr
, rstr
);
87 *val
= strcmpW( lstr
, rstr
) > 0;
90 *val
= strcmpW( lstr
, rstr
) < 0;
93 *val
= strcmpW( lstr
, rstr
) <= 0;
96 *val
= strcmpW( lstr
, rstr
) >= 0;
99 *val
= strcmpW( lstr
, rstr
);
102 *val
= eval_like( lstr
, rstr
);
105 ERR("unhandled operator %u\n", op
);
106 return WBEM_E_INVALID_QUERY
;
111 static inline BOOL
is_strcmp( const struct complex_expr
*expr
)
113 return ((expr
->left
->type
== EXPR_PROPVAL
&& expr
->right
->type
== EXPR_SVAL
) ||
114 (expr
->left
->type
== EXPR_SVAL
&& expr
->right
->type
== EXPR_PROPVAL
));
117 static inline BOOL
is_boolcmp( const struct complex_expr
*expr
, UINT ltype
, UINT rtype
)
119 if (ltype
== CIM_BOOLEAN
&& expr
->left
->type
== EXPR_PROPVAL
&&
120 (expr
->right
->type
== EXPR_SVAL
|| expr
->right
->type
== EXPR_BVAL
)) return TRUE
;
121 else if (rtype
== CIM_BOOLEAN
&& expr
->right
->type
== EXPR_PROPVAL
&&
122 (expr
->left
->type
== EXPR_SVAL
|| expr
->left
->type
== EXPR_BVAL
)) return TRUE
;
126 static HRESULT
eval_boolcmp( UINT op
, LONGLONG lval
, LONGLONG rval
, UINT ltype
, UINT rtype
, LONGLONG
*val
)
128 static const WCHAR trueW
[] = {'T','r','u','e',0};
130 if (ltype
== CIM_STRING
) lval
= !strcmpiW( (const WCHAR
*)(INT_PTR
)lval
, trueW
) ? -1 : 0;
131 else if (rtype
== CIM_STRING
) rval
= !strcmpiW( (const WCHAR
*)(INT_PTR
)rval
, trueW
) ? -1 : 0;
136 *val
= (lval
== rval
);
139 *val
= (lval
!= rval
);
142 ERR("unhandled operator %u\n", op
);
143 return WBEM_E_INVALID_QUERY
;
148 static UINT
resolve_type( UINT left
, UINT right
)
176 if (right
== CIM_STRING
) return CIM_STRING
;
180 if (right
== CIM_BOOLEAN
) return CIM_BOOLEAN
;
189 static HRESULT
eval_binary( const struct table
*table
, UINT row
, const struct complex_expr
*expr
,
190 LONGLONG
*val
, UINT
*type
)
196 lret
= eval_cond( table
, row
, expr
->left
, &lval
, <ype
);
197 rret
= eval_cond( table
, row
, expr
->right
, &rval
, &rtype
);
198 if (lret
!= S_OK
|| rret
!= S_OK
) return WBEM_E_INVALID_QUERY
;
200 *type
= resolve_type( ltype
, rtype
);
202 if (is_boolcmp( expr
, ltype
, rtype
))
203 return eval_boolcmp( expr
->op
, lval
, rval
, ltype
, rtype
, val
);
205 if (is_strcmp( expr
))
207 const WCHAR
*lstr
= (const WCHAR
*)(INT_PTR
)lval
;
208 const WCHAR
*rstr
= (const WCHAR
*)(INT_PTR
)rval
;
210 return eval_strcmp( expr
->op
, lstr
, rstr
, val
);
215 *val
= (lval
== rval
);
218 *val
= (lval
&& rval
);
221 *val
= (lval
|| rval
);
224 *val
= (lval
> rval
);
227 *val
= (lval
< rval
);
230 *val
= (lval
<= rval
);
233 *val
= (lval
>= rval
);
236 *val
= (lval
!= rval
);
239 ERR("unhandled operator %u\n", expr
->op
);
240 return WBEM_E_INVALID_QUERY
;
245 static HRESULT
eval_unary( const struct table
*table
, UINT row
, const struct complex_expr
*expr
,
246 LONGLONG
*val
, UINT
*type
)
253 if (expr
->op
== OP_NOT
)
255 hr
= eval_cond( table
, row
, expr
->left
, &lval
, type
);
262 hr
= get_column_index( table
, expr
->left
->u
.propval
->name
, &column
);
266 hr
= get_value( table
, row
, column
, &lval
);
279 ERR("unknown operator %u\n", expr
->op
);
280 return WBEM_E_INVALID_QUERY
;
283 *type
= table
->columns
[column
].type
& CIM_TYPE_MASK
;
287 static HRESULT
eval_propval( const struct table
*table
, UINT row
, const struct property
*propval
,
288 LONGLONG
*val
, UINT
*type
)
294 hr
= get_column_index( table
, propval
->name
, &column
);
298 *type
= table
->columns
[column
].type
& CIM_TYPE_MASK
;
299 return get_value( table
, row
, column
, val
);
302 HRESULT
eval_cond( const struct table
*table
, UINT row
, const struct expr
*cond
, LONGLONG
*val
, UINT
*type
)
313 return eval_binary( table
, row
, &cond
->u
.expr
, val
, type
);
316 return eval_unary( table
, row
, &cond
->u
.expr
, val
, type
);
319 return eval_propval( table
, row
, cond
->u
.propval
, val
, type
);
322 *val
= (INT_PTR
)cond
->u
.sval
;
337 ERR("invalid expression type\n");
340 return WBEM_E_INVALID_QUERY
;
343 HRESULT
execute_view( struct view
*view
)
347 if (!view
->table
) return S_OK
;
348 if (view
->table
->fill
)
350 clear_table( view
->table
);
351 view
->table
->fill( view
->table
, view
->cond
);
353 if (!view
->table
->num_rows
) return S_OK
;
355 len
= min( view
->table
->num_rows
, 16 );
356 if (!(view
->result
= heap_alloc( len
* sizeof(UINT
) ))) return E_OUTOFMEMORY
;
358 for (i
= 0; i
< view
->table
->num_rows
; i
++)
368 if (!(tmp
= heap_realloc( view
->result
, len
* sizeof(UINT
) ))) return E_OUTOFMEMORY
;
371 if ((hr
= eval_cond( view
->table
, i
, view
->cond
, &val
, &type
)) != S_OK
) return hr
;
372 if (val
) view
->result
[j
++] = i
;
378 struct query
*create_query(void)
382 if (!(query
= heap_alloc( sizeof(*query
) ))) return NULL
;
383 list_init( &query
->mem
);
388 void free_query( struct query
*query
)
390 struct list
*mem
, *next
;
393 destroy_view( query
->view
);
394 LIST_FOR_EACH_SAFE( mem
, next
, &query
->mem
) { heap_free( mem
); }
398 struct query
*addref_query( struct query
*query
)
400 InterlockedIncrement( &query
->refs
);
404 void release_query( struct query
*query
)
406 if (!InterlockedDecrement( &query
->refs
)) free_query( query
);
409 HRESULT
exec_query( const WCHAR
*str
, IEnumWbemClassObject
**result
)
415 if (!(query
= create_query())) return E_OUTOFMEMORY
;
416 hr
= parse_query( str
, &query
->view
, &query
->mem
);
417 if (hr
!= S_OK
) goto done
;
418 hr
= execute_view( query
->view
);
419 if (hr
!= S_OK
) goto done
;
420 hr
= EnumWbemClassObject_create( query
, (void **)result
);
423 release_query( query
);
427 BOOL
is_selected_prop( const struct view
*view
, const WCHAR
*name
)
429 const struct property
*prop
= view
->proplist
;
431 if (!prop
) return TRUE
;
434 if (!strcmpiW( prop
->name
, name
)) return TRUE
;
440 static BOOL
is_system_prop( const WCHAR
*name
)
442 return (name
[0] == '_' && name
[1] == '_');
445 static BSTR
build_servername( const struct view
*view
)
447 WCHAR server
[MAX_COMPUTERNAME_LENGTH
+ 1], *p
;
448 DWORD len
= sizeof(server
)/sizeof(server
[0]);
450 if (view
->proplist
) return NULL
;
452 if (!(GetComputerNameW( server
, &len
))) return NULL
;
453 for (p
= server
; *p
; p
++) *p
= toupperW( *p
);
454 return SysAllocString( server
);
457 static BSTR
build_classname( const struct view
*view
)
459 return SysAllocString( view
->table
->name
);
462 static BSTR
build_namespace( const struct view
*view
)
464 static const WCHAR cimv2W
[] = {'R','O','O','T','\\','C','I','M','V','2',0};
466 if (view
->proplist
) return NULL
;
467 return SysAllocString( cimv2W
);
470 static BSTR
build_proplist( const struct view
*view
, UINT index
, UINT count
, UINT
*len
)
472 static const WCHAR fmtW
[] = {'%','s','=','%','s',0};
473 UINT i
, j
, offset
, row
= view
->result
[index
];
474 BSTR
*values
, ret
= NULL
;
476 if (!(values
= heap_alloc( count
* sizeof(BSTR
) ))) return NULL
;
479 for (i
= 0; i
< view
->table
->num_cols
; i
++)
481 if (view
->table
->columns
[i
].type
& COL_FLAG_KEY
)
483 const WCHAR
*name
= view
->table
->columns
[i
].name
;
485 values
[j
] = get_value_bstr( view
->table
, row
, i
);
486 *len
+= strlenW( fmtW
) + strlenW( name
) + strlenW( values
[j
] );
490 if ((ret
= SysAllocStringLen( NULL
, *len
)))
493 for (i
= 0; i
< view
->table
->num_cols
; i
++)
495 if (view
->table
->columns
[i
].type
& COL_FLAG_KEY
)
497 const WCHAR
*name
= view
->table
->columns
[i
].name
;
499 offset
+= sprintfW( ret
+ offset
, fmtW
, name
, values
[j
] );
500 if (j
< count
- 1) ret
[offset
++] = ',';
505 for (i
= 0; i
< count
; i
++) SysFreeString( values
[i
] );
510 static UINT
count_key_columns( const struct view
*view
)
512 UINT i
, num_keys
= 0;
514 for (i
= 0; i
< view
->table
->num_cols
; i
++)
516 if (view
->table
->columns
[i
].type
& COL_FLAG_KEY
) num_keys
++;
521 static BSTR
build_relpath( const struct view
*view
, UINT index
, const WCHAR
*name
)
523 static const WCHAR fmtW
[] = {'%','s','.','%','s',0};
524 BSTR
class, proplist
, ret
= NULL
;
527 if (view
->proplist
) return NULL
;
529 if (!(class = build_classname( view
))) return NULL
;
530 if (!(num_keys
= count_key_columns( view
))) return class;
531 if (!(proplist
= build_proplist( view
, index
, num_keys
, &len
))) goto done
;
533 len
+= strlenW( fmtW
) + SysStringLen( class );
534 if (!(ret
= SysAllocStringLen( NULL
, len
))) goto done
;
535 sprintfW( ret
, fmtW
, class, proplist
);
538 SysFreeString( class );
539 SysFreeString( proplist
);
543 static BSTR
build_path( const struct view
*view
, UINT index
, const WCHAR
*name
)
545 static const WCHAR fmtW
[] = {'\\','\\','%','s','\\','%','s',':','%','s',0};
546 BSTR server
, namespace = NULL
, relpath
= NULL
, ret
= NULL
;
549 if (view
->proplist
) return NULL
;
551 if (!(server
= build_servername( view
))) return NULL
;
552 if (!(namespace = build_namespace( view
))) goto done
;
553 if (!(relpath
= build_relpath( view
, index
, name
))) goto done
;
555 len
= strlenW( fmtW
) + SysStringLen( server
) + SysStringLen( namespace ) + SysStringLen( relpath
);
556 if (!(ret
= SysAllocStringLen( NULL
, len
))) goto done
;
557 sprintfW( ret
, fmtW
, server
, namespace, relpath
);
560 SysFreeString( server
);
561 SysFreeString( namespace );
562 SysFreeString( relpath
);
566 BOOL
is_method( const struct table
*table
, UINT column
)
568 return table
->columns
[column
].type
& COL_FLAG_METHOD
;
571 static UINT
count_properties( const struct view
*view
)
573 UINT i
, num_props
= 0;
575 for (i
= 0; i
< view
->table
->num_cols
; i
++)
577 if (!is_method( view
->table
, i
)) num_props
++;
582 static UINT
count_selected_properties( const struct view
*view
)
584 const struct property
*prop
= view
->proplist
;
587 if (!prop
) return count_properties( view
);
590 while ((prop
= prop
->next
)) count
++;
594 static HRESULT
get_system_propval( const struct view
*view
, UINT index
, const WCHAR
*name
,
595 VARIANT
*ret
, CIMTYPE
*type
, LONG
*flavor
)
597 static const WCHAR classW
[] = {'_','_','C','L','A','S','S',0};
598 static const WCHAR genusW
[] = {'_','_','G','E','N','U','S',0};
599 static const WCHAR pathW
[] = {'_','_','P','A','T','H',0};
600 static const WCHAR namespaceW
[] = {'_','_','N','A','M','E','S','P','A','C','E',0};
601 static const WCHAR propcountW
[] = {'_','_','P','R','O','P','E','R','T','Y','_','C','O','U','N','T',0};
602 static const WCHAR relpathW
[] = {'_','_','R','E','L','P','A','T','H',0};
603 static const WCHAR serverW
[] = {'_','_','S','E','R','V','E','R',0};
605 if (flavor
) *flavor
= WBEM_FLAVOR_ORIGIN_SYSTEM
;
607 if (!strcmpiW( name
, classW
))
609 V_VT( ret
) = VT_BSTR
;
610 V_BSTR( ret
) = build_classname( view
);
611 if (type
) *type
= CIM_STRING
;
614 if (!strcmpiW( name
, genusW
))
617 V_I4( ret
) = WBEM_GENUS_INSTANCE
; /* FIXME */
618 if (type
) *type
= CIM_SINT32
;
621 else if (!strcmpiW( name
, namespaceW
))
623 V_VT( ret
) = VT_BSTR
;
624 V_BSTR( ret
) = build_namespace( view
);
625 if (type
) *type
= CIM_STRING
;
628 else if (!strcmpiW( name
, pathW
))
630 V_VT( ret
) = VT_BSTR
;
631 V_BSTR( ret
) = build_path( view
, index
, name
);
632 if (type
) *type
= CIM_STRING
;
635 if (!strcmpiW( name
, propcountW
))
638 V_I4( ret
) = count_selected_properties( view
);
639 if (type
) *type
= CIM_SINT32
;
642 else if (!strcmpiW( name
, relpathW
))
644 V_VT( ret
) = VT_BSTR
;
645 V_BSTR( ret
) = build_relpath( view
, index
, name
);
646 if (type
) *type
= CIM_STRING
;
649 else if (!strcmpiW( name
, serverW
))
651 V_VT( ret
) = VT_BSTR
;
652 V_BSTR( ret
) = build_servername( view
);
653 if (type
) *type
= CIM_STRING
;
656 FIXME("system property %s not implemented\n", debugstr_w(name
));
657 return WBEM_E_NOT_FOUND
;
660 VARTYPE
to_vartype( CIMTYPE type
)
664 case CIM_BOOLEAN
: return VT_BOOL
;
666 case CIM_DATETIME
: return VT_BSTR
;
667 case CIM_SINT8
: return VT_I1
;
668 case CIM_UINT8
: return VT_UI1
;
669 case CIM_SINT16
: return VT_I2
;
670 case CIM_UINT16
: return VT_UI2
;
671 case CIM_SINT32
: return VT_I4
;
672 case CIM_UINT32
: return VT_UI4
;
673 case CIM_SINT64
: return VT_I8
;
674 case CIM_UINT64
: return VT_UI8
;
676 ERR("unhandled type %u\n", type
);
682 SAFEARRAY
*to_safearray( const struct array
*array
, CIMTYPE type
)
685 UINT size
= get_type_size( type
);
686 VARTYPE vartype
= to_vartype( type
);
689 if (!array
|| !(ret
= SafeArrayCreateVector( vartype
, 0, array
->count
))) return NULL
;
691 for (i
= 0; i
< array
->count
; i
++)
693 void *ptr
= (char *)array
->ptr
+ i
* size
;
694 if (vartype
== VT_BSTR
)
696 BSTR str
= SysAllocString( *(const WCHAR
**)ptr
);
697 if (!str
|| SafeArrayPutElement( ret
, &i
, str
) != S_OK
)
699 SysFreeString( str
);
700 SafeArrayDestroy( ret
);
704 else if (SafeArrayPutElement( ret
, &i
, ptr
) != S_OK
)
706 SafeArrayDestroy( ret
);
713 void set_variant( VARTYPE type
, LONGLONG val
, void *val_ptr
, VARIANT
*ret
)
718 V_ARRAY( ret
) = val_ptr
;
727 V_BSTR( ret
) = val_ptr
;
750 ERR("unhandled variant type %u\n", type
);
756 HRESULT
get_propval( const struct view
*view
, UINT index
, const WCHAR
*name
, VARIANT
*ret
,
757 CIMTYPE
*type
, LONG
*flavor
)
762 void *val_ptr
= NULL
;
765 if (is_system_prop( name
)) return get_system_propval( view
, index
, name
, ret
, type
, flavor
);
766 if (!view
->count
|| !is_selected_prop( view
, name
)) return WBEM_E_NOT_FOUND
;
768 hr
= get_column_index( view
->table
, name
, &column
);
769 if (hr
!= S_OK
|| is_method( view
->table
, column
)) return WBEM_E_NOT_FOUND
;
771 row
= view
->result
[index
];
772 hr
= get_value( view
->table
, row
, column
, &val
);
773 if (hr
!= S_OK
) return hr
;
775 vartype
= view
->table
->columns
[column
].vartype
;
776 if (view
->table
->columns
[column
].type
& CIM_FLAG_ARRAY
)
778 CIMTYPE basetype
= view
->table
->columns
[column
].type
& CIM_TYPE_MASK
;
780 val_ptr
= to_safearray( (const struct array
*)(INT_PTR
)val
, basetype
);
781 if (!vartype
) vartype
= to_vartype( basetype
) | VT_ARRAY
;
784 switch (view
->table
->columns
[column
].type
& COL_TYPE_MASK
)
787 if (!vartype
) vartype
= VT_BOOL
;
794 val_ptr
= SysAllocString( (const WCHAR
*)(INT_PTR
)val
);
800 if (!vartype
) vartype
= VT_I1
;
803 if (!vartype
) vartype
= VT_UI1
;
806 if (!vartype
) vartype
= VT_I2
;
809 if (!vartype
) vartype
= VT_UI2
;
812 if (!vartype
) vartype
= VT_I4
;
815 if (!vartype
) vartype
= VT_UI4
;
819 val_ptr
= get_value_bstr( view
->table
, row
, column
);
823 val_ptr
= get_value_bstr( view
->table
, row
, column
);
826 ERR("unhandled column type %u\n", view
->table
->columns
[column
].type
);
827 return WBEM_E_FAILED
;
831 set_variant( vartype
, val
, val_ptr
, ret
);
832 if (type
) *type
= view
->table
->columns
[column
].type
& COL_TYPE_MASK
;
833 if (flavor
) *flavor
= 0;
837 static CIMTYPE
to_cimtype( VARTYPE type
)
841 case VT_BOOL
: return CIM_BOOLEAN
;
842 case VT_BSTR
: return CIM_STRING
;
843 case VT_I1
: return CIM_SINT8
;
844 case VT_UI1
: return CIM_UINT8
;
845 case VT_I2
: return CIM_SINT16
;
846 case VT_UI2
: return CIM_UINT16
;
847 case VT_I4
: return CIM_SINT32
;
848 case VT_UI4
: return CIM_UINT32
;
849 case VT_I8
: return CIM_SINT64
;
850 case VT_UI8
: return CIM_UINT64
;
852 ERR("unhandled type %u\n", type
);
858 static struct array
*to_array( VARIANT
*var
, CIMTYPE
*type
)
866 if (SafeArrayGetVartype( V_ARRAY( var
), &vartype
) != S_OK
) return NULL
;
867 if (!(basetype
= to_cimtype( vartype
))) return NULL
;
868 if (SafeArrayGetUBound( V_ARRAY( var
), 1, &bound
) != S_OK
) return NULL
;
869 if (!(ret
= heap_alloc( sizeof(struct array
) ))) return NULL
;
871 ret
->count
= bound
+ 1;
872 size
= get_type_size( basetype
);
873 if (!(ret
->ptr
= heap_alloc_zero( ret
->count
* size
)))
878 for (i
= 0; i
< ret
->count
; i
++)
880 void *ptr
= (char *)ret
->ptr
+ i
* size
;
881 if (vartype
== VT_BSTR
)
884 if (SafeArrayGetElement( V_ARRAY( var
), &i
, &str
) != S_OK
)
886 destroy_array( ret
, basetype
);
889 *(WCHAR
**)ptr
= heap_strdupW( str
);
890 SysFreeString( str
);
893 destroy_array( ret
, basetype
);
897 else if (SafeArrayGetElement( V_ARRAY( var
), &i
, ptr
) != S_OK
)
899 destroy_array( ret
, basetype
);
903 *type
= basetype
| CIM_FLAG_ARRAY
;
907 HRESULT
to_longlong( VARIANT
*var
, LONGLONG
*val
, CIMTYPE
*type
)
914 if (V_VT( var
) & VT_ARRAY
)
916 *val
= (INT_PTR
)to_array( var
, type
);
917 if (!*val
) return E_OUTOFMEMORY
;
923 *val
= V_BOOL( var
);
927 *val
= (INT_PTR
)heap_strdupW( V_BSTR( var
) );
928 if (!*val
) return E_OUTOFMEMORY
;
951 ERR("unhandled type %u\n", V_VT( var
));
952 return WBEM_E_FAILED
;
957 HRESULT
put_propval( const struct view
*view
, UINT index
, const WCHAR
*name
, VARIANT
*var
, CIMTYPE type
)
960 UINT column
, row
= view
->result
[index
];
963 hr
= get_column_index( view
->table
, name
, &column
);
966 FIXME("no support for creating new properties\n");
967 return WBEM_E_FAILED
;
969 if (is_method( view
->table
, column
) || !(view
->table
->columns
[column
].type
& COL_FLAG_DYNAMIC
))
970 return WBEM_E_FAILED
;
972 hr
= to_longlong( var
, &val
, &type
);
973 if (hr
!= S_OK
) return hr
;
975 return set_value( view
->table
, row
, column
, val
, type
);
978 HRESULT
get_properties( const struct view
*view
, LONG flags
, SAFEARRAY
**props
)
982 UINT i
, num_props
= count_selected_properties( view
);
985 if (!(sa
= SafeArrayCreateVector( VT_BSTR
, 0, num_props
))) return E_OUTOFMEMORY
;
987 for (i
= 0, j
= 0; i
< view
->table
->num_cols
; i
++)
991 if (is_method( view
->table
, i
)) continue;
992 if (!is_selected_prop( view
, view
->table
->columns
[i
].name
)) continue;
994 is_system
= is_system_prop( view
->table
->columns
[i
].name
);
995 if ((flags
& WBEM_FLAG_NONSYSTEM_ONLY
) && is_system
) continue;
996 else if ((flags
& WBEM_FLAG_SYSTEM_ONLY
) && !is_system
) continue;
998 str
= SysAllocString( view
->table
->columns
[i
].name
);
999 if (!str
|| SafeArrayPutElement( sa
, &j
, str
) != S_OK
)
1001 SysFreeString( str
);
1002 SafeArrayDestroy( sa
);
1003 return E_OUTOFMEMORY
;