[Libreoffice-commits] .: 9 commits - setup_native/source

Fridrich Strba fridrich at kemper.freedesktop.org
Wed Jul 18 02:07:49 PDT 2012


 setup_native/source/win32/wintools/makecab/makecab.c  |  379 ++++++++++++
 setup_native/source/win32/wintools/makecab/parseddf.c |  382 ++++++++++++
 setup_native/source/win32/wintools/makecab/parseddf.h |   36 +
 setup_native/source/win32/wintools/msidb/msidb.c      |  554 ++++++++++++++++++
 setup_native/source/win32/wintools/msiinfo/msiinfo.c  |  252 ++++++++
 setup_native/source/win32/wintools/msimsp/msimsp.c    |   84 ++
 setup_native/source/win32/wintools/msitran/msitran.c  |  120 +++
 7 files changed, 1807 insertions(+)

New commits:
commit 0977c5121e63522137a7b00c41d07112c192ef9e
Author: Eilidh McAdam <eilidh at lanedo.com>
Date:   Fri Jul 13 14:41:17 2012 +0100

    Use lcab to generate cabinets for now.
    
    lcab is expected in the sys. path.
    
    Change-Id: Ie1cd8a45966bbd84ce84f2ad1d86da492eafa321
    Signed-off-by: Fridrich Å trba <fridrich.strba at bluewin.ch>

diff --git a/setup_native/source/win32/wintools/makecab/makecab.c b/setup_native/source/win32/wintools/makecab/makecab.c
index b822cd6..3cca945 100644
--- a/setup_native/source/win32/wintools/makecab/makecab.c
+++ b/setup_native/source/win32/wintools/makecab/makecab.c
@@ -298,6 +298,8 @@ int main(int argc, char *argv[])
     DDFSRCFILE *srcListCurr = NULL;
     HFCI fci = NULL;
     ERF erf;
+    char * cmd = NULL;
+    unsigned int cmdSize = 0;
 
     while (argv[1] && (argv[1][0] == '-' || argv[1][0] == '/'))
     {
@@ -324,44 +326,45 @@ int main(int argc, char *argv[])
     }
     CabVerb = v;
 
-    srcList = srcListCurr;
-    if (ddfFile != NULL)
+    if (ddfFile == NULL)
     {
-        cabLog(CABLOG_MSG, "=== Parsing directive file \"%s\"===", ddfFile);
-        switch(ParseDdf(ddfFile, &ddfVars, &srcListCurr, v))
-        {
-        case DDFERR_UNREAD: cabLog(CABLOG_ERR, "Could not open directive file."); break;
-        }
-        getcwd(ddfVars.szCabPath, MAX_PATH-1);
-        strcat(ddfVars.szCabPath, "/");
+        cabLog(CABLOG_ERR, "No DDF file specified.");
+        return 1;
     }
 
-    if (srcListCurr != NULL)
+    cabLog(CABLOG_MSG, "=== Parsing directive file \"%s\"===", ddfFile);
+    switch(ParseDdf(ddfFile, &ddfVars, &srcListCurr, v))
     {
-        cabLogCCAB(&ddfVars);
-        fci = FCICreate(&erf, fnFilePlaced, fnMemAlloc, fnMemFree, fnOpen, fnRead,
-                        fnWrite, fnClose, fnSeek, fnDelete, fnGetTempFile, &ddfVars, NULL);
+    case DDFERR_UNREAD: cabLog(CABLOG_ERR, "Could not open directive file."); break;
+    }
+    getcwd(ddfVars.szCabPath, MAX_PATH-1);
+    strcat(ddfVars.szCabPath, "/");
 
-        if (fci != NULL)
-        {
-            cabLog(CABLOG_MSG, "=== Adding files to cabinet ===");
-            for (;srcListCurr != NULL; srcListCurr = srcListCurr->next)
-            {
-                cabLog(CABLOG_MSG, "Adding file: %s%s (%s)", ddfVars.szCabPath, srcListCurr->fileName, srcListCurr->cabName);
-                if (!FCIAddFile(fci, srcListCurr->fileName, srcListCurr->cabName, srcListCurr->extract, fnGetNextCab, fnStatus, fnGetOpenInfo, srcListCurr->cmpType))
-                    cabLogErr(&erf, "A problem occurred while adding a file");
-            }
+    srcList = srcListCurr;
+    if (srcList == NULL)
+    {
+        cabLog(CABLOG_ERR, "No input files were specified.");
+        return 2;
+    }
 
-            cabLog(CABLOG_MSG, "=== Flushing the cabinet ===");
-            if (!FCIFlushCabinet(fci, FALSE, fnGetNextCab, fnStatus))
-                cabLogErr(&erf, "A problem occurred while flushing the cabinet");
-            FCIDestroy(fci);
-        }
-        else
-        {
-            cabLogErr(&erf, "Could not get FCI context");
-        }
+    /* Construct system call to lcab */
+    for(srcListCurr = srcList; srcListCurr != NULL; srcListCurr = srcListCurr->next)
+        cmdSize += strlen(srcListCurr->fileName) + 1;
+    cmdSize += strlen(ddfVars.szCabPath) + strlen(ddfVars.szCab);
+    cmdSize += 6; /* room for "lcab " and \0 */
+    cmd = malloc(cmdSize);
+    strcpy(cmd, "lcab ");
+    for (srcListCurr = srcList; srcListCurr != NULL; srcListCurr = srcListCurr->next)
+    {
+        strcat(cmd, srcListCurr->fileName);
+        strcat(cmd, " ");
     }
+    strcat(cmd, ddfVars.szCabPath);
+    strcat(cmd, ddfVars.szCab);
+
+    cabLog(CABLOG_MSG, "syscall: %s\n", cmd);
+    system(cmd);
+    free(cmd);
 
     cabLog(CABLOG_MSG, "=== Cleaning up resources ===");
     /* Free list of cab source files */
@@ -371,5 +374,6 @@ int main(int argc, char *argv[])
         free(srcListCurr);
         srcListCurr = next;
     }
+    cabLog(CABLOG_MSG, "Cabinet file %s/%s created.", ddfVars.szCabPath, ddfVars.szCab);
     return 0;
 }
commit ae0e379a443585fd34522385144fdd69baa6105f
Author: Eilidh McAdam <eilidh at lanedo.com>
Date:   Tue Jul 10 19:31:26 2012 +0100

    Added functionality to msitran for transforms.
    
    Transforms currently cannot be generated as Wine does not implement
    MsiDatabaseGenerateTransform().
    
    Change-Id: I03507e07f372871eed23ac932426d5708f765884
    Signed-off-by: Fridrich Å trba <fridrich.strba at bluewin.ch>

diff --git a/setup_native/source/win32/wintools/msitran/msitran.c b/setup_native/source/win32/wintools/msitran/msitran.c
index f2669e9..39d6628 100644
--- a/setup_native/source/win32/wintools/msitran/msitran.c
+++ b/setup_native/source/win32/wintools/msitran/msitran.c
@@ -11,9 +11,15 @@
 
 #define WIN32_LEAN_AND_MEAN
 #include <windows.h>
+#include <msi.h>
+#include <msiquery.h>
 
-typedef enum ERRCOND { ERRA = 0x1, ERRB = 0x2, ERRC = 0x4, ERRD = 0x8, ERRE = 0x10, ERRF = 0x20 } ERRCOND;
-static unsigned int err;
+#define MSITRANSFORM_ERROR_ADDEXISTINGROW   0x01
+#define MSITRANSFORM_ERROR_DELMISSINGROW    0x02
+#define MSITRANSFORM_ERROR_ADDEXISTINGTABLE 0x04
+#define MSITRANSFORM_ERROR_DELMISSINGTABLE  0x08
+#define MSITRANSFORM_ERROR_UPDATEMISSINGROW 0x10
+#define MSITRANSFORM_ERROR_CHANGECODEPAGE   0x20
 
 void usage(void)
 {
@@ -31,14 +37,34 @@ void usage(void)
         "  f  Change codepage\n");
 }
 
-void generatePatch(char * basedb, char * refdb, char * transFile)
+BOOL generateTransform(char * basedb, char * refdb, char * transFile, unsigned int err)
 {
+    MSIHANDLE dbHandle, refHandle;
+    UINT r;
+    r = MsiOpenDatabase(basedb, MSIDBOPEN_READONLY, &dbHandle);
+    if (r != ERROR_SUCCESS) return FALSE;
+    r = MsiOpenDatabase (refdb, MSIDBOPEN_READONLY, &refHandle);
+    if (r != ERROR_SUCCESS) return FALSE;
+
+    /* TODO: This isn't implemented in Wine */
+    r = MsiDatabaseGenerateTransform(dbHandle, refHandle, transFile, 0, 0);
+    if (r != ERROR_SUCCESS)
+    {
+        MsiCloseHandle(dbHandle);
+        MsiCloseHandle(refHandle);
+        return FALSE;
+    }
+    r = MsiCreateTransformSummaryInfo(dbHandle, refHandle, transFile, err, 0);
+    MsiCloseHandle(dbHandle);
+    MsiCloseHandle(refHandle);
+
+    return TRUE;
 }
 
 int main(int argc, char *argv[])
 {
     char * genFiles[3] = {0, 0, 0};
-    unsigned int i = 0;
+    unsigned int i, err = 0;
     err = 0;
 
     /* Get parameters */
@@ -73,17 +99,22 @@ int main(int argc, char *argv[])
         {
             switch(tolower(argv[1][i]))
             {
-            case 'a': err |= ERRA; break;
-            case 'b': err |= ERRB; break;
-            case 'c': err |= ERRC; break;
-            case 'd': err |= ERRD; break;
-            case 'e': err |= ERRE; break;
-            case 'f': err |= ERRF; break;
-            }
+            case 'a': err |= MSITRANSFORM_ERROR_ADDEXISTINGROW; break;
+            case 'b': err |= MSITRANSFORM_ERROR_DELMISSINGROW; break;
+            case 'c': err |= MSITRANSFORM_ERROR_ADDEXISTINGTABLE; break;
+            case 'd': err |= MSITRANSFORM_ERROR_DELMISSINGTABLE; break;
+            case 'e': err |= MSITRANSFORM_ERROR_UPDATEMISSINGROW; break;
+            case 'f': err |= MSITRANSFORM_ERROR_CHANGECODEPAGE; break;
+              }
         }
     }
 
-    generatePatch(genFiles[0], genFiles[1], genFiles[2]);
+    /* Perform transformation */
+    if (!generateTransform(genFiles[0], genFiles[1], genFiles[2], err))
+    {
+        printf("An error occurred and the transform could not be generated\n");
+        return 3;
+    }
 
     return 0;
 }
commit a237b03f73574ac46de515fc4671b647d0a8168e
Author: Eilidh McAdam <eilidh at lanedo.com>
Date:   Tue Jul 10 18:19:17 2012 +0100

    Skeleton code for msimsp
    
    Change-Id: I23349edcf15731a9a33b9698bd77893003682e39
    Signed-off-by: Fridrich Å trba <fridrich.strba at bluewin.ch>

diff --git a/setup_native/source/win32/wintools/msimsp/msimsp.c b/setup_native/source/win32/wintools/msimsp/msimsp.c
new file mode 100644
index 0000000..ebea6f0
--- /dev/null
+++ b/setup_native/source/win32/wintools/msimsp/msimsp.c
@@ -0,0 +1,84 @@
+/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#include <stdio.h>
+#include <sys/stat.h>
+
+#define WIN32_LEAN_AND_MEAN
+#include <windows.h>
+
+void usage(void)
+{
+    printf(
+        "Usage: msimsp.exe -s [pcp_path] -p [msp_path] {options}\n"
+        "\nOptions:\n"
+        "-s <pcpfile>  Required. Path to the patch creation properties (.pcp) file.\n"
+        "-p <mspfile>  Required. Path to patch package being created (.msp)\n"
+        "-f <tmpdir>   Path to temporary directory (default: %%TMP%%/~pcw_tmp.tmp/\n"
+        "-k            Fail if temporary directory already exists\n"
+        "-l <logfile>  Path to log file of patch creation process and errors\n"
+/*      "-lp <logfile> Path to log file (includes performance data).\n"
+        "-d            Displays dialog on success\n"*/
+        "-? or -h      Display usage\n");
+}
+
+void createPatch(char * pcpFile, char * mspFile, char * tmpDir, char * logFile)
+{
+}
+
+int main(int argc, char *argv[])
+{
+    char * pcpFile = 0;
+    char * mspFile = 0;
+    char * tmpDir = 0;
+    char * logFile = 0;
+    BOOL chkTmpDir = FALSE;
+    struct stat s;
+
+    /* Get parameters */
+    while (argv[1] && (argv[1][0] == '-' || argv[1][0] == '/'))
+    {
+        switch(tolower(argv[1][1]))
+        {
+        case 's':
+            argv++; argc++;
+            pcpFile = argv[1];
+            break;
+        case 'p':
+            argv++; argc++;
+            mspFile = argv[1];
+            break;
+        case 'f':
+            argv++; argc++;
+            tmpDir = argv[1];
+            break;
+        case 'k':
+            chkTmpDir = TRUE;
+            break;
+        case 'l':
+            argv++; argc++;
+            logFile = argv[1];
+            break;
+        case '?':
+        case 'h':
+            usage();
+            return 0;
+        }
+        argv++; argc++;
+    }
+
+    if (chkTmpDir && stat(tmpDir, &s) == 0 && S_ISDIR(s.st_mode))
+    {
+        printf("Temporary directory exists, please specify another or omit -k\n");
+        return 2;
+    }
+    createPatch(pcpFile, mspFile, tmpDir, logFile);
+
+    return 0;
+}
commit 99716480586148354f4e43436c9e4411e674d57e
Author: Eilidh McAdam <eilidh at lanedo.com>
Date:   Tue Jul 10 18:07:58 2012 +0100

    Skeleton code for msitran
    
    Change-Id: Ic48abd66a04bfaafda846e514b096431e37488a8
    Signed-off-by: Fridrich Å trba <fridrich.strba at bluewin.ch>

diff --git a/setup_native/source/win32/wintools/msitran/msitran.c b/setup_native/source/win32/wintools/msitran/msitran.c
new file mode 100644
index 0000000..f2669e9
--- /dev/null
+++ b/setup_native/source/win32/wintools/msitran/msitran.c
@@ -0,0 +1,89 @@
+/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#include <stdio.h>
+
+#define WIN32_LEAN_AND_MEAN
+#include <windows.h>
+
+typedef enum ERRCOND { ERRA = 0x1, ERRB = 0x2, ERRC = 0x4, ERRD = 0x8, ERRE = 0x10, ERRF = 0x20 } ERRCOND;
+static unsigned int err;
+
+void usage(void)
+{
+    printf(
+        "Usage: msitran.exe -g {basedb}{refdb}{transformfile}[{errorconditions}]\n"
+        "\nOptions:\n"
+        "  -g        Generate a transform\n"
+        "  -? or -h  Display usage\n"
+        "\nError conditions (specify in {errorconditions} to suppress):\n"
+        "  a  Add existing row\n"
+        "  b  Delete non-existing row\n"
+        "  c  Add existing table\n"
+        "  d  Delete non-existing table\n"
+        "  e  Modify existing row\n"
+        "  f  Change codepage\n");
+}
+
+void generatePatch(char * basedb, char * refdb, char * transFile)
+{
+}
+
+int main(int argc, char *argv[])
+{
+    char * genFiles[3] = {0, 0, 0};
+    unsigned int i = 0;
+    err = 0;
+
+    /* Get parameters */
+    while (argv[1] && (argv[1][0] == '-' || argv[1][0] == '/'))
+    {
+        switch(tolower(argv[1][1]))
+        {
+        case 'g':
+            for (i = 0; i < 3; i++)
+            {
+                if (!argv[1])
+                {
+                    printf("Please supply all arguments for generating a transform\n");
+                    return 1;
+                }
+                argv++; argc--;
+                genFiles[i] = argv[1];
+            }
+            break;
+        case '?':
+        case 'h':
+            usage();
+            return 0;
+        }
+        argv++; argc++;
+    }
+
+    /* Record error suppression conditions */
+    if (argv[1])
+    {
+        for (i = 0; i < strlen(argv[1]); i++)
+        {
+            switch(tolower(argv[1][i]))
+            {
+            case 'a': err |= ERRA; break;
+            case 'b': err |= ERRB; break;
+            case 'c': err |= ERRC; break;
+            case 'd': err |= ERRD; break;
+            case 'e': err |= ERRE; break;
+            case 'f': err |= ERRF; break;
+            }
+        }
+    }
+
+    generatePatch(genFiles[0], genFiles[1], genFiles[2]);
+
+    return 0;
+}
commit 0cab13137aac689403c7dfa8a5aed785e88ac0c4
Author: Eilidh McAdam <eilidh at lanedo.com>
Date:   Fri Jul 6 17:44:03 2012 +0100

    Use correct license header for files in this branch.
    
    Change-Id: I7daf3277983b6bf41ddd664c8d4953902b1d0f3e
    Signed-off-by: Fridrich Å trba <fridrich.strba at bluewin.ch>

