{"id":6483,"date":"2012-09-27T07:00:00","date_gmt":"2012-09-27T07:00:00","guid":{"rendered":"https:\/\/blogs.msdn.microsoft.com\/oldnewthing\/2012\/09\/27\/why-arent-environment-variables-being-expanded-in-my-rgs-file\/"},"modified":"2012-09-27T07:00:00","modified_gmt":"2012-09-27T07:00:00","slug":"why-arent-environment-variables-being-expanded-in-my-rgs-file","status":"publish","type":"post","link":"https:\/\/devblogs.microsoft.com\/oldnewthing\/20120927-00\/?p=6483","title":{"rendered":"Why aren&#039;t environment variables being expanded in my RGS file?"},"content":{"rendered":"<p>A customer was having trouble with their RGS file.\n<\/p>\n<blockquote CLASS=\"q\">\n<p>\nI want to include the below line in a .rgs file:\n<\/p>\n<pre>\nval HandlerPath = s '%windir%\\system32\\awesome.dll'.\n<\/pre>\n<p>\nWhen I do this, registering of the dll fails with 80002009. Any help?\nIf I change it to\n<\/p>\n<pre>\nval HandlerPath = s 'C:\\windows\\system32\\awesome.dll'.\n<\/pre>\n<p>\nthen the registration succeeds (but of course now contains\na hard-coded path).\n<\/p>\n<\/blockquote>\n<p>\nA common problem people have when asking a question is assuming\nthat the person reading your question has knowledge that is a\nstrict superset of what you know.\nAs a result, people omit details like\nthe answer to the question\n&#8220;How did you register your RGS file?&#8221;\n<\/p>\n<p>\nIf all else fails read the documentation\n(which happens to be the #1 hit for &#8220;rgs file&#8221;, or at least was\nat the time of this writing).\nAnd the documentation explains\n<a HREF=\"http:\/\/msdn.microsoft.com\/en-us\/library\/7dc08eza.aspx\">\nhow the <code>%<\/code> works<\/a>.\nAnd it&#8217;s not for environment variable expansion.\n<\/p>\n<p>\nJust because you stick something between percent signs\ndoesn&#8217;t mean that the magical percent sign fairies are going\nto swoop in and perform environment variable expansion.\n<a HREF=\"http:\/\/blogs.msdn.com\/b\/oldnewthing\/archive\/2011\/08\/04\/10192588.aspx\">\nWishful thinking does not cause features to spring into existence<\/a>.\n<\/p>\n<p>\nAs the documentation says,\nyou need to use the\n<code>_ATL_REGMAP_ENTRY<\/code> macro to\ncreate the mapping for replacement variables.\n<\/p>\n<p>\nThis type of question reflects a certain mentality which is\n<a HREF=\"http:\/\/thedailywtf.com\/Articles\/G%C3%B6r_spel!.aspx\">\ncute when kids do it<\/a>,\nbut frustrating when demonstrated by programmers,\nnamely, that features exist\n<i>merely because you expect them to<\/i>,\nrather than because there&#8217;s any documentation that\nsuggests that they exist.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>A customer was having trouble with their RGS file. I want to include the below line in a .rgs file: val HandlerPath = s &#8216;%windir%\\system32\\awesome.dll&#8217;. When I do this, registering of the dll fails with 80002009. Any help? If I change it to val HandlerPath = s &#8216;C:\\windows\\system32\\awesome.dll&#8217;. then the registration succeeds (but of course [&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-6483","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-oldnewthing","tag-code"],"acf":[],"blog_post_summary":"<p>A customer was having trouble with their RGS file. I want to include the below line in a .rgs file: val HandlerPath = s &#8216;%windir%\\system32\\awesome.dll&#8217;. When I do this, registering of the dll fails with 80002009. Any help? If I change it to val HandlerPath = s &#8216;C:\\windows\\system32\\awesome.dll&#8217;. then the registration succeeds (but of course [&hellip;]<\/p>\n","_links":{"self":[{"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/posts\/6483","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=6483"}],"version-history":[{"count":0,"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/posts\/6483\/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=6483"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/categories?post=6483"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/tags?post=6483"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}