diff options
author | Simon Tatham <anakin@pobox.com> | 2017-05-28 09:54:05 +0100 |
---|---|---|
committer | Simon Tatham <anakin@pobox.com> | 2017-05-28 09:54:05 +0100 |
commit | fe5eb01f9b84b344bd1d476f409626fd7b4cd5f9 (patch) | |
tree | d378e92065fa90a1cce69eb38b3b3351ea6b3d50 /test.c | |
parent | f501b2927d7e4bf6b26c1e348270e6f4a48ffb27 (diff) | |
download | wix-on-linux-fe5eb01f9b84b344bd1d476f409626fd7b4cd5f9.tar.gz wix-on-linux-fe5eb01f9b84b344bd1d476f409626fd7b4cd5f9.tar.bz2 wix-on-linux-fe5eb01f9b84b344bd1d476f409626fd7b4cd5f9.zip |
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.
Diffstat (limited to 'test.c')
-rw-r--r-- | test.c | 33 |
1 files changed, 33 insertions, 0 deletions
@@ -0,0 +1,33 @@ | |||
1 | #include <stdio.h> | ||
2 | #include <string.h> | ||
3 | #include <stdlib.h> | ||
4 | #include <stdint.h> | ||
5 | #include <inttypes.h> | ||
6 | |||
7 | #include "misc.h" | ||
8 | #include "uchars.h" | ||
9 | #include "api.h" | ||
10 | |||
11 | int main(int argc, char **argv) | ||
12 | { | ||
13 | if (argc > 2 && !strcmp(argv[1], "version")) { | ||
14 | const char *filename8 = argv[2]; | ||
15 | char16_t filename16[4096]; | ||
16 | uint32_t filename16size = lenof(filename16); | ||
17 | c16cpy(filename16, &filename16size, filename8); | ||
18 | char16_t version[4096], language[4096]; | ||
19 | uint32_t versionsize = lenof(version), languagesize = lenof(language); | ||
20 | uint32_t retd = | ||
21 | MsiGetFileVersionW(filename16, version, &versionsize, | ||
22 | language, &languagesize); | ||
23 | printf("MsiGetFileVersionW(\"%s\") = %"PRId32"\n", filename8, retd); | ||
24 | if (retd == 0) { | ||
25 | printf(" version = \"%s\"\n language = \"%s\"\n", | ||
26 | ascii(version, false), ascii(language, false)); | ||
27 | } | ||
28 | } else { | ||
29 | fprintf(stderr, "usage: ./test version <file>\n"); | ||
30 | return 1; | ||
31 | } | ||
32 | return 0; | ||
33 | } | ||