ReactOS  0.4.15-dev-448-gd6c4411
service.c
Go to the documentation of this file.
1 /*
2  * Copyright 2009 Hans Leidekker for CodeWeavers
3  *
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.
8  *
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.
13  *
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
17  */
18 
19 #include <stdarg.h>
20 #include <stdio.h>
21 
22 #define COBJMACROS
23 
24 #include "windef.h"
25 #include "winbase.h"
26 #include "winuser.h"
27 #include "ole2.h"
28 #include "netfw.h"
29 
30 #include "wine/debug.h"
31 #include "hnetcfg_private.h"
32 
34 
35 typedef struct fw_service
36 {
39 } fw_service;
40 
42 {
43  return CONTAINING_RECORD(iface, fw_service, INetFwService_iface);
44 }
45 
47  INetFwService *iface )
48 {
51 }
52 
54  INetFwService *iface )
55 {
58  if (!refs)
59  {
60  TRACE("destroying %p\n", fw_service);
62  }
63  return refs;
64 }
65 
67  INetFwService *iface,
68  REFIID riid,
69  void **ppvObject )
70 {
72 
73  TRACE("%p %s %p\n", This, debugstr_guid( riid ), ppvObject );
74 
75  if ( IsEqualGUID( riid, &IID_INetFwService ) ||
78  {
79  *ppvObject = iface;
80  }
81  else
82  {
83  FIXME("interface %s not implemented\n", debugstr_guid(riid));
84  return E_NOINTERFACE;
85  }
86  INetFwService_AddRef( iface );
87  return S_OK;
88 }
89 
91  INetFwService *iface,
92  UINT *pctinfo )
93 {
95 
96  FIXME("%p %p\n", This, pctinfo);
97  return E_NOTIMPL;
98 }
99 
101  INetFwService *iface,
102  UINT iTInfo,
103  LCID lcid,
104  ITypeInfo **ppTInfo )
105 {
107 
108  FIXME("%p %u %u %p\n", This, iTInfo, lcid, ppTInfo);
109  return E_NOTIMPL;
110 }
111 
113  INetFwService *iface,
114  REFIID riid,
115  LPOLESTR *rgszNames,
116  UINT cNames,
117  LCID lcid,
118  DISPID *rgDispId )
119 {
121 
122  FIXME("%p %s %p %u %u %p\n", This, debugstr_guid(riid), rgszNames, cNames, lcid, rgDispId);
123  return E_NOTIMPL;
124 }
125 
127  INetFwService *iface,
128  DISPID dispIdMember,
129  REFIID riid,
130  LCID lcid,
131  WORD wFlags,
132  DISPPARAMS *pDispParams,
133  VARIANT *pVarResult,
134  EXCEPINFO *pExcepInfo,
135  UINT *puArgErr )
136 {
138 
139  FIXME("%p %d %s %d %d %p %p %p %p\n", This, dispIdMember, debugstr_guid(riid),
140  lcid, wFlags, pDispParams, pVarResult, pExcepInfo, puArgErr);
141  return E_NOTIMPL;
142 }
143 
145  INetFwService *iface,
146  BSTR *name )
147 {
149 
150  FIXME("%p %p\n", This, name);
151  return E_NOTIMPL;
152 }
153 
155  INetFwService *iface,
157 {
159 
160  FIXME("%p %p\n", This, type);
161  return E_NOTIMPL;
162 }
163 
165  INetFwService *iface,
166  VARIANT_BOOL *customized )
167 {
169 
170  FIXME("%p %p\n", This, customized);
171  return E_NOTIMPL;
172 }
173 
175  INetFwService *iface,
176  NET_FW_IP_VERSION *ipVersion )
177 {
179 
180  FIXME("%p %p\n", This, ipVersion);
181  return E_NOTIMPL;
182 }
183 
185  INetFwService *iface,
186  NET_FW_IP_VERSION ipVersion )
187 {
189 
190  FIXME("%p %u\n", This, ipVersion);
191  return E_NOTIMPL;
192 }
193 
195  INetFwService *iface,
196  NET_FW_SCOPE *scope )
197 {
199 
200  FIXME("%p %p\n", This, scope);
201  return E_NOTIMPL;
202 }
203 
205  INetFwService *iface,
206  NET_FW_SCOPE scope )
207 {
209 
210  FIXME("%p %u\n", This, scope);
211  return E_NOTIMPL;
212 }
213 
215  INetFwService *iface,
216  BSTR *remoteAddrs )
217 {
219 
220  FIXME("%p %p\n", This, remoteAddrs);
221  return E_NOTIMPL;
222 }
223 
225  INetFwService *iface,
226  BSTR remoteAddrs )
227 {
229 
230  FIXME("%p %s\n", This, debugstr_w(remoteAddrs));
231  return E_NOTIMPL;
232 }
233 
235  INetFwService *iface,
237 {
239 
240  FIXME("%p %p\n", This, enabled);
241  return E_NOTIMPL;
242 }
243 
245  INetFwService *iface,
247 {
249 
250  FIXME("%p %d\n", This, enabled);
251  return E_NOTIMPL;
252 }
253 
255  INetFwService *iface,
256  INetFwOpenPorts **openPorts )
257 {
259 
260  TRACE("%p %p\n", This, openPorts);
261  return NetFwOpenPorts_create( NULL, (void **)openPorts );
262 }
263 
264 static const struct INetFwServiceVtbl fw_service_vtbl =
265 {
285 };
286 
287 static HRESULT NetFwService_create( IUnknown *pUnkOuter, LPVOID *ppObj )
288 {
289  fw_service *fp;
290 
291  TRACE("(%p,%p)\n", pUnkOuter, ppObj);
292 
293  fp = HeapAlloc( GetProcessHeap(), 0, sizeof(*fp) );
294  if (!fp) return E_OUTOFMEMORY;
295 
296  fp->INetFwService_iface.lpVtbl = &fw_service_vtbl;
297  fp->refs = 1;
298 
299  *ppObj = &fp->INetFwService_iface;
300 
301  TRACE("returning iface %p\n", *ppObj);
302  return S_OK;
303 }
304 
305 typedef struct fw_services
306 {
309 } fw_services;
310 
312 {
313  return CONTAINING_RECORD(iface, fw_services, INetFwServices_iface);
314 }
315 
317  INetFwServices *iface )
318 {
321 }
322 
324  INetFwServices *iface )
325 {
328  if (!refs)
329  {
330  TRACE("destroying %p\n", fw_services);
332  }
333  return refs;
334 }
335 
337  INetFwServices *iface,
338  REFIID riid,
339  void **ppvObject )
340 {
342 
343  TRACE("%p %s %p\n", This, debugstr_guid( riid ), ppvObject );
344 
345  if ( IsEqualGUID( riid, &IID_INetFwServices ) ||
348  {
349  *ppvObject = iface;
350  }
351  else
352  {
353  FIXME("interface %s not implemented\n", debugstr_guid(riid));
354  return E_NOINTERFACE;
355  }
356  INetFwServices_AddRef( iface );
357  return S_OK;
358 }
359 
361  INetFwServices *iface,
362  UINT *pctinfo )
363 {
365 
366  FIXME("%p %p\n", This, pctinfo);
367  return E_NOTIMPL;
368 }
369 
371  INetFwServices *iface,
372  UINT iTInfo,
373  LCID lcid,
374  ITypeInfo **ppTInfo )
375 {
377 
378  FIXME("%p %u %u %p\n", This, iTInfo, lcid, ppTInfo);
379  return E_NOTIMPL;
380 }
381 
383  INetFwServices *iface,
384  REFIID riid,
385  LPOLESTR *rgszNames,
386  UINT cNames,
387  LCID lcid,
388  DISPID *rgDispId )
389 {
391 
392  FIXME("%p %s %p %u %u %p\n", This, debugstr_guid(riid), rgszNames, cNames, lcid, rgDispId);
393  return E_NOTIMPL;
394 }
395 
397  INetFwServices *iface,
398  DISPID dispIdMember,
399  REFIID riid,
400  LCID lcid,
401  WORD wFlags,
402  DISPPARAMS *pDispParams,
403  VARIANT *pVarResult,
404  EXCEPINFO *pExcepInfo,
405  UINT *puArgErr )
406 {
408 
409  FIXME("%p %d %s %d %d %p %p %p %p\n", This, dispIdMember, debugstr_guid(riid),
410  lcid, wFlags, pDispParams, pVarResult, pExcepInfo, puArgErr);
411  return E_NOTIMPL;
412 }
413 
415  INetFwServices *iface,
416  LONG *count )
417 {
419 
420  FIXME("%p, %p\n", This, count);
421 
422  *count = 0;
423  return S_OK;
424 }
425 
427  INetFwServices *iface,
428  NET_FW_SERVICE_TYPE svcType,
429  INetFwService **service )
430 {
432 
433  FIXME("%p, %u, %p\n", This, svcType, service);
434  return NetFwService_create( NULL, (void **)service );
435 }
436 
438  INetFwServices *iface,
439  IUnknown **newEnum )
440 {
442 
443  FIXME("%p, %p\n", This, newEnum);
444  return E_NOTIMPL;
445 }
446 
447 static const struct INetFwServicesVtbl fw_services_vtbl =
448 {
459 };
460 
462 {
463  fw_services *fp;
464 
465  TRACE("(%p,%p)\n", pUnkOuter, ppObj);
466 
467  fp = HeapAlloc( GetProcessHeap(), 0, sizeof(*fp) );
468  if (!fp) return E_OUTOFMEMORY;
469 
471  fp->refs = 1;
472 
473  *ppObj = &fp->INetFwServices_iface;
474 
475  TRACE("returning iface %p\n", *ppObj);
476  return S_OK;
477 }
LONG refs
Definition: service.c:308
static HRESULT WINAPI fw_service_Invoke(INetFwService *iface, DISPID dispIdMember, REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *pDispParams, VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr)
Definition: service.c:126
#define REFIID
Definition: guiddef.h:118
#define E_NOINTERFACE
Definition: winerror.h:2364
LONG refs
Definition: service.c:38
static HRESULT WINAPI fw_services_get_Count(INetFwServices *iface, LONG *count)
Definition: service.c:414
REFIID riid
Definition: precomp.h:44
GLuint GLuint GLsizei count
Definition: gl.h:1545
static fw_services * impl_from_INetFwServices(INetFwServices *iface)
Definition: service.c:311
static HRESULT WINAPI fw_service_QueryInterface(INetFwService *iface, REFIID riid, void **ppvObject)
Definition: service.c:66
GLuint GLuint GLsizei GLenum type
Definition: gl.h:1545
static HRESULT WINAPI fw_service_put_Scope(INetFwService *iface, NET_FW_SCOPE scope)
Definition: service.c:204
DWORD LCID
Definition: nls.h:13
OLECHAR * BSTR
Definition: compat.h:1943
WINE_DEFAULT_DEBUG_CHANNEL(msiexec)
static HRESULT WINAPI fw_services_GetTypeInfoCount(INetFwServices *iface, UINT *pctinfo)
Definition: service.c:360
static LPOLESTR
Definition: stg_prop.c:27
enum NET_FW_IP_VERSION_ NET_FW_IP_VERSION
GLenum GLenum GLsizei const GLuint GLboolean enabled
Definition: glext.h:7750
short VARIANT_BOOL
Definition: compat.h:1940
static ULONG WINAPI fw_services_AddRef(INetFwServices *iface)
Definition: service.c:316
static HRESULT WINAPI fw_service_get_RemoteAddresses(INetFwService *iface, BSTR *remoteAddrs)
Definition: service.c:214
HRESULT NetFwOpenPorts_create(IUnknown *, LPVOID *) DECLSPEC_HIDDEN
Definition: port.c:589
INetFwService INetFwService_iface
Definition: service.c:37
static HRESULT WINAPI fw_service_get_GloballyOpenPorts(INetFwService *iface, INetFwOpenPorts **openPorts)
Definition: service.c:254
#define E_OUTOFMEMORY
Definition: ddrawi.h:100
static HRESULT WINAPI fw_services_Invoke(INetFwServices *iface, DISPID dispIdMember, REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *pDispParams, VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr)
Definition: service.c:396
long LONG
Definition: pedump.c:60
enum NET_FW_SCOPE_ NET_FW_SCOPE
#define debugstr_w
Definition: kernel32.h:32
#define FIXME(fmt,...)
Definition: debug.h:111
smooth NULL
Definition: ftsmooth.c:416
#define debugstr_guid
Definition: kernel32.h:35
PFLT_MESSAGE_WAITER_QUEUE CONTAINING_RECORD(Csq, DEVICE_EXTENSION, IrpQueue)) -> WaiterQ.mLock) _IRQL_raises_(DISPATCH_LEVEL) VOID NTAPI FltpAcquireMessageWaiterLock(_In_ PIO_CSQ Csq, _Out_ PKIRQL Irql)
Definition: Messaging.c:560
static HRESULT WINAPI fw_service_GetIDsOfNames(INetFwService *iface, REFIID riid, LPOLESTR *rgszNames, UINT cNames, LCID lcid, DISPID *rgDispId)
Definition: service.c:112
static HRESULT WINAPI fw_services_GetIDsOfNames(INetFwServices *iface, REFIID riid, LPOLESTR *rgszNames, UINT cNames, LCID lcid, DISPID *rgDispId)
Definition: service.c:382
static HRESULT WINAPI fw_service_get_IpVersion(INetFwService *iface, NET_FW_IP_VERSION *ipVersion)
Definition: service.c:174
#define TRACE(s)
Definition: solgame.cpp:4
#define GetProcessHeap()
Definition: compat.h:404
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
static HRESULT NetFwService_create(IUnknown *pUnkOuter, LPVOID *ppObj)
Definition: service.c:287
static HRESULT WINAPI fw_service_GetTypeInfo(INetFwService *iface, UINT iTInfo, LCID lcid, ITypeInfo **ppTInfo)
Definition: service.c:100
LONG HRESULT
Definition: typedefs.h:78
const GUID IID_IUnknown
static HRESULT WINAPI fw_services_get__NewEnum(INetFwServices *iface, IUnknown **newEnum)
Definition: service.c:437
#define WINAPI
Definition: msvc.h:6
unsigned short WORD
Definition: ntddk_ex.h:93
static HRESULT WINAPI fw_service_get_Customized(INetFwService *iface, VARIANT_BOOL *customized)
Definition: service.c:164
HRESULT NetFwServices_create(IUnknown *pUnkOuter, LPVOID *ppObj)
Definition: service.c:461
enum NET_FW_SERVICE_TYPE_ NET_FW_SERVICE_TYPE
static fw_service * impl_from_INetFwService(INetFwService *iface)
Definition: service.c:41
const GUID IID_IDispatch
#define InterlockedDecrement
Definition: armddk.h:52
static ULONG WINAPI fw_services_Release(INetFwServices *iface)
Definition: service.c:323
static HRESULT WINAPI fw_service_GetTypeInfoCount(INetFwService *iface, UINT *pctinfo)
Definition: service.c:90
REFIID LPVOID * ppvObject
Definition: precomp.h:44
static HRESULT WINAPI fw_services_GetTypeInfo(INetFwServices *iface, UINT iTInfo, LCID lcid, ITypeInfo **ppTInfo)
Definition: service.c:370
static HRESULT WINAPI fw_service_put_RemoteAddresses(INetFwService *iface, BSTR remoteAddrs)
Definition: service.c:224
static HRESULT WINAPI fw_services_Item(INetFwServices *iface, NET_FW_SERVICE_TYPE svcType, INetFwService **service)
Definition: service.c:426
_In_ DWORD _Out_ _In_ WORD wFlags
Definition: wincon.h:534
struct stdole::EXCEPINFO EXCEPINFO
static VARIANTARG static DISPID
Definition: ordinal.c:49
#define S_OK
Definition: intsafe.h:59
struct fw_service fw_service
#define InterlockedIncrement
Definition: armddk.h:53
static HRESULT WINAPI fw_service_get_Scope(INetFwService *iface, NET_FW_SCOPE *scope)
Definition: service.c:194
static HRESULT WINAPI fw_service_get_Enabled(INetFwService *iface, VARIANT_BOOL *enabled)
Definition: service.c:234
static const struct INetFwServiceVtbl fw_service_vtbl
Definition: service.c:264
struct fw_services fw_services
#define E_NOTIMPL
Definition: ddrawi.h:99
static const struct INetFwServicesVtbl fw_services_vtbl
Definition: service.c:447
unsigned int UINT
Definition: ndis.h:50
BOOL WINAPI IsEqualGUID(REFGUID rguid1, REFGUID rguid2)
Definition: compobj.c:4112
INetFwServices INetFwServices_iface
Definition: service.c:307
static HRESULT WINAPI fw_services_QueryInterface(INetFwServices *iface, REFIID riid, void **ppvObject)
Definition: service.c:336
Definition: name.c:38
struct stdole::DISPPARAMS DISPPARAMS
unsigned int ULONG
Definition: retypes.h:1
static ULONG WINAPI fw_service_Release(INetFwService *iface)
Definition: service.c:53
static HRESULT WINAPI fw_service_get_Type(INetFwService *iface, NET_FW_SERVICE_TYPE *type)
Definition: service.c:154
static HRESULT WINAPI fw_service_put_IpVersion(INetFwService *iface, NET_FW_IP_VERSION ipVersion)
Definition: service.c:184
static ULONG WINAPI fw_service_AddRef(INetFwService *iface)
Definition: service.c:46
#define HeapFree(x, y, z)
Definition: compat.h:403
static HRESULT WINAPI fw_service_put_Enabled(INetFwService *iface, VARIANT_BOOL enabled)
Definition: service.c:244
static HRESULT WINAPI fw_service_get_Name(INetFwService *iface, BSTR *name)
Definition: service.c:144