Francois Gouget : regedit:
If the data for a given value is in an unknown format,
then print an error and don't modify the value.
Alexandre Julliard
julliard at wine.codeweavers.com
Thu Jun 14 07:47:06 CDT 2007
Module: wine
Branch: master
Commit: 90d77072357780e0bb3be9457a4c1d2c2649e09a
URL: http://source.winehq.org/git/wine.git/?a=commit;h=90d77072357780e0bb3be9457a4c1d2c2649e09a
Author: Francois Gouget <fgouget at codeweavers.com>
Date: Thu Jun 14 11:43:58 2007 +0200
regedit: If the data for a given value is in an unknown format, then print an error and don't modify the value.
Note that '"foo"=' is not valid.
---
programs/regedit/regproc.c | 16 ++++++++++++----
1 files changed, 12 insertions(+), 4 deletions(-)
diff --git a/programs/regedit/regproc.c b/programs/regedit/regproc.c
index 7f73674..befa971 100644
--- a/programs/regedit/regproc.c
+++ b/programs/regedit/regproc.c
@@ -169,7 +169,8 @@ static DWORD getDataType(LPSTR *lpValue, DWORD* parse_type)
}
return type;
}
- return (**lpValue=='\0'?REG_SZ:REG_NONE);
+ *parse_type=REG_NONE;
+ return REG_NONE;
}
/******************************************************************************
@@ -230,7 +231,7 @@ static HRESULT setValue(LPSTR val_name, LPSTR val_data)
/* Get the data type stored into the value field */
dwDataType = getDataType(&val_data, &dwParseType);
- if ( dwParseType == REG_SZ) /* no conversion for string */
+ if (dwParseType == REG_SZ) /* no conversion for string */
{
REGPROC_unescape_string(val_data);
/* Compute dwLen after REGPROC_unescape_string because it may
@@ -244,11 +245,13 @@ static HRESULT setValue(LPSTR val_name, LPSTR val_data)
val_data[dwLen]='\0';
}
lpbData = (BYTE*) val_data;
- } else if (dwParseType == REG_DWORD) /* Convert the dword types */
+ }
+ else if (dwParseType == REG_DWORD) /* Convert the dword types */
{
dwLen = convertHexToDWord(val_data, convert);
lpbData = convert;
- } else /* Convert the hexadecimal types */
+ }
+ else if (dwParseType == REG_BINARY) /* Convert the binary data */
{
int b_len = strlen (val_data)+2/3;
if (b_len > KEY_MAX_LEN) {
@@ -261,6 +264,11 @@ static HRESULT setValue(LPSTR val_name, LPSTR val_data)
lpbData = convert;
}
}
+ else /* unknown format */
+ {
+ fprintf(stderr,"%s: ERROR, unknown data format\n", getAppName());
+ return ERROR_INVALID_DATA;
+ }
hRes = RegSetValueEx(
currentKeyHandle,
More information about the wine-cvs
mailing list