ReactOS  0.4.14-dev-115-g4576127
systeminfo.c
Go to the documentation of this file.
1 /*
2  * IAutomaticUpdates implementation
3  *
4  * Copyright 2008 Hans Leidekker
5  * Copyright 2011 Bernhard Loos
6  *
7  * This library is free software; you can redistribute it and/or
8  * modify it under the terms of the GNU Lesser General Public
9  * License as published by the Free Software Foundation; either
10  * version 2.1 of the License, or (at your option) any later version.
11  *
12  * This library is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15  * Lesser General Public License for more details.
16  *
17  * You should have received a copy of the GNU Lesser General Public
18  * License along with this library; if not, write to the Free Software
19  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
20  */
21 
22 #define COBJMACROS
23 
24 #include "config.h"
25 #include <stdarg.h>
26 
27 #include "windef.h"
28 #include "winbase.h"
29 #include "winuser.h"
30 #include "ole2.h"
31 #include "wuapi.h"
32 #include "wuapi_private.h"
33 
34 #include "wine/debug.h"
35 
37 
38 typedef struct _systeminfo
39 {
40  ISystemInformation ISystemInformation_iface;
42 } systeminfo;
43 
44 static inline systeminfo *impl_from_ISystemInformation(ISystemInformation *iface)
45 {
46  return CONTAINING_RECORD(iface, systeminfo, ISystemInformation_iface);
47 }
48 
49 static ULONG WINAPI systeminfo_AddRef(ISystemInformation *iface)
50 {
52  return InterlockedIncrement(&This->refs);
53 }
54 
55 static ULONG WINAPI systeminfo_Release(ISystemInformation *iface)
56 {
58  LONG refs = InterlockedDecrement(&This->refs);
59  if (!refs)
60  {
61  TRACE("destroying %p\n", This);
63  }
64  return refs;
65 }
66 
67 static HRESULT WINAPI systeminfo_QueryInterface(ISystemInformation *iface,
68  REFIID riid, void **ppvObject)
69 {
71 
72  TRACE("%p %s %p\n", This, debugstr_guid(riid), ppvObject);
73 
74  if (IsEqualGUID(riid, &IID_ISystemInformation) ||
77  {
78  *ppvObject = iface;
79  }
80  else
81  {
82  FIXME("interface %s not implemented\n", debugstr_guid(riid));
83  return E_NOINTERFACE;
84  }
85  ISystemInformation_AddRef(iface);
86  return S_OK;
87 }
88 
89 static HRESULT WINAPI systeminfo_GetTypeInfoCount(ISystemInformation *iface,
90  UINT *pctinfo )
91 {
92  FIXME("\n");
93  return E_NOTIMPL;
94 }
95 
96 static HRESULT WINAPI systeminfo_GetTypeInfo(ISystemInformation *iface,
97  UINT iTInfo, LCID lcid, ITypeInfo **ppTInfo)
98 {
99  FIXME("\n");
100  return E_NOTIMPL;
101 }
102 
103 static HRESULT WINAPI systeminfo_GetIDsOfNames(ISystemInformation *iface,
104  REFIID riid, LPOLESTR *rgszNames, UINT cNames, LCID lcid,
105  DISPID *rgDispId)
106 {
107  FIXME("\n");
108  return E_NOTIMPL;
109 }
110 
111 static HRESULT WINAPI systeminfo_Invoke(ISystemInformation *iface,
112  DISPID dispIdMember, REFIID riid, LCID lcid, WORD wFlags,
113  DISPPARAMS *pDispParams, VARIANT *pVarResult,
114  EXCEPINFO *pExcepInfo, UINT *puArgErr )
115 {
116  FIXME("\n");
117  return E_NOTIMPL;
118 }
119 
120 static HRESULT WINAPI systeminfo_get_OemHardwareSupportLink(ISystemInformation *iface,
121  BSTR *retval)
122 {
123  FIXME("\n");
124  return E_NOTIMPL;
125 }
126 
127 static HRESULT WINAPI systeminfo_get_RebootRequired(ISystemInformation *iface,
128  VARIANT_BOOL *retval)
129 {
130  *retval = VARIANT_FALSE;
131  return S_OK;
132 }
133 
134 static const struct ISystemInformationVtbl systeminfo_vtbl =
135 {
145 };
146 
148 {
149  systeminfo *info;
150 
151  TRACE("(%p)\n", ppObj);
152 
153  info = HeapAlloc(GetProcessHeap(), 0, sizeof(*info));
154  if (!info)
155  return E_OUTOFMEMORY;
156 
157  info->ISystemInformation_iface.lpVtbl = &systeminfo_vtbl;
158  info->refs = 1;
159 
160  *ppObj = &info->ISystemInformation_iface;
161 
162  TRACE("returning iface %p\n", *ppObj);
163  return S_OK;
164 }
#define REFIID
Definition: guiddef.h:118
#define E_NOINTERFACE
Definition: winerror.h:2364
REFIID riid
Definition: precomp.h:44
static systeminfo * impl_from_ISystemInformation(ISystemInformation *iface)
Definition: systeminfo.c:44
static ULONG WINAPI systeminfo_AddRef(ISystemInformation *iface)
Definition: systeminfo.c:49
DWORD LCID
Definition: nls.h:13
OLECHAR * BSTR
Definition: compat.h:1934
static LPOLESTR
Definition: stg_prop.c:27
short VARIANT_BOOL
Definition: compat.h:1931
struct _test_info info[]
Definition: SetCursorPos.c:19
static const struct ISystemInformationVtbl systeminfo_vtbl
Definition: systeminfo.c:134
#define E_OUTOFMEMORY
Definition: ddrawi.h:100
long LONG
Definition: pedump.c:60
#define FIXME(fmt,...)
Definition: debug.h:110
static HRESULT WINAPI systeminfo_get_RebootRequired(ISystemInformation *iface, VARIANT_BOOL *retval)
Definition: systeminfo.c:127
static HRESULT WINAPI systeminfo_GetTypeInfoCount(ISystemInformation *iface, UINT *pctinfo)
Definition: systeminfo.c:89
static HRESULT WINAPI systeminfo_Invoke(ISystemInformation *iface, DISPID dispIdMember, REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *pDispParams, VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr)
Definition: systeminfo.c:111
#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
#define TRACE(s)
Definition: solgame.cpp:4
#define GetProcessHeap()
Definition: compat.h:395
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
LONG HRESULT
Definition: typedefs.h:77
const GUID IID_IUnknown
#define WINAPI
Definition: msvc.h:8
unsigned short WORD
Definition: ntddk_ex.h:93
struct _systeminfo systeminfo
const GUID IID_IDispatch
#define InterlockedDecrement
Definition: armddk.h:52
WINE_DEFAULT_DEBUG_CHANNEL(wuapi)
REFIID LPVOID * ppvObject
Definition: precomp.h:44
static HRESULT WINAPI systeminfo_get_OemHardwareSupportLink(ISystemInformation *iface, BSTR *retval)
Definition: systeminfo.c:120
HRESULT SystemInformation_create(LPVOID *ppObj)
Definition: systeminfo.c:147
_In_ DWORD _Out_ _In_ WORD wFlags
Definition: wincon.h:519
struct stdole::EXCEPINFO EXCEPINFO
static VARIANTARG static DISPID
Definition: ordinal.c:49
#define S_OK
Definition: intsafe.h:59
#define InterlockedIncrement
Definition: armddk.h:53
static HRESULT WINAPI systeminfo_QueryInterface(ISystemInformation *iface, REFIID riid, void **ppvObject)
Definition: systeminfo.c:67
#define E_NOTIMPL
Definition: ddrawi.h:99
unsigned int UINT
Definition: ndis.h:50
BOOL WINAPI IsEqualGUID(REFGUID rguid1, REFGUID rguid2)
Definition: compobj.c:4021
static ULONG WINAPI systeminfo_Release(ISystemInformation *iface)
Definition: systeminfo.c:55
struct stdole::DISPPARAMS DISPPARAMS
unsigned int ULONG
Definition: retypes.h:1
static HRESULT WINAPI systeminfo_GetIDsOfNames(ISystemInformation *iface, REFIID riid, LPOLESTR *rgszNames, UINT cNames, LCID lcid, DISPID *rgDispId)
Definition: systeminfo.c:103
ISystemInformation ISystemInformation_iface
Definition: systeminfo.c:40
static HRESULT WINAPI systeminfo_GetTypeInfo(ISystemInformation *iface, UINT iTInfo, LCID lcid, ITypeInfo **ppTInfo)
Definition: systeminfo.c:96
#define HeapFree(x, y, z)
Definition: compat.h:394