ReactOS  0.4.15-dev-1384-g878186b
main.c
Go to the documentation of this file.
1 /*
2  * WUAPI implementation
3  *
4  * Copyright 2008 Hans Leidekker
5  *
6  * This library is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU Lesser General Public
8  * License as published by the Free Software Foundation; either
9  * version 2.1 of the License, or (at your option) any later version.
10  *
11  * This library is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14  * Lesser General Public License for more details.
15  *
16  * You should have received a copy of the GNU Lesser General Public
17  * License along with this library; if not, write to the Free Software
18  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
19  */
20 
21 #define COBJMACROS
22 
23 #include <stdarg.h>
24 
25 #include "windef.h"
26 #include "winbase.h"
27 #include "winuser.h"
28 #include "ole2.h"
29 #include "rpcproxy.h"
30 #include "wuapi.h"
31 
32 #include "wine/debug.h"
33 #include "wuapi_private.h"
34 
36 
37 typedef HRESULT (*fnCreateInstance)( LPVOID *ppObj );
38 
39 typedef struct _wucf
40 {
43 } wucf;
44 
45 static inline wucf *impl_from_IClassFactory( IClassFactory *iface )
46 {
47  return CONTAINING_RECORD(iface, wucf, IClassFactory_iface);
48 }
49 
51 {
52  if (IsEqualGUID(riid, &IID_IUnknown) ||
54  {
55  IClassFactory_AddRef( iface );
56  *ppobj = iface;
57  return S_OK;
58  }
59  FIXME("interface %s not implemented\n", debugstr_guid(riid));
60  return E_NOINTERFACE;
61 }
62 
64 {
65  return 2;
66 }
67 
69 {
70  return 1;
71 }
72 
74  REFIID riid, LPVOID *ppobj )
75 {
76  wucf *This = impl_from_IClassFactory( iface );
77  HRESULT r;
78  IUnknown *punk;
79 
80  TRACE("%p %s %p\n", pOuter, debugstr_guid(riid), ppobj);
81 
82  *ppobj = NULL;
83 
84  if (pOuter)
85  return CLASS_E_NOAGGREGATION;
86 
87  r = This->pfnCreateInstance( (LPVOID *)&punk );
88  if (FAILED(r))
89  return r;
90 
91  r = IUnknown_QueryInterface( punk, riid, ppobj );
92  IUnknown_Release( punk );
93  return r;
94 }
95 
97 {
98  FIXME("(%p)->(%d)\n", iface, dolock);
99  return S_OK;
100 }
101 
102 static const struct IClassFactoryVtbl wucf_vtbl =
103 {
105  wucf_AddRef,
106  wucf_Release,
109 };
110 
114 
116 
118 {
119  switch(reason)
120  {
121  case DLL_WINE_PREATTACH:
122  return FALSE; /* prefer native version */
123  case DLL_PROCESS_ATTACH:
124  instance = hinst;
126  break;
127  }
128  return TRUE;
129 }
130 
132 {
133  IClassFactory *cf = NULL;
134 
135  TRACE("%s %s %p\n", debugstr_guid(rclsid), debugstr_guid(iid), ppv);
136 
137  if (IsEqualGUID( rclsid, &CLSID_UpdateSession ))
138  {
140  }
141  else if (IsEqualGUID( rclsid, &CLSID_AutomaticUpdates ))
142  {
144  }
145  else if (IsEqualGUID( rclsid, &CLSID_SystemInformation ))
146  {
148  }
149  if (!cf) return CLASS_E_CLASSNOTAVAILABLE;
150  return IClassFactory_QueryInterface( cf, iid, ppv );
151 }
152 
154 {
155  return S_FALSE;
156 }
157 
158 /***********************************************************************
159  * DllRegisterServer (WUAPI.@)
160  */
162 {
164 }
165 
166 /***********************************************************************
167  * DllUnregisterServer (WUAPI.@)
168  */
170 {
172 }
#define HRESULT
Definition: msvc.h:7
struct _wucf wucf
static const struct IClassFactoryVtbl wucf_vtbl
Definition: main.c:102
#define REFIID
Definition: guiddef.h:118
#define E_NOINTERFACE
Definition: winerror.h:2364
HRESULT __wine_register_resources(HMODULE module) DECLSPEC_HIDDEN
Definition: register.c:98
WINE_DEFAULT_DEBUG_CHANNEL(wmic)
static wucf sessioncf
Definition: main.c:111
#define TRUE
Definition: types.h:120
REFIID riid
Definition: precomp.h:44
GLdouble GLdouble GLdouble r
Definition: gl.h:2055
#define REFCLSID
Definition: guiddef.h:117
REFIID LPVOID * ppv
Definition: atlbase.h:39
BOOL WINAPI DisableThreadLibraryCalls(IN HMODULE hLibModule)
Definition: loader.c:85
static wucf * impl_from_IClassFactory(IClassFactory *iface)
Definition: main.c:45
#define DLL_PROCESS_ATTACH
Definition: compat.h:131
static ULONG WINAPI wucf_AddRef(IClassFactory *iface)
Definition: main.c:63
Definition: main.c:39
#define CLASS_E_CLASSNOTAVAILABLE
Definition: winerror.h:2663
static HRESULT WINAPI wucf_CreateInstance(IClassFactory *iface, LPUNKNOWN pOuter, REFIID riid, LPVOID *ppobj)
Definition: main.c:73
static HINSTANCE instance
Definition: main.c:115
HRESULT WINAPI DllRegisterServer(void)
Definition: main.c:212
#define FALSE
Definition: types.h:117
fnCreateInstance pfnCreateInstance
Definition: main.c:42
unsigned int BOOL
Definition: ntddk_ex.h:94
static LPUNKNOWN
Definition: ndr_ole.c:49
HRESULT WINAPI DllUnregisterServer(void)
Definition: main.c:220
#define FIXME(fmt,...)
Definition: debug.h:111
#define S_FALSE
Definition: winerror.h:2357
#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
static wucf updatescf
Definition: main.c:112
LONG HRESULT
Definition: typedefs.h:79
const GUID IID_IUnknown
static HRESULT WINAPI wucf_QueryInterface(IClassFactory *iface, REFIID riid, LPVOID *ppobj)
Definition: main.c:50
#define WINAPI
Definition: msvc.h:6
static HRESULT WINAPI wucf_LockServer(IClassFactory *iface, BOOL dolock)
Definition: main.c:96
unsigned long DWORD
Definition: ntddk_ex.h:95
IClassFactory IClassFactory_iface
Definition: main.c:41
static WCHAR reason[MAX_STRING_RESOURCE_LEN]
Definition: object.c:1904
HRESULT(* fnCreateInstance)(LPVOID *ppObj)
Definition: main.c:38
HRESULT __wine_unregister_resources(HMODULE module) DECLSPEC_HIDDEN
Definition: register.c:110
#define CLASS_E_NOAGGREGATION
Definition: winerror.h:2662
HRESULT SystemInformation_create(LPVOID *ppObj)
Definition: systeminfo.c:146
#define S_OK
Definition: intsafe.h:51
static ULONG WINAPI wucf_Release(IClassFactory *iface)
Definition: main.c:68
HRESULT WINAPI DllCanUnloadNow(void)
Definition: main.c:204
HRESULT UpdateSession_create(LPVOID *ppObj)
Definition: session.c:219
#define NULL
Definition: types.h:112
BOOL WINAPI IsEqualGUID(REFGUID rguid1, REFGUID rguid2)
Definition: compobj.c:4112
static wucf sysinfocf
Definition: main.c:113
unsigned int ULONG
Definition: retypes.h:1
static HINSTANCE hinst
Definition: edit.c:551
HRESULT AutomaticUpdates_create(LPVOID *ppObj)
Definition: updates.c:205
const GUID IID_IClassFactory
HRESULT WINAPI DllGetClassObject(REFCLSID rclsid, REFIID riid, LPVOID *ppv)
Definition: main.c:166
BOOL WINAPI DllMain(HINSTANCE hInstance, DWORD dwReason, LPVOID lpReserved)
Definition: main.c:26