Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Invalid registry value and registry key enumeration #15

Closed
majkinetor opened this issue Aug 2, 2016 · 5 comments
Closed

Invalid registry value and registry key enumeration #15

majkinetor opened this issue Aug 2, 2016 · 5 comments
Labels

Comments

@majkinetor
Copy link
Owner

majkinetor commented Aug 2, 2016

There is a problem, this (and other) plugin(s) enumerates the uninstall keys if there is an invalid entry.

On my computer I had to remove the invalid key NoModify in
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\nbi-nb-base-8.1.0.0.201510222201 and recreated it as a valid DWORD with value 1. From then on the problem was gone.

The entry was an invalid DWORD. AFAIK it was written with the wrong length information (8 instead of 4 bytes)

My System runs Windows 10.

Luckily I indeed exported the relevant registry entry before deleting and recreating it (with value 1):

--<snip>---
Windows Registry Editor Version 5.00

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\nbi-nb-base-8.1.0.0.201510222201]
"NoModify"=hex(4):01,00,00,00,00,00,00,00
--</snip>---

Link: https://disqus.com/home/discussion/chocolatey/chocolatey_gallery_wkhtmltopdf_099/#comment-2679706558

@majkinetor majkinetor added the bug label Aug 2, 2016
@majkinetor
Copy link
Owner Author

majkinetor commented Aug 2, 2016

I confirm this behavior.

Here is the regedit screenshot

image

After the import:

$local_key       = 'HKCU:\Software\Microsoft\Windows\CurrentVersion\Uninstall\*'
$machine_key     = 'HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\*'
$machine_key6432 = 'HKLM:\SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall\*'

PS> Get-ItemProperty @($machine_key6432, $machine_key, $local_key)
Get-ItemProperty : Specified cast is not valid.
At line:1 char:15
+ ... rray]$key = Get-ItemProperty @($machine_key6432, $machine_key, $local ...
+                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [Get-ItemProperty], InvalidCastException
    + FullyQualifiedErrorId : System.InvalidCastException,Microsoft.PowerShell.Commands.GetItemPropertyCommand

This is related to the mm-choco-extension module, but the same code is in chocolatey template itself (although I don't use it).

@majkinetor majkinetor removed the bug label Aug 2, 2016
@majkinetor
Copy link
Owner Author

majkinetor commented Aug 2, 2016

Now, this is not a bug because Get-ItemProperty fails, which is Powershell function. It doesn't expect such value. I can probably work around it and display a warning. Seems like it happens to some number of people.

I am also not sure how is this actually allowed to pass into registry ?! Might be an registry bug...

@majkinetor
Copy link
Owner Author

chocolatey/choco#739

@majkinetor majkinetor added the bug label Aug 2, 2016
@majkinetor
Copy link
Owner Author

Ok, i classify it as a bug since there is a workaround and I should use https://chocolatey.org/docs/helpers-get-uninstall-registry-key.

@2chg
Copy link

2chg commented Aug 2, 2016

I am also not sure how is this actually allowed to pass into registry ?! Might be an registry bug...
(Comment on Bug #15)

For netbeans the culrpit is found in a programming error:
Bug 251538 - Your Installer is Creating Invalid Data for the NoModify DWORD Key […]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants