ReactOS 0.4.15-dev-6068-g8061a6f
main.c File Reference
#include "regedit.h"
Include dependency graph for main.c:

Go to the source code of this file.

Macros

#define MAX_LOADSTRING   100
 

Functions

BOOL ProcessCmdLine (WCHAR *cmdline)
 
BOOL InitInstance (HINSTANCE hInstance, int nCmdShow)
 
void DestroyMainMenu ()
 
void ExitInstance (HINSTANCE hInstance)
 
BOOL TranslateChildTabMessage (PMSG msg)
 
int WINAPI wWinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance, LPWSTR lpCmdLine, int nCmdShow)
 

Variables

const WCHARreg_class_namesW []
 
HINSTANCE hInst
 
HWND hFrameWnd
 
HWND hStatusBar
 
HMENU hMenuFrame
 
HMENU hPopupMenus = 0
 
UINT nClipboardFormat
 
LPCWSTR strClipboardFormat = L"TODO: SET CORRECT FORMAT"
 
WCHAR szTitle [MAX_LOADSTRING]
 
WCHAR szFrameClass [MAX_LOADSTRING]
 
WCHAR szChildClass [MAX_LOADSTRING]
 

Macro Definition Documentation

◆ MAX_LOADSTRING

#define MAX_LOADSTRING   100

Definition at line 42 of file main.c.

Function Documentation

◆ DestroyMainMenu()

void DestroyMainMenu ( void  )

Definition at line 164 of file main.c.

165{
167}
HMENU hMenuFrame
Definition: main.c:37
BOOL WINAPI DestroyMenu(_In_ HMENU)

Referenced by ChildWndProc().

◆ ExitInstance()

void ExitInstance ( HINSTANCE  hInstance)

Definition at line 171 of file main.c.

172{
174
177}
HMENU hPopupMenus
Definition: main.c:38
VOID UnloadAclUiDll(VOID)
Definition: security.c:830
HINSTANCE hInstance
Definition: charmap.c:19
BOOL WINAPI UnregisterHexEditorClass(HINSTANCE hInstance)
Definition: hexedit.c:90

◆ InitInstance()

BOOL InitInstance ( HINSTANCE  hInstance,
int  nCmdShow 
)

Definition at line 61 of file main.c.

