ReactOS 0.4.15-dev-7918-g2a2556c
wshom_main.c File Reference
#include "wshom_private.h"
#include "initguid.h"
#include "wshom.h"
#include "rpcproxy.h"
#include "wine/debug.h"
Include dependency graph for wshom_main.c:

Go to the source code of this file.

Functions

 WINE_DEFAULT_DEBUG_CHANNEL (wshom)
 
static struct provideclassinfoimpl_from_IProvideClassInfo (IProvideClassInfo *iface)
 
static HRESULT load_typelib (void)
 
static HRESULT get_typeinfo_of_guid (const GUID *guid, ITypeInfo **tinfo)
 
HRESULT get_typeinfo (tid_t tid, ITypeInfo **typeinfo)
 
static void release_typelib (void)
 
static HRESULT WINAPI provideclassinfo_QueryInterface (IProvideClassInfo *iface, REFIID riid, void **obj)
 
static ULONG WINAPI provideclassinfo_AddRef (IProvideClassInfo *iface)
 
static ULONG WINAPI provideclassinfo_Release (IProvideClassInfo *iface)
 
static HRESULT WINAPI provideclassinfo_GetClassInfo (IProvideClassInfo *iface, ITypeInfo **ti)
 
void init_classinfo (const GUID *guid, IUnknown *outer, struct provideclassinfo *classinfo)
 
static HRESULT WINAPI ClassFactory_QueryInterface (IClassFactory *iface, REFIID riid, void **ppv)
 
static ULONG WINAPI ClassFactory_AddRef (IClassFactory *iface)
 
static ULONG WINAPI ClassFactory_Release (IClassFactory *iface)
 
static HRESULT WINAPI ClassFactory_LockServer (IClassFactory *iface, BOOL fLock)
 
BOOL WINAPI DllMain (HINSTANCE hInstDLL, DWORD fdwReason, LPVOID lpv)
 
HRESULT WINAPI DllGetClassObject (REFCLSID rclsid, REFIID riid, LPVOID *ppv)
 
HRESULT WINAPI DllCanUnloadNow (void)
 
HRESULT WINAPI DllRegisterServer (void)
 
HRESULT WINAPI DllUnregisterServer (void)
 

Variables

static HINSTANCE wshom_instance
 
static ITypeLibtypelib
 
static ITypeInfotypeinfos [LAST_tid]
 
static REFIID tid_ids []
 
static const IProvideClassInfoVtbl provideclassinfovtbl
 
static const IClassFactoryVtbl WshShellFactoryVtbl
 
static IClassFactory WshShellFactory = { &WshShellFactoryVtbl }
 

Function Documentation

◆ ClassFactory_AddRef()

static ULONG WINAPI ClassFactory_AddRef ( IClassFactory iface)
static

Definition at line 188 of file wshom_main.c.

189{
190 TRACE("(%p)\n", iface);
191 return 2;
192}
#define TRACE(s)
Definition: solgame.cpp:4

◆ ClassFactory_LockServer()

static HRESULT WINAPI ClassFactory_LockServer ( IClassFactory iface,
BOOL  fLock 
)
static

Definition at line 200 of file wshom_main.c.

201{
202 TRACE("(%p)->(%x)\n", iface, fLock);
203 return S_OK;
204}
#define S_OK
Definition: intsafe.h:52

◆ ClassFactory_QueryInterface()

static HRESULT WINAPI ClassFactory_QueryInterface ( IClassFactory iface,
REFIID  riid,
void **  ppv 
)
static

Definition at line 167 of file wshom_main.c.

168{
169 *ppv = NULL;
170
172 TRACE("(%p)->(IID_IUnknown %p)\n", iface, ppv);
173 *ppv = iface;
174 }else if(IsEqualGUID(&IID_IClassFactory, riid)) {
175 TRACE("(%p)->(IID_IClassFactory %p)\n", iface, ppv);
176 *ppv = iface;
177 }
178
179 if(*ppv) {
180 IUnknown_AddRef((IUnknown*)*ppv);
181 return S_OK;
182 }
183
184 WARN("(%p)->(%s %p)\n", iface, debugstr_guid(riid), ppv);
185 return E_NOINTERFACE;
186}
const GUID IID_IUnknown
const GUID IID_IClassFactory
#define WARN(fmt,...)
Definition: debug.h:112
#define NULL
Definition: types.h:112
REFIID riid
Definition: atlbase.h:39
REFIID LPVOID * ppv
Definition: atlbase.h:39
#define debugstr_guid
Definition: kernel32.h:35
#define IsEqualGUID(rguid1, rguid2)
Definition: guiddef.h:147
#define E_NOINTERFACE
Definition: winerror.h:2364

