xref: /reactos/dll/cpl/usrmgr/misc.c (revision e944dfa7)
1 /*
2  * COPYRIGHT:       See COPYING in the top level directory
3  * PROJECT:         ReactOS User Manager Control Panel
4  * FILE:            dll/cpl/usrmgr/misc.c
5  * PURPOSE:         Miscellaneous functions
6  *
7  * PROGRAMMERS:     Eric Kohl
8  */
9 
10 #include "usrmgr.h"
11 
12 BOOL
13 CheckAccountName(HWND hwndDlg,
14                  INT nIdDlgItem,
15                  LPTSTR lpAccountName)
16 {
17     TCHAR szAccountName[256];
18     UINT uLen;
19 
20     if (lpAccountName)
21         uLen = _tcslen(lpAccountName);
22     else
23         uLen = GetDlgItemText(hwndDlg, nIdDlgItem, szAccountName, 256);
24 
25     /* Check the account name */
26     if (uLen > 0 &&
27         _tcspbrk((lpAccountName) ? lpAccountName : szAccountName, TEXT("\"*+,/\\:;<=>?[]|")) != NULL)
28     {
29         MessageBox(hwndDlg,
30                    TEXT("The account name you entered is invalid! An account name must not contain the following characters: *+,/:;<=>?[\\]|"),
31                    TEXT("ERROR"),
32                    MB_OK | MB_ICONERROR);
33         return FALSE;
34     }
35 
36     return TRUE;
37 }
38