62{
63 BOOL AclUiAvailable;
64 HMENU hEditMenu;
66 WNDCLASSEXW wcFrame;
67 WNDCLASSEXW wcChild;
68 ATOM hFrameWndClass;
69
70 ZeroMemory(&wcFrame, sizeof(WNDCLASSEXW));
71 wcFrame.cbSize = sizeof(WNDCLASSEXW);
72 wcFrame.lpfnWndProc = FrameWndProc;
73 wcFrame.hInstance = hInstance;
79 wcFrame.hbrBackground = (HBRUSH)(COLOR_3DFACE + 1);
81
82 hFrameWndClass = RegisterClassExW(&wcFrame); /* register frame window class */
83
84 ZeroMemory(&wcChild, sizeof(WNDCLASSEXW));
85 wcChild.cbSize = sizeof(WNDCLASSEXW);
86 wcChild.lpfnWndProc = ChildWndProc;
87 wcChild.cbWndExtra = sizeof(HANDLE);
88 wcChild.hInstance = hInstance;
91 wcChild.hbrBackground = (HBRUSH)(COLOR_3DFACE + 1);
96
97 RegisterClassExW(&wcChild); /* register child windows class */
98
100
103
104 /* Initialize the Windows Common Controls DLL */
105 /* NOTE: Windows sets 0xFFFF to icce.dwICC but we use better value. */
106 icce.dwSize = sizeof(icce);
109
110 hEditMenu = GetSubMenu(hMenuFrame, 1);
111
112 AclUiAvailable = InitializeAclUiDll();
113 if(!AclUiAvailable)
114 {
115 /* hide the Edit/Permissions... menu entry */
116 if(hEditMenu != NULL)
117 {
119 /* remove the separator after the menu item */
120 RemoveMenu(hEditMenu, 4, MF_BYPOSITION);
121 }
122 }
123
124 if(hEditMenu != NULL)
126
128 /* if (nClipboardFormat == 0) {
129 DWORD dwError = GetLastError();
130 } */
131
135 NULL, hMenuFrame, hInstance, NULL/*lpParam*/);
136
137 if (!hFrameWnd)
138 {
139 return FALSE;
140 }
141
142 /* Create the status bar */
145 if (hStatusBar)
146 {
147 /* Create the status bar panes */
150 }
151
152 LoadSettings();
154 return TRUE;
155}
void LoadSettings(void)
Definition: settings.c:53
LRESULT CALLBACK ChildWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
Definition: childwnd.c:301
void SetupStatusBar(HWND hWnd, BOOL bResize)
Definition: framewnd.c:161
LRESULT CALLBACK FrameWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
Definition: framewnd.c:1357
HWND hFrameWnd
Definition: main.c:35
UINT nClipboardFormat
Definition: main.c:39
WCHAR szFrameClass[MAX_LOADSTRING]
Definition: main.c:44
LPCWSTR strClipboardFormat
Definition: main.c:40
WCHAR szTitle[MAX_LOADSTRING]
Definition: main.c:43
WCHAR szChildClass[MAX_LOADSTRING]
Definition: main.c:45
HWND hStatusBar
Definition: main.c:36
#define STATUS_WINDOW
Definition: main.h:26
#define IDI_REGEDIT
Definition: resource.h:35
#define IDR_REGEDIT_MENU
Definition: resource.h:41
#define ID_EDIT_MODIFY
Definition: resource.h:62
#define ID_VIEW_STATUSBAR
Definition: resource.h:54
#define IDR_POPUP_MENUS
Definition: resource.h:45
#define ID_VIEW_MENU
Definition: resource.h:25
#define ID_EDIT_PERMISSIONS
Definition: resource.h:150
BOOL InitializeAclUiDll(VOID)
Definition: security.c:811
BOOL WINAPI InitCommonControlsEx(const INITCOMMONCONTROLSEX *lpInitCtrls)
Definition: commctrl.c:893
HWND WINAPI CreateStatusWindowW(LONG style, LPCWSTR text, HWND parent, UINT wid)
Definition: commctrl.c:795
WORD ATOM
Definition: dimm.idl:113
#define NULL
Definition: types.h:112
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
#define UlongToPtr(u)
Definition: config.h:106
unsigned int BOOL
Definition: ntddk_ex.h:94
ATOM WINAPI RegisterHexEditorClass(HINSTANCE hInstance)
Definition: hexedit.c:69
static HICON
Definition: imagelist.c:84
static const CLSID *static CLSID *static const GUID VARIANT VARIANT *static IServiceProvider DWORD *static HMENU
Definition: ordinal.c:60
#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:1971
#define ICC_STANDARD_CLASSES
Definition: commctrl.h:73
#define ICC_WIN95_CLASSES
Definition: commctrl.h:66
LPCWSTR lpszClassName
Definition: winuser.h:3216
HBRUSH hbrBackground
Definition: winuser.h:3214
WNDPROC lpfnWndProc
Definition: winuser.h:3208
UINT cbSize
Definition: winuser.h:3206
int cbWndExtra
Definition: winuser.h:3210
HCURSOR hCursor
Definition: winuser.h:3213
HICON hIconSm
Definition: winuser.h:3217
HINSTANCE hInstance
Definition: winuser.h:3211
HICON hIcon
Definition: winuser.h:3212
PVOID HANDLE
Definition: typedefs.h:73
#define ZeroMemory
Definition: winbase.h:1670
#define MF_BYCOMMAND
Definition: winuser.h:202
BOOL WINAPI SetMenuDefaultItem(_In_ HMENU, _In_ UINT, _In_ UINT)
#define IMAGE_ICON
Definition: winuser.h:212
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:2172
#define IDC_ARROW
Definition: winuser.h:682
UINT WINAPI RegisterClipboardFormatW(_In_ LPCWSTR)
#define SM_CYSMICON
Definition: winuser.h:1007
#define MF_CHECKED
Definition: winuser.h:132
HCURSOR WINAPI LoadCursorW(_In_opt_ HINSTANCE, _In_ LPCWSTR)
Definition: cursoricon.c:2074
DWORD WINAPI CheckMenuItem(_In_ HMENU, _In_ UINT, _In_ UINT)
#define SM_CXSMICON
Definition: winuser.h:1006
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:1094
#define CW_USEDEFAULT
Definition: winuser.h:225
struct _WNDCLASSEXW WNDCLASSEXW
#define MAKEINTRESOURCEW(i)
Definition: winuser.h:582
HMENU WINAPI LoadMenuW(_In_opt_ HINSTANCE, _In_ LPCWSTR)
HICON WINAPI LoadIconW(_In_opt_ HINSTANCE hInstance, _In_ LPCWSTR lpIconName)
Definition: cursoricon.c:2044
int WINAPI GetSystemMetrics(_In_ int)
#define COLOR_3DFACE
Definition: winuser.h:923
const WCHAR * LPCWSTR
Definition: xmlstorage.h:185