diff --git a/setup_native/source/win32/wintools/makecab/makecab.c b/setup_native/source/win32/wintools/makecab/makecab.c
index f562157..b822cd6 100644
--- a/setup_native/source/win32/wintools/makecab/makecab.c
+++ b/setup_native/source/win32/wintools/makecab/makecab.c
@@ -1,12 +1,11 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/***********************************************************************
- * msidb.exe
- *
- * Needs -mconsole. See ipconfig.c in wine/programs/ipconfig
- *
- * Copyright 2012 Eilidh McAdam (eilidh at lanedo.com)
+/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
  *
- **********************************************************************/
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
 
 #include <stdio.h>
 #include <stdlib.h>
diff --git a/setup_native/source/win32/wintools/makecab/parseddf.c b/setup_native/source/win32/wintools/makecab/parseddf.c
index 4d4a0c3..0069ee1 100644
--- a/setup_native/source/win32/wintools/makecab/parseddf.c
+++ b/setup_native/source/win32/wintools/makecab/parseddf.c
@@ -1,4 +1,12 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
 #include "parseddf.h"
 #include <sys/stat.h>
 #include <stdarg.h>
diff --git a/setup_native/source/win32/wintools/makecab/parseddf.h b/setup_native/source/win32/wintools/makecab/parseddf.h
index 6b233db..24e681f 100644
--- a/setup_native/source/win32/wintools/makecab/parseddf.h
+++ b/setup_native/source/win32/wintools/makecab/parseddf.h
@@ -1,4 +1,4 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
 #ifndef __PARSEDDF_H__
 #define __PARSEDDF_H__
 
diff --git a/setup_native/source/win32/wintools/msidb/msidb.c b/setup_native/source/win32/wintools/msidb/msidb.c
index 41b4dfd..bce31ef 100644
--- a/setup_native/source/win32/wintools/msidb/msidb.c
+++ b/setup_native/source/win32/wintools/msidb/msidb.c
@@ -1,12 +1,11 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/***********************************************************************
- * msidb.exe
- *
- * Needs -mconsole. See ipconfig.c in wine/programs/ipconfig
+/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
  *
- * Copyright 2012 Eilidh McAdam (eilidh at lanedo.com)
- *
- **********************************************************************/
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
 
 #include <stdio.h>
 #include <stdlib.h>
diff --git a/setup_native/source/win32/wintools/msiinfo/msiinfo.c b/setup_native/source/win32/wintools/msiinfo/msiinfo.c
index 06d76bd..2a33684 100644
--- a/setup_native/source/win32/wintools/msiinfo/msiinfo.c
+++ b/setup_native/source/win32/wintools/msiinfo/msiinfo.c
@@ -1,12 +1,11 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/***********************************************************************
- * msiinfo.exe
+/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
  *
- * Needs -mconsole.
- *
- * Copyright 2012 Eilidh McAdam (eilidh at lanedo.com)
- *
- **********************************************************************/
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
 
 #include <stdio.h>
 #include <stdlib.h>
commit d71bd0dd0b537d3b4558d32073e82714210ab15e
Author: Eilidh McAdam <eilidh at lanedo.com>
Date:   Fri Jul 6 17:28:59 2012 +0100

    Code tidy up of indentation, comments and debug output.
    
    Change-Id: I966d34205db1825d3aa1d328c03418817bf01bc3
    Signed-off-by: Fridrich Å trba <fridrich.strba at bluewin.ch>

