WiX Burn 3.8无法正确设置NTSuitePersonal内置变量吗?

时间:2014-11-03 21:18:53

标签: windows wix burn wix3.8

WiX 3.8刻录built-in variables包含一些描述操作系统版本的值。其中之一是NTSuitePersonal。在操作系统上将此变量设置为零,我希望它返回为非零。这使我无法为我的应用程序定义安装条件。

我写了一个小C#命令行应用来调用GetVersionEx并检索带有相关标志的OSVERSIONINFOEX structure。我在两台机器上运行它。如果我检查第一台计算机,则“系统信息”对话框将操作系统名称显示为“Microsoft Windows 8.1 Enterprise N”。命令行输出如下:

wSuiteMask & VER_SUITE_PERSONAL: 0x00000100 & 0x00000200 = 0x00000000
wSuiteMask & VER_SUITE_SINGLEUSERTS: 0x00000100 & 0x00000100 = 0x00000100

第二台机器将操作系统名称显示为“Microsoft Windows 8.1”,它具有以下输出:

wSuiteMask & VER_SUITE_PERSONAL: 0x00000300 & 0x00000200 = 0x00000200
wSuiteMask & VER_SUITE_SINGLEUSERTS: 0x00000300 & 0x00000100 = 0x00000100

基于此,我希望NTSuitePersonal WiX Burn内置变量在第二台机器上为非零,但两者都设置为零。这是我在日志文件中看到的内容:

Variable: NTSuitePersonal = 0

我是否忽略了某些事情,或者这是否是Burn中的缺陷?

作为参考,我的命令行应用程序的全文如下:

using System;
using System.Runtime.InteropServices;

namespace OperatingSystemInfoSandbox
{
    class Program
    {
        [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Auto)]
        public class OSVERSIONINFOEX
        {
            public int dwOSVersionInfoSize;
            public int dwMajorVersion;
            public int dwMinorVersion;
            public int dwBuildNumber;
            public int dwPlatformId;
            [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 128)]
            public string szCSDVersion;
            public UInt16 wServicePackMajor;
            public UInt16 wServicePackMinor;
            public UInt16 wSuiteMask;
            public byte wProductType;
            public byte wReserved;
            public OSVERSIONINFOEX()
            {
                this.dwOSVersionInfoSize = (int)Marshal.SizeOf(typeof(OSVERSIONINFOEX));
            }
        }

        [return: MarshalAs(UnmanagedType.Bool)]
        [DllImport("kernel32.dll", CharSet = CharSet.Auto, SetLastError = true)]
        public static extern bool GetVersionEx([In, Out] OSVERSIONINFOEX osvi);

        public const UInt16 VER_SUITE_PERSONAL = 0x00000200;
        public const UInt16 VER_SUITE_SINGLEUSERTS = 0x00000100;

        static void Main(string[] args)
        {
            var osvi = new OSVERSIONINFOEX();
            GetVersionEx(osvi);
            Console.WriteLine("wSuiteMask & VER_SUITE_PERSONAL: 0x{0:x8} & 0x{1:x8} = 0x{2:x8}",
                osvi.wSuiteMask, VER_SUITE_PERSONAL, osvi.wSuiteMask & VER_SUITE_PERSONAL);
            Console.WriteLine("wSuiteMask & VER_SUITE_SINGLEUSERTS: 0x{0:x8} & 0x{1:x8} = 0x{2:x8}",
                osvi.wSuiteMask, VER_SUITE_SINGLEUSERTS, osvi.wSuiteMask & VER_SUITE_SINGLEUSERTS);
            Console.ReadKey();
        }        
    }
}

1 个答案:

答案 0 :(得分:1)

请提交错误。看起来它没有正确检查面具。