From a568db73a69a934c09ad5c95f5a218fb6b869298 Mon Sep 17 00:00:00 2001 From: Simon Tatham Date: Thu, 18 May 2017 08:26:44 +0100 Subject: [PATCH] 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. --- Makefile.am | 2 +- fake-msi.c => makemsi.c | 18 +++++++++++++----- 2 files changed, 14 insertions(+), 6 deletions(-) rename fake-msi.c => makemsi.c (93%) diff --git a/Makefile.am b/Makefile.am index a113320..1e25726 100644 --- a/Makefile.am +++ b/Makefile.am @@ -7,7 +7,7 @@ lib_LTLIBRARIES = libwinterop.so.la libmsi.so.la libpreload.la libwinterop_so_la_SOURCES = fake-winterop.c makecab.c memory.c \ memory.h dupstr.c dupstr.h subproc.c subproc.h uchars.c uchars.h -libmsi_so_la_SOURCES = fake-msi.c md5.c memory.c memory.h version.c \ +libmsi_so_la_SOURCES = makemsi.c md5.c memory.c memory.h version.c \ dupstr.c dupstr.h subproc.c subproc.h uchars.c uchars.h libpreload_la_SOURCES = preload.c diff --git a/fake-msi.c b/makemsi.c similarity index 93% rename from fake-msi.c rename to makemsi.c index 7bdcdc6..8b78448 100644 --- a/fake-msi.c +++ b/makemsi.c @@ -1,15 +1,13 @@ #include #include -#include #include -#include -#include #include +#include #include + #include #include -#include #include #include #include @@ -19,8 +17,18 @@ #include "subproc.h" #include "uchars.h" +/* + * The same routine MsiCloseHandle is used by our client to dispose of + * three kinds of structure that _we_ think of as completely different + * types. So we must ensure all three start with distinct magic number + * fields, so as to know what kind we're being asked to close. + */ typedef struct MsiTypePrefix { - enum { MAIN, VIEW, RECORD } type; + enum { + MAIN = 0x2B7FB8B8, + VIEW = 0x1570B0E3, + RECORD = 0x62365065 + } type; } MsiTypePrefix; typedef struct MsiMainCtx {