Results 1 to 4 of 4

Thread: Some keys seem to not exist when reading registry

  1. #1

    Thread Starter
    New Member
    Join Date
    Jul 2011
    Posts
    14

    Some keys seem to not exist when reading registry

    I am trying to read keys and values from the registry. The keys I am looking for do exist in the registry, but the variable mRegKey is still Nothing after the first line is run.
    I have also tried different keys under HKLM\Software, some work and some dont. HKLM\Software\ATI is found but HKLM\Software\Oracle is not (both are shown in regedit).

    Code:
            mRegKey = Registry.LocalMachine.OpenSubKey("SOFTWARE\Stockenstrand\DemoPC", False)
            If Not mRegKey Is Nothing Then
                mSettingImagePath = mRegKey.GetValue("ImagePath")
                mSettingSourceDrive = mRegKey.GetValue("SourceDrive")
                mSettingVirtualDrive = mRegKey.GetValue("VirtualDrive")
                mRegKey.Close()
            End If
    ---------------------------------------------
    >stockenstrand.com_
    ---------------------------------------------

  2. #2
    Karen Payne MVP kareninstructor's Avatar
    Join Date
    Jun 2008
    Location
    Oregon
    Posts
    6,713

    Re: Some keys seem to not exist when reading registry

    I am not sure this is relevant to your situation but there are times that a location is removed and then created later. If you where to try and read the location, key or value during this time that would be correct even thou you saw it in the registry editor. A real world example, Macromedia HomeSite+ keeps sessions stored in (figure 1) while not running and while running the key is destroyed until the editor is closed. Sometime download Process Monitor from Microsoft and watch the hundreds of operations being done in the registry without doing much.

    Figure 1
    Code:
    HKEY_CURRENT_USER\Software\Macromedia\HomeSite+\Restore

  3. #3

    Thread Starter
    New Member
    Join Date
    Jul 2011
    Posts
    14

    Re: Some keys seem to not exist when reading registry

    No, the entries are static. I have added them myself manually. I have not been able to find any logic (spaces in key names, sub keys etc etc) to why some keys are readable and others doesn't seem to exist.
    ---------------------------------------------
    >stockenstrand.com_
    ---------------------------------------------

  4. #4
    PowerPoster
    Join Date
    Mar 2002
    Location
    UK
    Posts
    4,780

    Re: Some keys seem to not exist when reading registry

    This google any good? (points here)

Tags for this Thread

Posting Permissions

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



Click Here to Expand Forum to Full Width