◆ ClassFactory_Release()

static ULONG WINAPI ClassFactory_Release ( IClassFactory iface)
static

Definition at line 194 of file wshom_main.c.

195{
196 TRACE("(%p)\n", iface);
197 return 1;
198}

◆ DllCanUnloadNow()

HRESULT WINAPI DllCanUnloadNow ( void  )

Definition at line 257 of file wshom_main.c.

258{
259 return S_FALSE;
260}
#define S_FALSE
Definition: winerror.h:2357

◆ DllGetClassObject()

HRESULT WINAPI DllGetClassObject ( REFCLSID  rclsid,
REFIID  riid,
LPVOID ppv 
)

Definition at line 243 of file wshom_main.c.

244{
245 if(IsEqualGUID(&CLSID_WshShell, rclsid)) {
246 TRACE("(CLSID_WshShell %s %p)\n", debugstr_guid(riid), ppv);
247 return IClassFactory_QueryInterface(&WshShellFactory, riid, ppv);
248 }
249
250 FIXME("%s %s %p\n", debugstr_guid(rclsid), debugstr_guid(riid), ppv);
252}
#define FIXME(fmt,...)
Definition: debug.h:111
#define CLASS_E_CLASSNOTAVAILABLE
Definition: winerror.h:2663
static IClassFactory WshShellFactory
Definition: wshom_main.c:214

◆ DllMain()

BOOL WINAPI DllMain ( HINSTANCE  hInstDLL,
DWORD  fdwReason,
LPVOID  lpv 
)

Definition at line 219 of file wshom_main.c.

220{
221 TRACE("(%p %d %p)\n", hInstDLL, fdwReason, lpv);
222
223 switch(fdwReason)
224 {
225 case DLL_WINE_PREATTACH:
226 return FALSE; /* prefer native version */
228 wshom_instance = hInstDLL;
230 break;
232 if (lpv) break;
234 break;
235 }
236
237 return TRUE;
238}
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
#define DLL_PROCESS_ATTACH
Definition: compat.h:131
#define DLL_PROCESS_DETACH
Definition: compat.h:130
BOOL WINAPI DisableThreadLibraryCalls(IN HMODULE hLibModule)
Definition: loader.c:85
static HINSTANCE wshom_instance
Definition: wshom_main.c:29
static void release_typelib(void)
Definition: wshom_main.c:103

◆ DllRegisterServer()

HRESULT WINAPI DllRegisterServer ( void  )

Definition at line 265 of file wshom_main.c.

266{
267 TRACE("()\n");
269}
HRESULT __wine_register_resources(HMODULE module) DECLSPEC_HIDDEN
Definition: register.c:98

◆ DllUnregisterServer()

HRESULT WINAPI DllUnregisterServer ( void  )

Definition at line 274 of file wshom_main.c.

275{
276 TRACE("()\n");
278}
HRESULT __wine_unregister_resources(HMODULE module) DECLSPEC_HIDDEN
Definition: register.c:110

◆ get_typeinfo()

HRESULT get_typeinfo ( tid_t  tid,
ITypeInfo **  typeinfo 
)

Definition at line 77 of file wshom_main.c.

78{
80
81 if (FAILED(hres = load_typelib()))
82 return hres;
83
84 if(!typeinfos[tid]) {
85 ITypeInfo *ti;
86
87 hres = ITypeLib_GetTypeInfoOfGuid(typelib, tid_ids[tid], &ti);
88 if(FAILED(hres)) {
89 ERR("GetTypeInfoOfGuid(%s) failed: %08x\n", debugstr_guid(tid_ids[tid]), hres);
90 return hres;
91 }
92
94 ITypeInfo_Release(ti);
95 }
96
98 ITypeInfo_AddRef(*typeinfo);
99 return S_OK;
100}
#define ERR(fmt,...)
Definition: debug.h:110
#define InterlockedCompareExchangePointer
Definition: interlocked.h:129
#define FAILED(hr)
Definition: intsafe.h:51
HRESULT hres
Definition: protocol.c:465
static TfClientId tid
static ITypeLib * typelib
Definition: wshom_main.c:36
static HRESULT load_typelib(void)
Definition: wshom_main.c:48
static REFIID tid_ids[]
Definition: wshom_main.c:39
static ITypeInfo * typeinfos[LAST_tid]
Definition: wshom_main.c:37

