Add support for longer than 1024 characters for initial settings of environment variables. Given windows behaviour changes after 2048, use that as the new limit for the variable size.
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=45810
---
Manual experiments on windows 10 shows that the registry keys can be over 1024 characters, and as per the links on the bug, it definitely is possible to have longer variables. We could go higher than 2048, but as per [1] behavious change after 2048, so until someone hits the new limit, 2048 should suffice [1] https://software.intel.com/en-us/articles/limitation-to-the-length-of-the-sy... Signed-off-by: Jason Edmeades us@edmeades.me.uk --- dlls/kernel32/process.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/dlls/kernel32/process.c b/dlls/kernel32/process.c index b0b5ccf5bc..b6b2c38d52 100644 --- a/dlls/kernel32/process.c +++ b/dlls/kernel32/process.c @@ -335,7 +335,8 @@ static BOOL build_initial_environment(void) * * Set environment variables by enumerating the values of a key; * helper for set_registry_environment(). - * Note that Windows happily truncates the value if it's too big. + * Note that early versions of Windows happily truncate the value if + * it's too big. */ static void set_registry_variables( HANDLE hkey, ULONG type ) { @@ -345,8 +346,8 @@ static void set_registry_variables( HANDLE hkey, ULONG type ) NTSTATUS status; DWORD size; int index; - char buffer[1024*sizeof(WCHAR) + sizeof(KEY_VALUE_FULL_INFORMATION)]; - WCHAR tmpbuf[1024]; + char buffer[2048*sizeof(WCHAR) + sizeof(KEY_VALUE_FULL_INFORMATION)]; + WCHAR tmpbuf[2048]; UNICODE_STRING tmp; KEY_VALUE_FULL_INFORMATION *info = (KEY_VALUE_FULL_INFORMATION *)buffer;