Commit 9b586bc2 authored by Andrew Nguyen's avatar Andrew Nguyen Committed by Alexandre Julliard

regedit: Convert the frame window code to Unicode.

parent 8f0bc1e2
...@@ -105,7 +105,10 @@ static void UpdateMenuItems(HMENU hMenu) { ...@@ -105,7 +105,10 @@ static void UpdateMenuItems(HMENU hMenu) {
BOOL bAllowEdit = FALSE; BOOL bAllowEdit = FALSE;
HKEY hRootKey = NULL; HKEY hRootKey = NULL;
LPWSTR keyName; LPWSTR keyName;
keyName = GetItemPath(hwndTV, TreeView_GetSelection(hwndTV), &hRootKey); HTREEITEM selection;
selection = (HTREEITEM)SendMessageW(hwndTV, TVM_GETNEXTITEM, TVGN_CARET, 0);
keyName = GetItemPath(hwndTV, selection, &hRootKey);
if (GetFocus() != hwndTV || (keyName && *keyName)) { /* can't modify root keys, but allow for their values */ if (GetFocus() != hwndTV || (keyName && *keyName)) { /* can't modify root keys, but allow for their values */
bAllowEdit = TRUE; bAllowEdit = TRUE;
} }
...@@ -327,10 +330,12 @@ static BOOL InitOpenFileName(HWND hWnd, OPENFILENAMEW *pofn) ...@@ -327,10 +330,12 @@ static BOOL InitOpenFileName(HWND hWnd, OPENFILENAMEW *pofn)
return TRUE; return TRUE;
} }
static BOOL import_registry_filename(LPTSTR filename) static BOOL import_registry_filename(LPWSTR filename)
{ {
static const WCHAR mode_r[] = {'r',0};
BOOL Success; BOOL Success;
FILE* reg_file = fopen(filename, "r"); FILE* reg_file = _wfopen(filename, mode_r);
if(!reg_file) if(!reg_file)
return FALSE; return FALSE;
...@@ -353,13 +358,8 @@ static BOOL ImportRegistryFile(HWND hWnd) ...@@ -353,13 +358,8 @@ static BOOL ImportRegistryFile(HWND hWnd)
LoadStringW(hInst, IDS_FILEDIALOG_IMPORT_TITLE, title, COUNT_OF(title)); LoadStringW(hInst, IDS_FILEDIALOG_IMPORT_TITLE, title, COUNT_OF(title));
ofn.lpstrTitle = title; ofn.lpstrTitle = title;
if (GetOpenFileNameW(&ofn)) { if (GetOpenFileNameW(&ofn)) {
CHAR* fileA = GetMultiByteString(ofn.lpstrFile); if (!import_registry_filename(ofn.lpstrFile))
if (!import_registry_filename(fileA)) {
/*printf("Can't open file \"%s\"\n", ofn.lpstrFile);*/
HeapFree(GetProcessHeap(), 0, fileA);
return FALSE; return FALSE;
}
HeapFree(GetProcessHeap(), 0, fileA);
} else { } else {
CheckCommDlgError(hWnd); CheckCommDlgError(hWnd);
} }
...@@ -397,8 +397,8 @@ static BOOL PrintRegistryHive(HWND hWnd, LPCWSTR path) ...@@ -397,8 +397,8 @@ static BOOL PrintRegistryHive(HWND hWnd, LPCWSTR path)
#if 1 #if 1
PRINTDLGW pd; PRINTDLGW pd;
ZeroMemory(&pd, sizeof(PRINTDLG)); ZeroMemory(&pd, sizeof(PRINTDLGW));
pd.lStructSize = sizeof(PRINTDLG); pd.lStructSize = sizeof(PRINTDLGW);
pd.hwndOwner = hWnd; pd.hwndOwner = hWnd;
pd.hDevMode = NULL; /* Don't forget to free or store hDevMode*/ pd.hDevMode = NULL; /* Don't forget to free or store hDevMode*/
pd.hDevNames = NULL; /* Don't forget to free or store hDevNames*/ pd.hDevNames = NULL; /* Don't forget to free or store hDevNames*/
...@@ -555,7 +555,7 @@ static INT_PTR CALLBACK addtofavorites_dlgproc(HWND hwndDlg, UINT uMsg, WPARAM w ...@@ -555,7 +555,7 @@ static INT_PTR CALLBACK addtofavorites_dlgproc(HWND hwndDlg, UINT uMsg, WPARAM w
switch(LOWORD(wParam)) { switch(LOWORD(wParam)) {
case IDC_VALUE_NAME: case IDC_VALUE_NAME:
if (HIWORD(wParam) == EN_UPDATE) { if (HIWORD(wParam) == EN_UPDATE) {
EnableWindow(GetDlgItem(hwndDlg, IDOK), GetWindowTextLength(hwndValue)>0); EnableWindow(GetDlgItem(hwndDlg, IDOK), GetWindowTextLengthW(hwndValue) > 0);
return TRUE; return TRUE;
} }
break; break;
...@@ -696,11 +696,11 @@ static BOOL _CmdWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) ...@@ -696,11 +696,11 @@ static BOOL _CmdWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
HeapFree(GetProcessHeap(), 0, keyPath); HeapFree(GetProcessHeap(), 0, keyPath);
} else if (hWndDelete == g_pChildWnd->hListWnd) { } else if (hWndDelete == g_pChildWnd->hListWnd) {
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 = SendMessageW(g_pChildWnd->hListWnd, LVM_GETNEXTITEM, -1, MAKELPARAM(LVNI_SELECTED, 0));
while(curIndex != -1) { while(curIndex != -1) {
WCHAR* valueName = GetItemText(g_pChildWnd->hListWnd, curIndex); WCHAR* valueName = GetItemText(g_pChildWnd->hListWnd, curIndex);
curIndex = ListView_GetNextItem(g_pChildWnd->hListWnd, curIndex, LVNI_SELECTED); curIndex = SendMessageW(g_pChildWnd->hListWnd, LVM_GETNEXTITEM, curIndex, MAKELPARAM(LVNI_SELECTED, 0));
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),
MAKEINTRESOURCEW(IDS_DELETE_BOX_TITLE), MAKEINTRESOURCEW(IDS_DELETE_BOX_TITLE),
...@@ -720,7 +720,7 @@ static BOOL _CmdWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) ...@@ -720,7 +720,7 @@ static BOOL _CmdWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
HeapFree(GetProcessHeap(), 0, keyPath); HeapFree(GetProcessHeap(), 0, keyPath);
} else if (IsChild(g_pChildWnd->hTreeWnd, hWndDelete) || } else if (IsChild(g_pChildWnd->hTreeWnd, hWndDelete) ||
IsChild(g_pChildWnd->hListWnd, hWndDelete)) { IsChild(g_pChildWnd->hListWnd, hWndDelete)) {
SendMessage(hWndDelete, WM_KEYDOWN, VK_DELETE, 0); SendMessageW(hWndDelete, WM_KEYDOWN, VK_DELETE, 0);
} }
break; break;
} }
...@@ -738,14 +738,14 @@ static BOOL _CmdWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) ...@@ -738,14 +738,14 @@ static BOOL _CmdWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
{ {
HTREEITEM hItem; HTREEITEM hItem;
if (LOWORD(wParam) == ID_EDIT_FIND && if (LOWORD(wParam) == ID_EDIT_FIND &&
DialogBox(0, MAKEINTRESOURCE(IDD_FIND), hWnd, find_dlgproc) != IDOK) DialogBoxW(0, MAKEINTRESOURCEW(IDD_FIND), hWnd, find_dlgproc) != IDOK)
break; break;
if (!*searchString) if (!*searchString)
break; break;
hItem = TreeView_GetSelection(g_pChildWnd->hTreeWnd); hItem = (HTREEITEM)SendMessageW(g_pChildWnd->hTreeWnd, TVM_GETNEXTITEM, TVGN_CARET, 0);
if (hItem) { if (hItem) {
int row = ListView_GetNextItem(g_pChildWnd->hListWnd, -1, LVNI_FOCUSED); int row = SendMessageW(g_pChildWnd->hListWnd, LVM_GETNEXTITEM, -1, MAKELPARAM(LVNI_FOCUSED, 0));
HCURSOR hcursorOld = SetCursor(LoadCursor(NULL, IDC_WAIT)); HCURSOR hcursorOld = SetCursor(LoadCursorW(NULL, (LPCWSTR)IDC_WAIT));
hItem = FindNext(g_pChildWnd->hTreeWnd, hItem, searchString, searchMask, &row); hItem = FindNext(g_pChildWnd->hTreeWnd, hItem, searchString, searchMask, &row);
SetCursor(hcursorOld); SetCursor(hcursorOld);
if (hItem) { if (hItem) {
...@@ -753,8 +753,15 @@ static BOOL _CmdWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) ...@@ -753,8 +753,15 @@ static BOOL _CmdWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
InvalidateRect(g_pChildWnd->hTreeWnd, NULL, TRUE); InvalidateRect(g_pChildWnd->hTreeWnd, NULL, TRUE);
UpdateWindow(g_pChildWnd->hTreeWnd); UpdateWindow(g_pChildWnd->hTreeWnd);
if (row != -1) { if (row != -1) {
ListView_SetItemState(g_pChildWnd->hListWnd, -1, 0, LVIS_FOCUSED|LVIS_SELECTED); LVITEMW item;
ListView_SetItemState(g_pChildWnd->hListWnd, row, LVIS_FOCUSED|LVIS_SELECTED, LVIS_FOCUSED|LVIS_SELECTED);
item.state = 0;
item.stateMask = LVIS_FOCUSED | LVIS_SELECTED;
SendMessageW(g_pChildWnd->hListWnd, LVM_SETITEMSTATE, (UINT)-1, (LPARAM)&item);
item.state = LVIS_FOCUSED | LVIS_SELECTED;
item.stateMask = LVIS_FOCUSED | LVIS_SELECTED;
SendMessageW(g_pChildWnd->hListWnd, LVM_SETITEMSTATE, row, (LPARAM)&item);
SetFocus(g_pChildWnd->hListWnd); SetFocus(g_pChildWnd->hListWnd);
} else { } else {
SetFocus(g_pChildWnd->hTreeWnd); SetFocus(g_pChildWnd->hTreeWnd);
...@@ -840,7 +847,7 @@ static BOOL _CmdWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) ...@@ -840,7 +847,7 @@ static BOOL _CmdWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
HKEY hKey; HKEY hKey;
LPWSTR lpKeyPath = GetItemFullPath(g_pChildWnd->hTreeWnd, NULL, FALSE); LPWSTR lpKeyPath = GetItemFullPath(g_pChildWnd->hTreeWnd, NULL, FALSE);
if (lpKeyPath) { if (lpKeyPath) {
if (DialogBox(0, MAKEINTRESOURCE(IDD_ADDFAVORITE), hWnd, addtofavorites_dlgproc) == IDOK) { if (DialogBoxW(0, MAKEINTRESOURCEW(IDD_ADDFAVORITE), hWnd, addtofavorites_dlgproc) == IDOK) {
if (RegCreateKeyExW(HKEY_CURRENT_USER, favoritesKey, if (RegCreateKeyExW(HKEY_CURRENT_USER, favoritesKey,
0, NULL, 0, 0, NULL, 0,
KEY_READ|KEY_WRITE, NULL, &hKey, NULL) == ERROR_SUCCESS) { KEY_READ|KEY_WRITE, NULL, &hKey, NULL) == ERROR_SUCCESS) {
...@@ -854,7 +861,7 @@ static BOOL _CmdWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) ...@@ -854,7 +861,7 @@ static BOOL _CmdWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
} }
case ID_FAVORITES_REMOVEFAVORITE: case ID_FAVORITES_REMOVEFAVORITE:
{ {
if (DialogBox(0, MAKEINTRESOURCE(IDD_DELFAVORITE), hWnd, removefavorite_dlgproc) == IDOK) { if (DialogBoxW(0, MAKEINTRESOURCEW(IDD_DELFAVORITE), hWnd, removefavorite_dlgproc) == IDOK) {
HKEY hKey; HKEY hKey;
if (RegOpenKeyExW(HKEY_CURRENT_USER, favoritesKey, if (RegOpenKeyExW(HKEY_CURRENT_USER, favoritesKey,
0, KEY_READ|KEY_WRITE, &hKey) == ERROR_SUCCESS) { 0, KEY_READ|KEY_WRITE, &hKey) == ERROR_SUCCESS) {
...@@ -896,7 +903,7 @@ static BOOL _CmdWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) ...@@ -896,7 +903,7 @@ static BOOL _CmdWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
pts = pt; pts = pt;
if(ClientToScreen(g_pChildWnd->hWnd, &pts)) { if(ClientToScreen(g_pChildWnd->hWnd, &pts)) {
SetCursorPos(pts.x, pts.y); SetCursorPos(pts.x, pts.y);
SetCursor(LoadCursor(0, IDC_SIZEWE)); SetCursor(LoadCursorW(0, (LPCWSTR)IDC_SIZEWE));
SendMessageW(g_pChildWnd->hWnd, WM_LBUTTONDOWN, 0, MAKELPARAM(pt.x, pt.y)); SendMessageW(g_pChildWnd->hWnd, WM_LBUTTONDOWN, 0, MAKELPARAM(pt.x, pt.y));
} }
return TRUE; return TRUE;
......
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