ReactOS  0.4.15-dev-1070-ge1a01de
compname.c File Reference
#include <k32.h>
#include <windns.h>
#include <debug.h>
Include dependency graph for compname.c:

Go to the source code of this file.

Macros

#define NDEBUG
 
#define MAX_COMPUTER_NAME_EX   64
 

Typedefs

typedef NTSTATUS(WINAPIFN_DnsValidateName_W) (LPCWSTR, DNS_NAME_FORMAT)
 

Functions

static BOOL GetComputerNameFromRegistry (LPWSTR RegistryKey, LPWSTR ValueNameStr, LPWSTR lpBuffer, LPDWORD nSize)
 
static BOOL SetActiveComputerNameToRegistry (LPCWSTR RegistryKey, LPCWSTR SubKey, LPCWSTR ValueNameStr, LPCWSTR lpBuffer)
 
BOOL WINAPI GetComputerNameExW (COMPUTER_NAME_FORMAT NameType, LPWSTR lpBuffer, LPDWORD nSize)
 
BOOL WINAPI GetComputerNameExA (COMPUTER_NAME_FORMAT NameType, LPSTR lpBuffer, LPDWORD nSize)
 
BOOL WINAPI GetComputerNameA (LPSTR lpBuffer, LPDWORD lpnSize)
 
BOOL WINAPI GetComputerNameW (LPWSTR lpBuffer, LPDWORD lpnSize)
 
static BOOL BaseVerifyDnsName (LPCWSTR lpDnsName)
 
static BOOL IsValidComputerName (COMPUTER_NAME_FORMAT NameType, LPCWSTR lpComputerName)
 
static BOOL SetComputerNameToRegistry (LPCWSTR RegistryKey, LPCWSTR ValueNameStr, LPCWSTR lpBuffer)
 
BOOL WINAPI SetComputerNameA (LPCSTR lpComputerName)
 
BOOL WINAPI SetComputerNameW (LPCWSTR lpComputerName)
 
BOOL WINAPI SetComputerNameExA (COMPUTER_NAME_FORMAT NameType, LPCSTR lpBuffer)
 
BOOL WINAPI SetComputerNameExW (COMPUTER_NAME_FORMAT NameType, LPCWSTR lpBuffer)
 
BOOL WINAPI DnsHostnameToComputerNameA (LPCSTR Hostname, LPSTR ComputerName, LPDWORD nSize)
 
BOOL WINAPI DnsHostnameToComputerNameW (LPCWSTR hostname, LPWSTR computername, LPDWORD size)
 
DWORD WINAPI AddLocalAlternateComputerNameA (LPSTR lpName, PNTSTATUS Status)
 
DWORD WINAPI AddLocalAlternateComputerNameW (LPWSTR lpName, PNTSTATUS Status)
 
DWORD WINAPI EnumerateLocalComputerNamesA (PVOID pUnknown, DWORD Size, LPSTR lpBuffer, LPDWORD lpnSize)
 
DWORD WINAPI EnumerateLocalComputerNamesW (PVOID pUnknown, DWORD Size, LPWSTR lpBuffer, LPDWORD lpnSize)
 
DWORD WINAPI RemoveLocalAlternateComputerNameA (LPSTR lpName, DWORD Unknown)
 
DWORD WINAPI RemoveLocalAlternateComputerNameW (LPWSTR lpName, DWORD Unknown)
 
BOOL WINAPI SetLocalPrimaryComputerNameA (IN DWORD Unknown1, IN DWORD Unknown2)
 
BOOL WINAPI SetLocalPrimaryComputerNameW (IN DWORD Unknown1, IN DWORD Unknown2)
 

Macro Definition Documentation

◆ MAX_COMPUTER_NAME_EX

#define MAX_COMPUTER_NAME_EX   64

◆ NDEBUG

#define NDEBUG

Definition at line 33 of file compname.c.

Typedef Documentation

◆ FN_DnsValidateName_W

typedef NTSTATUS(WINAPI * FN_DnsValidateName_W) (LPCWSTR, DNS_NAME_FORMAT)

Definition at line 36 of file compname.c.

Function Documentation

◆ AddLocalAlternateComputerNameA()

DWORD WINAPI AddLocalAlternateComputerNameA ( LPSTR  lpName,
PNTSTATUS  Status 
)

Definition at line 760 of file compname.c.

761 {
762  STUB;
763  return 0;
764 }
#define STUB
Definition: kernel32.h:27

◆ AddLocalAlternateComputerNameW()

DWORD WINAPI AddLocalAlternateComputerNameW ( LPWSTR  lpName,
PNTSTATUS  Status 
)

Definition at line 768 of file compname.c.

769 {
770  STUB;
771  return 0;
772 }
#define STUB
Definition: kernel32.h:27

◆ BaseVerifyDnsName()

static BOOL BaseVerifyDnsName ( LPCWSTR  lpDnsName)
static

Definition at line 459 of file compname.c.

460 {
461  HINSTANCE hDNSAPI;
462  FN_DnsValidateName_W fnValidate;
464  BOOL ret = FALSE;
465 
466  hDNSAPI = LoadLibraryW(L"dnsapi.dll");
467  if (hDNSAPI == NULL)
468  return FALSE;
469 
470  fnValidate = (FN_DnsValidateName_W)GetProcAddress(hDNSAPI, "DnsValidateName_W");
471  if (fnValidate)
472  {
473  Status = (*fnValidate)(lpDnsName, DnsNameHostnameLabel);
475  ret = TRUE;
476  }
477 
478  FreeLibrary(hDNSAPI);
479 
480  return ret;
481 }
#define TRUE
Definition: types.h:120
LONG NTSTATUS
Definition: precomp.h:26
#define DNS_ERROR_NON_RFC_NAME
Definition: winerror.h:1872
NTSTATUS(WINAPI * FN_DnsValidateName_W)(LPCWSTR, DNS_NAME_FORMAT)
Definition: compname.c:36
#define FALSE
Definition: types.h:117
unsigned int BOOL
Definition: ntddk_ex.h:94
#define LoadLibraryW(x)
Definition: compat.h:495
smooth NULL
Definition: ftsmooth.c:416
#define FreeLibrary(x)
Definition: compat.h:496
int ret
Status
Definition: gdiplustypes.h:24
static const WCHAR L[]
Definition: oid.c:1250
#define GetProcAddress(x, y)
Definition: compat.h:501
return STATUS_SUCCESS
Definition: btrfs.c:3014

Referenced by IsValidComputerName().

◆ DnsHostnameToComputerNameA()

BOOL WINAPI DnsHostnameToComputerNameA ( LPCSTR  Hostname,
LPSTR  ComputerName,
LPDWORD  nSize 
)

Definition at line 697 of file compname.c.

700 {
701  DWORD len;
702 
703  DPRINT("(%s, %p, %p)\n", Hostname, ComputerName, nSize);
704 
705  if (!Hostname || !nSize)
706  return FALSE;
707 
708  len = lstrlenA(Hostname);
709 
712 
713  if (*nSize < len)
714  {
715  *nSize = len;
716  return FALSE;
717  }
718 
719  if (!ComputerName) return FALSE;
720 
721  memcpy(ComputerName, Hostname, len);
722  ComputerName[len + 1] = 0;
723  return TRUE;
724 }
#define TRUE
Definition: types.h:120
*nSize LPSTR _Inout_ LPDWORD nSize
Definition: winbase.h:2037
#define FALSE
Definition: types.h:117
void DPRINT(...)
Definition: polytest.cpp:61
unsigned long DWORD
Definition: ntddk_ex.h:95
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
GLenum GLsizei len
Definition: glext.h:6722
#define MAX_COMPUTERNAME_LENGTH
Definition: winbase.h:240
int WINAPI lstrlenA(LPCSTR lpString)
Definition: lstring.c:145

◆ DnsHostnameToComputerNameW()

BOOL WINAPI DnsHostnameToComputerNameW ( LPCWSTR  hostname,
LPWSTR  computername,
LPDWORD  size 
)

Definition at line 732 of file compname.c.

735 {
736  DWORD len;
737 
738  DPRINT("(%s, %p, %p): stub\n", hostname, computername, size);
739 
740  if (!hostname || !size) return FALSE;
741  len = lstrlenW(hostname);
742 
745 
746  if (*size < len)
747  {
748  *size = len;
749  return FALSE;
750  }
751  if (!computername) return FALSE;
752 
753  memcpy(computername, hostname, len * sizeof(WCHAR));
754  computername[len + 1] = 0;
755  return TRUE;
756 }
#define TRUE
Definition: types.h:120
#define lstrlenW
Definition: compat.h:498
char * hostname
Definition: ftp.c:88
#define FALSE
Definition: types.h:117
void DPRINT(...)
Definition: polytest.cpp:61
GLsizeiptr size
Definition: glext.h:5919
__wchar_t WCHAR
Definition: xmlstorage.h:180
unsigned long DWORD
Definition: ntddk_ex.h:95
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
GLenum GLsizei len
Definition: glext.h:6722
#define MAX_COMPUTERNAME_LENGTH
Definition: winbase.h:240

Referenced by UpdateNetbiosName().

◆ EnumerateLocalComputerNamesA()

DWORD WINAPI EnumerateLocalComputerNamesA ( PVOID  pUnknown,
DWORD  Size,
LPSTR  lpBuffer,
LPDWORD  lpnSize 
)

Definition at line 776 of file compname.c.

777 {
778  STUB;
780 }
#define STUB
Definition: kernel32.h:27
#define ERROR_CALL_NOT_IMPLEMENTED
Definition: compat.h:102

◆ EnumerateLocalComputerNamesW()

DWORD WINAPI EnumerateLocalComputerNamesW ( PVOID  pUnknown,
DWORD  Size,
LPWSTR  lpBuffer,
LPDWORD  lpnSize 
)

Definition at line 784 of file compname.c.

785 {
786  STUB;
788 }
#define STUB
Definition: kernel32.h:27
#define ERROR_CALL_NOT_IMPLEMENTED
Definition: compat.h:102

◆ GetComputerNameA()

BOOL WINAPI GetComputerNameA ( LPSTR  lpBuffer,
LPDWORD  lpnSize 
)

Definition at line 429 of file compname.c.

430 {
431  BOOL ret;
432 
433  ret = GetComputerNameExA(ComputerNameNetBIOS, lpBuffer, lpnSize);
434  if (!ret && GetLastError() == ERROR_MORE_DATA)
436 
437  return ret;
438 }
#define ERROR_BUFFER_OVERFLOW
Definition: winerror.h:185
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1044
unsigned int BOOL
Definition: ntddk_ex.h:94
static LPSTR PULONG lpnSize
Definition: secur32.c:50
static TAGREF LPCWSTR LPDWORD LPVOID lpBuffer
Definition: db.cpp:173
#define SetLastError(x)
Definition: compat.h:500
int ret
#define ERROR_MORE_DATA
Definition: dderror.h:13
BOOL WINAPI GetComputerNameExA(COMPUTER_NAME_FORMAT NameType, LPSTR lpBuffer, LPDWORD nSize)
Definition: compname.c:376

◆ GetComputerNameExA()

BOOL WINAPI GetComputerNameExA ( COMPUTER_NAME_FORMAT  NameType,
LPSTR  lpBuffer,
LPDWORD  nSize 
)

Definition at line 376 of file compname.c.

