shell32/tests: Use the available ARRAY_SIZE() macro.
[wine.git] / programs / regedit / main.h
blob55317be33812010a1c8e5e2f55eebbe602b9525d
1 /*
2 * Regedit definitions
4 * Copyright (C) 2002 Robert Dickenson <robd@reactos.org>
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.
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.
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 St, Fifth Floor, Boston, MA 02110-1301, USA
21 #ifndef __MAIN_H__
22 #define __MAIN_H__
24 #include <stdio.h>
25 #include "resource.h"
27 #define STATUS_WINDOW 2001
28 #define TREE_WINDOW 2002
29 #define LIST_WINDOW 2003
31 #define SPLIT_WIDTH 5
33 #define ARRAY_SIZE(A) (sizeof(A)/sizeof(*A))
35 #define MAX_NEW_KEY_LEN 128
36 #define KEY_MAX_LEN 1024
38 #define REG_FORMAT_5 1
39 #define REG_FORMAT_4 2
41 /* Pop-Up Menus */
42 #define PM_COMPUTER 0
43 #define PM_TREEVIEW 1
44 #define PM_NEW_VALUE 2
45 #define PM_MODIFY_VALUE 3
47 /* HexEdit Class */
48 #define HEM_SETDATA (WM_USER+0)
49 #define HEM_GETDATA (WM_USER+1)
51 /******************************************************************************/
53 enum OPTION_FLAGS {
54 OPTIONS_AUTO_REFRESH = 0x01,
55 OPTIONS_READ_ONLY_MODE = 0x02,
56 OPTIONS_CONFIRM_ON_DELETE = 0x04,
57 OPTIONS_SAVE_ON_EXIT = 0x08,
58 OPTIONS_DISPLAY_BINARY_DATA = 0x10,
59 OPTIONS_VIEW_TREE_ONLY = 0x20,
60 OPTIONS_VIEW_DATA_ONLY = 0x40,
63 enum SEARCH_FLAGS {
64 SEARCH_WHOLE = 0x01,
65 SEARCH_KEYS = 0x02,
66 SEARCH_VALUES = 0x04,
67 SEARCH_CONTENT = 0x08,
70 typedef struct {
71 HWND hWnd;
72 HWND hTreeWnd;
73 HWND hListWnd;
74 int nFocusPanel; /* 0: left 1: right */
75 int nSplitPos;
76 WINDOWPLACEMENT pos;
77 WCHAR szPath[MAX_PATH];
78 } ChildWnd;
79 extern ChildWnd* g_pChildWnd;
81 typedef struct tagLINE_INFO
83 WCHAR *name;
84 DWORD dwValType;
85 void *val;
86 size_t val_len;
87 } LINE_INFO;
89 /*******************************************************************************
90 * Global Variables:
92 extern HINSTANCE hInst;
93 extern HWND hFrameWnd;
94 extern HMENU hMenuFrame;
95 extern HWND hStatusBar;
96 extern HMENU hPopupMenus;
97 extern HFONT hFont;
98 extern enum OPTION_FLAGS Options;
100 extern WCHAR szTitle[];
101 extern const WCHAR szFrameClass[];
102 extern const WCHAR szChildClass[];
103 extern const WCHAR szHexEditClass[];
104 extern WCHAR g_pszDefaultValueName[];
106 extern DWORD g_columnToSort;
107 extern BOOL g_invertSort;
108 extern WCHAR *g_currentPath;
109 extern HKEY g_currentRootKey;
111 /* Registry class names and their indexes */
112 extern const WCHAR* reg_class_namesW[];
113 #define INDEX_HKEY_LOCAL_MACHINE 0
114 #define INDEX_HKEY_USERS 1
115 #define INDEX_HKEY_CLASSES_ROOT 2
116 #define INDEX_HKEY_CURRENT_CONFIG 3
117 #define INDEX_HKEY_CURRENT_USER 4
118 #define INDEX_HKEY_DYN_DATA 5
120 /* about.c */
121 void ShowAboutBox(HWND hWnd);
123 /* childwnd.c */
124 LPWSTR GetItemFullPath(HWND hwndTV, HTREEITEM hItem, BOOL bFull);
125 LRESULT CALLBACK ChildWndProc(HWND, UINT, WPARAM, LPARAM);
127 /* edit.c */
128 BOOL CreateKey(HWND hwnd, HKEY hKeyRoot, LPCWSTR keyPath, LPWSTR newKeyName);
129 BOOL CreateValue(HWND hwnd, HKEY hKeyRoot, LPCWSTR keyPath, DWORD valueType, LPWSTR valueName);
130 BOOL ModifyValue(HWND hwnd, HKEY hKeyRoot, LPCWSTR keyPath, LPCWSTR valueName);
131 BOOL DeleteKey(HWND hwnd, HKEY hKeyRoot, LPCWSTR keyPath);
132 BOOL DeleteValue(HWND hwnd, HKEY hKeyRoot, LPCWSTR keyPath, LPCWSTR valueName);
133 BOOL RenameValue(HWND hwnd, HKEY hRootKey, LPCWSTR keyPath, LPCWSTR oldName, LPCWSTR newName);
134 BOOL RenameKey(HWND hwnd, HKEY hRootKey, LPCWSTR keyPath, LPCWSTR newName);
135 int WINAPIV messagebox(HWND hwnd, int buttons, int titleId, int resId, ...);
137 /* framewnd.c */
138 LRESULT CALLBACK FrameWndProc(HWND, UINT, WPARAM, LPARAM);
139 void SetupStatusBar(HWND hWnd, BOOL bResize);
140 void UpdateStatusBar(void);
142 /* hexedit.c */
143 void HexEdit_Register(void);
145 /* listview.c */
146 BOOL update_listview_path(const WCHAR *path);
147 void format_value_data(HWND hwndLV, int index, DWORD type, void *data, DWORD size);
148 int AddEntryToList(HWND hwndLV, WCHAR *Name, DWORD dwValType, void *ValBuf, DWORD dwCount, int pos);
149 void OnGetDispInfo(NMLVDISPINFOW *plvdi);
150 HWND CreateListView(HWND hwndParent, UINT id);
151 int CALLBACK CompareFunc(LPARAM lParam1, LPARAM lParam2, LPARAM lParamSort);
152 BOOL RefreshListView(HWND hwndLV, HKEY hKeyRoot, LPCWSTR keyPath, LPCWSTR highlightValue);
153 HWND StartValueRename(HWND hwndLV);
154 LPWSTR GetItemText(HWND hwndLV, UINT item);
155 LPCWSTR GetValueName(HWND hwndLV);
156 BOOL ListWndNotifyProc(HWND hWnd, WPARAM wParam, LPARAM lParam, BOOL *Result);
157 BOOL IsDefaultValue(HWND hwndLV, int i);
159 /* regedit.c */
160 void WINAPIV output_message(unsigned int id, ...);
161 void WINAPIV error_exit(unsigned int id, ...);
163 /* regproc.c */
164 void *heap_xalloc(size_t size);
165 void *heap_xrealloc(void *buf, size_t size);
166 char *GetMultiByteString(const WCHAR *strW);
167 BOOL import_registry_file(FILE *reg_file);
168 void delete_registry_key(WCHAR *reg_key_name);
169 BOOL export_registry_key(WCHAR *file_name, WCHAR *path, DWORD format);
171 /* treeview.c */
172 HWND CreateTreeView(HWND hwndParent, LPWSTR pHostName, UINT id);
173 BOOL RefreshTreeView(HWND hWndTV);
174 BOOL OnTreeExpanding(HWND hWnd, NMTREEVIEWW* pnmtv);
175 LPWSTR GetItemPath(HWND hwndTV, HTREEITEM hItem, HKEY* phRootKey);
176 BOOL DeleteNode(HWND hwndTV, HTREEITEM hItem);
177 HTREEITEM InsertNode(HWND hwndTV, HTREEITEM hItem, LPWSTR name);
178 HWND StartKeyRename(HWND hwndTV);
179 HTREEITEM FindPathInTree(HWND hwndTV, LPCWSTR lpKeyName);
180 HTREEITEM FindNext(HWND hwndTV, HTREEITEM hItem, LPCWSTR sstring, int mode, int *row);
182 #endif /* __MAIN_H__ */