[PATCH] advapi32: MachineGUID to have same value in WoW64

Nikolay Sivov nsivov at codeweavers.com
Tue Oct 16 03:54:54 CDT 2018



On 10/16/2018 11:06 AM, Brendan McGrath wrote:
> Currently, when running the following two commands in a new prefix:
> wine reg query 'HKLM\Software\Microsoft\Cryptography' /v MachineGuid
> wine64 reg query 'HKLM\Software\Microsoft\Cryptography' /v MachineGuid
>
> Two different values are returned. This can cause an issue when, for
> example, a 32-bit Launcher and 64-bit application expect the same value.
>
> This patch ensures that when the 64-bit GUID is created, the 32-bit
> GUID is created as well (with the same value).
>
> Signed-off-by: Brendan McGrath <brendan at redmandi.com>
> ---
>
> I considered a few options on how to achieve this; but ended up with
> this option as it seemed the simplest. However, it does leave the
> possiblity for an application or user to change one and leave the other.
>
> I did note that Windows doesn't appear to have a MachineGuid entry for
> WoW, so it looks like Windows just uses the one entry. But I wasn't
> sure of the best way to achieve that in Wine (and couldn't find a
> precedent).

Hi, Brendan.

Thanks for the patch. Since this value should only be present in 64bit 
branch, key should be opened with KEY_WOW64_64KEY when setting it. You 
can't access it on Windows either, with /reg:32 mode, which is default 
for 32-bit reg.exe.

>
>   dlls/advapi32/crypt.c | 8 ++++++++
>   1 file changed, 8 insertions(+)
>
> diff --git a/dlls/advapi32/crypt.c b/dlls/advapi32/crypt.c
> index 01d58804235..0ea64b52226 100644
> --- a/dlls/advapi32/crypt.c
> +++ b/dlls/advapi32/crypt.c
> @@ -313,6 +313,14 @@ static void CRYPT_CreateMachineGuid(void)
>                           RegSetValueExW(key, machineGuidW, 0, REG_SZ,
>                                          (const BYTE *)buf,
>                                          (lstrlenW(buf)+1)*sizeof(WCHAR));
> +                        r = RegOpenKeyExW(HKEY_LOCAL_MACHINE, cryptographyW, 0,
> +                                           KEY_ALL_ACCESS | KEY_WOW64_32KEY, &key);
> +                        if (!r)
> +                        {
> +                            RegSetValueExW(key, machineGuidW, 0, REG_SZ,
> +                                           (const BYTE *)buf,
> +                                           (lstrlenW(buf)+1)*sizeof(WCHAR));
> +                        }
>                       }
>   		}
>   		RegCloseKey(key);




More information about the wine-devel mailing list