379 {
382  BOOL Result;
383  PWCHAR TempBuffer = NULL;
384 
385  if ((nSize == NULL) ||
386  (lpBuffer == NULL && *nSize > 0))
387  {
389  return FALSE;
390  }
391 
392  if (*nSize > 0)
393  {
394  TempBuffer = RtlAllocateHeap(RtlGetProcessHeap(), 0, *nSize * sizeof(WCHAR));
395  if (!TempBuffer)
396  {
398  return FALSE;
399  }
400  }
401 
402  AnsiString.MaximumLength = (USHORT)*nSize;
403  AnsiString.Length = 0;
404  AnsiString.Buffer = lpBuffer;
405 
406  Result = GetComputerNameExW(NameType, TempBuffer, nSize);
407 
408  if (Result)
409  {
410  UnicodeString.MaximumLength = (USHORT)*nSize * sizeof(WCHAR) + sizeof(WCHAR);
411  UnicodeString.Length = (USHORT)*nSize * sizeof(WCHAR);
412  UnicodeString.Buffer = TempBuffer;
413 
415  &UnicodeString,
416  FALSE);
417  }
418 
419  RtlFreeHeap(RtlGetProcessHeap(), 0, TempBuffer);
420 
421  return Result;
422 }
#define ERROR_INVALID_PARAMETER
Definition: compat.h:101
*BytesInUnicodeString PWCH UnicodeString
Definition: rtlfuncs.h:1979
*nSize LPSTR _Inout_ LPDWORD nSize
Definition: winbase.h:2037
BOOLEAN NTAPI RtlFreeHeap(IN PVOID HeapHandle, IN ULONG Flags, IN PVOID HeapBase)
Definition: heap.c:606
#define ERROR_NOT_ENOUGH_MEMORY
Definition: dderror.h:7
uint16_t * PWCHAR
Definition: typedefs.h:56
BOOL WINAPI GetComputerNameExW(COMPUTER_NAME_FORMAT NameType, LPWSTR lpBuffer, LPDWORD nSize)
Definition: compname.c:216
#define FALSE
Definition: types.h:117
unsigned int BOOL
Definition: ntddk_ex.h:94
static TAGREF LPCWSTR LPDWORD LPVOID lpBuffer
Definition: db.cpp:173
smooth NULL
Definition: ftsmooth.c:416
_At_(*)(_In_ PWSK_CLIENT Client, _In_opt_ PUNICODE_STRING NodeName, _In_opt_ PUNICODE_STRING ServiceName, _In_opt_ ULONG NameSpace, _In_opt_ GUID *Provider, _In_opt_ PADDRINFOEXW Hints, _Outptr_ PADDRINFOEXW *Result, _In_opt_ PEPROCESS OwningProcess, _In_opt_ PETHREAD OwningThread, _Inout_ PIRP Irp Result)(Mem)) NTSTATUS(WSKAPI *PFN_WSK_GET_ADDRESS_INFO
Definition: wsk.h:426
NTSYSAPI NTSTATUS NTAPI RtlUnicodeStringToAnsiString(PANSI_STRING DestinationString, PUNICODE_STRING SourceString, BOOLEAN AllocateDestinationString)
PVOID NTAPI RtlAllocateHeap(IN PVOID HeapHandle, IN ULONG Flags, IN SIZE_T Size)
Definition: heap.c:588
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define SetLastError(x)
Definition: compat.h:500
unsigned short USHORT
Definition: pedump.c:61
ACPI_PHYSICAL_ADDRESS ACPI_SIZE BOOLEAN Warn BOOLEAN Physical UINT32 ACPI_TABLE_HEADER *OutTableHeader ACPI_TABLE_HEADER **OutTable ACPI_HANDLE UINT32 ACPI_WALK_CALLBACK ACPI_WALK_CALLBACK void void **ReturnValue UINT32 NameType
Definition: acpixf.h:654

Referenced by get_computer_name(), GetComputerNameA(), ShowInfo(), START_TEST(), test_getaddrinfo(), TestGetComputerNameEx(), and TestReturnValues().

◆ GetComputerNameExW()

BOOL WINAPI GetComputerNameExW ( COMPUTER_NAME_FORMAT  NameType,
LPWSTR  lpBuffer,
LPDWORD  nSize 
)

Definition at line 216 of file compname.c.

219 {
220  UNICODE_STRING ResultString;
221  UNICODE_STRING DomainPart;
224  BOOL ret = TRUE;
225  DWORD HostSize;
226 
227  if ((nSize == NULL) ||
228  (lpBuffer == NULL && *nSize > 0))
229  {
231  return FALSE;
232  }
233 
234  switch (NameType)
235  {
236  case ComputerNameNetBIOS:
237  ret = GetComputerNameFromRegistry(L"\\Registry\\Machine\\System\\CurrentControlSet"
238  L"\\Control\\ComputerName\\ActiveComputerName",
239  L"ComputerName",
240  lpBuffer,
241  nSize);
242  if ((ret == FALSE) &&
244  {
245  ret = GetComputerNameFromRegistry(L"\\Registry\\Machine\\System\\CurrentControlSet"
246  L"\\Control\\ComputerName\\ComputerName",
247  L"ComputerName",
248  lpBuffer,
249  nSize);
250  if (ret)
251  {
252  ret = SetActiveComputerNameToRegistry(L"\\Registry\\Machine\\System\\CurrentControlSet"
253  L"\\Control\\ComputerName",
254  L"ActiveComputerName",
255  L"ComputerName",
256  lpBuffer);
257  }
258  }
259  return ret;
260 
261  case ComputerNameDnsDomain:
262  return GetComputerNameFromRegistry(L"\\Registry\\Machine\\System\\CurrentControlSet"
263  L"\\Services\\Tcpip\\Parameters",
264  L"Domain",
265  lpBuffer,
266  nSize);
267 
268  case ComputerNameDnsFullyQualified:
269  ResultString.Length = 0;
270  ResultString.MaximumLength = (USHORT)*nSize * sizeof(WCHAR);
271  ResultString.Buffer = lpBuffer;
272 
274  RtlInitUnicodeString(&DomainPart, NULL);
275 
276  QueryTable[0].Name = L"HostName";
278  QueryTable[0].EntryContext = &DomainPart;
279 
281  L"\\Registry\\Machine\\System"
282  L"\\CurrentControlSet\\Services\\Tcpip"
283  L"\\Parameters",
284  QueryTable,
285  NULL,
286  NULL);
287 
288  if (NT_SUCCESS(Status))
289  {
290  Status = RtlAppendUnicodeStringToString(&ResultString, &DomainPart);
291  HostSize = DomainPart.Length;
292 
293  if (!NT_SUCCESS(Status))
294  {
295  ret = FALSE;
296  }
297 
298  RtlAppendUnicodeToString(&ResultString, L".");
299  RtlFreeUnicodeString(&DomainPart);
300 
301  RtlInitUnicodeString(&DomainPart, NULL);
302  QueryTable[0].Name = L"Domain";
304  QueryTable[0].EntryContext = &DomainPart;
305 
307  L"\\Registry\\Machine\\System"
308  L"\\CurrentControlSet\\Services\\Tcpip"
309  L"\\Parameters",
310  QueryTable,
311  NULL,
312  NULL);
313 
314  if (NT_SUCCESS(Status))
315  {
316  Status = RtlAppendUnicodeStringToString(&ResultString, &DomainPart);
317  if ((!NT_SUCCESS(Status)) || (!ret))
318  {
319  *nSize = HostSize + DomainPart.Length;
321  RtlFreeUnicodeString(&DomainPart);
322  return FALSE;
323  }
324  RtlFreeUnicodeString(&DomainPart);
325  *nSize = ResultString.Length / sizeof(WCHAR) - 1;
326  return TRUE;
327  }
328  }
329  return FALSE;
330 
331  case ComputerNameDnsHostname:
332  return GetComputerNameFromRegistry(L"\\Registry\\Machine\\System\\CurrentControlSet"
333  L"\\Services\\Tcpip\\Parameters",
334  L"Hostname",
335  lpBuffer,
336  nSize);
337 
338  case ComputerNamePhysicalDnsDomain:
339  return GetComputerNameFromRegistry(L"\\Registry\\Machine\\System\\CurrentControlSet"
340  L"\\Services\\Tcpip\\Parameters",
341  L"NV Domain",
342  lpBuffer,
343  nSize);
344 
345  /* XXX Redo this */
346  case ComputerNamePhysicalDnsFullyQualified:
347  return GetComputerNameExW(ComputerNameDnsFullyQualified,
348  lpBuffer,
349  nSize);
350 
351  case ComputerNamePhysicalDnsHostname:
352  return GetComputerNameFromRegistry(L"\\Registry\\Machine\\System\\CurrentControlSet"
353  L"\\Services\\Tcpip\\Parameters",
354  L"NV Hostname",
355  lpBuffer,
356  nSize);
357 
358  /* XXX Redo this */
359  case ComputerNamePhysicalNetBIOS:
360  return GetComputerNameExW(ComputerNameNetBIOS,
361  lpBuffer,
362  nSize);
363 
364  case ComputerNameMax:
365  return FALSE;
366  }
367 
368  return FALSE;
369 }
#define ERROR_INVALID_PARAMETER
Definition: compat.h:101
_In_ PCWSTR _Inout_ _At_ QueryTable _Pre_unknown_ PRTL_QUERY_REGISTRY_TABLE QueryTable
Definition: rtlfuncs.h:4142
NTSYSAPI NTSTATUS WINAPI RtlQueryRegistryValues(ULONG, PCWSTR, PRTL_QUERY_REGISTRY_TABLE, PVOID, PVOID)
USHORT MaximumLength
Definition: env_spec_w32.h:370
#define TRUE
Definition: types.h:120
*nSize LPSTR _Inout_ LPDWORD nSize
Definition: winbase.h:2037
LONG NTSTATUS
Definition: precomp.h:26
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1044
BOOL WINAPI GetComputerNameExW(COMPUTER_NAME_FORMAT NameType, LPWSTR lpBuffer, LPDWORD nSize)
Definition: compname.c:216
#define FALSE
Definition: types.h:117
unsigned int BOOL
Definition: ntddk_ex.h:94
static TAGREF LPCWSTR LPDWORD LPVOID lpBuffer
Definition: db.cpp:173
smooth NULL
Definition: ftsmooth.c:416
NTSTATUS RtlAppendUnicodeToString(IN PUNICODE_STRING Str1, IN PWSTR Str2)
Definition: string_lib.cpp:62
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
unsigned long DWORD
Definition: ntddk_ex.h:95
NTSYSAPI VOID NTAPI RtlFreeUnicodeString(PUNICODE_STRING UnicodeString)
#define SetLastError(x)
Definition: compat.h:500
static BOOL SetActiveComputerNameToRegistry(LPCWSTR RegistryKey, LPCWSTR SubKey, LPCWSTR ValueNameStr, LPCWSTR lpBuffer)
Definition: compname.c:131
int ret
Status
Definition: gdiplustypes.h:24
static const WCHAR L[]
Definition: oid.c:1250
#define RTL_REGISTRY_ABSOLUTE
Definition: nt_native.h:161
#define ERROR_MORE_DATA
Definition: dderror.h:13
unsigned short USHORT
Definition: pedump.c:61
NTSYSAPI NTSTATUS NTAPI RtlAppendUnicodeStringToString(PUNICODE_STRING Destination, PUNICODE_STRING Source)
NTSYSAPI VOID NTAPI RtlInitUnicodeString(PUNICODE_STRING DestinationString, PCWSTR SourceString)
#define RtlZeroMemory(Destination, Length)
Definition: typedefs.h:262
ACPI_PHYSICAL_ADDRESS ACPI_SIZE BOOLEAN Warn BOOLEAN Physical UINT32 ACPI_TABLE_HEADER *OutTableHeader ACPI_TABLE_HEADER **OutTable ACPI_HANDLE UINT32 ACPI_WALK_CALLBACK ACPI_WALK_CALLBACK void void **ReturnValue UINT32 NameType
Definition: acpixf.h:654
static BOOL GetComputerNameFromRegistry(LPWSTR RegistryKey, LPWSTR ValueNameStr, LPWSTR lpBuffer, LPDWORD nSize)
Definition: compname.c:42
#define RTL_QUERY_REGISTRY_DIRECT
Definition: nt_native.h:144

