msi: Add error handling when retriving component/feature state/action in condition.
[wine.git] / dlls / msi / cond.y
blob6ee6ab979cc71fab1a673444324ec8cff43348d7
1 %{
3 /*
4 * Implementation of the Microsoft Installer (msi.dll)
6 * Copyright 2003 Mike McCormack for CodeWeavers
8 * This library is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Lesser General Public
10 * License as published by the Free Software Foundation; either
11 * version 2.1 of the License, or (at your option) any later version.
13 * This library is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 * Lesser General Public License for more details.
18 * You should have received a copy of the GNU Lesser General Public
19 * License along with this library; if not, write to the Free Software
20 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
23 #define COBJMACROS
25 #include "config.h"
27 #include <stdarg.h>
28 #include <stdio.h>
29 #include <stdlib.h>
31 #include "windef.h"
32 #include "winbase.h"
33 #include "winuser.h"
34 #include "msi.h"
35 #include "msiquery.h"
36 #include "objbase.h"
37 #include "oleauto.h"
39 #include "msipriv.h"
40 #include "msiserver.h"
41 #include "wine/debug.h"
42 #include "wine/unicode.h"
43 #include "wine/list.h"
45 WINE_DEFAULT_DEBUG_CHANNEL(msi);
47 typedef struct tag_yyinput
49 MSIPACKAGE *package;
50 LPCWSTR str;
51 INT n;
52 MSICONDITION result;
53 struct list mem;
54 } COND_input;
56 struct cond_str {
57 LPCWSTR data;
58 INT len;
61 struct value {
62 enum value_type {
63 VALUE_INTEGER,
64 VALUE_LITERAL,
65 VALUE_SYMBOL
66 } type;
67 union {
68 INT integer;
69 WCHAR *string;
70 } u;
73 static LPWSTR COND_GetString( COND_input *info, const struct cond_str *str );
74 static LPWSTR COND_GetLiteral( COND_input *info, const struct cond_str *str );
75 static int cond_lex( void *COND_lval, COND_input *info);
76 static int cond_error( COND_input *info, const char *str);
78 static void *cond_alloc( COND_input *cond, unsigned int sz );
79 static void *cond_track_mem( COND_input *cond, void *ptr, unsigned int sz );
80 static void cond_free( void *ptr );
82 static INT compare_int( INT a, INT operator, INT b );
83 static INT compare_string( LPCWSTR a, INT operator, LPCWSTR b, BOOL convert );
85 static BOOL num_from_prop( LPCWSTR p, INT *val )
87 INT ret = 0, sign = 1;
89 if (!p)
90 return FALSE;
91 if (*p == '-')
93 sign = -1;
94 p++;
96 if (!*p)
97 return FALSE;
98 while (*p)
100 if( *p < '0' || *p > '9' )
101 return FALSE;
102 ret = ret*10 + (*p - '0');
103 p++;
105 *val = ret*sign;
106 return TRUE;
109 static void value_free( struct value val )
111 if (val.type != VALUE_INTEGER)
112 cond_free( val.u.string );
117 %lex-param { COND_input *info }
118 %parse-param { COND_input *info }
119 %pure-parser
121 %union
123 struct cond_str str;
124 struct value value;
125 LPWSTR identifier;
126 INT operator;
127 BOOL bool;
130 %token COND_SPACE COND_EOF
131 %token COND_OR COND_AND COND_NOT COND_XOR COND_IMP COND_EQV
132 %token COND_LT COND_GT COND_EQ COND_NE COND_GE COND_LE
133 %token COND_ILT COND_IGT COND_IEQ COND_INE COND_IGE COND_ILE
134 %token COND_LPAR COND_RPAR COND_TILDA COND_SS COND_ISS
135 %token COND_ILHS COND_IRHS COND_LHS COND_RHS
136 %token COND_PERCENT COND_DOLLARS COND_QUESTION COND_AMPER COND_EXCLAM
137 %token <str> COND_IDENT <str> COND_NUMBER <str> COND_LITER
139 %nonassoc COND_ERROR COND_EOF
141 %type <bool> expression boolean_term boolean_factor
142 %type <value> value
143 %type <identifier> identifier
144 %type <operator> operator
148 condition:
149 expression
151 COND_input* cond = (COND_input*) info;
152 cond->result = $1;
154 | /* empty */
156 COND_input* cond = (COND_input*) info;
157 cond->result = MSICONDITION_NONE;
161 expression:
162 boolean_term
164 $$ = $1;
166 | expression COND_OR boolean_term
168 $$ = $1 || $3;
170 | expression COND_IMP boolean_term
172 $$ = !$1 || $3;
174 | expression COND_XOR boolean_term
176 $$ = ( $1 || $3 ) && !( $1 && $3 );
178 | expression COND_EQV boolean_term
180 $$ = ( $1 && $3 ) || ( !$1 && !$3 );
184 boolean_term:
185 boolean_factor
187 $$ = $1;
189 | boolean_term COND_AND boolean_factor
191 $$ = $1 && $3;
195 boolean_factor:
196 COND_NOT boolean_factor
198 $$ = !$2;
200 | value
202 if ($1.type == VALUE_INTEGER)
203 $$ = $1.u.integer ? 1 : 0;
204 else
205 $$ = $1.u.string && $1.u.string[0];
206 value_free( $1 );
208 | value operator value
210 if ($1.type == VALUE_INTEGER && $3.type == VALUE_INTEGER)
212 $$ = compare_int($1.u.integer, $2, $3.u.integer);
214 else if ($1.type != VALUE_INTEGER && $3.type != VALUE_INTEGER)
216 $$ = compare_string($1.u.string, $2, $3.u.string,
217 $1.type == VALUE_SYMBOL || $3.type == VALUE_SYMBOL);
219 else if ($1.type == VALUE_LITERAL || $3.type == VALUE_LITERAL)
221 $$ = FALSE;
223 else if ($1.type == VALUE_SYMBOL) /* symbol operator integer */
225 int num;
226 if (num_from_prop( $1.u.string, &num ))
227 $$ = compare_int( num, $2, $3.u.integer );
228 else
229 $$ = ($2 == COND_NE || $2 == COND_INE );
231 else /* integer operator symbol */
233 int num;
234 if (num_from_prop( $3.u.string, &num ))
235 $$ = compare_int( $1.u.integer, $2, num );
236 else
237 $$ = ($2 == COND_NE || $2 == COND_INE );
240 value_free( $1 );
241 value_free( $3 );
243 | COND_LPAR expression COND_RPAR
245 $$ = $2;
249 operator:
250 /* common functions */
251 COND_EQ { $$ = COND_EQ; }
252 | COND_NE { $$ = COND_NE; }
253 | COND_LT { $$ = COND_LT; }
254 | COND_GT { $$ = COND_GT; }
255 | COND_LE { $$ = COND_LE; }
256 | COND_GE { $$ = COND_GE; }
257 | COND_SS { $$ = COND_SS; }
258 | COND_IEQ { $$ = COND_IEQ; }
259 | COND_INE { $$ = COND_INE; }
260 | COND_ILT { $$ = COND_ILT; }
261 | COND_IGT { $$ = COND_IGT; }
262 | COND_ILE { $$ = COND_ILE; }
263 | COND_IGE { $$ = COND_IGE; }
264 | COND_ISS { $$ = COND_ISS; }
265 | COND_LHS { $$ = COND_LHS; }
266 | COND_RHS { $$ = COND_RHS; }
267 | COND_ILHS { $$ = COND_ILHS; }
268 | COND_IRHS { $$ = COND_IRHS; }
271 value:
272 identifier
274 COND_input* cond = (COND_input*) info;
275 UINT len;
277 $$.type = VALUE_SYMBOL;
278 $$.u.string = msi_dup_property( cond->package->db, $1 );
279 if ($$.u.string)
281 len = (lstrlenW($$.u.string) + 1) * sizeof (WCHAR);
282 $$.u.string = cond_track_mem( cond, $$.u.string, len );
284 cond_free( $1 );
286 | COND_PERCENT identifier
288 COND_input* cond = (COND_input*) info;
289 UINT len = GetEnvironmentVariableW( $2, NULL, 0 );
290 $$.type = VALUE_SYMBOL;
291 $$.u.string = NULL;
292 if (len++)
294 $$.u.string = cond_alloc( cond, len*sizeof (WCHAR) );
295 if( !$$.u.string )
296 YYABORT;
297 GetEnvironmentVariableW( $2, $$.u.string, len );
299 cond_free( $2 );
301 | COND_LITER
303 COND_input* cond = (COND_input*) info;
304 $$.type = VALUE_LITERAL;
305 $$.u.string = COND_GetLiteral( cond, &$1 );
306 if( !$$.u.string )
307 YYABORT;
309 | COND_NUMBER
311 COND_input* cond = (COND_input*) info;
312 LPWSTR szNum = COND_GetString( cond, &$1 );
313 if( !szNum )
314 YYABORT;
315 $$.type = VALUE_INTEGER;
316 $$.u.integer = atoiW( szNum );
317 cond_free( szNum );
319 | COND_DOLLARS identifier
321 COND_input* cond = (COND_input*) info;
322 INSTALLSTATE install = INSTALLSTATE_UNKNOWN, action = INSTALLSTATE_UNKNOWN;
324 if(MSI_GetComponentStateW(cond->package, $2, &install, &action ) != ERROR_SUCCESS)
326 $$.type = VALUE_LITERAL;
327 $$.u.string = NULL;
329 else
331 $$.type = VALUE_INTEGER;
332 $$.u.integer = action;
334 cond_free( $2 );
336 | COND_QUESTION identifier
338 COND_input* cond = (COND_input*) info;
339 INSTALLSTATE install = INSTALLSTATE_UNKNOWN, action = INSTALLSTATE_UNKNOWN;
341 if(MSI_GetComponentStateW(cond->package, $2, &install, &action ) != ERROR_SUCCESS)
343 $$.type = VALUE_LITERAL;
344 $$.u.string = NULL;
346 else
348 $$.type = VALUE_INTEGER;
349 $$.u.integer = install;
351 cond_free( $2 );
353 | COND_AMPER identifier
355 COND_input* cond = (COND_input*) info;
356 INSTALLSTATE install, action;
358 if (MSI_GetFeatureStateW(cond->package, $2, &install, &action ) != ERROR_SUCCESS)
360 $$.type = VALUE_LITERAL;
361 $$.u.string = NULL;
363 else
365 $$.type = VALUE_INTEGER;
366 $$.u.integer = action;
368 cond_free( $2 );
370 | COND_EXCLAM identifier
372 COND_input* cond = (COND_input*) info;
373 INSTALLSTATE install = INSTALLSTATE_UNKNOWN, action = INSTALLSTATE_UNKNOWN;
375 if(MSI_GetFeatureStateW(cond->package, $2, &install, &action ) != ERROR_SUCCESS)
377 $$.type = VALUE_LITERAL;
378 $$.u.string = NULL;
380 else
382 $$.type = VALUE_INTEGER;
383 $$.u.integer = install;
385 cond_free( $2 );
389 identifier:
390 COND_IDENT
392 COND_input* cond = (COND_input*) info;
393 $$ = COND_GetString( cond, &$1 );
394 if( !$$ )
395 YYABORT;
402 static int COND_IsAlpha( WCHAR x )
404 return( ( ( x >= 'A' ) && ( x <= 'Z' ) ) ||
405 ( ( x >= 'a' ) && ( x <= 'z' ) ) ||
406 ( ( x == '_' ) ) );
409 static int COND_IsNumber( WCHAR x )
411 return( (( x >= '0' ) && ( x <= '9' )) || (x =='-') || (x =='.') );
414 static WCHAR *strstriW( const WCHAR *str, const WCHAR *sub )
416 LPWSTR strlower, sublower, r;
417 strlower = CharLowerW( strdupW( str ) );
418 sublower = CharLowerW( strdupW( sub ) );
419 r = strstrW( strlower, sublower );
420 if (r)
421 r = (LPWSTR)str + (r - strlower);
422 msi_free( strlower );
423 msi_free( sublower );
424 return r;
427 static BOOL str_is_number( LPCWSTR str )
429 int i;
431 if (!*str)
432 return FALSE;
434 for (i = 0; i < lstrlenW( str ); i++)
435 if (!isdigitW(str[i]))
436 return FALSE;
438 return TRUE;
441 static INT compare_substring( LPCWSTR a, INT operator, LPCWSTR b )
443 int lhs, rhs;
445 /* substring operators return 0 if LHS is missing */
446 if (!a || !*a)
447 return 0;
449 /* substring operators return 1 if RHS is missing */
450 if (!b || !*b)
451 return 1;
453 /* if both strings contain only numbers, use integer comparison */
454 lhs = atoiW(a);
455 rhs = atoiW(b);
456 if (str_is_number(a) && str_is_number(b))
457 return compare_int( lhs, operator, rhs );
459 switch (operator)
461 case COND_SS:
462 return strstrW( a, b ) != 0;
463 case COND_ISS:
464 return strstriW( a, b ) != 0;
465 case COND_LHS:
467 int l = strlenW( a );
468 int r = strlenW( b );
469 if (r > l) return 0;
470 return !strncmpW( a, b, r );
472 case COND_RHS:
474 int l = strlenW( a );
475 int r = strlenW( b );
476 if (r > l) return 0;
477 return !strncmpW( a + (l - r), b, r );
479 case COND_ILHS:
481 int l = strlenW( a );
482 int r = strlenW( b );
483 if (r > l) return 0;
484 return !strncmpiW( a, b, r );
486 case COND_IRHS:
488 int l = strlenW( a );
489 int r = strlenW( b );
490 if (r > l) return 0;
491 return !strncmpiW( a + (l - r), b, r );
493 default:
494 ERR("invalid substring operator\n");
495 return 0;
497 return 0;
500 static INT compare_string( LPCWSTR a, INT operator, LPCWSTR b, BOOL convert )
502 if (operator >= COND_SS && operator <= COND_RHS)
503 return compare_substring( a, operator, b );
505 /* null and empty string are equivalent */
506 if (!a) a = szEmpty;
507 if (!b) b = szEmpty;
509 if (convert && str_is_number(a) && str_is_number(b))
510 return compare_int( atoiW(a), operator, atoiW(b) );
512 /* a or b may be NULL */
513 switch (operator)
515 case COND_LT:
516 return strcmpW( a, b ) < 0;
517 case COND_GT:
518 return strcmpW( a, b ) > 0;
519 case COND_EQ:
520 return strcmpW( a, b ) == 0;
521 case COND_NE:
522 return strcmpW( a, b ) != 0;
523 case COND_GE:
524 return strcmpW( a, b ) >= 0;
525 case COND_LE:
526 return strcmpW( a, b ) <= 0;
527 case COND_ILT:
528 return strcmpiW( a, b ) < 0;
529 case COND_IGT:
530 return strcmpiW( a, b ) > 0;
531 case COND_IEQ:
532 return strcmpiW( a, b ) == 0;
533 case COND_INE:
534 return strcmpiW( a, b ) != 0;
535 case COND_IGE:
536 return strcmpiW( a, b ) >= 0;
537 case COND_ILE:
538 return strcmpiW( a, b ) <= 0;
539 default:
540 ERR("invalid string operator\n");
541 return 0;
543 return 0;
547 static INT compare_int( INT a, INT operator, INT b )
549 switch (operator)
551 case COND_LT:
552 case COND_ILT:
553 return a < b;
554 case COND_GT:
555 case COND_IGT:
556 return a > b;
557 case COND_EQ:
558 case COND_IEQ:
559 return a == b;
560 case COND_NE:
561 case COND_INE:
562 return a != b;
563 case COND_GE:
564 case COND_IGE:
565 return a >= b;
566 case COND_LE:
567 case COND_ILE:
568 return a <= b;
569 case COND_SS:
570 case COND_ISS:
571 return ( a & b ) ? 1 : 0;
572 case COND_RHS:
573 return ( ( a & 0xffff ) == b ) ? 1 : 0;
574 case COND_LHS:
575 return ( ( (a>>16) & 0xffff ) == b ) ? 1 : 0;
576 default:
577 ERR("invalid integer operator\n");
578 return 0;
580 return 0;
584 static int COND_IsIdent( WCHAR x )
586 return( COND_IsAlpha( x ) || COND_IsNumber( x ) || ( x == '_' )
587 || ( x == '#' ) || (x == '.') );
590 static int COND_GetOperator( COND_input *cond )
592 static const struct {
593 const WCHAR str[4];
594 int id;
595 } table[] = {
596 { {'~','<','=',0}, COND_ILE },
597 { {'~','>','<',0}, COND_ISS },
598 { {'~','>','>',0}, COND_IRHS },
599 { {'~','<','>',0}, COND_INE },
600 { {'~','>','=',0}, COND_IGE },
601 { {'~','<','<',0}, COND_ILHS },
602 { {'~','=',0}, COND_IEQ },
603 { {'~','<',0}, COND_ILT },
604 { {'~','>',0}, COND_IGT },
605 { {'>','=',0}, COND_GE },
606 { {'>','<',0}, COND_SS },
607 { {'<','<',0}, COND_LHS },
608 { {'<','>',0}, COND_NE },
609 { {'<','=',0}, COND_LE },
610 { {'>','>',0}, COND_RHS },
611 { {'>',0}, COND_GT },
612 { {'<',0}, COND_LT },
613 { {0}, 0 }
615 LPCWSTR p = &cond->str[cond->n];
616 int i = 0, len;
618 while ( 1 )
620 len = lstrlenW( table[i].str );
621 if ( !len || 0 == strncmpW( table[i].str, p, len ) )
622 break;
623 i++;
625 cond->n += len;
626 return table[i].id;
629 static int COND_GetOne( struct cond_str *str, COND_input *cond )
631 int rc, len = 1;
632 WCHAR ch;
634 str->data = &cond->str[cond->n];
636 ch = str->data[0];
638 switch( ch )
640 case 0: return 0;
641 case '(': rc = COND_LPAR; break;
642 case ')': rc = COND_RPAR; break;
643 case '&': rc = COND_AMPER; break;
644 case '!': rc = COND_EXCLAM; break;
645 case '$': rc = COND_DOLLARS; break;
646 case '?': rc = COND_QUESTION; break;
647 case '%': rc = COND_PERCENT; break;
648 case ' ': rc = COND_SPACE; break;
649 case '=': rc = COND_EQ; break;
651 case '~':
652 case '<':
653 case '>':
654 rc = COND_GetOperator( cond );
655 if (!rc)
656 rc = COND_ERROR;
657 return rc;
658 default:
659 rc = 0;
662 if ( rc )
664 cond->n += len;
665 return rc;
668 if (ch == '"' )
670 LPCWSTR p = strchrW( str->data + 1, '"' );
671 if (!p) return COND_ERROR;
672 len = p - str->data + 1;
673 rc = COND_LITER;
675 else if( COND_IsAlpha( ch ) )
677 static const WCHAR szNot[] = {'N','O','T',0};
678 static const WCHAR szAnd[] = {'A','N','D',0};
679 static const WCHAR szXor[] = {'X','O','R',0};
680 static const WCHAR szEqv[] = {'E','Q','V',0};
681 static const WCHAR szImp[] = {'I','M','P',0};
682 static const WCHAR szOr[] = {'O','R',0};
684 while( COND_IsIdent( str->data[len] ) )
685 len++;
686 rc = COND_IDENT;
688 if ( len == 3 )
690 if ( !strncmpiW( str->data, szNot, len ) )
691 rc = COND_NOT;
692 else if( !strncmpiW( str->data, szAnd, len ) )
693 rc = COND_AND;
694 else if( !strncmpiW( str->data, szXor, len ) )
695 rc = COND_XOR;
696 else if( !strncmpiW( str->data, szEqv, len ) )
697 rc = COND_EQV;
698 else if( !strncmpiW( str->data, szImp, len ) )
699 rc = COND_IMP;
701 else if( (len == 2) && !strncmpiW( str->data, szOr, len ) )
702 rc = COND_OR;
704 else if( COND_IsNumber( ch ) )
706 while( COND_IsNumber( str->data[len] ) )
707 len++;
708 rc = COND_NUMBER;
710 else
712 ERR("Got unknown character %c(%x)\n",ch,ch);
713 return COND_ERROR;
716 cond->n += len;
717 str->len = len;
719 return rc;
722 static int cond_lex( void *COND_lval, COND_input *cond )
724 int rc;
725 struct cond_str *str = COND_lval;
727 do {
728 rc = COND_GetOne( str, cond );
729 } while (rc == COND_SPACE);
731 return rc;
734 static LPWSTR COND_GetString( COND_input *cond, const struct cond_str *str )
736 LPWSTR ret;
738 ret = cond_alloc( cond, (str->len+1) * sizeof (WCHAR) );
739 if( ret )
741 memcpy( ret, str->data, str->len * sizeof(WCHAR));
742 ret[str->len]=0;
744 TRACE("Got identifier %s\n",debugstr_w(ret));
745 return ret;
748 static LPWSTR COND_GetLiteral( COND_input *cond, const struct cond_str *str )
750 LPWSTR ret;
752 ret = cond_alloc( cond, (str->len-1) * sizeof (WCHAR) );
753 if( ret )
755 memcpy( ret, str->data+1, (str->len-2) * sizeof(WCHAR) );
756 ret[str->len - 2]=0;
758 TRACE("Got literal %s\n",debugstr_w(ret));
759 return ret;
762 static void *cond_alloc( COND_input *cond, unsigned int sz )
764 struct list *mem;
766 mem = msi_alloc( sizeof (struct list) + sz );
767 if( !mem )
768 return NULL;
770 list_add_head( &(cond->mem), mem );
771 return mem + 1;
774 static void *cond_track_mem( COND_input *cond, void *ptr, unsigned int sz )
776 void *new_ptr;
778 if( !ptr )
779 return ptr;
781 new_ptr = cond_alloc( cond, sz );
782 if( !new_ptr )
784 msi_free( ptr );
785 return NULL;
788 memcpy( new_ptr, ptr, sz );
789 msi_free( ptr );
790 return new_ptr;
793 static void cond_free( void *ptr )
795 struct list *mem = (struct list *)ptr - 1;
797 if( ptr )
799 list_remove( mem );
800 msi_free( mem );
804 static int cond_error( COND_input *info, const char *str )
806 TRACE("%s\n", str );
807 return 0;
810 MSICONDITION MSI_EvaluateConditionW( MSIPACKAGE *package, LPCWSTR szCondition )
812 COND_input cond;
813 MSICONDITION r;
814 struct list *mem, *safety;
816 TRACE("%s\n", debugstr_w( szCondition ) );
818 if (szCondition == NULL) return MSICONDITION_NONE;
820 cond.package = package;
821 cond.str = szCondition;
822 cond.n = 0;
823 cond.result = MSICONDITION_ERROR;
825 list_init( &cond.mem );
827 if ( !cond_parse( &cond ) )
828 r = cond.result;
829 else
830 r = MSICONDITION_ERROR;
832 LIST_FOR_EACH_SAFE( mem, safety, &cond.mem )
834 /* The tracked memory lives directly after the list struct */
835 void *ptr = mem + 1;
836 if ( r != MSICONDITION_ERROR )
837 WARN( "condition parser failed to free up some memory: %p\n", ptr );
838 cond_free( ptr );
841 TRACE("%i <- %s\n", r, debugstr_w(szCondition));
842 return r;
845 MSICONDITION WINAPI MsiEvaluateConditionW( MSIHANDLE hInstall, LPCWSTR szCondition )
847 MSIPACKAGE *package;
848 UINT ret;
850 package = msihandle2msiinfo( hInstall, MSIHANDLETYPE_PACKAGE);
851 if( !package )
853 HRESULT hr;
854 BSTR condition;
855 IWineMsiRemotePackage *remote_package;
857 remote_package = (IWineMsiRemotePackage *)msi_get_remote( hInstall );
858 if (!remote_package)
859 return MSICONDITION_ERROR;
861 condition = SysAllocString( szCondition );
862 if (!condition)
864 IWineMsiRemotePackage_Release( remote_package );
865 return ERROR_OUTOFMEMORY;
868 hr = IWineMsiRemotePackage_EvaluateCondition( remote_package, condition );
870 SysFreeString( condition );
871 IWineMsiRemotePackage_Release( remote_package );
873 if (FAILED(hr))
875 if (HRESULT_FACILITY(hr) == FACILITY_WIN32)
876 return HRESULT_CODE(hr);
878 return ERROR_FUNCTION_FAILED;
881 return ERROR_SUCCESS;
884 ret = MSI_EvaluateConditionW( package, szCondition );
885 msiobj_release( &package->hdr );
886 return ret;
889 MSICONDITION WINAPI MsiEvaluateConditionA( MSIHANDLE hInstall, LPCSTR szCondition )
891 LPWSTR szwCond = NULL;
892 MSICONDITION r;
894 szwCond = strdupAtoW( szCondition );
895 if( szCondition && !szwCond )
896 return MSICONDITION_ERROR;
898 r = MsiEvaluateConditionW( hInstall, szwCond );
899 msi_free( szwCond );
900 return r;