2 * Copyright 2011 Jacek Caban for CodeWeavers
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 2.1 of the License, or (at your option) any later version.
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Lesser General Public License for more details.
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with this library; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
20 #include "wshom_private.h"
24 #include "wine/debug.h"
26 WINE_DEFAULT_DEBUG_CHANNEL(wshom
);
28 static HINSTANCE wshom_instance
;
30 static HRESULT WINAPI
ClassFactory_QueryInterface(IClassFactory
*iface
, REFIID riid
, void **ppv
)
34 if(IsEqualGUID(&IID_IUnknown
, riid
)) {
35 TRACE("(%p)->(IID_IUnknown %p)\n", iface
, ppv
);
37 }else if(IsEqualGUID(&IID_IClassFactory
, riid
)) {
38 TRACE("(%p)->(IID_IClassFactory %p)\n", iface
, ppv
);
43 IUnknown_AddRef((IUnknown
*)*ppv
);
47 FIXME("(%p)->(%s %p)\n", iface
, debugstr_guid(riid
), ppv
);
51 static ULONG WINAPI
ClassFactory_AddRef(IClassFactory
*iface
)
53 TRACE("(%p)\n", iface
);
57 static ULONG WINAPI
ClassFactory_Release(IClassFactory
*iface
)
59 TRACE("(%p)\n", iface
);
63 static HRESULT WINAPI
ClassFactory_LockServer(IClassFactory
*iface
, BOOL fLock
)
65 TRACE("(%p)->(%x)\n", iface
, fLock
);
69 static const IClassFactoryVtbl WshShellFactoryVtbl
= {
70 ClassFactory_QueryInterface
,
73 WshShellFactory_CreateInstance
,
74 ClassFactory_LockServer
77 static IClassFactory WshShellFactory
= { &WshShellFactoryVtbl
};
79 /******************************************************************
80 * DllMain (wshom.ocx.@)
82 BOOL WINAPI
DllMain(HINSTANCE hInstDLL
, DWORD fdwReason
, LPVOID lpv
)
84 TRACE("(%p %d %p)\n", hInstDLL
, fdwReason
, lpv
);
88 case DLL_WINE_PREATTACH
:
89 return FALSE
; /* prefer native version */
90 case DLL_PROCESS_ATTACH
:
91 wshom_instance
= hInstDLL
;
92 DisableThreadLibraryCalls(wshom_instance
);
99 /***********************************************************************
100 * DllGetClassObject (wshom.ocx.@)
102 HRESULT WINAPI
DllGetClassObject(REFCLSID rclsid
, REFIID riid
, LPVOID
*ppv
)
104 if(IsEqualGUID(&CLSID_WshShell
, rclsid
)) {
105 TRACE("(CLSID_WshShell %s %p)\n", debugstr_guid(riid
), ppv
);
106 return IClassFactory_QueryInterface(&WshShellFactory
, riid
, ppv
);
109 FIXME("%s %s %p\n", debugstr_guid(rclsid
), debugstr_guid(riid
), ppv
);
110 return CLASS_E_CLASSNOTAVAILABLE
;
113 /***********************************************************************
114 * DllCanUnloadNow (wshom.ocx.@)
116 HRESULT WINAPI
DllCanUnloadNow(void)
121 /***********************************************************************
122 * DllRegisterServer (wshom.ocx.@)
124 HRESULT WINAPI
DllRegisterServer(void)
127 return __wine_register_resources(wshom_instance
);
130 /***********************************************************************
131 * DllUnregisterServer (wshom.ocx.@)
133 HRESULT WINAPI
DllUnregisterServer(void)
136 return __wine_unregister_resources(wshom_instance
);