gdiplus/tests: Don't free if alloc failed.
[wine.git] / dlls / netapi32 / tests / ds.c
blob91119155046e8ffa8985069701c4a2b05fc4abb2
1 /*
2 * Copyright 2005 Paul Vriens
4 * Conformance test of the ds functions.
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.
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.
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
21 #include <stdarg.h>
23 #include <wine/test.h>
24 #include <windef.h>
25 #include <winbase.h>
26 #include <winerror.h>
27 #include <dsrole.h>
29 static DWORD (WINAPI *pDsRoleGetPrimaryDomainInformation)(LPCWSTR, DSROLE_PRIMARY_DOMAIN_INFO_LEVEL, PBYTE*);
30 static void (WINAPI *pDsRoleFreeMemory)(PVOID);
32 static void test_params(void)
34 DWORD ret;
35 PDSROLE_PRIMARY_DOMAIN_INFO_BASIC dpdi;
37 SetLastError(0xdeadbeef);
38 ret = pDsRoleGetPrimaryDomainInformation(NULL, DsRolePrimaryDomainInfoBasic, NULL);
39 ok( ret == ERROR_INVALID_PARAMETER, "Expected error ERROR_INVALID_PARAMETER, got (%d)\n", ret);
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);
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);
53 static void test_get(void)
55 DWORD ret;
56 PDSROLE_PRIMARY_DOMAIN_INFO_BASIC dpdi;
57 PDSROLE_UPGRADE_STATUS_INFO dusi;
58 PDSROLE_OPERATION_STATE_INFO dosi;
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);
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);
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);
77 START_TEST(ds)
79 HMODULE hnetapi32 = LoadLibrary("netapi32.dll");
81 pDsRoleGetPrimaryDomainInformation=(void*)GetProcAddress(hnetapi32,"DsRoleGetPrimaryDomainInformation");
82 if (pDsRoleGetPrimaryDomainInformation)
84 pDsRoleFreeMemory=(void*)GetProcAddress(hnetapi32,"DsRoleFreeMemory");
86 test_params();
87 test_get();
89 else
90 skip("DsRoleGetPrimaryDomainInformation is not available\n");
92 FreeLibrary(hnetapi32);