ReactOS  0.4.14-dev-293-g2b39b42
netid.c File Reference
#include <stdarg.h>
#include <windef.h>
#include <winbase.h>
#include <winuser.h>
#include <winreg.h>
#include <tchar.h>
#include <lm.h>
#include <prsht.h>
#include "resource.h"
Include dependency graph for netid.c:

Go to the source code of this file.

Macros

#define WIN32_NO_STATUS
 
#define MAX_COMPUTERDESCRIPTION_LENGTH   256
 

Functions

static INT_PTR CALLBACK NetIDPageProc (IN HWND hwndDlg, IN UINT uMsg, IN WPARAM wParam, IN LPARAM lParam)
 
static INT_PTR CALLBACK DNSSuffixPropDlgProc (HWND hDlg, UINT Msg, WPARAM wParam, LPARAM lParam)
 
static VOID SetRadioBtnState (HWND hDlg, BOOL IsDomain)
 
static VOID DisableControls (HWND hDlg)
 
static BOOL IsValidComputerName (LPCWSTR s)
 
static INT_PTR CALLBACK NetworkPropDlgProc (HWND hDlg, UINT Msg, WPARAM wParam, LPARAM lParam)
 
static VOID NetIDPage_OnInitDialog (HWND hwndDlg)
 
static LONG NetIDPage_OnApply (HWND hwndDlg)
 
HPROPSHEETPAGE WINAPI CreateNetIDPropertyPage (VOID)
 
BOOL WINAPI DllMain (IN HINSTANCE hinstDLL, IN DWORD dwReason, IN LPVOID lpvReserved)
 

Variables

static HINSTANCE hDllInstance
 

Macro Definition Documentation

◆ MAX_COMPUTERDESCRIPTION_LENGTH

#define MAX_COMPUTERDESCRIPTION_LENGTH   256

Definition at line 24 of file netid.c.

◆ WIN32_NO_STATUS

#define WIN32_NO_STATUS

Definition at line 11 of file netid.c.

Function Documentation

◆ CreateNetIDPropertyPage()

HPROPSHEETPAGE WINAPI CreateNetIDPropertyPage ( VOID  )

Definition at line 428 of file netid.c.

429 {
430  PROPSHEETPAGE psp = {0};
431 
432  psp.dwSize = sizeof(psp);
433  psp.dwFlags = PSP_DEFAULT;
434  psp.hInstance = hDllInstance;
435  psp.pszTemplate = MAKEINTRESOURCE(IDD_PROPPAGECOMPUTER);
436  psp.pfnDlgProc = NetIDPageProc;
437 
438  return CreatePropertySheetPage(&psp);
439 }
#define MAKEINTRESOURCE
Definition: winuser.h:591
#define IDD_PROPPAGECOMPUTER
Definition: resource.h:12
static HINSTANCE hDllInstance
Definition: netid.c:32
#define CreatePropertySheetPage
Definition: prsht.h:381
#define PSP_DEFAULT
Definition: prsht.h:22
static INT_PTR CALLBACK NetIDPageProc(IN HWND hwndDlg, IN UINT uMsg, IN WPARAM wParam, IN LPARAM lParam)
Definition: netid.c:381
#define PROPSHEETPAGE
Definition: prsht.h:371

◆ DisableControls()

static VOID DisableControls ( HWND  hDlg)
static

Definition at line 67 of file netid.c.

68 {
69  EnableWindow(GetDlgItem(hDlg, 1008), FALSE);
70  EnableWindow(GetDlgItem(hDlg, 1004), FALSE);
71  EnableWindow(GetDlgItem(hDlg, 116), FALSE);
72  EnableWindow(GetDlgItem(hDlg, 1007), FALSE);
73 }
HWND WINAPI GetDlgItem(_In_opt_ HWND, _In_ int)
BOOL WINAPI EnableWindow(_In_ HWND, _In_ BOOL)

Referenced by NetworkPropDlgProc().

◆ DllMain()

BOOL WINAPI DllMain ( IN HINSTANCE  hinstDLL,
IN DWORD  dwReason,
IN LPVOID  lpvReserved 
)

Definition at line 442 of file netid.c.

