mirror of
https://github.com/reactos/reactos.git
synced 2025-08-05 20:23:34 +00:00
[SYSSETUP]
* Generate random computer name (REACTOS-xxxxxxx) in Setup. Patch by David Quintana <gigaherz at gmail dot com> modified by me See issue #6099 for more details. svn path=/trunk/; revision=51358
This commit is contained in:
parent
46a8c8f9fa
commit
66a33a5246
1 changed files with 21 additions and 4 deletions
|
@ -564,6 +564,25 @@ WriteComputerSettings(WCHAR * ComputerName, HWND hwndDlg)
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* lpBuffer will be filled with a 15-char string (plus the null terminator) */
|
||||||
|
static void
|
||||||
|
GenerateComputerName(LPWSTR lpBuffer)
|
||||||
|
{
|
||||||
|
static const WCHAR Chars[] = L"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ";
|
||||||
|
static const unsigned cChars = sizeof(Chars) / sizeof(WCHAR) - 1;
|
||||||
|
unsigned i;
|
||||||
|
|
||||||
|
wcscpy(lpBuffer, L"REACTOS-");
|
||||||
|
|
||||||
|
srand(GetTickCount());
|
||||||
|
|
||||||
|
/* fill in 7 characters */
|
||||||
|
for (i = 8; i < 15; i++)
|
||||||
|
lpBuffer[i] = Chars[rand() % cChars];
|
||||||
|
|
||||||
|
lpBuffer[15] = UNICODE_NULL; /* NULL-terminate */
|
||||||
|
}
|
||||||
|
|
||||||
static INT_PTR CALLBACK
|
static INT_PTR CALLBACK
|
||||||
ComputerPageDlgProc(HWND hwndDlg,
|
ComputerPageDlgProc(HWND hwndDlg,
|
||||||
UINT uMsg,
|
UINT uMsg,
|
||||||
|
@ -576,7 +595,6 @@ ComputerPageDlgProc(HWND hwndDlg,
|
||||||
PWCHAR Password;
|
PWCHAR Password;
|
||||||
WCHAR Title[64];
|
WCHAR Title[64];
|
||||||
WCHAR EmptyComputerName[256], NotMatchPassword[256], WrongPassword[256];
|
WCHAR EmptyComputerName[256], NotMatchPassword[256], WrongPassword[256];
|
||||||
DWORD Length;
|
|
||||||
LPNMHDR lpnm;
|
LPNMHDR lpnm;
|
||||||
|
|
||||||
if (0 == LoadStringW(hDllInstance, IDS_REACTOS_SETUP, Title, sizeof(Title) / sizeof(Title[0])))
|
if (0 == LoadStringW(hDllInstance, IDS_REACTOS_SETUP, Title, sizeof(Title) / sizeof(Title[0])))
|
||||||
|
@ -588,9 +606,8 @@ ComputerPageDlgProc(HWND hwndDlg,
|
||||||
{
|
{
|
||||||
case WM_INITDIALOG:
|
case WM_INITDIALOG:
|
||||||
{
|
{
|
||||||
/* Retrieve current computer name */
|
/* Generate a new pseudo-random computer name */
|
||||||
Length = MAX_COMPUTERNAME_LENGTH + 1;
|
GenerateComputerName(ComputerName);
|
||||||
GetComputerNameW(ComputerName, &Length);
|
|
||||||
|
|
||||||
/* Display current computer name */
|
/* Display current computer name */
|
||||||
SetDlgItemTextW(hwndDlg, IDC_COMPUTERNAME, ComputerName);
|
SetDlgItemTextW(hwndDlg, IDC_COMPUTERNAME, ComputerName);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue