xref: /reactos/base/applications/regedit/main.h (revision 682f85ad)
1 /*
2  * Regedit definitions
3  *
4  * Copyright (C) 2002 Robert Dickenson <robd@reactos.org>
5  *
6  * This library is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU Lesser General Public
8  * License as published by the Free Software Foundation; either
9  * version 2.1 of the License, or (at your option) any later version.
10  *
11  * This library is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14  * Lesser General Public License for more details.
15  *
16  * You should have received a copy of the GNU Lesser General Public
17  * License along with this library; if not, write to the Free Software
18  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
19  */
20 
21 #pragma once
22 
23 #include "resource.h"
24 
25 
26 #define STATUS_WINDOW   2001
27 #define TREE_WINDOW     2002
28 #define LIST_WINDOW     2003
29 
30 #define SPLIT_WIDTH    5
31 #define SPLIT_MIN     30
32 
33 #define COUNT_OF(a) (sizeof(a)/sizeof(a[0]))
34 
35 #define PM_MODIFYVALUE  0
36 #define PM_NEW          1
37 #define PM_TREECONTEXT  2
38 #define PM_ROOTITEM     3
39 #define PM_HEXEDIT      4
40 
41 #define MAX_NEW_KEY_LEN 128
42 
43 extern HINSTANCE hInst;
44 
45 /******************************************************************************/
46 
47 enum OPTION_FLAGS
48 {
49     OPTIONS_AUTO_REFRESH        = 0x01,
50     OPTIONS_READ_ONLY_MODE      = 0x02,
51     OPTIONS_CONFIRM_ON_DELETE   = 0x04,
52     OPTIONS_SAVE_ON_EXIT        = 0x08,
53     OPTIONS_DISPLAY_BINARY_DATA = 0x10,
54     OPTIONS_VIEW_TREE_ONLY      = 0x20,
55     OPTIONS_VIEW_DATA_ONLY      = 0x40,
56 };
57 
58 typedef struct
59 {
60     HWND    hWnd;
61     HWND    hTreeWnd;
62     HWND    hListWnd;
63     HWND    hAddressBarWnd;
64     HWND    hAddressBtnWnd;
65     HICON   hArrowIcon;
66     int     nFocusPanel;      /* 0: left  1: right */
67     int     nSplitPos;
68     WINDOWPLACEMENT pos;
69     WCHAR   szPath[MAX_PATH];
70 } ChildWnd;
71 extern ChildWnd* g_pChildWnd;
72 
73 /*******************************************************************************
74  * Global Variables:
75  */
76 extern HINSTANCE hInst;
77 extern HWND      hFrameWnd;
78 extern HMENU     hMenuFrame;
79 extern HWND      hStatusBar;
80 extern HMENU     hPopupMenus;
81 extern HFONT     hFont;
82 extern enum OPTION_FLAGS Options;
83 
84 extern WCHAR szTitle[];
85 extern WCHAR szFrameClass[];
86 extern WCHAR szChildClass[];
87 
88 extern const WCHAR g_szGeneralRegKey[];
89 
90 /* about.c */
91 extern void ShowAboutBox(HWND hWnd);
92 
93 /* childwnd.c */
94 extern LRESULT CALLBACK ChildWndProc(HWND, UINT, WPARAM, LPARAM);
95 extern void ResizeWnd(int cx, int cy);
96 extern LPCWSTR get_root_key_name(HKEY hRootKey);
97 VOID UpdateAddress(HTREEITEM hItem, HKEY hRootKey, LPCWSTR pszPath);
98 
99 /* error.c */
100 extern int ErrorMessageBox(HWND hWnd, LPCWSTR lpTitle, DWORD dwErrorCode, ...);
101 extern int InfoMessageBox(HWND hWnd, UINT uType, LPCWSTR lpTitle, LPCWSTR lpMessage, ...);
102 
103 /* find.c */
104 extern void FindDialog(HWND hWnd);
105 extern BOOL FindNext(HWND hWnd);
106 extern void FindNextMessageBox(HWND hWnd);
107 
108 /* framewnd.c */
109 extern LRESULT CALLBACK FrameWndProc(HWND, UINT, WPARAM, LPARAM);
110 extern void SetupStatusBar(HWND hWnd, BOOL bResize);
111 extern void UpdateStatusBar(void);
112 extern BOOL CopyKeyName(HWND hWnd, HKEY hRootKey, LPCWSTR keyName);
113 extern BOOL ExportRegistryFile(HWND hWnd);
114 
115 /* listview.c */
116 extern HWND CreateListView(HWND hwndParent, HMENU id, INT cx);
117 extern BOOL RefreshListView(HWND hwndLV, HKEY hKey, LPCWSTR keyPath);
118 extern LPCWSTR GetValueName(HWND hwndLV, int iStartAt);
119 extern BOOL ListWndNotifyProc(HWND hWnd, WPARAM wParam, LPARAM lParam, BOOL *Result);
120 extern BOOL TreeWndNotifyProc(HWND hWnd, WPARAM wParam, LPARAM lParam, BOOL *Result);
121 extern BOOL IsDefaultValue(HWND hwndLV, int i);
122 
123 /* regedit.c */
124 LPCWSTR getAppName(void);
125 
126 /* treeview.c */
127 extern HWND CreateTreeView(HWND hwndParent, LPWSTR pHostName, HMENU id);
128 extern BOOL RefreshTreeView(HWND hWndTV);
129 extern BOOL RefreshTreeItem(HWND hwndTV, HTREEITEM hItem);
130 extern BOOL OnTreeExpanding(HWND hWnd, NMTREEVIEW* pnmtv);
131 extern LPCWSTR GetItemPath(HWND hwndTV, HTREEITEM hItem, HKEY* phRootKey);
132 extern BOOL DeleteNode(HWND hwndTV, HTREEITEM hItem);
133 extern HTREEITEM InsertNode(HWND hwndTV, HTREEITEM hItem, LPWSTR name);
134 extern HWND StartKeyRename(HWND hwndTV);
135 extern BOOL CreateNewKey(HWND hwndTV, HTREEITEM hItem);
136 extern BOOL SelectNode(HWND hwndTV, LPCWSTR keyPath);
137 extern void DestroyTreeView(HWND hwndTV);
138 extern void DestroyListView(HWND hwndLV);
139 extern void DestroyMainMenu(void);
140 
141 /* edit.c */
142 extern BOOL ModifyValue(HWND hwnd, HKEY hKey, LPCWSTR valueName, BOOL EditBin);
143 extern BOOL DeleteKey(HWND hwnd, HKEY hKeyRoot, LPCWSTR keyPath);
144 extern LONG RenameKey(HKEY hKey, LPCWSTR lpSubKey, LPCWSTR lpNewName);
145 extern LONG RenameValue(HKEY hKey, LPCWSTR lpSubKey, LPCWSTR lpDestValue, LPCWSTR lpSrcValue);
146 extern LONG QueryStringValue(HKEY hKey, LPCWSTR lpSubKey, LPCWSTR lpValueName, LPWSTR pszBuffer, DWORD dwBufferLen);
147 extern BOOL GetKeyName(LPWSTR pszDest, size_t iDestLength, HKEY hRootKey, LPCWSTR lpSubKey);
148 
149 /* security.c */
150 extern BOOL RegKeyEditPermissions(HWND hWndOwner, HKEY hKey, LPCWSTR lpMachine, LPCWSTR lpKeyName);
151 
152 /* settings.c */
153 extern void LoadSettings(void);
154 extern void SaveSettings(void);
155 
156 /* EOF */
157