Commit 8bec1304c3

LeRoyce Pearson <leroycepearson@geemili.xyz>
2020-03-24 05:34:00
Fix compile error on windows
1 parent 113b217
Changed files (2)
lib/std/os/windows.zig
@@ -107,6 +107,7 @@ pub fn OpenFileW(
     sub_path_w: [*:0]const u16,
     sa: ?*SECURITY_ATTRIBUTES,
     access_mask: ACCESS_MASK,
+    share_access_opt: ?ULONG,
     creation: ULONG,
 ) OpenError!HANDLE {
     if (sub_path_w[0] == '.' and sub_path_w[1] == 0) {
@@ -135,6 +136,7 @@ pub fn OpenFileW(
         .SecurityQualityOfService = null,
     };
     var io: IO_STATUS_BLOCK = undefined;
+    const share_access = share_access_opt orelse FILE_SHARE_WRITE | FILE_SHARE_READ | FILE_SHARE_DELETE;
     const rc = ntdll.NtCreateFile(
         &result,
         access_mask,
@@ -142,7 +144,7 @@ pub fn OpenFileW(
         &io,
         null,
         FILE_ATTRIBUTE_NORMAL,
-        FILE_SHARE_WRITE | FILE_SHARE_READ | FILE_SHARE_DELETE,
+        share_access,
         creation,
         FILE_NON_DIRECTORY_FILE | FILE_SYNCHRONOUS_IO_NONALERT,
         null,
lib/std/os.zig
@@ -1651,7 +1651,7 @@ pub fn renameatW(
     ReplaceIfExists: windows.BOOLEAN,
 ) RenameError!void {
     const access_mask = windows.SYNCHRONIZE | windows.GENERIC_WRITE | windows.DELETE;
-    const src_fd = try windows.OpenFileW(old_dir_fd, old_path, null, access_mask, windows.FILE_OPEN);
+    const src_fd = try windows.OpenFileW(old_dir_fd, old_path, null, access_mask, null, windows.FILE_OPEN);
     defer windows.CloseHandle(src_fd);
 
     const struct_buf_len = @sizeOf(windows.FILE_RENAME_INFORMATION) + (MAX_PATH_BYTES - 1);