ReactOS 0.4.16-dev-329-g9223134
main.c
Go to the documentation of this file.
1/*
2 * Regedit main function
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#include "regedit.h"
9
11
12const WCHAR *reg_class_namesW[] = {L"HKEY_LOCAL_MACHINE", L"HKEY_USERS",
13 L"HKEY_CLASSES_ROOT", L"HKEY_CURRENT_CONFIG",
14 L"HKEY_CURRENT_USER", L"HKEY_DYN_DATA"
15 };
16
17/*******************************************************************************
18 * Global Variables:
19 */
20
27LPCWSTR strClipboardFormat = L"TODO: SET CORRECT FORMAT";
28
29#define MAX_LOADSTRING 100
33
34
43{
44 BOOL AclUiAvailable;
45 HMENU hEditMenu;
47 WNDCLASSEXW wcFrame;
48 WNDCLASSEXW wcChild;
49 ATOM hFrameWndClass;
50
51 ZeroMemory(&wcFrame, sizeof(WNDCLASSEXW));
52 wcFrame.cbSize = sizeof(WNDCLASSEXW);
53 wcFrame.lpfnWndProc = FrameWndProc;
54 wcFrame.hInstance = hInstance;
60 wcFrame.hbrBackground = (HBRUSH)(COLOR_3DFACE + 1);
62
63 hFrameWndClass = RegisterClassExW(&wcFrame); /* register frame window class */
64
65 ZeroMemory(&wcChild, sizeof(WNDCLASSEXW));
66 wcChild.cbSize = sizeof(WNDCLASSEXW);
67 wcChild.lpfnWndProc = ChildWndProc;
68 wcChild.cbWndExtra = sizeof(HANDLE);
69 wcChild.hInstance = hInstance;
72 wcChild.hbrBackground = (HBRUSH)(COLOR_3DFACE + 1);
77
78 RegisterClassExW(&wcChild); /* register child windows class */
79
81
84
85 /* Initialize the Windows Common Controls DLL */
86 /* NOTE: Windows sets 0xFFFF to icce.dwICC but we use better value. */
87 icce.dwSize = sizeof(icce);
90
91 hEditMenu = GetSubMenu(hMenuFrame, 1);
92
93 AclUiAvailable = InitializeAclUiDll();
94 if(!AclUiAvailable)
95 {
96 /* hide the Edit/Permissions... menu entry */
97 if(hEditMenu != NULL)
98 {
100 /* remove the separator after the menu item */
101 RemoveMenu(hEditMenu, 4, MF_BYPOSITION);
102 }
103 }
104
105 if(hEditMenu != NULL)
107
109 /* if (nClipboardFormat == 0) {
110 DWORD dwError = GetLastError();
111 } */
112
116 NULL, hMenuFrame, hInstance, NULL/*lpParam*/);
117 if (!hFrameWnd)
118 return FALSE;
119
120 /* Create the status bar */
123 if (hStatusBar)
124 {
125 /* Create the status bar panes */
128 }
129
130 LoadSettings();
132 return TRUE;
133}
134
135/*
136 * We need to destroy the main menu before destroying the main window
137 * to avoid a memory leak.
138 */
140{
142}
143
145{
147
150}
151
153{
154 HWND hEdit = (HWND)SendMessageW(hWnd, Msg, 0, 0);
155 return hEdit && IsWindowVisible(hEdit);
156}
157
159{
160 if (msg->message != WM_KEYDOWN) return FALSE;
161 if (msg->wParam != VK_TAB) return FALSE;
162 if (GetParent(msg->hwnd) != g_pChildWnd->hWnd) return FALSE;
164 return TRUE;
165}
166
168{
169 if (msg->message == WM_KEYDOWN)
170 {
171 if (msg->wParam == VK_DELETE)
172 {
173 if (g_pChildWnd->hAddressBarWnd == msg->hwnd)
174 return FALSE;
176 return FALSE;
177 }
178 }
179 return TranslateAcceleratorW(hWnd, hAccTable, msg);
180}
181
183 HINSTANCE hPrevInstance,
184 LPWSTR lpCmdLine,
185 int nCmdShow)
186{
187 MSG msg;
188 HACCEL hAccel;
189
190 UNREFERENCED_PARAMETER(hPrevInstance);
191
193
194 /* Initialize global strings */
198
200 return 0;
201
202 switch (GetUserDefaultUILanguage())
203 {
206 break;
207 default:
208 break;
209 }
210 /* Store instance handle in our global variable */
212
213 /* Perform application initialization */
214 if (!InitInstance(hInstance, nCmdShow))
215 return 0;
216
218
219 /* Main message loop */
220 while (GetMessageW(&msg, NULL, 0, 0))
221 {
224 {
227 }
228 }
229
231 return (int)msg.wParam;
232}
233
234/* EOF */
#define msg(x)
Definition: auth_time.c:54
void LoadSettings(void)
Definition: settings.c:53
HWND hWnd
Definition: settings.c:17
#define ID_ACCEL
Definition: resources.h:13
int WINAPI wWinMain(HINSTANCE hInst, HINSTANCE hPrevInst, LPWSTR cmdline, int cmdshow)
Definition: main.c:788
#define IDS_APP_TITLE
Definition: resource.h:10
LRESULT CALLBACK ChildWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
Definition: childwnd.c:366
ChildWnd * g_pChildWnd
Definition: childwnd.c:13
void SetupStatusBar(HWND hWnd, BOOL bResize)
Definition: framewnd.c:153
LRESULT CALLBACK FrameWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
Definition: framewnd.c:1440
#define MAX_LOADSTRING
Definition: main.c:29
HMENU hPopupMenus
Definition: main.c:25
BOOL InitInstance(HINSTANCE hInstance, int nCmdShow)
Definition: main.c:42
const WCHAR * reg_class_namesW[]
Definition: main.c:12
HWND hFrameWnd
Definition: main.c:22
static BOOL InLabelEdit(HWND hWnd, UINT Msg)
Definition: main.c:152
UINT nClipboardFormat
Definition: main.c:26
void DestroyMainMenu()
Definition: main.c:139
WCHAR szFrameClass[MAX_LOADSTRING]
Definition: main.c:31
HMENU hMenuFrame
Definition: main.c:24
LPCWSTR strClipboardFormat
Definition: main.c:27
BOOL ProcessCmdLine(WCHAR *cmdline)
Definition: regedit.c:216
static BOOL TranslateRegeditAccelerator(HWND hWnd, HACCEL hAccTable, PMSG msg)
Definition: main.c:167
static BOOL TranslateChildTabMessage(PMSG msg)
Definition: main.c:158
WCHAR szTitle[MAX_LOADSTRING]
Definition: main.c:30
WCHAR szChildClass[MAX_LOADSTRING]
Definition: main.c:32
HWND hStatusBar
Definition: main.c:23
#define ARRAY_SIZE(A)
Definition: main.h:20
#define STATUS_WINDOW
Definition: main.h:13
#define IDI_REGEDIT
Definition: resource.h:22
#define IDC_REGEDIT
Definition: resource.h:26
#define IDR_REGEDIT_MENU
Definition: resource.h:28
#define ID_EDIT_MODIFY
Definition: resource.h:48
#define ID_VIEW_STATUSBAR
Definition: resource.h:40
#define IDR_POPUP_MENUS
Definition: resource.h:32
#define IDC_REGEDIT_FRAME
Definition: resource.h:27
#define ID_SWITCH_PANELS
Definition: resource.h:102
#define ID_VIEW_MENU
Definition: resource.h:12
#define ID_EDIT_PERMISSIONS
Definition: resource.h:103
BOOL InitializeAclUiDll(VOID)
Definition: security.c:765
VOID UnloadAclUiDll(VOID)
Definition: security.c:784
HINSTANCE hInstance
Definition: charmap.c:19
struct @1642 Msg[]
BOOL WINAPI InitCommonControlsEx(const INITCOMMONCONTROLSEX *lpInitCtrls)
Definition: commctrl.c:900
HWND WINAPI CreateStatusWindowW(LONG style, LPCWSTR text, HWND parent, UINT wid)
Definition: commctrl.c:802
WORD ATOM
Definition: dimm.idl:113
#define NULL
Definition: types.h:112
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
HANDLE HWND
Definition: compat.h:19
LPWSTR WINAPI GetCommandLineW(VOID)
Definition: proc.c:2019
LANGID WINAPI GetUserDefaultUILanguage(void)
Definition: locale.c:1375
HRESULT WINAPI DECLSPEC_HOTPATCH OleInitialize(LPVOID reserved)
Definition: ole2.c:169
#define UlongToPtr(u)
Definition: config.h:106
HINSTANCE hInst
Definition: dxdiag.c:13
unsigned int BOOL
Definition: ntddk_ex.h:94
ATOM WINAPI RegisterHexEditorClass(HINSTANCE hInstance)
Definition: hexedit.c:56
BOOL WINAPI UnregisterHexEditorClass(HINSTANCE hInstance)
Definition: hexedit.c:77
void ExitInstance(void)
Definition: main.c:213
HACCEL hAccel
Definition: main.c:47
static HICON
Definition: imagelist.c:80
static const CLSID *static CLSID *static const GUID VARIANT VARIANT *static IServiceProvider DWORD *static HMENU
Definition: ordinal.c:63
unsigned int UINT
Definition: ndis.h:50
#define UNREFERENCED_PARAMETER(P)
Definition: ntbasedef.h:325
#define L(x)
Definition: ntvdm.h:50
#define WS_CHILD
Definition: pedump.c:617
#define WS_OVERLAPPEDWINDOW
Definition: pedump.c:637
#define WS_VISIBLE
Definition: pedump.c:620
#define WS_CLIPSIBLINGS
Definition: pedump.c:618
#define WS_CLIPCHILDREN
Definition: pedump.c:619
#define ICC_USEREX_CLASSES
Definition: commctrl.h:68
#define SBT_NOBORDERS
Definition: commctrl.h:1976
#define LVM_GETEDITCONTROL
Definition: commctrl.h:2547
#define TVM_GETEDITCONTROL
Definition: commctrl.h:3511
#define ICC_STANDARD_CLASSES
Definition: commctrl.h:73
#define ICC_WIN95_CLASSES
Definition: commctrl.h:66
#define MAKELANGID(p, s)
Definition: nls.h:15
#define LANG_HEBREW
Definition: nls.h:67
#define SUBLANG_DEFAULT
Definition: nls.h:168
static HWND hEdit
Definition: autocomplete.c:34
TCHAR * cmdline
Definition: stretchblt.cpp:32
HWND hTreeWnd
Definition: main.h:50
HWND hListWnd
Definition: main.h:51
HWND hAddressBarWnd
Definition: main.h:52
HWND hWnd
Definition: main.h:49
LPCWSTR lpszClassName
Definition: winuser.h:3229
HBRUSH hbrBackground
Definition: winuser.h:3227
WNDPROC lpfnWndProc
Definition: winuser.h:3221
UINT cbSize
Definition: winuser.h:3219
int cbWndExtra
Definition: winuser.h:3223
HCURSOR hCursor
Definition: winuser.h:3226
HICON hIconSm
Definition: winuser.h:3230
HINSTANCE hInstance
Definition: winuser.h:3224
HICON hIcon
Definition: winuser.h:3225
TW_UINT32 TW_UINT16 TW_UINT16 MSG
Definition: twain.h:1829
PVOID HANDLE
Definition: typedefs.h:73
BOOL WINAPI SetProcessDefaultLayout(DWORD dwDefaultLayout)
Definition: window.c:1691
#define ZeroMemory
Definition: winbase.h:1737
#define WINAPI
Definition: msvc.h:6
#define LAYOUT_RTL
Definition: wingdi.h:1371
#define MF_BYCOMMAND
Definition: winuser.h:202
#define VK_TAB
Definition: winuser.h:2202
BOOL WINAPI TranslateMessage(_In_ const MSG *)
BOOL WINAPI SetMenuDefaultItem(_In_ HMENU, _In_ UINT, _In_ UINT)
BOOL WINAPI GetMessageW(_Out_ LPMSG, _In_opt_ HWND, _In_ UINT, _In_ UINT)
BOOL WINAPI PostMessageW(_In_opt_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define IMAGE_ICON
Definition: winuser.h:212
int WINAPI LoadStringW(_In_opt_ HINSTANCE hInstance, _In_ UINT uID, _Out_writes_to_(cchBufferMax, return+1) LPWSTR lpBuffer, _In_ int cchBufferMax)
#define WM_COMMAND
Definition: winuser.h:1743
HANDLE WINAPI LoadImageW(_In_opt_ HINSTANCE hInst, _In_ LPCWSTR name, _In_ UINT type, _In_ int cx, _In_ int cy, _In_ UINT fuLoad)
Definition: cursoricon.c:2255
#define IDC_ARROW
Definition: winuser.h:687
UINT WINAPI RegisterClipboardFormatW(_In_ LPCWSTR)
#define SM_CYSMICON
Definition: winuser.h:1016
#define MF_CHECKED
Definition: winuser.h:132
HCURSOR WINAPI LoadCursorW(_In_opt_ HINSTANCE, _In_ LPCWSTR)
Definition: cursoricon.c:2157
DWORD WINAPI CheckMenuItem(_In_ HMENU, _In_ UINT, _In_ UINT)
#define SM_CXSMICON
Definition: winuser.h:1015
HMENU WINAPI GetSubMenu(_In_ HMENU, _In_ int)
HWND WINAPI CreateWindowExW(_In_ DWORD dwExStyle, _In_opt_ LPCWSTR lpClassName, _In_opt_ LPCWSTR lpWindowName, _In_ DWORD dwStyle, _In_ int X, _In_ int Y, _In_ int nWidth, _In_ int nHeight, _In_opt_ HWND hWndParent, _In_opt_ HMENU hMenu, _In_opt_ HINSTANCE hInstance, _In_opt_ LPVOID lpParam)
#define MF_BYPOSITION
Definition: winuser.h:203
BOOL WINAPI RemoveMenu(_In_ HMENU, _In_ UINT, _In_ UINT)
BOOL WINAPI UpdateWindow(_In_ HWND)
ATOM WINAPI RegisterClassExW(_In_ CONST WNDCLASSEXW *)
#define WS_EX_WINDOWEDGE
Definition: winuser.h:407
#define LR_SHARED
Definition: winuser.h:1103
#define CW_USEDEFAULT
Definition: winuser.h:225
HWND WINAPI GetParent(_In_ HWND)
HACCEL WINAPI LoadAcceleratorsW(_In_opt_ HINSTANCE, _In_ LPCWSTR)
BOOL WINAPI DestroyMenu(_In_ HMENU)
LRESULT WINAPI DispatchMessageW(_In_ const MSG *)
int WINAPI TranslateAcceleratorW(_In_ HWND, _In_ HACCEL, _In_ LPMSG)
struct _WNDCLASSEXW WNDCLASSEXW
#define VK_DELETE
Definition: winuser.h:2236
#define WM_KEYDOWN
Definition: winuser.h:1718
#define MAKEINTRESOURCEW(i)
Definition: winuser.h:582
HMENU WINAPI LoadMenuW(_In_opt_ HINSTANCE, _In_ LPCWSTR)
BOOL WINAPI IsWindowVisible(_In_ HWND)
HICON WINAPI LoadIconW(_In_opt_ HINSTANCE hInstance, _In_ LPCWSTR lpIconName)
Definition: cursoricon.c:2127
int WINAPI GetSystemMetrics(_In_ int)
LRESULT WINAPI SendMessageW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define COLOR_3DFACE
Definition: winuser.h:932
__wchar_t WCHAR
Definition: xmlstorage.h:180
WCHAR * LPWSTR
Definition: xmlstorage.h:184
const WCHAR * LPCWSTR
Definition: xmlstorage.h:185