summaryrefslogtreecommitdiff
path: root/setup_native
diff options
context:
space:
mode:
authorStephan Bergmann <sbergman@redhat.com>2017-02-10 14:05:21 +0100
committerStephan Bergmann <sbergman@redhat.com>2017-02-10 18:01:27 +0000
commit8646ab97dc37c0606b19057686bf3d610f9c15ee (patch)
tree17b3df6f5cf55cb1091c4aa70930dd415d9ea0e3 /setup_native
parent09e9274fc080b471393b806617eb03124db67590 (diff)
Remove MinGW support
In OOo times, there'd originally been efforts to allow building on Windows with MinGW. Later, in LO times, this has been shifted to an attempt of cross- compiling for Windows on Linux. That attempt can be considered abandoned, and the relevant code rotting. Due to this heritage, there are now three kinds of MinGW-specific code in LO: * Code from the original OOo native Windows effort that is no longer relevant for the LO cross-compilation effort, but has never been removed properly. * Code from the original OOo native Windows effort that is re-purposed for the LO cross-compilation effort. * Code that has been added specifially for the LO cross-compilation effort. All three kinds of code are removed. (An unrelated, remaining use of MinGW is for --enable-build-unowinreg, utilizing --with-mingw-cross-compiler, MINGWCXX, and MINGWSTRIP.) Change-Id: I49daad8669b4cbe49fa923050c4a4a6ff7dda568 Reviewed-on: https://gerrit.libreoffice.org/34127 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
Diffstat (limited to 'setup_native')
-rw-r--r--setup_native/CustomTarget_wintools.mk38
-rw-r--r--setup_native/Module_setup_native.mk13
-rw-r--r--setup_native/Package_wintools.mk22
-rw-r--r--setup_native/source/win32/wintools/makecab/makecab.c379
-rw-r--r--setup_native/source/win32/wintools/makecab/parseddf.c386
-rw-r--r--setup_native/source/win32/wintools/makecab/parseddf.h46
-rw-r--r--setup_native/source/win32/wintools/msidb/msidb.c620
-rw-r--r--setup_native/source/win32/wintools/msiinfo/msiinfo.c254
-rw-r--r--setup_native/source/win32/wintools/msimsp/msimsp.c86
-rw-r--r--setup_native/source/win32/wintools/msitran/msitran.c122
10 files changed, 1 insertions, 1965 deletions
diff --git a/setup_native/CustomTarget_wintools.mk b/setup_native/CustomTarget_wintools.mk
deleted file mode 100644
index 0436bc48ba1a..000000000000
--- a/setup_native/CustomTarget_wintools.mk
+++ /dev/null
@@ -1,38 +0,0 @@
-# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*-
-#
-# 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/.
-#
-
-wintools_WORKDIR := $(call gb_CustomTarget_get_workdir,setup_native/wintools)
-wintools_SRCDIR := $(SRCDIR)/setup_native/source/win32/wintools
-
-$(eval $(call gb_CustomTarget_CustomTarget,setup_native/wintools))
-
-$(eval $(call gb_CustomTarget_register_targets,setup_native/wintools,\
- makecab.exe \
- msidb.exe \
- msiinfo.exe \
- msimsp.exe \
- msitran.exe \
-))
-
-$(wintools_WORKDIR)/makecab.exe: $(wintools_SRCDIR)/makecab/makecab.c $(wintools_SRCDIR)/makecab/parseddf.c
- $(WINEGCC) -o $@ $< -m32 -mconsole -lmsi
-
-$(wintools_WORKDIR)/msidb.exe: $(wintools_SRCDIR)/msidb/msidb.c
- $(WINEGCC) -o $@ $< -m32 -municode -lmsi
-
-$(wintools_WORKDIR)/msiinfo.exe: $(wintools_SRCDIR)/msiinfo/msiinfo.c
- $(WINEGCC) -o $@ $< -m32 -mconsole -municode -lmsi
-
-$(wintools_WORKDIR)/msimsp.exe: $(wintools_SRCDIR)/msimsp/msimsp.c
- $(WINEGCC) -o $@ $< -m32 -mconsole -lmsi
-
-$(wintools_WORKDIR)/msitran.exe: $(wintools_SRCDIR)/msitran/msitran.c
- $(WINEGCC) -o $@ $< -m32 -mconsole -lmsi
-
-# vim: set noet sw=4 ts=4:
diff --git a/setup_native/Module_setup_native.mk b/setup_native/Module_setup_native.mk
index 163bd4e24a88..d19e57c0c554 100644
--- a/setup_native/Module_setup_native.mk
+++ b/setup_native/Module_setup_native.mk
@@ -21,7 +21,7 @@ $(eval $(call gb_Module_add_targets,setup_native,\
) \
))
-ifeq ($(OS)$(COM),WNTMSC)
+ifeq ($(OS),WNT)
$(eval $(call gb_Module_add_targets,setup_native,\
Library_instooofiltmsi \
Library_qslnkmsi \
@@ -35,17 +35,6 @@ $(eval $(call gb_Module_add_targets,setup_native,\
StaticLibrary_seterror \
))
-else
-
-ifneq ($(WINEGCC),)
-# this is supposed to be built on the _build_ platform, even though the
-# result is an .exe
-$(eval $(call gb_Module_add_targets,setup_native,\
- CustomTarget_wintools \
- Package_wintools \
-))
-endif
-
endif
# vim: set noet sw=4 ts=4:
diff --git a/setup_native/Package_wintools.mk b/setup_native/Package_wintools.mk
deleted file mode 100644
index 5d9662e192e2..000000000000
--- a/setup_native/Package_wintools.mk
+++ /dev/null
@@ -1,22 +0,0 @@
-# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*-
-#
-# 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/.
-#
-
-$(eval $(call gb_Package_Package,setup_native_wintools,$(call gb_CustomTarget_get_workdir,setup_native/wintools)))
-
-$(error FIXME do not deliver this stuff to OUTDIR)
-
-$(eval $(call gb_Package_add_files,setup_native_wintools,bin,\
- makecab.exe \
- msidb.exe \
- msiinfo.exe \
- msimsp.exe \
- msitran.exe\
-))
-
-# vim: set noet sw=4 ts=4:
diff --git a/setup_native/source/win32/wintools/makecab/makecab.c b/setup_native/source/win32/wintools/makecab/makecab.c
deleted file mode 100644
index a5c7acda1a8e..000000000000
--- a/setup_native/source/win32/wintools/makecab/makecab.c
+++ /dev/null
@@ -1,379 +0,0 @@
-/* -*- 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>
-#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 < SAL_N_ELEMENTS(FCI_ERRS))
- 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);
-}
-
-/***********************************************************************
- * Define FCI callbacks
- **********************************************************************/
-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;
- }
-
- 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;
- char * cmd = NULL;
- unsigned int cmdSize = 0;
-
- 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;
-
- if (ddfFile == NULL)
- {
- cabLog(CABLOG_ERR, "No DDF file specified.");
- usage();
- return 0;
- }
-
- 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, "/");
-
- srcList = srcListCurr;
- if (srcList == NULL)
- {
- cabLog(CABLOG_ERR, "No input files were specified.");
- return 2;
- }
-
- /* 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 */
- for (srcListCurr = srcList; srcListCurr != NULL; )
- {
- struct DDFSRCFILE *const next = srcListCurr->next;
- free(srcListCurr);
- srcListCurr = next;
- }
- cabLog(CABLOG_MSG, "Cabinet file %s/%s created.", ddfVars.szCabPath, ddfVars.szCab);
- return 0;
-}
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/setup_native/source/win32/wintools/makecab/parseddf.c b/setup_native/source/win32/wintools/makecab/parseddf.c
deleted file mode 100644
index bde5be4a9a9f..000000000000
--- a/setup_native/source/win32/wintools/makecab/parseddf.c
+++ /dev/null
@@ -1,386 +0,0 @@
-/* -*- 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>
-#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: %3u%%", desc, progress);
- else if (progress > 0 && progress < 100) printf("\r %s: %3u%%", 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 < SAL_N_ELEMENTS(VARS); 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;
-
- fclose(ddf);
-
- return DDF_OK;
-}
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/setup_native/source/win32/wintools/makecab/parseddf.h b/setup_native/source/win32/wintools/makecab/parseddf.h
deleted file mode 100644
index 90f34c6e7f87..000000000000
--- a/setup_native/source/win32/wintools/makecab/parseddf.h
+++ /dev/null
@@ -1,46 +0,0 @@
-/* -*- 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/.
- */
-
-#ifndef INCLUDED_SETUP_NATIVE_SOURCE_WIN32_WINTOOLS_MAKECAB_PARSEDDF_H
-#define INCLUDED_SETUP_NATIVE_SOURCE_WIN32_WINTOOLS_MAKECAB_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 // INCLUDED_SETUP_NATIVE_SOURCE_WIN32_WINTOOLS_MAKECAB_PARSEDDF_H
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/setup_native/source/win32/wintools/msidb/msidb.c b/setup_native/source/win32/wintools/msidb/msidb.c
deleted file mode 100644
index 2c100975fe7b..000000000000
--- a/setup_native/source/win32/wintools/msidb/msidb.c
+++ /dev/null
@@ -1,620 +0,0 @@
-/* -*- 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>
-#include <dirent.h>
-
-#define WIN32_LEAN_AND_MEAN
-#include <windows.h>
-#include <msi.h>
-#include <msiquery.h>
-#include <msidefs.h>
-
-#include "wine/unicode.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
-
-static const WCHAR PATH_DELIMITERW[] = {'/', 0};
-static const char PATH_DELIMITER[] = {'/', 0};
-
-
-static WCHAR *strdupAtoW( UINT cp, const char *str )
-{
- WCHAR *ret = NULL;
- if (str)
- {
- DWORD len = MultiByteToWideChar( cp, 0, str, -1, NULL, 0 );
- if ((ret = malloc( len * sizeof(WCHAR) )))
- MultiByteToWideChar( cp, 0, str, -1, ret, len );
- }
- return ret;
-}
-
-static char *strdupWtoA( UINT cp, const WCHAR *str )
-{
- char *ret = NULL;
- if (str)
- {
- DWORD len = WideCharToMultiByte(cp, 0, str, -1, NULL, 0, NULL, NULL);
- if ( (ret = malloc(len)) )
- WideCharToMultiByte(cp, 0, str, -1, ret, len, NULL, NULL);
- }
- return ret;
-}
-
-static BOOL msidbImportStorages(LPCWSTR dbfile, LPCWSTR wdir, LPWSTR storageNames[])
-{
- static const WCHAR delim[] = {'/', 0};
- UINT r, len, i;
- MSIHANDLE dbhandle, view, rec;
- WCHAR *storagePath = 0;
- char *query = "INSERT INTO _Storages (Name, Data) VALUES(?, ?)";
-
- r = MsiOpenDatabaseW(dbfile, (LPWSTR) MSIDBOPEN_TRANSACT, &dbhandle);
- if (r != ERROR_SUCCESS) return FALSE;
-
- r = MsiDatabaseOpenView(dbhandle, query, &view);
- if (r != ERROR_SUCCESS) return FALSE;
- MsiViewExecute(view, 0);
- r = MsiViewFetch(view, &rec);
- if (r != ERROR_SUCCESS) return FALSE;
-
- for (i = 0; i < MAX_STORAGES && storageNames[i] != 0; ++i)
- {
- len = lstrlenW(wdir) + lstrlenW(storageNames[i]) + 2;
- storagePath = malloc(len * sizeof(WCHAR));
- if (storagePath == NULL) return FALSE;
-
- lstrcpyW(storagePath, wdir);
- lstrcatW(storagePath, delim);
- lstrcatW(storagePath, storageNames[i]);
-
- rec = MsiCreateRecord(2);
- MsiRecordSetStringW(rec, 1, storageNames[i]);
- r = MsiRecordSetStreamW(rec, 2, storagePath);
- if (r != ERROR_SUCCESS)
- {
- return FALSE;
- }
-
- r = MsiViewExecute(view, rec);
- if (r != ERROR_SUCCESS)
- {
- return FALSE;
- }
-
- MsiCloseHandle(rec);
- }
-
- MsiViewClose(view);
- MsiCloseHandle(view);
- MsiDatabaseCommit(dbhandle);
- MsiCloseHandle(dbhandle);
- return TRUE;
-}
-
-static BOOL msidbExportStorage(LPCWSTR dbfile, LPCWSTR wdir, LPWSTR storageName)
-{
- UINT r, len;
- MSIHANDLE dbhandle, view, rec;
- char queryBuffer[100];
- char *storageNameA = strdupWtoA(CP_ACP, storageName);
- char *wdirA = strdupWtoA(CP_ACP, wdir);
- char *storagePath = NULL;
- char *dataBuffer;
- DWORD dataLen = 0;
- FILE *fp = NULL;
- sprintf(queryBuffer, "SELECT * FROM _Storages WHERE Name = '%s'", storageNameA);
-
- r = MsiOpenDatabaseW(dbfile, (LPWSTR) MSIDBOPEN_READONLY, &dbhandle);
- if (r != ERROR_SUCCESS)
- {
- free(storageNameA);
- free(wdirA);
- return FALSE;
- }
-
- MsiDatabaseOpenView(dbhandle, queryBuffer, &view);
- MsiViewExecute(view, 0);
- r = MsiViewFetch(view, &rec);
- if (r != ERROR_SUCCESS)
- {
- free(storageNameA);
- free(wdirA);
- return FALSE;
- }
-
- if (MsiRecordReadStream(rec, 2, 0, &dataLen) != ERROR_SUCCESS)
- {
- free(storageNameA);
- free(wdirA);
- return FALSE;
- }
-
- if ((dataBuffer = malloc(dataLen)) == NULL)
- {
- free(storageNameA);
- free(wdirA);
- return FALSE;
- }
- if (MsiRecordReadStream(rec, 2, dataBuffer, &dataLen) != ERROR_SUCCESS)
- {
- free(storageNameA);
- free(wdirA);
- return FALSE;
- }
-
- len = strlen(wdirA) + strlen(storageNameA) + 2;
- storagePath = malloc(len * sizeof(WCHAR));
- if (storagePath == NULL)
- {
- free(storageNameA);
- free(wdirA);
- return FALSE;
- }
-
- strcpy(storagePath, wdirA);
- strcat(storagePath, "/");
- strcat(storagePath, storageNameA);
-
- fp = fopen(storagePath , "wb");
- if (fp != NULL)
- {
- fwrite(dataBuffer, 1, dataLen, fp);
- fclose(fp);
- }
-
- free(storagePath);
- MsiCloseHandle(rec);
-
- MsiViewClose(view);
- MsiCloseHandle(view);
- MsiCloseHandle(dbhandle);
- free(storageNameA);
- free(wdirA);
- return TRUE;
-}
-
-static BOOL msidbImportStreams(LPCWSTR dbfile, LPCWSTR wdir, LPWSTR streamNames[])
-{
- UINT r, len;
- MSIHANDLE dbhandle, view, rec;
- int i = 0;
- WCHAR *streamPath = 0;
- char *query = "INSERT INTO _Streams (Name, Data) VALUES(?, ?)";
-
- r = MsiOpenDatabaseW(dbfile, (LPWSTR) MSIDBOPEN_TRANSACT, &dbhandle);
- if (r != ERROR_SUCCESS) return FALSE;
-
- r = MsiDatabaseOpenView(dbhandle, query, &view);
- if (r != ERROR_SUCCESS) return FALSE;
-
- for (i = 0; i < MAX_STREAMS && streamNames[i] != NULL; i++)
- {
- len = lstrlenW(wdir) + lstrlenW(streamNames[i]) + 2;
- streamPath = malloc(len * sizeof(WCHAR));
- if (streamPath == NULL) return FALSE;
-
- lstrcpyW(streamPath, wdir);
- lstrcatW(streamPath, PATH_DELIMITERW);
- lstrcatW(streamPath, streamNames[i]);
-
- rec = MsiCreateRecord(2);
- MsiRecordSetStringW(rec, 1, streamNames[i]);
- r = MsiRecordSetStreamW(rec, 2, streamPath);
- if (r != ERROR_SUCCESS)
- {
- return FALSE;
- }
-
- r = MsiViewExecute(view, rec);
- if (r != ERROR_SUCCESS)
- {
- return FALSE;
- }
-
- MsiCloseHandle(rec);
- }
-
- MsiViewClose(view);
- MsiCloseHandle(view);
- MsiDatabaseCommit(dbhandle);
- MsiCloseHandle(dbhandle);
- return TRUE;
-}
-
-/***********************************************************************
- * msidbExportStream
- *
- * Exports a stream to a file with an .idb extension.
- *
- * Examples (note wildcard escape for *nix/bash):
- * msidb -d <pathtomsi>.msi -f <workdir> -x <streamname>
- * msidb -d <pathtomsi>.msi -f <workdir> -x data.cab
- **********************************************************************/
-static BOOL msidbExportStream(LPCWSTR dbfile, LPCWSTR wdir, LPCWSTR streamName)
-{
- static const char ext[] = {'.', 'i', 'd', 'b', 0};
- UINT r, len;
- MSIHANDLE dbhandle, streamListView, rec;
- char queryBuffer[100];
- FILE *fp = 0;
- char *streamNameA = strdupWtoA(CP_ACP, streamName);
- char *wdirA = strdupWtoA(CP_ACP, wdir);
- char *streamFileA = 0;
- char streamPath[MAX_PATH];
- char *dataBuffer;
- DWORD dataLen = 0;
-
- r = MsiOpenDatabaseW(dbfile, (LPCWSTR) MSIDBOPEN_READONLY, &dbhandle);
- if (r != ERROR_SUCCESS)
- {
- free(wdirA);
- free(streamNameA);
- return FALSE;
- }
-
- sprintf(queryBuffer, "SELECT * FROM _Streams WHERE Name = '%s'", streamNameA);
- MsiDatabaseOpenView(dbhandle, queryBuffer, &streamListView);
- MsiViewExecute(streamListView, 0);
- r = MsiViewFetch(streamListView, &rec);
- if (r != ERROR_SUCCESS)
- {
- free(wdirA);
- free(streamNameA);
- return FALSE;
- }
-
- if (MsiRecordReadStream(rec, 2, 0, &dataLen) != ERROR_SUCCESS)
- {
- free(wdirA);
- free(streamNameA);
- return FALSE;
- }
- dataBuffer = malloc(dataLen);
- if (!dataBuffer)
- {
- free(wdirA);
- free(streamNameA);
- return FALSE;
- }
- if (MsiRecordReadStream(rec, 2, dataBuffer, &dataLen) != ERROR_SUCCESS)
- {
- free(wdirA);
- free(streamNameA);
- return FALSE;
- }
-
- len = strlen(streamNameA) + 5;
- streamFileA = malloc(len);
- if (streamFileA == NULL)
- {
- free(wdirA);
- free(streamNameA);
- return FALSE;
- }
-
- strcpy(streamFileA, streamNameA);
- strcat(streamFileA, ext);
-
- strcpy(streamPath, wdirA);
- strcat(streamPath, PATH_DELIMITER);
- strcat(streamPath, streamFileA);
-
- fp = fopen(streamPath , "wb");
- if (fp != NULL)
- {
- fwrite(dataBuffer, 1, dataLen, fp);
- fclose(fp);
- }
-
- free(streamFileA);
- MsiCloseHandle(rec);
-
- MsiViewClose(streamListView);
- MsiCloseHandle(streamListView);
- MsiCloseHandle(dbhandle);
- free(wdirA);
- free(streamNameA);
- return TRUE;
-}
-
-/***********************************************************************
- * msidbImportTables
- *
- * Takes a list of tables or '*' (for all) to import from text archive
- * files in specified folder
- *
- * For each table, a file called <tablename>.idt is imported containing
- * tab separated ASCII.
- *
- * Examples (note wildcard escape for *nix/bash):
- * msidb -d <pathtomsi>.msi -f <workdir> -i \*
- * msidb -d <pathtomsi>.msi -f <workdir> -i File Directory Binary
- **********************************************************************/
-static BOOL msidbImportTables(LPCWSTR dbfile, LPCWSTR wdir, LPWSTR tables[], BOOL create)
-{
- static const WCHAR ext[] = {'.', 'i', 'd', 't', 0};
- static const WCHAR all[] = {'*', 0};
-
- UINT r, len;
- char *dirNameA;
- char *fileName;
- DIR *dir;
- struct dirent *ent;
-
- int i = 0;
- MSIHANDLE dbhandle;
-
- LPWSTR tableFile = 0;
- LPCWSTR oFlag = (LPCWSTR) MSIDBOPEN_TRANSACT;
-
- if (create == TRUE) oFlag = (LPCWSTR) MSIDBOPEN_CREATE;
- r = MsiOpenDatabaseW(dbfile, oFlag, &dbhandle);
-
- if (r != ERROR_SUCCESS)
- {
- return FALSE;
- }
-
- if (strcmpW(tables[0], all) == 0)
- {
- dirNameA = strdupWtoA(CP_ACP, wdir);
- dir = opendir(dirNameA);
-
- if (dir)
- {
- while ((ent = readdir(dir)) != NULL)
- {
- if (ent->d_type != DT_REG) continue;
- fileName = ent->d_name;
- if (strcmp(fileName+strlen(fileName)-4*sizeof(fileName[0]), ".idt") != 0) continue;
- if (strcmp(fileName, ".") == 0 || strcmp(fileName, "..") == 0) continue;
- tableFile = strdupAtoW(CP_ACP, fileName);
- r = MsiDatabaseImportW(dbhandle, wdir, tableFile);
- free(tableFile);
- }
- }
- else
- {
- free(dirNameA);
- return FALSE;
- }
- closedir(dir);
- free(dirNameA);
- }
- else
- {
- for (i = 0; i < MAX_TABLES && tables[i] != 0; ++i)
- {
- len = lstrlenW(tables[i]) + 5;
- tableFile = malloc(len * sizeof (WCHAR));
- if (tableFile == NULL) return FALSE;
-
- lstrcpyW(tableFile, tables[i]);
- lstrcatW(tableFile, ext);
- r = MsiDatabaseImportW(dbhandle, wdir, tableFile);
- free(tableFile);
-
- if (r != ERROR_SUCCESS)
- {
- return FALSE;
- }
- }
- }
-
- MsiDatabaseCommit(dbhandle);
- MsiCloseHandle(dbhandle);
- return TRUE;
-}
-
-/***********************************************************************
- * msidbExportTables
- *
- * Takes a list of tables or '*' (for all) to export to text archive
- * files in specified folder
- *
- * For each table, a file called <tablename>.idt is exported containing
- * tab separated ASCII.
- *
- * Examples (note wildcard escape for *nix/bash):
- * msidb -d <pathtomsi>.msi -f <workdir> -e \*
- * msidb -d <pathtomsi>.msi -f <workdir> -e File Directory Binary
- **********************************************************************/
-static BOOL msidbExportTables(LPCWSTR dbfile, LPCWSTR wdir, LPWSTR tables[])
-{
- static const WCHAR ext[] = {'.', 'i', 'd', 't', 0};
- static const WCHAR all[] = {'*', 0};
- UINT r, len;
- MSIHANDLE dbhandle, tableListView, rec;
- LPWSTR tableFile = 0;
- WCHAR tableName[MAX_TABLE_NAME];
- DWORD size = SAL_N_ELEMENTS(tableName);
- int i = 0;
-
- r = MsiOpenDatabaseW(dbfile, (LPCWSTR) MSIDBOPEN_READONLY, &dbhandle);
-
- if (r != ERROR_SUCCESS) return FALSE;
-
- if (strcmpW(tables[0], all) == 0)
- {
- r = MsiDatabaseOpenView(dbhandle, "SELECT Name FROM _Tables", &tableListView);
- r = MsiViewExecute(tableListView, 0);
- r = MsiViewFetch(tableListView, &rec);
-
- while (r == ERROR_SUCCESS)
- {
- size = SAL_N_ELEMENTS(tableName);
- r = MsiRecordGetStringW(rec, 1, tableName, &size);
- if (r == ERROR_SUCCESS)
- {
- len = lstrlenW(tableName) + 5;
- tableFile = malloc(len * sizeof (WCHAR));
- if (tableFile == NULL) return FALSE;
-
- lstrcpyW(tableFile, tableName);
- lstrcatW(tableFile, ext);
-
- r = MsiDatabaseExportW(dbhandle, tableName, wdir, tableFile);
-
- free(tableFile);
- MsiCloseHandle(rec);
- }
-
- r = MsiViewFetch(tableListView, &rec);
- }
-
- MsiViewClose(tableListView);
- MsiCloseHandle(tableListView);
- }
- else
- {
- for (i = 0; i < MAX_TABLES && tables[i] != 0; ++i)
- {
- len = lstrlenW(tables[i]) + 5;
- tableFile = malloc(len * sizeof (WCHAR));
- if (tableFile == NULL) return FALSE;
-
- lstrcpyW(tableFile, tables[i]);
- lstrcatW(tableFile, ext);
- r = MsiDatabaseExportW(dbhandle, tables[i], wdir, tableFile);
-
- free(tableFile);
- }
- }
-
- MsiCloseHandle(dbhandle);
- return TRUE;
-}
-
-static void usage( void )
-{
- printf(
- "Usage: msidb [options] [tables]\n"
- "\nOptions:\n"
- " -d <path> Fully qualified path to MSI database file\n"
- " -f <wdir> Path to the text archive folder\n"
- " -c Create or overwrite with new database and import tables\n"
- " -i <tables> Import tables from text archive files - "
- "use * for all\n"
- " -e <tables> Export tables to files archive in directory - "
- "use * for all\n"
- " -x <stream> Saves stream as <stream>.idb in <wdir>\n"
- " -a <file> Adds stream from file to database\n"
- " -r <storage> Adds storage to database as substorage\n");
-}
-
-int wmain(int argc, WCHAR *argv[])
-{
- LPWSTR dbfile, streamName, storageName;
- LPWSTR wdir = (LPWSTR) L".";
- LPWSTR streamFiles[MAX_STREAMS] = {0};
- LPWSTR storageNames[MAX_STORAGES] = {0};
- LPWSTR iTables[MAX_TABLES] = {0};
- LPWSTR oTables[MAX_TABLES] = {0};
- BOOL createdb = FALSE;
- int i = 0;
- int currStream = 0;
- int currStorage = 0;
- dbfile = streamName = storageName = NULL;
-
- while (argv[1] && (argv[1][0] == '-' || argv[1][0] == '/'))
- {
- switch (tolower(argv[1][1]))
- {
- case 'i': /* Import tables */
- i = 0;
- while (argv[2] && argv[2][0] != '-' && i < 10)
- {
- iTables[i] = argv[2];
- argv++; argc--; i++;
- }
- break;
- case 'e': /* Export tables */
- i = 0;
- while (argv[2] && argv[2][0] != '-' && i < 10)
- {
- oTables[i] = argv[2];
- argv++; argc--; i++;
- }
- break;
- case 'c': /* Create/overwrite .msi db */
- createdb = TRUE;
- break;
- case 'f': /* Specify working dir */
- argv++; argc--;
- wdir = argv[1];
- break;
- case 'd': /* Specify .msi db */
- argv++; argc--;
- dbfile = argv[1];
- break;
- case 'x': /* Save stream to .ibd */
- argv++; argc--;
- streamName = argv[1];
- break;
- case 'a': /* Add stream(s) to db */
- argv++; argc--;
- if (currStream < MAX_STREAMS)
- streamFiles[currStream++] = argv[1];
- break;
- case 'w':
- argv++; argc--;
- storageName = argv[1];
- break;
- case 'r': /* Add strg as substrg to db */
- argv++; argc--;
- if (currStorage < MAX_STORAGES)
- storageNames[currStorage++] = argv[1];
- break;
- case '?':
- case 'h':
- usage();
- return 0;
- }
- argv++; argc--;
- }
-
- if (iTables[0])
- if (!msidbImportTables(dbfile, wdir, iTables, createdb))
- return 1;
-
- if (oTables[0])
- if (!msidbExportTables(dbfile, wdir, oTables))
- return 2;
-
- if (streamName)
- if (!msidbExportStream(dbfile, wdir, streamName))
- return 3;
-
- if (streamFiles[0])
- if (!msidbImportStreams(dbfile, wdir, streamFiles))
- return 4;
-
- if(storageNames[0])
- if (!msidbImportStorages(dbfile, wdir, storageNames))
- return 5;
-
- if (storageName)
- if (!msidbExportStorage(dbfile, wdir, storageName))
- return 6;
-
- if (!iTables[0] && !oTables[0] && !streamName && !streamFiles[0] && !storageNames[0] && !storageName)
- return 7;
-
- return 0;
-}
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/setup_native/source/win32/wintools/msiinfo/msiinfo.c b/setup_native/source/win32/wintools/msiinfo/msiinfo.c
deleted file mode 100644
index 2ba88dfb3d3c..000000000000
--- a/setup_native/source/win32/wintools/msiinfo/msiinfo.c
+++ /dev/null
@@ -1,254 +0,0 @@
-/* -*- 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>
-#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 unsigned 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;
- unsigned 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;
- unsigned 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, unsigned property, unsigned dataType, LPCWSTR value)
-{
- unsigned 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)
-{
- 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;
- unsigned i = 0;
- MSIHANDLE dbhandle, infohandle;
- unsigned r;
- LPWSTR value = 0;
- static const WCHAR h1[] = {'/', '?', 0};
- static const WCHAR h2[] = {'-', '?', 0};
-
- if (argc > 1)
- {
- dbfile = argv[1];
- argv++; argc--;
- }
-
- if (!dbfile || strcmpW(dbfile, h1) == 0 || strcmpW(dbfile, h2) == 0)
- {
- usage();
- return 0;
- }
- else 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;
-}
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/setup_native/source/win32/wintools/msimsp/msimsp.c b/setup_native/source/win32/wintools/msimsp/msimsp.c
deleted file mode 100644
index 8e2c99dc4bb0..000000000000
--- a/setup_native/source/win32/wintools/msimsp/msimsp.c
+++ /dev/null
@@ -1,86 +0,0 @@
-/* -*- 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;
-}
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/setup_native/source/win32/wintools/msitran/msitran.c b/setup_native/source/win32/wintools/msitran/msitran.c
deleted file mode 100644
index 2e2b5e85f2da..000000000000
--- a/setup_native/source/win32/wintools/msitran/msitran.c
+++ /dev/null
@@ -1,122 +0,0 @@
-/* -*- 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>
-#include <msi.h>
-#include <msiquery.h>
-
-#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)
-{
- 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");
-}
-
-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, err = 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 |= 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;
- }
- }
- }
-
- /* 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;
-}
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */