[ros-diffs] [dchapyshev] 43052: - Partially implement "Computer Name Changes" dialog. Computer name can be changed now. See issue #3304 for more details.

dchapyshev at svn.reactos.org dchapyshev at svn.reactos.org
Tue Sep 15 15:45:35 CEST 2009


Author: dchapyshev
Date: Tue Sep 15 15:45:34 2009
New Revision: 43052

URL: http://svn.reactos.org/svn/reactos?rev=43052&view=rev
Log:
- Partially implement "Computer Name Changes" dialog. Computer name can be changed now.
See issue #3304 for more details.

Modified:
    trunk/reactos/dll/win32/netid/lang/bg-BG.rc
    trunk/reactos/dll/win32/netid/lang/cs-CZ.rc
    trunk/reactos/dll/win32/netid/lang/de-DE.rc
    trunk/reactos/dll/win32/netid/lang/el-GR.rc
    trunk/reactos/dll/win32/netid/lang/en-US.rc
    trunk/reactos/dll/win32/netid/lang/es-ES.rc
    trunk/reactos/dll/win32/netid/lang/fr-FR.rc
    trunk/reactos/dll/win32/netid/lang/id-ID.rc
    trunk/reactos/dll/win32/netid/lang/it-IT.rc
    trunk/reactos/dll/win32/netid/lang/nl-NL.rc
    trunk/reactos/dll/win32/netid/lang/no-NO.rc
    trunk/reactos/dll/win32/netid/lang/pl-PL.rc
    trunk/reactos/dll/win32/netid/lang/ru-RU.rc
    trunk/reactos/dll/win32/netid/lang/sk-SK.rc
    trunk/reactos/dll/win32/netid/lang/uk-UA.rc
    trunk/reactos/dll/win32/netid/netid.c