Referenced by _LocalGetPrintServerHandleData(), GetComputerNameExA(), GetComputerNameW(), NSP_GetHostNameHeapAllocW(), test_GetAddrInfoW(), TestGetComputerNameEx(), and wmain().

◆ GetComputerNameFromRegistry()

static BOOL GetComputerNameFromRegistry ( LPWSTR  RegistryKey,
LPWSTR  ValueNameStr,
LPWSTR  lpBuffer,
LPDWORD  nSize 
)
static

Definition at line 42 of file compname.c.

46 {
52  ULONG KeyInfoSize;
53  ULONG ReturnSize;
55 
56  if (lpBuffer != NULL && *nSize > 0)
57  lpBuffer[0] = 0;
58 
59  RtlInitUnicodeString(&KeyName, RegistryKey);
61  &KeyName,
63  NULL,
64  NULL);
65 
67  KEY_READ,
69  if (!NT_SUCCESS(Status))
70  {
72  return FALSE;
73  }
74 
75  KeyInfoSize = sizeof(KEY_VALUE_PARTIAL_INFORMATION) + *nSize * sizeof(WCHAR);
76  KeyInfo = RtlAllocateHeap(RtlGetProcessHeap(), 0, KeyInfoSize);
77  if (KeyInfo == NULL)
78  {
81  return FALSE;
82  }
83 
84  RtlInitUnicodeString(&ValueName, ValueNameStr);
85 
87  &ValueName,
89  KeyInfo,
90  KeyInfoSize,
91  &ReturnSize);
92 
94 
95  if (!NT_SUCCESS(Status))
96  {
97  *nSize = (ReturnSize - FIELD_OFFSET(KEY_VALUE_PARTIAL_INFORMATION, Data)) / sizeof(WCHAR);
98  goto failed;
99  }
100 
101  if (KeyInfo->Type != REG_SZ)
102  {
104  goto failed;
105  }
106 
107  if (!lpBuffer || *nSize < (KeyInfo->DataLength / sizeof(WCHAR)))
108  {
109  *nSize = (ReturnSize - FIELD_OFFSET(KEY_VALUE_PARTIAL_INFORMATION, Data)) / sizeof(WCHAR);
111  goto failed;
112  }
113 
114  *nSize = KeyInfo->DataLength / sizeof(WCHAR) - 1;
115  RtlCopyMemory(lpBuffer, KeyInfo->Data, KeyInfo->DataLength);
116  lpBuffer[*nSize] = 0;
117 
118  RtlFreeHeap(RtlGetProcessHeap(), 0, KeyInfo);
119 
120  return TRUE;
121 
122 failed:
123  RtlFreeHeap(RtlGetProcessHeap(), 0, KeyInfo);
125  return FALSE;
126 }
IN PUNICODE_STRING IN POBJECT_ATTRIBUTES ObjectAttributes
Definition: conport.c:35
_Must_inspect_result_ _Out_ PNDIS_STATUS _In_ NDIS_HANDLE _In_ ULONG _Out_ PNDIS_STRING KeyName
Definition: ndis.h:4711
NTSYSAPI VOID NTAPI RtlCopyMemory(VOID UNALIGNED *Destination, CONST VOID UNALIGNED *Source, ULONG Length)
#define OBJ_CASE_INSENSITIVE
Definition: winternl.h:228
_Must_inspect_result_ _Out_ PNDIS_STATUS _In_ NDIS_HANDLE _In_ ULONG _Out_ PNDIS_STRING _Out_ PNDIS_HANDLE KeyHandle
Definition: ndis.h:4711
#define KEY_READ
Definition: nt_native.h:1023
#define TRUE
Definition: types.h:120
*nSize LPSTR _Inout_ LPDWORD nSize
Definition: winbase.h:2037
LONG NTSTATUS
Definition: precomp.h:26
BOOLEAN NTAPI RtlFreeHeap(IN PVOID HeapHandle, IN ULONG Flags, IN PVOID HeapBase)
Definition: heap.c:606
_In_ PUNICODE_STRING ValueName
Definition: cmfuncs.h:264
#define FALSE
Definition: types.h:117
static TAGREF LPCWSTR LPDWORD LPVOID lpBuffer
Definition: db.cpp:173
smooth NULL
Definition: ftsmooth.c:416
DWORD BaseSetLastNTError(IN NTSTATUS Status)
Definition: reactos.cpp:166
PVOID NTAPI RtlAllocateHeap(IN PVOID HeapHandle, IN ULONG Flags, IN SIZE_T Size)
Definition: heap.c:588
NTSYSAPI NTSTATUS NTAPI NtQueryValueKey(IN HANDLE KeyHandle, IN PUNICODE_STRING ValueName, IN KEY_VALUE_INFORMATION_CLASS KeyValueInformationClass, IN PVOID KeyValueInformation, IN ULONG Length, IN PULONG ResultLength)
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
#define SetLastError(x)
Definition: compat.h:500
NTSTATUS NTAPI NtClose(IN HANDLE Handle)
Definition: obhandle.c:3399
#define STATUS_UNSUCCESSFUL
Definition: udferr_usr.h:132
Status
Definition: gdiplustypes.h:24
#define STATUS_BUFFER_OVERFLOW
Definition: shellext.h:66
struct _KEY_VALUE_PARTIAL_INFORMATION KEY_VALUE_PARTIAL_INFORMATION
#define FIELD_OFFSET(t, f)
Definition: typedefs.h:255
NTSYSAPI NTSTATUS NTAPI NtOpenKey(OUT PHANDLE KeyHandle, IN ACCESS_MASK DesiredAccess, IN POBJECT_ATTRIBUTES ObjectAttributes)
Definition: ntapi.c:336
unsigned int ULONG
Definition: retypes.h:1
NTSYSAPI VOID NTAPI RtlInitUnicodeString(PUNICODE_STRING DestinationString, PCWSTR SourceString)
#define InitializeObjectAttributes(p, n, a, r, s)
Definition: reg.c:106
#define ERROR_OUTOFMEMORY
Definition: deptool.c:13
#define REG_SZ
Definition: layer.c:22

