xref: /reactos/base/applications/regedit/main.h (revision 565bf9e3)
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 ARRAY_SIZE(A) (sizeof(A)/sizeof(*A))
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 #define KEY_MAX_LEN      1024
43 
44 #define REG_FORMAT_5     1
45 #define REG_FORMAT_4     2
46 
47 /******************************************************************************/
48 
49 enum OPTION_FLAGS
50 {
51     OPTIONS_AUTO_REFRESH        = 0x01,
52     OPTIONS_READ_ONLY_MODE      = 0x02,
53     OPTIONS_CONFIRM_ON_DELETE   = 0x04,
54     OPTIONS_SAVE_ON_EXIT        = 0x08,
55     OPTIONS_DISPLAY_BINARY_DATA = 0x10,
56     OPTIONS_VIEW_TREE_ONLY      = 0x20,
57     OPTIONS_VIEW_DATA_ONLY      = 0x40,
58 };
59 
60 typedef struct
61 {
62     HWND    hWnd;
63     HWND    hTreeWnd;
64     HWND    hListWnd;
65     HWND    hAddressBarWnd;
66     HWND    hAddressBtnWnd;
67     HICON   hArrowIcon;
68     int     nFocusPanel;      /* 0: left  1: right */
69     int     nSplitPos;
70     WINDOWPLACEMENT pos;
71     WCHAR   szPath[MAX_PATH];
72 } ChildWnd;
73 extern ChildWnd* g_pChildWnd;
74 
75 /*******************************************************************************
76  * Global Variables:
77  */
78 extern HINSTANCE hInst;
79 extern HWND      hFrameWnd;
80 extern HMENU     hMenuFrame;
81 extern HWND      hStatusBar;
82 extern HMENU     hPopupMenus;
83 extern HFONT     hFont;
84 extern enum OPTION_FLAGS Options;
85 
86 extern WCHAR szTitle[];
87 extern WCHAR szFrameClass[];
88 extern WCHAR szChildClass[];
89 
90 extern const WCHAR g_szGeneralRegKey[];
91 extern const WCHAR* reg_class_namesW[];
92 
93 /* about.c */
94 void ShowAboutBox(HWND hWnd);
95 
96 /* childwnd.c */
97 LRESULT CALLBACK ChildWndProc(HWND, UINT, WPARAM, LPARAM);
98 void ResizeWnd(int cx, int cy);
99 LPCWSTR get_root_key_name(HKEY hRootKey);
100 VOID UpdateAddress(HTREEITEM hItem, HKEY hRootKey, LPCWSTR pszPath, BOOL bSelectNone);
101 
102 /* edit.c */
103 BOOL ModifyValue(HWND hwnd, HKEY hKey, LPCWSTR valueName, BOOL EditBin);
104 BOOL DeleteKey(HWND hwnd, HKEY hKeyRoot, LPCWSTR keyPath);
105 LONG RenameKey(HKEY hKey, LPCWSTR lpSubKey, LPCWSTR lpNewName);
106 LONG RenameValue(HKEY hKey, LPCWSTR lpSubKey, LPCWSTR lpDestValue, LPCWSTR lpSrcValue);
107 LONG QueryStringValue(HKEY hKey, LPCWSTR lpSubKey, LPCWSTR lpValueName, LPWSTR pszBuffer, DWORD dwBufferLen);
108 BOOL GetKeyName(LPWSTR pszDest, size_t iDestLength, HKEY hRootKey, LPCWSTR lpSubKey);
109 
110 /* error.c */
111 int ErrorMessageBox(HWND hWnd, LPCWSTR lpTitle, DWORD dwErrorCode, ...);
112 int InfoMessageBox(HWND hWnd, UINT uType, LPCWSTR lpTitle, LPCWSTR lpMessage, ...);
113 
114 /* find.c */
115 void FindDialog(HWND hWnd);
116 BOOL FindNext(HWND hWnd);
117 void FindNextMessageBox(HWND hWnd);
118 
119 /* framewnd.c */
120 LRESULT CALLBACK FrameWndProc(HWND, UINT, WPARAM, LPARAM);
121 void SetupStatusBar(HWND hWnd, BOOL bResize);
122 void UpdateStatusBar(void);
123 BOOL CopyKeyName(HWND hWnd, HKEY hRootKey, LPCWSTR keyName);
124 BOOL ExportRegistryFile(HWND hWnd);
125 
126 /* listview.c */
127 HWND CreateListView(HWND hwndParent, HMENU id, INT cx);
128 BOOL RefreshListView(HWND hwndLV, HKEY hKey, LPCWSTR keyPath, BOOL bSelectNone);
129 WCHAR *GetValueName(HWND hwndLV, int iStartAt);
130 BOOL ListWndNotifyProc(HWND hWnd, WPARAM wParam, LPARAM lParam, BOOL *Result);
131 BOOL TreeWndNotifyProc(HWND hWnd, WPARAM wParam, LPARAM lParam, BOOL *Result);
132 BOOL IsDefaultValue(HWND hwndLV, int i);
133 
134 /* regedit.c */
135 void WINAPIV output_message(unsigned int id, ...);
136 void WINAPIV error_exit(unsigned int id, ...);
137 
138 /* regproc.c */
139 char *GetMultiByteString(const WCHAR *strW);
140 BOOL import_registry_file(FILE *reg_file);
141 void delete_registry_key(WCHAR *reg_key_name);
142 BOOL export_registry_key(WCHAR *file_name, WCHAR *path, DWORD format);
143 
144 /* security.c */
145 BOOL RegKeyEditPermissions(HWND hWndOwner, HKEY hKey, LPCWSTR lpMachine, LPCWSTR lpKeyName);
146 
147 /* settings.c */
148 void LoadSettings(void);
149 void SaveSettings(void);
150 
151 /* treeview.c */
152 HWND CreateTreeView(HWND hwndParent, LPWSTR pHostName, HMENU id);
153 BOOL RefreshTreeView(HWND hWndTV);
154 BOOL RefreshTreeItem(HWND hwndTV, HTREEITEM hItem);
155 BOOL OnTreeExpanding(HWND hWnd, NMTREEVIEW* pnmtv);
156 LPCWSTR GetItemPath(HWND hwndTV, HTREEITEM hItem, HKEY* phRootKey);
157 BOOL DeleteNode(HWND hwndTV, HTREEITEM hItem);
158 HTREEITEM InsertNode(HWND hwndTV, HTREEITEM hItem, LPWSTR name);
159 HWND StartKeyRename(HWND hwndTV);
160 BOOL CreateNewKey(HWND hwndTV, HTREEITEM hItem);
161 BOOL SelectNode(HWND hwndTV, LPCWSTR keyPath);
162 void DestroyTreeView(HWND hwndTV);
163 void DestroyListView(HWND hwndLV);
164 void DestroyMainMenu(void);
165 
166 /* txtproc.c */
167 BOOL txt_export_registry_key(LPCWSTR file_name, LPCWSTR path);
168 
169 /* EOF */
170