fix for version.dll and msi.dll

Marcus Brinkmann marcus.brinkmann at ruhr-uni-bochum.de
Thu Nov 8 10:01:35 CST 2007


Hi,

this patch allows WiX 3.0.2925.0 (wix.sf.net) to make a bit more
progress running under mono within wine.  There are two issues
addressed by this patch:

1. version.dll's GetFileVersionInfoSizeW does return
ERROR_FILE_NOT_FOUND when trying to get the version of a file that
does not contain a version (for example, a text file).  This is
because it relies on VERSION_GetFileVersionInfo_16 to do the file
existance check, which returns 0 (meaning file does not exist) if
LoadLibrary16 fails.

The patch addresses this by making VERSION_GetFileVersionInfo_16
return 0xFFFFFFFF (meaning file exists but does not have version) if
LoadLibrary16 returns an error beside ERROR_FILE_NOT_FOUND.

This may not be the best approach, or even the most comprehensive
approach (there might be similar problems in other parts of the code,
I did not check).  But at least for this invocation it matches the
behaviour of Microsoft version.dll.

2007-11-08  Marcus Brinkmann  <marcus at g10code.de>

	* dlls/version/info.c (VERSION_GetFileVersionInfo_16): Return
	0xFFFFFFFF if LoadLibrary16 fails except for ERROR_FILE_NOT_FOUND.

2. msi.dll's MsiGetFileVersionW does return
ERROR_RESOURCE_DATA_NOT_FOUND when the file does not have a version.
The Microsoft msi.dll returns ERROR_FILE_INVALID in this case.  I
remapped the error in this case.  Again, there might be more
comprehensive solutions and other locations with similar problems.

2007-11-08  Marcus Brinkmann  <marcus at g10code.de>

	* dlls/msi/msi.c (MsiGetFileVersionW): Return
	ERROR_FILE_INVALID instead of ERROR_RESOURCE_DATA_NOT_FOUND
	on failure of GetFileVersionInfoSizeW.

Here is how I tested these patches:

1. Running light.exe from wix on a wixobj file with a non-versioned
file as a component prints a diagnostic error indicating
ERROR_FILE_NOT_FOUND using wine's builtin of version.dll and msi.dll,
but ERROR_RESOURCE_DATA_NOT_FOUND using wine's builtin of msi.dll and
native version.dll.  With the first patch above, both native and
builtin version.dll lead to ERROR_RESOURCE_DATA_NOT_FOUND.

2. After applying the first fix, using wine's builtin msi.dll leads to
the above mentioned ERROR_RESOURCE_DATA_NOT_FOUND error in light.exe.
With the second fix, light.exe makes more progress.  This is because
wix handles the error code 1006 (ERROR_FILE_INVALID) specially, but
bails out on error code 1812 (ERROR_RESOURCE_DATA_NOT_FOUND).

I wish I could conclude this submission telling you that wix now runs
fine.  But it does not.  Builtin msi.dll fails ERROR_BAD_QUERY_SYNTAX
on the tables generated by wix, and there are also bugs in Mono which
make wix fail even with native msi.dll and in fact even under Windows
proper.  So, no success for me, but a small improvement for you at
least :)

Thanks,
Marcus

--
g10 Code GmbH       http://g10code.com      AmtsGer. Wuppertal HRB 14459
Hüttenstr. 61                               Geschäftsführung Werner Koch
D-40699 Erkrath  -=- The GnuPG Experts -=-  USt-Id DE215605608

-------------- next part --------------
A non-text attachment was scrubbed...
Name: wine-msi-version.diff
Type: application/octet-stream
Size: 1130 bytes
Desc: not available
Url : http://www.winehq.org/pipermail/wine-patches/attachments/20071108/59697d35/attachment.obj 


More information about the wine-patches mailing list