[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
This commit is contained in:
Whindmar Saksit
2026-07-09 23:35:05 +02:00
committed by GitHub
parent 8b5e6383f2
commit 2885d40937
+8 -3
View File
@@ -8,6 +8,7 @@
* Ismael Ferreras Morezuelas <[email protected]>
* Katayama Hirofumi MZ <[email protected]>
* Oleg Dubinskiy <[email protected]>
* Whindmar Saksit <[email protected]>
*/
/* 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);
}