{"id":14963,"date":"2010-02-12T07:00:00","date_gmt":"2010-02-12T07:00:00","guid":{"rendered":"https:\/\/blogs.msdn.microsoft.com\/oldnewthing\/2010\/02\/12\/how-do-i-get-information-about-the-target-of-a-symbolic-link\/"},"modified":"2010-02-12T07:00:00","modified_gmt":"2010-02-12T07:00:00","slug":"how-do-i-get-information-about-the-target-of-a-symbolic-link","status":"publish","type":"post","link":"https:\/\/devblogs.microsoft.com\/oldnewthing\/20100212-00\/?p=14963","title":{"rendered":"How do I get information about the target of a symbolic link?"},"content":{"rendered":"<p>Functions like <code>GetFileAttributes<\/code> and <code>FindFirstFile<\/code>, when asked to provide information about a symbolic link, returns information about the link itself and not the link destination. If you use the <code>FindFirstFile<\/code> function, you can tell that you have a symbolic link because the file attributes will have the <code>FILE_ATTRIBUTES_REPARSE_POINT<\/code> flag set, and the <code>dwReserved0<\/code> member will contain the special value <code>IO_REPARSE_TAG_SYMLINK<\/code>.\n Okay, great, so now I know I have a symbolic link, but what if I want information about the link target? For example, I want to know the size of the link target, its last-modified time, and its name.\n To do this, you open the symbolic link. The I\/O manager dereferences the symbolic link and gives you a handle to the link destination. You can then call functions like <code>GetFileSize<\/code>, <code>GetFileInformationByHandleEx<\/code>, or <code>GetFinalPathNameByHandle<\/code> to obtain information about the symbolic link target.<\/p>\n<p> <b>Exercise<\/b>: If the field is called <code>dwReserved0<\/code>, shouldn&#8217;t it be off limits? Why isn&#8217;t the field called <code>dwReparsePointType<\/code>? <\/p>\n","protected":false},"excerpt":{"rendered":"<p>Functions like GetFileAttributes and FindFirstFile, when asked to provide information about a symbolic link, returns information about the link itself and not the link destination. If you use the FindFirstFile function, you can tell that you have a symbolic link because the file attributes will have the FILE_ATTRIBUTES_REPARSE_POINT flag set, and the dwReserved0 member will [&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-14963","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-oldnewthing","tag-code"],"acf":[],"blog_post_summary":"<p>Functions like GetFileAttributes and FindFirstFile, when asked to provide information about a symbolic link, returns information about the link itself and not the link destination. If you use the FindFirstFile function, you can tell that you have a symbolic link because the file attributes will have the FILE_ATTRIBUTES_REPARSE_POINT flag set, and the dwReserved0 member will [&hellip;]<\/p>\n","_links":{"self":[{"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/posts\/14963","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=14963"}],"version-history":[{"count":0,"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/posts\/14963\/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=14963"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/categories?post=14963"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/tags?post=14963"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}