https://git.reactos.org/?p=reactos.git;a=commitdiff;h=dbc20b6484408b807b4d29...
commit dbc20b6484408b807b4d2971e4f3afe174104e07 Author: Katayama Hirofumi MZ katayama.hirofumi.mz@gmail.com AuthorDate: Mon May 27 11:24:16 2019 +0900 Commit: GitHub noreply@github.com CommitDate: Mon May 27 11:24:16 2019 +0900
[KERNEL32_APITEST] Check also 'NV Hostname' in SetComputerNameExW testcase (#1581)
Also test NV Hostname registry value in the testcase of kernel32!SetComputerNameW. ROSTESTS-322 --- .../rostests/apitests/kernel32/SetComputerNameExW.c | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+)
diff --git a/modules/rostests/apitests/kernel32/SetComputerNameExW.c b/modules/rostests/apitests/kernel32/SetComputerNameExW.c index 5019265400..89ba26460a 100644 --- a/modules/rostests/apitests/kernel32/SetComputerNameExW.c +++ b/modules/rostests/apitests/kernel32/SetComputerNameExW.c @@ -44,6 +44,7 @@ START_TEST(SetComputerNameExW) BOOL ret; HKEY hKeyHN, hKeyCN; DWORD cbData; + WCHAR szNVHostNameOld[MAX_PATH], szNVHostNameNew[MAX_PATH]; WCHAR szHostNameOld[MAX_PATH], szHostNameNew[MAX_PATH]; WCHAR szComputerNameOld[MAX_PATH], szComputerNameNew[MAX_PATH];
@@ -62,6 +63,13 @@ START_TEST(SetComputerNameExW) return; }
+ /* Get Old NV Hostname */ + szNVHostNameOld[0] = UNICODE_NULL; + cbData = sizeof(szNVHostNameOld); + Error = RegQueryValueExW(hKeyHN, L"NV Hostname", NULL, NULL, (LPBYTE)szNVHostNameOld, &cbData); + ok_long(Error, ERROR_SUCCESS); + ok(szNVHostNameOld[0], "szNVHostNameOld is empty\n"); + /* Get Old Hostname */ szHostNameOld[0] = UNICODE_NULL; cbData = sizeof(szHostNameOld); @@ -80,6 +88,15 @@ START_TEST(SetComputerNameExW) ret = SetComputerNameExW(ComputerNamePhysicalDnsHostname, szNewName); ok_int(ret, TRUE);
+ /* Get New NV Hostname */ + szNVHostNameNew[0] = UNICODE_NULL; + cbData = sizeof(szNVHostNameNew); + Error = RegQueryValueExW(hKeyHN, L"NV Hostname", NULL, NULL, (LPBYTE)szNVHostNameNew, &cbData); + ok_long(Error, ERROR_SUCCESS); + ok(szNVHostNameNew[0], "szNVHostNameNew is empty\n"); + ok(lstrcmpW(szNVHostNameNew, szNewName) == 0, + "szNVHostNameNew '%S' should be szNewName '%S'\n", szNVHostNameNew, szNewName); + /* Get New Hostname */ szHostNameNew[0] = UNICODE_NULL; cbData = sizeof(szHostNameNew); @@ -99,6 +116,10 @@ START_TEST(SetComputerNameExW) "szComputerNameNew '%S' should be szNewName '%S'\n", szComputerNameNew, szNewName);
/* Restore the registry values */ + cbData = (lstrlenW(szNVHostNameOld) + 1) * sizeof(WCHAR); + Error = RegSetValueExW(hKeyHN, L"NV Hostname", 0, REG_SZ, (LPBYTE)szNVHostNameOld, cbData); + ok_long(Error, ERROR_SUCCESS); + cbData = (lstrlenW(szHostNameOld) + 1) * sizeof(WCHAR); Error = RegSetValueExW(hKeyHN, L"Hostname", 0, REG_SZ, (LPBYTE)szHostNameOld, cbData); ok_long(Error, ERROR_SUCCESS);