<?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 Question about the getUserRegistryProductRootKey function in ObjectARX Forum</title>
    <link>https://forums.autodesk.com/t5/objectarx-forum/question-about-the-getuserregistryproductrootkey-function/m-p/13760358#M44098</link>
    <description>&lt;LI-CODE lang="general"&gt;int ArxGetProductKey()
{
#if (ADS &amp;gt; 18)
	const ACHAR* pRegKey = acdbHostApplicationServices()-&amp;gt;getUserRegistryProductRootKey();
#else
	const ACHAR* pRegKey = acdbHostApplicationServices()-&amp;gt;getRegistryProductRootKey();
#endif
	ads_retstr(pRegKey);
	adsout &amp;lt;&amp;lt; "\nkey=" &amp;lt;&amp;lt; pRegKey;
	return RSRSLT;
}&lt;/LI-CODE&gt;&lt;P&gt;Including&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;acdbHostApplicationServices()-&amp;gt;getMachineRegistryProductRootKey();&lt;/P&gt;&lt;P&gt;The above function will retrieve a value such as:&lt;BR /&gt;"Software\\Autodesk\\AutoCAD\\R24.1\\ACAD-5101:409"&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;However, if I want to obtain the function pointer from within AcDb24.dll,&lt;/SPAN&gt;&lt;/P&gt;&lt;LI-CODE lang="general"&gt;c:\Program Files\Autodesk\AutoCAD 2022&amp;gt;dumpbin /exports acdb24.dll | findstr RootKey
       9836 2660 001A5A14 ?getMachineRegistryProductRootKey@AcDbHostApplicationServices@@UEAAPEB_WXZ
      10512 2904 001A5A14 ?getUserRegistryProductRootKey@AcDbHostApplicationServices@@UEAAPEB_WXZ&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="general"&gt;typedef const ACHAR* (*PFN_getUserRegistryProductRootKey)();

const ACHAR* GetUserRegistryProductRootKey()
{
  const char* mangledName = "?getUserRegistryProductRootKey@AcDbHostApplicationServices@@UEAAPEB_WXZ";
    const wchar_t* dllName = L"ACDB24.dll";
    HMODULE hMod = GetModuleHandleW(dllName);
    if (!hMod) hMod = LoadLibraryW(dllName);
    if (!hMod) return nullptr;
    PFN_getUserRegistryProductRootKey pfnGetKey =
        (PFN_getUserRegistryProductRootKey)GetProcAddress(hMod, mangledName);
    if (!pfnGetKey) return nullptr;
    return pfnGetKey();
}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The result obtained from the above function is actually:&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;SOFTWARE\Autodesk\ObjectDBX\R24.1&lt;/P&gt;&lt;P&gt;Why is the result different?&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;For the second method, what &lt;STRONG&gt;name mangling&lt;/STRONG&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt; should be used to get the correct value&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;"Software\\Autodesk\\AutoCAD\\R24.1\\ACAD-5101:409"?&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;DIV&gt;&lt;DIV class=""&gt;&amp;nbsp;&lt;/DIV&gt;&lt;/DIV&gt;</description>
    <pubDate>Fri, 08 Aug 2025 20:34:54 GMT</pubDate>
    <dc:creator>7598165</dc:creator>
    <dc:date>2025-08-08T20:34:54Z</dc:date>
    <item>
      <title>Question about the getUserRegistryProductRootKey function</title>
      <link>https://forums.autodesk.com/t5/objectarx-forum/question-about-the-getuserregistryproductrootkey-function/m-p/13760358#M44098</link>
      <description>&lt;LI-CODE lang="general"&gt;int ArxGetProductKey()
{
#if (ADS &amp;gt; 18)
	const ACHAR* pRegKey = acdbHostApplicationServices()-&amp;gt;getUserRegistryProductRootKey();
#else
	const ACHAR* pRegKey = acdbHostApplicationServices()-&amp;gt;getRegistryProductRootKey();
#endif
	ads_retstr(pRegKey);
	adsout &amp;lt;&amp;lt; "\nkey=" &amp;lt;&amp;lt; pRegKey;
	return RSRSLT;
}&lt;/LI-CODE&gt;&lt;P&gt;Including&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;acdbHostApplicationServices()-&amp;gt;getMachineRegistryProductRootKey();&lt;/P&gt;&lt;P&gt;The above function will retrieve a value such as:&lt;BR /&gt;"Software\\Autodesk\\AutoCAD\\R24.1\\ACAD-5101:409"&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;However, if I want to obtain the function pointer from within AcDb24.dll,&lt;/SPAN&gt;&lt;/P&gt;&lt;LI-CODE lang="general"&gt;c:\Program Files\Autodesk\AutoCAD 2022&amp;gt;dumpbin /exports acdb24.dll | findstr RootKey
       9836 2660 001A5A14 ?getMachineRegistryProductRootKey@AcDbHostApplicationServices@@UEAAPEB_WXZ
      10512 2904 001A5A14 ?getUserRegistryProductRootKey@AcDbHostApplicationServices@@UEAAPEB_WXZ&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="general"&gt;typedef const ACHAR* (*PFN_getUserRegistryProductRootKey)();

const ACHAR* GetUserRegistryProductRootKey()
{
  const char* mangledName = "?getUserRegistryProductRootKey@AcDbHostApplicationServices@@UEAAPEB_WXZ";
    const wchar_t* dllName = L"ACDB24.dll";
    HMODULE hMod = GetModuleHandleW(dllName);
    if (!hMod) hMod = LoadLibraryW(dllName);
    if (!hMod) return nullptr;
    PFN_getUserRegistryProductRootKey pfnGetKey =
        (PFN_getUserRegistryProductRootKey)GetProcAddress(hMod, mangledName);
    if (!pfnGetKey) return nullptr;
    return pfnGetKey();
}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The result obtained from the above function is actually:&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;SOFTWARE\Autodesk\ObjectDBX\R24.1&lt;/P&gt;&lt;P&gt;Why is the result different?&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;For the second method, what &lt;STRONG&gt;name mangling&lt;/STRONG&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt; should be used to get the correct value&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;"Software\\Autodesk\\AutoCAD\\R24.1\\ACAD-5101:409"?&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;DIV&gt;&lt;DIV class=""&gt;&amp;nbsp;&lt;/DIV&gt;&lt;/DIV&gt;</description>
      <pubDate>Fri, 08 Aug 2025 20:34:54 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/objectarx-forum/question-about-the-getuserregistryproductrootkey-function/m-p/13760358#M44098</guid>
      <dc:creator>7598165</dc:creator>
      <dc:date>2025-08-08T20:34:54Z</dc:date>
    </item>
  </channel>
</rss>

