42{
43 INetCfg *pNetCfg =
NULL;
44 INetCfgLock *pNetCfgLock =
NULL;
45 INetCfgComponent *pTcpipComponent =
NULL;
46 INetCfgComponent *pNicComponent =
NULL;
47 IEnumNetCfgComponent *pEnumNicComponents =
NULL;
51
52 TRACE(
"InstallTypicalNetworkSettings()\n");
53
56 {
57 ERR(
"CoInitialize failed\n");
59 }
60
63 CLSCTX_INPROC_SERVER,
67 {
68 ERR(
"CoCreateInstance failed\n");
70 }
71
72
74 (
PVOID*)&pNetCfgLock);
76 {
77 ERR(
"QueryInterface failed\n");
79 }
80
81 hr = pNetCfgLock->AcquireWriteLock(5000,
85 {
86 ERR(
"AcquireWriteLock failed\n");
88 }
89
91
92
93 hr = pNetCfg->Initialize(
NULL);
95 {
96 ERR(
"Initialize failed\n");
98 }
99
101
102
103 hr = pNetCfg->FindComponent(
L"ms_tcpip",
104 &pTcpipComponent);
106 {
107 FIXME(
"Found the TCP/IP driver!\n");
108 }
109 else
110 {
111 ERR(
"Initialize failed\n");
113 }
114
115 hr = pNetCfg->EnumComponents(&GUID_DEVCLASS_NET,
116 &pEnumNicComponents);
118 {
119 ERR(
"EnumComponents failed\n");
121 }
122
123 for (;;)
124 {
125 hr = pEnumNicComponents->Next(1,
126 &pNicComponent,
129 {
130 TRACE(
"EnumNicComponents done!\n");
131 break;
132 }
133
134 hr = pNicComponent->GetDisplayName(&pszNicName);
136 {
137 FIXME(
"NIC name: %S\n", pszNicName);
139 }
140
141
142
143 pNicComponent->Release();
144 pNicComponent =
NULL;
145 }
146
149 if (pNicComponent !=
NULL)
150 pNicComponent->Release();
151
152 if (pEnumNicComponents !=
NULL)
153 pEnumNicComponents->Release();
154
155 if (pTcpipComponent !=
NULL)
156 pTcpipComponent->Release();
157
158 if (fInitialized)
159 pNetCfg->Uninitialize();
160
161 if (fWriteLocked)
162 pNetCfgLock->ReleaseWriteLock();
163
164 if (pNetCfgLock !=
NULL)
166
168 pNetCfg->Release();
169
171
172 TRACE(
"InstallTypicalNetworkSettings() done!\n");
173
175}
HRESULT WINAPI DECLSPEC_HOTPATCH CoCreateInstance(REFCLSID rclsid, LPUNKNOWN pUnkOuter, DWORD dwClsContext, REFIID iid, LPVOID *ppv)
HRESULT WINAPI CoInitialize(LPVOID lpReserved)
void WINAPI DECLSPEC_HOTPATCH CoUninitialize(void)
VOID WINAPI CoTaskMemFree(LPVOID ptr)
HRESULT QueryInterface([in] REFIID riid, [out, iid_is(riid)] void **ppvObject)
EXTERN_C const IID IID_INetCfgLock
EXTERN_C const GUID CLSID_CNetCfg
EXTERN_C const IID IID_INetCfg