ReactOS  0.4.15-dev-5496-g599ba9c
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 }
BOOL WINAPI DestroyMenu(_In_ HMENU)
HMENU hMenuFrame
Definition: main.c:37

Referenced by ChildWndProc().

◆ ExitInstance()

void ExitInstance ( HINSTANCE  hInstance)

Definition at line 171 of file main.c.

172 {
174 
176  UnloadAclUiDll();
177 }
BOOL WINAPI UnregisterHexEditorClass(HINSTANCE hInstance)
Definition: hexedit.c:90
HMENU hPopupMenus
Definition: main.c:38
HINSTANCE hInstance
Definition: main.c:36
BOOL WINAPI DestroyMenu(_In_ HMENU)
VOID UnloadAclUiDll(VOID)
Definition: security.c:830

Referenced by WinMain(), and wWinMain().

◆ 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;
78  wcFrame.hCursor = LoadCursorW(NULL, IDC_ARROW);
79  wcFrame.hbrBackground = (HBRUSH)(COLOR_3DFACE + 1);
80  wcFrame.lpszClassName = szFrameClass;
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;
90  wcChild.hCursor = LoadCursorW(NULL, IDC_ARROW);
91  wcChild.hbrBackground = (HBRUSH)(COLOR_3DFACE + 1);
92  wcChild.lpszClassName = szChildClass;
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);
108  InitCommonControlsEx(&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 }
#define WS_CLIPSIBLINGS
Definition: pedump.c:618
LRESULT CALLBACK ChildWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
Definition: childwnd.c:301
#define WS_EX_WINDOWEDGE
Definition: winuser.h:407
static HICON
Definition: imagelist.c:84
#define IDI_REGEDIT
Definition: resource.h:35
void SetupStatusBar(HWND hWnd, BOOL bResize)
Definition: framewnd.c:161
#define LR_SHARED
Definition: winuser.h:1094
#define IMAGE_ICON
Definition: winuser.h:212
#define MF_BYCOMMAND
Definition: winuser.h:202
int cbWndExtra
Definition: winuser.h:3210
const WCHAR * LPCWSTR
Definition: xmlstorage.h:185
WORD ATOM
Definition: dimm.idl:113
#define TRUE
Definition: types.h:120
UINT WINAPI RegisterClipboardFormatW(_In_ LPCWSTR)
BOOL InitializeAclUiDll(VOID)
Definition: security.c:811
WCHAR szTitle[MAX_LOADSTRING]
Definition: main.c:43
BOOL WINAPI UpdateWindow(_In_ HWND)
#define ZeroMemory
Definition: winbase.h:1670
#define SM_CYSMICON
Definition: winuser.h:1007
HICON hIcon
Definition: winuser.h:3212
#define WS_CHILD
Definition: pedump.c:617
struct _WNDCLASSEXW WNDCLASSEXW
#define WS_CLIPCHILDREN
Definition: pedump.c:619
ATOM WINAPI RegisterClassExW(_In_ CONST WNDCLASSEXW *)
#define ICC_WIN95_CLASSES
Definition: commctrl.h:66
#define L(x)
Definition: ntvdm.h:50
#define ID_VIEW_STATUSBAR
Definition: resource.h:54
#define COLOR_3DFACE
Definition: winuser.h:923
void LoadSettings(void)
Definition: settings.c:53
#define FALSE
Definition: types.h:117
unsigned int BOOL
Definition: ntddk_ex.h:94
HANDLE WINAPI LoadImageW(_In_opt_ HINSTANCE, _In_ LPCWSTR, _In_ UINT, _In_ int, _In_ int, _In_ UINT)
Definition: cursoricon.c:2172
#define MF_BYPOSITION
Definition: winuser.h:203
HWND WINAPI CreateStatusWindowW(LONG style, LPCWSTR text, HWND parent, UINT wid)
Definition: commctrl.c:795
#define CW_USEDEFAULT
Definition: winuser.h:225
#define ID_EDIT_PERMISSIONS
Definition: resource.h:150
static HANDLE(WINAPI *pGetProcessHandleFromHwnd)(HWND)
#define ICC_USEREX_CLASSES
Definition: commctrl.h:68
HWND hStatusBar
Definition: main.c:36
#define UlongToPtr(u)
Definition: config.h:106
LPCWSTR lpszClassName
Definition: winuser.h:3216
#define MF_CHECKED
Definition: winuser.h:132
WCHAR szFrameClass[MAX_LOADSTRING]
Definition: main.c:44
HBRUSH hbrBackground
Definition: winuser.h:3214
UINT cbSize
Definition: winuser.h:3206
HMENU hPopupMenus
Definition: main.c:38
#define IDR_REGEDIT_MENU
Definition: resource.h:41
int WINAPI GetSystemMetrics(_In_ int)
DWORD WINAPI CheckMenuItem(_In_ HMENU, _In_ UINT, _In_ UINT)
HCURSOR WINAPI LoadCursorW(_In_opt_ HINSTANCE, _In_ LPCWSTR)
Definition: cursoricon.c:2074
HINSTANCE hInstance
Definition: main.c:36
HINSTANCE hInstance
Definition: winuser.h:3211
#define SM_CXSMICON
Definition: winuser.h:1006
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)
BOOL WINAPI InitCommonControlsEx(const INITCOMMONCONTROLSEX *lpInitCtrls)
Definition: commctrl.c:893
#define ID_VIEW_MENU
Definition: resource.h:25
WCHAR szChildClass[MAX_LOADSTRING]
Definition: main.c:45
HCURSOR hCursor
Definition: winuser.h:3213
HMENU WINAPI GetSubMenu(_In_ HMENU, _In_ int)
#define STATUS_WINDOW
Definition: main.h:26
WNDPROC lpfnWndProc
Definition: winuser.h:3208
ATOM WINAPI RegisterHexEditorClass(HINSTANCE hInstance)
Definition: hexedit.c:69
#define ID_EDIT_MODIFY
Definition: resource.h:62
HWND hFrameWnd
Definition: main.c:35
#define IDR_POPUP_MENUS
Definition: resource.h:45
HMENU hMenuFrame
Definition: main.c:37
LRESULT CALLBACK FrameWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
Definition: framewnd.c:1352
BOOL WINAPI RemoveMenu(_In_ HMENU, _In_ UINT, _In_ UINT)
#define NULL
Definition: types.h:112
BOOL WINAPI SetMenuDefaultItem(_In_ HMENU, _In_ UINT, _In_ UINT)
HICON hIconSm
Definition: winuser.h:3217
#define IDC_ARROW
Definition: winuser.h:682
HMENU WINAPI LoadMenuW(_In_opt_ HINSTANCE, _In_ LPCWSTR)
#define WS_OVERLAPPEDWINDOW
Definition: pedump.c:637
HICON WINAPI LoadIconW(_In_opt_ HINSTANCE, _In_ LPCWSTR)
Definition: cursoricon.c:2044
#define ICC_STANDARD_CLASSES
Definition: commctrl.h:73
#define MAKEINTRESOURCEW(i)
Definition: winuser.h:582
#define WS_VISIBLE
Definition: pedump.c:620
static const CLSID *static CLSID *static const GUID VARIANT VARIANT *static IServiceProvider DWORD *static HMENU
Definition: ordinal.c:60
#define SBT_NOBORDERS
Definition: commctrl.h:1971
UINT nClipboardFormat
Definition: main.c:39
LPCWSTR strClipboardFormat
Definition: main.c:40

