{"id":4473,"date":"2013-05-02T07:00:00","date_gmt":"2013-05-02T07:00:00","guid":{"rendered":"https:\/\/blogs.msdn.microsoft.com\/oldnewthing\/2013\/05\/02\/any-setting-you-expose-to-the-user-you-implicitly-expose-to-applications\/"},"modified":"2013-05-02T07:00:00","modified_gmt":"2013-05-02T07:00:00","slug":"any-setting-you-expose-to-the-user-you-implicitly-expose-to-applications","status":"publish","type":"post","link":"https:\/\/devblogs.microsoft.com\/oldnewthing\/20130502-00\/?p=4473","title":{"rendered":"Any setting you expose to the user you implicitly expose to applications"},"content":{"rendered":"<p>Often, in response to some sort of design decision, people will say, &#8220;Well, sure, you made this decision because it would allow applications to do Bad Thing, but why not expose it as a setting the user can select? For example, let the user pick a Topper Than Topmost Awesome Top Window Super Top (Extra Super edition), and keep that window on top regardless of what any application does.&#8221;<\/p>\n<p> Because anything the user can do, an application can do. <\/p>\n<p> Suppose there was a new context menu item for a window called <i>Make this Topper Than Topmost Awesome Top Window Super Top (Extra Super edition)<\/i>. Well, an application could just programmatically send the <code>WM_SYS&shy;COMMAND<\/code> message with <code>wParam<\/code> set to <code>SC_TOPPER&shy;THAN&shy;TOPMOST&shy;AWESOME&shy;TOP&shy;WINDOW&shy;SUPER&shy;TOP&shy;EXTRA&shy;SUPER<\/code>. <\/p>\n<p> If you say, &#8220;Nope, that context menu item is super secret and has a random command ID so nobody knows what its ID is&#8221;, well, the program could just call <code>Get&shy;System&shy;Menu<\/code> and enumerate the menu items and then extract the ID from the one whose name is <i>Make this Topper Than Topmost Awesome Top Window Super Top (Extra Super edition)<\/i>. <\/p>\n<p> If you say, &#8220;Nope, that menu item will be hidden from enumeration, so programs which enumerate their system menu can&#8217;t see it&#8221;, well, the program could just use Accessibility to programmatically open its system menu, and then programmatically click the <i>Make this Topper Than Topmost Awesome Top Window Super Top Super (Extra Super edition)<\/i> button. <\/p>\n<p> Anything the user can do, a program can do by simply <a href=\"http:\/\/blogs.msdn.com\/b\/oldnewthing\/archive\/2009\/02\/02\/9388941.aspx\"> pretending to be the user<\/a>. <\/p>\n","protected":false},"excerpt":{"rendered":"<p>Often, in response to some sort of design decision, people will say, &#8220;Well, sure, you made this decision because it would allow applications to do Bad Thing, but why not expose it as a setting the user can select? For example, let the user pick a Topper Than Topmost Awesome Top Window Super Top (Extra [&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":[26],"class_list":["post-4473","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-oldnewthing","tag-other"],"acf":[],"blog_post_summary":"<p>Often, in response to some sort of design decision, people will say, &#8220;Well, sure, you made this decision because it would allow applications to do Bad Thing, but why not expose it as a setting the user can select? For example, let the user pick a Topper Than Topmost Awesome Top Window Super Top (Extra [&hellip;]<\/p>\n","_links":{"self":[{"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/posts\/4473","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=4473"}],"version-history":[{"count":0,"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/posts\/4473\/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=4473"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/categories?post=4473"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/tags?post=4473"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}