26 ok(Ret ==
TRUE,
"[%d] GetComputerNameExW returned %d\n",
NameType, Ret);
35 "[%d] Unexpected ReferenceLen %lu\n",
NameType, ReferenceLen);
36 if (
NameType != ComputerNameDnsDomain &&
NameType != ComputerNamePhysicalDnsDomain)
38 ok(ReferenceLen != 0,
"[%d] Unexpected ReferenceLen %lu\n",
NameType, ReferenceLen);
40 ok(
Size == ReferenceLen,
"[%d] Size is %lu, expected %lu\n",
NameType,
Size, ReferenceLen);
47 ok(Ret ==
FALSE,
"[%d] GetComputerNameExW returned %d\n",
NameType, Ret);
54 ok(Ret ==
FALSE,
"[%d] GetComputerNameExA returned %d\n",
NameType, Ret);
63 ok(Ret ==
FALSE,
"[%d] GetComputerNameExW returned %d\n",
NameType, Ret);
71 ok(Ret ==
FALSE,
"[%d] GetComputerNameExA returned %d\n",
NameType, Ret);
80 ok(Ret ==
FALSE,
"[%d] GetComputerNameExW returned %d\n",
NameType, Ret);
82 ok(BufferW[0] == 0x5555,
"[%d] BufferW[0] = 0x%x\n",
NameType, BufferW[0]);
88 ok(Ret ==
FALSE,
"[%d] GetComputerNameExA returned %d\n",
NameType, Ret);
90 ok(BufferA[0] == 0x55,
"[%d] BufferA[0] = 0x%x\n",
NameType, BufferA[0]);
97 ok(Ret ==
FALSE,
"[%d] GetComputerNameExW returned %d\n",
NameType, Ret);
99 ok(
Size == ReferenceLen + 1,
"[%d] Got Size %lu, expected %lu\n",
NameType,
Size, ReferenceLen + 1);
105 ok(Ret ==
FALSE,
"[%d] GetComputerNameExA returned %d\n",
NameType, Ret);
107 ok(
Size == ReferenceLen + 1,
"[%d] Got Size %lu, expected %lu\n",
NameType,
Size, ReferenceLen + 1);
115 ok(Ret ==
FALSE,
"[%d] GetComputerNameExW returned %d\n",
NameType, Ret);
117 ok(
Size == ReferenceLen + 1,
"[%d] Got Size %lu, expected %lu\n",
NameType,
Size, ReferenceLen + 1);
118 ok(BufferW[0] == 0x5555,
"[%d] BufferW[0] = 0x%x\n",
NameType, BufferW[0]);
125 ok(Ret ==
FALSE,
"[%d] GetComputerNameExA returned %d\n",
NameType, Ret);
127 ok(
Size == ReferenceLen + 1,
"[%d] Got Size %lu, expected %lu\n",
NameType,
Size, ReferenceLen + 1);
128 ok(BufferA[0] == 0x55,
"[%d] BufferA[0] = 0x%x\n",
NameType, BufferA[0]);
136 ok(Ret ==
FALSE,
"[%d] GetComputerNameExW returned %d\n",
NameType, Ret);
138 ok(
Size == ReferenceLen + 1,
"[%d] Got Size %lu, expected %lu\n",
NameType,
Size, ReferenceLen + 1);
139 if (
NameType != ComputerNameNetBIOS &&
NameType != ComputerNamePhysicalNetBIOS)
141 if (ReferenceLen == 0)
143 ok(BufferW[0] == 0x5555,
"[%d] BufferW[0] = 0x%x\n",
148 ok(BufferW[0] == 0,
"[%d] BufferW[0] = 0x%x\n",
152 ok(BufferW[1] == 0x5555,
"[%d] BufferW[1] = 0x%x\n",
NameType, BufferW[1]);
159 ok(Ret ==
FALSE,
"[%d] GetComputerNameExA returned %d\n",
NameType, Ret);
161 ok(
Size == ReferenceLen + 1,
"[%d] Got Size %lu, expected %lu\n",
NameType,
Size, ReferenceLen + 1);
162 ok(BufferA[0] == 0x55,
"[%d] BufferA[0] = 0x%x\n",
NameType, BufferA[0]);
166 Size = ReferenceLen + 1;
168 ok(Ret ==
TRUE,
"[%d] GetComputerNameExW returned %d\n",
NameType, Ret);
169 ok(
Size == ReferenceLen,
"[%d] Got Size %lu, expected %lu\n",
NameType,
Size, ReferenceLen + 1);
170 ok(BufferW[ReferenceLen] == 0,
"[%d] BufferW[ReferenceLen] = 0x%x\n",
NameType, BufferW[ReferenceLen]);
171 ok(BufferW[ReferenceLen + 1] == 0x5555,
"[%d] BufferW[ReferenceLen + 1] = 0x%x\n",
NameType, BufferW[ReferenceLen + 1]);
172 ok(!
wcscmp(BufferW, Reference),
"[%d] '%ls' != '%ls'\n",
NameType, BufferW, Reference);
175 Size = ReferenceLen + 1;
177 ok(Ret ==
TRUE,
"[%d] GetComputerNameExA returned %d\n",
NameType, Ret);
178 ok(
Size == ReferenceLen,
"[%d] Got Size %lu, expected %lu\n",
NameType,
Size, ReferenceLen + 1);
179 ok(BufferA[ReferenceLen] == 0,
"[%d] BufferA[ReferenceLen] = 0x%x\n",
NameType, BufferA[ReferenceLen]);
180 ok(BufferA[ReferenceLen + 1] == 0x55,
"[%d] BufferA[ReferenceLen + 1] = 0x%x\n",
NameType, BufferA[ReferenceLen + 1]);
181 for (
i = 0;
i < ReferenceLen;
i++)
183 if (BufferA[
i] != Reference[
i])
185 ok(0,
"[%d] BufferA[%lu] = 0x%x, expected 0x%x\n",
NameType,
i, BufferA[
i], Reference[
i]);
201 "System\\CurrentControlSet\\Services\\Tcpip\\Parameters",
242 "System\\CurrentControlSet\\Control\\ComputerName\\ActiveComputerName",
281 "System\\CurrentControlSet\\Services\\Tcpip\\Parameters",
310 "System\\CurrentControlSet\\Services\\Tcpip\\Parameters",
330 CHAR OrigNetBIOS[128];
331 CHAR OrigHostname[128];
332 CHAR OrigDomainName[128];
333 CHAR OrigDhcpHostname[128];
334 CHAR OrigDhcpDomainName[128];
335 BOOL OrigNetBIOSExists;
336 BOOL OrigHostnameExists;
337 BOOL OrigDomainNameExists;
338 BOOL OrigDhcpHostnameExists;
339 BOOL OrigDhcpDomainNameExists;
340 CHAR ComputerName[128];
341 DWORD ComputerNameSize = 0;
345 memset(OrigNetBIOS, 0,
sizeof(OrigNetBIOS));
346 memset(OrigHostname, 0,
sizeof(OrigHostname));
347 memset(OrigDomainName, 0,
sizeof(OrigDomainName));
348 memset(OrigDhcpHostname, 0,
sizeof(OrigDhcpHostname));
349 memset(OrigDhcpDomainName, 0,
sizeof(OrigDhcpDomainName));
367 trace(
"Starting values:\n");
368 trace(
"NetBIOS: %s, exists %s\n", OrigNetBIOS, OrigNetBIOSExists ?
"yes" :
"no");
369 trace(
"Hostname: %s, exists %s\n", OrigHostname, OrigHostnameExists ?
"yes" :
"no");
370 trace(
"Domain: %s, exists %s\n", OrigDomainName, OrigDomainNameExists ?
"yes" :
"no");
371 trace(
"DhcpHostname: %s, exists %s\n", OrigDhcpHostnameExists ? OrigDhcpHostname :
"", OrigDhcpHostnameExists ?
"yes" :
"no");
372 trace(
"DhcpDomain: %s, exists %s\n", OrigDhcpDomainNameExists ? OrigDhcpDomainName :
"", OrigDhcpDomainNameExists ?
"yes" :
"no");
375 ComputerNameSize = 0;
378 if (ComputerNameSize)
380 Ret =
GetComputerNameExA(ComputerNamePhysicalNetBIOS, ComputerName, &ComputerNameSize);
381 ok(Ret,
"GetComputerNameExA(ComputerNamePhysicalNetBIOS) failed with %ld\n",
GetLastError());
385 memset(ComputerName, 0,
sizeof(ComputerName));
387 ok(
strcmp(ComputerName, OrigNetBIOS) == 0,
"ComputerNamePhysicalNetBIOS doesn't match registry value '%s' != '%s'\n", ComputerName, OrigNetBIOS);
391 ComputerNameSize = 0;
394 if (ComputerNameSize)
396 Ret =
GetComputerNameExA(ComputerNamePhysicalDnsHostname, ComputerName, &ComputerNameSize);
397 ok(Ret,
"GetComputerNameExA(ComputerNamePhysicalDnsHostname) failed with %ld\n",
GetLastError());
401 memset(ComputerName, 0,
sizeof(ComputerName));
403 ok(
strcmp(ComputerName, OrigHostname) == 0,
"ComputerNamePhysicalDnsHostname doesn't match registry value '%s' != '%s'\n", ComputerName, OrigHostname);
407 ComputerNameSize = 0;
410 if (ComputerNameSize)
412 Ret =
GetComputerNameExA(ComputerNamePhysicalDnsDomain, ComputerName, &ComputerNameSize);
413 ok(Ret,
"GetComputerNameExA(ComputerNamePhysicalDnsDomain) failed with %ld\n",
GetLastError());
417 memset(ComputerName, 0,
sizeof(ComputerName));
419 ok(
strcmp(ComputerName, OrigDomainName) == 0,
"ComputerNamePhysicalDnsDomain doesn't match registry value '%s' != '%s'\n", ComputerName, OrigDomainName);
421 ComputerNameSize = 0;
426 if (ComputerNameSize)
429 ok(Ret,
"GetComputerNameExA(ComputerNameNetBIOS) failed with %ld\n",
GetLastError());
433 memset(ComputerName, 0,
sizeof(ComputerName));
435 ok(
strcmp(ComputerName, OrigNetBIOS) == 0,
"ComputerNameNetBIOS doesn't match registry value '%s' != '%s'\n", ComputerName, OrigNetBIOS);
439 ComputerNameSize = 0;
442 if (ComputerNameSize)
445 ok(Ret,
"GetComputerNameExA(ComputerNameDnsHostname) failed with %ld\n",
GetLastError());
449 memset(ComputerName, 0,
sizeof(ComputerName));
451 ok(
strcmp(ComputerName, OrigHostname) == 0,
"ComputerNameDnsHostname doesn't match registry value '%s' != '%s'\n", ComputerName, OrigHostname);
455 ComputerNameSize = 0;
458 if (ComputerNameSize)
461 ok(Ret,
"GetComputerNameExA(ComputerNameDnsDomain) failed with %ld\n",
GetLastError());
465 memset(ComputerName, 0,
sizeof(ComputerName));
467 ok(
strcmp(ComputerName, OrigDomainName) == 0,
"ComputerNameDnsDomain doesn't match registry value '%s' != '%s'\n", ComputerName, OrigDomainName);
476 ComputerNameSize = 0;
479 if (ComputerNameSize)
481 Ret =
GetComputerNameExA(ComputerNamePhysicalNetBIOS, ComputerName, &ComputerNameSize);
482 ok(Ret,
"GetComputerNameExA(ComputerNamePhysicalNetBIOS) failed with %ld\n",
GetLastError());
486 memset(ComputerName, 0,
sizeof(ComputerName));
488 ok(
strcmp(ComputerName, OrigNetBIOS) == 0,
"ComputerNamePhysicalNetBIOS doesn't match registry value '%s' != '%s'\n", ComputerName, OrigNetBIOS);
492 ComputerNameSize = 0;
495 if (ComputerNameSize)
497 Ret =
GetComputerNameExA(ComputerNamePhysicalDnsHostname, ComputerName, &ComputerNameSize);
498 ok(Ret,
"GetComputerNameExA(ComputerNamePhysicalDnsHostname) failed with %ld\n",
GetLastError());
502 memset(ComputerName, 0,
sizeof(ComputerName));
504 ok(
strcmp(ComputerName, OrigHostname) == 0,
"ComputerNamePhysicalDnsHostname doesn't match registry value '%s' != '%s'\n", ComputerName, OrigHostname);
508 ComputerNameSize = 0;
511 if (ComputerNameSize)
513 Ret =
GetComputerNameExA(ComputerNamePhysicalDnsDomain, ComputerName, &ComputerNameSize);
514 ok(Ret,
"GetComputerNameExA(ComputerNamePhysicalDnsDomain) failed with %ld\n",
GetLastError());
518 memset(ComputerName, 0,
sizeof(ComputerName));
520 ok(
strcmp(ComputerName, OrigDomainName) == 0,
"ComputerNamePhysicalDnsDomain doesn't match registry value '%s' != '%s'\n", ComputerName, OrigDomainName);
522 ComputerNameSize = 0;
527 if (ComputerNameSize)
530 ok(Ret,
"GetComputerNameExA(ComputerNameNetBIOS) failed with %ld\n",
GetLastError());
534 memset(ComputerName, 0,
sizeof(ComputerName));
536 ok(
strcmp(ComputerName, OrigNetBIOS) == 0,
"ComputerNameNetBIOS doesn't match registry value '%s' != '%s'\n", ComputerName, OrigNetBIOS);
540 ComputerNameSize = 0;
543 if (ComputerNameSize)
546 ok(Ret,
"GetComputerNameExA(ComputerNameDnsHostname) failed with %ld\n",
GetLastError());
550 memset(ComputerName, 0,
sizeof(ComputerName));
552 ok(
strcmp(ComputerName, OrigHostname) == 0,
"ComputerNameDnsHostname doesn't match registry value '%s' != '%s'\n", ComputerName, OrigHostname);
556 ComputerNameSize = 0;
559 if (ComputerNameSize)
562 ok(Ret,
"GetComputerNameExA(ComputerNameDnsDomain) failed with %ld\n",
GetLastError());
566 memset(ComputerName, 0,
sizeof(ComputerName));
568 ok(
strcmp(ComputerName, OrigDomainName) == 0,
"ComputerNameDnsDomain doesn't match registry value '%s' != '%s'\n", ComputerName, OrigDomainName);
572 if (OrigDhcpHostnameExists)
577 if (OrigDhcpDomainNameExists)
static VOID TestReturnValues()
static VOID TestGetComputerNameEx(_In_ COMPUTER_NAME_FORMAT NameType)
static LSTATUS DeleteRegistryValue(PCHAR ValueName)
static LSTATUS WriteRegistryValue(PCHAR ValueName, PCHAR Value)
static LSTATUS ReadRegistryComputerNameValue(PCHAR ValueName, PCHAR Value)
static LSTATUS ReadRegistryValue(PCHAR ValueName, PCHAR Value)
#define EndSeh(ExpectedStatus)
int strcmp(const char *String1, const char *String2)
ACPI_PHYSICAL_ADDRESS ACPI_SIZE BOOLEAN Warn UINT32 *TableIdx UINT32 ACPI_TABLE_HEADER *OutTableHeader ACPI_TABLE_HEADER **OutTable ACPI_HANDLE UINT32 ACPI_WALK_CALLBACK ACPI_WALK_CALLBACK void void **ReturnValue UINT32 NameType
#define RegCloseKey(hKey)
BOOL WINAPI GetComputerNameExW(COMPUTER_NAME_FORMAT NameType, LPWSTR lpBuffer, LPDWORD nSize)
static LSTATUS(WINAPI *pRegDeleteTreeW)(HKEY
LONG WINAPI RegSetValueExA(HKEY hKey, LPCSTR lpValueName, DWORD Reserved, DWORD dwType, CONST BYTE *lpData, DWORD cbData)
LONG WINAPI RegOpenKeyExA(_In_ HKEY hKey, _In_ LPCSTR lpSubKey, _In_ DWORD ulOptions, _In_ REGSAM samDesired, _Out_ PHKEY phkResult)
LONG WINAPI RegDeleteValueA(HKEY hKey, LPCSTR lpValueName)
LONG WINAPI RegQueryValueExA(_In_ HKEY hkeyorg, _In_ LPCSTR name, _In_ LPDWORD reserved, _Out_opt_ LPDWORD type, _Out_opt_ LPBYTE data, _Inout_opt_ LPDWORD count)
#define ERROR_INVALID_PARAMETER
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
#define RtlFillMemory(Dest, Length, Fill)
BOOL WINAPI GetComputerNameExA(COMPUTER_NAME_FORMAT, LPSTR, LPDWORD)
int WINAPI lstrlenA(LPCSTR lpString)
#define ERROR_FILE_NOT_FOUND
_In_ NDIS_ERROR_CODE ErrorCode
_Check_return_ _CRTIMP int __cdecl wcscmp(_In_z_ const wchar_t *_Str1, _In_z_ const wchar_t *_Str2)
_Must_inspect_result_ _In_ WDFDEVICE _In_ PWDF_DEVICE_PROPERTY_DATA _In_ DEVPROPTYPE _In_ ULONG Size
_Must_inspect_result_ _In_ WDFKEY _In_ PCUNICODE_STRING ValueName
_Must_inspect_result_ _In_ WDFKEY _In_ PCUNICODE_STRING _Out_opt_ PUSHORT _Inout_opt_ PUNICODE_STRING Value
DWORD WINAPI GetLastError(void)
#define HKEY_LOCAL_MACHINE