From 2885d40937f9e7dea63c25263fa56a2e3ce472a7 Mon Sep 17 00:00:00 2001 From: Whindmar Saksit Date: Thu, 9 Jul 2026 23:35:05 +0200 Subject: [PATCH] [SYSSETUP] Unattended ComputerName=* means random name (#9267) Windows supports[^1] using * as "automatic" for some entries. Let's support it as well. [^1]: https://web.archive.org/web/20070506023846/http://www.microsoft.com/technet/prodtechnol/Windows2000Pro/deploy/unattend/sp1ch01.mspx --- dll/win32/syssetup/wizard.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/dll/win32/syssetup/wizard.c b/dll/win32/syssetup/wizard.c index 600f00645f8..d9d01da88a1 100644 --- a/dll/win32/syssetup/wizard.c +++ b/dll/win32/syssetup/wizard.c @@ -8,6 +8,7 @@ * Ismael Ferreras Morezuelas * Katayama Hirofumi MZ * Oleg Dubinskiy + * Whindmar Saksit */ /* INCLUDES *****************************************************************/ @@ -1160,9 +1161,13 @@ ComputerPageDlgProc(HWND hwndDlg, SetFocus(GetDlgItem(hwndDlg, IDC_COMPUTERNAME)); if (pSetupData->UnattendSetup) { - SendMessage(GetDlgItem(hwndDlg, IDC_COMPUTERNAME), WM_SETTEXT, 0, (LPARAM)pSetupData->ComputerName); - SendMessage(GetDlgItem(hwndDlg, IDC_ADMINPASSWORD1), WM_SETTEXT, 0, (LPARAM)pSetupData->AdminPassword); - SendMessage(GetDlgItem(hwndDlg, IDC_ADMINPASSWORD2), WM_SETTEXT, 0, (LPARAM)pSetupData->AdminPassword); + /* "*" means use random name (we have already generated it above) */ + if (pSetupData->ComputerName[0] == L'*' && !pSetupData->ComputerName[1]) + wcscpy(pSetupData->ComputerName, ComputerName); + else + SetDlgItemTextW(hwndDlg, IDC_COMPUTERNAME, pSetupData->ComputerName); + SetDlgItemTextW(hwndDlg, IDC_ADMINPASSWORD1, pSetupData->AdminPassword); + SetDlgItemTextW(hwndDlg, IDC_ADMINPASSWORD2, pSetupData->AdminPassword); WriteComputerSettings(pSetupData->ComputerName, NULL); SetAdministratorPassword(pSetupData->AdminPassword); }