static ULONG WINAPI INetConnectionPropertyUi2_fnRelease( INetConnectionPropertyUi2 * iface) { INetConnectionPropertyUiImpl * This = (INetConnectionPropertyUiImpl*)iface; ULONG refCount = InterlockedDecrement(&This->ref); if (!refCount) { if (This->pNCfg) { INetCfg_Uninitialize(This->pNCfg); INetCfg_Release(This->pNCfg); } if (This->NCfgLock) { INetCfgLock_Release(This->NCfgLock); } if (This->pProperties) { NcFreeNetconProperties(This->pProperties); } CoTaskMemFree (This); } return refCount; }
static void create_configuration(void) { static const WCHAR tcpipW[] = {'M','S','_','T','C','P','I','P',0}; static const WCHAR myclient[] = {'M','Y',' ','C','L','I','E','N','T',0}; HRESULT hr; INetCfg *config = NULL; INetCfgLock *netlock = NULL; INetCfgComponent *component = NULL; LPWSTR client = NULL; hr = CoCreateInstance( &CLSID_CNetCfg, NULL, CLSCTX_ALL, &IID_INetCfg, (LPVOID*)&config); ok(hr == S_OK, "Failed to create object\n"); if(SUCCEEDED(hr)) { hr = INetCfg_QueryInterface(config, &IID_INetCfgLock, (LPVOID*)&netlock); ok(hr == S_OK, "got 0x%08x\n", hr); hr = INetCfgLock_AcquireWriteLock(netlock, 5000, myclient, &client); ok(hr == S_OK || hr == E_ACCESSDENIED /* Not run as admin */, "got 0x%08x\n", hr); if(hr == S_OK) { trace("Lock value: %s\n", wine_dbgstr_w(client)); CoTaskMemFree(client); } else if(hr == E_ACCESSDENIED) trace("Not run with Admin permissions\n"); hr = INetCfg_Initialize(config, NULL); ok(hr == S_OK, "got 0x%08x\n", hr); /* AcquireWriteLock needs to be run before Initialize */ hr = INetCfgLock_AcquireWriteLock(netlock, 5000, myclient, &client); todo_wine ok(hr == NETCFG_E_ALREADY_INITIALIZED || hr == E_ACCESSDENIED, "got 0x%08x\n", hr); hr = INetCfg_FindComponent(config, tcpipW, &component); todo_wine ok(hr == S_OK, "got 0x%08x\n", hr); if(hr == S_OK) { INetCfgComponent_Release(component); } hr = INetCfg_Apply(config); todo_wine ok(hr == S_OK || hr == NETCFG_E_NO_WRITE_LOCK, "got 0x%08x\n", hr); hr = INetCfg_Uninitialize(config); ok(hr == S_OK, "got 0x%08x\n", hr); hr = INetCfgLock_ReleaseWriteLock(netlock); ok(hr == S_OK, "got 0x%08x\n", hr); INetCfg_Release(config); } }