ReactOS 0.4.16-dev-13-ge2fc578
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)
 
static BOOL InLabelEdit (HWND hWnd, UINT Msg)
 
static BOOL TranslateChildTabMessage (PMSG msg)
 
static BOOL TranslateRegeditAccelerator (HWND hWnd, HACCEL hAccTable, 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
 
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 29 of file main.c.

Function Documentation

◆ DestroyMainMenu()

void DestroyMainMenu ( void  )

Definition at line 139 of file main.c.

140{
142}
HMENU hMenuFrame
Definition: main.c:24
BOOL WINAPI DestroyMenu(_In_ HMENU)

Referenced by ChildWndProc().

◆ ExitInstance()

void ExitInstance ( HINSTANCE  hInstance)

Definition at line 144 of file main.c.

145{
147
150}
HMENU hPopupMenus
Definition: main.c:25
VOID UnloadAclUiDll(VOID)
Definition: security.c:784
HINSTANCE hInstance
Definition: charmap.c:19
BOOL WINAPI UnregisterHexEditorClass(HINSTANCE hInstance)
Definition: hexedit.c:77

◆ InitInstance()

BOOL InitInstance ( HINSTANCE  hInstance,
int  nCmdShow 
)

PURPOSE: Saves instance handle and creates main window

COMMENTS: In this function, we save the instance handle in a global variable and create and display the main program window.

Definition at line 42 of file main.c.

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}
void LoadSettings(void)
Definition: settings.c:53
LRESULT CALLBACK ChildWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
Definition: childwnd.c:366
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
HWND hFrameWnd
Definition: main.c:22
UINT nClipboardFormat
Definition: main.c:26
WCHAR szFrameClass[MAX_LOADSTRING]
Definition: main.c:31
LPCWSTR strClipboardFormat
Definition: main.c:27
WCHAR szTitle[MAX_LOADSTRING]
Definition: main.c:30
WCHAR szChildClass[MAX_LOADSTRING]
Definition: main.c:32
HWND hStatusBar
Definition: main.c:23
#define STATUS_WINDOW
Definition: main.h:13
#define IDI_REGEDIT
Definition: resource.h:22
#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 ID_VIEW_MENU
Definition: resource.h:12
#define ID_EDIT_PERMISSIONS
Definition: resource.h:103
BOOL InitializeAclUiDll(VOID)
Definition: security.c:765
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
#define UlongToPtr(u)
Definition: config.h:106
unsigned int BOOL
Definition: ntddk_ex.h:94
ATOM WINAPI RegisterHexEditorClass(HINSTANCE hInstance)
Definition: hexedit.c:56
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
#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 ICC_STANDARD_CLASSES
Definition: commctrl.h:73
#define ICC_WIN95_CLASSES
Definition: commctrl.h:66
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
PVOID HANDLE
Definition: typedefs.h:73
#define ZeroMemory
Definition: winbase.h:1712
#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:2247
#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:2149
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
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:2119
int WINAPI GetSystemMetrics(_In_ int)
#define COLOR_3DFACE
Definition: winuser.h:932
const WCHAR * LPCWSTR
Definition: xmlstorage.h:185

Referenced by WinMain(), and wWinMain().

◆ InLabelEdit()

static BOOL InLabelEdit ( HWND  hWnd,
UINT  Msg 
)
static

Definition at line 152 of file main.c.

153{
154 HWND hEdit = (HWND)SendMessageW(hWnd, Msg, 0, 0);
155 return hEdit && IsWindowVisible(hEdit);
156}
HWND hWnd
Definition: settings.c:17
struct @1636 Msg[]
HANDLE HWND
Definition: compat.h:19
static HWND hEdit
Definition: autocomplete.c:34
BOOL WINAPI IsWindowVisible(_In_ HWND)
LRESULT WINAPI SendMessageW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)

Referenced by DECLARE_INTERFACE_(), and TranslateRegeditAccelerator().

◆ ProcessCmdLine()

BOOL ProcessCmdLine ( WCHAR cmdline)

Definition at line 216 of file regedit.c.

