- Partially implement "Computer Name Changes" dialog. Computer name can be changed now.

See issue #3304 for more details.

svn path=/trunk/; revision=43052
This commit is contained in:
Dmitry Chapyshev 2009-09-15 13:45:34 +00:00
parent d794889e14
commit b8395bbb78
16 changed files with 254 additions and 5 deletions

View file

@ -67,8 +67,11 @@ BEGIN
22 "Добре дошли в работна група %1."
23 "Добре дошли в имение %1."
24 "Трябва да презапуснете компютъра, за да влязат промените в действие."
25 "You can change the name and the membership of this computer. Changes may affect access to network resources."
1021 "Забележка: Само управниците могат да променят опознавателите на компютъра."
1022 "Забележка: Опознавателят на компютъра не може да бъде сменен, защото:"
3210 "&По&дробности >>"
3220 "<< &По&дробности"
4000 "Information"
4001 "Can't set new a computer name!"
END

View file

@ -73,8 +73,11 @@ BEGIN
22 "Vítejte v pracovní skupině %1."
23 "Vítejte v doméně %1."
24 "Aby se změny mohly projevit, musí být počítač restartován."
25 "You can change the name and the membership of this computer. Changes may affect access to network resources."
1021 "Poznámka: Identifikaci tohoto počítače mohou změnit pouze administrátoři."
1022 "Poznámka: Identifikace počítače nemůže být změněna z následujících důvodů:"
3210 "&Detaily >>"
3220 "<< &Detaily"
4000 "Information"
4001 "Can't set new a computer name!"
END

View file

@ -75,8 +75,11 @@ BEGIN
22 "Willkommen in der Arbeitsgruppe %1"
23 "Willkommen in der Domäne %1"
24 "Sie müssen den Computer neustarten, damit die Änderungen wirksam werden."
25 "You can change the name and the membership of this computer. Changes may affect access to network resources."
1021 "Hinweis: Nur Administratoren können die Identifikation des Computers ändern."
1022 "Hinweis: Die Identifikation des Computers kann aus folgendem Grund nicht geändert werden:"
3210 "&Details >>"
3220 "<< &Details"
4000 "Information"
4001 "Can't set new a computer name!"
END

View file

@ -67,8 +67,11 @@ BEGIN
22 "Welcome to the %1 workgroup."
23 "Welcome to the %1 domain."
24 "You must restart this computer for the changes to take effect."
25 "You can change the name and the membership of this computer. Changes may affect access to network resources."
1021 "Note: Only Administrators can change the identification of this computer."
1022 "Note: The identification of the computer cannot be changed because:"
3210 "&Details >>"
3220 "<< &Details"
4000 "Information"
4001 "Can't set new a computer name!"
END

View file

@ -67,8 +67,11 @@ BEGIN
22 "Welcome to the %1 workgroup."
23 "Welcome to the %1 domain."
24 "You must restart this computer for the changes to take effect."
25 "You can change the name and the membership of this computer. Changes may affect access to network resources."
1021 "Note: Only Administrators can change the identification of this computer."
1022 "Note: The identification of the computer cannot be changed because:"
3210 "&Details >>"
3220 "<< &Details"
4000 "Information"
4001 "Can't set new a computer name!"
END

View file

@ -72,8 +72,11 @@ BEGIN
22 "Bienvenido al grupo de trabajo %1."
23 "Bienvenido al dominio %1."
24 "Debe reiniciar el equipo para que los cambios tengan efecto."
25 "You can change the name and the membership of this computer. Changes may affect access to network resources."
1021 "Nota: Sólo los Administradores pueden cambiar la identificación de este equipo."
1022 "Nota: La identificación de este equipo no puede ser cambiada porque:"
3210 "&Detalles >>"
3220 "<< &Detalles"
4000 "Information"
4001 "Can't set new a computer name!"
END

View file

@ -67,8 +67,11 @@ BEGIN
22 "Bienvenue dans le groupe de travail %1."
23 "Bienvenue dans le domaine %1."
24 "Vous devez redémarrer votre ordinateur pour que les changements soient pris en compte."
25 "You can change the name and the membership of this computer. Changes may affect access to network resources."
1021 "Note : Seuls les administrateurs peuvent modifier l'identification de cet ordinateur."
1022 "Note : L'identification de l'ordinateur ne peut pas être modifiée car :"
3210 "&Détails >>"
3220 "<< &Détails"
4000 "Information"
4001 "Can't set new a computer name!"
END

View file

@ -67,8 +67,11 @@ BEGIN
22 "Welcome to the %1 workgroup."
23 "Welcome to the %1 domain."
24 "You must restart this computer for the changes to take effect."
25 "You can change the name and the membership of this computer. Changes may affect access to network resources."
1021 "Note: Only Administrators can change the identification of this computer."
1022 "Note: The identification of the computer cannot be changed because:"
3210 "&Details >>"
3220 "<< &Details"
4000 "Information"
4001 "Can't set new a computer name!"
END

View file

@ -68,8 +68,11 @@ BEGIN
22 "Benvenuto al gruppo di lavoro %1."
23 "Benvenuto al dominio %1."
24 "Il computer deve essre riavviato per rendere operative queste modifiche."
25 "You can change the name and the membership of this computer. Changes may affect access to network resources."
1021 "Nota: Solo gli Amministratori possono cambiare l'identificazione di questo computer."
1022 "Nota: L'identificazione di questo computer non può essere cambiata perchè:"
3210 "&Dettagli >>"
3220 "<< &Dettagli"
4000 "Information"
4001 "Can't set new a computer name!"
END

View file

@ -67,8 +67,11 @@ BEGIN
22 "Welkom bij de werkgoep %1."
23 "Welkom bij het domein %1."
24 "U moet de computer herstarten om de wijzigingen van kracht te laten gaan."
25 "You can change the name and the membership of this computer. Changes may affect access to network resources."
1021 "Let op: Alleen Administrators mogen de indentificatie van deze computer aanpassen."
1022 "Let op: De indentificatie van deze computer kan niet gewijzigd worden omdat:"
3210 "&Details >>"
3220 "<< &Details"
4000 "Information"
4001 "Can't set new a computer name!"
END

View file

@ -67,8 +67,11 @@ BEGIN
22 "Velkommen til %1 arbeidsgruppen."
23 "Velkommen til %1 domene."
24 "Du må starte denne datamaskinen på nytt for at endringene skal tre i kraft."
25 "You can change the name and the membership of this computer. Changes may affect access to network resources."
1021 "OBS: Bare administratorer kan endre identifisering for denne datamaskinen."
1022 "OBS: Identifisering for datamaskinen kunne ikke endres fordi:"
3210 "&Detaljer >>"
3220 "<< &Detaljer"
4000 "Information"
4001 "Can't set new a computer name!"
END

View file

@ -75,8 +75,11 @@ BEGIN
22 "Witamy w grupie roboczej %1."
23 "Witamy w domenie %1."
24 "Musisz zrestartować komputer aby zmiany odniosły skutek."
25 "You can change the name and the membership of this computer. Changes may affect access to network resources."
1021 "Uwaga: Tylko Administratorzy mogš zmieniać identyfikator tego komputera."
1022 "Uwaga: Identyfikator tego komputera nie został zmieniony, powód:"
3210 "&Szczegóły >>"
3220 "<< &Szczegóły"
4000 "Information"
4001 "Can't set new a computer name!"
END

View file

@ -67,8 +67,11 @@ BEGIN
22 "Добро пожаловать в рабочую группу %1."
23 "Добро пожаловать в домен %1."
24 "Необходимо перезапустить компьютер для того, чтобы эти изменения вступили в силу."
25 "Можно изменить имя и принадлежность этого компьютера. Изменения могут повлиять на доступ к сетевым ресурсам."
1021 "Примечание: только администраторы могут изменить идентификацию этого компьютера."
1022 "Примечание: идентификация этого компьютера не может быть изменена, потому что:"
3210 "&Подробно >>"
3220 "<< &Подробно"
4000 "Информация"
4001 "Не удалось установить новое имя компьютера!"
END

View file

@ -74,8 +74,11 @@ BEGIN
22 "Vitajte v pracovnej skupine %1."
23 "Vitajte v doméne %1."
24 "Aby sa prejavili vykonané zmeny, musíte reštartovať počítač."
25 "You can change the name and the membership of this computer. Changes may affect access to network resources."
1021 "Poznámka: Iba správcovia môžu zmeniť identifikáciu tohto počítača."
1022 "Poznámka: Identifikácia počítača nemôže byť zmenená, lebo:"
3210 "&Podrobnosti >>"
3220 "<< &Podrobnosti"
4000 "Information"
4001 "Can't set new a computer name!"
END

View file

@ -75,8 +75,11 @@ BEGIN
22 "Вас вітає робоча група %1."
23 "Вас вітає домен %1."
24 "Слід перезапустити комп'ютер, щоб ці зміни набрали сили."
25 "You can change the name and the membership of this computer. Changes may affect access to network resources."
1021 "Примітка: змінити ідентифікацію цього комп'ютера можуть лише адміністратори."
1022 "Примітка: змінити ідентифікацію цього комп'ютера неможливо, оскільки:"
3210 "&Подробиці >>"
3220 "<< &Подробиці"
4000 "Information"
4001 "Can't set new a computer name!"
END

View file

@ -3,17 +3,211 @@
* LICENSE: GPL - See COPYING in the top level directory
* FILE: dll/win32/netid/netid.c
* PURPOSE: Network ID Page
* COPYRIGHT: Copyright Thomas Weidenmueller <w3seek@reactos.org>
* COPYRIGHT: Thomas Weidenmueller <w3seek@reactos.org>
* Dmitry Chapyshev <dmitry@reactos.org>
*
*/
#include <windows.h>
#include <tchar.h>
#include <lm.h>
#include <prsht.h>
#include "resource.h"
static HINSTANCE hDllInstance;
static
INT_PTR CALLBACK
DNSSuffixPropDlgProc(HWND hDlg, UINT Msg, WPARAM wParam, LPARAM lParam)
{
switch (Msg)
{
case WM_COMMAND:
{
switch (LOWORD(wParam))
{
case IDCANCEL:
case IDOK:
EndDialog(hDlg, LOWORD(wParam));
break;
}
}
break;
}
return FALSE;
}
static VOID
SetRadioBtnState(HWND hDlg, BOOL IsDomain)
{
SendDlgItemMessage(hDlg, 1008, BM_SETCHECK, (WPARAM)IsDomain, 0);
SendDlgItemMessage(hDlg, 1004, BM_SETCHECK, (WPARAM)!IsDomain, 0);
EnableWindow(GetDlgItem(hDlg, 116), IsDomain);
EnableWindow(GetDlgItem(hDlg, 1007), !IsDomain);
}
static VOID
DisableControls(HWND hDlg)
{
EnableWindow(GetDlgItem(hDlg, 1008), FALSE);
EnableWindow(GetDlgItem(hDlg, 1004), FALSE);
EnableWindow(GetDlgItem(hDlg, 116), FALSE);
EnableWindow(GetDlgItem(hDlg, 1007), FALSE);
}
static
INT_PTR CALLBACK
NetworkPropDlgProc(HWND hDlg, UINT Msg, WPARAM wParam, LPARAM lParam)
{
switch (Msg)
{
case WM_INITDIALOG:
{
LPWKSTA_INFO_101 wki = NULL;
DWORD Size = MAX_COMPUTERNAME_LENGTH + 1;
TCHAR ComputerName[MAX_COMPUTERNAME_LENGTH + 1];
TCHAR MsgText[MAX_PATH * 2];
LPWSTR JoinName;
NETSETUP_JOIN_STATUS JoinStatus;
if (LoadString(hDllInstance, 25, MsgText, sizeof(MsgText) / sizeof(TCHAR)))
SetDlgItemText(hDlg, 1017, MsgText);
if (GetComputerName(ComputerName, &Size))
{
SetDlgItemText(hDlg, 1002, ComputerName);
SetDlgItemText(hDlg, 1001, ComputerName);
}
if (NetGetJoinInformation(NULL, &JoinName, &JoinStatus) != NERR_Success)
{
SetRadioBtnState(hDlg, FALSE);
if (NetWkstaGetInfo(NULL,
101,
(LPBYTE*)&wki) == NERR_Success)
{
SetDlgItemText(hDlg,
1007,
wki->wki101_langroup);
}
else DisableControls(hDlg);
if (wki) NetApiBufferFree(wki);
}
else
{
switch (JoinStatus)
{
case NetSetupDomainName:
SetDlgItemText(hDlg, 116, JoinName);
SetRadioBtnState(hDlg, TRUE);
break;
case NetSetupWorkgroupName:
SetDlgItemText(hDlg, 1007, JoinName);
SetRadioBtnState(hDlg, FALSE);
break;
case NetSetupUnjoined:
break;
case NetSetupUnknownStatus:
default:
{
SetRadioBtnState(hDlg, FALSE);
if (NetWkstaGetInfo(NULL,
101,
(LPBYTE*)&wki) == NERR_Success)
{
SetDlgItemText(hDlg,
1007,
wki->wki101_langroup);
}
else DisableControls(hDlg);
if (wki) NetApiBufferFree(wki);
break;
}
}
if (JoinName) NetApiBufferFree(JoinName);
}
}
break;
case WM_COMMAND:
{
switch (LOWORD(wParam))
{
case 1008: /* Domain radio button */
case 1004: /* Workgroup radio button */
if (SendDlgItemMessage(hDlg, 1008, BM_GETCHECK, 0, 0) == BST_CHECKED)
SetRadioBtnState(hDlg, TRUE);
else
SetRadioBtnState(hDlg, FALSE);
break;
case 1003:
DialogBox(hDllInstance,
MAKEINTRESOURCE(IDD_PROPPAGEDNSANDNETBIOS),
hDlg,
DNSSuffixPropDlgProc);
break;
case IDOK:
{
DWORD Size = MAX_COMPUTERNAME_LENGTH + 1;
TCHAR ComputerName[MAX_COMPUTERNAME_LENGTH + 1];
TCHAR NewComputerName[MAX_COMPUTERNAME_LENGTH + 1];
if (GetComputerName(ComputerName, &Size))
{
if (GetWindowText(GetDlgItem(hDlg, 1002),
NewComputerName,
(MAX_COMPUTERNAME_LENGTH + 1)))
{
if (_tcscmp(ComputerName, NewComputerName) != 0)
{
if (!SetComputerName(NewComputerName))
{
TCHAR szMsgText[MAX_PATH];
LoadString(hDllInstance, 4001, szMsgText, sizeof(szMsgText) / sizeof(TCHAR));
MessageBox(0, szMsgText, NULL, MB_OK | MB_ICONERROR);
}
else
{
TCHAR szMsgTitle[MAX_PATH], szMsgText[MAX_PATH];
LoadString(hDllInstance, 4000, szMsgTitle, sizeof(szMsgTitle) / sizeof(TCHAR));
LoadString(hDllInstance, 24, szMsgText, sizeof(szMsgText) / sizeof(TCHAR));
MessageBox(hDlg, szMsgText, szMsgTitle, MB_OK | MB_ICONINFORMATION);
}
}
}
}
EndDialog(hDlg, LOWORD(wParam));
}
break;
case IDCANCEL:
EndDialog(hDlg, LOWORD(wParam));
break;
}
}
break;
}
return FALSE;
}
static INT_PTR CALLBACK
NetIDPageProc(IN HWND hwndDlg,
IN UINT uMsg,
@ -23,7 +217,6 @@ NetIDPageProc(IN HWND hwndDlg,
INT_PTR Ret = 0;
UNREFERENCED_PARAMETER(lParam);
UNREFERENCED_PARAMETER(wParam);
switch (uMsg)
{
@ -48,12 +241,23 @@ NetIDPageProc(IN HWND hwndDlg,
wki->wki101_langroup);
}
if (wki != NULL)
NetApiBufferFree(wki);
if (wki) NetApiBufferFree(wki);
Ret = TRUE;
break;
}
case WM_COMMAND:
switch (LOWORD(wParam))
{
case IDC_NETWORK_PROPERTY:
DialogBox(hDllInstance,
MAKEINTRESOURCE(IDD_PROPPAGECOMPNAMECHENGE),
hwndDlg,
NetworkPropDlgProc);
break;
}
break;
}
return Ret;
@ -66,7 +270,7 @@ CreateNetIDPropertyPage(VOID)
psp.dwSize = sizeof(psp);
psp.dwFlags = PSP_DEFAULT;
psp.hInstance= hDllInstance;
psp.hInstance = hDllInstance;
psp.pszTemplate = MAKEINTRESOURCE(IDD_PROPPAGECOMPUTER);
psp.pfnDlgProc = NetIDPageProc;