https://git.reactos.org/?p=reactos.git;a=commitdiff;h=de2b20d2408c19374671c…
commit de2b20d2408c19374671cef31047f972a32b8ad9
Author: Serge Gautherie <32623169+SergeGautherie(a)users.noreply.github.com>
AuthorDate: Sun May 26 19:33:03 2019 +0200
Commit: Katayama Hirofumi MZ <katayama.hirofumi.mz(a)gmail.com>
CommitDate: Mon May 27 02:33:03 2019 +0900
[KERNEL32_APITEST] Improve SetComputerNameExW test a bit (#1580)
Addendum to 8aeb6a9. ROSTESTS-227
---
.../rostests/apitests/kernel32/SetComputerNameExW.c | 18 ++++++++++--------
1 file changed, 10 insertions(+), 8 deletions(-)
diff --git a/modules/rostests/apitests/kernel32/SetComputerNameExW.c
b/modules/rostests/apitests/kernel32/SetComputerNameExW.c
index 658e74e8a4..fc55c96f15 100644
--- a/modules/rostests/apitests/kernel32/SetComputerNameExW.c
+++ b/modules/rostests/apitests/kernel32/SetComputerNameExW.c
@@ -39,24 +39,26 @@ static HKEY OpenComputerNameKey(void)
START_TEST(SetComputerNameExW)
{
+ static const WCHAR szNewName[] = L"SRVROSTEST";
LONG Error;
BOOL ret;
HKEY hKeyHN, hKeyCN;
DWORD cbData;
WCHAR szHostNameOld[MAX_PATH], szHostNameNew[MAX_PATH];
WCHAR szComputerNameOld[MAX_PATH], szComputerNameNew[MAX_PATH];
- static const WCHAR szNewName[] = L"SRVROSTEST";
/* Open keys */
hKeyHN = OpenHostNameKey();
+ ok(hKeyHN, "hKeyHN is NULL\n");
hKeyCN = OpenComputerNameKey();
+ ok(hKeyCN, "hKeyCN is NULL\n");
if (!hKeyHN || !hKeyCN)
{
if (hKeyHN)
RegCloseKey(hKeyHN);
if (hKeyCN)
RegCloseKey(hKeyCN);
- skip("Unable to open keys (%p, %p).\n", hKeyHN, hKeyCN);
+ skip("Unable to open keys. Missing Admin rights?\n");
return;
}
@@ -65,14 +67,14 @@ START_TEST(SetComputerNameExW)
cbData = sizeof(szHostNameOld);
Error = RegQueryValueExW(hKeyHN, L"Hostname", NULL, NULL,
(LPBYTE)szHostNameOld, &cbData);
ok_long(Error, ERROR_SUCCESS);
- ok(szHostNameOld[0], "szHostNameOld is %S", szHostNameOld);
+ ok(szHostNameOld[0], "szHostNameOld is empty\n");
/* Get Old Computer Name */
szComputerNameOld[0] = UNICODE_NULL;
cbData = sizeof(szComputerNameOld);
Error = RegQueryValueExW(hKeyCN, L"ComputerName", NULL, NULL,
(LPBYTE)szComputerNameOld, &cbData);
ok_long(Error, ERROR_SUCCESS);
- ok(szComputerNameOld[0], "szHostNameOld is %S", szComputerNameOld);
+ ok(szComputerNameOld[0], "szComputerNameOld is empty\n");
/* Change the value */
ret = SetComputerNameExW(ComputerNamePhysicalDnsHostname, szNewName);
@@ -83,18 +85,18 @@ START_TEST(SetComputerNameExW)
cbData = sizeof(szHostNameNew);
Error = RegQueryValueExW(hKeyHN, L"Hostname", NULL, NULL,
(LPBYTE)szHostNameNew, &cbData);
ok_long(Error, ERROR_SUCCESS);
- ok(szHostNameNew[0], "szHostNameNew was empty.\n");
+ ok(szHostNameNew[0], "szHostNameNew is empty\n");
ok(lstrcmpW(szHostNameNew, szHostNameOld) == 0,
- "szHostNameNew '%S' should be szHostNameOld '%S'.\n",
szHostNameNew, szHostNameOld);
+ "szHostNameNew '%S' should be szHostNameOld '%S'\n",
szHostNameNew, szHostNameOld);
/* Get New Computer Name */
szComputerNameNew[0] = UNICODE_NULL;
cbData = sizeof(szComputerNameNew);
Error = RegQueryValueExW(hKeyCN, L"ComputerName", NULL, NULL,
(LPBYTE)szComputerNameNew, &cbData);
ok_long(Error, ERROR_SUCCESS);
- ok(szComputerNameNew[0], "szComputerNameNew was empty.\n");
+ ok(szComputerNameNew[0], "szComputerNameNew is empty\n");
ok(lstrcmpW(szComputerNameNew, szNewName) == 0,
- "szComputerNameNew '%S' should be szNewName '%S'.\n",
szComputerNameNew, szNewName);
+ "szComputerNameNew '%S' should be szNewName '%S'\n",
szComputerNameNew, szNewName);
/* Restore the registry values */
cbData = (lstrlenW(szHostNameOld) + 1) * sizeof(WCHAR);