Modified: trunk/reactos/dll/win32/netid/lang/bg-BG.rc
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/netid/lang/bg-BG.rc?rev=43052&r1=43051&r2=43052&view=diff
==============================================================================
--- trunk/reactos/dll/win32/netid/lang/bg-BG.rc [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/netid/lang/bg-BG.rc [iso-8859-1] Tue Sep 15 15:45:34 2009
@@ -67,8 +67,11 @@
     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

Modified: trunk/reactos/dll/win32/netid/lang/cs-CZ.rc
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/netid/lang/cs-CZ.rc?rev=43052&r1=43051&r2=43052&view=diff
==============================================================================
--- trunk/reactos/dll/win32/netid/lang/cs-CZ.rc [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/netid/lang/cs-CZ.rc [iso-8859-1] Tue Sep 15 15:45:34 2009
@@ -73,8 +73,11 @@
     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

Modified: trunk/reactos/dll/win32/netid/lang/de-DE.rc
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/netid/lang/de-DE.rc?rev=43052&r1=43051&r2=43052&view=diff
==============================================================================
--- trunk/reactos/dll/win32/netid/lang/de-DE.rc [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/netid/lang/de-DE.rc [iso-8859-1] Tue Sep 15 15:45:34 2009
@@ -75,8 +75,11 @@
     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

Modified: trunk/reactos/dll/win32/netid/lang/el-GR.rc
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/netid/lang/el-GR.rc?rev=43052&r1=43051&r2=43052&view=diff
==============================================================================
--- trunk/reactos/dll/win32/netid/lang/el-GR.rc [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/netid/lang/el-GR.rc [iso-8859-1] Tue Sep 15 15:45:34 2009
@@ -67,8 +67,11 @@
     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

Modified: trunk/reactos/dll/win32/netid/lang/en-US.rc
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/netid/lang/en-US.rc?rev=43052&r1=43051&r2=43052&view=diff
==============================================================================
--- trunk/reactos/dll/win32/netid/lang/en-US.rc [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/netid/lang/en-US.rc [iso-8859-1] Tue Sep 15 15:45:34 2009
@@ -67,8 +67,11 @@
     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

Modified: trunk/reactos/dll/win32/netid/lang/es-ES.rc
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/netid/lang/es-ES.rc?rev=43052&r1=43051&r2=43052&view=diff
==============================================================================
--- trunk/reactos/dll/win32/netid/lang/es-ES.rc [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/netid/lang/es-ES.rc [iso-8859-1] Tue Sep 15 15:45:34 2009
@@ -72,8 +72,11 @@
     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

Modified: trunk/reactos/dll/win32/netid/lang/fr-FR.rc
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/netid/lang/fr-FR.rc?rev=43052&r1=43051&r2=43052&view=diff
==============================================================================
--- trunk/reactos/dll/win32/netid/lang/fr-FR.rc [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/netid/lang/fr-FR.rc [iso-8859-1] Tue Sep 15 15:45:34 2009
@@ -67,8 +67,11 @@
     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

Modified: trunk/reactos/dll/win32/netid/lang/id-ID.rc
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/netid/lang/id-ID.rc?rev=43052&r1=43051&r2=43052&view=diff
==============================================================================
--- trunk/reactos/dll/win32/netid/lang/id-ID.rc [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/netid/lang/id-ID.rc [iso-8859-1] Tue Sep 15 15:45:34 2009
@@ -67,8 +67,11 @@
     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

Modified: trunk/reactos/dll/win32/netid/lang/it-IT.rc
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/netid/lang/it-IT.rc?rev=43052&r1=43051&r2=43052&view=diff
==============================================================================
--- trunk/reactos/dll/win32/netid/lang/it-IT.rc [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/netid/lang/it-IT.rc [iso-8859-1] Tue Sep 15 15:45:34 2009
@@ -68,8 +68,11 @@
     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

Modified: trunk/reactos/dll/win32/netid/lang/nl-NL.rc
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/netid/lang/nl-NL.rc?rev=43052&r1=43051&r2=43052&view=diff
==============================================================================
--- trunk/reactos/dll/win32/netid/lang/nl-NL.rc [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/netid/lang/nl-NL.rc [iso-8859-1] Tue Sep 15 15:45:34 2009
@@ -67,8 +67,11 @@
     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

Modified: trunk/reactos/dll/win32/netid/lang/no-NO.rc
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/netid/lang/no-NO.rc?rev=43052&r1=43051&r2=43052&view=diff
==============================================================================
--- trunk/reactos/dll/win32/netid/lang/no-NO.rc [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/netid/lang/no-NO.rc [iso-8859-1] Tue Sep 15 15:45:34 2009
@@ -67,8 +67,11 @@
     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

Modified: trunk/reactos/dll/win32/netid/lang/pl-PL.rc
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/netid/lang/pl-PL.rc?rev=43052&r1=43051&r2=43052&view=diff
==============================================================================
--- trunk/reactos/dll/win32/netid/lang/pl-PL.rc [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/netid/lang/pl-PL.rc [iso-8859-1] Tue Sep 15 15:45:34 2009
@@ -75,8 +75,11 @@
     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

Modified: trunk/reactos/dll/win32/netid/lang/ru-RU.rc
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/netid/lang/ru-RU.rc?rev=43052&r1=43051&r2=43052&view=diff
==============================================================================
--- trunk/reactos/dll/win32/netid/lang/ru-RU.rc [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/netid/lang/ru-RU.rc [iso-8859-1] Tue Sep 15 15:45:34 2009
@@ -67,8 +67,11 @@
     22 "Äîáðî ïîæàëîâàòü â ðàáî÷óþ ãðóïïó %1."
     23 "Äîáðî ïîæàëîâàòü â äîìåí %1."
     24 "Íåîáõîäèìî ïåðåçàïóñòèòü êîìïüþòåð äëÿ òîãî, ÷òîáû ýòè èçìåíåíèÿ âñòóïèëè â ñèëó."
+	25 "Ìîæíî èçìåíèòü èìÿ è ïðèíàäëåæíîñòü ýòîãî êîìïüþòåðà. Èçìåíåíèÿ ìîãóò ïîâëèÿòü íà äîñòóï ê ñåòåâûì ðåñóðñàì."
     1021 "Ïðèìå÷àíèå: òîëüêî àäìèíèñòðàòîðû ìîãóò èçìåíèòü èäåíòèôèêàöèþ ýòîãî êîìïüþòåðà."
     1022 "Ïðèìå÷àíèå: èäåíòèôèêàöèÿ ýòîãî êîìïüþòåðà íå ìîæåò áûòü èçìåíåíà, ïîòîìó ÷òî:"
     3210 "&Ïîäðîáíî >>"
     3220 "<< &Ïîäðîáíî"
+	4000 "Èíôîðìàöèÿ"
+	4001 "Íå óäàëîñü óñòàíîâèòü íîâîå èìÿ êîìïüþòåðà!"
 END

Modified: trunk/reactos/dll/win32/netid/lang/sk-SK.rc
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/netid/lang/sk-SK.rc?rev=43052&r1=43051&r2=43052&view=diff
==============================================================================
--- trunk/reactos/dll/win32/netid/lang/sk-SK.rc [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/netid/lang/sk-SK.rc [iso-8859-1] Tue Sep 15 15:45:34 2009
@@ -74,8 +74,11 @@
     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

Modified: trunk/reactos/dll/win32/netid/lang/uk-UA.rc
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/netid/lang/uk-UA.rc?rev=43052&r1=43051&r2=43052&view=diff
==============================================================================
--- trunk/reactos/dll/win32/netid/lang/uk-UA.rc [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/netid/lang/uk-UA.rc [iso-8859-1] Tue Sep 15 15:45:34 2009
@@ -75,8 +75,11 @@
     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

Modified: trunk/reactos/dll/win32/netid/netid.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/netid/netid.c?rev=43052&r1=43051&r2=43052&view=diff
==============================================================================
--- trunk/reactos/dll/win32/netid/netid.c [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/netid/netid.c [iso-8859-1] Tue Sep 15 15:45:34 2009
@@ -3,16 +3,210 @@
  * LICENSE:     GPL - See COPYING in the top level directory
  * FILE:        dll/win32/netid/netid.c
  * PURPOSE:     Network ID Page
- * COPYRIGHT:   Copyright Thomas Weidenmueller <w3seek at reactos.org>
+ * COPYRIGHT:   Thomas Weidenmueller <w3seek at reactos.org>
+ *              Dmitry Chapyshev <dmitry at 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,
@@ -23,7 +217,6 @@
     INT_PTR Ret = 0;
 
     UNREFERENCED_PARAMETER(lParam);
-    UNREFERENCED_PARAMETER(wParam);
 
     switch (uMsg)
     {
@@ -48,12 +241,23 @@
                                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 @@
 
     psp.dwSize = sizeof(psp);
     psp.dwFlags = PSP_DEFAULT;
-    psp.hInstance= hDllInstance;
+    psp.hInstance = hDllInstance;
     psp.pszTemplate = MAKEINTRESOURCE(IDD_PROPPAGECOMPUTER);
     psp.pfnDlgProc = NetIDPageProc;
 




More information about the Ros-diffs mailing list