ReactOS  0.4.15-dev-5142-g967f5b9
netcfgx.c File Reference
#include <stdio.h>
#include "netcfgx.h"
#include "wine/test.h"
Include dependency graph for netcfgx.c:

Go to the source code of this file.

Macros

#define WIN32_LEAN_AND_MEAN
 
#define COBJMACROS
 

Functions

static void create_configuration (void)
 
 START_TEST (netcfgx)
 

Macro Definition Documentation

◆ COBJMACROS

#define COBJMACROS

Definition at line 21 of file netcfgx.c.

◆ WIN32_LEAN_AND_MEAN

#define WIN32_LEAN_AND_MEAN

Definition at line 18 of file netcfgx.c.

Function Documentation

◆ create_configuration()

static void create_configuration ( void  )
static

Definition at line 29 of file netcfgx.c.

30 {
31  static const WCHAR tcpipW[] = {'M','S','_','T','C','P','I','P',0};
32  static const WCHAR myclient[] = {'M','Y',' ','C','L','I','E','N','T',0};
33  HRESULT hr;
34  INetCfg *config = NULL;
35  INetCfgLock *netlock = NULL;
36  INetCfgComponent *component = NULL;
37  LPWSTR client = NULL;
38 
40  ok(hr == S_OK, "Failed to create object\n");
41  if(SUCCEEDED(hr))
42  {
44  ok(hr == S_OK, "got 0x%08x\n", hr);
45 
46  hr = INetCfgLock_AcquireWriteLock(netlock, 5000, myclient, &client);
47  ok(hr == S_OK ||
48  hr == E_ACCESSDENIED /* Not run as admin */, "got 0x%08x\n", hr);
49  if(hr == S_OK)
50  {
51  trace("Lock value: %s\n", wine_dbgstr_w(client));
53  }
54  else if(hr == E_ACCESSDENIED)
55  trace("Not run with Admin permissions\n");
56 
58  ok(hr == S_OK, "got 0x%08x\n", hr);
59 
60  /* AcquireWriteLock needs to be run before Initialize */
61  hr = INetCfgLock_AcquireWriteLock(netlock, 5000, myclient, &client);
62  todo_wine ok(hr == NETCFG_E_ALREADY_INITIALIZED || hr == E_ACCESSDENIED, "got 0x%08x\n", hr);
63 
64  hr = INetCfg_FindComponent(config, tcpipW, &component);
65  todo_wine ok(hr == S_OK, "got 0x%08x\n", hr);
66  if(hr == S_OK)
67  {
68  INetCfgComponent_Release(component);
69  }
70 
72  todo_wine ok(hr == S_OK || hr == NETCFG_E_NO_WRITE_LOCK, "got 0x%08x\n", hr);
73 
75  ok(hr == S_OK, "got 0x%08x\n", hr);
76 
78  ok(hr == S_OK, "got 0x%08x\n", hr);
79 
80  INetCfgLock_Release(netlock);
82  }
83 }
#define INetCfg_QueryInterface(p, a, b)
Definition: netcfgx.h:287
#define E_ACCESSDENIED
Definition: winerror.h:2849
EXTERN_C const IID IID_INetCfgLock
Definition: netcfgx.h:14
VOID WINAPI CoTaskMemFree(LPVOID ptr)
Definition: ifs.c:442
HRESULT hr
Definition: shlfolder.c:183
char * wine_dbgstr_w(const wchar_t *wstr)
Definition: atltest.h:87
#define todo_wine
Definition: custom.c:79
#define INetCfg_Apply(p)
Definition: netcfgx.h:292
if SUCCEEDED(hr)
#define INetCfg_Initialize(p, a)
Definition: netcfgx.h:290
EXTERN_C const IID IID_INetCfg
Definition: netcfgx.h:300
EXTERN_C const GUID CLSID_CNetCfg
Definition: netcfgx.h:299
#define INetCfg_Release(p)
Definition: netcfgx.h:289
#define trace
Definition: atltest.h:70
__wchar_t WCHAR
Definition: xmlstorage.h:180
LONG HRESULT
Definition: typedefs.h:79
static FILE * client
Definition: client.c:41
#define INetCfgComponent_Release(p)
Definition: netcfgx.h:62
#define NETCFG_E_NO_WRITE_LOCK
Definition: netcfgx.h:305
HRESULT WINAPI DECLSPEC_HOTPATCH CoCreateInstance(REFCLSID rclsid, LPUNKNOWN pUnkOuter, DWORD dwClsContext, REFIID iid, LPVOID *ppv)
Definition: compobj.c:3325
#define INetCfgLock_AcquireWriteLock(p, a, b, c)
Definition: netcfgx.h:24
#define S_OK
Definition: intsafe.h:52
#define ok(value,...)
Definition: atltest.h:57
#define NULL
Definition: types.h:112
#define NETCFG_E_ALREADY_INITIALIZED
Definition: netcfgx.h:302
#define INetCfgLock_Release(p)
Definition: netcfgx.h:23
#define INetCfg_Uninitialize(p)
Definition: netcfgx.h:291
WCHAR * LPWSTR
Definition: xmlstorage.h:184
#define INetCfgLock_ReleaseWriteLock(p)
Definition: netcfgx.h:25
#define INetCfg_FindComponent(p, a, b)
Definition: netcfgx.h:295

Referenced by START_TEST().

◆ START_TEST()

START_TEST ( netcfgx  )

Definition at line 85 of file netcfgx.c.

86 {
87  HRESULT hr;
88 
89  hr = CoInitialize(0);
90  ok( hr == S_OK, "failed to init com\n");
91  if (hr != S_OK)
92  return;
93 
95 
97 }
HRESULT hr
Definition: shlfolder.c:183
static void create_configuration(void)
Definition: netcfgx.c:29
LONG HRESULT
Definition: typedefs.h:79
#define S_OK
Definition: intsafe.h:52
void WINAPI DECLSPEC_HOTPATCH CoUninitialize(void)
Definition: compobj.c:2067
#define ok(value,...)
Definition: atltest.h:57
HRESULT WINAPI CoInitialize(LPVOID lpReserved)
Definition: compobj.c:1964