Commit 0035421e authored by Alexander Nicolaysen Sørnes's avatar Alexander Nicolaysen Sørnes Committed by Alexandre Julliard

regedit: Remove an ANSI function.

parent d2664e0f
...@@ -639,7 +639,6 @@ static INT_PTR CALLBACK removefavorite_dlgproc(HWND hwndDlg, UINT uMsg, WPARAM w ...@@ -639,7 +639,6 @@ static INT_PTR CALLBACK removefavorite_dlgproc(HWND hwndDlg, UINT uMsg, WPARAM w
static BOOL _CmdWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) static BOOL _CmdWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
{ {
HKEY hKeyRoot = 0; HKEY hKeyRoot = 0;
LPCTSTR valueName;
DWORD valueType; DWORD valueType;
int curIndex; int curIndex;
BOOL firstItem = TRUE; BOOL firstItem = TRUE;
...@@ -693,9 +692,8 @@ static BOOL _CmdWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) ...@@ -693,9 +692,8 @@ static BOOL _CmdWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
WCHAR* keyPath = GetItemPath(g_pChildWnd->hTreeWnd, 0, &hKeyRoot); WCHAR* keyPath = GetItemPath(g_pChildWnd->hTreeWnd, 0, &hKeyRoot);
curIndex = ListView_GetNextItem(g_pChildWnd->hListWnd, -1, LVNI_SELECTED); curIndex = ListView_GetNextItem(g_pChildWnd->hListWnd, -1, LVNI_SELECTED);
while(curIndex != -1) { while(curIndex != -1) {
WCHAR* valueNameW; WCHAR* valueName = GetItemText(g_pChildWnd->hListWnd, curIndex);
valueName = GetItemText(g_pChildWnd->hListWnd, curIndex);
curIndex = ListView_GetNextItem(g_pChildWnd->hListWnd, curIndex, LVNI_SELECTED); curIndex = ListView_GetNextItem(g_pChildWnd->hListWnd, curIndex, LVNI_SELECTED);
if(curIndex != -1 && firstItem) { if(curIndex != -1 && firstItem) {
if (MessageBoxW(hWnd, MAKEINTRESOURCEW(IDS_DELETE_BOX_TEXT_MULTIPLE), if (MessageBoxW(hWnd, MAKEINTRESOURCEW(IDS_DELETE_BOX_TEXT_MULTIPLE),
...@@ -703,14 +701,14 @@ static BOOL _CmdWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) ...@@ -703,14 +701,14 @@ static BOOL _CmdWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
MB_YESNO | MB_ICONEXCLAMATION) != IDYES) MB_YESNO | MB_ICONEXCLAMATION) != IDYES)
break; break;
} }
valueNameW = GetWideString(valueName);
if (!DeleteValue(hWnd, hKeyRoot, keyPath, valueNameW, curIndex==-1 && firstItem)) if (!DeleteValue(hWnd, hKeyRoot, keyPath, valueName, curIndex==-1 && firstItem))
{ {
HeapFree(GetProcessHeap(), 0, valueNameW); HeapFree(GetProcessHeap(), 0, valueName);
break; break;
} }
firstItem = FALSE; firstItem = FALSE;
HeapFree(GetProcessHeap(), 0, valueNameW); HeapFree(GetProcessHeap(), 0, valueName);
} }
RefreshListView(g_pChildWnd->hListWnd, hKeyRoot, keyPath, NULL); RefreshListView(g_pChildWnd->hListWnd, hKeyRoot, keyPath, NULL);
HeapFree(GetProcessHeap(), 0, keyPath); HeapFree(GetProcessHeap(), 0, keyPath);
......
...@@ -22,11 +22,9 @@ ...@@ -22,11 +22,9 @@
#include <windows.h> #include <windows.h>
#include <commctrl.h> #include <commctrl.h>
#include <stdlib.h> #include <stdlib.h>
#include <tchar.h>
#include <stdio.h> #include <stdio.h>
#include "main.h" #include "main.h"
#include "regproc.h"
#include "wine/unicode.h" #include "wine/unicode.h"
static INT Image_String; static INT Image_String;
...@@ -56,30 +54,7 @@ static WCHAR g_szValueNotSet[64]; ...@@ -56,30 +54,7 @@ static WCHAR g_szValueNotSet[64];
static int default_column_widths[MAX_LIST_COLUMNS] = { 200, 175, 400 }; static int default_column_widths[MAX_LIST_COLUMNS] = { 200, 175, 400 };
static int column_alignment[MAX_LIST_COLUMNS] = { LVCFMT_LEFT, LVCFMT_LEFT, LVCFMT_LEFT }; static int column_alignment[MAX_LIST_COLUMNS] = { LVCFMT_LEFT, LVCFMT_LEFT, LVCFMT_LEFT };
LPTSTR GetItemText(HWND hwndLV, UINT item) LPWSTR GetItemText(HWND hwndLV, UINT item)
{
LPTSTR newStr, curStr;
unsigned int maxLen = 128;
curStr = HeapAlloc(GetProcessHeap(), 0, maxLen);
if (!curStr) return NULL;
if (item == 0) { /* first item is ALWAYS a default */
HeapFree(GetProcessHeap(), 0, curStr);
return NULL;
}
do {
ListView_GetItemText(hwndLV, item, 0, curStr, maxLen);
if (_tcslen(curStr) < maxLen - 1) return curStr;
newStr = HeapReAlloc(GetProcessHeap(), 0, curStr, maxLen * 2);
if (!newStr) break;
curStr = newStr;
maxLen *= 2;
} while (TRUE);
HeapFree(GetProcessHeap(), 0, curStr);
return NULL;
}
LPWSTR GetItemTextW(HWND hwndLV, UINT item)
{ {
LPWSTR newStr, curStr; LPWSTR newStr, curStr;
unsigned int maxLen = 128; unsigned int maxLen = 128;
...@@ -113,7 +88,7 @@ LPCWSTR GetValueName(HWND hwndLV) ...@@ -113,7 +88,7 @@ LPCWSTR GetValueName(HWND hwndLV)
item = ListView_GetNextItem(hwndLV, -1, LVNI_FOCUSED); item = ListView_GetNextItem(hwndLV, -1, LVNI_FOCUSED);
if (item == -1) return NULL; if (item == -1) return NULL;
g_valueName = GetItemTextW(hwndLV, item); g_valueName = GetItemText(hwndLV, item);
return g_valueName; return g_valueName;
} }
...@@ -422,7 +397,7 @@ static LRESULT CALLBACK ListWndProc(HWND hWnd, UINT message, WPARAM wParam, LPAR ...@@ -422,7 +397,7 @@ static LRESULT CALLBACK ListWndProc(HWND hWnd, UINT message, WPARAM wParam, LPAR
break; break;
case LVN_ENDLABELEDITW: { case LVN_ENDLABELEDITW: {
LPNMLVDISPINFOW dispInfo = (LPNMLVDISPINFOW)lParam; LPNMLVDISPINFOW dispInfo = (LPNMLVDISPINFOW)lParam;
LPWSTR oldName = GetItemTextW(hWnd, dispInfo->item.iItem); LPWSTR oldName = GetItemText(hWnd, dispInfo->item.iItem);
LONG ret; LONG ret;
if (!oldName) return -1; /* cannot rename a default value */ if (!oldName) return -1; /* cannot rename a default value */
ret = RenameValue(hWnd, g_currentRootKey, g_currentPath, oldName, dispInfo->item.pszText); ret = RenameValue(hWnd, g_currentRootKey, g_currentPath, oldName, dispInfo->item.pszText);
......
...@@ -120,7 +120,7 @@ extern void UpdateStatusBar(void); ...@@ -120,7 +120,7 @@ extern void UpdateStatusBar(void);
extern HWND CreateListView(HWND hwndParent, UINT id); extern HWND CreateListView(HWND hwndParent, UINT id);
extern BOOL RefreshListView(HWND hwndLV, HKEY hKeyRoot, LPCWSTR keyPath, LPCWSTR highlightValue); extern BOOL RefreshListView(HWND hwndLV, HKEY hKeyRoot, LPCWSTR keyPath, LPCWSTR highlightValue);
extern HWND StartValueRename(HWND hwndLV); extern HWND StartValueRename(HWND hwndLV);
extern LPTSTR GetItemText(HWND hwndLV, UINT item); extern LPWSTR GetItemText(HWND hwndLV, UINT item);
extern LPCWSTR GetValueName(HWND hwndLV); extern LPCWSTR GetValueName(HWND hwndLV);
extern BOOL ListWndNotifyProc(HWND hWnd, WPARAM wParam, LPARAM lParam, BOOL *Result); extern BOOL ListWndNotifyProc(HWND hWnd, WPARAM wParam, LPARAM lParam, BOOL *Result);
extern BOOL IsDefaultValue(HWND hwndLV, int i); extern BOOL IsDefaultValue(HWND hwndLV, int i);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment