Skip to content

Commit

Permalink
[REGEDIT] Partially sync Regedit to Wine-7.17 (#4717)
Browse files Browse the repository at this point in the history
* [REGEDIT] Partially Sync to Wine 7.17

- regproc.c and regedit.c are now in sync.
- some other mostly depending fixes for the remaining files

* [REGEDIT_WINETEST] Sync to Wine-7.0
  • Loading branch information
gonzoMD committed Nov 2, 2022
1 parent 6603025 commit 36a7f0d
Show file tree
Hide file tree
Showing 49 changed files with 3,348 additions and 1,744 deletions.
2 changes: 1 addition & 1 deletion base/applications/regedit/CMakeLists.txt
Expand Up @@ -22,7 +22,7 @@ file(GLOB regedit_rc_deps res/*.*)
add_rc_deps(regedit.rc ${regedit_rc_deps})
add_executable(regedit ${SOURCE} regedit.rc)
set_module_type(regedit win32gui UNICODE)
target_link_libraries(regedit uuid)
target_link_libraries(regedit uuid wine)
add_importlibs(regedit user32 gdi32 advapi32 ole32 shell32 comctl32 comdlg32 shlwapi msvcrt kernel32 ntdll)
add_pch(regedit regedit.h SOURCE)
add_cd_file(TARGET regedit DESTINATION reactos FOR all)
Expand Down
2 changes: 1 addition & 1 deletion base/applications/regedit/about.c
Expand Up @@ -25,7 +25,7 @@
void ShowAboutBox(HWND hWnd)
{
WCHAR AppStr[255];
LoadStringW(hInst, IDS_APP_TITLE, AppStr, COUNT_OF(AppStr));
LoadStringW(hInst, IDS_APP_TITLE, AppStr, ARRAY_SIZE(AppStr));
ShellAboutW(hWnd, AppStr, NULL, LoadIconW(hInst, MAKEINTRESOURCEW(IDI_REGEDIT)));
}

Expand Down
22 changes: 11 additions & 11 deletions base/applications/regedit/childwnd.c
Expand Up @@ -157,7 +157,7 @@ static void SuggestKeys(HKEY hRootKey, LPCWSTR pszKeyPath, LPWSTR pszSuggestions

/* Check default key */
if (QueryStringValue(hRootKey, pszKeyPath, NULL,
szBuffer, COUNT_OF(szBuffer)) == ERROR_SUCCESS)
szBuffer, ARRAY_SIZE(szBuffer)) == ERROR_SUCCESS)
{
/* Sanity check this key; it cannot be empty, nor can it be a
* loop back */
Expand Down Expand Up @@ -189,7 +189,7 @@ static void SuggestKeys(HKEY hRootKey, LPCWSTR pszKeyPath, LPWSTR pszSuggestions
if (RegOpenKeyW(hRootKey, pszKeyPath, &hSubKey) == ERROR_SUCCESS)
{
if (QueryStringValue(hSubKey, L"CLSID", NULL, szBuffer,
COUNT_OF(szBuffer)) == ERROR_SUCCESS)
ARRAY_SIZE(szBuffer)) == ERROR_SUCCESS)
{
lstrcpynW(pszSuggestions, L"HKCR\\CLSID\\", (int)iSuggestionsLength);
i = wcslen(pszSuggestions);
Expand Down Expand Up @@ -218,7 +218,7 @@ LRESULT CALLBACK AddressBarProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lPar
case WM_KEYUP:
if (wParam == VK_RETURN)
{
GetWindowTextW(hwnd, s_szNode, COUNT_OF(s_szNode));
GetWindowTextW(hwnd, s_szNode, ARRAY_SIZE(s_szNode));
SelectNode(g_pChildWnd->hTreeWnd, s_szNode);
}
break;
Expand Down Expand Up @@ -254,7 +254,7 @@ UpdateAddress(HTREEITEM hItem, HKEY hRootKey, LPCWSTR pszPath)
RefreshListView(g_pChildWnd->hListWnd, hRootKey, keyPath);
rootName = get_root_key_name(hRootKey);
cbFullPath = (wcslen(rootName) + 1 + wcslen(keyPath) + 1) * sizeof(WCHAR);
fullPath = HeapAlloc(GetProcessHeap(), 0, cbFullPath);
fullPath = malloc(cbFullPath);
if (fullPath)
{
/* set (correct) the address bar text */
Expand All @@ -265,7 +265,7 @@ UpdateAddress(HTREEITEM hItem, HKEY hRootKey, LPCWSTR pszPath)

SendMessageW(hStatusBar, SB_SETTEXTW, 0, (LPARAM)fullPath);
SendMessageW(g_pChildWnd->hAddressBarWnd, WM_SETTEXT, 0, (LPARAM)fullPath);
HeapFree(GetProcessHeap(), 0, fullPath);
free(fullPath);

/* disable hive manipulation items temporarily (enable only if necessary) */
EnableMenuItem(hMenuFrame, ID_REGISTRY_LOADHIVE, MF_BYCOMMAND | MF_GRAYED);
Expand Down Expand Up @@ -313,7 +313,7 @@ LRESULT CALLBACK ChildWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lPa
DWORD style;

/* Load "My Computer" string */
LoadStringW(hInst, IDS_MY_COMPUTER, buffer, COUNT_OF(buffer));
LoadStringW(hInst, IDS_MY_COMPUTER, buffer, ARRAY_SIZE(buffer));

g_pChildWnd = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(ChildWnd));
if (!g_pChildWnd) return 0;
Expand Down Expand Up @@ -384,7 +384,7 @@ LRESULT CALLBACK ChildWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lPa
DestroyTreeView(g_pChildWnd->hTreeWnd);
DestroyMainMenu();
DestroyIcon(g_pChildWnd->hArrowIcon);
HeapFree(GetProcessHeap(), 0, g_pChildWnd);
free(g_pChildWnd);
g_pChildWnd = NULL;
PostQuitMessage(0);
break;
Expand Down Expand Up @@ -603,7 +603,7 @@ LRESULT CALLBACK ChildWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lPa
TreeView_GetItem(g_pChildWnd->hTreeWnd, &item);

/* Set the Expand/Collapse menu item appropriately */
LoadStringW(hInst, (item.state & TVIS_EXPANDED) ? IDS_COLLAPSE : IDS_EXPAND, buffer, COUNT_OF(buffer));
LoadStringW(hInst, (item.state & TVIS_EXPANDED) ? IDS_COLLAPSE : IDS_EXPAND, buffer, ARRAY_SIZE(buffer));
memset(&mii, 0, sizeof(mii));
mii.cbSize = sizeof(mii);
mii.fMask = MIIM_STRING | MIIM_STATE | MIIM_ID;
Expand Down Expand Up @@ -632,18 +632,18 @@ LRESULT CALLBACK ChildWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lPa

/* Come up with suggestions */
keyPath = GetItemPath(g_pChildWnd->hTreeWnd, NULL, &hRootKey);
SuggestKeys(hRootKey, keyPath, Suggestions, COUNT_OF(Suggestions));
SuggestKeys(hRootKey, keyPath, Suggestions, ARRAY_SIZE(Suggestions));
if (Suggestions[0])
{
AppendMenu(hContextMenu, MF_SEPARATOR, 0, NULL);

LoadStringW(hInst, IDS_GOTO_SUGGESTED_KEY, resource, COUNT_OF(resource));
LoadStringW(hInst, IDS_GOTO_SUGGESTED_KEY, resource, ARRAY_SIZE(resource));

s = Suggestions;
wID = ID_TREE_SUGGESTION_MIN;
while(*s && (wID <= ID_TREE_SUGGESTION_MAX))
{
_snwprintf(buffer, COUNT_OF(buffer), resource, s);
_snwprintf(buffer, ARRAY_SIZE(buffer), resource, s);

memset(&mii, 0, sizeof(mii));
mii.cbSize = sizeof(mii);
Expand Down
74 changes: 37 additions & 37 deletions base/applications/regedit/edit.c
Expand Up @@ -49,14 +49,14 @@ void error(HWND hwnd, INT resId, ...)

hInstance = GetModuleHandle(0);

if (!LoadStringW(hInstance, IDS_ERROR, title, COUNT_OF(title)))
if (!LoadStringW(hInstance, IDS_ERROR, title, ARRAY_SIZE(title)))
wcscpy(title, L"Error");

if (!LoadStringW(hInstance, resId, errfmt, COUNT_OF(errfmt)))
if (!LoadStringW(hInstance, resId, errfmt, ARRAY_SIZE(errfmt)))
wcscpy(errfmt, L"Unknown error string!");

va_start(ap, resId);
_vsnwprintf(errstr, COUNT_OF(errstr), errfmt, ap);
_vsnwprintf(errstr, ARRAY_SIZE(errstr), errfmt, ap);
va_end(ap);

MessageBoxW(hwnd, errstr, title, MB_OK | MB_ICONERROR);
Expand All @@ -65,7 +65,7 @@ void error(HWND hwnd, INT resId, ...)
static void error_code_messagebox(HWND hwnd, DWORD error_code)
{
WCHAR title[256];
if (!LoadStringW(hInst, IDS_ERROR, title, COUNT_OF(title)))
if (!LoadStringW(hInst, IDS_ERROR, title, ARRAY_SIZE(title)))
wcscpy(title, L"Error");
ErrorMessageBox(hwnd, title, error_code);
}
Expand All @@ -80,14 +80,14 @@ void warning(HWND hwnd, INT resId, ...)

hInstance = GetModuleHandle(0);

if (!LoadStringW(hInstance, IDS_WARNING, title, COUNT_OF(title)))
if (!LoadStringW(hInstance, IDS_WARNING, title, ARRAY_SIZE(title)))
wcscpy(title, L"Warning");

if (!LoadStringW(hInstance, resId, errfmt, COUNT_OF(errfmt)))
if (!LoadStringW(hInstance, resId, errfmt, ARRAY_SIZE(errfmt)))
wcscpy(errfmt, L"Unknown error string!");

va_start(ap, resId);
_vsnwprintf(errstr, COUNT_OF(errstr), errfmt, ap);
_vsnwprintf(errstr, ARRAY_SIZE(errstr), errfmt, ap);
va_end(ap);

MessageBoxW(hwnd, errstr, title, MB_OK | MB_ICONSTOP);
Expand All @@ -111,7 +111,7 @@ INT_PTR CALLBACK modify_string_dlgproc(HWND hwndDlg, UINT uMsg, WPARAM wParam, L
else
{
WCHAR buffer[255];
LoadStringW(hInst, IDS_DEFAULT_VALUE_NAME, buffer, COUNT_OF(buffer));
LoadStringW(hInst, IDS_DEFAULT_VALUE_NAME, buffer, ARRAY_SIZE(buffer));
SetDlgItemTextW(hwndDlg, IDC_VALUE_NAME, buffer);
}
SetDlgItemTextW(hwndDlg, IDC_VALUE_DATA, stringValueData);
Expand Down Expand Up @@ -180,7 +180,7 @@ INT_PTR CALLBACK modify_multi_string_dlgproc(HWND hwndDlg, UINT uMsg, WPARAM wPa
else
{
WCHAR buffer[255];
LoadStringW(hInst, IDS_DEFAULT_VALUE_NAME, buffer, COUNT_OF(buffer));
LoadStringW(hInst, IDS_DEFAULT_VALUE_NAME, buffer, ARRAY_SIZE(buffer));
SetDlgItemTextW(hwndDlg, IDC_VALUE_NAME, buffer);
}
SetDlgItemTextW(hwndDlg, IDC_VALUE_DATA, stringValueData);
Expand Down Expand Up @@ -300,7 +300,7 @@ INT_PTR CALLBACK modify_dword_dlgproc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LP
else
{
WCHAR buffer[255];
LoadStringW(hInst, IDS_DEFAULT_VALUE_NAME, buffer, COUNT_OF(buffer));
LoadStringW(hInst, IDS_DEFAULT_VALUE_NAME, buffer, ARRAY_SIZE(buffer));
SetDlgItemTextW(hwndDlg, IDC_VALUE_NAME, buffer);
}
CheckRadioButton (hwndDlg, IDC_FORMAT_HEX, IDC_FORMAT_DEC, IDC_FORMAT_HEX);
Expand Down Expand Up @@ -402,7 +402,7 @@ INT_PTR CALLBACK modify_binary_dlgproc(HWND hwndDlg, UINT uMsg, WPARAM wParam, L
else
{
WCHAR buffer[255];
LoadStringW(hInst, IDS_DEFAULT_VALUE_NAME, buffer, COUNT_OF(buffer));
LoadStringW(hInst, IDS_DEFAULT_VALUE_NAME, buffer, ARRAY_SIZE(buffer));
SetDlgItemTextW(hwndDlg, IDC_VALUE_NAME, buffer);
}
hwndValue = GetDlgItem(hwndDlg, IDC_VALUE_DATA);
Expand Down Expand Up @@ -456,13 +456,13 @@ static BOOL CreateResourceColumns(HWND hwnd)
/* Load the column labels from the resource file. */
lvC.iSubItem = 0;
lvC.cx = (rc.right - rc.left) / 2;
LoadStringW(hInst, IDS_DMA_CHANNEL, szText, COUNT_OF(szText));
LoadStringW(hInst, IDS_DMA_CHANNEL, szText, ARRAY_SIZE(szText));
if (ListView_InsertColumn(hwndLV, 0, &lvC) == -1)
return FALSE;

lvC.iSubItem = 1;
lvC.cx = (rc.right - rc.left) - lvC.cx;
LoadStringW(hInst, IDS_DMA_PORT, szText, COUNT_OF(szText));
LoadStringW(hInst, IDS_DMA_PORT, szText, ARRAY_SIZE(szText));
if (ListView_InsertColumn(hwndLV, 1, &lvC) == -1)
return FALSE;

Expand All @@ -476,23 +476,23 @@ static BOOL CreateResourceColumns(HWND hwnd)
/* Load the column labels from the resource file. */
lvC.iSubItem = 0;
lvC.cx = width;
LoadStringW(hInst, IDS_INTERRUPT_VECTOR, szText, COUNT_OF(szText));
LoadStringW(hInst, IDS_INTERRUPT_VECTOR, szText, ARRAY_SIZE(szText));
if (ListView_InsertColumn(hwndLV, 0, &lvC) == -1)
return FALSE;

lvC.iSubItem = 1;
LoadStringW(hInst, IDS_INTERRUPT_LEVEL, szText, COUNT_OF(szText));
LoadStringW(hInst, IDS_INTERRUPT_LEVEL, szText, ARRAY_SIZE(szText));
if (ListView_InsertColumn(hwndLV, 1, &lvC) == -1)
return FALSE;

lvC.iSubItem = 2;
LoadStringW(hInst, IDS_INTERRUPT_AFFINITY, szText, COUNT_OF(szText));
LoadStringW(hInst, IDS_INTERRUPT_AFFINITY, szText, ARRAY_SIZE(szText));
if (ListView_InsertColumn(hwndLV, 2, &lvC) == -1)
return FALSE;

lvC.iSubItem = 3;
lvC.cx = (rc.right - rc.left) - 3 * width;
LoadStringW(hInst, IDS_INTERRUPT_TYPE, szText, COUNT_OF(szText));
LoadStringW(hInst, IDS_INTERRUPT_TYPE, szText, ARRAY_SIZE(szText));
if (ListView_InsertColumn(hwndLV, 3, &lvC) == -1)
return FALSE;

Expand All @@ -506,18 +506,18 @@ static BOOL CreateResourceColumns(HWND hwnd)
/* Load the column labels from the resource file. */
lvC.iSubItem = 0;
lvC.cx = width;
LoadStringW(hInst, IDS_MEMORY_ADDRESS, szText, COUNT_OF(szText));
LoadStringW(hInst, IDS_MEMORY_ADDRESS, szText, ARRAY_SIZE(szText));
if (ListView_InsertColumn(hwndLV, 0, &lvC) == -1)
return FALSE;

lvC.iSubItem = 1;
LoadStringW(hInst, IDS_MEMORY_LENGTH, szText, COUNT_OF(szText));
LoadStringW(hInst, IDS_MEMORY_LENGTH, szText, ARRAY_SIZE(szText));
if (ListView_InsertColumn(hwndLV, 1, &lvC) == -1)
return FALSE;

lvC.iSubItem = 2;
lvC.cx = (rc.right - rc.left) - 2 * width;
LoadStringW(hInst, IDS_MEMORY_ACCESS, szText, COUNT_OF(szText));
LoadStringW(hInst, IDS_MEMORY_ACCESS, szText, ARRAY_SIZE(szText));
if (ListView_InsertColumn(hwndLV, 2, &lvC) == -1)
return FALSE;

Expand All @@ -531,18 +531,18 @@ static BOOL CreateResourceColumns(HWND hwnd)
/* Load the column labels from the resource file. */
lvC.iSubItem = 0;
lvC.cx = width;
LoadStringW(hInst, IDS_PORT_ADDRESS, szText, COUNT_OF(szText));
LoadStringW(hInst, IDS_PORT_ADDRESS, szText, ARRAY_SIZE(szText));
if (ListView_InsertColumn(hwndLV, 0, &lvC) == -1)
return FALSE;

lvC.iSubItem = 1;
LoadStringW(hInst, IDS_PORT_LENGTH, szText, COUNT_OF(szText));
LoadStringW(hInst, IDS_PORT_LENGTH, szText, ARRAY_SIZE(szText));
if (ListView_InsertColumn(hwndLV, 1, &lvC) == -1)
return FALSE;

lvC.iSubItem = 2;
lvC.cx = (rc.right - rc.left) - 2 * width;
LoadStringW(hInst, IDS_PORT_ACCESS, szText, COUNT_OF(szText));
LoadStringW(hInst, IDS_PORT_ACCESS, szText, ARRAY_SIZE(szText));
if (ListView_InsertColumn(hwndLV, 2, &lvC) == -1)
return FALSE;

Expand All @@ -555,18 +555,18 @@ static BOOL CreateResourceColumns(HWND hwnd)
/* Load the column labels from the resource file. */
lvC.iSubItem = 0;
lvC.cx = width;
LoadStringW(hInst, IDS_SPECIFIC_RESERVED1, szText, COUNT_OF(szText));
LoadStringW(hInst, IDS_SPECIFIC_RESERVED1, szText, ARRAY_SIZE(szText));
if (ListView_InsertColumn(hwndLV, 0, &lvC) == -1)
return FALSE;

lvC.iSubItem = 1;
LoadStringW(hInst, IDS_SPECIFIC_RESERVED2, szText, COUNT_OF(szText));
LoadStringW(hInst, IDS_SPECIFIC_RESERVED2, szText, ARRAY_SIZE(szText));
if (ListView_InsertColumn(hwndLV, 1, &lvC) == -1)
return FALSE;

lvC.iSubItem = 2;
lvC.cx = (rc.right - rc.left) - 2 * width;
LoadStringW(hInst, IDS_SPECIFIC_DATASIZE, szText, COUNT_OF(szText));
LoadStringW(hInst, IDS_SPECIFIC_DATASIZE, szText, ARRAY_SIZE(szText));
if (ListView_InsertColumn(hwndLV, 2, &lvC) == -1)
return FALSE;

Expand Down Expand Up @@ -725,9 +725,9 @@ ParseResources(HWND hwnd)
ListView_SetItemText(hwndLV, iItem, 1, buffer);

if (pDescriptor->Flags & CM_RESOURCE_PORT_IO)
LoadStringW(hInst, IDS_PORT_PORT_IO, buffer, COUNT_OF(buffer));
LoadStringW(hInst, IDS_PORT_PORT_IO, buffer, ARRAY_SIZE(buffer));
else
LoadStringW(hInst, IDS_PORT_MEMORY_IO, buffer, COUNT_OF(buffer));
LoadStringW(hInst, IDS_PORT_MEMORY_IO, buffer, ARRAY_SIZE(buffer));
ListView_SetItemText(hwndLV, iItem, 2, buffer);
}
break;
Expand Down Expand Up @@ -756,9 +756,9 @@ ParseResources(HWND hwnd)
ListView_SetItemText(hwndLV, iItem, 2, buffer);

if (pDescriptor->Flags & CM_RESOURCE_INTERRUPT_LATCHED)
LoadStringW(hInst, IDS_INTERRUPT_EDGE_SENSITIVE, buffer, COUNT_OF(buffer));
LoadStringW(hInst, IDS_INTERRUPT_EDGE_SENSITIVE, buffer, ARRAY_SIZE(buffer));
else
LoadStringW(hInst, IDS_INTERRUPT_LEVEL_SENSITIVE, buffer, COUNT_OF(buffer));
LoadStringW(hInst, IDS_INTERRUPT_LEVEL_SENSITIVE, buffer, ARRAY_SIZE(buffer));

ListView_SetItemText(hwndLV, iItem, 3, buffer);
}
Expand Down Expand Up @@ -791,15 +791,15 @@ ParseResources(HWND hwnd)
switch (pDescriptor->Flags & (CM_RESOURCE_MEMORY_READ_ONLY | CM_RESOURCE_MEMORY_WRITE_ONLY))
{
case CM_RESOURCE_MEMORY_READ_ONLY:
LoadStringW(hInst, IDS_MEMORY_READ_ONLY, buffer, COUNT_OF(buffer));
LoadStringW(hInst, IDS_MEMORY_READ_ONLY, buffer, ARRAY_SIZE(buffer));
break;

case CM_RESOURCE_MEMORY_WRITE_ONLY:
LoadStringW(hInst, IDS_MEMORY_WRITE_ONLY, buffer, COUNT_OF(buffer));
LoadStringW(hInst, IDS_MEMORY_WRITE_ONLY, buffer, ARRAY_SIZE(buffer));
break;

default:
LoadStringW(hInst, IDS_MEMORY_READ_WRITE, buffer, COUNT_OF(buffer));
LoadStringW(hInst, IDS_MEMORY_READ_WRITE, buffer, ARRAY_SIZE(buffer));
break;
}

Expand Down Expand Up @@ -961,13 +961,13 @@ static BOOL CreateResourceListColumns(HWND hWndListView)
/* Load the column labels from the resource file. */
lvC.iSubItem = 0;
lvC.cx = (rc.right - rc.left) / 2;
LoadStringW(hInst, IDS_BUSNUMBER, szText, COUNT_OF(szText));
LoadStringW(hInst, IDS_BUSNUMBER, szText, ARRAY_SIZE(szText));
if (ListView_InsertColumn(hWndListView, 0, &lvC) == -1)
return FALSE;

lvC.iSubItem = 1;
lvC.cx = (rc.right - rc.left) - lvC.cx;
LoadStringW(hInst, IDS_INTERFACE, szText, COUNT_OF(szText));
LoadStringW(hInst, IDS_INTERFACE, szText, ARRAY_SIZE(szText));
if (ListView_InsertColumn(hWndListView, 1, &lvC) == -1)
return FALSE;

Expand Down Expand Up @@ -1467,8 +1467,8 @@ BOOL DeleteKey(HWND hwnd, HKEY hKeyRoot, LPCWSTR keyPath)
return FALSE;
}

LoadStringW(hInst, IDS_QUERY_DELETE_KEY_CONFIRM, caption, COUNT_OF(caption));
LoadStringW(hInst, IDS_QUERY_DELETE_KEY_ONE, msg, COUNT_OF(msg));
LoadStringW(hInst, IDS_QUERY_DELETE_KEY_CONFIRM, caption, ARRAY_SIZE(caption));
LoadStringW(hInst, IDS_QUERY_DELETE_KEY_ONE, msg, ARRAY_SIZE(msg));

if (MessageBoxW(g_pChildWnd->hWnd, msg, caption, MB_ICONQUESTION | MB_YESNO) != IDYES)
goto done;
Expand Down

2 comments on commit 36a7f0d

@JoachimHenze
Copy link
Contributor

Choose a reason for hiding this comment

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

This commit did introduce/unhide regression https://jira.reactos.org/browse/CORE-18603

@JoachimHenze
Copy link
Contributor

Choose a reason for hiding this comment

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

Please sign in to comment.