ReactOS  0.4.15-dev-2956-g61e7ea5
main.c
Go to the documentation of this file.
1 /*
2  *
3  * Copyright 2009 Austin English
4  *
5  * This library is free software; you can redistribute it and/or
6  * modify it under the terms of the GNU Lesser General Public
7  * License as published by the Free Software Foundation; either
8  * version 2.1 of the License, or (at your option) any later version.
9  *
10  * This library is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13  * Lesser General Public License for more details.
14  *
15  * You should have received a copy of the GNU Lesser General Public
16  * License along with this library; if not, write to the Free Software
17  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
18  */
19 
20 #include <stdarg.h>
21 
22 #define COBJMACROS
23 
24 #include "windef.h"
25 #include "winbase.h"
26 #include "objbase.h"
27 #include "wbemcli.h"
28 #include "wbemprov.h"
29 #include "rpcproxy.h"
30 
31 #include "wbemprox_private.h"
32 #include "wine/debug.h"
33 
35 
37 
38 typedef HRESULT (*fnCreateInstance)( LPVOID *ppObj );
39 
40 typedef struct
41 {
44 } wbemprox_cf;
45 
47 {
49 }
50 
52 {
53  if (IsEqualGUID(riid, &IID_IUnknown) ||
55  {
56  IClassFactory_AddRef( iface );
57  *ppobj = iface;
58  return S_OK;
59  }
60  FIXME("interface %s not implemented\n", debugstr_guid(riid));
61  return E_NOINTERFACE;
62 }
63 
65 {
66  return 2;
67 }
68 
70 {
71  return 1;
72 }
73 
75  REFIID riid, LPVOID *ppobj )
76 {
78  HRESULT r;
79  IUnknown *punk;
80 
81  TRACE("%p %s %p\n", pOuter, debugstr_guid(riid), ppobj);
82 
83  *ppobj = NULL;
84 
85  if (pOuter)
86  return CLASS_E_NOAGGREGATION;
87 
88  r = This->pfnCreateInstance( (LPVOID *)&punk );
89  if (FAILED(r))
90  return r;
91 
92  r = IUnknown_QueryInterface( punk, riid, ppobj );
93  IUnknown_Release( punk );
94  return r;
95 }
96 
98 {
99  FIXME("(%p)->(%d)\n", iface, dolock);
100  return S_OK;
101 }
102 
103 static const struct IClassFactoryVtbl wbemprox_cf_vtbl =
104 {
110 };
111 
113 
115 {
116 
117  switch (fdwReason)
118  {
119  case DLL_PROCESS_ATTACH:
120  instance = hinstDLL;
121  DisableThreadLibraryCalls(hinstDLL);
122  init_table_list();
123  break;
124  }
125 
126  return TRUE;
127 }
128 
130 {
131  IClassFactory *cf = NULL;
132 
133  TRACE("%s %s %p\n", debugstr_guid(rclsid), debugstr_guid(iid), ppv);
134 
135  if (IsEqualGUID( rclsid, &CLSID_WbemLocator ) ||
136  IsEqualGUID( rclsid, &CLSID_WbemAdministrativeLocator ))
137  {
139  }
140  if (!cf) return CLASS_E_CLASSNOTAVAILABLE;
141  return IClassFactory_QueryInterface( cf, iid, ppv );
142 }
143 
144 /***********************************************************************
145  * DllCanUnloadNow (WBEMPROX.@)
146  */
148 {
149  return S_FALSE;
150 }
151 
152 /***********************************************************************
153  * DllRegisterServer (WBEMPROX.@)
154  */
156 {
158 }
159 
160 /***********************************************************************
161  * DllUnregisterServer (WBEMPROX.@)
162  */
164 {
166 }
#define HRESULT
Definition: msvc.h:7
#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 wbemprox_cf * impl_from_IClassFactory(IClassFactory *iface)
Definition: main.c:46
static HRESULT WINAPI wbemprox_cf_LockServer(IClassFactory *iface, BOOL dolock)
Definition: main.c:97
#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 wbemprox_cf wbem_locator_cf
Definition: main.c:112
#define DLL_PROCESS_ATTACH
Definition: compat.h:131
void init_table_list(void)
Definition: builtin.c:4605
#define CLASS_E_CLASSNOTAVAILABLE
Definition: winerror.h:2663
static const struct IClassFactoryVtbl wbemprox_cf_vtbl
Definition: main.c:103
static IN DWORD IN LPVOID lpvReserved
HRESULT WINAPI DllRegisterServer(void)
Definition: main.c:212
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
static ULONG WINAPI wbemprox_cf_AddRef(IClassFactory *iface)
Definition: main.c:64
static HINSTANCE instance
Definition: main.c:36
#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
IClassFactory IClassFactory_iface
Definition: main.c:42
#define TRACE(s)
Definition: solgame.cpp:4
LONG HRESULT
Definition: typedefs.h:79
const GUID IID_IUnknown
#define WINAPI
Definition: msvc.h:6
unsigned long DWORD
Definition: ntddk_ex.h:95
fnCreateInstance pfnCreateInstance
Definition: main.c:43
HRESULT(* fnCreateInstance)(LPVOID *ppObj)
Definition: main.c:38
HRESULT __wine_unregister_resources(HMODULE module) DECLSPEC_HIDDEN
Definition: register.c:110
static ULONG WINAPI wbemprox_cf_Release(IClassFactory *iface)
Definition: main.c:69
#define CLASS_E_NOAGGREGATION
Definition: winerror.h:2662
#define S_OK
Definition: intsafe.h:52
HRESULT WINAPI DllCanUnloadNow(void)
Definition: main.c:204
#define NULL
Definition: types.h:112
BOOL WINAPI IsEqualGUID(REFGUID rguid1, REFGUID rguid2)
Definition: compobj.c:4112
static HRESULT WINAPI wbemprox_cf_CreateInstance(IClassFactory *iface, LPUNKNOWN pOuter, REFIID riid, LPVOID *ppobj)
Definition: main.c:74
static HRESULT WINAPI wbemprox_cf_QueryInterface(IClassFactory *iface, REFIID riid, LPVOID *ppobj)
Definition: main.c:51
unsigned int ULONG
Definition: retypes.h:1
HRESULT WbemLocator_create(LPVOID *ppObj)
Definition: wbemlocator.c:212
const GUID IID_IClassFactory
IClassFactory IClassFactory_iface
Definition: main.c:440
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