From f4629b559998f2f98e2bb90ec7a32c9fb24bc192 Mon Sep 17 00:00:00 2001 From: Robert Dickenson Date: Sat, 20 Jul 2002 16:29:26 +0000 Subject: [PATCH] Updated with latest progress. How does one read a default registry value??? svn path=/trunk/; revision=3273 --- rosapps/regedit/Makefile | 10 +- rosapps/regedit/childwnd.c | 26 +-- rosapps/regedit/framewnd.c | 52 +---- rosapps/regedit/listview.c | 132 +++++------ rosapps/regedit/main.c | 26 +-- rosapps/regedit/main.h | 48 ++-- rosapps/regedit/regedit.rc | 19 +- rosapps/regedit/resource.h | 3 +- rosapps/regedit/treeview.c | 11 +- rosapps/regedt32/Makefile | 24 +- rosapps/regedt32/childwnd.c | 186 ++++++++++------ rosapps/regedt32/childwnd.h | 8 +- rosapps/regedt32/framewnd.c | 292 ++++++++++++++++++++----- rosapps/regedt32/framewnd.h | 12 +- rosapps/regedt32/listview.c | 364 +++++++++++++++++++++++++++++++ rosapps/regedt32/listview.h | 43 ++++ rosapps/regedt32/main.c | 57 ++--- rosapps/regedt32/main.h | 54 ++++- rosapps/regedt32/regedt32.rc | 82 ++++++- rosapps/regedt32/res/folder1.bmp | Bin 0 -> 246 bytes rosapps/regedt32/res/folder2.bmp | Bin 0 -> 246 bytes rosapps/regedt32/res/folder3.bmp | Bin 0 -> 246 bytes rosapps/regedt32/resource.h | 66 +++--- rosapps/regedt32/settings.c | 126 +++++++++++ rosapps/regedt32/settings.h | 43 ++++ rosapps/regedt32/treeview.c | 259 ++++++++++++++++++++++ rosapps/regedt32/treeview.h | 44 ++++ 27 files changed, 1564 insertions(+), 423 deletions(-) create mode 100644 rosapps/regedt32/listview.c create mode 100644 rosapps/regedt32/listview.h create mode 100644 rosapps/regedt32/res/folder1.bmp create mode 100644 rosapps/regedt32/res/folder2.bmp create mode 100644 rosapps/regedt32/res/folder3.bmp create mode 100644 rosapps/regedt32/settings.c create mode 100644 rosapps/regedt32/settings.h create mode 100644 rosapps/regedt32/treeview.c create mode 100644 rosapps/regedt32/treeview.h diff --git a/rosapps/regedit/Makefile b/rosapps/regedit/Makefile index 56d3f066183..111fb0c4604 100644 --- a/rosapps/regedit/Makefile +++ b/rosapps/regedit/Makefile @@ -29,11 +29,11 @@ BASE_CFLAGS = -DGCC -D_WIN32_IE=0x0400 RCFLAGS = -DGCC -D_WIN32_IE=0x0400 -OBJS = about.o \ - framewnd.o \ +OBJS = framewnd.o \ childwnd.o \ listview.o \ treeview.o \ + about.o \ trace.o \ main.o @@ -50,16 +50,18 @@ $(TARGET).exe: $(OBJS) $(TARGET).coff main.h: resource.h -about.o: about.c about.h main.h - main.o: main.c main.h framewnd.h framewnd.o: framewnd.c framewnd.h listview.h treeview.h main.h +childwnd.o: childwnd.c childwnd.h main.h + listview.o: listview.c listview.h main.h treeview.o: treeview.c treeview.h main.h +about.o: about.c about.h main.h + debug.o: debug.c debug.h main.h diff --git a/rosapps/regedit/childwnd.c b/rosapps/regedit/childwnd.c index 2495f76a68f..213b5e9d8d4 100644 --- a/rosapps/regedit/childwnd.c +++ b/rosapps/regedit/childwnd.c @@ -45,6 +45,8 @@ //////////////////////////////////////////////////////////////////////////////// +// Local module support methods +// static void MakeFullRegPath(HWND hwndTV, HTREEITEM hItem, LPTSTR keyPath, int* pPathLen, int max) { @@ -87,17 +89,10 @@ static void ResizeWnd(ChildWnd* pChildWnd, int cx, int cy) cx = pChildWnd->nSplitPos + SPLIT_WIDTH/2; DeferWindowPos(hdwp, pChildWnd->hTreeWnd, 0, rt.left, rt.top, pChildWnd->nSplitPos-SPLIT_WIDTH/2-rt.left, rt.bottom-rt.top, SWP_NOZORDER|SWP_NOACTIVATE); - DeferWindowPos(hdwp, pChildWnd->hListWnd, 0, rt.left+cx+1, rt.top, rt.right-cx, rt.bottom-rt.top, SWP_NOZORDER|SWP_NOACTIVATE); + DeferWindowPos(hdwp, pChildWnd->hListWnd, 0, rt.left+cx , rt.top, rt.right-cx, rt.bottom-rt.top, SWP_NOZORDER|SWP_NOACTIVATE); EndDeferWindowPos(hdwp); } -static void OnSize(ChildWnd* pChildWnd, WPARAM wParam, LPARAM lParam) -{ - if (wParam != SIZE_MINIMIZED && pChildWnd != NULL) { - ResizeWnd(pChildWnd, LOWORD(lParam), HIWORD(lParam)); - } -} - static void OnPaint(HWND hWnd) { PAINTSTRUCT ps; @@ -110,7 +105,6 @@ static void OnPaint(HWND hWnd) EndPaint(hWnd, &ps); } - //////////////////////////////////////////////////////////////////////////////// // // FUNCTION: _CmdWndProc(HWND, unsigned, WORD, LONG) @@ -157,12 +151,12 @@ LRESULT CALLBACK ChildWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lPa pChildWnd = (ChildWnd*)((LPCREATESTRUCT)lParam)->lpCreateParams; ASSERT(pChildWnd); pChildWnd->nSplitPos = 250; - pChildWnd->hTreeWnd = CreateTreeView(hWnd, pChildWnd->root.path, TREE_WINDOW); - pChildWnd->hListWnd = CreateListView(hWnd, LIST_WINDOW/*, &pChildWnd->root*/); + pChildWnd->hTreeWnd = CreateTreeView(hWnd, pChildWnd->szPath, TREE_WINDOW); + pChildWnd->hListWnd = CreateListView(hWnd, LIST_WINDOW/*, pChildWnd->szPath*/); break; case WM_COMMAND: if (!_CmdWndProc(hWnd, message, wParam, lParam)) { - return DefWindowProc(hWnd, message, wParam, lParam); + goto def; } break; case WM_PAINT: @@ -179,8 +173,6 @@ LRESULT CALLBACK ChildWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lPa } } goto def; - //break; - case WM_DESTROY: PostQuitMessage(0); break; @@ -264,7 +256,6 @@ LRESULT CALLBACK ChildWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lPa int keyPathLen = 0; keyPath[0] = _T('\0'); hKey = FindRegRoot(pChildWnd->hTreeWnd, ((NMTREEVIEW*)lParam)->itemNew.hItem, keyPath, &keyPathLen, sizeof(keyPath)); - //BOOL RefreshListView(HWND hwndTV, HKEY hKey, LPTSTR keyPath) RefreshListView(pChildWnd->hListWnd, hKey, keyPath); keyPathLen = 0; @@ -272,7 +263,6 @@ LRESULT CALLBACK ChildWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lPa MakeFullRegPath(pChildWnd->hTreeWnd, ((NMTREEVIEW*)lParam)->itemNew.hItem, keyPath, &keyPathLen, sizeof(keyPath)); SendMessage(hStatusBar, SB_SETTEXT, 0, (LPARAM)keyPath); } -// RefreshList(pChildWnd->hListWnd, entry); break; default: goto def; @@ -286,8 +276,8 @@ LRESULT CALLBACK ChildWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lPa break; case WM_SIZE: - if (wParam != SIZE_MINIMIZED) { - OnSize(pChildWnd, wParam, lParam); + if (wParam != SIZE_MINIMIZED && pChildWnd != NULL) { + ResizeWnd(pChildWnd, LOWORD(lParam), HIWORD(lParam)); } // fall through default: def: diff --git a/rosapps/regedit/framewnd.c b/rosapps/regedit/framewnd.c index 8477f7dcd93..5290ab65cc6 100644 --- a/rosapps/regedit/framewnd.c +++ b/rosapps/regedit/framewnd.c @@ -43,7 +43,7 @@ //////////////////////////////////////////////////////////////////////////////// -// Globals and Variables: +// Global and Local Variables: // static BOOL bInMenuLoop = FALSE; // Tells us if we are in the menu loop @@ -70,16 +70,9 @@ static void resize_frame_rect(HWND hWnd, PRECT prect) GetClientRect(hStatusBar, &rt); prect->bottom -= rt.bottom; } - MoveWindow(hChildWnd, prect->left-1,prect->top-1,prect->right+2,prect->bottom+1, TRUE); + MoveWindow(hChildWnd, prect->left, prect->top, prect->right, prect->bottom, TRUE); } -/* -static void resize_frame(HWND hWnd, int cx, int cy) -{ - RECT rect = {0, 0, cx, cy}; - resize_frame_rect(hWnd, &rect); -} - */ void resize_frame_client(HWND hWnd) { RECT rect; @@ -88,6 +81,7 @@ void resize_frame_client(HWND hWnd) resize_frame_rect(hWnd, &rect); } +//////////////////////////////////////////////////////////////////////////////// static void OnEnterMenuLoop(HWND hWnd) { @@ -146,10 +140,6 @@ void UpdateStatusBar(void) TCHAR text[260]; DWORD size; -// size = sizeof(text)/sizeof(TCHAR); -// GetUserName(text, &size); -// SendMessage(hStatusBar, SB_SETTEXT, 0, (LPARAM)text); -// SendMessage(hStatusBar, SB_SETTEXT, 0, (LPARAM)_T("")); size = sizeof(text)/sizeof(TCHAR); GetComputerName(text, &size); SendMessage(hStatusBar, SB_SETTEXT, 0, (LPARAM)text); @@ -184,19 +174,6 @@ static BOOL _CmdWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) //PageSetupDlg(&psd); break; case ID_REGISTRY_OPENLOCAL: -/* - { - HWND hChildWnd; -// hChildWnd = CreateWindow(szFrameClass, szTitle, WS_OVERLAPPEDWINDOW | WS_CHILD, -// CW_USEDEFAULT, 0, CW_USEDEFAULT, 0, hWnd, NULL, hInst, NULL); - hChildWnd = CreateWindow(szFrameClass, szTitle, WS_OVERLAPPEDWINDOW | WS_CHILD, - 0, 0, 150, 170, hWnd, NULL, hInst, NULL); - if (hChildWnd) { - ShowWindow(hChildWnd, 1); - UpdateWindow(hChildWnd); - } - } - */ break; case ID_REGISTRY_EXIT: DestroyWindow(hWnd); @@ -234,30 +211,24 @@ static BOOL _CmdWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) // PURPOSE: Processes messages for the main frame window. // // WM_COMMAND - process the application menu -// WM_PAINT - Paint the main window // WM_DESTROY - post a quit message and return // // -static ChildWnd Child; LRESULT CALLBACK FrameWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) { + static ChildWnd* pChildWnd = NULL; switch (message) { case WM_CREATE: { - //Child.root.entry = ; - _tcsncpy(Child.root.path, _T("My Computer"), MAX_PATH); - -// HMENU hMenuWindow = GetSubMenu(hMenuFrame, GetMenuItemCount(hMenuFrame)-2); + pChildWnd = malloc(sizeof(ChildWnd)); + _tcsncpy(pChildWnd->szPath, _T("My Computer"), MAX_PATH); hChildWnd = CreateWindowEx(0, szChildClass, _T("regedit child window"), -// hChildWnd = CreateWindowEx(0, (LPCTSTR)(int)hChildWndClass, _T("regedit child window"), // WS_CHILD|WS_CLIPCHILDREN|WS_VISIBLE|WS_BORDER, - WS_CHILD|WS_VISIBLE|WS_BORDER, + WS_CHILD|WS_VISIBLE | WS_EX_CLIENTEDGE, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, -// hWnd, (HMENU)0, hInst, NULL/*lpParam*/); - hWnd, (HMENU)0, hInst, &Child); - + hWnd, (HMENU)0, hInst, pChildWnd); } break; case WM_COMMAND: @@ -268,11 +239,8 @@ LRESULT CALLBACK FrameWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lPa case WM_SIZE: resize_frame_client(hWnd); break; -// OnSize(wParam, lParam); -// goto def; case WM_TIMER: break; - case WM_ENTERMENULOOP: OnEnterMenuLoop(hWnd); break; @@ -283,6 +251,10 @@ LRESULT CALLBACK FrameWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lPa OnMenuSelect(hWnd, LOWORD(wParam), HIWORD(wParam), (HMENU)lParam); break; case WM_DESTROY: + if (pChildWnd) { + free(pChildWnd); + pChildWnd = NULL; + } WinHelp(hWnd, _T("regedit"), HELP_QUIT, 0); PostQuitMessage(0); default: diff --git a/rosapps/regedit/listview.c b/rosapps/regedit/listview.c index 44405073bf4..d2c5c4b23e6 100644 --- a/rosapps/regedit/listview.c +++ b/rosapps/regedit/listview.c @@ -35,22 +35,20 @@ #endif #include - -#include -#define ASSERT assert #include "main.h" #include "listview.h" -#include "trace.h" - - //////////////////////////////////////////////////////////////////////////////// -// Global Variables: +// Global and Local Variables: // static WNDPROC g_orgListWndProc; +#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 column_alignment[MAX_LIST_COLUMNS] = { LVCFMT_LEFT, LVCFMT_LEFT, LVCFMT_LEFT }; + //////////////////////////////////////////////////////////////////////////////// // Local module support methods @@ -60,8 +58,6 @@ static void AddEntryToList(HWND hwndLV, LPTSTR Name, DWORD dwValType, void* ValB { LVITEM item; - TRACE("AddEntryToList(%s, %d, ...)\n", Name, dwCount); - item.mask = LVIF_TEXT | LVIF_PARAM; item.iItem = 0;//idx; item.iSubItem = 0; @@ -79,11 +75,6 @@ static void AddEntryToList(HWND hwndLV, LPTSTR Name, DWORD dwValType, void* ValB ListView_InsertItem(hwndLV, &item); } - -#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 column_alignment[MAX_LIST_COLUMNS] = { LVCFMT_LEFT, LVCFMT_LEFT, LVCFMT_LEFT }; - static void CreateListColumns(HWND hWndListView) { TCHAR szText[50]; @@ -107,9 +98,7 @@ static void CreateListColumns(HWND hWndListView) } } - -// OnGetDispInfo - processes the LVN_GETDISPINFO -// notification message. +// OnGetDispInfo - processes the LVN_GETDISPINFO notification message. static void OnGetDispInfo(NMLVDISPINFO* plvdi) { @@ -120,8 +109,7 @@ static void OnGetDispInfo(NMLVDISPINFO* plvdi) switch (plvdi->item.iSubItem) { case 0: -// plvdi->item.pszText = pEntry->szName; -// plvdi->item.cchTextMax = lstrlen(pEntry->szName); + plvdi->item.pszText = _T("(Default)"); break; case 1: switch (plvdi->item.lParam) { @@ -149,12 +137,6 @@ static void OnGetDispInfo(NMLVDISPINFO* plvdi) case REG_LINK: plvdi->item.pszText = _T("REG_LINK"); break; -// case REG_QWORD: -// plvdi->item.pszText = _T("REG_QWORD"); -// break; -// case REG_QWORD_LITTLE_ENDIAN: -// plvdi->item.pszText = _T("REG_QWORD_LITTLE_ENDIAN"); -// break; case REG_RESOURCE_LIST: plvdi->item.pszText = _T("REG_RESOURCE_LIST"); break; @@ -162,11 +144,10 @@ static void OnGetDispInfo(NMLVDISPINFO* plvdi) plvdi->item.pszText = _T("REG_NONE"); break; default: - wsprintf(buffer, "unknown(%d)", plvdi->item.lParam); + wsprintf(buffer, _T("unknown(%d)"), plvdi->item.lParam); plvdi->item.pszText = buffer; break; } -// item.lParam = (LPARAM)dwValType; break; case 2: plvdi->item.pszText = _T("(value not set)"); @@ -174,13 +155,23 @@ static void OnGetDispInfo(NMLVDISPINFO* plvdi) case 3: plvdi->item.pszText = _T(""); break; - default: -// _tcscpy(buffer, _T(" ")); -// plvdi->item.pszText = buffer; - break; } } +static int CALLBACK CompareFunc(LPARAM lParam1, LPARAM lParam2, LPARAM lParamSort) +{ + TCHAR buf1[1000]; + TCHAR buf2[1000]; + + ListView_GetItemText((HWND)lParamSort, lParam1, 0, buf1, sizeof(buf1)); + ListView_GetItemText((HWND)lParamSort, lParam2, 0, buf2, sizeof(buf2)); + return _tcscmp(buf1, buf2); +} + +static void ListViewPopUpMenu(HWND hWnd, POINT pt) +{ +} + static BOOL _CmdWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) { switch (LOWORD(wParam)) { @@ -191,10 +182,6 @@ static BOOL _CmdWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) } return TRUE; } -//////////////////////////////////////////////////////////////////////////////// -void ListViewPopUpMenu(HWND hWnd, POINT pt) -{ -} static LRESULT CALLBACK ListWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) { @@ -236,8 +223,6 @@ static LRESULT CALLBACK ListWndProc(HWND hWnd, UINT message, WPARAM wParam, LPAR item.mask = LVIF_PARAM; item.iItem = info.iItem; if (ListView_GetItem(hWnd, &item)) { -// Entry* entry = (Entry*)item.lParam; -// OpenTarget(hWnd, entry->data.cFileName); } } } @@ -247,7 +232,7 @@ static LRESULT CALLBACK ListWndProc(HWND hWnd, UINT message, WPARAM wParam, LPAR { int idx; LV_HITTESTINFO lvH; - NM_LISTVIEW *pNm = (NM_LISTVIEW *)lParam; + NM_LISTVIEW* pNm = (NM_LISTVIEW*)lParam; lvH.pt.x = pNm->ptAction.x; lvH.pt.y = pNm->ptAction.y; idx = ListView_HitTest(hWnd, &lvH); @@ -269,7 +254,7 @@ static LRESULT CALLBACK ListWndProc(HWND hWnd, UINT message, WPARAM wParam, LPAR //TODO: SetFocus(Globals.hDriveBar) //SetFocus(child->nFocusPanel? child->left.hWnd: child->right.hWnd); } - break; + // fall thru... default: return CallWindowProc(g_orgListWndProc, hWnd, message, wParam, lParam); break; @@ -277,27 +262,16 @@ static LRESULT CALLBACK ListWndProc(HWND hWnd, UINT message, WPARAM wParam, LPAR return 0; } -static int CALLBACK CompareFunc(LPARAM lParam1, LPARAM lParam2, LPARAM lParamSort) -{ - TCHAR buf1[1000]; - TCHAR buf2[1000]; - - ListView_GetItemText((HWND)lParamSort, lParam1, 0, buf1, sizeof(buf1)); - ListView_GetItemText((HWND)lParamSort, lParam2, 0, buf2, sizeof(buf2)); - return _tcscmp(buf1, buf2); -} - - HWND CreateListView(HWND hwndParent, int id) { - RECT rcClient; // dimensions of client area - HWND hwndLV; // handle to list view control + RECT rcClient; + HWND hwndLV; // Get the dimensions of the parent window's client area, and create the list view control. GetClientRect(hwndParent, &rcClient); hwndLV = CreateWindowEx(0, WC_LISTVIEW, _T("List View"), - WS_VISIBLE | WS_CHILD | WS_BORDER | LVS_REPORT, + WS_VISIBLE | WS_CHILD | WS_EX_CLIENTEDGE | LVS_REPORT, 0, 0, rcClient.right, rcClient.bottom, hwndParent, (HMENU)id, hInst, NULL); ListView_SetExtendedListViewStyle(hwndLV, LVS_EX_FULLROWSELECT); @@ -305,13 +279,12 @@ HWND CreateListView(HWND hwndParent, int id) // Initialize the image list, and add items to the control. /* if (!InitListViewImageLists(hwndLV) || - !InitListViewItems(hwndLV, lpszPathName)) { + !InitListViewItems(hwndLV, szName)) { DestroyWindow(hwndLV); return FALSE; } */ CreateListColumns(hwndLV); -// SetWindowLong(hwndLV, GWL_USERDATA, (LPARAM)pRoot); g_orgListWndProc = SubclassWindow(hwndLV, ListWndProc); return hwndLV; } @@ -323,8 +296,36 @@ BOOL RefreshListView(HWND hwndLV, HKEY hKey, LPTSTR keyPath) } if (hKey != NULL) { + LONG errCode; HKEY hNewKey; - LONG errCode = RegOpenKeyEx(hKey, keyPath, 0, KEY_READ, &hNewKey); + + + DWORD max_sub_key_len; + DWORD max_val_name_len; + DWORD max_val_size; + DWORD val_count; + errCode = RegQueryInfoKey(hKey, NULL, NULL, NULL, NULL, + &max_sub_key_len, NULL, &val_count, &max_val_name_len, &max_val_size, NULL, NULL); + if (errCode == ERROR_SUCCESS) { + TCHAR* ValName = malloc(++max_val_name_len * sizeof(TCHAR)); + DWORD dwValNameLen = max_val_name_len; + BYTE* ValBuf = malloc(++max_val_size); + DWORD dwValSize = max_val_size; + DWORD dwIndex = 0L; + DWORD dwValType; + while (RegEnumValue(hKey, dwIndex, ValName, &dwValNameLen, NULL, &dwValType, ValBuf, &dwValSize) == ERROR_SUCCESS) { + AddEntryToList(hwndLV, ValName, dwValType, ValBuf, dwIndex); + dwValNameLen = max_val_name_len; + dwValSize = max_val_size; + dwValType = 0L; + ++dwIndex; + } + free(ValBuf); + free(ValName); + } + + + errCode = RegOpenKeyEx(hKey, keyPath, 0, KEY_READ, &hNewKey); if (errCode == ERROR_SUCCESS) { DWORD max_sub_key_len; DWORD max_val_name_len; @@ -337,36 +338,23 @@ BOOL RefreshListView(HWND hwndLV, HKEY hKey, LPTSTR keyPath) if (errCode == ERROR_SUCCESS) { TCHAR* ValName = malloc(++max_val_name_len * sizeof(TCHAR)); DWORD dwValNameLen = max_val_name_len; - TCHAR* ValBuf = malloc(++max_val_size * sizeof(TCHAR)); + BYTE* ValBuf = malloc(++max_val_size); DWORD dwValSize = max_val_size; DWORD dwIndex = 0L; DWORD dwValType; -#if 0 - for (; dwIndex < val_count; dwIndex++) { - if (RegEnumValue(hNewKey, dwIndex, ValName, &dwValNameLen, NULL, &dwValType, ValBuf, &dwValSize) == ERROR_SUCCESS) { - AddEntryToList(hwndLV, ValName, dwValType, ValBuf, dwIndex); - dwValNameLen = max_val_name_len; - dwValSize = max_val_size; - dwValType = 0L; - } - } -#else - //while (RegEnumValue(hNewKey, dwIndex, ValName, &dwValNameLen, NULL, &dwValType, ValBuf, &dwValSize) == ERROR_SUCCESS) { - while (RegEnumValue(hNewKey, dwIndex, ValName, &dwValNameLen, NULL, &dwValType, NULL, NULL) == ERROR_SUCCESS) { + while (RegEnumValue(hNewKey, dwIndex, ValName, &dwValNameLen, NULL, &dwValType, ValBuf, &dwValSize) == ERROR_SUCCESS) { + //while (RegEnumValue(hNewKey, dwIndex, ValName, &dwValNameLen, NULL, &dwValType, NULL, NULL) == ERROR_SUCCESS) { AddEntryToList(hwndLV, ValName, dwValType, ValBuf, dwIndex); dwValNameLen = max_val_name_len; dwValSize = max_val_size; dwValType = 0L; ++dwIndex; } -#endif free(ValBuf); free(ValName); } - //ListView_SortItemsEx(hwndLV, CompareFunc, hwndLV); // SendMessage(hwndLV, LVM_SORTITEMSEX, (WPARAM)CompareFunc, (LPARAM)hwndLV); - ShowWindow(hwndLV, SW_SHOW); RegCloseKey(hNewKey); } diff --git a/rosapps/regedit/main.c b/rosapps/regedit/main.c index 5942e6fa2d5..c0b8ea9b6c1 100644 --- a/rosapps/regedit/main.c +++ b/rosapps/regedit/main.c @@ -101,37 +101,15 @@ BOOL InitInstance(HINSTANCE hInstance, int nCmdShow) GetSystemMetrics(SM_CXSMICON), GetSystemMetrics(SM_CYSMICON), LR_SHARED) }; -// ATOM hChildWndClass = RegisterClassEx(&wcChild); // register child windows class - RegisterClassEx(&wcChild); // register child windows class - -/* - WNDCLASSEX wcex; - wcex.cbSize = sizeof(WNDCLASSEX); - wcex.style = CS_HREDRAW | CS_VREDRAW; - wcex.lpfnWndProc = (WNDPROC)FrameWndProc; - wcex.cbClsExtra = 0; - wcex.cbWndExtra = 0; - wcex.hInstance = hInstance; - wcex.hIcon = LoadIcon(hInstance, (LPCTSTR)IDI_REGEDIT); - wcex.hCursor = LoadCursor(NULL, IDC_ARROW); - wcex.hbrBackground = (HBRUSH)SS_BLACKRECT; -// wcex.lpszMenuName = (LPCSTR)IDC_REGEDIT; - wcex.lpszMenuName = (LPCSTR)IDR_REGEDIT_MENU; - wcex.lpszClassName = szFrameClass; - wcex.hIconSm = LoadIcon((HINSTANCE)wcex.hInstance, (LPCTSTR)IDI_SMALL); - RegisterClassEx(&wcex); - */ + ATOM hChildWndClass = RegisterClassEx(&wcChild); // register child windows class hMenuFrame = LoadMenu(hInstance, MAKEINTRESOURCE(IDR_REGEDIT_MENU)); // Initialize the Windows Common Controls DLL InitCommonControls(); - hInst = hInstance; // Store instance handle in our global variable -// hFrameWnd = CreateWindow(szFrameClass, szTitle, WS_OVERLAPPEDWINDOW, -// CW_USEDEFAULT, 0, CW_USEDEFAULT, 0, NULL, NULL, hInstance, NULL); hFrameWnd = CreateWindowEx(0, (LPCTSTR)(int)hFrameWndClass, szTitle, - WS_OVERLAPPEDWINDOW, + WS_OVERLAPPEDWINDOW | WS_EX_CLIENTEDGE, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, NULL, hMenuFrame, hInstance, NULL/*lpParam*/); diff --git a/rosapps/regedit/main.h b/rosapps/regedit/main.h index c0f9db1f8c9..d956b9ca498 100644 --- a/rosapps/regedit/main.h +++ b/rosapps/regedit/main.h @@ -32,60 +32,48 @@ extern "C" { #endif // _MSC_VER > 1000 #include "resource.h" -//#include "regproc.h" #define STATUS_WINDOW 2001 #define TREE_WINDOW 2002 #define LIST_WINDOW 2003 -#define SPLIT_WINDOW 2004 #define MAX_LOADSTRING 100 -#define SPLIT_WIDTH 3 +#define SPLIT_WIDTH 5 #define MAX_NAME_LEN 500 -//#include "entries.h" -//#if 0 -typedef struct _Entry { - struct _Entry* next; - struct _Entry* down; - struct _Entry* up; - BOOL expanded; - BOOL scanned; - int level; - BOOL bKey; // key or value? - HKEY hKey; -// BOOL bRoot; - HTREEITEM hTreeItem; - TCHAR szName[MAX_NAME_LEN]; -} Entry; - +//////////////////////////////////////////////////////////////////////////////// -typedef struct { - Entry entry; - TCHAR path[MAX_PATH]; -// DWORD _flags; -} Root; +enum OPTION_FLAGS { + OPTIONS_AUTO_REFRESH = 0x01, + OPTIONS_READ_ONLY_MODE = 0x02, + OPTIONS_CONFIRM_ON_DELETE = 0x04, + OPTIONS_SAVE_ON_EXIT = 0x08, + OPTIONS_DISPLAY_BINARY_DATA = 0x10, + OPTIONS_VIEW_TREE_ONLY = 0x20, + OPTIONS_VIEW_DATA_ONLY = 0x40, +}; typedef struct { HWND hWnd; HWND hTreeWnd; HWND hListWnd; int nFocusPanel; // 0: left 1: right - WINDOWPLACEMENT pos; int nSplitPos; - Root root; + WINDOWPLACEMENT pos; + TCHAR szPath[MAX_PATH]; } ChildWnd; -//#endif //////////////////////////////////////////////////////////////////////////////// // Global Variables: // extern HINSTANCE hInst; -extern HWND hFrameWnd; -extern HWND hStatusBar; -extern HMENU hMenuFrame; +extern HWND hFrameWnd; +extern HMENU hMenuFrame; +extern HWND hStatusBar; +extern HFONT hFont; +extern enum OPTION_FLAGS Options; extern TCHAR szTitle[]; extern TCHAR szFrameClass[]; diff --git a/rosapps/regedit/regedit.rc b/rosapps/regedit/regedit.rc index e1c989c2f0e..bcf6f588fa4 100644 --- a/rosapps/regedit/regedit.rc +++ b/rosapps/regedit/regedit.rc @@ -1,3 +1,6 @@ +#include +#include + //Microsoft Developer Studio generated resource script. // #include "resource.h" @@ -173,8 +176,8 @@ END // VS_VERSION_INFO VERSIONINFO - FILEVERSION 1,0,0,1 - PRODUCTVERSION 1,0,0,1 + FILEVERSION RES_UINT_FV_MAJOR,RES_UINT_FV_MINOR,RES_UINT_FV_REVISION,RES_UINT_FV_BUILD + PRODUCTVERSION RES_UINT_PV_MAJOR,RES_UINT_PV_MINOR,RES_UINT_PV_REVISION,RES_UINT_PV_BUILD FILEFLAGSMASK 0x3fL #ifdef _DEBUG FILEFLAGS 0x1L @@ -187,10 +190,10 @@ VS_VERSION_INFO VERSIONINFO BEGIN BLOCK "StringFileInfo" BEGIN - BLOCK "0c0904b0" + BLOCK "040904b0" BEGIN VALUE "Comments", "Absolutely no warranties whatsoever - Use at your own risk\0" - VALUE "CompanyName", "ReactWare\0" + VALUE "CompanyName", RES_STR_COMPANY_NAME VALUE "FileDescription", "ReactOS Registry Editor by Robert Dickenson\0" VALUE "FileVersion", "1, 0, 0, 1\0" VALUE "InternalName", "regedit\0" @@ -198,8 +201,8 @@ BEGIN VALUE "LegalTrademarks", "\0" VALUE "OriginalFilename", "regedit.exe\0" VALUE "PrivateBuild", "\0" - VALUE "ProductName", "ReactOS Registry Editor\0" - VALUE "ProductVersion", "1, 0, 0, 1\0" + VALUE "ProductName", RES_STR_PRODUCT_NAME + VALUE "ProductVersion", RES_STR_PRODUCT_VERSION VALUE "SpecialBuild", "Non-versioned Development Beta Release\0" END END @@ -342,10 +345,6 @@ END STRINGTABLE DISCARDABLE BEGIN ID_HELP_HELPTOPICS "Opens Registry Editor Help." -END - -STRINGTABLE DISCARDABLE -BEGIN ID_HELP_ABOUT "Displays program information, version number, and copyright." END diff --git a/rosapps/regedit/resource.h b/rosapps/regedit/resource.h index 003e9821edb..8400555e1ca 100644 --- a/rosapps/regedit/resource.h +++ b/rosapps/regedit/resource.h @@ -2,6 +2,7 @@ // Microsoft Developer Studio generated include file. // Used by regedit.rc // + #define ID_REGISTRY_MENU 0 #define ID_EDIT_MENU 1 #define ID_VIEW_MENU 2 @@ -28,7 +29,6 @@ #define IDB_ROOT 134 #define ID_REGISTRY_EXIT 32770 -#define ID_HELP_HELPTOPICS 32771 #define ID_FAVOURITES_ADDTOFAVOURITES 32772 #define ID_FAVOURITES_REMOVEFAVOURITE 32773 #define ID_VIEW_STATUSBAR 32774 @@ -49,6 +49,7 @@ #define ID_REGISTRY_CONNECTNETWORKREGISTRY 32791 #define ID_REGISTRY_DISCONNECTNETWORKREGISTRY 32792 #define ID_REGISTRY_PRINT 32793 +#define ID_HELP_HELPTOPICS 32794 #define ID_HELP_ABOUT 32795 #define ID_WINDOW_CASCADE 32797 #define ID_WINDOW_TILE 32798 diff --git a/rosapps/regedit/treeview.c b/rosapps/regedit/treeview.c index 84e97ed084d..69d7b490730 100644 --- a/rosapps/regedit/treeview.c +++ b/rosapps/regedit/treeview.c @@ -34,7 +34,6 @@ #include #endif -//#include #include "main.h" #include "treeview.h" @@ -209,7 +208,7 @@ BOOL OnTreeExpanding(HWND hwndTV, NMTREEVIEW* pnmtv) DWORD cName = MAX_NAME_LEN; FILETIME LastWriteTime; DWORD dwIndex = 0L; - ShowWindow(hwndTV, SW_HIDE); + //ShowWindow(hwndTV, SW_HIDE); while (RegEnumKeyEx(hNewKey, dwIndex, Name, &cName, NULL, NULL, NULL, &LastWriteTime) == ERROR_SUCCESS) { DWORD dwCount = 0L; errCode = RegOpenKeyEx(hNewKey, Name, 0, KEY_READ, &hKey); @@ -226,8 +225,7 @@ BOOL OnTreeExpanding(HWND hwndTV, NMTREEVIEW* pnmtv) cName = MAX_NAME_LEN; ++dwIndex; } - ShowWindow(hwndTV, SW_SHOW); - //UpdateStatus(hwndTV, pnmtv->itemNew.hItem); + //ShowWindow(hwndTV, SW_SHOWNOACTIVATE); RegCloseKey(hNewKey); } } else { @@ -236,8 +234,6 @@ BOOL OnTreeExpanding(HWND hwndTV, NMTREEVIEW* pnmtv) return TRUE; } -//////////////////////////////////////////////////////////////////////////////// - // CreateTreeView - creates a tree view control. // Returns the handle to the new control if successful, or NULL otherwise. // hwndParent - handle to the control's parent window. @@ -250,7 +246,7 @@ HWND CreateTreeView(HWND hwndParent, LPTSTR pHostName, int id) // Get the dimensions of the parent window's client area, and create the tree view control. GetClientRect(hwndParent, &rcClient); hwndTV = CreateWindowEx(0, WC_TREEVIEW, _T("Tree View"), - WS_VISIBLE | WS_CHILD | WS_BORDER | TVS_HASLINES | TVS_HASBUTTONS | TVS_LINESATROOT, + WS_VISIBLE | WS_CHILD | WS_EX_CLIENTEDGE | TVS_HASLINES | TVS_HASBUTTONS | TVS_LINESATROOT, 0, 0, rcClient.right, rcClient.bottom, hwndParent, (HMENU)id, hInst, NULL); // Initialize the image list, and add items to the control. @@ -260,4 +256,3 @@ HWND CreateTreeView(HWND hwndParent, LPTSTR pHostName, int id) } return hwndTV; } - diff --git a/rosapps/regedt32/Makefile b/rosapps/regedt32/Makefile index b02ab95955e..244d1468413 100644 --- a/rosapps/regedt32/Makefile +++ b/rosapps/regedt32/Makefile @@ -30,10 +30,13 @@ RCFLAGS = -DGCC -D_WIN32_IE=0x0400 OBJS = framewnd.o \ - childwnd.o \ - main.o + childwnd.o \ + listview.o \ + treeview.o \ + settings.o \ + main.o -LIBS = -lgdi32 -luser32 -lkernel32 -lcomctl32 +LIBS = -lgdi32 -luser32 -lkernel32 -ladvapi32 -lcomctl32 -lcomdlg32 all: $(TARGET).exe @@ -44,13 +47,20 @@ $(TARGET).exe: $(OBJS) $(TARGET).coff $(NM) --numeric-sort $(TARGET).exe > $(TARGET).sym -main.o: main.c main.h framewnd.h resource.h +main.h: resource.h -framewnd.o: framewnd.c framewnd.h resource.h +main.o: main.c main.h framewnd.h -childwnd.o: childwnd.c childwnd.h resource.h +framewnd.o: framewnd.c framewnd.h listview.h treeview.h main.h + +childwnd.o: childwnd.c childwnd.h main.h + +listview.o: listview.c listview.h main.h + +treeview.o: treeview.c treeview.h main.h + +settings.o: settings.c settings.h main.h -$(TARGET).o: $(TARGET).c $(TARGET).h resource.h clean: - $(RM) $(OBJS) diff --git a/rosapps/regedt32/childwnd.c b/rosapps/regedt32/childwnd.c index 780827e1c46..d3bcaa01ad2 100644 --- a/rosapps/regedt32/childwnd.c +++ b/rosapps/regedt32/childwnd.c @@ -38,9 +38,42 @@ #define ASSERT assert #include "main.h" +#include "framewnd.h" #include "childwnd.h" +#include "treeview.h" +#include "listview.h" +#define COLOR_SPLITBAR LTGRAY_BRUSH //////////////////////////////////////////////////////////////////////////////// +// Global Variables: +// + + +//////////////////////////////////////////////////////////////////////////////// +// Local module support methods +// + +static void MakeFullRegPath(HWND hwndTV, HTREEITEM hItem, LPTSTR keyPath, int* pPathLen, int max) +{ + TVITEM item; + item.mask = TVIF_PARAM; + item.hItem = hItem; + if (TreeView_GetItem(hwndTV, &item)) { + if (item.hItem != TreeView_GetRoot(hwndTV)) { + // recurse + MakeFullRegPath(hwndTV, TreeView_GetParent(hwndTV, hItem), keyPath, pPathLen, max); + keyPath[*pPathLen] = _T('\\'); + ++(*pPathLen); + } + item.mask = TVIF_TEXT; + item.hItem = hItem; + item.pszText = &keyPath[*pPathLen]; + item.cchTextMax = max - *pPathLen; + if (TreeView_GetItem(hwndTV, &item)) { + *pPathLen += _tcslen(item.pszText); + } + } +} static void draw_splitbar(HWND hWnd, int x) { @@ -54,27 +87,57 @@ static void draw_splitbar(HWND hWnd, int x) ReleaseDC(hWnd, hdc); } +static void ResizeWnd(ChildWnd* pChildWnd, int cx, int cy) +{ + HDWP hdwp = BeginDeferWindowPos(2); + RECT rt = {0, 0, cx, cy}; + + cx = pChildWnd->nSplitPos + SPLIT_WIDTH/2; + DeferWindowPos(hdwp, pChildWnd->hTreeWnd, 0, rt.left, rt.top, pChildWnd->nSplitPos-SPLIT_WIDTH/2-rt.left, rt.bottom-rt.top, SWP_NOZORDER|SWP_NOACTIVATE); +// DeferWindowPos(hdwp, pChildWnd->hListWnd, 0, rt.left+cx+1, rt.top, rt.right-cx, rt.bottom-rt.top, SWP_NOZORDER|SWP_NOACTIVATE); + DeferWindowPos(hdwp, pChildWnd->hListWnd, 0, rt.left+cx, rt.top, rt.right-cx, rt.bottom-rt.top, SWP_NOZORDER|SWP_NOACTIVATE); + EndDeferWindowPos(hdwp); +} static void OnPaint(HWND hWnd, ChildWnd* pChildWnd) { - PAINTSTRUCT ps; - RECT rt; - HDC hdc; - - GetClientRect(hWnd, &rt); - hdc = BeginPaint(hWnd, &ps); - FillRect(ps.hdc, &rt, GetStockObject(BLACK_BRUSH)); - EndPaint(hWnd, &ps); + HBRUSH lastBrush; + PAINTSTRUCT ps; + RECT rt; + + BeginPaint(hWnd, &ps); + GetClientRect(hWnd, &rt); + lastBrush = SelectObject(ps.hdc, (HBRUSH)GetStockObject(COLOR_SPLITBAR)); + Rectangle(ps.hdc, rt.left, rt.top-1, rt.right, rt.bottom+1); + SelectObject(ps.hdc, lastBrush); +// rt.top = rt.bottom - GetSystemMetrics(SM_CYHSCROLL); +// FillRect(ps.hdc, &rt, GetStockObject(BLACK_BRUSH)); + EndPaint(hWnd, &ps); } +//////////////////////////////////////////////////////////////////////////////// +// +// FUNCTION: _CmdWndProc(HWND, unsigned, WORD, LONG) +// +// PURPOSE: Processes WM_COMMAND messages for the main frame window. +// +// -static void OnSize(ChildWnd* pChildWnd, WPARAM wParam, LPARAM lParam) +static BOOL _CmdWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) { - if (wParam != SIZE_MINIMIZED) { - //resize_tree(pChildWnd, LOWORD(lParam), HIWORD(lParam)); - } + switch (LOWORD(wParam)) { + // Parse the menu selections: +// case ID_REGISTRY_EXIT: +// DestroyWindow(hWnd); +// break; + default: + return FALSE; + } + return TRUE; } + +//////////////////////////////////////////////////////////////////////////////// // // FUNCTION: ChildWndProc(HWND, unsigned, WORD, LONG) // @@ -92,6 +155,16 @@ LRESULT CALLBACK ChildWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lPa ASSERT(pChildWnd); switch (message) { + case WM_CREATE: + pChildWnd->nSplitPos = 250; + pChildWnd->hTreeWnd = CreateTreeView(hWnd, pChildWnd->szKeyName, pChildWnd->hKey); + pChildWnd->hListWnd = CreateListView(hWnd/*, &pChildWnd->root*/); + break; + case WM_COMMAND: + if (!_CmdWndProc(hWnd, message, wParam, lParam)) { + goto def; + } + break; case WM_PAINT: OnPaint(hWnd, pChildWnd); return 0; @@ -105,57 +178,43 @@ LRESULT CALLBACK ChildWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lPa return TRUE; } } - //goto def; - break; + goto def; - case WM_DESTROY: - PostQuitMessage(0); - break; case WM_LBUTTONDOWN: { RECT rt; int x = LOWORD(lParam); GetClientRect(hWnd, &rt); if (x>=pChildWnd->nSplitPos-SPLIT_WIDTH/2 && xnSplitPos+SPLIT_WIDTH/2+1) { last_split = pChildWnd->nSplitPos; -#ifdef _NO_EXTENSIONS draw_splitbar(hWnd, last_split); -#endif SetCapture(hWnd); } break;} case WM_LBUTTONUP: if (GetCapture() == hWnd) { -#ifdef _NO_EXTENSIONS RECT rt; int x = LOWORD(lParam); draw_splitbar(hWnd, last_split); last_split = -1; GetClientRect(hWnd, &rt); pChildWnd->nSplitPos = x; - //resize_tree(pChildWnd, rt.right, rt.bottom); -#endif + ResizeWnd(pChildWnd, rt.right, rt.bottom); ReleaseCapture(); } break; -#ifdef _NO_EXTENSIONS case WM_CAPTURECHANGED: if (GetCapture()==hWnd && last_split>=0) draw_splitbar(hWnd, last_split); break; -#endif case WM_KEYDOWN: if (wParam == VK_ESCAPE) if (GetCapture() == hWnd) { RECT rt; -#ifdef _NO_EXTENSIONS draw_splitbar(hWnd, last_split); -#else - pChildWnd->nSplitPos = last_split; -#endif GetClientRect(hWnd, &rt); - //resize_tree(pChildWnd, rt.right, rt.bottom); + ResizeWnd(pChildWnd, rt.right, rt.bottom); last_split = -1; ReleaseCapture(); SetCursor(LoadCursor(0, IDC_ARROW)); @@ -166,7 +225,6 @@ LRESULT CALLBACK ChildWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lPa if (GetCapture() == hWnd) { RECT rt; int x = LOWORD(lParam); -#ifdef _NO_EXTENSIONS HDC hdc = GetDC(hWnd); GetClientRect(hWnd, &rt); rt.left = last_split-SPLIT_WIDTH/2; @@ -177,56 +235,50 @@ LRESULT CALLBACK ChildWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lPa rt.right = x+SPLIT_WIDTH/2+1; InvertRect(hdc, &rt); ReleaseDC(hWnd, hdc); -#else - GetClientRect(hWnd, &rt); - if (x>=0 && xnSplitPos = x; - //resize_tree(pChildWnd, rt.right, rt.bottom); - rt.left = x-SPLIT_WIDTH/2; - rt.right = x+SPLIT_WIDTH/2+1; - InvalidateRect(hWnd, &rt, FALSE); - UpdateWindow(pChildWnd->hLeftWnd); - UpdateWindow(hWnd); - UpdateWindow(pChildWnd->hRightWnd); - } -#endif } break; -#ifndef _NO_EXTENSIONS - case WM_GETMINMAXINFO: - DefMDIChildProc(hWnd, message, wParam, lParam); - {LPMINMAXINFO lpmmi = (LPMINMAXINFO)lParam; - lpmmi->ptMaxTrackSize.x <<= 1;//2*GetSystemMetrics(SM_CXSCREEN) / SM_CXVIRTUALSCREEN - lpmmi->ptMaxTrackSize.y <<= 1;//2*GetSystemMetrics(SM_CYSCREEN) / SM_CYVIRTUALSCREEN - break;} -#endif - case WM_SETFOCUS: - SetCurrentDirectory(pChildWnd->szPath); - SetFocus(pChildWnd->nFocusPanel? pChildWnd->hRightWnd: pChildWnd->hLeftWnd); + SetFocus(pChildWnd->nFocusPanel? pChildWnd->hListWnd: pChildWnd->hTreeWnd); break; - case WM_TIMER: - break; + case WM_NOTIFY: + if ((int)wParam == TREE_WINDOW) { + switch (((LPNMHDR)lParam)->code) { + case TVN_ITEMEXPANDING: + return !OnTreeExpanding(pChildWnd->hTreeWnd, (NMTREEVIEW*)lParam); + case TVN_SELCHANGED: + { + HKEY hKey; + TCHAR keyPath[1000]; + int keyPathLen = 0; + keyPath[0] = _T('\0'); + hKey = FindRegRoot(pChildWnd->hTreeWnd, ((NMTREEVIEW*)lParam)->itemNew.hItem, keyPath, &keyPathLen, sizeof(keyPath)); + RefreshListView(pChildWnd->hListWnd, hKey, keyPath); - case WM_COMMAND: - // Parse the menu selections: - switch (LOWORD(wParam)) { - case IDM_EXIT: - DestroyWindow(hWnd); - break; - default: - return DefMDIChildProc(hWnd, message, wParam, lParam); + keyPathLen = 0; + keyPath[0] = _T('\0'); + MakeFullRegPath(pChildWnd->hTreeWnd, ((NMTREEVIEW*)lParam)->itemNew.hItem, keyPath, &keyPathLen, sizeof(keyPath)); + SendMessage(hStatusBar, SB_SETTEXT, 0, (LPARAM)keyPath); + } + break; + default: + goto def; + } + } else + if ((int)wParam == LIST_WINDOW) { + if (!SendMessage(pChildWnd->hListWnd, message, wParam, lParam)) { + goto def; + } } break; case WM_SIZE: - if (wParam != SIZE_MINIMIZED) { - OnSize(pChildWnd, wParam, lParam); + if (wParam != SIZE_MINIMIZED && pChildWnd != NULL) { + ResizeWnd(pChildWnd, LOWORD(lParam), HIWORD(lParam)); } // fall through - default: + default: def: return DefMDIChildProc(hWnd, message, wParam, lParam); } return 0; diff --git a/rosapps/regedt32/childwnd.h b/rosapps/regedt32/childwnd.h index b9e680d6fda..439c0c0ff12 100644 --- a/rosapps/regedt32/childwnd.h +++ b/rosapps/regedt32/childwnd.h @@ -1,5 +1,5 @@ /* - * ReactOS Application MDI Child Window + * ReactOS regedt32 * * childwnd.h * @@ -20,8 +20,8 @@ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ -#ifndef __CHILD_WND_H__ -#define __CHILD_WND_H__ +#ifndef __CHILDWND_H__ +#define __CHILDWND_H__ #ifdef __cplusplus extern "C" { @@ -39,4 +39,4 @@ LRESULT CALLBACK ChildWndProc(HWND, UINT, WPARAM, LPARAM); }; #endif -#endif // __CHILD_WND_H__ +#endif // __CHILDWND_H__ diff --git a/rosapps/regedt32/framewnd.c b/rosapps/regedt32/framewnd.c index 58843e8a4d3..e275a61ce75 100644 --- a/rosapps/regedt32/framewnd.c +++ b/rosapps/regedt32/framewnd.c @@ -41,18 +41,56 @@ //////////////////////////////////////////////////////////////////////////////// -// Globals and Variables: +// Global and Local Variables: // +enum OPTION_FLAGS Options; BOOL bInMenuLoop = FALSE; // Tells us if we are in the menu loop static HHOOK hcbthook; static ChildWnd* newchild = NULL; + //////////////////////////////////////////////////////////////////////////////// // Local module support methods // +static void resize_frame_rect(HWND hWnd, PRECT prect) +{ + RECT rt; +/* + if (IsWindowVisible(hToolBar)) { + SendMessage(hToolBar, WM_SIZE, 0, 0); + GetClientRect(hToolBar, &rt); + prect->top = rt.bottom+3; + prect->bottom -= rt.bottom+3; + } + */ + if (IsWindowVisible(hStatusBar)) { + SetupStatusBar(hWnd, TRUE); + GetClientRect(hStatusBar, &rt); + prect->bottom -= rt.bottom; + } + MoveWindow(hMDIClient, prect->left,prect->top,prect->right,prect->bottom, TRUE); +} + +static void resize_frame(HWND hWnd, int cx, int cy) +{ + RECT rect = {0, 0, cx, cy}; + + resize_frame_rect(hWnd, &rect); +} + +void resize_frame_client(HWND hWnd) +{ + RECT rect; + + GetClientRect(hWnd, &rect); + resize_frame_rect(hWnd, &rect); +} + +//////////////////////////////////////////////////////////////////////////////// + static LRESULT CALLBACK CBTProc(int code, WPARAM wParam, LPARAM lParam) { if (code == HCBT_CREATEWND && newchild) { @@ -64,43 +102,60 @@ static LRESULT CALLBACK CBTProc(int code, WPARAM wParam, LPARAM lParam) return CallNextHookEx(hcbthook, code, wParam, lParam); } -static HWND InitChildWindow(LPTSTR param) +static ChildWnd* alloc_child_window(LPCTSTR szKeyName, HKEY hKey) { - //TCHAR drv[_MAX_DRIVE]; - TCHAR path[MAX_PATH]; - ChildWnd* pChildWnd = NULL; - pChildWnd = (ChildWnd*)malloc(sizeof(ChildWnd)); + ChildWnd* pChildWnd = (ChildWnd*)malloc(sizeof(ChildWnd)); + + memset(pChildWnd, 0, sizeof(ChildWnd)); + pChildWnd->pos.length = sizeof(WINDOWPLACEMENT); + pChildWnd->pos.flags = 0; + pChildWnd->pos.showCmd = SW_SHOWNORMAL; + pChildWnd->pos.rcNormalPosition.left = CW_USEDEFAULT; + pChildWnd->pos.rcNormalPosition.top = CW_USEDEFAULT; + pChildWnd->pos.rcNormalPosition.right = CW_USEDEFAULT; + pChildWnd->pos.rcNormalPosition.bottom = CW_USEDEFAULT; + pChildWnd->nFocusPanel = 0; + pChildWnd->nSplitPos = 300; +// pChildWnd->visible_cols = COL_SIZE|COL_DATE|COL_TIME|COL_ATTRIBUTES; +// pChildWnd->sortOrder = SORT_NAME; +// pChildWnd->header_wdths_ok = FALSE; + lstrcpy(pChildWnd->szKeyName, szKeyName); // MAX_PATH + pChildWnd->hKey = hKey; + return pChildWnd; +} + +static HWND CreateChildWindow(HWND hWnd, LPCTSTR szKeyName, HKEY hKey, int unused) +{ + ChildWnd* pChildWnd = alloc_child_window(szKeyName, hKey); if (pChildWnd != NULL) { - MDICREATESTRUCT mcs = { - szChildClass, path, hInst, - CW_USEDEFAULT, CW_USEDEFAULT, - CW_USEDEFAULT, CW_USEDEFAULT, - 0/*style*/, 0/*lParam*/ - }; - memset(pChildWnd, 0, sizeof(ChildWnd)); - lstrcpy(pChildWnd->szPath, path); - pChildWnd->pos.length = sizeof(WINDOWPLACEMENT); - pChildWnd->pos.flags = 0; - pChildWnd->pos.showCmd = SW_SHOWNORMAL; - pChildWnd->pos.rcNormalPosition.left = CW_USEDEFAULT; - pChildWnd->pos.rcNormalPosition.top = CW_USEDEFAULT; - pChildWnd->pos.rcNormalPosition.right = CW_USEDEFAULT; - pChildWnd->pos.rcNormalPosition.bottom = CW_USEDEFAULT; - pChildWnd->nFocusPanel = 0; - pChildWnd->nSplitPos = 200; + MDICREATESTRUCT mcs = { szChildClass, szKeyName, hInst, + CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, + 0/*style*/, (LPARAM)hKey/*lParam*/}; hcbthook = SetWindowsHookEx(WH_CBT, CBTProc, 0, GetCurrentThreadId()); newchild = pChildWnd; pChildWnd->hWnd = (HWND)SendMessage(hMDIClient, WM_MDICREATE, 0, (LPARAM)&mcs); UnhookWindowsHookEx(hcbthook); - if (pChildWnd->hWnd == NULL) { + if (pChildWnd->hWnd != NULL) { + return pChildWnd->hWnd; + } else { free(pChildWnd); newchild = pChildWnd = NULL; } - return pChildWnd->hWnd; } return 0; } +void CreateClientChildren(HWND hWnd) +{ + CreateChildWindow(hWnd, _T("HKEY_CLASSES_ROOT"), HKEY_CLASSES_ROOT, 1); + CreateChildWindow(hWnd, _T("HKEY_CURRENT_USER"), HKEY_CURRENT_USER, 1); + CreateChildWindow(hWnd, _T("HKEY_LOCAL_MACHINE"), HKEY_LOCAL_MACHINE, 1); + CreateChildWindow(hWnd, _T("HKEY_USERS"), HKEY_USERS, 1); + CreateChildWindow(hWnd, _T("HKEY_CURRENT_CONFIG"), HKEY_CURRENT_CONFIG, 1); + PostMessage(hMDIClient, WM_MDICASCADE, 0, 0); +} + + static BOOL CALLBACK CloseEnumProc(HWND hWnd, LPARAM lParam) { if (!GetWindow(hWnd, GW_OWNER)) { @@ -140,7 +195,7 @@ typedef struct { INT nSizeMax; } CHOOSEFONT, *LPCHOOSEFONT; */ -void CmdOptionsFont(HWND hWnd) +static void CmdOptionsFont(HWND hWnd) { // LOGFONT LogFont; CHOOSEFONT cf = { sizeof(CHOOSEFONT), hWnd, NULL, @@ -193,7 +248,7 @@ void CmdOptionsFont(HWND hWnd) } -void CmdRegistryPrint(HWND hWnd, int cmd) +static void CmdRegistryPrint(HWND hWnd, int cmd) { PRINTDLG pd = { sizeof(PRINTDLG), hWnd, 0, // hDevMode; @@ -257,7 +312,7 @@ typedef struct tagOFN { */ //GetOpenFileName(...); //GetSaveFileName(...); -void CmdRegistrySaveSubTreeAs(HWND hWnd) +static void CmdRegistrySaveSubTreeAs(HWND hWnd) { OPENFILENAME ofn;// = { }; @@ -270,8 +325,46 @@ void CmdRegistrySaveSubTreeAs(HWND hWnd) } } +void SetupStatusBar(HWND hWnd, BOOL bResize) +{ + RECT rc; + int nParts; + GetClientRect(hWnd, &rc); + nParts = rc.right; +// nParts = -1; + if (bResize) + SendMessage(hStatusBar, WM_SIZE, 0, 0); + SendMessage(hStatusBar, SB_SETPARTS, 1, (LPARAM)&nParts); +} + +void UpdateStatusBar(void) +{ + TCHAR text[260]; + DWORD size; + + size = sizeof(text)/sizeof(TCHAR); + GetComputerName(text, &size); + SendMessage(hStatusBar, SB_SETTEXT, 0, (LPARAM)text); +} + +static void toggle_child(HWND hWnd, UINT cmd, HWND hchild) +{ + BOOL vis = IsWindowVisible(hchild); + + CheckMenuItem(GetSubMenu(hMenuFrame, ID_VIEW_MENU), cmd, vis?MF_BYCOMMAND:MF_BYCOMMAND|MF_CHECKED); + ShowWindow(hchild, vis?SW_HIDE:SW_SHOW); + resize_frame_client(hWnd); +} + +//////////////////////////////////////////////////////////////////////////////// +// +// FUNCTION: _CmdWndProc(HWND, unsigned, WORD, LONG) +// +// PURPOSE: Processes WM_COMMAND messages for the main frame window. +// +// -static LRESULT _CmdWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) +static BOOL _CmdWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) { HWND hChildWnd; switch (LOWORD(wParam)) { @@ -283,13 +376,19 @@ static LRESULT _CmdWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam if (!SendMessage(hChildWnd, WM_QUERYENDSESSION, 0, 0)) SendMessage(hMDIClient, WM_MDIDESTROY, (WPARAM)hChildWnd, 0); break; -// case ID_FILE_EXIT: -// SendMessage(hWnd, WM_CLOSE, 0, 0); -// break; -// case IDM_EXIT: -// DestroyWindow(hWnd); -// break; -// case ID_FILE_OPEN: + case ID_REGISTRY_OPENLOCAL: + CreateClientChildren(hWnd); + break; + case ID_REGISTRY_CLOSE: + SendMessage(hWnd, WM_COMMAND, ID_WINDOW_CLOSEALL, 0); +// SendMessage(hWnd, WM_CLOSE, 0, 0); + break; + case ID_REGISTRY_LOADHIVE: + case ID_REGISTRY_UNLOADHIVE: + case ID_REGISTRY_RESTORE: + case ID_REGISTRY_SAVEKEY: + case ID_REGISTRY_SELECTCOMPUTER: + break; case ID_REGISTRY_PRINTSUBTREE: case ID_REGISTRY_PRINTERSETUP: CmdRegistryPrint(hWnd, LOWORD(wParam)); @@ -297,13 +396,83 @@ static LRESULT _CmdWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam case ID_REGISTRY_SAVESUBTREEAS: CmdRegistrySaveSubTreeAs(hWnd); break; + case ID_REGISTRY_EXIT: + DestroyWindow(hWnd); + break; case ID_OPTIONS_FONT: CmdOptionsFont(hWnd); break; - case ID_REGISTRY_OPENLOCAL: - case ID_WINDOW_NEW_WINDOW: - InitChildWindow("Child Window"); - return 0; + + case ID_VIEW_STATUSBAR: + toggle_child(hWnd, LOWORD(wParam), hStatusBar); + break; + + case ID_VIEW_DISPLAYBINARYDATA: + if (Options & OPTIONS_DISPLAY_BINARY_DATA) { + Options &= ~OPTIONS_DISPLAY_BINARY_DATA; + CheckMenuItem(GetSubMenu(hMenuFrame, ID_VIEW_MENU), LOWORD(wParam), MF_BYCOMMAND); + } else { + Options |= OPTIONS_DISPLAY_BINARY_DATA; + CheckMenuItem(GetSubMenu(hMenuFrame, ID_VIEW_MENU), LOWORD(wParam), MF_BYCOMMAND | MF_CHECKED); + } + break; +//// + case ID_VIEW_TREEANDDATA: + Options &= ~(OPTIONS_VIEW_TREE_ONLY|OPTIONS_VIEW_DATA_ONLY); + CheckMenuItem(GetSubMenu(hMenuFrame, ID_VIEW_MENU), LOWORD(wParam), MF_BYCOMMAND | MF_CHECKED); + CheckMenuItem(GetSubMenu(hMenuFrame, ID_VIEW_MENU), ID_VIEW_TREEONLY, MF_BYCOMMAND); + CheckMenuItem(GetSubMenu(hMenuFrame, ID_VIEW_MENU), ID_VIEW_DATAONLY, MF_BYCOMMAND); + break; + case ID_VIEW_TREEONLY: + Options &= ~OPTIONS_VIEW_DATA_ONLY; + CheckMenuItem(GetSubMenu(hMenuFrame, ID_VIEW_MENU), LOWORD(wParam), MF_BYCOMMAND | MF_CHECKED); + CheckMenuItem(GetSubMenu(hMenuFrame, ID_VIEW_MENU), ID_VIEW_TREEANDDATA, MF_BYCOMMAND); + CheckMenuItem(GetSubMenu(hMenuFrame, ID_VIEW_MENU), ID_VIEW_DATAONLY, MF_BYCOMMAND); + break; + case ID_VIEW_DATAONLY: + Options &= ~OPTIONS_VIEW_TREE_ONLY; + CheckMenuItem(GetSubMenu(hMenuFrame, ID_VIEW_MENU), LOWORD(wParam), MF_BYCOMMAND | MF_CHECKED); + CheckMenuItem(GetSubMenu(hMenuFrame, ID_VIEW_MENU), ID_VIEW_TREEANDDATA, MF_BYCOMMAND); + CheckMenuItem(GetSubMenu(hMenuFrame, ID_VIEW_MENU), ID_VIEW_TREEONLY, MF_BYCOMMAND); + break; +//// + case ID_OPTIONS_AUTOREFRESH: + if (Options & OPTIONS_AUTO_REFRESH) { + Options &= ~OPTIONS_AUTO_REFRESH; + CheckMenuItem(GetSubMenu(hMenuFrame, ID_OPTIONS_MENU), LOWORD(wParam), MF_BYCOMMAND); + } else { + Options |= OPTIONS_AUTO_REFRESH; + CheckMenuItem(GetSubMenu(hMenuFrame, ID_OPTIONS_MENU), LOWORD(wParam), MF_BYCOMMAND | MF_CHECKED); + } + break; + case ID_OPTIONS_READONLYMODE: + if (Options & OPTIONS_READ_ONLY_MODE) { + Options &= ~OPTIONS_READ_ONLY_MODE; + CheckMenuItem(GetSubMenu(hMenuFrame, ID_OPTIONS_MENU), LOWORD(wParam), MF_BYCOMMAND); + } else { + Options |= OPTIONS_READ_ONLY_MODE; + CheckMenuItem(GetSubMenu(hMenuFrame, ID_OPTIONS_MENU), LOWORD(wParam), MF_BYCOMMAND | MF_CHECKED); + } + break; + case ID_OPTIONS_CONFIRMONDELETE: + if (Options & OPTIONS_CONFIRM_ON_DELETE) { + Options &= ~OPTIONS_CONFIRM_ON_DELETE; + CheckMenuItem(GetSubMenu(hMenuFrame, ID_OPTIONS_MENU), LOWORD(wParam), MF_BYCOMMAND); + } else { + Options |= OPTIONS_CONFIRM_ON_DELETE; + CheckMenuItem(GetSubMenu(hMenuFrame, ID_OPTIONS_MENU), LOWORD(wParam), MF_BYCOMMAND | MF_CHECKED); + } + break; + case ID_OPTIONS_SAVESETTINGSONEXIT: + if (Options & OPTIONS_SAVE_ON_EXIT) { + Options &= ~OPTIONS_SAVE_ON_EXIT; + CheckMenuItem(GetSubMenu(hMenuFrame, ID_OPTIONS_MENU), LOWORD(wParam), MF_BYCOMMAND); + } else { + Options |= OPTIONS_SAVE_ON_EXIT; + CheckMenuItem(GetSubMenu(hMenuFrame, ID_OPTIONS_MENU), LOWORD(wParam), MF_BYCOMMAND | MF_CHECKED); + } + break; + case ID_WINDOW_CASCADE: SendMessage(hMDIClient, WM_MDICASCADE, 0, 0); break; @@ -313,7 +482,7 @@ static LRESULT _CmdWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam case ID_WINDOW_TILE_VERT: SendMessage(hMDIClient, WM_MDITILE, MDITILE_VERTICAL, 0); break; - case ID_WINDOW_ARRANGE_ICONS: + case ID_WINDOW_ARRANGEICONS: SendMessage(hMDIClient, WM_MDIICONARRANGE, 0, 0); break; case ID_HELP_ABOUT: @@ -325,13 +494,9 @@ static LRESULT _CmdWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam } break; default: - hChildWnd = (HWND)SendMessage(hMDIClient, WM_MDIGETACTIVE, 0, 0); - if (IsWindow(hChildWnd)) - SendMessage(hChildWnd, WM_COMMAND, wParam, lParam); - else - return DefFrameProc(hWnd, hMDIClient, message, wParam, lParam); - } - return 0; + return FALSE; + } + return TRUE; } //////////////////////////////////////////////////////////////////////////////// @@ -353,15 +518,38 @@ LRESULT CALLBACK FrameWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lPa HMENU hMenuWindow = GetSubMenu(hMenuFrame, GetMenuItemCount(hMenuFrame)-2); CLIENTCREATESTRUCT ccs = { hMenuWindow, IDW_FIRST_CHILD }; hMDIClient = CreateWindowEx(0, _T("MDICLIENT"), NULL, - WS_CHILD|WS_CLIPCHILDREN|WS_VSCROLL|WS_HSCROLL|WS_VISIBLE|WS_BORDER, - 0, 0, 0, 0, - hWnd, (HMENU)0, hInst, &ccs); + WS_EX_MDICHILD|WS_CHILD|WS_CLIPCHILDREN|WS_VISIBLE, + 0, 0, 0, 0, + hWnd, (HMENU)0, hInst, &ccs); + } + if (Options & OPTIONS_AUTO_REFRESH) { + CheckMenuItem(GetSubMenu(hMenuFrame, ID_OPTIONS_MENU), ID_OPTIONS_AUTOREFRESH, MF_BYCOMMAND | MF_CHECKED); } + if (Options & OPTIONS_READ_ONLY_MODE) { + CheckMenuItem(GetSubMenu(hMenuFrame, ID_OPTIONS_MENU), ID_OPTIONS_READONLYMODE, MF_BYCOMMAND | MF_CHECKED); + } + if (Options & OPTIONS_CONFIRM_ON_DELETE) { + CheckMenuItem(GetSubMenu(hMenuFrame, ID_OPTIONS_MENU), ID_OPTIONS_CONFIRMONDELETE, MF_BYCOMMAND | MF_CHECKED); + } + if (Options & OPTIONS_SAVE_ON_EXIT) { + CheckMenuItem(GetSubMenu(hMenuFrame, ID_OPTIONS_MENU), ID_OPTIONS_SAVESETTINGSONEXIT, MF_BYCOMMAND | MF_CHECKED); + } + CreateClientChildren(hWnd); break; case WM_COMMAND: - return _CmdWndProc(hWnd, message, wParam, lParam); + if (!_CmdWndProc(hWnd, message, wParam, lParam)) { +// HWND hChildWnd = (HWND)SendMessage(hMDIClient, WM_MDIGETACTIVE, 0, 0); +// if (IsWindow(hChildWnd)) +// if (SendMessage(hChildWnd, WM_DISPATCH_COMMAND, wParam, lParam)) +// break; + return DefFrameProc(hWnd, hMDIClient, message, wParam, lParam); + } break; + case WM_SIZE: + resize_frame_client(hWnd); + break; case WM_DESTROY: + WinHelp(hWnd, _T("regedt32"), HELP_QUIT, 0); PostQuitMessage(0); break; case WM_QUERYENDSESSION: diff --git a/rosapps/regedt32/framewnd.h b/rosapps/regedt32/framewnd.h index d72290b430a..e04c67440f1 100644 --- a/rosapps/regedt32/framewnd.h +++ b/rosapps/regedt32/framewnd.h @@ -1,5 +1,5 @@ /* - * ReactOS Application Main Window + * ReactOS regedt32 * * framewnd.h * @@ -20,8 +20,8 @@ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ -#ifndef __FRAME_WND_H__ -#define __FRAME_WND_H__ +#ifndef __FRAMEWND_H__ +#define __FRAMEWND_H__ #ifdef __cplusplus extern "C" { @@ -33,10 +33,14 @@ extern "C" { LRESULT CALLBACK FrameWndProc(HWND, UINT, WPARAM, LPARAM); +void CreateClientChildren(HWND hWnd); +void SetupStatusBar(HWND hWnd, BOOL bResize); +void UpdateStatusBar(void); + #ifdef __cplusplus }; #endif -#endif // __FRAME_WND_H__ +#endif // __FRAMEWND_H__ diff --git a/rosapps/regedt32/listview.c b/rosapps/regedt32/listview.c new file mode 100644 index 00000000000..3e3bec8434f --- /dev/null +++ b/rosapps/regedt32/listview.c @@ -0,0 +1,364 @@ +/* + * ReactOS regedit + * + * listview.c + * + * Copyright (C) 2002 Robert Dickenson + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#ifdef _MSC_VER +#include "stdafx.h" +#else +#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers +#include +#include +#include +#include +#include +#include +#include +#include +#endif + +#include +#include "main.h" +#include "listview.h" + + +//////////////////////////////////////////////////////////////////////////////// +// Global and Local Variables: +// + +static WNDPROC g_orgListWndProc; + +#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 column_alignment[MAX_LIST_COLUMNS] = { LVCFMT_LEFT, LVCFMT_LEFT, LVCFMT_LEFT }; + + +//////////////////////////////////////////////////////////////////////////////// +// Local module support methods +// + +static void AddEntryToList(HWND hwndLV, LPTSTR Name, DWORD dwValType, void* ValBuf, DWORD dwCount) +{ + LVITEM item; + + item.mask = LVIF_TEXT | LVIF_PARAM; + item.iItem = 0;//idx; + item.iSubItem = 0; + item.state = 0; + item.stateMask = 0; + item.pszText = Name; + item.cchTextMax = _tcslen(item.pszText); + item.cchTextMax = 0; + item.iImage = 0; + item.lParam = (LPARAM)dwValType; +// item.lParam = (LPARAM)ValBuf; +#if (_WIN32_IE >= 0x0300) + item.iIndent = 0; +#endif + ListView_InsertItem(hwndLV, &item); +} + +static void CreateListColumns(HWND hWndListView) +{ + TCHAR szText[50]; + int index; + LV_COLUMN lvC; + + // Create columns. + lvC.mask = LVCF_FMT | LVCF_WIDTH | LVCF_TEXT | LVCF_SUBITEM; + lvC.pszText = szText; + + // Load the column labels from the resource file. + for (index = 0; index < MAX_LIST_COLUMNS; index++) { + lvC.iSubItem = index; + lvC.cx = default_column_widths[index]; + lvC.fmt = column_alignment[index]; + LoadString(hInst, IDS_LIST_COLUMN_FIRST + index, szText, sizeof(szText)); + if (ListView_InsertColumn(hWndListView, index, &lvC) == -1) { + // TODO: handle failure condition... + break; + } + } +} + +// OnGetDispInfo - processes the LVN_GETDISPINFO notification message. + +static void OnGetDispInfo(NMLVDISPINFO* plvdi) +{ + static TCHAR buffer[200]; + + plvdi->item.pszText = NULL; + plvdi->item.cchTextMax = 0; + + switch (plvdi->item.iSubItem) { + case 0: + plvdi->item.pszText = _T("(Default)"); + break; + case 1: + switch (plvdi->item.lParam) { + case REG_SZ: + plvdi->item.pszText = _T("REG_SZ"); + break; + case REG_EXPAND_SZ: + plvdi->item.pszText = _T("REG_EXPAND_SZ"); + break; + case REG_BINARY: + plvdi->item.pszText = _T("REG_BINARY"); + break; + case REG_DWORD: + plvdi->item.pszText = _T("REG_DWORD"); + break; +// case REG_DWORD_LITTLE_ENDIAN: +// plvdi->item.pszText = _T("REG_DWORD_LITTLE_ENDIAN"); +// break; + case REG_DWORD_BIG_ENDIAN: + plvdi->item.pszText = _T("REG_DWORD_BIG_ENDIAN"); + break; + case REG_MULTI_SZ: + plvdi->item.pszText = _T("REG_MULTI_SZ"); + break; + case REG_LINK: + plvdi->item.pszText = _T("REG_LINK"); + break; + case REG_RESOURCE_LIST: + plvdi->item.pszText = _T("REG_RESOURCE_LIST"); + break; + case REG_NONE: + plvdi->item.pszText = _T("REG_NONE"); + break; + default: + wsprintf(buffer, _T("unknown(%d)"), plvdi->item.lParam); + plvdi->item.pszText = buffer; + break; + } + break; + case 2: + plvdi->item.pszText = _T("(value not set)"); + break; + case 3: + plvdi->item.pszText = _T(""); + break; + } +} + +static int CALLBACK CompareFunc(LPARAM lParam1, LPARAM lParam2, LPARAM lParamSort) +{ + TCHAR buf1[1000]; + TCHAR buf2[1000]; + + ListView_GetItemText((HWND)lParamSort, lParam1, 0, buf1, sizeof(buf1)); + ListView_GetItemText((HWND)lParamSort, lParam2, 0, buf2, sizeof(buf2)); + return _tcscmp(buf1, buf2); +} + +static void ListViewPopUpMenu(HWND hWnd, POINT pt) +{ +} + +static BOOL _CmdWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) +{ + switch (LOWORD(wParam)) { +// case ID_FILE_OPEN: +// break; + default: + return FALSE; + } + return TRUE; +} + +static LRESULT CALLBACK ListWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) +{ + switch (message) { + case WM_COMMAND: + if (!_CmdWndProc(hWnd, message, wParam, lParam)) { + return CallWindowProc(g_orgListWndProc, hWnd, message, wParam, lParam); + } + break; + case WM_NOTIFY: + switch (((LPNMHDR)lParam)->code) { + case LVN_GETDISPINFO: + OnGetDispInfo((NMLVDISPINFO*)lParam); + break; + case NM_DBLCLK: + { + NMITEMACTIVATE* nmitem = (LPNMITEMACTIVATE)lParam; + LVHITTESTINFO info; + + if (nmitem->hdr.hwndFrom != hWnd) break; +// if (nmitem->hdr.idFrom != IDW_LISTVIEW) break; +// if (nmitem->hdr.code != ???) break; +#ifdef _MSC_VER + switch (nmitem->uKeyFlags) { + case LVKF_ALT: // The ALT key is pressed. + // properties dialog box ? + break; + case LVKF_CONTROL: // The CTRL key is pressed. + // run dialog box for providing parameters... + break; + case LVKF_SHIFT: // The SHIFT key is pressed. + break; + } +#endif + info.pt.x = nmitem->ptAction.x; + info.pt.y = nmitem->ptAction.y; + if (ListView_HitTest(hWnd, &info) != -1) { + LVITEM item; + item.mask = LVIF_PARAM; + item.iItem = info.iItem; + if (ListView_GetItem(hWnd, &item)) { + } + } + } + break; + + case NM_RCLICK: + { + int idx; + LV_HITTESTINFO lvH; + NM_LISTVIEW* pNm = (NM_LISTVIEW*)lParam; + lvH.pt.x = pNm->ptAction.x; + lvH.pt.y = pNm->ptAction.y; + idx = ListView_HitTest(hWnd, &lvH); + if (idx != -1) { + POINT pt; + GetCursorPos(&pt); + ListViewPopUpMenu(hWnd, pt); + return idx; + } + } + break; + + default: + return CallWindowProc(g_orgListWndProc, hWnd, message, wParam, lParam); + } + break; + case WM_KEYDOWN: + if (wParam == VK_TAB) { + //TODO: SetFocus(Globals.hDriveBar) + //SetFocus(child->nFocusPanel? child->left.hWnd: child->right.hWnd); + } + // fall thru... + default: + return CallWindowProc(g_orgListWndProc, hWnd, message, wParam, lParam); + break; + } + return 0; +} + + +HWND CreateListView(HWND hwndParent) +{ + RECT rcClient; + HWND hwndLV; + + // Get the dimensions of the parent window's client area, and create the list view control. + GetClientRect(hwndParent, &rcClient); + hwndLV = CreateWindowEx(0, WC_LISTVIEW, _T("List View"), + WS_VISIBLE | WS_CHILD | WS_EX_CLIENTEDGE | LVS_REPORT, + 0, 0, rcClient.right, rcClient.bottom, + hwndParent, (HMENU)LIST_WINDOW, hInst, NULL); + ListView_SetExtendedListViewStyle(hwndLV, LVS_EX_FULLROWSELECT); + + // Initialize the image list, and add items to the control. +/* + if (!InitListViewImageLists(hwndLV) || + !InitListViewItems(hwndLV, szName)) { + DestroyWindow(hwndLV); + return FALSE; + } + */ + CreateListColumns(hwndLV); + g_orgListWndProc = SubclassWindow(hwndLV, ListWndProc); + return hwndLV; +} + +BOOL RefreshListView(HWND hwndLV, HKEY hKey, LPTSTR keyPath) +{ + if (hwndLV != NULL) { + ListView_DeleteAllItems(hwndLV); + } + + if (hKey != NULL) { + LONG errCode; + HKEY hNewKey; + + + DWORD max_sub_key_len; + DWORD max_val_name_len; + DWORD max_val_size; + DWORD val_count; + errCode = RegQueryInfoKey(hKey, NULL, NULL, NULL, NULL, + &max_sub_key_len, NULL, &val_count, &max_val_name_len, &max_val_size, NULL, NULL); + if (errCode == ERROR_SUCCESS) { + TCHAR* ValName = malloc(++max_val_name_len * sizeof(TCHAR)); + DWORD dwValNameLen = max_val_name_len; + BYTE* ValBuf = malloc(++max_val_size); + DWORD dwValSize = max_val_size; + DWORD dwIndex = 0L; + DWORD dwValType; + while (RegEnumValue(hKey, dwIndex, ValName, &dwValNameLen, NULL, &dwValType, ValBuf, &dwValSize) == ERROR_SUCCESS) { + AddEntryToList(hwndLV, ValName, dwValType, ValBuf, dwIndex); + dwValNameLen = max_val_name_len; + dwValSize = max_val_size; + dwValType = 0L; + ++dwIndex; + } + free(ValBuf); + free(ValName); + } + + + errCode = RegOpenKeyEx(hKey, keyPath, 0, KEY_READ, &hNewKey); + if (errCode == ERROR_SUCCESS) { + DWORD max_sub_key_len; + DWORD max_val_name_len; + DWORD max_val_size; + DWORD val_count; + ShowWindow(hwndLV, SW_HIDE); + /* get size information and resize the buffers if necessary */ + errCode = RegQueryInfoKey(hNewKey, NULL, NULL, NULL, NULL, + &max_sub_key_len, NULL, &val_count, &max_val_name_len, &max_val_size, NULL, NULL); + if (errCode == ERROR_SUCCESS) { + TCHAR* ValName = malloc(++max_val_name_len * sizeof(TCHAR)); + DWORD dwValNameLen = max_val_name_len; + BYTE* ValBuf = malloc(++max_val_size); + DWORD dwValSize = max_val_size; + DWORD dwIndex = 0L; + DWORD dwValType; + while (RegEnumValue(hNewKey, dwIndex, ValName, &dwValNameLen, NULL, &dwValType, ValBuf, &dwValSize) == ERROR_SUCCESS) { + //while (RegEnumValue(hNewKey, dwIndex, ValName, &dwValNameLen, NULL, &dwValType, NULL, NULL) == ERROR_SUCCESS) { + AddEntryToList(hwndLV, ValName, dwValType, ValBuf, dwIndex); + dwValNameLen = max_val_name_len; + dwValSize = max_val_size; + dwValType = 0L; + ++dwIndex; + } + free(ValBuf); + free(ValName); + } + //ListView_SortItemsEx(hwndLV, CompareFunc, hwndLV); +// SendMessage(hwndLV, LVM_SORTITEMSEX, (WPARAM)CompareFunc, (LPARAM)hwndLV); + ShowWindow(hwndLV, SW_SHOW); + RegCloseKey(hNewKey); + } + } + return TRUE; +} + diff --git a/rosapps/regedt32/listview.h b/rosapps/regedt32/listview.h new file mode 100644 index 00000000000..b17384afe9d --- /dev/null +++ b/rosapps/regedt32/listview.h @@ -0,0 +1,43 @@ +/* + * ReactOS regedit + * + * listview.h + * + * Copyright (C) 2002 Robert Dickenson + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#ifndef __LISTVIEW_H__ +#define __LISTVIEW_H__ + +#ifdef __cplusplus +extern "C" { +#endif + +#if _MSC_VER > 1000 +#pragma once +#endif // _MSC_VER > 1000 + + +HWND CreateListView(HWND hwndParent); +BOOL RefreshListView(HWND hwndTV, HKEY hKey, LPTSTR keyPath); + + +#ifdef __cplusplus +}; +#endif + +#endif // __LISTVIEW_H__ diff --git a/rosapps/regedt32/main.c b/rosapps/regedt32/main.c index fe3727a5cfb..6d5730486a0 100644 --- a/rosapps/regedt32/main.c +++ b/rosapps/regedt32/main.c @@ -37,6 +37,7 @@ #include "main.h" #include "framewnd.h" #include "childwnd.h" +#include "settings.h" //////////////////////////////////////////////////////////////////////////////// @@ -46,16 +47,27 @@ HINSTANCE hInst; HACCEL hAccel; HWND hFrameWnd; -HMENU hMenuFrame; HWND hMDIClient; HWND hStatusBar; +HMENU hMenuFrame; TCHAR szTitle[MAX_LOADSTRING]; TCHAR szFrameClass[MAX_LOADSTRING]; TCHAR szChildClass[MAX_LOADSTRING]; -//////////////////////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////////////////// +// +// +// FUNCTION: InitInstance(HANDLE, int) +// +// PURPOSE: Saves instance handle and creates main window +// +// COMMENTS: +// +// In this function, we save the instance handle in a global variable and +// create and display the main program window. +// BOOL InitInstance(HINSTANCE hInstance, int nCmdShow) { WNDCLASSEX wcFrame = { @@ -77,7 +89,7 @@ BOOL InitInstance(HINSTANCE hInstance, int nCmdShow) WNDCLASSEX wcChild = { sizeof(WNDCLASSEX), - CS_HREDRAW | CS_VREDRAW/*style*/, + CS_HREDRAW | CS_VREDRAW | CS_NOCLOSE/*style*/, ChildWndProc, 0/*cbClsExtra*/, sizeof(HANDLE)/*cbWndExtra*/, @@ -93,17 +105,8 @@ BOOL InitInstance(HINSTANCE hInstance, int nCmdShow) }; ATOM hChildWndClass = RegisterClassEx(&wcChild); // register child windows class - HMENU hMenu = LoadMenu(hInstance, MAKEINTRESOURCE(IDR_REGEDT32_MENU)); - HMENU hMenuOptions = GetSubMenu(hMenu, ID_OPTIONS_MENU); - HMENU hChildMenu = LoadMenu(hInstance, MAKEINTRESOURCE(IDR_REGEDT32_MENU)); - - INITCOMMONCONTROLSEX icc = { - sizeof(INITCOMMONCONTROLSEX), - ICC_BAR_CLASSES - }; - - hMenuFrame = hMenu; - hAccel = LoadAccelerators(hInstance, MAKEINTRESOURCE(IDC_REGEDT32)); + hMenuFrame = LoadMenu(hInstance, MAKEINTRESOURCE(IDR_REGEDT32_MENU)); +// hAccel = LoadAccelerators(hInstance, MAKEINTRESOURCE(IDC_REGEDT32)); // Initialize the Windows Common Controls DLL InitCommonControls(); @@ -111,26 +114,19 @@ BOOL InitInstance(HINSTANCE hInstance, int nCmdShow) hFrameWnd = CreateWindowEx(0, (LPCTSTR)(int)hFrameWndClass, szTitle, WS_OVERLAPPEDWINDOW | WS_CLIPCHILDREN, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, - NULL/*hWndParent*/, hMenuFrame, hInstance, NULL/*lpParam*/); + NULL, hMenuFrame, hInstance, NULL/*lpParam*/); if (!hFrameWnd) { return FALSE; } -#if 0 - { - int nParts[3]; // Create the status bar - hStatusBar = CreateStatusWindow(WS_VISIBLE|WS_CHILD|WS_CLIPSIBLINGS|SBT_NOBORDERS, "", hFrameWnd, STATUS_WINDOW); - if (!hStatusBar) - return FALSE; - // Create the status bar panes - nParts[0] = 100; - nParts[1] = 210; - nParts[2] = 400; - SendMessage(hStatusBar, SB_SETPARTS, 3, (long)nParts); + hStatusBar = CreateStatusWindow(WS_VISIBLE|WS_CHILD|WS_CLIPSIBLINGS|SBT_NOBORDERS, + _T(""), hFrameWnd, STATUS_WINDOW); + if (hStatusBar) { + // Create the status bar panes + SetupStatusBar(hFrameWnd, FALSE); + CheckMenuItem(GetSubMenu(hMenuFrame, ID_VIEW_MENU), ID_VIEW_STATUSBAR, MF_BYCOMMAND|MF_CHECKED); } -#endif - ShowWindow(hFrameWnd, nCmdShow); UpdateWindow(hFrameWnd); return TRUE; @@ -160,6 +156,9 @@ int APIENTRY WinMain(HINSTANCE hInstance, // Store instance handle in our global variable hInst = hInstance; + // Load our settings from the registry + LoadSettings(); + // Perform application initialization: if (!InitInstance(hInstance, nCmdShow)) { return FALSE; @@ -175,6 +174,8 @@ int APIENTRY WinMain(HINSTANCE hInstance, DispatchMessage(&msg); } } + // Save our settings to the registry + SaveSettings(); ExitInstance(); return msg.wParam; } diff --git a/rosapps/regedt32/main.h b/rosapps/regedt32/main.h index eb93f5479cf..ed8dff5e5fc 100644 --- a/rosapps/regedt32/main.h +++ b/rosapps/regedt32/main.h @@ -34,40 +34,74 @@ extern "C" { #include "resource.h" +#define STATUS_WINDOW 2001 +#define TREE_WINDOW 2002 +#define LIST_WINDOW 2003 + +#define MAX_LOADSTRING 100 +#define SPLIT_WIDTH 5 +#define MAX_NAME_LEN 500 + + +#define ID_WINDOW_CLOSE 798 +#define ID_WINDOW_CLOSEALL 799 + +#define IDW_FIRST_CHILD 0xC000 //0x200 + //////////////////////////////////////////////////////////////////////////////// -#define SPLIT_WIDTH 5 -#define MAX_LOADSTRING 100 +enum OPTION_FLAGS { + OPTIONS_AUTO_REFRESH = 0x01, + OPTIONS_READ_ONLY_MODE = 0x02, + OPTIONS_CONFIRM_ON_DELETE = 0x04, + OPTIONS_SAVE_ON_EXIT = 0x08, + OPTIONS_DISPLAY_BINARY_DATA = 0x10, + OPTIONS_VIEW_TREE_ONLY = 0x20, + OPTIONS_VIEW_DATA_ONLY = 0x40, +}; typedef struct { HWND hWnd; - HWND hLeftWnd; - HWND hRightWnd; + HWND hTreeWnd; + HWND hListWnd; int nFocusPanel; // 0: left 1: right int nSplitPos; WINDOWPLACEMENT pos; - TCHAR szPath[MAX_PATH]; + TCHAR szKeyName[MAX_PATH]; + HKEY hKey; } ChildWnd; -//void UpdateStatusBar(void); - - //////////////////////////////////////////////////////////////////////////////// // Global Variables: - +// extern HINSTANCE hInst; extern HACCEL hAccel; extern HWND hFrameWnd; extern HMENU hMenuFrame; extern HWND hMDIClient; -//extern HWND hStatusBar; +extern HWND hStatusBar; //extern HWND hToolBar; extern HFONT hFont; +extern enum OPTION_FLAGS Options; extern TCHAR szTitle[]; extern TCHAR szFrameClass[]; extern TCHAR szChildClass[]; +#ifndef _MSC_VER +typedef struct tagNMITEMACTIVATE{ + NMHDR hdr; + int iItem; + int iSubItem; + UINT uNewState; + UINT uOldState; + UINT uChanged; + POINT ptAction; + LPARAM lParam; + UINT uKeyFlags; +} NMITEMACTIVATE, FAR *LPNMITEMACTIVATE; +#endif + #ifdef __cplusplus }; #endif diff --git a/rosapps/regedt32/regedt32.rc b/rosapps/regedt32/regedt32.rc index d76b5eb01df..ab3367c4868 100644 --- a/rosapps/regedt32/regedt32.rc +++ b/rosapps/regedt32/regedt32.rc @@ -1,3 +1,6 @@ +#include +#include + //Microsoft Developer Studio generated resource script. // #include "resource.h" @@ -34,6 +37,15 @@ LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US IDI_REGEDT32 ICON DISCARDABLE "res/regedt32.ico" IDI_SMALL ICON DISCARDABLE "res/small.ico" +///////////////////////////////////////////////////////////////////////////// +// +// Bitmap +// + +IDB_OPEN_FILE BITMAP DISCARDABLE "res/folder3.bmp" +IDB_CLOSED_FILE BITMAP DISCARDABLE "res/folder1.bmp" +IDB_ROOT BITMAP DISCARDABLE "res/folder2.bmp" + ///////////////////////////////////////////////////////////////////////////// // // Menu @@ -58,7 +70,7 @@ BEGIN MENUITEM "P&rinter Setup...", ID_REGISTRY_PRINTERSETUP MENUITEM "Save Subtree &As...", ID_REGISTRY_SAVESUBTREEAS MENUITEM SEPARATOR - MENUITEM "E&xit", IDM_EXIT + MENUITEM "E&xit", ID_REGISTRY_EXIT END POPUP "&Edit" BEGIN @@ -82,15 +94,14 @@ BEGIN END POPUP "&View" BEGIN - MENUITEM "Tree &and Data", ID_VIEW_TREEANDDATA - , CHECKED, GRAYED - MENUITEM "&Tree only", ID_VIEW_TREEONLY, GRAYED - MENUITEM "&Data only", ID_VIEW_DATAONLY, GRAYED + MENUITEM "Tree &and Data", ID_VIEW_TREEANDDATA, CHECKED + MENUITEM "&Tree only", ID_VIEW_TREEONLY + MENUITEM "&Data only", ID_VIEW_DATAONLY MENUITEM SEPARATOR + MENUITEM "Status &Bar", ID_VIEW_STATUSBAR MENUITEM "&Split", ID_VIEW_SPLIT, GRAYED MENUITEM SEPARATOR MENUITEM "Display &Binary Data", ID_VIEW_DISPLAYBINARYDATA - , GRAYED MENUITEM SEPARATOR MENUITEM "R&efresh All\tShift+F6", ID_VIEW_REFRESHALL, GRAYED MENUITEM "&Refresh Active\tF6", ID_VIEW_REFRESHACTIVE @@ -108,19 +119,15 @@ BEGIN MENUITEM "&Font...", ID_OPTIONS_FONT MENUITEM SEPARATOR MENUITEM "&Auto Refresh", ID_OPTIONS_AUTOREFRESH - , CHECKED MENUITEM "&Read Only Mode", ID_OPTIONS_READONLYMODE MENUITEM "&Confirm on Delete", ID_OPTIONS_CONFIRMONDELETE - , CHECKED MENUITEM "&Save Settings on Exit", ID_OPTIONS_SAVESETTINGSONEXIT - , CHECKED END POPUP "&Window" BEGIN MENUITEM "&Cascade\tShift+F5", ID_WINDOW_CASCADE MENUITEM "&Tile\tShift+F4", ID_WINDOW_TILE - MENUITEM "&Arrange Icons", ID_WINDOW_ARRANGE_ICONS - MENUITEM SEPARATOR + MENUITEM "&Arrange Icons", ID_WINDOW_ARRANGEICONS END POPUP "&Help" BEGIN @@ -173,17 +180,68 @@ END #endif // APSTUDIO_INVOKED +///////////////////////////////////////////////////////////////////////////// +// +// Version +// + +VS_VERSION_INFO VERSIONINFO + FILEVERSION RES_UINT_FV_MAJOR,RES_UINT_FV_MINOR,RES_UINT_FV_REVISION,RES_UINT_FV_BUILD + PRODUCTVERSION RES_UINT_PV_MAJOR,RES_UINT_PV_MINOR,RES_UINT_PV_REVISION,RES_UINT_PV_BUILD + FILEFLAGSMASK 0x3fL +#ifdef _DEBUG + FILEFLAGS 0x1L +#else + FILEFLAGS 0x0L +#endif + FILEOS 0x40004L + FILETYPE 0x1L + FILESUBTYPE 0x0L +BEGIN + BLOCK "StringFileInfo" + BEGIN + BLOCK "040904b0" + BEGIN + VALUE "Comments", "Absolutely no warranties whatsoever - Use at your own risk\0" + VALUE "CompanyName", RES_STR_COMPANY_NAME + VALUE "FileDescription", "ReactOS Registry Editor 32 by Robert Dickenson\0" + VALUE "FileVersion", "1, 0, 0, 1\0" + VALUE "InternalName", "regedt32\0" + VALUE "LegalCopyright", "Copyright © 2002 Robert Dickenson\0" + VALUE "LegalTrademarks", "\0" + VALUE "OriginalFilename", "regedt32.exe\0" + VALUE "PrivateBuild", "\0" + VALUE "ProductName", RES_STR_PRODUCT_NAME + VALUE "ProductVersion", RES_STR_PRODUCT_VERSION + VALUE "SpecialBuild", "Non-versioned Development Beta Release\0" + END + END + BLOCK "VarFileInfo" + BEGIN + VALUE "Translation", 0xc09, 1200 + END +END + + ///////////////////////////////////////////////////////////////////////////// // // String Table // +STRINGTABLE DISCARDABLE +BEGIN + IDS_LIST_COLUMN_NAME "Name" + IDS_LIST_COLUMN_TYPE "Type" + IDS_LIST_COLUMN_DATA "Data" +END + STRINGTABLE DISCARDABLE BEGIN IDS_APP_TITLE "ReactOS Registry Editor" IDC_REGEDT32 "REGED32" IDC_REGEDT32_FRAME "REGED32_FRAME" - IDS_HELLO "Hello World!" + IDS_APP_REG_KEY "\\Regedt32" + IDS_APP_REG_PATH RES_STR_ROSAPP_REGISTRY_ROOT END #endif // English (U.S.) resources diff --git a/rosapps/regedt32/res/folder1.bmp b/rosapps/regedt32/res/folder1.bmp new file mode 100644 index 0000000000000000000000000000000000000000..dada286b64daeafc29cbe1abb95401624b3db837 GIT binary patch literal 246 zcmZ?r{l)+RWk5;;hy|dSk%0v)(EuhP1WXRX1IhpqLqh|E0+K)`!+`?_fHX+rKNvCm z{|{mTF%W`;Kzwunlm~$y9bnM#<99U(H2nC!9R!HyL(FaX0o1gkqoef|vX!!BF8Uz}CeBTZN#PcDhHv9l;+R@R`|G&Gsx*sG4 IG#J@J0LHU(N&o-= literal 0 HcmV?d00001 diff --git a/rosapps/regedt32/res/folder3.bmp b/rosapps/regedt32/res/folder3.bmp new file mode 100644 index 0000000000000000000000000000000000000000..dfc3c4fb8c25a53a71e724cbd31a45969fa80e69 GIT binary patch literal 246 zcmZ{cF%Ezr6hkpOFnSC}6BcK8ujAbDABV(|d%0r!F;3W|eLz2dKkm?U5(_=Q9>U}W zJbS@LCD6d+kw&PsvY;KcfvIP8_9LweY>}jB7{$$SiK`)t$xxgT#Xpb|=Ral^ylYuU E4~Mx*tN;K2 literal 0 HcmV?d00001 diff --git a/rosapps/regedt32/resource.h b/rosapps/regedt32/resource.h index 42cadadde80..1e95dc7c568 100644 --- a/rosapps/regedt32/resource.h +++ b/rosapps/regedt32/resource.h @@ -2,7 +2,6 @@ // Microsoft Developer Studio generated include file. // Used by regedt32.rc // -#define IDW_FIRST_CHILD 200 #define ID_REGISTRY_MENU 0 #define ID_EDIT_MENU 1 @@ -13,24 +12,30 @@ #define ID_WINDOW_MENU 6 #define ID_HELP_MENU 7 -#define ID_WINDOW_CLOSE 798 -#define ID_WINDOW_CLOSEALL 799 -#define STATUS_WINDOW 2001 +#define IDS_LIST_COLUMN_FIRST 91 +#define IDS_LIST_COLUMN_NAME 91 +#define IDS_LIST_COLUMN_TYPE 92 +#define IDS_LIST_COLUMN_DATA 93 +#define IDS_LIST_COLUMN_LAST 93 -#define IDD_ABOUTBOX 103 -#define IDS_APP_TITLE 103 -#define IDM_EXIT 105 -#define IDS_HELLO 106 -#define IDI_REGEDT32 107 -#define IDI_SMALL 108 -#define IDC_REGEDT32 109 -#define IDC_REGEDT32_FRAME 110 -#define IDR_REGEDT32_MENU 129 -#define IDR_REGEDT_MENU 130 -#define ID_HELP_ABOUT 32770 -#define ID_HELP_HELPTOPICS 32771 -#define ID_FAVORITES_ADDTOFAVOURITES 32772 -#define ID_FAVORITES_REMOVEFAVOURITE 32773 +#define IDD_ABOUTBOX 101 +#define IDS_APP_TITLE 102 +#define IDI_REGEDT32 103 +#define IDI_SMALL 104 +#define IDC_REGEDT32 105 +#define IDC_REGEDT32_FRAME 106 +#define IDR_REGEDT32_MENU 107 +#define IDS_APP_REG_KEY 108 +#define IDS_APP_REG_PATH 109 + +#define IDB_OPEN_FILE 132 +#define IDB_CLOSED_FILE 133 +#define IDB_ROOT 134 + +#define ID_REGISTRY_EXIT 32770 +#define ID_WINDOW_TILE 32772 +#define ID_WINDOW_TILE_VERT 32772 +#define ID_WINDOW_REFRESH 32773 #define ID_VIEW_STATUSBAR 32774 #define ID_VIEW_SPLIT 32775 #define ID_VIEW_REFRESH 32776 @@ -45,14 +50,17 @@ #define ID_EDIT_NEW_BINARYVALUE 32787 #define ID_EDIT_NEW_DWORDVALUE 32788 -#define ID_WINDOW_NEW_WINDOW 32794 -#define ID_WINDOW_CASCADE 32795 -#define ID_WINDOW_TILE 32796 -#define ID_WINDOW_TILE_HORZ 32796 -#define ID_WINDOW_TILE_VERT 32797 -#define ID_WINDOW_ARRANGE_ICONS 32798 -#define ID_WINDOW_REFRESH 32799 - +#define ID_REGISTRY_IMPORTREGISTRYFILE 32789 +#define ID_REGISTRY_EXPORTREGISTRYFILE 32790 +#define ID_REGISTRY_CONNECTNETWORKREGISTRY 32791 +#define ID_REGISTRY_DISCONNECTNETWORKREGISTRY 32792 +#define ID_REGISTRY_PRINT 32793 +#define ID_HELP_HELPTOPICS 32794 +#define ID_HELP_ABOUT 32795 +#define ID_HELP_CONTENTS 32796 +#define ID_WINDOW_CASCADE 32797 +#define ID_WINDOW_TILE_HORZ 32798 +#define ID_WINDOW_ARRANGEICONS 32799 #define ID_OPTIONS_FONT 32800 #define ID_OPTIONS_AUTOREFRESH 32801 #define ID_OPTIONS_READONLYMODE 32802 @@ -86,12 +94,6 @@ #define ID_REGISTRY_PRINTSUBTREE 32832 #define ID_REGISTRY_PRINTERSETUP 32833 #define ID_REGISTRY_SAVESUBTREEAS 32834 -#define ID_REGISTRY_IMPORTREGISTRYFILE 32835 -#define ID_REGISTRY_EXPORTREGISTRYFILE 32836 -#define ID_REGISTRY_CONNECTNETWORKREGISTRY 32837 -#define ID_REGISTRY_DISCONNECTNETWORKREGISTRY 32838 -#define ID_REGISTRY_PRINT 32839 -#define ID_HELP_CONTENTS 32840 #define IDC_LICENSE_EDIT 1029 #define IDS_LICENSE 32835 diff --git a/rosapps/regedt32/settings.c b/rosapps/regedt32/settings.c new file mode 100644 index 00000000000..3b88d7691f4 --- /dev/null +++ b/rosapps/regedt32/settings.c @@ -0,0 +1,126 @@ +/* + * ReactOS regedt32 + * + * settings.c + * + * Copyright (C) 2002 Robert Dickenson + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers +#include +#include +#include +#define ASSERT assert + +#include "main.h" +#include "settings.h" + + +static BOOL CheckResult(LONG error) +{ + if (error != ERROR_SUCCESS) { + PTSTR msg; + if (FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER|FORMAT_MESSAGE_FROM_SYSTEM, + 0, error, MAKELANGID(LANG_NEUTRAL,SUBLANG_DEFAULT), (PTSTR)&msg, 0, NULL)) + MessageBox(NULL, msg, szTitle, MB_ICONERROR | MB_OK); + else + MessageBox(NULL, _T("Error"), szTitle, MB_ICONERROR | MB_OK); + LocalFree(msg); + return FALSE; + } + return TRUE; +} + +static BOOL CreateRegistryPath(LPTSTR szRegPath, int nMaxLen) +{ + LPTSTR pRegPath = szRegPath; + + // Initialise registry path string from application PATH and KEY resources + int nLength = LoadString(hInst, IDS_APP_REG_PATH, szRegPath, nMaxLen); + nLength += LoadString(hInst, IDS_APP_REG_KEY, szRegPath + nLength, nMaxLen - nLength); + ASSERT(nLength < (nMaxLen - 1)); + szRegPath[nLength] = _T('\\'); + + // walk the registry path string creating the tree if required + while (pRegPath = _tcschr(pRegPath, _T('\\'))) { + LONG result; + HKEY hKey = NULL; + *pRegPath = _T('\0'); + // Open (or create) the key + result = RegCreateKeyEx(HKEY_CURRENT_USER, szRegPath, 0, NULL, REG_OPTION_NON_VOLATILE, KEY_WRITE, NULL, &hKey, NULL); + if (!CheckResult(result)) return FALSE; + RegCloseKey(hKey); + *pRegPath = _T('\\'); + pRegPath = pRegPath + 1; + } + szRegPath[nLength] = _T('\0'); + return TRUE; +} + +void LoadSettings(void) +{ + TCHAR szRegPath[MAX_LOADSTRING]; + + HKEY hKey; + DWORD dwSize; + LONG result; + + if (!CreateRegistryPath(szRegPath, MAX_LOADSTRING)) return; + + // Open the key + result = RegOpenKeyEx(HKEY_CURRENT_USER, szRegPath, 0, KEY_READ, &hKey); + if (!CheckResult(result)) return; + + // Read the settings + dwSize = sizeof(enum OPTION_FLAGS); + result = RegQueryValueEx(hKey, _T("Preferences"), NULL, NULL, (LPBYTE)&Options, &dwSize); + + // Close the key + RegCloseKey(hKey); +} + +void SaveSettings(void) +{ + TCHAR szRegPath[MAX_LOADSTRING]; + HKEY hKey = NULL; + LONG result; + + if (!CreateRegistryPath(szRegPath, MAX_LOADSTRING)) return; + + // Open the key + result = RegOpenKeyEx(HKEY_CURRENT_USER, szRegPath, 0, KEY_READ | KEY_WRITE, &hKey); + if (!CheckResult(result)) return; + + // When options are NOT to be saved we reload the options word, clean the save bit and write it back + if (!(Options & OPTIONS_SAVE_ON_EXIT)) { + DWORD dwSize = sizeof(enum OPTION_FLAGS); + result = RegQueryValueEx(hKey, _T("Preferences"), NULL, NULL, (LPBYTE)&Options, &dwSize); + if (result == ERROR_SUCCESS) { + Options &= ~OPTIONS_SAVE_ON_EXIT; + RegSetValueEx(hKey, _T("Preferences"), 0, REG_DWORD, (LPBYTE)&Options, sizeof(enum OPTION_FLAGS)); + } + goto abort; + } + + // Save the settings + result = RegSetValueEx(hKey, _T("Preferences"), 0, REG_DWORD, (LPBYTE)&Options, sizeof(enum OPTION_FLAGS)); + if (!CheckResult(result)) goto abort; + +abort: + // Close the key + RegCloseKey(hKey); +} diff --git a/rosapps/regedt32/settings.h b/rosapps/regedt32/settings.h new file mode 100644 index 00000000000..060a4dc9788 --- /dev/null +++ b/rosapps/regedt32/settings.h @@ -0,0 +1,43 @@ +/* + * ReactOS regedt32 + * + * settings.h + * + * Copyright (C) 2002 Robert Dickenson + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#ifndef __SETTINGS_H__ +#define __SETTINGS_H__ + +#ifdef __cplusplus +extern "C" { +#endif + +#if _MSC_VER > 1000 +#pragma once +#endif // _MSC_VER > 1000 + + +void LoadSettings(void); +void SaveSettings(void); + + +#ifdef __cplusplus +}; +#endif + +#endif // __SETTINGS_H__ diff --git a/rosapps/regedt32/treeview.c b/rosapps/regedt32/treeview.c new file mode 100644 index 00000000000..5d8a2235269 --- /dev/null +++ b/rosapps/regedt32/treeview.c @@ -0,0 +1,259 @@ +/* + * ReactOS regedit + * + * treeview.c + * + * Copyright (C) 2002 Robert Dickenson + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#ifdef _MSC_VER +#include "stdafx.h" +#else +#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers +#include +#include +#include +#include +#include +#include +#include +#include +#endif + +#include "main.h" +#include "treeview.h" + + +// Global variables and constants +// Image_Open, Image_Closed, and Image_Root - integer variables for indexes of the images. +// CX_BITMAP and CY_BITMAP - width and height of an icon. +// NUM_BITMAPS - number of bitmaps to add to the image list. +int Image_Open; +int Image_Closed; +int Image_Root; + +#define CX_BITMAP 16 +#define CY_BITMAP 16 +#define NUM_BITMAPS 3 + + +HKEY FindRegRoot(HWND hwndTV, HTREEITEM hItem, LPTSTR keyPath, int* pPathLen, int max) +{ + HKEY hKey = NULL; + TVITEM item; + item.mask = TVIF_PARAM; + item.hItem = TreeView_GetParent(hwndTV, hItem); + + if (TreeView_GetItem(hwndTV, &item)) { + if (item.lParam == 0) { + // recurse + hKey = FindRegRoot(hwndTV, item.hItem, keyPath, pPathLen, max); + keyPath[*pPathLen] = _T('\\'); + ++(*pPathLen); + item.mask = TVIF_TEXT; + item.hItem = hItem; + item.pszText = &keyPath[*pPathLen]; + item.cchTextMax = max - *pPathLen; + if (TreeView_GetItem(hwndTV, &item)) { + *pPathLen += _tcslen(item.pszText); + } + } else { + // found root key with valid key value + hKey = (HKEY)item.lParam; + item.mask = TVIF_TEXT; + item.hItem = hItem; +// item.pszText = &keyPath[*pPathLen]; + item.pszText = keyPath; + item.cchTextMax = max; + if (TreeView_GetItem(hwndTV, &item)) { + *pPathLen += _tcslen(item.pszText); + } + } + } + return hKey; +} + +static HTREEITEM AddEntryToTree(HWND hwndTV, HTREEITEM hParent, LPTSTR label, HKEY hKey, DWORD dwChildren) +{ + HTREEITEM hItem = 0; + TVITEM tvi; + TVINSERTSTRUCT tvins; + + tvi.mask = TVIF_TEXT | TVIF_IMAGE | TVIF_SELECTEDIMAGE | TVIF_CHILDREN | TVIF_PARAM; + tvi.pszText = label; + tvi.cchTextMax = lstrlen(tvi.pszText); + tvi.iImage = Image_Closed; + tvi.iSelectedImage = Image_Open; + tvi.cChildren = dwChildren; + tvi.lParam = (LPARAM)hKey; + tvins.item = tvi; + if (hKey) tvins.hInsertAfter = (HTREEITEM)TVI_LAST; + else tvins.hInsertAfter = (HTREEITEM)TVI_SORT; + tvins.hParent = hParent; + hItem = (HTREEITEM)SendMessage(hwndTV, TVM_INSERTITEM, 0, (LPARAM)(LPTVINSERTSTRUCT)&tvins); + return hItem; +} + + +static BOOL InitTreeViewItems(HWND hwndTV, LPTSTR szKeyName, HKEY hKey) +{ + TVITEM tvi; + TVINSERTSTRUCT tvins; + HTREEITEM hRoot; + + tvi.mask = TVIF_TEXT | TVIF_IMAGE | TVIF_SELECTEDIMAGE | TVIF_CHILDREN | TVIF_PARAM; + // Set the text of the item. + tvi.pszText = szKeyName; + tvi.cchTextMax = lstrlen(tvi.pszText); + // Assume the item is not a parent item, so give it an image. + tvi.iImage = Image_Root; + tvi.iSelectedImage = Image_Root; + tvi.cChildren = 5; + // Save the heading level in the item's application-defined data area. + //tvi.lParam = (LPARAM)NULL; + tvi.lParam = (LPARAM)hKey; + tvins.item = tvi; + tvins.hInsertAfter = (HTREEITEM)TVI_FIRST; + tvins.hParent = TVI_ROOT; + // Add the item to the tree view control. + hRoot = (HTREEITEM)SendMessage(hwndTV, TVM_INSERTITEM, 0, (LPARAM)(LPTVINSERTSTRUCT)&tvins); + +// AddEntryToTree(hwndTV, hRoot, _T("HKEY_CLASSES_ROOT"), HKEY_CLASSES_ROOT, 1); +// AddEntryToTree(hwndTV, hRoot, _T("HKEY_CURRENT_USER"), HKEY_CURRENT_USER, 1); +// AddEntryToTree(hwndTV, hRoot, _T("HKEY_LOCAL_MACHINE"), HKEY_LOCAL_MACHINE, 1); +// AddEntryToTree(hwndTV, hRoot, _T("HKEY_USERS"), HKEY_USERS, 1); +// AddEntryToTree(hwndTV, hRoot, _T("HKEY_CURRENT_CONFIG"), HKEY_CURRENT_CONFIG, 1); + + return TRUE; +} + +// InitTreeViewImageLists - creates an image list, adds three bitmaps +// to it, and associates the image list with a tree view control. +// Returns TRUE if successful, or FALSE otherwise. +// hwndTV - handle to the tree view control. + +static BOOL InitTreeViewImageLists(HWND hwndTV) +{ + HIMAGELIST himl; // handle to image list + HBITMAP hbmp; // handle to bitmap + + // Create the image list. + if ((himl = ImageList_Create(CX_BITMAP, CY_BITMAP, + FALSE, NUM_BITMAPS, 0)) == NULL) + return FALSE; + + // Add the open file, closed file, and document bitmaps. + hbmp = LoadBitmap(hInst, MAKEINTRESOURCE(IDB_OPEN_FILE)); + Image_Open = ImageList_Add(himl, hbmp, (HBITMAP) NULL); + DeleteObject(hbmp); + + hbmp = LoadBitmap(hInst, MAKEINTRESOURCE(IDB_CLOSED_FILE)); + Image_Closed = ImageList_Add(himl, hbmp, (HBITMAP) NULL); + DeleteObject(hbmp); + + hbmp = LoadBitmap(hInst, MAKEINTRESOURCE(IDB_ROOT)); + Image_Root = ImageList_Add(himl, hbmp, (HBITMAP) NULL); + DeleteObject(hbmp); + + // Fail if not all of the images were added. + if (ImageList_GetImageCount(himl) < 3) + return FALSE; + + // Associate the image list with the tree view control. + TreeView_SetImageList(hwndTV, himl, TVSIL_NORMAL); + + return TRUE; +} + +BOOL OnTreeExpanding(HWND hwndTV, NMTREEVIEW* pnmtv) +{ + HKEY hKey; + TCHAR keyPath[1000]; + int keyPathLen = 0; + + static int expanding; + if (expanding) return FALSE; + if (pnmtv->itemNew.state & TVIS_EXPANDEDONCE ) { + return TRUE; + } + expanding = TRUE; + + // check if this is either the root or a subkey item... + if ((HKEY)pnmtv->itemNew.lParam == NULL) { + keyPath[0] = _T('\0'); + hKey = FindRegRoot(hwndTV, pnmtv->itemNew.hItem, keyPath, &keyPathLen, sizeof(keyPath)); + } else { + hKey = (HKEY)pnmtv->itemNew.lParam; + keyPath[0] = _T('\0'); + } + + if (hKey != NULL) { + HKEY hNewKey; + LONG errCode = RegOpenKeyEx(hKey, keyPath, 0, KEY_READ, &hNewKey); + if (errCode == ERROR_SUCCESS) { + TCHAR Name[MAX_NAME_LEN]; + DWORD cName = MAX_NAME_LEN; + FILETIME LastWriteTime; + DWORD dwIndex = 0L; + //ShowWindow(hwndTV, SW_HIDE); + while (RegEnumKeyEx(hNewKey, dwIndex, Name, &cName, NULL, NULL, NULL, &LastWriteTime) == ERROR_SUCCESS) { + DWORD dwCount = 0L; + errCode = RegOpenKeyEx(hNewKey, Name, 0, KEY_READ, &hKey); + if (errCode == ERROR_SUCCESS) { + TCHAR SubName[MAX_NAME_LEN]; + DWORD cSubName = MAX_NAME_LEN; +// if (RegEnumKeyEx(hKey, 0, SubName, &cSubName, NULL, NULL, NULL, NULL) == ERROR_SUCCESS) { + while (RegEnumKeyEx(hKey, dwCount, SubName, &cSubName, NULL, NULL, NULL, NULL) == ERROR_SUCCESS) { + ++dwCount; + } + } + RegCloseKey(hKey); + AddEntryToTree(hwndTV, pnmtv->itemNew.hItem, Name, NULL, dwCount); + cName = MAX_NAME_LEN; + ++dwIndex; + } + //ShowWindow(hwndTV, SW_SHOWNOACTIVATE); + RegCloseKey(hNewKey); + } + } else { + } + expanding = FALSE; + return TRUE; +} + +// CreateTreeView - creates a tree view control. +// Returns the handle to the new control if successful, or NULL otherwise. +// hwndParent - handle to the control's parent window. + +HWND CreateTreeView(HWND hwndParent, LPTSTR szKeyName, HKEY hKey) +{ + RECT rcClient; + HWND hwndTV; + + // Get the dimensions of the parent window's client area, and create the tree view control. + GetClientRect(hwndParent, &rcClient); + hwndTV = CreateWindowEx(0, WC_TREEVIEW, _T("Tree View"), + WS_VISIBLE | WS_CHILD | WS_EX_CLIENTEDGE | TVS_HASLINES | TVS_HASBUTTONS | TVS_LINESATROOT, + 0, 0, rcClient.right, rcClient.bottom, + hwndParent, (HMENU)TREE_WINDOW, hInst, NULL); + // Initialize the image list, and add items to the control. + if (!InitTreeViewImageLists(hwndTV) || !InitTreeViewItems(hwndTV, szKeyName, hKey)) { + DestroyWindow(hwndTV); + return NULL; + } + return hwndTV; +} diff --git a/rosapps/regedt32/treeview.h b/rosapps/regedt32/treeview.h new file mode 100644 index 00000000000..61150ef1382 --- /dev/null +++ b/rosapps/regedt32/treeview.h @@ -0,0 +1,44 @@ +/* + * ReactOS regedit + * + * treeview.h + * + * Copyright (C) 2002 Robert Dickenson + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#ifndef __TREEVIEW_H__ +#define __TREEVIEW_H__ + +#ifdef __cplusplus +extern "C" { +#endif + +#if _MSC_VER > 1000 +#pragma once +#endif // _MSC_VER > 1000 + + +HWND CreateTreeView(HWND hwndParent, LPTSTR szKeyName, HKEY hKey); +BOOL OnTreeExpanding(HWND hWnd, NMTREEVIEW* pnmtv); +HKEY FindRegRoot(HWND hwndTV, HTREEITEM hItem, LPTSTR keyPath, int* pPathLen, int max); + + +#ifdef __cplusplus +}; +#endif + +#endif // __TREEVIEW_H__ -- 2.17.1