[PATCH v2 1/3] kernelbase: Implement compatibility mode for GetVersionEx.

Nikolay Sivov nsivov at codeweavers.com
Tue Mar 17 11:28:16 CDT 2020


On 3/17/20 7:07 PM, Gabriel Ivăncescu wrote:
> +/***********************************************************************
> + * Win8 info, reported if app doesn't provide compat GUID in manifest.
> + */
> +static const RTL_OSVERSIONINFOEXW windows8_version_data =
> +{
> +    sizeof(RTL_OSVERSIONINFOEXW), 6, 2, 0x23f0, VER_PLATFORM_WIN32_NT,
> +    {0}, 0, 0, VER_SUITE_SINGLEUSERTS, VER_NT_WORKSTATION, 0
> +};
> +
> +
> +/***********************************************************************
> + * Windows versions that need compatibility GUID specified in manifest
> + * in order to be reported by the APIs.
> + */
> +static const struct
> +{
> +    RTL_OSVERSIONINFOEXW info;
> +    GUID guid;
> +} version_data[] =
> +{
> +    /* Windows 8.1 */
> +    {
> +        {
> +            sizeof(RTL_OSVERSIONINFOEXW), 6, 3, 0x2580, VER_PLATFORM_WIN32_NT,
> +            {0}, 0, 0, VER_SUITE_SINGLEUSERTS, VER_NT_WORKSTATION, 0
> +        },
> +        {0x1f676c76,0x80e1,0x4239,{0x95,0xbb,0x83,0xd0,0xf6,0xd0,0xda,0x78}}
> +    },
> +    /* Windows 10 */
> +    {
> +        {
> +            sizeof(RTL_OSVERSIONINFOEXW), 10, 0, 0x42ee, VER_PLATFORM_WIN32_NT,
> +            {0}, 0, 0, VER_SUITE_SINGLEUSERTS, VER_NT_WORKSTATION, 0
> +        },
> +        {0x8e0f7a12,0xbfb3,0x4fe8,{0xb9,0xa5,0x48,0xfd,0x50,0xa1,0x5a,0x9a}}
> +    }
> +};
For that you only need to store 3 values - major/minor/build.
> +/***********************************************************************
> + * Holds the current version (including compatibility mode).
> + * Call init_current_version before using it.
> + */
> +static RTL_OSVERSIONINFOEXW current_version;
> +
> +
> +/******************************************************************************
> + *  init_current_version
> + *
> + * Initialize the current_version variable.
> + *
> + * For compatibility, Windows 8.1 and later report Win8 version unless the app
> + * has a manifest that confirms its compatibility with newer versions of Windows.
> + *
> + */
> +static BOOL CALLBACK init_current_version_callback(PINIT_ONCE init_once, PVOID parameter, PVOID *context)
> +{
Should it actually be static and initialized once? What happens if you 
activate another context dynamically?

> +    /*ACTIVATION_CONTEXT_COMPATIBILITY_INFORMATION*/DWORD *acci;
Why not use proper type pointer?

> +                if (elements[i].Type == ACTCX_COMPATIBILITY_ELEMENT_TYPE_OS &&
> +                    IsEqualGUID(&elements[i].Id, &version_data[idx].guid))
Type value name has a typo.



More information about the wine-devel mailing list