Referenced by WinMain(), and wWinMain().

◆ ProcessCmdLine()

BOOL ProcessCmdLine ( WCHAR cmdline)

Definition at line 188 of file regedit.c.

189 {
190  WCHAR **argv;
191  int argc, i;
193 
195 
196  if (!argv)
197  return FALSE;
198 
199  if (argc == 1)
200  {
201  LocalFree(argv);
202  return FALSE;
203  }
204 
205  for (i = 1; i < argc; i++)
206  {
207  if (argv[i][0] != '/' && argv[i][0] != '-')
208  break; /* No flags specified. */
209 
210  if (!argv[i][1] && argv[i][0] == '-')
211  break; /* '-' is a filename. It indicates we should use stdin. */
212 
213  if (argv[i][1] && argv[i][2] && argv[i][2] != ':')
214  break; /* This is a file path beginning with '/'. */
215 
216  switch (towupper(argv[i][1]))
217  {
218  case '?':
220  break;
221  case 'D':
223  break;
224  case 'E':
226  break;
227  case 'C':
228  case 'L':
229  case 'M':
230  case 'R':
231  /* unhandled */;
232  break;
233  case 'S':
234  case 'V':
235  /* ignored */;
236  break;
237  default:
240  }
241  }
242 
243  if (i == argc)
244  {
245  switch (action)
246  {
247  case ACTION_ADD:
248  case ACTION_EXPORT:
250  break;
251  case ACTION_DELETE:
253  break;
254  }
256  }
257 
258  for (; i < argc; i++)
260 
261  LocalFree(argv);
262 
263  return TRUE;
264 }
#define STRING_INVALID_SWITCH
Definition: resource.h:303
static int argc
Definition: ServiceArgs.c:12
#define STRING_USAGE
Definition: resource.h:44
#define TRUE
Definition: types.h:120
TCHAR * cmdline
Definition: stretchblt.cpp:32
#define argv
Definition: mplay32.c:18
#define STRING_NO_FILENAME
Definition: resource.h:305
#define FALSE
Definition: types.h:117
LPWSTR *WINAPI CommandLineToArgvW(LPCWSTR lpCmdline, int *numargs)
Definition: shell32_main.c:80
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define STRING_NO_REG_KEY
Definition: resource.h:306
void WINAPIV error_exit(unsigned int id,...)
Definition: regedit.c:103
REGEDIT_ACTION
Definition: regedit.c:122
static void PerformRegAction(REGEDIT_ACTION action, WCHAR **argv, int *i)
Definition: regedit.c:126
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:1577
void WINAPIV output_message(unsigned int id,...)
Definition: regedit.c:88
#define STRING_HELP
Definition: xcopy.h:74
#define towupper(c)
Definition: wctype.h:99

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 ID_SWITCH_PANELS
Definition: resource.h:149
ChildWnd * g_pChildWnd
Definition: childwnd.c:23
#define TRUE
Definition: types.h:120
#define VK_TAB
Definition: winuser.h:2189
#define L(x)
Definition: ntvdm.h:50
#define FALSE
Definition: types.h:117
#define WM_KEYDOWN
Definition: winuser.h:1705
SHORT WINAPI GetKeyState(_In_ int)
HWND hWnd
Definition: main.h:62
#define EM_SETSEL
Definition: winuser.h:2008
#define WM_COMMAND
Definition: winuser.h:1730
HWND hFrameWnd
Definition: main.c:35
HWND WINAPI GetParent(_In_ HWND)
LRESULT WINAPI SendMessageW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define VK_CONTROL
Definition: winuser.h:2193
#define msg(x)
Definition: auth_time.c:54
HWND hAddressBarWnd
Definition: main.h:65
BOOL WINAPI PostMessageW(_In_opt_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)

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 */
228  hInst = hInstance;
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 }
LANGID WINAPI GetUserDefaultUILanguage(void)
Definition: lang.c:810
BOOL WINAPI TranslateMessage(_In_ const MSG *)
void ExitInstance(HINSTANCE hInstance)
Definition: main.c:171
#define LAYOUT_RTL
Definition: wingdi.h:1371
#define UNREFERENCED_PARAMETER(P)
Definition: ntbasedef.h:317
TW_UINT32 TW_UINT16 TW_UINT16 MSG
Definition: twain.h:1827
#define SUBLANG_DEFAULT
Definition: nls.h:168
WCHAR szTitle[MAX_LOADSTRING]
Definition: main.c:43
int WINAPI LoadStringW(_In_opt_ HINSTANCE hInstance, _In_ UINT uID, _Out_writes_to_(cchBufferMax, return+1) LPWSTR lpBuffer, _In_ int cchBufferMax)
#define LANG_HEBREW
Definition: nls.h:67
HINSTANCE hInst
Definition: main.c:34
LRESULT WINAPI DispatchMessageW(_In_ const MSG *)
HACCEL hAccel
Definition: main.c:47
BOOL ProcessCmdLine(WCHAR *cmdline)
Definition: regedit.c:188
LPWSTR WINAPI GetCommandLineW(VOID)
Definition: proc.c:2014
HACCEL WINAPI LoadAcceleratorsW(_In_opt_ HINSTANCE, _In_ LPCWSTR)
BOOL WINAPI SetProcessDefaultLayout(DWORD dwDefaultLayout)
Definition: window.c:1720
WCHAR szFrameClass[MAX_LOADSTRING]
Definition: main.c:44
#define IDC_REGEDIT
Definition: resource.h:39
HINSTANCE hInstance
Definition: main.c:36
#define IDC_REGEDIT_FRAME
Definition: resource.h:40
BOOL TranslateChildTabMessage(PMSG msg)
Definition: main.c:179
int WINAPI TranslateAcceleratorW(_In_ HWND, _In_ HACCEL, _In_ LPMSG)
WCHAR szChildClass[MAX_LOADSTRING]
Definition: main.c:45
HWND hFrameWnd
Definition: main.c:35
#define ARRAY_SIZE(a)
Definition: main.h:24
#define NULL
Definition: types.h:112
#define IDS_APP_TITLE
Definition: resource.h:10
BOOL WINAPI GetMessageW(_Out_ LPMSG, _In_opt_ HWND, _In_ UINT, _In_ UINT)
#define msg(x)
Definition: auth_time.c:54
BOOL InitInstance(HINSTANCE hInstance, int nCmdShow)
Definition: main.c:61
#define ID_ACCEL
Definition: resources.h:13
#define MAKELANGID(p, s)
Definition: nls.h:15
#define MAKEINTRESOURCEW(i)
Definition: winuser.h:582

Variable Documentation

◆ hFrameWnd

◆ hInst

◆ 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"
}
#define L(x)
Definition: ntvdm.h:50

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