445 {
446  switch (dwReason)
447  {
448  case DLL_PROCESS_ATTACH:
449  hDllInstance = hinstDLL;
450  DisableThreadLibraryCalls(hinstDLL);
451  break;
452  }
453 
454  return TRUE;
455 }
#define TRUE
Definition: types.h:120
BOOL WINAPI DisableThreadLibraryCalls(IN HMODULE hLibModule)
Definition: loader.c:85
#define DLL_PROCESS_ATTACH
Definition: compat.h:120
DWORD dwReason
Definition: misc.cpp:154
static HINSTANCE hDllInstance
Definition: netid.c:32

◆ DNSSuffixPropDlgProc()

static INT_PTR CALLBACK DNSSuffixPropDlgProc ( HWND  hDlg,
UINT  Msg,
WPARAM  wParam,
LPARAM  lParam 
)
static

Definition at line 37 of file netid.c.

38 {
39  switch (Msg)
40  {
41  case WM_COMMAND:
42  {
43  switch (LOWORD(wParam))
44  {
45  case IDCANCEL:
46  case IDOK:
47  EndDialog(hDlg, LOWORD(wParam));
48  break;
49  }
50  }
51  break;
52  }
53 
54  return FALSE;
55 }
#define IDOK
Definition: winuser.h:824
struct @1591 Msg[]
BOOL WINAPI EndDialog(_In_ HWND, _In_ INT_PTR)
WPARAM wParam
Definition: combotst.c:138
#define WM_COMMAND
Definition: winuser.h:1722
#define IDCANCEL
Definition: winuser.h:825
#define LOWORD(l)
Definition: pedump.c:82

Referenced by NetworkPropDlgProc().

◆ IsValidComputerName()

static BOOL IsValidComputerName ( LPCWSTR  s)
static

Definition at line 77 of file netid.c.

78 {
79  int i;
80 
81  for (i = 0; i <= wcslen(s); i++)
82  {
83  if (s[i] == L'!' || s[i] == L'@' || s[i] == L'#' || s[i] == L'$'
84  || s[i] == L'^' || s[i] == L'&' || s[i] == L'\\' || s[i] == L'|'
85  || s[i] == L')' || s[i] == L'(' || s[i] == L'{' || s[i] == L'"'
86  || s[i] == L'}' || s[i] == L'~' || s[i] == L'/' || s[i] == L'\''
87  || s[i] == L'=' || s[i] == L':' || s[i] == L';' || s[i] == L'+'
88  || s[i] == L'<' || s[i] == L'>' || s[i] == L'?' || s[i] == L'['
89  || s[i] == L']' || s[i] == L'`' || s[i] == L'%' || s[i] == L'_'
90  || s[i] == L'.')
91  return FALSE;
92  }
93 
94  return TRUE;
95 }
#define TRUE
Definition: types.h:120
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
static const WCHAR L[]
Definition: oid.c:1250
GLdouble s
Definition: gl.h:2039
size_t __cdecl wcslen(_In_z_ const wchar_t *_Str)

Referenced by NetworkPropDlgProc().

◆ NetIDPage_OnApply()

static LONG NetIDPage_OnApply ( HWND  hwndDlg)
static

Definition at line 325 of file netid.c.

327 {
328  WCHAR ComputerDescription[MAX_COMPUTERDESCRIPTION_LENGTH + 1];
329  WCHAR NewComputerDescription[MAX_COMPUTERDESCRIPTION_LENGTH + 1];
330  HKEY KeyHandle = NULL;
331  DWORD dwSize;
332  LONG lError;
333 
335  L"SYSTEM\\CurrentControlSet\\Services\\LanmanServer\\Parameters",
336  0,
338  &KeyHandle);
339  if (lError != ERROR_SUCCESS)
340  return lError;
341 
342  GetDlgItemTextW(hwndDlg,
343  IDC_COMPDESC,
344  NewComputerDescription,
345  ARRAYSIZE(NewComputerDescription));
346  if (GetLastError() != ERROR_SUCCESS)
347  {
348  lError = GetLastError();
349  goto done;
350  }
351 
352  dwSize = sizeof(ComputerDescription);
353  lError = RegQueryValueExW(KeyHandle,
354  L"srvcomment",
355  0,
356  NULL,
357  (PBYTE)ComputerDescription,
358  &dwSize);
359  if (lError != ERROR_SUCCESS && lError != ERROR_FILE_NOT_FOUND)
360  goto done;
361 
362  lError = ERROR_SUCCESS;
363  if (wcscmp(ComputerDescription, NewComputerDescription) != 0)
364  {
365  lError = RegSetValueExW(KeyHandle,
366  L"srvcomment",
367  0,
368  REG_SZ,
369  (PBYTE)NewComputerDescription,
370  (wcslen(NewComputerDescription) + 1) * sizeof(WCHAR));
371  }
372 
373 done:
374  if (KeyHandle != NULL)
376 
377  return lError;
378 }
UINT WINAPI GetDlgItemTextW(HWND hDlg, int nIDDlgItem, LPWSTR lpString, int nMaxCount)
Definition: dialog.c:2208
#define ERROR_SUCCESS
Definition: deptool.c:10
#define KEY_SET_VALUE
Definition: nt_native.h:1017
_Must_inspect_result_ _Out_ PNDIS_STATUS _In_ NDIS_HANDLE _In_ ULONG _Out_ PNDIS_STRING _Out_ PNDIS_HANDLE KeyHandle
Definition: ndis.h:4711
#define ARRAYSIZE(array)
Definition: filtermapper.c:47
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1059
LONG WINAPI RegCloseKey(HKEY hKey)
Definition: reg.c:423
long LONG
Definition: pedump.c:60
#define IDC_COMPDESC
Definition: resource.h:14
smooth NULL
Definition: ftsmooth.c:416
#define ERROR_FILE_NOT_FOUND
Definition: disk.h:79
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
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
__wchar_t WCHAR
Definition: xmlstorage.h:180
unsigned long DWORD
Definition: ntddk_ex.h:95
static const WCHAR L[]
Definition: oid.c:1250
#define MAX_COMPUTERDESCRIPTION_LENGTH
Definition: netid.c:24
_Check_return_ _CRTIMP int __cdecl wcscmp(_In_z_ const wchar_t *_Str1, _In_z_ const wchar_t *_Str2)
#define KEY_QUERY_VALUE
Definition: nt_native.h:1016
LONG WINAPI RegOpenKeyExW(HKEY hKey, LPCWSTR lpSubKey, DWORD ulOptions, REGSAM samDesired, PHKEY phkResult)
Definition: reg.c:3366
BYTE * PBYTE
Definition: pedump.c:66
size_t __cdecl wcslen(_In_z_ const wchar_t *_Str)
PSDBQUERYRESULT_VISTA PVOID DWORD * dwSize
Definition: env.c:54
#define HKEY_LOCAL_MACHINE
Definition: winreg.h:12
#define REG_SZ
Definition: layer.c:22

Referenced by NetIDPageProc().

◆ NetIDPage_OnInitDialog()

static VOID NetIDPage_OnInitDialog ( HWND  hwndDlg)
static

Definition at line 275 of file netid.c.

277 {
278  WCHAR ComputerDescription[MAX_COMPUTERDESCRIPTION_LENGTH + 1];
279  WCHAR ComputerName[MAX_COMPUTERNAME_LENGTH + 1];
280  DWORD RegSize = sizeof(ComputerDescription);
282  HKEY KeyHandle;
283  LPWKSTA_INFO_101 wki;
284  LONG lError;
285 
286  /* Display computer name and description */
288 
290  L"SYSTEM\\CurrentControlSet\\Services\\LanmanServer\\Parameters",
291  0,
293  &KeyHandle);
294  if (lError == ERROR_SUCCESS)
295  {
296  lError = RegQueryValueExW(KeyHandle,
297  L"srvcomment",
298  0,
299  NULL,
300  (LPBYTE)ComputerDescription,
301  &RegSize);
302  if (lError == ERROR_SUCCESS)
303  {
304  ComputerDescription[RegSize / sizeof(WCHAR)] = UNICODE_NULL;
305  SetDlgItemText(hwndDlg, IDC_COMPDESC, ComputerDescription);
306  }
307 
309  }
310 
311  if (GetComputerName(ComputerName, &Size))
312  {
313  SetDlgItemText(hwndDlg, IDC_COMPUTERNAME, ComputerName);
314  }
315 
316  if (NetWkstaGetInfo(NULL, 101, (LPBYTE*)&wki) == NERR_Success)
317  {
318  SetDlgItemText(hwndDlg, IDC_WORKGROUPDOMAIN_NAME, wki->wki101_langroup);
319  NetApiBufferFree(wki);
320  }
321 }
#define ERROR_SUCCESS
Definition: deptool.c:10
_Must_inspect_result_ _Out_ PNDIS_STATUS _In_ NDIS_HANDLE _In_ ULONG _Out_ PNDIS_STRING _Out_ PNDIS_HANDLE KeyHandle
Definition: ndis.h:4711
#define EM_SETLIMITTEXT
Definition: winuser.h:1993
#define GetComputerName
Definition: winbase.h:3624
#define SendDlgItemMessage
Definition: winuser.h:5743
#define NERR_Success
Definition: lmerr.h:5
#define IDC_WORKGROUPDOMAIN_NAME
Definition: resource.h:16
LONG WINAPI RegCloseKey(HKEY hKey)
Definition: reg.c:423
unsigned char * LPBYTE
Definition: typedefs.h:52
#define UNICODE_NULL
long LONG
Definition: pedump.c:60
#define IDC_COMPDESC
Definition: resource.h:14
smooth NULL
Definition: ftsmooth.c:416
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
__wchar_t WCHAR
Definition: xmlstorage.h:180
unsigned long DWORD
Definition: ntddk_ex.h:95
#define SetDlgItemText
Definition: winuser.h:5750
#define IDC_COMPUTERNAME
Definition: resource.h:15
static const WCHAR L[]
Definition: oid.c:1250
NET_API_STATUS WINAPI NetWkstaGetInfo(LMSTR servername, DWORD level, LPBYTE *bufptr)
Definition: wksta.c:472
IN PVOID IN PVOID IN USHORT IN USHORT Size
Definition: pci.h:359
#define MAX_COMPUTERDESCRIPTION_LENGTH
Definition: netid.c:24
#define MAX_COMPUTERNAME_LENGTH
Definition: winbase.h:240
NET_API_STATUS WINAPI NetApiBufferFree(LPVOID Buffer)
Definition: apibuf.c:43
#define KEY_QUERY_VALUE
Definition: nt_native.h:1016
LONG WINAPI RegOpenKeyExW(HKEY hKey, LPCWSTR lpSubKey, DWORD ulOptions, REGSAM samDesired, PHKEY phkResult)
Definition: reg.c:3366
#define HKEY_LOCAL_MACHINE
Definition: winreg.h:12

Referenced by NetIDPageProc().

◆ NetIDPageProc()

static INT_PTR CALLBACK NetIDPageProc ( IN HWND  hwndDlg,
IN UINT  uMsg,
IN WPARAM  wParam,
IN LPARAM  lParam 
)
static

Definition at line 381 of file netid.c.

385 {
386  static BOOL bEnable = FALSE;
387  INT_PTR Ret = 0;
388 
389  switch (uMsg)
390  {
391  case WM_INITDIALOG:
392  NetIDPage_OnInitDialog(hwndDlg);
393  bEnable = TRUE;
394  Ret = TRUE;
395  break;
396 
397  case WM_NOTIFY:
398  switch (((LPNMHDR)lParam)->code)
399  {
400  case PSN_APPLY:
401  NetIDPage_OnApply(hwndDlg);
402  break;
403  }
404  break;
405 
406  case WM_COMMAND:
407  switch (LOWORD(wParam))
408  {
409  case IDC_COMPDESC:
410  if (HIWORD(wParam) == EN_CHANGE && bEnable == TRUE)
411  PropSheet_Changed(GetParent(hwndDlg), hwndDlg);
412  break;
413 
417  hwndDlg,
419  break;
420  }
421  break;
422  }
423 
424  return Ret;
425 }
#define MAKEINTRESOURCE
Definition: winuser.h:591
#define TRUE
Definition: types.h:120
#define IDC_NETWORK_PROPERTY
Definition: resource.h:19
static LONG NetIDPage_OnApply(HWND hwndDlg)
Definition: netid.c:325
#define PSN_APPLY
Definition: prsht.h:117
int32_t INT_PTR
Definition: typedefs.h:62
WPARAM wParam
Definition: combotst.c:138
static VOID NetIDPage_OnInitDialog(HWND hwndDlg)
Definition: netid.c:275
#define DialogBox
Definition: winuser.h:5662
unsigned int BOOL
Definition: ntddk_ex.h:94
#define IDC_COMPDESC
Definition: resource.h:14
static HINSTANCE hDllInstance
Definition: netid.c:32
#define PropSheet_Changed(d, w)
Definition: prsht.h:326
#define IDD_PROPPAGECOMPNAMECHENGE
Definition: resource.h:10
#define WM_COMMAND
Definition: winuser.h:1722
static INT_PTR CALLBACK NetworkPropDlgProc(HWND hDlg, UINT Msg, WPARAM wParam, LPARAM lParam)
Definition: netid.c:99
HWND WINAPI GetParent(_In_ HWND)
_In_ BOOL bEnable
Definition: winddi.h:3426
#define HIWORD(l)
Definition: typedefs.h:246
#define WM_INITDIALOG
Definition: winuser.h:1721
LPARAM lParam
Definition: combotst.c:139
#define LOWORD(l)
Definition: pedump.c:82
#define WM_NOTIFY
Definition: richedit.h:61
#define EN_CHANGE
Definition: winuser.h:2004

Referenced by CreateNetIDPropertyPage(), and NetworkPropDlgProc().

◆ NetworkPropDlgProc()

static INT_PTR CALLBACK NetworkPropDlgProc ( HWND  hDlg,
UINT  Msg,
WPARAM  wParam,
LPARAM  lParam 
)
static

Definition at line 99 of file netid.c.

100 {
101  switch (Msg)
102  {
103  case WM_INITDIALOG:
104  {
105  LPWKSTA_INFO_101 wki = NULL;
107  TCHAR ComputerName[MAX_COMPUTERNAME_LENGTH + 1];
108  TCHAR MsgText[MAX_PATH * 2];
109  LPWSTR JoinName;
110  NETSETUP_JOIN_STATUS JoinStatus;
111 
112  if (LoadString(hDllInstance, 25, MsgText, sizeof(MsgText) / sizeof(TCHAR)))
113  SetDlgItemText(hDlg, 1017, MsgText);
114 
116 
117  if (GetComputerName(ComputerName, &Size))
118  {
119  SetDlgItemText(hDlg, 1002, ComputerName);
120  SetDlgItemText(hDlg, 1001, ComputerName);
121  }
122 
123  if (NetGetJoinInformation(NULL, &JoinName, &JoinStatus) != NERR_Success)
124  {
125  SetRadioBtnState(hDlg, FALSE);
126 
127  if (NetWkstaGetInfo(NULL,
128  101,
129  (LPBYTE*)&wki) == NERR_Success)
130  {
131  SetDlgItemText(hDlg,
132  1007,
133  wki->wki101_langroup);
134  }
135  else DisableControls(hDlg);
136 
137  if (wki) NetApiBufferFree(wki);
138  }
139  else
140  {
141  switch (JoinStatus)
142  {
143  case NetSetupDomainName:
144  SetDlgItemText(hDlg, 116, JoinName);
145  SetRadioBtnState(hDlg, TRUE);
146  break;
147 
149  SetDlgItemText(hDlg, 1007, JoinName);
150  SetRadioBtnState(hDlg, FALSE);
151  break;
152 
153  case NetSetupUnjoined:
154  break;
155 
157  default:
158  {
159  SetRadioBtnState(hDlg, FALSE);
160 
161  if (NetWkstaGetInfo(NULL,
162  101,
163  (LPBYTE*)&wki) == NERR_Success)
164  {
165  SetDlgItemText(hDlg,
166  1007,
167  wki->wki101_langroup);
168  }
169  else DisableControls(hDlg);
170 
171  if (wki) NetApiBufferFree(wki);
172  break;
173  }
174  }
175 
176  if (JoinName) NetApiBufferFree(JoinName);
177  }
178  }
179  break;
180 
181  case WM_COMMAND:
182  {
183  switch (LOWORD(wParam))
184  {
185  case 1002:
186  if (HIWORD(wParam) == EN_CHANGE)
187  {
189 
191  SetDlgItemText(hDlg, 1001, szText);
192  }
193  break;
194 
195  case 1008: /* Domain radio button */
196  case 1004: /* Workgroup radio button */
197  if (SendDlgItemMessage(hDlg, 1008, BM_GETCHECK, 0, 0) == BST_CHECKED)
198  SetRadioBtnState(hDlg, TRUE);
199  else
200  SetRadioBtnState(hDlg, FALSE);
201  break;
202 
203  case 1003:
206  hDlg,
208  break;
209 
210  case IDOK:
211  {
213  TCHAR ComputerName[MAX_COMPUTERNAME_LENGTH + 1];
214  TCHAR NewComputerName[MAX_COMPUTERNAME_LENGTH + 1];
215 
216  if (GetComputerName(ComputerName, &Size))
217  {
218  if (GetWindowText(GetDlgItem(hDlg, 1002),
219  NewComputerName,
221  {
222  if (_tcscmp(ComputerName, NewComputerName) != 0)
223  {
224  if (!IsValidComputerName(NewComputerName))
225  {
226  TCHAR szText[MAX_PATH], szMsgText[MAX_PATH];
227 
228  LoadString(hDllInstance, 1030, szText, sizeof(szText) / sizeof(TCHAR));
229 
230  swprintf(szMsgText, szText, NewComputerName);
231  MessageBox(hDlg, szMsgText, NULL, MB_OK | MB_ICONERROR);
232  SetFocus(GetDlgItem(hDlg, 1002));
233  break;
234  }
235  else if (!SetComputerNameExW(ComputerNamePhysicalDnsHostname, NewComputerName))
236  {
237  TCHAR szMsgText[MAX_PATH];
238 
239  LoadString(hDllInstance, 4001, szMsgText, sizeof(szMsgText) / sizeof(TCHAR));
240 
241  MessageBox(hDlg, szMsgText, NULL, MB_OK | MB_ICONERROR);
242  }
243  else
244  {
245  TCHAR szMsgTitle[MAX_PATH], szMsgText[MAX_PATH];
246 
247  LoadString(hDllInstance, 4000, szMsgTitle, sizeof(szMsgTitle) / sizeof(TCHAR));
248  LoadString(hDllInstance, 24, szMsgText, sizeof(szMsgText) / sizeof(TCHAR));
249 
250  MessageBox(hDlg, szMsgText, szMsgTitle, MB_OK | MB_ICONINFORMATION);
251 
252  NetIDPageProc(GetParent(hDlg), WM_INITDIALOG, 0, 0);
253  }
254  }
255  }
256  }
257 
258  EndDialog(hDlg, LOWORD(wParam));
259  }
260  break;
261 
262  case IDCANCEL:
263  EndDialog(hDlg, LOWORD(wParam));
264  break;
265  }
266  }
267  break;
268  }
269 
270  return FALSE;
271 }
#define MAKEINTRESOURCE
Definition: winuser.h:591
#define TRUE
Definition: types.h:120
#define IDOK
Definition: winuser.h:824
static VOID DisableControls(HWND hDlg)
Definition: netid.c:67
int _tcscmp(const _TCHAR *s1, const _TCHAR *s2)
Definition: tcscmp.h:8
#define EM_SETLIMITTEXT
Definition: winuser.h:1993
struct @1591 Msg[]
#define GetComputerName
Definition: winbase.h:3624
HWND WINAPI SetFocus(_In_opt_ HWND)
#define SendDlgItemMessage
Definition: winuser.h:5743
NET_API_STATUS NET_API_FUNCTION NetGetJoinInformation(LPCWSTR Server, LPWSTR *Name, PNETSETUP_JOIN_STATUS type)
Definition: wksta.c:559
BOOL WINAPI EndDialog(_In_ HWND, _In_ INT_PTR)
WPARAM wParam
Definition: combotst.c:138
#define GetWindowText
Definition: winuser.h:5699
#define NERR_Success
Definition: lmerr.h:5
#define DialogBox
Definition: winuser.h:5662
unsigned char * LPBYTE
Definition: typedefs.h:52
static const WCHAR szText[]
Definition: dialog.c:139
smooth NULL
Definition: ftsmooth.c:416
static INT_PTR CALLBACK DNSSuffixPropDlgProc(HWND hDlg, UINT Msg, WPARAM wParam, LPARAM lParam)
Definition: netid.c:37
#define BM_GETCHECK
Definition: winuser.h:1900
static HINSTANCE hDllInstance
Definition: netid.c:32
char TCHAR
Definition: xmlstorage.h:189
HWND WINAPI GetDlgItem(_In_opt_ HWND, _In_ int)
enum tagNETSETUP_JOIN_STATUS NETSETUP_JOIN_STATUS
#define MAX_PATH
Definition: compat.h:26
#define swprintf(buf, format,...)
Definition: sprintf.c:56
unsigned long DWORD
Definition: ntddk_ex.h:95
#define SetDlgItemText
Definition: winuser.h:5750
#define MB_ICONINFORMATION
Definition: winuser.h:796
static INT_PTR CALLBACK NetIDPageProc(IN HWND hwndDlg, IN UINT uMsg, IN WPARAM wParam, IN LPARAM lParam)
Definition: netid.c:381
NET_API_STATUS WINAPI NetWkstaGetInfo(LMSTR servername, DWORD level, LPBYTE *bufptr)
Definition: wksta.c:472
#define MB_ICONERROR
Definition: winuser.h:781
#define MessageBox
Definition: winuser.h:5723
#define WM_COMMAND
Definition: winuser.h:1722
IN PVOID IN PVOID IN USHORT IN USHORT Size
Definition: pci.h:359
static VOID SetRadioBtnState(HWND hDlg, BOOL IsDomain)
Definition: netid.c:58
#define MAX_COMPUTERNAME_LENGTH
Definition: winbase.h:240
HWND WINAPI GetParent(_In_ HWND)
NET_API_STATUS WINAPI NetApiBufferFree(LPVOID Buffer)
Definition: apibuf.c:43
#define MB_OK
Definition: winuser.h:784
#define BST_CHECKED
Definition: winuser.h:197
#define IDD_PROPPAGEDNSANDNETBIOS
Definition: resource.h:11
#define SendMessage
Definition: winuser.h:5744
#define HIWORD(l)
Definition: typedefs.h:246
WCHAR * LPWSTR
Definition: xmlstorage.h:184
#define IDCANCEL
Definition: winuser.h:825
#define WM_INITDIALOG
Definition: winuser.h:1721
#define LOWORD(l)
Definition: pedump.c:82
BOOL WINAPI SetComputerNameExW(COMPUTER_NAME_FORMAT NameType, LPCWSTR lpBuffer)
Definition: compname.c:592
#define LoadString
Definition: winuser.h:5720
static BOOL IsValidComputerName(LPCWSTR s)
Definition: netid.c:77
#define EN_CHANGE
Definition: winuser.h:2004

Referenced by NetIDPageProc().

◆ SetRadioBtnState()

static VOID SetRadioBtnState ( HWND  hDlg,
BOOL  IsDomain 
)
static

Definition at line 58 of file netid.c.

59 {
60  SendDlgItemMessage(hDlg, 1008, BM_SETCHECK, (WPARAM)IsDomain, 0);
61  SendDlgItemMessage(hDlg, 1004, BM_SETCHECK, (WPARAM)!IsDomain, 0);
62  EnableWindow(GetDlgItem(hDlg, 116), IsDomain);
63  EnableWindow(GetDlgItem(hDlg, 1007), !IsDomain);
64 }
UINT_PTR WPARAM
Definition: windef.h:207
#define SendDlgItemMessage
Definition: winuser.h:5743
#define BM_SETCHECK
Definition: winuser.h:1903
HWND WINAPI GetDlgItem(_In_opt_ HWND, _In_ int)
BOOL WINAPI EnableWindow(_In_ HWND, _In_ BOOL)

Referenced by NetworkPropDlgProc().

Variable Documentation

◆ hDllInstance

HINSTANCE hDllInstance
static

Definition at line 32 of file netid.c.

Referenced by CreateNetIDPropertyPage(), DllMain(), NetIDPageProc(), and NetworkPropDlgProc().