Sync to Wine-20050524:
authorGé van Geldorp <ge@gse.nl>
Thu, 26 May 2005 21:55:34 +0000 (21:55 +0000)
committerGé van Geldorp <ge@gse.nl>
Thu, 26 May 2005 21:55:34 +0000 (21:55 +0000)
Alexander Julliard <julliard@winehq.org>
- Added rules for building import libraries in the individual dll
  makefiles, and added support for building a .def.a static import
  library too.
Aric Stewart <aric@codeweavers.com>
- Fix a few leaking object handles.
- Correct user component publication.
- Implement MsiEnumComponentQualifiers.
- Implement Publish Components in order for MsiGetQualifiedComponent
  apis to work. Also implement MsiGetQualifiedComponent, or at least some
  of the functionality as it is supposed to install stuff if it is
  absent, which it does not do yet.
- Correct query quoting based on Mike's patch.
  Also more error messages about return codes from custom actions and
  ignore an error that we should be ignoring.
- Double terminate SZ_MULTI properly.
- ClassInfo and ExtensionInfo are also written for ADVERTISED
  components.
- Write the RegOwner and RegCompany keys as blank if they do not exist
  when doing the RegisterUser action.
- Fix quoting on queries.
- Respect '+' and '*' in WriteRegistryValues to only create the key if
  it does not already exist. Prevents overwriting values with NULL.
- We cannot internally load the files in FileCost because that action
  may be skipped or not called. So do it in CostInitialize.
- Quote the file path in SelfRegModules.
- Do not write squished null guids to the feature registration.
- Correctly use short filenames from uncompressed file sources. Also
  default feature and component install states to ABSENT instead of
  UNKNOWN.
- Correct a problem with parse_data if binary data was not in full bytes.
- More properly handle uncompressed file sources, fix the creating and
  parsing of Source Directories.
- ExecuteAction runs the whole Execute table and not just from
  InstallValidate onward.  To do this make sure we do not do the
  costing initialization work again if it is already done (by checking
  the CostingComplete Property).
- A lot of work to refine feature states, setting the state affects
  the state of all child features and also respect features that want
  to default to something other than LOCAL.
- Fix a few leaking object handles.
- Correct user component publication.
- Implement MsiEnumComponentQualifiers.
- We have a stub for MsiGetUserInfoA we should use it.
- A few small fixes.
- Add a missing msiobj_release that was resulting in a leaked object
  with each MsiCreateRecord call.
- Fix a leaking handle.
- Make MsiCollectUserInfo more internally consistent.
  Thanks to Mike McCormack.
- Fix a leaking handle in MsiConfigureProductExW.
- Implement MsiGetProductCodeW.
- Implement MsiGetUserInfoW.
- Implement MsiCollectUserInfoA/W.
- Implement MsiQueryFeatureStateW.
- Correct a leaking hkey handle.
- Expand some handling of special properties in MsiGetProductInfo.
- Fix for the return codes for the Qualified component calls. They are
  not INSTALLSTATEs but rather success values.
- Quoting fixes.
Mike McCormack <mike@codeweavers.com>
- Make sure that dialogs are only created and destroyed in a single
  thread.
- Track memory allocations in the SQL parser.
- Create the ORDER BY view in a single call.
- Simplify parsing of the FROM keyword.
- Improve parser error checking.
- Simplify parsing of select query.
- remove the unused utf8 field of an expression
- make the parse result a single assignment at top level of parsing
- abort parsing on a memory allocation failure
- Only tables can be backquoted, strings must be single quoted.
- Declare MsiExportDatabase* in the spec file, and fix a typo.
- make sure to free the string table when closing the database
- don't free szPersist in MsiOpenDatabase if it's not a string
- Avoid some non-standard str functions.
Francois Gouget <fgouget@free.fr>
- Tweak the documentation to make winapi_check happy.
Juan Lang <juan_lang@yahoo.com>
- Don't fail in RegisterFonts if the Fonts table is missing.
- Partially implement AppSearch for RegLocator-type searches.
- Turn handled errors from ERRs to WARNs or TRACEs.
Vincent Beron <vberon@mecano.gme.usherb.ca>
- Use SUBLANG_NEUTRAL for French resources.
Stefan Leichter <Stefan.Leichter@camLine.com>
- Update version resource of msi.dll to current version shipped from
  windows update.
- Added minimal implementation of MsiCreateAndVerifyInstallerDirectory.
Marcus Meissner <marcus@jet.franken.de>
- Set PhysicalMemory property from system data.

svn path=/trunk/; revision=15537

30 files changed:
reactos/include/wine/msidefs.h
reactos/lib/msi/Makefile.in
reactos/lib/msi/action.c
reactos/lib/msi/action.h
reactos/lib/msi/appsearch.c
reactos/lib/msi/cond.tab.c
reactos/lib/msi/cond.y
reactos/lib/msi/create.c
reactos/lib/msi/custom.c
reactos/lib/msi/database.c
reactos/lib/msi/dialog.c
reactos/lib/msi/insert.c
reactos/lib/msi/msi.c
reactos/lib/msi/msi.spec
reactos/lib/msi/msi_Fr.rc
reactos/lib/msi/msipriv.h
reactos/lib/msi/msiquery.c
reactos/lib/msi/order.c
reactos/lib/msi/package.c
reactos/lib/msi/query.h
reactos/lib/msi/record.c
reactos/lib/msi/registry.c
reactos/lib/msi/sql.tab.c
reactos/lib/msi/sql.y
reactos/lib/msi/suminfo.c
reactos/lib/msi/table.c
reactos/lib/msi/tokenize.c
reactos/lib/msi/update.c
reactos/lib/msi/version.rc
reactos/lib/msi/where.c

index f266b32..71b054b 100644 (file)
 extern "C" {
 #endif
 
+enum msidbFileAttributes {
+    msidbFileAttributesReadOnly = 0x00000001,
+    msidbFileAttributesHidden = 0x00000002,
+    msidbFileAttributesSystem = 0x00000004,
+    msidbFileAttributesVital = 0x00000200,
+    msidbFileAttributesChecksum = 0x00000400,
+    msidbFileAttributesPatchAdded = 0x00001000,
+    msidbFileAttributesNoncompressed = 0x00002000,
+    msidbFileAttributesCompressed = 0x00004000
+};
+        
 enum msidbDialogAttributes {
     msidbDialogAttributesVisible = 0x00000001,
     msidbDialogAttributesModal = 0x00000002,
@@ -103,6 +114,22 @@ enum msidbComponentAttributes
     msidbComponentAttributes64bit = 0x00000100
 };
 
+enum msidbRegistryRoot
+{
+    msidbRegistryRootClassesRoot = 0,
+    msidbRegistryRootCurrentUser = 1,
+    msidbRegistryRootLocalMachine = 2,
+    msidbRegistryRootUsers = 3,
+};
+
+enum msidbLocatorType
+{
+    msidbLocatorTypeDirectory = 0x000,
+    msidbLocatorTypeFileName = 0x001,
+    msidbLocatorTypeRawValue = 0x002,
+    msidbLocatorType64bit = 0x010,
+};
+
 /*
  * Windows SDK braindamage alert
  *
index 85c1eee..12f85fd 100644 (file)
@@ -3,6 +3,7 @@ TOPOBJDIR = ../..
 SRCDIR    = @srcdir@\r
 VPATH     = @srcdir@\r
 MODULE    = msi.dll\r
+IMPORTLIB = libmsi.$(IMPLIBEXT)\r
 IMPORTS   = shell32 cabinet oleaut32 ole32 version user32 gdi32 advapi32 kernel32\r
 EXTRALIBS = -luuid $(LIBUNICODE)\r
 \r
index ae48e3b..caa2686 100644 (file)
@@ -99,6 +99,7 @@ static UINT ACTION_ForceReboot(MSIPACKAGE *package);
 static UINT ACTION_ResolveSource(MSIPACKAGE *package);
 static UINT ACTION_ExecuteAction(MSIPACKAGE *package);
 static UINT ACTION_RegisterFonts(MSIPACKAGE *package);
+static UINT ACTION_PublishComponents(MSIPACKAGE *package);
 
  
 /*
@@ -324,7 +325,7 @@ static struct _actions StandardActions[] = {
     { szInstallServices, NULL},
     { szPatchFiles, NULL},
     { szProcessComponents, ACTION_ProcessComponents },
-    { szPublishComponents, NULL},
+    { szPublishComponents, ACTION_PublishComponents },
     { szPublishFeatures, ACTION_PublishFeatures },
     { szPublishProduct, ACTION_PublishProduct },
     { szRegisterClassInfo, ACTION_RegisterClassInfo },
@@ -380,6 +381,13 @@ inline static void reduce_to_longfilename(WCHAR* filename)
         memmove(filename, p+1, (strlenW(p+1)+1)*sizeof(WCHAR));
 }
 
+inline static void reduce_to_shortfilename(WCHAR* filename)
+{
+    LPWSTR p = strchrW(filename,'|');
+    if (p)
+        *p = 0;
+}
+
 WCHAR *load_dynamic_stringW(MSIRECORD *row, INT index)
 {
     UINT rc;
@@ -598,6 +606,7 @@ void ACTION_free_package_structures( MSIPACKAGE* package)
     {
         HeapFree(GetProcessHeap(),0,package->files[i].File);
         HeapFree(GetProcessHeap(),0,package->files[i].FileName);
+        HeapFree(GetProcessHeap(),0,package->files[i].ShortName);
         HeapFree(GetProcessHeap(),0,package->files[i].Version);
         HeapFree(GetProcessHeap(),0,package->files[i].Language);
         HeapFree(GetProcessHeap(),0,package->files[i].SourcePath);
@@ -630,15 +639,16 @@ static void ui_progress(MSIPACKAGE *package, int a, int b, int c, int d )
     MSI_ProcessMessage(package, INSTALLMESSAGE_PROGRESS, row);
     msiobj_release(&row->hdr);
 
-    msi_dialog_check_messages(package->dialog, NULL);
+    msi_dialog_check_messages(NULL);
 }
 
 static void ui_actiondata(MSIPACKAGE *package, LPCWSTR action, MSIRECORD * record)
 {
     static const WCHAR Query_t[] = 
         {'S','E','L','E','C','T',' ','*',' ','F','R','O','M',' ',
-         'A','c','t','i','o', 'n','T','e','x','t',' ','W','H','E','R','E',' ',
-         'A','c','t','i','o','n',' ','=', ' ','\'','%','s','\'',0};
+         '`','A','c','t','i','o', 'n','T','e','x','t','`',' ',
+         'W','H','E','R','E',' ', '`','A','c','t','i','o','n','`',' ','=', 
+         ' ','\'','%','s','\'',0};
     WCHAR message[1024];
     UINT rc;
     MSIQUERY * view;
@@ -655,12 +665,14 @@ static void ui_actiondata(MSIPACKAGE *package, LPCWSTR action, MSIRECORD * recor
         if (rc != ERROR_SUCCESS)
         {
             MSI_ViewClose(view);
+            msiobj_release(&view->hdr);
             return;
         }
         rc = MSI_ViewFetch(view,&row);
         if (rc != ERROR_SUCCESS)
         {
             MSI_ViewClose(view);
+            msiobj_release(&view->hdr);
             return;
         }
 
@@ -705,8 +717,9 @@ static void ui_actionstart(MSIPACKAGE *package, LPCWSTR action)
         {'H','H','\'',':','\'','m','m','\'',':','\'','s','s',0};
     static const WCHAR Query_t[] = 
         {'S','E','L','E','C','T',' ','*',' ','F','R','O','M',' ',
-         'A','c','t','i','o', 'n','T','e','x','t',' ','W','H','E','R','E', ' ',
-         'A','c','t','i','o','n',' ','=', ' ','\'','%','s','\'',0};
+         '`','A','c','t','i','o', 'n','T','e','x','t','`',' ',
+         'W','H','E','R','E', ' ','`','A','c','t','i','o','n','`',' ','=', 
+         ' ','\'','%','s','\'',0};
     WCHAR message[1024];
     WCHAR timet[0x100];
     UINT rc;
@@ -1005,14 +1018,14 @@ static UINT ACTION_PerformActionSequence(MSIPACKAGE *package, UINT seq, BOOL UI)
     MSIRECORD * row = 0;
     static const WCHAR ExecSeqQuery[] =
         {'S','E','L','E','C','T',' ','*',' ','F','R','O','M',' ',
-         'I','n','s','t','a','l','l','E','x','e','c','u','t','e',
-         'S','e','q','u','e','n','c','e',' ', 'W','H','E','R','E',' ',
-         'S','e','q','u','e','n','c','e',' ', '=',' ','%','i',0};
+         '`','I','n','s','t','a','l','l','E','x','e','c','u','t','e',
+         'S','e','q','u','e','n','c','e','`',' ', 'W','H','E','R','E',' ',
+         '`','S','e','q','u','e','n','c','e','`',' ', '=',' ','%','i',0};
 
     static const WCHAR UISeqQuery[] =
         {'S','E','L','E','C','T',' ','*',' ','F','R','O','M',' ',
-        'I','n','s','t','a','l','l','U','I','S','e','q','u','e','n','c','e',
-        ' ', 'W','H','E','R','E',' ', 'S','e','q','u','e','n','c','e',
+     '`','I','n','s','t','a','l','l','U','I','S','e','q','u','e','n','c','e',
+     '`', ' ', 'W','H','E','R','E',' ','`','S','e','q','u','e','n','c','e','`',
         ' ', '=',' ','%','i',0};
 
     if (UI)
@@ -1090,18 +1103,19 @@ static UINT ACTION_ProcessExecSequence(MSIPACKAGE *package, BOOL UIran)
     UINT rc;
     static const WCHAR ExecSeqQuery[] =
         {'S','E','L','E','C','T',' ','*',' ', 'F','R','O','M',' ',
-         'I','n','s','t','a','l','l','E','x','e','c','u','t','e',
-         'S','e','q','u','e','n','c','e',' ', 'W','H','E','R','E',' ',
-         'S','e','q','u','e','n','c','e',' ', '>',' ','%','i',' ',
+         '`','I','n','s','t','a','l','l','E','x','e','c','u','t','e',
+         'S','e','q','u','e','n','c','e','`',' ', 'W','H','E','R','E',' ',
+         '`','S','e','q','u','e','n','c','e','`',' ', '>',' ','%','i',' ',
          'O','R','D','E','R',' ', 'B','Y',' ',
-         'S','e','q','u','e','n','c','e',0 };
+         '`','S','e','q','u','e','n','c','e','`',0 };
     MSIRECORD * row = 0;
     static const WCHAR IVQuery[] =
-        {'S','E','L','E','C','T',' ','S','e','q','u','e','n','c','e',' ',
-         'F','R','O','M',' ','I','n','s','t','a','l','l',
-         'E','x','e','c','u','t','e','S','e','q','u','e','n','c','e',' ',
-         'W','H','E','R','E',' ','A','c','t','i','o','n',' ','=',' ','`',
-         'I','n','s','t','a','l','l','V','a','l','i','d','a','t','e','`', 0};
+        {'S','E','L','E','C','T',' ','`','S','e','q','u','e','n','c','e','`',
+         ' ', 'F','R','O','M',' ','`','I','n','s','t','a','l','l',
+         'E','x','e','c','u','t','e','S','e','q','u','e','n','c','e','`',' ',
+         'W','H','E','R','E',' ','`','A','c','t','i','o','n','`',' ','=',
+         ' ','\'', 'I','n','s','t','a','l','l',
+         'V','a','l','i','d','a','t','e','\'', 0};
     INT seq = 0;
 
 
@@ -1225,10 +1239,12 @@ static UINT ACTION_ProcessUISequence(MSIPACKAGE *package)
     UINT rc;
     static const WCHAR ExecSeqQuery [] =
         {'S','E','L','E','C','T',' ','*',' ','F','R','O','M',' ',
-         'I','n','s','t','a','l','l','U','I','S','e','q','u','e','n','c','e',
-         ' ','W','H','E','R','E',' ', 'S','e','q','u','e','n','c','e',' ',
+         '`','I','n','s','t','a','l','l',
+         'U','I','S','e','q','u','e','n','c','e','`',
+         ' ','W','H','E','R','E',' ', 
+         '`','S','e','q','u','e','n','c','e','`',' ',
          '>',' ','0',' ','O','R','D','E','R',' ','B','Y',' ',
-         'S','e','q','u','e','n','c','e',0};
+         '`','S','e','q','u','e','n','c','e','`',0};
     
     rc = MSI_DatabaseOpenViewW(package->db, ExecSeqQuery, &view);
     
@@ -1420,7 +1436,7 @@ UINT ACTION_PerformUIAction(MSIPACKAGE *package, const WCHAR *action)
     if (!handled)
         handled = ACTION_HandleDialogBox(package, action, &rc);
 
-    msi_dialog_check_messages( package->dialog, NULL );
+    msi_dialog_check_messages( NULL );
 
     if (!handled)
     {
@@ -1493,9 +1509,10 @@ static BOOL create_full_pathW(const WCHAR *path)
 static UINT ACTION_CreateFolders(MSIPACKAGE *package)
 {
     static const WCHAR ExecSeqQuery[] =
-        {'S','E','L','E','C','T',' ','D','i','r','e','c','t','o','r','y','_',
+        {'S','E','L','E','C','T',' ',
+         '`','D','i','r','e','c','t','o','r','y','_','`',
          ' ','F','R','O','M',' ',
-         'C','r','e','a','t','e','F','o','l','d','e','r',0 };
+         '`','C','r','e','a','t','e','F','o','l','d','e','r','`',0 };
     UINT rc;
     MSIQUERY *view;
     MSIFOLDER *folder;
@@ -1606,7 +1623,7 @@ static int load_component(MSIPACKAGE* package, MSIRECORD * row)
     sz = 96;       
     MSI_RecordGetStringW(row,6,package->components[index].KeyPath,&sz);
 
-    package->components[index].Installed = INSTALLSTATE_UNKNOWN;
+    package->components[index].Installed = INSTALLSTATE_ABSENT;
     package->components[index].Action = INSTALLSTATE_UNKNOWN;
     package->components[index].ActionRequest = INSTALLSTATE_UNKNOWN;
 
@@ -1620,14 +1637,18 @@ static void load_feature(MSIPACKAGE* package, MSIRECORD * row)
     int index = package->loaded_features;
     DWORD sz;
     static const WCHAR Query1[] = 
-        {'S','E','L','E','C','T',' ','C','o','m','p','o','n','e','n','t','_',
-         ' ','F','R','O','M',' ','F','e','a','t','u','r','e',
-         'C','o','m','p','o','n','e','n','t','s',' ','W','H','E','R','E',' ',
-         'F','e', 'a','t','u','r','e','_','=','\'','%','s','\'',0};
+        {'S','E','L','E','C','T',' ',
+         '`','C','o','m','p','o','n','e','n','t','_','`',
+         ' ','F','R','O','M',' ','`','F','e','a','t','u','r','e',
+         'C','o','m','p','o','n','e','n','t','s','`',' ',
+         'W','H','E','R','E',' ',
+         '`','F','e', 'a','t','u','r','e','_','`',' ','=','\'','%','s','\'',0};
     static const WCHAR Query2[] = 
         {'S','E','L','E','C','T',' ','*',' ','F','R', 'O','M',' ', 
-         'C','o','m','p','o','n','e','n','t',' ','W','H','E','R','E',' ', 
-         'C','o','m','p','o','n','e','n','t','=','\'','%','s','\'',0};
+         '`','C','o','m','p','o','n','e','n','t','`',' ',
+         'W','H','E','R','E',' ', 
+         '`','C','o','m','p','o','n','e','n','t','`',' ',
+         '=','\'','%','s','\'',0};
     MSIQUERY * view;
     MSIQUERY * view2;
     MSIRECORD * row2;
@@ -1673,7 +1694,7 @@ static void load_feature(MSIPACKAGE* package, MSIRECORD * row)
 
     package->features[index].Attributes= MSI_RecordGetInteger(row,8);
 
-    package->features[index].Installed = INSTALLSTATE_UNKNOWN;
+    package->features[index].Installed = INSTALLSTATE_ABSENT;
     package->features[index].Action = INSTALLSTATE_UNKNOWN;
     package->features[index].ActionRequest = INSTALLSTATE_UNKNOWN;
 
@@ -1712,6 +1733,7 @@ static void load_feature(MSIPACKAGE* package, MSIRECORD * row)
                   c_indx);
             package->features[index].Components[cnt] = c_indx;
             package->features[index].ComponentCount ++;
+            msiobj_release( &row2->hdr );
             continue;
         }
 
@@ -1751,61 +1773,6 @@ static void load_feature(MSIPACKAGE* package, MSIRECORD * row)
     msiobj_release(&view->hdr);
 }
 
-/*
- * I am not doing any of the costing functionality yet. 
- * Mostly looking at doing the Component and Feature loading
- *
- * The native MSI does A LOT of modification to tables here. Mostly adding
- * a lot of temporary columns to the Feature and Component tables. 
- *
- *    note: Native msi also tracks the short filename. But I am only going to
- *          track the long ones.  Also looking at this directory table
- *          it appears that the directory table does not get the parents
- *          resolved base on property only based on their entries in the 
- *          directory table.
- */
-static UINT ACTION_CostInitialize(MSIPACKAGE *package)
-{
-    MSIQUERY * view;
-    MSIRECORD * row;
-    UINT rc;
-    static const WCHAR Query_all[] =
-        {'S','E','L','E','C','T',' ','*',' ', 'F','R','O','M',' ',
-         'F','e','a','t','u','r','e',0};
-    static const WCHAR szCosting[] =
-        {'C','o','s','t','i','n','g','C','o','m','p','l','e','t','e',0 };
-    static const WCHAR szZero[] = { '0', 0 };
-
-    MSI_SetPropertyW(package, szCosting, szZero);
-    MSI_SetPropertyW(package, cszRootDrive , c_colon);
-
-    rc = MSI_DatabaseOpenViewW(package->db,Query_all,&view);
-    if (rc != ERROR_SUCCESS)
-        return rc;
-    rc = MSI_ViewExecute(view,0);
-    if (rc != ERROR_SUCCESS)
-    {
-        MSI_ViewClose(view);
-        msiobj_release(&view->hdr);
-        return rc;
-    }
-    while (1)
-    {
-        DWORD rc;
-
-        rc = MSI_ViewFetch(view,&row);
-        if (rc != ERROR_SUCCESS)
-            break;
-       
-        load_feature(package,row); 
-        msiobj_release(&row->hdr);
-    }
-    MSI_ViewClose(view);
-    msiobj_release(&view->hdr);
-
-    return ERROR_SUCCESS;
-}
-
 static UINT load_file(MSIPACKAGE* package, MSIRECORD * row)
 {
     DWORD index = package->loaded_files;
@@ -1838,8 +1805,10 @@ static UINT load_file(MSIPACKAGE* package, MSIRECORD * row)
     HeapFree(GetProcessHeap(), 0, buffer);
 
     package->files[index].FileName = load_dynamic_stringW(row,3);
-
     reduce_to_longfilename(package->files[index].FileName);
+
+    package->files[index].ShortName = load_dynamic_stringW(row,3);
+    reduce_to_shortfilename(package->files[index].ShortName);
     
     package->files[index].FileSize = MSI_RecordGetInteger(row,4);
     package->files[index].Version = load_dynamic_stringW(row, 5);
@@ -1855,15 +1824,15 @@ static UINT load_file(MSIPACKAGE* package, MSIRECORD * row)
     return ERROR_SUCCESS;
 }
 
-static UINT ACTION_FileCost(MSIPACKAGE *package)
+static UINT load_all_files(MSIPACKAGE *package)
 {
     MSIQUERY * view;
     MSIRECORD * row;
     UINT rc;
     static const WCHAR Query[] =
         {'S','E','L','E','C','T',' ','*',' ', 'F','R','O','M',' ',
-         'F','i','l','e',' ', 'O','R','D','E','R',' ','B','Y',' ',
-         'S','e','q','u','e','n','c','e', 0};
+         '`','F','i','l','e','`',' ', 'O','R','D','E','R',' ','B','Y',' ',
+         '`','S','e','q','u','e','n','c','e','`', 0};
 
     if (!package)
         return ERROR_INVALID_HANDLE;
@@ -1897,16 +1866,88 @@ static UINT ACTION_FileCost(MSIPACKAGE *package)
     return ERROR_SUCCESS;
 }
 
+
+/*
+ * I am not doing any of the costing functionality yet. 
+ * Mostly looking at doing the Component and Feature loading
+ *
+ * The native MSI does A LOT of modification to tables here. Mostly adding
+ * a lot of temporary columns to the Feature and Component tables. 
+ *
+ *    note: Native msi also tracks the short filename. But I am only going to
+ *          track the long ones.  Also looking at this directory table
+ *          it appears that the directory table does not get the parents
+ *          resolved base on property only based on their entries in the 
+ *          directory table.
+ */
+static UINT ACTION_CostInitialize(MSIPACKAGE *package)
+{
+    MSIQUERY * view;
+    MSIRECORD * row;
+    UINT rc;
+    static const WCHAR Query_all[] =
+        {'S','E','L','E','C','T',' ','*',' ', 'F','R','O','M',' ',
+         '`','F','e','a','t','u','r','e','`',0};
+    static const WCHAR szCosting[] =
+        {'C','o','s','t','i','n','g','C','o','m','p','l','e','t','e',0 };
+    static const WCHAR szZero[] = { '0', 0 };
+    WCHAR buffer[3];
+    DWORD sz = 3;
+
+    MSI_GetPropertyW(package, szCosting, buffer, &sz);
+    if (buffer[0]=='1')
+        return ERROR_SUCCESS;
+    
+    MSI_SetPropertyW(package, szCosting, szZero);
+    MSI_SetPropertyW(package, cszRootDrive , c_colon);
+
+    rc = MSI_DatabaseOpenViewW(package->db,Query_all,&view);
+    if (rc != ERROR_SUCCESS)
+        return rc;
+    rc = MSI_ViewExecute(view,0);
+    if (rc != ERROR_SUCCESS)
+    {
+        MSI_ViewClose(view);
+        msiobj_release(&view->hdr);
+        return rc;
+    }
+    while (1)
+    {
+        DWORD rc;
+
+        rc = MSI_ViewFetch(view,&row);
+        if (rc != ERROR_SUCCESS)
+            break;
+       
+        load_feature(package,row); 
+        msiobj_release(&row->hdr);
+    }
+    MSI_ViewClose(view);
+    msiobj_release(&view->hdr);
+
+    load_all_files(package);
+
+    return ERROR_SUCCESS;
+}
+
+static UINT ACTION_FileCost(MSIPACKAGE *package)
+{
+    return ERROR_SUCCESS;
+}
+
+
 static INT load_folder(MSIPACKAGE *package, const WCHAR* dir)
 {
     static const WCHAR Query[] =
         {'S','E','L','E','C','T',' ','*',' ','F','R','O','M',' ',
-         'D','i','r','e','c', 't','o','r','y',' ','W','H','E','R','E',' ','`',
-         'D','i','r','e','c','t', 'o','r','y','`',' ','=',' ','`','%','s','`',
+         '`','D','i','r','e','c', 't','o','r','y','`',' ',
+         'W','H','E','R','E',' ', '`', 'D','i','r','e','c','t', 'o','r','y','`',
+         ' ','=',' ','\'','%','s','\'',
          0};
     UINT rc;
     MSIQUERY * view;
     LPWSTR ptargetdir, targetdir, parent, srcdir;
+    LPWSTR shortname = NULL;
     MSIRECORD * row = 0;
     INT index = -1;
     DWORD i;
@@ -1972,15 +2013,16 @@ static INT load_folder(MSIPACKAGE *package, const WCHAR* dir)
     /* for now only pick long filename versions */
     if (strchrW(targetdir,'|'))
     {
+        shortname = targetdir;
         targetdir = strchrW(targetdir,'|'); 
         *targetdir = 0;
         targetdir ++;
     }
+    /* for the sourcedir pick the short filename */
     if (srcdir && strchrW(srcdir,'|'))
     {
-        srcdir= strchrW(srcdir,'|'); 
-        *srcdir= 0;
-        srcdir ++;
+        LPWSTR p = strchrW(srcdir,'|'); 
+        *p = 0;
     }
 
     /* now check for root dirs */
@@ -1999,9 +2041,12 @@ static INT load_folder(MSIPACKAGE *package, const WCHAR* dir)
 
     if (srcdir)
         package->folders[index].SourceDefault = strdupW(srcdir);
+    else if (shortname)
+        package->folders[index].SourceDefault = strdupW(shortname);
     else if (targetdir)
         package->folders[index].SourceDefault = strdupW(targetdir);
     HeapFree(GetProcessHeap(), 0, ptargetdir);
+        TRACE("   SourceDefault = %s\n",debugstr_w(package->folders[index].SourceDefault));
 
     parent = load_dynamic_stringW(row,2);
     if (parent) 
@@ -2105,6 +2150,7 @@ LPWSTR resolve_folder(MSIPACKAGE *package, LPCWSTR name, BOOL source,
     else if (source && package->folders[i].ResolvedSource)
     {
         path = strdupW(package->folders[i].ResolvedSource);
+        TRACE("   (source)already resolved to %s\n",debugstr_w(path));
         return path;
     }
     else if (!source && package->folders[i].Property)
@@ -2136,6 +2182,7 @@ LPWSTR resolve_folder(MSIPACKAGE *package, LPCWSTR name, BOOL source,
         else 
         {
             path = build_directory_name(3, p, package->folders[i].SourceDefault, NULL);
+            TRACE("   (source)resolved into %s\n",debugstr_w(path));
             package->folders[i].ResolvedSource = strdupW(path);
         }
         HeapFree(GetProcessHeap(),0,p);
@@ -2201,17 +2248,25 @@ void ACTION_UpdateComponentStates(MSIPACKAGE *package, LPCWSTR szFeature)
     {
         MSICOMPONENT* component = &package->components[feature->Components[i]];
 
+        TRACE("MODIFYING(%i): Component %s (Installed %i, Action %i, Request %i)\n",
+            newstate, debugstr_w(component->Component), component->Installed, 
+            component->Action, component->ActionRequest);
+        
         if (!component->Enabled)
             continue;
         else
         {
             if (newstate == INSTALLSTATE_LOCAL)
+            {
                 component->ActionRequest = INSTALLSTATE_LOCAL;
+                component->Action = INSTALLSTATE_LOCAL;
+            }
             else 
             {
                 int j,k;
 
                 component->ActionRequest = newstate;
+                component->Action = newstate;
 
                 /*if any other feature wants is local we need to set it local*/
                 for (j = 0; 
@@ -2225,12 +2280,19 @@ void ACTION_UpdateComponentStates(MSIPACKAGE *package, LPCWSTR szFeature)
                         {
                             if (package->features[j].ActionRequest == 
                                 INSTALLSTATE_LOCAL)
+                            {
+                                TRACE("Saved by %s\n", debugstr_w(package->features[j].Feature));
                                 component->ActionRequest = INSTALLSTATE_LOCAL;
+                                component->Action = INSTALLSTATE_LOCAL;
+                            }
                             break;
                         }
                 }
             }
         }
+        TRACE("Result (%i): Component %s (Installed %i, Action %i, Request %i)\n",
+            newstate, debugstr_w(component->Component), component->Installed, 
+            component->Action, component->ActionRequest);
     } 
 }
 
@@ -2344,10 +2406,26 @@ static UINT SetFeatureStates(MSIPACKAGE *package)
             BOOL feature_state = ((package->features[i].Level > 0) &&
                              (package->features[i].Level <= install_level));
 
-            if (feature_state)
+            if ((feature_state) && 
+               (package->features[i].Action == INSTALLSTATE_UNKNOWN))
             {
-                package->features[i].ActionRequest = INSTALLSTATE_LOCAL;
-                package->features[i].Action = INSTALLSTATE_LOCAL;
+                if (package->features[i].Attributes & 
+                                msidbFeatureAttributesFavorSource)
+                {
+                    package->features[i].ActionRequest = INSTALLSTATE_SOURCE;
+                    package->features[i].Action = INSTALLSTATE_SOURCE;
+                }
+                else if (package->features[i].Attributes &
+                                msidbFeatureAttributesFavorAdvertise)
+                {
+                    package->features[i].ActionRequest =INSTALLSTATE_ADVERTISED;
+                    package->features[i].Action =INSTALLSTATE_ADVERTISED;
+                }
+                else
+                {
+                    package->features[i].ActionRequest = INSTALLSTATE_LOCAL;
+                    package->features[i].Action = INSTALLSTATE_LOCAL;
+                }
             }
         }
     }
@@ -2380,6 +2458,27 @@ static UINT SetFeatureStates(MSIPACKAGE *package)
                     component->Action = INSTALLSTATE_LOCAL;
                     component->ActionRequest = INSTALLSTATE_LOCAL;
                 }
+                else if (feature->ActionRequest == INSTALLSTATE_SOURCE)
+                {
+                    if ((component->Action == INSTALLSTATE_UNKNOWN) ||
+                        (component->Action == INSTALLSTATE_ABSENT) ||
+                        (component->Action == INSTALLSTATE_ADVERTISED))
+                           
+                    {
+                        component->Action = INSTALLSTATE_SOURCE;
+                        component->ActionRequest = INSTALLSTATE_SOURCE;
+                    }
+                }
+                else if (feature->ActionRequest == INSTALLSTATE_ADVERTISED)
+                {
+                    if ((component->Action == INSTALLSTATE_UNKNOWN) ||
+                        (component->Action == INSTALLSTATE_ABSENT))
+                           
+                    {
+                        component->Action = INSTALLSTATE_ADVERTISED;
+                        component->ActionRequest = INSTALLSTATE_ADVERTISED;
+                    }
+                }
                 else if (feature->ActionRequest == INSTALLSTATE_ABSENT)
                 {
                     if (component->Action == INSTALLSTATE_UNKNOWN)
@@ -2415,10 +2514,10 @@ static UINT ACTION_CostFinalize(MSIPACKAGE *package)
 {
     static const WCHAR ExecSeqQuery[] =
         {'S','E','L','E','C','T',' ','*',' ','F','R','O','M',' ',
-         'D','i','r','e','c','t','o','r','y',0};
+         '`','D','i','r','e','c','t','o','r','y','`',0};
     static const WCHAR ConditionQuery[] =
         {'S','E','L','E','C','T',' ','*',' ','F','R','O','M',' ',
-         'C','o','n','d','i','t','i','o','n',0};
+         '`','C','o','n','d','i','t','i','o','n','`',0};
     static const WCHAR szCosting[] =
         {'C','o','s','t','i','n','g','C','o','m','p','l','e','t','e',0 };
     static const WCHAR szlevel[] =
@@ -2428,6 +2527,12 @@ static UINT ACTION_CostFinalize(MSIPACKAGE *package)
     MSIQUERY * view;
     DWORD i;
     LPWSTR level;
+    DWORD sz = 3;
+    WCHAR buffer[3];
+
+    MSI_GetPropertyW(package, szCosting, buffer, &sz);
+    if (buffer[0]=='1')
+        return ERROR_SUCCESS;
 
     TRACE("Building Directory properties\n");
 
@@ -2669,6 +2774,7 @@ static UINT writeout_cabinet_stream(MSIPACKAGE *package, WCHAR* stream_name,
 
     if (the_file == INVALID_HANDLE_VALUE)
     {
+        ERR("Unable to create file %s\n",debugstr_w(source));
         rc = ERROR_FUNCTION_FAILED;
         goto end;
     }
@@ -2771,7 +2877,7 @@ static INT_PTR cabinet_notify(FDINOTIFICATIONTYPE fdint, PFDINOTIFICATION pfdin)
         LPWSTR tracknametmp;
         static const WCHAR tmpprefix[] = {'C','A','B','T','M','P','_',0};
        
-        if (data->file_name && strcmp(data->file_name,pfdin->psz1))
+        if (data->file_name && lstrcmpiA(data->file_name,pfdin->psz1))
                 return 0;
         
         file = cabinet_alloc((len+1)*sizeof(char));
@@ -2884,8 +2990,8 @@ static BOOL extract_a_cabinet_file(MSIPACKAGE* package, const WCHAR* source,
     return ret;
 }
 
-static UINT ready_media_for_file(MSIPACKAGE *package, UINT sequence
-                                 WCHAR* path, WCHAR* file)
+static UINT ready_media_for_file(MSIPACKAGE *package, WCHAR* path
+                                 MSIFILE* file)
 {
     UINT rc;
     MSIQUERY * view;
@@ -2893,24 +2999,30 @@ static UINT ready_media_for_file(MSIPACKAGE *package, UINT sequence,
     static WCHAR source[MAX_PATH];
     static const WCHAR ExecSeqQuery[] =
         {'S','E','L','E','C','T',' ','*',' ', 'F','R','O','M',' ',
-         'M','e','d','i','a',' ','W','H','E','R','E',' ',
-         'L','a','s','t','S','e','q','u','e','n','c','e',' ','>','=',' ','%',
-         'i',' ','O','R','D','E','R',' ','B','Y',' ',
-         'L','a','s','t','S','e','q','u','e','n','c','e',0};
+         '`','M','e','d','i','a','`',' ','W','H','E','R','E',' ',
+         '`','L','a','s','t','S','e','q','u','e','n','c','e','`',' ','>','=',
+         ' ','%', 'i',' ','O','R','D','E','R',' ','B','Y',' ',
+         '`','L','a','s','t','S','e','q','u','e','n','c','e','`',0};
     WCHAR Query[1024];
     WCHAR cab[0x100];
     DWORD sz=0x100;
     INT seq;
     static UINT last_sequence = 0; 
 
-    if (sequence <= last_sequence)
+    if (file->Attributes & msidbFileAttributesNoncompressed)
     {
-        TRACE("Media already ready (%u, %u)\n",sequence,last_sequence);
-        /*extract_a_cabinet_file(package, source,path,file); */
+        TRACE("Uncompressed File, no media to ready.\n");
         return ERROR_SUCCESS;
     }
 
-    sprintfW(Query,ExecSeqQuery,sequence);
+    if (file->Sequence <= last_sequence)
+    {
+        TRACE("Media already ready (%u, %u)\n",file->Sequence,last_sequence);
+        /*extract_a_cabinet_file(package, source,path,file->File); */
+        return ERROR_SUCCESS;
+    }
+
+    sprintfW(Query,ExecSeqQuery,file->Sequence);
 
     rc = MSI_DatabaseOpenViewW(package->db, Query, &view);
     if (rc != ERROR_SUCCESS)
@@ -3038,12 +3150,10 @@ static UINT ACTION_InstallFiles(MSIPACKAGE *package)
         if ((file->State == 1) || (file->State == 2))
         {
             LPWSTR p;
-            INT len;
             MSICOMPONENT* comp = NULL;
 
             TRACE("Installing %s\n",debugstr_w(file->File));
-            rc = ready_media_for_file(package,file->Sequence,path_to_source,
-                            file->File);
+            rc = ready_media_for_file(package, path_to_source, file);
             /* 
              * WARNING!
              * our file table could change here because a new temp file
@@ -3068,11 +3178,18 @@ static UINT ACTION_InstallFiles(MSIPACKAGE *package)
             HeapFree(GetProcessHeap(),0,file->TargetPath);
 
             file->TargetPath = build_directory_name(2, p, file->FileName);
+            HeapFree(GetProcessHeap(),0,p);
+
+            if (file->Attributes & msidbFileAttributesNoncompressed)
+            {
+                p = resolve_folder(package, comp->Directory, TRUE, FALSE, NULL);
+                file->SourcePath = build_directory_name(2, p, file->ShortName);
+                HeapFree(GetProcessHeap(),0,p);
+            }
+            else
+                file->SourcePath = build_directory_name(2, path_to_source, 
+                            file->File);
 
-            len = strlenW(path_to_source) + strlenW(file->File) + 2;
-            file->SourcePath = HeapAlloc(GetProcessHeap(),0,len*sizeof(WCHAR));
-            strcpyW(file->SourcePath, path_to_source);
-            strcatW(file->SourcePath, file->File);
 
             TRACE("file paths %s to %s\n",debugstr_w(file->SourcePath),
                   debugstr_w(file->TargetPath));
@@ -3088,16 +3205,26 @@ static UINT ACTION_InstallFiles(MSIPACKAGE *package)
             msiobj_release( &uirow->hdr );
             ui_progress(package,2,file->FileSize,0,0);
 
-            if (!MoveFileW(file->SourcePath,file->TargetPath))
+            
+            if (file->Attributes & msidbFileAttributesNoncompressed)
+                rc = CopyFileW(file->SourcePath,file->TargetPath,FALSE);
+            else
+                rc = MoveFileW(file->SourcePath, file->TargetPath);
+
+            if (!rc)
             {
                 rc = GetLastError();
-                ERR("Unable to move file (%s -> %s) (error %d)\n",
+                ERR("Unable to move/copy file (%s -> %s) (error %d)\n",
                      debugstr_w(file->SourcePath), debugstr_w(file->TargetPath),
                       rc);
                 if (rc == ERROR_ALREADY_EXISTS && file->State == 2)
                 {
-                    CopyFileW(file->SourcePath,file->TargetPath,FALSE);
-                    DeleteFileW(file->SourcePath);
+                    if (!CopyFileW(file->SourcePath,file->TargetPath,FALSE))
+                        ERR("Unable to copy file (%s -> %s) (error %ld)\n",
+                            debugstr_w(file->SourcePath), 
+                            debugstr_w(file->TargetPath), GetLastError());
+                    if (!(file->Attributes & msidbFileAttributesNoncompressed))
+                        DeleteFileW(file->SourcePath);
                     rc = 0;
                 }
                 else if (rc == ERROR_FILE_NOT_FOUND)
@@ -3105,14 +3232,17 @@ static UINT ACTION_InstallFiles(MSIPACKAGE *package)
                     ERR("Source File Not Found!  Continuing\n");
                     rc = 0;
                 }
-                else
+                else if (file->Attributes & msidbFileAttributesVital)
                 {
-                    ERR("Ignoring Error and continuing...\n");
+                    ERR("Ignoring Error and continuing (nonvital file)...\n");
                     rc = 0;
                 }
             }
             else
+            {
                 file->State = 4;
+                rc = ERROR_SUCCESS;
+            }
         }
     }
 
@@ -3151,7 +3281,7 @@ static UINT ACTION_DuplicateFiles(MSIPACKAGE *package)
     MSIRECORD * row = 0;
     static const WCHAR ExecSeqQuery[] =
         {'S','E','L','E','C','T',' ','*',' ','F','R','O','M',' ',
-         'D','u','p','l','i','c','a','t','e','F','i','l','e',0};
+         '`','D','u','p','l','i','c','a','t','e','F','i','l','e','`',0};
 
     if (!package)
         return ERROR_INVALID_HANDLE;
@@ -3304,21 +3434,35 @@ static LPSTR parse_value(MSIPACKAGE *package, WCHAR *value, DWORD *type,
         {
             LPWSTR ptr;
             CHAR byte[5];
-            LPWSTR deformated;
+            LPWSTR deformated = NULL;
             int count;
 
             deformat_string(package, &value[2], &deformated);
 
             /* binary value type */
-            ptr = deformated; 
-            *type=REG_BINARY;
-            *size = strlenW(ptr)/2;
+            ptr = deformated;
+            *type = REG_BINARY;
+            if (strlenW(ptr)%2)
+                *size = (strlenW(ptr)/2)+1;
+            else
+                *size = strlenW(ptr)/2;
+
             data = HeapAlloc(GetProcessHeap(),0,*size);
-          
+
             byte[0] = '0'; 
             byte[1] = 'x'; 
             byte[4] = 0; 
             count = 0;
+            /* if uneven pad with a zero in front */
+            if (strlenW(ptr)%2)
+            {
+                byte[2]= '0';
+                byte[3]= *ptr;
+                ptr++;
+                data[count] = (BYTE)strtol(byte,NULL,0);
+                count ++;
+                TRACE("Uneven byte count\n");
+            }
             while (*ptr)
             {
                 byte[2]= *ptr;
@@ -3395,7 +3539,7 @@ static UINT ACTION_WriteRegistryValues(MSIPACKAGE *package)
     MSIRECORD * row = 0;
     static const WCHAR ExecSeqQuery[] =
         {'S','E','L','E','C','T',' ','*',' ','F','R','O','M',' ',
-         'R','e','g','i','s','t','r','y',0 };
+         '`','R','e','g','i','s','t','r','y','`',0 };
 
     if (!package)
         return ERROR_INVALID_HANDLE;
@@ -3438,6 +3582,7 @@ static UINT ACTION_WriteRegistryValues(MSIPACKAGE *package)
         MSIRECORD * uirow;
         LPWSTR uikey;
         INT   root;
+        BOOL check_first = FALSE;
 
         rc = MSI_ViewFetch(view,&row);
         if (rc != ERROR_SUCCESS)
@@ -3483,6 +3628,7 @@ static UINT ACTION_WriteRegistryValues(MSIPACKAGE *package)
             {
                 HeapFree(GetProcessHeap(),0,name);
                 name = NULL;
+                check_first = TRUE;
             }
         }
 
@@ -3545,8 +3691,32 @@ static UINT ACTION_WriteRegistryValues(MSIPACKAGE *package)
 
         deformat_string(package, name, &deformated);
 
-        TRACE("Setting value %s\n",debugstr_w(deformated));
-        RegSetValueExW(hkey, deformated, 0, type, value_data, size);
+        /* get the double nulls to terminate SZ_MULTI */
+        if (type == REG_MULTI_SZ)
+            size +=sizeof(WCHAR);
+
+        if (!check_first)
+        {
+            TRACE("Setting value %s of %s\n",debugstr_w(deformated),
+                            debugstr_w(uikey));
+            RegSetValueExW(hkey, deformated, 0, type, value_data, size);
+        }
+        else
+        {
+            DWORD sz = 0;
+            rc = RegQueryValueExW(hkey, deformated, NULL, NULL, NULL, &sz);
+            if (rc == ERROR_SUCCESS || rc == ERROR_MORE_DATA)
+            {
+                TRACE("value %s of %s checked already exists\n",
+                                debugstr_w(deformated), debugstr_w(uikey));
+            }
+            else
+            {
+                TRACE("Checked and setting value %s of %s\n",
+                                debugstr_w(deformated), debugstr_w(uikey));
+                RegSetValueExW(hkey, deformated, 0, type, value_data, size);
+            }
+        }
 
         uirow = MSI_CreateRecord(3);
         MSI_RecordSetStringW(uirow,2,deformated);
@@ -3589,7 +3759,7 @@ static UINT ACTION_InstallValidate(MSIPACKAGE *package)
     DWORD total = 0;
     static const WCHAR q1[]=
         {'S','E','L','E','C','T',' ','*',' ', 'F','R','O','M',' ',
-         'R','e','g','i','s','t','r','y',0};
+         '`','R','e','g','i','s','t','r','y','`',0};
     UINT rc;
     MSIQUERY * view;
     MSIRECORD * row = 0;
@@ -3629,6 +3799,14 @@ static UINT ACTION_InstallValidate(MSIPACKAGE *package)
         total += package->files[i].FileSize;
     ui_progress(package,0,total,0,0);
 
+    for(i = 0; i < package->loaded_features; i++)
+    {
+        MSIFEATURE* feature = &package->features[i];
+        TRACE("Feature: %s; Installed: %i; Action %i; Request %i\n",
+            debugstr_w(feature->Feature), feature->Installed, feature->Action,
+            feature->ActionRequest);
+    }
+    
     return ERROR_SUCCESS;
 }
 
@@ -3639,7 +3817,7 @@ static UINT ACTION_LaunchConditions(MSIPACKAGE *package)
     MSIRECORD * row = 0;
     static const WCHAR ExecSeqQuery[] =
         {'S','E','L','E','C','T',' ','*',' ','F','R','O','M',' ',
-         'L','a','u','n','c','h','C','o','n','d','i','t','i','o','n',0};
+         '`','L','a','u','n','c','h','C','o','n','d','i','t','i','o','n','`',0};
     static const WCHAR title[]=
         {'I','n','s','t','a','l','l',' ','F','a', 'i','l','e','d',0};
 
@@ -3708,8 +3886,9 @@ static LPWSTR resolve_keypath( MSIPACKAGE* package, INT
         LPWSTR key,deformated,buffer,name,deformated_name;
         static const WCHAR ExecSeqQuery[] =
             {'S','E','L','E','C','T',' ','*',' ','F','R','O','M',' ',
-             'R','e','g','i','s','t','r','y',' ','W','H','E','R','E',' ',
-             'R','e','g','i','s','t','r','y',' ','=',' ' ,'`','%','s','`',0 };
+             '`','R','e','g','i','s','t','r','y','`',' ',
+             'W','H','E','R','E',' ', '`','R','e','g','i','s','t','r','y','`',
+             ' ','=',' ' ,'\'','%','s','\'',0 };
         static const WCHAR fmt[]={'%','0','2','i',':','\\','%','s','\\',0};
         static const WCHAR fmt2[]=
             {'%','0','2','i',':','\\','%','s','\\','%','s',0};
@@ -3941,9 +4120,6 @@ static UINT ACTION_ProcessComponents(MSIPACKAGE *package)
             MSIRECORD * uirow;
 
             squash_guid(package->components[i].ComponentId,squished_cc);
-            rc = RegCreateKeyW(hkey,squished_cc,&hkey2);
-            if (rc != ERROR_SUCCESS)
-                continue;
            
             keypath = resolve_keypath(package,i);
             package->components[i].FullKeypath = keypath;
@@ -3951,8 +4127,9 @@ static UINT ACTION_ProcessComponents(MSIPACKAGE *package)
             /* do the refcounting */
             ACTION_RefCountComponent( package, i);
 
-            TRACE("Component %s, Keypath=%s, RefCount=%i\n", 
-                            debugstr_w(package->components[i].Component), 
+            TRACE("Component %s (%s), Keypath=%s, RefCount=%i\n", 
+                            debugstr_w(package->components[i].Component),
+                            debugstr_w(squished_cc),
                             debugstr_w(package->components[i].FullKeypath), 
                             package->components[i].RefCount);
             /*
@@ -3962,6 +4139,10 @@ static UINT ACTION_ProcessComponents(MSIPACKAGE *package)
             if (ACTION_VerifyComponentForAction(package, i,
                                     INSTALLSTATE_LOCAL))
             {
+                rc = RegCreateKeyW(hkey,squished_cc,&hkey2);
+                if (rc != ERROR_SUCCESS)
+                    continue;
+
                 if (keypath)
                 {
                     RegSetValueExW(hkey2,squished_pc,0,REG_SZ,(LPVOID)keypath,
@@ -3996,6 +4177,11 @@ static UINT ACTION_ProcessComponents(MSIPACKAGE *package)
                                     INSTALLSTATE_ABSENT))
             {
                 DWORD res;
+
+                rc = RegOpenKeyW(hkey,squished_cc,&hkey2);
+                if (rc != ERROR_SUCCESS)
+                    continue;
+
                 RegDeleteValueW(hkey2,squished_pc);
 
                 /* if the key is empty delete it */
@@ -4088,7 +4274,7 @@ static UINT ACTION_RegisterTypeLibraries(MSIPACKAGE *package)
     MSIRECORD * row = 0;
     static const WCHAR Query[] =
         {'S','E','L','E','C','T',' ','*',' ','F','R','O','M',' ',
-         'T','y','p','e','L','i','b',0};
+         '`','T','y','p','e','L','i','b','`',0};
 
     if (!package)
         return ERROR_INVALID_HANDLE;
@@ -4217,8 +4403,8 @@ static UINT register_appid(MSIPACKAGE *package, LPCWSTR clsid, LPCWSTR app )
     MSIRECORD * row = 0;
     static const WCHAR ExecSeqQuery[] = 
         {'S','E','L','E','C','T',' ','*',' ','F','R','O','M',' ',
-         'A','p','p','I' ,'d',' ','w','h','e','r','e',' ',
-         'A','p','p','I','d','=','`','%','s','`',0};
+         '`','A','p','p','I' ,'d','`',' ','W','H','E','R','E',' ',
+         '`','A','p','p','I','d','`',' ','=','\'','%','s','\'',0};
     HKEY hkey2,hkey3;
     LPWSTR buffer=0;
 
@@ -4347,7 +4533,7 @@ static UINT ACTION_RegisterClassInfo(MSIPACKAGE *package)
     MSIRECORD * row = 0;
     static const WCHAR ExecSeqQuery[] =
         {'S','E','L','E','C','T',' ','*',' ','F','R','O','M',' ',
-         'C','l','a','s','s',0};
+         '`','C','l','a','s','s','`',0};
     static const WCHAR szCLSID[] = { 'C','L','S','I','D',0 };
     static const WCHAR szProgID[] = { 'P','r','o','g','I','D',0 };
     static const WCHAR szAppID[] = { 'A','p','p','I','D',0 };
@@ -4404,8 +4590,10 @@ static UINT ACTION_RegisterClassInfo(MSIPACKAGE *package)
             continue;
         }
 
-        if (!ACTION_VerifyComponentForAction(package, index,
-                                INSTALLSTATE_LOCAL))
+        if ((!ACTION_VerifyComponentForAction(package, index,
+                                INSTALLSTATE_LOCAL)) &&
+            (!ACTION_VerifyComponentForAction(package, index,
+                                INSTALLSTATE_ADVERTISED)))
         {
             TRACE("Skipping class reg due to disabled component\n");
             msiobj_release(&row->hdr);
@@ -4662,8 +4850,8 @@ static UINT register_parent_progid(MSIPACKAGE *package, LPCWSTR parent,
     MSIRECORD * row = 0;
     static const WCHAR Query_t[] = 
         {'S','E','L','E','C','T',' ','*',' ','F','R','O','M',' ',
-         'P','r','o','g' ,'I','d',' ','W','H','E','R','E',' ',
-         'P','r','o','g','I','d',' ','=',' ','`' ,'%','s','`',0};
+         '`','P','r','o','g' ,'I','d','`',' ','W','H','E','R','E',' ',
+         '`','P','r','o','g','I','d','`',' ','=',' ','\'' ,'%','s','\'',0};
 
     if (!package)
         return ERROR_INVALID_HANDLE;
@@ -4776,7 +4964,7 @@ static UINT ACTION_RegisterProgIdInfo(MSIPACKAGE *package)
     MSIRECORD * row = 0;
     static const WCHAR Query[] =
         {'S','E','L','E','C','T',' ','*',' ', 'F','R','O','M',' ',
-         'P','r','o','g','I','d',0};
+         '`','P','r','o','g','I','d','`',0};
 
     if (!package)
         return ERROR_INVALID_HANDLE;
@@ -4851,8 +5039,8 @@ static UINT ACTION_CreateShortcuts(MSIPACKAGE *package)
     MSIQUERY * view;
     MSIRECORD * row = 0;
     static const WCHAR Query[] =
-        {'S','E','L','E','C','T',' ','*',' ','f','r','o','m',' ',
-         'S','h','o','r','t','c','u','t',0};
+        {'S','E','L','E','C','T',' ','*',' ','F','R','O','M',' ',
+         '`','S','h','o','r','t','c','u','t','`',0};
     IShellLinkW *sl;
     IPersistFile *pf;
     HRESULT res;
@@ -5054,7 +5242,7 @@ static UINT ACTION_PublishProduct(MSIPACKAGE *package)
     MSIRECORD * row = 0;
     static const WCHAR Query[]=
         {'S','E','L','E','C','T',' ','*',' ','F','R','O','M',' ',
-         'I','c','o','n',0};
+         '`','I','c','o','n','`',0};
     DWORD sz;
     /* for registry stuff */
     LPWSTR productcode;
@@ -5215,7 +5403,7 @@ static UINT ACTION_WriteIniValues(MSIPACKAGE *package)
     MSIRECORD * row = 0;
     static const WCHAR ExecSeqQuery[] = 
         {'S','E','L','E','C','T',' ','*',' ','F','R','O','M',' ',
-         'I','n','i','F','i','l','e',0};
+         '`','I','n','i','F','i','l','e','`',0};
     static const WCHAR szWindowsFolder[] =
           {'W','i','n','d','o','w','s','F','o','l','d','e','r',0};
 
@@ -5357,10 +5545,11 @@ static UINT ACTION_SelfRegModules(MSIPACKAGE *package)
     MSIRECORD * row = 0;
     static const WCHAR ExecSeqQuery[] = 
         {'S','E','L','E','C','T',' ','*',' ','F','R','O','M',' ',
-         'S','e','l','f','R','e','g',0};
+         '`','S','e','l','f','R','e','g','`',0};
 
     static const WCHAR ExeStr[] =
-        {'r','e','g','s','v','r','3','2','.','e','x','e',' ','/','s',' ',0};
+        {'r','e','g','s','v','r','3','2','.','e','x','e',' ','\"',0};
+    static const WCHAR close[] =  {'\"',0};
     STARTUPINFOW si;
     PROCESS_INFORMATION info;
     BOOL brc;
@@ -5414,13 +5603,14 @@ static UINT ACTION_SelfRegModules(MSIPACKAGE *package)
         filename = HeapAlloc(GetProcessHeap(),0,len*sizeof(WCHAR));
         strcpyW(filename,ExeStr);
         strcatW(filename,package->files[index].TargetPath);
+        strcatW(filename,close);
 
         TRACE("Registering %s\n",debugstr_w(filename));
         brc = CreateProcessW(NULL, filename, NULL, NULL, FALSE, 0, NULL,
                   c_colon, &si, &info);
 
         if (brc)
-            msi_dialog_check_messages(package->dialog, info.hProcess);
+            msi_dialog_check_messages(info.hProcess);
  
         HeapFree(GetProcessHeap(),0,filename);
         msiobj_release(&row->hdr);
@@ -5460,9 +5650,12 @@ static UINT ACTION_PublishFeatures(MSIPACKAGE *package)
         GUID clsid;
         int j;
         INT size;
+        BOOL absent = FALSE;
 
-        if (!ACTION_VerifyFeatureForAction(package,i,INSTALLSTATE_LOCAL))
-            continue;
+        if (!ACTION_VerifyFeatureForAction(package,i,INSTALLSTATE_LOCAL) &&
+            !ACTION_VerifyFeatureForAction(package,i,INSTALLSTATE_SOURCE) &&
+            !ACTION_VerifyFeatureForAction(package,i,INSTALLSTATE_ADVERTISED))
+            absent = TRUE;
 
         size = package->features[i].ComponentCount*21;
         size +=1;
@@ -5476,14 +5669,18 @@ static UINT ACTION_PublishFeatures(MSIPACKAGE *package)
         {
             WCHAR buf[21];
             memset(buf,0,sizeof(buf));
-            TRACE("From %s\n",debugstr_w(package->components
+            if (package->components
+                [package->features[i].Components[j]].ComponentId[0]!=0)
+            {
+                TRACE("From %s\n",debugstr_w(package->components
                             [package->features[i].Components[j]].ComponentId));
-            CLSIDFromString(package->components
+                CLSIDFromString(package->components
                             [package->features[i].Components[j]].ComponentId,
                             &clsid);
-            encode_base85_guid(&clsid,buf);
-            TRACE("to %s\n",debugstr_w(buf));
-            strcatW(data,buf);
+                encode_base85_guid(&clsid,buf);
+                TRACE("to %s\n",debugstr_w(buf));
+                strcatW(data,buf);
+            }
         }
         if (package->features[i].Feature_Parent[0])
         {
@@ -5497,9 +5694,23 @@ static UINT ACTION_PublishFeatures(MSIPACKAGE *package)
                        (LPSTR)data,size);
         HeapFree(GetProcessHeap(),0,data);
 
-        size = strlenW(package->features[i].Feature_Parent)*sizeof(WCHAR);
-        RegSetValueExW(hukey,package->features[i].Feature,0,REG_SZ,
+        if (!absent)
+        {
+            size = strlenW(package->features[i].Feature_Parent)*sizeof(WCHAR);
+            RegSetValueExW(hukey,package->features[i].Feature,0,REG_SZ,
                        (LPSTR)package->features[i].Feature_Parent,size);
+        }
+        else
+        {
+            size = (strlenW(package->features[i].Feature_Parent)+2)*
+                    sizeof(WCHAR);
+            data = HeapAlloc(GetProcessHeap(),0,size);
+            data[0] = 0x6;
+            strcpyW(&data[1],package->features[i].Feature_Parent);
+            RegSetValueExW(hukey,package->features[i].Feature,0,REG_SZ,
+                       (LPSTR)data,size);
+            HeapFree(GetProcessHeap(),0,data);
+        }
     }
 
 end:
@@ -5625,7 +5836,10 @@ static UINT ACTION_RegisterProduct(MSIPACKAGE *package)
     snprintfW(path,sizeof(path)/sizeof(path[0]),installerPathFmt,windir);
     create_full_pathW(path);
     TRACE("Copying to local package %s\n",debugstr_w(packagefile));
-    CopyFileW(package->PackagePath,packagefile,FALSE);
+    if (!CopyFileW(package->PackagePath,packagefile,FALSE))
+        ERR("Unable to copy package (%s -> %s) (error %ld)\n",
+            debugstr_w(package->PackagePath), debugstr_w(packagefile),
+            GetLastError());
     size = strlenW(packagefile)*sizeof(WCHAR);
     RegSetValueExW(hkey,szLocalPackage,0,REG_SZ,(LPSTR)packagefile,size);
     
@@ -5793,7 +6007,7 @@ static UINT ACTION_RegisterExtensionInfo(MSIPACKAGE *package)
     MSIRECORD * row = 0;
     static const WCHAR ExecSeqQuery[] =
         {'S','E','L','E','C','T',' ','*',' ','F','R','O','M',' ',
-         'E','x','t','e','n','s','i','o','n',0};
+         '`','E','x','t','e','n','s','i','o','n','`',0};
     static const WCHAR szContentType[] = 
         {'C','o','n','t','e','n','t',' ','T','y','p','e',0 };
     HKEY hkey;
@@ -5842,8 +6056,10 @@ static UINT ACTION_RegisterExtensionInfo(MSIPACKAGE *package)
             continue;
         }
 
-        if (!ACTION_VerifyComponentForAction(package, index,
-                                INSTALLSTATE_LOCAL))
+        if ((!ACTION_VerifyComponentForAction(package, index,
+                                INSTALLSTATE_LOCAL)) &&
+            (!ACTION_VerifyComponentForAction(package, index,
+                                INSTALLSTATE_ADVERTISED)))
         {
             TRACE("Skipping extension reg due to disabled component\n");
             msiobj_release(&row->hdr);
@@ -5916,7 +6132,7 @@ static UINT ACTION_RegisterMIMEInfo(MSIPACKAGE *package)
     MSIRECORD * row = 0;
     static const WCHAR ExecSeqQuery[] =
         {'S','E','L','E','C','T',' ','*',' ','F','R','O','M',' ',
-         'M','I','M','E',0};
+         '`','M','I','M','E','`',0};
     static const WCHAR szExten[] = 
         {'E','x','t','e','n','s','i','o','n',0 };
     HKEY hkey;
@@ -6042,6 +6258,8 @@ static UINT ACTION_RegisterUser(MSIPACKAGE *package)
             size = strlenW(buffer)*sizeof(WCHAR);
             RegSetValueExW(hkey,szRegKeys[i],0,REG_SZ,(LPSTR)buffer,size);
         }
+        else
+            RegSetValueExW(hkey,szRegKeys[i],0,REG_SZ,NULL,0);
         i++;
     }
 
@@ -6057,7 +6275,7 @@ end:
 static UINT ACTION_ExecuteAction(MSIPACKAGE *package)
 {
     UINT rc;
-    rc = ACTION_ProcessExecSequence(package,TRUE);
+    rc = ACTION_ProcessExecSequence(package,FALSE);
     return rc;
 }
 
@@ -6187,6 +6405,8 @@ static LPWSTR load_ttfname_from(LPCWSTR filename)
         }
         CloseHandle(handle);
     }
+    else
+        ERR("Unable to open font file %s\n", debugstr_w(filename));
 
     TRACE("Returning fontname %s\n",debugstr_w(ret));
     return ret;
@@ -6199,7 +6419,7 @@ static UINT ACTION_RegisterFonts(MSIPACKAGE *package)
     MSIRECORD * row = 0;
     static const WCHAR ExecSeqQuery[] =
         {'S','E','L','E','C','T',' ','*',' ','F','R','O','M',' ',
-         'F','o','n','t',0};
+         '`','F','o','n','t','`',0};
     static const WCHAR regfont1[] =
         {'S','o','f','t','w','a','r','e','\\',
          'M','i','c','r','o','s','o','f','t','\\',
@@ -6215,16 +6435,22 @@ static UINT ACTION_RegisterFonts(MSIPACKAGE *package)
     HKEY hkey1;
     HKEY hkey2;
 
+    TRACE("%p\n", package);
+
     rc = MSI_DatabaseOpenViewW(package->db, ExecSeqQuery, &view);
     if (rc != ERROR_SUCCESS)
-        return rc;
+    {
+        TRACE("MSI_DatabaseOpenViewW failed: %d\n", rc);
+        return ERROR_SUCCESS;
+    }
 
     rc = MSI_ViewExecute(view, 0);
     if (rc != ERROR_SUCCESS)
     {
         MSI_ViewClose(view);
         msiobj_release(&view->hdr);
-        return rc;
+        TRACE("MSI_ViewExecute returned %d\n", rc);
+        return ERROR_SUCCESS;
     }
 
     RegCreateKeyW(HKEY_LOCAL_MACHINE,regfont1,&hkey1);
@@ -6289,10 +6515,143 @@ static UINT ACTION_RegisterFonts(MSIPACKAGE *package)
     RegCloseKey(hkey1);
     RegCloseKey(hkey2);
 
+    TRACE("returning %d\n", rc);
+    return rc;
+}
+
+static UINT ITERATE_PublishComponent(MSIRECORD *rec, LPVOID param)
+{
+    MSIPACKAGE *package = (MSIPACKAGE*)param;
+    LPWSTR productid=NULL, compgroupid=NULL;
+    LPWSTR feature=NULL;
+    LPWSTR text = NULL;
+    LPWSTR qualifier = NULL;
+    LPWSTR component = NULL;
+    GUID clsid;
+    WCHAR productid_85[21];
+    WCHAR component_85[21];
+    HKEY hkey;
+    UINT rc = ERROR_SUCCESS;
+    UINT index;
+    /*
+     * I have a fair bit of confusion as to when a < is used and when a > is
+     * used. I do not think i have it right...
+     *
+     * Ok it appears that the > is used if there is a guid for the compoenent
+     * and the < is used if not.
+     */
+    static WCHAR fmt1[] = {'%','s','%','s','<',0,0};
+    static WCHAR fmt2[] = {'%','s','%','s','>','%','s',0,0};
+    LPWSTR output = NULL;
+    DWORD sz = 0;
+    INT component_index;
+
+    component = load_dynamic_stringW(rec,3);
+    component_index = get_loaded_component(package,component);
+
+    if (!ACTION_VerifyComponentForAction(package, component_index,
+                            INSTALLSTATE_LOCAL) && 
+       !ACTION_VerifyComponentForAction(package, component_index,
+                            INSTALLSTATE_SOURCE) &&
+       !ACTION_VerifyComponentForAction(package, component_index,
+                            INSTALLSTATE_ADVERTISED))
+    {
+        TRACE("Skipping: Component %s not scheduled for install\n",
+                        debugstr_w(component));
+        HeapFree(GetProcessHeap(),0,component);
+        return ERROR_SUCCESS;
+    }
+
+    memset(productid_85,0,sizeof(productid_85));
+    memset(component_85,0,sizeof(component_85));
+    compgroupid = load_dynamic_stringW(rec,1);
+
+    rc = MSIREG_OpenUserComponentsKey(compgroupid, &hkey, TRUE);
+    if (rc != ERROR_SUCCESS)
+        goto end;
+    
+    productid = load_dynamic_property(package,szProductCode,NULL);
+    CLSIDFromString(productid, &clsid);
+    
+    encode_base85_guid(&clsid,productid_85);
+
+    text = load_dynamic_stringW(rec,4);
+    qualifier = load_dynamic_stringW(rec,2);
+
+    feature = load_dynamic_stringW(rec,5);
+  
+    index = get_loaded_component(package, component);
+    CLSIDFromString(package->components[index].ComponentId, &clsid);
+    encode_base85_guid(&clsid,component_85);
+
+    TRACE("Doing something with this... %s = %s %s %s %s\n", 
+            debugstr_w(qualifier), debugstr_w(productid_85),
+            debugstr_w(feature), debugstr_w(text), debugstr_w(component_85));
+    sz = lstrlenW(productid_85) + lstrlenW(feature);
+    if (text)
+        sz += lstrlenW(text);
+    if (component && index >= 0)
+        sz += lstrlenW(component_85);
+
+    sz+=3;
+    sz *= sizeof(WCHAR);
+           
+    output = HeapAlloc(GetProcessHeap(),0,sz);
+    memset(output,0,sz);
+
+    if (component && index >= 0)
+        sprintfW(output,fmt2,productid_85,feature,component_85);
+    else
+        sprintfW(output,fmt1,productid_85,feature);
+
+    if (text)
+        strcatW(output,text);
+
+    sz = (lstrlenW(output)+2) * sizeof(WCHAR);
+   RegSetValueExW(hkey, qualifier,0,REG_MULTI_SZ, (LPBYTE)output, sz);
+    
+end:
+    RegCloseKey(hkey);
+    HeapFree(GetProcessHeap(),0,output);
+    HeapFree(GetProcessHeap(),0,compgroupid);
+    HeapFree(GetProcessHeap(),0,component);
+    HeapFree(GetProcessHeap(),0,productid);
+    HeapFree(GetProcessHeap(),0,feature);
+    HeapFree(GetProcessHeap(),0,text);
+    HeapFree(GetProcessHeap(),0,qualifier);
+    
+    return rc;
+}
+
+/*
+ * At present I am ignorning the advertised components part of this and only
+ * focusing on the qualified component sets
+ */
+static UINT ACTION_PublishComponents(MSIPACKAGE *package)
+{
+    UINT rc;
+    MSIQUERY * view;
+    static const WCHAR ExecSeqQuery[] =
+        {'S','E','L','E','C','T',' ','*',' ','F','R','O','M',' ',
+         '`','P','u','b','l','i','s','h',
+         'C','o','m','p','o','n','e','n','t','`',0};
+    
+    rc = MSI_DatabaseOpenViewW(package->db, ExecSeqQuery, &view);
+    if (rc != ERROR_SUCCESS)
+        return ERROR_SUCCESS;
+
+    rc = MSI_IterateRecords(view, NULL, ITERATE_PublishComponent, package);
+    msiobj_release(&view->hdr);
+
     return rc;
 }
 
 /* Msi functions that seem appropriate here */
+
+/***********************************************************************
+ * MsiDoActionA       (MSI.@)
+ */
 UINT WINAPI MsiDoActionA( MSIHANDLE hInstall, LPCSTR szAction )
 {
     LPWSTR szwAction;
@@ -6316,6 +6675,9 @@ UINT WINAPI MsiDoActionA( MSIHANDLE hInstall, LPCSTR szAction )
     return rc;
 }
 
+/***********************************************************************
+ * MsiDoActionW       (MSI.@)
+ */
 UINT WINAPI MsiDoActionW( MSIHANDLE hInstall, LPCWSTR szAction )
 {
     MSIPACKAGE *package;
@@ -6461,6 +6823,9 @@ UINT WINAPI MsiGetSourcePathW( MSIHANDLE hInstall, LPCWSTR szFolder, LPWSTR
 }
 
 
+/***********************************************************************
+ * MsiSetTargetPathA  (MSI.@)
+ */
 UINT WINAPI MsiSetTargetPathA(MSIHANDLE hInstall, LPCSTR szFolder, 
                              LPCSTR szFolderPath)
 {
@@ -6519,7 +6884,7 @@ UINT MSI_SetTargetPathW(MSIPACKAGE *package, LPCWSTR szFolder,
     HeapFree(GetProcessHeap(),0,folder->Property);
     folder->Property = build_directory_name(2, szFolderPath, NULL);
 
-    if (strcmpiW(path, folder->Property) == 0)
+    if (lstrcmpiW(path, folder->Property) == 0)
     {
         /*
          *  Resolved Target has not really changed, so just 
@@ -6550,6 +6915,9 @@ UINT MSI_SetTargetPathW(MSIPACKAGE *package, LPCWSTR szFolder,
     return ERROR_SUCCESS;
 }
 
+/***********************************************************************
+ * MsiSetTargetPathW  (MSI.@)
+ */
 UINT WINAPI MsiSetTargetPathW(MSIHANDLE hInstall, LPCWSTR szFolder, 
                              LPCWSTR szFolderPath)
 {
@@ -6604,7 +6972,9 @@ BOOL WINAPI MsiGetMode(MSIHANDLE hInstall, MSIRUNMODE iRunMode)
     return TRUE;
 }
 
-/*
+/***********************************************************************
+ * MsiSetFeatureStateA (MSI.@)
+ *
  * According to the docs, when this is called it immediately recalculates
  * all the component states as well
  */
@@ -6626,11 +6996,42 @@ UINT WINAPI MsiSetFeatureStateA(MSIHANDLE hInstall, LPCSTR szFeature,
     return rc;
 }
 
+
+
+UINT WINAPI MSI_SetFeatureStateW(MSIPACKAGE* package, LPCWSTR szFeature,
+                                INSTALLSTATE iState)
+{
+    INT index, i;
+    UINT rc = ERROR_SUCCESS;
+
+    TRACE(" %s to %i\n",debugstr_w(szFeature), iState);
+
+    index = get_loaded_feature(package,szFeature);
+    if (index < 0)
+        return ERROR_UNKNOWN_FEATURE;
+
+    package->features[index].ActionRequest= iState;
+    package->features[index].Action= iState;
+
+    ACTION_UpdateComponentStates(package,szFeature);
+
+    /* update all the features that are children of this feature */
+    for (i = 0; i < package->loaded_features; i++)
+    {
+        if (strcmpW(szFeature, package->features[i].Feature_Parent) == 0)
+            MSI_SetFeatureStateW(package, package->features[i].Feature, iState);
+    }
+    
+    return rc;
+}
+
+/***********************************************************************
+ * MsiSetFeatureStateW (MSI.@)
+ */
 UINT WINAPI MsiSetFeatureStateW(MSIHANDLE hInstall, LPCWSTR szFeature,
                                 INSTALLSTATE iState)
 {
     MSIPACKAGE* package;
-    INT index;
     UINT rc = ERROR_SUCCESS;
 
     TRACE(" %s to %i\n",debugstr_w(szFeature), iState);
@@ -6639,17 +7040,8 @@ UINT WINAPI MsiSetFeatureStateW(MSIHANDLE hInstall, LPCWSTR szFeature,
     if (!package)
         return ERROR_INVALID_HANDLE;
 
-    index = get_loaded_feature(package,szFeature);
-    if (index < 0)
-    {
-        rc = ERROR_UNKNOWN_FEATURE;
-        goto end;
-    }
-
-    package->features[index].ActionRequest= iState;
-    ACTION_UpdateComponentStates(package,szFeature);
+    rc = MSI_SetFeatureStateW(package,szFeature,iState);
 
-end:
     msiobj_release( &package->hdr );
     return rc;
 }
@@ -6706,6 +7098,9 @@ piAction);
     return ret;
 }
 
+/***********************************************************************
+ * MsiGetComponentStateA (MSI.@)
+ */
 UINT WINAPI MsiGetComponentStateA(MSIHANDLE hInstall, LPSTR szComponent,
                   INSTALLSTATE *piInstalled, INSTALLSTATE *piAction)
 {
@@ -6745,6 +7140,9 @@ piAction);
     return ERROR_SUCCESS;
 }
 
+/***********************************************************************
+ * MsiGetComponentStateW (MSI.@)
+ */
 UINT WINAPI MsiGetComponentStateW(MSIHANDLE hInstall, LPWSTR szComponent,
                   INSTALLSTATE *piInstalled, INSTALLSTATE *piAction)
 {
index af718be..a88a07f 100644 (file)
@@ -82,6 +82,7 @@ typedef struct tagMSIFILE
     LPWSTR File;
     INT ComponentIndex;
     LPWSTR FileName;
+    LPWSTR ShortName;
     INT FileSize;
     LPWSTR Version;
     LPWSTR Language;
index ca9fc65..f499caa 100644 (file)
 
 #include "windef.h"
 #include "winbase.h"
+#include "winreg.h"
 #include "msi.h"
 #include "msiquery.h"
+#include "msidefs.h"
 #include "winver.h"
 #include "wine/unicode.h"
 #include "wine/debug.h"
@@ -243,6 +245,9 @@ static UINT ACTION_AppSearchReg(MSIPACKAGE *package, BOOL *appFound,
    'R','e','g','L','o','c','a','t','o','r',' ',
    'w','h','e','r','e',' ','S','i','g','n','a','t','u','r','e','_',' ','=',' ',
    '\'','%','s','\'',0};
+    static const WCHAR dwordFmt[] = { '#','%','d','\0' };
+    static const WCHAR expandSzFmt[] = { '#','%','%','%','s','\0' };
+    static const WCHAR binFmt[] = { '#','x','%','x','\0' };
 
     TRACE("(package %p, appFound %p, sig %p)\n", package, appFound, sig);
     *appFound = FALSE;
@@ -250,7 +255,11 @@ static UINT ACTION_AppSearchReg(MSIPACKAGE *package, BOOL *appFound,
     if (rc == ERROR_SUCCESS)
     {
         MSIRECORD *row = 0;
-        LPWSTR keyPath;
+        LPWSTR keyPath = NULL, valueName = NULL, propertyValue = NULL;
+        int root, type;
+        HKEY rootKey, key = NULL;
+        DWORD sz = 0, regType, i;
+        LPBYTE value = NULL;
 
         rc = MSI_ViewExecute(view, 0);
         if (rc != ERROR_SUCCESS)
@@ -266,13 +275,121 @@ static UINT ACTION_AppSearchReg(MSIPACKAGE *package, BOOL *appFound,
             goto end;
         }
 
-        /* get key path */
+        root = MSI_RecordGetInteger(row,2);
         keyPath = load_dynamic_stringW(row,3);
-        FIXME("AppSearch unimplemented for RegLocator (key path %s)\n",
-         debugstr_w(keyPath));
-        HeapFree(GetProcessHeap(), 0, keyPath);
+        /* FIXME: keyPath needs to be expanded for properties */
+        valueName = load_dynamic_stringW(row,4);
+        /* FIXME: valueName probably does too */
+        type = MSI_RecordGetInteger(row,5);
+
+        if ((type & 0x0f) != msidbLocatorTypeRawValue)
+        {
+            FIXME("AppSearch unimplemented for type %d (key path %s, value %s)\n",
+             type, debugstr_w(keyPath), debugstr_w(valueName));
+            goto end;
+        }
+
+        switch (root)
+        {
+            case msidbRegistryRootClassesRoot:
+                rootKey = HKEY_CLASSES_ROOT;
+                break;
+            case msidbRegistryRootCurrentUser:
+                rootKey = HKEY_CURRENT_USER;
+                break;
+            case msidbRegistryRootLocalMachine:
+                rootKey = HKEY_LOCAL_MACHINE;
+                break;
+            case msidbRegistryRootUsers:
+                rootKey = HKEY_USERS;
+                break;
+            default:
+                WARN("Unknown root key %d\n", root);
+                goto end;
+        }
+
+        rc = RegCreateKeyW(rootKey, keyPath, &key);
+        if (rc)
+        {
+            TRACE("RegCreateKeyW returned %d\n", rc);
+            rc = ERROR_SUCCESS;
+            goto end;
+        }
+        rc = RegQueryValueExW(key, valueName, NULL, NULL, NULL, &sz);
+        if (rc)
+        {
+            TRACE("RegQueryValueExW returned %d\n", rc);
+            rc = ERROR_SUCCESS;
+            goto end;
+        }
+        /* FIXME: sanity-check sz before allocating (is there an upper-limit
+         * on the value of a property?)
+         */
+        value = HeapAlloc(GetProcessHeap(), 0, sz);
+        rc = RegQueryValueExW(key, valueName, NULL, &regType, value, &sz);
+        if (rc)
+        {
+            TRACE("RegQueryValueExW returned %d\n", rc);
+            rc = ERROR_SUCCESS;
+            goto end;
+        }
+
+        switch (regType)
+        {
+            case REG_SZ:
+                if (*(LPWSTR)value == '#')
+                {
+                    /* escape leading pound with another */
+                    propertyValue = HeapAlloc(GetProcessHeap(), 0,
+                     sz + sizeof(WCHAR));
+                    propertyValue[0] = '#';
+                    strcpyW(propertyValue + 1, (LPWSTR)value);
+                }
+                else
+                {
+                    propertyValue = HeapAlloc(GetProcessHeap(), 0, sz);
+                    strcpyW(propertyValue, (LPWSTR)value);
+                }
+                break;
+            case REG_DWORD:
+                /* 7 chars for digits, 1 for NULL, 1 for #, and 1 for sign
+                 * char if needed
+                 */
+                propertyValue = HeapAlloc(GetProcessHeap(), 0,
+                 10 * sizeof(WCHAR));
+                sprintfW(propertyValue, dwordFmt, *(DWORD *)value);
+                break;
+            case REG_EXPAND_SZ:
+                /* space for extra #% characters in front */
+                propertyValue = HeapAlloc(GetProcessHeap(), 0,
+                 sz + 2 * sizeof(WCHAR));
+                sprintfW(propertyValue, expandSzFmt, (LPWSTR)value);
+                break;
+            case REG_BINARY:
+                /* 3 == length of "#x<nibble>" */
+                propertyValue = HeapAlloc(GetProcessHeap(), 0,
+                 (sz * 3 + 1) * sizeof(WCHAR));
+                for (i = 0; i < sz; i++)
+                    sprintfW(propertyValue + i * 3, binFmt, value[i]);
+                break;
+            default:
+                WARN("unimplemented for values of type %ld\n", regType);
+                goto end;
+        }
+
+        TRACE("found registry value, setting %s to %s\n",
+         debugstr_w(sig->Property), debugstr_w(propertyValue));
+        rc = MSI_SetPropertyW(package, sig->Property, propertyValue);
+        *appFound = TRUE;
 
 end:
+        HeapFree(GetProcessHeap(), 0, propertyValue);
+        HeapFree(GetProcessHeap(), 0, value);
+        RegCloseKey(key);
+
+        HeapFree(GetProcessHeap(), 0, keyPath);
+        HeapFree(GetProcessHeap(), 0, valueName);
+
         msiobj_release(&row->hdr);
         MSI_ViewClose(view);
         msiobj_release(&view->hdr);
index 56af92f..72fe698 100644 (file)
-/* A Bison parser, made by GNU Bison 1.875c.  */
-
-/* Skeleton parser for Yacc-like parsing with Bison,
-   Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003 Free Software Foundation, Inc.
-
-   This program is free software; you can redistribute it and/or modify
-   it under the terms of the GNU General Public License as published by
-   the Free Software Foundation; either version 2, or (at your option)
-   any later version.
-
-   This program is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-   GNU General Public License for more details.
-
-   You should have received a copy of the GNU General Public License
-   along with this program; if not, write to the Free Software
-   Foundation, Inc., 59 Temple Place - Suite 330,
-   Boston, MA 02111-1307, USA.  */
-
-/* As a special exception, when this file is copied by Bison into a
-   Bison output file, you may use that output file without restriction.
-   This special exception was added by the Free Software Foundation
-   in version 1.24 of Bison.  */
-
-/* Written by Richard Stallman by simplifying the original so called
-   ``semantic'' parser.  */
-
-/* All symbols defined below should begin with yy or YY, to avoid
-   infringing on user name space.  This should be done even for local
-   variables, as they might otherwise be expanded by user macros.
-   There are some unavoidable exceptions within include files to
-   define necessary library symbols; they are noted "INFRINGES ON
-   USER NAME SPACE" below.  */
-
-/* Identify Bison output.  */
-#define YYBISON 1
-
-/* Skeleton name.  */
-#define YYSKELETON_NAME "yacc.c"
-
-/* Pure parsers.  */
-#define YYPURE 1
-
-/* Using locations.  */
-#define YYLSP_NEEDED 0
-
-/* If NAME_PREFIX is specified substitute the variables and functions
-   names.  */
-#define yyparse COND_parse
-#define yylex   COND_lex
-#define yyerror COND_error
-#define yylval  COND_lval
-#define yychar  COND_char
-#define yydebug COND_debug
-#define yynerrs COND_nerrs
-
-
-/* Tokens.  */
-#ifndef YYTOKENTYPE
-# define YYTOKENTYPE
-   /* Put the tokens into the symbol table, so that GDB and other debuggers
-      know about them.  */
-   enum yytokentype {
-     COND_SPACE = 258,
-     COND_EOF = 259,
-     COND_OR = 260,
-     COND_AND = 261,
-     COND_NOT = 262,
-     COND_LT = 263,
-     COND_GT = 264,
-     COND_EQ = 265,
-     COND_LPAR = 266,
-     COND_RPAR = 267,
-     COND_TILDA = 268,
-     COND_PERCENT = 269,
-     COND_DOLLARS = 270,
-     COND_QUESTION = 271,
-     COND_AMPER = 272,
-     COND_EXCLAM = 273,
-     COND_IDENT = 274,
-     COND_NUMBER = 275,
-     COND_LITER = 276,
-     COND_ERROR = 277
-   };
-#endif
-#define COND_SPACE 258
-#define COND_EOF 259
-#define COND_OR 260
-#define COND_AND 261
-#define COND_NOT 262
-#define COND_LT 263
-#define COND_GT 264
-#define COND_EQ 265
-#define COND_LPAR 266
-#define COND_RPAR 267
-#define COND_TILDA 268
-#define COND_PERCENT 269
-#define COND_DOLLARS 270
-#define COND_QUESTION 271
-#define COND_AMPER 272
-#define COND_EXCLAM 273
-#define COND_IDENT 274
-#define COND_NUMBER 275
-#define COND_LITER 276
-#define COND_ERROR 277
-
-
-
-
-/* Copy the first part of user declarations.  */
-#line 1 "./cond.y"
-
-
-/*
- * Implementation of the Microsoft Installer (msi.dll)
- *
- * Copyright 2003 Mike McCormack for CodeWeavers
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
- */
-
-#include "config.h"
-
-#include <stdarg.h>
-#include <stdio.h>
-#include <stdlib.h>
-
-#include "windef.h"
-#include "winbase.h"
-#include "wine/debug.h"
-#include "wine/unicode.h"
-
-#include "msi.h"
-#include "msiquery.h"
-#include "msipriv.h"
-
-#define YYLEX_PARAM info
-#define YYPARSE_PARAM info
-
-static int COND_error(char *str);
-
-WINE_DEFAULT_DEBUG_CHANNEL(msi);
-
-typedef struct tag_yyinput
-{
-    MSIPACKAGE *package;
-    LPCWSTR str;
-    INT    n;
-    MSICONDITION result;
-} COND_input;
-
-struct cond_str {
-    LPCWSTR data;
-    INT len;
-};
-
-static LPWSTR COND_GetString( struct cond_str *str );
-static LPWSTR COND_GetLiteral( struct cond_str *str );
-static int COND_lex( void *COND_lval, COND_input *info);
-
-typedef INT (*comp_int)(INT a, INT b);
-typedef INT (*comp_str)(LPWSTR a, LPWSTR b, BOOL caseless);
-typedef INT (*comp_m1)(LPWSTR a,int b);
-typedef INT (*comp_m2)(int a,LPWSTR b);
-
-static INT comp_lt_i(INT a, INT b);
-static INT comp_gt_i(INT a, INT b);
-static INT comp_le_i(INT a, INT b);
-static INT comp_ge_i(INT a, INT b);
-static INT comp_eq_i(INT a, INT b);
-static INT comp_ne_i(INT a, INT b);
-static INT comp_bitand(INT a, INT b);
-static INT comp_highcomp(INT a, INT b);
-static INT comp_lowcomp(INT a, INT b);
-
-static INT comp_eq_s(LPWSTR a, LPWSTR b, BOOL casless);
-static INT comp_ne_s(LPWSTR a, LPWSTR b, BOOL casless);
-static INT comp_lt_s(LPWSTR a, LPWSTR b, BOOL casless);
-static INT comp_gt_s(LPWSTR a, LPWSTR b, BOOL casless);
-static INT comp_le_s(LPWSTR a, LPWSTR b, BOOL casless);
-static INT comp_ge_s(LPWSTR a, LPWSTR b, BOOL casless);
-static INT comp_substring(LPWSTR a, LPWSTR b, BOOL casless);
-static INT comp_start(LPWSTR a, LPWSTR b, BOOL casless);
-static INT comp_end(LPWSTR a, LPWSTR b, BOOL casless);
-
-static INT comp_eq_m1(LPWSTR a, INT b);
-static INT comp_ne_m1(LPWSTR a, INT b);
-static INT comp_lt_m1(LPWSTR a, INT b);
-static INT comp_gt_m1(LPWSTR a, INT b);
-static INT comp_le_m1(LPWSTR a, INT b);
-static INT comp_ge_m1(LPWSTR a, INT b);
-
-static INT comp_eq_m2(INT a, LPWSTR b);
-static INT comp_ne_m2(INT a, LPWSTR b);
-static INT comp_lt_m2(INT a, LPWSTR b);
-static INT comp_gt_m2(INT a, LPWSTR b);
-static INT comp_le_m2(INT a, LPWSTR b);
-static INT comp_ge_m2(INT a, LPWSTR b);
-
-
-
-/* Enabling traces.  */
-#ifndef YYDEBUG
-# define YYDEBUG 0
-#endif
-
-/* Enabling verbose error messages.  */
-#ifdef YYERROR_VERBOSE
-# undef YYERROR_VERBOSE
-# define YYERROR_VERBOSE 1
-#else
-# define YYERROR_VERBOSE 0
-#endif
-
-#if ! defined (YYSTYPE) && ! defined (YYSTYPE_IS_DECLARED)
-#line 106 "./cond.y"
-typedef union YYSTYPE {
-    struct cond_str str;
-    LPWSTR    string;
-    INT       value;
-    comp_int  fn_comp_int;
-    comp_str  fn_comp_str;
-    comp_m1   fn_comp_m1;
-    comp_m2   fn_comp_m2;
-} YYSTYPE;
-/* Line 191 of yacc.c.  */
-#line 241 "cond.tab.c"
-# define yystype YYSTYPE /* obsolescent; will be withdrawn */
-# define YYSTYPE_IS_DECLARED 1
-# define YYSTYPE_IS_TRIVIAL 1
-#endif
-
-
-
-/* Copy the second part of user declarations.  */
-
-
-/* Line 214 of yacc.c.  */
-#line 253 "cond.tab.c"
-
-#if ! defined (yyoverflow) || YYERROR_VERBOSE
-
-# ifndef YYFREE
-#  define YYFREE free
-# endif
-# ifndef YYMALLOC
-#  define YYMALLOC malloc
-# endif
-
-/* The parser invokes alloca or malloc; define the necessary symbols.  */
-
-# ifdef YYSTACK_USE_ALLOCA
-#  if YYSTACK_USE_ALLOCA
-#   define YYSTACK_ALLOC alloca
-#  endif
-# else
-#  if defined (alloca) || defined (_ALLOCA_H)
-#   define YYSTACK_ALLOC alloca
-#  else
-#   ifdef __GNUC__
-#    define YYSTACK_ALLOC __builtin_alloca
-#   endif
-#  endif
-# endif
-
-# ifdef YYSTACK_ALLOC
-   /* Pacify GCC's `empty if-body' warning. */
-#  define YYSTACK_FREE(Ptr) do { /* empty */; } while (0)
-# else
-#  if defined (__STDC__) || defined (__cplusplus)
-#   include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
-#   define YYSIZE_T size_t
-#  endif
-#  define YYSTACK_ALLOC YYMALLOC
-#  define YYSTACK_FREE YYFREE
-# endif
-#endif /* ! defined (yyoverflow) || YYERROR_VERBOSE */
-
-
-#if (! defined (yyoverflow) \
-     && (! defined (__cplusplus) \
-        || (defined (YYSTYPE_IS_TRIVIAL) && YYSTYPE_IS_TRIVIAL)))
-
-/* A type that is properly aligned for any stack member.  */
-union yyalloc
-{
-  short yyss;
-  YYSTYPE yyvs;
-  };
-
-/* The size of the maximum gap between one aligned stack and the next.  */
-# define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1)
-
-/* The size of an array large to enough to hold all stacks, each with
-   N elements.  */
-# define YYSTACK_BYTES(N) \
-     ((N) * (sizeof (short) + sizeof (YYSTYPE))                                \
-      + YYSTACK_GAP_MAXIMUM)
-
-/* Copy COUNT objects from FROM to TO.  The source and destination do
-   not overlap.  */
-# ifndef YYCOPY
-#  if defined (__GNUC__) && 1 < __GNUC__
-#   define YYCOPY(To, From, Count) \
-      __builtin_memcpy (To, From, (Count) * sizeof (*(From)))
-#  else
-#   define YYCOPY(To, From, Count)             \
-      do                                       \
-       {                                       \
-         register YYSIZE_T yyi;                \
-         for (yyi = 0; yyi < (Count); yyi++)   \
-           (To)[yyi] = (From)[yyi];            \
-       }                                       \
-      while (0)
-#  endif
-# endif
-
-/* Relocate STACK from its old location to the new one.  The
-   local variables YYSIZE and YYSTACKSIZE give the old and new number of
-   elements in the stack, and YYPTR gives the new location of the
-   stack.  Advance YYPTR to a properly aligned location for the next
-   stack.  */
-# define YYSTACK_RELOCATE(Stack)                                       \
-    do                                                                 \
-      {                                                                        \
-       YYSIZE_T yynewbytes;                                            \
-       YYCOPY (&yyptr->Stack, Stack, yysize);                          \
-       Stack = &yyptr->Stack;                                          \
-       yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \
-       yyptr += yynewbytes / sizeof (*yyptr);                          \
-      }                                                                        \
-    while (0)
-
-#endif
-
-#if defined (__STDC__) || defined (__cplusplus)
-   typedef signed char yysigned_char;
-#else
-   typedef short yysigned_char;
-#endif
-
-/* YYFINAL -- State number of the termination state. */
-#define YYFINAL  30
-/* YYLAST -- Last index in YYTABLE.  */
-#define YYLAST   146
-
-/* YYNTOKENS -- Number of terminals. */
-#define YYNTOKENS  23
-/* YYNNTS -- Number of nonterminals. */
-#define YYNNTS  17
-/* YYNRULES -- Number of rules. */
-#define YYNRULES  65
-/* YYNRULES -- Number of states. */
-#define YYNSTATES  74
-
-/* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX.  */
-#define YYUNDEFTOK  2
-#define YYMAXUTOK   277
-
-#define YYTRANSLATE(YYX)                                               \
-  ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
-
-/* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX.  */
-static const unsigned char yytranslate[] =
-{
-       0,     2,     2,     2,     2,     2,     2,     2,     2,     2,
-       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
-       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
-       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
-       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
-       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
-       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
-       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
-       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
-       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
-       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
-       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
-       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
-       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
-       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
-       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
-       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
-       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
-       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
-       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
-       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
-       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
-       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
-       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
-       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
-       2,     2,     2,     2,     2,     2,     1,     2,     3,     4,
-       5,     6,     7,     8,     9,    10,    11,    12,    13,    14,
-      15,    16,    17,    18,    19,    20,    21,    22
-};
-
-#if YYDEBUG
-/* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in
-   YYRHS.  */
-static const unsigned char yyprhs[] =
-{
-       0,     0,     3,     5,     7,    11,    13,    17,    19,    22,
-      24,    26,    30,    34,    39,    43,    47,    51,    53,    56,
-      58,    60,    63,    66,    69,    72,    75,    77,    80,    82,
-      84,    87,    90,    93,    96,    99,   101,   104,   106,   108,
-     111,   114,   117,   120,   123,   125,   128,   130,   132,   135,
-     138,   141,   144,   147,   149,   151,   153,   155,   157,   160,
-     163,   166,   169,   171,   174,   176
-};
-
-/* YYRHS -- A `-1'-separated list of the rules' RHS. */
-static const yysigned_char yyrhs[] =
-{
-      24,     0,    -1,    25,    -1,    26,    -1,    26,     5,    25,
-      -1,    27,    -1,    26,     6,    27,    -1,    28,    -1,     7,
-      28,    -1,    33,    -1,    34,    -1,    33,    29,    33,    -1,
-      34,    30,    34,    -1,    34,    13,    30,    34,    -1,    34,
-      31,    33,    -1,    33,    32,    34,    -1,    11,    25,    12,
-      -1,    10,    -1,     8,     9,    -1,     8,    -1,     9,    -1,
-       8,    10,    -1,     9,    10,    -1,     9,     8,    -1,     8,
-       8,    -1,     9,     9,    -1,    10,    -1,     8,     9,    -1,
-       8,    -1,     9,    -1,     8,    10,    -1,     9,    10,    -1,
-       9,     8,    -1,     8,     8,    -1,     9,     9,    -1,    10,
-      -1,     8,     9,    -1,     8,    -1,     9,    -1,     8,    10,
-      -1,     9,    10,    -1,     9,     8,    -1,     8,     8,    -1,
-       9,     9,    -1,    10,    -1,     8,     9,    -1,     8,    -1,
-       9,    -1,     8,    10,    -1,     9,    10,    -1,     9,     8,
-      -1,     8,     8,    -1,     9,     9,    -1,    36,    -1,    39,
-      -1,    37,    -1,    35,    -1,    21,    -1,    15,    38,    -1,
-      16,    38,    -1,    17,    38,    -1,    18,    38,    -1,    38,
-      -1,    14,    38,    -1,    19,    -1,    20,    -1
-};
-
-/* YYRLINE[YYN] -- source line where rule number YYN was defined.  */
-static const unsigned short yyrline[] =
-{
-       0,   136,   136,   144,   148,   155,   159,   166,   170,   178,
-     182,   186,   190,   194,   198,   202,   206,   214,   218,   222,
-     226,   230,   234,   239,   243,   247,   255,   259,   263,   267,
-     271,   275,   280,   284,   288,   296,   300,   304,   308,   312,
-     316,   321,   325,   329,   337,   341,   345,   349,   353,   357,
-     362,   366,   370,   377,   381,   388,   392,   399,   408,   417,
-     426,   435,   447,   470,   484,   493
-};
-#endif
-
-#if YYDEBUG || YYERROR_VERBOSE
-/* YYTNME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
-   First, the terminals, then, starting at YYNTOKENS, nonterminals. */
-static const char *const yytname[] =
-{
-  "$end", "error", "$undefined", "COND_SPACE", "COND_EOF", "COND_OR",
-  "COND_AND", "COND_NOT", "COND_LT", "COND_GT", "COND_EQ", "COND_LPAR",
-  "COND_RPAR", "COND_TILDA", "COND_PERCENT", "COND_DOLLARS",
-  "COND_QUESTION", "COND_AMPER", "COND_EXCLAM", "COND_IDENT",
-  "COND_NUMBER", "COND_LITER", "COND_ERROR", "$accept", "condition",
-  "expression", "boolean_term", "boolean_factor", "term", "comp_op_i",
-  "comp_op_s", "comp_op_m1", "comp_op_m2", "value_i", "value_s", "literal",
-  "symbol_i", "symbol_s", "identifier", "integer", 0
-};
-#endif
-
-# ifdef YYPRINT
-/* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to
-   token YYLEX-NUM.  */
-static const unsigned short yytoknum[] =
-{
-       0,   256,   257,   258,   259,   260,   261,   262,   263,   264,
-     265,   266,   267,   268,   269,   270,   271,   272,   273,   274,
-     275,   276,   277
-};
-# endif
-
-/* YYR1[YYN] -- Symbol number of symbol that rule YYN derives.  */
-static const unsigned char yyr1[] =
-{
-       0,    23,    24,    25,    25,    26,    26,    27,    27,    28,
-      28,    28,    28,    28,    28,    28,    28,    29,    29,    29,
-      29,    29,    29,    29,    29,    29,    30,    30,    30,    30,
-      30,    30,    30,    30,    30,    31,    31,    31,    31,    31,
-      31,    31,    31,    31,    32,    32,    32,    32,    32,    32,
-      32,    32,    32,    33,    33,    34,    34,    35,    36,    36,
-      36,    36,    37,    37,    38,    39
-};
-
-/* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN.  */
-static const unsigned char yyr2[] =
-{
-       0,     2,     1,     1,     3,     1,     3,     1,     2,     1,
-       1,     3,     3,     4,     3,     3,     3,     1,     2,     1,
-       1,     2,     2,     2,     2,     2,     1,     2,     1,     1,
-       2,     2,     2,     2,     2,     1,     2,     1,     1,     2,
-       2,     2,     2,     2,     1,     2,     1,     1,     2,     2,
-       2,     2,     2,     1,     1,     1,     1,     1,     2,     2,
-       2,     2,     1,     2,     1,     1
-};
-
-/* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state
-   STATE-NUM when YYTABLE doesn't specify something else to do.  Zero
-   means the default is an error.  */
-static const unsigned char yydefact[] =
-{
-       0,     0,     0,     0,     0,     0,     0,     0,    64,    65,
-      57,     0,     2,     3,     5,     7,     9,    10,    56,    53,
-      55,    62,    54,     8,     0,    63,    58,    59,    60,    61,
-       1,     0,     0,    19,    20,    17,     0,     0,    37,    38,
-      35,     0,     0,     0,    16,     4,     6,    24,    18,    21,
-      23,    25,    22,    11,    15,    42,    36,    39,    41,    43,
-      40,    28,    29,    26,     0,    12,    14,    33,    27,    30,
-      32,    34,    31,    13
-};
-
-/* YYDEFGOTO[NTERM-NUM]. */
-static const yysigned_char yydefgoto[] =
-{
-      -1,    11,    12,    13,    14,    15,    36,    42,    43,    37,
-      16,    17,    18,    19,    20,    21,    22
-};
-
-/* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
-   STATE-NUM.  */
-#define YYPACT_NINF -37
-static const short yypact[] =
-{
-      -4,    51,    -4,   -11,   -11,   -11,   -11,   -11,   -37,   -37,
-     -37,    18,   -37,    -1,   -37,   -37,    49,    14,   -37,   -37,
-     -37,   -37,   -37,   -37,    19,   -37,   -37,   -37,   -37,   -37,
-     -37,    -4,    -4,    11,    25,    34,   111,    59,    28,    42,
-      60,   130,    59,   111,   -37,   -37,   -37,    63,    69,    72,
-      73,    81,    82,   -37,   -37,    85,    91,    94,    95,   103,
-     104,   133,   136,   -37,    59,   -37,   -37,   -37,   -37,   -37,
-     -37,   -37,   -37,   -37
-};
-
-/* YYPGOTO[NTERM-NUM].  */
-static const short yypgoto[] =
-{
-     -37,   -37,    -2,   -37,    -6,    39,   -37,     0,   -37,   -37,
-     -34,   -36,   -37,   -37,   -37,   129,   -37
-};
-
-/* YYTABLE[YYPACT[STATE-NUM]].  What to do in state STATE-NUM.  If
-   positive, shift that token.  If negative, reduce the rule which
-   number is the opposite.  If zero, do what YYDEFACT says.
-   If YYTABLE_NINF, syntax error.  */
-#define YYTABLE_NINF -53
-static const yysigned_char yytable[] =
-{
-      24,    54,    53,     1,    31,    32,    65,     2,     8,    66,
-       3,     4,     5,     6,     7,     8,     9,    10,    30,    47,
-      48,    49,    38,    39,    40,   -46,    46,    41,    73,    45,
-     -46,    44,   -46,    50,    51,    52,    55,    56,    57,   -47,
-      23,    64,   -28,     0,   -47,     0,   -47,   -28,   -44,   -28,
-      58,    59,    60,   -44,     0,   -44,   -29,    33,    34,    35,
-       0,   -29,     2,   -29,     0,     3,     4,     5,     6,     7,
-       8,     9,    10,     3,   -26,     0,     0,   -51,     8,   -26,
-      10,   -26,   -51,   -45,   -51,     0,   -48,   -50,   -45,     0,
-     -45,   -48,   -50,   -48,   -50,   -52,   -49,     0,     0,   -33,
-     -52,   -49,   -52,   -49,   -33,   -27,   -33,     0,   -30,   -32,
-     -27,     0,   -27,   -30,   -32,   -30,   -32,   -34,   -31,     0,
-       0,     0,   -34,   -31,   -34,   -31,     4,     5,     6,     7,
-       0,     9,    25,    26,    27,    28,    29,     0,    61,    62,
-      63,    67,    68,    69,    70,    71,    72
-};
-
-static const yysigned_char yycheck[] =
-{
-       2,    37,    36,     7,     5,     6,    42,    11,    19,    43,
-      14,    15,    16,    17,    18,    19,    20,    21,     0,     8,
-       9,    10,     8,     9,    10,    14,    32,    13,    64,    31,
-      19,    12,    21,     8,     9,    10,     8,     9,    10,    14,
-       1,    41,    14,    -1,    19,    -1,    21,    19,    14,    21,
-       8,     9,    10,    19,    -1,    21,    14,     8,     9,    10,
-      -1,    19,    11,    21,    -1,    14,    15,    16,    17,    18,
-      19,    20,    21,    14,    14,    -1,    -1,    14,    19,    19,
-      21,    21,    19,    14,    21,    -1,    14,    14,    19,    -1,
-      21,    19,    19,    21,    21,    14,    14,    -1,    -1,    14,
-      19,    19,    21,    21,    19,    14,    21,    -1,    14,    14,
-      19,    -1,    21,    19,    19,    21,    21,    14,    14,    -1,
-      -1,    -1,    19,    19,    21,    21,    15,    16,    17,    18,
-      -1,    20,     3,     4,     5,     6,     7,    -1,     8,     9,
-      10,     8,     9,    10,     8,     9,    10
-};
-
-/* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
-   symbol of state STATE-NUM.  */
-static const unsigned char yystos[] =
-{
-       0,     7,    11,    14,    15,    16,    17,    18,    19,    20,
-      21,    24,    25,    26,    27,    28,    33,    34,    35,    36,
-      37,    38,    39,    28,    25,    38,    38,    38,    38,    38,
-       0,     5,     6,     8,     9,    10,    29,    32,     8,     9,
-      10,    13,    30,    31,    12,    25,    27,     8,     9,    10,
-       8,     9,    10,    33,    34,     8,     9,    10,     8,     9,
-      10,     8,     9,    10,    30,    34,    33,     8,     9,    10,
-       8,     9,    10,    34
-};
-
-#if ! defined (YYSIZE_T) && defined (__SIZE_TYPE__)
-# define YYSIZE_T __SIZE_TYPE__
-#endif
-#if ! defined (YYSIZE_T) && defined (size_t)
-# define YYSIZE_T size_t
-#endif
-#if ! defined (YYSIZE_T)
-# if defined (__STDC__) || defined (__cplusplus)
-#  include <stddef.h> /* INFRINGES ON USER NAME SPACE */
-#  define YYSIZE_T size_t
-# endif
-#endif
-#if ! defined (YYSIZE_T)
-# define YYSIZE_T unsigned int
-#endif
-
-#define yyerrok                (yyerrstatus = 0)
-#define yyclearin      (yychar = YYEMPTY)
-#define YYEMPTY                (-2)
-#define YYEOF          0
-
-#define YYACCEPT       goto yyacceptlab
-#define YYABORT                goto yyabortlab
-#define YYERROR                goto yyerrorlab
-
-
-/* Like YYERROR except do call yyerror.  This remains here temporarily
-   to ease the transition to the new meaning of YYERROR, for GCC.
-   Once GCC version 2 has supplanted version 1, this can go.  */
-
-#define YYFAIL         goto yyerrlab
-
-#define YYRECOVERING()  (!!yyerrstatus)
-
-#define YYBACKUP(Token, Value)                                 \
-do                                                             \
-  if (yychar == YYEMPTY && yylen == 1)                         \
-    {                                                          \
-      yychar = (Token);                                                \
-      yylval = (Value);                                                \
-      yytoken = YYTRANSLATE (yychar);                          \
-      YYPOPSTACK;                                              \
-      goto yybackup;                                           \
-    }                                                          \
-  else                                                         \
-    {                                                          \
-      yyerror ("syntax error: cannot back up");\
-      YYERROR;                                                 \
-    }                                                          \
-while (0)
-
-#define YYTERROR       1
-#define YYERRCODE      256
-
-/* YYLLOC_DEFAULT -- Compute the default location (before the actions
-   are run).  */
-
-#ifndef YYLLOC_DEFAULT
-# define YYLLOC_DEFAULT(Current, Rhs, N)               \
-   ((Current).first_line   = (Rhs)[1].first_line,      \
-    (Current).first_column = (Rhs)[1].first_column,    \
-    (Current).last_line    = (Rhs)[N].last_line,       \
-    (Current).last_column  = (Rhs)[N].last_column)
-#endif
-
-/* YYLEX -- calling `yylex' with the right arguments.  */
-
-#ifdef YYLEX_PARAM
-# define YYLEX yylex (&yylval, YYLEX_PARAM)
-#else
-# define YYLEX yylex (&yylval)
-#endif
-
-/* Enable debugging if requested.  */
-#if YYDEBUG
-
-# ifndef YYFPRINTF
-#  include <stdio.h> /* INFRINGES ON USER NAME SPACE */
-#  define YYFPRINTF fprintf
-# endif
-
-# define YYDPRINTF(Args)                       \
-do {                                           \
-  if (yydebug)                                 \
-    YYFPRINTF Args;                            \
-} while (0)
-
-# define YYDSYMPRINT(Args)                     \
-do {                                           \
-  if (yydebug)                                 \
-    yysymprint Args;                           \
-} while (0)
-
-# define YYDSYMPRINTF(Title, Token, Value, Location)           \
-do {                                                           \
-  if (yydebug)                                                 \
-    {                                                          \
-      YYFPRINTF (stderr, "%s ", Title);                                \
-      yysymprint (stderr,                                      \
-                  Token, Value);       \
-      YYFPRINTF (stderr, "\n");                                        \
-    }                                                          \
-} while (0)
-
-/*------------------------------------------------------------------.
-| yy_stack_print -- Print the state stack from its BOTTOM up to its |
-| TOP (included).                                                   |
-`------------------------------------------------------------------*/
-
-#if defined (__STDC__) || defined (__cplusplus)
-static void
-yy_stack_print (short *bottom, short *top)
-#else
-static void
-yy_stack_print (bottom, top)
-    short *bottom;
-    short *top;
-#endif
-{
-  YYFPRINTF (stderr, "Stack now");
-  for (/* Nothing. */; bottom <= top; ++bottom)
-    YYFPRINTF (stderr, " %d", *bottom);
-  YYFPRINTF (stderr, "\n");
-}
-
-# define YY_STACK_PRINT(Bottom, Top)                           \
-do {                                                           \
-  if (yydebug)                                                 \
-    yy_stack_print ((Bottom), (Top));                          \
-} while (0)
-
-
-/*------------------------------------------------.
-| Report that the YYRULE is going to be reduced.  |
-`------------------------------------------------*/
-
-#if defined (__STDC__) || defined (__cplusplus)
-static void
-yy_reduce_print (int yyrule)
-#else
-static void
-yy_reduce_print (yyrule)
-    int yyrule;
-#endif
-{
-  int yyi;
-  unsigned int yylno = yyrline[yyrule];
-  YYFPRINTF (stderr, "Reducing stack by rule %d (line %u), ",
-             yyrule - 1, yylno);
-  /* Print the symbols being reduced, and their result.  */
-  for (yyi = yyprhs[yyrule]; 0 <= yyrhs[yyi]; yyi++)
-    YYFPRINTF (stderr, "%s ", yytname [yyrhs[yyi]]);
-  YYFPRINTF (stderr, "-> %s\n", yytname [yyr1[yyrule]]);
-}
-
-# define YY_REDUCE_PRINT(Rule)         \
-do {                                   \
-  if (yydebug)                         \
-    yy_reduce_print (Rule);            \
-} while (0)
-
-/* Nonzero means print parse trace.  It is left uninitialized so that
-   multiple parsers can coexist.  */
-int yydebug;
-#else /* !YYDEBUG */
-# define YYDPRINTF(Args)
-# define YYDSYMPRINT(Args)
-# define YYDSYMPRINTF(Title, Token, Value, Location)
-# define YY_STACK_PRINT(Bottom, Top)
-# define YY_REDUCE_PRINT(Rule)
-#endif /* !YYDEBUG */
-
-
-/* YYINITDEPTH -- initial size of the parser's stacks.  */
-#ifndef        YYINITDEPTH
-# define YYINITDEPTH 200
-#endif
-
-/* YYMAXDEPTH -- maximum size the stacks can grow to (effective only
-   if the built-in stack extension method is used).
-
-   Do not make this value too large; the results are undefined if
-   SIZE_MAX < YYSTACK_BYTES (YYMAXDEPTH)
-   evaluated with infinite-precision integer arithmetic.  */
-
-#if defined (YYMAXDEPTH) && YYMAXDEPTH == 0
-# undef YYMAXDEPTH
-#endif
-
-#ifndef YYMAXDEPTH
-# define YYMAXDEPTH 10000
-#endif
-
-\f
-
-#if YYERROR_VERBOSE
-
-# ifndef yystrlen
-#  if defined (__GLIBC__) && defined (_STRING_H)
-#   define yystrlen strlen
-#  else
-/* Return the length of YYSTR.  */
-static YYSIZE_T
-#   if defined (__STDC__) || defined (__cplusplus)
-yystrlen (const char *yystr)
-#   else
-yystrlen (yystr)
-     const char *yystr;
-#   endif
-{
-  register const char *yys = yystr;
-
-  while (*yys++ != '\0')
-    continue;
-
-  return yys - yystr - 1;
-}
-#  endif
-# endif
-
-# ifndef yystpcpy
-#  if defined (__GLIBC__) && defined (_STRING_H) && defined (_GNU_SOURCE)
-#   define yystpcpy stpcpy
-#  else
-/* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in
-   YYDEST.  */
-static char *
-#   if defined (__STDC__) || defined (__cplusplus)
-yystpcpy (char *yydest, const char *yysrc)
-#   else
-yystpcpy (yydest, yysrc)
-     char *yydest;
-     const char *yysrc;
-#   endif
-{
-  register char *yyd = yydest;
-  register const char *yys = yysrc;
-
-  while ((*yyd++ = *yys++) != '\0')
-    continue;
-
-  return yyd - 1;
-}
-#  endif
-# endif
-
-#endif /* !YYERROR_VERBOSE */
-
-\f
-
-#if YYDEBUG
-/*--------------------------------.
-| Print this symbol on YYOUTPUT.  |
-`--------------------------------*/
-
-#if defined (__STDC__) || defined (__cplusplus)
-static void
-yysymprint (FILE *yyoutput, int yytype, YYSTYPE *yyvaluep)
-#else
-static void
-yysymprint (yyoutput, yytype, yyvaluep)
-    FILE *yyoutput;
-    int yytype;
-    YYSTYPE *yyvaluep;
-#endif
-{
-  /* Pacify ``unused variable'' warnings.  */
-  (void) yyvaluep;
-
-  if (yytype < YYNTOKENS)
-    {
-      YYFPRINTF (yyoutput, "token %s (", yytname[yytype]);
-# ifdef YYPRINT
-      YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep);
-# endif
-    }
-  else
-    YYFPRINTF (yyoutput, "nterm %s (", yytname[yytype]);
-
-  switch (yytype)
-    {
-      default:
-        break;
-    }
-  YYFPRINTF (yyoutput, ")");
-}
-
-#endif /* ! YYDEBUG */
-/*-----------------------------------------------.
-| Release the memory associated to this symbol.  |
-`-----------------------------------------------*/
-
-#if defined (__STDC__) || defined (__cplusplus)
-static void
-yydestruct (int yytype, YYSTYPE *yyvaluep)
-#else
-static void
-yydestruct (yytype, yyvaluep)
-    int yytype;
-    YYSTYPE *yyvaluep;
-#endif
-{
-  /* Pacify ``unused variable'' warnings.  */
-  (void) yyvaluep;
-
-  switch (yytype)
-    {
-
-      default:
-        break;
-    }
-}
-\f
-
-/* Prevent warnings from -Wmissing-prototypes.  */
-
-#ifdef YYPARSE_PARAM
-# if defined (__STDC__) || defined (__cplusplus)
-int yyparse (void *YYPARSE_PARAM);
-# else
-int yyparse ();
-# endif
-#else /* ! YYPARSE_PARAM */
-#if defined (__STDC__) || defined (__cplusplus)
-int yyparse (void);
-#else
-int yyparse ();
-#endif
-#endif /* ! YYPARSE_PARAM */
-
-
-
-
-
-
-/*----------.
-| yyparse.  |
-`----------*/
-
-#ifdef YYPARSE_PARAM
-# if defined (__STDC__) || defined (__cplusplus)
-int yyparse (void *YYPARSE_PARAM)
-# else
-int yyparse (YYPARSE_PARAM)
-  void *YYPARSE_PARAM;
-# endif
-#else /* ! YYPARSE_PARAM */
-#if defined (__STDC__) || defined (__cplusplus)
-int
-yyparse (void)
-#else
-int
-yyparse ()
-
-#endif
-#endif
-{
-  /* The lookahead symbol.  */
-int yychar;
-
-/* The semantic value of the lookahead symbol.  */
-YYSTYPE yylval;
-
-/* Number of syntax errors so far.  */
-int yynerrs;
-
-  register int yystate;
-  register int yyn;
-  int yyresult;
-  /* Number of tokens to shift before error messages enabled.  */
-  int yyerrstatus;
-  /* Lookahead token as an internal (translated) token number.  */
-  int yytoken = 0;
-
-  /* Three stacks and their tools:
-     `yyss': related to states,
-     `yyvs': related to semantic values,
-     `yyls': related to locations.
-
-     Refer to the stacks thru separate pointers, to allow yyoverflow
-     to reallocate them elsewhere.  */
-
-  /* The state stack.  */
-  short        yyssa[YYINITDEPTH];
-  short *yyss = yyssa;
-  register short *yyssp;
-
-  /* The semantic value stack.  */
-  YYSTYPE yyvsa[YYINITDEPTH];
-  YYSTYPE *yyvs = yyvsa;
-  register YYSTYPE *yyvsp;
-
-
-
-#define YYPOPSTACK   (yyvsp--, yyssp--)
-
-  YYSIZE_T yystacksize = YYINITDEPTH;
-
-  /* The variables used to return semantic value and location from the
-     action routines.  */
-  YYSTYPE yyval;
-
-
-  /* When reducing, the number of symbols on the RHS of the reduced
-     rule.  */
-  int yylen;
-
-  YYDPRINTF ((stderr, "Starting parse\n"));
-
-  yystate = 0;
-  yyerrstatus = 0;
-  yynerrs = 0;
-  yychar = YYEMPTY;            /* Cause a token to be read.  */
-
-  /* Initialize stack pointers.
-     Waste one element of value and location stack
-     so that they stay on the same level as the state stack.
-     The wasted elements are never initialized.  */
-
-  yyssp = yyss;
-  yyvsp = yyvs;
-
-  goto yysetstate;
-
-/*------------------------------------------------------------.
-| yynewstate -- Push a new state, which is found in yystate.  |
-`------------------------------------------------------------*/
- yynewstate:
-  /* In all cases, when you get here, the value and location stacks
-     have just been pushed. so pushing a state here evens the stacks.
-     */
-  yyssp++;
-
- yysetstate:
-  *yyssp = yystate;
-
-  if (yyss + yystacksize - 1 <= yyssp)
-    {
-      /* Get the current used size of the three stacks, in elements.  */
-      YYSIZE_T yysize = yyssp - yyss + 1;
-
-#ifdef yyoverflow
-      {
-       /* Give user a chance to reallocate the stack. Use copies of
-          these so that the &'s don't force the real ones into
-          memory.  */
-       YYSTYPE *yyvs1 = yyvs;
-       short *yyss1 = yyss;
-
-
-       /* Each stack pointer address is followed by the size of the
-          data in use in that stack, in bytes.  This used to be a
-          conditional around just the two extra args, but that might
-          be undefined if yyoverflow is a macro.  */
-       yyoverflow ("parser stack overflow",
-                   &yyss1, yysize * sizeof (*yyssp),
-                   &yyvs1, yysize * sizeof (*yyvsp),
-
-                   &yystacksize);
-
-       yyss = yyss1;
-       yyvs = yyvs1;
-      }
-#else /* no yyoverflow */
-# ifndef YYSTACK_RELOCATE
-      goto yyoverflowlab;
-# else
-      /* Extend the stack our own way.  */
-      if (YYMAXDEPTH <= yystacksize)
-       goto yyoverflowlab;
-      yystacksize *= 2;
-      if (YYMAXDEPTH < yystacksize)
-       yystacksize = YYMAXDEPTH;
-
-      {
-       short *yyss1 = yyss;
-       union yyalloc *yyptr =
-         (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize));
-       if (! yyptr)
-         goto yyoverflowlab;
-       YYSTACK_RELOCATE (yyss);
-       YYSTACK_RELOCATE (yyvs);
-
-#  undef YYSTACK_RELOCATE
-       if (yyss1 != yyssa)
-         YYSTACK_FREE (yyss1);
-      }
-# endif
-#endif /* no yyoverflow */
-
-      yyssp = yyss + yysize - 1;
-      yyvsp = yyvs + yysize - 1;
-
-
-      YYDPRINTF ((stderr, "Stack size increased to %lu\n",
-                 (unsigned long int) yystacksize));
-
-      if (yyss + yystacksize - 1 <= yyssp)
-       YYABORT;
-    }
-
-  YYDPRINTF ((stderr, "Entering state %d\n", yystate));
-
-  goto yybackup;
-
-/*-----------.
-| yybackup.  |
-`-----------*/
-yybackup:
-
-/* Do appropriate processing given the current state.  */
-/* Read a lookahead token if we need one and don't already have one.  */
-/* yyresume: */
-
-  /* First try to decide what to do without reference to lookahead token.  */
-
-  yyn = yypact[yystate];
-  if (yyn == YYPACT_NINF)
-    goto yydefault;
-
-  /* Not known => get a lookahead token if don't already have one.  */
-
-  /* YYCHAR is either YYEMPTY or YYEOF or a valid lookahead symbol.  */
-  if (yychar == YYEMPTY)
-    {
-      YYDPRINTF ((stderr, "Reading a token: "));
-      yychar = YYLEX;
-    }
-
-  if (yychar <= YYEOF)
-    {
-      yychar = yytoken = YYEOF;
-      YYDPRINTF ((stderr, "Now at end of input.\n"));
-    }
-  else
-    {
-      yytoken = YYTRANSLATE (yychar);
-      YYDSYMPRINTF ("Next token is", yytoken, &yylval, &yylloc);
-    }
-
-  /* If the proper action on seeing token YYTOKEN is to reduce or to
-     detect an error, take that action.  */
-  yyn += yytoken;
-  if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken)
-    goto yydefault;
-  yyn = yytable[yyn];
-  if (yyn <= 0)
-    {
-      if (yyn == 0 || yyn == YYTABLE_NINF)
-       goto yyerrlab;
-      yyn = -yyn;
-      goto yyreduce;
-    }
-
-  if (yyn == YYFINAL)
-    YYACCEPT;
-
-  /* Shift the lookahead token.  */
-  YYDPRINTF ((stderr, "Shifting token %s, ", yytname[yytoken]));
-
-  /* Discard the token being shifted unless it is eof.  */
-  if (yychar != YYEOF)
-    yychar = YYEMPTY;
-
-  *++yyvsp = yylval;
-
-
-  /* Count tokens shifted since error; after three, turn off error
-     status.  */
-  if (yyerrstatus)
-    yyerrstatus--;
-
-  yystate = yyn;
-  goto yynewstate;
-
-
-/*-----------------------------------------------------------.
-| yydefault -- do the default action for the current state.  |
-`-----------------------------------------------------------*/
-yydefault:
-  yyn = yydefact[yystate];
-  if (yyn == 0)
-    goto yyerrlab;
-  goto yyreduce;
-
-
-/*-----------------------------.
-| yyreduce -- Do a reduction.  |
-`-----------------------------*/
-yyreduce:
-  /* yyn is the number of a rule to reduce with.  */
-  yylen = yyr2[yyn];
-
-  /* If YYLEN is nonzero, implement the default value of the action:
-     `$$ = $1'.
-
-     Otherwise, the following line sets YYVAL to garbage.
-     This behavior is undocumented and Bison
-     users should not rely upon it.  Assigning to YYVAL
-     unconditionally makes the parser a bit smaller, and it avoids a
-     GCC warning that YYVAL may be used uninitialized.  */
-  yyval = yyvsp[1-yylen];
-
-
-  YY_REDUCE_PRINT (yyn);
-  switch (yyn)
-    {
-        case 2:
-#line 137 "./cond.y"
-    {
-            COND_input* cond = (COND_input*) info;
-            cond->result = yyvsp[0].value;
-        ;}
-    break;
-
-  case 3:
-#line 145 "./cond.y"
-    {
-            yyval.value = yyvsp[0].value;
-        ;}
-    break;
-
-  case 4:
-#line 149 "./cond.y"
-    {
-            yyval.value = yyvsp[-2].value || yyvsp[0].value;
-        ;}
-    break;
-
-  case 5:
-#line 156 "./cond.y"
-    {
-            yyval.value = yyvsp[0].value;
-        ;}
-    break;
-
-  case 6:
-#line 160 "./cond.y"
-    {
-            yyval.value = yyvsp[-2].value && yyvsp[0].value;
-        ;}
-    break;
-
-  case 7:
-#line 167 "./cond.y"
-    {
-            yyval.value = yyvsp[0].value;
-        ;}
-    break;
-
-  case 8:
-#line 171 "./cond.y"
-    {
-            yyval.value = ! yyvsp[0].value;
-        ;}
-    break;
-
-  case 9:
-#line 179 "./cond.y"
-    {
-            yyval.value = yyvsp[0].value;
-        ;}
-    break;
-
-  case 10:
-#line 183 "./cond.y"
-    {
-            yyval.value = yyvsp[0].string[0] ? MSICONDITION_TRUE : MSICONDITION_FALSE;
-        ;}
-    break;
-
-  case 11:
-#line 187 "./cond.y"
-    {
-            yyval.value = yyvsp[-1].fn_comp_int( yyvsp[-2].value, yyvsp[0].value );
-        ;}
-    break;
-
-  case 12:
-#line 191 "./cond.y"
-    {
-            yyval.value = yyvsp[-1].fn_comp_str( yyvsp[-2].string, yyvsp[0].string, FALSE );
-        ;}
-    break;
-
-  case 13:
-#line 195 "./cond.y"
-    {
-            yyval.value = yyvsp[-1].fn_comp_str( yyvsp[-3].string, yyvsp[0].string, TRUE );
-        ;}
-    break;
-
-  case 14:
-#line 199 "./cond.y"
-    {
-            yyval.value = yyvsp[-1].fn_comp_m1( yyvsp[-2].string, yyvsp[0].value );
-        ;}
-    break;
-
-  case 15:
-#line 203 "./cond.y"
-    {
-            yyval.value = yyvsp[-1].fn_comp_m2( yyvsp[-2].value, yyvsp[0].string );
-        ;}
-    break;
-
-  case 16:
-#line 207 "./cond.y"
-    {
-            yyval.value = yyvsp[-1].value;
-        ;}
-    break;
-
-  case 17:
-#line 215 "./cond.y"
-    {
-            yyval.fn_comp_int = comp_eq_i;
-        ;}
-    break;
-
-  case 18:
-#line 219 "./cond.y"
-    {
-            yyval.fn_comp_int = comp_ne_i;
-        ;}
-    break;
-
-  case 19:
-#line 223 "./cond.y"
-    {
-            yyval.fn_comp_int = comp_lt_i;
-        ;}
-    break;
-
-  case 20:
-#line 227 "./cond.y"
-    {
-            yyval.fn_comp_int = comp_gt_i;
-        ;}
-    break;
-
-  case 21:
-#line 231 "./cond.y"
-    {
-            yyval.fn_comp_int = comp_le_i;
-        ;}
-    break;
-
-  case 22:
-#line 235 "./cond.y"
-    {
-            yyval.fn_comp_int = comp_ge_i;
-        ;}
-    break;
-
-  case 23:
-#line 240 "./cond.y"
-    {
-            yyval.fn_comp_int = comp_bitand;
-        ;}
-    break;
-
-  case 24:
-#line 244 "./cond.y"
-    {
-            yyval.fn_comp_int = comp_highcomp;
-        ;}
-    break;
-
-  case 25:
-#line 248 "./cond.y"
-    {
-            yyval.fn_comp_int = comp_lowcomp;
-        ;}
-    break;
-
-  case 26:
-#line 256 "./cond.y"
-    {
-            yyval.fn_comp_str = comp_eq_s;
-        ;}
-    break;
-
-  case 27:
-#line 260 "./cond.y"
-    {
-            yyval.fn_comp_str = comp_ne_s;
-        ;}
-    break;
-
-  case 28:
-#line 264 "./cond.y"
-    {
-            yyval.fn_comp_str = comp_lt_s;
-        ;}
-    break;
-
-  case 29:
-#line 268 "./cond.y"
-    {
-            yyval.fn_comp_str = comp_gt_s;
-        ;}
-    break;
-
-  case 30:
-#line 272 "./cond.y"
-    {
-            yyval.fn_comp_str = comp_le_s;
-        ;}
-    break;
-
-  case 31:
-#line 276 "./cond.y"
-    {
-            yyval.fn_comp_str = comp_ge_s;
-        ;}
-    break;
-
-  case 32:
-#line 281 "./cond.y"
-    {
-            yyval.fn_comp_str = comp_substring;
-        ;}
-    break;
-
-  case 33:
-#line 285 "./cond.y"
-    {
-            yyval.fn_comp_str = comp_start;
-        ;}
-    break;
-
-  case 34:
-#line 289 "./cond.y"
-    {
-            yyval.fn_comp_str = comp_end;
-        ;}
-    break;
-
-  case 35:
-#line 297 "./cond.y"
-    {
-            yyval.fn_comp_m1 = comp_eq_m1;
-        ;}
-    break;
-
-  case 36:
-#line 301 "./cond.y"
-    {
-            yyval.fn_comp_m1 = comp_ne_m1;
-        ;}
-    break;
-
-  case 37:
-#line 305 "./cond.y"
-    {
-            yyval.fn_comp_m1 = comp_lt_m1;
-        ;}
-    break;
-
-  case 38:
-#line 309 "./cond.y"
-    {
-            yyval.fn_comp_m1 = comp_gt_m1;
-        ;}
-    break;
-
-  case 39:
-#line 313 "./cond.y"
-    {
-            yyval.fn_comp_m1 = comp_le_m1;
-        ;}
-    break;
-
-  case 40:
-#line 317 "./cond.y"
-    {
-            yyval.fn_comp_m1 = comp_ge_m1;
-        ;}
-    break;
-
-  case 41:
-#line 322 "./cond.y"
-    {
-            yyval.fn_comp_m1 = 0;
-        ;}
-    break;
-
-  case 42:
-#line 326 "./cond.y"
-    {
-            yyval.fn_comp_m1 = 0;
-        ;}
-    break;
-
-  case 43:
-#line 330 "./cond.y"
-    {
-            yyval.fn_comp_m1 = 0;
-        ;}
-    break;
-
-  case 44:
-#line 338 "./cond.y"
-    {
-            yyval.fn_comp_m2 = comp_eq_m2;
-        ;}
-    break;
-
-  case 45:
-#line 342 "./cond.y"
-    {
-            yyval.fn_comp_m2 = comp_ne_m2;
-        ;}
-    break;
-
-  case 46:
-#line 346 "./cond.y"
-    {
-            yyval.fn_comp_m2 = comp_lt_m2;
-        ;}
-    break;
-
-  case 47:
-#line 350 "./cond.y"
-    {
-            yyval.fn_comp_m2 = comp_gt_m2;
-        ;}
-    break;
-
-  case 48:
-#line 354 "./cond.y"
-    {
-            yyval.fn_comp_m2 = comp_le_m2;
-        ;}
-    break;
-
-  case 49:
-#line 358 "./cond.y"
-    {
-            yyval.fn_comp_m2 = comp_ge_m2;
-        ;}
-    break;
-
-  case 50:
-#line 363 "./cond.y"
-    {
-            yyval.fn_comp_m2 = 0;
-        ;}
-    break;
-
-  case 51:
-#line 367 "./cond.y"
-    {
-            yyval.fn_comp_m2 = 0;
-        ;}
-    break;
-
-  case 52:
-#line 371 "./cond.y"
-    {
-            yyval.fn_comp_m2 = 0;
-        ;}
-    break;
-
-  case 53:
-#line 378 "./cond.y"
-    {
-            yyval.value = yyvsp[0].value;
-        ;}
-    break;
-
-  case 54:
-#line 382 "./cond.y"
-    {
-            yyval.value = yyvsp[0].value;
-        ;}
-    break;
-
-  case 55:
-#line 389 "./cond.y"
-    {
-        yyval.string = yyvsp[0].string;
-    ;}
-    break;
-
-  case 56:
-#line 393 "./cond.y"
-    {
-        yyval.string = yyvsp[0].string;
-    ;}
-    break;
-
-  case 57:
-#line 400 "./cond.y"
-    {
-            yyval.string = COND_GetLiteral(&yyvsp[0].str);
-            if( !yyval.string )
-                YYABORT;
-        ;}
-    break;
-
-  case 58:
-#line 409 "./cond.y"
-    {
-            COND_input* cond = (COND_input*) info;
-            INSTALLSTATE install = INSTALLSTATE_UNKNOWN, action = INSTALLSTATE_UNKNOWN;
-      
-            MSI_GetComponentStateW(cond->package, yyvsp[0].string, &install, &action );
-            yyval.value = action;
-            HeapFree( GetProcessHeap(), 0, yyvsp[0].string );
-        ;}
-    break;
-
-  case 59:
-#line 418 "./cond.y"
-    {
-            COND_input* cond = (COND_input*) info;
-            INSTALLSTATE install = INSTALLSTATE_UNKNOWN, action = INSTALLSTATE_UNKNOWN;
-      
-            MSI_GetComponentStateW(cond->package, yyvsp[0].string, &install, &action );
-            yyval.value = install;
-            HeapFree( GetProcessHeap(), 0, yyvsp[0].string );
-        ;}
-    break;
-
-  case 60:
-#line 427 "./cond.y"
-    {
-            COND_input* cond = (COND_input*) info;
-            INSTALLSTATE install = INSTALLSTATE_UNKNOWN, action = INSTALLSTATE_UNKNOWN;
-      
-            MSI_GetFeatureStateW(cond->package, yyvsp[0].string, &install, &action );
-            yyval.value = action;
-            HeapFree( GetProcessHeap(), 0, yyvsp[0].string );
-        ;}
-    break;
-
-  case 61:
-#line 436 "./cond.y"
-    {
-            COND_input* cond = (COND_input*) info;
-            INSTALLSTATE install = INSTALLSTATE_UNKNOWN, action = INSTALLSTATE_UNKNOWN;
-      
-            MSI_GetFeatureStateW(cond->package, yyvsp[0].string, &install, &action );
-            yyval.value = install;
-            HeapFree( GetProcessHeap(), 0, yyvsp[0].string );
-        ;}
-    break;
-
-  case 62:
-#line 448 "./cond.y"
-    {
-            DWORD sz;
-            COND_input* cond = (COND_input*) info;
-
-            sz = 0;
-            MSI_GetPropertyW(cond->package, yyvsp[0].string, NULL, &sz);
-            if (sz == 0)
-            {
-                yyval.string = HeapAlloc( GetProcessHeap(), 0 ,sizeof(WCHAR));
-                yyval.string[0] = 0;
-            }
-            else
-            {
-                sz ++;
-                yyval.string = HeapAlloc( GetProcessHeap(), 0, sz*sizeof (WCHAR) );
-
-                /* Lookup the identifier */
-
-                MSI_GetPropertyW(cond->package,yyvsp[0].string,yyval.string,&sz);
-            }
-            HeapFree( GetProcessHeap(), 0, yyvsp[0].string );
-        ;}
-    break;
-
-  case 63:
-#line 471 "./cond.y"
-    {
-            UINT len = GetEnvironmentVariableW( yyvsp[0].string, NULL, 0 );
-            if( len++ )
-            {
-                yyval.string = HeapAlloc( GetProcessHeap(), 0, len*sizeof (WCHAR) );
-                if( yyval.string )
-                    GetEnvironmentVariableW( yyvsp[0].string, yyval.string, len );
-            }
-            HeapFree( GetProcessHeap(), 0, yyvsp[0].string );
-        ;}
-    break;
-
-  case 64:
-#line 485 "./cond.y"
-    {
-            yyval.string = COND_GetString(&yyvsp[0].str);
-            if( !yyval.string )
-                YYABORT;
-        ;}
-    break;
-
-  case 65:
-#line 494 "./cond.y"
-    {
-            LPWSTR szNum = COND_GetString(&yyvsp[0].str);
-            if( !szNum )
-                YYABORT;
-            yyval.value = atoiW( szNum );
-            HeapFree( GetProcessHeap(), 0, szNum );
-        ;}
-    break;
-
-
-    }
-
-/* Line 1000 of yacc.c.  */
-#line 1726 "cond.tab.c"
-\f
-  yyvsp -= yylen;
-  yyssp -= yylen;
-
-
-  YY_STACK_PRINT (yyss, yyssp);
-
-  *++yyvsp = yyval;
-
-
-  /* Now `shift' the result of the reduction.  Determine what state
-     that goes to, based on the state we popped back to and the rule
-     number reduced by.  */
-
-  yyn = yyr1[yyn];
-
-  yystate = yypgoto[yyn - YYNTOKENS] + *yyssp;
-  if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp)
-    yystate = yytable[yystate];
-  else
-    yystate = yydefgoto[yyn - YYNTOKENS];
-
-  goto yynewstate;
-
-
-/*------------------------------------.
-| yyerrlab -- here on detecting error |
-`------------------------------------*/
-yyerrlab:
-  /* If not already recovering from an error, report this error.  */
-  if (!yyerrstatus)
-    {
-      ++yynerrs;
-#if YYERROR_VERBOSE
-      yyn = yypact[yystate];
-
-      if (YYPACT_NINF < yyn && yyn < YYLAST)
-       {
-         YYSIZE_T yysize = 0;
-         int yytype = YYTRANSLATE (yychar);
-         const char* yyprefix;
-         char *yymsg;
-         int yyx;
-
-         /* Start YYX at -YYN if negative to avoid negative indexes in
-            YYCHECK.  */
-         int yyxbegin = yyn < 0 ? -yyn : 0;
-
-         /* Stay within bounds of both yycheck and yytname.  */
-         int yychecklim = YYLAST - yyn;
-         int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS;
-         int yycount = 0;
-
-         yyprefix = ", expecting ";
-         for (yyx = yyxbegin; yyx < yyxend; ++yyx)
-           if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR)
-             {
-               yysize += yystrlen (yyprefix) + yystrlen (yytname [yyx]);
-               yycount += 1;
-               if (yycount == 5)
-                 {
-                   yysize = 0;
-                   break;
-                 }
-             }
-         yysize += (sizeof ("syntax error, unexpected ")
-                    + yystrlen (yytname[yytype]));
-         yymsg = (char *) YYSTACK_ALLOC (yysize);
-         if (yymsg != 0)
-           {
-             char *yyp = yystpcpy (yymsg, "syntax error, unexpected ");
-             yyp = yystpcpy (yyp, yytname[yytype]);
-
-             if (yycount < 5)
-               {
-                 yyprefix = ", expecting ";
-                 for (yyx = yyxbegin; yyx < yyxend; ++yyx)
-                   if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR)
-                     {
-                       yyp = yystpcpy (yyp, yyprefix);
-                       yyp = yystpcpy (yyp, yytname[yyx]);
-                       yyprefix = " or ";
-                     }
-               }
-             yyerror (yymsg);
-             YYSTACK_FREE (yymsg);
-           }
-         else
-           yyerror ("syntax error; also virtual memory exhausted");
-       }
-      else
-#endif /* YYERROR_VERBOSE */
-       yyerror ("syntax error");
-    }
-
-
-
-  if (yyerrstatus == 3)
-    {
-      /* If just tried and failed to reuse lookahead token after an
-        error, discard it.  */
-
-      if (yychar <= YYEOF)
-        {
-          /* If at end of input, pop the error token,
-            then the rest of the stack, then return failure.  */
-         if (yychar == YYEOF)
-            for (;;)
-              {
-                YYPOPSTACK;
-                if (yyssp == yyss)
-                  YYABORT;
-                YYDSYMPRINTF ("Error: popping", yystos[*yyssp], yyvsp, yylsp);
-                yydestruct (yystos[*yyssp], yyvsp);
-              }
-        }
-      else
-       {
-         YYDSYMPRINTF ("Error: discarding", yytoken, &yylval, &yylloc);
-         yydestruct (yytoken, &yylval);
-         yychar = YYEMPTY;
-
-       }
-    }
-
-  /* Else will try to reuse lookahead token after shifting the error
-     token.  */
-  goto yyerrlab1;
-
-
-/*---------------------------------------------------.
-| yyerrorlab -- error raised explicitly by YYERROR.  |
-`---------------------------------------------------*/
-yyerrorlab:
-
-#ifdef __GNUC__
-  /* Pacify GCC when the user code never invokes YYERROR and the label
-     yyerrorlab therefore never appears in user code.  */
-  if (0)
-     goto yyerrorlab;
-#endif
-
-  yyvsp -= yylen;
-  yyssp -= yylen;
-  yystate = *yyssp;
-  goto yyerrlab1;
-
-
-/*-------------------------------------------------------------.
-| yyerrlab1 -- common code for both syntax error and YYERROR.  |
-`-------------------------------------------------------------*/
-yyerrlab1:
-  yyerrstatus = 3;     /* Each real token shifted decrements this.  */
-
-  for (;;)
-    {
-      yyn = yypact[yystate];
-      if (yyn != YYPACT_NINF)
-       {
-         yyn += YYTERROR;
-         if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR)
-           {
-             yyn = yytable[yyn];
-             if (0 < yyn)
-               break;
-           }
-       }
-
-      /* Pop the current state because it cannot handle the error token.  */
-      if (yyssp == yyss)
-       YYABORT;
-
-      YYDSYMPRINTF ("Error: popping", yystos[*yyssp], yyvsp, yylsp);
-      yydestruct (yystos[yystate], yyvsp);
-      YYPOPSTACK;
-      yystate = *yyssp;
-      YY_STACK_PRINT (yyss, yyssp);
-    }
-
-  if (yyn == YYFINAL)
-    YYACCEPT;
-
-  YYDPRINTF ((stderr, "Shifting error token, "));
-
-  *++yyvsp = yylval;
-
-
-  yystate = yyn;
-  goto yynewstate;
-
-
-/*-------------------------------------.
-| yyacceptlab -- YYACCEPT comes here.  |
-`-------------------------------------*/
-yyacceptlab:
-  yyresult = 0;
-  goto yyreturn;
-
-/*-----------------------------------.
-| yyabortlab -- YYABORT comes here.  |
-`-----------------------------------*/
-yyabortlab:
-  yyresult = 1;
-  goto yyreturn;
-
-#ifndef yyoverflow
-/*----------------------------------------------.
-| yyoverflowlab -- parser overflow comes here.  |
-`----------------------------------------------*/
-yyoverflowlab:
-  yyerror ("parser stack overflow");
-  yyresult = 2;
-  /* Fall through.  */
-#endif
-
-yyreturn:
-#ifndef yyoverflow
-  if (yyss != yyssa)
-    YYSTACK_FREE (yyss);
-#endif
-  return yyresult;
-}
-
-
-#line 503 "./cond.y"
-
-
-
-static int COND_IsAlpha( WCHAR x )
-{
-    return( ( ( x >= 'A' ) && ( x <= 'Z' ) ) ||
-            ( ( x >= 'a' ) && ( x <= 'z' ) ) ||
-            ( ( x == '_' ) ) );
-}
-
-static int COND_IsNumber( WCHAR x )
-{
-    return( (( x >= '0' ) && ( x <= '9' ))  || (x =='-') || (x =='.') );
-}
-
-
-/* the mess of comparison functions */
-
-static INT comp_lt_i(INT a, INT b)
-{ return (a < b); }
-static INT comp_gt_i(INT a, INT b)
-{ return (a > b); }
-static INT comp_le_i(INT a, INT b)
-{ return (a <= b); }
-static INT comp_ge_i(INT a, INT b)
-{ return (a >= b); }
-static INT comp_eq_i(INT a, INT b)
-{ return (a == b); }
-static INT comp_ne_i(INT a, INT b)
-{ return (a != b); }
-static INT comp_bitand(INT a, INT b)
-{ return a & b;}
-static INT comp_highcomp(INT a, INT b)
-{ return HIWORD(a)==b; }
-static INT comp_lowcomp(INT a, INT b)
-{ return LOWORD(a)==b; }
-
-static INT comp_eq_s(LPWSTR a, LPWSTR b, BOOL casless)
-{ if (casless) return !strcmpiW(a,b); else return !strcmpW(a,b);}
-static INT comp_ne_s(LPWSTR a, LPWSTR b, BOOL casless)
-{ if (casless) return strcmpiW(a,b); else  return strcmpW(a,b);}
-static INT comp_lt_s(LPWSTR a, LPWSTR b, BOOL casless)
-{ if (casless) return strcmpiW(a,b)<0; else return strcmpW(a,b)<0;}
-static INT comp_gt_s(LPWSTR a, LPWSTR b, BOOL casless)
-{ if (casless) return strcmpiW(a,b)>0; else return strcmpW(a,b)>0;}
-static INT comp_le_s(LPWSTR a, LPWSTR b, BOOL casless)
-{ if (casless) return strcmpiW(a,b)<=0; else return strcmpW(a,b)<=0;}
-static INT comp_ge_s(LPWSTR a, LPWSTR b, BOOL casless)
-{ if (casless) return strcmpiW(a,b)>=0; else return  strcmpW(a,b)>=0;}
-static INT comp_substring(LPWSTR a, LPWSTR b, BOOL casless)
-/* ERROR NOT WORKING REWRITE */
-{ if (casless) return strstrW(a,b)!=NULL; else return strstrW(a,b)!=NULL;}
-static INT comp_start(LPWSTR a, LPWSTR b, BOOL casless)
-{ if (casless) return strncmpiW(a,b,strlenW(b))==0; 
-  else return strncmpW(a,b,strlenW(b))==0;}
-static INT comp_end(LPWSTR a, LPWSTR b, BOOL casless)
-{ 
-    int i = strlenW(a); 
-    int j = strlenW(b); 
-    if (j>i)
-        return 0;
-    if (casless) return (!strcmpiW(&a[i-j-1],b));
-    else  return (!strcmpW(&a[i-j-1],b));
-}
-
-
-static INT comp_eq_m1(LPWSTR a, INT b)
-{ if (COND_IsNumber(a[0])) return atoiW(a)==b; else return 0;}
-static INT comp_ne_m1(LPWSTR a, INT b)
-{ if (COND_IsNumber(a[0])) return atoiW(a)!=b; else return 1;}
-static INT comp_lt_m1(LPWSTR a, INT b)
-{ if (COND_IsNumber(a[0])) return atoiW(a)<b; else return 0;}
-static INT comp_gt_m1(LPWSTR a, INT b)
-{ if (COND_IsNumber(a[0])) return atoiW(a)>b; else return 0;}
-static INT comp_le_m1(LPWSTR a, INT b)
-{ if (COND_IsNumber(a[0])) return atoiW(a)<=b; else return 0;}
-static INT comp_ge_m1(LPWSTR a, INT b)
-{ if (COND_IsNumber(a[0])) return atoiW(a)>=b; else return 0;}
-
-static INT comp_eq_m2(INT a, LPWSTR b)
-{ if (COND_IsNumber(b[0])) return a == atoiW(b); else return 0;}
-static INT comp_ne_m2(INT a, LPWSTR b)
-{ if (COND_IsNumber(b[0])) return a != atoiW(b); else return 1;}
-static INT comp_lt_m2(INT a, LPWSTR b)
-{ if (COND_IsNumber(b[0])) return a < atoiW(b); else return 0;}
-static INT comp_gt_m2(INT a, LPWSTR b)
-{ if (COND_IsNumber(b[0])) return a > atoiW(b); else return 0;}
-static INT comp_le_m2(INT a, LPWSTR b)
-{ if (COND_IsNumber(b[0])) return a <= atoiW(b); else return 0;}
-static INT comp_ge_m2(INT a, LPWSTR b)
-{ if (COND_IsNumber(b[0])) return a >= atoiW(b); else return 0;}
-
-
-
-static int COND_IsIdent( WCHAR x )
-{
-    return( COND_IsAlpha( x ) || COND_IsNumber( x ) || ( x == '_' ) 
-            || ( x == '#' ) || (x == '.') );
-}
-
-static int COND_GetOne( struct cond_str *str, COND_input *cond )
-{
-    static const WCHAR szNot[] = {'N','O','T',0};
-    static const WCHAR szAnd[] = {'A','N','D',0};
-    static const WCHAR szOr[] = {'O','R',0};
-    WCHAR ch;
-    int rc, len = 1;
-
-    str->data = &cond->str[cond->n];
-
-    ch = str->data[0];
-    switch( ch )
-    {
-    case 0: return 0;
-    case '(': rc = COND_LPAR; break;
-    case ')': rc = COND_RPAR; break;
-    case '&': rc = COND_AMPER; break;
-    case '!': rc = COND_EXCLAM; break;
-    case '$': rc = COND_DOLLARS; break;
-    case '?': rc = COND_QUESTION; break;
-    case '%': rc = COND_PERCENT; break;
-    case ' ': rc = COND_SPACE; break;
-    case '=': rc = COND_EQ; break;
-    case '~': rc = COND_TILDA; break;
-    case '<': rc = COND_LT; break;
-    case '>': rc = COND_GT; break;
-    case '"':
-       {
-           const WCHAR *ch2 = str->data + 1;
-
-
-           while ( *ch2 && *ch2 != '"' )
-               ++ch2;
-           if (*ch2 == '"')
-           {
-               len = ch2 - str->data + 1;
-               rc = COND_LITER;
-               break;
-           }
-       }
-       ERR("Unterminated string\n");
-       rc = COND_ERROR;
-       break;
-    default: 
-        if( COND_IsAlpha( ch ) )
-        {
-            while( COND_IsIdent( str->data[len] ) )
-                len++;
-            rc = COND_IDENT;
-            break;
-        }
-
-        if( COND_IsNumber( ch ) )
-        {
-            while( COND_IsNumber( str->data[len] ) )
-                len++;
-            rc = COND_NUMBER;
-            break;
-        }
-
-        ERR("Got unknown character %c(%x)\n",ch,ch);
-        rc = COND_ERROR;
-        break;
-    }
-
-    /* keyword identifiers */
-    if( rc == COND_IDENT )
-    {
-        if( (len==3) && (strncmpiW(str->data,szNot,len)==0) )
-            rc = COND_NOT;
-        else if( (len==3) && (strncmpiW(str->data,szAnd,len)==0) )
-            rc = COND_AND;
-        else if( (len==2) && (strncmpiW(str->data,szOr,len)==0) )
-            rc = COND_OR;
-    }
-
-    cond->n += len;
-    str->len = len;
-
-    return rc;
-}
-
-static int COND_lex( void *COND_lval, COND_input *cond )
-{
-    int rc;
-    struct cond_str *str = COND_lval;
-
-    do {
-        rc = COND_GetOne( str, cond );
-    } while (rc == COND_SPACE);
-    
-    return rc;
-}
-
-static LPWSTR COND_GetString( struct cond_str *str )
-{
-    LPWSTR ret;
-
-    ret = HeapAlloc( GetProcessHeap(), 0, (str->len+1) * sizeof (WCHAR) );
-    if( ret )
-    {
-        memcpy( ret, str->data, str->len * sizeof(WCHAR));
-        ret[str->len]=0;
-    }
-    TRACE("Got identifier %s\n",debugstr_w(ret));
-    return ret;
-}
-
-static LPWSTR COND_GetLiteral( struct cond_str *str )
-{
-    LPWSTR ret;
-
-    ret = HeapAlloc( GetProcessHeap(), 0, (str->len-1) * sizeof (WCHAR) );
-    if( ret )
-    {
-        memcpy( ret, str->data+1, (str->len-2) * sizeof(WCHAR) );
-        ret[str->len - 2]=0;
-    }
-    TRACE("Got literal %s\n",debugstr_w(ret));
-    return ret;
-}
-
-static int COND_error(char *str)
-{
-    return 0;
-}
-
-MSICONDITION MSI_EvaluateConditionW( MSIPACKAGE *package, LPCWSTR szCondition )
-{
-    COND_input cond;
-    MSICONDITION r;
-
-    cond.package = package;
-    cond.str   = szCondition;
-    cond.n     = 0;
-    cond.result = -1;
-    
-    TRACE("Evaluating %s\n",debugstr_w(szCondition));    
-
-    if( szCondition && !COND_parse( &cond ) )
-        r = cond.result;
-    else
-        r = MSICONDITION_ERROR;
-
-    TRACE("Evaluates to %i\n",r);
-    return r;
-}
-
-MSICONDITION WINAPI MsiEvaluateConditionW( MSIHANDLE hInstall, LPCWSTR szCondition )
-{
-    MSIPACKAGE *package;
-    UINT ret;
-
-    package = msihandle2msiinfo( hInstall, MSIHANDLETYPE_PACKAGE);
-    if( !package)
-        return ERROR_INVALID_HANDLE;
-    ret = MSI_EvaluateConditionW( package, szCondition );
-    msiobj_release( &package->hdr );
-    return ret;
-}
-
-MSICONDITION WINAPI MsiEvaluateConditionA( MSIHANDLE hInstall, LPCSTR szCondition )
-{
-    LPWSTR szwCond = NULL;
-    MSICONDITION r;
-
-    if( szCondition )
-    {
-        UINT len = MultiByteToWideChar( CP_ACP, 0, szCondition, -1, NULL, 0 );
-        szwCond = HeapAlloc( GetProcessHeap(), 0, len * sizeof (WCHAR) );
-        MultiByteToWideChar( CP_ACP, 0, szCondition, -1, szwCond, len );
-    }
-
-    r = MsiEvaluateConditionW( hInstall, szwCond );
-
-    HeapFree( GetProcessHeap(), 0, szwCond );
-
-    return r;
-}
-
+/* A Bison parser, made from ./cond.y\r
+   by GNU bison 1.35.  */\r
+\r
+#define YYBISON 1  /* Identify Bison output.  */\r
+\r
+#define yyparse COND_parse\r
+#define yylex COND_lex\r
+#define yyerror COND_error\r
+#define yylval COND_lval\r
+#define yychar COND_char\r
+#define yydebug COND_debug\r
+#define yynerrs COND_nerrs\r
+# define       COND_SPACE      257\r
+# define       COND_EOF        258\r
+# define       COND_OR 259\r
+# define       COND_AND        260\r
+# define       COND_NOT        261\r
+# define       COND_LT 262\r
+# define       COND_GT 263\r
+# define       COND_EQ 264\r
+# define       COND_LPAR       265\r
+# define       COND_RPAR       266\r
+# define       COND_TILDA      267\r
+# define       COND_PERCENT    268\r
+# define       COND_DOLLARS    269\r
+# define       COND_QUESTION   270\r
+# define       COND_AMPER      271\r
+# define       COND_EXCLAM     272\r
+# define       COND_IDENT      273\r
+# define       COND_NUMBER     274\r
+# define       COND_LITER      275\r
+# define       COND_ERROR      276\r
+\r
+#line 1 "./cond.y"\r
+\r
+\r
+/*\r
+ * Implementation of the Microsoft Installer (msi.dll)\r
+ *\r
+ * Copyright 2003 Mike McCormack for CodeWeavers\r
+ *\r
+ * This library is free software; you can redistribute it and/or\r
+ * modify it under the terms of the GNU Lesser General Public\r
+ * License as published by the Free Software Foundation; either\r
+ * version 2.1 of the License, or (at your option) any later version.\r
+ *\r
+ * This library is distributed in the hope that it will be useful,\r
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU\r
+ * Lesser General Public License for more details.\r
+ *\r
+ * You should have received a copy of the GNU Lesser General Public\r
+ * License along with this library; if not, write to the Free Software\r
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA\r
+ */\r
+\r
+#include "config.h"\r
+\r
+#include <stdarg.h>\r
+#include <stdio.h>\r
+#include <stdlib.h>\r
+\r
+#include "windef.h"\r
+#include "winbase.h"\r
+#include "wine/debug.h"\r
+#include "wine/unicode.h"\r
+\r
+#include "msi.h"\r
+#include "msiquery.h"\r
+#include "msipriv.h"\r
+\r
+#define YYLEX_PARAM info\r
+#define YYPARSE_PARAM info\r
+\r
+static int COND_error(char *str);\r
+\r
+WINE_DEFAULT_DEBUG_CHANNEL(msi);\r
+\r
+typedef struct tag_yyinput\r
+{\r
+    MSIPACKAGE *package;\r
+    LPCWSTR str;\r
+    INT    n;\r
+    MSICONDITION result;\r
+} COND_input;\r
+\r
+struct cond_str {\r
+    LPCWSTR data;\r
+    INT len;\r
+};\r
+\r
+static LPWSTR COND_GetString( struct cond_str *str );\r
+static LPWSTR COND_GetLiteral( struct cond_str *str );\r
+static int COND_lex( void *COND_lval, COND_input *info);\r
+\r
+typedef INT (*comp_int)(INT a, INT b);\r
+typedef INT (*comp_str)(LPWSTR a, LPWSTR b, BOOL caseless);\r
+typedef INT (*comp_m1)(LPWSTR a,int b);\r
+typedef INT (*comp_m2)(int a,LPWSTR b);\r
+\r
+static INT comp_lt_i(INT a, INT b);\r
+static INT comp_gt_i(INT a, INT b);\r
+static INT comp_le_i(INT a, INT b);\r
+static INT comp_ge_i(INT a, INT b);\r
+static INT comp_eq_i(INT a, INT b);\r
+static INT comp_ne_i(INT a, INT b);\r
+static INT comp_bitand(INT a, INT b);\r
+static INT comp_highcomp(INT a, INT b);\r
+static INT comp_lowcomp(INT a, INT b);\r
+\r
+static INT comp_eq_s(LPWSTR a, LPWSTR b, BOOL casless);\r
+static INT comp_ne_s(LPWSTR a, LPWSTR b, BOOL casless);\r
+static INT comp_lt_s(LPWSTR a, LPWSTR b, BOOL casless);\r
+static INT comp_gt_s(LPWSTR a, LPWSTR b, BOOL casless);\r
+static INT comp_le_s(LPWSTR a, LPWSTR b, BOOL casless);\r
+static INT comp_ge_s(LPWSTR a, LPWSTR b, BOOL casless);\r
+static INT comp_substring(LPWSTR a, LPWSTR b, BOOL casless);\r
+static INT comp_start(LPWSTR a, LPWSTR b, BOOL casless);\r
+static INT comp_end(LPWSTR a, LPWSTR b, BOOL casless);\r
+\r
+static INT comp_eq_m1(LPWSTR a, INT b);\r
+static INT comp_ne_m1(LPWSTR a, INT b);\r
+static INT comp_lt_m1(LPWSTR a, INT b);\r
+static INT comp_gt_m1(LPWSTR a, INT b);\r
+static INT comp_le_m1(LPWSTR a, INT b);\r
+static INT comp_ge_m1(LPWSTR a, INT b);\r
+\r
+static INT comp_eq_m2(INT a, LPWSTR b);\r
+static INT comp_ne_m2(INT a, LPWSTR b);\r
+static INT comp_lt_m2(INT a, LPWSTR b);\r
+static INT comp_gt_m2(INT a, LPWSTR b);\r
+static INT comp_le_m2(INT a, LPWSTR b);\r
+static INT comp_ge_m2(INT a, LPWSTR b);\r
+\r
+\r
+#line 105 "./cond.y"\r
+#ifndef YYSTYPE\r
+typedef union\r
+{\r
+    struct cond_str str;\r
+    LPWSTR    string;\r
+    INT       value;\r
+    comp_int  fn_comp_int;\r
+    comp_str  fn_comp_str;\r
+    comp_m1   fn_comp_m1;\r
+    comp_m2   fn_comp_m2;\r
+} yystype;\r
+# define YYSTYPE yystype\r
+# define YYSTYPE_IS_TRIVIAL 1\r
+#endif\r
+#ifndef YYDEBUG\r
+# define YYDEBUG 0\r
+#endif\r
+\r
+\r
+\r
+#define        YYFINAL         74\r
+#define        YYFLAG          -32768\r
+#define        YYNTBASE        23\r
+\r
+/* YYTRANSLATE(YYLEX) -- Bison token number corresponding to YYLEX. */\r
+#define YYTRANSLATE(x) ((unsigned)(x) <= 276 ? yytranslate[x] : 39)\r
+\r
+/* YYTRANSLATE[YYLEX] -- Bison token number corresponding to YYLEX. */\r
+static const char yytranslate[] =\r
+{\r
+       0,     2,     2,     2,     2,     2,     2,     2,     2,     2,\r
+       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,\r
+       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,\r
+       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,\r
+       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,\r
+       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,\r
+       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,\r
+       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,\r
+       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,\r
+       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,\r
+       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,\r
+       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,\r
+       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,\r
+       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,\r
+       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,\r
+       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,\r
+       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,\r
+       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,\r
+       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,\r
+       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,\r
+       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,\r
+       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,\r
+       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,\r
+       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,\r
+       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,\r
+       2,     2,     2,     2,     2,     2,     1,     3,     4,     5,\r
+       6,     7,     8,     9,    10,    11,    12,    13,    14,    15,\r
+      16,    17,    18,    19,    20,    21,    22\r
+};\r
+\r
+#if YYDEBUG\r
+static const short yyprhs[] =\r
+{\r
+       0,     0,     2,     4,     8,    10,    14,    16,    19,    21,\r
+      23,    27,    31,    36,    40,    44,    48,    50,    53,    55,\r
+      57,    60,    63,    66,    69,    72,    74,    77,    79,    81,\r
+      84,    87,    90,    93,    96,    98,   101,   103,   105,   108,\r
+     111,   114,   117,   120,   122,   125,   127,   129,   132,   135,\r
+     138,   141,   144,   146,   148,   150,   152,   154,   157,   160,\r
+     163,   166,   168,   171,   173\r
+};\r
+static const short yyrhs[] =\r
+{\r
+      24,     0,    25,     0,    25,     5,    24,     0,    26,     0,\r
+      25,     6,    26,     0,    27,     0,     7,    27,     0,    32,\r
+       0,    33,     0,    32,    28,    32,     0,    33,    29,    33,\r
+       0,    33,    13,    29,    33,     0,    33,    30,    32,     0,\r
+      32,    31,    33,     0,    11,    24,    12,     0,    10,     0,\r
+       8,     9,     0,     8,     0,     9,     0,     8,    10,     0,\r
+       9,    10,     0,     9,     8,     0,     8,     8,     0,     9,\r
+       9,     0,    10,     0,     8,     9,     0,     8,     0,     9,\r
+       0,     8,    10,     0,     9,    10,     0,     9,     8,     0,\r
+       8,     8,     0,     9,     9,     0,    10,     0,     8,     9,\r
+       0,     8,     0,     9,     0,     8,    10,     0,     9,    10,\r
+       0,     9,     8,     0,     8,     8,     0,     9,     9,     0,\r
+      10,     0,     8,     9,     0,     8,     0,     9,     0,     8,\r
+      10,     0,     9,    10,     0,     9,     8,     0,     8,     8,\r
+       0,     9,     9,     0,    35,     0,    38,     0,    36,     0,\r
+      34,     0,    21,     0,    15,    37,     0,    16,    37,     0,\r
+      17,    37,     0,    18,    37,     0,    37,     0,    14,    37,\r
+       0,    19,     0,    20,     0\r
+};\r
+\r
+#endif\r
+\r
+#if YYDEBUG\r
+/* YYRLINE[YYN] -- source line where rule number YYN was defined. */\r
+static const short yyrline[] =\r
+{\r
+       0,   135,   143,   148,   154,   159,   165,   170,   177,   182,\r
+     186,   190,   194,   198,   202,   206,   212,   218,   222,   226,\r
+     230,   234,   239,   243,   247,   253,   259,   263,   267,   271,\r
+     275,   280,   284,   288,   294,   300,   304,   308,   312,   316,\r
+     321,   325,   329,   335,   341,   345,   349,   353,   357,   362,\r
+     366,   370,   376,   381,   387,   392,   398,   407,   417,   426,\r
+     435,   446,   470,   483,   492\r
+};\r
+#endif\r
+\r
+\r
+#if (YYDEBUG) || defined YYERROR_VERBOSE\r
+\r
+/* YYTNAME[TOKEN_NUM] -- String name of the token TOKEN_NUM. */\r
+static const char *const yytname[] =\r
+{\r
+  "$", "error", "$undefined.", "COND_SPACE", "COND_EOF", "COND_OR", \r
+  "COND_AND", "COND_NOT", "COND_LT", "COND_GT", "COND_EQ", "COND_LPAR", \r
+  "COND_RPAR", "COND_TILDA", "COND_PERCENT", "COND_DOLLARS", \r
+  "COND_QUESTION", "COND_AMPER", "COND_EXCLAM", "COND_IDENT", \r
+  "COND_NUMBER", "COND_LITER", "COND_ERROR", "condition", "expression", \r
+  "boolean_term", "boolean_factor", "term", "comp_op_i", "comp_op_s", \r
+  "comp_op_m1", "comp_op_m2", "value_i", "value_s", "literal", "symbol_i", \r
+  "symbol_s", "identifier", "integer", 0\r
+};\r
+#endif\r
+\r
+/* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */\r
+static const short yyr1[] =\r
+{\r
+       0,    23,    24,    24,    25,    25,    26,    26,    27,    27,\r
+      27,    27,    27,    27,    27,    27,    28,    28,    28,    28,\r
+      28,    28,    28,    28,    28,    29,    29,    29,    29,    29,\r
+      29,    29,    29,    29,    30,    30,    30,    30,    30,    30,\r
+      30,    30,    30,    31,    31,    31,    31,    31,    31,    31,\r
+      31,    31,    32,    32,    33,    33,    34,    35,    35,    35,\r
+      35,    36,    36,    37,    38\r
+};\r
+\r
+/* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */\r
+static const short yyr2[] =\r
+{\r
+       0,     1,     1,     3,     1,     3,     1,     2,     1,     1,\r
+       3,     3,     4,     3,     3,     3,     1,     2,     1,     1,\r
+       2,     2,     2,     2,     2,     1,     2,     1,     1,     2,\r
+       2,     2,     2,     2,     1,     2,     1,     1,     2,     2,\r
+       2,     2,     2,     1,     2,     1,     1,     2,     2,     2,\r
+       2,     2,     1,     1,     1,     1,     1,     2,     2,     2,\r
+       2,     1,     2,     1,     1\r
+};\r
+\r
+/* YYDEFACT[S] -- default rule to reduce with in state S when YYTABLE\r
+   doesn't specify something else to do.  Zero means the default is an\r
+   error. */\r
+static const short yydefact[] =\r
+{\r
+       0,     0,     0,     0,     0,     0,     0,     0,    63,    64,\r
+      56,     1,     2,     4,     6,     8,     9,    55,    52,    54,\r
+      61,    53,     7,     0,    62,    57,    58,    59,    60,     0,\r
+       0,    18,    19,    16,     0,     0,    36,    37,    34,     0,\r
+       0,     0,    15,     3,     5,    23,    17,    20,    22,    24,\r
+      21,    10,    14,    41,    35,    38,    40,    42,    39,    27,\r
+      28,    25,     0,    11,    13,    32,    26,    29,    31,    33,\r
+      30,    12,     0,     0,     0\r
+};\r
+\r
+static const short yydefgoto[] =\r
+{\r
+      72,    11,    12,    13,    14,    34,    40,    41,    35,    15,\r
+      16,    17,    18,    19,    20,    21\r
+};\r
+\r
+static const short yypact[] =\r
+{\r
+      -5,    50,    -5,   -12,   -12,   -12,   -12,   -12,-32768,-32768,\r
+  -32768,-32768,    -2,-32768,-32768,    48,   123,-32768,-32768,-32768,\r
+  -32768,-32768,-32768,    -4,-32768,-32768,-32768,-32768,-32768,    -5,\r
+      -5,    10,    24,    33,   110,    58,    27,    41,    59,   135,\r
+      58,   110,-32768,-32768,-32768,    62,    68,    71,    72,    80,\r
+      81,-32768,-32768,    84,    90,    93,    94,   102,   103,   138,\r
+     141,-32768,    58,-32768,-32768,-32768,-32768,-32768,-32768,-32768,\r
+  -32768,-32768,    17,    21,-32768\r
+};\r
+\r
+static const short yypgoto[] =\r
+{\r
+  -32768,    -1,-32768,    -8,    25,-32768,   -14,-32768,-32768,   -11,\r
+     -35,-32768,-32768,-32768,   134,-32768\r
+};\r
+\r
+\r
+#define        YYLAST          151\r
+\r
+\r
+static const short yytable[] =\r
+{\r
+      52,    23,     1,    29,    30,    63,     2,     8,    42,     3,\r
+       4,     5,     6,     7,     8,     9,    10,    73,    45,    46,\r
+      47,    74,    44,    51,   -45,    62,    22,    71,    43,   -45,\r
+      64,   -45,    48,    49,    50,    53,    54,    55,   -46,     0,\r
+       0,   -27,     0,   -46,     0,   -46,   -27,   -43,   -27,    56,\r
+      57,    58,   -43,     0,   -43,   -28,    31,    32,    33,     0,\r
+     -28,     2,   -28,     0,     3,     4,     5,     6,     7,     8,\r
+       9,    10,     3,   -25,     0,     0,   -50,     8,   -25,    10,\r
+     -25,   -50,   -44,   -50,     0,   -47,   -49,   -44,     0,   -44,\r
+     -47,   -49,   -47,   -49,   -51,   -48,     0,     0,   -32,   -51,\r
+     -48,   -51,   -48,   -32,   -26,   -32,     0,   -29,   -31,   -26,\r
+       0,   -26,   -29,   -31,   -29,   -31,   -33,   -30,     0,     0,\r
+       0,   -33,   -30,   -33,   -30,     4,     5,     6,     7,     0,\r
+       9,    36,    37,    38,     0,     0,    39,    24,    25,    26,\r
+      27,    28,     0,    59,    60,    61,    65,    66,    67,    68,\r
+      69,    70\r
+};\r
+\r
+static const short yycheck[] =\r
+{\r
+      35,     2,     7,     5,     6,    40,    11,    19,    12,    14,\r
+      15,    16,    17,    18,    19,    20,    21,     0,     8,     9,\r
+      10,     0,    30,    34,    14,    39,     1,    62,    29,    19,\r
+      41,    21,     8,     9,    10,     8,     9,    10,    14,    -1,\r
+      -1,    14,    -1,    19,    -1,    21,    19,    14,    21,     8,\r
+       9,    10,    19,    -1,    21,    14,     8,     9,    10,    -1,\r
+      19,    11,    21,    -1,    14,    15,    16,    17,    18,    19,\r
+      20,    21,    14,    14,    -1,    -1,    14,    19,    19,    21,\r
+      21,    19,    14,    21,    -1,    14,    14,    19,    -1,    21,\r
+      19,    19,    21,    21,    14,    14,    -1,    -1,    14,    19,\r
+      19,    21,    21,    19,    14,    21,    -1,    14,    14,    19,\r
+      -1,    21,    19,    19,    21,    21,    14,    14,    -1,    -1,\r
+      -1,    19,    19,    21,    21,    15,    16,    17,    18,    -1,\r
+      20,     8,     9,    10,    -1,    -1,    13,     3,     4,     5,\r
+       6,     7,    -1,     8,     9,    10,     8,     9,    10,     8,\r
+       9,    10\r
+};\r
+#define YYPURE 1\r
+\r
+/* -*-C-*-  Note some compilers choke on comments on `#line' lines.  */\r
+#line 3 "/usr/share/bison/bison.simple"\r
+\r
+/* Skeleton output parser for bison,\r
+\r
+   Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002 Free Software\r
+   Foundation, Inc.\r
+\r
+   This program is free software; you can redistribute it and/or modify\r
+   it under the terms of the GNU General Public License as published by\r
+   the Free Software Foundation; either version 2, or (at your option)\r
+   any later version.\r
+\r
+   This program is distributed in the hope that it will be useful,\r
+   but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
+   GNU General Public License for more details.\r
+\r
+   You should have received a copy of the GNU General Public License\r
+   along with this program; if not, write to the Free Software\r
+   Foundation, Inc., 59 Temple Place - Suite 330,\r
+   Boston, MA 02111-1307, USA.  */\r
+\r
+/* As a special exception, when this file is copied by Bison into a\r
+   Bison output file, you may use that output file without restriction.\r
+   This special exception was added by the Free Software Foundation\r
+   in version 1.24 of Bison.  */\r
+\r
+/* This is the parser code that is written into each bison parser when\r
+   the %semantic_parser declaration is not specified in the grammar.\r
+   It was written by Richard Stallman by simplifying the hairy parser\r
+   used when %semantic_parser is specified.  */\r
+\r
+/* All symbols defined below should begin with yy or YY, to avoid\r
+   infringing on user name space.  This should be done even for local\r
+   variables, as they might otherwise be expanded by user macros.\r
+   There are some unavoidable exceptions within include files to\r
+   define necessary library symbols; they are noted "INFRINGES ON\r
+   USER NAME SPACE" below.  */\r
+\r
+#if ! defined (yyoverflow) || defined (YYERROR_VERBOSE)\r
+\r
+/* The parser invokes alloca or malloc; define the necessary symbols.  */\r
+\r
+# if YYSTACK_USE_ALLOCA\r
+#  define YYSTACK_ALLOC alloca\r
+# else\r
+#  ifndef YYSTACK_USE_ALLOCA\r
+#   if defined (alloca) || defined (_ALLOCA_H)\r
+#    define YYSTACK_ALLOC alloca\r
+#   else\r
+#    ifdef __GNUC__\r
+#     define YYSTACK_ALLOC __builtin_alloca\r
+#    endif\r
+#   endif\r
+#  endif\r
+# endif\r
+\r
+# ifdef YYSTACK_ALLOC\r
+   /* Pacify GCC's `empty if-body' warning. */\r
+#  define YYSTACK_FREE(Ptr) do { /* empty */; } while (0)\r
+# else\r
+#  if defined (__STDC__) || defined (__cplusplus)\r
+#   include <stdlib.h> /* INFRINGES ON USER NAME SPACE */\r
+#   define YYSIZE_T size_t\r
+#  endif\r
+#  define YYSTACK_ALLOC malloc\r
+#  define YYSTACK_FREE free\r
+# endif\r
+#endif /* ! defined (yyoverflow) || defined (YYERROR_VERBOSE) */\r
+\r
+\r
+#if (! defined (yyoverflow) \\r
+     && (! defined (__cplusplus) \\r
+        || (YYLTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL)))\r
+\r
+/* A type that is properly aligned for any stack member.  */\r
+union yyalloc\r
+{\r
+  short yyss;\r
+  YYSTYPE yyvs;\r
+# if YYLSP_NEEDED\r
+  YYLTYPE yyls;\r
+# endif\r
+};\r
+\r
+/* The size of the maximum gap between one aligned stack and the next.  */\r
+# define YYSTACK_GAP_MAX (sizeof (union yyalloc) - 1)\r
+\r
+/* The size of an array large to enough to hold all stacks, each with\r
+   N elements.  */\r
+# if YYLSP_NEEDED\r
+#  define YYSTACK_BYTES(N) \\r
+     ((N) * (sizeof (short) + sizeof (YYSTYPE) + sizeof (YYLTYPE))     \\r
+      + 2 * YYSTACK_GAP_MAX)\r
+# else\r
+#  define YYSTACK_BYTES(N) \\r
+     ((N) * (sizeof (short) + sizeof (YYSTYPE))                                \\r
+      + YYSTACK_GAP_MAX)\r
+# endif\r
+\r
+/* Copy COUNT objects from FROM to TO.  The source and destination do\r
+   not overlap.  */\r
+# ifndef YYCOPY\r
+#  if 1 < __GNUC__\r
+#   define YYCOPY(To, From, Count) \\r
+      __builtin_memcpy (To, From, (Count) * sizeof (*(From)))\r
+#  else\r
+#   define YYCOPY(To, From, Count)             \\r
+      do                                       \\r
+       {                                       \\r
+         register YYSIZE_T yyi;                \\r
+         for (yyi = 0; yyi < (Count); yyi++)   \\r
+           (To)[yyi] = (From)[yyi];            \\r
+       }                                       \\r
+      while (0)\r
+#  endif\r
+# endif\r
+\r
+/* Relocate STACK from its old location to the new one.  The\r
+   local variables YYSIZE and YYSTACKSIZE give the old and new number of\r
+   elements in the stack, and YYPTR gives the new location of the\r
+   stack.  Advance YYPTR to a properly aligned location for the next\r
+   stack.  */\r
+# define YYSTACK_RELOCATE(Stack)                                       \\r
+    do                                                                 \\r
+      {                                                                        \\r
+       YYSIZE_T yynewbytes;                                            \\r
+       YYCOPY (&yyptr->Stack, Stack, yysize);                          \\r
+       Stack = &yyptr->Stack;                                          \\r
+       yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAX;   \\r
+       yyptr += yynewbytes / sizeof (*yyptr);                          \\r
+      }                                                                        \\r
+    while (0)\r
+\r
+#endif\r
+\r
+\r
+#if ! defined (YYSIZE_T) && defined (__SIZE_TYPE__)\r
+# define YYSIZE_T __SIZE_TYPE__\r
+#endif\r
+#if ! defined (YYSIZE_T) && defined (size_t)\r
+# define YYSIZE_T size_t\r
+#endif\r
+#if ! defined (YYSIZE_T)\r
+# if defined (__STDC__) || defined (__cplusplus)\r
+#  include <stddef.h> /* INFRINGES ON USER NAME SPACE */\r
+#  define YYSIZE_T size_t\r
+# endif\r
+#endif\r
+#if ! defined (YYSIZE_T)\r
+# define YYSIZE_T unsigned int\r
+#endif\r
+\r
+#define yyerrok                (yyerrstatus = 0)\r
+#define yyclearin      (yychar = YYEMPTY)\r
+#define YYEMPTY                -2\r
+#define YYEOF          0\r
+#define YYACCEPT       goto yyacceptlab\r
+#define YYABORT        goto yyabortlab\r
+#define YYERROR                goto yyerrlab1\r
+/* Like YYERROR except do call yyerror.  This remains here temporarily\r
+   to ease the transition to the new meaning of YYERROR, for GCC.\r
+   Once GCC version 2 has supplanted version 1, this can go.  */\r
+#define YYFAIL         goto yyerrlab\r
+#define YYRECOVERING()  (!!yyerrstatus)\r
+#define YYBACKUP(Token, Value)                                 \\r
+do                                                             \\r
+  if (yychar == YYEMPTY && yylen == 1)                         \\r
+    {                                                          \\r
+      yychar = (Token);                                                \\r
+      yylval = (Value);                                                \\r
+      yychar1 = YYTRANSLATE (yychar);                          \\r
+      YYPOPSTACK;                                              \\r
+      goto yybackup;                                           \\r
+    }                                                          \\r
+  else                                                         \\r
+    {                                                          \\r
+      yyerror ("syntax error: cannot back up");                        \\r
+      YYERROR;                                                 \\r
+    }                                                          \\r
+while (0)\r
+\r
+#define YYTERROR       1\r
+#define YYERRCODE      256\r
+\r
+\r
+/* YYLLOC_DEFAULT -- Compute the default location (before the actions\r
+   are run).\r
+\r
+   When YYLLOC_DEFAULT is run, CURRENT is set the location of the\r
+   first token.  By default, to implement support for ranges, extend\r
+   its range to the last symbol.  */\r
+\r
+#ifndef YYLLOC_DEFAULT\r
+# define YYLLOC_DEFAULT(Current, Rhs, N)               \\r
+   Current.last_line   = Rhs[N].last_line;     \\r
+   Current.last_column = Rhs[N].last_column;\r
+#endif\r
+\r
+\r
+/* YYLEX -- calling `yylex' with the right arguments.  */\r
+\r
+#if YYPURE\r
+# if YYLSP_NEEDED\r
+#  ifdef YYLEX_PARAM\r
+#   define YYLEX               yylex (&yylval, &yylloc, YYLEX_PARAM)\r
+#  else\r
+#   define YYLEX               yylex (&yylval, &yylloc)\r
+#  endif\r
+# else /* !YYLSP_NEEDED */\r
+#  ifdef YYLEX_PARAM\r
+#   define YYLEX               yylex (&yylval, YYLEX_PARAM)\r
+#  else\r
+#   define YYLEX               yylex (&yylval)\r
+#  endif\r
+# endif /* !YYLSP_NEEDED */\r
+#else /* !YYPURE */\r
+# define YYLEX                 yylex ()\r
+#endif /* !YYPURE */\r
+\r
+\r
+/* Enable debugging if requested.  */\r
+#if YYDEBUG\r
+\r
+# ifndef YYFPRINTF\r
+#  include <stdio.h> /* INFRINGES ON USER NAME SPACE */\r
+#  define YYFPRINTF fprintf\r
+# endif\r
+\r
+# define YYDPRINTF(Args)                       \\r
+do {                                           \\r
+  if (yydebug)                                 \\r
+    YYFPRINTF Args;                            \\r
+} while (0)\r
+/* Nonzero means print parse trace.  It is left uninitialized so that\r
+   multiple parsers can coexist.  */\r
+int yydebug;\r
+#else /* !YYDEBUG */\r
+# define YYDPRINTF(Args)\r
+#endif /* !YYDEBUG */\r
+\r
+/* YYINITDEPTH -- initial size of the parser's stacks.  */\r
+#ifndef        YYINITDEPTH\r
+# define YYINITDEPTH 200\r
+#endif\r
+\r
+/* YYMAXDEPTH -- maximum size the stacks can grow to (effective only\r
+   if the built-in stack extension method is used).\r
+\r
+   Do not make this value too large; the results are undefined if\r
+   SIZE_MAX < YYSTACK_BYTES (YYMAXDEPTH)\r
+   evaluated with infinite-precision integer arithmetic.  */\r
+\r
+#if YYMAXDEPTH == 0\r
+# undef YYMAXDEPTH\r
+#endif\r
+\r
+#ifndef YYMAXDEPTH\r
+# define YYMAXDEPTH 10000\r
+#endif\r
+\f\r
+#ifdef YYERROR_VERBOSE\r
+\r
+# ifndef yystrlen\r
+#  if defined (__GLIBC__) && defined (_STRING_H)\r
+#   define yystrlen strlen\r
+#  else\r
+/* Return the length of YYSTR.  */\r
+static YYSIZE_T\r
+#   if defined (__STDC__) || defined (__cplusplus)\r
+yystrlen (const char *yystr)\r
+#   else\r
+yystrlen (yystr)\r
+     const char *yystr;\r
+#   endif\r
+{\r
+  register const char *yys = yystr;\r
+\r
+  while (*yys++ != '\0')\r
+    continue;\r
+\r
+  return yys - yystr - 1;\r
+}\r
+#  endif\r
+# endif\r
+\r
+# ifndef yystpcpy\r
+#  if defined (__GLIBC__) && defined (_STRING_H) && defined (_GNU_SOURCE)\r
+#   define yystpcpy stpcpy\r
+#  else\r
+/* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in\r
+   YYDEST.  */\r
+static char *\r
+#   if defined (__STDC__) || defined (__cplusplus)\r
+yystpcpy (char *yydest, const char *yysrc)\r
+#   else\r
+yystpcpy (yydest, yysrc)\r
+     char *yydest;\r
+     const char *yysrc;\r
+#   endif\r
+{\r
+  register char *yyd = yydest;\r
+  register const char *yys = yysrc;\r
+\r
+  while ((*yyd++ = *yys++) != '\0')\r
+    continue;\r
+\r
+  return yyd - 1;\r
+}\r
+#  endif\r
+# endif\r
+#endif\r
+\f\r
+#line 315 "/usr/share/bison/bison.simple"\r
+\r
+\r
+/* The user can define YYPARSE_PARAM as the name of an argument to be passed\r
+   into yyparse.  The argument should have type void *.\r
+   It should actually point to an object.\r
+   Grammar actions can access the variable by casting it\r
+   to the proper pointer type.  */\r
+\r
+#ifdef YYPARSE_PARAM\r
+# if defined (__STDC__) || defined (__cplusplus)\r
+#  define YYPARSE_PARAM_ARG void *YYPARSE_PARAM\r
+#  define YYPARSE_PARAM_DECL\r
+# else\r
+#  define YYPARSE_PARAM_ARG YYPARSE_PARAM\r
+#  define YYPARSE_PARAM_DECL void *YYPARSE_PARAM;\r
+# endif\r
+#else /* !YYPARSE_PARAM */\r
+# define YYPARSE_PARAM_ARG\r
+# define YYPARSE_PARAM_DECL\r
+#endif /* !YYPARSE_PARAM */\r
+\r
+/* Prevent warning if -Wstrict-prototypes.  */\r
+#ifdef __GNUC__\r
+# ifdef YYPARSE_PARAM\r
+int yyparse (void *);\r
+# else\r
+int yyparse (void);\r
+# endif\r
+#endif\r
+\r
+/* YY_DECL_VARIABLES -- depending whether we use a pure parser,\r
+   variables are global, or local to YYPARSE.  */\r
+\r
+#define YY_DECL_NON_LSP_VARIABLES                      \\r
+/* The lookahead symbol.  */                           \\r
+int yychar;                                            \\r
+                                                       \\r
+/* The semantic value of the lookahead symbol. */      \\r
+YYSTYPE yylval;                                                \\r
+                                                       \\r
+/* Number of parse errors so far.  */                  \\r
+int yynerrs;\r
+\r
+#if YYLSP_NEEDED\r
+# define YY_DECL_VARIABLES                     \\r
+YY_DECL_NON_LSP_VARIABLES                      \\r
+                                               \\r
+/* Location data for the lookahead symbol.  */ \\r
+YYLTYPE yylloc;\r
+#else\r
+# define YY_DECL_VARIABLES                     \\r
+YY_DECL_NON_LSP_VARIABLES\r
+#endif\r
+\r
+\r
+/* If nonreentrant, generate the variables here. */\r
+\r
+#if !YYPURE\r
+YY_DECL_VARIABLES\r
+#endif  /* !YYPURE */\r
+\r
+int\r
+yyparse (YYPARSE_PARAM_ARG)\r
+     YYPARSE_PARAM_DECL\r
+{\r
+  /* If reentrant, generate the variables here. */\r
+#if YYPURE\r
+  YY_DECL_VARIABLES\r
+#endif  /* !YYPURE */\r
+\r
+  register int yystate;\r
+  register int yyn;\r
+  int yyresult;\r
+  /* Number of tokens to shift before error messages enabled.  */\r
+  int yyerrstatus;\r
+  /* Lookahead token as an internal (translated) token number.  */\r
+  int yychar1 = 0;\r
+\r
+  /* Three stacks and their tools:\r
+     `yyss': related to states,\r
+     `yyvs': related to semantic values,\r
+     `yyls': related to locations.\r
+\r
+     Refer to the stacks thru separate pointers, to allow yyoverflow\r
+     to reallocate them elsewhere.  */\r
+\r
+  /* The state stack. */\r
+  short        yyssa[YYINITDEPTH];\r
+  short *yyss = yyssa;\r
+  register short *yyssp;\r
+\r
+  /* The semantic value stack.  */\r
+  YYSTYPE yyvsa[YYINITDEPTH];\r
+  YYSTYPE *yyvs = yyvsa;\r
+  register YYSTYPE *yyvsp;\r
+\r
+#if YYLSP_NEEDED\r
+  /* The location stack.  */\r
+  YYLTYPE yylsa[YYINITDEPTH];\r
+  YYLTYPE *yyls = yylsa;\r
+  YYLTYPE *yylsp;\r
+#endif\r
+\r
+#if YYLSP_NEEDED\r
+# define YYPOPSTACK   (yyvsp--, yyssp--, yylsp--)\r
+#else\r
+# define YYPOPSTACK   (yyvsp--, yyssp--)\r
+#endif\r
+\r
+  YYSIZE_T yystacksize = YYINITDEPTH;\r
+\r
+\r
+  /* The variables used to return semantic value and location from the\r
+     action routines.  */\r
+  YYSTYPE yyval;\r
+#if YYLSP_NEEDED\r
+  YYLTYPE yyloc;\r
+#endif\r
+\r
+  /* When reducing, the number of symbols on the RHS of the reduced\r
+     rule. */\r
+  int yylen;\r
+\r
+  YYDPRINTF ((stderr, "Starting parse\n"));\r
+\r
+  yystate = 0;\r
+  yyerrstatus = 0;\r
+  yynerrs = 0;\r
+  yychar = YYEMPTY;            /* Cause a token to be read.  */\r
+\r
+  /* Initialize stack pointers.\r
+     Waste one element of value and location stack\r
+     so that they stay on the same level as the state stack.\r
+     The wasted elements are never initialized.  */\r
+\r
+  yyssp = yyss;\r
+  yyvsp = yyvs;\r
+#if YYLSP_NEEDED\r
+  yylsp = yyls;\r
+#endif\r
+  goto yysetstate;\r
+\r
+/*------------------------------------------------------------.\r
+| yynewstate -- Push a new state, which is found in yystate.  |\r
+`------------------------------------------------------------*/\r
+ yynewstate:\r
+  /* In all cases, when you get here, the value and location stacks\r
+     have just been pushed. so pushing a state here evens the stacks.\r
+     */\r
+  yyssp++;\r
+\r
+ yysetstate:\r
+  *yyssp = yystate;\r
+\r
+  if (yyssp >= yyss + yystacksize - 1)\r
+    {\r
+      /* Get the current used size of the three stacks, in elements.  */\r
+      YYSIZE_T yysize = yyssp - yyss + 1;\r
+\r
+#ifdef yyoverflow\r
+      {\r
+       /* Give user a chance to reallocate the stack. Use copies of\r
+          these so that the &'s don't force the real ones into\r
+          memory.  */\r
+       YYSTYPE *yyvs1 = yyvs;\r
+       short *yyss1 = yyss;\r
+\r
+       /* Each stack pointer address is followed by the size of the\r
+          data in use in that stack, in bytes.  */\r
+# if YYLSP_NEEDED\r
+       YYLTYPE *yyls1 = yyls;\r
+       /* This used to be a conditional around just the two extra args,\r
+          but that might be undefined if yyoverflow is a macro.  */\r
+       yyoverflow ("parser stack overflow",\r
+                   &yyss1, yysize * sizeof (*yyssp),\r
+                   &yyvs1, yysize * sizeof (*yyvsp),\r
+                   &yyls1, yysize * sizeof (*yylsp),\r
+                   &yystacksize);\r
+       yyls = yyls1;\r
+# else\r
+       yyoverflow ("parser stack overflow",\r
+                   &yyss1, yysize * sizeof (*yyssp),\r
+                   &yyvs1, yysize * sizeof (*yyvsp),\r
+                   &yystacksize);\r
+# endif\r
+       yyss = yyss1;\r
+       yyvs = yyvs1;\r
+      }\r
+#else /* no yyoverflow */\r
+# ifndef YYSTACK_RELOCATE\r
+      goto yyoverflowlab;\r
+# else\r
+      /* Extend the stack our own way.  */\r
+      if (yystacksize >= YYMAXDEPTH)\r
+       goto yyoverflowlab;\r
+      yystacksize *= 2;\r
+      if (yystacksize > YYMAXDEPTH)\r
+       yystacksize = YYMAXDEPTH;\r
+\r
+      {\r
+       short *yyss1 = yyss;\r
+       union yyalloc *yyptr =\r
+         (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize));\r
+       if (! yyptr)\r
+         goto yyoverflowlab;\r
+       YYSTACK_RELOCATE (yyss);\r
+       YYSTACK_RELOCATE (yyvs);\r
+# if YYLSP_NEEDED\r
+       YYSTACK_RELOCATE (yyls);\r
+# endif\r
+# undef YYSTACK_RELOCATE\r
+       if (yyss1 != yyssa)\r
+         YYSTACK_FREE (yyss1);\r
+      }\r
+# endif\r
+#endif /* no yyoverflow */\r
+\r
+      yyssp = yyss + yysize - 1;\r
+      yyvsp = yyvs + yysize - 1;\r
+#if YYLSP_NEEDED\r
+      yylsp = yyls + yysize - 1;\r
+#endif\r
+\r
+      YYDPRINTF ((stderr, "Stack size increased to %lu\n",\r
+                 (unsigned long int) yystacksize));\r
+\r
+      if (yyssp >= yyss + yystacksize - 1)\r
+       YYABORT;\r
+    }\r
+\r
+  YYDPRINTF ((stderr, "Entering state %d\n", yystate));\r
+\r
+  goto yybackup;\r
+\r
+\r
+/*-----------.\r
+| yybackup.  |\r
+`-----------*/\r
+yybackup:\r
+\r
+/* Do appropriate processing given the current state.  */\r
+/* Read a lookahead token if we need one and don't already have one.  */\r
+/* yyresume: */\r
+\r
+  /* First try to decide what to do without reference to lookahead token.  */\r
+\r
+  yyn = yypact[yystate];\r
+  if (yyn == YYFLAG)\r
+    goto yydefault;\r
+\r
+  /* Not known => get a lookahead token if don't already have one.  */\r
+\r
+  /* yychar is either YYEMPTY or YYEOF\r
+     or a valid token in external form.  */\r
+\r
+  if (yychar == YYEMPTY)\r
+    {\r
+      YYDPRINTF ((stderr, "Reading a token: "));\r
+      yychar = YYLEX;\r
+    }\r
+\r
+  /* Convert token to internal form (in yychar1) for indexing tables with */\r
+\r
+  if (yychar <= 0)             /* This means end of input. */\r
+    {\r
+      yychar1 = 0;\r
+      yychar = YYEOF;          /* Don't call YYLEX any more */\r
+\r
+      YYDPRINTF ((stderr, "Now at end of input.\n"));\r
+    }\r
+  else\r
+    {\r
+      yychar1 = YYTRANSLATE (yychar);\r
+\r
+#if YYDEBUG\r
+     /* We have to keep this `#if YYDEBUG', since we use variables\r
+       which are defined only if `YYDEBUG' is set.  */\r
+      if (yydebug)\r
+       {\r
+         YYFPRINTF (stderr, "Next token is %d (%s",\r
+                    yychar, yytname[yychar1]);\r
+         /* Give the individual parser a way to print the precise\r
+            meaning of a token, for further debugging info.  */\r
+# ifdef YYPRINT\r
+         YYPRINT (stderr, yychar, yylval);\r
+# endif\r
+         YYFPRINTF (stderr, ")\n");\r
+       }\r
+#endif\r
+    }\r
+\r
+  yyn += yychar1;\r
+  if (yyn < 0 || yyn > YYLAST || yycheck[yyn] != yychar1)\r
+    goto yydefault;\r
+\r
+  yyn = yytable[yyn];\r
+\r
+  /* yyn is what to do for this token type in this state.\r
+     Negative => reduce, -yyn is rule number.\r
+     Positive => shift, yyn is new state.\r
+       New state is final state => don't bother to shift,\r
+       just return success.\r
+     0, or most negative number => error.  */\r
+\r
+  if (yyn < 0)\r
+    {\r
+      if (yyn == YYFLAG)\r
+       goto yyerrlab;\r
+      yyn = -yyn;\r
+      goto yyreduce;\r
+    }\r
+  else if (yyn == 0)\r
+    goto yyerrlab;\r
+\r
+  if (yyn == YYFINAL)\r
+    YYACCEPT;\r
+\r
+  /* Shift the lookahead token.  */\r
+  YYDPRINTF ((stderr, "Shifting token %d (%s), ",\r
+             yychar, yytname[yychar1]));\r
+\r
+  /* Discard the token being shifted unless it is eof.  */\r
+  if (yychar != YYEOF)\r
+    yychar = YYEMPTY;\r
+\r
+  *++yyvsp = yylval;\r
+#if YYLSP_NEEDED\r
+  *++yylsp = yylloc;\r
+#endif\r
+\r
+  /* Count tokens shifted since error; after three, turn off error\r
+     status.  */\r
+  if (yyerrstatus)\r
+    yyerrstatus--;\r
+\r
+  yystate = yyn;\r
+  goto yynewstate;\r
+\r
+\r
+/*-----------------------------------------------------------.\r
+| yydefault -- do the default action for the current state.  |\r
+`-----------------------------------------------------------*/\r
+yydefault:\r
+  yyn = yydefact[yystate];\r
+  if (yyn == 0)\r
+    goto yyerrlab;\r
+  goto yyreduce;\r
+\r
+\r
+/*-----------------------------.\r
+| yyreduce -- Do a reduction.  |\r
+`-----------------------------*/\r
+yyreduce:\r
+  /* yyn is the number of a rule to reduce with.  */\r
+  yylen = yyr2[yyn];\r
+\r
+  /* If YYLEN is nonzero, implement the default value of the action:\r
+     `$$ = $1'.\r
+\r
+     Otherwise, the following line sets YYVAL to the semantic value of\r
+     the lookahead token.  This behavior is undocumented and Bison\r
+     users should not rely upon it.  Assigning to YYVAL\r
+     unconditionally makes the parser a bit smaller, and it avoids a\r
+     GCC warning that YYVAL may be used uninitialized.  */\r
+  yyval = yyvsp[1-yylen];\r
+\r
+#if YYLSP_NEEDED\r
+  /* Similarly for the default location.  Let the user run additional\r
+     commands if for instance locations are ranges.  */\r
+  yyloc = yylsp[1-yylen];\r
+  YYLLOC_DEFAULT (yyloc, (yylsp - yylen), yylen);\r
+#endif\r
+\r
+#if YYDEBUG\r
+  /* We have to keep this `#if YYDEBUG', since we use variables which\r
+     are defined only if `YYDEBUG' is set.  */\r
+  if (yydebug)\r
+    {\r
+      int yyi;\r
+\r
+      YYFPRINTF (stderr, "Reducing via rule %d (line %d), ",\r
+                yyn, yyrline[yyn]);\r
+\r
+      /* Print the symbols being reduced, and their result.  */\r
+      for (yyi = yyprhs[yyn]; yyrhs[yyi] > 0; yyi++)\r
+       YYFPRINTF (stderr, "%s ", yytname[yyrhs[yyi]]);\r
+      YYFPRINTF (stderr, " -> %s\n", yytname[yyr1[yyn]]);\r
+    }\r
+#endif\r
+\r
+  switch (yyn) {\r
+\r
+case 1:\r
+#line 137 "./cond.y"\r
+{\r
+            COND_input* cond = (COND_input*) info;\r
+            cond->result = yyvsp[0].value;\r
+        ;\r
+    break;}\r
+case 2:\r
+#line 145 "./cond.y"\r
+{\r
+            yyval.value = yyvsp[0].value;\r
+        ;\r
+    break;}\r
+case 3:\r
+#line 149 "./cond.y"\r
+{\r
+            yyval.value = yyvsp[-2].value || yyvsp[0].value;\r
+        ;\r
+    break;}\r
+case 4:\r
+#line 156 "./cond.y"\r
+{\r
+            yyval.value = yyvsp[0].value;\r
+        ;\r
+    break;}\r
+case 5:\r
+#line 160 "./cond.y"\r
+{\r
+            yyval.value = yyvsp[-2].value && yyvsp[0].value;\r
+        ;\r
+    break;}\r
+case 6:\r
+#line 167 "./cond.y"\r
+{\r
+            yyval.value = yyvsp[0].value;\r
+        ;\r
+    break;}\r
+case 7:\r
+#line 171 "./cond.y"\r
+{\r
+            yyval.value = ! yyvsp[0].value;\r
+        ;\r
+    break;}\r
+case 8:\r
+#line 179 "./cond.y"\r
+{\r
+            yyval.value = yyvsp[0].value;\r
+        ;\r
+    break;}\r
+case 9:\r
+#line 183 "./cond.y"\r
+{\r
+            yyval.value = (yyvsp[0].string && yyvsp[0].string[0]) ? MSICONDITION_TRUE : MSICONDITION_FALSE;\r
+        ;\r
+    break;}\r
+case 10:\r
+#line 187 "./cond.y"\r
+{\r
+            yyval.value = yyvsp[-1].fn_comp_int( yyvsp[-2].value, yyvsp[0].value );\r
+        ;\r
+    break;}\r
+case 11:\r
+#line 191 "./cond.y"\r
+{\r
+            yyval.value = yyvsp[-1].fn_comp_str( yyvsp[-2].string, yyvsp[0].string, FALSE );\r
+        ;\r
+    break;}\r
+case 12:\r
+#line 195 "./cond.y"\r
+{\r
+            yyval.value = yyvsp[-1].fn_comp_str( yyvsp[-3].string, yyvsp[0].string, TRUE );\r
+        ;\r
+    break;}\r
+case 13:\r
+#line 199 "./cond.y"\r
+{\r
+            yyval.value = yyvsp[-1].fn_comp_m1( yyvsp[-2].string, yyvsp[0].value );\r
+        ;\r
+    break;}\r
+case 14:\r
+#line 203 "./cond.y"\r
+{\r
+            yyval.value = yyvsp[-1].fn_comp_m2( yyvsp[-2].value, yyvsp[0].string );\r
+        ;\r
+    break;}\r
+case 15:\r
+#line 207 "./cond.y"\r
+{\r
+            yyval.value = yyvsp[-1].value;\r
+        ;\r
+    break;}\r
+case 16:\r
+#line 215 "./cond.y"\r
+{\r
+            yyval.fn_comp_int = comp_eq_i;\r
+        ;\r
+    break;}\r
+case 17:\r
+#line 219 "./cond.y"\r
+{\r
+            yyval.fn_comp_int = comp_ne_i;\r
+        ;\r
+    break;}\r
+case 18:\r
+#line 223 "./cond.y"\r
+{\r
+            yyval.fn_comp_int = comp_lt_i;\r
+        ;\r
+    break;}\r
+case 19:\r
+#line 227 "./cond.y"\r
+{\r
+            yyval.fn_comp_int = comp_gt_i;\r
+        ;\r
+    break;}\r
+case 20:\r
+#line 231 "./cond.y"\r
+{\r
+            yyval.fn_comp_int = comp_le_i;\r
+        ;\r
+    break;}\r
+case 21:\r
+#line 235 "./cond.y"\r
+{\r
+            yyval.fn_comp_int = comp_ge_i;\r
+        ;\r
+    break;}\r
+case 22:\r
+#line 240 "./cond.y"\r
+{\r
+            yyval.fn_comp_int = comp_bitand;\r
+        ;\r
+    break;}\r
+case 23:\r
+#line 244 "./cond.y"\r
+{\r
+            yyval.fn_comp_int = comp_highcomp;\r
+        ;\r
+    break;}\r
+case 24:\r
+#line 248 "./cond.y"\r
+{\r
+            yyval.fn_comp_int = comp_lowcomp;\r
+        ;\r
+    break;}\r
+case 25:\r
+#line 256 "./cond.y"\r
+{\r
+            yyval.fn_comp_str = comp_eq_s;\r
+        ;\r
+    break;}\r
+case 26:\r
+#line 260 "./cond.y"\r
+{\r
+            yyval.fn_comp_str = comp_ne_s;\r
+        ;\r
+    break;}\r
+case 27:\r
+#line 264 "./cond.y"\r
+{\r
+            yyval.fn_comp_str = comp_lt_s;\r
+        ;\r
+    break;}\r
+case 28:\r
+#line 268 "./cond.y"\r
+{\r
+            yyval.fn_comp_str = comp_gt_s;\r
+        ;\r
+    break;}\r
+case 29:\r
+#line 272 "./cond.y"\r
+{\r
+            yyval.fn_comp_str = comp_le_s;\r
+        ;\r
+    break;}\r
+case 30:\r
+#line 276 "./cond.y"\r
+{\r
+            yyval.fn_comp_str = comp_ge_s;\r
+        ;\r
+    break;}\r
+case 31:\r
+#line 281 "./cond.y"\r
+{\r
+            yyval.fn_comp_str = comp_substring;\r
+        ;\r
+    break;}\r
+case 32:\r
+#line 285 "./cond.y"\r
+{\r
+            yyval.fn_comp_str = comp_start;\r
+        ;\r
+    break;}\r
+case 33:\r
+#line 289 "./cond.y"\r
+{\r
+            yyval.fn_comp_str = comp_end;\r
+        ;\r
+    break;}\r
+case 34:\r
+#line 297 "./cond.y"\r
+{\r
+            yyval.fn_comp_m1 = comp_eq_m1;\r
+        ;\r
+    break;}\r
+case 35:\r
+#line 301 "./cond.y"\r
+{\r
+            yyval.fn_comp_m1 = comp_ne_m1;\r
+        ;\r
+    break;}\r
+case 36:\r
+#line 305 "./cond.y"\r
+{\r
+            yyval.fn_comp_m1 = comp_lt_m1;\r
+        ;\r
+    break;}\r
+case 37:\r
+#line 309 "./cond.y"\r
+{\r
+            yyval.fn_comp_m1 = comp_gt_m1;\r
+        ;\r
+    break;}\r
+case 38:\r
+#line 313 "./cond.y"\r
+{\r
+            yyval.fn_comp_m1 = comp_le_m1;\r
+        ;\r
+    break;}\r
+case 39:\r
+#line 317 "./cond.y"\r
+{\r
+            yyval.fn_comp_m1 = comp_ge_m1;\r
+        ;\r
+    break;}\r
+case 40:\r
+#line 322 "./cond.y"\r
+{\r
+            yyval.fn_comp_m1 = 0;\r
+        ;\r
+    break;}\r
+case 41:\r
+#line 326 "./cond.y"\r
+{\r
+            yyval.fn_comp_m1 = 0;\r
+        ;\r
+    break;}\r
+case 42:\r
+#line 330 "./cond.y"\r
+{\r
+            yyval.fn_comp_m1 = 0;\r
+        ;\r
+    break;}\r
+case 43:\r
+#line 338 "./cond.y"\r
+{\r
+            yyval.fn_comp_m2 = comp_eq_m2;\r
+        ;\r
+    break;}\r
+case 44:\r
+#line 342 "./cond.y"\r
+{\r
+            yyval.fn_comp_m2 = comp_ne_m2;\r
+        ;\r
+    break;}\r
+case 45:\r
+#line 346 "./cond.y"\r
+{\r
+            yyval.fn_comp_m2 = comp_lt_m2;\r
+        ;\r
+    break;}\r
+case 46:\r
+#line 350 "./cond.y"\r
+{\r
+            yyval.fn_comp_m2 = comp_gt_m2;\r
+        ;\r
+    break;}\r
+case 47:\r
+#line 354 "./cond.y"\r
+{\r
+            yyval.fn_comp_m2 = comp_le_m2;\r
+        ;\r
+    break;}\r
+case 48:\r
+#line 358 "./cond.y"\r
+{\r
+            yyval.fn_comp_m2 = comp_ge_m2;\r
+        ;\r
+    break;}\r
+case 49:\r
+#line 363 "./cond.y"\r
+{\r
+            yyval.fn_comp_m2 = 0;\r
+        ;\r
+    break;}\r
+case 50:\r
+#line 367 "./cond.y"\r
+{\r
+            yyval.fn_comp_m2 = 0;\r
+        ;\r
+    break;}\r
+case 51:\r
+#line 371 "./cond.y"\r
+{\r
+            yyval.fn_comp_m2 = 0;\r
+        ;\r
+    break;}\r
+case 52:\r
+#line 378 "./cond.y"\r
+{\r
+            yyval.value = yyvsp[0].value;\r
+        ;\r
+    break;}\r
+case 53:\r
+#line 382 "./cond.y"\r
+{\r
+            yyval.value = yyvsp[0].value;\r
+        ;\r
+    break;}\r
+case 54:\r
+#line 389 "./cond.y"\r
+{\r
+        yyval.string = yyvsp[0].string;\r
+    ;\r
+    break;}\r
+case 55:\r
+#line 393 "./cond.y"\r
+{\r
+        yyval.string = yyvsp[0].string;\r
+    ;\r
+    break;}\r
+case 56:\r
+#line 400 "./cond.y"\r
+{\r
+            yyval.string = COND_GetLiteral(&yyvsp[0].str);\r
+            if( !yyval.string )\r
+                YYABORT;\r
+        ;\r
+    break;}\r
+case 57:\r
+#line 409 "./cond.y"\r
+{\r
+            COND_input* cond = (COND_input*) info;\r
+            INSTALLSTATE install = INSTALLSTATE_UNKNOWN, action = INSTALLSTATE_UNKNOWN;\r
+      \r
+            MSI_GetComponentStateW(cond->package, yyvsp[0].string, &install, &action );\r
+            yyval.value = action;\r
+            HeapFree( GetProcessHeap(), 0, yyvsp[0].string );\r
+        ;\r
+    break;}\r
+case 58:\r
+#line 418 "./cond.y"\r
+{\r
+            COND_input* cond = (COND_input*) info;\r
+            INSTALLSTATE install = INSTALLSTATE_UNKNOWN, action = INSTALLSTATE_UNKNOWN;\r
+      \r
+            MSI_GetComponentStateW(cond->package, yyvsp[0].string, &install, &action );\r
+            yyval.value = install;\r
+            HeapFree( GetProcessHeap(), 0, yyvsp[0].string );\r
+        ;\r
+    break;}\r
+case 59:\r
+#line 427 "./cond.y"\r
+{\r
+            COND_input* cond = (COND_input*) info;\r
+            INSTALLSTATE install = INSTALLSTATE_UNKNOWN, action = INSTALLSTATE_UNKNOWN;\r
+      \r
+            MSI_GetFeatureStateW(cond->package, yyvsp[0].string, &install, &action );\r
+            yyval.value = action;\r
+            HeapFree( GetProcessHeap(), 0, yyvsp[0].string );\r
+        ;\r
+    break;}\r
+case 60:\r
+#line 436 "./cond.y"\r
+{\r
+            COND_input* cond = (COND_input*) info;\r
+            INSTALLSTATE install = INSTALLSTATE_UNKNOWN, action = INSTALLSTATE_UNKNOWN;\r
+      \r
+            MSI_GetFeatureStateW(cond->package, yyvsp[0].string, &install, &action );\r
+            yyval.value = install;\r
+            HeapFree( GetProcessHeap(), 0, yyvsp[0].string );\r
+        ;\r
+    break;}\r
+case 61:\r
+#line 448 "./cond.y"\r
+{\r
+            DWORD sz;\r
+            COND_input* cond = (COND_input*) info;\r
+\r
+            sz = 0;\r
+            MSI_GetPropertyW(cond->package, yyvsp[0].string, NULL, &sz);\r
+            if (sz == 0)\r
+            {\r
+                yyval.string = HeapAlloc( GetProcessHeap(), 0 ,sizeof(WCHAR));\r
+                yyval.string[0] = 0;\r
+            }\r
+            else\r
+            {\r
+                sz ++;\r
+                yyval.string = HeapAlloc( GetProcessHeap(), 0, sz*sizeof (WCHAR) );\r
+\r
+                /* Lookup the identifier */\r
+\r
+                MSI_GetPropertyW(cond->package,yyvsp[0].string,yyval.string,&sz);\r
+            }\r
+            HeapFree( GetProcessHeap(), 0, yyvsp[0].string );\r
+        ;\r
+    break;}\r
+case 62:\r
+#line 471 "./cond.y"\r
+{\r
+            UINT len = GetEnvironmentVariableW( yyvsp[0].string, NULL, 0 );\r
+            if( len++ )\r
+            {\r
+                yyval.string = HeapAlloc( GetProcessHeap(), 0, len*sizeof (WCHAR) );\r
+                if( yyval.string )\r
+                    GetEnvironmentVariableW( yyvsp[0].string, yyval.string, len );\r
+            }\r
+            HeapFree( GetProcessHeap(), 0, yyvsp[0].string );\r
+        ;\r
+    break;}\r
+case 63:\r
+#line 485 "./cond.y"\r
+{\r
+            yyval.string = COND_GetString(&yyvsp[0].str);\r
+            if( !yyval.string )\r
+                YYABORT;\r
+        ;\r
+    break;}\r
+case 64:\r
+#line 494 "./cond.y"\r
+{\r
+            LPWSTR szNum = COND_GetString(&yyvsp[0].str);\r
+            if( !szNum )\r
+                YYABORT;\r
+            yyval.value = atoiW( szNum );\r
+            HeapFree( GetProcessHeap(), 0, szNum );\r
+        ;\r
+    break;}\r
+}\r
+\r
+#line 705 "/usr/share/bison/bison.simple"\r
+\r
+\f\r
+  yyvsp -= yylen;\r
+  yyssp -= yylen;\r
+#if YYLSP_NEEDED\r
+  yylsp -= yylen;\r
+#endif\r
+\r
+#if YYDEBUG\r
+  if (yydebug)\r
+    {\r
+      short *yyssp1 = yyss - 1;\r
+      YYFPRINTF (stderr, "state stack now");\r
+      while (yyssp1 != yyssp)\r
+       YYFPRINTF (stderr, " %d", *++yyssp1);\r
+      YYFPRINTF (stderr, "\n");\r
+    }\r
+#endif\r
+\r
+  *++yyvsp = yyval;\r
+#if YYLSP_NEEDED\r
+  *++yylsp = yyloc;\r
+#endif\r
+\r
+  /* Now `shift' the result of the reduction.  Determine what state\r
+     that goes to, based on the state we popped back to and the rule\r
+     number reduced by.  */\r
+\r
+  yyn = yyr1[yyn];\r
+\r
+  yystate = yypgoto[yyn - YYNTBASE] + *yyssp;\r
+  if (yystate >= 0 && yystate <= YYLAST && yycheck[yystate] == *yyssp)\r
+    yystate = yytable[yystate];\r
+  else\r
+    yystate = yydefgoto[yyn - YYNTBASE];\r
+\r
+  goto yynewstate;\r
+\r
+\r
+/*------------------------------------.\r
+| yyerrlab -- here on detecting error |\r
+`------------------------------------*/\r
+yyerrlab:\r
+  /* If not already recovering from an error, report this error.  */\r
+  if (!yyerrstatus)\r
+    {\r
+      ++yynerrs;\r
+\r
+#ifdef YYERROR_VERBOSE\r
+      yyn = yypact[yystate];\r
+\r
+      if (yyn > YYFLAG && yyn < YYLAST)\r
+       {\r
+         YYSIZE_T yysize = 0;\r
+         char *yymsg;\r
+         int yyx, yycount;\r
+\r
+         yycount = 0;\r
+         /* Start YYX at -YYN if negative to avoid negative indexes in\r
+            YYCHECK.  */\r
+         for (yyx = yyn < 0 ? -yyn : 0;\r
+              yyx < (int) (sizeof (yytname) / sizeof (char *)); yyx++)\r
+           if (yycheck[yyx + yyn] == yyx)\r
+             yysize += yystrlen (yytname[yyx]) + 15, yycount++;\r
+         yysize += yystrlen ("parse error, unexpected ") + 1;\r
+         yysize += yystrlen (yytname[YYTRANSLATE (yychar)]);\r
+         yymsg = (char *) YYSTACK_ALLOC (yysize);\r
+         if (yymsg != 0)\r
+           {\r
+             char *yyp = yystpcpy (yymsg, "parse error, unexpected ");\r
+             yyp = yystpcpy (yyp, yytname[YYTRANSLATE (yychar)]);\r
+\r
+             if (yycount < 5)\r
+               {\r
+                 yycount = 0;\r
+                 for (yyx = yyn < 0 ? -yyn : 0;\r
+                      yyx < (int) (sizeof (yytname) / sizeof (char *));\r
+                      yyx++)\r
+                   if (yycheck[yyx + yyn] == yyx)\r
+                     {\r
+                       const char *yyq = ! yycount ? ", expecting " : " or ";\r
+                       yyp = yystpcpy (yyp, yyq);\r
+                       yyp = yystpcpy (yyp, yytname[yyx]);\r
+                       yycount++;\r
+                     }\r
+               }\r
+             yyerror (yymsg);\r
+             YYSTACK_FREE (yymsg);\r
+           }\r
+         else\r
+           yyerror ("parse error; also virtual memory exhausted");\r
+       }\r
+      else\r
+#endif /* defined (YYERROR_VERBOSE) */\r
+       yyerror ("parse error");\r
+    }\r
+  goto yyerrlab1;\r
+\r
+\r
+/*--------------------------------------------------.\r
+| yyerrlab1 -- error raised explicitly by an action |\r
+`--------------------------------------------------*/\r
+yyerrlab1:\r
+  if (yyerrstatus == 3)\r
+    {\r
+      /* If just tried and failed to reuse lookahead token after an\r
+        error, discard it.  */\r
+\r
+      /* return failure if at end of input */\r
+      if (yychar == YYEOF)\r
+       YYABORT;\r
+      YYDPRINTF ((stderr, "Discarding token %d (%s).\n",\r
+                 yychar, yytname[yychar1]));\r
+      yychar = YYEMPTY;\r
+    }\r
+\r
+  /* Else will try to reuse lookahead token after shifting the error\r
+     token.  */\r
+\r
+  yyerrstatus = 3;             /* Each real token shifted decrements this */\r
+\r
+  goto yyerrhandle;\r
+\r
+\r
+/*-------------------------------------------------------------------.\r
+| yyerrdefault -- current state does not do anything special for the |\r
+| error token.                                                       |\r
+`-------------------------------------------------------------------*/\r
+yyerrdefault:\r
+#if 0\r
+  /* This is wrong; only states that explicitly want error tokens\r
+     should shift them.  */\r
+\r
+  /* If its default is to accept any token, ok.  Otherwise pop it.  */\r
+  yyn = yydefact[yystate];\r
+  if (yyn)\r
+    goto yydefault;\r
+#endif\r
+\r
+\r
+/*---------------------------------------------------------------.\r
+| yyerrpop -- pop the current state because it cannot handle the |\r
+| error token                                                    |\r
+`---------------------------------------------------------------*/\r
+yyerrpop:\r
+  if (yyssp == yyss)\r
+    YYABORT;\r
+  yyvsp--;\r
+  yystate = *--yyssp;\r
+#if YYLSP_NEEDED\r
+  yylsp--;\r
+#endif\r
+\r
+#if YYDEBUG\r
+  if (yydebug)\r
+    {\r
+      short *yyssp1 = yyss - 1;\r
+      YYFPRINTF (stderr, "Error: state stack now");\r
+      while (yyssp1 != yyssp)\r
+       YYFPRINTF (stderr, " %d", *++yyssp1);\r
+      YYFPRINTF (stderr, "\n");\r
+    }\r
+#endif\r
+\r
+/*--------------.\r
+| yyerrhandle.  |\r
+`--------------*/\r
+yyerrhandle:\r
+  yyn = yypact[yystate];\r
+  if (yyn == YYFLAG)\r
+    goto yyerrdefault;\r
+\r
+  yyn += YYTERROR;\r
+  if (yyn < 0 || yyn > YYLAST || yycheck[yyn] != YYTERROR)\r
+    goto yyerrdefault;\r
+\r
+  yyn = yytable[yyn];\r
+  if (yyn < 0)\r
+    {\r
+      if (yyn == YYFLAG)\r
+       goto yyerrpop;\r
+      yyn = -yyn;\r
+      goto yyreduce;\r
+    }\r
+  else if (yyn == 0)\r
+    goto yyerrpop;\r
+\r
+  if (yyn == YYFINAL)\r
+    YYACCEPT;\r
+\r
+  YYDPRINTF ((stderr, "Shifting error token, "));\r
+\r
+  *++yyvsp = yylval;\r
+#if YYLSP_NEEDED\r
+  *++yylsp = yylloc;\r
+#endif\r
+\r
+  yystate = yyn;\r
+  goto yynewstate;\r
+\r
+\r
+/*-------------------------------------.\r
+| yyacceptlab -- YYACCEPT comes here.  |\r
+`-------------------------------------*/\r
+yyacceptlab:\r
+  yyresult = 0;\r
+  goto yyreturn;\r
+\r
+/*-----------------------------------.\r
+| yyabortlab -- YYABORT comes here.  |\r
+`-----------------------------------*/\r
+yyabortlab:\r
+  yyresult = 1;\r
+  goto yyreturn;\r
+\r
+/*---------------------------------------------.\r
+| yyoverflowab -- parser overflow comes here.  |\r
+`---------------------------------------------*/\r
+yyoverflowlab:\r
+  yyerror ("parser stack overflow");\r
+  yyresult = 2;\r
+  /* Fall through.  */\r
+\r
+yyreturn:\r
+#ifndef yyoverflow\r
+  if (yyss != yyssa)\r
+    YYSTACK_FREE (yyss);\r
+#endif\r
+  return yyresult;\r
+}\r
+#line 503 "./cond.y"\r
+\r
+\r
+\r
+static int COND_IsAlpha( WCHAR x )\r
+{\r
+    return( ( ( x >= 'A' ) && ( x <= 'Z' ) ) ||\r
+            ( ( x >= 'a' ) && ( x <= 'z' ) ) ||\r
+            ( ( x == '_' ) ) );\r
+}\r
+\r
+static int COND_IsNumber( WCHAR x )\r
+{\r
+    return( (( x >= '0' ) && ( x <= '9' ))  || (x =='-') || (x =='.') );\r
+}\r
+\r
+\r
+/* the mess of comparison functions */\r
+\r
+static INT comp_lt_i(INT a, INT b)\r
+{ return (a < b); }\r
+static INT comp_gt_i(INT a, INT b)\r
+{ return (a > b); }\r
+static INT comp_le_i(INT a, INT b)\r
+{ return (a <= b); }\r
+static INT comp_ge_i(INT a, INT b)\r
+{ return (a >= b); }\r
+static INT comp_eq_i(INT a, INT b)\r
+{ return (a == b); }\r
+static INT comp_ne_i(INT a, INT b)\r
+{ return (a != b); }\r
+static INT comp_bitand(INT a, INT b)\r
+{ return a & b;}\r
+static INT comp_highcomp(INT a, INT b)\r
+{ return HIWORD(a)==b; }\r
+static INT comp_lowcomp(INT a, INT b)\r
+{ return LOWORD(a)==b; }\r
+\r
+static INT comp_eq_s(LPWSTR a, LPWSTR b, BOOL casless)\r
+{ if (casless) return !strcmpiW(a,b); else return !strcmpW(a,b);}\r
+static INT comp_ne_s(LPWSTR a, LPWSTR b, BOOL casless)\r
+{ if (casless) return strcmpiW(a,b); else  return strcmpW(a,b);}\r
+static INT comp_lt_s(LPWSTR a, LPWSTR b, BOOL casless)\r
+{ if (casless) return strcmpiW(a,b)<0; else return strcmpW(a,b)<0;}\r
+static INT comp_gt_s(LPWSTR a, LPWSTR b, BOOL casless)\r
+{ if (casless) return strcmpiW(a,b)>0; else return strcmpW(a,b)>0;}\r
+static INT comp_le_s(LPWSTR a, LPWSTR b, BOOL casless)\r
+{ if (casless) return strcmpiW(a,b)<=0; else return strcmpW(a,b)<=0;}\r
+static INT comp_ge_s(LPWSTR a, LPWSTR b, BOOL casless)\r
+{ if (casless) return strcmpiW(a,b)>=0; else return  strcmpW(a,b)>=0;}\r
+static INT comp_substring(LPWSTR a, LPWSTR b, BOOL casless)\r
+/* ERROR NOT WORKING REWRITE */\r
+{ if (casless) return strstrW(a,b)!=NULL; else return strstrW(a,b)!=NULL;}\r
+static INT comp_start(LPWSTR a, LPWSTR b, BOOL casless)\r
+{ if (casless) return strncmpiW(a,b,strlenW(b))==0; \r
+  else return strncmpW(a,b,strlenW(b))==0;}\r
+static INT comp_end(LPWSTR a, LPWSTR b, BOOL casless)\r
+{ \r
+    int i = strlenW(a); \r
+    int j = strlenW(b); \r
+    if (j>i)\r
+        return 0;\r
+    if (casless) return (!strcmpiW(&a[i-j-1],b));\r
+    else  return (!strcmpW(&a[i-j-1],b));\r
+}\r
+\r
+\r
+static INT comp_eq_m1(LPWSTR a, INT b)\r
+{ if (COND_IsNumber(a[0])) return atoiW(a)==b; else return 0;}\r
+static INT comp_ne_m1(LPWSTR a, INT b)\r
+{ if (COND_IsNumber(a[0])) return atoiW(a)!=b; else return 1;}\r
+static INT comp_lt_m1(LPWSTR a, INT b)\r
+{ if (COND_IsNumber(a[0])) return atoiW(a)<b; else return 0;}\r
+static INT comp_gt_m1(LPWSTR a, INT b)\r
+{ if (COND_IsNumber(a[0])) return atoiW(a)>b; else return 0;}\r
+static INT comp_le_m1(LPWSTR a, INT b)\r
+{ if (COND_IsNumber(a[0])) return atoiW(a)<=b; else return 0;}\r
+static INT comp_ge_m1(LPWSTR a, INT b)\r
+{ if (COND_IsNumber(a[0])) return atoiW(a)>=b; else return 0;}\r
+\r
+static INT comp_eq_m2(INT a, LPWSTR b)\r
+{ if (COND_IsNumber(b[0])) return a == atoiW(b); else return 0;}\r
+static INT comp_ne_m2(INT a, LPWSTR b)\r
+{ if (COND_IsNumber(b[0])) return a != atoiW(b); else return 1;}\r
+static INT comp_lt_m2(INT a, LPWSTR b)\r
+{ if (COND_IsNumber(b[0])) return a < atoiW(b); else return 0;}\r
+static INT comp_gt_m2(INT a, LPWSTR b)\r
+{ if (COND_IsNumber(b[0])) return a > atoiW(b); else return 0;}\r
+static INT comp_le_m2(INT a, LPWSTR b)\r
+{ if (COND_IsNumber(b[0])) return a <= atoiW(b); else return 0;}\r
+static INT comp_ge_m2(INT a, LPWSTR b)\r
+{ if (COND_IsNumber(b[0])) return a >= atoiW(b); else return 0;}\r
+\r
+\r
+\r
+static int COND_IsIdent( WCHAR x )\r
+{\r
+    return( COND_IsAlpha( x ) || COND_IsNumber( x ) || ( x == '_' ) \r
+            || ( x == '#' ) || (x == '.') );\r
+}\r
+\r
+static int COND_GetOne( struct cond_str *str, COND_input *cond )\r
+{\r
+    static const WCHAR szNot[] = {'N','O','T',0};\r
+    static const WCHAR szAnd[] = {'A','N','D',0};\r
+    static const WCHAR szOr[] = {'O','R',0};\r
+    WCHAR ch;\r
+    int rc, len = 1;\r
+\r
+    str->data = &cond->str[cond->n];\r
+\r
+    ch = str->data[0];\r
+    switch( ch )\r
+    {\r
+    case 0: return 0;\r
+    case '(': rc = COND_LPAR; break;\r
+    case ')': rc = COND_RPAR; break;\r
+    case '&': rc = COND_AMPER; break;\r
+    case '!': rc = COND_EXCLAM; break;\r
+    case '$': rc = COND_DOLLARS; break;\r
+    case '?': rc = COND_QUESTION; break;\r
+    case '%': rc = COND_PERCENT; break;\r
+    case ' ': rc = COND_SPACE; break;\r
+    case '=': rc = COND_EQ; break;\r
+    case '~': rc = COND_TILDA; break;\r
+    case '<': rc = COND_LT; break;\r
+    case '>': rc = COND_GT; break;\r
+    case '"':\r
+       {\r
+           const WCHAR *ch2 = str->data + 1;\r
+\r
+\r
+           while ( *ch2 && *ch2 != '"' )\r
+               ++ch2;\r
+           if (*ch2 == '"')\r
+           {\r
+               len = ch2 - str->data + 1;\r
+               rc = COND_LITER;\r
+               break;\r
+           }\r
+       }\r
+       ERR("Unterminated string\n");\r
+       rc = COND_ERROR;\r
+       break;\r
+    default: \r
+        if( COND_IsAlpha( ch ) )\r
+        {\r
+            while( COND_IsIdent( str->data[len] ) )\r
+                len++;\r
+            rc = COND_IDENT;\r
+            break;\r
+        }\r
+\r
+        if( COND_IsNumber( ch ) )\r
+        {\r
+            while( COND_IsNumber( str->data[len] ) )\r
+                len++;\r
+            rc = COND_NUMBER;\r
+            break;\r
+        }\r
+\r
+        ERR("Got unknown character %c(%x)\n",ch,ch);\r
+        rc = COND_ERROR;\r
+        break;\r
+    }\r
+\r
+    /* keyword identifiers */\r
+    if( rc == COND_IDENT )\r
+    {\r
+        if( (len==3) && (strncmpiW(str->data,szNot,len)==0) )\r
+            rc = COND_NOT;\r
+        else if( (len==3) && (strncmpiW(str->data,szAnd,len)==0) )\r
+            rc = COND_AND;\r
+        else if( (len==2) && (strncmpiW(str->data,szOr,len)==0) )\r
+            rc = COND_OR;\r
+    }\r
+\r
+    cond->n += len;\r
+    str->len = len;\r
+\r
+    return rc;\r
+}\r
+\r
+static int COND_lex( void *COND_lval, COND_input *cond )\r
+{\r
+    int rc;\r
+    struct cond_str *str = COND_lval;\r
+\r
+    do {\r
+        rc = COND_GetOne( str, cond );\r
+    } while (rc == COND_SPACE);\r
+    \r
+    return rc;\r
+}\r
+\r
+static LPWSTR COND_GetString( struct cond_str *str )\r
+{\r
+    LPWSTR ret;\r
+\r
+    ret = HeapAlloc( GetProcessHeap(), 0, (str->len+1) * sizeof (WCHAR) );\r
+    if( ret )\r
+    {\r
+        memcpy( ret, str->data, str->len * sizeof(WCHAR));\r
+        ret[str->len]=0;\r
+    }\r
+    TRACE("Got identifier %s\n",debugstr_w(ret));\r
+    return ret;\r
+}\r
+\r
+static LPWSTR COND_GetLiteral( struct cond_str *str )\r
+{\r
+    LPWSTR ret;\r
+\r
+    ret = HeapAlloc( GetProcessHeap(), 0, (str->len-1) * sizeof (WCHAR) );\r
+    if( ret )\r
+    {\r
+        memcpy( ret, str->data+1, (str->len-2) * sizeof(WCHAR) );\r
+        ret[str->len - 2]=0;\r
+    }\r
+    TRACE("Got literal %s\n",debugstr_w(ret));\r
+    return ret;\r
+}\r
+\r
+static int COND_error(char *str)\r
+{\r
+    return 0;\r
+}\r
+\r
+MSICONDITION MSI_EvaluateConditionW( MSIPACKAGE *package, LPCWSTR szCondition )\r
+{\r
+    COND_input cond;\r
+    MSICONDITION r;\r
+\r
+    cond.package = package;\r
+    cond.str   = szCondition;\r
+    cond.n     = 0;\r
+    cond.result = -1;\r
+    \r
+    TRACE("Evaluating %s\n",debugstr_w(szCondition));    \r
+\r
+    if ( szCondition == NULL || szCondition[0] == 0)\r
+       r = MSICONDITION_NONE;\r
+    else if ( !COND_parse( &cond ) )\r
+        r = cond.result;\r
+    else\r
+        r = MSICONDITION_ERROR;\r
+\r
+    TRACE("Evaluates to %i\n",r);\r
+    return r;\r
+}\r
+\r
+MSICONDITION WINAPI MsiEvaluateConditionW( MSIHANDLE hInstall, LPCWSTR szCondition )\r
+{\r
+    MSIPACKAGE *package;\r
+    UINT ret;\r
+\r
+    package = msihandle2msiinfo( hInstall, MSIHANDLETYPE_PACKAGE);\r
+    if( !package)\r
+        return ERROR_INVALID_HANDLE;\r
+    ret = MSI_EvaluateConditionW( package, szCondition );\r
+    msiobj_release( &package->hdr );\r
+    return ret;\r
+}\r
+\r
+MSICONDITION WINAPI MsiEvaluateConditionA( MSIHANDLE hInstall, LPCSTR szCondition )\r
+{\r
+    LPWSTR szwCond = NULL;\r
+    MSICONDITION r;\r
+\r
+    if( szCondition )\r
+    {\r
+        UINT len = MultiByteToWideChar( CP_ACP, 0, szCondition, -1, NULL, 0 );\r
+        szwCond = HeapAlloc( GetProcessHeap(), 0, len * sizeof (WCHAR) );\r
+        MultiByteToWideChar( CP_ACP, 0, szCondition, -1, szwCond, len );\r
+    }\r
+\r
+    r = MsiEvaluateConditionW( hInstall, szwCond );\r
+\r
+    HeapFree( GetProcessHeap(), 0, szwCond );\r
+\r
+    return r;\r
+}\r
index 8be1d2e..fd995b8 100644 (file)
@@ -181,7 +181,7 @@ term:
         }\r
   | value_s\r
         {\r
-            $$ = $1[0] ? MSICONDITION_TRUE : MSICONDITION_FALSE;\r
+            $$ = ($1 && $1[0]) ? MSICONDITION_TRUE : MSICONDITION_FALSE;\r
         }\r
   | value_i comp_op_i value_i\r
         {\r
@@ -739,7 +739,9 @@ MSICONDITION MSI_EvaluateConditionW( MSIPACKAGE *package, LPCWSTR szCondition )
     \r
     TRACE("Evaluating %s\n",debugstr_w(szCondition));    \r
 \r
-    if( szCondition && !COND_parse( &cond ) )\r
+    if ( szCondition == NULL || szCondition[0] == 0)\r
+       r = MSICONDITION_NONE;\r
+    else if ( !COND_parse( &cond ) )\r
         r = cond.result;\r
     else\r
         r = MSICONDITION_ERROR;\r
index b22a2aa..bbf9042 100644 (file)
@@ -201,20 +201,10 @@ static UINT CREATE_modify( struct tagMSIVIEW *view, MSIMODIFY eModifyMode,
 static UINT CREATE_delete( struct tagMSIVIEW *view )\r
 {\r
     MSICREATEVIEW *cv = (MSICREATEVIEW*)view;\r
-    create_col_info *col;\r
 \r
     TRACE("%p\n", cv );\r
 \r
-    col = cv->col_info; \r
-    while( col )\r
-    {\r
-        create_col_info *t = col;\r
-        col = col->next;\r
-        HeapFree( GetProcessHeap(), 0, t->colname );\r
-        HeapFree( GetProcessHeap(), 0, t );\r
-    }\r
     msiobj_release( &cv->db->hdr );\r
-    HeapFree( GetProcessHeap(), 0, cv->name );\r
     HeapFree( GetProcessHeap(), 0, cv );\r
 \r
     return ERROR_SUCCESS;\r
@@ -250,7 +240,7 @@ UINT CREATE_CreateView( MSIDATABASE *db, MSIVIEW **view, LPWSTR table,
     cv->view.ops = &create_ops;\r
     msiobj_addref( &db->hdr );\r
     cv->db = db;\r
-    cv->name = table;  /* FIXME: strdupW it? */\r
+    cv->name = table;\r
     cv->col_info = col_info;\r
     cv->bIsTemp = temp;\r
     *view = (MSIVIEW*) cv;\r
index b9e70cf..4465fc2 100644 (file)
@@ -80,9 +80,10 @@ UINT ACTION_CustomAction(MSIPACKAGE *package,LPCWSTR action, BOOL execute)
     MSIQUERY * view;
     MSIRECORD * row = 0;
     static const WCHAR ExecSeqQuery[] =
-    {'s','e','l','e','c','t',' ','*',' ','f','r','o','m',' ','C','u','s','t','o'
-        ,'m','A','c','t','i','o','n',' ','w','h','e','r','e',' ','`','A','c','t','i'
-        ,'o','n','`',' ','=',' ','`','%','s','`',0};
+    {'S','E','L','E','C','T',' ','*',' ','F','R','O','M',' ',
+     '`','C','u','s','t','o' ,'m','A','c','t','i','o','n','`',
+     ' ','W','H','E','R','E',' ','`','A','c','t','i' ,'o','n','`',' ',
+     '=',' ','\'','%','s','\'',0};
     UINT type;
     LPWSTR source;
     LPWSTR target;
@@ -251,8 +252,9 @@ static UINT store_binary_to_temp(MSIPACKAGE *package, LPCWSTR source,
         MSIQUERY * view;
         MSIRECORD * row = 0;
         static const WCHAR fmt[] =
-        {'s','e','l','e','c','t',' ','*',' ','f','r','o','m',' ','B','i'
-,'n','a','r','y',' ','w','h','e','r','e',' ','N','a','m','e','=','`','%','s','`',0};
+        {'S','E','L','E','C','T',' ','*',' ','F','R','O','M',' ',
+         '`','B','i' ,'n','a','r','y','`',' ','W','H','E','R','E',
+         ' ','`','N','a','m','e','`',' ','=',' ','\'','%','s','\'',0};
         HANDLE the_file;
         CHAR buffer[1024];
 
@@ -333,7 +335,7 @@ static void file_running_action(MSIPACKAGE* package, HANDLE Handle,
 
 static UINT process_action_return_value(UINT type, HANDLE ThreadHandle)
 {
-    DWORD rc;
+    DWORD rc=0;
     
     if (type == 2)
     {
@@ -357,7 +359,8 @@ static UINT process_action_return_value(UINT type, HANDLE ThreadHandle)
         case ERROR_NO_MORE_ITEMS:
             return ERROR_SUCCESS;
         default:
-            return ERROR_FUNCTION_FAILED;
+            ERR("Invalid Return Code %lx\n",rc);
+            return ERROR_INSTALL_FAILURE;
     }
 }
 
@@ -372,9 +375,9 @@ static UINT process_handle(MSIPACKAGE* package, UINT type,
         /* synchronous */
         TRACE("Synchronous Execution of action %s\n",debugstr_w(Name));
         if (ProcessHandle)
-            msi_dialog_check_messages(package->dialog, ProcessHandle);
+            msi_dialog_check_messages(ProcessHandle);
         else
-            msi_dialog_check_messages(package->dialog, ThreadHandle);
+            msi_dialog_check_messages(ThreadHandle);
 
         if (!(type & 0x40))
         {
@@ -479,7 +482,7 @@ static DWORD WINAPI DllThread(LPVOID info)
     stuff = (thread_struct*)info;
     rc = ACTION_CallDllFunction(stuff);
 
-    TRACE("MSI Thread (0x%lx) finished\n",GetCurrentThreadId());
+    TRACE("MSI Thread (0x%lx) finished (rc %li)\n",GetCurrentThreadId(), rc);
     /* clse all handles for this thread */
     MsiCloseAllHandles();
     return rc;
@@ -630,7 +633,8 @@ static UINT HANDLE_CustomType19(MSIPACKAGE *package, LPCWSTR source,
     static const WCHAR query[] = {
       'S','E','L','E','C','T',' ','`','M','e','s','s','a','g','e','`',' ',
       'F','R','O','M',' ','`','E','r','r','o','r','`',' ',
-      'W','H','E','R','E',' ','`','E','r','r','o','r','`',' ','=',' ','%','s',0
+      'W','H','E','R','E',' ','`','E','r','r','o','r','`',' ','=',' ',
+      '\'','%','s','\'',0
     };
     MSIQUERY *view = NULL;
     MSIRECORD *row = 0;
@@ -685,7 +689,7 @@ static UINT HANDLE_CustomType50(MSIPACKAGE *package, LPCWSTR source,
 
     prop = load_dynamic_property(package,source,&prc);
     if (!prop)
-        return prc;
+        return ERROR_SUCCESS;
 
     deformat_string(package,target,&deformated);
     len = strlenW(prop) + 2;
@@ -782,8 +786,7 @@ void ACTION_FinishCustomActions(MSIPACKAGE* package)
         {
             TRACE("Waiting on action %s\n",
                debugstr_w(package->RunningAction[i].name));
-            msi_dialog_check_messages(package->dialog,
-                                      package->RunningAction[i].handle);
+            msi_dialog_check_messages(package->RunningAction[i].handle);
         }
 
         HeapFree(GetProcessHeap(),0,package->RunningAction[i].name);
index 6d7bd1b..800b1db 100644 (file)
@@ -65,6 +65,7 @@ VOID MSI_CloseDatabase( MSIOBJECTHDR *arg )
     DWORD r;
 
     free_cached_tables( db );
+    msi_destroy_stringtable( db->strings );
     r = IStorage_Release( db->storage );
     if( r )
         ERR("database reference count was not zero (%ld)\n", r);
@@ -213,7 +214,8 @@ UINT WINAPI MsiOpenDatabaseA(LPCSTR szDBPath, LPCSTR szPersist, MSIHANDLE *phDB)
     r = MsiOpenDatabaseW( szwDBPath, szwPersist, phDB );
 
 end:
-    HeapFree( GetProcessHeap(), 0, szwPersist );
+    if( HIWORD(szPersist) )
+        HeapFree( GetProcessHeap(), 0, szwPersist );
     HeapFree( GetProcessHeap(), 0, szwDBPath );
 
     return r;
@@ -334,7 +336,7 @@ UINT WINAPI MsiDatabaseExportA( MSIHANDLE handle, LPCSTR szTable,
             goto end;
     }
 
-    r = MsiDatabaseImportW( handle, path, file );
+    r = MsiDatabaseExportW( handle, table, path, file );
 
 end:
     HeapFree( GetProcessHeap(), 0, table );
index 19ab2d5..4977329 100644 (file)
@@ -44,6 +44,9 @@ WINE_DEFAULT_DEBUG_CHANNEL(msi);
 const WCHAR szMsiDialogClass[] = {
     'M','s','i','D','i','a','l','o','g','C','l','o','s','e','C','l','a','s','s',0
 };
+const WCHAR szMsiHiddenWindow[] = {
+    'M','s','i','H','i','d','d','e','n','W','i','n','d','o','w',0
+};
 const static WCHAR szStatic[] = { 'S','t','a','t','i','c',0 };
 const static WCHAR szButton[] = { 'B','U','T','T','O','N', 0 };
 
@@ -106,6 +109,14 @@ static UINT msi_dialog_radiogroup_handler( msi_dialog *, msi_control *, WPARAM p
 static LRESULT WINAPI MSIRadioGroup_WndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam);
 
 
+/* dialog sequencing */
+
+#define WM_MSI_DIALOG_CREATE  (WM_USER+0x100)
+#define WM_MSI_DIALOG_DESTROY (WM_USER+0x101)
+
+static DWORD uiThreadId;
+static HWND hMsiHiddenWindow;
+
 INT msi_dialog_scale_unit( msi_dialog *dialog, INT val )
 {
     return (dialog->scale * val + 5) / 10;
@@ -725,41 +736,51 @@ static INT msi_dialog_get_sans_serif_height( HWND hwnd )
     return height;
 }
 
-static LRESULT msi_dialog_oncreate( HWND hwnd, LPCREATESTRUCTW cs )
+/* fetch the associated record from the Dialog table */
+static MSIRECORD *msi_get_dialog_record( msi_dialog *dialog )
 {
     static const WCHAR query[] = {
         'S','E','L','E','C','T',' ','*',' ',
         'F','R','O','M',' ','D','i','a','l','o','g',' ',
         'W','H','E','R','E',' ',
            '`','D','i','a','l','o','g','`',' ','=',' ','\'','%','s','\'',0};
-    static const WCHAR df[] = {
-        'D','e','f','a','u','l','t','U','I','F','o','n','t',0 };
-    msi_dialog *dialog = (msi_dialog*) cs->lpCreateParams;
     MSIPACKAGE *package = dialog->package;
     MSIQUERY *view = NULL;
     MSIRECORD *rec = NULL;
-    DWORD width, height;
-    LPCWSTR text;
-    LPWSTR title = NULL;
     UINT r;
 
-    TRACE("%p %p\n", dialog, package);
-
-    dialog->hwnd = hwnd;
-    SetWindowLongPtrW( hwnd, GWLP_USERDATA, (LONG_PTR) dialog );
+    TRACE("%p %s\n", dialog, debugstr_w(dialog->name) );
 
-    /* fetch the associated record from the Dialog table */
     r = MSI_OpenQuery( package->db, &view, query, dialog->name );
     if( r != ERROR_SUCCESS )
     {
         ERR("query failed for dialog %s\n", debugstr_w(dialog->name));
-        return -1;
+        return NULL;
     }
     MSI_ViewExecute( view, NULL );
     MSI_ViewFetch( view, &rec );
     MSI_ViewClose( view );
     msiobj_release( &view->hdr );
 
+    return rec;
+}
+
+static LRESULT msi_dialog_oncreate( HWND hwnd, LPCREATESTRUCTW cs )
+{
+    static const WCHAR df[] = {
+        'D','e','f','a','u','l','t','U','I','F','o','n','t',0 };
+    msi_dialog *dialog = (msi_dialog*) cs->lpCreateParams;
+    MSIRECORD *rec = NULL;
+    DWORD width, height;
+    LPCWSTR text;
+    LPWSTR title = NULL;
+
+    TRACE("%p %p\n", dialog, dialog->package);
+
+    dialog->hwnd = hwnd;
+    SetWindowLongPtrW( hwnd, GWLP_USERDATA, (LONG_PTR) dialog );
+
+    rec = msi_get_dialog_record( dialog );
     if( !rec )
     {
         TRACE("No record found for dialog %s\n", debugstr_w(dialog->name));
@@ -1004,7 +1025,8 @@ static LRESULT WINAPI MSIDialog_WndProc( HWND hwnd, UINT msg,
 {
     msi_dialog *dialog = (LPVOID) GetWindowLongPtrW( hwnd, GWLP_USERDATA );
 
-    TRACE(" 0x%04x\n", msg);
+    TRACE("0x%04x\n", msg);
+
     switch (msg)
     {
     case WM_CREATE:
@@ -1020,13 +1042,43 @@ static LRESULT WINAPI MSIDialog_WndProc( HWND hwnd, UINT msg,
     return DefWindowProcW(hwnd, msg, wParam, lParam);
 }
 
+static LRESULT WINAPI MSIRadioGroup_WndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
+{
+    WNDPROC oldproc = (WNDPROC) GetPropW(hWnd, szButtonData);
+
+    TRACE("hWnd %p msg %04x wParam 0x%08x lParam 0x%08lx\n", hWnd, msg, wParam, lParam);
+
+    if (msg == WM_COMMAND) /* Forward notifications to dialog */
+        SendMessageW(GetParent(hWnd), msg, wParam, lParam);
+
+    return CallWindowProcW(oldproc, hWnd, msg, wParam, lParam);
+}
+
+static LRESULT WINAPI MSIHiddenWindowProc( HWND hwnd, UINT msg,
+                WPARAM wParam, LPARAM lParam )
+{
+    msi_dialog *dialog = (msi_dialog*) lParam;
+
+    TRACE("%d %p\n", msg, dialog);
+
+    switch (msg)
+    {
+    case WM_MSI_DIALOG_CREATE:
+        return msi_dialog_run_message_loop( dialog );
+    case WM_MSI_DIALOG_DESTROY:
+        msi_dialog_destroy( dialog );
+        return 0;
+    }
+    return DefWindowProcW( hwnd, msg, wParam, lParam );
+}
+
 /* functions that interface to other modules within MSI */
 
 msi_dialog *msi_dialog_create( MSIPACKAGE* package, LPCWSTR szDialogName,
                                 msi_dialog_event_handler event_handler )
 {
+    MSIRECORD *rec = NULL;
     msi_dialog *dialog;
-    HWND hwnd;
 
     TRACE("%p %s\n", package, debugstr_w(szDialogName));
 
@@ -1036,73 +1088,112 @@ msi_dialog *msi_dialog_create( MSIPACKAGE* package, LPCWSTR szDialogName,
     if( !dialog )
         return NULL;
     strcpyW( dialog->name, szDialogName );
+    msiobj_addref( &package->hdr );
     dialog->package = package;
     dialog->event_handler = event_handler;
+    dialog->finished = 0;
 
-    /* create the dialog window, don't show it yet */
-    hwnd = CreateWindowW( szMsiDialogClass, szDialogName, WS_OVERLAPPEDWINDOW,
-                     CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT,
-                     NULL, NULL, NULL, dialog );
-    if( !hwnd )
+    /* verify that the dialog exists */
+    rec = msi_get_dialog_record( dialog );
+    if( !rec )
     {
-        ERR("Failed to create dialog %s\n", debugstr_w( szDialogName ));
-        msi_dialog_destroy( dialog );
+        HeapFree( GetProcessHeap(), 0, dialog );
         return NULL;
     }
+    dialog->attributes = MSI_RecordGetInteger( rec, 6 );
+    msiobj_release( &rec->hdr );
 
     return dialog;
 }
 
+static void msi_process_pending_messages(void)
+{
+    MSG msg;
+
+    while( PeekMessageW( &msg, 0, 0, 0, PM_REMOVE ) )
+    {
+        TranslateMessage( &msg );
+        DispatchMessageW( &msg );
+    }
+}
+
 void msi_dialog_end_dialog( msi_dialog *dialog )
 {
+    TRACE("%p\n", dialog);
     dialog->finished = 1;
+    PostMessageW(dialog->hwnd, WM_NULL, 0, 0);
 }
 
-UINT msi_dialog_run_message_loop( msi_dialog *dialog )
+void msi_dialog_check_messages( HANDLE handle )
 {
-    MSG msg;
+    DWORD r;
 
-    if( dialog->attributes & msidbDialogAttributesVisible )
+    /* in threads other than the UI thread, block */
+    if( uiThreadId != GetCurrentThreadId() )
     {
-        ShowWindow( dialog->hwnd, SW_SHOW );
-        UpdateWindow( dialog->hwnd );
+        if( handle )
+            WaitForSingleObject( handle, INFINITE );
+        return;
     }
 
-    if( dialog->attributes & msidbDialogAttributesModal )
+    /* there's two choices for the UI thread */
+    while (1)
     {
-        while( !dialog->finished && GetMessageW( &msg, 0, 0, 0 ) )
-        {
-            TranslateMessage( &msg );
-            DispatchMessageW( &msg );
-        }
-    }
-    else
-        return ERROR_IO_PENDING;
+        msi_process_pending_messages();
 
-    return ERROR_SUCCESS;
+        if( !handle )
+            break;
+
+        /*
+         * block here until somebody creates a new dialog or
+         * the handle we're waiting on becomes ready
+         */
+        r = MsgWaitForMultipleObjects( 1, &handle, 0, INFINITE, QS_ALLINPUT );
+        if( r == WAIT_OBJECT_0 )
+            break;
+    }
 }
 
-void msi_dialog_check_messages( msi_dialog *dialog, HANDLE handle )
+UINT msi_dialog_run_message_loop( msi_dialog *dialog )
 {
-    MSG msg;
-    DWORD r;
+    HWND hwnd;
+
+    if( !(dialog->attributes & msidbDialogAttributesVisible) )
+        return ERROR_SUCCESS;
+
+    if( uiThreadId != GetCurrentThreadId() )
+        return SendMessageW( hMsiHiddenWindow, WM_MSI_DIALOG_CREATE, 0, (LPARAM) dialog );
+
+    /* create the dialog window, don't show it yet */
+    hwnd = CreateWindowW( szMsiDialogClass, dialog->name, WS_OVERLAPPEDWINDOW,
+                     CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT,
+                     NULL, NULL, NULL, dialog );
+    if( !hwnd )
+    {
+        ERR("Failed to create dialog %s\n", debugstr_w( dialog->name ));
+        return ERROR_FUNCTION_FAILED;
+    }
 
-    do
+    ShowWindow( hwnd, SW_SHOW );
+    UpdateWindow( hwnd );
+
+    if( dialog->attributes & msidbDialogAttributesModal )
     {
-        while( PeekMessageW( &msg, 0, 0, 0, PM_REMOVE ) )
+        while( !dialog->finished )
         {
-            TranslateMessage( &msg );
-            DispatchMessageW( &msg );
+            MsgWaitForMultipleObjects( 0, NULL, 0, INFINITE, QS_ALLEVENTS );
+            msi_process_pending_messages();
         }
-        if( !handle )
-            break;
-        r = MsgWaitForMultipleObjects( 1, &handle, 0, INFINITE, QS_ALLEVENTS );
     }
-    while( WAIT_OBJECT_0 != r );
+    else
+        return ERROR_IO_PENDING;
+
+    return ERROR_SUCCESS;
 }
 
 void msi_dialog_do_preview( msi_dialog *dialog )
 {
+    TRACE("\n");
     dialog->attributes |= msidbDialogAttributesVisible;
     dialog->attributes &= ~msidbDialogAttributesModal;
     msi_dialog_run_message_loop( dialog );
@@ -1110,6 +1201,12 @@ void msi_dialog_do_preview( msi_dialog *dialog )
 
 void msi_dialog_destroy( msi_dialog *dialog )
 {
+    if( uiThreadId != GetCurrentThreadId() )
+    {
+        SendMessageW( hMsiHiddenWindow, WM_MSI_DIALOG_DESTROY, 0, (LPARAM) dialog );
+        return;
+    }
+
     if( dialog->hwnd )
         ShowWindow( dialog->hwnd, SW_HIDE );
     
@@ -1138,11 +1235,12 @@ void msi_dialog_destroy( msi_dialog *dialog )
     if( dialog->hwnd )
         DestroyWindow( dialog->hwnd );
 
+    msiobj_release( &dialog->package->hdr );
     dialog->package = NULL;
     HeapFree( GetProcessHeap(), 0, dialog );
 }
 
-void msi_dialog_register_class( void )
+BOOL msi_dialog_register_class( void )
 {
     WNDCLASSW cls;
 
@@ -1155,22 +1253,28 @@ void msi_dialog_register_class( void )
     cls.lpszMenuName  = NULL;
     cls.lpszClassName = szMsiDialogClass;
 
-    RegisterClassW( &cls );
-}
+    if( !RegisterClassW( &cls ) )
+        return FALSE;
 
-void msi_dialog_unregister_class( void )
-{
-    UnregisterClassW( szMsiDialogClass, NULL );
-}
+    cls.lpfnWndProc   = MSIHiddenWindowProc;
+    cls.lpszClassName = szMsiHiddenWindow;
 
-static LRESULT WINAPI MSIRadioGroup_WndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
-{
-    WNDPROC oldproc = (WNDPROC) GetPropW(hWnd, szButtonData);
+    if( !RegisterClassW( &cls ) )
+        return FALSE;
 
-    TRACE("hWnd %p msg %04x wParam 0x%08x lParam 0x%08lx\n", hWnd, msg, wParam, lParam);
+    uiThreadId = GetCurrentThreadId();
 
-    if (msg == WM_COMMAND) /* Forward notifications to dialog */
-        SendMessageW(GetParent(hWnd), msg, wParam, lParam);
+    hMsiHiddenWindow = CreateWindowW( szMsiHiddenWindow, NULL, WS_OVERLAPPED,
+                                   0, 0, 100, 100, NULL, NULL, NULL, NULL );
+    if( !hMsiHiddenWindow )
+        return FALSE;
 
-    return CallWindowProcW(oldproc, hWnd, msg, wParam, lParam);
+    return TRUE;
+}
+
+void msi_dialog_unregister_class( void )
+{
+    DestroyWindow( hMsiHiddenWindow );
+    UnregisterClassW( szMsiDialogClass, NULL );
+    uiThreadId = 0;
 }
index 40dba1a..b8e6998 100644 (file)
@@ -233,7 +233,6 @@ static UINT INSERT_delete( struct tagMSIVIEW *view )
     sv = iv->sv;\r
     if( sv )\r
         sv->ops->delete( sv );\r
-    delete_value_list( iv->vals );\r
     msiobj_release( &iv->db->hdr );\r
     HeapFree( GetProcessHeap(), 0, iv );\r
 \r
index aabcd52..b1f3bab 100644 (file)
@@ -35,6 +35,8 @@
 #include "wincrypt.h"\r
 #include "winver.h"\r
 #include "winuser.h"\r
+#include "wine/unicode.h"\r
+#include "action.h"\r
 \r
 UINT WINAPI MsiGetFileVersionW(LPCWSTR szFilePath, LPWSTR lpVersionBuf, DWORD* pcchVersionBuf, LPWSTR lpLangBuf, DWORD* pcchLangBuf);\r
 \r
@@ -59,6 +61,8 @@ LPVOID gUIContext = NULL;
 WCHAR gszLogFile[MAX_PATH];\r
 HINSTANCE msi_hInstance;\r
 \r
+static const WCHAR installerW[] = {'\\','I','n','s','t','a','l','l','e','r',0};\r
+\r
 UINT WINAPI MsiOpenProductA(LPCSTR szProduct, MSIHANDLE *phProduct)\r
 {\r
     UINT r;\r
@@ -252,7 +256,7 @@ UINT WINAPI MsiApplyPatchW(LPCWSTR szPatchPackage, LPCWSTR szInstallPackage,
 UINT WINAPI MsiConfigureProductExW(LPCWSTR szProduct, int iInstallLevel,\r
                         INSTALLSTATE eInstallState, LPCWSTR szCommandLine)\r
 {\r
-    MSIHANDLE handle;\r
+    MSIHANDLE handle = -1;\r
     MSIPACKAGE* package;\r
     UINT rc;\r
     HKEY hkey=0,hkey1=0;\r
@@ -330,6 +334,8 @@ UINT WINAPI MsiConfigureProductExW(LPCWSTR szProduct, int iInstallLevel,
     HeapFree(GetProcessHeap(),0,commandline);\r
 end:\r
     RegCloseKey(hkey);\r
+    if (handle != -1)\r
+        MsiCloseHandle(handle);\r
 \r
     return rc;\r
 }\r
@@ -420,11 +426,38 @@ UINT WINAPI MsiGetProductCodeA(LPCSTR szComponent, LPSTR szBuffer)
 \r
 UINT WINAPI MsiGetProductCodeW(LPCWSTR szComponent, LPWSTR szBuffer)\r
 {\r
-    FIXME("%s %p\n",debugstr_w(szComponent), szBuffer);\r
+    UINT rc;\r
+    HKEY hkey;\r
+    WCHAR szSquished[GUID_SIZE];\r
+    DWORD sz = GUID_SIZE;\r
+    static const WCHAR szPermKey[] =\r
+        { '0','0','0','0','0','0','0','0','0','0','0','0',\r
+          '0','0','0','0','0','0','0', '0','0','0','0','0',\r
+          '0','0','0','0','0','0','0','0',0};\r
+\r
+    TRACE("%s %p\n",debugstr_w(szComponent), szBuffer);\r
 \r
     if (NULL == szComponent)\r
         return ERROR_INVALID_PARAMETER;\r
-    return ERROR_CALL_NOT_IMPLEMENTED;\r
+\r
+    rc = MSIREG_OpenComponentsKey( szComponent, &hkey, FALSE);\r
+    if (rc != ERROR_SUCCESS)\r
+        return ERROR_UNKNOWN_COMPONENT;\r
+\r
+    rc = RegEnumValueW(hkey, 0, szSquished, &sz, NULL, NULL, NULL, NULL);\r
+    if (rc == ERROR_SUCCESS && strcmpW(szSquished,szPermKey)==0)\r
+    {\r
+        sz = GUID_SIZE;\r
+        rc = RegEnumValueW(hkey, 1, szSquished, &sz, NULL, NULL, NULL, NULL);\r
+    }\r
+\r
+    RegCloseKey(hkey);\r
+\r
+    if (rc != ERROR_SUCCESS)\r
+        return ERROR_INSTALL_FAILURE;\r
+\r
+    unsquash_guid(szSquished, szBuffer);\r
+    return ERROR_SUCCESS;\r
 }\r
 \r
 UINT WINAPI MsiGetProductInfoA(LPCSTR szProduct, LPCSTR szAttribute,\r
@@ -475,6 +508,14 @@ UINT WINAPI MsiGetProductInfoW(LPCWSTR szProduct, LPCWSTR szAttribute,
 {\r
     MSIHANDLE hProduct;\r
     UINT r;\r
+    static const WCHAR szPackageCode[] =\r
+        {'P','a','c','k','a','g','e','C','o','d','e',0};\r
+    static const WCHAR szVersionString[] =\r
+        {'V','e','r','s','i','o','n','S','t','r','i','n','g',0};\r
+    static const WCHAR szProductVersion[] =\r
+        {'P','r','o','d','u','c','t','V','e','r','s','i','o','n',0};\r
+    static const WCHAR szAssignmentType[] =\r
+        {'A','s','s','i','g','n','m','e','n','t','T','y','p','e',0};\r
 \r
     FIXME("%s %s %p %p\n",debugstr_w(szProduct), debugstr_w(szAttribute),\r
           szBuffer, pcchValueBuf);\r
@@ -483,13 +524,66 @@ UINT WINAPI MsiGetProductInfoW(LPCWSTR szProduct, LPCWSTR szAttribute,
         return ERROR_INVALID_PARAMETER;\r
     if (NULL == szProduct || NULL == szAttribute)\r
         return ERROR_INVALID_PARAMETER;\r
+    \r
+    /* check for special properties */\r
+    if (strcmpW(szAttribute, szPackageCode)==0)\r
+    {\r
+        HKEY hkey;\r
+        WCHAR squished[GUID_SIZE];\r
+        WCHAR package[200];\r
+        DWORD sz = sizeof(squished);\r
+\r
+        r = MSIREG_OpenUserProductsKey(szProduct, &hkey, FALSE);\r
+        if (r != ERROR_SUCCESS)\r
+            return ERROR_UNKNOWN_PRODUCT;\r
+\r
+        r = RegQueryValueExW(hkey, szPackageCode, NULL, NULL, \r
+                        (LPBYTE)squished, &sz);\r
+        if (r != ERROR_SUCCESS)\r
+        {\r
+            RegCloseKey(hkey);\r
+            return ERROR_UNKNOWN_PRODUCT;\r
+        }\r
 \r
-    r = MsiOpenProductW(szProduct, &hProduct);\r
-    if (ERROR_SUCCESS != r)\r
-        return r;\r
+        unsquash_guid(squished, package);\r
+        *pcchValueBuf = strlenW(package);\r
+        if (strlenW(package) > *pcchValueBuf)\r
+        {\r
+            RegCloseKey(hkey);\r
+            return ERROR_MORE_DATA;\r
+        }\r
+        else\r
+            strcpyW(szBuffer, package);\r
+\r
+        RegCloseKey(hkey);\r
+        r = ERROR_SUCCESS;\r
+    }\r
+    else if (strcmpW(szAttribute, szVersionString)==0)\r
+    {\r
+        r = MsiOpenProductW(szProduct, &hProduct);\r
+        if (ERROR_SUCCESS != r)\r
+            return r;\r
+\r
+        r = MsiGetPropertyW(hProduct, szProductVersion, szBuffer, pcchValueBuf);\r
+        MsiCloseHandle(hProduct);\r
+    }\r
+    else if (strcmpW(szAttribute, szAssignmentType)==0)\r
+    {\r
+        FIXME("0 (zero) if advertised, 1(one) if per machine.\n");\r
+        if (szBuffer)\r
+            szBuffer[0] = 1;\r
+        r = ERROR_SUCCESS;\r
+    }\r
+    else\r
+    {\r
+        r = MsiOpenProductW(szProduct, &hProduct);\r
+        if (ERROR_SUCCESS != r)\r
+            return r;\r
+\r
+        r = MsiGetPropertyW(hProduct, szAttribute, szBuffer, pcchValueBuf);\r
+        MsiCloseHandle(hProduct);\r
+    }\r
 \r
-    r = MsiGetPropertyW(hProduct, szAttribute, szBuffer, pcchValueBuf);\r
-    MsiCloseHandle(hProduct);\r
     return r;\r
 }\r
 \r
@@ -970,6 +1064,9 @@ end:
     return rrc;\r
 }\r
 \r
+/******************************************************************\r
+ * MsiQueryFeatureStateA      [MSI.@]\r
+ */\r
 INSTALLSTATE WINAPI MsiQueryFeatureStateA(LPCSTR szProduct, LPCSTR szFeature)\r
 {\r
     INSTALLSTATE rc;\r
@@ -1001,15 +1098,37 @@ INSTALLSTATE WINAPI MsiQueryFeatureStateA(LPCSTR szProduct, LPCSTR szFeature)
     return rc;\r
 }\r
 \r
+/******************************************************************\r
+ * MsiQueryFeatureStateW      [MSI.@]\r
+ *\r
+ * This does not verify that the Feature is functional. So i am only going to\r
+ * check the existence of the key in the registry. This should tell me if it is\r
+ * installed.\r
+ */\r
 INSTALLSTATE WINAPI MsiQueryFeatureStateW(LPCWSTR szProduct, LPCWSTR szFeature)\r
 {\r
-    FIXME("%s %s\n", debugstr_w(szProduct), debugstr_w(szFeature));\r
-    /*\r
-     * Iterates all the features components and the features parents components\r
-     */\r
-    return INSTALLSTATE_LOCAL;\r
+    UINT rc;\r
+    DWORD sz = 0;\r
+    HKEY hkey;\r
+\r
+    TRACE("%s %s\n", debugstr_w(szProduct), debugstr_w(szFeature));\r
+\r
+    rc = MSIREG_OpenFeaturesKey(szProduct, &hkey, FALSE);\r
+    if (rc != ERROR_SUCCESS)\r
+        return INSTALLSTATE_UNKNOWN;\r
+\r
+    rc = RegQueryValueExW( hkey, szFeature, NULL, NULL, NULL, &sz);\r
+    RegCloseKey(hkey);\r
+\r
+    if (rc == ERROR_SUCCESS)\r
+        return INSTALLSTATE_LOCAL;\r
+    else\r
+        return INSTALLSTATE_ABSENT;\r
 }\r
 \r
+/******************************************************************\r
+ * MsiGetFileVersionA         [MSI.@]\r
+ */\r
 UINT WINAPI MsiGetFileVersionA(LPCSTR szFilePath, LPSTR lpVersionBuf,\r
                 DWORD* pcchVersionBuf, LPSTR lpLangBuf, DWORD* pcchLangBuf)\r
 {\r
@@ -1055,6 +1174,9 @@ end:
     return ret;\r
 }\r
 \r
+/******************************************************************\r
+ * MsiGetFileVersionW         [MSI.@]\r
+ */\r
 UINT WINAPI MsiGetFileVersionW(LPCWSTR szFilePath, LPWSTR lpVersionBuf,\r
                 DWORD* pcchVersionBuf, LPWSTR lpLangBuf, DWORD* pcchLangBuf)\r
 {\r
@@ -1195,7 +1317,7 @@ static IClassFactoryVtbl MsiCF_Vtbl =
 static IClassFactoryImpl Msi_CF = { &MsiCF_Vtbl };\r
 \r
 /******************************************************************\r
- *     DllGetClassObject [MSI.@]\r
+ * DllGetClassObject          [MSI.@]\r
  */\r
 HRESULT WINAPI MSI_DllGetClassObject(REFCLSID rclsid, REFIID riid, LPVOID *ppv)\r
 {\r
@@ -1214,7 +1336,7 @@ HRESULT WINAPI MSI_DllGetClassObject(REFCLSID rclsid, REFIID riid, LPVOID *ppv)
 }\r
 \r
 /******************************************************************\r
- *     DllGetVersion [MSI.@]\r
+ * DllGetVersion              [MSI.@]\r
  */\r
 HRESULT WINAPI MSI_DllGetVersion(DLLVERSIONINFO *pdvi)\r
 {\r
@@ -1232,7 +1354,7 @@ HRESULT WINAPI MSI_DllGetVersion(DLLVERSIONINFO *pdvi)
 }\r
 \r
 /******************************************************************\r
- *     DllCanUnloadNow [MSI.@]\r
+ * DllCanUnloadNow            [MSI.@]\r
  */\r
 BOOL WINAPI MSI_DllCanUnloadNow(void)\r
 {\r
@@ -1272,6 +1394,9 @@ INSTALLSTATE WINAPI MsiUseFeatureExW(LPCWSTR szProduct, LPCWSTR szFeature,
     return INSTALLSTATE_LOCAL;\r
 }\r
 \r
+/***********************************************************************\r
+ * MsiUseFeatureExA           [MSI.@]\r
+ */\r
 INSTALLSTATE WINAPI MsiUseFeatureExA(LPCSTR szProduct, LPCSTR szFeature,\r
                              DWORD dwInstallMode, DWORD dwReserved)\r
 {\r
@@ -1300,22 +1425,191 @@ UINT WINAPI MsiProvideQualifiedComponentExW(LPCWSTR szComponent,
                 DWORD Unused1, DWORD Unused2, LPWSTR lpPathBuf,\r
                 DWORD* pcchPathBuf)\r
 {\r
-    FIXME("%s %s %li %s %li %li %p %p\n", debugstr_w(szComponent),\r
+    HKEY hkey;\r
+    UINT rc;\r
+    LPWSTR info;\r
+    DWORD sz;\r
+    LPWSTR product = NULL;\r
+    LPWSTR component = NULL;\r
+    LPWSTR ptr;\r
+    GUID clsid;\r
+\r
+    TRACE("%s %s %li %s %li %li %p %p\n", debugstr_w(szComponent),\r
           debugstr_w(szQualifier), dwInstallMode, debugstr_w(szProduct),\r
           Unused1, Unused2, lpPathBuf, pcchPathBuf);\r
+   \r
+    rc = MSIREG_OpenUserComponentsKey(szComponent, &hkey, FALSE);\r
+    if (rc != ERROR_SUCCESS)\r
+        return ERROR_INDEX_ABSENT;\r
 \r
-    return ERROR_INDEX_ABSENT;\r
+    sz = 0;\r
+    rc = RegQueryValueExW( hkey, szQualifier, NULL, NULL, NULL, &sz);\r
+    if (sz <= 0)\r
+    {\r
+        RegCloseKey(hkey);\r
+        return ERROR_INDEX_ABSENT;\r
+    }\r
+\r
+    info = HeapAlloc(GetProcessHeap(),0,sz);\r
+    rc = RegQueryValueExW( hkey, szQualifier, NULL, NULL, (LPBYTE)info, &sz);\r
+    if (rc != ERROR_SUCCESS)\r
+    {\r
+        RegCloseKey(hkey);\r
+        HeapFree(GetProcessHeap(),0,info);\r
+        return ERROR_INDEX_ABSENT;\r
+    }\r
+\r
+    /* find the component */\r
+    ptr = strchrW(&info[20],'>');\r
+    if (ptr)\r
+        ptr++;\r
+    else\r
+    {\r
+        RegCloseKey(hkey);\r
+        HeapFree(GetProcessHeap(),0,info);\r
+        return ERROR_INDEX_ABSENT;\r
+    }\r
+\r
+    if (!szProduct)\r
+    {\r
+        decode_base85_guid(info,&clsid);\r
+        StringFromCLSID(&clsid, &product);\r
+    }\r
+    decode_base85_guid(ptr,&clsid);\r
+    StringFromCLSID(&clsid, &component);\r
+\r
+    if (!szProduct)\r
+        rc = MsiGetComponentPathW(product, component, lpPathBuf, pcchPathBuf);\r
+    else\r
+        rc = MsiGetComponentPathW(szProduct, component, lpPathBuf, pcchPathBuf);\r
+   \r
+    RegCloseKey(hkey);\r
+    HeapFree(GetProcessHeap(),0,info);\r
+    HeapFree(GetProcessHeap(),0,product);\r
+    HeapFree(GetProcessHeap(),0,component);\r
+\r
+    if (rc == INSTALLSTATE_LOCAL)\r
+        return ERROR_SUCCESS;\r
+    else \r
+        return ERROR_FILE_NOT_FOUND;\r
+}\r
+\r
+/***********************************************************************\r
+ * MsiProvideQualifiedComponentW [MSI.@]\r
+ */\r
+UINT WINAPI MsiProvideQualifiedComponentW( LPCWSTR szComponent,\r
+                LPCWSTR szQualifier, DWORD dwInstallMode, LPWSTR lpPathBuf,\r
+                DWORD* pcchPathBuf)\r
+{\r
+    return MsiProvideQualifiedComponentExW(szComponent, szQualifier, \r
+                    dwInstallMode, NULL, 0, 0, lpPathBuf, pcchPathBuf);\r
+}\r
+\r
+/***********************************************************************\r
+ * MsiProvideQualifiedComponentA [MSI.@]\r
+ */\r
+UINT WINAPI MsiProvideQualifiedComponentA( LPCSTR szComponent,\r
+                LPCSTR szQualifier, DWORD dwInstallMode, LPSTR lpPathBuf,\r
+                DWORD* pcchPathBuf)\r
+{\r
+    LPWSTR szwComponent, szwQualifier, lpwPathBuf;\r
+    DWORD pcchwPathBuf;\r
+    UINT rc;\r
+\r
+    TRACE("%s %s %li %p %p\n",szComponent, szQualifier,\r
+                    dwInstallMode, lpPathBuf, pcchPathBuf);\r
+\r
+    szwComponent= strdupAtoW( szComponent);\r
+    szwQualifier= strdupAtoW( szQualifier);\r
+\r
+    lpwPathBuf = HeapAlloc(GetProcessHeap(),0,*pcchPathBuf * sizeof(WCHAR));\r
+\r
+    pcchwPathBuf = *pcchPathBuf;\r
+\r
+    rc = MsiProvideQualifiedComponentW(szwComponent, szwQualifier, \r
+                    dwInstallMode, lpwPathBuf, &pcchwPathBuf);\r
+\r
+    HeapFree(GetProcessHeap(),0,szwComponent);\r
+    HeapFree(GetProcessHeap(),0,szwQualifier);\r
+    *pcchPathBuf = WideCharToMultiByte(CP_ACP, 0, lpwPathBuf, pcchwPathBuf,\r
+                    lpPathBuf, *pcchPathBuf, NULL, NULL);\r
+\r
+    HeapFree(GetProcessHeap(),0,lpwPathBuf);\r
+    return rc;\r
 }\r
 \r
 USERINFOSTATE WINAPI MsiGetUserInfoW(LPCWSTR szProduct, LPWSTR lpUserNameBuf,\r
                 DWORD* pcchUserNameBuf, LPWSTR lpOrgNameBuf,\r
                 DWORD* pcchOrgNameBuf, LPWSTR lpSerialBuf, DWORD* pcchSerialBuf)\r
 {\r
-    FIXME("%s %p %p %p %p %p %p\n",debugstr_w(szProduct), lpUserNameBuf,\r
+    HKEY hkey;\r
+    DWORD sz;\r
+    UINT rc = ERROR_SUCCESS,rc2 = ERROR_SUCCESS;\r
+    static const WCHAR szOwner[] = {'R','e','g','O','w','n','e','r',0};\r
+    static const WCHAR szCompany[] = {'R','e','g','C','o','m','p','a','n','y',0};\r
+    static const WCHAR szSerial[] = {'P','r','o','d','u','c','t','I','D',0};\r
+\r
+    TRACE("%s %p %p %p %p %p %p\n",debugstr_w(szProduct), lpUserNameBuf,\r
           pcchUserNameBuf, lpOrgNameBuf, pcchOrgNameBuf, lpSerialBuf,\r
           pcchSerialBuf);\r
 \r
-    return USERINFOSTATE_UNKNOWN;\r
+    rc = MSIREG_OpenUninstallKey(szProduct, &hkey, FALSE);\r
+    if (rc != ERROR_SUCCESS)\r
+        return USERINFOSTATE_UNKNOWN;\r
+\r
+    if (lpUserNameBuf)\r
+    {\r
+        sz = *lpUserNameBuf * sizeof(WCHAR);\r
+        rc = RegQueryValueExW( hkey, szOwner, NULL, NULL, (LPBYTE)lpUserNameBuf,\r
+                               &sz);\r
+    }\r
+    if (!lpUserNameBuf && pcchUserNameBuf)\r
+    {\r
+        sz = 0;\r
+        rc = RegQueryValueExW( hkey, szOwner, NULL, NULL, NULL, &sz);\r
+    }\r
+\r
+    if (pcchUserNameBuf)\r
+        *pcchUserNameBuf = sz / sizeof(WCHAR);\r
+\r
+    if (lpOrgNameBuf)\r
+    {\r
+        sz = *pcchOrgNameBuf * sizeof(WCHAR);\r
+        rc2 = RegQueryValueExW( hkey, szCompany, NULL, NULL, \r
+                               (LPBYTE)lpOrgNameBuf, &sz);\r
+    }\r
+    if (!lpOrgNameBuf && pcchOrgNameBuf)\r
+    {\r
+        sz = 0;\r
+        rc2 = RegQueryValueExW( hkey, szCompany, NULL, NULL, NULL, &sz);\r
+    }\r
+\r
+    if (pcchOrgNameBuf)\r
+        *pcchOrgNameBuf = sz / sizeof(WCHAR);\r
+\r
+    if (rc != ERROR_SUCCESS && rc != ERROR_MORE_DATA && \r
+        rc2 != ERROR_SUCCESS && rc2 != ERROR_MORE_DATA)\r
+    {\r
+        RegCloseKey(hkey);\r
+        return USERINFOSTATE_ABSENT;\r
+    }\r
+\r
+    if (lpSerialBuf)\r
+    {\r
+        sz = *pcchSerialBuf * sizeof(WCHAR);\r
+        RegQueryValueExW( hkey, szSerial, NULL, NULL, (LPBYTE)lpSerialBuf,\r
+                               &sz);\r
+    }\r
+    if (!lpSerialBuf && pcchSerialBuf)\r
+    {\r
+        sz = 0;\r
+        rc = RegQueryValueExW( hkey, szSerial, NULL, NULL, NULL, &sz);\r
+    }\r
+    if (pcchSerialBuf)\r
+        *pcchSerialBuf = sz / sizeof(WCHAR);\r
+    \r
+    RegCloseKey(hkey);\r
+    return USERINFOSTATE_PRESENT;\r
 }\r
 \r
 USERINFOSTATE WINAPI MsiGetUserInfoA(LPCSTR szProduct, LPSTR lpUserNameBuf,\r
@@ -1331,20 +1625,68 @@ USERINFOSTATE WINAPI MsiGetUserInfoA(LPCSTR szProduct, LPSTR lpUserNameBuf,
 \r
 UINT WINAPI MsiCollectUserInfoW(LPCWSTR szProduct)\r
 {\r
-    FIXME("%s\n",debugstr_w(szProduct));\r
-    return ERROR_CALL_NOT_IMPLEMENTED;\r
+    MSIHANDLE handle;\r
+    UINT rc;\r
+    MSIPACKAGE *package;\r
+    static const WCHAR szFirstRun[] = {'F','i','r','s','t','R','u','n',0};\r
+\r
+    TRACE("(%s)\n",debugstr_w(szProduct));\r
+\r
+    rc = MsiOpenProductW(szProduct,&handle);\r
+    if (rc != ERROR_SUCCESS)\r
+        return ERROR_INVALID_PARAMETER;\r
+\r
+    package = msihandle2msiinfo(handle, MSIHANDLETYPE_PACKAGE);\r
+    rc = ACTION_PerformUIAction(package, szFirstRun);\r
+    msiobj_release( &package->hdr );\r
+\r
+    MsiCloseHandle(handle);\r
+\r
+    return rc;\r
 }\r
 \r
 UINT WINAPI MsiCollectUserInfoA(LPCSTR szProduct)\r
 {\r
-    FIXME("%s\n",debugstr_a(szProduct));\r
-    return ERROR_CALL_NOT_IMPLEMENTED;\r
+    MSIHANDLE handle;\r
+    UINT rc;\r
+    MSIPACKAGE *package;\r
+    static const WCHAR szFirstRun[] = {'F','i','r','s','t','R','u','n',0};\r
+\r
+    TRACE("(%s)\n",debugstr_a(szProduct));\r
+\r
+    rc = MsiOpenProductA(szProduct,&handle);\r
+    if (rc != ERROR_SUCCESS)\r
+        return ERROR_INVALID_PARAMETER;\r
+\r
+    package = msihandle2msiinfo(handle, MSIHANDLETYPE_PACKAGE);\r
+    rc = ACTION_PerformUIAction(package, szFirstRun);\r
+    msiobj_release( &package->hdr );\r
+\r
+    MsiCloseHandle(handle);\r
+\r
+    return rc;\r
 }\r
 \r
 UINT WINAPI MsiCreateAndVerifyInstallerDirectory(DWORD dwReserved)\r
 {\r
-    FIXME("%ld\n", dwReserved);\r
-    return ERROR_CALL_NOT_IMPLEMENTED;\r
+    WCHAR path[MAX_PATH];\r
+\r
+    if(dwReserved) {\r
+        FIXME("Don't know how to handle argument %ld\n", dwReserved);\r
+        return ERROR_CALL_NOT_IMPLEMENTED;\r
+    }\r
+\r
+   if(!GetWindowsDirectoryW(path, MAX_PATH)) {\r
+        FIXME("GetWindowsDirectory failed unexpected! Error %ld\n",\r
+              GetLastError());\r
+        return ERROR_CALL_NOT_IMPLEMENTED;\r
+   }\r
+\r
+   strcatW(path, installerW);\r
+\r
+   CreateDirectoryW(path, NULL);\r
+\r
+   return 0;\r
 }\r
 \r
 UINT WINAPI MsiGetShortcutTargetA( LPCSTR szShortcutTarget,\r
index 4bf2712..9146406 100644 (file)
@@ -18,8 +18,8 @@
 18 stdcall MsiDatabaseApplyTransformA(long str long)\r
 19 stdcall MsiDatabaseApplyTransformW(long wstr long)\r
 20 stdcall MsiDatabaseCommit(long)\r
-21 stub MsiDatabaseExportA\r
-22 stub MsiDatabaseExportW\r
+21 stdcall MsiDatabaseExportA(long str str str)\r
+22 stdcall MsiDatabaseExportW(long wstr wstr wstr)\r
 23 stdcall MsiDatabaseGenerateTransformA(long long str long long)\r
 24 stdcall MsiDatabaseGenerateTransformW(long long wstr long long)\r
 25 stdcall MsiDatabaseGetPrimaryKeysA(long str ptr)\r
@@ -78,7 +78,7 @@
 78 stdcall MsiGetSummaryInformationW(long wstr long ptr)\r
 79 stdcall MsiGetTargetPathA(long str ptr ptr)\r
 80 stdcall MsiGetTargetPathW(long wstr ptr ptr)\r
-81 stub MsiGetUserInfoA\r
+81 stdcall MsiGetUserInfoA(str ptr ptr ptr ptr ptr ptr)\r
 82 stdcall MsiGetUserInfoW(wstr ptr ptr ptr ptr ptr ptr)\r
 83 stub MsiInstallMissingComponentA\r
 84 stub MsiInstallMissingComponentW\r
 105 stdcall MsiProvideComponentFromDescriptorA(str ptr ptr ptr)\r
 106 stdcall MsiProvideComponentFromDescriptorW(wstr ptr ptr ptr)\r
 107 stub MsiProvideComponentW\r
-108 stub MsiProvideQualifiedComponentA\r
-109 stub MsiProvideQualifiedComponentW\r
+108 stdcall MsiProvideQualifiedComponentA(str str long ptr ptr)\r
+109 stdcall MsiProvideQualifiedComponentW(str str long ptr ptr)\r
 110 stdcall MsiQueryFeatureStateA(str str)\r
 111 stdcall MsiQueryFeatureStateW(wstr wstr)\r
 112 stdcall MsiQueryProductStateA(str)\r
index d1551ab..6ed1034 100644 (file)
@@ -18,7 +18,7 @@
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  */
 
-LANGUAGE LANG_FRENCH, SUBLANG_DEFAULT
+LANGUAGE LANG_FRENCH, SUBLANG_NEUTRAL
 
 STRINGTABLE DISCARDABLE
 {
index 290de68..2aad08a 100644 (file)
@@ -30,6 +30,7 @@
 #include "objbase.h"\r
 #include "objidl.h"\r
 #include "wine/unicode.h"\r
+#include "wine/list.h"\r
 \r
 #define MSI_DATASIZEMASK 0x00ff\r
 #define MSITYPE_VALID    0x0100\r
@@ -77,6 +78,7 @@ typedef struct tagMSIQUERY
     MSIVIEW *view;\r
     UINT row;\r
     MSIDATABASE *db;\r
+    struct list mem;\r
 } MSIQUERY;\r
 \r
 /* maybe we can use a Variant instead of doing it ourselves? */\r
@@ -288,7 +290,7 @@ extern const WCHAR *msi_string_lookup_id( string_table *st, UINT id );
 extern UINT msi_string_get_codepage( string_table *st );\r
 \r
 \r
-extern UINT VIEW_find_column( MSIVIEW *view, LPWSTR name, UINT *n );\r
+extern UINT VIEW_find_column( MSIVIEW *view, LPCWSTR name, UINT *n );\r
 \r
 extern BOOL TABLE_Exists( MSIDATABASE *db, LPWSTR name );\r
 \r
@@ -342,6 +344,7 @@ extern MSICONDITION MSI_EvaluateConditionW( MSIPACKAGE *, LPCWSTR );
 extern UINT MSI_SetPropertyW( MSIPACKAGE *, LPCWSTR, LPCWSTR );\r
 extern UINT MSI_GetComponentStateW( MSIPACKAGE *, LPWSTR, INSTALLSTATE *, INSTALLSTATE * );\r
 extern UINT MSI_GetFeatureStateW( MSIPACKAGE *, LPWSTR, INSTALLSTATE *, INSTALLSTATE * );\r
+extern UINT WINAPI MSI_SetFeatureStateW(MSIPACKAGE*, LPCWSTR, INSTALLSTATE );\r
 \r
 /* for deformating */\r
 extern UINT MSI_FormatRecordW(MSIPACKAGE* package, MSIRECORD* record, \r
@@ -357,6 +360,7 @@ extern UINT MSIREG_OpenUserProductsKey(LPCWSTR szProduct, HKEY* key, BOOL create
 extern UINT MSIREG_OpenFeatures(HKEY* key);\r
 extern UINT MSIREG_OpenFeaturesKey(LPCWSTR szProduct, HKEY* key, BOOL create);\r
 extern UINT MSIREG_OpenComponents(HKEY* key);\r
+extern UINT MSIREG_OpenUserComponentsKey(LPCWSTR szComponent, HKEY* key, BOOL create);\r
 extern UINT MSIREG_OpenComponentsKey(LPCWSTR szComponent, HKEY* key, BOOL create);\r
 extern UINT MSIREG_OpenProductsKey(LPCWSTR szProduct, HKEY* key, BOOL create);\r
 extern UINT MSIREG_OpenUserFeaturesKey(LPCWSTR szProduct, HKEY* key, BOOL create);\r
@@ -367,10 +371,10 @@ typedef VOID (*msi_dialog_event_handler)( MSIPACKAGE*, LPCWSTR, LPCWSTR, msi_dia
 extern msi_dialog *msi_dialog_create( MSIPACKAGE*, LPCWSTR, msi_dialog_event_handler );\r
 extern UINT msi_dialog_run_message_loop( msi_dialog* );\r
 extern void msi_dialog_end_dialog( msi_dialog* );\r
-extern void msi_dialog_check_messages( msi_dialog*, HANDLE );\r
+extern void msi_dialog_check_messages( HANDLE );\r
 extern void msi_dialog_do_preview( msi_dialog* );\r
 extern void msi_dialog_destroy( msi_dialog* );\r
-extern void msi_dialog_register_class( void );\r
+extern BOOL msi_dialog_register_class( void );\r
 extern void msi_dialog_unregister_class( void );\r
 \r
 /* UI globals */\r
index eb50d09..cdd4457 100644 (file)
@@ -41,13 +41,19 @@ WINE_DEFAULT_DEBUG_CHANNEL(msi);
 void MSI_CloseView( MSIOBJECTHDR *arg )\r
 {\r
     MSIQUERY *query = (MSIQUERY*) arg;\r
+    struct list *ptr, *t;\r
 \r
     if( query->view && query->view->ops->delete )\r
         query->view->ops->delete( query->view );\r
     msiobj_release( &query->db->hdr );\r
+\r
+    LIST_FOR_EACH_SAFE( ptr, t, &query->mem )\r
+    {\r
+        HeapFree( GetProcessHeap(), 0, ptr );\r
+    }\r
 }\r
 \r
-UINT VIEW_find_column( MSIVIEW *table, LPWSTR name, UINT *n )\r
+UINT VIEW_find_column( MSIVIEW *table, LPCWSTR name, UINT *n )\r
 {\r
     LPWSTR col_name;\r
     UINT i, count, r;\r
@@ -120,8 +126,9 @@ UINT MSI_DatabaseOpenViewW(MSIDATABASE *db,
     query->row = 0;\r
     query->db = db;\r
     query->view = NULL;\r
+    list_init( &query->mem );\r
 \r
-    r = MSI_ParseSQL( db, szQuery, &query->view );\r
+    r = MSI_ParseSQL( db, szQuery, &query->view, &query->mem );\r
     if( r == ERROR_SUCCESS )\r
     {\r
         msiobj_addref( &query->hdr );\r
@@ -141,7 +148,7 @@ UINT MSI_OpenQuery( MSIDATABASE *db, MSIQUERY **view, LPCWSTR fmt, ... )
 \r
     /* figure out how much space we need to allocate */\r
     va_start(va, fmt);\r
-    sz = strlenW(fmt) + 1;\r
+    sz = lstrlenW(fmt) + 1;\r
     p = fmt;\r
     while (*p)\r
     {\r
@@ -152,7 +159,7 @@ UINT MSI_OpenQuery( MSIDATABASE *db, MSIQUERY **view, LPCWSTR fmt, ... )
         switch (*p)\r
         {\r
         case 's':  /* a string */\r
-            sz += strlenW(va_arg(va,LPCWSTR));\r
+            sz += lstrlenW(va_arg(va,LPCWSTR));\r
             break;\r
         case 'd':\r
         case 'i':  /* an integer -2147483648 seems to be longest */\r
index c23b1ef..33947a0 100644 (file)
@@ -264,40 +264,8 @@ MSIVIEWOPS order_ops =
     ORDER_delete\r
 };\r
 \r
-UINT ORDER_CreateView( MSIDATABASE *db, MSIVIEW **view, MSIVIEW *table )\r
+static UINT ORDER_AddColumn( MSIORDERVIEW *ov, LPCWSTR name )\r
 {\r
-    MSIORDERVIEW *ov = NULL;\r
-    UINT count = 0, r;\r
-\r
-    TRACE("%p\n", ov );\r
-\r
-    r = table->ops->get_dimensions( table, NULL, &count );\r
-    if( r != ERROR_SUCCESS )\r
-    {\r
-        ERR("can't get table dimensions\n");\r
-        return r;\r
-    }\r
-\r
-    ov = HeapAlloc( GetProcessHeap(), HEAP_ZERO_MEMORY, \r
-                    sizeof *ov + sizeof (UINT) * count );\r
-    if( !ov )\r
-        return ERROR_FUNCTION_FAILED;\r
-    \r
-    /* fill the structure */\r
-    ov->view.ops = &order_ops;\r
-    msiobj_addref( &db->hdr );\r
-    ov->db = db;\r
-    ov->table = table;\r
-    ov->reorder = NULL;\r
-    ov->num_cols = 0;\r
-    *view = (MSIVIEW*) ov;\r
-\r
-    return ERROR_SUCCESS;\r
-}\r
-\r
-UINT ORDER_AddColumn( MSIVIEW *view, LPWSTR name )\r
-{\r
-    MSIORDERVIEW *ov = (MSIORDERVIEW*)view;\r
     UINT n, count, r;\r
     MSIVIEW *table;\r
 \r
@@ -332,3 +300,39 @@ UINT ORDER_AddColumn( MSIVIEW *view, LPWSTR name )
 \r
     return ERROR_SUCCESS;\r
 }\r
+\r
+UINT ORDER_CreateView( MSIDATABASE *db, MSIVIEW **view, MSIVIEW *table,\r
+                       string_list *columns )\r
+{\r
+    MSIORDERVIEW *ov = NULL;\r
+    UINT count = 0, r;\r
+    string_list *x;\r
+\r
+    TRACE("%p\n", ov );\r
+\r
+    r = table->ops->get_dimensions( table, NULL, &count );\r
+    if( r != ERROR_SUCCESS )\r
+    {\r
+        ERR("can't get table dimensions\n");\r
+        return r;\r
+    }\r
+\r
+    ov = HeapAlloc( GetProcessHeap(), HEAP_ZERO_MEMORY, \r
+                    sizeof *ov + sizeof (UINT) * count );\r
+    if( !ov )\r
+        return ERROR_FUNCTION_FAILED;\r
+    \r
+    /* fill the structure */\r
+    ov->view.ops = &order_ops;\r
+    msiobj_addref( &db->hdr );\r
+    ov->db = db;\r
+    ov->table = table;\r
+    ov->reorder = NULL;\r
+    ov->num_cols = 0;\r
+    *view = (MSIVIEW*) ov;\r
+\r
+    for( x = columns; x ; x = x->next )\r
+        ORDER_AddColumn( ov, x->string );\r
+\r
+    return ERROR_SUCCESS;\r
+}\r
index 938de88..be257e1 100644 (file)
@@ -73,7 +73,7 @@ static UINT clone_properties(MSIDATABASE *db)
        'Y',' ','K','E','Y',' ','`','_','P','r','o','p','e','r','t','y','`',')',0};\r
     static const WCHAR Query[] = {\r
        'S','E','L','E','C','T',' ','*',' ',\r
-       'f','r','o','m',' ','P','r','o','p','e','r','t','y',0};\r
+       'F','R','O','M',' ','`','P','r','o','p','e','r','t','y','`',0};\r
     static const WCHAR Insert[] = {\r
        'I','N','S','E','R','T',' ','i','n','t','o',' ',\r
        '`','_','P','r','o','p','e','r','t','y','`',' ',\r
@@ -139,6 +139,7 @@ static VOID set_installer_properties(MSIPACKAGE *package)
     WCHAR pth[MAX_PATH];\r
     WCHAR *ptr;\r
     OSVERSIONINFOA OSVersion;\r
+    MEMORYSTATUSEX msex;\r
     DWORD verval;\r
     WCHAR verstr[10], bufstr[20];\r
     HDC dc;\r
@@ -202,6 +203,7 @@ static VOID set_installer_properties(MSIPACKAGE *package)
     static const WCHAR szSix[] = {'6',0 };\r
 \r
     static const WCHAR szVersionMsi[] = { 'V','e','r','s','i','o','n','M','s','i',0 };\r
+    static const WCHAR szPhysicalMemory[] = { 'P','h','y','s','i','c','a','l','M','e','m','o','r','y',0 };\r
     static const WCHAR szFormat2[] = {'%','l','i','.','%','l','i',0};\r
 /* Screen properties */\r
     static const WCHAR szScreenX[] = {'S','c','r','e','e','n','X',0};\r
@@ -217,7 +219,6 @@ ComputerName
 UserLanguageID\r
 LogonUser\r
 VirtualMemory\r
-PhysicalMemory\r
 Intel\r
 ShellAdvSupport\r
 DefaultUIFont\r
@@ -306,6 +307,12 @@ Privileged
     SHGetFolderPathW(NULL,CSIDL_WINDOWS,NULL,0,pth);\r
     strcatW(pth,cszbs);\r
     MSI_SetPropertyW(package, WF, pth);\r
+    \r
+    /* Physical Memory is specified in MB. Using total amount. */\r
+    msex.dwLength = sizeof(msex);\r
+    GlobalMemoryStatusEx( &msex );\r
+    sprintfW( bufstr, szScreenFormat, (int)(msex.ullTotalPhys/1024/1024));\r
+    MSI_SetPropertyW(package, szPhysicalMemory, bufstr);\r
 \r
     SHGetFolderPathW(NULL,CSIDL_WINDOWS,NULL,0,pth);\r
     ptr = strchrW(pth,'\\');\r
@@ -740,9 +747,10 @@ static UINT MSI_GetPropertyRow(MSIPACKAGE *package, LPCWSTR szName, MSIRECORD **
     MSIQUERY *view;\r
     UINT rc, sz;\r
     static const WCHAR select[]=\r
-    {'s','e','l','e','c','t',' ','V','a','l','u','e',' ','f','r','o','m',' '\r
-     ,'_','P','r','o','p','e','r','t','y',' ','w','h','e','r','e',' '\r
-     ,'_','P','r','o','p','e','r','t','y','=','`','%','s','`',0};\r
+    {'S','E','L','E','C','T',' ','`','V','a','l','u','e','`',' ',\r
+     'F','R','O','M',' ' ,'`','_','P','r','o','p','e','r','t','y','`',\r
+     ' ','W','H','E','R','E',' ' ,'`','_','P','r','o','p','e','r','t','y','`',\r
+     '=','\'','%','s','\'',0};\r
     LPWSTR query;\r
 \r
     if (!szName)\r
@@ -793,7 +801,7 @@ UINT MSI_GetPropertyW(MSIPACKAGE *package, LPCWSTR szName,
     else\r
     {\r
         *pchValueBuf = 0;\r
-        TRACE("property not found\n");\r
+        TRACE("property %s not found\n", debugstr_w(szName));\r
     }\r
 \r
     return rc;\r
index b66cc58..7227129 100644 (file)
@@ -30,6 +30,7 @@
 #include "msi.h"\r
 #include "msiquery.h"\r
 #include "msipriv.h"\r
+#include "wine/list.h"\r
 \r
 \r
 #define OP_EQ       1\r
@@ -50,7 +51,6 @@
 #define EXPR_SVAL     5\r
 #define EXPR_UVAL     6\r
 #define EXPR_STRCMP   7\r
-#define EXPR_UTF8     8\r
 #define EXPR_WILDCARD 9\r
 #define EXPR_COL_NUMBER_STRING 10\r
 \r
@@ -83,7 +83,6 @@ struct expr
         LPWSTR sval;\r
         LPWSTR column;\r
         UINT col_number;\r
-        char *utf8;\r
     } u;\r
 };\r
 \r
@@ -107,7 +106,8 @@ typedef struct _column_assignment
 } column_assignment;\r
 \r
 \r
-UINT MSI_ParseSQL( MSIDATABASE *db, LPCWSTR command, MSIVIEW **phView);\r
+UINT MSI_ParseSQL( MSIDATABASE *db, LPCWSTR command, MSIVIEW **phview,\r
+                   struct list *mem );\r
 \r
 UINT TABLE_CreateView( MSIDATABASE *db, LPCWSTR name, MSIVIEW **view );\r
 \r
@@ -116,8 +116,8 @@ UINT SELECT_CreateView( MSIDATABASE *db, MSIVIEW **view, MSIVIEW *table,
 \r
 UINT DISTINCT_CreateView( MSIDATABASE *db, MSIVIEW **view, MSIVIEW *table );\r
 \r
-UINT ORDER_CreateView( MSIDATABASE *db, MSIVIEW **view, MSIVIEW *table );\r
-UINT ORDER_AddColumn( MSIVIEW *group, LPWSTR name );\r
+UINT ORDER_CreateView( MSIDATABASE *db, MSIVIEW **view, MSIVIEW *table,\r
+                       string_list *columns );\r
 \r
 UINT WHERE_CreateView( MSIDATABASE *db, MSIVIEW **view, MSIVIEW *table,\r
                        struct expr *cond );\r
@@ -133,10 +133,6 @@ UINT UPDATE_CreateView( MSIDATABASE *db, MSIVIEW **, LPWSTR table,
 \r
 UINT DELETE_CreateView( MSIDATABASE *db, MSIVIEW **view, MSIVIEW *table );\r
 \r
-void delete_expr( struct expr *e );\r
-void delete_string_list( string_list *sl );\r
-void delete_value_list( value_list *vl );\r
-\r
 int sqliteGetToken(const WCHAR *z, int *tokenType);\r
 \r
 #endif /* __WINE_MSI_QUERY_H */\r
index a06b0a5..2b04690 100644 (file)
@@ -98,6 +98,7 @@ MSIHANDLE WINAPI MsiCreateRecord( unsigned int cParams )
     rec = MSI_CreateRecord( cParams );\r
     if( rec )\r
         ret = alloc_msihandle( &rec->hdr );\r
+    msiobj_release( &rec->hdr );\r
     return ret;\r
 }\r
 \r
index c6de569..15e9109 100644 (file)
@@ -85,6 +85,13 @@ static const WCHAR szInstaller_Components_fmt[] = {
 'C','o','m','p','o','n','e','n','t','s','\\',
 '%','s',0};
 
+static const WCHAR szUser_Components_fmt[] = {
+'S','o','f','t','w','a','r','e','\\',
+'M','i','c','r','o','s','o','f','t','\\',
+'I','n','s','t','a','l','l','e','r','\\',
+'C','o','m','p','o','n','e','n','t','s','\\',
+'%','s',0};
+
 static const WCHAR szUninstall_fmt[] = {
 'S','o','f','t','w','a','r','e','\\',
 'M','i','c','r','o','s','o','f','t','\\',
@@ -388,6 +395,26 @@ UINT MSIREG_OpenComponentsKey(LPCWSTR szComponent, HKEY* key, BOOL create)
     return rc;
 }
 
+UINT MSIREG_OpenUserComponentsKey(LPCWSTR szComponent, HKEY* key, BOOL create)
+{
+    UINT rc;
+    WCHAR squished_cc[GUID_SIZE];
+    WCHAR keypath[0x200];
+
+    TRACE("%s\n",debugstr_w(szComponent));
+    squash_guid(szComponent,squished_cc);
+    TRACE("squished (%s)\n", debugstr_w(squished_cc));
+
+    sprintfW(keypath,szUser_Components_fmt,squished_cc);
+
+    if (create)
+        rc = RegCreateKeyW(HKEY_CURRENT_USER,keypath,key);
+    else
+        rc = RegOpenKeyW(HKEY_CURRENT_USER,keypath,key);
+
+    return rc;
+}
+
 UINT MSIREG_OpenProductsKey(LPCWSTR szProduct, HKEY* key, BOOL create)
 {
     UINT rc;
@@ -695,26 +722,154 @@ UINT WINAPI MsiEnumClientsW(LPCWSTR szComponent, DWORD index, LPWSTR szProduct)
     return r;
 }
 
+/*************************************************************************
+ *  MsiEnumComponentQualifiersA [MSI.@]
+ *
+ */
 UINT WINAPI MsiEnumComponentQualifiersA( LPSTR szComponent, DWORD iIndex,
                 LPSTR lpQualifierBuf, DWORD* pcchQualifierBuf,
                 LPSTR lpApplicationDataBuf, DWORD* pcchApplicationDataBuf)
 {
-    FIXME("%s %08lx %p %p %p %p\n", debugstr_a(szComponent), iIndex,
+    LPWSTR szwComponent;
+    LPWSTR lpwQualifierBuf;
+    DWORD pcchwQualifierBuf;
+    LPWSTR lpwApplicationDataBuf;
+    DWORD pcchwApplicationDataBuf;
+    DWORD rc;
+    DWORD length;
+
+    TRACE("%s %08lx %p %p %p %p\n", debugstr_a(szComponent), iIndex,
           lpQualifierBuf, pcchQualifierBuf, lpApplicationDataBuf,
           pcchApplicationDataBuf);
-    return ERROR_CALL_NOT_IMPLEMENTED;
+
+    szwComponent = strdupAtoW(szComponent);
+
+    if (lpQualifierBuf)
+        lpwQualifierBuf = HeapAlloc(GetProcessHeap(),0, (*pcchQualifierBuf) * 
+                        sizeof(WCHAR));
+    else
+        lpwQualifierBuf = NULL;
+
+    if (pcchQualifierBuf)
+        pcchwQualifierBuf = *pcchQualifierBuf;
+    else
+        pcchwQualifierBuf = 0;
+
+    if (lpApplicationDataBuf)
+       lpwApplicationDataBuf = HeapAlloc(GetProcessHeap(),0 ,
+                            (*pcchApplicationDataBuf) * sizeof(WCHAR));
+    else
+        lpwApplicationDataBuf = NULL;
+
+    if (pcchApplicationDataBuf)
+        pcchwApplicationDataBuf = *pcchApplicationDataBuf;
+    else
+        pcchwApplicationDataBuf = 0;
+
+    rc = MsiEnumComponentQualifiersW( szwComponent, iIndex, lpwQualifierBuf, 
+                    &pcchwQualifierBuf, lpwApplicationDataBuf,
+                    &pcchwApplicationDataBuf);
+
+    /*
+     * A bit of wizardry to report back the length without the null.
+     * just in case the buffer is too small and is filled.
+     */
+    if (lpQualifierBuf)
+    {
+        length = WideCharToMultiByte(CP_ACP, 0, lpwQualifierBuf, -1,
+                        lpQualifierBuf, *pcchQualifierBuf, NULL, NULL); 
+
+        if (*pcchQualifierBuf == length && lpQualifierBuf[length-1])
+            *pcchQualifierBuf = length;
+        else
+            *pcchQualifierBuf = length - 1;
+    }
+    if (lpApplicationDataBuf)
+    {
+        length = WideCharToMultiByte(CP_ACP, 0,
+                        lpwApplicationDataBuf, -1, lpApplicationDataBuf,
+                        *pcchApplicationDataBuf, NULL, NULL); 
+
+        if (*pcchApplicationDataBuf == length && lpApplicationDataBuf[length-1])
+            *pcchApplicationDataBuf = length;
+        else
+            *pcchApplicationDataBuf = length - 1;
+    }
+
+    HeapFree(GetProcessHeap(),0,lpwApplicationDataBuf);
+    HeapFree(GetProcessHeap(),0,lpwQualifierBuf);
+    HeapFree(GetProcessHeap(),0,szwComponent);
+
+    return rc;
 }
 
+/*************************************************************************
+ *  MsiEnumComponentQualifiersW [MSI.@]
+ *
+ */
 UINT WINAPI MsiEnumComponentQualifiersW( LPWSTR szComponent, DWORD iIndex,
                 LPWSTR lpQualifierBuf, DWORD* pcchQualifierBuf,
                 LPWSTR lpApplicationDataBuf, DWORD* pcchApplicationDataBuf )
 {
-    FIXME("%s %08lx %p %p %p %p\n", debugstr_w(szComponent), iIndex,
+    UINT rc;
+    HKEY key;
+    DWORD actual_pcchQualifierBuf = 0;
+    DWORD actual_pcchApplicationDataBuf = 0;
+    LPWSTR full_buffer = NULL;
+    DWORD full_buffer_size = 0;
+    LPWSTR ptr;
+
+    TRACE("%s %08lx %p %p %p %p\n", debugstr_w(szComponent), iIndex,
           lpQualifierBuf, pcchQualifierBuf, lpApplicationDataBuf,
           pcchApplicationDataBuf);
-    return ERROR_CALL_NOT_IMPLEMENTED;
+
+    if (pcchQualifierBuf)
+        actual_pcchQualifierBuf = *pcchQualifierBuf * sizeof(WCHAR);
+    if (pcchApplicationDataBuf)
+        actual_pcchApplicationDataBuf = *pcchApplicationDataBuf * sizeof(WCHAR);
+    
+    rc = MSIREG_OpenUserComponentsKey(szComponent, &key, FALSE);
+    if (rc != ERROR_SUCCESS)
+        return ERROR_UNKNOWN_COMPONENT;
+
+    full_buffer_size = (52 * sizeof(WCHAR)) + actual_pcchApplicationDataBuf;
+    full_buffer = HeapAlloc(GetProcessHeap(),0,full_buffer_size);
+    
+    rc = RegEnumValueW(key, iIndex, lpQualifierBuf, pcchQualifierBuf, NULL, 
+                    NULL, (LPBYTE)full_buffer, &full_buffer_size);
+
+    RegCloseKey(key);
+
+    if (rc == ERROR_SUCCESS || rc == ERROR_MORE_DATA)
+    {
+        if (lpApplicationDataBuf && pcchApplicationDataBuf)
+        {
+            ptr = full_buffer;
+            /* Skip the first guid */
+            ptr += 21;
+    
+            /* Skip the name and the component guid if it exists */
+            if (strchrW(ptr,'<'))
+                ptr = strchrW(ptr,'<');
+            else 
+                ptr = strchrW(ptr,'>') + 21;
+
+            lstrcpynW(lpApplicationDataBuf,ptr,*pcchApplicationDataBuf);
+            *pcchApplicationDataBuf = strlenW(ptr);
+        }
+        if (lpQualifierBuf && pcchQualifierBuf)
+            *pcchQualifierBuf /= sizeof(WCHAR); 
+        TRACE("Providing %s and %s\n", debugstr_w(lpQualifierBuf), 
+                        debugstr_w(lpApplicationDataBuf));
+    }
+
+    return rc;
 }
 
+/*************************************************************************
+ *  MsiEnumRelatedProductsW   [MSI.@]
+ *
+ */
 UINT WINAPI MsiEnumRelatedProductsW(LPCWSTR szUpgradeCode, DWORD dwReserved,
                                     DWORD iProductIndex, LPWSTR lpProductBuf)
 {
@@ -742,6 +897,10 @@ UINT WINAPI MsiEnumRelatedProductsW(LPCWSTR szUpgradeCode, DWORD dwReserved,
     return r;
 }
 
+/*************************************************************************
+ *  MsiEnumRelatedProductsA   [MSI.@]
+ *
+ */
 UINT WINAPI MsiEnumRelatedProductsA(LPCSTR szUpgradeCode, DWORD dwReserved,
                                     DWORD iProductIndex, LPSTR lpProductBuf)
 {
index 874691c..524ddda 100644 (file)
-/* A Bison parser, made by GNU Bison 1.875b.  */
-
-/* Skeleton parser for Yacc-like parsing with Bison,
-   Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003 Free Software Foundation, Inc.
-
-   This program is free software; you can redistribute it and/or modify
-   it under the terms of the GNU General Public License as published by
-   the Free Software Foundation; either version 2, or (at your option)
-   any later version.
-
-   This program is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-   GNU General Public License for more details.
-
-   You should have received a copy of the GNU General Public License
-   along with this program; if not, write to the Free Software
-   Foundation, Inc., 59 Temple Place - Suite 330,
-   Boston, MA 02111-1307, USA.  */
-
-/* As a special exception, when this file is copied by Bison into a
-   Bison output file, you may use that output file without restriction.
-   This special exception was added by the Free Software Foundation
-   in version 1.24 of Bison.  */
-
-/* Written by Richard Stallman by simplifying the original so called
-   ``semantic'' parser.  */
-
-/* All symbols defined below should begin with yy or YY, to avoid
-   infringing on user name space.  This should be done even for local
-   variables, as they might otherwise be expanded by user macros.
-   There are some unavoidable exceptions within include files to
-   define necessary library symbols; they are noted "INFRINGES ON
-   USER NAME SPACE" below.  */
-
-/* Identify Bison output.  */
-#define YYBISON 1
-
-/* Skeleton name.  */
-#define YYSKELETON_NAME "yacc.c"
-
-/* Pure parsers.  */
-#define YYPURE 1
-
-/* Using locations.  */
-#define YYLSP_NEEDED 0
-
-/* If NAME_PREFIX is specified substitute the variables and functions
-   names.  */
-#define yyparse SQL_parse
-#define yylex   SQL_lex
-#define yyerror SQL_error
-#define yylval  SQL_lval
-#define yychar  SQL_char
-#define yydebug SQL_debug
-#define yynerrs SQL_nerrs
-
-
-/* Tokens.  */
-#ifndef YYTOKENTYPE
-# define YYTOKENTYPE
-   /* Put the tokens into the symbol table, so that GDB and other debuggers
-      know about them.  */
-   enum yytokentype {
-     TK_ABORT = 258,
-     TK_AFTER = 259,
-     TK_AGG_FUNCTION = 260,
-     TK_ALL = 261,
-     TK_AND = 262,
-     TK_AS = 263,
-     TK_ASC = 264,
-     TK_BEFORE = 265,
-     TK_BEGIN = 266,
-     TK_BETWEEN = 267,
-     TK_BITAND = 268,
-     TK_BITNOT = 269,
-     TK_BITOR = 270,
-     TK_BY = 271,
-     TK_CASCADE = 272,
-     TK_CASE = 273,
-     TK_CHAR = 274,
-     TK_CHECK = 275,
-     TK_CLUSTER = 276,
-     TK_COLLATE = 277,
-     TK_COLUMN = 278,
-     TK_COMMA = 279,
-     TK_COMMENT = 280,
-     TK_COMMIT = 281,
-     TK_CONCAT = 282,
-     TK_CONFLICT = 283,
-     TK_CONSTRAINT = 284,
-     TK_COPY = 285,
-     TK_CREATE = 286,
-     TK_DEFAULT = 287,
-     TK_DEFERRABLE = 288,
-     TK_DEFERRED = 289,
-     TK_DELETE = 290,
-     TK_DELIMITERS = 291,
-     TK_DESC = 292,
-     TK_DISTINCT = 293,
-     TK_DOT = 294,
-     TK_DROP = 295,
-     TK_EACH = 296,
-     TK_ELSE = 297,
-     TK_END = 298,
-     TK_END_OF_FILE = 299,
-     TK_EQ = 300,
-     TK_EXCEPT = 301,
-     TK_EXPLAIN = 302,
-     TK_FAIL = 303,
-     TK_FLOAT = 304,
-     TK_FOR = 305,
-     TK_FOREIGN = 306,
-     TK_FROM = 307,
-     TK_FUNCTION = 308,
-     TK_GE = 309,
-     TK_GLOB = 310,
-     TK_GROUP = 311,
-     TK_GT = 312,
-     TK_HAVING = 313,
-     TK_HOLD = 314,
-     TK_IGNORE = 315,
-     TK_ILLEGAL = 316,
-     TK_IMMEDIATE = 317,
-     TK_IN = 318,
-     TK_INDEX = 319,
-     TK_INITIALLY = 320,
-     TK_ID = 321,
-     TK_INSERT = 322,
-     TK_INSTEAD = 323,
-     TK_INT = 324,
-     TK_INTEGER = 325,
-     TK_INTERSECT = 326,
-     TK_INTO = 327,
-     TK_IS = 328,
-     TK_ISNULL = 329,
-     TK_JOIN = 330,
-     TK_JOIN_KW = 331,
-     TK_KEY = 332,
-     TK_LE = 333,
-     TK_LIKE = 334,
-     TK_LIMIT = 335,
-     TK_LONG = 336,
-     TK_LONGCHAR = 337,
-     TK_LP = 338,
-     TK_LSHIFT = 339,
-     TK_LT = 340,
-     TK_LOCALIZABLE = 341,
-     TK_MATCH = 342,
-     TK_MINUS = 343,
-     TK_NE = 344,
-     TK_NOT = 345,
-     TK_NOTNULL = 346,
-     TK_NULL = 347,
-     TK_OBJECT = 348,
-     TK_OF = 349,
-     TK_OFFSET = 350,
-     TK_ON = 351,
-     TK_OR = 352,
-     TK_ORACLE_OUTER_JOIN = 353,
-     TK_ORDER = 354,
-     TK_PLUS = 355,
-     TK_PRAGMA = 356,
-     TK_PRIMARY = 357,
-     TK_RAISE = 358,
-     TK_REFERENCES = 359,
-     TK_REM = 360,
-     TK_REPLACE = 361,
-     TK_RESTRICT = 362,
-     TK_ROLLBACK = 363,
-     TK_ROW = 364,
-     TK_RP = 365,
-     TK_RSHIFT = 366,
-     TK_SELECT = 367,
-     TK_SEMI = 368,
-     TK_SET = 369,
-     TK_SHORT = 370,
-     TK_SLASH = 371,
-     TK_SPACE = 372,
-     TK_STAR = 373,
-     TK_STATEMENT = 374,
-     TK_STRING = 375,
-     TK_TABLE = 376,
-     TK_TEMP = 377,
-     TK_THEN = 378,
-     TK_TRANSACTION = 379,
-     TK_TRIGGER = 380,
-     TK_UMINUS = 381,
-     TK_UNCLOSED_STRING = 382,
-     TK_UNION = 383,
-     TK_UNIQUE = 384,
-     TK_UPDATE = 385,
-     TK_UPLUS = 386,
-     TK_USING = 387,
-     TK_VACUUM = 388,
-     TK_VALUES = 389,
-     TK_VIEW = 390,
-     TK_WHEN = 391,
-     TK_WHERE = 392,
-     TK_WILDCARD = 393,
-     COLUMN = 395,
-     FUNCTION = 396,
-     COMMENT = 397,
-     UNCLOSED_STRING = 398,
-     SPACE = 399,
-     ILLEGAL = 400,
-     END_OF_FILE = 401
-   };
-#endif
-#define TK_ABORT 258
-#define TK_AFTER 259
-#define TK_AGG_FUNCTION 260
-#define TK_ALL 261
-#define TK_AND 262
-#define TK_AS 263
-#define TK_ASC 264
-#define TK_BEFORE 265
-#define TK_BEGIN 266
-#define TK_BETWEEN 267
-#define TK_BITAND 268
-#define TK_BITNOT 269
-#define TK_BITOR 270
-#define TK_BY 271
-#define TK_CASCADE 272
-#define TK_CASE 273
-#define TK_CHAR 274
-#define TK_CHECK 275
-#define TK_CLUSTER 276
-#define TK_COLLATE 277
-#define TK_COLUMN 278
-#define TK_COMMA 279
-#define TK_COMMENT 280
-#define TK_COMMIT 281
-#define TK_CONCAT 282
-#define TK_CONFLICT 283
-#define TK_CONSTRAINT 284
-#define TK_COPY 285
-#define TK_CREATE 286
-#define TK_DEFAULT 287
-#define TK_DEFERRABLE 288
-#define TK_DEFERRED 289
-#define TK_DELETE 290
-#define TK_DELIMITERS 291
-#define TK_DESC 292
-#define TK_DISTINCT 293