# File.stat: Support detection of Kind.sym_link on Windows · gitcafe/zig

[View on GitCafe](https://git.cafe/gitcafe/zig/commit/11a398af3e12f0d1da0a5f95a17e334a063890a9)

Repository: [gitcafe/zig](https://git.cafe/gitcafe/zig)

Visibility: public

Requested revision: 11a398af3e12f0d1da0a5f95a17e334a063890a9

Requested commit: 11a398af3e12f0d1da0a5f95a17e334a063890a9

Commit: 11a398af3e12f0d1da0a5f95a17e334a063890a9

Tree: 5b8be54db331c73e8a3fafd7e3f959d42d68418a

Author: Ryan Liptak

Committer: Ryan Liptak

## Message

```
File.stat: Support detection of Kind.sym_link on Windows

Requires an extra NtQueryInformationFile call when FILE_ATTRIBUTE_REPARSE_POINT is set to determine if it's actually a symlink or some other kind of reparse point (https://learn.microsoft.com/en-us/windows/win32/fileio/reparse-point-tags). This is something that `File.Metadata.kind` was already doing, so the same technique is used in `stat`.

Also, replace the std.os.windows.DeviceIoControl call in `metadata` with NtQueryInformationFile (NtQueryInformationFile is what gets called during kernel32.GetFileInformationByHandleEx with FileAttributeTagInfo, verified using NtTrace).

```

## Parents

- [f36ac227b13884f42f259bc38c5b0aa012273799](https://git.cafe/gitcafe/zig/commit/f36ac227b13884f42f259bc38c5b0aa012273799?format=markdown)

[Source at this commit](https://git.cafe/gitcafe/zig/tree/11a398af3e12f0d1da0a5f95a17e334a063890a9?format=markdown)
