Author: ekohl
Date: Sun May 18 09:59:44 2008
New Revision: 33579
URL:
http://svn.reactos.org/svn/reactos?rev=33579&view=rev
Log:
- Rename CheckUserName() to CheckAccountName() and move it to a new source file (misc.c).
- Also use CheckAccountName() to check group names for illegal characters.
Added:
trunk/reactos/dll/cpl/usrmgr/misc.c (with props)
Modified:
trunk/reactos/dll/cpl/usrmgr/groups.c
trunk/reactos/dll/cpl/usrmgr/users.c
trunk/reactos/dll/cpl/usrmgr/usrmgr.h
trunk/reactos/dll/cpl/usrmgr/usrmgr.rbuild
Modified: trunk/reactos/dll/cpl/usrmgr/groups.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/cpl/usrmgr/groups.c?re…
==============================================================================
--- trunk/reactos/dll/cpl/usrmgr/groups.c [iso-8859-1] (original)
+++ trunk/reactos/dll/cpl/usrmgr/groups.c [iso-8859-1] Sun May 18 09:59:44 2008
@@ -122,6 +122,12 @@
break;
case IDOK:
+ if (!CheckAccountName(hwndDlg, IDC_GROUP_NEW_NAME, NULL))
+ {
+ SetFocus(GetDlgItem(hwndDlg, IDC_GROUP_NEW_NAME));
+ SendDlgItemMessage(hwndDlg, IDC_GROUP_NEW_NAME, EM_SETSEL, 0,
-1);
+ break;
+ }
nLength = SendDlgItemMessage(hwndDlg, IDC_GROUP_NEW_NAME,
WM_GETTEXTLENGTH, 0, 0);
if (nLength > 0)
@@ -338,6 +344,9 @@
if (lstrcmp(szOldGroupName, szNewGroupName) == 0)
return FALSE;
+ /* Check the group name for illegal characters */
+ if (!CheckAccountName(NULL, 0, szNewGroupName))
+ return FALSE;
/* Change the user name */
lgrpi0.lgrpi0_name = szNewGroupName;
Added: trunk/reactos/dll/cpl/usrmgr/misc.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/cpl/usrmgr/misc.c?rev=…
==============================================================================
--- trunk/reactos/dll/cpl/usrmgr/misc.c (added)
+++ trunk/reactos/dll/cpl/usrmgr/misc.c [iso-8859-1] Sun May 18 09:59:44 2008
@@ -1,0 +1,38 @@
+/*
+ * COPYRIGHT: See COPYING in the top level directory
+ * PROJECT: ReactOS User Manager Control Panel
+ * FILE: dll/cpl/usrmgr/misc.c
+ * PURPOSE: Miscellaneus functions
+ *
+ * PROGRAMMERS: Eric Kohl
+ */
+
+#include "usrmgr.h"
+
+
+BOOL
+CheckAccountName(HWND hwndDlg,
+ INT nIdDlgItem,
+ LPTSTR lpAccountName)
+{
+ TCHAR szAccountName[256];
+ UINT uLen;
+
+ if (lpAccountName)
+ uLen = _tcslen(lpAccountName);
+ else
+ uLen = GetDlgItemText(hwndDlg, nIdDlgItem, szAccountName, 256);
+
+ /* Check the account name */
+ if (uLen > 0 &&
+ _tcspbrk((lpAccountName) ? lpAccountName : szAccountName,
TEXT("\"*+,/\\:;<=>?[]|")) != NULL)
+ {
+ MessageBox(hwndDlg,
+ TEXT("The account name you entered is invalid! An account name
must not contain the following charecters: *+,/:;<=>?[\\]|"),
+ TEXT("ERROR"),
+ MB_OK | MB_ICONERROR);
+ return FALSE;
+ }
+
+ return TRUE;
+}
Propchange: trunk/reactos/dll/cpl/usrmgr/misc.c
------------------------------------------------------------------------------
svn:eol-style = native
Modified: trunk/reactos/dll/cpl/usrmgr/users.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/cpl/usrmgr/users.c?rev…
==============================================================================
--- trunk/reactos/dll/cpl/usrmgr/users.c [iso-8859-1] (original)
+++ trunk/reactos/dll/cpl/usrmgr/users.c [iso-8859-1] Sun May 18 09:59:44 2008
@@ -56,36 +56,6 @@
}
-static BOOL
-CheckUserName(HWND hwndDlg,
- INT nIdDlgItem,
- LPTSTR lpUserName)
-{
- TCHAR szUserName[256];
- UINT uLen;
-
- if (lpUserName)
- uLen = _tcslen(lpUserName);
- else
- uLen = GetDlgItemText(hwndDlg, nIdDlgItem, szUserName, 256);
-
- /* Check the user name */
- if (uLen > 0 &&
- _tcspbrk((lpUserName) ? lpUserName : szUserName,
TEXT("\"*+,/\\:;<=>?[]|")) != NULL)
- {
- MessageBox(hwndDlg,
- TEXT("The user name you entered is invalid! A user name must not
contain the following charecters: *+,/:;<=>?[\\]|"),
- TEXT("ERROR"),
- MB_OK | MB_ICONERROR);
- return FALSE;
- }
-
-
- return TRUE;
-}
-
-
-
INT_PTR CALLBACK
ChangePasswordDlgProc(HWND hwndDlg,
UINT uMsg,
@@ -204,7 +174,7 @@
break;
case IDOK:
- if (!CheckUserName(hwndDlg, IDC_USER_NEW_NAME, NULL))
+ if (!CheckAccountName(hwndDlg, IDC_USER_NEW_NAME, NULL))
{
SetFocus(GetDlgItem(hwndDlg, IDC_USER_NEW_NAME));
SendDlgItemMessage(hwndDlg, IDC_USER_NEW_NAME, EM_SETSEL, 0,
-1);
@@ -554,7 +524,7 @@
return FALSE;
/* Check the user name for illegal characters */
- if (!CheckUserName(NULL, 0, szNewUserName))
+ if (!CheckAccountName(NULL, 0, szNewUserName))
return FALSE;
/* Change the user name */
Modified: trunk/reactos/dll/cpl/usrmgr/usrmgr.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/cpl/usrmgr/usrmgr.h?re…
==============================================================================
--- trunk/reactos/dll/cpl/usrmgr/usrmgr.h [iso-8859-1] (original)
+++ trunk/reactos/dll/cpl/usrmgr/usrmgr.h [iso-8859-1] Sun May 18 09:59:44 2008
@@ -29,6 +29,11 @@
INT_PTR CALLBACK GroupsPageProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam);
INT_PTR CALLBACK ExtraPageProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam);
+/* misc.c */
+BOOL
+CheckAccountName(HWND hwndDlg,
+ INT nIdDlgItem,
+ LPTSTR lpAccountName);
#endif /* __CPL_DESK_H__ */
Modified: trunk/reactos/dll/cpl/usrmgr/usrmgr.rbuild
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/cpl/usrmgr/usrmgr.rbui…
==============================================================================
--- trunk/reactos/dll/cpl/usrmgr/usrmgr.rbuild [iso-8859-1] (original)
+++ trunk/reactos/dll/cpl/usrmgr/usrmgr.rbuild [iso-8859-1] Sun May 18 09:59:44 2008
@@ -15,6 +15,7 @@
<library>msvcrt</library>
<file>extra.c</file>
<file>groups.c</file>
+ <file>misc.c</file>
<file>users.c</file>
<file>usrmgr.c</file>
<file>usrmgr.rc</file>