mirror of
https://github.com/reactos/reactos.git
synced 2025-08-06 09:22:58 +00:00
[REGEDIT] Deduplication and other formatting changes (#7193)
- Deduplicates unused IDC_REGEDIT MENU vs. actually used IDR_REGEDIT_MENU - shrinks the binary size, GCC8.4.0dbg build shrinks from 1.052.672 -> 1.049.600 bytes - that also solves a few FIXME's, e.g. in hu-HU, pl-PL, sl-SI, sq-AL, tr-TR, uk-UA - translates the help-popup string in th-TH.rc - slightly tweak some headers to be a bit closer to newstyle without going all the way - also link to LPGL2.1+ in the source files to reduce the wall-of-text, also some other whitespace tweaks in those, but no functional change - security.c: vertical-compactness-whitespace-changes aim to get HeapAlloc closer to HeapFree - id-ID.rc: "&Data nilai" and "&Nama nilai" does exist in 4 dialogs, Harmonize them - pt-PT.rc: add 2 missing accels in IDD_EDIT_STRING - edit.c: 3x ARRAY_SIZE - the most review-worthy change in the actual .h/.c files is clb.c the change from ClbWndClass.hInstance = hinstDLL, ClbWndClass.hIcon = NULL; to ClbWndClass.hInstance = hinstDLL; ClbWndClass.hIcon = NULL; - clb.c the stripped INT_PTR-cast for EndDialog() was Co-authored-by: Katayama Hirofumi MZ <katayama.hirofumi.mz@gmail.com>
This commit is contained in:
parent
d7ab15dcb4
commit
470cef7bfd
47 changed files with 152 additions and 869 deletions
|
@ -2,20 +2,7 @@
|
|||
* Registry editing UI functions.
|
||||
*
|
||||
* Copyright (C) 2003 Dimitrie O. Paun
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
* LICENSE: LGPL-2.1-or-later (https://spdx.org/licenses/LGPL-2.1-or-later)
|
||||
*/
|
||||
|
||||
#include "regedit.h"
|
||||
|
@ -163,7 +150,6 @@ INT_PTR CALLBACK modify_string_dlgproc(HWND hwndDlg, UINT uMsg, WPARAM wParam, L
|
|||
return FALSE;
|
||||
}
|
||||
|
||||
|
||||
INT_PTR CALLBACK modify_multi_string_dlgproc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
|
||||
{
|
||||
WCHAR* valueData;
|
||||
|
@ -231,7 +217,6 @@ INT_PTR CALLBACK modify_multi_string_dlgproc(HWND hwndDlg, UINT uMsg, WPARAM wPa
|
|||
return FALSE;
|
||||
}
|
||||
|
||||
|
||||
LRESULT CALLBACK DwordEditSubclassProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
|
||||
{
|
||||
WNDPROC oldwndproc;
|
||||
|
@ -243,7 +228,7 @@ LRESULT CALLBACK DwordEditSubclassProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPAR
|
|||
case WM_CHAR:
|
||||
if (dwordEditMode == EDIT_MODE_DEC)
|
||||
{
|
||||
if (isdigit((int) wParam & 0xff) || iscntrl((int) wParam & 0xff))
|
||||
if (isdigit((int)wParam & 0xff) || iscntrl((int)wParam & 0xff))
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
@ -254,7 +239,7 @@ LRESULT CALLBACK DwordEditSubclassProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPAR
|
|||
}
|
||||
else if (dwordEditMode == EDIT_MODE_HEX)
|
||||
{
|
||||
if (isxdigit((int) wParam & 0xff) || iscntrl((int) wParam & 0xff))
|
||||
if (isxdigit((int)wParam & 0xff) || iscntrl((int)wParam & 0xff))
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
@ -272,7 +257,6 @@ LRESULT CALLBACK DwordEditSubclassProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPAR
|
|||
return CallWindowProcW(oldwndproc, hwnd, uMsg, wParam, lParam);
|
||||
}
|
||||
|
||||
|
||||
INT_PTR CALLBACK modify_dword_dlgproc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
|
||||
{
|
||||
WNDPROC oldproc;
|
||||
|
@ -386,7 +370,6 @@ INT_PTR CALLBACK modify_dword_dlgproc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LP
|
|||
return FALSE;
|
||||
}
|
||||
|
||||
|
||||
INT_PTR CALLBACK modify_binary_dlgproc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
|
||||
{
|
||||
HWND hwndValue;
|
||||
|
@ -419,7 +402,7 @@ INT_PTR CALLBACK modify_binary_dlgproc(HWND hwndDlg, UINT uMsg, WPARAM wParam, L
|
|||
case IDOK:
|
||||
if ((hwndValue = GetDlgItem(hwndDlg, IDC_VALUE_DATA)))
|
||||
{
|
||||
len = (UINT) HexEdit_GetBufferSize(hwndValue);
|
||||
len = (UINT)HexEdit_GetBufferSize(hwndValue);
|
||||
if (len > 0 && binValueData)
|
||||
binValueData = HeapReAlloc(GetProcessHeap(), 0, binValueData, len);
|
||||
else
|
||||
|
@ -437,7 +420,6 @@ INT_PTR CALLBACK modify_binary_dlgproc(HWND hwndDlg, UINT uMsg, WPARAM wParam, L
|
|||
return FALSE;
|
||||
}
|
||||
|
||||
|
||||
static BOOL CreateResourceColumns(HWND hwnd)
|
||||
{
|
||||
WCHAR szText[80];
|
||||
|
@ -661,7 +643,6 @@ GetInterfaceType(INTERFACE_TYPE InterfaceType,
|
|||
// wcscpy(pBuffer, lpInterfaceType);
|
||||
}
|
||||
|
||||
|
||||
static VOID
|
||||
ParseResources(HWND hwnd)
|
||||
{
|
||||
|
@ -859,7 +840,6 @@ ParseResources(HWND hwnd)
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
static BOOL
|
||||
OnResourceNotify(HWND hwndDlg, NMHDR *phdr)
|
||||
{
|
||||
|
@ -916,7 +896,6 @@ OnResourceNotify(HWND hwndDlg, NMHDR *phdr)
|
|||
return FALSE;
|
||||
}
|
||||
|
||||
|
||||
static INT_PTR CALLBACK modify_resource_dlgproc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
|
||||
{
|
||||
UNREFERENCED_PARAMETER(lParam);
|
||||
|
@ -1037,7 +1016,6 @@ OnResourceListNotify(HWND hwndDlg, NMHDR *phdr)
|
|||
return FALSE;
|
||||
}
|
||||
|
||||
|
||||
static INT_PTR CALLBACK modify_resource_list_dlgproc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
|
||||
{
|
||||
UNREFERENCED_PARAMETER(lParam);
|
||||
|
@ -1436,7 +1414,7 @@ static INT_PTR CALLBACK show_requirements_dma_dlgproc(HWND hwndDlg, UINT uMsg, W
|
|||
{
|
||||
case IDOK:
|
||||
case IDCANCEL:
|
||||
EndDialog(hwndDlg, IDOK);
|
||||
EndDialog(hwndDlg, IDOK);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -1593,7 +1571,7 @@ BOOL ModifyValue(HWND hwnd, HKEY hKey, LPCWSTR valueName, BOOL EditBin)
|
|||
{
|
||||
if (stringValueData)
|
||||
{
|
||||
lRet = RegSetValueExW(hKey, valueName, 0, type, (LPBYTE)stringValueData, (DWORD) (wcslen(stringValueData) + 1) * sizeof(WCHAR));
|
||||
lRet = RegSetValueExW(hKey, valueName, 0, type, (LPBYTE)stringValueData, (DWORD)(wcslen(stringValueData) + 1) * sizeof(WCHAR));
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -1697,7 +1675,7 @@ BOOL ModifyValue(HWND hwnd, HKEY hKey, LPCWSTR valueName, BOOL EditBin)
|
|||
warning(hwnd, IDS_MULTI_SZ_EMPTY_STRING);
|
||||
}
|
||||
|
||||
lRet = RegSetValueExW(hKey, valueName, 0, type, (LPBYTE)lines, (DWORD) buflen);
|
||||
lRet = RegSetValueExW(hKey, valueName, 0, type, (LPBYTE)lines, (DWORD)buflen);
|
||||
HeapFree(GetProcessHeap(), 0, lines);
|
||||
}
|
||||
else
|
||||
|
@ -1898,7 +1876,7 @@ static LONG CopyKey(HKEY hDestKey, LPCWSTR lpDestSubKey, HKEY hSrcKey, LPCWSTR l
|
|||
dwIndex = 0;
|
||||
do
|
||||
{
|
||||
cbName = sizeof(szSubKey) / sizeof(szSubKey[0]);
|
||||
cbName = ARRAY_SIZE(szSubKey);
|
||||
lResult = RegEnumKeyExW(hSrcKey, dwIndex++, szSubKey, &cbName, NULL, NULL, NULL, &ft);
|
||||
if (lResult == ERROR_SUCCESS)
|
||||
{
|
||||
|
@ -1913,8 +1891,8 @@ static LONG CopyKey(HKEY hDestKey, LPCWSTR lpDestSubKey, HKEY hSrcKey, LPCWSTR l
|
|||
dwIndex = 0;
|
||||
do
|
||||
{
|
||||
cbName = sizeof(szValueName) / sizeof(szValueName[0]);
|
||||
cbData = sizeof(szValueData) / sizeof(szValueData[0]);
|
||||
cbName = ARRAY_SIZE(szValueName);
|
||||
cbData = ARRAY_SIZE(szValueData);
|
||||
lResult = RegEnumValueW(hSrcKey, dwIndex++, szValueName, &cbName, NULL, &dwType, szValueData, &cbData);
|
||||
if (lResult == ERROR_SUCCESS)
|
||||
{
|
||||
|
@ -2005,7 +1983,7 @@ LONG RenameKey(HKEY hKey, LPCWSTR lpSubKey, LPCWSTR lpNewName)
|
|||
{
|
||||
s++;
|
||||
cbNewSubKey = (s - lpSubKey + wcslen(lpNewName) + 1) * sizeof(WCHAR);
|
||||
lpNewSubKey = (LPWSTR) HeapAlloc(GetProcessHeap(), 0, cbNewSubKey);
|
||||
lpNewSubKey = (LPWSTR)HeapAlloc(GetProcessHeap(), 0, cbNewSubKey);
|
||||
if (lpNewSubKey != NULL)
|
||||
{
|
||||
StringCbCopyNW(lpNewSubKey, cbNewSubKey, lpSubKey, (s - lpSubKey) * sizeof(WCHAR));
|
||||
|
@ -2072,7 +2050,7 @@ LONG QueryStringValue(HKEY hKey, LPCWSTR lpSubKey, LPCWSTR lpValueName, LPWSTR p
|
|||
}
|
||||
|
||||
cbData = (dwBufferLen - 1) * sizeof(*pszBuffer);
|
||||
lResult = RegQueryValueExW(hKey, lpValueName, NULL, &dwType, (LPBYTE) pszBuffer, &cbData);
|
||||
lResult = RegQueryValueExW(hKey, lpValueName, NULL, &dwType, (LPBYTE)pszBuffer, &cbData);
|
||||
if (lResult != ERROR_SUCCESS)
|
||||
goto done;
|
||||
if (dwType != REG_SZ)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue