mirror of
https://github.com/reactos/reactos.git
synced 2024-12-26 17:14:41 +00:00
Updated with latest progress. How does one read a default registry value???
svn path=/trunk/; revision=3273
This commit is contained in:
parent
ad319a46cf
commit
f4629b5599
27 changed files with 1563 additions and 422 deletions
|
@ -29,11 +29,11 @@ BASE_CFLAGS = -DGCC -D_WIN32_IE=0x0400
|
||||||
RCFLAGS = -DGCC -D_WIN32_IE=0x0400
|
RCFLAGS = -DGCC -D_WIN32_IE=0x0400
|
||||||
|
|
||||||
|
|
||||||
OBJS = about.o \
|
OBJS = framewnd.o \
|
||||||
framewnd.o \
|
|
||||||
childwnd.o \
|
childwnd.o \
|
||||||
listview.o \
|
listview.o \
|
||||||
treeview.o \
|
treeview.o \
|
||||||
|
about.o \
|
||||||
trace.o \
|
trace.o \
|
||||||
main.o
|
main.o
|
||||||
|
|
||||||
|
@ -50,16 +50,18 @@ $(TARGET).exe: $(OBJS) $(TARGET).coff
|
||||||
|
|
||||||
main.h: resource.h
|
main.h: resource.h
|
||||||
|
|
||||||
about.o: about.c about.h main.h
|
|
||||||
|
|
||||||
main.o: main.c main.h framewnd.h
|
main.o: main.c main.h framewnd.h
|
||||||
|
|
||||||
framewnd.o: framewnd.c framewnd.h listview.h treeview.h main.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
|
listview.o: listview.c listview.h main.h
|
||||||
|
|
||||||
treeview.o: treeview.c treeview.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
|
debug.o: debug.c debug.h main.h
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -45,6 +45,8 @@
|
||||||
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
// Local module support methods
|
||||||
|
//
|
||||||
|
|
||||||
static void MakeFullRegPath(HWND hwndTV, HTREEITEM hItem, LPTSTR keyPath, int* pPathLen, int max)
|
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;
|
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->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);
|
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)
|
static void OnPaint(HWND hWnd)
|
||||||
{
|
{
|
||||||
PAINTSTRUCT ps;
|
PAINTSTRUCT ps;
|
||||||
|
@ -110,7 +105,6 @@ static void OnPaint(HWND hWnd)
|
||||||
EndPaint(hWnd, &ps);
|
EndPaint(hWnd, &ps);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
//
|
//
|
||||||
// FUNCTION: _CmdWndProc(HWND, unsigned, WORD, LONG)
|
// 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;
|
pChildWnd = (ChildWnd*)((LPCREATESTRUCT)lParam)->lpCreateParams;
|
||||||
ASSERT(pChildWnd);
|
ASSERT(pChildWnd);
|
||||||
pChildWnd->nSplitPos = 250;
|
pChildWnd->nSplitPos = 250;
|
||||||
pChildWnd->hTreeWnd = CreateTreeView(hWnd, pChildWnd->root.path, TREE_WINDOW);
|
pChildWnd->hTreeWnd = CreateTreeView(hWnd, pChildWnd->szPath, TREE_WINDOW);
|
||||||
pChildWnd->hListWnd = CreateListView(hWnd, LIST_WINDOW/*, &pChildWnd->root*/);
|
pChildWnd->hListWnd = CreateListView(hWnd, LIST_WINDOW/*, pChildWnd->szPath*/);
|
||||||
break;
|
break;
|
||||||
case WM_COMMAND:
|
case WM_COMMAND:
|
||||||
if (!_CmdWndProc(hWnd, message, wParam, lParam)) {
|
if (!_CmdWndProc(hWnd, message, wParam, lParam)) {
|
||||||
return DefWindowProc(hWnd, message, wParam, lParam);
|
goto def;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case WM_PAINT:
|
case WM_PAINT:
|
||||||
|
@ -179,8 +173,6 @@ LRESULT CALLBACK ChildWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lPa
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
goto def;
|
goto def;
|
||||||
//break;
|
|
||||||
|
|
||||||
case WM_DESTROY:
|
case WM_DESTROY:
|
||||||
PostQuitMessage(0);
|
PostQuitMessage(0);
|
||||||
break;
|
break;
|
||||||
|
@ -264,7 +256,6 @@ LRESULT CALLBACK ChildWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lPa
|
||||||
int keyPathLen = 0;
|
int keyPathLen = 0;
|
||||||
keyPath[0] = _T('\0');
|
keyPath[0] = _T('\0');
|
||||||
hKey = FindRegRoot(pChildWnd->hTreeWnd, ((NMTREEVIEW*)lParam)->itemNew.hItem, keyPath, &keyPathLen, sizeof(keyPath));
|
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);
|
RefreshListView(pChildWnd->hListWnd, hKey, keyPath);
|
||||||
|
|
||||||
keyPathLen = 0;
|
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));
|
MakeFullRegPath(pChildWnd->hTreeWnd, ((NMTREEVIEW*)lParam)->itemNew.hItem, keyPath, &keyPathLen, sizeof(keyPath));
|
||||||
SendMessage(hStatusBar, SB_SETTEXT, 0, (LPARAM)keyPath);
|
SendMessage(hStatusBar, SB_SETTEXT, 0, (LPARAM)keyPath);
|
||||||
}
|
}
|
||||||
// RefreshList(pChildWnd->hListWnd, entry);
|
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
goto def;
|
goto def;
|
||||||
|
@ -286,8 +276,8 @@ LRESULT CALLBACK ChildWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lPa
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case WM_SIZE:
|
case WM_SIZE:
|
||||||
if (wParam != SIZE_MINIMIZED) {
|
if (wParam != SIZE_MINIMIZED && pChildWnd != NULL) {
|
||||||
OnSize(pChildWnd, wParam, lParam);
|
ResizeWnd(pChildWnd, LOWORD(lParam), HIWORD(lParam));
|
||||||
}
|
}
|
||||||
// fall through
|
// fall through
|
||||||
default: def:
|
default: def:
|
||||||
|
|
|
@ -43,7 +43,7 @@
|
||||||
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
// Globals and Variables:
|
// Global and Local Variables:
|
||||||
//
|
//
|
||||||
|
|
||||||
static BOOL bInMenuLoop = FALSE; // Tells us if we are in the menu loop
|
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);
|
GetClientRect(hStatusBar, &rt);
|
||||||
prect->bottom -= rt.bottom;
|
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)
|
void resize_frame_client(HWND hWnd)
|
||||||
{
|
{
|
||||||
RECT rect;
|
RECT rect;
|
||||||
|
@ -88,6 +81,7 @@ void resize_frame_client(HWND hWnd)
|
||||||
resize_frame_rect(hWnd, &rect);
|
resize_frame_rect(hWnd, &rect);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
static void OnEnterMenuLoop(HWND hWnd)
|
static void OnEnterMenuLoop(HWND hWnd)
|
||||||
{
|
{
|
||||||
|
@ -146,10 +140,6 @@ void UpdateStatusBar(void)
|
||||||
TCHAR text[260];
|
TCHAR text[260];
|
||||||
DWORD size;
|
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);
|
size = sizeof(text)/sizeof(TCHAR);
|
||||||
GetComputerName(text, &size);
|
GetComputerName(text, &size);
|
||||||
SendMessage(hStatusBar, SB_SETTEXT, 0, (LPARAM)text);
|
SendMessage(hStatusBar, SB_SETTEXT, 0, (LPARAM)text);
|
||||||
|
@ -184,19 +174,6 @@ static BOOL _CmdWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
|
||||||
//PageSetupDlg(&psd);
|
//PageSetupDlg(&psd);
|
||||||
break;
|
break;
|
||||||
case ID_REGISTRY_OPENLOCAL:
|
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;
|
break;
|
||||||
case ID_REGISTRY_EXIT:
|
case ID_REGISTRY_EXIT:
|
||||||
DestroyWindow(hWnd);
|
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.
|
// PURPOSE: Processes messages for the main frame window.
|
||||||
//
|
//
|
||||||
// WM_COMMAND - process the application menu
|
// WM_COMMAND - process the application menu
|
||||||
// WM_PAINT - Paint the main window
|
|
||||||
// WM_DESTROY - post a quit message and return
|
// WM_DESTROY - post a quit message and return
|
||||||
//
|
//
|
||||||
//
|
//
|
||||||
static ChildWnd Child;
|
|
||||||
|
|
||||||
LRESULT CALLBACK FrameWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
|
LRESULT CALLBACK FrameWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
|
||||||
{
|
{
|
||||||
|
static ChildWnd* pChildWnd = NULL;
|
||||||
|
|
||||||
switch (message) {
|
switch (message) {
|
||||||
case WM_CREATE:
|
case WM_CREATE:
|
||||||
{
|
{
|
||||||
//Child.root.entry = ;
|
pChildWnd = malloc(sizeof(ChildWnd));
|
||||||
_tcsncpy(Child.root.path, _T("My Computer"), MAX_PATH);
|
_tcsncpy(pChildWnd->szPath, _T("My Computer"), MAX_PATH);
|
||||||
|
|
||||||
// HMENU hMenuWindow = GetSubMenu(hMenuFrame, GetMenuItemCount(hMenuFrame)-2);
|
|
||||||
hChildWnd = CreateWindowEx(0, szChildClass, _T("regedit child window"),
|
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_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,
|
CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT,
|
||||||
// hWnd, (HMENU)0, hInst, NULL/*lpParam*/);
|
hWnd, (HMENU)0, hInst, pChildWnd);
|
||||||
hWnd, (HMENU)0, hInst, &Child);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case WM_COMMAND:
|
case WM_COMMAND:
|
||||||
|
@ -268,11 +239,8 @@ LRESULT CALLBACK FrameWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lPa
|
||||||
case WM_SIZE:
|
case WM_SIZE:
|
||||||
resize_frame_client(hWnd);
|
resize_frame_client(hWnd);
|
||||||
break;
|
break;
|
||||||
// OnSize(wParam, lParam);
|
|
||||||
// goto def;
|
|
||||||
case WM_TIMER:
|
case WM_TIMER:
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case WM_ENTERMENULOOP:
|
case WM_ENTERMENULOOP:
|
||||||
OnEnterMenuLoop(hWnd);
|
OnEnterMenuLoop(hWnd);
|
||||||
break;
|
break;
|
||||||
|
@ -283,6 +251,10 @@ LRESULT CALLBACK FrameWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lPa
|
||||||
OnMenuSelect(hWnd, LOWORD(wParam), HIWORD(wParam), (HMENU)lParam);
|
OnMenuSelect(hWnd, LOWORD(wParam), HIWORD(wParam), (HMENU)lParam);
|
||||||
break;
|
break;
|
||||||
case WM_DESTROY:
|
case WM_DESTROY:
|
||||||
|
if (pChildWnd) {
|
||||||
|
free(pChildWnd);
|
||||||
|
pChildWnd = NULL;
|
||||||
|
}
|
||||||
WinHelp(hWnd, _T("regedit"), HELP_QUIT, 0);
|
WinHelp(hWnd, _T("regedit"), HELP_QUIT, 0);
|
||||||
PostQuitMessage(0);
|
PostQuitMessage(0);
|
||||||
default:
|
default:
|
||||||
|
|
|
@ -35,22 +35,20 @@
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <windowsx.h>
|
#include <windowsx.h>
|
||||||
|
|
||||||
#include <assert.h>
|
|
||||||
#define ASSERT assert
|
|
||||||
#include "main.h"
|
#include "main.h"
|
||||||
#include "listview.h"
|
#include "listview.h"
|
||||||
|
|
||||||
|
|
||||||
#include "trace.h"
|
|
||||||
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
// Global Variables:
|
// Global and Local Variables:
|
||||||
//
|
//
|
||||||
|
|
||||||
static WNDPROC g_orgListWndProc;
|
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
|
// Local module support methods
|
||||||
|
@ -60,8 +58,6 @@ static void AddEntryToList(HWND hwndLV, LPTSTR Name, DWORD dwValType, void* ValB
|
||||||
{
|
{
|
||||||
LVITEM item;
|
LVITEM item;
|
||||||
|
|
||||||
TRACE("AddEntryToList(%s, %d, ...)\n", Name, dwCount);
|
|
||||||
|
|
||||||
item.mask = LVIF_TEXT | LVIF_PARAM;
|
item.mask = LVIF_TEXT | LVIF_PARAM;
|
||||||
item.iItem = 0;//idx;
|
item.iItem = 0;//idx;
|
||||||
item.iSubItem = 0;
|
item.iSubItem = 0;
|
||||||
|
@ -79,11 +75,6 @@ static void AddEntryToList(HWND hwndLV, LPTSTR Name, DWORD dwValType, void* ValB
|
||||||
ListView_InsertItem(hwndLV, &item);
|
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)
|
static void CreateListColumns(HWND hWndListView)
|
||||||
{
|
{
|
||||||
TCHAR szText[50];
|
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)
|
static void OnGetDispInfo(NMLVDISPINFO* plvdi)
|
||||||
{
|
{
|
||||||
|
@ -120,8 +109,7 @@ static void OnGetDispInfo(NMLVDISPINFO* plvdi)
|
||||||
|
|
||||||
switch (plvdi->item.iSubItem) {
|
switch (plvdi->item.iSubItem) {
|
||||||
case 0:
|
case 0:
|
||||||
// plvdi->item.pszText = pEntry->szName;
|
plvdi->item.pszText = _T("(Default)");
|
||||||
// plvdi->item.cchTextMax = lstrlen(pEntry->szName);
|
|
||||||
break;
|
break;
|
||||||
case 1:
|
case 1:
|
||||||
switch (plvdi->item.lParam) {
|
switch (plvdi->item.lParam) {
|
||||||
|
@ -149,12 +137,6 @@ static void OnGetDispInfo(NMLVDISPINFO* plvdi)
|
||||||
case REG_LINK:
|
case REG_LINK:
|
||||||
plvdi->item.pszText = _T("REG_LINK");
|
plvdi->item.pszText = _T("REG_LINK");
|
||||||
break;
|
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:
|
case REG_RESOURCE_LIST:
|
||||||
plvdi->item.pszText = _T("REG_RESOURCE_LIST");
|
plvdi->item.pszText = _T("REG_RESOURCE_LIST");
|
||||||
break;
|
break;
|
||||||
|
@ -162,11 +144,10 @@ static void OnGetDispInfo(NMLVDISPINFO* plvdi)
|
||||||
plvdi->item.pszText = _T("REG_NONE");
|
plvdi->item.pszText = _T("REG_NONE");
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
wsprintf(buffer, "unknown(%d)", plvdi->item.lParam);
|
wsprintf(buffer, _T("unknown(%d)"), plvdi->item.lParam);
|
||||||
plvdi->item.pszText = buffer;
|
plvdi->item.pszText = buffer;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
// item.lParam = (LPARAM)dwValType;
|
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
plvdi->item.pszText = _T("(value not set)");
|
plvdi->item.pszText = _T("(value not set)");
|
||||||
|
@ -174,13 +155,23 @@ static void OnGetDispInfo(NMLVDISPINFO* plvdi)
|
||||||
case 3:
|
case 3:
|
||||||
plvdi->item.pszText = _T("");
|
plvdi->item.pszText = _T("");
|
||||||
break;
|
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)
|
static BOOL _CmdWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
|
||||||
{
|
{
|
||||||
switch (LOWORD(wParam)) {
|
switch (LOWORD(wParam)) {
|
||||||
|
@ -191,10 +182,6 @@ static BOOL _CmdWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
|
||||||
}
|
}
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
|
||||||
void ListViewPopUpMenu(HWND hWnd, POINT pt)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
static LRESULT CALLBACK ListWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
|
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.mask = LVIF_PARAM;
|
||||||
item.iItem = info.iItem;
|
item.iItem = info.iItem;
|
||||||
if (ListView_GetItem(hWnd, &item)) {
|
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;
|
int idx;
|
||||||
LV_HITTESTINFO lvH;
|
LV_HITTESTINFO lvH;
|
||||||
NM_LISTVIEW *pNm = (NM_LISTVIEW *)lParam;
|
NM_LISTVIEW* pNm = (NM_LISTVIEW*)lParam;
|
||||||
lvH.pt.x = pNm->ptAction.x;
|
lvH.pt.x = pNm->ptAction.x;
|
||||||
lvH.pt.y = pNm->ptAction.y;
|
lvH.pt.y = pNm->ptAction.y;
|
||||||
idx = ListView_HitTest(hWnd, &lvH);
|
idx = ListView_HitTest(hWnd, &lvH);
|
||||||
|
@ -269,7 +254,7 @@ static LRESULT CALLBACK ListWndProc(HWND hWnd, UINT message, WPARAM wParam, LPAR
|
||||||
//TODO: SetFocus(Globals.hDriveBar)
|
//TODO: SetFocus(Globals.hDriveBar)
|
||||||
//SetFocus(child->nFocusPanel? child->left.hWnd: child->right.hWnd);
|
//SetFocus(child->nFocusPanel? child->left.hWnd: child->right.hWnd);
|
||||||
}
|
}
|
||||||
break;
|
// fall thru...
|
||||||
default:
|
default:
|
||||||
return CallWindowProc(g_orgListWndProc, hWnd, message, wParam, lParam);
|
return CallWindowProc(g_orgListWndProc, hWnd, message, wParam, lParam);
|
||||||
break;
|
break;
|
||||||
|
@ -277,27 +262,16 @@ static LRESULT CALLBACK ListWndProc(HWND hWnd, UINT message, WPARAM wParam, LPAR
|
||||||
return 0;
|
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)
|
HWND CreateListView(HWND hwndParent, int id)
|
||||||
{
|
{
|
||||||
RECT rcClient; // dimensions of client area
|
RECT rcClient;
|
||||||
HWND hwndLV; // handle to list view control
|
HWND hwndLV;
|
||||||
|
|
||||||
// Get the dimensions of the parent window's client area, and create the list view control.
|
// Get the dimensions of the parent window's client area, and create the list view control.
|
||||||
GetClientRect(hwndParent, &rcClient);
|
GetClientRect(hwndParent, &rcClient);
|
||||||
hwndLV = CreateWindowEx(0, WC_LISTVIEW, _T("List View"),
|
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,
|
0, 0, rcClient.right, rcClient.bottom,
|
||||||
hwndParent, (HMENU)id, hInst, NULL);
|
hwndParent, (HMENU)id, hInst, NULL);
|
||||||
ListView_SetExtendedListViewStyle(hwndLV, LVS_EX_FULLROWSELECT);
|
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.
|
// Initialize the image list, and add items to the control.
|
||||||
/*
|
/*
|
||||||
if (!InitListViewImageLists(hwndLV) ||
|
if (!InitListViewImageLists(hwndLV) ||
|
||||||
!InitListViewItems(hwndLV, lpszPathName)) {
|
!InitListViewItems(hwndLV, szName)) {
|
||||||
DestroyWindow(hwndLV);
|
DestroyWindow(hwndLV);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
CreateListColumns(hwndLV);
|
CreateListColumns(hwndLV);
|
||||||
// SetWindowLong(hwndLV, GWL_USERDATA, (LPARAM)pRoot);
|
|
||||||
g_orgListWndProc = SubclassWindow(hwndLV, ListWndProc);
|
g_orgListWndProc = SubclassWindow(hwndLV, ListWndProc);
|
||||||
return hwndLV;
|
return hwndLV;
|
||||||
}
|
}
|
||||||
|
@ -323,8 +296,36 @@ BOOL RefreshListView(HWND hwndLV, HKEY hKey, LPTSTR keyPath)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (hKey != NULL) {
|
if (hKey != NULL) {
|
||||||
|
LONG errCode;
|
||||||
HKEY hNewKey;
|
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) {
|
if (errCode == ERROR_SUCCESS) {
|
||||||
DWORD max_sub_key_len;
|
DWORD max_sub_key_len;
|
||||||
DWORD max_val_name_len;
|
DWORD max_val_name_len;
|
||||||
|
@ -337,36 +338,23 @@ BOOL RefreshListView(HWND hwndLV, HKEY hKey, LPTSTR keyPath)
|
||||||
if (errCode == ERROR_SUCCESS) {
|
if (errCode == ERROR_SUCCESS) {
|
||||||
TCHAR* ValName = malloc(++max_val_name_len * sizeof(TCHAR));
|
TCHAR* ValName = malloc(++max_val_name_len * sizeof(TCHAR));
|
||||||
DWORD dwValNameLen = max_val_name_len;
|
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 dwValSize = max_val_size;
|
||||||
DWORD dwIndex = 0L;
|
DWORD dwIndex = 0L;
|
||||||
DWORD dwValType;
|
DWORD dwValType;
|
||||||
#if 0
|
while (RegEnumValue(hNewKey, dwIndex, ValName, &dwValNameLen, NULL, &dwValType, ValBuf, &dwValSize) == ERROR_SUCCESS) {
|
||||||
for (; dwIndex < val_count; dwIndex++) {
|
//while (RegEnumValue(hNewKey, dwIndex, ValName, &dwValNameLen, NULL, &dwValType, NULL, NULL) == ERROR_SUCCESS) {
|
||||||
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) {
|
|
||||||
AddEntryToList(hwndLV, ValName, dwValType, ValBuf, dwIndex);
|
AddEntryToList(hwndLV, ValName, dwValType, ValBuf, dwIndex);
|
||||||
dwValNameLen = max_val_name_len;
|
dwValNameLen = max_val_name_len;
|
||||||
dwValSize = max_val_size;
|
dwValSize = max_val_size;
|
||||||
dwValType = 0L;
|
dwValType = 0L;
|
||||||
++dwIndex;
|
++dwIndex;
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
free(ValBuf);
|
free(ValBuf);
|
||||||
free(ValName);
|
free(ValName);
|
||||||
}
|
}
|
||||||
|
|
||||||
//ListView_SortItemsEx(hwndLV, CompareFunc, hwndLV);
|
//ListView_SortItemsEx(hwndLV, CompareFunc, hwndLV);
|
||||||
// SendMessage(hwndLV, LVM_SORTITEMSEX, (WPARAM)CompareFunc, (LPARAM)hwndLV);
|
// SendMessage(hwndLV, LVM_SORTITEMSEX, (WPARAM)CompareFunc, (LPARAM)hwndLV);
|
||||||
|
|
||||||
ShowWindow(hwndLV, SW_SHOW);
|
ShowWindow(hwndLV, SW_SHOW);
|
||||||
RegCloseKey(hNewKey);
|
RegCloseKey(hNewKey);
|
||||||
}
|
}
|
||||||
|
|
|
@ -101,37 +101,15 @@ BOOL InitInstance(HINSTANCE hInstance, int nCmdShow)
|
||||||
GetSystemMetrics(SM_CXSMICON), GetSystemMetrics(SM_CYSMICON), LR_SHARED)
|
GetSystemMetrics(SM_CXSMICON), GetSystemMetrics(SM_CYSMICON), LR_SHARED)
|
||||||
|
|
||||||
};
|
};
|
||||||
// ATOM hChildWndClass = RegisterClassEx(&wcChild); // register child windows class
|
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);
|
|
||||||
*/
|
|
||||||
|
|
||||||
hMenuFrame = LoadMenu(hInstance, MAKEINTRESOURCE(IDR_REGEDIT_MENU));
|
hMenuFrame = LoadMenu(hInstance, MAKEINTRESOURCE(IDR_REGEDIT_MENU));
|
||||||
|
|
||||||
// Initialize the Windows Common Controls DLL
|
// Initialize the Windows Common Controls DLL
|
||||||
InitCommonControls();
|
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,
|
hFrameWnd = CreateWindowEx(0, (LPCTSTR)(int)hFrameWndClass, szTitle,
|
||||||
WS_OVERLAPPEDWINDOW,
|
WS_OVERLAPPEDWINDOW | WS_EX_CLIENTEDGE,
|
||||||
CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT,
|
CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT,
|
||||||
NULL, hMenuFrame, hInstance, NULL/*lpParam*/);
|
NULL, hMenuFrame, hInstance, NULL/*lpParam*/);
|
||||||
|
|
||||||
|
|
|
@ -32,60 +32,48 @@ extern "C" {
|
||||||
#endif // _MSC_VER > 1000
|
#endif // _MSC_VER > 1000
|
||||||
|
|
||||||
#include "resource.h"
|
#include "resource.h"
|
||||||
//#include "regproc.h"
|
|
||||||
|
|
||||||
|
|
||||||
#define STATUS_WINDOW 2001
|
#define STATUS_WINDOW 2001
|
||||||
#define TREE_WINDOW 2002
|
#define TREE_WINDOW 2002
|
||||||
#define LIST_WINDOW 2003
|
#define LIST_WINDOW 2003
|
||||||
#define SPLIT_WINDOW 2004
|
|
||||||
|
|
||||||
#define MAX_LOADSTRING 100
|
#define MAX_LOADSTRING 100
|
||||||
#define SPLIT_WIDTH 3
|
#define SPLIT_WIDTH 5
|
||||||
#define MAX_NAME_LEN 500
|
#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;
|
|
||||||
|
|
||||||
|
enum OPTION_FLAGS {
|
||||||
typedef struct {
|
OPTIONS_AUTO_REFRESH = 0x01,
|
||||||
Entry entry;
|
OPTIONS_READ_ONLY_MODE = 0x02,
|
||||||
TCHAR path[MAX_PATH];
|
OPTIONS_CONFIRM_ON_DELETE = 0x04,
|
||||||
// DWORD _flags;
|
OPTIONS_SAVE_ON_EXIT = 0x08,
|
||||||
} Root;
|
OPTIONS_DISPLAY_BINARY_DATA = 0x10,
|
||||||
|
OPTIONS_VIEW_TREE_ONLY = 0x20,
|
||||||
|
OPTIONS_VIEW_DATA_ONLY = 0x40,
|
||||||
|
};
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
HWND hWnd;
|
HWND hWnd;
|
||||||
HWND hTreeWnd;
|
HWND hTreeWnd;
|
||||||
HWND hListWnd;
|
HWND hListWnd;
|
||||||
int nFocusPanel; // 0: left 1: right
|
int nFocusPanel; // 0: left 1: right
|
||||||
WINDOWPLACEMENT pos;
|
|
||||||
int nSplitPos;
|
int nSplitPos;
|
||||||
Root root;
|
WINDOWPLACEMENT pos;
|
||||||
|
TCHAR szPath[MAX_PATH];
|
||||||
} ChildWnd;
|
} ChildWnd;
|
||||||
//#endif
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
// Global Variables:
|
// Global Variables:
|
||||||
//
|
//
|
||||||
extern HINSTANCE hInst;
|
extern HINSTANCE hInst;
|
||||||
extern HWND hFrameWnd;
|
extern HWND hFrameWnd;
|
||||||
extern HWND hStatusBar;
|
extern HMENU hMenuFrame;
|
||||||
extern HMENU hMenuFrame;
|
extern HWND hStatusBar;
|
||||||
|
extern HFONT hFont;
|
||||||
|
extern enum OPTION_FLAGS Options;
|
||||||
|
|
||||||
extern TCHAR szTitle[];
|
extern TCHAR szTitle[];
|
||||||
extern TCHAR szFrameClass[];
|
extern TCHAR szFrameClass[];
|
||||||
|
|
|
@ -1,3 +1,6 @@
|
||||||
|
#include <defines.h>
|
||||||
|
#include <reactos/resource.h>
|
||||||
|
|
||||||
//Microsoft Developer Studio generated resource script.
|
//Microsoft Developer Studio generated resource script.
|
||||||
//
|
//
|
||||||
#include "resource.h"
|
#include "resource.h"
|
||||||
|
@ -173,8 +176,8 @@ END
|
||||||
//
|
//
|
||||||
|
|
||||||
VS_VERSION_INFO VERSIONINFO
|
VS_VERSION_INFO VERSIONINFO
|
||||||
FILEVERSION 1,0,0,1
|
FILEVERSION RES_UINT_FV_MAJOR,RES_UINT_FV_MINOR,RES_UINT_FV_REVISION,RES_UINT_FV_BUILD
|
||||||
PRODUCTVERSION 1,0,0,1
|
PRODUCTVERSION RES_UINT_PV_MAJOR,RES_UINT_PV_MINOR,RES_UINT_PV_REVISION,RES_UINT_PV_BUILD
|
||||||
FILEFLAGSMASK 0x3fL
|
FILEFLAGSMASK 0x3fL
|
||||||
#ifdef _DEBUG
|
#ifdef _DEBUG
|
||||||
FILEFLAGS 0x1L
|
FILEFLAGS 0x1L
|
||||||
|
@ -187,10 +190,10 @@ VS_VERSION_INFO VERSIONINFO
|
||||||
BEGIN
|
BEGIN
|
||||||
BLOCK "StringFileInfo"
|
BLOCK "StringFileInfo"
|
||||||
BEGIN
|
BEGIN
|
||||||
BLOCK "0c0904b0"
|
BLOCK "040904b0"
|
||||||
BEGIN
|
BEGIN
|
||||||
VALUE "Comments", "Absolutely no warranties whatsoever - Use at your own risk\0"
|
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 "FileDescription", "ReactOS Registry Editor by Robert Dickenson\0"
|
||||||
VALUE "FileVersion", "1, 0, 0, 1\0"
|
VALUE "FileVersion", "1, 0, 0, 1\0"
|
||||||
VALUE "InternalName", "regedit\0"
|
VALUE "InternalName", "regedit\0"
|
||||||
|
@ -198,8 +201,8 @@ BEGIN
|
||||||
VALUE "LegalTrademarks", "\0"
|
VALUE "LegalTrademarks", "\0"
|
||||||
VALUE "OriginalFilename", "regedit.exe\0"
|
VALUE "OriginalFilename", "regedit.exe\0"
|
||||||
VALUE "PrivateBuild", "\0"
|
VALUE "PrivateBuild", "\0"
|
||||||
VALUE "ProductName", "ReactOS Registry Editor\0"
|
VALUE "ProductName", RES_STR_PRODUCT_NAME
|
||||||
VALUE "ProductVersion", "1, 0, 0, 1\0"
|
VALUE "ProductVersion", RES_STR_PRODUCT_VERSION
|
||||||
VALUE "SpecialBuild", "Non-versioned Development Beta Release\0"
|
VALUE "SpecialBuild", "Non-versioned Development Beta Release\0"
|
||||||
END
|
END
|
||||||
END
|
END
|
||||||
|
@ -342,10 +345,6 @@ END
|
||||||
STRINGTABLE DISCARDABLE
|
STRINGTABLE DISCARDABLE
|
||||||
BEGIN
|
BEGIN
|
||||||
ID_HELP_HELPTOPICS "Opens Registry Editor Help."
|
ID_HELP_HELPTOPICS "Opens Registry Editor Help."
|
||||||
END
|
|
||||||
|
|
||||||
STRINGTABLE DISCARDABLE
|
|
||||||
BEGIN
|
|
||||||
ID_HELP_ABOUT "Displays program information, version number, and copyright."
|
ID_HELP_ABOUT "Displays program information, version number, and copyright."
|
||||||
END
|
END
|
||||||
|
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
// Microsoft Developer Studio generated include file.
|
// Microsoft Developer Studio generated include file.
|
||||||
// Used by regedit.rc
|
// Used by regedit.rc
|
||||||
//
|
//
|
||||||
|
|
||||||
#define ID_REGISTRY_MENU 0
|
#define ID_REGISTRY_MENU 0
|
||||||
#define ID_EDIT_MENU 1
|
#define ID_EDIT_MENU 1
|
||||||
#define ID_VIEW_MENU 2
|
#define ID_VIEW_MENU 2
|
||||||
|
@ -28,7 +29,6 @@
|
||||||
#define IDB_ROOT 134
|
#define IDB_ROOT 134
|
||||||
|
|
||||||
#define ID_REGISTRY_EXIT 32770
|
#define ID_REGISTRY_EXIT 32770
|
||||||
#define ID_HELP_HELPTOPICS 32771
|
|
||||||
#define ID_FAVOURITES_ADDTOFAVOURITES 32772
|
#define ID_FAVOURITES_ADDTOFAVOURITES 32772
|
||||||
#define ID_FAVOURITES_REMOVEFAVOURITE 32773
|
#define ID_FAVOURITES_REMOVEFAVOURITE 32773
|
||||||
#define ID_VIEW_STATUSBAR 32774
|
#define ID_VIEW_STATUSBAR 32774
|
||||||
|
@ -49,6 +49,7 @@
|
||||||
#define ID_REGISTRY_CONNECTNETWORKREGISTRY 32791
|
#define ID_REGISTRY_CONNECTNETWORKREGISTRY 32791
|
||||||
#define ID_REGISTRY_DISCONNECTNETWORKREGISTRY 32792
|
#define ID_REGISTRY_DISCONNECTNETWORKREGISTRY 32792
|
||||||
#define ID_REGISTRY_PRINT 32793
|
#define ID_REGISTRY_PRINT 32793
|
||||||
|
#define ID_HELP_HELPTOPICS 32794
|
||||||
#define ID_HELP_ABOUT 32795
|
#define ID_HELP_ABOUT 32795
|
||||||
#define ID_WINDOW_CASCADE 32797
|
#define ID_WINDOW_CASCADE 32797
|
||||||
#define ID_WINDOW_TILE 32798
|
#define ID_WINDOW_TILE 32798
|
||||||
|
|
|
@ -34,7 +34,6 @@
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
//#include <windowsx.h>
|
|
||||||
#include "main.h"
|
#include "main.h"
|
||||||
#include "treeview.h"
|
#include "treeview.h"
|
||||||
|
|
||||||
|
@ -209,7 +208,7 @@ BOOL OnTreeExpanding(HWND hwndTV, NMTREEVIEW* pnmtv)
|
||||||
DWORD cName = MAX_NAME_LEN;
|
DWORD cName = MAX_NAME_LEN;
|
||||||
FILETIME LastWriteTime;
|
FILETIME LastWriteTime;
|
||||||
DWORD dwIndex = 0L;
|
DWORD dwIndex = 0L;
|
||||||
ShowWindow(hwndTV, SW_HIDE);
|
//ShowWindow(hwndTV, SW_HIDE);
|
||||||
while (RegEnumKeyEx(hNewKey, dwIndex, Name, &cName, NULL, NULL, NULL, &LastWriteTime) == ERROR_SUCCESS) {
|
while (RegEnumKeyEx(hNewKey, dwIndex, Name, &cName, NULL, NULL, NULL, &LastWriteTime) == ERROR_SUCCESS) {
|
||||||
DWORD dwCount = 0L;
|
DWORD dwCount = 0L;
|
||||||
errCode = RegOpenKeyEx(hNewKey, Name, 0, KEY_READ, &hKey);
|
errCode = RegOpenKeyEx(hNewKey, Name, 0, KEY_READ, &hKey);
|
||||||
|
@ -226,8 +225,7 @@ BOOL OnTreeExpanding(HWND hwndTV, NMTREEVIEW* pnmtv)
|
||||||
cName = MAX_NAME_LEN;
|
cName = MAX_NAME_LEN;
|
||||||
++dwIndex;
|
++dwIndex;
|
||||||
}
|
}
|
||||||
ShowWindow(hwndTV, SW_SHOW);
|
//ShowWindow(hwndTV, SW_SHOWNOACTIVATE);
|
||||||
//UpdateStatus(hwndTV, pnmtv->itemNew.hItem);
|
|
||||||
RegCloseKey(hNewKey);
|
RegCloseKey(hNewKey);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
@ -236,8 +234,6 @@ BOOL OnTreeExpanding(HWND hwndTV, NMTREEVIEW* pnmtv)
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
|
||||||
|
|
||||||
// CreateTreeView - creates a tree view control.
|
// CreateTreeView - creates a tree view control.
|
||||||
// Returns the handle to the new control if successful, or NULL otherwise.
|
// Returns the handle to the new control if successful, or NULL otherwise.
|
||||||
// hwndParent - handle to the control's parent window.
|
// 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.
|
// Get the dimensions of the parent window's client area, and create the tree view control.
|
||||||
GetClientRect(hwndParent, &rcClient);
|
GetClientRect(hwndParent, &rcClient);
|
||||||
hwndTV = CreateWindowEx(0, WC_TREEVIEW, _T("Tree View"),
|
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,
|
0, 0, rcClient.right, rcClient.bottom,
|
||||||
hwndParent, (HMENU)id, hInst, NULL);
|
hwndParent, (HMENU)id, hInst, NULL);
|
||||||
// Initialize the image list, and add items to the control.
|
// Initialize the image list, and add items to the control.
|
||||||
|
@ -260,4 +256,3 @@ HWND CreateTreeView(HWND hwndParent, LPTSTR pHostName, int id)
|
||||||
}
|
}
|
||||||
return hwndTV;
|
return hwndTV;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -30,10 +30,13 @@ RCFLAGS = -DGCC -D_WIN32_IE=0x0400
|
||||||
|
|
||||||
|
|
||||||
OBJS = framewnd.o \
|
OBJS = framewnd.o \
|
||||||
childwnd.o \
|
childwnd.o \
|
||||||
main.o
|
listview.o \
|
||||||
|
treeview.o \
|
||||||
|
settings.o \
|
||||||
|
main.o
|
||||||
|
|
||||||
LIBS = -lgdi32 -luser32 -lkernel32 -lcomctl32
|
LIBS = -lgdi32 -luser32 -lkernel32 -ladvapi32 -lcomctl32 -lcomdlg32
|
||||||
|
|
||||||
all: $(TARGET).exe
|
all: $(TARGET).exe
|
||||||
|
|
||||||
|
@ -44,13 +47,20 @@ $(TARGET).exe: $(OBJS) $(TARGET).coff
|
||||||
$(NM) --numeric-sort $(TARGET).exe > $(TARGET).sym
|
$(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:
|
clean:
|
||||||
- $(RM) $(OBJS)
|
- $(RM) $(OBJS)
|
||||||
|
|
|
@ -38,9 +38,42 @@
|
||||||
#define ASSERT assert
|
#define ASSERT assert
|
||||||
|
|
||||||
#include "main.h"
|
#include "main.h"
|
||||||
|
#include "framewnd.h"
|
||||||
#include "childwnd.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)
|
static void draw_splitbar(HWND hWnd, int x)
|
||||||
{
|
{
|
||||||
|
@ -54,27 +87,57 @@ static void draw_splitbar(HWND hWnd, int x)
|
||||||
ReleaseDC(hWnd, hdc);
|
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)
|
static void OnPaint(HWND hWnd, ChildWnd* pChildWnd)
|
||||||
{
|
{
|
||||||
PAINTSTRUCT ps;
|
HBRUSH lastBrush;
|
||||||
RECT rt;
|
PAINTSTRUCT ps;
|
||||||
HDC hdc;
|
RECT rt;
|
||||||
|
|
||||||
GetClientRect(hWnd, &rt);
|
BeginPaint(hWnd, &ps);
|
||||||
hdc = BeginPaint(hWnd, &ps);
|
GetClientRect(hWnd, &rt);
|
||||||
FillRect(ps.hdc, &rt, GetStockObject(BLACK_BRUSH));
|
lastBrush = SelectObject(ps.hdc, (HBRUSH)GetStockObject(COLOR_SPLITBAR));
|
||||||
EndPaint(hWnd, &ps);
|
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) {
|
switch (LOWORD(wParam)) {
|
||||||
//resize_tree(pChildWnd, LOWORD(lParam), HIWORD(lParam));
|
// Parse the menu selections:
|
||||||
}
|
// case ID_REGISTRY_EXIT:
|
||||||
|
// DestroyWindow(hWnd);
|
||||||
|
// break;
|
||||||
|
default:
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
//
|
//
|
||||||
// FUNCTION: ChildWndProc(HWND, unsigned, WORD, LONG)
|
// FUNCTION: ChildWndProc(HWND, unsigned, WORD, LONG)
|
||||||
//
|
//
|
||||||
|
@ -92,6 +155,16 @@ LRESULT CALLBACK ChildWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lPa
|
||||||
ASSERT(pChildWnd);
|
ASSERT(pChildWnd);
|
||||||
|
|
||||||
switch (message) {
|
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:
|
case WM_PAINT:
|
||||||
OnPaint(hWnd, pChildWnd);
|
OnPaint(hWnd, pChildWnd);
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -105,57 +178,43 @@ LRESULT CALLBACK ChildWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lPa
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//goto def;
|
goto def;
|
||||||
break;
|
|
||||||
|
|
||||||
case WM_DESTROY:
|
|
||||||
PostQuitMessage(0);
|
|
||||||
break;
|
|
||||||
case WM_LBUTTONDOWN: {
|
case WM_LBUTTONDOWN: {
|
||||||
RECT rt;
|
RECT rt;
|
||||||
int x = LOWORD(lParam);
|
int x = LOWORD(lParam);
|
||||||
GetClientRect(hWnd, &rt);
|
GetClientRect(hWnd, &rt);
|
||||||
if (x>=pChildWnd->nSplitPos-SPLIT_WIDTH/2 && x<pChildWnd->nSplitPos+SPLIT_WIDTH/2+1) {
|
if (x>=pChildWnd->nSplitPos-SPLIT_WIDTH/2 && x<pChildWnd->nSplitPos+SPLIT_WIDTH/2+1) {
|
||||||
last_split = pChildWnd->nSplitPos;
|
last_split = pChildWnd->nSplitPos;
|
||||||
#ifdef _NO_EXTENSIONS
|
|
||||||
draw_splitbar(hWnd, last_split);
|
draw_splitbar(hWnd, last_split);
|
||||||
#endif
|
|
||||||
SetCapture(hWnd);
|
SetCapture(hWnd);
|
||||||
}
|
}
|
||||||
break;}
|
break;}
|
||||||
|
|
||||||
case WM_LBUTTONUP:
|
case WM_LBUTTONUP:
|
||||||
if (GetCapture() == hWnd) {
|
if (GetCapture() == hWnd) {
|
||||||
#ifdef _NO_EXTENSIONS
|
|
||||||
RECT rt;
|
RECT rt;
|
||||||
int x = LOWORD(lParam);
|
int x = LOWORD(lParam);
|
||||||
draw_splitbar(hWnd, last_split);
|
draw_splitbar(hWnd, last_split);
|
||||||
last_split = -1;
|
last_split = -1;
|
||||||
GetClientRect(hWnd, &rt);
|
GetClientRect(hWnd, &rt);
|
||||||
pChildWnd->nSplitPos = x;
|
pChildWnd->nSplitPos = x;
|
||||||
//resize_tree(pChildWnd, rt.right, rt.bottom);
|
ResizeWnd(pChildWnd, rt.right, rt.bottom);
|
||||||
#endif
|
|
||||||
ReleaseCapture();
|
ReleaseCapture();
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
#ifdef _NO_EXTENSIONS
|
|
||||||
case WM_CAPTURECHANGED:
|
case WM_CAPTURECHANGED:
|
||||||
if (GetCapture()==hWnd && last_split>=0)
|
if (GetCapture()==hWnd && last_split>=0)
|
||||||
draw_splitbar(hWnd, last_split);
|
draw_splitbar(hWnd, last_split);
|
||||||
break;
|
break;
|
||||||
#endif
|
|
||||||
case WM_KEYDOWN:
|
case WM_KEYDOWN:
|
||||||
if (wParam == VK_ESCAPE)
|
if (wParam == VK_ESCAPE)
|
||||||
if (GetCapture() == hWnd) {
|
if (GetCapture() == hWnd) {
|
||||||
RECT rt;
|
RECT rt;
|
||||||
#ifdef _NO_EXTENSIONS
|
|
||||||
draw_splitbar(hWnd, last_split);
|
draw_splitbar(hWnd, last_split);
|
||||||
#else
|
|
||||||
pChildWnd->nSplitPos = last_split;
|
|
||||||
#endif
|
|
||||||
GetClientRect(hWnd, &rt);
|
GetClientRect(hWnd, &rt);
|
||||||
//resize_tree(pChildWnd, rt.right, rt.bottom);
|
ResizeWnd(pChildWnd, rt.right, rt.bottom);
|
||||||
last_split = -1;
|
last_split = -1;
|
||||||
ReleaseCapture();
|
ReleaseCapture();
|
||||||
SetCursor(LoadCursor(0, IDC_ARROW));
|
SetCursor(LoadCursor(0, IDC_ARROW));
|
||||||
|
@ -166,7 +225,6 @@ LRESULT CALLBACK ChildWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lPa
|
||||||
if (GetCapture() == hWnd) {
|
if (GetCapture() == hWnd) {
|
||||||
RECT rt;
|
RECT rt;
|
||||||
int x = LOWORD(lParam);
|
int x = LOWORD(lParam);
|
||||||
#ifdef _NO_EXTENSIONS
|
|
||||||
HDC hdc = GetDC(hWnd);
|
HDC hdc = GetDC(hWnd);
|
||||||
GetClientRect(hWnd, &rt);
|
GetClientRect(hWnd, &rt);
|
||||||
rt.left = last_split-SPLIT_WIDTH/2;
|
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;
|
rt.right = x+SPLIT_WIDTH/2+1;
|
||||||
InvertRect(hdc, &rt);
|
InvertRect(hdc, &rt);
|
||||||
ReleaseDC(hWnd, hdc);
|
ReleaseDC(hWnd, hdc);
|
||||||
#else
|
|
||||||
GetClientRect(hWnd, &rt);
|
|
||||||
if (x>=0 && x<rt.right) {
|
|
||||||
pChildWnd->nSplitPos = 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;
|
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:
|
case WM_SETFOCUS:
|
||||||
SetCurrentDirectory(pChildWnd->szPath);
|
SetFocus(pChildWnd->nFocusPanel? pChildWnd->hListWnd: pChildWnd->hTreeWnd);
|
||||||
SetFocus(pChildWnd->nFocusPanel? pChildWnd->hRightWnd: pChildWnd->hLeftWnd);
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case WM_TIMER:
|
case WM_NOTIFY:
|
||||||
break;
|
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:
|
keyPathLen = 0;
|
||||||
// Parse the menu selections:
|
keyPath[0] = _T('\0');
|
||||||
switch (LOWORD(wParam)) {
|
MakeFullRegPath(pChildWnd->hTreeWnd, ((NMTREEVIEW*)lParam)->itemNew.hItem, keyPath, &keyPathLen, sizeof(keyPath));
|
||||||
case IDM_EXIT:
|
SendMessage(hStatusBar, SB_SETTEXT, 0, (LPARAM)keyPath);
|
||||||
DestroyWindow(hWnd);
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
return DefMDIChildProc(hWnd, message, wParam, lParam);
|
goto def;
|
||||||
|
}
|
||||||
|
} else
|
||||||
|
if ((int)wParam == LIST_WINDOW) {
|
||||||
|
if (!SendMessage(pChildWnd->hListWnd, message, wParam, lParam)) {
|
||||||
|
goto def;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case WM_SIZE:
|
case WM_SIZE:
|
||||||
if (wParam != SIZE_MINIMIZED) {
|
if (wParam != SIZE_MINIMIZED && pChildWnd != NULL) {
|
||||||
OnSize(pChildWnd, wParam, lParam);
|
ResizeWnd(pChildWnd, LOWORD(lParam), HIWORD(lParam));
|
||||||
}
|
}
|
||||||
// fall through
|
// fall through
|
||||||
default:
|
default: def:
|
||||||
return DefMDIChildProc(hWnd, message, wParam, lParam);
|
return DefMDIChildProc(hWnd, message, wParam, lParam);
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* ReactOS Application MDI Child Window
|
* ReactOS regedt32
|
||||||
*
|
*
|
||||||
* childwnd.h
|
* childwnd.h
|
||||||
*
|
*
|
||||||
|
@ -20,8 +20,8 @@
|
||||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef __CHILD_WND_H__
|
#ifndef __CHILDWND_H__
|
||||||
#define __CHILD_WND_H__
|
#define __CHILDWND_H__
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C" {
|
extern "C" {
|
||||||
|
@ -39,4 +39,4 @@ LRESULT CALLBACK ChildWndProc(HWND, UINT, WPARAM, LPARAM);
|
||||||
};
|
};
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#endif // __CHILD_WND_H__
|
#endif // __CHILDWND_H__
|
||||||
|
|
|
@ -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
|
BOOL bInMenuLoop = FALSE; // Tells us if we are in the menu loop
|
||||||
|
|
||||||
static HHOOK hcbthook;
|
static HHOOK hcbthook;
|
||||||
static ChildWnd* newchild = NULL;
|
static ChildWnd* newchild = NULL;
|
||||||
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
// Local module support methods
|
// 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)
|
static LRESULT CALLBACK CBTProc(int code, WPARAM wParam, LPARAM lParam)
|
||||||
{
|
{
|
||||||
if (code == HCBT_CREATEWND && newchild) {
|
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);
|
return CallNextHookEx(hcbthook, code, wParam, lParam);
|
||||||
}
|
}
|
||||||
|
|
||||||
static HWND InitChildWindow(LPTSTR param)
|
static ChildWnd* alloc_child_window(LPCTSTR szKeyName, HKEY hKey)
|
||||||
{
|
{
|
||||||
//TCHAR drv[_MAX_DRIVE];
|
ChildWnd* pChildWnd = (ChildWnd*)malloc(sizeof(ChildWnd));
|
||||||
TCHAR path[MAX_PATH];
|
|
||||||
ChildWnd* pChildWnd = NULL;
|
memset(pChildWnd, 0, sizeof(ChildWnd));
|
||||||
pChildWnd = (ChildWnd*)malloc(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) {
|
if (pChildWnd != NULL) {
|
||||||
MDICREATESTRUCT mcs = {
|
MDICREATESTRUCT mcs = { szChildClass, szKeyName, hInst,
|
||||||
szChildClass, path, hInst,
|
CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT,
|
||||||
CW_USEDEFAULT, CW_USEDEFAULT,
|
0/*style*/, (LPARAM)hKey/*lParam*/};
|
||||||
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;
|
|
||||||
hcbthook = SetWindowsHookEx(WH_CBT, CBTProc, 0, GetCurrentThreadId());
|
hcbthook = SetWindowsHookEx(WH_CBT, CBTProc, 0, GetCurrentThreadId());
|
||||||
newchild = pChildWnd;
|
newchild = pChildWnd;
|
||||||
pChildWnd->hWnd = (HWND)SendMessage(hMDIClient, WM_MDICREATE, 0, (LPARAM)&mcs);
|
pChildWnd->hWnd = (HWND)SendMessage(hMDIClient, WM_MDICREATE, 0, (LPARAM)&mcs);
|
||||||
UnhookWindowsHookEx(hcbthook);
|
UnhookWindowsHookEx(hcbthook);
|
||||||
if (pChildWnd->hWnd == NULL) {
|
if (pChildWnd->hWnd != NULL) {
|
||||||
|
return pChildWnd->hWnd;
|
||||||
|
} else {
|
||||||
free(pChildWnd);
|
free(pChildWnd);
|
||||||
newchild = pChildWnd = NULL;
|
newchild = pChildWnd = NULL;
|
||||||
}
|
}
|
||||||
return pChildWnd->hWnd;
|
|
||||||
}
|
}
|
||||||
return 0;
|
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)
|
static BOOL CALLBACK CloseEnumProc(HWND hWnd, LPARAM lParam)
|
||||||
{
|
{
|
||||||
if (!GetWindow(hWnd, GW_OWNER)) {
|
if (!GetWindow(hWnd, GW_OWNER)) {
|
||||||
|
@ -140,7 +195,7 @@ typedef struct {
|
||||||
INT nSizeMax;
|
INT nSizeMax;
|
||||||
} CHOOSEFONT, *LPCHOOSEFONT;
|
} CHOOSEFONT, *LPCHOOSEFONT;
|
||||||
*/
|
*/
|
||||||
void CmdOptionsFont(HWND hWnd)
|
static void CmdOptionsFont(HWND hWnd)
|
||||||
{
|
{
|
||||||
// LOGFONT LogFont;
|
// LOGFONT LogFont;
|
||||||
CHOOSEFONT cf = { sizeof(CHOOSEFONT), hWnd, NULL,
|
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,
|
PRINTDLG pd = { sizeof(PRINTDLG), hWnd,
|
||||||
0, // hDevMode;
|
0, // hDevMode;
|
||||||
|
@ -257,7 +312,7 @@ typedef struct tagOFN {
|
||||||
*/
|
*/
|
||||||
//GetOpenFileName(...);
|
//GetOpenFileName(...);
|
||||||
//GetSaveFileName(...);
|
//GetSaveFileName(...);
|
||||||
void CmdRegistrySaveSubTreeAs(HWND hWnd)
|
static void CmdRegistrySaveSubTreeAs(HWND hWnd)
|
||||||
{
|
{
|
||||||
OPENFILENAME ofn;// = { };
|
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);
|
||||||
|
}
|
||||||
|
|
||||||
static LRESULT _CmdWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
|
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 BOOL _CmdWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
|
||||||
{
|
{
|
||||||
HWND hChildWnd;
|
HWND hChildWnd;
|
||||||
switch (LOWORD(wParam)) {
|
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))
|
if (!SendMessage(hChildWnd, WM_QUERYENDSESSION, 0, 0))
|
||||||
SendMessage(hMDIClient, WM_MDIDESTROY, (WPARAM)hChildWnd, 0);
|
SendMessage(hMDIClient, WM_MDIDESTROY, (WPARAM)hChildWnd, 0);
|
||||||
break;
|
break;
|
||||||
// case ID_FILE_EXIT:
|
case ID_REGISTRY_OPENLOCAL:
|
||||||
// SendMessage(hWnd, WM_CLOSE, 0, 0);
|
CreateClientChildren(hWnd);
|
||||||
// break;
|
break;
|
||||||
// case IDM_EXIT:
|
case ID_REGISTRY_CLOSE:
|
||||||
// DestroyWindow(hWnd);
|
SendMessage(hWnd, WM_COMMAND, ID_WINDOW_CLOSEALL, 0);
|
||||||
// break;
|
// SendMessage(hWnd, WM_CLOSE, 0, 0);
|
||||||
// case ID_FILE_OPEN:
|
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_PRINTSUBTREE:
|
||||||
case ID_REGISTRY_PRINTERSETUP:
|
case ID_REGISTRY_PRINTERSETUP:
|
||||||
CmdRegistryPrint(hWnd, LOWORD(wParam));
|
CmdRegistryPrint(hWnd, LOWORD(wParam));
|
||||||
|
@ -297,13 +396,83 @@ static LRESULT _CmdWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam
|
||||||
case ID_REGISTRY_SAVESUBTREEAS:
|
case ID_REGISTRY_SAVESUBTREEAS:
|
||||||
CmdRegistrySaveSubTreeAs(hWnd);
|
CmdRegistrySaveSubTreeAs(hWnd);
|
||||||
break;
|
break;
|
||||||
|
case ID_REGISTRY_EXIT:
|
||||||
|
DestroyWindow(hWnd);
|
||||||
|
break;
|
||||||
case ID_OPTIONS_FONT:
|
case ID_OPTIONS_FONT:
|
||||||
CmdOptionsFont(hWnd);
|
CmdOptionsFont(hWnd);
|
||||||
break;
|
break;
|
||||||
case ID_REGISTRY_OPENLOCAL:
|
|
||||||
case ID_WINDOW_NEW_WINDOW:
|
case ID_VIEW_STATUSBAR:
|
||||||
InitChildWindow("Child Window");
|
toggle_child(hWnd, LOWORD(wParam), hStatusBar);
|
||||||
return 0;
|
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:
|
case ID_WINDOW_CASCADE:
|
||||||
SendMessage(hMDIClient, WM_MDICASCADE, 0, 0);
|
SendMessage(hMDIClient, WM_MDICASCADE, 0, 0);
|
||||||
break;
|
break;
|
||||||
|
@ -313,7 +482,7 @@ static LRESULT _CmdWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam
|
||||||
case ID_WINDOW_TILE_VERT:
|
case ID_WINDOW_TILE_VERT:
|
||||||
SendMessage(hMDIClient, WM_MDITILE, MDITILE_VERTICAL, 0);
|
SendMessage(hMDIClient, WM_MDITILE, MDITILE_VERTICAL, 0);
|
||||||
break;
|
break;
|
||||||
case ID_WINDOW_ARRANGE_ICONS:
|
case ID_WINDOW_ARRANGEICONS:
|
||||||
SendMessage(hMDIClient, WM_MDIICONARRANGE, 0, 0);
|
SendMessage(hMDIClient, WM_MDIICONARRANGE, 0, 0);
|
||||||
break;
|
break;
|
||||||
case ID_HELP_ABOUT:
|
case ID_HELP_ABOUT:
|
||||||
|
@ -325,13 +494,9 @@ static LRESULT _CmdWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
hChildWnd = (HWND)SendMessage(hMDIClient, WM_MDIGETACTIVE, 0, 0);
|
return FALSE;
|
||||||
if (IsWindow(hChildWnd))
|
}
|
||||||
SendMessage(hChildWnd, WM_COMMAND, wParam, lParam);
|
return TRUE;
|
||||||
else
|
|
||||||
return DefFrameProc(hWnd, hMDIClient, message, wParam, lParam);
|
|
||||||
}
|
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
@ -353,15 +518,38 @@ LRESULT CALLBACK FrameWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lPa
|
||||||
HMENU hMenuWindow = GetSubMenu(hMenuFrame, GetMenuItemCount(hMenuFrame)-2);
|
HMENU hMenuWindow = GetSubMenu(hMenuFrame, GetMenuItemCount(hMenuFrame)-2);
|
||||||
CLIENTCREATESTRUCT ccs = { hMenuWindow, IDW_FIRST_CHILD };
|
CLIENTCREATESTRUCT ccs = { hMenuWindow, IDW_FIRST_CHILD };
|
||||||
hMDIClient = CreateWindowEx(0, _T("MDICLIENT"), NULL,
|
hMDIClient = CreateWindowEx(0, _T("MDICLIENT"), NULL,
|
||||||
WS_CHILD|WS_CLIPCHILDREN|WS_VSCROLL|WS_HSCROLL|WS_VISIBLE|WS_BORDER,
|
WS_EX_MDICHILD|WS_CHILD|WS_CLIPCHILDREN|WS_VISIBLE,
|
||||||
0, 0, 0, 0,
|
0, 0, 0, 0,
|
||||||
hWnd, (HMENU)0, hInst, &ccs);
|
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;
|
break;
|
||||||
case WM_COMMAND:
|
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;
|
break;
|
||||||
|
case WM_SIZE:
|
||||||
|
resize_frame_client(hWnd);
|
||||||
|
break;
|
||||||
case WM_DESTROY:
|
case WM_DESTROY:
|
||||||
|
WinHelp(hWnd, _T("regedt32"), HELP_QUIT, 0);
|
||||||
PostQuitMessage(0);
|
PostQuitMessage(0);
|
||||||
break;
|
break;
|
||||||
case WM_QUERYENDSESSION:
|
case WM_QUERYENDSESSION:
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* ReactOS Application Main Window
|
* ReactOS regedt32
|
||||||
*
|
*
|
||||||
* framewnd.h
|
* framewnd.h
|
||||||
*
|
*
|
||||||
|
@ -20,8 +20,8 @@
|
||||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef __FRAME_WND_H__
|
#ifndef __FRAMEWND_H__
|
||||||
#define __FRAME_WND_H__
|
#define __FRAMEWND_H__
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C" {
|
extern "C" {
|
||||||
|
@ -33,10 +33,14 @@ extern "C" {
|
||||||
|
|
||||||
|
|
||||||
LRESULT CALLBACK FrameWndProc(HWND, UINT, WPARAM, LPARAM);
|
LRESULT CALLBACK FrameWndProc(HWND, UINT, WPARAM, LPARAM);
|
||||||
|
void CreateClientChildren(HWND hWnd);
|
||||||
|
|
||||||
|
void SetupStatusBar(HWND hWnd, BOOL bResize);
|
||||||
|
void UpdateStatusBar(void);
|
||||||
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
};
|
};
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#endif // __FRAME_WND_H__
|
#endif // __FRAMEWND_H__
|
||||||
|
|
364
rosapps/regedt32/listview.c
Normal file
364
rosapps/regedt32/listview.c
Normal file
|
@ -0,0 +1,364 @@
|
||||||
|
/*
|
||||||
|
* ReactOS regedit
|
||||||
|
*
|
||||||
|
* listview.c
|
||||||
|
*
|
||||||
|
* Copyright (C) 2002 Robert Dickenson <robd@reactos.org>
|
||||||
|
*
|
||||||
|
* 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 <windows.h>
|
||||||
|
#include <commctrl.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <malloc.h>
|
||||||
|
#include <memory.h>
|
||||||
|
#include <tchar.h>
|
||||||
|
#include <process.h>
|
||||||
|
#include <stdio.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include <windowsx.h>
|
||||||
|
#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;
|
||||||
|
}
|
||||||
|
|
43
rosapps/regedt32/listview.h
Normal file
43
rosapps/regedt32/listview.h
Normal file
|
@ -0,0 +1,43 @@
|
||||||
|
/*
|
||||||
|
* ReactOS regedit
|
||||||
|
*
|
||||||
|
* listview.h
|
||||||
|
*
|
||||||
|
* Copyright (C) 2002 Robert Dickenson <robd@reactos.org>
|
||||||
|
*
|
||||||
|
* 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__
|
|
@ -37,6 +37,7 @@
|
||||||
#include "main.h"
|
#include "main.h"
|
||||||
#include "framewnd.h"
|
#include "framewnd.h"
|
||||||
#include "childwnd.h"
|
#include "childwnd.h"
|
||||||
|
#include "settings.h"
|
||||||
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
@ -46,16 +47,27 @@
|
||||||
HINSTANCE hInst;
|
HINSTANCE hInst;
|
||||||
HACCEL hAccel;
|
HACCEL hAccel;
|
||||||
HWND hFrameWnd;
|
HWND hFrameWnd;
|
||||||
HMENU hMenuFrame;
|
|
||||||
HWND hMDIClient;
|
HWND hMDIClient;
|
||||||
HWND hStatusBar;
|
HWND hStatusBar;
|
||||||
|
HMENU hMenuFrame;
|
||||||
|
|
||||||
TCHAR szTitle[MAX_LOADSTRING];
|
TCHAR szTitle[MAX_LOADSTRING];
|
||||||
TCHAR szFrameClass[MAX_LOADSTRING];
|
TCHAR szFrameClass[MAX_LOADSTRING];
|
||||||
TCHAR szChildClass[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)
|
BOOL InitInstance(HINSTANCE hInstance, int nCmdShow)
|
||||||
{
|
{
|
||||||
WNDCLASSEX wcFrame = {
|
WNDCLASSEX wcFrame = {
|
||||||
|
@ -77,7 +89,7 @@ BOOL InitInstance(HINSTANCE hInstance, int nCmdShow)
|
||||||
|
|
||||||
WNDCLASSEX wcChild = {
|
WNDCLASSEX wcChild = {
|
||||||
sizeof(WNDCLASSEX),
|
sizeof(WNDCLASSEX),
|
||||||
CS_HREDRAW | CS_VREDRAW/*style*/,
|
CS_HREDRAW | CS_VREDRAW | CS_NOCLOSE/*style*/,
|
||||||
ChildWndProc,
|
ChildWndProc,
|
||||||
0/*cbClsExtra*/,
|
0/*cbClsExtra*/,
|
||||||
sizeof(HANDLE)/*cbWndExtra*/,
|
sizeof(HANDLE)/*cbWndExtra*/,
|
||||||
|
@ -93,17 +105,8 @@ BOOL InitInstance(HINSTANCE hInstance, int nCmdShow)
|
||||||
};
|
};
|
||||||
ATOM hChildWndClass = RegisterClassEx(&wcChild); // register child windows class
|
ATOM hChildWndClass = RegisterClassEx(&wcChild); // register child windows class
|
||||||
|
|
||||||
HMENU hMenu = LoadMenu(hInstance, MAKEINTRESOURCE(IDR_REGEDT32_MENU));
|
hMenuFrame = LoadMenu(hInstance, MAKEINTRESOURCE(IDR_REGEDT32_MENU));
|
||||||
HMENU hMenuOptions = GetSubMenu(hMenu, ID_OPTIONS_MENU);
|
// hAccel = LoadAccelerators(hInstance, MAKEINTRESOURCE(IDC_REGEDT32));
|
||||||
HMENU hChildMenu = LoadMenu(hInstance, MAKEINTRESOURCE(IDR_REGEDT32_MENU));
|
|
||||||
|
|
||||||
INITCOMMONCONTROLSEX icc = {
|
|
||||||
sizeof(INITCOMMONCONTROLSEX),
|
|
||||||
ICC_BAR_CLASSES
|
|
||||||
};
|
|
||||||
|
|
||||||
hMenuFrame = hMenu;
|
|
||||||
hAccel = LoadAccelerators(hInstance, MAKEINTRESOURCE(IDC_REGEDT32));
|
|
||||||
|
|
||||||
// Initialize the Windows Common Controls DLL
|
// Initialize the Windows Common Controls DLL
|
||||||
InitCommonControls();
|
InitCommonControls();
|
||||||
|
@ -111,26 +114,19 @@ BOOL InitInstance(HINSTANCE hInstance, int nCmdShow)
|
||||||
hFrameWnd = CreateWindowEx(0, (LPCTSTR)(int)hFrameWndClass, szTitle,
|
hFrameWnd = CreateWindowEx(0, (LPCTSTR)(int)hFrameWndClass, szTitle,
|
||||||
WS_OVERLAPPEDWINDOW | WS_CLIPCHILDREN,
|
WS_OVERLAPPEDWINDOW | WS_CLIPCHILDREN,
|
||||||
CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT,
|
CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT,
|
||||||
NULL/*hWndParent*/, hMenuFrame, hInstance, NULL/*lpParam*/);
|
NULL, hMenuFrame, hInstance, NULL/*lpParam*/);
|
||||||
if (!hFrameWnd) {
|
if (!hFrameWnd) {
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if 0
|
|
||||||
{
|
|
||||||
int nParts[3];
|
|
||||||
// Create the status bar
|
// Create the status bar
|
||||||
hStatusBar = CreateStatusWindow(WS_VISIBLE|WS_CHILD|WS_CLIPSIBLINGS|SBT_NOBORDERS, "", hFrameWnd, STATUS_WINDOW);
|
hStatusBar = CreateStatusWindow(WS_VISIBLE|WS_CHILD|WS_CLIPSIBLINGS|SBT_NOBORDERS,
|
||||||
if (!hStatusBar)
|
_T(""), hFrameWnd, STATUS_WINDOW);
|
||||||
return FALSE;
|
if (hStatusBar) {
|
||||||
// Create the status bar panes
|
// Create the status bar panes
|
||||||
nParts[0] = 100;
|
SetupStatusBar(hFrameWnd, FALSE);
|
||||||
nParts[1] = 210;
|
CheckMenuItem(GetSubMenu(hMenuFrame, ID_VIEW_MENU), ID_VIEW_STATUSBAR, MF_BYCOMMAND|MF_CHECKED);
|
||||||
nParts[2] = 400;
|
|
||||||
SendMessage(hStatusBar, SB_SETPARTS, 3, (long)nParts);
|
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
ShowWindow(hFrameWnd, nCmdShow);
|
ShowWindow(hFrameWnd, nCmdShow);
|
||||||
UpdateWindow(hFrameWnd);
|
UpdateWindow(hFrameWnd);
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
@ -160,6 +156,9 @@ int APIENTRY WinMain(HINSTANCE hInstance,
|
||||||
// Store instance handle in our global variable
|
// Store instance handle in our global variable
|
||||||
hInst = hInstance;
|
hInst = hInstance;
|
||||||
|
|
||||||
|
// Load our settings from the registry
|
||||||
|
LoadSettings();
|
||||||
|
|
||||||
// Perform application initialization:
|
// Perform application initialization:
|
||||||
if (!InitInstance(hInstance, nCmdShow)) {
|
if (!InitInstance(hInstance, nCmdShow)) {
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
@ -175,6 +174,8 @@ int APIENTRY WinMain(HINSTANCE hInstance,
|
||||||
DispatchMessage(&msg);
|
DispatchMessage(&msg);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
// Save our settings to the registry
|
||||||
|
SaveSettings();
|
||||||
ExitInstance();
|
ExitInstance();
|
||||||
return msg.wParam;
|
return msg.wParam;
|
||||||
}
|
}
|
||||||
|
|
|
@ -34,40 +34,74 @@ extern "C" {
|
||||||
#include "resource.h"
|
#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
|
enum OPTION_FLAGS {
|
||||||
#define MAX_LOADSTRING 100
|
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 {
|
typedef struct {
|
||||||
HWND hWnd;
|
HWND hWnd;
|
||||||
HWND hLeftWnd;
|
HWND hTreeWnd;
|
||||||
HWND hRightWnd;
|
HWND hListWnd;
|
||||||
int nFocusPanel; // 0: left 1: right
|
int nFocusPanel; // 0: left 1: right
|
||||||
int nSplitPos;
|
int nSplitPos;
|
||||||
WINDOWPLACEMENT pos;
|
WINDOWPLACEMENT pos;
|
||||||
TCHAR szPath[MAX_PATH];
|
TCHAR szKeyName[MAX_PATH];
|
||||||
|
HKEY hKey;
|
||||||
} ChildWnd;
|
} ChildWnd;
|
||||||
|
|
||||||
//void UpdateStatusBar(void);
|
|
||||||
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
// Global Variables:
|
// Global Variables:
|
||||||
|
//
|
||||||
extern HINSTANCE hInst;
|
extern HINSTANCE hInst;
|
||||||
extern HACCEL hAccel;
|
extern HACCEL hAccel;
|
||||||
extern HWND hFrameWnd;
|
extern HWND hFrameWnd;
|
||||||
extern HMENU hMenuFrame;
|
extern HMENU hMenuFrame;
|
||||||
extern HWND hMDIClient;
|
extern HWND hMDIClient;
|
||||||
//extern HWND hStatusBar;
|
extern HWND hStatusBar;
|
||||||
//extern HWND hToolBar;
|
//extern HWND hToolBar;
|
||||||
extern HFONT hFont;
|
extern HFONT hFont;
|
||||||
|
extern enum OPTION_FLAGS Options;
|
||||||
|
|
||||||
extern TCHAR szTitle[];
|
extern TCHAR szTitle[];
|
||||||
extern TCHAR szFrameClass[];
|
extern TCHAR szFrameClass[];
|
||||||
extern TCHAR szChildClass[];
|
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
|
#ifdef __cplusplus
|
||||||
};
|
};
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -1,3 +1,6 @@
|
||||||
|
#include <defines.h>
|
||||||
|
#include <reactos/resource.h>
|
||||||
|
|
||||||
//Microsoft Developer Studio generated resource script.
|
//Microsoft Developer Studio generated resource script.
|
||||||
//
|
//
|
||||||
#include "resource.h"
|
#include "resource.h"
|
||||||
|
@ -34,6 +37,15 @@ LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
|
||||||
IDI_REGEDT32 ICON DISCARDABLE "res/regedt32.ico"
|
IDI_REGEDT32 ICON DISCARDABLE "res/regedt32.ico"
|
||||||
IDI_SMALL ICON DISCARDABLE "res/small.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
|
// Menu
|
||||||
|
@ -58,7 +70,7 @@ BEGIN
|
||||||
MENUITEM "P&rinter Setup...", ID_REGISTRY_PRINTERSETUP
|
MENUITEM "P&rinter Setup...", ID_REGISTRY_PRINTERSETUP
|
||||||
MENUITEM "Save Subtree &As...", ID_REGISTRY_SAVESUBTREEAS
|
MENUITEM "Save Subtree &As...", ID_REGISTRY_SAVESUBTREEAS
|
||||||
MENUITEM SEPARATOR
|
MENUITEM SEPARATOR
|
||||||
MENUITEM "E&xit", IDM_EXIT
|
MENUITEM "E&xit", ID_REGISTRY_EXIT
|
||||||
END
|
END
|
||||||
POPUP "&Edit"
|
POPUP "&Edit"
|
||||||
BEGIN
|
BEGIN
|
||||||
|
@ -82,15 +94,14 @@ BEGIN
|
||||||
END
|
END
|
||||||
POPUP "&View"
|
POPUP "&View"
|
||||||
BEGIN
|
BEGIN
|
||||||
MENUITEM "Tree &and Data", ID_VIEW_TREEANDDATA
|
MENUITEM "Tree &and Data", ID_VIEW_TREEANDDATA, CHECKED
|
||||||
, CHECKED, GRAYED
|
MENUITEM "&Tree only", ID_VIEW_TREEONLY
|
||||||
MENUITEM "&Tree only", ID_VIEW_TREEONLY, GRAYED
|
MENUITEM "&Data only", ID_VIEW_DATAONLY
|
||||||
MENUITEM "&Data only", ID_VIEW_DATAONLY, GRAYED
|
|
||||||
MENUITEM SEPARATOR
|
MENUITEM SEPARATOR
|
||||||
|
MENUITEM "Status &Bar", ID_VIEW_STATUSBAR
|
||||||
MENUITEM "&Split", ID_VIEW_SPLIT, GRAYED
|
MENUITEM "&Split", ID_VIEW_SPLIT, GRAYED
|
||||||
MENUITEM SEPARATOR
|
MENUITEM SEPARATOR
|
||||||
MENUITEM "Display &Binary Data", ID_VIEW_DISPLAYBINARYDATA
|
MENUITEM "Display &Binary Data", ID_VIEW_DISPLAYBINARYDATA
|
||||||
, GRAYED
|
|
||||||
MENUITEM SEPARATOR
|
MENUITEM SEPARATOR
|
||||||
MENUITEM "R&efresh All\tShift+F6", ID_VIEW_REFRESHALL, GRAYED
|
MENUITEM "R&efresh All\tShift+F6", ID_VIEW_REFRESHALL, GRAYED
|
||||||
MENUITEM "&Refresh Active\tF6", ID_VIEW_REFRESHACTIVE
|
MENUITEM "&Refresh Active\tF6", ID_VIEW_REFRESHACTIVE
|
||||||
|
@ -108,19 +119,15 @@ BEGIN
|
||||||
MENUITEM "&Font...", ID_OPTIONS_FONT
|
MENUITEM "&Font...", ID_OPTIONS_FONT
|
||||||
MENUITEM SEPARATOR
|
MENUITEM SEPARATOR
|
||||||
MENUITEM "&Auto Refresh", ID_OPTIONS_AUTOREFRESH
|
MENUITEM "&Auto Refresh", ID_OPTIONS_AUTOREFRESH
|
||||||
, CHECKED
|
|
||||||
MENUITEM "&Read Only Mode", ID_OPTIONS_READONLYMODE
|
MENUITEM "&Read Only Mode", ID_OPTIONS_READONLYMODE
|
||||||
MENUITEM "&Confirm on Delete", ID_OPTIONS_CONFIRMONDELETE
|
MENUITEM "&Confirm on Delete", ID_OPTIONS_CONFIRMONDELETE
|
||||||
, CHECKED
|
|
||||||
MENUITEM "&Save Settings on Exit", ID_OPTIONS_SAVESETTINGSONEXIT
|
MENUITEM "&Save Settings on Exit", ID_OPTIONS_SAVESETTINGSONEXIT
|
||||||
, CHECKED
|
|
||||||
END
|
END
|
||||||
POPUP "&Window"
|
POPUP "&Window"
|
||||||
BEGIN
|
BEGIN
|
||||||
MENUITEM "&Cascade\tShift+F5", ID_WINDOW_CASCADE
|
MENUITEM "&Cascade\tShift+F5", ID_WINDOW_CASCADE
|
||||||
MENUITEM "&Tile\tShift+F4", ID_WINDOW_TILE
|
MENUITEM "&Tile\tShift+F4", ID_WINDOW_TILE
|
||||||
MENUITEM "&Arrange Icons", ID_WINDOW_ARRANGE_ICONS
|
MENUITEM "&Arrange Icons", ID_WINDOW_ARRANGEICONS
|
||||||
MENUITEM SEPARATOR
|
|
||||||
END
|
END
|
||||||
POPUP "&Help"
|
POPUP "&Help"
|
||||||
BEGIN
|
BEGIN
|
||||||
|
@ -173,17 +180,68 @@ END
|
||||||
#endif // APSTUDIO_INVOKED
|
#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
|
// String Table
|
||||||
//
|
//
|
||||||
|
|
||||||
|
STRINGTABLE DISCARDABLE
|
||||||
|
BEGIN
|
||||||
|
IDS_LIST_COLUMN_NAME "Name"
|
||||||
|
IDS_LIST_COLUMN_TYPE "Type"
|
||||||
|
IDS_LIST_COLUMN_DATA "Data"
|
||||||
|
END
|
||||||
|
|
||||||
STRINGTABLE DISCARDABLE
|
STRINGTABLE DISCARDABLE
|
||||||
BEGIN
|
BEGIN
|
||||||
IDS_APP_TITLE "ReactOS Registry Editor"
|
IDS_APP_TITLE "ReactOS Registry Editor"
|
||||||
IDC_REGEDT32 "REGED32"
|
IDC_REGEDT32 "REGED32"
|
||||||
IDC_REGEDT32_FRAME "REGED32_FRAME"
|
IDC_REGEDT32_FRAME "REGED32_FRAME"
|
||||||
IDS_HELLO "Hello World!"
|
IDS_APP_REG_KEY "\\Regedt32"
|
||||||
|
IDS_APP_REG_PATH RES_STR_ROSAPP_REGISTRY_ROOT
|
||||||
END
|
END
|
||||||
|
|
||||||
#endif // English (U.S.) resources
|
#endif // English (U.S.) resources
|
||||||
|
|
BIN
rosapps/regedt32/res/folder1.bmp
Normal file
BIN
rosapps/regedt32/res/folder1.bmp
Normal file
Binary file not shown.
After Width: | Height: | Size: 246 B |
BIN
rosapps/regedt32/res/folder2.bmp
Normal file
BIN
rosapps/regedt32/res/folder2.bmp
Normal file
Binary file not shown.
After Width: | Height: | Size: 246 B |
BIN
rosapps/regedt32/res/folder3.bmp
Normal file
BIN
rosapps/regedt32/res/folder3.bmp
Normal file
Binary file not shown.
After Width: | Height: | Size: 246 B |
|
@ -2,7 +2,6 @@
|
||||||
// Microsoft Developer Studio generated include file.
|
// Microsoft Developer Studio generated include file.
|
||||||
// Used by regedt32.rc
|
// Used by regedt32.rc
|
||||||
//
|
//
|
||||||
#define IDW_FIRST_CHILD 200
|
|
||||||
|
|
||||||
#define ID_REGISTRY_MENU 0
|
#define ID_REGISTRY_MENU 0
|
||||||
#define ID_EDIT_MENU 1
|
#define ID_EDIT_MENU 1
|
||||||
|
@ -13,24 +12,30 @@
|
||||||
#define ID_WINDOW_MENU 6
|
#define ID_WINDOW_MENU 6
|
||||||
#define ID_HELP_MENU 7
|
#define ID_HELP_MENU 7
|
||||||
|
|
||||||
#define ID_WINDOW_CLOSE 798
|
#define IDS_LIST_COLUMN_FIRST 91
|
||||||
#define ID_WINDOW_CLOSEALL 799
|
#define IDS_LIST_COLUMN_NAME 91
|
||||||
#define STATUS_WINDOW 2001
|
#define IDS_LIST_COLUMN_TYPE 92
|
||||||
|
#define IDS_LIST_COLUMN_DATA 93
|
||||||
|
#define IDS_LIST_COLUMN_LAST 93
|
||||||
|
|
||||||
#define IDD_ABOUTBOX 103
|
#define IDD_ABOUTBOX 101
|
||||||
#define IDS_APP_TITLE 103
|
#define IDS_APP_TITLE 102
|
||||||
#define IDM_EXIT 105
|
#define IDI_REGEDT32 103
|
||||||
#define IDS_HELLO 106
|
#define IDI_SMALL 104
|
||||||
#define IDI_REGEDT32 107
|
#define IDC_REGEDT32 105
|
||||||
#define IDI_SMALL 108
|
#define IDC_REGEDT32_FRAME 106
|
||||||
#define IDC_REGEDT32 109
|
#define IDR_REGEDT32_MENU 107
|
||||||
#define IDC_REGEDT32_FRAME 110
|
#define IDS_APP_REG_KEY 108
|
||||||
#define IDR_REGEDT32_MENU 129
|
#define IDS_APP_REG_PATH 109
|
||||||
#define IDR_REGEDT_MENU 130
|
|
||||||
#define ID_HELP_ABOUT 32770
|
#define IDB_OPEN_FILE 132
|
||||||
#define ID_HELP_HELPTOPICS 32771
|
#define IDB_CLOSED_FILE 133
|
||||||
#define ID_FAVORITES_ADDTOFAVOURITES 32772
|
#define IDB_ROOT 134
|
||||||
#define ID_FAVORITES_REMOVEFAVOURITE 32773
|
|
||||||
|
#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_STATUSBAR 32774
|
||||||
#define ID_VIEW_SPLIT 32775
|
#define ID_VIEW_SPLIT 32775
|
||||||
#define ID_VIEW_REFRESH 32776
|
#define ID_VIEW_REFRESH 32776
|
||||||
|
@ -45,14 +50,17 @@
|
||||||
#define ID_EDIT_NEW_BINARYVALUE 32787
|
#define ID_EDIT_NEW_BINARYVALUE 32787
|
||||||
#define ID_EDIT_NEW_DWORDVALUE 32788
|
#define ID_EDIT_NEW_DWORDVALUE 32788
|
||||||
|
|
||||||
#define ID_WINDOW_NEW_WINDOW 32794
|
#define ID_REGISTRY_IMPORTREGISTRYFILE 32789
|
||||||
#define ID_WINDOW_CASCADE 32795
|
#define ID_REGISTRY_EXPORTREGISTRYFILE 32790
|
||||||
#define ID_WINDOW_TILE 32796
|
#define ID_REGISTRY_CONNECTNETWORKREGISTRY 32791
|
||||||
#define ID_WINDOW_TILE_HORZ 32796
|
#define ID_REGISTRY_DISCONNECTNETWORKREGISTRY 32792
|
||||||
#define ID_WINDOW_TILE_VERT 32797
|
#define ID_REGISTRY_PRINT 32793
|
||||||
#define ID_WINDOW_ARRANGE_ICONS 32798
|
#define ID_HELP_HELPTOPICS 32794
|
||||||
#define ID_WINDOW_REFRESH 32799
|
#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_FONT 32800
|
||||||
#define ID_OPTIONS_AUTOREFRESH 32801
|
#define ID_OPTIONS_AUTOREFRESH 32801
|
||||||
#define ID_OPTIONS_READONLYMODE 32802
|
#define ID_OPTIONS_READONLYMODE 32802
|
||||||
|
@ -86,12 +94,6 @@
|
||||||
#define ID_REGISTRY_PRINTSUBTREE 32832
|
#define ID_REGISTRY_PRINTSUBTREE 32832
|
||||||
#define ID_REGISTRY_PRINTERSETUP 32833
|
#define ID_REGISTRY_PRINTERSETUP 32833
|
||||||
#define ID_REGISTRY_SAVESUBTREEAS 32834
|
#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 IDC_LICENSE_EDIT 1029
|
||||||
#define IDS_LICENSE 32835
|
#define IDS_LICENSE 32835
|
||||||
|
|
126
rosapps/regedt32/settings.c
Normal file
126
rosapps/regedt32/settings.c
Normal file
|
@ -0,0 +1,126 @@
|
||||||
|
/*
|
||||||
|
* ReactOS regedt32
|
||||||
|
*
|
||||||
|
* settings.c
|
||||||
|
*
|
||||||
|
* Copyright (C) 2002 Robert Dickenson <robd@reactos.org>
|
||||||
|
*
|
||||||
|
* 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 <windows.h>
|
||||||
|
#include <tchar.h>
|
||||||
|
#include <assert.h>
|
||||||
|
#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);
|
||||||
|
}
|
43
rosapps/regedt32/settings.h
Normal file
43
rosapps/regedt32/settings.h
Normal file
|
@ -0,0 +1,43 @@
|
||||||
|
/*
|
||||||
|
* ReactOS regedt32
|
||||||
|
*
|
||||||
|
* settings.h
|
||||||
|
*
|
||||||
|
* Copyright (C) 2002 Robert Dickenson <robd@reactos.org>
|
||||||
|
*
|
||||||
|
* 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__
|
259
rosapps/regedt32/treeview.c
Normal file
259
rosapps/regedt32/treeview.c
Normal file
|
@ -0,0 +1,259 @@
|
||||||
|
/*
|
||||||
|
* ReactOS regedit
|
||||||
|
*
|
||||||
|
* treeview.c
|
||||||
|
*
|
||||||
|
* Copyright (C) 2002 Robert Dickenson <robd@reactos.org>
|
||||||
|
*
|
||||||
|
* 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 <windows.h>
|
||||||
|
#include <commctrl.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <malloc.h>
|
||||||
|
#include <memory.h>
|
||||||
|
#include <tchar.h>
|
||||||
|
#include <process.h>
|
||||||
|
#include <stdio.h>
|
||||||
|
#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;
|
||||||
|
}
|
44
rosapps/regedt32/treeview.h
Normal file
44
rosapps/regedt32/treeview.h
Normal file
|
@ -0,0 +1,44 @@
|
||||||
|
/*
|
||||||
|
* ReactOS regedit
|
||||||
|
*
|
||||||
|
* treeview.h
|
||||||
|
*
|
||||||
|
* Copyright (C) 2002 Robert Dickenson <robd@reactos.org>
|
||||||
|
*
|
||||||
|
* 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__
|
Loading…
Reference in a new issue