Referenced by GetComputerNameExW().

◆ GetComputerNameW()

BOOL WINAPI GetComputerNameW ( LPWSTR  lpBuffer,
LPDWORD  lpnSize 
)

Definition at line 446 of file compname.c.

447 {
448  BOOL ret;
449 
450  ret = GetComputerNameExW(ComputerNameNetBIOS, lpBuffer, lpnSize);
451  if (!ret && GetLastError() == ERROR_MORE_DATA)
453 
454  return ret;
455 }
#define ERROR_BUFFER_OVERFLOW
Definition: winerror.h:185
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1044
BOOL WINAPI GetComputerNameExW(COMPUTER_NAME_FORMAT NameType, LPWSTR lpBuffer, LPDWORD nSize)
Definition: compname.c:216
unsigned int BOOL
Definition: ntddk_ex.h:94
static LPSTR PULONG lpnSize
Definition: secur32.c:50
static TAGREF LPCWSTR LPDWORD LPVOID lpBuffer
Definition: db.cpp:173
#define SetLastError(x)
Definition: compat.h:500
int ret
#define ERROR_MORE_DATA
Definition: dderror.h:13

Referenced by _LocalEnumPrintersCheckName(), _LocalGetPrintServerHandleData(), ADVAPI_IsLocalComputer(), AllSysInfo(), BasepGetComputerNameFromNtPath(), build_servername(), build_systeminfo_tree(), copy_servername_from_name(), CreateEnvironmentBlock(), CreateProfile(), ElfReportEventW(), EnumEventsThread(), fill_service(), get_computername(), get_owner(), get_username(), GetComputerObjectNameW(), GetUserNameExW(), init_access_tests(), init_wksta_tests(), InitializeSystemPage(), is_local_machine(), is_local_machineW(), LocalOpenPrinter(), LogfReportEvent(), LsaApLogonUserEx2(), LsapIsLocalComputer(), MSTASK_ITaskScheduler_GetTargetComputer(), MSTASK_ITaskScheduler_SetTargetComputer(), mstsc_ProtocolIOThread(), NETAPI_IsLocalComputer(), NetpGetComputerName(), NetrServerGetInfo(), NetWkstaGetInfo(), parse_path(), ProcessPortMessage(), RegConnectRegistryW(), set_installer_properties(), SetDomainComboBox(), CRootNode::SetupNode(), ShowHeader(), START_TEST(), test_GetComputerName(), test_RegQueryValueExPerformanceData(), test_SetTargetComputer(), test_Win32_ComputerSystem(), and test_Win32_Process().

◆ IsValidComputerName()

