10#define WIN32_NO_STATUS
15#define _WIN32_WINNT 0x0600
21 RegHostNameKey[] =
L"System\\CurrentControlSet\\Services\\Tcpip\\Parameters";
32 RegComputerNameKey[] =
L"System\\CurrentControlSet\\Control\\ComputerName\\ComputerName";
49 trace(
"Testing '%S':\n", pszNewName);
53 cbData =
sizeof(szNVHostNameOld);
56 ok(szNVHostNameOld[0],
"szNVHostNameOld is empty\n");
60 cbData =
sizeof(szHostNameOld);
63 ok(szHostNameOld[0],
"szHostNameOld is empty\n");
67 cbData =
sizeof(szComputerNameOld);
70 ok(szComputerNameOld[0],
"szComputerNameOld is empty\n");
84 cbData =
sizeof(szNVHostNameNew);
89 ok(szNVHostNameNew[0],
"szNVHostNameNew is empty\n");
91 "szNVHostNameNew '%S' should be pszNewName '%S'\n", szNVHostNameNew, pszNewName);
96 cbData =
sizeof(szHostNameNew);
101 ok(szHostNameNew[0],
"szHostNameNew is empty\n");
102 ok(
lstrcmpW(szHostNameNew, szHostNameOld) == 0,
103 "szHostNameNew '%S' should be szHostNameOld '%S'\n", szHostNameNew, szHostNameOld);
108 cbData =
sizeof(szComputerNameNew);
113 ok(szComputerNameNew[0],
"szComputerNameNew is empty\n");
118 ok(
lstrcmpiW(szComputerNameNew, szTruncatedNewName) == 0,
119 "szComputerNameNew '%S' should be szTruncatedNewName '%S'\n",
120 szComputerNameNew, szTruncatedNewName);
125 "szComputerNameNew '%S' should be pszNewName '%S'\n",
126 szComputerNameNew, pszNewName);
147 static const WCHAR ValidSymbols[] =
L"-_";
148 static const WCHAR InvalidSymbols[] =
L"\"/\\[]:|<>+=;,?";
150 INT i, cchValidSymbols, cchInvalidSymbols;
155 ok(hKeyHN !=
NULL,
"hKeyHN is NULL\n");
157 ok(hKeyCN !=
NULL,
"hKeyCN is NULL\n");
158 if (!hKeyHN || !hKeyCN)
164 skip(
"Unable to open keys. Missing Admin rights?\n");
168 cchValidSymbols =
lstrlenW(ValidSymbols);
169 cchInvalidSymbols =
lstrlenW(InvalidSymbols);
229 for (
i = 0;
i < cchValidSymbols; ++
i)
236 for (
i = 0;
i < cchValidSymbols; ++
i)
244 for (
i = 0;
i < cchValidSymbols; ++
i)
252 for (
i = 0;
i < cchValidSymbols; ++
i)
260 for (
i = 0;
i < cchInvalidSymbols; ++
i)
268 for (
i = 0;
i < cchInvalidSymbols; ++
i)
static void DoTestComputerName(HKEY hKeyHN, HKEY hKeyCN, LPCWSTR pszNewName, BOOL bValid)
static HKEY OpenComputerNameKey(void)
static HKEY OpenHostNameKey(void)
#define ok_long(expression, result)
#define ok_int(expression, result)
#define RegCloseKey(hKey)
BOOL WINAPI SetComputerNameExW(COMPUTER_NAME_FORMAT NameType, LPCWSTR lpBuffer)
LONG WINAPI RegOpenKeyExW(HKEY hKey, LPCWSTR lpSubKey, DWORD ulOptions, REGSAM samDesired, PHKEY phkResult)
LONG WINAPI RegSetValueExW(_In_ HKEY hKey, _In_ LPCWSTR lpValueName, _In_ DWORD Reserved, _In_ DWORD dwType, _In_ CONST BYTE *lpData, _In_ DWORD cbData)
LONG WINAPI RegQueryValueExW(_In_ HKEY hkeyorg, _In_ LPCWSTR name, _In_ LPDWORD reserved, _In_ LPDWORD type, _In_ LPBYTE data, _In_ LPDWORD count)
#define ERROR_INVALID_PARAMETER
int WINAPI lstrcmpW(LPCWSTR str1, LPCWSTR str2)
int WINAPI lstrcmpiW(LPCWSTR str1, LPCWSTR str2)
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
static const WCHAR szName[]
DWORD WINAPI GetLastError(void)
#define MAX_COMPUTERNAME_LENGTH
#define HKEY_LOCAL_MACHINE