none
RegistryKey.GetValue for WinLogon Fails to Return All Values RRS feed

  • Question

  • When using RegistryKey.GetValueNames to retrieve the values of "LOCALMACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon", not all values of the key are returned. It only returns 10 values, which matches the ValuesCount of the key. However, if I manually count the values of the key using "regedit", I have 33 values recorded. There is no way to update the values count of key, either in "regedit" or code. It appears that this "bad" count is impacting using the GetValue method, which I am trying to use.


    Thursday, July 26, 2018 2:25 PM

Answers

  • Seems that your program accesses a different key: “Computer\HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\Microsoft\Windows NT\CurrentVersion\Winlogon”.

    Try disabling the “Prefer 32-bit” option in Project Properties, or see RegDisableReflectionKey, or try this:

    RegistryKey b = RegistryKey.OpenBaseKey( RegistryHive.LocalMachine, RegistryView.Registry64 );
    RegistryKey rk = b.OpenSubKey( @"SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon" );
    valueNames = rk.GetValueNames();




    • Edited by Viorel_MVP Thursday, July 26, 2018 6:58 PM
    • Marked as answer by AlaskanRogue Thursday, July 26, 2018 8:15 PM
    Thursday, July 26, 2018 6:53 PM

All replies

  • Seems that your program accesses a different key: “Computer\HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\Microsoft\Windows NT\CurrentVersion\Winlogon”.

    Try disabling the “Prefer 32-bit” option in Project Properties, or see RegDisableReflectionKey, or try this:

    RegistryKey b = RegistryKey.OpenBaseKey( RegistryHive.LocalMachine, RegistryView.Registry64 );
    RegistryKey rk = b.OpenSubKey( @"SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon" );
    valueNames = rk.GetValueNames();




    • Edited by Viorel_MVP Thursday, July 26, 2018 6:58 PM
    • Marked as answer by AlaskanRogue Thursday, July 26, 2018 8:15 PM
    Thursday, July 26, 2018 6:53 PM
  • Thanks Viorel, that worked. Marc.
    Thursday, July 26, 2018 8:16 PM