static BOOL IsValidComputerName ( COMPUTER_NAME_FORMAT  NameType,
LPCWSTR  lpComputerName 
)
static

Definition at line 488 of file compname.c.

490 {
491  size_t Length;
492  static const WCHAR s_szInvalidChars[] =
493  L"\"/\\[]:|<>+=;,?"
494  L"\x01\x02\x03\x04\x05\x06\x07\x08\x09\x0A\x0B\x0C\x0D\x0E\x0F"
495  L"\x10\x11\x12\x13\x14\x15\x16\x17\x18\x19\x1A\x1B\x1C\x1D\x1E\x1F";
496 
497  if (lpComputerName == NULL)
498  return FALSE;
499 
500 #define MAX_COMPUTER_NAME_EX 64
501  /* Get string length */
503  return FALSE;
504 #undef MAX_COMPUTER_NAME_EX
505 
506  /* An empty name is invalid, except a DNS name */
507  if (Length == 0 && NameType != ComputerNamePhysicalDnsDomain)
508  return FALSE;
509 
510  /* Leading or trailing spaces are invalid */
511  if (Length > 0 &&
512  (lpComputerName[0] == L' ' || lpComputerName[Length - 1] == L' '))
513  {
514  return FALSE;
515  }
516 
517  /* Check whether the name contains any invalid character */
518  if (wcscspn(lpComputerName, s_szInvalidChars) < Length)
519  return FALSE;
520 
521  switch (NameType)
522  {
523  case ComputerNamePhysicalNetBIOS:
525  return FALSE;
526  return TRUE;
527 
528  case ComputerNamePhysicalDnsDomain:
529  /* An empty DNS name is valid */
530  if (Length != 0)
532  return TRUE;
533 
534  case ComputerNamePhysicalDnsHostname:
536 
537  default:
538  return FALSE;
539  }
540 }
#define MAX_COMPUTER_NAME_EX
#define TRUE
Definition: types.h:120
_Check_return_ _CRTIMP size_t __cdecl wcscspn(_In_z_ const wchar_t *_Str, _In_z_ const wchar_t *_Control)
_Must_inspect_result_ NTSTRSAFEAPI RtlStringCchLengthW(_In_reads_or_z_(cchMax) STRSAFE_LPCWSTR psz, _In_ _In_range_(1, NTSTRSAFE_MAX_CCH) size_t cchMax, _Out_opt_ _Deref_out_range_(<, cchMax) _Deref_out_range_(<=, _String_length_(psz)) size_t *pcchLength)
Definition: ntstrsafe.h:1573
#define FALSE
Definition: types.h:117
smooth NULL
Definition: ftsmooth.c:416
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
_In_ ULONG _In_ ULONG _In_ ULONG Length
Definition: ntddpcm.h:101
static const WCHAR L[]
Definition: oid.c:1250
static BOOL BaseVerifyDnsName(LPCWSTR lpDnsName)
Definition: compname.c:459
LPWSTR lpComputerName
Definition: eventvwr.c:91
#define MAX_COMPUTERNAME_LENGTH
Definition: winbase.h:240
ACPI_PHYSICAL_ADDRESS ACPI_SIZE BOOLEAN Warn BOOLEAN Physical UINT32 ACPI_TABLE_HEADER *OutTableHeader ACPI_TABLE_HEADER **OutTable ACPI_HANDLE UINT32 ACPI_WALK_CALLBACK ACPI_WALK_CALLBACK void void **ReturnValue UINT32 NameType
Definition: acpixf.h:654

Referenced by SetComputerNameExW().

◆ RemoveLocalAlternateComputerNameA()

DWORD WINAPI RemoveLocalAlternateComputerNameA ( LPSTR  lpName,
DWORD  Unknown 
)

Definition at line 792 of file compname.c.

793 {
794  STUB;
796 }
#define STUB
Definition: kernel32.h:27
#define ERROR_CALL_NOT_IMPLEMENTED
Definition: compat.h:102

◆ RemoveLocalAlternateComputerNameW()

DWORD WINAPI RemoveLocalAlternateComputerNameW ( LPWSTR  lpName,
DWORD  Unknown 
)

Definition at line 800 of file compname.c.

801 {
802  STUB;
804 }
#define STUB
Definition: kernel32.h:27
#define ERROR_CALL_NOT_IMPLEMENTED
Definition: compat.h:102

◆ SetActiveComputerNameToRegistry()

static BOOL SetActiveComputerNameToRegistry ( LPCWSTR  RegistryKey,
LPCWSTR  SubKey,
LPCWSTR  ValueNameStr,
LPCWSTR  lpBuffer 
)
static

Definition at line 131 of file compname.c.

