fix some bugs in regedit
like alloca -> HeapAlloc + HeapFree
Modified: trunk/reactos/subsys/system/regedit/regproc.c
Modified: trunk/reactos/subsys/system/regedit/security.c
_____
Modified: trunk/reactos/subsys/system/regedit/regproc.c
--- trunk/reactos/subsys/system/regedit/regproc.c 2005-10-17
22:40:24 UTC (rev 18543)
+++ trunk/reactos/subsys/system/regedit/regproc.c 2005-10-17
23:38:24 UTC (rev 18544)
@@ -1620,17 +1620,26 @@
{
LPCTSTR s;
LPTSTR lpNewSubKey;
+ LONG Ret = 0;
s = _tcsrchr(lpSubKey, '\\');
if (s)
{
s++;
- lpNewSubKey = (LPTSTR) alloca((s - lpSubKey +
_tcslen(lpNewName) + 1) * sizeof(TCHAR));
- memcpy(lpNewSubKey, lpSubKey, (s - lpSubKey) * sizeof(TCHAR));
- _tcscpy(lpNewSubKey + (s - lpSubKey), lpNewName);
- lpNewName = lpNewSubKey;
+ lpNewSubKey = (LPTSTR) HeapAlloc(GetProcessHeap(), 0, (s -
lpSubKey + _tcslen(lpNewName) + 1) * sizeof(TCHAR));
+ if (lpNewName != NULL) {
+ memcpy(lpNewSubKey, lpSubKey, (s - lpSubKey) *
sizeof(TCHAR));
+ _tcscpy(lpNewSubKey + (s - lpSubKey),
lpNewName);
+ lpNewName = lpNewSubKey;
+ }
}
- return RegMoveKey(hKey, lpNewName, hKey, lpSubKey);
+ if (lpNewName != NULL) {
+ Ret = RegMoveKey(hKey, lpNewName, hKey, lpSubKey);
+ if (s) {
+ HeapFree(GetProcessHeap(), 0, lpNewSubKey);
+ }
+ }
+ return Ret;
}
LONG RegRenameValue(HKEY hKey, LPCTSTR lpSubKey, LPCTSTR lpDestValue,
LPCTSTR lpSrcValue)
_____
Modified: trunk/reactos/subsys/system/regedit/security.c
--- trunk/reactos/subsys/system/regedit/security.c 2005-10-17
22:40:24 UTC (rev 18543)
+++ trunk/reactos/subsys/system/regedit/security.c 2005-10-17
23:38:24 UTC (rev 18544)
@@ -295,7 +295,7 @@
LPCTSTR lpMachine,
LPCTSTR lpKeyName)
{
- BOOL Result;
+ BOOL Result = FALSE;
LPWSTR Machine, KeyName;
HKEY hInfoKey;
LPREGKEYSECURITY RegKeySecurity;
Show replies by date