diff --git a/patches/ntdll-Junction_Points/0026-Return-correct-status-value-if-handle-is-not-a-repar.patch b/patches/ntdll-Junction_Points/0026-Return-correct-status-value-if-handle-is-not-a-repar.patch new file mode 100644 index 00000000..eadaaf2f --- /dev/null +++ b/patches/ntdll-Junction_Points/0026-Return-correct-status-value-if-handle-is-not-a-repar.patch @@ -0,0 +1,51 @@ +From 246a50e7cf09bd1d77d327e170c2d7432e0d5f5e Mon Sep 17 00:00:00 2001 +From: Lorenzo Ferrillo +Date: Mon, 6 May 2024 23:46:44 +0200 +Subject: [PATCH] Return correct status value if handle is not a reparse point + +--- + dlls/ntdll/unix/file.c | 19 ++++++++++++++----- + 1 file changed, 14 insertions(+), 5 deletions(-) + +diff --git a/dlls/ntdll/unix/file.c b/dlls/ntdll/unix/file.c +index 2bfb9b7d051..93732543ae4 100644 +--- a/dlls/ntdll/unix/file.c ++++ b/dlls/ntdll/unix/file.c +@@ -3944,9 +3944,11 @@ NTSTATUS get_reparse_point_unix(const char *unix_name, REPARSE_DATA_BUFFER *buff + char *p; + + ret = readlink( unix_name, link_path, sizeof(link_path) ); ++ + if (ret < 0) + { +- status = errno_to_status( errno ); ++ if (errno == EINVAL) status = STATUS_NOT_A_REPARSE_POINT; ++ else status = errno_to_status( errno ); + goto cleanup; + } + link_path_len = ret; +@@ -7303,10 +7305,17 @@ NTSTATUS WINAPI NtFsControlFile( HANDLE handle, HANDLE event, PIO_APC_ROUTINE ap + } + case FSCTL_GET_REPARSE_POINT: + { +- REPARSE_DATA_BUFFER *buffer = (REPARSE_DATA_BUFFER *)out_buffer; +- ULONG size = out_size; +- status = get_reparse_point( handle, buffer, &size ); +- io->Information = size; ++ io->Information = 0; ++ if (out_buffer){ ++ REPARSE_DATA_BUFFER *buffer = (REPARSE_DATA_BUFFER *)out_buffer; ++ ULONG size = out_size; ++ status = get_reparse_point( handle, buffer, &size ); ++ if (status == STATUS_SUCCESS) ++ io->Information = size; ++ } ++ else { ++ status = STATUS_INVALID_USER_BUFFER; ++ } + break; + } + case FSCTL_SET_REPARSE_POINT: +-- +2.43.0 +