xref: /reactos/base/applications/regedit/main.h (revision c948ea85)
1 /*
2  * Regedit definitions
3  *
4  * Copyright (C) 2002 Robert Dickenson <robd@reactos.org>
5  * LICENSE: LGPL-2.1-or-later (https://spdx.org/licenses/LGPL-2.1-or-later)
6  */
7 
8 #pragma once
9 
10 #include "resource.h"
11 
12 
13 #define STATUS_WINDOW   2001
14 #define TREE_WINDOW     2002
15 #define LIST_WINDOW     2003
16 
17 #define SPLIT_WIDTH    5
18 #define SPLIT_MIN     30
19 
20 #define ARRAY_SIZE(A) (sizeof(A)/sizeof(*A))
21 
22 #define PM_MODIFYVALUE  0
23 #define PM_NEW          1
24 #define PM_TREECONTEXT  2
25 #define PM_ROOTITEM     3
26 #define PM_HEXEDIT      4
27 
28 #define MAX_NEW_KEY_LEN  128
29 #define KEY_MAX_LEN      1024
30 
31 #define REG_FORMAT_5     1
32 #define REG_FORMAT_4     2
33 
34 /******************************************************************************/
35 
36 enum OPTION_FLAGS
37 {
38     OPTIONS_AUTO_REFRESH        = 0x01,
39     OPTIONS_READ_ONLY_MODE      = 0x02,
40     OPTIONS_CONFIRM_ON_DELETE   = 0x04,
41     OPTIONS_SAVE_ON_EXIT        = 0x08,
42     OPTIONS_DISPLAY_BINARY_DATA = 0x10,
43     OPTIONS_VIEW_TREE_ONLY      = 0x20,
44     OPTIONS_VIEW_DATA_ONLY      = 0x40,
45 };
46 
47 typedef struct
48 {
49     HWND    hWnd;
50     HWND    hTreeWnd;
51     HWND    hListWnd;
52     HWND    hAddressBarWnd;
53     HWND    hAddressBtnWnd;
54     HICON   hArrowIcon;
55     int     nFocusPanel;      /* 0: left  1: right */
56     int     nSplitPos;
57     WINDOWPLACEMENT pos;
58     WCHAR   szPath[MAX_PATH];
59 } ChildWnd;
60 extern ChildWnd* g_pChildWnd;
61 
62 /*******************************************************************************
63  * Global Variables:
64  */
65 extern HINSTANCE hInst;
66 extern HWND      hFrameWnd;
67 extern HMENU     hMenuFrame;
68 extern HWND      hStatusBar;
69 extern HMENU     hPopupMenus;
70 extern HFONT     hFont;
71 extern enum OPTION_FLAGS Options;
72 
73 extern WCHAR szTitle[];
74 extern WCHAR szFrameClass[];
75 extern WCHAR szChildClass[];
76 
77 extern const WCHAR g_szGeneralRegKey[];
78 extern const WCHAR* reg_class_namesW[];
79 
80 /* about.c */
81 void ShowAboutBox(HWND hWnd);
82 
83 /* childwnd.c */
84 LRESULT CALLBACK ChildWndProc(HWND, UINT, WPARAM, LPARAM);
85 void ResizeWnd(int cx, int cy);
86 LPCWSTR get_root_key_name(HKEY hRootKey);
87 VOID UpdateAddress(HTREEITEM hItem, HKEY hRootKey, LPCWSTR pszPath, BOOL bSelectNone);
88 
89 /* edit.c */
90 BOOL ModifyValue(HWND hwnd, HKEY hKey, LPCWSTR valueName, BOOL EditBin);
91 BOOL DeleteKey(HWND hwnd, HKEY hKeyRoot, LPCWSTR keyPath);
92 LONG RenameKey(HKEY hKey, LPCWSTR lpSubKey, LPCWSTR lpNewName);
93 LONG RenameValue(HKEY hKey, LPCWSTR lpSubKey, LPCWSTR lpDestValue, LPCWSTR lpSrcValue);
94 LONG QueryStringValue(HKEY hKey, LPCWSTR lpSubKey, LPCWSTR lpValueName, LPWSTR pszBuffer, DWORD dwBufferLen);
95 BOOL GetKeyName(LPWSTR pszDest, size_t iDestLength, HKEY hRootKey, LPCWSTR lpSubKey);
96 
97 /* error.c */
98 int ErrorMessageBox(HWND hWnd, LPCWSTR lpTitle, DWORD dwErrorCode, ...);
99 int InfoMessageBox(HWND hWnd, UINT uType, LPCWSTR lpTitle, LPCWSTR lpMessage, ...);
100 
101 /* find.c */
102 void FindDialog(HWND hWnd);
103 BOOL FindNext(HWND hWnd);
104 void FindNextMessageBox(HWND hWnd);
105 
106 /* framewnd.c */
107 LRESULT CALLBACK FrameWndProc(HWND, UINT, WPARAM, LPARAM);
108 void SetupStatusBar(HWND hWnd, BOOL bResize);
109 void UpdateStatusBar(void);
110 BOOL CopyKeyName(HWND hWnd, HKEY hRootKey, LPCWSTR keyName);
111 BOOL ExportRegistryFile(HWND hWnd);
112 
113 /* listview.c */
114 HWND CreateListView(HWND hwndParent, HMENU id, INT cx);
115 BOOL RefreshListView(HWND hwndLV, HKEY hKey, LPCWSTR keyPath, BOOL bSelectNone);
116 WCHAR *GetValueName(HWND hwndLV, int iStartAt);
117 BOOL ListWndNotifyProc(HWND hWnd, WPARAM wParam, LPARAM lParam, BOOL *Result);
118 BOOL TreeWndNotifyProc(HWND hWnd, WPARAM wParam, LPARAM lParam, BOOL *Result);
119 BOOL IsDefaultValue(HWND hwndLV, int i);
120 
121 /* regedit.c */
122 void WINAPIV output_message(unsigned int id, ...);
123 void WINAPIV error_exit(unsigned int id, ...);
124 
125 /* regproc.c */
126 char *GetMultiByteString(const WCHAR *strW);
127 BOOL import_registry_file(FILE *reg_file);
128 void delete_registry_key(WCHAR *reg_key_name);
129 BOOL export_registry_key(WCHAR *file_name, WCHAR *path, DWORD format);
130 
131 /* security.c */
132 BOOL RegKeyEditPermissions(HWND hWndOwner, HKEY hKey, LPCWSTR lpMachine, LPCWSTR lpKeyName);
133 
134 /* settings.c */
135 void LoadSettings(void);
136 void SaveSettings(void);
137 
138 /* treeview.c */
139 HWND CreateTreeView(HWND hwndParent, LPWSTR pHostName, HMENU id);
140 BOOL RefreshTreeView(HWND hWndTV);
141 BOOL RefreshTreeItem(HWND hwndTV, HTREEITEM hItem);
142 BOOL OnTreeExpanding(HWND hWnd, NMTREEVIEW* pnmtv);
143 LPCWSTR GetItemPath(HWND hwndTV, HTREEITEM hItem, HKEY* phRootKey);
144 BOOL DeleteNode(HWND hwndTV, HTREEITEM hItem);
145 HTREEITEM InsertNode(HWND hwndTV, HTREEITEM hItem, LPWSTR name);
146 HWND StartKeyRename(HWND hwndTV);
147 BOOL CreateNewKey(HWND hwndTV, HTREEITEM hItem);
148 BOOL SelectNode(HWND hwndTV, LPCWSTR keyPath);
149 void DestroyTreeView(HWND hwndTV);
150 void DestroyListView(HWND hwndLV);
151 void DestroyMainMenu(void);
152 
153 /* txtproc.c */
154 BOOL txt_export_registry_key(LPCWSTR file_name, LPCWSTR path);
155 
156 /* EOF */
157