From e5654cce9f4710f02acef0acfda6efe05a71d158 Mon Sep 17 00:00:00 2001 From: Colin Finck Date: Mon, 26 Jun 2017 15:19:07 +0000 Subject: [PATCH] [NETAPI32_APITEST] Add a simple API Test for netapi32.dll, only covering DsRoleGetPrimaryDomainInformation so far. It succeeds in ReactOS, but outputs a heap error in the debug log. In real world applications, this later leads to a heap assertion failure. svn path=/trunk/; revision=75208 --- rostests/apitests/CMakeLists.txt | 1 + rostests/apitests/netapi32/CMakeLists.txt | 10 +++++++ .../DsRoleGetPrimaryDomainInformation.c | 27 +++++++++++++++++++ rostests/apitests/netapi32/testlist.c | 20 ++++++++++++++ 4 files changed, 58 insertions(+) create mode 100644 rostests/apitests/netapi32/CMakeLists.txt create mode 100644 rostests/apitests/netapi32/DsRoleGetPrimaryDomainInformation.c create mode 100644 rostests/apitests/netapi32/testlist.c diff --git a/rostests/apitests/CMakeLists.txt b/rostests/apitests/CMakeLists.txt index 3999bfc6c01..f9fd5d25dc7 100644 --- a/rostests/apitests/CMakeLists.txt +++ b/rostests/apitests/CMakeLists.txt @@ -20,6 +20,7 @@ endif() add_subdirectory(localspl) add_subdirectory(msgina) add_subdirectory(msvcrt) +add_subdirectory(netapi32) add_subdirectory(netshell) add_subdirectory(ntdll) add_subdirectory(ole32) diff --git a/rostests/apitests/netapi32/CMakeLists.txt b/rostests/apitests/netapi32/CMakeLists.txt new file mode 100644 index 00000000000..78ea60db622 --- /dev/null +++ b/rostests/apitests/netapi32/CMakeLists.txt @@ -0,0 +1,10 @@ + +list(APPEND SOURCE + DsRoleGetPrimaryDomainInformation.c + testlist.c) + +add_executable(netapi32_apitest ${SOURCE}) +target_link_libraries(netapi32_apitest wine ${PSEH_LIB}) +set_module_type(netapi32_apitest win32cui) +add_importlibs(netapi32_apitest netapi32 msvcrt kernel32 ntdll) +add_rostests_file(TARGET netapi32_apitest) diff --git a/rostests/apitests/netapi32/DsRoleGetPrimaryDomainInformation.c b/rostests/apitests/netapi32/DsRoleGetPrimaryDomainInformation.c new file mode 100644 index 00000000000..6b1a31bbff0 --- /dev/null +++ b/rostests/apitests/netapi32/DsRoleGetPrimaryDomainInformation.c @@ -0,0 +1,27 @@ +/* + * PROJECT: ReactOS netapi32.dll API Tests + * LICENSE: GNU GPLv2 or any later version as published by the Free Software Foundation + * PURPOSE: Tests for DsRoleGetPrimaryDomainInformation + * COPYRIGHT: Copyright 2017 Colin Finck + */ + +#include + +#define WIN32_NO_STATUS +#include +#include +#include + +START_TEST(DsRoleGetPrimaryDomainInformation) +{ + DWORD dwErrorCode; + PDSROLE_PRIMARY_DOMAIN_INFO_BASIC pInfo = NULL; + + // Get information about the domain membership of this computer. + dwErrorCode = DsRoleGetPrimaryDomainInformation(NULL, DsRolePrimaryDomainInfoBasic, (PBYTE*)&pInfo); + ok(dwErrorCode == ERROR_SUCCESS, "DsRoleGetPrimaryDomainInformation returns %lu!\n", dwErrorCode); + ok(pInfo->MachineRole >= DsRole_RoleStandaloneWorkstation && pInfo->MachineRole <= DsRole_RolePrimaryDomainController, "pInfo->MachineRole is %lu!\n", pInfo->MachineRole); + + if (pInfo) + DsRoleFreeMemory(pInfo); +} diff --git a/rostests/apitests/netapi32/testlist.c b/rostests/apitests/netapi32/testlist.c new file mode 100644 index 00000000000..71249eb7bbc --- /dev/null +++ b/rostests/apitests/netapi32/testlist.c @@ -0,0 +1,20 @@ +/* + * PROJECT: ReactOS netapi32.dll API Tests + * LICENSE: GNU GPLv2 or any later version as published by the Free Software Foundation + * PURPOSE: Test list + * COPYRIGHT: Copyright 2017 Colin Finck + */ + +#define __ROS_LONG64__ + +#define STANDALONE +#include + +extern void func_DsRoleGetPrimaryDomainInformation(void); + +const struct test winetest_testlist[] = +{ + { "DsRoleGetPrimaryDomainInformation", func_DsRoleGetPrimaryDomainInformation }, + + { 0, 0 } +};