135 {
140  SIZE_T StringLength;
143 
144  StringLength = wcslen(lpBuffer);
145  if (StringLength > ((MAXULONG / sizeof(WCHAR)) - 1))
146  {
147  return FALSE;
148  }
149 
150  RtlInitUnicodeString(&KeyName, RegistryKey);
152  &KeyName,
154  NULL,
155  NULL);
156 
158  KEY_WRITE,
160  if (!NT_SUCCESS(Status))
161  {
163  return FALSE;
164  }
165 
166  RtlInitUnicodeString(&KeyName, SubKey);
168  &KeyName,
170  KeyHandle,
171  NULL);
172 
174  KEY_WRITE,
176  0,
177  NULL,
179  &Disposition);
180  if (!NT_SUCCESS(Status))
181  {
184  return FALSE;
185  }
186 
187  RtlInitUnicodeString(&ValueName, ValueNameStr);
188 
190  &ValueName,
191  0,
192  REG_SZ,
193  (PVOID)lpBuffer,
194  (StringLength + 1) * sizeof(WCHAR));
195  if (!NT_SUCCESS(Status))
196  {
200  return FALSE;
201  }
202 
206 
207  return TRUE;
208 }
IN PUNICODE_STRING IN POBJECT_ATTRIBUTES ObjectAttributes
Definition: conport.c:35
_Must_inspect_result_ _Out_ PNDIS_STATUS _In_ NDIS_HANDLE _In_ ULONG _Out_ PNDIS_STRING KeyName
Definition: ndis.h:4711
NTSTATUS NTAPI NtCreateKey(OUT PHANDLE KeyHandle, IN ACCESS_MASK DesiredAccess, IN POBJECT_ATTRIBUTES ObjectAttributes, IN ULONG TitleIndex, IN PUNICODE_STRING Class OPTIONAL, IN ULONG CreateOptions, OUT PULONG Disposition OPTIONAL)
Definition: ntapi.c:240
#define OBJ_CASE_INSENSITIVE
Definition: winternl.h:228
_Must_inspect_result_ _Out_ PNDIS_STATUS _In_ NDIS_HANDLE _In_ ULONG _Out_ PNDIS_STRING _Out_ PNDIS_HANDLE KeyHandle
Definition: ndis.h:4711
#define TRUE
Definition: types.h:120
LONG NTSTATUS
Definition: precomp.h:26
_In_ ACCESS_MASK _In_ POBJECT_ATTRIBUTES _Reserved_ ULONG _In_opt_ PUNICODE_STRING _In_ ULONG _Out_opt_ PULONG Disposition
Definition: cmfuncs.h:50
_In_ PUNICODE_STRING ValueName
Definition: cmfuncs.h:264
#define FALSE
Definition: types.h:117
static TAGREF LPCWSTR LPDWORD LPVOID lpBuffer
Definition: db.cpp:173
smooth NULL
Definition: ftsmooth.c:416
DWORD BaseSetLastNTError(IN NTSTATUS Status)
Definition: reactos.cpp:166
#define KEY_WRITE
Definition: nt_native.h:1031
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
NTSTATUS NTAPI NtClose(IN HANDLE Handle)
Definition: obhandle.c:3399
_Must_inspect_result_ _Out_ PNDIS_STATUS _In_ NDIS_HANDLE _In_ PNDIS_STRING _Out_ PNDIS_HANDLE SubKeyHandle
Definition: ndis.h:4723
Status
Definition: gdiplustypes.h:24
#define MAXULONG
Definition: typedefs.h:251
ULONG_PTR SIZE_T
Definition: typedefs.h:80
NTSTATUS NTAPI NtFlushKey(IN HANDLE KeyHandle)
Definition: ntapi.c:1085
NTSYSAPI NTSTATUS NTAPI NtSetValueKey(IN HANDLE KeyHandle, IN PUNICODE_STRING ValueName, IN ULONG TitleIndex OPTIONAL, IN ULONG Type, IN PVOID Data, IN ULONG DataSize)
Definition: ntapi.c:859
NTSYSAPI NTSTATUS NTAPI NtOpenKey(OUT PHANDLE KeyHandle, IN ACCESS_MASK DesiredAccess, IN POBJECT_ATTRIBUTES ObjectAttributes)
Definition: ntapi.c:336
unsigned int ULONG
Definition: retypes.h:1
NTSYSAPI VOID NTAPI RtlInitUnicodeString(PUNICODE_STRING DestinationString, PCWSTR SourceString)
#define InitializeObjectAttributes(p, n, a, r, s)
Definition: reg.c:106
#define REG_OPTION_VOLATILE
Definition: nt_native.h:1060
size_t __cdecl wcslen(_In_z_ const wchar_t *_Str)
#define REG_SZ
Definition: layer.c:22

Referenced by GetComputerNameExW().

◆ SetComputerNameA()

BOOL WINAPI SetComputerNameA ( LPCSTR  lpComputerName)

Definition at line 605 of file compname.c.

606 {
607  return SetComputerNameExA(ComputerNamePhysicalNetBIOS, lpComputerName);
608 }
BOOL WINAPI SetComputerNameExA(COMPUTER_NAME_FORMAT NameType, LPCSTR lpBuffer)
Definition: compname.c:627
LPWSTR lpComputerName
Definition: eventvwr.c:91

◆ SetComputerNameExA()

BOOL WINAPI SetComputerNameExA ( COMPUTER_NAME_FORMAT  NameType,
LPCSTR  lpBuffer 
)

Definition at line 627 of file compname.c.

629 {
631  BOOL bResult;
632 
634 
635  bResult = SetComputerNameExW(NameType, Buffer.Buffer);
636 
638 
639  return bResult;
640 }
char * LPSTR
Definition: xmlstorage.h:182
unsigned int BOOL
Definition: ntddk_ex.h:94
static TAGREF LPCWSTR LPDWORD LPVOID lpBuffer
Definition: db.cpp:173
NTSYSAPI BOOLEAN NTAPI RtlCreateUnicodeStringFromAsciiz(_Out_ PUNICODE_STRING Destination, _In_ PCSZ Source)
Definition: bufpool.h:45
NTSYSAPI VOID NTAPI RtlFreeUnicodeString(PUNICODE_STRING UnicodeString)
ACPI_PHYSICAL_ADDRESS ACPI_SIZE BOOLEAN Warn BOOLEAN Physical UINT32 ACPI_TABLE_HEADER *OutTableHeader ACPI_TABLE_HEADER **OutTable ACPI_HANDLE UINT32 ACPI_WALK_CALLBACK ACPI_WALK_CALLBACK void void **ReturnValue UINT32 NameType
Definition: acpixf.h:654
IN BOOLEAN OUT PSTR Buffer
Definition: progress.h:34
BOOL WINAPI SetComputerNameExW(COMPUTER_NAME_FORMAT NameType, LPCWSTR lpBuffer)
Definition: compname.c:648

Referenced by SetComputerNameA().

◆ SetComputerNameExW()

BOOL WINAPI SetComputerNameExW ( COMPUTER_NAME_FORMAT  NameType,
LPCWSTR  lpBuffer 
)

Definition at line 648 of file compname.c.

650 {
651  BOOL ret1, ret2;
652 
654  {
656  return FALSE;
657  }
658 
659  switch (NameType)
660  {
661  case ComputerNamePhysicalDnsDomain:
662  return SetComputerNameToRegistry(L"\\Registry\\Machine\\System\\CurrentControlSet"
663  L"\\Services\\Tcpip\\Parameters",
664  L"NV Domain",
665  lpBuffer);
666 
667  case ComputerNamePhysicalDnsHostname:
668  ret1 = SetComputerNameToRegistry(L"\\Registry\\Machine\\System\\CurrentControlSet"
669  L"\\Services\\Tcpip\\Parameters",
670  L"NV Hostname",
671  lpBuffer);
672 
673  ret2 = SetComputerNameToRegistry(L"\\Registry\\Machine\\System\\CurrentControlSet"
674  L"\\Control\\ComputerName\\ComputerName",
675  L"ComputerName",
676  lpBuffer);
677  return (ret1 && ret2);
678 
679  case ComputerNamePhysicalNetBIOS:
680  return SetComputerNameToRegistry(L"\\Registry\\Machine\\System\\CurrentControlSet"
681  L"\\Control\\ComputerName\\ComputerName",
682  L"ComputerName",
683  lpBuffer);
684 
685  default:
687  return FALSE;
688  }
689 }
#define ERROR_INVALID_PARAMETER
Definition: compat.h:101
#define FALSE
Definition: types.h:117
unsigned int BOOL
Definition: ntddk_ex.h:94
static BOOL IsValidComputerName(COMPUTER_NAME_FORMAT NameType, LPCWSTR lpComputerName)
Definition: compname.c:488
static TAGREF LPCWSTR LPDWORD LPVOID lpBuffer
Definition: db.cpp:173
#define SetLastError(x)
Definition: compat.h:500
static const WCHAR L[]
Definition: oid.c:1250
static BOOL SetComputerNameToRegistry(LPCWSTR RegistryKey, LPCWSTR ValueNameStr, LPCWSTR lpBuffer)
Definition: compname.c:544
ACPI_PHYSICAL_ADDRESS ACPI_SIZE BOOLEAN Warn BOOLEAN Physical UINT32 ACPI_TABLE_HEADER *OutTableHeader ACPI_TABLE_HEADER **OutTable ACPI_HANDLE UINT32 ACPI_WALK_CALLBACK ACPI_WALK_CALLBACK void void **ReturnValue UINT32 NameType
Definition: acpixf.h:654

