diff --git a/dlls/ntdll/reg.c b/dlls/ntdll/reg.c index 3bee5882857..d68f1543aa8 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 93d42c9cd9d..574f2e4ce95 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;