Skip to content

Win32::IsDeveloperModeEnabled() doesn't work in 32bit Perl #36

Open
@jkahrman

Description

@jkahrman

From a 32bit process, Win32::IsDeveloperModeEnabled() can't see the 64bit registry key where the developer mode setting is stored. It's using a wrong (similarly named) constant to set the dwFlags argument

win32/Win32.xs

Lines 1692 to 1700 in 39daf7c

status = pfnRegGetValueA(
HKEY_LOCAL_MACHINE,
"SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\AppModelUnlock",
"AllowDevelopmentWithoutDevLicense",
RRF_RT_REG_DWORD | KEY_WOW64_64KEY,
NULL,
&val,
&val_size
);

KEY_WOW64_64KEY is a "Registry Access Right" constant defined in winnt.h as 0x0100 - https://docs.microsoft.com/en-us/windows/win32/sysinfo/registry-key-security-and-access-rights

The correct constant to use is RRF_SUBKEY_WOW6464KEY which is defined in winreg.h as
0x00010000 - https://docs.microsoft.com/en-us/windows/win32/api/winreg/nf-winreg-reggetvaluea#RRF_SUBKEY_WOW6464KEY

Note: The RRF_SUBKEY_WOW6464KEY constant is only defined in the Windows 10 SDK, and I'm building Perl with the 8.1 SDK, and then running that binary on Windows 10 machines.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions