ReactOS  0.4.14-dev-866-g5b3e84f
netid.c
Go to the documentation of this file.
1 /*
2  * PROJECT: ReactOS System Control Panel Applet
3  * LICENSE: GPL - See COPYING in the top level directory
4  * FILE: dll/win32/netid/netid.c
5  * PURPOSE: Network ID Page
6  * COPYRIGHT: Thomas Weidenmueller <w3seek@reactos.org>
7  * Dmitry Chapyshev <dmitry@reactos.org>
8  *
9  */
10 
11 #define WIN32_NO_STATUS
12 #include <stdarg.h>
13 #include <windef.h>
14 #include <winbase.h>
15 #include <winuser.h>
16 #include <winreg.h>
17 #include <windns.h>
18 #include <lm.h>
19 #include <prsht.h>
20 
21 #include "resource.h"
22 
23 
24 #define MAX_COMPUTERDESCRIPTION_LENGTH 255
25 #define MAX_HOSTNAME_LENGTH 63
26 #define MAX_DOMAINNAME_LENGTH 255
27 
28 typedef struct _NETIDDATA
29 {
37 
38 
40 
41 static
42 INT
44  HWND hDlg,
45  UINT uType,
46  DWORD dwMessage,
47  ...)
48 {
49  WCHAR szTitle[256], szMessage[256], szText[512];
50  va_list args = NULL;
51 
53 
54  LoadStringW(hDllInstance, dwMessage, szMessage, ARRAYSIZE(szMessage));
55 
56  va_start(args, dwMessage);
58  szMessage,
59  0,
60  0,
61  szText,
63  &args);
64  va_end(args);
65 
66  return MessageBoxW(hDlg, szText, szTitle, uType);
67 }
68 
69 static
70 BOOL
72  PNETIDDATA pNetIdData)
73 {
75  DWORD dwSize;
76  DWORD dwError;
77 
79  L"SYSTEM\\CurrentControlSet\\Services\\TcpIp\\Parameters",
80  0,
82  &KeyHandle);
83  if (dwError == ERROR_SUCCESS)
84  {
85  dwSize = sizeof(pNetIdData->szHostName);
87  L"NV HostName",
88  0,
89  NULL,
90  (LPBYTE)&pNetIdData->szHostName,
91  &dwSize);
92 
93  dwSize = sizeof(pNetIdData->szDomainName);
95  L"NV Domain",
96  0,
97  NULL,
98  (LPBYTE)&pNetIdData->szDomainName,
99  &dwSize);
100 
102  }
103 
105  L"SYSTEM\\CurrentControlSet\\Control\\ComputerName\\ComputerName",
106  0,
108  &KeyHandle);
109  if (dwError == ERROR_SUCCESS)
110  {
111  dwSize = sizeof(pNetIdData->szComputerName);
113  L"ComputerName",
114  0,
115  NULL,
116  (LPBYTE)&pNetIdData->szComputerName,
117  &dwSize);
118 
120  }
121 
122  return TRUE;
123 }
124 
125 static
126 BOOL
128  HWND hDlg,
129  UINT uId)
130 {
131  WCHAR szDomainName[256];
132  DWORD dwError;
133 
134  if (GetDlgItemTextW(hDlg, uId, szDomainName, ARRAYSIZE(szDomainName)) == 0)
135  return TRUE;
136 
137  dwError = DnsValidateName_W(szDomainName, DnsNameDomain);
138  if (dwError != ERROR_SUCCESS)
139  {
140  switch (dwError)
141  {
143  if (FormatMessageBox(hDlg, MB_YESNO | MB_ICONWARNING, 7, szDomainName) == IDYES)
144  return TRUE;
145  break;
146 
147  case ERROR_INVALID_NAME:
148  FormatMessageBox(hDlg, MB_OK | MB_ICONERROR, 8, szDomainName);
149  break;
150 
152  FormatMessageBox(hDlg, MB_OK | MB_ICONERROR, 1031, szDomainName);
153  break;
154 
156  FormatMessageBox(hDlg, MB_OK | MB_ICONERROR, 1032, szDomainName);
157  break;
158  }
159 
160  return FALSE;
161  }
162 
163  return TRUE;
164 }
165 
166 static
169 {
170  PNETIDDATA pNetIdData;
171 
172  pNetIdData = (PNETIDDATA)GetWindowLongPtr(hDlg, DWLP_USER);
173 
174  switch (Msg)
175  {
176  case WM_INITDIALOG:
177  pNetIdData = (PNETIDDATA)lParam;
178  if (pNetIdData != NULL)
179  {
180  SetWindowLongPtr(hDlg, DWLP_USER, (LONG_PTR)pNetIdData);
181 
182  SetDlgItemTextW(hDlg, 1011, pNetIdData->szDomainName);
183 
184  SetDlgItemTextW(hDlg, 1013, pNetIdData->szComputerName);
186  }
187  return TRUE;
188 
189  case WM_COMMAND:
190  switch (LOWORD(wParam))
191  {
192  case 1011:
193  if (HIWORD(wParam) == EN_CHANGE)
194  {
195  EnableWindow(GetDlgItem(hDlg, IDOK), TRUE);
196  }
197  break;
198 
199  case IDOK:
200  if (!IsValidDomainName(hDlg, 1011))
201  {
202  SetFocus(GetDlgItem(hDlg, 1011));
203  break;
204  }
205 
206  GetDlgItemTextW(hDlg, 1011, pNetIdData->szDomainName, ARRAYSIZE(pNetIdData->szDomainName));
207  pNetIdData->bDomainNameChanged = TRUE;
208  EndDialog(hDlg, TRUE);
209  break;
210 
211  case IDCANCEL:
212  EndDialog(hDlg, FALSE);
213  break;
214  }
215  break;
216  }
217 
218  return FALSE;
219 }
220 
221 static VOID
222 SetRadioBtnState(HWND hDlg, BOOL IsDomain)
223 {
224  SendDlgItemMessage(hDlg, 1008, BM_SETCHECK, (WPARAM)IsDomain, 0);
225  SendDlgItemMessage(hDlg, 1004, BM_SETCHECK, (WPARAM)!IsDomain, 0);
226  EnableWindow(GetDlgItem(hDlg, 116), IsDomain);
227  EnableWindow(GetDlgItem(hDlg, 1007), !IsDomain);
228 }
229 
230 static VOID
232 {
233  EnableWindow(GetDlgItem(hDlg, 1008), FALSE);
234  EnableWindow(GetDlgItem(hDlg, 1004), FALSE);
235  EnableWindow(GetDlgItem(hDlg, 116), FALSE);
236  EnableWindow(GetDlgItem(hDlg, 1007), FALSE);
237 }
238 
239 static
240 BOOL
242  HWND hDlg,
243  UINT uId)
244 {
245  WCHAR szHostName[256];
246  DWORD dwError;
247 
248  GetWindowText(GetDlgItem(hDlg, uId), szHostName, ARRAYSIZE(szHostName));
249 
250  dwError = DnsValidateName_W(szHostName, DnsNameHostnameLabel);
251  if (dwError != ERROR_SUCCESS)
252  {
253  switch (dwError)
254  {
256  if (FormatMessageBox(hDlg, MB_YESNO | MB_ICONWARNING, 10, szHostName) == IDYES)
257  return TRUE;
258  break;
259 
260  case ERROR_INVALID_NAME:
261  FormatMessageBox(hDlg, MB_OK | MB_ICONERROR, 11);
262  return FALSE;
263 
265  FormatMessageBox(hDlg, MB_OK | MB_ICONERROR, 1029, szHostName);
266  break;
267 
269  FormatMessageBox(hDlg, MB_OK | MB_ICONERROR, 1030, szHostName);
270  break;
271  }
272 
273  return FALSE;
274  }
275 
276  return TRUE;
277 }
278 
279 static
280 VOID
282  HWND hDlg,
283  UINT uId,
284  PNETIDDATA pNetIdData)
285 {
286  WCHAR szFullComputerName[512];
287 
288  wsprintf(szFullComputerName, L"%s.%s", pNetIdData->szHostName, pNetIdData->szDomainName);
289  SetDlgItemText(hDlg, uId, szFullComputerName);
290 }
291 
292 static
293 VOID
295  HWND hDlg,
296  UINT uId,
297  PNETIDDATA pNetIdData)
298 {
299  WCHAR szFullComputerName[512];
300  WCHAR szHostName[256];
301 
302  GetWindowText(GetDlgItem(hDlg, 1002), szHostName, ARRAYSIZE(szHostName));
303 
304  wsprintf(szFullComputerName, L"%s.%s", szHostName, pNetIdData->szDomainName);
305  SetDlgItemText(hDlg, uId, szFullComputerName);
306 }
307 
308 static
309 VOID
311  HWND hDlg,
312  UINT uId,
313  PNETIDDATA pNetIdData)
314 {
315  WCHAR szHostName[256];
316  DWORD dwSize;
317 
318  GetWindowText(GetDlgItem(hDlg, 1002), szHostName, ARRAYSIZE(szHostName));
319 
320  dwSize = ARRAYSIZE(pNetIdData->szComputerName);
321  DnsHostnameToComputerNameW(szHostName,
322  pNetIdData->szComputerName,
323  &dwSize);
324 }
325 
326 static
327 VOID
329  HWND hDlg,
330  PNETIDDATA pNetIdData)
331 {
332  LPWKSTA_INFO_101 wki = NULL;
333  WCHAR MsgText[MAX_PATH * 2];
334  LPWSTR JoinName = NULL;
335  NETSETUP_JOIN_STATUS JoinStatus;
336 
337  if (LoadStringW(hDllInstance, 25, MsgText, ARRAYSIZE(MsgText)))
338  SetDlgItemText(hDlg, 1017, MsgText);
339 
341  SetDlgItemText(hDlg, 1002, pNetIdData->szHostName);
342  SetFullComputerName(hDlg, 1001, pNetIdData);
343 
344  if (NetGetJoinInformation(NULL, &JoinName, &JoinStatus) != NERR_Success)
345  {
346  SetRadioBtnState(hDlg, FALSE);
347 
348  if (NetWkstaGetInfo(NULL,
349  101,
350  (LPBYTE*)&wki) == NERR_Success)
351  {
352  SetDlgItemText(hDlg,
353  1007,
354  wki->wki101_langroup);
355  }
356  else
357  {
358  DisableControls(hDlg);
359  }
360 
361  if (wki)
362  NetApiBufferFree(wki);
363  }
364  else
365  {
366  switch (JoinStatus)
367  {
368  case NetSetupDomainName:
369  SetDlgItemText(hDlg, 116, JoinName);
370  SetRadioBtnState(hDlg, TRUE);
371  break;
372 
374  SetDlgItemText(hDlg, 1007, JoinName);
375  SetRadioBtnState(hDlg, FALSE);
376  break;
377 
378  case NetSetupUnjoined:
379  break;
380 
382  default:
383  SetRadioBtnState(hDlg, FALSE);
384 
385  if (NetWkstaGetInfo(NULL,
386  101,
387  (LPBYTE*)&wki) == NERR_Success)
388  {
389  SetDlgItemText(hDlg,
390  1007,
391  wki->wki101_langroup);
392  }
393  else
394  {
395  DisableControls(hDlg);
396  }
397 
398  if (wki)
399  NetApiBufferFree(wki);
400  break;
401  }
402 
403  if (JoinName)
404  NetApiBufferFree(JoinName);
405  }
406 }
407 
408 static
409 BOOL
411  HWND hDlg,
412  PNETIDDATA pNetIdData)
413 {
414  WCHAR szMsgText[MAX_PATH], szMsgTitle[MAX_PATH];
415 
416  if (pNetIdData->bHostNameChanged)
417  {
418  if (!IsValidComputerName(hDlg, 1002))
419  {
420  SetFocus(GetDlgItem(hDlg, 1002));
421  return FALSE;
422  }
423 
424  GetWindowText(GetDlgItem(hDlg, 1002), pNetIdData->szHostName, ARRAYSIZE(pNetIdData->szHostName));
425 
426  if (!SetComputerNameExW(ComputerNamePhysicalDnsHostname, pNetIdData->szHostName))
427  {
428  LoadStringW(hDllInstance, 4001, szMsgText, ARRAYSIZE(szMsgText));
429  MessageBoxW(hDlg, szMsgText, NULL, MB_OK | MB_ICONERROR);
430  return FALSE;
431  }
432  }
433 
434  if (pNetIdData->bDomainNameChanged)
435  {
436  if (!SetComputerNameExW(ComputerNamePhysicalDnsDomain, pNetIdData->szDomainName))
437  {
438  /* FIXME: Show error message */
439  return FALSE;
440  }
441  }
442 
443  LoadStringW(hDllInstance, 4000, szMsgTitle, ARRAYSIZE(szMsgTitle));
444  LoadStringW(hDllInstance, 24, szMsgText, ARRAYSIZE(szMsgText));
445  MessageBoxW(hDlg, szMsgText, szMsgTitle, MB_OK | MB_ICONINFORMATION);
446 
447  return TRUE;
448 }
449 
450 static
453 {
454  PNETIDDATA pNetIdData;
455 
456  pNetIdData = (PNETIDDATA)GetWindowLongPtr(hDlg, DWLP_USER);
457 
458  switch (Msg)
459  {
460  case WM_INITDIALOG:
461  pNetIdData = (PNETIDDATA)lParam;
462  if (pNetIdData != NULL)
463  {
464  SetWindowLongPtr(hDlg, DWLP_USER, (LONG_PTR)pNetIdData);
465  NetworkDlg_OnInitDialog(hDlg, pNetIdData);
467  }
468  return TRUE;
469 
470  case WM_COMMAND:
471  switch (LOWORD(wParam))
472  {
473  case 1002:
474  if (HIWORD(wParam) == EN_CHANGE)
475  {
476  UpdateFullComputerName(hDlg, 1001, pNetIdData);
477  UpdateNetbiosName(hDlg, 1001, pNetIdData);
478  pNetIdData->bHostNameChanged = TRUE;
479  EnableWindow(GetDlgItem(hDlg, IDOK), TRUE);
480  }
481  break;
482 
483  case 1008: /* Domain radio button */
484  case 1004: /* Workgroup radio button */
485  if (SendDlgItemMessage(hDlg, 1008, BM_GETCHECK, 0, 0) == BST_CHECKED)
486  SetRadioBtnState(hDlg, TRUE);
487  else
488  SetRadioBtnState(hDlg, FALSE);
489  break;
490 
491  case 1003:
494  hDlg,
496  (LPARAM)pNetIdData))
497  {
498  UpdateFullComputerName(hDlg, 1001, pNetIdData);
499  EnableWindow(GetDlgItem(hDlg, IDOK), TRUE);
500  }
501  break;
502 
503  case IDOK:
504  if (NetworkDlg_OnOK(hDlg, pNetIdData))
505  EndDialog(hDlg, TRUE);
506  break;
507 
508  case IDCANCEL:
509  EndDialog(hDlg, FALSE);
510  break;
511  }
512  break;
513  }
514 
515  return FALSE;
516 }
517 
518 static
519 VOID
521  HWND hwndDlg,
522  PNETIDDATA pNetIdData)
523 {
524  WCHAR ComputerDescription[MAX_COMPUTERDESCRIPTION_LENGTH + 1];
525  DWORD RegSize = sizeof(ComputerDescription);
526  HKEY KeyHandle;
527  LPWKSTA_INFO_101 wki;
528  LONG lError;
529 
530  /* Display computer name and description */
532 
534  L"SYSTEM\\CurrentControlSet\\Services\\LanmanServer\\Parameters",
535  0,
537  &KeyHandle);
538  if (lError == ERROR_SUCCESS)
539  {
540  lError = RegQueryValueExW(KeyHandle,
541  L"srvcomment",
542  0,
543  NULL,
544  (LPBYTE)ComputerDescription,
545  &RegSize);
546  if (lError == ERROR_SUCCESS)
547  {
548  ComputerDescription[RegSize / sizeof(WCHAR)] = UNICODE_NULL;
549  SetDlgItemText(hwndDlg, IDC_COMPDESC, ComputerDescription);
550  }
551 
553  }
554 
555  if (NetWkstaGetInfo(NULL, 101, (LPBYTE*)&wki) == NERR_Success)
556  {
557  SetDlgItemText(hwndDlg, IDC_WORKGROUPDOMAIN_NAME, wki->wki101_langroup);
558  NetApiBufferFree(wki);
559  }
560 }
561 
562 static
563 LONG
565  HWND hwndDlg)
566 {
567  WCHAR ComputerDescription[MAX_COMPUTERDESCRIPTION_LENGTH + 1];
568  WCHAR NewComputerDescription[MAX_COMPUTERDESCRIPTION_LENGTH + 1];
569  HKEY KeyHandle = NULL;
570  DWORD dwSize;
571  LONG lError;
572 
574  L"SYSTEM\\CurrentControlSet\\Services\\LanmanServer\\Parameters",
575  0,
577  &KeyHandle);
578  if (lError != ERROR_SUCCESS)
579  return lError;
580 
581  GetDlgItemTextW(hwndDlg,
582  IDC_COMPDESC,
583  NewComputerDescription,
584  ARRAYSIZE(NewComputerDescription));
585  if (GetLastError() != ERROR_SUCCESS)
586  {
587  lError = GetLastError();
588  goto done;
589  }
590 
591  dwSize = sizeof(ComputerDescription);
592  lError = RegQueryValueExW(KeyHandle,
593  L"srvcomment",
594  0,
595  NULL,
596  (PBYTE)ComputerDescription,
597  &dwSize);
598  if (lError != ERROR_SUCCESS && lError != ERROR_FILE_NOT_FOUND)
599  goto done;
600 
601  lError = ERROR_SUCCESS;
602  if (wcscmp(ComputerDescription, NewComputerDescription) != 0)
603  {
604  lError = RegSetValueExW(KeyHandle,
605  L"srvcomment",
606  0,
607  REG_SZ,
608  (PBYTE)NewComputerDescription,
609  (wcslen(NewComputerDescription) + 1) * sizeof(WCHAR));
610  }
611 
612 done:
613  if (KeyHandle != NULL)
615 
616  return lError;
617 }
618 
619 static INT_PTR CALLBACK
621  IN UINT uMsg,
622  IN WPARAM wParam,
623  IN LPARAM lParam)
624 {
625  PNETIDDATA pNetIdData;
626 
627  pNetIdData = (PNETIDDATA)GetWindowLongPtr(hwndDlg, DWLP_USER);
628 
629  switch (uMsg)
630  {
631  case WM_INITDIALOG:
632  pNetIdData = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(NETIDDATA));
633  if (pNetIdData != NULL)
634  {
635  SetWindowLongPtr(hwndDlg, DWLP_USER, (LONG_PTR)pNetIdData);
636  GetComputerNames(pNetIdData);
637  SetFullComputerName(hwndDlg, IDC_COMPUTERNAME, pNetIdData);
638  NetIDPage_OnInitDialog(hwndDlg, pNetIdData);
639  pNetIdData->bEnable = TRUE;
640  }
641  return TRUE;
642 
643  case WM_NOTIFY:
644  switch (((LPNMHDR)lParam)->code)
645  {
646  case PSN_APPLY:
647  NetIDPage_OnApply(hwndDlg);
648  break;
649  }
650  break;
651 
652  case WM_COMMAND:
653  switch (LOWORD(wParam))
654  {
655  case IDC_COMPDESC:
656  if (HIWORD(wParam) == EN_CHANGE && pNetIdData->bEnable == TRUE)
657  PropSheet_Changed(GetParent(hwndDlg), hwndDlg);
658  break;
659 
663  hwndDlg,
665  (LPARAM)pNetIdData))
666  {
667  UpdateFullComputerName(hwndDlg, IDC_COMPUTERNAME, pNetIdData);
668  }
669  break;
670  }
671  break;
672 
673  case WM_DESTROY:
674  if (pNetIdData != NULL)
675  {
676  HeapFree(GetProcessHeap(), 0, pNetIdData);
677  pNetIdData = NULL;
679  }
680  break;
681  }
682 
683  return FALSE;
684 }
685 
688 {
689  PROPSHEETPAGE psp = {0};
690 
691  psp.dwSize = sizeof(psp);
692  psp.dwFlags = PSP_DEFAULT;
693  psp.hInstance = hDllInstance;
694  psp.pszTemplate = MAKEINTRESOURCE(IDD_PROPPAGECOMPUTER);
695  psp.pfnDlgProc = NetIDPageProc;
696 
697  return CreatePropertySheetPage(&psp);
698 }
699 
700 BOOL WINAPI
702  IN DWORD dwReason,
704 {
705  switch (dwReason)
706  {
707  case DLL_PROCESS_ATTACH:
708  hDllInstance = hinstDLL;
709  DisableThreadLibraryCalls(hinstDLL);
710  break;
711  }
712 
713  return TRUE;
714 }
BOOL WINAPI DllMain(IN HINSTANCE hinstDLL, IN DWORD dwReason, IN LPVOID lpvReserved)
Definition: netid.c:701
#define MAKEINTRESOURCE
Definition: winuser.h:591
#define IN
Definition: typedefs.h:38
UINT WINAPI GetDlgItemTextW(HWND hDlg, int nIDDlgItem, LPWSTR lpString, int nMaxCount)
Definition: dialog.c:2265
#define TRUE
Definition: types.h:120
#define IDOK
Definition: winuser.h:824
#define IDC_NETWORK_PROPERTY
Definition: resource.h:19
static VOID DisableControls(HWND hDlg)
Definition: netid.c:231
#define ERROR_SUCCESS
Definition: deptool.c:10
#define IDYES
Definition: winuser.h:829
#define KEY_SET_VALUE
Definition: nt_native.h:1017
#define IDD_PROPPAGECOMPUTER
Definition: resource.h:12
_Must_inspect_result_ _Out_ PNDIS_STATUS _In_ NDIS_HANDLE _In_ ULONG _Out_ PNDIS_STRING _Out_ PNDIS_HANDLE KeyHandle
Definition: ndis.h:4711
#define MAX_DOMAINNAME_LENGTH
Definition: netid.c:26
#define EM_SETLIMITTEXT
Definition: winuser.h:1993
#define FORMAT_MESSAGE_FROM_STRING
Definition: winbase.h:402
#define DNS_ERROR_NON_RFC_NAME
Definition: winerror.h:1872
#define CALLBACK
Definition: compat.h:27
static VOID NetworkDlg_OnInitDialog(HWND hDlg, PNETIDDATA pNetIdData)
Definition: netid.c:328
BOOL WINAPI DisableThreadLibraryCalls(IN HMODULE hLibModule)
Definition: loader.c:85
#define ARRAYSIZE(array)
Definition: filtermapper.c:47
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1059
HWND WINAPI SetFocus(_In_opt_ HWND)
struct _NETIDDATA NETIDDATA
#define DLL_PROCESS_ATTACH
Definition: compat.h:120
UINT_PTR WPARAM
Definition: windef.h:207
static LONG NetIDPage_OnApply(HWND hwndDlg)
Definition: netid.c:564
#define SendDlgItemMessage
Definition: winuser.h:5817
#define PSN_APPLY
Definition: prsht.h:117
int32_t INT_PTR
Definition: typedefs.h:62
DWORD WINAPI FormatMessageW(DWORD dwFlags, LPCVOID lpSource, DWORD dwMessageId, DWORD dwLanguageId, LPWSTR lpBuffer, DWORD nSize, __ms_va_list *args)
Definition: format_msg.c:583
static VOID UpdateFullComputerName(HWND hDlg, UINT uId, PNETIDDATA pNetIdData)
Definition: netid.c:294
Definition: match.c:390
int WINAPI LoadStringW(_In_opt_ HINSTANCE hInstance, _In_ UINT uID, _Out_writes_to_(cchBufferMax, return+1) LPWSTR lpBuffer, _In_ int cchBufferMax)
int32_t INT
Definition: typedefs.h:56
#define SetWindowLongPtr
Definition: treelist.c:70
BOOL WINAPI EndDialog(_In_ HWND, _In_ INT_PTR)
WPARAM wParam
Definition: combotst.c:138
DNS_STATUS WINAPI DnsValidateName_W(PCWSTR name, DNS_NAME_FORMAT format)
Definition: names.c:124
WCHAR szComputerName[MAX_COMPUTERNAME_LENGTH+1]
Definition: netid.c:32
static IN DWORD IN LPVOID lpvReserved
#define MB_ICONWARNING
Definition: winuser.h:780
#define GetWindowText
Definition: winuser.h:5773
#define NERR_Success
Definition: lmerr.h:5
BOOL WINAPI SetDlgItemTextW(_In_ HWND, _In_ int, _In_ LPCWSTR)
DWORD dwReason
Definition: misc.cpp:154
#define IDC_WORKGROUPDOMAIN_NAME
Definition: resource.h:16
BOOL bEnable
Definition: netid.c:35
LONG WINAPI RegCloseKey(HKEY hKey)
Definition: reg.c:423
unsigned char * LPBYTE
Definition: typedefs.h:52
#define va_end(ap)
Definition: acmsvcex.h:90
#define MB_YESNO
Definition: winuser.h:811
#define UNICODE_NULL
static const WCHAR szText[]
Definition: dialog.c:139
BOOL bDomainNameChanged
Definition: netid.c:34
unsigned int BOOL
Definition: ntddk_ex.h:94
long LONG
Definition: pedump.c:60
#define IDC_COMPDESC
Definition: resource.h:14
struct _PSP * HPROPSHEETPAGE
Definition: mstask.idl:90
smooth NULL
Definition: ftsmooth.c:416
LONG_PTR LPARAM
Definition: windef.h:208
static INT_PTR CALLBACK DNSSuffixPropDlgProc(HWND hDlg, UINT Msg, WPARAM wParam, LPARAM lParam)
Definition: netid.c:168
char * va_list
Definition: acmsvcex.h:78
#define BM_GETCHECK
Definition: winuser.h:1900
#define ERROR_FILE_NOT_FOUND
Definition: disk.h:79
static HINSTANCE hDllInstance
Definition: netid.c:39
#define CreatePropertySheetPage
Definition: prsht.h:381
#define WM_DESTROY
Definition: winuser.h:1591
BOOL WINAPI DnsHostnameToComputerNameW(LPCWSTR hostname, LPWSTR computername, LPDWORD size)
Definition: compname.c:686
BOOL bHostNameChanged
Definition: netid.c:33
LONG WINAPI RegSetValueExW(_In_ HKEY hKey, _In_ LPCWSTR lpValueName, _In_ DWORD Reserved, _In_ DWORD dwType, _In_ CONST BYTE *lpData, _In_ DWORD cbData)
Definition: reg.c:4895
#define PSP_DEFAULT
Definition: prsht.h:22
#define BM_SETCHECK
Definition: winuser.h:1903
NET_API_STATUS WINAPI NetGetJoinInformation(_In_ LPCWSTR lpServer, _Out_ LPWSTR *lpNameBuffer, _Out_ PNETSETUP_JOIN_STATUS BufferType)
Definition: wksta_new.c:317
#define MAX_HOSTNAME_LENGTH
Definition: netid.c:25
#define GetProcessHeap()
Definition: compat.h:403
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
LONG WINAPI RegQueryValueExW(_In_ HKEY hkeyorg, _In_ LPCWSTR name, _In_ LPDWORD reserved, _In_ LPDWORD type, _In_ LPBYTE data, _In_ LPDWORD count)
Definition: reg.c:4116
int WINAPI MessageBoxW(_In_opt_ HWND, _In_opt_ LPCWSTR, _In_opt_ LPCWSTR, _In_ UINT)
HWND WINAPI GetDlgItem(_In_opt_ HWND, _In_ int)
__wchar_t WCHAR
Definition: xmlstorage.h:180
WCHAR szHostName[MAX_HOSTNAME_LENGTH+1]
Definition: netid.c:30
#define PropSheet_Changed(d, w)
Definition: prsht.h:326
static BOOL IsValidComputerName(HWND hDlg, UINT uId)
Definition: netid.c:241
#define MAX_PATH
Definition: compat.h:26
#define WINAPI
Definition: msvc.h:6
unsigned long DWORD
Definition: ntddk_ex.h:95
static VOID NetIDPage_OnInitDialog(HWND hwndDlg, PNETIDDATA pNetIdData)
Definition: netid.c:520
#define SetDlgItemText
Definition: winuser.h:5824
TCHAR szTitle[MAX_LOADSTRING]
Definition: magnifier.c:35
#define IDD_PROPPAGECOMPNAMECHENGE
Definition: resource.h:10
#define MB_ICONINFORMATION
Definition: winuser.h:796
#define DialogBoxParam
Definition: winuser.h:5739
#define IDC_COMPUTERNAME
Definition: resource.h:15
static INT_PTR CALLBACK NetIDPageProc(IN HWND hwndDlg, IN UINT uMsg, IN WPARAM wParam, IN LPARAM lParam)
Definition: netid.c:620
static const WCHAR L[]
Definition: oid.c:1250
#define DWLP_USER
Definition: winuser.h:866
NET_API_STATUS WINAPI NetWkstaGetInfo(LMSTR servername, DWORD level, LPBYTE *bufptr)
Definition: wksta.c:472
#define MB_ICONERROR
Definition: winuser.h:781
static VOID SetFullComputerName(HWND hDlg, UINT uId, PNETIDDATA pNetIdData)
Definition: netid.c:281
#define WM_COMMAND
Definition: winuser.h:1722
static VOID SetRadioBtnState(HWND hDlg, BOOL IsDomain)
Definition: netid.c:222
BOOL WINAPI EnableWindow(_In_ HWND, _In_ BOOL)
#define MAX_COMPUTERDESCRIPTION_LENGTH
Definition: netid.c:24
static INT_PTR CALLBACK NetworkPropDlgProc(HWND hDlg, UINT Msg, WPARAM wParam, LPARAM lParam)
Definition: netid.c:452
#define MAX_COMPUTERNAME_LENGTH
Definition: winbase.h:240
_Check_return_ _CRTIMP int __cdecl wcscmp(_In_z_ const wchar_t *_Str1, _In_z_ const wchar_t *_Str2)
HWND WINAPI GetParent(_In_ HWND)
HPROPSHEETPAGE WINAPI CreateNetIDPropertyPage(VOID)
Definition: netid.c:687
NET_API_STATUS WINAPI NetApiBufferFree(LPVOID Buffer)
Definition: apibuf.c:43
static BOOL NetworkDlg_OnOK(HWND hDlg, PNETIDDATA pNetIdData)
Definition: netid.c:410
#define KEY_QUERY_VALUE
Definition: nt_native.h:1016
struct _NETIDDATA * PNETIDDATA
__int3264 LONG_PTR
Definition: mstsclib_h.h:276
#define va_start(ap, A)
Definition: acmsvcex.h:91
unsigned int UINT
Definition: ndis.h:50
#define MB_OK
Definition: winuser.h:784
#define HEAP_ZERO_MEMORY
Definition: compat.h:123
static BOOL GetComputerNames(PNETIDDATA pNetIdData)
Definition: netid.c:71
#define BST_CHECKED
Definition: winuser.h:197
#define IDD_PROPPAGEDNSANDNETBIOS
Definition: resource.h:11
#define DNS_ERROR_INVALID_NAME_CHAR
Definition: winerror.h:1877
#define SendMessage
Definition: winuser.h:5818
struct @1587 Msg[]
#define HIWORD(l)
Definition: typedefs.h:246
LONG WINAPI RegOpenKeyExW(HKEY hKey, LPCWSTR lpSubKey, DWORD ulOptions, REGSAM samDesired, PHKEY phkResult)
Definition: reg.c:3366
#define ERROR_INVALID_NAME
Definition: compat.h:93
#define GetWindowLongPtr
Definition: treelist.c:73
static VOID UpdateNetbiosName(HWND hDlg, UINT uId, PNETIDDATA pNetIdData)
Definition: netid.c:310
WCHAR * LPWSTR
Definition: xmlstorage.h:184
#define IDCANCEL
Definition: winuser.h:825
#define DNS_ERROR_NUMERIC_NAME
Definition: winerror.h:1878
#define wsprintf
Definition: winuser.h:5840
BYTE * PBYTE
Definition: pedump.c:66
#define WM_INITDIALOG
Definition: winuser.h:1721
LPARAM lParam
Definition: combotst.c:139
#define LOWORD(l)
Definition: pedump.c:82
static BOOL IsValidDomainName(HWND hDlg, UINT uId)
Definition: netid.c:127
size_t __cdecl wcslen(_In_z_ const wchar_t *_Str)
#define HeapFree(x, y, z)
Definition: compat.h:402
BOOL WINAPI SetComputerNameExW(COMPUTER_NAME_FORMAT NameType, LPCWSTR lpBuffer)
Definition: compname.c:602
PSDBQUERYRESULT_VISTA PVOID DWORD * dwSize
Definition: env.c:54
#define PROPSHEETPAGE
Definition: prsht.h:371
#define WM_NOTIFY
Definition: richedit.h:61
enum _NETSETUP_JOIN_STATUS NETSETUP_JOIN_STATUS
WCHAR szDomainName[MAX_DOMAINNAME_LENGTH+1]
Definition: netid.c:31
static INT FormatMessageBox(HWND hDlg, UINT uType, DWORD dwMessage,...)
Definition: netid.c:43
#define HKEY_LOCAL_MACHINE
Definition: winreg.h:12
#define REG_SZ
Definition: layer.c:22
#define EN_CHANGE
Definition: winuser.h:2004