Commit graph

43 commits

Author SHA1 Message Date
cc5125c36e Rename artifact to wix-on-linux.zip 2025-04-02 16:05:23 +02:00
79af3e9f48 upload-artifact back to v4 but explicitly from forgejo 2025-04-02 15:57:43 +02:00
5ab26b0207 upload-artifact v4 -> v3 2025-04-02 15:54:46 +02:00
f8ba7f27c5 Build in forgejo action 2025-04-02 15:46:37 +02:00
Simon Tatham
3ed828da1b Minor updates to README.
Someone on https://github.com/wixtoolset/issues/issues/4381 found this
repository recently and judged it to be abandoned, whereas in fact
it's been working reliably for me for nearly a decade and I just don't
have to fix bugs in it very often.

Looking at the README, I wonder if the reason they thought it was
abandoned is that _that_ hadn't been updated in a very long time! It
still said 'very new', 'only ever tested on Ubuntu 14.04' (which was
true at the beginning of the project's life), and 'only supports
Python 2' (an outright untruth).

I've brought it up to date, and made it look more like 'stable' than
'abandoned immediately after creation'.
2023-08-18 08:29:32 +01:00
Simon Tatham
558d8cf7cd Migrate Python code to Python 3. 2020-08-26 21:13:29 +01:00
Simon Tatham
1c1c3850e8 Stop using real pointers as handles in makemsi.c.
Upgrading to Ubuntu 18.04, which seems to have become more prone to
allocating process memory above the 4G boundary, has revealed that the
client code of the phony msi.dll functions is not in fact prepared to
accept arbitrary machine-word sized pointer values. It's expecting
32-bit handles, so we were segfaulting because MsiDatabaseImportW was
only being given the bottom 32 bits of the 64-bit pointer that
MsiOpenDatabaseW had returned.

So now I just keep a trivial registry of small integer handle values
and the pointers they map to. I don't even bother to recycle them -
the process isn't expected to run for long enough for me to care.
2018-05-14 18:14:12 +01:00
Simon Tatham
66f1f5d2bf First draft of licence and readme files. 2017-06-07 06:39:21 +01:00
Simon Tatham
0bc12e1c67 Fix WORD16 and WORD32 macros.
I made the mistake of using the same variable name _offset for the
temporary variable in WORD16 and WORD32, and for the one in BYTE which
the other two use as a subroutine - meaning that the declaration on
the first line of BYTE read 'size_t _offset = _offset+3' or similar,
in which the RHS _offset referred to the newly declared LHS one rather
than to the one in the outer scope.

WORD32 had the additional goof that I had declared its return-value
accumulator variable as a 16- rather than 32-bit integer due to
copy-and-paste error.

Between those two mistakes - surely introduced at the last minute when
I was doing code cleanup on this source base, because I know this
function was working OK before then - I had completely broken the
extraction of version strings from PE executables.
2017-05-28 10:00:03 +01:00
Simon Tatham
fe5eb01f9b Add a command-line test program.
At the moment it only tests MsiGetFileVersion, because that's the
piece I just found a problem in, but I could easily extend it to have
convenient command-line test rigs for other parts of this setup too.
2017-05-28 09:54:05 +01:00
Simon Tatham
f501b2927d Rename the last 'fake' file. 2017-05-18 19:01:01 +01:00
Simon Tatham
5e1f0d7e9f Move CAB-reading into its own file. 2017-05-18 19:00:07 +01:00
Simon Tatham
8574dcc8c5 Rename the libraries to remove the extra ".so" in the names.
I don't know why those strange names seemed necessary to start with
and now don't seem to be. I probably changed something subtle
somewhere without noticing.
2017-05-18 18:50:08 +01:00
Simon Tatham
2cab25bf14 General MD5 cleanups.
I did these in passing while looking for the bug in the previous
commit, and they seem like general improvements, so I'll keep them.
2017-05-18 18:49:35 +01:00
Simon Tatham
4b3314ff48 Fix parenthesis goof in the revised file-MD5ing code.
Every block I read was being condensed down to one byte.
2017-05-18 18:49:00 +01:00
Simon Tatham
ee4341de51 Fix a memory-management goof.
That's what I get for actually trying to free my memory :-)
2017-05-18 18:48:39 +01:00
Simon Tatham
4b5efa150a Make the symlinking in 'make install' idempotent. 2017-05-18 08:30:18 +01:00
Simon Tatham
a568db73a6 Rename fake-msi.c to makemsi.c.
It's now a sensible source flie containing a set of routines that do
something coherently connected to each other, so it doesn't deserve
that 'fake-' prefix that I used for the previous monolithic files full
of tangled-together stuff.

While I'm here, I've also made up nicer (i.e. more distinguishable)
random magic numbers for the structure-type disambiguation.
2017-05-18 08:27:29 +01:00
Simon Tatham
7ca5ab5ef2 Move CAB-creation routines into their own file.
Also tidy up some of the memory management, while I'm here.
2017-05-18 08:19:55 +01:00
Simon Tatham
39faf94ea2 Move the char16 functions into their own file.
This completes the removal of the monolithic fake-lib.[ch].
2017-05-18 07:16:21 +01:00
Simon Tatham
3b3a5fd6bf Move system_argv_* into their own file. 2017-05-18 07:10:17 +01:00
Simon Tatham
48919caa7b Move dupcat out into its own file, and add dupstr.
Also a handy #define to replace all those tedious castings of NULL.
2017-05-18 07:10:17 +01:00
Simon Tatham
69d886c575 Redo the bounds checks in MsiGetFileVersion.
Now any failing bounds check causes the whole function to fail, rather
than returning a made-up value.
2017-05-18 06:57:29 +01:00
Simon Tatham
7e5c5d4232 Move MsiGetFileVersion out into its own file. 2017-05-18 06:57:18 +01:00
Simon Tatham
9e3e915426 Move snew/sfree out into their own header+src. 2017-05-18 06:46:55 +01:00
Simon Tatham
ca59ebf60d Move MD5 out into its own file.
This begins a programme of code reorganisation at the end of which I'd
like to end up with something almost legible :-)
2017-05-18 06:43:51 +01:00
Simon Tatham
7de9585efb Set up an autotools system.
Supersedes the hand-hacked Makefile I was previously working with.
2017-05-17 19:31:26 +01:00
Simon Tatham
e8d91ad369 Top-level wrapper script to do the environment setup.
This sets up $WIX and $LD_PRELOAD before running a Wix .NET executable
via mono, so the user doesn't have to have pre-prepared those
variables (and, in particular, libpreload doesn't uncontrolledly
affect loads of other stuff too).
2017-05-17 19:29:08 +01:00
Simon Tatham
ad56c28a70 Find makecab.py via $WIX rather than $PATH.
We have to define $WIX in any case for libpreload, so we might as well
get our money's worth out of it and not also require the Wix directory
to be on PATH.
2017-05-17 19:28:49 +01:00
Simon Tatham
4aa85aa621 Fix checksum calculation in CAB data records.
[MS-CAB] is pretty unclearly worded in this area. Turns out that if
the sequence of bytes being checksummed is not a multiple of 4 bytes,
you are supposed to _first_ reverse the order of the trailing (n % 4)
bytes, and _then_ append zero bytes to pad to a multiple of 4, before
you do the main checksum operation of XORing together all the 32-bit
words of the input.
2017-05-16 20:11:53 +01:00
Simon Tatham
dc057115b5 Write terminating strings when MsiGetFileVersion() fails.
I had expected that if you were returning a failure code you didn't
have to - perhaps even _shouldn't_ - write through the output pointer
arguments. But in fact, now that my implementation of
MsiGetFileVersion _knows_ how to fail (i.e. doesn't just return a
hardcoded value for every call), the MSI build doesn't work unless I
also clear the output strings in the case of failure.
2017-05-16 19:19:51 +01:00
Simon Tatham
74592eecf3 Implement MsiGetFileHash.
A quick experiment or two with the real Windows version suggests that
the hash function in question is just MD5, repackaged as an array of
four little-endian 32-bit words instead of 16 bytes.
2017-05-16 19:06:45 +01:00
Simon Tatham
af3d986af7 Implement MsiGetFileVersion.
This is pretty ugly code, but it works well enough to deliver the
right versions for the files in my test MSI. I can polish it later.
2017-05-16 19:06:37 +01:00
Simon Tatham
f0cdcb370e My own CAB-maker, which compresses.
lcab produces uncompressed CAB files, which is a bit low-quality for
my taste - especially when it turns out CAB files have Deflate as one
of their compression options, so I can write a compressed CAB-builder
in only about 100 lines of Python using the zlib module! I'd expected
to have to faff about finding an implementation of LZX, but there's
really no need to bother.
2017-05-16 19:06:05 +01:00
Simon Tatham
decda92874 Use an LD_PRELOAD library in place of symlink to /home.
Apart from dependency on native-code DLLs, the one other quirk of
running WiX under mono is that it doesn't seem to quite get the right
answers when combining $PWD with a Unix absolute path to one of its
own supporting files - it doesn't interpret the leading slash on the
latter as meaning $PWD should be ignored, so it tries to look for
/home/my/build/dir/home/my/wix/install/dir/some.file. Previously I was
bodging around that by having my build dir contain a symlink 'home'
pointing at /home; this is marginally less intrusive.
2017-05-16 07:03:19 +01:00
Simon Tatham
0985b382d3 Create the cab with the files in the right order.
In my test MSI, the files are supposed to be in alphabetical order,
not in 'whatever order lcab enumerated the Unix directory I pointed it
at' order. The test MSI didn't install, but with this change, it does,
so my guess is that either the real Windows installer system depends
on the alphabetical order for a search algorithm, or else files in the
cab are referred to by a numeric index of some kind.
2017-05-15 21:00:12 +01:00
Simon Tatham
505ea0fc84 Trivial misspelled option. 2017-05-15 20:49:59 +01:00
Simon Tatham
29795aed5b We now get as far as building a non-empty MSI file!
But I haven't tested it yet, so it's probably got a zillion things
wrong inside it.
2017-05-15 20:04:18 +01:00
Simon Tatham
b19fd4ee77 Build cab files using lcab. 2017-05-15 19:19:10 +01:00
Simon Tatham
d6e5f7ae7b All the remaining function stubs I appear to need.
Now I can get an idea of what sequence of calls WiX actually expects
to use to build an MSI.
2017-05-15 18:46:48 +01:00
Simon Tatham
6824aa549c Start of a fake msi.dll.
This seems to be the next function WiX expects from its native-code
DLLs. So far it's just a stub.
2017-02-20 07:17:56 +00:00
Simon Tatham
fbf19f95a0 Set up a libtoolish Makefile for fake libs.
The previous handwritten .la was a daft way of doing things!
2017-02-20 07:17:46 +00:00
Simon Tatham
abd0e801c0 Fake implementation of winterop.dll.
If I compile this to Linux native code, and then run WiX under Mono,
it loads this library and gets past the first CabExtract call, so I
can find out what the next problem turns out to be.
2017-02-16 20:33:01 +00:00