◆ get_typeinfo_of_guid()

static HRESULT get_typeinfo_of_guid ( const GUID guid,
ITypeInfo **  tinfo 
)
static

Definition at line 67 of file wshom_main.c.

68{
70
71 if(FAILED(hres = load_typelib()))
72 return hres;
73
74 return ITypeLib_GetTypeInfoOfGuid(typelib, guid, tinfo);
75}
const GUID * guid

Referenced by provideclassinfo_GetClassInfo().

◆ impl_from_IProvideClassInfo()

static struct provideclassinfo * impl_from_IProvideClassInfo ( IProvideClassInfo iface)
inlinestatic

Definition at line 31 of file wshom_main.c.

32{
33 return CONTAINING_RECORD(iface, struct provideclassinfo, IProvideClassInfo_iface);
34}
#define CONTAINING_RECORD(address, type, field)
Definition: typedefs.h:260

Referenced by provideclassinfo_AddRef(), provideclassinfo_GetClassInfo(), provideclassinfo_QueryInterface(), and provideclassinfo_Release().

◆ init_classinfo()

void init_classinfo ( const GUID guid,
IUnknown outer,
struct provideclassinfo classinfo 
)

Definition at line 160 of file wshom_main.c.

161{
162 classinfo->IProvideClassInfo_iface.lpVtbl = &provideclassinfovtbl;
163 classinfo->outer = outer;
164 classinfo->guid = guid;
165}
classinfo
Definition: clsfactory.c:43
static const IProvideClassInfoVtbl provideclassinfovtbl
Definition: wshom_main.c:153

◆ load_typelib()

static HRESULT load_typelib ( void  )
static

Definition at line 48 of file wshom_main.c.

49{
51 ITypeLib *tl;
52
53 if(typelib)
54 return S_OK;
55
56 hres = LoadRegTypeLib(&LIBID_IWshRuntimeLibrary, 1, 0, LOCALE_SYSTEM_DEFAULT, &tl);
57 if(FAILED(hres)) {
58 ERR("LoadRegTypeLib failed: %08x\n", hres);
59 return hres;
60 }
61
63 ITypeLib_Release(tl);
64 return hres;
65}
HRESULT WINAPI LoadRegTypeLib(REFGUID rguid, WORD wVerMajor, WORD wVerMinor, LCID lcid, ITypeLib **ppTLib)
Definition: typelib.c:531
#define LOCALE_SYSTEM_DEFAULT

Referenced by get_typeinfo(), and get_typeinfo_of_guid().

◆ provideclassinfo_AddRef()

static ULONG WINAPI provideclassinfo_AddRef ( IProvideClassInfo iface)
static

Definition at line 132 of file wshom_main.c.

133{
135 return IUnknown_AddRef(This->outer);
136}
static struct provideclassinfo * impl_from_IProvideClassInfo(IProvideClassInfo *iface)
Definition: wshom_main.c:31

◆ provideclassinfo_GetClassInfo()

static HRESULT WINAPI provideclassinfo_GetClassInfo ( IProvideClassInfo iface,
ITypeInfo **  ti 
)
static

Definition at line 144 of file wshom_main.c.

145{
147
148 TRACE("(%p)->(%p)\n", This, ti);
149
150 return get_typeinfo_of_guid(This->guid, ti);
151}
static HRESULT get_typeinfo_of_guid(const GUID *guid, ITypeInfo **tinfo)
Definition: wshom_main.c:67

◆ provideclassinfo_QueryInterface()

static HRESULT WINAPI provideclassinfo_QueryInterface ( IProvideClassInfo iface,
REFIID  riid,
void **  obj 
)
static

Definition at line 117 of file wshom_main.c.

