directmanipulation: Return S_OK form viewport_SetViewportOptions stub.
[wine/zf.git] / dlls / netcfgx / tests / netcfgx.c
blob31558f44f429d30e4f62a68d43bc09ac40944b54
1 /*
2 * Copyright 2014 Alistair Leslie-Hughes
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 2.1 of the License, or (at your option) any later version.
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Lesser General Public License for more details.
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with this library; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
18 #define WIN32_LEAN_AND_MEAN
19 #include <stdio.h>
21 #define COBJMACROS
23 #include "netcfgx.h"
24 #include "wine/test.h"
26 static void create_configuration(void)
28 HRESULT hr;
29 INetCfg *config = NULL;
30 INetCfgLock *netlock = NULL;
31 INetCfgComponent *component = NULL;
32 LPWSTR client = NULL;
34 hr = CoCreateInstance( &CLSID_CNetCfg, NULL, CLSCTX_ALL, &IID_INetCfg, (LPVOID*)&config);
35 ok(hr == S_OK, "Failed to create object\n");
36 if(SUCCEEDED(hr))
38 hr = INetCfg_QueryInterface(config, &IID_INetCfgLock, (LPVOID*)&netlock);
39 ok(hr == S_OK, "got 0x%08x\n", hr);
41 hr = INetCfgLock_AcquireWriteLock(netlock, 5000, L"MY CLIENT", &client);
42 ok(hr == S_OK ||
43 hr == E_ACCESSDENIED /* Not run as admin */, "got 0x%08x\n", hr);
44 if(hr == S_OK)
46 trace("Lock value: %s\n", wine_dbgstr_w(client));
47 CoTaskMemFree(client);
49 else if(hr == E_ACCESSDENIED)
50 trace("Not run with Admin permissions\n");
52 hr = INetCfg_Initialize(config, NULL);
53 ok(hr == S_OK, "got 0x%08x\n", hr);
55 /* AcquireWriteLock needs to be run before Initialize */
56 hr = INetCfgLock_AcquireWriteLock(netlock, 5000, L"MY CLIENT", &client);
57 todo_wine ok(hr == NETCFG_E_ALREADY_INITIALIZED || hr == E_ACCESSDENIED, "got 0x%08x\n", hr);
59 hr = INetCfg_FindComponent(config, L"MS_TCPIP", &component);
60 todo_wine ok(hr == S_OK, "got 0x%08x\n", hr);
61 if(hr == S_OK)
63 INetCfgComponent_Release(component);
66 hr = INetCfg_Apply(config);
67 todo_wine ok(hr == S_OK || hr == NETCFG_E_NO_WRITE_LOCK, "got 0x%08x\n", hr);
69 hr = INetCfg_Uninitialize(config);
70 ok(hr == S_OK, "got 0x%08x\n", hr);
72 hr = INetCfgLock_ReleaseWriteLock(netlock);
73 ok(hr == S_OK, "got 0x%08x\n", hr);
75 INetCfgLock_Release(netlock);
76 INetCfg_Release(config);
80 START_TEST(netcfgx)
82 HRESULT hr;
84 hr = CoInitialize(0);
85 ok( hr == S_OK, "failed to init com\n");
86 if (hr != S_OK)
87 return;
89 create_configuration();
91 CoUninitialize();