{"id":3029,"date":"2020-03-21T20:46:20","date_gmt":"2020-03-21T12:46:20","guid":{"rendered":"https:\/\/www.aoisnow.net\/blog\/?p=3029"},"modified":"2025-05-03T12:30:42","modified_gmt":"2025-05-03T04:30:42","slug":"tont-%e4%b8%ba%e4%bb%80%e4%b9%88%e4%bc%9a%e6%9c%89%e4%b8%80%e4%b8%aa%e5%8d%95%e7%8b%ac%e7%9a%84-getsystemdirectory-%e6%96%b9%e6%b3%95%ef%bc%9f","status":"publish","type":"post","link":"https:\/\/www.aoisnow.net\/blog\/archives\/3029","title":{"rendered":"TONT 37623 \u4e3a\u4ec0\u4e48\u4f1a\u6709\u4e00\u4e2a\u5355\u72ec\u7684 GetSystemDirectory \u65b9\u6cd5\uff1f"},"content":{"rendered":"<p>\u539f\u6587\u94fe\u63a5\uff1a<a href=\"https:\/\/devblogs.microsoft.com\/oldnewthing\/20041008-00\/?p=37623\" target=\"_blank\" rel=\"noopener\">https:\/\/devblogs.microsoft.com\/oldnewthing\/20041008-00\/?p=37623<\/a><\/p>\n<p>If the system directory is always %windir%\\SYSTEM32, why is there a special function to get it?<\/p>\n<p>\u5982\u679c\u7cfb\u7edf\u76ee\u5f55\u603b\u4f1a\u662f %windir%\\SYSTEM32\uff0c\u4e3a\u4ec0\u4e48\u8fd8\u6709\u4e13\u95e8\u7684\u4e00\u4e2a\u65b9\u6cd5\u6765\u83b7\u53d6\u5b83\uff1f<\/p>\n<p>Because it wasn\u2019t always that.<\/p>\n<p>\u56e0\u4e3a\u5e76\u4e0d\u603b\u662f\u5982\u6b64\u3002<\/p>\n<p>For 16-bit programs on Windows NT, the system directory is %windir%\\SYSTEM. That\u2019s also the name of the system directory for Windows 95-based systems and all the 16-bit versions of Windows.<\/p>\n<p>\u5bf9\u4e8e Windows NT \u4e0b\u7684 16 \u4f4d\u5e94\u7528\u7a0b\u5e8f\u6765\u8bf4\uff0c\u7cfb\u7edf\u76ee\u5f55\u662f %windir%\\SYSTEM\u3002\u5bf9\u4e8e\u4ee5 Windows 95 \u4e3a\u57fa\u7840\u3001\u4ee5\u53ca\u6240\u670916\u4f4d\u7248\u672c\u7684 Windows \u6765\u8bf4\u4e5f\u662f\u5982\u6b64\u3002<\/p>\n<p>But even in the 16-bit world, if it was always %windir%\\SYSTEM, why have a function for it?<\/p>\n<p>\u7136\u800c\uff0c\u5373\u4fbf\u572816\u4f4d\u7684\u4e16\u754c\u91cc\uff0c\u5982\u679c\u7cfb\u7edf\u76ee\u5f55\u603b\u4f1a\u662f %windir%\\SYSTEM \u7684\u8bdd\uff0c\u90a3\u4e3a\u4ec0\u4e48\u8fd8\u9700\u8981\u4e13\u95e8\u7684\u4e00\u4e2a\u65b9\u6cd5\u5462\uff1f<\/p>\n<p>Because even in the 16-bit world, it wasn\u2019t always %windir%\\SYSTEM.<\/p>\n<p>\u56e0\u4e3a\u5373\u4f7f\u572816\u4f4d\u7684\u4e16\u754c\u91cc\uff0c\u4e5f\u5e76\u4e0d\u603b\u662f\u5982\u6b64\u3002<\/p>\n<p>Back in the old days, you could run Windows directly over the network. All the system files were kept on the network server, and only the user\u2019s files were kept on the local machine. What\u2019s more, every single computer on the network used the same system directory on the server. There was only one copy of USER.EXE, for example, which everybody shared.<\/p>\n<p>\u5728\u8fc7\u53bb\uff0c\u4f60\u53ef\u4ee5\u76f4\u63a5\u901a\u8fc7\u7f51\u7edc\u6765\u8fd0\u884cWindows\u3002\u6240\u6709\u7684\u7cfb\u7edf\u6587\u4ef6\u90fd\u5b58\u653e\u5728\u7f51\u7edc\u670d\u52a1\u5668\u4e0a\uff0c\u53ea\u6709\u7528\u6237\u7684\u6587\u4ef6\u4fdd\u5b58\u5728\u672c\u5730\u3002\u53e6\u5916\uff0c\u7f51\u7edc\u4e0a\u7684\u6240\u6709\u8ba1\u7b97\u673a\u90fd\u4f1a\u8c03\u7528\u670d\u52a1\u5668\u4e0a\u76f8\u540c\u7684\u7cfb\u7edf\u76ee\u5f55\uff0c\u4f8b\u5982\uff0c\u53ea\u4f1a\u6709\u4e00\u4efdUSER.exe\u4f9b\u6240\u6709\u4eba\u5171\u4eab\u4f7f\u7528\u3002<\/p>\n<p>Under this network-based Windows configuration, the system directory was a directory on a server somewhere (\\\\server\\share\\somewhere) and the Windows directory was a directory on the local machine (C:\\WINDOWS). Clients did not have write permission into the shared system directory, but they did have permission to write into the Windows directory.<\/p>\n<p>\u5728\u8fd9\u79cd\u4ee5\u7f51\u7edc\u4e3a\u57fa\u7840\u914d\u7f6e\u7684Windows\u73af\u5883\u4e0b\uff0c\u7cfb\u7edf\u76ee\u5f55\u662f\u5b58\u653e\u5728\u670d\u52a1\u5668\u4e0a\u7684\u67d0\u5904\u7684\uff08\u4f8b\u5982\\\\server\\\u5171\u4eab\u540d\\\u5171\u4eab\u76ee\u5f55\uff09\uff0c\u800cWindows\u76ee\u5f55\u662f\u672c\u673a\u4e0a\u7684\u67d0\u4e2a\u6587\u4ef6\u5939\uff08\u4f8b\u5982C:\\WINDOWS\uff09\u3002\u5ba2\u6237\u7aef\u6ca1\u6709\u6743\u9650\u5199\u5165\u7cfb\u7edf\u76ee\u5f55\uff0c\u4e0d\u8fc7\u7684\u786e\u6709\u6743\u9650\u5bf9Windows\u76ee\u5f55\u8fdb\u884c\u5199\u5165\u3002<\/p>\n<p>That\u2019s why GetSystemDirectory is a separate function.<\/p>\n<p>\u8fd9\u5c31\u662f\u4e3a\u4ec0\u4e48GetSystemDirectory\u662f\u5355\u72ec\u5b58\u5728\u7684\u4e00\u4e2a\u65b9\u6cd5\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u539f\u6587\u94fe\u63a5\uff1ahttps:\/\/devblogs.microsoft.com\/oldnewthing\/2004100 [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[2],"tags":[],"class_list":["post-3029","post","type-post","status-publish","format-standard","hentry","category-tont_history"],"_links":{"self":[{"href":"https:\/\/www.aoisnow.net\/blog\/wp-json\/wp\/v2\/posts\/3029","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.aoisnow.net\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.aoisnow.net\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.aoisnow.net\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.aoisnow.net\/blog\/wp-json\/wp\/v2\/comments?post=3029"}],"version-history":[{"count":0,"href":"https:\/\/www.aoisnow.net\/blog\/wp-json\/wp\/v2\/posts\/3029\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.aoisnow.net\/blog\/wp-json\/wp\/v2\/media?parent=3029"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.aoisnow.net\/blog\/wp-json\/wp\/v2\/categories?post=3029"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.aoisnow.net\/blog\/wp-json\/wp\/v2\/tags?post=3029"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}