{"id":99775,"date":"2018-09-19T07:00:00","date_gmt":"2018-09-19T21:00:00","guid":{"rendered":"https:\/\/blogs.msdn.microsoft.com\/oldnewthing\/?p=99775"},"modified":"2019-03-13T00:30:05","modified_gmt":"2019-03-13T07:30:05","slug":"20180919-00","status":"publish","type":"post","link":"https:\/\/devblogs.microsoft.com\/oldnewthing\/20180919-00\/?p=99775","title":{"rendered":"Why did every Windows 3.0 DLL have an exported function called WEP?"},"content":{"rendered":"<p>One of the quirks of Windows 3.0 was this function called WEP, which was exported by every DLL. And yet if you looked at every DLL, you&#8217;d see that the function did nothing but return. <\/p>\n<p>What&#8217;s the deal with this function that everybody has, but which does nothing? <\/p>\n<p>WEP stands for Windows Exit Procedure. Starting in Windows 3.0, Windows would call a DLL&#8217;s WEP function with a single boolean parameter. It called the WEP function with <code>FALSE<\/code> immediately before unloading the DLL from memory, and it called the WEP function with <code>TRUE<\/code> immediately before shutting down. Of course, the DLL&#8217;s WEP function was called only once per instance, because once you&#8217;re unloaded, you&#8217;re not going to be around to receive the shutdown notification. <\/p>\n<p>Since the WEP function was called as part of the unload or shutdown process, you were extremely limited in what you could do. The function itself had to be in a non-moveable segment, and the import entry needed to be in the resident name table. You can&#8217;t call any function that might result in a call to <code>Load&shy;Module<\/code>. You can&#8217;t call into another DLL at shutdown, because the other DLL might have already run its shutdown code. <\/p>\n<p>In practice, everybody just returned without doing anything. <\/p>\n","protected":false},"excerpt":{"rendered":"<p>The Windows Exit Procedure.<\/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":[2],"class_list":["post-99775","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-oldnewthing","tag-history"],"acf":[],"blog_post_summary":"<p>The Windows Exit Procedure.<\/p>\n","_links":{"self":[{"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/posts\/99775","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=99775"}],"version-history":[{"count":0,"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/posts\/99775\/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=99775"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/categories?post=99775"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/tags?post=99775"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}