Module: wine Branch: master Commit: 935cc7987df61352a2cc51b83e839551e9720fb2 URL: http://source.winehq.org/git/wine.git/?a=commit;h=935cc7987df61352a2cc51b83e...
Author: Alexandre Julliard julliard@winehq.org Date: Fri Apr 2 11:48:14 2010 +0200
server: Update the registry key and value name length limits to the now documented values.
---
dlls/ntdll/reg.c | 12 +++++++----- server/registry.c | 4 ++-- 2 files changed, 9 insertions(+), 7 deletions(-)
diff --git a/dlls/ntdll/reg.c b/dlls/ntdll/reg.c index 3bee588..d68f154 100644 --- a/dlls/ntdll/reg.c +++ b/dlls/ntdll/reg.c @@ -42,8 +42,10 @@
WINE_DEFAULT_DEBUG_CHANNEL(reg);
-/* maximum length of a key/value name in bytes (without terminating null) */ -#define MAX_NAME_LENGTH ((MAX_PATH-1) * sizeof(WCHAR)) +/* maximum length of a key name in bytes (without terminating null) */ +#define MAX_NAME_LENGTH (255 * sizeof(WCHAR)) +/* maximum length of a value name in bytes (without terminating null) */ +#define MAX_VALUE_LENGTH (16383 * sizeof(WCHAR))
/****************************************************************************** * NtCreateKey [NTDLL.@] @@ -188,7 +190,7 @@ NTSTATUS WINAPI NtDeleteValueKey( HANDLE hkey, const UNICODE_STRING *name ) NTSTATUS ret;
TRACE( "(%p,%s)\n", hkey, debugstr_us(name) ); - if (name->Length > MAX_NAME_LENGTH) return STATUS_BUFFER_OVERFLOW; + if (name->Length > MAX_VALUE_LENGTH) return STATUS_BUFFER_OVERFLOW;
SERVER_START_REQ( delete_key_value ) { @@ -481,7 +483,7 @@ NTSTATUS WINAPI NtQueryValueKey( HANDLE handle, const UNICODE_STRING *name,
TRACE( "(%p,%s,%d,%p,%d)\n", handle, debugstr_us(name), info_class, info, length );
- if (name->Length > MAX_NAME_LENGTH) return STATUS_BUFFER_OVERFLOW; + if (name->Length > MAX_VALUE_LENGTH) return STATUS_BUFFER_OVERFLOW;
/* compute the length we want to retrieve */ switch(info_class) @@ -769,7 +771,7 @@ NTSTATUS WINAPI NtSetValueKey( HANDLE hkey, const UNICODE_STRING *name, ULONG Ti
TRACE( "(%p,%s,%d,%p,%d)\n", hkey, debugstr_us(name), type, data, count );
- if (name->Length > MAX_NAME_LENGTH) return STATUS_BUFFER_OVERFLOW; + if (name->Length > MAX_VALUE_LENGTH) return STATUS_BUFFER_OVERFLOW;
SERVER_START_REQ( set_key_value ) { diff --git a/server/registry.c b/server/registry.c index 93d42c9..574f2e4 100644 --- a/server/registry.c +++ b/server/registry.c @@ -100,8 +100,8 @@ struct key_value #define MIN_SUBKEYS 8 /* min. number of allocated subkeys per key */ #define MIN_VALUES 8 /* min. number of allocated values per key */
-#define MAX_NAME_LEN MAX_PATH /* max. length of a key name */ -#define MAX_VALUE_LEN MAX_PATH /* max. length of a value name */ +#define MAX_NAME_LEN 255 /* max. length of a key name */ +#define MAX_VALUE_LEN 16383 /* max. length of a value name */
/* the root of the registry tree */ static struct key *root_key;