<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Error when reading the registry in .NET Forum</title>
    <link>https://forums.autodesk.com/t5/net-forum/error-when-reading-the-registry/m-p/10789265#M14459</link>
    <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;To access LocalMachine (64 bits)&amp;nbsp; you should do:&lt;/P&gt;
&lt;LI-CODE lang="csharp"&gt;RegistryKey rklm = RegistryKey.OpenBaseKey(RegistryHive.LocalMachine, RegistryView.Registry64);&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Mon, 29 Nov 2021 21:59:30 GMT</pubDate>
    <dc:creator>_gile</dc:creator>
    <dc:date>2021-11-29T21:59:30Z</dc:date>
    <item>
      <title>Error when reading the registry</title>
      <link>https://forums.autodesk.com/t5/net-forum/error-when-reading-the-registry/m-p/10789170#M14458</link>
      <description>&lt;P&gt;Hi.&lt;/P&gt;&lt;P&gt;I have an installer that reads from the registry to find the AutoCAD version and location. It was working until recently. It seems the new computers being given out won't let the installer read from the registry. People have been running it as admin in the past but it doesn't accept this anymore. Has anyone run into this and if so what permissions do I need to ask IT for? They tried giving people admin rights but it doesn't seem to work..&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;LI-CODE lang="general"&gt; ' Get the AutoCAD current version registry key 
Private Function GetAcadCurVerKey() As String
        Dim rkcu As Microsoft.Win32.RegistryKey = 
           Microsoft.Win32.Registry.CurrentUser
        Dim path As String = "Software\Autodesk\AutoCAD\"
        Using rk1 As Microsoft.Win32.RegistryKey = rkcu.OpenSubKey(path)
            path += rk1.GetValue("CurVer")
            Using rk2 As Microsoft.Win32.RegistryKey = rkcu.OpenSubKey(path)
                Return path &amp;amp; "\" &amp;amp; rk2.GetValue("CurVer")
            End Using
        End Using
    End Function
    ' Get the acad.exe location for the AutoCAD current version 
    Private Function GetAcadLocation() As String
        Dim rklm As Microsoft.Win32.RegistryKey = 
              Microsoft.Win32.Registry.LocalMachine
        Dim path As String = GetAcadCurVerKey()
        Using rk As Microsoft.Win32.RegistryKey = rklm.OpenSubKey(path)
            Return DirectCast(rk.GetValue("AcadLocation"), String)
        End Using
    End Function&lt;/LI-CODE&gt;</description>
      <pubDate>Mon, 29 Nov 2021 21:13:34 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/error-when-reading-the-registry/m-p/10789170#M14458</guid>
      <dc:creator>GeeHaa</dc:creator>
      <dc:date>2021-11-29T21:13:34Z</dc:date>
    </item>
    <item>
      <title>Re: Error when reading the registry</title>
      <link>https://forums.autodesk.com/t5/net-forum/error-when-reading-the-registry/m-p/10789265#M14459</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;To access LocalMachine (64 bits)&amp;nbsp; you should do:&lt;/P&gt;
&lt;LI-CODE lang="csharp"&gt;RegistryKey rklm = RegistryKey.OpenBaseKey(RegistryHive.LocalMachine, RegistryView.Registry64);&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 29 Nov 2021 21:59:30 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/error-when-reading-the-registry/m-p/10789265#M14459</guid>
      <dc:creator>_gile</dc:creator>
      <dc:date>2021-11-29T21:59:30Z</dc:date>
    </item>
    <item>
      <title>Re: Error when reading the registry</title>
      <link>https://forums.autodesk.com/t5/net-forum/error-when-reading-the-registry/m-p/10794379#M14460</link>
      <description>&lt;P&gt;Thanks for the response Giles. Sorry it took so long to respond but I had to find a new user with the problem.&lt;/P&gt;&lt;P&gt;I changed the line you recommended and it errors out in the same place when it hits this line&amp;nbsp;&lt;/P&gt;&lt;P&gt;Using rk1 As Microsoft .Win32.RegistryKey = rkcu.OpenSubKey(path)&lt;/P&gt;&lt;P&gt;The error is object reference not set to an instance of object.&lt;/P&gt;&lt;P&gt;Please note it works fine on my machine. But I have full admin rights.&lt;/P&gt;&lt;P&gt;I tried changing everything to 64 bit and it still errors out in the same place.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks again.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 01 Dec 2021 19:32:32 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/error-when-reading-the-registry/m-p/10794379#M14460</guid>
      <dc:creator>GeeHaa</dc:creator>
      <dc:date>2021-12-01T19:32:32Z</dc:date>
    </item>
    <item>
      <title>Re: Error when reading the registry</title>
      <link>https://forums.autodesk.com/t5/net-forum/error-when-reading-the-registry/m-p/10795490#M14461</link>
      <description>&lt;P&gt;When I did such installers, I added an app.manifest file to the executable project (right click on the project in the Solution Explorer &amp;gt; Add &amp;gt; New Item &amp;gt; Application Manifest File) in which I replaced:&lt;/P&gt;
