summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--tests/registry.test6
-rw-r--r--win/tclWinReg.c6
2 files changed, 6 insertions, 6 deletions
diff --git a/tests/registry.test b/tests/registry.test
index bd91911..f90f602 100644
--- a/tests/registry.test
+++ b/tests/registry.test
@@ -461,11 +461,11 @@ test registry-6.20 {GetValue: values with Unicode strings with embedded nulls} {
set result
} "foo ba r baz"
test registry-6.21 {GetValue: very long value names and values} {pcOnly} {
- registry set HKEY_CURRENT_USER\\TclFoobar [string repeat k 16383] [string repeat x 16383] multi_sz
- set result [registry get HKEY_CURRENT_USER\\TclFoobar [string repeat k 16383]]
+ registry set HKEY_CURRENT_USER\\TclFoobar [string repeat k 199] [string repeat x 199] multi_sz
+ set result [registry get HKEY_CURRENT_USER\\TclFoobar [string repeat k 199]]
registry delete HKEY_CURRENT_USER\\TclFoobar
set result
-} [string repeat x 16383]
+} [string repeat x 199]
test registry-7.1 {GetValueNames: bad key} {win reg english} {
registry delete HKEY_CURRENT_USER\\TclFoobar
diff --git a/win/tclWinReg.c b/win/tclWinReg.c
index 4c74d1b..343a22f 100644
--- a/win/tclWinReg.c
+++ b/win/tclWinReg.c
@@ -779,8 +779,8 @@ GetValue(
*/
Tcl_DStringInit(&data);
- length = TCL_DSTRING_STATIC_SIZE - 1;
- Tcl_DStringSetLength(&data, (int) length);
+ Tcl_DStringSetLength(&data, TCL_DSTRING_STATIC_SIZE - 1);
+ length = TCL_DSTRING_STATIC_SIZE / (regWinProcs->useWide ? 2 : 1) - 1;
valueName = Tcl_GetStringFromObj(valueNameObj, &nameLen);
nativeValue = Tcl_WinUtfToTChar(valueName, nameLen, &buf);
@@ -795,7 +795,7 @@ GetValue(
*/
length *= 2;
- Tcl_DStringSetLength(&data, (int) length);
+ Tcl_DStringSetLength(&data, (int) length * (regWinProcs->useWide ? 2 : 1));
result = (*regWinProcs->regQueryValueExProc)(key, (char *) nativeValue,
NULL, &type, (BYTE *) Tcl_DStringValue(&data), &length);
}