mirror of
https://github.com/reactos/reactos.git
synced 2025-01-07 06:45:24 +00:00
[REGEDIT
- Fix comment headers. - Improve error-displaying function and add another one (to be used later on). - Clear a part of code. svn path=/trunk/; revision=57456
This commit is contained in:
parent
835f8fc099
commit
4617f92587
5 changed files with 114 additions and 43 deletions
|
@ -1,14 +1,76 @@
|
||||||
|
/*
|
||||||
|
* Regedit errors, warnings, informations displaying
|
||||||
|
*
|
||||||
|
* Copyright (C) 2010 Adam Kachwalla <geekdundee@gmail.com>
|
||||||
|
* Copyright (C) 2012 Hermès Bélusca - Maïto <hermes.belusca@sfr.fr>
|
||||||
|
*
|
||||||
|
* This library is free software; you can redistribute it and/or
|
||||||
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
|
* License as published by the Free Software Foundation; either
|
||||||
|
* version 2.1 of the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This library is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
* Lesser General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Lesser General Public
|
||||||
|
* License along with this library; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
|
*/
|
||||||
|
|
||||||
#include <regedit.h>
|
#include <regedit.h>
|
||||||
void ErrorMessageBox(HWND hWnd, LPCTSTR title, DWORD code)
|
|
||||||
|
int ErrorMessageBox(HWND hWnd, LPCTSTR lpTitle, DWORD dwErrorCode, ...)
|
||||||
{
|
{
|
||||||
LPTSTR lpMsgBuf;
|
int iRet = 0;
|
||||||
DWORD status;
|
LPTSTR lpMsgBuf = NULL;
|
||||||
static const TCHAR fallback[] = TEXT("Error displaying error message.\n");
|
DWORD Status = 0;
|
||||||
status = FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM,
|
|
||||||
NULL, code, 0, (LPTSTR)&lpMsgBuf, 0, NULL);
|
va_list args = NULL;
|
||||||
if (!status)
|
va_start(args, dwErrorCode);
|
||||||
lpMsgBuf = (LPTSTR)fallback;
|
|
||||||
MessageBox(hWnd, lpMsgBuf, title, MB_OK | MB_ICONERROR);
|
Status = FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM,
|
||||||
if (lpMsgBuf != fallback)
|
NULL,
|
||||||
LocalFree(lpMsgBuf);
|
dwErrorCode,
|
||||||
|
MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
|
||||||
|
(LPTSTR)&lpMsgBuf,
|
||||||
|
0,
|
||||||
|
&args);
|
||||||
|
|
||||||
|
va_end(args);
|
||||||
|
|
||||||
|
iRet = MessageBox(hWnd, (Status && lpMsgBuf ? lpMsgBuf : TEXT("Error displaying error message.\n")), lpTitle, MB_OK | MB_ICONERROR);
|
||||||
|
|
||||||
|
if (lpMsgBuf) LocalFree(lpMsgBuf);
|
||||||
|
|
||||||
|
/* Return the MessageBox information */
|
||||||
|
return iRet;
|
||||||
|
}
|
||||||
|
|
||||||
|
int InfoMessageBox(HWND hWnd, UINT uType, LPCTSTR lpTitle, LPCTSTR lpMessage, ...)
|
||||||
|
{
|
||||||
|
int iRet = 0;
|
||||||
|
LPTSTR lpMsgBuf = NULL;
|
||||||
|
DWORD Status = 0;
|
||||||
|
|
||||||
|
va_list args = NULL;
|
||||||
|
va_start(args, lpMessage);
|
||||||
|
|
||||||
|
Status = FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_STRING,
|
||||||
|
lpMessage,
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
(LPTSTR)&lpMsgBuf,
|
||||||
|
0,
|
||||||
|
&args);
|
||||||
|
|
||||||
|
va_end(args);
|
||||||
|
|
||||||
|
iRet = MessageBox(hWnd, (Status && lpMsgBuf ? lpMsgBuf : TEXT("Error displaying error message.\n")), lpTitle, uType);
|
||||||
|
|
||||||
|
if (lpMsgBuf) LocalFree(lpMsgBuf);
|
||||||
|
|
||||||
|
/* Return the MessageBox information */
|
||||||
|
return iRet;
|
||||||
}
|
}
|
||||||
|
|
|
@ -94,7 +94,8 @@ extern void ResizeWnd(int cx, int cy);
|
||||||
extern LPCTSTR get_root_key_name(HKEY hRootKey);
|
extern LPCTSTR get_root_key_name(HKEY hRootKey);
|
||||||
|
|
||||||
/* error.c */
|
/* error.c */
|
||||||
extern void ErrorMessageBox(HWND hWnd, LPCTSTR title, DWORD code);
|
extern int ErrorMessageBox(HWND hWnd, LPCTSTR lpTitle, DWORD dwErrorCode, ...);
|
||||||
|
extern int InfoMessageBox(HWND hWnd, UINT uType, LPCTSTR lpTitle, LPCTSTR lpMessage, ...);
|
||||||
|
|
||||||
/* find.c */
|
/* find.c */
|
||||||
extern void FindDialog(HWND hWnd);
|
extern void FindDialog(HWND hWnd);
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
/*
|
/*
|
||||||
* Windows regedit.exe registry editor implementation.
|
* Windows regedit.exe registry editor implementation.
|
||||||
*
|
*
|
||||||
* Copyright 2002 Andriy Palamarchuk
|
* Copyright (C) 2002 Andriy Palamarchuk
|
||||||
*
|
*
|
||||||
* This library is free software; you can redistribute it and/or
|
* This library is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU Lesser General Public
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
|
@ -258,11 +258,12 @@ BOOL ProcessCmdLine(LPWSTR lpCmdLine)
|
||||||
{
|
{
|
||||||
if (chu == L'S')
|
if (chu == L'S')
|
||||||
{
|
{
|
||||||
|
/* Silence dialogs */
|
||||||
silent = TRUE;
|
silent = TRUE;
|
||||||
}
|
}
|
||||||
else if (chu == L'V')
|
else if (chu == L'V')
|
||||||
{
|
{
|
||||||
/* ignore these switches */
|
/* Ignore this switch */
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -323,14 +324,21 @@ BOOL ProcessCmdLine(LPWSTR lpCmdLine)
|
||||||
|
|
||||||
if (*s && action == ACTION_UNDEF)
|
if (*s && action == ACTION_UNDEF)
|
||||||
{
|
{
|
||||||
TCHAR szTitle[256], szText[256];
|
if (!silent)
|
||||||
LoadString(hInst, IDS_APP_TITLE, szTitle, COUNT_OF(szTitle));
|
{
|
||||||
LoadString(hInst, IDS_IMPORT_PROMPT, szText, COUNT_OF(szText));
|
TCHAR szTitle[256], szText[256];
|
||||||
/* request import confirmation */
|
LoadString(hInst, IDS_APP_TITLE, szTitle, COUNT_OF(szTitle));
|
||||||
if (silent || MessageBox(NULL, szText, szTitle, MB_YESNO) == IDYES)
|
LoadString(hInst, IDS_IMPORT_PROMPT, szText, COUNT_OF(szText));
|
||||||
action = ACTION_ADD;
|
/* request import confirmation */
|
||||||
|
if (MessageBox(NULL, szText, szTitle, MB_YESNO) == IDYES)
|
||||||
|
action = ACTION_ADD;
|
||||||
|
else
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
else
|
else
|
||||||
return TRUE;
|
{
|
||||||
|
action = ACTION_ADD;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (action == ACTION_UNDEF)
|
if (action == ACTION_UNDEF)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
|
@ -2,9 +2,9 @@
|
||||||
* Registry processing routines. Routines, common for registry
|
* Registry processing routines. Routines, common for registry
|
||||||
* processing frontends.
|
* processing frontends.
|
||||||
*
|
*
|
||||||
* Copyright 1999 Sylvain St-Germain
|
* Copyright (C) 1999 Sylvain St-Germain
|
||||||
* Copyright 2002 Andriy Palamarchuk
|
* Copyright (C) 2002 Andriy Palamarchuk
|
||||||
* Copyright 2008 Alexander N. S?rnes <alex@thehandofagony.com>
|
* Copyright (C) 2008 Alexander N. Sørnes <alex@thehandofagony.com>
|
||||||
*
|
*
|
||||||
* This library is free software; you can redistribute it and/or
|
* This library is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU Lesser General Public
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
|
|
|
@ -1,23 +1,23 @@
|
||||||
/*
|
/*
|
||||||
* regedit (settings.c)
|
* Regedit settings
|
||||||
*
|
*
|
||||||
* Copyright 2012 Edijs Kolesnikovics <terminedijs@yahoo.com>
|
* Copyright (C) 2012 Edijs Kolesnikovics <terminedijs@yahoo.com>
|
||||||
* Copyright 2012 Grégori Macário Harbs <mysoft64bits at gmail dot com>
|
* Copyright (C) 2012 Grégori Macário Harbs <mysoft64bits at gmail dot com>
|
||||||
*
|
*
|
||||||
* This library is free software; you can redistribute it and/or
|
* This library is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU Lesser General Public
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
* License as published by the Free Software Foundation; either
|
* License as published by the Free Software Foundation; either
|
||||||
* version 2.1 of the License, or (at your option) any later version.
|
* version 2.1 of the License, or (at your option) any later version.
|
||||||
*
|
*
|
||||||
* This library is distributed in the hope that it will be useful,
|
* This library is distributed in the hope that it will be useful,
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
* Lesser General Public License for more details.
|
* Lesser General Public License for more details.
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU Lesser General Public
|
* You should have received a copy of the GNU Lesser General Public
|
||||||
* License along with this library; if not, write to the Free Software
|
* License along with this library; if not, write to the Free Software
|
||||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <regedit.h>
|
#include <regedit.h>
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue