{"id":5793,"date":"2012-12-19T07:00:00","date_gmt":"2012-12-19T07:00:00","guid":{"rendered":"https:\/\/blogs.msdn.microsoft.com\/oldnewthing\/2012\/12\/19\/why-doesnt-shgetknownfolderpath-return-the-customized-path\/"},"modified":"2012-12-19T07:00:00","modified_gmt":"2012-12-19T07:00:00","slug":"why-doesnt-shgetknownfolderpath-return-the-customized-path","status":"publish","type":"post","link":"https:\/\/devblogs.microsoft.com\/oldnewthing\/20121219-00\/?p=5793","title":{"rendered":"Why doesn&#039;t SHGetKnownFolderPath return the customized path?"},"content":{"rendered":"<p>\nA customer reported that the\n<code>SHGet&shy;Known&shy;Folder&shy;Path<\/code> function\nwas not working correctly.\nThey moved their Videos folder to a new location,\nbut when they called\n<code>SHGet&shy;Known&shy;Folder&shy;Path<\/code>,\nthey got the old path rather than the new one.\n<\/p>\n<p>\nA quick check of the code they provided showed why:\n<\/p>\n<pre>\n ...\n SHGetKnownFolderPath(FOLDERID_Videos,\n                      KF_FLAG_DONT_VERIFY |\n                      KF_FLAG_DEFAULT_PATH,\n                      NULL,\n                      &amp;pszPath);\n<\/pre>\n<p>\nUm, you&#8217;re passing the\n<code>KF_FLAG_DEFAULT_PATH<\/code> flag.\nThat flag means\n&#8220;Tell me where this folder <i>would have been<\/i>\nif its location had never been customized.&#8221;\nTherefore,\nif you pass this flag,\nyou have no right to complain that it&#8217;s returning\na path different from the customized path.\nBecause passing that flag means &#8220;I don&#8217;t want\nthe customized path.&#8221;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>A customer reported that the SHGet&shy;Known&shy;Folder&shy;Path function was not working correctly. They moved their Videos folder to a new location, but when they called SHGet&shy;Known&shy;Folder&shy;Path, they got the old path rather than the new one. A quick check of the code they provided showed why: &#8230; SHGetKnownFolderPath(FOLDERID_Videos, KF_FLAG_DONT_VERIFY | KF_FLAG_DEFAULT_PATH, NULL, &amp;pszPath); Um, you&#8217;re passing [&hellip;]<\/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-5793","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-oldnewthing","tag-code"],"acf":[],"blog_post_summary":"<p>A customer reported that the SHGet&shy;Known&shy;Folder&shy;Path function was not working correctly. They moved their Videos folder to a new location, but when they called SHGet&shy;Known&shy;Folder&shy;Path, they got the old path rather than the new one. A quick check of the code they provided showed why: &#8230; SHGetKnownFolderPath(FOLDERID_Videos, KF_FLAG_DONT_VERIFY | KF_FLAG_DEFAULT_PATH, NULL, &amp;pszPath); Um, you&#8217;re passing [&hellip;]<\/p>\n","_links":{"self":[{"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/posts\/5793","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=5793"}],"version-history":[{"count":0,"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/posts\/5793\/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=5793"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/categories?post=5793"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/tags?post=5793"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}