Error Predefined Handle 714 (0x2CA): Fix it With 3 Steps

Reading time icon 2 min. read


Readers help support Windows Report. We may get a commission if you buy through our links. Tooltip Icon

Read our disclosure page to find out how can you help Windows Report sustain the editorial team. Read more

ERROR_PREDEFINED_HANDLE

ERROR_PREDEFINED_HANDLE usually affects developers and system administrators, but it will make managing your PC harder. Luckily, there are a couple of methods you can use to fix it.

How can I fix ERROR_PREDEFINED_HANDLE?

Before we start, ensure that you’re not modifying top-level hives such as HKEY_LOCAL_MACHINE. Also, a quick restart can sometimes help with this issue.

1. Check your registry permissions

  1. Press the Windows key + R and type regedit.
  2. Next, navigate to the key you want to modify.
  3. Right-click it and choose Permissions.
    Registry Editor Permissions
  4. Ensure that your account has Full Control over that key.

2. Use the correct Registry API in your code

  1. Open your code.
  2. Next, modify the code so it looks like this:
    HKEY hKey;
    if (RegOpenKeyEx(HKEY_LOCAL_MACHINE, TEXT("SOFTWARE\\MyApp"), 0, KEY_READ, &hKey) == ERROR_SUCCESS) {
        RegCloseKey(hKey);
    }

    regopenkeyex code
  3. Save changes.

3. Use PowerShell

  1. Open PowerShell as administrator.
  2. Run the following code:
    $Key = "HKLM:\SOFTWARE\MyApp"
    if (Test-Path $Key) {
        Set-ItemProperty -Path $Key -Name "MyValue" -Value "NewData"
    }

    key powershell
  3. Check if the problem is resolved.

Using this code, you will check if the key exists before trying to modify it. Be sure to make the changes to the code before running it.

The ERROR_PREDEFINED_HANDLE also comes with the following message:  714 (0x2CA) The specified registry key is referenced by a predefined handle so you can easily recognize it.

We covered similar issues in the past, and for more information check our ERROR_HANDLES_CLOSED or ERROR_INVALID_EXCEPTION_HANDLER guide.

More about the topics: error

User forum

0 messages