&lt;P&gt;&amp;lt;requestedExecutionLevel level=&lt;STRONG&gt;"asInvoker"&lt;/STRONG&gt; uiAccess="false" /&amp;gt;&lt;/P&gt;
&lt;P&gt;with:&lt;/P&gt;
&lt;P&gt;&amp;lt;requestedExecutionLevel level=&lt;STRONG&gt;"requireAdministrator"&lt;/STRONG&gt; uiAccess="false" /&amp;gt;&lt;/P&gt;</description>
      <pubDate>Thu, 02 Dec 2021 07:46:30 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/error-when-reading-the-registry/m-p/10795490#M14461</guid>
      <dc:creator>_gile</dc:creator>
      <dc:date>2021-12-02T07:46:30Z</dc:date>
    </item>
    <item>
      <title>Re: Error when reading the registry</title>
      <link>https://forums.autodesk.com/t5/net-forum/error-when-reading-the-registry/m-p/10811737#M14462</link>
      <description>&lt;!-- ?xml version=&amp;quot;1.0&amp;quot; encoding=&amp;quot;utf-8&amp;quot;? --&gt;&lt;LI-CODE lang="general"&gt;&amp;lt;?xml version="1.0" encoding="utf-8"?&amp;gt;
&amp;lt;asmv1:assembly manifestVersion="1.0" xmlns="urn:schemas-microsoft-com:asm.v1" xmlns:asmv1="urn:schemas-microsoft-com:asm.v1" xmlns:asmv2="urn:schemas-microsoft-com:asm.v2" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"&amp;gt;
  &amp;lt;assemblyIdentity version="1.0.0.0" name="MyApplication.app"/&amp;gt;
  &amp;lt;trustInfo xmlns="urn:schemas-microsoft-com:asm.v2"&amp;gt;
    &amp;lt;security&amp;gt;
      &amp;lt;requestedPrivileges xmlns="urn:schemas-microsoft-com:asm.v3"&amp;gt;
         &amp;lt;requestedExecutionLevel  level="requireAdministrator" uiAccess="false" /&amp;gt;
       &amp;lt;/requestedPrivileges&amp;gt;
    &amp;lt;/security&amp;gt;
  &amp;lt;/trustInfo&amp;gt;&lt;/LI-CODE&gt;&lt;P&gt;I inserted the line above. And put both the manifest file and the executable in the same folder. It still crashes when trying to read the registry. The compiler created 5 files including the manifest file. Do I need to include them all? I was informed by IT that new users don't have admin rights.&lt;/P&gt;</description>
      <pubDate>Thu, 09 Dec 2021 13:43:01 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/error-when-reading-the-registry/m-p/10811737#M14462</guid>
      <dc:creator>GeeHaa</dc:creator>
      <dc:date>2021-12-09T13:43:01Z</dc:date>
    </item>
    <item>
      <title>Re: Error when reading the registry</title>
      <link>https://forums.autodesk.com/t5/net-forum/error-when-reading-the-registry/m-p/10929367#M14463</link>
      <description>&lt;P&gt;Thanks Giles, I finally have it working. IT gave me a new computer to test it on so I could use trial and error to get it working. I reverted require Administrator back to Asinvoker and Published the app(It wouldn't let me publish with RequireAdministrator). I guess all I needed to do was publish the app. Visual Studio Created an Application that didn't work because it was missing groups of files but since I didn't need the files included I just use the Executable it created. It runs perfectly now without running as administrator.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks Again for your help.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 04 Feb 2022 18:35:37 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/error-when-reading-the-registry/m-p/10929367#M14463</guid>
      <dc:creator>GeeHaa</dc:creator>
      <dc:date>2022-02-04T18:35:37Z</dc:date>
    </item>
  </channel>
</rss>

