From 7b1d23fd295fe8275b313f31ea545f7f6b3f2e62 Mon Sep 17 00:00:00 2001 From: Lars Kanis Date: Thu, 17 Nov 2022 10:57:52 +0100 Subject: Windows: Readlink improvements (#6745) * Windows: Use readlink emulation for File.readlink This fixes readlink emulation for the ERROR_MORE_DATA case and general error reporting. It now releases GVL while readlink IO operation. The dedicated rb_readlink was introduced in commit 2ffb87995a33cdc7ba609a4b867f03f18da0c3b3 in order to improve encoding and buffer allocation. However the encoding issues are solved since ruby-3.0 switched to UTF-8 and the buffer allocation will be improved in a later commit. * Windows: Increase the default buffer size for reparse point info So far nearly all queries of reparse points needed two attempts to get enough buffer. * Windows: Remove declaration of rb_w32_wreadlink It was removed in commit 2f6fdd3aebdee2ce04d003b206f6da78120e8235 --- win32/file.h | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) (limited to 'win32/file.h') diff --git a/win32/file.h b/win32/file.h index 36ff27c9b1..ef701487dd 100644 --- a/win32/file.h +++ b/win32/file.h @@ -1,10 +1,8 @@ #ifndef RUBY_WIN32_FILE_H #define RUBY_WIN32_FILE_H -#define MAX_REPARSE_PATH_LEN 4092 - enum { - MINIMUM_REPARSE_BUFFER_PATH_LEN = 4 + MINIMUM_REPARSE_BUFFER_PATH_LEN = 100 }; /* License: Ruby's */ typedef struct { @@ -18,14 +16,14 @@ typedef struct { USHORT PrintNameOffset; USHORT PrintNameLength; ULONG Flags; - WCHAR PathBuffer[4]; + WCHAR PathBuffer[MINIMUM_REPARSE_BUFFER_PATH_LEN]; } SymbolicLinkReparseBuffer; struct { USHORT SubstituteNameOffset; USHORT SubstituteNameLength; USHORT PrintNameOffset; USHORT PrintNameLength; - WCHAR PathBuffer[4]; + WCHAR PathBuffer[MINIMUM_REPARSE_BUFFER_PATH_LEN]; } MountPointReparseBuffer; }; } rb_w32_reparse_buffer_t; -- cgit v1.2.1