Index: dll/win32/netid/netid.c =================================================================== --- dll/win32/netid/netid.c (revision 74175) +++ dll/win32/netid/netid.c (working copy) @@ -13,6 +13,7 @@ #include #include #include +#include #include #include #include @@ -19,6 +20,8 @@ #include "resource.h" +#define MAX_COMPUTERDESCRIPTION_LENGTH 256 + static INT_PTR CALLBACK NetIDPageProc(IN HWND hwndDlg, IN UINT uMsg, @@ -274,16 +277,31 @@ { INT_PTR Ret = 0; - UNREFERENCED_PARAMETER(lParam); - switch (uMsg) { case WM_INITDIALOG: { - /* Display computer name */ + /* Display computer name and description */ + HKEY KeyHandle; + TCHAR ComputerDescription[MAX_COMPUTERDESCRIPTION_LENGTH + 1]; + DWORD RegSize = sizeof(ComputerDescription); LPWKSTA_INFO_101 wki = NULL; DWORD Size = MAX_COMPUTERNAME_LENGTH + 1; TCHAR ComputerName[MAX_COMPUTERNAME_LENGTH + 1]; + + SendMessage(GetDlgItem(hwndDlg, IDC_COMPDESC), EM_SETLIMITTEXT, MAX_COMPUTERDESCRIPTION_LENGTH, 0); + + if (RegOpenKeyEx(HKEY_LOCAL_MACHINE, _T("SYSTEM\\CurrentControlSet\\Services\\LanmanServer\\Parameters"), 0, + KEY_QUERY_VALUE, &KeyHandle) == ERROR_SUCCESS) + { + if (RegQueryValueEx(KeyHandle, _T("srvcomment"), 0, NULL, (LPBYTE)ComputerDescription, &RegSize) == ERROR_SUCCESS) + { + ComputerDescription[RegSize / sizeof(TCHAR)] = 0; + SetDlgItemText(hwndDlg, IDC_COMPDESC, ComputerDescription); + } + RegCloseKey(KeyHandle); + } + if (GetComputerName(ComputerName,&Size)) { SetDlgItemText(hwndDlg, @@ -305,6 +323,36 @@ break; } + case WM_NOTIFY: + switch (((LPNMHDR)lParam)->code) + { + case PSN_APPLY: + { + HKEY KeyHandle; + TCHAR ComputerDescription[MAX_COMPUTERDESCRIPTION_LENGTH + 1]; + DWORD RegSize = sizeof(ComputerDescription); + TCHAR NewComputerDescription[MAX_COMPUTERDESCRIPTION_LENGTH + 1]; + + if (RegOpenKeyEx(HKEY_LOCAL_MACHINE, _T("SYSTEM\\CurrentControlSet\\Services\\LanmanServer\\Parameters"), 0, + KEY_QUERY_VALUE | KEY_SET_VALUE, &KeyHandle) == ERROR_SUCCESS) + { + GetWindowText(GetDlgItem(hwndDlg, IDC_COMPDESC), NewComputerDescription, ARRAYSIZE(NewComputerDescription)); + if (GetLastError() == ERROR_SUCCESS) + { + if (RegQueryValueEx(KeyHandle, _T("srvcomment"), 0, NULL, (LPBYTE)ComputerDescription, &RegSize) != ERROR_SUCCESS + || _tcscmp(ComputerDescription, NewComputerDescription) != 0) + { + RegSetValueEx(KeyHandle, _T("srvcomment"), 0, REG_SZ, (LPBYTE)NewComputerDescription, + (_tcslen(NewComputerDescription) + 1) * sizeof(TCHAR)); + } + } + RegCloseKey(KeyHandle); + } + } + break; + } + break; + case WM_COMMAND: switch (LOWORD(wParam)) {