118{
120
121 TRACE("(%p)->(%s %p)\n", This, debugstr_guid(riid), obj);
122
124 *obj = iface;
125 IProvideClassInfo_AddRef(iface);
126 return S_OK;
127 }
128 else
129 return IUnknown_QueryInterface(This->outer, riid, obj);
130}
const GUID IID_IProvideClassInfo
#define IsEqualIID(riid1, riid2)
Definition: guiddef.h:95

◆ provideclassinfo_Release()

static ULONG WINAPI provideclassinfo_Release ( IProvideClassInfo iface)
static

Definition at line 138 of file wshom_main.c.

139{
141 return IUnknown_Release(This->outer);
142}

◆ release_typelib()

static void release_typelib ( void  )
static

Definition at line 103 of file wshom_main.c.

104{
105 unsigned i;
106
107 if(!typelib)
108 return;
109
110 for(i = 0; i < ARRAY_SIZE(typeinfos); i++)
111 if(typeinfos[i])
112 ITypeInfo_Release(typeinfos[i]);
113
114 ITypeLib_Release(typelib);
115}
#define ARRAY_SIZE(A)
Definition: main.h:33
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248

Referenced by DllMain().

◆ WINE_DEFAULT_DEBUG_CHANNEL()

WINE_DEFAULT_DEBUG_CHANNEL ( wshom  )

Variable Documentation

◆ provideclassinfovtbl

const IProvideClassInfoVtbl provideclassinfovtbl
static
Initial value:
= {
}
static ULONG WINAPI provideclassinfo_Release(IProvideClassInfo *iface)
Definition: wshom_main.c:138
static HRESULT WINAPI provideclassinfo_QueryInterface(IProvideClassInfo *iface, REFIID riid, void **obj)
Definition: wshom_main.c:117
static ULONG WINAPI provideclassinfo_AddRef(IProvideClassInfo *iface)
Definition: wshom_main.c:132
static HRESULT WINAPI provideclassinfo_GetClassInfo(IProvideClassInfo *iface, ITypeInfo **ti)
Definition: wshom_main.c:144

Definition at line 153 of file wshom_main.c.

Referenced by init_classinfo().

◆ tid_ids

REFIID tid_ids[]
static
Initial value:
= {
&IID_IWshCollection,
&IID_IWshEnvironment,
&IID_IWshExec,
&IID_IWshShell3,
&IID_IWshShortcut
}
#define IID_NULL
Definition: guiddef.h:98

Definition at line 39 of file wshom_main.c.

Referenced by get_typeinfo().

◆ typeinfos

ITypeInfo* typeinfos[LAST_tid]
static

Definition at line 37 of file wshom_main.c.

Referenced by get_typeinfo(), and release_typelib().

◆ typelib

ITypeLib* typelib
static

Definition at line 36 of file wshom_main.c.

Referenced by get_typeinfo(), get_typeinfo_of_guid(), load_typelib(), and release_typelib().

◆ wshom_instance

HINSTANCE wshom_instance
static

Definition at line 29 of file wshom_main.c.

Referenced by DllMain(), DllRegisterServer(), and DllUnregisterServer().

◆ WshShellFactory

IClassFactory WshShellFactory = { &WshShellFactoryVtbl }
static

Definition at line 214 of file wshom_main.c.

Referenced by DllGetClassObject().

◆ WshShellFactoryVtbl

const IClassFactoryVtbl WshShellFactoryVtbl
static
Initial value:
= {
}
HRESULT WINAPI WshShellFactory_CreateInstance(IClassFactory *iface, IUnknown *outer, REFIID riid, void **ppv)
Definition: shell.c:1825
static HRESULT WINAPI ClassFactory_LockServer(IClassFactory *iface, BOOL fLock)
Definition: wshom_main.c:200
static ULONG WINAPI ClassFactory_Release(IClassFactory *iface)
Definition: wshom_main.c:194
static HRESULT WINAPI ClassFactory_QueryInterface(IClassFactory *iface, REFIID riid, void **ppv)
Definition: wshom_main.c:167
static ULONG WINAPI ClassFactory_AddRef(IClassFactory *iface)
Definition: wshom_main.c:188

Definition at line 206 of file wshom_main.c.