ReactOS 0.4.15-dev-8145-ga541a46
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:829
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:313
void SetupStatusBar(HWND hWnd, BOOL bResize)
Definition: framewnd.c:178
LRESULT CALLBACK FrameWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
Definition: framewnd.c:1488
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:810
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: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:1971
#define ICC_STANDARD_CLASSES
Definition: commctrl.h:73
#define ICC_WIN95_CLASSES
Definition: commctrl.h:66
LPCWSTR lpszClassName
Definition: winuser.h:3226
HBRUSH hbrBackground
Definition: winuser.h:3224
WNDPROC lpfnWndProc
Definition: winuser.h:3218
UINT cbSize
Definition: winuser.h:3216
int cbWndExtra
Definition: winuser.h:3220
HCURSOR hCursor
Definition: winuser.h:3223
HICON hIconSm
Definition: winuser.h:3227
HINSTANCE hInstance
Definition: winuser.h:3221
HICON hIcon
Definition: winuser.h:3222
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:2234
#define IDC_ARROW
Definition: winuser.h:687
UINT WINAPI RegisterClipboardFormatW(_In_ LPCWSTR)
#define SM_CYSMICON
Definition: winuser.h:1013
#define MF_CHECKED
Definition: winuser.h:132
HCURSOR WINAPI LoadCursorW(_In_opt_ HINSTANCE, _In_ LPCWSTR)
Definition: cursoricon.c:2136
DWORD WINAPI CheckMenuItem(_In_ HMENU, _In_ UINT, _In_ UINT)
#define SM_CXSMICON
Definition: winuser.h:1012
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:1100
#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:2106
int WINAPI GetSystemMetrics(_In_ int)
#define COLOR_3DFACE
Definition: winuser.h:929
const WCHAR * LPCWSTR
Definition: xmlstorage.h:185

Referenced by WinMain(), and wWinMain().

◆ ProcessCmdLine()

BOOL ProcessCmdLine ( WCHAR cmdline)

Definition at line 229 of file regedit.c.

230{
231 WCHAR **argv;
232 int argc, i;
234#ifdef __REACTOS__
235 BOOL silent = FALSE;
236#endif
237
239
240 if (!argv)
241 return FALSE;
242
243 if (argc == 1)
244 {
246 return FALSE;
247 }
248
249 for (i = 1; i < argc; i++)
250 {
251 if (argv[i][0] != '/' && argv[i][0] != '-')
252 break; /* No flags specified. */
253
254 if (!argv[i][1] && argv[i][0] == '-')
255 break; /* '-' is a filename. It indicates we should use stdin. */
256
257 if (argv[i][1] && argv[i][2] && argv[i][2] != ':')
258 break; /* This is a file path beginning with '/'. */
259
260 switch (towupper(argv[i][1]))
261 {
262 case '?':
264 break;
265 case 'D':
267 break;
268 case 'E':
270 break;
271 case 'C':
272 case 'L':
273 case 'M':
274 case 'R':
275 /* unhandled */;
276 break;
277 case 'S':
278#ifdef __REACTOS__
279 silent = TRUE;
280 break;
281#endif
282 case 'V':
283 /* ignored */;
284 break;
285 default:
288 }
289 }
290
291 if (i == argc)
292 {
293 switch (action)
294 {
295 case ACTION_ADD:
296 case ACTION_EXPORT:
298 break;
299 case ACTION_DELETE:
301 break;
302 }
304 }
305
306 for (; i < argc; i++)
307#ifdef __REACTOS__
308 PerformRegAction(action, argv, &i, silent);
309#else
311#endif
312
314
315 return TRUE;
316}
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:127
void WINAPIV output_message(unsigned int id,...)
Definition: regedit.c:86
void WINAPIV error_exit(unsigned int id,...)
Definition: regedit.c:101
REGEDIT_ACTION
Definition: regedit.c:120
@ ACTION_ADD
Definition: regedit.c:121
@ ACTION_EXPORT
Definition: regedit.c:121
@ ACTION_DELETE
Definition: regedit.c:121
#define STRING_INVALID_SWITCH
Definition: resource.h:373
#define STRING_NO_FILENAME
Definition: resource.h:375
#define STRING_NO_REG_KEY
Definition: resource.h:376
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:24
#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:2199
BOOL WINAPI PostMessageW(_In_opt_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define WM_COMMAND
Definition: winuser.h:1740
#define VK_CONTROL
Definition: winuser.h:2203
#define EM_SETSEL
Definition: winuser.h:2018
HWND WINAPI GetParent(_In_ HWND)
#define WM_KEYDOWN
Definition: winuser.h:1715
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 /* Initialize global strings */
212
214 {
215 return 0;
216 }
217
218 switch (GetUserDefaultUILanguage())
219 {
222 break;
223
224 default:
225 break;
226 }
227 /* Store instance handle in our global variable */
229
230 /* Perform application initialization */
231 if (!InitInstance(hInstance, nCmdShow))
232 {
233 return 0;
234 }
236
237 /* Main message loop */
238 while (GetMessageW(&msg, NULL, 0, 0))
239 {
242 {
245 }
246 }
247
249 return (int)msg.wParam;
250}
#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:229
#define ARRAY_SIZE(A)
Definition: main.h:33
#define IDC_REGEDIT
Definition: resource.h:39
#define IDC_REGEDIT_FRAME
Definition: resource.h:40
LPWSTR WINAPI GetCommandLineW(VOID)
Definition: proc.c:2013
LANGID WINAPI GetUserDefaultUILanguage(void)
Definition: locale.c:1374
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:1719
#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

◆ 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(), parse_key_name(), txt_export_all(), and txt_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