PHP User Warning: fetch_template() calls should be replaced by the vB_Template class. Template name: bbcode_highlight in ..../includes/functions.php on line 4197

PHP User Warning: fetch_template() calls should be replaced by the vB_Template class. Template name: bbcode_highlight in ..../includes/functions.php on line 4197
Registry call returns nothing-VBForums
Results 1 to 6 of 6

Thread: Registry call returns nothing

  1. #1

    Thread Starter
    New Member
    Join Date
    Dec 2019
    Posts
    3

    Registry call returns nothing

    I cannot seem to access the values under the registry key: HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Authentication

    Dim readValue = My.Computer.Registry.GetValue(
    "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Authentication\LockScreenContent", "manager", Nothing)

    If My.Computer.Registry.GetValue("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Authenti cation\LockScreenContent",
    "manager", Nothing) Is Nothing Then
    MsgBox("Value does not exist.")
    else
    MsgBox("The value is " & readValue)
    End If

    The value should be {A9B005E5-AB63-4C1D-AE9E-AA120A50BB0F} as shown in my regedit

    Every entry below Authorization also returns nothing...

    Any ideas?

  2. #2
    PowerPoster kfcSmitty's Avatar
    Join Date
    May 2005
    Posts
    2,168

    Re: Registry call returns nothing

    To access HKEY_LOCAL_MACHINE you need to use

    Registry.LocalMachine.GetValue. If you change your calls to use that it should work. Also, you have a space in "authentication" in your if statement.

    https://docs.microsoft.com/en-us/dot...tframework-4.8

  3. #3

    Thread Starter
    New Member
    Join Date
    Dec 2019
    Posts
    3

    Re: Registry call returns nothing

    Quote Originally Posted by kfcSmitty View Post
    To access HKEY_LOCAL_MACHINE you need to use

    Registry.LocalMachine.GetValue. If you change your calls to use that it should work. Also, you have a space in "authentication" in your if statement.

    https://docs.microsoft.com/en-us/dot...tframework-4.8
    space is copy error (senior moment}

    I changed the 2 lines to:
    Dim readValue = My.Computer.Registry.LocalMachine.GetValue(
    and
    If My.Computer.Registry.LocalMachine.GetValue(...

    and it returned "manager" not the value of it.

  4. #4
    PowerPoster kfcSmitty's Avatar
    Join Date
    May 2005
    Posts
    2,168

    Re: Registry call returns nothing

    Looks like you need to specify that you're in a 64 bit environment.


    vb.net Code:
    1. Using hklm = RegistryKey.OpenBaseKey(RegistryHive.LocalMachine, RegistryView.Registry64)
    2.     Using key = hklm.OpenSubKey("SOFTWARE\Microsoft\Windows\CurrentVersion\Authentication\LockScreenContent", False)
    3.         Dim keyValue As String = key.GetValue("manager", Nothing)
    4.         Console.ReadLine()
    5.     End Using
    6. End Using

  5. #5

    Thread Starter
    New Member
    Join Date
    Dec 2019
    Posts
    3

    Re: Registry call returns nothing

    Quote Originally Posted by kfcSmitty View Post
    Looks like you need to specify that you're in a 64 bit environment.


    vb.net Code:
    1. Using hklm = RegistryKey.OpenBaseKey(RegistryHive.LocalMachine, RegistryView.Registry64)
    2.     Using key = hklm.OpenSubKey("SOFTWARE\Microsoft\Windows\CurrentVersion\Authentication\LockScreenContent", False)
    3.         Dim keyValue As String = key.GetValue("manager", Nothing)
    4.         Console.ReadLine()
    5.     End Using
    6. End Using
    Must be something else missing.
    I'm getting errors:
    RegistryView, RegistryKey, and ReistryHive are not declared. It may be inaccessible due to its protection level.

  6. #6
    PowerPoster kfcSmitty's Avatar
    Join Date
    May 2005
    Posts
    2,168

    Re: Registry call returns nothing

    You need to import Microsoft.Win32

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Featured


Click Here to Expand Forum to Full Width