diff options
author | Eilidh McAdam <eilidh@lanedo.com> | 2012-07-10 19:31:26 +0100 |
---|---|---|
committer | Fridrich Štrba <fridrich.strba@bluewin.ch> | 2012-07-18 11:02:20 +0200 |
commit | ae0e379a443585fd34522385144fdd69baa6105f (patch) | |
tree | b110ab95352a5e8315514664c18c17843b1f307f /setup_native | |
parent | a237b03f73574ac46de515fc4671b647d0a8168e (diff) |
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@bluewin.ch>
Diffstat (limited to 'setup_native')
-rw-r--r-- | setup_native/source/win32/wintools/msitran/msitran.c | 55 |
1 files changed, 43 insertions, 12 deletions
diff --git a/setup_native/source/win32/wintools/msitran/msitran.c b/setup_native/source/win32/wintools/msitran/msitran.c index f2669e9097e4..39d66286e127 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; } |