This project is read-only.
1
Vote

Utils.GetBitsVersion() 64-bit issue

description

Utils.GetBitsVersion() -
There is still an issue running on a 64-bit OS. 64-bit processes appear to be OK; a 32-bit process (x86 build) is where I have problems. This appears to be due to file system redirection i.e. c:\windows\system32 actually points to c:\windows\syswow64. The problem is, qmgr.dll does not exist in syswow64, so you trigger the FileNotFoundException and the BitsVersion comes back as 0.0.

There is a BITS proxy DLL which appears to be appropriately versioned and exists in both system32 and syswow64. So maybe something like:
var fileName = Path.Combine(System.Environment.SystemDirectory, "qmgr.dll");
if (!File.Exists(fileName))
    fileName = Path.Combine(System.Environment.SystemDirectory, "qmgrprxy.dll");
if (!File.Exists(fileName))
    return BitsVersion.Bits0_0;

FileVersionInfo fileVersion = FileVersionInfo.GetVersionInfo(fileName);

// ... remainder unchanged ...

comments

xidar wrote Aug 17, 2015 at 6:11 PM

nice catch... I'll give it a try locally and update the codebase

wrote Aug 17, 2015 at 6:39 PM