Author: hbelusca Date: Tue Jan 1 19:38:47 2013 New Revision: 58090
URL: http://svn.reactos.org/svn/reactos?rev=58090&view=rev Log: [REGEDIT] - Revert lstrcpynW --> wcsncpy changes from r57471 back to lstrcpynW because this function automatically NULL-terminate strings (but I wonder if there is a replacement of lstrcpynW which has all its functionalities, in the CRT). This fixes address loading after editing it in the address bar. Caught by Edijus ;) - Unicodize a little bit more regedit.
Modified: trunk/reactos/base/applications/regedit/childwnd.c trunk/reactos/base/applications/regedit/edit.c trunk/reactos/base/applications/regedit/find.c trunk/reactos/base/applications/regedit/framewnd.c trunk/reactos/base/applications/regedit/listview.c trunk/reactos/base/applications/regedit/treeview.c
Modified: trunk/reactos/base/applications/regedit/childwnd.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/regedit/c... ============================================================================== --- trunk/reactos/base/applications/regedit/childwnd.c [iso-8859-1] (original) +++ trunk/reactos/base/applications/regedit/childwnd.c [iso-8859-1] Tue Jan 1 19:38:47 2013 @@ -236,16 +236,16 @@ { /* Sanity check this key; it cannot be empty, nor can it be a * loop back */ - if ((szBuffer[0] != L'\0') && wcsicmp(szBuffer, pszKeyPath)) + if ((szBuffer[0] != L'\0') && _wcsicmp(szBuffer, pszKeyPath)) { if (RegOpenKeyW(hRootKey, szBuffer, &hOtherKey) == ERROR_SUCCESS) { - wcsncpy(pszSuggestions, L"HKCR\", (int) iSuggestionsLength); + lstrcpynW(pszSuggestions, L"HKCR\", (int) iSuggestionsLength); i = wcslen(pszSuggestions); pszSuggestions += i; iSuggestionsLength -= i;
- wcsncpy(pszSuggestions, szBuffer, (int) iSuggestionsLength); + lstrcpynW(pszSuggestions, szBuffer, (int) iSuggestionsLength); i = MIN(wcslen(pszSuggestions) + 1, iSuggestionsLength); pszSuggestions += i; iSuggestionsLength -= i; @@ -266,12 +266,12 @@ if (QueryStringValue(hSubKey, L"CLSID", NULL, szBuffer, COUNT_OF(szBuffer)) == ERROR_SUCCESS) { - wcsncpy(pszSuggestions, L"HKCR\CLSID\", (int)iSuggestionsLength); + lstrcpynW(pszSuggestions, L"HKCR\CLSID\", (int)iSuggestionsLength); i = wcslen(pszSuggestions); pszSuggestions += i; iSuggestionsLength -= i;
- wcsncpy(pszSuggestions, szBuffer, (int)iSuggestionsLength); + lstrcpynW(pszSuggestions, szBuffer, (int)iSuggestionsLength); i = MIN(wcslen(pszSuggestions) + 1, iSuggestionsLength); pszSuggestions += i; iSuggestionsLength -= i; @@ -286,7 +286,7 @@ { WNDPROC oldwndproc; static WCHAR s_szNode[256]; - oldwndproc = (WNDPROC)(LONG_PTR)GetWindowLongPtr(hwnd, GWL_USERDATA); + oldwndproc = (WNDPROC)(LONG_PTR)GetWindowLongPtr(hwnd, GWLP_USERDATA);
switch (uMsg) { @@ -300,7 +300,7 @@ default: break; } - return CallWindowProc(oldwndproc, hwnd, uMsg, wParam, lParam); + return CallWindowProcW(oldwndproc, hwnd, uMsg, wParam, lParam); }
static VOID @@ -333,8 +333,8 @@ EnableMenuItem(GetSubMenu(hMenuFrame,0), ID_REGISTRY_LOADHIVE, MF_BYCOMMAND | MF_GRAYED); EnableMenuItem(GetSubMenu(hMenuFrame,0), ID_REGISTRY_UNLOADHIVE, MF_BYCOMMAND | MF_GRAYED); /* compare the strings to see if we should enable/disable the "Load Hive" menus accordingly */ - if (!(wcsicmp(rootName, L"HKEY_LOCAL_MACHINE") && - wcsicmp(rootName, L"HKEY_USERS"))) + if (!(_wcsicmp(rootName, L"HKEY_LOCAL_MACHINE") && + _wcsicmp(rootName, L"HKEY_USERS"))) { /* * enable the unload menu item if at the root, otherwise @@ -406,9 +406,9 @@ 0); } /* Subclass the AddressBar */ - oldproc = (WNDPROC)(LONG_PTR)GetWindowLongPtr(g_pChildWnd->hAddressBarWnd, GWL_WNDPROC); - SetWindowLongPtr(g_pChildWnd->hAddressBarWnd, GWL_USERDATA, (DWORD_PTR)oldproc); - SetWindowLongPtr(g_pChildWnd->hAddressBarWnd, GWL_WNDPROC, (DWORD_PTR)AddressBarProc); + oldproc = (WNDPROC)(LONG_PTR)GetWindowLongPtr(g_pChildWnd->hAddressBarWnd, GWLP_WNDPROC); + SetWindowLongPtr(g_pChildWnd->hAddressBarWnd, GWLP_USERDATA, (DWORD_PTR)oldproc); + SetWindowLongPtr(g_pChildWnd->hAddressBarWnd, GWLP_WNDPROC, (DWORD_PTR)AddressBarProc); break; } case WM_COMMAND: @@ -660,8 +660,8 @@ { TVHITTESTINFO hti; HMENU hContextMenu; - TVITEM item; - MENUITEMINFO mii; + TVITEMW item; + MENUITEMINFOW mii; WCHAR resource[256]; WCHAR buffer[256]; LPWSTR s;
Modified: trunk/reactos/base/applications/regedit/edit.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/regedit/e... ============================================================================== --- trunk/reactos/base/applications/regedit/edit.c [iso-8859-1] (original) +++ trunk/reactos/base/applications/regedit/edit.c [iso-8859-1] Tue Jan 1 19:38:47 2013 @@ -230,7 +230,7 @@ { WNDPROC oldwndproc;
- oldwndproc = (WNDPROC)(LONG_PTR)GetWindowLongPtr(hwnd, GWL_USERDATA); + oldwndproc = (WNDPROC)(LONG_PTR)GetWindowLongPtr(hwnd, GWLP_USERDATA);
switch (uMsg) { @@ -263,7 +263,7 @@ } }
- return CallWindowProc(oldwndproc, hwnd, uMsg, wParam, lParam); + return CallWindowProcW(oldwndproc, hwnd, uMsg, wParam, lParam); }
@@ -285,9 +285,9 @@
/* subclass the edit control */ hwndValue = GetDlgItem(hwndDlg, IDC_VALUE_DATA); - oldproc = (WNDPROC)(LONG_PTR)GetWindowLongPtr(hwndValue, GWL_WNDPROC); - SetWindowLongPtr(hwndValue, GWL_USERDATA, (DWORD_PTR)oldproc); - SetWindowLongPtr(hwndValue, GWL_WNDPROC, (DWORD_PTR)DwordEditSubclassProc); + oldproc = (WNDPROC)(LONG_PTR)GetWindowLongPtr(hwndValue, GWLP_WNDPROC); + SetWindowLongPtr(hwndValue, GWLP_USERDATA, (DWORD_PTR)oldproc); + SetWindowLongPtr(hwndValue, GWLP_WNDPROC, (DWORD_PTR)DwordEditSubclassProc);
if (editValueName && wcscmp(editValueName, L"")) { @@ -665,7 +665,7 @@ HWND hwndLV;
WCHAR buffer[80]; - LVITEM item; + LVITEMW item; INT iItem;
pFullDescriptor = &resourceValueData->List[fullResourceIndex]; @@ -866,7 +866,7 @@ if (lpnmlv->iItem != -1) { PCM_PARTIAL_RESOURCE_DESCRIPTOR pDescriptor; - LVITEM item; + LVITEMW item;
item.mask = LVIF_PARAM; item.iItem = lpnmlv->iItem; @@ -968,7 +968,7 @@ { PCM_FULL_RESOURCE_DESCRIPTOR pFullDescriptor; WCHAR buffer[80]; - LVITEM item; + LVITEMW item; ULONG i; INT iItem;
Modified: trunk/reactos/base/applications/regedit/find.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/regedit/f... ============================================================================== --- trunk/reactos/base/applications/regedit/find.c [iso-8859-1] (original) +++ trunk/reactos/base/applications/regedit/find.c [iso-8859-1] Tue Jan 1 19:38:47 2013 @@ -77,7 +77,7 @@ if (s_dwFlags & RSF_MATCHCASE) return wcscmp(pszName1, pszName2) == 0; else - return wcsicmp(pszName1, pszName2) == 0; + return _wcsicmp(pszName1, pszName2) == 0; } else { @@ -130,7 +130,7 @@ { const LPCWSTR *a = (const LPCWSTR *)x; const LPCWSTR *b = (const LPCWSTR *)y; - return wcsicmp(*a, *b); + return _wcsicmp(*a, *b); }
BOOL RegFindRecurse( @@ -198,7 +198,7 @@ if (DoEvents()) goto err;
- if (!fPast && wcsicmp(ppszNames[i], pszValueName) == 0) + if (!fPast && _wcsicmp(ppszNames[i], pszValueName) == 0) { fPast = TRUE; continue; @@ -390,7 +390,7 @@ } else { - wcsncpy(szKeyName, pch + 1, MAX_PATH); + lstrcpynW(szKeyName, pch + 1, MAX_PATH); *pch = 0; lResult = RegOpenKeyExW(hBaseKey, szSubKey, 0, KEY_ALL_ACCESS, &hSubKey); @@ -434,7 +434,7 @@ if (DoEvents()) goto err;
- if (!fPast && wcsicmp(ppszNames[i], szKeyName) == 0) + if (!fPast && _wcsicmp(ppszNames[i], szKeyName) == 0) { fPast = TRUE; continue;
Modified: trunk/reactos/base/applications/regedit/framewnd.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/regedit/f... ============================================================================== --- trunk/reactos/base/applications/regedit/framewnd.c [iso-8859-1] (original) +++ trunk/reactos/base/applications/regedit/framewnd.c [iso-8859-1] Tue Jan 1 19:38:47 2013 @@ -453,7 +453,7 @@ { /* Look at the extension of the file to determine its type */ if (ofn.nFileExtension >= 1 && - wcsicmp(ofn.lpstrFile + ofn.nFileExtension, L"reg") == 0) /* REGEDIT4 or Windows Registry Editor Version 5.00 */ + _wcsicmp(ofn.lpstrFile + ofn.nFileExtension, L"reg") == 0) /* REGEDIT4 or Windows Registry Editor Version 5.00 */ { /* Open the file */ FILE* fp = _wfopen(ofn.lpstrFile, L"r"); @@ -1249,7 +1249,7 @@ if ((LOWORD(wParam) >= ID_FAVORITES_MIN) && (LOWORD(wParam) <= ID_FAVORITES_MAX)) { HMENU hMenu; - MENUITEMINFO mii; + MENUITEMINFOW mii; WCHAR szFavorite[512];
hMenu = GetSubMenu(GetMenu(hWnd), FAVORITES_MENU_POSITION);
Modified: trunk/reactos/base/applications/regedit/listview.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/regedit/l... ============================================================================== --- trunk/reactos/base/applications/regedit/listview.c [iso-8859-1] (original) +++ trunk/reactos/base/applications/regedit/listview.c [iso-8859-1] Tue Jan 1 19:38:47 2013 @@ -56,7 +56,7 @@ LPCWSTR GetValueName(HWND hwndLV, int iStartAt) { int item; - LVITEM LVItem; + LVITEMW LVItem; PLINE_INFO lineinfo;
/* @@ -108,7 +108,7 @@ BOOL IsDefaultValue(HWND hwndLV, int i) { PLINE_INFO lineinfo; - LVITEM Item; + LVITEMW Item;
Item.mask = LVIF_PARAM; Item.iItem = i; @@ -126,7 +126,7 @@ static void AddEntryToList(HWND hwndLV, LPWSTR Name, DWORD dwValType, void* ValBuf, DWORD dwCount, int Position, BOOL ValExists) { PLINE_INFO linfo; - LVITEM item; + LVITEMW item; int index;
linfo = (PLINE_INFO)HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(LINE_INFO) + dwCount); @@ -654,7 +654,7 @@ void DestroyListView(HWND hwndLV) { INT count, i; - LVITEM item; + LVITEMW item;
count = ListView_GetItemCount(hwndLV); for (i = 0; i < count; i++)
Modified: trunk/reactos/base/applications/regedit/treeview.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/regedit/t... ============================================================================== --- trunk/reactos/base/applications/regedit/treeview.c [iso-8859-1] (original) +++ trunk/reactos/base/applications/regedit/treeview.c [iso-8859-1] Tue Jan 1 19:38:47 2013 @@ -34,7 +34,7 @@
static BOOL get_item_path(HWND hwndTV, HTREEITEM hItem, HKEY* phKey, LPWSTR* pKeyPath, int* pPathLen, int* pMaxLen) { - TVITEM item; + TVITEMW item; size_t maxLen, len; LPWSTR newStr;
@@ -109,8 +109,8 @@ /* Add an entry to the tree. Only give hKey for root nodes (HKEY_ constants) */ static HTREEITEM AddEntryToTree(HWND hwndTV, HTREEITEM hParent, LPWSTR label, HKEY hKey, DWORD dwChildren) { - TVITEM tvi; - TVINSERTSTRUCT tvins; + TVITEMW tvi; + TVINSERTSTRUCTW tvins;
if (hKey) { @@ -140,7 +140,7 @@ LPCWSTR KeyPath; DWORD dwCount, dwIndex, dwMaxSubKeyLen; LPWSTR Name = NULL; - TVITEM tvItem; + TVITEMW tvItem; LPWSTR pszNodes = NULL; BOOL bSuccess = FALSE; LPWSTR s; @@ -332,7 +332,7 @@ { WCHAR buf[MAX_NEW_KEY_LEN]; HTREEITEM hNewItem = 0; - TVITEMEX item; + TVITEMEXW item;
/* Default to the current selection */ if (!hItem) @@ -390,8 +390,8 @@
static BOOL InitTreeViewItems(HWND hwndTV, LPWSTR pHostName) { - TVITEM tvi; - TVINSERTSTRUCT tvins; + TVITEMW tvi; + TVINSERTSTRUCTW tvins; HTREEITEM hRoot;
tvi.mask = TVIF_TEXT | TVIF_IMAGE | TVIF_SELECTEDIMAGE | TVIF_CHILDREN | TVIF_PARAM; @@ -664,7 +664,7 @@ WCHAR szPathPart[128]; WCHAR szBuffer[128]; LPCWSTR s; - TVITEM tvi; + TVITEMW tvi;
/* Load "My Computer" string... */ LoadStringW(hInst, IDS_MY_COMPUTER, szBuffer, COUNT_OF(szBuffer)); @@ -683,22 +683,22 @@ while(keyPath[0]) { s = wcschr(keyPath, L'\'); - wcsncpy(szPathPart, keyPath, s ? s - keyPath + 1 : wcslen(keyPath) + 1); + lstrcpynW(szPathPart, keyPath, s ? s - keyPath + 1 : wcslen(keyPath) + 1);
/* Special case for root to expand root key abbreviations */ if (hItem == hRoot) { - if (!wcsicmp(szPathPart, L"HKCR")) + if (!_wcsicmp(szPathPart, L"HKCR")) wcscpy(szPathPart, L"HKEY_CLASSES_ROOT"); - else if (!wcsicmp(szPathPart, L"HKCU")) + else if (!_wcsicmp(szPathPart, L"HKCU")) wcscpy(szPathPart, L"HKEY_CURRENT_USER"); - else if (!wcsicmp(szPathPart, L"HKLM")) + else if (!_wcsicmp(szPathPart, L"HKLM")) wcscpy(szPathPart, L"HKEY_LOCAL_MACHINE"); - else if (!wcsicmp(szPathPart, L"HKU")) + else if (!_wcsicmp(szPathPart, L"HKU")) wcscpy(szPathPart, L"HKEY_USERS"); - else if (!wcsicmp(szPathPart, L"HKCC")) + else if (!_wcsicmp(szPathPart, L"HKCC")) wcscpy(szPathPart, L"HKEY_CURRENT_CONFIG"); - else if (!wcsicmp(szPathPart, L"HKDD")) + else if (!_wcsicmp(szPathPart, L"HKDD")) wcscpy(szPathPart, L"HKEY_DYN_DATA"); }
@@ -713,7 +713,7 @@
(void)TreeView_GetItem(hwndTV, &tvi);
- if (!wcsicmp(szBuffer, szPathPart)) + if (!_wcsicmp(szBuffer, szPathPart)) break; }