Referenced by WinMain(), and wWinMain().

◆ ProcessCmdLine()

BOOL ProcessCmdLine ( WCHAR cmdline)

Definition at line 227 of file regedit.c.

228{
229 WCHAR **argv;
230 int argc, i;
232#ifdef __REACTOS__
233 BOOL silent = FALSE;
234#endif
235
237
238 if (!argv)
239 return FALSE;
240
241 if (argc == 1)
242 {
244 return FALSE;
245 }
246
247 for (i = 1; i < argc; i++)
248 {
249 if (argv[i][0] != '/' && argv[i][0] != '-')
250 break; /* No flags specified. */
251
252 if (!argv[i][1] && argv[i][0] == '-')
253 break; /* '-' is a filename. It indicates we should use stdin. */
254
255 if (argv[i][1] && argv[i][2] && argv[i][2] != ':')
256 break; /* This is a file path beginning with '/'. */
257
258 switch (towupper(argv[i][1]))
259 {
260 case '?':
262 break;
263 case 'D':
265 break;
266 case 'E':
268 break;
269 case 'C':
270 case 'L':
271 case 'M':
272 case 'R':
273 /* unhandled */;
274 break;
275 case 'S':
276#ifdef __REACTOS__
277 silent = TRUE;
278 break;
279#endif
280 case 'V':
281 /* ignored */;
282 break;
283 default:
286 }
287 }
288
289 if (i == argc)
290 {
291 switch (action)
292 {
293 case ACTION_ADD:
294 case ACTION_EXPORT:
296 break;
297 case ACTION_DELETE:
299 break;
300 }
302 }
303
304 for (; i < argc; i++)
305#ifdef __REACTOS__
306 PerformRegAction(action, argv, &i, silent);
307#else
309#endif
310
312
313 return TRUE;
314}
static int argc
Definition: ServiceArgs.c:12
#define STRING_USAGE
Definition: resource.h:44
static void PerformRegAction(REGEDIT_ACTION action, WCHAR **argv, int *i)
Definition: regedit.c:129
void WINAPIV output_message(unsigned int id,...)
Definition: regedit.c:88
void WINAPIV error_exit(unsigned int id,...)
Definition: regedit.c:103
REGEDIT_ACTION
Definition: regedit.c:122
@ ACTION_ADD
Definition: regedit.c:123
@ ACTION_EXPORT
Definition: regedit.c:123
@ ACTION_DELETE
Definition: regedit.c:123
#define STRING_INVALID_SWITCH
Definition: resource.h:303
#define STRING_NO_FILENAME
Definition: resource.h:305
#define STRING_NO_REG_KEY
Definition: resource.h:306
const WCHAR * action
Definition: action.c:7479
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
HLOCAL NTAPI LocalFree(HLOCAL hMem)
Definition: heapmem.c:1594
#define argv
Definition: mplay32.c:18
LPWSTR *WINAPI CommandLineToArgvW(LPCWSTR lpCmdline, int *numargs)
Definition: shell32_main.c:80
TCHAR * cmdline
Definition: stretchblt.cpp:32
#define towupper(c)
Definition: wctype.h:99
#define STRING_HELP
Definition: xcopy.h:74
__wchar_t WCHAR
Definition: xmlstorage.h:180

