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
static BOOL _CmdWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
{
HKEY hKeyRoot = 0;
LPCTSTR valueName;
DWORD valueType;
int curIndex;
BOOL firstItem = TRUE;
......@@ -693,9 +692,8 @@ static BOOL _CmdWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
WCHAR* keyPath = GetItemPath(g_pChildWnd->hTreeWnd, 0, &hKeyRoot);
curIndex = ListView_GetNextItem(g_pChildWnd->hListWnd, -1, LVNI_SELECTED);
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);
if(curIndex != -1 && firstItem) {
if (MessageBoxW(hWnd, MAKEINTRESOURCEW(IDS_DELETE_BOX_TEXT_MULTIPLE),
......@@ -703,14 +701,14 @@ static BOOL _CmdWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
MB_YESNO | MB_ICONEXCLAMATION) != IDYES)
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;
}
firstItem = FALSE;
HeapFree(GetProcessHeap(), 0, valueNameW);
HeapFree(GetProcessHeap(), 0, valueName);
}
RefreshListView(g_pChildWnd->hListWnd, hKeyRoot, keyPath, NULL);
HeapFree(GetProcessHeap(), 0, keyPath);
......
......@@ -22,11 +22,9 @@
#include <windows.h>
#include <commctrl.h>
#include <stdlib.h>
#include <tchar.h>
#include <stdio.h>
#include "main.h"
#include "regproc.h"
#include "wine/unicode.h"
static INT Image_String;
......@@ -56,30 +54,7 @@ static WCHAR g_szValueNotSet[64];
static int default_column_widths[MAX_LIST_COLUMNS] = { 200, 175, 400 };
static int column_alignment[MAX_LIST_COLUMNS] = { LVCFMT_LEFT, LVCFMT_LEFT, LVCFMT_LEFT };
LPTSTR 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 GetItemText(HWND hwndLV, UINT item)
{
LPWSTR newStr, curStr;
unsigned int maxLen = 128;
......@@ -113,7 +88,7 @@ LPCWSTR GetValueName(HWND hwndLV)
item = ListView_GetNextItem(hwndLV, -1, LVNI_FOCUSED);
if (item == -1) return NULL;
g_valueName = GetItemTextW(hwndLV, item);
g_valueName = GetItemText(hwndLV, item);
return g_valueName;
}
......@@ -422,7 +397,7 @@ static LRESULT CALLBACK ListWndProc(HWND hWnd, UINT message, WPARAM wParam, LPAR
break;
case LVN_ENDLABELEDITW: {
LPNMLVDISPINFOW dispInfo = (LPNMLVDISPINFOW)lParam;
LPWSTR oldName = GetItemTextW(hWnd, dispInfo->item.iItem);
LPWSTR oldName = GetItemText(hWnd, dispInfo->item.iItem);
LONG ret;
if (!oldName) return -1; /* cannot rename a default value */
ret = RenameValue(hWnd, g_currentRootKey, g_currentPath, oldName, dispInfo->item.pszText);
......
......@@ -120,7 +120,7 @@ extern void UpdateStatusBar(void);
extern HWND CreateListView(HWND hwndParent, UINT id);
extern BOOL RefreshListView(HWND hwndLV, HKEY hKeyRoot, LPCWSTR keyPath, LPCWSTR highlightValue);
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 BOOL ListWndNotifyProc(HWND hWnd, WPARAM wParam, LPARAM lParam, BOOL *Result);
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