{"id":2453,"date":"2013-12-05T07:00:00","date_gmt":"2013-12-05T07:00:00","guid":{"rendered":"https:\/\/blogs.msdn.microsoft.com\/oldnewthing\/2013\/12\/05\/whats-up-with-the-registry-key-hkey_classes_rootclsidclsid\/"},"modified":"2021-01-04T12:03:43","modified_gmt":"2021-01-04T20:03:43","slug":"20131205-00","status":"publish","type":"post","link":"https:\/\/devblogs.microsoft.com\/oldnewthing\/20131205-00\/?p=2453","title":{"rendered":"What&#8217;s up with the registry key HKEY_CLASSES_ROOT\\CLSID\\CLSID?"},"content":{"rendered":"<p>While I was <a title=\"Cheap amusement: Searching for spelling errors in the registry\" href=\"https:\/\/devblogs.microsoft.com\/oldnewthing\/20120510-00\/?p=7663\"> looking for spelling errors in the registry<\/a>, I ran across the strange registry key <code>HKEY_<wbr \/>CLASSES_<wbr \/>ROOT\\<wbr \/>CLSID\\<wbr \/>CLSID<\/code>, which has as its default value the stringified GUID <code>{0000031A-0000-0000-C000-000000000046}<\/code>. I asked the COM folks what the deal was with that.<\/p>\n<p>They explained, &#8220;It&#8217;s the progid for the class moniker.&#8221;<\/p>\n<p>That was enough to push me in the right direction, and it made my brain explode from the meta-ness of it all. Sort of like when you study Category Theory in math class.<\/p>\n<p>If you want to connect a COM class ID with a programmatic ID, you cross-link them like this:<\/p>\n<pre>[HKEY_CLASSES_ROOT\\CLSID\\<span style=\"border: solid .75pt black;\">{clsid}<\/span>\\ProgId]\r\n@=\"<span style=\"border: solid .75pt black;\">progid<\/span>\"\r\n\r\n[HKEY_CLASSES_ROOT\\<span style=\"border: solid .75pt black;\">progid<\/span>\\CLSID]\r\n@=\"<span style=\"border: solid .75pt black;\">{clsid}<\/span>\"\r\n<\/pre>\n<p>The class ID is a child of <code>HKEY_<wbr \/>CLASSES_<wbr \/>ROOT\\<wbr \/>CLSID<\/code>, and it in turn has a <code>ProgId<\/code> subkey whose value is the programmatic ID. Meanwhile, the programmatic ID is a child of <code>HKEY_<wbr \/>CLASSES_<wbr \/>ROOT<\/code>, and it in turn has a <code>CLSID<\/code> subkey whose value is the class ID.<\/p>\n<p>Here&#8217;s where things get weird: The programmatic ID for the class moniker is <code>CLSID<\/code>.<\/p>\n<p>Plug that into the above formula, and you get<\/p>\n<pre>[HKEY_CLASSES_ROOT\\CLSID\\<span style=\"border: solid .75pt black;\">{0000031A-0000-0000-C000-000000000046}<\/span>\\ProgId]\r\n@=\"<span style=\"border: solid .75pt black;\">CLSID<\/span>\"\r\n\r\n[HKEY_CLASSES_ROOT\\<span style=\"border: solid .75pt black;\">CLSID<\/span>\\CLSID]\r\n@=\"<span style=\"border: solid .75pt black;\">{0000031A-0000-0000-C000-000000000046}<\/span>\"\r\n<\/pre>\n<p>So it&#8217;s all legit. It just looks weird.<\/p>\n<p>It&#8217;s like that trick on the 80386 where you set a page directory entry to point back to the page directory itself, thereby allowing you to <a href=\"http:\/\/knowyourmeme.com\/memes\/xzibit-yo-dawg\"> access page tables through the page table<\/a>.<\/p>\n<p><b>Bonus chatter<\/b>: It frustrates me when I answer a question by merely giving a push in the right direction, and the person doesn&#8217;t realize that it was a helpful push and just comes back looking for more hand-holding. I try not to be that person.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>It&#8217;s the class moniker.<\/p>\n","protected":false},"author":1069,"featured_media":111744,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[1],"tags":[25],"class_list":["post-2453","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-oldnewthing","tag-code"],"acf":[],"blog_post_summary":"<p>It&#8217;s the class moniker.<\/p>\n","_links":{"self":[{"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/posts\/2453","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/users\/1069"}],"replies":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/comments?post=2453"}],"version-history":[{"count":0,"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/posts\/2453\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/media\/111744"}],"wp:attachment":[{"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/media?parent=2453"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/categories?post=2453"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/tags?post=2453"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}