diff --git a/setup_native/source/win32/wintools/makecab/makecab.c b/setup_native/source/win32/wintools/makecab/makecab.c
index f4579da..f562157 100644
--- a/setup_native/source/win32/wintools/makecab/makecab.c
+++ b/setup_native/source/win32/wintools/makecab/makecab.c
@@ -37,337 +37,340 @@ static const char * FCI_ERRS[] = {"None", "Error opening source file", "Error re
 
 void cabLog(CABLOGLEVEL lvl, char * msg, ...)
 {
-  va_list args;
-  if (CabVerb < lvl) return;
-
-  switch (lvl)
-  {
-  case CABLOG_WRN: printf("[Warning] "); break;
-  case CABLOG_ERR: printf("[Error] "); break;
-  }
-
-  va_start(args, msg);
-  vprintf(msg, args);
-  va_end(args);
-  printf("\n");
+    va_list args;
+    if (CabVerb < lvl) return;
+
+    switch (lvl)
+    {
+    case CABLOG_WRN: printf("[Warning] "); break;
+    case CABLOG_ERR: printf("[Error] "); break;
+    }
+
+    va_start(args, msg);
+    vprintf(msg, args);
+    va_end(args);
+    printf("\n");
 }
 
 void cabLogErr(PERF erf, char * msg)
 {
-  if (!erf)
-  {
-    cabLog(CABLOG_ERR, "%s: An unknown problem occurred");
-    return;
-  }
-
-  if (erf->erfOper >= 0)
-  {
-    if (erf->erfOper < (sizeof(FCI_ERRS)/sizeof(FCI_ERRS[0])))
-      cabLog(CABLOG_ERR, "%s: %s", msg, FCI_ERRS[erf->erfOper]);
-    else
-      cabLog(CABLOG_ERR, "%s: Unknown error", msg);
-  }
+    if (!erf)
+    {
+        cabLog(CABLOG_ERR, "%s: An unknown problem occurred");
+        return;
+    }
+
+    if (erf->erfOper >= 0)
+    {
+        if (erf->erfOper < (sizeof(FCI_ERRS)/sizeof(FCI_ERRS[0])))
+            cabLog(CABLOG_ERR, "%s: %s", msg, FCI_ERRS[erf->erfOper]);
+        else
+            cabLog(CABLOG_ERR, "%s: Unknown error", msg);
+    }
 }
 
 void cabLogCCAB(PCCAB cc)
 {
-  cabLog(CABLOG_MSG,
-         "cb                 %ld\n"
-         "cbFolderThresh     %ld\n"
-         "cbReserveCFHeader  %d\n"
-         "cbReserveCFFolder  %d\n"
-         "cbReserveCFData    %d\n"
-         "iCab               %d\n"
-         "iDisk              %d\n"
-         "setID              %d\n"
-         "szDisk             %s\n"
-         "szCab              %s\n"
-         "szCabPath          %s\n",
-         cc->cb, cc->cbFolderThresh, cc->cbReserveCFHeader,
-         cc->cbReserveCFFolder, cc->cbReserveCFData, cc->iCab,
-         cc->iDisk, cc->setID, cc->szDisk, cc->szCab, cc->szCabPath);
+    cabLog(CABLOG_MSG,
+           "cb                 %ld\n"
+           "cbFolderThresh     %ld\n"
+           "cbReserveCFHeader  %d\n"
+           "cbReserveCFFolder  %d\n"
+           "cbReserveCFData    %d\n"
+           "iCab               %d\n"
+           "iDisk              %d\n"
+           "setID              %d\n"
+           "szDisk             %s\n"
+           "szCab              %s\n"
+           "szCabPath          %s\n",
+           cc->cb, cc->cbFolderThresh, cc->cbReserveCFHeader,
+           cc->cbReserveCFFolder, cc->cbReserveCFData, cc->iCab,
+           cc->iDisk, cc->setID, cc->szDisk, cc->szCab, cc->szCabPath);
 }
 
+/***********************************************************************
+ * Define FCI callbacks
+ **********************************************************************/
 FNFCIALLOC (fnMemAlloc) /*(ULONG cb)*/
 {
-  return malloc(cb);
+    return malloc(cb);
 }
 
 FNFCIFREE (fnMemFree) /*(void HUGE *memory)*/
 {
-  free(memory);
+    free(memory);
 }
 
 FNFCIOPEN (fnOpen) /*(char *pszFile, int oflag, int pmode, int *err, void *pv)*/
 {
-  FILE * f = NULL;
-  char * mode = "r+";
-  printf("DEBUG: fnOpen file %s\n", pszFile);
-  if (oflag & _O_WRONLY) mode = "w";
-  else if (oflag & _O_RDWR) mode = "r+";
-  else if (oflag & _O_RDONLY) mode = "r";
-
-  if (oflag & _O_CREAT && oflag & _O_RDWR) mode = "w+";
-
-  f = fopen(pszFile, mode);
-  if (f == NULL)
-  {
-    cabLog(CABLOG_ERR, "Could not get handle to file %s", pszFile);
-    *err = -1;
-  }
-
-  return (INT_PTR) f;
+    FILE * f = NULL;
+    char * mode = "r+";
+    printf("DEBUG: fnOpen file %s\n", pszFile);
+    if (oflag & _O_WRONLY) mode = "w";
+    else if (oflag & _O_RDWR) mode = "r+";
+    else if (oflag & _O_RDONLY) mode = "r";
+
+    if (oflag & _O_CREAT && oflag & _O_RDWR) mode = "w+";
+
+    f = fopen(pszFile, mode);
+    if (f == NULL)
+    {
+        cabLog(CABLOG_ERR, "Could not get handle to file %s", pszFile);
+        *err = -1;
+    }
+
+    return (INT_PTR) f;
 }
 
 FNFCIREAD (fnRead) /*(INT_PTR hf, void FAR *memory, UINT cb, int FAR *err, void FAR *pv)*/
 {
-  FILE * f = (FILE *)hf;
-  size_t r = fread(memory, 1, cb, f);
-  printf("DEBUG: fnRead\n");
-  if (r < cb)
-  {
-    if (feof(f))
-    {
-      cabLog(CABLOG_WRN, "Reached EOF while reading file (%d chars remain of %d requested)", r, cb);
-      return r;
-    }
-    else if (ferror(f))
+    FILE * f = (FILE *)hf;
+    size_t r = fread(memory, 1, cb, f);
+    printf("DEBUG: fnRead\n");
+    if (r < cb)
     {
-      cabLog(CABLOG_ERR, "Error while reading file");
+        if (feof(f))
+        {
+            cabLog(CABLOG_WRN, "Reached EOF while reading file (%d chars remain of %d requested)", r, cb);
+            return r;
+        }
+        else if (ferror(f))
+        {
+            cabLog(CABLOG_ERR, "Error while reading file");
+        }
+        *err = -1;
+        return -1;
     }
-    *err = -1;
-    return -1;
-  }
-  return r;
+    return r;
 }
 
 FNFCIWRITE (fnWrite) /*(INT_PTR hf, void FAR *memory, UINT cb, int FAR *err, void FAR *pv)*/
 {
-  unsigned int c;
-  printf("DEBUG: fnWrite\n");
-  if ( !(hf && (c = fwrite(memory, 1, sizeof(memory), (FILE *)hf))) )
-  {
-    if(c < cb)
+    unsigned int c;
+    printf("DEBUG: fnWrite\n");
+    if ( !(hf && (c = fwrite(memory, 1, sizeof(memory), (FILE *)hf))) )
     {
-      *err = -1;
-      return -1;
+        if(c < cb)
+        {
+            *err = -1;
+            return -1;
+        }
     }
-  }
-  return cb;
+    return cb;
 }
 
 FNFCICLOSE (fnClose) /*(INT_PTR hf, int FAR *err, void FAR *pv)*/
 {
-  printf("DEBUG: fnClose\n");
-  if ( !(hf && fclose((FILE *)hf) != EOF) )
-  {
-    *err = -1;
-    return -1;
-  }
-  return 0;
+    printf("DEBUG: fnClose\n");
+    if ( !(hf && fclose((FILE *)hf) != EOF) )
+    {
+        *err = -1;
+        return -1;
+    }
+    return 0;
 }
 
 FNFCISEEK (fnSeek) /*(INT_PTR hf, long dist, int seektype, int FAR *err, void FAR *pv)*/
 {
-  printf("DEBUG: fnSeek\n");
-  if (fseek((FILE *)hf, dist, seektype) != 0)
-  {
-    *err = -1;
-    return -1;
-  }
-  return 0;
+    printf("DEBUG: fnSeek\n");
+    if (fseek((FILE *)hf, dist, seektype) != 0)
+    {
+        *err = -1;
+        return -1;
+    }
+    return 0;
 }
 
 FNFCIDELETE (fnDelete) /*(LPSTR pszFile, int FAR *err, void FAR *pv)*/
 {
-  printf("DEBUG: fnDelete\n");
-  if (remove(pszFile) != 0)
-  {
-    *err = -1;
-    return -1;
-  }
-  return 0;
+    printf("DEBUG: fnDelete\n");
+    if (remove(pszFile) != 0)
+    {
+        *err = -1;
+        return -1;
+    }
+    return 0;
 }
 
 FNFCIGETTEMPFILE (fnGetTempFile) /*(char *pszTempName[bcount(cbTempName)], int cbTempName[range(>=, MAX_PATH)], void FAR *pv)*/
 {
-  BOOL success = FALSE;
-  CHAR tempPath[L_tmpnam];
-  char * r;
-  printf("DEBUG: fnGetTempFile\n");
-  r = tmpnam(tempPath);
-  if (r != NULL)
-  {
-    success = TRUE;
-    strcpy(pszTempName, tempPath);
-    cbTempName = strlen(pszTempName);
-  }
-  return success;
+    BOOL success = FALSE;
+    CHAR tempPath[L_tmpnam];
+    char * r;
+    printf("DEBUG: fnGetTempFile\n");
+    r = tmpnam(tempPath);
+    if (r != NULL)
+    {
+        success = TRUE;
+        strcpy(pszTempName, tempPath);
+        cbTempName = strlen(pszTempName);
+    }
+    return success;
 }
 
 FNFCIFILEPLACED (fnFilePlaced) /*(PCCAB *pccab, LPSTR pszFile, long cbFile, BOOL fContinuation, void FAR *pv)*/
 {
-  printf("DEBUG: fnFilePlaced\n");
-  if (fContinuation == FALSE)
-    cabLog(CABLOG_MSG, "%s (%d b) has been added to %s", pszFile, cbFile, pccab->szCab);
+    printf("DEBUG: fnFilePlaced\n");
+    if (fContinuation == FALSE)
+        cabLog(CABLOG_MSG, "%s (%d b) has been added to %s", pszFile, cbFile, pccab->szCab);
 
-  return 0;
+    return 0;
 }
 
-FNFCIGETNEXTCABINET(fnGetNextCab)/*(PCCAB pccab, ULONG cbPrevCab, void FAR *pv)*/
+FNFCIGETNEXTCABINET(fnGetNextCab) /*(PCCAB pccab, ULONG cbPrevCab, void FAR *pv)*/
 {
-  printf("DEBUG: fnGetNextCab\n");
-  return TRUE;
+    printf("DEBUG: fnGetNextCab\n");
+    return TRUE;
 }
 
-FNFCISTATUS(fnStatus)/*(UINT typeStatus, ULONG cb1, ULONG cb2, void FAR *pv)*/
+FNFCISTATUS(fnStatus) /*(UINT typeStatus, ULONG cb1, ULONG cb2, void FAR *pv)*/
 {
-  switch (typeStatus)
-  {
-  case statusFile:
-    printf("\rCompressing source file (%d bytes compressed from %d)", cb1, cb2);
-    break;
-  case statusFolder:
-    printf("\rCopying data into cabinet (%d of %d)", cb1, cb2);
-    break;
-  case statusCabinet:
-    printf("\rWriting cabinet file (%d of approx. %d bytes)", cb1, cb2);
-    return cb2;
-    break;
-  }
-
-  return 0;
+    switch (typeStatus)
+    {
+    case statusFile:
+        printf("\rCompressing source file (%d bytes compressed from %d)", cb1, cb2);
+        break;
+    case statusFolder:
+        printf("\rCopying data into cabinet (%d of %d)", cb1, cb2);
+        break;
+    case statusCabinet:
+        printf("\rWriting cabinet file (%d of approx. %d bytes)", cb1, cb2);
+        return cb2;
+        break;
+    }
+
+    return 0;
 }
 
-FNFCIGETOPENINFO(fnGetOpenInfo)/*(LPSTR pszName, USHORT *pdate, USHORT *ptime, USHORT *pattribs, int FAR *err, void FAR *pv)*/
+FNFCIGETOPENINFO(fnGetOpenInfo) /*(LPSTR pszName, USHORT *pdate, USHORT *ptime, USHORT *pattribs, int FAR *err, void FAR *pv)*/
 {
-  /* pdate: dddddmmmmyyyyyyy - d [1-31] m [1-12] y offset from 1980 */
-  /* ptime: sssssmmmmhhhhhhh = s [second/2] m [0-59] h [0-23] */
-  struct stat s;
-  struct tm * time;
-  FILE * f = NULL;
-  if (stat(pszName, &s) != -1)
-  {
-    time = gmtime(&s.st_mtime);
-    *pdate = 0;
-    *ptime = 0;
-
-    /* Note: tm_year is years since 1900 */
-    *pdate = (time->tm_mday << 11) | ((time->tm_mon+1) << 7) | (time->tm_year-80);
-    *ptime = ((time->tm_sec / 2) << 11) | (time->tm_min << 6) | (time->tm_hour);
-    f = (FILE *) fnOpen(pszName, _O_RDONLY, 0, err, pv);
-  }
-
-  if (!f)
-  {
-    cabLog(CABLOG_ERR, "Could not access file information: %s", pszName);
-    return -1;
-  }
-  return (INT_PTR) f;
+    /* pdate: dddddmmmmyyyyyyy - d [1-31] m [1-12] y offset from 1980 */
+    /* ptime: sssssmmmmhhhhhhh = s [second/2] m [0-59] h [0-23] */
+    struct stat s;
+    struct tm * time;
+    FILE * f = NULL;
+    if (stat(pszName, &s) != -1)
+    {
+        time = gmtime(&s.st_mtime);
+        *pdate = 0;
+        *ptime = 0;
+
+        /* Note: tm_year is years since 1900 */
+        *pdate = (time->tm_mday << 11) | ((time->tm_mon+1) << 7) | (time->tm_year-80);
+        *ptime = ((time->tm_sec / 2) << 11) | (time->tm_min << 6) | (time->tm_hour);
+        f = (FILE *) fnOpen(pszName, _O_RDONLY, 0, err, pv);
+    }
+
+    if (!f)
+    {
+        cabLog(CABLOG_ERR, "Could not access file information: %s", pszName);
+        return -1;
+    }
+    return (INT_PTR) f;
 }
 
 /*
-MAKECAB [/V[n]] [/D var=value ...] [/L dir] source [destination]
-MAKECAB [/V[n]] [/D var=value ...] /F directive_file [...]
-source  - File to compress.
-destination  - File name to give compressed file. If omitted, the
-last character of the source file name is replaced
-with an underscore (_) and used as the destination.
-/F directives - A file with MakeCAB directives (may be repeated).
-/D var=value - Defines variable with specified value.
-/L dir - Location to place destination (default is current directory).
-/V[n] - Verbosity level (1..3)
+  MAKECAB [/V[n]] [/D var=value ...] [/L dir] source [destination]
+  MAKECAB [/V[n]] [/D var=value ...] /F directive_file [...]
+  source  - File to compress.
+  destination  - File name to give compressed file. If omitted, the
+  last character of the source file name is replaced
+  with an underscore (_) and used as the destination.
+  /F directives - A file with MakeCAB directives (may be repeated).
+  /D var=value - Defines variable with specified value.
+  /L dir - Location to place destination (default is current directory).
+  /V[n] - Verbosity level (1..3)
 */
 void usage(void)
 {
-  printf(
-    "Usage: makecab [/V[n]] /F directive_file\n"
-    "\nOptions:\n"
-    "/F directives - A file with MakeCAB directives.\n"
-    "/V[n] - Verbosity level (1..3)\n");
+    printf(
+        "Usage: makecab [/V[n]] /F directive_file\n"
+        "\nOptions:\n"
+        "/F directives - A file with MakeCAB directives.\n"
+        "/V[n] - Verbosity level (1..3)\n");
 }
 
 int main(int argc, char *argv[])
 {
-  int v = 0;
-  char * ddfFile = NULL;
-  CCAB ddfVars;
-  DDFSRCFILE *srcList = NULL;
-  DDFSRCFILE *srcListCurr = NULL;
-  HFCI fci = NULL;
-  ERF erf;
-
-  while (argv[1] && (argv[1][0] == '-' || argv[1][0] == '/'))
-  {
-    switch(tolower(argv[1][1]))
+    int v = 0;
+    char * ddfFile = NULL;
+    CCAB ddfVars;
+    DDFSRCFILE *srcList = NULL;
+    DDFSRCFILE *srcListCurr = NULL;
+    HFCI fci = NULL;
+    ERF erf;
+
+    while (argv[1] && (argv[1][0] == '-' || argv[1][0] == '/'))
     {
-    case 'f':              /* Directive file specified */
-      argv++; argc--;
-      ddfFile = argv[1];
-      break;
-    case 'v':              /* Verbosity [0-3] */
-      switch(argv[1][2])
-      {
-      case '0': v = 0; break;
-      case '1': v = 1; break;
-      case '2': v = 2; break;
-      case '3': v = 3; break;
-      }
-      break;
-    case '?':
-      usage();
-      return 0;
+        switch(tolower(argv[1][1]))
+        {
+        case 'f':              /* Directive file specified */
+            argv++; argc--;
+            ddfFile = argv[1];
+            break;
+        case 'v':              /* Verbosity [0-3] */
+            switch(argv[1][2])
+            {
+            case '0': v = 0; break;
+            case '1': v = 1; break;
+            case '2': v = 2; break;
+            case '3': v = 3; break;
+            }
+            break;
+        case '?':
+            usage();
+            return 0;
+        }
+        argv++; argc--;
     }
-    argv++; argc--;
-  }
-  CabVerb = v;
-
-  srcList = srcListCurr;
-  if (ddfFile != NULL)
-  {
-    cabLog(CABLOG_MSG, "=== Parsing directive file \"%s\"===", ddfFile);
-    switch(ParseDdf(ddfFile, &ddfVars, &srcListCurr, v))
+    CabVerb = v;
+
+    srcList = srcListCurr;
+    if (ddfFile != NULL)
     {
-    case DDFERR_UNREAD: cabLog(CABLOG_ERR, "Could not open directive file."); break;
+        cabLog(CABLOG_MSG, "=== Parsing directive file \"%s\"===", ddfFile);
+        switch(ParseDdf(ddfFile, &ddfVars, &srcListCurr, v))
+        {
+        case DDFERR_UNREAD: cabLog(CABLOG_ERR, "Could not open directive file."); break;
+        }
+        getcwd(ddfVars.szCabPath, MAX_PATH-1);
+        strcat(ddfVars.szCabPath, "/");
     }
-    getcwd(ddfVars.szCabPath, MAX_PATH-1);
-    strcat(ddfVars.szCabPath, "/");
-  }
 
-  if (srcListCurr != NULL)
-  {
-    cabLogCCAB(&ddfVars);
-    fci = FCICreate(&erf, fnFilePlaced, fnMemAlloc, fnMemFree, fnOpen, fnRead,
-                    fnWrite, fnClose, fnSeek, fnDelete, fnGetTempFile, &ddfVars, NULL);
-
-    if (fci != NULL)
+    if (srcListCurr != NULL)
     {
-      cabLog(CABLOG_MSG, "=== Adding files to cabinet ===");
-      for (;srcListCurr != NULL; srcListCurr = srcListCurr->next)
-      {
-        cabLog(CABLOG_MSG, "Adding file: %s%s (%s)", ddfVars.szCabPath, srcListCurr->fileName, srcListCurr->cabName);
-        if (!FCIAddFile(fci, srcListCurr->fileName, srcListCurr->cabName, srcListCurr->extract, fnGetNextCab, fnStatus, fnGetOpenInfo, srcListCurr->cmpType))
-          cabLogErr(&erf, "A problem occurred while adding a file");
-      }
-
-      cabLog(CABLOG_MSG, "=== Flushing the cabinet ===");
-      if (!FCIFlushCabinet(fci, FALSE, fnGetNextCab, fnStatus))
-        cabLogErr(&erf, "A problem occurred while flushing the cabinet");
-      FCIDestroy(fci);
+        cabLogCCAB(&ddfVars);
+        fci = FCICreate(&erf, fnFilePlaced, fnMemAlloc, fnMemFree, fnOpen, fnRead,
+                        fnWrite, fnClose, fnSeek, fnDelete, fnGetTempFile, &ddfVars, NULL);
+
+        if (fci != NULL)
+        {
+            cabLog(CABLOG_MSG, "=== Adding files to cabinet ===");
+            for (;srcListCurr != NULL; srcListCurr = srcListCurr->next)
+            {
+                cabLog(CABLOG_MSG, "Adding file: %s%s (%s)", ddfVars.szCabPath, srcListCurr->fileName, srcListCurr->cabName);
+                if (!FCIAddFile(fci, srcListCurr->fileName, srcListCurr->cabName, srcListCurr->extract, fnGetNextCab, fnStatus, fnGetOpenInfo, srcListCurr->cmpType))
+                    cabLogErr(&erf, "A problem occurred while adding a file");
+            }
+
+            cabLog(CABLOG_MSG, "=== Flushing the cabinet ===");
+            if (!FCIFlushCabinet(fci, FALSE, fnGetNextCab, fnStatus))
+                cabLogErr(&erf, "A problem occurred while flushing the cabinet");
+            FCIDestroy(fci);
+        }
+        else
+        {
+            cabLogErr(&erf, "Could not get FCI context");
+        }
     }
-    else
+
+    cabLog(CABLOG_MSG, "=== Cleaning up resources ===");
+    /* Free list of cab source files */
+    for (srcListCurr = srcList; srcListCurr != NULL; )
     {
-      cabLogErr(&erf, "Could not get FCI context");
+        struct DDFSRCFILE *const next = srcListCurr->next;
+        free(srcListCurr);
+        srcListCurr = next;
     }
-  }
-
-  cabLog(CABLOG_MSG, "=== Cleaning up resources ===");
-  /* Free list of cab source files */
-  for (srcListCurr = srcList; srcListCurr != NULL; )
-  {
-    struct DDFSRCFILE *const next = srcListCurr->next;
-    free(srcListCurr);
-    srcListCurr = next;
-  }
-  return 0;
+    return 0;
 }
diff --git a/setup_native/source/win32/wintools/makecab/parseddf.c b/setup_native/source/win32/wintools/makecab/parseddf.c
index 6c1aa29..4d4a0c3 100644
--- a/setup_native/source/win32/wintools/makecab/parseddf.c
+++ b/setup_native/source/win32/wintools/makecab/parseddf.c
@@ -15,99 +15,99 @@ static unsigned int DdfVerb = 0;
 /* Trim leading whitespace from a null terminated string */
 void ltrim(char * str)
 {
-  unsigned int i = 0;
-  while (isspace(str[i]) && str[i] != '\0') i++;
-  if (i > 0) memmove(str, str+i, strlen(str)+1-i);
+    unsigned int i = 0;
+    while (isspace(str[i]) && str[i] != '\0') i++;
+    if (i > 0) memmove(str, str+i, strlen(str)+1-i);
 }
 
 /* Trim trailing whitespace from a null terminated string */
 void rtrim(char * str)
 {
-  unsigned int i = strlen(str) - 1;
-  while (isspace(str[i]) && i > 0) i--;
-  if (i) i++;
-  str[i] = '\0';
+    unsigned int i = strlen(str) - 1;
+    while (isspace(str[i]) && i > 0) i--;
+    if (i) i++;
+    str[i] = '\0';
 }
 
 /* Trim trailing and leading whitespace from a null terminated string */
 void trim(char * str)
 {
-  ltrim(str);
-  rtrim(str);
+    ltrim(str);
+    rtrim(str);
 }
 
 void ddfLogProgress(DDFLOGLEVEL lvl, char * desc, unsigned int progress)
 {
-  if (DdfVerb < lvl) return;
-  if (progress == 0) printf("  %s: %3d%%", desc, progress);
-  else if (progress > 0 && progress < 100) printf("\r  %s: %3d%%", desc, progress);
-  else if (progress == 100) printf("\r  %s: 100%%\n", desc);
-  fflush(stdout);
+    if (DdfVerb < lvl) return;
+    if (progress == 0) printf("  %s: %3d%%", desc, progress);
+    else if (progress > 0 && progress < 100) printf("\r  %s: %3d%%", desc, progress);
+    else if (progress == 100) printf("\r  %s: 100%%\n", desc);
+    fflush(stdout);
 }
 
 void ddfLog(DDFLOGLEVEL lvl, char * msg, ...)
 {
-  va_list args;
-  if (DdfVerb < lvl) return;
-
-  switch (lvl)
-  {
-  case DDFLOG_WRN: printf("[Warning] "); break;
-  case DDFLOG_ERR: printf("[Error] "); break;
-  }
-
-  va_start(args, msg);
-  vprintf(msg, args);
-  va_end(args);
-  printf("\n");
+    va_list args;
+    if (DdfVerb < lvl) return;
+
+    switch (lvl)
+    {
+    case DDFLOG_WRN: printf("[Warning] "); break;
+    case DDFLOG_ERR: printf("[Error] "); break;
+    }
+
+    va_start(args, msg);
+    vprintf(msg, args);
+    va_end(args);
+    printf("\n");
 }
 
 void ddfPrintState(DDFLOGLEVEL lvl, PCCAB ccab, DDFSRCFILE * srcList)
 {
-  static const unsigned int SIZE = 2048;
-  char msg[SIZE];
-  char srcLine[DDF_MAX_CHARS];
-  unsigned int len;
-  DDFSRCFILE * srcListCurr;
-
-  if (ccab)
-  {
-    len = sprintf(msg,
-          "=== Directive file state table ===\n"
-          "CabinetName           %s\n"
-          "ReservePerCabinetSize %d\n"
-          "MaxDiskSize           %d\n"
-          "Compress              %d\n"
-          "CompressionMemory     %d\n"
-          "Cabinet               %d\n"
-          "DiskDirectoryTemplate %s",
-          ccab->szCab,
-          ccab->cbReserveCFHeader,
-          ccab->iDisk,
-          1,
-          CompMemory,
-          1,
-          ccab->szCabPath);
-  }
-  else
-  {
-    msg[0] = '\0';
-  }
-  if (!srcList) printf("DEBUG: No list!\n");
-
-  for (srcListCurr = srcList;
-       srcListCurr != NULL && (len = strlen(msg)) < SIZE;
-       srcListCurr = srcListCurr->next)
-  {
-    sprintf(srcLine, "\nsrc: %s (%s) extract? %d MSZIP? %d LZX? %d",
-        srcListCurr->fileName, srcListCurr->cabName,
-        srcListCurr->extract, (srcListCurr->cmpType == tcompTYPE_MSZIP),
-        (srcListCurr->cmpType != tcompTYPE_MSZIP));
-    strncat(msg, srcLine, SIZE-strlen(srcLine)-1);
-  }
-  if (msg[SIZE-1] != '\0') msg[SIZE-1] = '\0';
-
-  ddfLog(lvl, msg);
+    static const unsigned int SIZE = 2048;
+    char msg[SIZE];
+    char srcLine[DDF_MAX_CHARS];
+    unsigned int len;
+    DDFSRCFILE * srcListCurr;
+
+    if (ccab)
+    {
+        len = sprintf(msg,
+                      "=== Directive file state table ===\n"
+                      "CabinetName           %s\n"
+                      "ReservePerCabinetSize %d\n"
+                      "MaxDiskSize           %d\n"
+                      "Compress              %d\n"
+                      "CompressionMemory     %d\n"
+                      "Cabinet               %d\n"
+                      "DiskDirectoryTemplate %s",
+                      ccab->szCab,
+                      ccab->cbReserveCFHeader,
+                      ccab->iDisk,
+                      1,
+                      CompMemory,
+                      1,
+                      ccab->szCabPath);
+    }
+    else
+    {
+        msg[0] = '\0';
+    }
+    if (!srcList) printf("DEBUG: No list!\n");
+
+    for (srcListCurr = srcList;
+         srcListCurr != NULL && (len = strlen(msg)) < SIZE;
+         srcListCurr = srcListCurr->next)
+    {
+        sprintf(srcLine, "\nsrc: %s (%s) extract? %d MSZIP? %d LZX? %d",
+                srcListCurr->fileName, srcListCurr->cabName,
+                srcListCurr->extract, (srcListCurr->cmpType == tcompTYPE_MSZIP),
+                (srcListCurr->cmpType != tcompTYPE_MSZIP));
+        strncat(msg, srcLine, SIZE-strlen(srcLine)-1);
+    }
+    if (msg[SIZE-1] != '\0') msg[SIZE-1] = '\0';
+
+    ddfLog(lvl, msg);
 }
 
 /* Moves the next DDF token from the beginning of *line into *token.
@@ -126,249 +126,249 @@ void ddfPrintState(DDFLOGLEVEL lvl, PCCAB ccab, DDFSRCFILE * srcList)
  */
 DDFERR nextToken(char * token, char * line)
 {
-  unsigned int i = 0;
-  unsigned int r = DDF_OK;
-  unsigned int offset = 0;
-  int c;
-  BOOL esc = FALSE;
-
-  ltrim(line);
-  if (line[0] == '\0' || line[0] == ';') return DDFERR_NO_MORE_TOKENS;
-  if (line[0] == '=')
-  {
-    memmove(line, line+1, strlen(line));
-    trim(line);
-  }
-
-  for (i = 0; i < DDF_MAX_CHARS-1 && i < strlen(line); i++)
-  {
-    /* Chomp delimiting tokens unless they're escaped */
-    c = line[i];
-    if (c == '\"')
+    unsigned int i = 0;
+    unsigned int r = DDF_OK;
+    unsigned int offset = 0;
+    int c;
+    BOOL esc = FALSE;
+
+    ltrim(line);
+    if (line[0] == '\0' || line[0] == ';') return DDFERR_NO_MORE_TOKENS;
+    if (line[0] == '=')
     {
-      esc = !esc;
-      offset++;
-      /* Compress "" to ", otherwise don't add quote to token*/
-      if (i > 0 && line[i-1] != '\"') continue;
-    }
-    else if (c == '\r' || c == '\n')
-    {
-      r = DDFERR_INVALID_ENDL;
-      break;
-    }
-    else if(!esc)
-    {
-      if (isspace(c) || c == '=') { r = DDF_OK; break; }
-      else if (c == ';') { r = DDFERR_NO_MORE_TOKENS; break; }
+        memmove(line, line+1, strlen(line));
+        trim(line);
     }
 
-    token[i - offset] = c;
+    for (i = 0; i < DDF_MAX_CHARS-1 && i < strlen(line); i++)
+    {
+        /* Chomp delimiting tokens unless they're escaped */
+        c = line[i];
+        if (c == '\"')
+        {
+            esc = !esc;
+            offset++;
+            /* Compress "" to ", otherwise don't add quote to token*/
+            if (i > 0 && line[i-1] != '\"') continue;
+        }
+        else if (c == '\r' || c == '\n')
+        {
+            r = DDFERR_INVALID_ENDL;
+            break;
+        }
+        else if(!esc)
+        {
+            if (isspace(c) || c == '=') { r = DDF_OK; break; }
+            else if (c == ';') { r = DDFERR_NO_MORE_TOKENS; break; }
+        }
+
+        token[i - offset] = c;
 
-  }
-  token[i - offset] = '\0';
-  memmove(line, line+i, strlen(line)+1-i);
-  return r;
+    }
+    token[i - offset] = '\0';
+    memmove(line, line+i, strlen(line)+1-i);
+    return r;
 }
 
 DDFERR setVar(DDFVAR key, PCCAB ccab, char * value)
 {
-  int i = 0;
-  char * cp = NULL;
-
-  ddfLog(DDFLOG_MSG, "Setting variable %s=%s...", VARS[key], value);
-
-  switch (key)
-  {
-  case DDF_CABNAME:
-    strncpy(ccab->szCab, value, 255);
-    break;
-  case DDF_RESERVEPERCAB:
-    i = atoi(value);
-    if (i < 0) i = 0;
-    if (i > DDF_MAX_CABRESERVE) i = DDF_MAX_CABRESERVE;
-    if (i % 4 != 0) i -= (i % 4);
-    ccab->cbReserveCFHeader = i;
-    break;
-  case DDF_MAXDISK:
-    i = atoi(value);
-    ccab->cb = i;
-    break;
-  case DDF_COMPTYPE:
-    if (strcmp(value, "LZX") == 0)
+    int i = 0;
+    char * cp = NULL;
+
+    ddfLog(DDFLOG_MSG, "Setting variable %s=%s...", VARS[key], value);
+
+    switch (key)
     {
+    case DDF_CABNAME:
+        strncpy(ccab->szCab, value, 255);
+        break;
+    case DDF_RESERVEPERCAB:
+        i = atoi(value);
+        if (i < 0) i = 0;
+        if (i > DDF_MAX_CABRESERVE) i = DDF_MAX_CABRESERVE;
+        if (i % 4 != 0) i -= (i % 4);
+        ccab->cbReserveCFHeader = i;
+        break;
+    case DDF_MAXDISK:
+        i = atoi(value);
+        ccab->cb = i;
+        break;
+    case DDF_COMPTYPE:
+        if (strcmp(value, "LZX") == 0)
+        {
 /*      if (CompMemory) CompType = TCOMPfromLZXWindow(CompMemory);
-    else CompType = tcompTYPE_LZX;*/
+        else CompType = tcompTYPE_LZX;*/
 /*TODO: LZX not yet supported in Wine */
-    CompType = tcompTYPE_MSZIP;
-    }
-    else
-    {
-      if (strcmp(value, "MSZIP") != 0)
-    ddfLog(DDFLOG_WRN, "Invalid compression type \"%s\", reverting to MSZIP.", value);
-      CompType = tcompTYPE_MSZIP;
+            CompType = tcompTYPE_MSZIP;
+        }
+        else
+        {
+            if (strcmp(value, "MSZIP") != 0)
+                ddfLog(DDFLOG_WRN, "Invalid compression type \"%s\", reverting to MSZIP.", value);
+            CompType = tcompTYPE_MSZIP;
+        }
+        break;
+    case DDF_COMPRESS:
+        break;
+    case DDF_COMPMEM:
+        i = atoi(value);
+        if (i < 15) i = 15;
+        if (i > 21) i = 21;
+        CompMemory = i;
+        if (CompType == tcompTYPE_LZX) CompType = TCOMPfromLZXWindow(CompMemory);
+        break;
+    case DDF_CABINET:
+        break;
+    case DDF_DISKDIRTEMPLATE:
+        while ((cp = strchr(value, '*')) != '\0') *cp = '1';
+        strncpy(ccab->szCabPath, value, 255);
+        break;
     }
-    break;
-  case DDF_COMPRESS:
-    break;
-  case DDF_COMPMEM:
-    i = atoi(value);
-    if (i < 15) i = 15;
-    if (i > 21) i = 21;
-    CompMemory = i;
-    if (CompType == tcompTYPE_LZX) CompType = TCOMPfromLZXWindow(CompMemory);
-    break;
-  case DDF_CABINET:
-    break;
-  case DDF_DISKDIRTEMPLATE:
-    while ((cp = strchr(value, '*')) != '\0') *cp = '1';
-    strncpy(ccab->szCabPath, value, 255);
-    break;
-  }
-
-  return DDF_OK;
+
+    return DDF_OK;
 }
 
 DDFERR parseCmd(char * line, PCCAB ccab, char * token)
 {
-  unsigned int r, i;
-  char *p;
-  for (p = token ; *p; ++p) *p = tolower(*p);
-
-  /* Set command checks lower case token representing var name
-     against known variables. If found, the next token is used as
-     the value to assign */
-  if (strcmp(token, ".set") == 0)
-  {
-    r = nextToken(token, line);
-    if (r != DDF_OK) return DDFERR_FUNC_FAILED;
-
+    unsigned int r, i;
+    char *p;
     for (p = token ; *p; ++p) *p = tolower(*p);
-    if (isdigit(token[strlen(token)-1])) token[strlen(token)-1] = '\0';
-    for (i = 0; i < (sizeof(VARS)/sizeof(VARS[0])); i++)
+
+    /* Set command checks lower case token representing var name
+       against known variables. If found, the next token is used as
+       the value to assign */
+    if (strcmp(token, ".set") == 0)
     {
-      if (strcmp(token, VARS[i]) == 0)
-      {
-    r = nextToken(token, line);
-    if (r != DDF_OK) return DDFERR_FUNC_FAILED;
-    setVar(i, ccab, token);
-    break;
-      }
+        r = nextToken(token, line);
+        if (r != DDF_OK) return DDFERR_FUNC_FAILED;
+
+        for (p = token ; *p; ++p) *p = tolower(*p);
+        if (isdigit(token[strlen(token)-1])) token[strlen(token)-1] = '\0';
+        for (i = 0; i < (sizeof(VARS)/sizeof(VARS[0])); i++)
+        {
+            if (strcmp(token, VARS[i]) == 0)
+            {
+                r = nextToken(token, line);
+                if (r != DDF_OK) return DDFERR_FUNC_FAILED;
+                setVar(i, ccab, token);
+                break;
+            }
+        }
     }
-  }
 
-  return DDF_OK;
+    return DDF_OK;
 }
 
 char * getCabName(char * name)
 {
-  char * cName;
-  if ((cName = strrchr(name, '/')) || (cName = strrchr(name, '\\')))
-    cName++;
-  else
-    cName = name;
-  return cName;
+    char * cName;
+    if ((cName = strrchr(name, '/')) || (cName = strrchr(name, '\\')))
+        cName++;
+    else
+        cName = name;
+    return cName;
 }
 
 DDFERR parseSrc(char * line, DDFSRCFILE ** srcFileList, char * token)
 {
-  unsigned int r;
-  struct stat s;
-  DDFSRCFILE * tmpSrcFile;
-
-  /* Check file exists before allocating DDFSRCFILE */
-  if (stat(token, &s) == -1 && errno == ENOENT)
-  {
-    ddfLog(DDFLOG_WRN, "Could not find file \"%s\"", token);
-    return DDFERR_SRC_SKIPPED;
-  }
-
-  tmpSrcFile = (DDFSRCFILE *) malloc(sizeof(DDFSRCFILE));
-  if (!tmpSrcFile) return DDFERR_FUNC_FAILED;
-  if (!(*srcFileList))
-  {
-     *srcFileList = tmpSrcFile;
-  }
-  else
-  {
-     while ((*srcFileList)->next != NULL) *srcFileList = (*srcFileList)->next;
-    (*srcFileList)->next = tmpSrcFile;
-  }
-
-  strncpy(tmpSrcFile->fileName, token, MAX_PATH);
-  /* Get cabinet file name or construct from src path if unspecified */
-  r = nextToken(token, line);
-  if (r != DDF_OK || token[0] == '/')
-  {
-    strncpy(tmpSrcFile->cabName, getCabName(tmpSrcFile->fileName), DDF_MAX_CABNAME-1);
-  }
-  else
-  {
-    strncpy(tmpSrcFile->cabName, token, DDF_MAX_CABNAME-1);
-  }
-
-  tmpSrcFile->cabName[DDF_MAX_CABNAME-1] = '\0';
-  tmpSrcFile->extract = FALSE;
-  tmpSrcFile->cmpType = CompType;
-  tmpSrcFile->next = NULL;
-
-  return DDF_OK;
-}
-
-DDFERR parseDdfLine(char * line, PCCAB ccab, DDFSRCFILE ** srcList)
-{
-  unsigned int r;
-  char token[DDF_MAX_CHARS];
+    unsigned int r;
+    struct stat s;
+    DDFSRCFILE * tmpSrcFile;
 
-  if (line[0] == '\0') return DDF_OK;
+    /* Check file exists before allocating DDFSRCFILE */
+    if (stat(token, &s) == -1 && errno == ENOENT)
+    {
+        ddfLog(DDFLOG_WRN, "Could not find file \"%s\"", token);
+        return DDFERR_SRC_SKIPPED;
+    }
 
-  ddfLog(DDFLOG_MSG, "Parsing line \"%s\"", line);
+    tmpSrcFile = (DDFSRCFILE *) malloc(sizeof(DDFSRCFILE));
+    if (!tmpSrcFile) return DDFERR_FUNC_FAILED;
+    if (!(*srcFileList))
+    {
+        *srcFileList = tmpSrcFile;
+    }
+    else
+    {
+        while ((*srcFileList)->next != NULL) *srcFileList = (*srcFileList)->next;
+        (*srcFileList)->next = tmpSrcFile;
+    }
 
-  r = nextToken(token,line);
-  if (r == DDF_OK)
-  {
-    if (token[0] == '.')
+    strncpy(tmpSrcFile->fileName, token, MAX_PATH);
+    /* Get cabinet file name or construct from src path if unspecified */
+    r = nextToken(token, line);
+    if (r != DDF_OK || token[0] == '/')
     {
-      r = parseCmd(line, ccab, token);
-      if (r != DDF_OK) ddfLog(DDFLOG_ERR, "Invalid command line skipped: %s%s", token, line);
+        strncpy(tmpSrcFile->cabName, getCabName(tmpSrcFile->fileName), DDF_MAX_CABNAME-1);
     }
     else
     {
-      r = parseSrc(line, srcList, token);
+        strncpy(tmpSrcFile->cabName, token, DDF_MAX_CABNAME-1);
+    }
 
-      if (r == DDFERR_SRC_SKIPPED)
-    ddfLog(DDFLOG_ERR, "Source file command \"%s%s\" couldn't be read - skipped", token, line);
-      else if (r == DDFERR_FUNC_FAILED)
-    ddfLog(DDFLOG_WRN, "Could not parse command correctly, \"%s\" remains", line);
+    tmpSrcFile->cabName[DDF_MAX_CABNAME-1] = '\0';
+    tmpSrcFile->extract = FALSE;
+    tmpSrcFile->cmpType = CompType;
+    tmpSrcFile->next = NULL;
+
+    return DDF_OK;
+}
+
+DDFERR parseDdfLine(char * line, PCCAB ccab, DDFSRCFILE ** srcList)
+{
+    unsigned int r;
+    char token[DDF_MAX_CHARS];
+
+    if (line[0] == '\0') return DDF_OK;
+
+    ddfLog(DDFLOG_MSG, "Parsing line \"%s\"", line);
+
+    r = nextToken(token,line);
+    if (r == DDF_OK)
+    {
+        if (token[0] == '.')
+        {
+            r = parseCmd(line, ccab, token);
+            if (r != DDF_OK) ddfLog(DDFLOG_ERR, "Invalid command line skipped: %s%s", token, line);
+        }
+        else
+        {
+            r = parseSrc(line, srcList, token);
+
+            if (r == DDFERR_SRC_SKIPPED)
+                ddfLog(DDFLOG_ERR, "Source file command \"%s%s\" couldn't be read - skipped", token, line);
+            else if (r == DDFERR_FUNC_FAILED)
+                ddfLog(DDFLOG_WRN, "Could not parse command correctly, \"%s\" remains", line);
+        }
     }
-  }
 
-  return r;
+    return r;
 }
 
 DDFERR ParseDdf(char* ddfFile, PCCAB ccab, DDFSRCFILE ** srcListH, unsigned int v)
 {
-  char fLine[DDF_MAX_CHARS];
-  FILE *ddf = NULL;
-  unsigned int i = 0;
-  DDFSRCFILE * srcListCurr = NULL;
-
-  ddf = fopen(ddfFile, "r");
-  if (ddf == NULL) return DDFERR_UNREAD;
-
-  DdfVerb = v;
-  for (; i < DDF_MAX_LINES && fgets(fLine, sizeof fLine, ddf); i++)
-  {
-    fLine[strlen(fLine)-1] = '\0';
-    parseDdfLine(fLine, ccab, &srcListCurr);
-    if (srcListCurr && !(*srcListH))
+    char fLine[DDF_MAX_CHARS];
+    FILE *ddf = NULL;
+    unsigned int i = 0;
+    DDFSRCFILE * srcListCurr = NULL;
+
+    ddf = fopen(ddfFile, "r");
+    if (ddf == NULL) return DDFERR_UNREAD;
+
+    DdfVerb = v;
+    for (; i < DDF_MAX_LINES && fgets(fLine, sizeof fLine, ddf); i++)
     {
-      *srcListH = srcListCurr;
+        fLine[strlen(fLine)-1] = '\0';
+        parseDdfLine(fLine, ccab, &srcListCurr);
+        if (srcListCurr && !(*srcListH))
+        {
+            *srcListH = srcListCurr;
+        }
     }
-  }
 
-  ddfPrintState(DDFLOG_MSG, ccab, *srcListH);
-  ccab->cbFolderThresh = ccab->cb;
-  ccab->iDisk = 0;
+    ddfPrintState(DDFLOG_MSG, ccab, *srcListH);
+    ccab->cbFolderThresh = ccab->cb;
+    ccab->iDisk = 0;
 
-  return DDF_OK;
+    return DDF_OK;
 }
diff --git a/setup_native/source/win32/wintools/makecab/parseddf.h b/setup_native/source/win32/wintools/makecab/parseddf.h
index 6a46541..6b233db 100644
--- a/setup_native/source/win32/wintools/makecab/parseddf.h
+++ b/setup_native/source/win32/wintools/makecab/parseddf.h
@@ -20,11 +20,11 @@ typedef enum DDFLOGLEVEL { DDFLOG_ERR = 1, DDFLOG_WRN, DDFLOG_MSG } DDFLOGLEVEL;
 
 typedef struct DDFSRCFILE
 {
-  char fileName[MAX_PATH];
-  char cabName[DDF_MAX_CABNAME];
-  BOOL extract;
-  TCOMP cmpType;
-  struct DDFSRCFILE * next;
+    char fileName[MAX_PATH];
+    char cabName[DDF_MAX_CABNAME];
+    BOOL extract;
+    TCOMP cmpType;
+    struct DDFSRCFILE * next;
 } DDFSRCFILE;
 
 unsigned int ParseDdf(char * ddfFile, PCCAB vars, DDFSRCFILE ** srcListH, unsigned int v);
diff --git a/setup_native/source/win32/wintools/msidb/msidb.c b/setup_native/source/win32/wintools/msidb/msidb.c
index c8d9c6f..41b4dfd 100644
--- a/setup_native/source/win32/wintools/msidb/msidb.c
+++ b/setup_native/source/win32/wintools/msidb/msidb.c
@@ -82,21 +82,17 @@ static BOOL msidbImportStorages(LPCWSTR dbfile, LPCWSTR wdir, LPWSTR storageName
         lstrcatW(storagePath, delim);
         lstrcatW(storagePath, storageNames[i]);
 
-        /* WINE_MESSAGE("Importing from %s\n", wine_dbgstr_w(storagePath)); */
-
         rec = MsiCreateRecord(2);
         MsiRecordSetStringW(rec, 1, storageNames[i]);
         r = MsiRecordSetStreamW(rec, 2, storagePath);
         if (r != ERROR_SUCCESS)
         {
-            /* WINE_MESSAGE("Error setting storage %d\n", r); */
             return FALSE;
         }
 
         r = MsiViewExecute(view, rec);
         if (r != ERROR_SUCCESS)
         {
-            /* WINE_MESSAGE("Unable to update with storage record %d\n", r); */
             return FALSE;
         }
 
@@ -133,10 +129,9 @@ static BOOL msidbExportStorage(LPCWSTR dbfile, LPCWSTR wdir, LPWSTR storageName)
 
     if ((r = MsiRecordReadStream(rec, 2, 0, &dataLen)) != ERROR_SUCCESS)
     {
-        /* WINE_MESSAGE("Problem reading stream, error %d %d %d (%d)\n", r, r == ERROR_INVALID_HANDLE, r == ERROR_INVALID_PARAMETER, dataLen ); */
         return FALSE;
     }
-    /* WINE_MESSAGE("Exporting storage %s using query %s\n", storageNameA, queryBuffer); */
+
     if ((dataBuffer = malloc(dataLen)) == NULL) return FALSE;
     if (MsiRecordReadStream(rec, 2, dataBuffer, &dataLen) != ERROR_SUCCESS) return FALSE;
 
@@ -195,14 +190,12 @@ static BOOL msidbImportStreams(LPCWSTR dbfile, LPCWSTR wdir, LPWSTR streamNames[
         r = MsiRecordSetStreamW(rec, 2, streamPath);
         if (r != ERROR_SUCCESS)
         {
-            /* WINE_MESSAGE("Error setting stream %d (%s)\n", r, wine_dbgstr_w(streamNames[i])); */
             return FALSE;
         }
 
         r = MsiViewExecute(view, rec);
         if (r != ERROR_SUCCESS)
         {
-            /* WINE_MESSAGE("Unable to update with stream record %d\n", r); */
             return FALSE;
         }
 
@@ -319,7 +312,6 @@ static BOOL msidbImportTables(LPCWSTR dbfile, LPCWSTR wdir, LPWSTR tables[], BOO
 
     if (r != ERROR_SUCCESS)
     {
-        /* WINE_MESSAGE("Error while opening db: %d %d %d %d\n", r == ERROR_BAD_PATHNAME, r == ERROR_FUNCTION_FAILED, r == ERROR_INVALID_HANDLE, r == ERROR_INVALID_PARAMETER); */
         return FALSE;
     }
 
@@ -336,12 +328,6 @@ static BOOL msidbImportTables(LPCWSTR dbfile, LPCWSTR wdir, LPWSTR tables[], BOO
                 if (strcmp(fileName, ".") == 0 || strcmp(fileName, "..") == 0) continue;
                 tableFile = strdupAtoW(CP_ACP, fileName);
                 r = MsiDatabaseImportW(dbhandle, wdir, tableFile);
-
-                if (r != ERROR_SUCCESS)
-                {
-                    /* WINE_MESSAGE("Failed to import %s from %s\n", wine_dbgstr_w(tableFile), wine_dbgstr_w(wdir)); */
-                }
-
                 free(tableFile);
             }
         }
@@ -360,11 +346,6 @@ static BOOL msidbImportTables(LPCWSTR dbfile, LPCWSTR wdir, LPWSTR tables[], BOO
             lstrcatW(tableFile, ext);
 
             r = MsiDatabaseImportW(dbhandle, wdir, tableFile);
-            if (r != ERROR_SUCCESS)
-            {
-                /* WINE_MESSAGE("Error while importing %s: %d %d %d %d\n", wine_dbgstr_w(tableFile), r == ERROR_BAD_PATHNAME, r == ERROR_FUNCTION_FAILED, r == ERROR_INVALID_HANDLE, r == ERROR_INVALID_PARAMETER); */
-            }
-
             free(tableFile);
 
             if (r != ERROR_SUCCESS)
@@ -426,21 +407,11 @@ static BOOL msidbExportTables(LPCWSTR dbfile, LPCWSTR wdir, LPWSTR tables[])
                 lstrcatW(tableFile, ext);
 
                 r = MsiDatabaseExportW(dbhandle, tableName, wdir, tableFile);
-#ifdef DEBUG
-                if (r != ERROR_SUCCESS)
-                {
-                    /* WINE_MESSAGE("Failed to export %s. Reason: functionfailed(%d) invalidparam(%d) badpath(%d)\n",wine_dbgstr_w(tableFile), r==ERROR_FUNCTION_FAILED, r==ERROR_INVALID_PARAMETER, r==ERROR_BAD_PATHNAME ); */
-                }
-#endif
+
                 free(tableFile);
                 MsiCloseHandle(rec);
             }
-#ifdef DEBUG
-            else
-            {
-                /* WINE_MESSAGE("Failed with error. Size is now %d. Error: %d %d %d\n", size, r == ERROR_MORE_DATA, r == ERROR_INVALID_HANDLE, r == ERROR_INVALID_PARAMETER); */
-            }
-#endif
+
             r = MsiViewFetch(tableListView, &rec);
         }
 
@@ -580,10 +551,5 @@ int wmain(int argc, WCHAR *argv[])
         if (!msidbExportStorage(dbfile, wdir, storageName))
             return 6;
 
-    /*for (i = 0; i < 10; i++)
-      {
-      WINE_MESSAGE("%s\t%s\t%s\t%s\t%s\n", wine_dbgstr_w(iTables[i]), wine_dbgstr_w(oTables[i]), wine_dbgstr_w(streamName), wine_dbgstr_w(streamFiles[i]), wine_dbgstr_w(storageNames[i]));
-      }*/
-
     return 0;
 }
diff --git a/setup_native/source/win32/wintools/msiinfo/msiinfo.c b/setup_native/source/win32/wintools/msiinfo/msiinfo.c
index 932477f..06d76bd 100644
--- a/setup_native/source/win32/wintools/msiinfo/msiinfo.c
+++ b/setup_native/source/win32/wintools/msiinfo/msiinfo.c
@@ -61,186 +61,193 @@ static const char * commandNames[COMMANDS] =
 
 static void parseDate(LPCWSTR value, SYSTEMTIME *time)
 {
-  LPWSTR field;
-  uint len = 4*sizeof(WCHAR);
+    LPWSTR field;
+    uint len = 4*sizeof(WCHAR);
 
-  if (lstrlenW(value) != 19) return;
-  field = malloc(len + sizeof(WCHAR));
-  if (field == NULL) return;
-  memcpy(field, value, len);
-  field[4] = L'\0';
-  time->wYear = atoiW(field);
+    if (lstrlenW(value) != 19) return;
+    field = malloc(len + sizeof(WCHAR));
+    if (field == NULL) return;
+    memcpy(field, value, len);
+    field[4] = L'\0';
+    time->wYear = atoiW(field);
 
-  len = 2 * sizeof(WCHAR);
-  memcpy(field, &(value[5]), len);
-  field[2] = '\0';
-  time->wMonth = atoiW(field);
+    len = 2 * sizeof(WCHAR);
+    memcpy(field, &(value[5]), len);
+    field[2] = '\0';
+    time->wMonth = atoiW(field);
 
-  memcpy(field, &(value[8]), len);
-  time->wDay = atoiW(field);
+    memcpy(field, &(value[8]), len);
+    time->wDay = atoiW(field);
 
-  memcpy(field, &(value[11]), len);
-  time->wHour = atoiW(field);
+    memcpy(field, &(value[11]), len);
+    time->wHour = atoiW(field);
 
-  memcpy(field, &(value[14]), len);
-  time->wMinute = atoiW(field);
+    memcpy(field, &(value[14]), len);
+    time->wMinute = atoiW(field);
 
-  memcpy(field, &(value[17]), len);
-  time->wSecond = atoiW(field);
+    memcpy(field, &(value[17]), len);
+    time->wSecond = atoiW(field);
 
-  free(field);
+    free(field);
 }
 
 static BOOL msiinfoDisplayProperties(LPWSTR dbfile)
 {
-  MSIHANDLE dbhandle, infohandle;
-  uint i, r, dataType;
-  INT iVal;
-  FILETIME ftVal;
-  SYSTEMTIME sysTime;
-  LPWSTR szVal = NULL;
-  DWORD size;
-  r = MsiOpenDatabaseW(dbfile, (LPWSTR) MSIDBOPEN_READONLY, &dbhandle);
-  if (r != ERROR_SUCCESS)
-  {
-    return FALSE;
-  }
-
-  r = MsiGetSummaryInformationW(dbhandle, 0, 0, &infohandle);
-  if (r != ERROR_SUCCESS)
-  {
-    return FALSE;
-  }
-  for (i = 0; i < COMMANDS; i++)
-  {
-    MsiSummaryInfoGetPropertyW(infohandle, commandMap[i][1], &dataType,
-                               &iVal, &ftVal, szVal, &size);
-
-    wprintf(L"%-24s", commandNames[i]);
-    if (dataType == VT_LPSTR)
+    MSIHANDLE dbhandle, infohandle;
+    uint i, r, dataType;
+    INT iVal;
+    FILETIME ftVal;
+    SYSTEMTIME sysTime;
+    LPWSTR szVal = NULL;
+    DWORD size;
+    r = MsiOpenDatabaseW(dbfile, (LPWSTR) MSIDBOPEN_READONLY, &dbhandle);
+    if (r != ERROR_SUCCESS)
     {
-      if (szVal!=NULL) wprintf(L"%ls (%d)\n", szVal, lstrlenW(szVal));
-      else wprintf(L"\n");
+        return FALSE;
     }
-    else if (dataType == VT_FILETIME)
+
+    r = MsiGetSummaryInformationW(dbhandle, 0, 0, &infohandle);
+    if (r != ERROR_SUCCESS)
     {
-      FileTimeToSystemTime(&ftVal, &sysTime);
-      wprintf(L"%04d/%02d/%02d %02d:%02d:%02d\n", sysTime.wYear, sysTime.wMonth,
-         sysTime.wDay, sysTime.wHour, sysTime.wMinute, sysTime.wSecond);
+        return FALSE;
     }
-    else
+    for (i = 0; i < COMMANDS; i++)
     {
-      wprintf(L"%d\n", iVal);
+        MsiSummaryInfoGetPropertyW(infohandle, commandMap[i][1], &dataType,
+                                   &iVal, &ftVal, szVal, &size);
+
+        wprintf(L"%-24s", commandNames[i]);
+        if (dataType == VT_LPSTR)
+        {
+            if (szVal!=NULL) wprintf(L"%ls (%d)\n", szVal, lstrlenW(szVal));
+            else wprintf(L"\n");
+        }
+        else if (dataType == VT_FILETIME)
+        {
+            FileTimeToSystemTime(&ftVal, &sysTime);
+            wprintf(L"%04d/%02d/%02d %02d:%02d:%02d\n", sysTime.wYear, sysTime.wMonth,
+                    sysTime.wDay, sysTime.wHour, sysTime.wMinute, sysTime.wSecond);
+        }
+        else
+        {
+            wprintf(L"%d\n", iVal);
+        }
     }
-  }
 
-  MsiCloseHandle(infohandle);
-  return TRUE;
+    MsiCloseHandle(infohandle);
+    return TRUE;
 }
 
 static BOOL msiinfoUpdateProperty(MSIHANDLE infoHandle, uint property, uint dataType, LPCWSTR value)
 {
-  uint r;
-  int iVal = 0;
-  FILETIME ftVal;
-  SYSTEMTIME sysTime = {0};
-  LPCWSTR szVal = NULL;
-
-  if (dataType == VT_LPSTR) szVal = value;
-  else if (dataType == VT_FILETIME)
-  {
-    parseDate(value, &sysTime);
-    SystemTimeToFileTime(&sysTime, &ftVal);
-  }
-  else
-    iVal = atoiW(value);
-
-  r = MsiSummaryInfoSetPropertyW(infoHandle, property, dataType, iVal, &ftVal, szVal);
-  if (r != ERROR_SUCCESS)
-  {
-    wprintf(L"Problem updating property: %d %d %d %d\n", r == ERROR_DATATYPE_MISMATCH, r == ERROR_FUNCTION_FAILED, ERROR_UNKNOWN_PROPERTY, ERROR_UNSUPPORTED_TYPE);
-    return FALSE;
-  }
-
-  return TRUE;
+    uint r;
+    int iVal = 0;
+    FILETIME ftVal;
+    SYSTEMTIME sysTime = {0};
+    LPCWSTR szVal = NULL;
+
+    if (dataType == VT_LPSTR) szVal = value;
+    else if (dataType == VT_FILETIME)
+    {
+        parseDate(value, &sysTime);
+        SystemTimeToFileTime(&sysTime, &ftVal);
+    }
+    else
+        iVal = atoiW(value);
+
+    r = MsiSummaryInfoSetPropertyW(infoHandle, property, dataType, iVal, &ftVal, szVal);
+    if (r != ERROR_SUCCESS)
+    {
+        wprintf(L"Problem updating property: %d %d %d %d\n", r == ERROR_DATATYPE_MISMATCH, r == ERROR_FUNCTION_FAILED, ERROR_UNKNOWN_PROPERTY, ERROR_UNSUPPORTED_TYPE);
+        return FALSE;
+    }
+
+    return TRUE;
 }
 
 static void usage(void)
 {
-  WINE_MESSAGE(
-    "Usage: msiinfo {database} [[-b]-d] {options} {data}\n"
-    "\nOptions:\n"
-    "  -c <cp>       Specify codepage\n"
-    "  -t <title>    Specify title\n"
-    "  -j <subject>  Specify subject\n"
-    "  -a <author>   Specify author\n"
-    "  -k <keywords> Specify keywords\n"
-    "  -o <comment>  Specify comments\n"
-    "  -p <template> Specify template\n"
-    "  -l <author>   Specify last author\n"
-    "  -v <revno>    Specify revision number\n"
-    "  -s <date>     Specify last printed date\n"
-    "  -r <date>     Specify creation date\n"
-    "  -q <date>     Specify date of last save\n"
-    "  -g <pages>    Specify page count\n"
-    "  -w <words>    Specify word count\n"
-    "  -h <chars>    Specify character count\n"
-    "  -n <appname>  Specify application which created the database\n"
-    "  -u <security> Specify security (0: none, 2: read only (rec.) 3: read only (enforced)\n");
+    wprintf(
+        L"Usage: msiinfo {database} [[-b]-d] {options} {data}\n"
+        L"\nOptions:\n"
+        L"  -c <cp>       Specify codepage\n"
+        L"  -t <title>    Specify title\n"
+        L"  -j <subject>  Specify subject\n"
+        L"  -a <author>   Specify author\n"
+        L"  -k <keywords> Specify keywords\n"
+        L"  -o <comment>  Specify comments\n"
+        L"  -p <template> Specify template\n"
+        L"  -l <author>   Specify last author\n"
+        L"  -v <revno>    Specify revision number\n"
+        L"  -s <date>     Specify last printed date\n"
+        L"  -r <date>     Specify creation date\n"
+        L"  -q <date>     Specify date of last save\n"
+        L"  -g <pages>    Specify page count\n"
+        L"  -w <words>    Specify word count\n"
+        L"  -h <chars>    Specify character count\n"
+        L"  -n <appname>  Specify application which created the database\n"
+        L"  -u <security> Specify security (0: none, 2: read only (rec.) 3: read only (enforced)\n");
 }
 
 int wmain(int argc, WCHAR *argv[])
 {
-  WCHAR *dbfile = NULL;
-  uint i = 0;
-  MSIHANDLE dbhandle, infohandle;
-  uint r;
-  LPWSTR value = 0;
-
-  if (argc > 1)
-  {
-    dbfile = argv[1];
-    argv++; argc--;
-  }
-
-  if (argc == 1)
-  {
-    msiinfoDisplayProperties(dbfile);
-    return 0;
-  }
-
-  r = MsiOpenDatabaseW(dbfile, (LPWSTR) MSIDBOPEN_TRANSACT, &dbhandle);
-  if (r != ERROR_SUCCESS) return 1;
-  r = MsiGetSummaryInformationW(dbhandle, 0, 20, &infohandle);
-  if (r != ERROR_SUCCESS) return 2;
+    WCHAR *dbfile = NULL;
+    uint i = 0;
+    MSIHANDLE dbhandle, infohandle;
+    uint r;
+    LPWSTR value = 0;
+    static const WCHAR h1[] = {'/', '?', 0};
+    static const WCHAR h2[] = {'-', '?', 0};
+
+    if (argc > 1)
+    {
+        dbfile = argv[1];
+        argv++; argc--;
+    }
 
-  while (argv[1] && argv[1][0] == '-')
-  {
-    switch (argv[1][1])
+    if (strcmpW(dbfile, h1) == 0 || strcmpW(dbfile, h2) == 0)
     {
-    case '?':
-    case 'h':
-      usage();
-      return 0;
-    default:
-      for (i = 0; i < COMMANDS; i++)
-      {
-    if (commandMap[i][0] == argv[1][1])
+        usage();
+        return 0;
+    }
+    else if (argc == 1)
     {
-      argv++; argc--;
-      value = argv[1];
-      msiinfoUpdateProperty(infohandle, commandMap[i][1], commandMap[i][2], value);
-      break;
+        msiinfoDisplayProperties(dbfile);
+        return 0;
     }
-      }
-      break;
+
+    r = MsiOpenDatabaseW(dbfile, (LPWSTR) MSIDBOPEN_TRANSACT, &dbhandle);
+    if (r != ERROR_SUCCESS) return 1;
+    r = MsiGetSummaryInformationW(dbhandle, 0, 20, &infohandle);
+    if (r != ERROR_SUCCESS) return 2;
+
+    while (argv[1] && argv[1][0] == '-')
+    {
+        switch (argv[1][1])
+        {
+        case '?':
+        case 'h':
+            usage();
+            return 0;
+        default:
+            for (i = 0; i < COMMANDS; i++)
+            {
+                if (commandMap[i][0] == argv[1][1])
+                {
+                    argv++; argc--;
+                    value = argv[1];
+                    msiinfoUpdateProperty(infohandle, commandMap[i][1], commandMap[i][2], value);
+                    break;
+                }
+            }
+            break;
+        }
+        argv++; argc--;
     }
-    argv++; argc--;
-  }
-
-  MsiSummaryInfoPersist(infohandle);
-  MsiDatabaseCommit(dbhandle);
-  MsiCloseHandle(dbhandle);
-  msiinfoDisplayProperties(dbfile);
-  return 0;
+
+    MsiSummaryInfoPersist(infohandle);
+    MsiDatabaseCommit(dbhandle);
+    MsiCloseHandle(dbhandle);
+    msiinfoDisplayProperties(dbfile);
+    return 0;
 }
commit 9167f0a1a89ee2567449e4bd8bd21b02d8316be1
Author: Eilidh McAdam <eilidh at lanedo.com>
Date:   Mon Jul 2 18:53:12 2012 +0100

    Initial makecab implementation to parse .ddf files.
    
    Currently, makecab does not output .cab files. A subset of the ddf
    format is interpreted.
    
    Change-Id: Iae11aefb4759a0eb76f9455b2206b59864086af5
    Signed-off-by: Fridrich Å trba <fridrich.strba at bluewin.ch>

diff --git a/setup_native/source/win32/wintools/makecab/makecab.c b/setup_native/source/win32/wintools/makecab/makecab.c
new file mode 100644
index 0000000..f4579da
--- /dev/null
+++ b/setup_native/source/win32/wintools/makecab/makecab.c
@@ -0,0 +1,373 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/***********************************************************************
+ * msidb.exe
+ *
+ * Needs -mconsole. See ipconfig.c in wine/programs/ipconfig
+ *
+ * Copyright 2012 Eilidh McAdam (eilidh at lanedo.com)
+ *
+ **********************************************************************/
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <stdarg.h>
+#include <sys/stat.h>
+#include <time.h>
+#include <unistd.h>
+#include <zlib.h>
+#define WIN32_LEAN_AND_MEAN
+#include <windows.h>
+
+#include "parseddf.h"
+
+#define _O_RDONLY 0
+#define _O_WRONLY 1
+#define _O_RDWR 2
+#define _O_CREAT 0x0100
+
+#define _A_RDONLY 1
+#define _A_HIDDEN 2
+#define _A_SYSTEM 4
+#define _A_ARCH 0x20
+
+typedef enum CABLOGLEVEL { CABLOG_ERR = 1, CABLOG_WRN, CABLOG_MSG } CABLOGLEVEL;
+typedef enum CABERR { CAB_OK, CABERR_DDF_UNOPENED } CABERR;
+static unsigned int CabVerb = 0;
+static const char * FCI_ERRS[] = {"None", "Error opening source file", "Error reading source file", "Error allocating memory", "Error creating temporary file", "Unknown compression type specified", "Error creating cabinet file", "Compression was manually aborted", "Error compressing data", "Cabinet data size or file count limits exceeded"};
+
+void cabLog(CABLOGLEVEL lvl, char * msg, ...)
+{
+  va_list args;
+  if (CabVerb < lvl) return;
+
+  switch (lvl)
+  {
+  case CABLOG_WRN: printf("[Warning] "); break;
+  case CABLOG_ERR: printf("[Error] "); break;
+  }
+
+  va_start(args, msg);
+  vprintf(msg, args);
+  va_end(args);
+  printf("\n");
+}
+
+void cabLogErr(PERF erf, char * msg)
+{
+  if (!erf)
+  {
+    cabLog(CABLOG_ERR, "%s: An unknown problem occurred");
+    return;
+  }
+
+  if (erf->erfOper >= 0)
+  {
+    if (erf->erfOper < (sizeof(FCI_ERRS)/sizeof(FCI_ERRS[0])))
+      cabLog(CABLOG_ERR, "%s: %s", msg, FCI_ERRS[erf->erfOper]);
+    else
+      cabLog(CABLOG_ERR, "%s: Unknown error", msg);
+  }
+}
+
+void cabLogCCAB(PCCAB cc)
+{
+  cabLog(CABLOG_MSG,
+         "cb                 %ld\n"
+         "cbFolderThresh     %ld\n"
+         "cbReserveCFHeader  %d\n"
+         "cbReserveCFFolder  %d\n"
+         "cbReserveCFData    %d\n"
+         "iCab               %d\n"
+         "iDisk              %d\n"
+         "setID              %d\n"
+         "szDisk             %s\n"
+         "szCab              %s\n"
+         "szCabPath          %s\n",
+         cc->cb, cc->cbFolderThresh, cc->cbReserveCFHeader,
+         cc->cbReserveCFFolder, cc->cbReserveCFData, cc->iCab,
+         cc->iDisk, cc->setID, cc->szDisk, cc->szCab, cc->szCabPath);
+}
+
+FNFCIALLOC (fnMemAlloc) /*(ULONG cb)*/
+{
+  return malloc(cb);
+}
+
+FNFCIFREE (fnMemFree) /*(void HUGE *memory)*/
+{
+  free(memory);
+}
+
+FNFCIOPEN (fnOpen) /*(char *pszFile, int oflag, int pmode, int *err, void *pv)*/
+{
+  FILE * f = NULL;
+  char * mode = "r+";
+  printf("DEBUG: fnOpen file %s\n", pszFile);
+  if (oflag & _O_WRONLY) mode = "w";
+  else if (oflag & _O_RDWR) mode = "r+";
+  else if (oflag & _O_RDONLY) mode = "r";
+
+  if (oflag & _O_CREAT && oflag & _O_RDWR) mode = "w+";
+
+  f = fopen(pszFile, mode);
+  if (f == NULL)
+  {
+    cabLog(CABLOG_ERR, "Could not get handle to file %s", pszFile);
+    *err = -1;
+  }
+
+  return (INT_PTR) f;
+}
+
+FNFCIREAD (fnRead) /*(INT_PTR hf, void FAR *memory, UINT cb, int FAR *err, void FAR *pv)*/
+{
+  FILE * f = (FILE *)hf;
+  size_t r = fread(memory, 1, cb, f);
+  printf("DEBUG: fnRead\n");
+  if (r < cb)
+  {
+    if (feof(f))
+    {
+      cabLog(CABLOG_WRN, "Reached EOF while reading file (%d chars remain of %d requested)", r, cb);
+      return r;
+    }
+    else if (ferror(f))
+    {
+      cabLog(CABLOG_ERR, "Error while reading file");
+    }
+    *err = -1;
+    return -1;
+  }
+  return r;
+}
+
+FNFCIWRITE (fnWrite) /*(INT_PTR hf, void FAR *memory, UINT cb, int FAR *err, void FAR *pv)*/
+{
+  unsigned int c;
+  printf("DEBUG: fnWrite\n");
+  if ( !(hf && (c = fwrite(memory, 1, sizeof(memory), (FILE *)hf))) )
+  {
+    if(c < cb)
+    {
+      *err = -1;
+      return -1;
+    }
+  }
+  return cb;
+}
+
+FNFCICLOSE (fnClose) /*(INT_PTR hf, int FAR *err, void FAR *pv)*/
+{
+  printf("DEBUG: fnClose\n");
+  if ( !(hf && fclose((FILE *)hf) != EOF) )
+  {
+    *err = -1;
+    return -1;
+  }
+  return 0;
+}
+
+FNFCISEEK (fnSeek) /*(INT_PTR hf, long dist, int seektype, int FAR *err, void FAR *pv)*/
+{
+  printf("DEBUG: fnSeek\n");
+  if (fseek((FILE *)hf, dist, seektype) != 0)
+  {
+    *err = -1;
+    return -1;
+  }
+  return 0;
+}
+
+FNFCIDELETE (fnDelete) /*(LPSTR pszFile, int FAR *err, void FAR *pv)*/
+{
+  printf("DEBUG: fnDelete\n");
+  if (remove(pszFile) != 0)
+  {
+    *err = -1;
+    return -1;
+  }
+  return 0;
+}
+
+FNFCIGETTEMPFILE (fnGetTempFile) /*(char *pszTempName[bcount(cbTempName)], int cbTempName[range(>=, MAX_PATH)], void FAR *pv)*/
+{
+  BOOL success = FALSE;
+  CHAR tempPath[L_tmpnam];
+  char * r;
+  printf("DEBUG: fnGetTempFile\n");
+  r = tmpnam(tempPath);
+  if (r != NULL)
+  {
+    success = TRUE;
+    strcpy(pszTempName, tempPath);
+    cbTempName = strlen(pszTempName);
+  }
+  return success;
+}
+
+FNFCIFILEPLACED (fnFilePlaced) /*(PCCAB *pccab, LPSTR pszFile, long cbFile, BOOL fContinuation, void FAR *pv)*/
+{
+  printf("DEBUG: fnFilePlaced\n");
+  if (fContinuation == FALSE)
+    cabLog(CABLOG_MSG, "%s (%d b) has been added to %s", pszFile, cbFile, pccab->szCab);
+
+  return 0;
+}
+
+FNFCIGETNEXTCABINET(fnGetNextCab)/*(PCCAB pccab, ULONG cbPrevCab, void FAR *pv)*/
+{
+  printf("DEBUG: fnGetNextCab\n");
+  return TRUE;
+}
+
+FNFCISTATUS(fnStatus)/*(UINT typeStatus, ULONG cb1, ULONG cb2, void FAR *pv)*/
+{
+  switch (typeStatus)
+  {
+  case statusFile:
+    printf("\rCompressing source file (%d bytes compressed from %d)", cb1, cb2);
+    break;
+  case statusFolder:
+    printf("\rCopying data into cabinet (%d of %d)", cb1, cb2);
+    break;
+  case statusCabinet:
+    printf("\rWriting cabinet file (%d of approx. %d bytes)", cb1, cb2);
+    return cb2;
+    break;
+  }
+
+  return 0;
+}
+
+FNFCIGETOPENINFO(fnGetOpenInfo)/*(LPSTR pszName, USHORT *pdate, USHORT *ptime, USHORT *pattribs, int FAR *err, void FAR *pv)*/
+{
+  /* pdate: dddddmmmmyyyyyyy - d [1-31] m [1-12] y offset from 1980 */
+  /* ptime: sssssmmmmhhhhhhh = s [second/2] m [0-59] h [0-23] */
+  struct stat s;
+  struct tm * time;
+  FILE * f = NULL;
+  if (stat(pszName, &s) != -1)
+  {
+    time = gmtime(&s.st_mtime);
+    *pdate = 0;
+    *ptime = 0;
+
+    /* Note: tm_year is years since 1900 */
+    *pdate = (time->tm_mday << 11) | ((time->tm_mon+1) << 7) | (time->tm_year-80);
+    *ptime = ((time->tm_sec / 2) << 11) | (time->tm_min << 6) | (time->tm_hour);
+    f = (FILE *) fnOpen(pszName, _O_RDONLY, 0, err, pv);
+  }
+
+  if (!f)
+  {
+    cabLog(CABLOG_ERR, "Could not access file information: %s", pszName);
+    return -1;
+  }
+  return (INT_PTR) f;
+}
+
+/*
+MAKECAB [/V[n]] [/D var=value ...] [/L dir] source [destination]
+MAKECAB [/V[n]] [/D var=value ...] /F directive_file [...]
+source  - File to compress.
+destination  - File name to give compressed file. If omitted, the
+last character of the source file name is replaced
+with an underscore (_) and used as the destination.
+/F directives - A file with MakeCAB directives (may be repeated).
+/D var=value - Defines variable with specified value.
+/L dir - Location to place destination (default is current directory).
+/V[n] - Verbosity level (1..3)
+*/
+void usage(void)
+{
+  printf(
+    "Usage: makecab [/V[n]] /F directive_file\n"
+    "\nOptions:\n"
+    "/F directives - A file with MakeCAB directives.\n"
+    "/V[n] - Verbosity level (1..3)\n");
+}
+
+int main(int argc, char *argv[])
+{
+  int v = 0;
+  char * ddfFile = NULL;
+  CCAB ddfVars;
+  DDFSRCFILE *srcList = NULL;
+  DDFSRCFILE *srcListCurr = NULL;
+  HFCI fci = NULL;
+  ERF erf;
+
+  while (argv[1] && (argv[1][0] == '-' || argv[1][0] == '/'))
+  {
+    switch(tolower(argv[1][1]))
+    {
+    case 'f':              /* Directive file specified */
+      argv++; argc--;
+      ddfFile = argv[1];
+      break;
+    case 'v':              /* Verbosity [0-3] */
+      switch(argv[1][2])
+      {
+      case '0': v = 0; break;
+      case '1': v = 1; break;
+      case '2': v = 2; break;
+      case '3': v = 3; break;
+      }
+      break;
+    case '?':
+      usage();
+      return 0;
+    }
+    argv++; argc--;
+  }
+  CabVerb = v;
+
+  srcList = srcListCurr;
+  if (ddfFile != NULL)
+  {
+    cabLog(CABLOG_MSG, "=== Parsing directive file \"%s\"===", ddfFile);
+    switch(ParseDdf(ddfFile, &ddfVars, &srcListCurr, v))
+    {
+    case DDFERR_UNREAD: cabLog(CABLOG_ERR, "Could not open directive file."); break;
+    }
+    getcwd(ddfVars.szCabPath, MAX_PATH-1);
+    strcat(ddfVars.szCabPath, "/");
+  }
+
+  if (srcListCurr != NULL)
+  {
+    cabLogCCAB(&ddfVars);
+    fci = FCICreate(&erf, fnFilePlaced, fnMemAlloc, fnMemFree, fnOpen, fnRead,
+                    fnWrite, fnClose, fnSeek, fnDelete, fnGetTempFile, &ddfVars, NULL);
+
+    if (fci != NULL)
+    {
+      cabLog(CABLOG_MSG, "=== Adding files to cabinet ===");
+      for (;srcListCurr != NULL; srcListCurr = srcListCurr->next)
+      {
+        cabLog(CABLOG_MSG, "Adding file: %s%s (%s)", ddfVars.szCabPath, srcListCurr->fileName, srcListCurr->cabName);
+        if (!FCIAddFile(fci, srcListCurr->fileName, srcListCurr->cabName, srcListCurr->extract, fnGetNextCab, fnStatus, fnGetOpenInfo, srcListCurr->cmpType))
+          cabLogErr(&erf, "A problem occurred while adding a file");
+      }
+
+      cabLog(CABLOG_MSG, "=== Flushing the cabinet ===");
+      if (!FCIFlushCabinet(fci, FALSE, fnGetNextCab, fnStatus))
+        cabLogErr(&erf, "A problem occurred while flushing the cabinet");
+      FCIDestroy(fci);
+    }
+    else
+    {
+      cabLogErr(&erf, "Could not get FCI context");
+    }
+  }
+
+  cabLog(CABLOG_MSG, "=== Cleaning up resources ===");
+  /* Free list of cab source files */
+  for (srcListCurr = srcList; srcListCurr != NULL; )
+  {
+    struct DDFSRCFILE *const next = srcListCurr->next;
+    free(srcListCurr);
+    srcListCurr = next;
+  }
+  return 0;
+}
diff --git a/setup_native/source/win32/wintools/makecab/parseddf.c b/setup_native/source/win32/wintools/makecab/parseddf.c
new file mode 100644
index 0000000..6c1aa29
--- /dev/null
+++ b/setup_native/source/win32/wintools/makecab/parseddf.c
@@ -0,0 +1,374 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+#include "parseddf.h"
+#include <sys/stat.h>
+#include <stdarg.h>
+#include <stdio.h>
+#include <errno.h>
+
+extern int errno;
+static const char * VARS[] = {"cabinetname", "reservepercabinetsize", "maxdisksize", "compressiontype", "compress", "compressionmemory", "cabinet", "diskdirectorytemplate"};
+static const unsigned int VARS_COUNT = 8;
+static int CompMemory = 0;
+static TCOMP CompType = tcompTYPE_MSZIP;
+static unsigned int DdfVerb = 0;
+
+/* Trim leading whitespace from a null terminated string */
+void ltrim(char * str)
+{
+  unsigned int i = 0;
+  while (isspace(str[i]) && str[i] != '\0') i++;
+  if (i > 0) memmove(str, str+i, strlen(str)+1-i);
+}
+
+/* Trim trailing whitespace from a null terminated string */
+void rtrim(char * str)
+{
+  unsigned int i = strlen(str) - 1;
+  while (isspace(str[i]) && i > 0) i--;
+  if (i) i++;
+  str[i] = '\0';
+}
+
+/* Trim trailing and leading whitespace from a null terminated string */
+void trim(char * str)
+{
+  ltrim(str);
+  rtrim(str);
+}
+
+void ddfLogProgress(DDFLOGLEVEL lvl, char * desc, unsigned int progress)
+{
+  if (DdfVerb < lvl) return;
+  if (progress == 0) printf("  %s: %3d%%", desc, progress);
+  else if (progress > 0 && progress < 100) printf("\r  %s: %3d%%", desc, progress);
+  else if (progress == 100) printf("\r  %s: 100%%\n", desc);
+  fflush(stdout);
+}
+
+void ddfLog(DDFLOGLEVEL lvl, char * msg, ...)
+{
+  va_list args;
+  if (DdfVerb < lvl) return;
+
+  switch (lvl)
+  {
+  case DDFLOG_WRN: printf("[Warning] "); break;
+  case DDFLOG_ERR: printf("[Error] "); break;
+  }
+
+  va_start(args, msg);
+  vprintf(msg, args);
+  va_end(args);
+  printf("\n");
+}
+
+void ddfPrintState(DDFLOGLEVEL lvl, PCCAB ccab, DDFSRCFILE * srcList)
+{
+  static const unsigned int SIZE = 2048;
+  char msg[SIZE];
+  char srcLine[DDF_MAX_CHARS];
+  unsigned int len;
+  DDFSRCFILE * srcListCurr;
+
+  if (ccab)
+  {
+    len = sprintf(msg,
+          "=== Directive file state table ===\n"
+          "CabinetName           %s\n"
+          "ReservePerCabinetSize %d\n"
+          "MaxDiskSize           %d\n"
+          "Compress              %d\n"
+          "CompressionMemory     %d\n"
+          "Cabinet               %d\n"
+          "DiskDirectoryTemplate %s",
+          ccab->szCab,
+          ccab->cbReserveCFHeader,
+          ccab->iDisk,
+          1,
+          CompMemory,
+          1,
+          ccab->szCabPath);
+  }
+  else
+  {
+    msg[0] = '\0';
+  }
+  if (!srcList) printf("DEBUG: No list!\n");
+
+  for (srcListCurr = srcList;
+       srcListCurr != NULL && (len = strlen(msg)) < SIZE;
+       srcListCurr = srcListCurr->next)
+  {
+    sprintf(srcLine, "\nsrc: %s (%s) extract? %d MSZIP? %d LZX? %d",
+        srcListCurr->fileName, srcListCurr->cabName,
+        srcListCurr->extract, (srcListCurr->cmpType == tcompTYPE_MSZIP),
+        (srcListCurr->cmpType != tcompTYPE_MSZIP));
+    strncat(msg, srcLine, SIZE-strlen(srcLine)-1);
+  }
+  if (msg[SIZE-1] != '\0') msg[SIZE-1] = '\0';
+
+  ddfLog(lvl, msg);
+}
+
+/* Moves the next DDF token from the beginning of *line into *token.
+ *
+ * Currently supported token delimiters are:
+ * whitespace (trimmed when not quoted)
+ * ; demarks the start of a comment
+ * " escapes whitespace, quotes and =
+ * = when setting values
+ * \n \r - only if file has endline incompatibility
+ *
+ * returns:
+ * DDF_OK More tokens remain
+ * DDFERR_NO_MORE_TOKENS At the end of the (usable) line.
+ * DDFERR_INVALID_ENDL Token up to this point is stored, endline is chomped.
+ */
+DDFERR nextToken(char * token, char * line)
+{
+  unsigned int i = 0;
+  unsigned int r = DDF_OK;
+  unsigned int offset = 0;
+  int c;
+  BOOL esc = FALSE;
+
+  ltrim(line);
+  if (line[0] == '\0' || line[0] == ';') return DDFERR_NO_MORE_TOKENS;
+  if (line[0] == '=')
+  {
+    memmove(line, line+1, strlen(line));
+    trim(line);
+  }
+
+  for (i = 0; i < DDF_MAX_CHARS-1 && i < strlen(line); i++)
+  {
+    /* Chomp delimiting tokens unless they're escaped */
+    c = line[i];
+    if (c == '\"')
+    {
+      esc = !esc;
+      offset++;
+      /* Compress "" to ", otherwise don't add quote to token*/
+      if (i > 0 && line[i-1] != '\"') continue;
+    }
+    else if (c == '\r' || c == '\n')
+    {
+      r = DDFERR_INVALID_ENDL;
+      break;
+    }
+    else if(!esc)
+    {
+      if (isspace(c) || c == '=') { r = DDF_OK; break; }
+      else if (c == ';') { r = DDFERR_NO_MORE_TOKENS; break; }
+    }
+
+    token[i - offset] = c;
+
+  }
+  token[i - offset] = '\0';
+  memmove(line, line+i, strlen(line)+1-i);
+  return r;
+}
+
+DDFERR setVar(DDFVAR key, PCCAB ccab, char * value)
+{
+  int i = 0;
+  char * cp = NULL;
+
+  ddfLog(DDFLOG_MSG, "Setting variable %s=%s...", VARS[key], value);
+
+  switch (key)
+  {
+  case DDF_CABNAME:
+    strncpy(ccab->szCab, value, 255);
+    break;
+  case DDF_RESERVEPERCAB:
+    i = atoi(value);
+    if (i < 0) i = 0;
+    if (i > DDF_MAX_CABRESERVE) i = DDF_MAX_CABRESERVE;
+    if (i % 4 != 0) i -= (i % 4);
+    ccab->cbReserveCFHeader = i;
+    break;
+  case DDF_MAXDISK:
+    i = atoi(value);
+    ccab->cb = i;
+    break;
+  case DDF_COMPTYPE:
+    if (strcmp(value, "LZX") == 0)
+    {
+/*      if (CompMemory) CompType = TCOMPfromLZXWindow(CompMemory);
+    else CompType = tcompTYPE_LZX;*/
+/*TODO: LZX not yet supported in Wine */
+    CompType = tcompTYPE_MSZIP;
+    }
+    else
+    {
+      if (strcmp(value, "MSZIP") != 0)
+    ddfLog(DDFLOG_WRN, "Invalid compression type \"%s\", reverting to MSZIP.", value);
+      CompType = tcompTYPE_MSZIP;
+    }
+    break;
+  case DDF_COMPRESS:
+    break;
+  case DDF_COMPMEM:
+    i = atoi(value);
+    if (i < 15) i = 15;
+    if (i > 21) i = 21;
+    CompMemory = i;
+    if (CompType == tcompTYPE_LZX) CompType = TCOMPfromLZXWindow(CompMemory);
+    break;
+  case DDF_CABINET:
+    break;
+  case DDF_DISKDIRTEMPLATE:
+    while ((cp = strchr(value, '*')) != '\0') *cp = '1';
+    strncpy(ccab->szCabPath, value, 255);
+    break;
+  }
+
+  return DDF_OK;
+}
+
+DDFERR parseCmd(char * line, PCCAB ccab, char * token)
+{
+  unsigned int r, i;
+  char *p;
+  for (p = token ; *p; ++p) *p = tolower(*p);
+
+  /* Set command checks lower case token representing var name
+     against known variables. If found, the next token is used as
+     the value to assign */
+  if (strcmp(token, ".set") == 0)
+  {
+    r = nextToken(token, line);
+    if (r != DDF_OK) return DDFERR_FUNC_FAILED;
+
+    for (p = token ; *p; ++p) *p = tolower(*p);
+    if (isdigit(token[strlen(token)-1])) token[strlen(token)-1] = '\0';
+    for (i = 0; i < (sizeof(VARS)/sizeof(VARS[0])); i++)
+    {
+      if (strcmp(token, VARS[i]) == 0)
+      {
+    r = nextToken(token, line);
+    if (r != DDF_OK) return DDFERR_FUNC_FAILED;
+    setVar(i, ccab, token);
+    break;
+      }
+    }
+  }
+
+  return DDF_OK;
+}
+
+char * getCabName(char * name)
+{
+  char * cName;
+  if ((cName = strrchr(name, '/')) || (cName = strrchr(name, '\\')))
+    cName++;
+  else
+    cName = name;
+  return cName;
+}
+
+DDFERR parseSrc(char * line, DDFSRCFILE ** srcFileList, char * token)
+{
+  unsigned int r;
+  struct stat s;
+  DDFSRCFILE * tmpSrcFile;
+
+  /* Check file exists before allocating DDFSRCFILE */
+  if (stat(token, &s) == -1 && errno == ENOENT)
+  {
+    ddfLog(DDFLOG_WRN, "Could not find file \"%s\"", token);
+    return DDFERR_SRC_SKIPPED;
+  }
+
+  tmpSrcFile = (DDFSRCFILE *) malloc(sizeof(DDFSRCFILE));
+  if (!tmpSrcFile) return DDFERR_FUNC_FAILED;
+  if (!(*srcFileList))
+  {
+     *srcFileList = tmpSrcFile;
+  }
+  else
+  {
+     while ((*srcFileList)->next != NULL) *srcFileList = (*srcFileList)->next;
+    (*srcFileList)->next = tmpSrcFile;
+  }
+
+  strncpy(tmpSrcFile->fileName, token, MAX_PATH);
+  /* Get cabinet file name or construct from src path if unspecified */
+  r = nextToken(token, line);
+  if (r != DDF_OK || token[0] == '/')
+  {
+    strncpy(tmpSrcFile->cabName, getCabName(tmpSrcFile->fileName), DDF_MAX_CABNAME-1);
+  }
+  else
+  {
+    strncpy(tmpSrcFile->cabName, token, DDF_MAX_CABNAME-1);
+  }
+
+  tmpSrcFile->cabName[DDF_MAX_CABNAME-1] = '\0';
+  tmpSrcFile->extract = FALSE;
+  tmpSrcFile->cmpType = CompType;
+  tmpSrcFile->next = NULL;
+
+  return DDF_OK;
+}
+
+DDFERR parseDdfLine(char * line, PCCAB ccab, DDFSRCFILE ** srcList)
+{
+  unsigned int r;
+  char token[DDF_MAX_CHARS];
+
+  if (line[0] == '\0') return DDF_OK;
+
+  ddfLog(DDFLOG_MSG, "Parsing line \"%s\"", line);
+
+  r = nextToken(token,line);
+  if (r == DDF_OK)
+  {
+    if (token[0] == '.')
+    {
+      r = parseCmd(line, ccab, token);
+      if (r != DDF_OK) ddfLog(DDFLOG_ERR, "Invalid command line skipped: %s%s", token, line);
+    }
+    else
+    {
+      r = parseSrc(line, srcList, token);
+
+      if (r == DDFERR_SRC_SKIPPED)
+    ddfLog(DDFLOG_ERR, "Source file command \"%s%s\" couldn't be read - skipped", token, line);
+      else if (r == DDFERR_FUNC_FAILED)
+    ddfLog(DDFLOG_WRN, "Could not parse command correctly, \"%s\" remains", line);
+    }
+  }
+
+  return r;
+}
+
+DDFERR ParseDdf(char* ddfFile, PCCAB ccab, DDFSRCFILE ** srcListH, unsigned int v)
+{
+  char fLine[DDF_MAX_CHARS];
+  FILE *ddf = NULL;
+  unsigned int i = 0;
+  DDFSRCFILE * srcListCurr = NULL;
+
+  ddf = fopen(ddfFile, "r");
+  if (ddf == NULL) return DDFERR_UNREAD;
+
+  DdfVerb = v;
+  for (; i < DDF_MAX_LINES && fgets(fLine, sizeof fLine, ddf); i++)
+  {
+    fLine[strlen(fLine)-1] = '\0';
+    parseDdfLine(fLine, ccab, &srcListCurr);
+    if (srcListCurr && !(*srcListH))
+    {
+      *srcListH = srcListCurr;
+    }
+  }
+
+  ddfPrintState(DDFLOG_MSG, ccab, *srcListH);
+  ccab->cbFolderThresh = ccab->cb;
+  ccab->iDisk = 0;
+
+  return DDF_OK;
+}
diff --git a/setup_native/source/win32/wintools/makecab/parseddf.h b/setup_native/source/win32/wintools/makecab/parseddf.h
new file mode 100644
index 0000000..6a46541
--- /dev/null
+++ b/setup_native/source/win32/wintools/makecab/parseddf.h
@@ -0,0 +1,36 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+#ifndef __PARSEDDF_H__
+#define __PARSEDDF_H__
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+#include <windows.h>
+#include <fci.h>
+
+typedef enum DDFLINETYPE { DDF_NONE, DDF_CMD, DDF_SRC } DDFLINETYPE;
+typedef enum DDFERR { DDF_OK, DDFERR_INVALID_ENDL, DDFERR_NO_MORE_TOKENS, DDFERR_FUNC_FAILED, DDFERR_SRC_SKIPPED, DDFERR_UNREAD } DDFERR;
+typedef enum DDFVAR { DDF_CABNAME, DDF_RESERVEPERCAB, DDF_MAXDISK, DDF_COMPTYPE, DDF_COMPRESS, DDF_COMPMEM, DDF_CABINET, DDF_DISKDIRTEMPLATE } DDFVAR;
+typedef enum DDFLOGLEVEL { DDFLOG_ERR = 1, DDFLOG_WRN, DDFLOG_MSG } DDFLOGLEVEL;
+
+#define DDF_MAX_CHARS 1024
+#define DDF_MAX_LINES 1024
+#define DDF_MAX_CABRESERVE 60000
+#define DDF_MAX_CABNAME 50
+
+typedef struct DDFSRCFILE
+{
+  char fileName[MAX_PATH];
+  char cabName[DDF_MAX_CABNAME];
+  BOOL extract;
+  TCOMP cmpType;
+  struct DDFSRCFILE * next;
+} DDFSRCFILE;
+
+unsigned int ParseDdf(char * ddfFile, PCCAB vars, DDFSRCFILE ** srcListH, unsigned int v);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __PARSEDDF_H__ */
commit 2921203806ce262696ae2c10c19ad456bcaac375
Author: Eilidh McAdam <eilidh at lanedo.com>
Date:   Mon Jul 2 18:52:16 2012 +0100

    Initial implementation of msiinfo.
    
    Msiinfo supports the change of most summary information. Unsupported:
    -b, -d
    
    Change-Id: I51466c9acea54fe151db966c4ce47b29f90ab937
    Signed-off-by: Fridrich Å trba <fridrich.strba at bluewin.ch>

diff --git a/setup_native/source/win32/wintools/msiinfo/msiinfo.c b/setup_native/source/win32/wintools/msiinfo/msiinfo.c
new file mode 100644
index 0000000..932477f
--- /dev/null
+++ b/setup_native/source/win32/wintools/msiinfo/msiinfo.c
@@ -0,0 +1,246 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/***********************************************************************
+ * msiinfo.exe
+ *
+ * Needs -mconsole.
+ *
+ * Copyright 2012 Eilidh McAdam (eilidh at lanedo.com)
+ *
+ **********************************************************************/
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <dirent.h>
+
+#define WIN32_LEAN_AND_MEAN
+#include <windows.h>
+#include <msi.h>
+#include <msiquery.h>
+#include <msidefs.h>
+#include <wchar.h>
+
+#define WINE_NO_TRACE_MSGS 1
+#define WINE_NO_DEBUG_MSGS 1
+
+#include "wine/unicode.h"
+#include "wine/debug.h"
+#include "wtypes.h"
+
+#define MAX_TABLES 50
+#define MAX_STREAMS 10
+#define MAX_STORAGES 10
+#define MAX_TABLE_NAME 50
+#define MAX_STREAM_NAME 62
+#define MAX_STORAGE_NAME 31
+#define COMMANDS 17
+
+static const uint commandMap[COMMANDS][4] =
+{{'c', PID_CODEPAGE, VT_I2},
+ {'t', PID_TITLE, VT_LPSTR},
+ {'j', PID_SUBJECT, VT_LPSTR},
+ {'a', PID_AUTHOR, VT_LPSTR},
+ {'k', PID_KEYWORDS, VT_LPSTR},
+ {'o', PID_COMMENTS, VT_LPSTR},
+ {'p', PID_TEMPLATE, VT_LPSTR},
+ {'l', PID_LASTAUTHOR, VT_LPSTR},
+ {'v', PID_REVNUMBER, VT_LPSTR},
+ {'s', PID_LASTPRINTED, VT_FILETIME},
+ {'r', PID_CREATE_DTM, VT_FILETIME},
+ {'q', PID_LASTSAVE_DTM, VT_FILETIME},
+ {'g', PID_PAGECOUNT, VT_I4},
+ {'w', PID_WORDCOUNT, VT_I4},
+ {'h', PID_CHARCOUNT, VT_I4},
+ {'n', PID_APPNAME, VT_LPSTR},
+ {'u', PID_SECURITY, VT_I4}};
+
+static const char * commandNames[COMMANDS] =
+{"Codepage", "Title", "Subject", "Author", "Keywords", "Comments",
+ "Template", "Last Saved By", "Revision Number", "Last Printed",
+ "Create Time/Date", "Last Save Time/Date", "Page Count", "Word Count",
+ "Character Count", "Creating Application", "Security"};
+
+static void parseDate(LPCWSTR value, SYSTEMTIME *time)
+{
+  LPWSTR field;
+  uint len = 4*sizeof(WCHAR);
+
+  if (lstrlenW(value) != 19) return;
+  field = malloc(len + sizeof(WCHAR));
+  if (field == NULL) return;
+  memcpy(field, value, len);
+  field[4] = L'\0';
+  time->wYear = atoiW(field);
+
+  len = 2 * sizeof(WCHAR);
+  memcpy(field, &(value[5]), len);
+  field[2] = '\0';
+  time->wMonth = atoiW(field);
+
+  memcpy(field, &(value[8]), len);
+  time->wDay = atoiW(field);
+
+  memcpy(field, &(value[11]), len);
+  time->wHour = atoiW(field);
+
+  memcpy(field, &(value[14]), len);
+  time->wMinute = atoiW(field);
+
+  memcpy(field, &(value[17]), len);
+  time->wSecond = atoiW(field);
+
+  free(field);
+}
+
+static BOOL msiinfoDisplayProperties(LPWSTR dbfile)
+{
+  MSIHANDLE dbhandle, infohandle;
+  uint i, r, dataType;
+  INT iVal;
+  FILETIME ftVal;
+  SYSTEMTIME sysTime;
+  LPWSTR szVal = NULL;
+  DWORD size;
+  r = MsiOpenDatabaseW(dbfile, (LPWSTR) MSIDBOPEN_READONLY, &dbhandle);
+  if (r != ERROR_SUCCESS)
+  {
+    return FALSE;
+  }
+
+  r = MsiGetSummaryInformationW(dbhandle, 0, 0, &infohandle);
+  if (r != ERROR_SUCCESS)
+  {
+    return FALSE;
+  }
+  for (i = 0; i < COMMANDS; i++)
+  {
+    MsiSummaryInfoGetPropertyW(infohandle, commandMap[i][1], &dataType,
+                               &iVal, &ftVal, szVal, &size);
+
+    wprintf(L"%-24s", commandNames[i]);
+    if (dataType == VT_LPSTR)
+    {
+      if (szVal!=NULL) wprintf(L"%ls (%d)\n", szVal, lstrlenW(szVal));
+      else wprintf(L"\n");
+    }
+    else if (dataType == VT_FILETIME)
+    {
+      FileTimeToSystemTime(&ftVal, &sysTime);
+      wprintf(L"%04d/%02d/%02d %02d:%02d:%02d\n", sysTime.wYear, sysTime.wMonth,
+         sysTime.wDay, sysTime.wHour, sysTime.wMinute, sysTime.wSecond);
+    }
+    else
+    {
+      wprintf(L"%d\n", iVal);
+    }
+  }
+
+  MsiCloseHandle(infohandle);
+  return TRUE;
+}
+
+static BOOL msiinfoUpdateProperty(MSIHANDLE infoHandle, uint property, uint dataType, LPCWSTR value)
+{
+  uint r;
+  int iVal = 0;
+  FILETIME ftVal;
+  SYSTEMTIME sysTime = {0};
+  LPCWSTR szVal = NULL;
+
+  if (dataType == VT_LPSTR) szVal = value;
+  else if (dataType == VT_FILETIME)
+  {
+    parseDate(value, &sysTime);
+    SystemTimeToFileTime(&sysTime, &ftVal);
+  }
+  else
+    iVal = atoiW(value);
+
+  r = MsiSummaryInfoSetPropertyW(infoHandle, property, dataType, iVal, &ftVal, szVal);
+  if (r != ERROR_SUCCESS)
+  {
+    wprintf(L"Problem updating property: %d %d %d %d\n", r == ERROR_DATATYPE_MISMATCH, r == ERROR_FUNCTION_FAILED, ERROR_UNKNOWN_PROPERTY, ERROR_UNSUPPORTED_TYPE);
+    return FALSE;
+  }
+
+  return TRUE;
+}
+
+static void usage(void)
+{
+  WINE_MESSAGE(
+    "Usage: msiinfo {database} [[-b]-d] {options} {data}\n"
+    "\nOptions:\n"
+    "  -c <cp>       Specify codepage\n"
+    "  -t <title>    Specify title\n"
+    "  -j <subject>  Specify subject\n"
+    "  -a <author>   Specify author\n"
+    "  -k <keywords> Specify keywords\n"
+    "  -o <comment>  Specify comments\n"
+    "  -p <template> Specify template\n"
+    "  -l <author>   Specify last author\n"
+    "  -v <revno>    Specify revision number\n"
+    "  -s <date>     Specify last printed date\n"
+    "  -r <date>     Specify creation date\n"
+    "  -q <date>     Specify date of last save\n"
+    "  -g <pages>    Specify page count\n"
+    "  -w <words>    Specify word count\n"
+    "  -h <chars>    Specify character count\n"
+    "  -n <appname>  Specify application which created the database\n"
+    "  -u <security> Specify security (0: none, 2: read only (rec.) 3: read only (enforced)\n");
+}
+
+int wmain(int argc, WCHAR *argv[])
+{
+  WCHAR *dbfile = NULL;
+  uint i = 0;
+  MSIHANDLE dbhandle, infohandle;
+  uint r;
+  LPWSTR value = 0;
+
+  if (argc > 1)
+  {
+    dbfile = argv[1];
+    argv++; argc--;
+  }
+
+  if (argc == 1)
+  {
+    msiinfoDisplayProperties(dbfile);
+    return 0;
+  }
+
+  r = MsiOpenDatabaseW(dbfile, (LPWSTR) MSIDBOPEN_TRANSACT, &dbhandle);
+  if (r != ERROR_SUCCESS) return 1;
+  r = MsiGetSummaryInformationW(dbhandle, 0, 20, &infohandle);
+  if (r != ERROR_SUCCESS) return 2;
+
+  while (argv[1] && argv[1][0] == '-')
+  {
+    switch (argv[1][1])
+    {
+    case '?':
+    case 'h':
+      usage();
+      return 0;
+    default:
+      for (i = 0; i < COMMANDS; i++)
+      {
+    if (commandMap[i][0] == argv[1][1])
+    {
+      argv++; argc--;
+      value = argv[1];
+      msiinfoUpdateProperty(infohandle, commandMap[i][1], commandMap[i][2], value);
+      break;
+    }
+      }
+      break;
+    }
+    argv++; argc--;
+  }
+
+  MsiSummaryInfoPersist(infohandle);
+  MsiDatabaseCommit(dbhandle);
+  MsiCloseHandle(dbhandle);
+  msiinfoDisplayProperties(dbfile);
+  return 0;
+}
commit 5d4a9127a4af92c49a8c73dfd7597db4772c58c4
Author: Eilidh McAdam <eilidh at lanedo.com>
Date:   Mon Jul 2 18:48:02 2012 +0100

    Initial crossmsi branch with first msidb implementation.
    
    Msidb is a subset of MS msidb. Currently unsupported options are:

... etc. - the rest is truncated


More information about the Libreoffice-commits mailing list