summaryrefslogtreecommitdiffstats
path: root/win/tclWinReg.c
diff options
context:
space:
mode:
Diffstat (limited to 'win/tclWinReg.c')
-rw-r--r--win/tclWinReg.c24
1 files changed, 20 insertions, 4 deletions
diff --git a/win/tclWinReg.c b/win/tclWinReg.c
index 479435c..7d296a1 100644
--- a/win/tclWinReg.c
+++ b/win/tclWinReg.c
@@ -11,7 +11,7 @@
* See the file "license.terms" for information on usage and redistribution
* of this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tclWinReg.c,v 1.9 1999/04/16 00:48:09 stanton Exp $
+ * RCS: @(#) $Id: tclWinReg.c,v 1.10 1999/10/05 22:47:05 hobbs Exp $
*/
#include <tclPort.h>
@@ -694,7 +694,13 @@ GetValue(
result = (*regWinProcs->regQueryValueExProc)(key, valueName, NULL, &type,
(BYTE *) Tcl_DStringValue(&data), &length);
- if (result == ERROR_MORE_DATA) {
+ while (result == ERROR_MORE_DATA) {
+ /*
+ * The Windows docs say that in this error case, we just need
+ * to expand our buffer and request more data.
+ * Required for HKEY_PERFORMANCE_DATA
+ */
+ length *= 2;
Tcl_DStringSetLength(&data, length);
result = (*regWinProcs->regQueryValueExProc)(key, valueName, NULL,
&type, (BYTE *) Tcl_DStringValue(&data), &length);
@@ -975,8 +981,18 @@ OpenSubKey(
result = (*regWinProcs->regCreateKeyExProc)(rootKey, keyName, 0, "",
REG_OPTION_NON_VOLATILE, mode, NULL, keyPtr, &create);
} else {
- result = (*regWinProcs->regOpenKeyExProc)(rootKey, keyName, 0, mode,
- keyPtr);
+ if (rootKey == HKEY_PERFORMANCE_DATA) {
+ /*
+ * Here we fudge it for this special root key.
+ * See MSDN for more info on HKEY_PERFORMANCE_DATA and
+ * the peculiarities surrounding it
+ */
+ *keyPtr = HKEY_PERFORMANCE_DATA;
+ result = ERROR_SUCCESS;
+ } else {
+ result = (*regWinProcs->regOpenKeyExProc)(rootKey, keyName, 0,
+ mode, keyPtr);
+ }
}
Tcl_DStringFree(&buf);