Skip to content

Commit

Permalink
[0.4.8][REGEDIT] Port back several improvements and crash-fixes
Browse files Browse the repository at this point in the history
0.4.15-dev-5985-g 31fdaca [REGEDIT] Strip redundant include, minor formatting (#5264)
0.4.15-dev-5970-g 9d7d331 [REGEDIT] Check whether pszSelectKey is NULL on CDN_FILEOK (#5255)
0.4.15-dev-5898-g 84e580b [REGEDIT] Fix ListView selection and finding (#5150)
(superseded) 0.4.15-dev-5802-g cce3eb9 Fix buffer read past end problem. (#5146) CORE-15896 and CORE-18230
partially 0.4.15-dev-5753-g 1ee9ea4 [REGEDIT] Avoid buffer overflow in SelectNode. CORE-18602 (I left the wscpy-replacement at the end for the fixed size strings, as they would increase binary size, and are totally safe)
partially 0.4.15-dev-5308-g 5daf5cd [REGEDIT] Use shell icons for the tree view (#4841) CORE-10764
0.4.15-dev-4850-g 568383c [REGEDIT] Fix issue at Find registry key (#4341)
partially 0.4.15-dev-2265-g bebdfda [REGEDIT]... Use newer file open dialog (#3571)
0.4.15-dev-1470-g 9de8787 [REGEDIT] Display search finished messagebox when using Find Next (F3) menu item (#3371) CORE-17368
0.4.15-dev-1302-g 6aae5f4 [REGEDIT] Make "finished find" messagebox owned by Regedit window (#3369) CORE-17367
0.4.15-dev-169-g 0461de3 [REGEDIT] Fix HeapFree() on the wrong variable (#2736)
0.4.14-dev-1484-g c832112 [REGEDIT] Fix tree view popup menu issues CORE-16887
0.4.14-dev-1468-g 763de23 [REGEDIT] Fix inconsistent menu state for 'Permissions' CORE-16889
a more efficient solution than 0.4.14-dev-1467-g b280615 [REGEDIT] Crash on selecting 'New' on root item 'My computer' CORE-16888
0.4.14-dev-1466-g 13dd917 [REGEDIT] CORE-16892 fr-FR Translation update
0.4.13-dev-464-g 6b95727 [REGEDIT] Adjust ListView column widths (#1663) CORE-15187
0.4.12-dev-47-g 63a0ac0 [REGEDIT] Set background brush to child window (#1122) CORE-15442
0.4.11-dev-481-g efbebf9 [REGEDIT] Improve the layout of controls (#967) CORE-15187
0.4.11-dev-480-g e4c2cff [REGEDIT] Don't paint background in WM_PAINT (#970) CORE-15187
0.4.11-dev-458-g 125db5e [REGEDIT] Trivial resizing code fix (#950)
0.4.11-dev-457-g b3231e0 [REGEDIT] Code formatting (#949)
0.4.10-dev-244-g b941574 [REGEDIT] Fix importing very big *.reg files (HEX values commonly) (#618)

a few fragments only of 0.4.15-dev-5304-g 36a7f0d [REGEDIT] framewnd.c resize_frame_rect(), main.h strip externs before func declarations and reordering, treeview.c InitTreeViewImageLists()

also port back a few selected translation improvements, and strip the suggestions-feature in older branches <= 0.4.13 which does not exist in 2k3sp2.
  • Loading branch information
JoachimHenze committed May 1, 2023
1 parent ff05a90 commit 73339e0
Show file tree
Hide file tree
Showing 49 changed files with 560 additions and 746 deletions.
2 changes: 1 addition & 1 deletion base/applications/regedit/about.c
Expand Up @@ -26,7 +26,7 @@ void ShowAboutBox(HWND hWnd)
{
WCHAR AppStr[255];
LoadStringW(hInst, IDS_APP_TITLE, AppStr, COUNT_OF(AppStr));
ShellAboutW(hWnd, AppStr, L"", LoadIconW(hInst, MAKEINTRESOURCEW(IDI_REGEDIT)));
ShellAboutW(hWnd, AppStr, NULL, LoadIconW(hInst, MAKEINTRESOURCEW(IDI_REGEDIT)));
}

/* EOF */
432 changes: 76 additions & 356 deletions base/applications/regedit/childwnd.c

Large diffs are not rendered by default.

10 changes: 5 additions & 5 deletions base/applications/regedit/clb/lang/id-ID.rc
Expand Up @@ -10,13 +10,13 @@ BEGIN
CHECKBOX "&Batas", 1713, 10, 30, 34, 10, BS_AUTOCHECKBOX | WS_GROUP | WS_TABSTOP
CHECKBOX "&Urut", 1705, 10, 40, 26, 10, BS_AUTOCHECKBOX | WS_GROUP | WS_TABSTOP
CHECKBOX "Berita&hu", 1706, 10, 50, 32, 10, BS_AUTOCHECKBOX | WS_GROUP | WS_TABSTOP
CHECKBOX "V&ert. Bar Gulung", 1707, 10, 60, 64, 10, BS_AUTOCHECKBOX | WS_GROUP | WS_TABSTOP
CHECKBOX "&Multipel Pilihan", -1, 79, 20, 72, 10, BS_AUTOCHECKBOX | WS_GROUP | WS_TABSTOP | WS_DISABLED
CHECKBOX "&Vert. Bar Gulung", 1707, 10, 60, 64, 10, BS_AUTOCHECKBOX | WS_GROUP | WS_TABSTOP
CHECKBOX "Mu&ltipel Pilihan", -1, 79, 20, 72, 10, BS_AUTOCHECKBOX | WS_GROUP | WS_TABSTOP | WS_DISABLED
CHECKBOX "&Perluasan Pilihan", -1, 79, 30, 77, 10, BS_AUTOCHECKBOX | WS_GROUP | WS_TABSTOP | WS_DISABLED
CHECKBOX "&Popout Headings", 1714, 79, 40, 68, 10, BS_AUTOCHECKBOX | WS_GROUP | WS_TABSTOP
CHECKBOX "&Springy Kolom", 1715, 79, 50, 66, 10, BS_AUTOCHECKBOX | WS_GROUP | WS_TABSTOP
CHECKBOX "&Judul Popout", 1714, 79, 40, 68, 10, BS_AUTOCHECKBOX | WS_GROUP | WS_TABSTOP
CHECKBOX "&Kolom kenyal", 1715, 79, 50, 66, 10, BS_AUTOCHECKBOX | WS_GROUP | WS_TABSTOP
GROUPBOX "Gaya Dasar", -1, 6, 80, 158, 34
CHECKBOX "&Terlihat", 1701, 10, 92, 34, 10, BS_AUTOCHECKBOX | WS_GROUP | WS_TABSTOP
CHECKBOX "T&erlihat", 1701, 10, 92, 34, 10, BS_AUTOCHECKBOX | WS_GROUP | WS_TABSTOP
CHECKBOX "&Dimatikan", 1702, 10, 102, 41, 10, BS_AUTOCHECKBOX | WS_GROUP | WS_TABSTOP
CHECKBOX "&Grup", 1703, 79, 92, 32, 10, BS_AUTOCHECKBOX | WS_GROUP | WS_TABSTOP
CHECKBOX "&Tab Henti", 1704, 79, 102, 44, 10, BS_AUTOCHECKBOX | WS_GROUP | WS_TABSTOP
Expand Down
2 changes: 1 addition & 1 deletion base/applications/regedit/clb/lang/pl-PL.rc
Expand Up @@ -3,7 +3,7 @@
* caemyr@gmail.com
* https://sourceforge.net/projects/reactospl
* Updated by Saibamen - Adam Stachowicz (saibamenppl@gmail.com) (August, 2011)
* UTF-8 conversion by Caemyr (May, 2011)
* UTF-8 conversion by Caemyr (May, 2011)
*/

LANGUAGE LANG_POLISH, SUBLANG_DEFAULT
Expand Down
2 changes: 1 addition & 1 deletion base/applications/regedit/clb/lang/sk-SK.rc
@@ -1,6 +1,6 @@
/* TRANSLATOR : Mário Kačmár /Mario Kacmar/ aka Kario (kario@szm.sk)
* DATE OF TR.: 07-07-2008
*/
*/

LANGUAGE LANG_SLOVAK, SUBLANG_DEFAULT

Expand Down
8 changes: 4 additions & 4 deletions base/applications/regedit/clb/lang/tr-TR.rc
Expand Up @@ -4,10 +4,10 @@ LANGUAGE LANG_TURKISH, SUBLANG_DEFAULT

IDD_COLUMNLISTBOXSTYLES DIALOGEX 0, 0, 227, 215
STYLE DS_SHELLFONT | DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU
CAPTION "Dikeçli Dizelge Kutusu Biçimleri"
CAPTION "Sütun Listesi Kutusu Biçimleri"
FONT 8, "MS Shell Dlg", 0, 0, 0x0
BEGIN
GROUPBOX "Dikeçli Dizelge Kutusu Biçimleri", -1, 6, 7, 158, 71
GROUPBOX "Sütün Listesi Kutusu Biçimleri", -1, 6, 7, 158, 71
CHECKBOX "&Ölçünlü", 1710, 10, 20, 42, 10, BS_AUTOCHECKBOX | WS_GROUP | WS_TABSTOP
CHECKBOX "&Hudut", 1713, 10, 30, 34, 10, BS_AUTOCHECKBOX | WS_GROUP | WS_TABSTOP
CHECKBOX "&Diz", 1705, 10, 40, 26, 10, BS_AUTOCHECKBOX | WS_GROUP | WS_TABSTOP
Expand All @@ -16,8 +16,8 @@ BEGIN
CHECKBOX "&Çoklu Seçim", -1, 79, 20, 72, 10, BS_AUTOCHECKBOX | WS_GROUP | WS_TABSTOP | WS_DISABLED
CHECKBOX "&Genişletilmiş Seçim", -1, 79, 30, 77, 10, BS_AUTOCHECKBOX | WS_GROUP | WS_TABSTOP | WS_DISABLED
CHECKBOX "&Açılan Başlıklar", 1714, 79, 40, 68, 10, BS_AUTOCHECKBOX | WS_GROUP | WS_TABSTOP
CHECKBOX "&Esnek Dikeçler", 1715, 79, 50, 66, 10, BS_AUTOCHECKBOX | WS_GROUP | WS_TABSTOP
GROUPBOX "Başlıca Biçimler", -1, 6, 80, 158, 34
CHECKBOX "&Esnek Sütunlar", 1715, 79, 50, 66, 10, BS_AUTOCHECKBOX | WS_GROUP | WS_TABSTOP
GROUPBOX "Temel Biçimler", -1, 6, 80, 158, 34
CHECKBOX "Gö&rünür", 1701, 10, 92, 34, 10, BS_AUTOCHECKBOX | WS_GROUP | WS_TABSTOP
CHECKBOX "Edi&lgin", 1702, 10, 102, 41, 10, BS_AUTOCHECKBOX | WS_GROUP | WS_TABSTOP
CHECKBOX "Öbe&kleme", 1703, 79, 92, 32, 10, BS_AUTOCHECKBOX | WS_GROUP | WS_TABSTOP
Expand Down
136 changes: 65 additions & 71 deletions base/applications/regedit/find.c
Expand Up @@ -32,7 +32,7 @@ static BOOL s_bAbort;

static DWORD s_dwFlags;
static WCHAR s_szName[MAX_PATH];
static DWORD s_cbName;
static DWORD s_cchName;
static const WCHAR s_empty[] = L"";
static const WCHAR s_backslash[] = L"\\";

Expand Down Expand Up @@ -87,41 +87,31 @@ static BOOL CompareName(LPCWSTR pszName1, LPCWSTR pszName2)
}
}

static BOOL
CompareData(
DWORD dwType,
LPCWSTR psz1,
LPCWSTR psz2)
static BOOL MatchString(LPCWCH pch1, INT cch1, LPCWCH pch2, INT cch2)
{
INT i, cch1 = wcslen(psz1), cch2 = wcslen(psz2);
if (dwType == REG_SZ || dwType == REG_EXPAND_SZ)
{
if (s_dwFlags & RSF_WHOLESTRING)
{
if (s_dwFlags & RSF_MATCHCASE)
return 2 == CompareStringW(LOCALE_SYSTEM_DEFAULT, 0,
psz1, cch1, psz2, cch2);
else
return 2 == CompareStringW(LOCALE_SYSTEM_DEFAULT,
NORM_IGNORECASE, psz1, cch1, psz2, cch2);
}
INT i;
DWORD dwNorm = ((s_dwFlags & RSF_MATCHCASE) ? NORM_IGNORECASE : 0);

for(i = 0; i <= cch1 - cch2; i++)
{
if (s_dwFlags & RSF_MATCHCASE)
{
if (2 == CompareStringW(LOCALE_SYSTEM_DEFAULT, 0,
psz1 + i, cch2, psz2, cch2))
return TRUE;
}
else
{
if (2 == CompareStringW(LOCALE_SYSTEM_DEFAULT,
NORM_IGNORECASE, psz1 + i, cch2, psz2, cch2))
return TRUE;
}
}
if (s_dwFlags & RSF_WHOLESTRING)
return 2 == CompareStringW(LOCALE_SYSTEM_DEFAULT, dwNorm, pch1, cch1, pch2, cch2);

if (cch1 < cch2)
return FALSE;

for (i = 0; i <= cch1 - cch2; i++)
{
if (2 == CompareStringW(LOCALE_SYSTEM_DEFAULT, dwNorm, pch1 + i, cch2, pch2, cch2))
return TRUE;
}

return FALSE;
}

static BOOL MatchData(DWORD dwType, LPCVOID pv1, DWORD cb1)
{
if (dwType == REG_SZ || dwType == REG_EXPAND_SZ || dwType == REG_MULTI_SZ)
return MatchString(pv1, (INT)(cb1 / sizeof(WCHAR)), s_szFindWhat, lstrlenW(s_szFindWhat));

return FALSE;
}

Expand All @@ -143,7 +133,7 @@ BOOL RegFindRecurse(
LONG lResult;
WCHAR szSubKey[MAX_PATH];
DWORD i, c, cb, type;
BOOL fPast = FALSE;
BOOL fPast;
LPWSTR *ppszNames = NULL;
LPBYTE pb = NULL;

Expand All @@ -160,9 +150,6 @@ BOOL RegFindRecurse(
if (lResult != ERROR_SUCCESS)
return FALSE;

if (pszValueName == NULL)
pszValueName = s_empty;

lResult = RegQueryInfoKeyW(hSubKey, NULL, NULL, NULL, NULL, NULL, NULL,
&c, NULL, NULL, NULL, NULL);
if (lResult != ERROR_SUCCESS)
Expand All @@ -177,8 +164,8 @@ BOOL RegFindRecurse(
if (DoEvents())
goto err;

s_cbName = MAX_PATH * sizeof(WCHAR);
lResult = RegEnumValueW(hSubKey, i, s_szName, &s_cbName, NULL, NULL,
s_cchName = _countof(s_szName);
lResult = RegEnumValueW(hSubKey, i, s_szName, &s_cchName, NULL, NULL,
NULL, &cb);
if (lResult == ERROR_NO_MORE_ITEMS)
{
Expand All @@ -187,14 +174,15 @@ BOOL RegFindRecurse(
}
if (lResult != ERROR_SUCCESS)
goto err;
if (s_cbName >= MAX_PATH * sizeof(WCHAR))
if (s_cchName >= _countof(s_szName))
continue;

ppszNames[i] = _wcsdup(s_szName);
}

qsort(ppszNames, c, sizeof(LPWSTR), compare);

fPast = (pszValueName == NULL);
for(i = 0; i < c; i++)
{
if (DoEvents())
Expand All @@ -212,10 +200,7 @@ BOOL RegFindRecurse(
CompareName(ppszNames[i], s_szFindWhat))
{
*ppszFoundSubKey = _wcsdup(szSubKey);
if (ppszNames[i][0] == 0)
*ppszFoundValueName = NULL;
else
*ppszFoundValueName = _wcsdup(ppszNames[i]);
*ppszFoundValueName = _wcsdup(ppszNames[i]);
goto success;
}

Expand All @@ -231,14 +216,10 @@ BOOL RegFindRecurse(
if (lResult != ERROR_SUCCESS)
goto err;

if ((s_dwFlags & RSF_LOOKATDATA) &&
CompareData(type, (LPWSTR) pb, s_szFindWhat))
if ((s_dwFlags & RSF_LOOKATDATA) && MatchData(type, pb, cb))
{
*ppszFoundSubKey = _wcsdup(szSubKey);
if (ppszNames[i][0] == 0)
*ppszFoundValueName = NULL;
else
*ppszFoundValueName = _wcsdup(ppszNames[i]);
*ppszFoundValueName = _wcsdup(ppszNames[i]);
goto success;
}
free(pb);
Expand Down Expand Up @@ -267,8 +248,8 @@ BOOL RegFindRecurse(
if (DoEvents())
goto err;

s_cbName = MAX_PATH * sizeof(WCHAR);
lResult = RegEnumKeyExW(hSubKey, i, s_szName, &s_cbName, NULL, NULL,
s_cchName = _countof(s_szName);
lResult = RegEnumKeyExW(hSubKey, i, s_szName, &s_cchName, NULL, NULL,
NULL, NULL);
if (lResult == ERROR_NO_MORE_ITEMS)
{
Expand All @@ -277,7 +258,7 @@ BOOL RegFindRecurse(
}
if (lResult != ERROR_SUCCESS)
goto err;
if (s_cbName >= MAX_PATH * sizeof(WCHAR))
if (s_cchName >= _countof(s_szName))
continue;

ppszNames[i] = _wcsdup(s_szName);
Expand Down Expand Up @@ -366,17 +347,18 @@ BOOL RegFindWalk(
WCHAR szKeyName[MAX_PATH];
WCHAR szSubKey[MAX_PATH];
LPWSTR pch;
BOOL fPast;
BOOL fPast, fKeyMatched;
LPWSTR *ppszNames = NULL;

hBaseKey = *phKey;

if (wcslen(pszSubKey) >= _countof(szSubKey))
return FALSE;

if (RegFindRecurse(hBaseKey, pszSubKey, pszValueName, ppszFoundSubKey,
ppszFoundValueName))
return TRUE;

if (wcslen(pszSubKey) >= MAX_PATH)
return FALSE;

wcscpy(szSubKey, pszSubKey);
while(szSubKey[0] != 0)
{
Expand Down Expand Up @@ -415,8 +397,8 @@ BOOL RegFindWalk(
if (DoEvents())
goto err;

s_cbName = MAX_PATH * sizeof(WCHAR);
lResult = RegEnumKeyExW(hSubKey, i, s_szName, &s_cbName,
s_cchName = _countof(s_szName);
lResult = RegEnumKeyExW(hSubKey, i, s_szName, &s_cchName,
NULL, NULL, NULL, NULL);
if (lResult == ERROR_NO_MORE_ITEMS)
{
Expand Down Expand Up @@ -464,7 +446,8 @@ BOOL RegFindWalk(
goto success;
}

if (RegFindRecurse(hSubKey, ppszNames[i], NULL,
fKeyMatched = (_wcsicmp(ppszNames[i], szKeyName) == 0);
if (RegFindRecurse(hSubKey, ppszNames[i], (fKeyMatched ? pszValueName : NULL),
ppszFoundSubKey, ppszFoundValueName))
{
LPWSTR psz = *ppszFoundSubKey;
Expand Down Expand Up @@ -687,10 +670,16 @@ BOOL FindNext(HWND hWnd)
{
GetKeyName(szFullKey, COUNT_OF(szFullKey), hKeyRoot, pszFoundSubKey);
SelectNode(g_pChildWnd->hTreeWnd, szFullKey);
SetValueName(g_pChildWnd->hListWnd, pszFoundValueName);
free(pszFoundSubKey);
free(pszFoundValueName);
SetFocus(g_pChildWnd->hListWnd);

if (pszFoundValueName != NULL)
{
SetValueName(g_pChildWnd->hListWnd, pszFoundValueName);
free(pszFoundValueName);
SetFocus(g_pChildWnd->hListWnd);
}
else
SetFocus(g_pChildWnd->hTreeWnd);
}
return fSuccess || s_bAbort;
}
Expand Down Expand Up @@ -810,18 +799,23 @@ static INT_PTR CALLBACK FindDialogProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPAR
return iResult;
}

void FindNextMessageBox(HWND hWnd)
{
if (!FindNext(hWnd))
{
WCHAR msg[128], caption[128];

LoadStringW(hInst, IDS_FINISHEDFIND, msg, COUNT_OF(msg));
LoadStringW(hInst, IDS_APP_TITLE, caption, COUNT_OF(caption));
MessageBoxW(hWnd, msg, caption, MB_ICONINFORMATION);
}
}

void FindDialog(HWND hWnd)
{
if (DialogBoxParamW(GetModuleHandle(NULL), MAKEINTRESOURCEW(IDD_FIND),
hWnd, FindDialogProc, 0) != 0)
{
if (!FindNext(hWnd))
{
WCHAR msg[128], caption[128];

LoadStringW(hInst, IDS_FINISHEDFIND, msg, COUNT_OF(msg));
LoadStringW(hInst, IDS_APP_TITLE, caption, COUNT_OF(caption));
MessageBoxW(0, msg, caption, MB_ICONINFORMATION);
}
FindNextMessageBox(hWnd);
}
}

1 comment on commit 73339e0

@JoachimHenze
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry: typo in a mentioned CORE-ID in commit comment: CORE-15896 -> CORE-15986

Please sign in to comment.