Referenced by wWinMain().

◆ TranslateChildTabMessage()

BOOL TranslateChildTabMessage ( PMSG  msg)

Definition at line 179 of file main.c.

180{
181 if (msg->message != WM_KEYDOWN) return FALSE;
182
183 /* Allow Ctrl+A on address bar */
184 if ((msg->hwnd == g_pChildWnd->hAddressBarWnd) &&
185 (msg->message == WM_KEYDOWN) &&
186 (msg->wParam == L'A') && (GetKeyState(VK_CONTROL) < 0))
187 {
188 SendMessageW(msg->hwnd, EM_SETSEL, 0, -1);
189 return TRUE;
190 }
191
192 if (msg->wParam != VK_TAB) return FALSE;
193 if (GetParent(msg->hwnd) != g_pChildWnd->hWnd) return FALSE;
195 return TRUE;
196}
#define msg(x)
Definition: auth_time.c:54
ChildWnd * g_pChildWnd
Definition: childwnd.c:23
#define ID_SWITCH_PANELS
Definition: resource.h:149
HWND hAddressBarWnd
Definition: main.h:65
HWND hWnd
Definition: main.h:62
#define VK_TAB
Definition: winuser.h:2189
BOOL WINAPI PostMessageW(_In_opt_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define WM_COMMAND
Definition: winuser.h:1730
#define VK_CONTROL
Definition: winuser.h:2193
#define EM_SETSEL
Definition: winuser.h:2008
HWND WINAPI GetParent(_In_ HWND)
#define WM_KEYDOWN
Definition: winuser.h:1705
LRESULT WINAPI SendMessageW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
SHORT WINAPI GetKeyState(_In_ int)

Referenced by wWinMain().

◆ wWinMain()

int WINAPI wWinMain ( HINSTANCE  hInstance,
HINSTANCE  hPrevInstance,
LPWSTR  lpCmdLine,
int  nShowCmd 
)

This file has no copyright assigned and is placed in the Public Domain. This file is part of the w64 mingw-runtime package. No warranty is given; refer to the file DISCLAIMER.PD within this package.

Definition at line 198 of file main.c.

202{
203 MSG msg;
204 HACCEL hAccel;
205
206 UNREFERENCED_PARAMETER(hPrevInstance);
207
208#ifdef _DEBUG
209 /* Report any memory leaks on exit */
211#endif
212
213 /* Initialize global strings */
217
219 {
220 return 0;
221 }
222
223 switch (GetUserDefaultUILanguage())
224 {
227 break;
228
229 default:
230 break;
231 }
232 /* Store instance handle in our global variable */
234
235 /* Perform application initialization */
236 if (!InitInstance(hInstance, nCmdShow))
237 {
238 return 0;
239 }
241
242 /* Main message loop */
243 while (GetMessageW(&msg, NULL, 0, 0))
244 {
247 {
250 }
251 }
252
254 return (int)msg.wParam;
255}
#define ID_ACCEL
Definition: resources.h:13
#define IDS_APP_TITLE
Definition: resource.h:10
BOOL InitInstance(HINSTANCE hInstance, int nCmdShow)
Definition: main.c:61
BOOL TranslateChildTabMessage(PMSG msg)
Definition: main.c:179
BOOL ProcessCmdLine(WCHAR *cmdline)
Definition: regedit.c:227
#define ARRAY_SIZE(A)
Definition: main.h:33
#define IDC_REGEDIT
Definition: resource.h:39
#define IDC_REGEDIT_FRAME
Definition: resource.h:40
#define _CRTDBG_LEAK_CHECK_DF
Definition: crtdbg.h:52
#define _CrtSetDbgFlag(f)
Definition: crtdbg.h:240
#define _CRTDBG_ALLOC_MEM_DF
Definition: crtdbg.h:47
LPWSTR WINAPI GetCommandLineW(VOID)
Definition: proc.c:2013
HINSTANCE hInst
Definition: dxdiag.c:13
LANGID WINAPI GetUserDefaultUILanguage(void)
Definition: lang.c:810
void ExitInstance(void)
Definition: main.c:213
HACCEL hAccel
Definition: main.c:47
#define UNREFERENCED_PARAMETER(P)
Definition: ntbasedef.h:317
#define MAKELANGID(p, s)
Definition: nls.h:15
#define LANG_HEBREW
Definition: nls.h:67
#define SUBLANG_DEFAULT
Definition: nls.h:168
TW_UINT32 TW_UINT16 TW_UINT16 MSG
Definition: twain.h:1829
BOOL WINAPI SetProcessDefaultLayout(DWORD dwDefaultLayout)
Definition: window.c:1720
#define LAYOUT_RTL
Definition: wingdi.h:1371
BOOL WINAPI TranslateMessage(_In_ const MSG *)
BOOL WINAPI GetMessageW(_Out_ LPMSG, _In_opt_ HWND, _In_ UINT, _In_ UINT)
int WINAPI LoadStringW(_In_opt_ HINSTANCE hInstance, _In_ UINT uID, _Out_writes_to_(cchBufferMax, return+1) LPWSTR lpBuffer, _In_ int cchBufferMax)
HACCEL WINAPI LoadAcceleratorsW(_In_opt_ HINSTANCE, _In_ LPCWSTR)
LRESULT WINAPI DispatchMessageW(_In_ const MSG *)
int WINAPI TranslateAcceleratorW(_In_ HWND, _In_ HACCEL, _In_ LPMSG)

Variable Documentation

◆ hFrameWnd

◆ hInst

HINSTANCE hInst

Definition at line 34 of file main.c.

◆ hMenuFrame

◆ hPopupMenus

HMENU hPopupMenus = 0

◆ hStatusBar

HWND hStatusBar

Definition at line 36 of file main.c.

Referenced by InitInstance(), and UpdateStatusBar().

◆ nClipboardFormat

UINT nClipboardFormat

Definition at line 39 of file main.c.

Referenced by InitInstance().

◆ reg_class_namesW

const WCHAR* reg_class_namesW[]
Initial value:
= {L"HKEY_LOCAL_MACHINE", L"HKEY_USERS",
L"HKEY_CLASSES_ROOT", L"HKEY_CURRENT_CONFIG",
L"HKEY_CURRENT_USER", L"HKEY_DYN_DATA"
}

Definition at line 25 of file main.c.

Referenced by export_all(), and parse_key_name().

◆ strClipboardFormat

LPCWSTR strClipboardFormat = L"TODO: SET CORRECT FORMAT"

Definition at line 40 of file main.c.

Referenced by InitInstance().

◆ szChildClass

WCHAR szChildClass[MAX_LOADSTRING]

Definition at line 45 of file main.c.

Referenced by FrameWndProc(), InitChildWindow(), InitInstance(), WinMain(), and wWinMain().

◆ szFrameClass

WCHAR szFrameClass[MAX_LOADSTRING]

Definition at line 44 of file main.c.

Referenced by InitInstance(), WinMain(), and wWinMain().

◆ szTitle