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

regedit: Set the unicode flag for the listview.

parent d0991c92
...@@ -165,7 +165,7 @@ static INT_PTR CALLBACK bin_modify_dlgproc(HWND hwndDlg, UINT uMsg, WPARAM wPara ...@@ -165,7 +165,7 @@ static INT_PTR CALLBACK bin_modify_dlgproc(HWND hwndDlg, UINT uMsg, WPARAM wPara
if (params->lpszValueName) if (params->lpszValueName)
SetDlgItemTextW(hwndDlg, IDC_VALUE_NAME, params->lpszValueName); SetDlgItemTextW(hwndDlg, IDC_VALUE_NAME, params->lpszValueName);
else else
SetDlgItemTextW(hwndDlg, IDC_VALUE_NAME, g_pszDefaultValueNameW); SetDlgItemTextW(hwndDlg, IDC_VALUE_NAME, g_pszDefaultValueName);
SendDlgItemMessage(hwndDlg, IDC_VALUE_DATA, HEM_SETDATA, (WPARAM)params->cbData, (LPARAM)params->pData); SendDlgItemMessage(hwndDlg, IDC_VALUE_DATA, HEM_SETDATA, (WPARAM)params->cbData, (LPARAM)params->pData);
return TRUE; return TRUE;
case WM_COMMAND: case WM_COMMAND:
...@@ -299,7 +299,7 @@ BOOL ModifyValue(HWND hwnd, HKEY hKeyRoot, LPCWSTR keyPath, LPCWSTR valueName) ...@@ -299,7 +299,7 @@ BOOL ModifyValue(HWND hwnd, HKEY hKeyRoot, LPCWSTR keyPath, LPCWSTR valueName)
return FALSE; return FALSE;
} }
editValueName = valueName ? valueName : g_pszDefaultValueNameW; editValueName = valueName ? valueName : g_pszDefaultValueName;
if(!(stringValueData = read_value(hwnd, hKey, valueName, &type, &len))) goto done; if(!(stringValueData = read_value(hwnd, hKey, valueName, &type, &len))) goto done;
if ( (type == REG_SZ) || (type == REG_EXPAND_SZ) ) { if ( (type == REG_SZ) || (type == REG_EXPAND_SZ) ) {
...@@ -428,7 +428,7 @@ BOOL DeleteValue(HWND hwnd, HKEY hKeyRoot, LPCWSTR keyPath, LPCWSTR valueName, B ...@@ -428,7 +428,7 @@ BOOL DeleteValue(HWND hwnd, HKEY hKeyRoot, LPCWSTR keyPath, LPCWSTR valueName, B
BOOL result = FALSE; BOOL result = FALSE;
LONG lRet; LONG lRet;
HKEY hKey; HKEY hKey;
LPCWSTR visibleValueName = valueName ? valueName : g_pszDefaultValueNameW; LPCWSTR visibleValueName = valueName ? valueName : g_pszDefaultValueName;
WCHAR empty = 0; WCHAR empty = 0;
lRet = RegOpenKeyExW(hKeyRoot, keyPath, 0, KEY_READ | KEY_SET_VALUE, &hKey); lRet = RegOpenKeyExW(hKeyRoot, keyPath, 0, KEY_READ | KEY_SET_VALUE, &hKey);
......
...@@ -2,6 +2,7 @@ ...@@ -2,6 +2,7 @@
* Regedit listviews * Regedit listviews
* *
* Copyright (C) 2002 Robert Dickenson <robd@reactos.org> * Copyright (C) 2002 Robert Dickenson <robd@reactos.org>
* Copyright (C) 2008 Alexander N. Sørnes <alex@thehandofagony.com>
* *
* This library is free software; you can redistribute it and/or * This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public * modify it under the terms of the GNU Lesser General Public
...@@ -49,8 +50,7 @@ static BOOL g_invertSort = FALSE; ...@@ -49,8 +50,7 @@ static BOOL g_invertSort = FALSE;
static LPWSTR g_valueName; static LPWSTR g_valueName;
static LPWSTR g_currentPath; static LPWSTR g_currentPath;
static HKEY g_currentRootKey; static HKEY g_currentRootKey;
static WCHAR g_szValueNotSetW[64]; static WCHAR g_szValueNotSet[64];
static TCHAR g_szValueNotSet[64];
#define MAX_LIST_COLUMNS (IDS_LIST_COLUMN_LAST - IDS_LIST_COLUMN_FIRST + 1) #define MAX_LIST_COLUMNS (IDS_LIST_COLUMN_LAST - IDS_LIST_COLUMN_FIRST + 1)
static int default_column_widths[MAX_LIST_COLUMNS] = { 200, 175, 400 }; static int default_column_widths[MAX_LIST_COLUMNS] = { 200, 175, 400 };
...@@ -192,7 +192,7 @@ static void AddEntryToList(HWND hwndLV, LPWSTR Name, DWORD dwValType, ...@@ -192,7 +192,7 @@ static void AddEntryToList(HWND hwndLV, LPWSTR Name, DWORD dwValType,
if (ValBuf) { if (ValBuf) {
ListView_SetItemTextW(hwndLV, index, 2, ValBuf); ListView_SetItemTextW(hwndLV, index, 2, ValBuf);
} else { } else {
ListView_SetItemTextW(hwndLV, index, 2, g_szValueNotSetW); ListView_SetItemTextW(hwndLV, index, 2, g_szValueNotSet);
} }
break; break;
case REG_DWORD: { case REG_DWORD: {
...@@ -280,10 +280,10 @@ static BOOL CreateListColumns(HWND hWndListView) ...@@ -280,10 +280,10 @@ static BOOL CreateListColumns(HWND hWndListView)
/* OnGetDispInfo - processes the LVN_GETDISPINFO notification message. */ /* OnGetDispInfo - processes the LVN_GETDISPINFO notification message. */
static void OnGetDispInfo(NMLVDISPINFO* plvdi) static void OnGetDispInfo(NMLVDISPINFOW* plvdi)
{ {
static TCHAR buffer[200]; static WCHAR buffer[200];
static TCHAR reg_szT[] = {'R','E','G','_','S','Z',0}, static WCHAR reg_szT[] = {'R','E','G','_','S','Z',0},
reg_expand_szT[] = {'R','E','G','_','E','X','P','A','N','D','_','S','Z',0}, reg_expand_szT[] = {'R','E','G','_','E','X','P','A','N','D','_','S','Z',0},
reg_binaryT[] = {'R','E','G','_','B','I','N','A','R','Y',0}, reg_binaryT[] = {'R','E','G','_','B','I','N','A','R','Y',0},
reg_dwordT[] = {'R','E','G','_','D','W','O','R','D',0}, reg_dwordT[] = {'R','E','G','_','D','W','O','R','D',0},
...@@ -300,7 +300,7 @@ static void OnGetDispInfo(NMLVDISPINFO* plvdi) ...@@ -300,7 +300,7 @@ static void OnGetDispInfo(NMLVDISPINFO* plvdi)
switch (plvdi->item.iSubItem) { switch (plvdi->item.iSubItem) {
case 0: case 0:
plvdi->item.pszText = (LPSTR)g_pszDefaultValueName; plvdi->item.pszText = g_pszDefaultValueName;
break; break;
case 1: case 1:
switch (((LINE_INFO*)plvdi->item.lParam)->dwValType) { switch (((LINE_INFO*)plvdi->item.lParam)->dwValType) {
...@@ -333,9 +333,9 @@ static void OnGetDispInfo(NMLVDISPINFO* plvdi) ...@@ -333,9 +333,9 @@ static void OnGetDispInfo(NMLVDISPINFO* plvdi)
break; break;
default: default:
{ {
TCHAR szUnknownFmt[64]; WCHAR szUnknownFmt[64];
LoadString(hInst, IDS_REGISTRY_UNKNOWN_TYPE, szUnknownFmt, COUNT_OF(szUnknownFmt)); LoadStringW(hInst, IDS_REGISTRY_UNKNOWN_TYPE, szUnknownFmt, COUNT_OF(szUnknownFmt));
wsprintf(buffer, szUnknownFmt, plvdi->item.lParam); wsprintfW(buffer, szUnknownFmt, plvdi->item.lParam);
plvdi->item.pszText = buffer; plvdi->item.pszText = buffer;
break; break;
} }
...@@ -403,12 +403,12 @@ static LRESULT CALLBACK ListWndProc(HWND hWnd, UINT message, WPARAM wParam, LPAR ...@@ -403,12 +403,12 @@ static LRESULT CALLBACK ListWndProc(HWND hWnd, UINT message, WPARAM wParam, LPAR
case WM_NOTIFY_REFLECT: case WM_NOTIFY_REFLECT:
switch (((LPNMHDR)lParam)->code) { switch (((LPNMHDR)lParam)->code) {
case LVN_BEGINLABELEDIT: case LVN_BEGINLABELEDITW:
if (!((NMLVDISPINFO *)lParam)->item.iItem) if (!((NMLVDISPINFOW *)lParam)->item.iItem)
return 1; return 1;
return 0; return 0;
case LVN_GETDISPINFO: case LVN_GETDISPINFOW:
OnGetDispInfo((NMLVDISPINFO*)lParam); OnGetDispInfo((NMLVDISPINFOW*)lParam);
break; break;
case LVN_COLUMNCLICK: case LVN_COLUMNCLICK:
if (g_columnToSort == ((LPNMLISTVIEW)lParam)->iSubItem) if (g_columnToSort == ((LPNMLISTVIEW)lParam)->iSubItem)
...@@ -418,20 +418,18 @@ static LRESULT CALLBACK ListWndProc(HWND hWnd, UINT message, WPARAM wParam, LPAR ...@@ -418,20 +418,18 @@ static LRESULT CALLBACK ListWndProc(HWND hWnd, UINT message, WPARAM wParam, LPAR
g_invertSort = FALSE; g_invertSort = FALSE;
} }
SendMessage(hWnd, LVM_SORTITEMS, (WPARAM)hWnd, (LPARAM)CompareFunc); SendMessageW(hWnd, LVM_SORTITEMS, (WPARAM)hWnd, (LPARAM)CompareFunc);
break; break;
case LVN_ENDLABELEDIT: { case LVN_ENDLABELEDITW: {
LPNMLVDISPINFO dispInfo = (LPNMLVDISPINFO)lParam; LPNMLVDISPINFOW dispInfo = (LPNMLVDISPINFOW)lParam;
LPWSTR oldName = GetItemTextW(hWnd, dispInfo->item.iItem); LPWSTR oldName = GetItemTextW(hWnd, dispInfo->item.iItem);
WCHAR* newName = GetWideString(dispInfo->item.pszText);
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, newName); ret = RenameValue(hWnd, g_currentRootKey, g_currentPath, oldName, dispInfo->item.pszText);
if (ret) if (ret)
{ {
RefreshListView(hWnd, g_currentRootKey, g_currentPath, newName); RefreshListView(hWnd, g_currentRootKey, g_currentPath, dispInfo->item.pszText);
} }
HeapFree(GetProcessHeap(), 0, newName);
HeapFree(GetProcessHeap(), 0, oldName); HeapFree(GetProcessHeap(), 0, oldName);
return 0; return 0;
} }
...@@ -496,8 +494,7 @@ HWND CreateListView(HWND hwndParent, UINT id) ...@@ -496,8 +494,7 @@ HWND CreateListView(HWND hwndParent, UINT id)
WCHAR ListView[] = {'L','i','s','t',' ','V','i','e','w',0}; WCHAR ListView[] = {'L','i','s','t',' ','V','i','e','w',0};
/* prepare strings */ /* prepare strings */
LoadString(hInst, IDS_REGISTRY_VALUE_NOT_SET, g_szValueNotSet, COUNT_OF(g_szValueNotSet)); LoadStringW(hInst, IDS_REGISTRY_VALUE_NOT_SET, g_szValueNotSet, COUNT_OF(g_szValueNotSet));
LoadStringW(hInst, IDS_REGISTRY_VALUE_NOT_SET, g_szValueNotSetW, COUNT_OF(g_szValueNotSetW));
/* Get the dimensions of the parent window's client area, and create the list view control. */ /* Get the dimensions of the parent window's client area, and create the list view control. */
GetClientRect(hwndParent, &rcClient); GetClientRect(hwndParent, &rcClient);
...@@ -506,6 +503,7 @@ HWND CreateListView(HWND hwndParent, UINT id) ...@@ -506,6 +503,7 @@ HWND CreateListView(HWND hwndParent, UINT id)
0, 0, rcClient.right, rcClient.bottom, 0, 0, rcClient.right, rcClient.bottom,
hwndParent, (HMENU)ULongToHandle(id), hInst, NULL); hwndParent, (HMENU)ULongToHandle(id), hInst, NULL);
if (!hwndLV) return NULL; if (!hwndLV) return NULL;
SendMessageW(hwndLV, LVM_SETUNICODEFORMAT, TRUE, 0);
SendMessageW(hwndLV, LVM_SETEXTENDEDLISTVIEWSTYLE, 0, LVS_EX_FULLROWSELECT); SendMessageW(hwndLV, LVM_SETEXTENDEDLISTVIEWSTYLE, 0, LVS_EX_FULLROWSELECT);
/* Initialize the image list */ /* Initialize the image list */
......
...@@ -29,8 +29,7 @@ ...@@ -29,8 +29,7 @@
#define REGEDIT_DECLARE_FUNCTIONS #define REGEDIT_DECLARE_FUNCTIONS
#include "main.h" #include "main.h"
TCHAR g_pszDefaultValueName[64]; WCHAR g_pszDefaultValueName[64];
WCHAR g_pszDefaultValueNameW[64];
BOOL ProcessCmdLine(LPSTR lpCmdLine); BOOL ProcessCmdLine(LPSTR lpCmdLine);
...@@ -183,8 +182,7 @@ int APIENTRY WinMain(HINSTANCE hInstance, ...@@ -183,8 +182,7 @@ int APIENTRY WinMain(HINSTANCE hInstance,
/* Initialize global strings */ /* Initialize global strings */
LoadString(hInstance, IDS_APP_TITLE, szTitle, COUNT_OF(szTitle)); LoadString(hInstance, IDS_APP_TITLE, szTitle, COUNT_OF(szTitle));
LoadString(hInstance, IDS_REGISTRY_DEFAULT_VALUE, g_pszDefaultValueName, COUNT_OF(g_pszDefaultValueName)); LoadStringW(hInstance, IDS_REGISTRY_DEFAULT_VALUE, g_pszDefaultValueName, COUNT_OF(g_pszDefaultValueName));
LoadStringW(hInstance, IDS_REGISTRY_DEFAULT_VALUE, g_pszDefaultValueNameW, COUNT_OF(g_pszDefaultValueNameW));
/* Store instance handle in our global variable */ /* Store instance handle in our global variable */
hInst = hInstance; hInst = hInstance;
......
...@@ -90,8 +90,7 @@ extern enum OPTION_FLAGS Options; ...@@ -90,8 +90,7 @@ extern enum OPTION_FLAGS Options;
extern TCHAR szTitle[]; extern TCHAR szTitle[];
extern const TCHAR szFrameClass[]; extern const TCHAR szFrameClass[];
extern const TCHAR szChildClass[]; extern const TCHAR szChildClass[];
extern TCHAR g_pszDefaultValueName[]; extern WCHAR g_pszDefaultValueName[];
extern WCHAR g_pszDefaultValueNameW[];
/* Registry class names and their indexes */ /* Registry class names and their indexes */
extern const WCHAR* reg_class_namesW[]; extern const WCHAR* reg_class_namesW[];
......
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