Referenced by DoTestComputerName(), NetworkDlg_OnOK(), SetComputerNameExA(), SetComputerNameW(), and WriteComputerSettings().

◆ SetComputerNameToRegistry()

static BOOL SetComputerNameToRegistry ( LPCWSTR  RegistryKey,
LPCWSTR  ValueNameStr,
LPCWSTR  lpBuffer 
)
static

Definition at line 544 of file compname.c.

547 {
552  SIZE_T StringLength;
554 
555  StringLength = wcslen(lpBuffer);
556  if (StringLength > ((MAXULONG / sizeof(WCHAR)) - 1))
557  {
558  return FALSE;
559  }
560 
561  RtlInitUnicodeString(&KeyName, RegistryKey);
563  &KeyName,
565  NULL,
566  NULL);
567 
569  KEY_WRITE,
571  if (!NT_SUCCESS(Status))
572  {
574  return FALSE;
575  }
576 
577  RtlInitUnicodeString(&ValueName, ValueNameStr);
578 
580  &ValueName,
581  0,
582  REG_SZ,
583  (PVOID)lpBuffer,
584  (StringLength + 1) * sizeof(WCHAR));
585  if (!NT_SUCCESS(Status))
586  {
589  return FALSE;
590  }
591 
594 
596  return TRUE;
597 }
IN PUNICODE_STRING IN POBJECT_ATTRIBUTES ObjectAttributes
Definition: conport.c:35
_Must_inspect_result_ _Out_ PNDIS_STATUS _In_ NDIS_HANDLE _In_ ULONG _Out_ PNDIS_STRING KeyName
Definition: ndis.h:4711
#define ERROR_SUCCESS
Definition: deptool.c:10
#define OBJ_CASE_INSENSITIVE
Definition: winternl.h:228
_Must_inspect_result_ _Out_ PNDIS_STATUS _In_ NDIS_HANDLE _In_ ULONG _Out_ PNDIS_STRING _Out_ PNDIS_HANDLE KeyHandle
Definition: ndis.h:4711
#define TRUE
Definition: types.h:120
LONG NTSTATUS
Definition: precomp.h:26
_In_ PUNICODE_STRING ValueName
Definition: cmfuncs.h:264
#define FALSE
Definition: types.h:117
static TAGREF LPCWSTR LPDWORD LPVOID lpBuffer
Definition: db.cpp:173
smooth NULL
Definition: ftsmooth.c:416
DWORD BaseSetLastNTError(IN NTSTATUS Status)
Definition: reactos.cpp:166
#define KEY_WRITE
Definition: nt_native.h:1031
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
#define SetLastError(x)
Definition: compat.h:500
NTSTATUS NTAPI NtClose(IN HANDLE Handle)
Definition: obhandle.c:3399
Status
Definition: gdiplustypes.h:24
#define MAXULONG
Definition: typedefs.h:251
ULONG_PTR SIZE_T
Definition: typedefs.h:80
NTSTATUS NTAPI NtFlushKey(IN HANDLE KeyHandle)
Definition: ntapi.c:1085
NTSYSAPI NTSTATUS NTAPI NtSetValueKey(IN HANDLE KeyHandle, IN PUNICODE_STRING ValueName, IN ULONG TitleIndex OPTIONAL, IN ULONG Type, IN PVOID Data, IN ULONG DataSize)
Definition: ntapi.c:859
NTSYSAPI NTSTATUS NTAPI NtOpenKey(OUT PHANDLE KeyHandle, IN ACCESS_MASK DesiredAccess, IN POBJECT_ATTRIBUTES ObjectAttributes)
Definition: ntapi.c:336
NTSYSAPI VOID NTAPI RtlInitUnicodeString(PUNICODE_STRING DestinationString, PCWSTR SourceString)
#define InitializeObjectAttributes(p, n, a, r, s)
Definition: reg.c:106
size_t __cdecl wcslen(_In_z_ const wchar_t *_Str)
#define REG_SZ
Definition: layer.c:22

Referenced by SetComputerNameExW().

◆ SetComputerNameW()

BOOL WINAPI SetComputerNameW ( LPCWSTR  lpComputerName)

Definition at line 616 of file compname.c.

617 {
618  return SetComputerNameExW(ComputerNamePhysicalNetBIOS, lpComputerName);
619 }
LPWSTR lpComputerName
Definition: eventvwr.c:91
BOOL WINAPI SetComputerNameExW(COMPUTER_NAME_FORMAT NameType, LPCWSTR lpBuffer)
Definition: compname.c:648

Referenced by WriteComputerSettings().

◆ SetLocalPrimaryComputerNameA()

BOOL WINAPI SetLocalPrimaryComputerNameA ( IN DWORD  Unknown1,
IN DWORD  Unknown2 
)

Definition at line 811 of file compname.c.

813 {
814  STUB;
815  return FALSE;
816 }
#define FALSE
Definition: types.h:117
#define STUB
Definition: kernel32.h:27

◆ SetLocalPrimaryComputerNameW()

BOOL WINAPI SetLocalPrimaryComputerNameW ( IN DWORD  Unknown1,
IN DWORD  Unknown2 
)

Definition at line 823 of file compname.c.

825 {
826  STUB;
827  return FALSE;
828 }
#define FALSE
Definition: types.h:117
#define STUB
Definition: kernel32.h:27