xref: /reactos/dll/cpl/usrmgr/misc.c (revision 40462c92)
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 VOID
13 DebugPrintf(LPTSTR szFormat, ...)
14 {
15     TCHAR szOut[512];
16     va_list arg_ptr;
17 
18 
19     va_start (arg_ptr, szFormat);
20     _vstprintf (szOut, szFormat, arg_ptr);
21     va_end (arg_ptr);
22 
23     MessageBox(NULL, szOut, _T("Debug"), MB_OK);
24 }
25 
26 BOOL
27 CheckAccountName(HWND hwndDlg,
28                  INT nIdDlgItem,
29                  LPTSTR lpAccountName)
30 {
31     TCHAR szAccountName[256];
32     UINT uLen;
33 
34     if (lpAccountName)
35         uLen = _tcslen(lpAccountName);
36     else
37         uLen = GetDlgItemText(hwndDlg, nIdDlgItem, szAccountName, 256);
38 
39     /* Check the account name */
40     if (uLen > 0 &&
41         _tcspbrk((lpAccountName) ? lpAccountName : szAccountName, TEXT("\"*+,/\\:;<=>?[]|")) != NULL)
42     {
43         MessageBox(hwndDlg,
44                    TEXT("The account name you entered is invalid! An account name must not contain the following characters: *+,/:;<=>?[\\]|"),
45                    TEXT("ERROR"),
46                    MB_OK | MB_ICONERROR);
47         return FALSE;
48     }
49 
50     return TRUE;
51 }
52