ReactOS 0.4.15-dev-7924-g5949c20
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 <stdarg.h>
25
26#include "windef.h"
27#include "winbase.h"
28#include "winuser.h"
29#include "ole2.h"
30#include "wuapi.h"
31#include "wuapi_private.h"
32
33#include "wine/debug.h"
34
36
37typedef struct _systeminfo
38{
39 ISystemInformation ISystemInformation_iface;
42
43static inline systeminfo *impl_from_ISystemInformation(ISystemInformation *iface)
44{
45 return CONTAINING_RECORD(iface, systeminfo, ISystemInformation_iface);
46}
47
48static ULONG WINAPI systeminfo_AddRef(ISystemInformation *iface)
49{
51 return InterlockedIncrement(&This->refs);
52}
53
54static ULONG WINAPI systeminfo_Release(ISystemInformation *iface)
55{
57 LONG refs = InterlockedDecrement(&This->refs);
58 if (!refs)
59 {
60 TRACE("destroying %p\n", This);
62 }
63 return refs;
64}
65
66static HRESULT WINAPI systeminfo_QueryInterface(ISystemInformation *iface,
67 REFIID riid, void **ppvObject)
68{
70
71 TRACE("%p %s %p\n", This, debugstr_guid(riid), ppvObject);
72
73 if (IsEqualGUID(riid, &IID_ISystemInformation) ||
76 {
77 *ppvObject = iface;
78 }
79 else
80 {
81 FIXME("interface %s not implemented\n", debugstr_guid(riid));
82 return E_NOINTERFACE;
83 }
84 ISystemInformation_AddRef(iface);
85 return S_OK;
86}
87
88static HRESULT WINAPI systeminfo_GetTypeInfoCount(ISystemInformation *iface,
89 UINT *pctinfo )
90{
91 FIXME("\n");
92 return E_NOTIMPL;
93}
94
95static HRESULT WINAPI systeminfo_GetTypeInfo(ISystemInformation *iface,
96 UINT iTInfo, LCID lcid, ITypeInfo **ppTInfo)
97{
98 FIXME("\n");
99 return E_NOTIMPL;
100}
101
102static HRESULT WINAPI systeminfo_GetIDsOfNames(ISystemInformation *iface,
103 REFIID riid, LPOLESTR *rgszNames, UINT cNames, LCID lcid,
104 DISPID *rgDispId)
105{
106 FIXME("\n");
107 return E_NOTIMPL;
108}
109
110static HRESULT WINAPI systeminfo_Invoke(ISystemInformation *iface,
111 DISPID dispIdMember, REFIID riid, LCID lcid, WORD wFlags,
112 DISPPARAMS *pDispParams, VARIANT *pVarResult,
113 EXCEPINFO *pExcepInfo, UINT *puArgErr )
114{
115 FIXME("\n");
116 return E_NOTIMPL;
117}
118
119static HRESULT WINAPI systeminfo_get_OemHardwareSupportLink(ISystemInformation *iface,
120 BSTR *retval)
121{
122 FIXME("\n");
123 return E_NOTIMPL;
124}
125
126static HRESULT WINAPI systeminfo_get_RebootRequired(ISystemInformation *iface,
127 VARIANT_BOOL *retval)
128{
129 *retval = VARIANT_FALSE;
130 return S_OK;
131}
132
133static const struct ISystemInformationVtbl systeminfo_vtbl =
134{
144};
145
147{
149
150 TRACE("(%p)\n", ppObj);
151
152 info = HeapAlloc(GetProcessHeap(), 0, sizeof(*info));
153 if (!info)
154 return E_OUTOFMEMORY;
155
156 info->ISystemInformation_iface.lpVtbl = &systeminfo_vtbl;
157 info->refs = 1;
158
159 *ppObj = &info->ISystemInformation_iface;
160
161 TRACE("returning iface %p\n", *ppObj);
162 return S_OK;
163}
#define InterlockedIncrement
Definition: armddk.h:53
#define InterlockedDecrement
Definition: armddk.h:52
#define WINE_DEFAULT_DEBUG_CHANNEL(t)
Definition: precomp.h:23
const GUID IID_IUnknown
#define FIXME(fmt,...)
Definition: debug.h:111
#define E_OUTOFMEMORY
Definition: ddrawi.h:100
#define E_NOTIMPL
Definition: ddrawi.h:99
#define GetProcessHeap()
Definition: compat.h:736
#define HeapAlloc
Definition: compat.h:733
OLECHAR * BSTR
Definition: compat.h:2293
#define HeapFree(x, y, z)
Definition: compat.h:735
short VARIANT_BOOL
Definition: compat.h:2290
static HRESULT WINAPI systeminfo_GetIDsOfNames(ISystemInformation *iface, REFIID riid, LPOLESTR *rgszNames, UINT cNames, LCID lcid, DISPID *rgDispId)
Definition: systeminfo.c:102
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:110
static const struct ISystemInformationVtbl systeminfo_vtbl
Definition: systeminfo.c:133
HRESULT SystemInformation_create(LPVOID *ppObj)
Definition: systeminfo.c:146
static ULONG WINAPI systeminfo_Release(ISystemInformation *iface)
Definition: systeminfo.c:54
static HRESULT WINAPI systeminfo_GetTypeInfoCount(ISystemInformation *iface, UINT *pctinfo)
Definition: systeminfo.c:88
static systeminfo * impl_from_ISystemInformation(ISystemInformation *iface)
Definition: systeminfo.c:43
static HRESULT WINAPI systeminfo_get_OemHardwareSupportLink(ISystemInformation *iface, BSTR *retval)
Definition: systeminfo.c:119
static HRESULT WINAPI systeminfo_get_RebootRequired(ISystemInformation *iface, VARIANT_BOOL *retval)
Definition: systeminfo.c:126
static HRESULT WINAPI systeminfo_GetTypeInfo(ISystemInformation *iface, UINT iTInfo, LCID lcid, ITypeInfo **ppTInfo)
Definition: systeminfo.c:95
static HRESULT WINAPI systeminfo_QueryInterface(ISystemInformation *iface, REFIID riid, void **ppvObject)
Definition: systeminfo.c:66
static ULONG WINAPI systeminfo_AddRef(ISystemInformation *iface)
Definition: systeminfo.c:48
struct _systeminfo systeminfo
unsigned short WORD
Definition: ntddk_ex.h:93
REFIID riid
Definition: atlbase.h:39
#define S_OK
Definition: intsafe.h:52
#define debugstr_guid
Definition: kernel32.h:35
static LPOLESTR
Definition: stg_prop.c:27
static VARIANTARG static DISPID
Definition: ordinal.c:52
unsigned int UINT
Definition: ndis.h:50
const GUID IID_IDispatch
long LONG
Definition: pedump.c:60
#define IsEqualGUID(rguid1, rguid2)
Definition: guiddef.h:147
#define REFIID
Definition: guiddef.h:118
DWORD LCID
Definition: nls.h:13
#define TRACE(s)
Definition: solgame.cpp:4
ISystemInformation ISystemInformation_iface
Definition: systeminfo.c:39
#define CONTAINING_RECORD(address, type, field)
Definition: typedefs.h:260
uint32_t ULONG
Definition: typedefs.h:59
_In_ DWORD _Out_ _In_ WORD wFlags
Definition: wincon.h:531
_In_ void _In_ PCCERT_CONTEXT _In_opt_ LPFILETIME _In_ DWORD _In_ DWORD _Outptr_opt_ void ** ppvObject
Definition: wincrypt.h:6082
#define WINAPI
Definition: msvc.h:6
#define E_NOINTERFACE
Definition: winerror.h:2364