ReactOS 0.4.15-dev-7953-g1f49173
ds.c
Go to the documentation of this file.
1/*
2 * Copyright 2005 Paul Vriens
3 *
4 * Conformance test of the ds functions.
5 *
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
10 *
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
15 *
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
19 */
20
21#include <stdarg.h>
22
23#include <wine/test.h>
24#include <windef.h>
25#include <winbase.h>
26#include <winerror.h>
27#include <dsrole.h>
28
29static DWORD (WINAPI *pDsRoleGetPrimaryDomainInformation)(LPCWSTR, DSROLE_PRIMARY_DOMAIN_INFO_LEVEL, PBYTE*);
30static void (WINAPI *pDsRoleFreeMemory)(PVOID);
31
32static void test_params(void)
33{
34 DWORD ret;
36
37 SetLastError(0xdeadbeef);
38 ret = pDsRoleGetPrimaryDomainInformation(NULL, DsRolePrimaryDomainInfoBasic, NULL);
39 ok( ret == ERROR_INVALID_PARAMETER, "Expected error ERROR_INVALID_PARAMETER, got (%d)\n", ret);
40
41 SetLastError(0xdeadbeef);
42 ret = pDsRoleGetPrimaryDomainInformation(NULL, 0, NULL);
43 ok( ret == ERROR_INVALID_PARAMETER, "Expected error ERROR_INVALID_PARAMETER, got (%d)\n", ret);
44 SetLastError(0xdeadbeef);
45 ret = pDsRoleGetPrimaryDomainInformation(NULL, 4, NULL);
46 ok( ret == ERROR_INVALID_PARAMETER, "Expected error ERROR_INVALID_PARAMETER, got (%d)\n", ret);
47
48 SetLastError(0xdeadbeef);
49 ret = pDsRoleGetPrimaryDomainInformation(NULL, 4, (PBYTE *)&dpdi);
50 ok( ret == ERROR_INVALID_PARAMETER, "Expected error ERROR_INVALID_PARAMETER, got (%d)\n", ret);
51}
52
53static void test_get(void)
54{
55 DWORD ret;
59
60 SetLastError(0xdeadbeef);
61 ret = pDsRoleGetPrimaryDomainInformation(NULL, DsRolePrimaryDomainInfoBasic, (PBYTE *)&dpdi);
62 ok( ret == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got (%d)\n", ret);
63 pDsRoleFreeMemory(dpdi);
64
65 SetLastError(0xdeadbeef);
66 ret = pDsRoleGetPrimaryDomainInformation(NULL, DsRoleUpgradeStatus, (PBYTE *)&dusi);
67 todo_wine { ok( ret == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got (%d)\n", ret); }
68 pDsRoleFreeMemory(dusi);
69
70 SetLastError(0xdeadbeef);
71 ret = pDsRoleGetPrimaryDomainInformation(NULL, DsRoleOperationState, (PBYTE *)&dosi);
72 todo_wine { ok( ret == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got (%d)\n", ret); }
73 pDsRoleFreeMemory(dosi);
74}
75
76
78{
79 HMODULE hnetapi32 = LoadLibraryA("netapi32.dll");
80
81 pDsRoleGetPrimaryDomainInformation=(void*)GetProcAddress(hnetapi32,"DsRoleGetPrimaryDomainInformation");
82 if (pDsRoleGetPrimaryDomainInformation)
83 {
84 pDsRoleFreeMemory=(void*)GetProcAddress(hnetapi32,"DsRoleFreeMemory");
85
87 test_get();
88 }
89 else
90 win_skip("DsRoleGetPrimaryDomainInformation is not available\n");
91
92 FreeLibrary(hnetapi32);
93}
#define ok(value,...)
Definition: atltest.h:57
#define START_TEST(x)
Definition: atltest.h:75
#define ERROR_SUCCESS
Definition: deptool.c:10
#define NULL
Definition: types.h:112
#define ERROR_INVALID_PARAMETER
Definition: compat.h:101
#define SetLastError(x)
Definition: compat.h:752
#define GetProcAddress(x, y)
Definition: compat.h:753
#define FreeLibrary(x)
Definition: compat.h:748
HINSTANCE WINAPI DECLSPEC_HOTPATCH LoadLibraryA(LPCSTR lpLibFileName)
Definition: loader.c:111
static DSROLE_PRIMARY_DOMAIN_INFO_LEVEL
Definition: ds.c:29
static void test_get(void)
Definition: ds.c:53
static void test_params(void)
Definition: ds.c:32
@ DsRolePrimaryDomainInfoBasic
Definition: dsrole.h:32
@ DsRoleUpgradeStatus
Definition: dsrole.h:33
@ DsRoleOperationState
Definition: dsrole.h:34
unsigned long DWORD
Definition: ntddk_ex.h:95
#define ds
Definition: i386-dis.c:443
#define todo_wine
Definition: custom.c:79
#define DWORD
Definition: nt_native.h:44
BYTE * PBYTE
Definition: pedump.c:66
#define win_skip
Definition: test.h:160
void * PVOID
Definition: typedefs.h:50
int ret
#define WINAPI
Definition: msvc.h:6
const WCHAR * LPCWSTR
Definition: xmlstorage.h:185