{"id":110700,"date":"2025-01-01T07:00:00","date_gmt":"2025-01-01T15:00:00","guid":{"rendered":"https:\/\/devblogs.microsoft.com\/oldnewthing\/?p=110700"},"modified":"2024-12-31T21:13:24","modified_gmt":"2025-01-01T05:13:24","slug":"20250101-00","status":"publish","type":"post","link":"https:\/\/devblogs.microsoft.com\/oldnewthing\/20250101-00\/?p=110700","title":{"rendered":"How is it possible to get <CODE>ERROR_<WBR>KEY_<WBR>DELETED<\/CODE> when I&#8217;m <I>creating<\/I> a key?"},"content":{"rendered":"<p>Some time ago, I explained that <a title=\"What does ERROR_KEY_DELETED mean?\" href=\"https:\/\/devblogs.microsoft.com\/oldnewthing\/20240821-46\/?p=110160\"> the <code>ERROR_<wbr \/>KEY_<wbr \/>DELETED<\/code> error code means that you tried to perform an operation on a deleted key<\/a>. But what does it mean when you get the error when trying to <i>create<\/i> a key?<\/p>\n<p>The key it&#8217;s complaining about is not the key you&#8217;re trying to create. The problem is with the key that you are trying to create the key <i>beneath<\/i>.<\/p>\n<pre>auto err = RegCreateKeyEx(<span style=\"border: solid 1px currentcolor;\">parentKey<\/span>, subkeyName,\r\n    0, nullptr, REG_OPTION_NON_VOLATILE, KEY_WRITE, nullptr, &amp;childKey);\r\n<\/pre>\n<p>If the parent key is deleted, then any future attempt to use that parent key (including creating child keys under it) will return <code>ERROR_<wbr \/>KEY_<wbr \/>DELETED<\/code>.<\/p>\n<p>We&#8217;ll look into this some more next time.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>The key that got deleted is not the one you are trying to create.<\/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-110700","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-oldnewthing","tag-code"],"acf":[],"blog_post_summary":"<p>The key that got deleted is not the one you are trying to create.<\/p>\n","_links":{"self":[{"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/posts\/110700","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=110700"}],"version-history":[{"count":0,"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/posts\/110700\/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=110700"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/categories?post=110700"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/tags?post=110700"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}