avifil32: Fix type of variable used to store the result of ICCompress in AVIFILE_Enco...
[wine/wine64.git] / programs / regedit / edit.c
blob5856b641b2f7aa98dd0fc6067ea66621e877b522
1 /*
2 * Registry editing UI functions.
4 * Copyright (C) 2003 Dimitrie O. Paun
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
21 #define WIN32_LEAN_AND_MEAN /* Exclude rarely-used stuff from Windows headers */
23 #include <windows.h>
24 #include <tchar.h>
25 #include <commctrl.h>
26 #include <commdlg.h>
27 #include <cderr.h>
28 #include <stdlib.h>
29 #include <stdio.h>
30 #include <shellapi.h>
31 #include <shlwapi.h>
33 #include "wine/unicode.h"
34 #include "main.h"
35 #include "regproc.h"
36 #include "resource.h"
38 static const WCHAR* editValueName;
39 static WCHAR* stringValueData;
40 static BOOL isDecimal;
42 struct edit_params
44 HKEY hKey;
45 LPCWSTR lpszValueName;
46 void *pData;
47 LONG cbData;
50 static INT vmessagebox(HWND hwnd, INT buttons, INT titleId, INT resId, va_list ap)
52 TCHAR title[256];
53 TCHAR errfmt[1024];
54 TCHAR errstr[1024];
56 if (!LoadString(hInst, titleId, title, COUNT_OF(title)))
57 lstrcpy(title, "Error");
59 if (!LoadString(hInst, resId, errfmt, COUNT_OF(errfmt)))
60 lstrcpy(errfmt, "Unknown error string!");
62 _vsntprintf(errstr, COUNT_OF(errstr), errfmt, ap);
64 return MessageBox(hwnd, errstr, title, buttons);
67 static INT messagebox(HWND hwnd, INT buttons, INT titleId, INT resId, ...)
69 va_list ap;
70 INT result;
72 va_start(ap, resId);
73 result = vmessagebox(hwnd, buttons, titleId, resId, ap);
74 va_end(ap);
76 return result;
79 void error(HWND hwnd, INT resId, ...)
81 va_list ap;
83 va_start(ap, resId);
84 vmessagebox(hwnd, MB_OK | MB_ICONERROR, IDS_ERROR, resId, ap);
85 va_end(ap);
88 static void error_code_messagebox(HWND hwnd, DWORD error_code)
90 LPWSTR lpMsgBuf;
91 DWORD status;
92 WCHAR title[256];
93 static WCHAR fallback[] = {'E','r','r','o','r',' ','d','i','s','p','l','a','y','i','n','g',' ','e','r','r','o','r',' ','m','e','s','s','a','g','e','.','\n',0};
94 static const WCHAR title_error[] = {'E','r','r','o','r',0};
96 if (!LoadStringW(hInst, IDS_ERROR, title, COUNT_OF(title)))
97 lstrcpyW(title, title_error);
98 status = FormatMessageW(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM,
99 NULL, error_code, 0, (LPWSTR)&lpMsgBuf, 0, NULL);
100 if (!status)
101 lpMsgBuf = fallback;
102 MessageBoxW(hwnd, lpMsgBuf, title, MB_OK | MB_ICONERROR);
103 if (lpMsgBuf != fallback)
104 LocalFree(lpMsgBuf);
107 static BOOL change_dword_base(HWND hwndDlg, BOOL toHex)
109 TCHAR buf[128];
110 DWORD val;
112 if (!GetDlgItemText(hwndDlg, IDC_VALUE_DATA, buf, COUNT_OF(buf))) return FALSE;
113 if (!_stscanf(buf, toHex ? "%u" : "%x", &val)) return FALSE;
114 wsprintf(buf, toHex ? "%x" : "%u", val);
115 return SetDlgItemText(hwndDlg, IDC_VALUE_DATA, buf);
118 static INT_PTR CALLBACK modify_dlgproc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
120 WCHAR* valueData;
121 HWND hwndValue;
122 int len;
124 switch(uMsg) {
125 case WM_INITDIALOG:
126 SetDlgItemTextW(hwndDlg, IDC_VALUE_NAME, editValueName);
127 SetDlgItemTextW(hwndDlg, IDC_VALUE_DATA, stringValueData);
128 CheckRadioButton(hwndDlg, IDC_DWORD_HEX, IDC_DWORD_DEC, isDecimal ? IDC_DWORD_DEC : IDC_DWORD_HEX);
129 return TRUE;
130 case WM_COMMAND:
131 switch (LOWORD(wParam)) {
132 case IDC_DWORD_HEX:
133 if (isDecimal && change_dword_base(hwndDlg, TRUE)) isDecimal = FALSE;
134 break;
135 case IDC_DWORD_DEC:
136 if (!isDecimal && change_dword_base(hwndDlg, FALSE)) isDecimal = TRUE;
137 break;
138 case IDOK:
139 if ((hwndValue = GetDlgItem(hwndDlg, IDC_VALUE_DATA))) {
140 len = GetWindowTextLengthW(hwndValue);
141 if ((valueData = HeapReAlloc(GetProcessHeap(), 0, stringValueData, (len + 1) * sizeof(WCHAR)))) {
142 stringValueData = valueData;
143 if (!GetWindowTextW(hwndValue, stringValueData, len + 1))
144 *stringValueData = 0;
147 /* Fall through */
148 case IDCANCEL:
149 EndDialog(hwndDlg, wParam);
150 return TRUE;
153 return FALSE;
156 static INT_PTR CALLBACK bin_modify_dlgproc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
158 struct edit_params *params;
159 LPBYTE pData;
160 LONG cbData;
161 LONG lRet;
163 switch(uMsg) {
164 case WM_INITDIALOG:
165 params = (struct edit_params *)lParam;
166 SetWindowLongPtr(hwndDlg, DWLP_USER, (ULONG_PTR)params);
167 if (params->lpszValueName)
168 SetDlgItemTextW(hwndDlg, IDC_VALUE_NAME, params->lpszValueName);
169 else
170 SetDlgItemTextW(hwndDlg, IDC_VALUE_NAME, g_pszDefaultValueName);
171 SendDlgItemMessage(hwndDlg, IDC_VALUE_DATA, HEM_SETDATA, (WPARAM)params->cbData, (LPARAM)params->pData);
172 return TRUE;
173 case WM_COMMAND:
174 switch (LOWORD(wParam)) {
175 case IDOK:
176 params = (struct edit_params *)GetWindowLongPtr(hwndDlg, DWLP_USER);
177 cbData = SendDlgItemMessage(hwndDlg, IDC_VALUE_DATA, HEM_GETDATA, 0, 0);
178 pData = HeapAlloc(GetProcessHeap(), 0, cbData);
180 if (pData)
182 SendDlgItemMessageW(hwndDlg, IDC_VALUE_DATA, HEM_GETDATA, (WPARAM)cbData, (LPARAM)pData);
183 lRet = RegSetValueExW(params->hKey, params->lpszValueName, 0, REG_BINARY, pData, cbData);
185 else
186 lRet = ERROR_OUTOFMEMORY;
188 if (lRet == ERROR_SUCCESS)
189 EndDialog(hwndDlg, 1);
190 else
192 error_code_messagebox(hwndDlg, lRet);
193 EndDialog(hwndDlg, 0);
195 return TRUE;
196 case IDCANCEL:
197 EndDialog(hwndDlg, 0);
198 return TRUE;
201 return FALSE;
204 static BOOL check_value(HWND hwnd, HKEY hKey, LPCWSTR valueName)
206 WCHAR empty = 0;
207 LONG lRet = RegQueryValueExW(hKey, valueName ? valueName : &empty, 0, NULL, 0, NULL);
208 if(lRet != ERROR_SUCCESS) return FALSE;
209 return TRUE;
212 static LPWSTR read_value(HWND hwnd, HKEY hKey, LPCWSTR valueName, DWORD *lpType, LONG *len)
214 DWORD valueDataLen;
215 LPWSTR buffer = NULL;
216 LONG lRet;
217 WCHAR empty = 0;
219 lRet = RegQueryValueExW(hKey, valueName ? valueName : &empty, 0, lpType, 0, &valueDataLen);
220 if (lRet != ERROR_SUCCESS) {
221 if (lRet == ERROR_FILE_NOT_FOUND && !valueName) { /* no default value here, make it up */
222 if (len) *len = 1;
223 if (lpType) *lpType = REG_SZ;
224 buffer = HeapAlloc(GetProcessHeap(), 0, sizeof(WCHAR));
225 *buffer = '\0';
226 return buffer;
228 error(hwnd, IDS_BAD_VALUE, valueName);
229 goto done;
231 if ( *lpType == REG_DWORD ) valueDataLen = sizeof(DWORD);
232 if (!(buffer = HeapAlloc(GetProcessHeap(), 0, valueDataLen+sizeof(WCHAR)))) {
233 error(hwnd, IDS_TOO_BIG_VALUE, valueDataLen);
234 goto done;
236 lRet = RegQueryValueExW(hKey, valueName, 0, 0, (LPBYTE)buffer, &valueDataLen);
237 if (lRet != ERROR_SUCCESS) {
238 error(hwnd, IDS_BAD_VALUE, valueName);
239 goto done;
241 if((valueDataLen % sizeof(WCHAR)) == 0)
242 buffer[valueDataLen / sizeof(WCHAR)] = 0;
243 if(len) *len = valueDataLen;
244 return buffer;
246 done:
247 HeapFree(GetProcessHeap(), 0, buffer);
248 return NULL;
251 BOOL CreateKey(HWND hwnd, HKEY hKeyRoot, LPCWSTR keyPath, LPWSTR keyName)
253 BOOL result = FALSE;
254 LONG lRet = ERROR_SUCCESS;
255 HKEY retKey = NULL;
256 WCHAR newKey[MAX_NEW_KEY_LEN - 4];
257 int keyNum;
258 HKEY hKey;
260 lRet = RegOpenKeyExW(hKeyRoot, keyPath, 0, KEY_CREATE_SUB_KEY, &hKey);
261 if (lRet != ERROR_SUCCESS) {
262 error_code_messagebox(hwnd, lRet);
263 goto done;
266 if (!LoadStringW(GetModuleHandle(0), IDS_NEWKEY, newKey, COUNT_OF(newKey))) goto done;
268 /* try to find out a name for the newly create key (max 100 times) */
269 for (keyNum = 1; keyNum < 100; keyNum++) {
270 wsprintfW(keyName, newKey, keyNum);
271 lRet = RegOpenKeyW(hKey, keyName, &retKey);
272 if (lRet != ERROR_SUCCESS) break;
273 RegCloseKey(retKey);
275 if (lRet == ERROR_SUCCESS) goto done;
277 lRet = RegCreateKeyW(hKey, keyName, &retKey);
278 if (lRet != ERROR_SUCCESS) {
279 error_code_messagebox(hwnd, lRet);
280 goto done;
283 result = TRUE;
285 done:
286 RegCloseKey(retKey);
287 return result;
290 BOOL ModifyValue(HWND hwnd, HKEY hKeyRoot, LPCWSTR keyPath, LPCWSTR valueName)
292 BOOL result = FALSE;
293 DWORD type;
294 LONG lRet;
295 HKEY hKey;
296 LONG len;
298 lRet = RegOpenKeyExW(hKeyRoot, keyPath, 0, KEY_READ | KEY_SET_VALUE, &hKey);
299 if (lRet != ERROR_SUCCESS) {
300 error_code_messagebox(hwnd, lRet);
301 return FALSE;
304 editValueName = valueName ? valueName : g_pszDefaultValueName;
305 if(!(stringValueData = read_value(hwnd, hKey, valueName, &type, &len))) goto done;
307 if ( (type == REG_SZ) || (type == REG_EXPAND_SZ) ) {
308 if (DialogBoxW(0, MAKEINTRESOURCEW(IDD_EDIT_STRING), hwnd, modify_dlgproc) == IDOK) {
309 lRet = RegSetValueExW(hKey, valueName, 0, type, (LPBYTE)stringValueData, (lstrlenW(stringValueData) + 1) * sizeof(WCHAR));
310 if (lRet == ERROR_SUCCESS) result = TRUE;
311 else error_code_messagebox(hwnd, lRet);
313 } else if ( type == REG_DWORD ) {
314 const WCHAR u[] = {'%','u',0};
315 const WCHAR x[] = {'%','x',0};
316 wsprintfW(stringValueData, isDecimal ? u : x, *((DWORD*)stringValueData));
317 if (DialogBoxW(0, MAKEINTRESOURCEW(IDD_EDIT_DWORD), hwnd, modify_dlgproc) == IDOK) {
318 DWORD val;
319 CHAR* valueA = GetMultiByteString(stringValueData);
320 if (_stscanf(valueA, isDecimal ? "%u" : "%x", &val)) {
321 lRet = RegSetValueExW(hKey, valueName, 0, type, (BYTE*)&val, sizeof(val));
322 if (lRet == ERROR_SUCCESS) result = TRUE;
323 else error_code_messagebox(hwnd, lRet);
325 HeapFree(GetProcessHeap(), 0, valueA);
327 } else if ( type == REG_BINARY ) {
328 struct edit_params params;
329 params.hKey = hKey;
330 params.lpszValueName = valueName;
331 params.pData = stringValueData;
332 params.cbData = len;
333 result = DialogBoxParam(NULL, MAKEINTRESOURCE(IDD_EDIT_BINARY), hwnd,
334 bin_modify_dlgproc, (LPARAM)&params);
335 } else if ( type == REG_MULTI_SZ ) {
336 WCHAR char1 = '\r', char2 = '\n';
337 WCHAR *tmpValueData = NULL;
338 INT i, j, count;
340 for ( i = 0, count = 0; i < len - 1; i++)
341 if ( !stringValueData[i] && stringValueData[i + 1] )
342 count++;
343 tmpValueData = HeapAlloc( GetProcessHeap(), 0, ( len + count ) * sizeof(WCHAR));
344 if ( !tmpValueData ) goto done;
346 for ( i = 0, j = 0; i < len - 1; i++)
348 if ( !stringValueData[i] && stringValueData[i + 1])
350 tmpValueData[j++] = char1;
351 tmpValueData[j++] = char2;
353 else
354 tmpValueData[j++] = stringValueData[i];
356 tmpValueData[j] = stringValueData[i];
357 HeapFree( GetProcessHeap(), 0, stringValueData);
358 stringValueData = tmpValueData;
359 tmpValueData = NULL;
361 if (DialogBoxW(0, MAKEINTRESOURCEW(IDD_EDIT_MULTI_STRING), hwnd, modify_dlgproc) == IDOK)
363 len = lstrlenW( stringValueData );
364 tmpValueData = HeapAlloc( GetProcessHeap(), 0, (len + 2) * sizeof(WCHAR));
365 if ( !tmpValueData ) goto done;
367 for ( i = 0, j = 0; i < len - 1; i++)
369 if ( stringValueData[i] == char1 && stringValueData[i + 1] == char2)
371 if ( tmpValueData[j - 1] != 0)
372 tmpValueData[j++] = 0;
373 i++;
375 else
376 tmpValueData[j++] = stringValueData[i];
378 tmpValueData[j++] = stringValueData[i];
379 tmpValueData[j++] = 0;
380 tmpValueData[j++] = 0;
381 HeapFree( GetProcessHeap(), 0, stringValueData);
382 stringValueData = tmpValueData;
384 lRet = RegSetValueExW(hKey, valueName, 0, type, (LPBYTE)stringValueData, j * sizeof(WCHAR));
385 if (lRet == ERROR_SUCCESS) result = TRUE;
386 else error_code_messagebox(hwnd, lRet);
388 } else {
389 error(hwnd, IDS_UNSUPPORTED_TYPE, type);
392 done:
393 HeapFree(GetProcessHeap(), 0, stringValueData);
394 stringValueData = NULL;
395 RegCloseKey(hKey);
396 return result;
399 BOOL DeleteKey(HWND hwnd, HKEY hKeyRoot, LPCWSTR keyPath)
401 BOOL result = FALSE;
402 LONG lRet;
403 HKEY hKey;
404 CHAR* keyPathA = GetMultiByteString(keyPath);
406 lRet = RegOpenKeyExW(hKeyRoot, keyPath, 0, KEY_READ|KEY_SET_VALUE, &hKey);
407 if (lRet != ERROR_SUCCESS) {
408 error_code_messagebox(hwnd, lRet);
409 return FALSE;
412 if (messagebox(hwnd, MB_YESNO | MB_ICONEXCLAMATION, IDS_DELETE_BOX_TITLE, IDS_DELETE_BOX_TEXT, keyPathA) != IDYES)
413 goto done;
415 lRet = SHDeleteKeyW(hKeyRoot, keyPath);
416 if (lRet != ERROR_SUCCESS) {
417 error(hwnd, IDS_BAD_KEY, keyPath);
418 goto done;
420 result = TRUE;
422 done:
423 RegCloseKey(hKey);
424 HeapFree(GetProcessHeap(), 0, keyPathA);
425 return result;
428 BOOL DeleteValue(HWND hwnd, HKEY hKeyRoot, LPCWSTR keyPath, LPCWSTR valueName, BOOL showMessageBox)
430 BOOL result = FALSE;
431 LONG lRet;
432 HKEY hKey;
433 LPCWSTR visibleValueName = valueName ? valueName : g_pszDefaultValueName;
434 WCHAR empty = 0;
436 lRet = RegOpenKeyExW(hKeyRoot, keyPath, 0, KEY_READ | KEY_SET_VALUE, &hKey);
437 if (lRet != ERROR_SUCCESS) return FALSE;
439 if (showMessageBox)
441 LPSTR visibleValueNameA = GetMultiByteString(visibleValueName);
442 if (messagebox(hwnd, MB_YESNO | MB_ICONEXCLAMATION, IDS_DELETE_BOX_TITLE, IDS_DELETE_BOX_TEXT, visibleValueNameA) != IDYES)
444 HeapFree(GetProcessHeap(), 0, visibleValueNameA);
445 goto done;
447 HeapFree(GetProcessHeap(), 0, visibleValueNameA);
450 lRet = RegDeleteValueW(hKey, valueName ? valueName : &empty);
451 if (lRet != ERROR_SUCCESS && valueName) {
452 error(hwnd, IDS_BAD_VALUE, valueName);
454 if (lRet != ERROR_SUCCESS) goto done;
455 result = TRUE;
457 done:
458 RegCloseKey(hKey);
459 return result;
462 BOOL CreateValue(HWND hwnd, HKEY hKeyRoot, LPCWSTR keyPath, DWORD valueType, LPWSTR valueName)
464 LONG lRet = ERROR_SUCCESS;
465 WCHAR newValue[256];
466 DWORD valueDword = 0;
467 BOOL result = FALSE;
468 int valueNum;
469 HKEY hKey;
471 lRet = RegOpenKeyExW(hKeyRoot, keyPath, 0, KEY_READ | KEY_SET_VALUE, &hKey);
472 if (lRet != ERROR_SUCCESS) {
473 error_code_messagebox(hwnd, lRet);
474 return FALSE;
477 if (!LoadStringW(GetModuleHandle(0), IDS_NEWVALUE, newValue, COUNT_OF(newValue))) goto done;
479 /* try to find out a name for the newly create key (max 100 times) */
480 for (valueNum = 1; valueNum < 100; valueNum++) {
481 wsprintfW(valueName, newValue, valueNum);
482 lRet = RegQueryValueExW(hKey, valueName, 0, 0, 0, 0);
483 if (lRet == ERROR_FILE_NOT_FOUND) break;
485 if (lRet != ERROR_FILE_NOT_FOUND) {
486 error_code_messagebox(hwnd, lRet);
487 goto done;
490 lRet = RegSetValueExW(hKey, valueName, 0, valueType, (BYTE*)&valueDword, sizeof(DWORD));
491 if (lRet != ERROR_SUCCESS) {
492 error_code_messagebox(hwnd, lRet);
493 goto done;
495 result = TRUE;
497 done:
498 RegCloseKey(hKey);
499 return result;
502 BOOL RenameValue(HWND hwnd, HKEY hKeyRoot, LPCWSTR keyPath, LPCWSTR oldName, LPCWSTR newName)
504 LPWSTR value = NULL;
505 DWORD type;
506 LONG len, lRet;
507 BOOL result = FALSE;
508 HKEY hKey;
510 if (!oldName) return FALSE;
511 if (!newName) return FALSE;
513 lRet = RegOpenKeyExW(hKeyRoot, keyPath, 0, KEY_READ | KEY_SET_VALUE, &hKey);
514 if (lRet != ERROR_SUCCESS) {
515 error_code_messagebox(hwnd, lRet);
516 return FALSE;
518 /* check if value already exists */
519 if (check_value(hwnd, hKey, newName)) goto done;
520 value = read_value(hwnd, hKey, oldName, &type, &len);
521 if(!value) goto done;
522 lRet = RegSetValueExW(hKey, newName, 0, type, (BYTE*)value, len);
523 if (lRet != ERROR_SUCCESS) {
524 error_code_messagebox(hwnd, lRet);
525 goto done;
527 lRet = RegDeleteValueW(hKey, oldName);
528 if (lRet != ERROR_SUCCESS) {
529 RegDeleteValueW(hKey, newName);
530 error_code_messagebox(hwnd, lRet);
531 goto done;
533 result = TRUE;
535 done:
536 HeapFree(GetProcessHeap(), 0, value);
537 RegCloseKey(hKey);
538 return result;
542 BOOL RenameKey(HWND hwnd, HKEY hRootKey, LPCWSTR keyPath, LPCWSTR newName)
544 LPWSTR parentPath = 0;
545 LPCWSTR srcSubKey = 0;
546 HKEY parentKey = 0;
547 HKEY destKey = 0;
548 BOOL result = FALSE;
549 LONG lRet;
550 DWORD disposition;
552 if (!keyPath || !newName) return FALSE;
554 if (!strrchrW(keyPath, '\\')) {
555 parentKey = hRootKey;
556 srcSubKey = keyPath;
557 } else {
558 LPWSTR srcSubKey_copy;
560 parentPath = HeapAlloc(GetProcessHeap(), 0, (lstrlenW(keyPath)+1)*sizeof(WCHAR));
561 lstrcpyW(parentPath, keyPath);
562 srcSubKey_copy = strrchrW(parentPath, '\\');
563 *srcSubKey_copy = 0;
564 srcSubKey = srcSubKey_copy + 1;
565 lRet = RegOpenKeyExW(hRootKey, parentPath, 0, KEY_READ | KEY_CREATE_SUB_KEY, &parentKey);
566 if (lRet != ERROR_SUCCESS) {
567 error_code_messagebox(hwnd, lRet);
568 goto done;
572 /* The following fails if the old name is the same as the new name. */
573 if (!lstrcmpW(srcSubKey, newName)) goto done;
575 lRet = RegCreateKeyExW(parentKey, newName, 0, NULL, REG_OPTION_NON_VOLATILE,
576 KEY_WRITE, NULL /* FIXME */, &destKey, &disposition);
577 if (disposition == REG_OPENED_EXISTING_KEY)
578 lRet = ERROR_FILE_EXISTS; /* FIXME: we might want a better error message than this */
579 if (lRet != ERROR_SUCCESS) {
580 error_code_messagebox(hwnd, lRet);
581 goto done;
584 /* FIXME: SHCopyKey does not copy the security attributes */
585 lRet = SHCopyKeyW(parentKey, srcSubKey, destKey, 0);
586 if (lRet != ERROR_SUCCESS) {
587 RegCloseKey(destKey);
588 RegDeleteKeyW(parentKey, newName);
589 error_code_messagebox(hwnd, lRet);
590 goto done;
593 lRet = SHDeleteKeyW(hRootKey, keyPath);
594 if (lRet != ERROR_SUCCESS) {
595 error_code_messagebox(hwnd, lRet);
596 goto done;
599 result = TRUE;
601 done:
602 RegCloseKey(destKey);
603 if (parentKey) {
604 RegCloseKey(parentKey);
605 HeapFree(GetProcessHeap(), 0, parentPath);
607 return result;