| ... | ... | @@ -836,7 +836,7 @@ pub const Dir = struct { |
| 836 | 836 | } |
| 837 | 837 | } |
| 838 | 838 | |
| 839 | | fn openDirFlagsC(self: Dir, sub_path_c: [*]const u8, flags: u32) OpenError!Dir { |
| 839 | fn openDirFlagsC(self: Dir, sub_path_c: [*:0]const u8, flags: u32) OpenError!Dir { |
| 840 | 840 | const fd = os.openatC(self.fd, sub_path_c, flags, 0) catch |err| switch (err) { |
| 841 | 841 | error.FileTooBig => unreachable, // can't happen for directories |
| 842 | 842 | error.IsDir => unreachable, // we're providing O_DIRECTORY |
| ... | ... | @@ -850,13 +850,16 @@ pub const Dir = struct { |
| 850 | 850 | /// Same as `openDirTraverse` except the path parameter is UTF16LE, NT-prefixed. |
| 851 | 851 | /// This function is Windows-only. |
| 852 | 852 | pub fn openDirTraverseW(self: Dir, sub_path_w: [*:0]const u16) OpenError!Dir { |
| 853 | | // TODO: open without FILE_LIST_DIRECTORY |
| 854 | | return self.openDirListW(sub_path_w); |
| 853 | return self.openDirAccessMaskW(sub_path_w, w.STANDARD_RIGHTS_READ | w.FILE_READ_ATTRIBUTES | w.FILE_READ_EA | w.SYNCHRONIZE | w.FILE_TRAVERSE); |
| 855 | 854 | } |
| 856 | 855 | |
| 857 | 856 | /// Same as `openDirList` except the path parameter is UTF16LE, NT-prefixed. |
| 858 | 857 | /// This function is Windows-only. |
| 859 | 858 | pub fn openDirListW(self: Dir, sub_path_w: [*:0]const u16) OpenError!Dir { |
| 859 | return self.openDirAccessMaskW(sub_path_w, w.STANDARD_RIGHTS_READ | w.FILE_READ_ATTRIBUTES | w.FILE_READ_EA | w.SYNCHRONIZE | w.FILE_TRAVERSE | w.FILE_LIST_DIRECTORY); |
| 860 | } |
| 861 | |
| 862 | fn openDirAccessMaskW(self: Dir, sub_path_w: [*:0]const u16, access_mask: u32) OpenError!Dir { |
| 860 | 863 | const w = os.windows; |
| 861 | 864 | |
| 862 | 865 | var result = Dir{ |
| ... | ... | @@ -889,7 +892,7 @@ pub const Dir = struct { |
| 889 | 892 | var io: w.IO_STATUS_BLOCK = undefined; |
| 890 | 893 | const rc = w.ntdll.NtCreateFile( |
| 891 | 894 | &result.fd, |
| 892 | | w.STANDARD_RIGHTS_READ | w.FILE_READ_ATTRIBUTES | w.FILE_READ_EA | w.SYNCHRONIZE | w.FILE_TRAVERSE | w.FILE_LIST_DIRECTORY, |
| 895 | access_mask, |
| 893 | 896 | &attr, |
| 894 | 897 | &io, |
| 895 | 898 | null, |