217{
218 WCHAR **argv;
219 int argc, i;
221#ifdef __REACTOS__
222 BOOL silent = FALSE;
223#endif
224
226
227 if (!argv)
228 return FALSE;
229
230 if (argc == 1)
231 {
233 return FALSE;
234 }
235
236 for (i = 1; i < argc; i++)
237 {
238 if (argv[i][0] != '/' && argv[i][0] != '-')
239 break; /* No flags specified. */
240
241 if (!argv[i][1] && argv[i][0] == '-')
242 break; /* '-' is a filename. It indicates we should use stdin. */
243
244 if (argv[i][1] && argv[i][2] && argv[i][2] != ':')
245 break; /* This is a file path beginning with '/'. */
246
247 switch (towupper(argv[i][1]))
248 {
249 case '?':
251 break;
252 case 'D':
254 break;
255 case 'E':
257 break;
258 case 'C':
259 case 'L':
260 case 'M':
261 case 'R':
262 /* unhandled */;
263 break;
264 case 'S':
265#ifdef __REACTOS__
266 silent = TRUE;
267 break;
268#endif
269 case 'V':
270 /* ignored */;
271 break;
272 default:
275 }
276 }
277
278 if (i == argc)
279 {
280 switch (action)
281 {
282 case ACTION_ADD:
283 case ACTION_EXPORT:
285 break;
286 case ACTION_DELETE:
288 break;
289 }
291 }
292
293 for (; i < argc; i++)
294#ifdef __REACTOS__
295 PerformRegAction(action, argv, &i, silent);
296#else
298#endif
299
301
302 return TRUE;
303}
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:114
void WINAPIV output_message(unsigned int id,...)
Definition: regedit.c:73
void WINAPIV error_exit(unsigned int id,...)
Definition: regedit.c:88
REGEDIT_ACTION
Definition: regedit.c:107
@ ACTION_ADD
Definition: regedit.c:108
@ ACTION_EXPORT
Definition: regedit.c:108
@ ACTION_DELETE
Definition: regedit.c:108
#define STRING_INVALID_SWITCH
Definition: resource.h:325
#define STRING_NO_FILENAME
Definition: resource.h:327
#define STRING_NO_REG_KEY
Definition: resource.h:328
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:79
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()

static BOOL TranslateChildTabMessage ( PMSG  msg)
static

Definition at line 158 of file main.c.

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}
#define msg(x)
Definition: auth_time.c:54
ChildWnd * g_pChildWnd
Definition: childwnd.c:13
#define ID_SWITCH_PANELS
Definition: resource.h:102
HWND hWnd
Definition: main.h:49
#define VK_TAB
Definition: winuser.h:2202
BOOL WINAPI PostMessageW(_In_opt_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define WM_COMMAND
Definition: winuser.h:1743
HWND WINAPI GetParent(_In_ HWND)
#define WM_KEYDOWN
Definition: winuser.h:1718

Referenced by wWinMain().

◆ TranslateRegeditAccelerator()

static BOOL TranslateRegeditAccelerator ( HWND  hWnd,
HACCEL  hAccTable,
PMSG  msg 
)
static

Definition at line 167 of file main.c.

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}
static BOOL InLabelEdit(HWND hWnd, UINT Msg)
Definition: main.c:152
#define LVM_GETEDITCONTROL
Definition: commctrl.h:2547
#define TVM_GETEDITCONTROL
Definition: commctrl.h:3511
HWND hTreeWnd
Definition: main.h:50
HWND hListWnd
Definition: main.h:51
HWND hAddressBarWnd
Definition: main.h:52
int WINAPI TranslateAcceleratorW(_In_ HWND, _In_ HACCEL, _In_ LPMSG)
#define VK_DELETE
Definition: winuser.h:2236

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 182 of file main.c.

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}
#define ID_ACCEL
Definition: resources.h:13
#define IDS_APP_TITLE
Definition: resource.h:10
BOOL InitInstance(HINSTANCE hInstance, int nCmdShow)
Definition: main.c:42
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
#define ARRAY_SIZE(A)
Definition: main.h:20
#define IDC_REGEDIT
Definition: resource.h:26
#define IDC_REGEDIT_FRAME
Definition: resource.h:27
LPWSTR WINAPI GetCommandLineW(VOID)
Definition: proc.c:2013
LANGID WINAPI GetUserDefaultUILanguage(void)
Definition: locale.c:1374
HRESULT WINAPI DECLSPEC_HOTPATCH OleInitialize(LPVOID reserved)
Definition: ole2.c:169
HINSTANCE hInst
Definition: dxdiag.c:13
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:1691
#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 *)

Variable Documentation

◆ hFrameWnd

◆ hInst

HINSTANCE hInst

Definition at line 21 of file main.c.

◆ hMenuFrame

◆ hPopupMenus

HMENU hPopupMenus

◆ hStatusBar

◆ nClipboardFormat

UINT nClipboardFormat

Definition at line 26 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 12 of file main.c.

Referenced by export_all(), parse_key_name(), txt_export_all(), and txt_parse_key_name().

◆ strClipboardFormat

LPCWSTR strClipboardFormat = L"TODO: SET CORRECT FORMAT"

Definition at line 27 of file main.c.

Referenced by InitInstance().

◆ szChildClass

WCHAR szChildClass[MAX_LOADSTRING]

Definition at line 32 of file main.c.

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

◆ szFrameClass

WCHAR szFrameClass[MAX_LOADSTRING]

Definition at line 31 of file main.c.

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

◆ szTitle