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