2 * ExplorerFrame main functions
4 * Copyright 2010 David Hedberg
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.
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.
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
25 #define NONAMELESSUNION
26 #define NONAMELESSSTRUCT
36 #include "wine/debug.h"
38 #include "explorerframe_main.h"
40 WINE_DEFAULT_DEBUG_CHANNEL(explorerframe
);
42 HINSTANCE explorerframe_hinstance
;
43 LONG EFRAME_refCount
= 0;
45 /*************************************************************************
46 * DllMain (ExplorerFrame.@)
48 BOOL WINAPI
DllMain(HINSTANCE hinst
, DWORD fdwReason
, LPVOID fImpLoad
)
50 TRACE("%p, 0x%x, %p\n", hinst
, fdwReason
, fImpLoad
);
53 case DLL_PROCESS_ATTACH
:
54 DisableThreadLibraryCalls(hinst
);
55 explorerframe_hinstance
= hinst
;
61 /*************************************************************************
62 * DllCanUnloadNow (ExplorerFrame.@)
64 HRESULT WINAPI
DllCanUnloadNow(void)
66 TRACE("refCount is %d\n", EFRAME_refCount
);
67 return EFRAME_refCount
? S_FALSE
: S_OK
;
70 /*************************************************************************
71 * DllGetVersion (ExplorerFrame.@)
73 HRESULT WINAPI
DllGetVersion(DLLVERSIONINFO
*info
)
76 if(info
->cbSize
== sizeof(DLLVERSIONINFO
) ||
77 info
->cbSize
== sizeof(DLLVERSIONINFO2
))
80 info
->dwMajorVersion
= 6;
81 info
->dwMinorVersion
= 1;
82 info
->dwBuildNumber
= 7600;
83 info
->dwPlatformID
= DLLVER_PLATFORM_WINDOWS
;
84 if(info
->cbSize
== sizeof(DLLVERSIONINFO2
))
86 DLLVERSIONINFO2
*info2
= (DLLVERSIONINFO2
*)info
;
88 info2
->ullVersion
= MAKEDLLVERULL(info
->dwMajorVersion
,
91 16385); /* "hotfix number" */
96 WARN("wrong DLLVERSIONINFO size from app.\n");
100 /*************************************************************************
101 * Implement the ExplorerFrame class factory
106 IClassFactory IClassFactory_iface
;
107 HRESULT (*cf
)(IUnknown
*, REFIID
, void**);
111 static inline IClassFactoryImpl
*impl_from_IClassFactory(IClassFactory
*iface
)
113 return CONTAINING_RECORD(iface
, IClassFactoryImpl
, IClassFactory_iface
);
116 /*************************************************************************
117 * EFCF_QueryInterface
119 static HRESULT WINAPI
EFCF_QueryInterface(IClassFactory
* iface
,
120 REFIID riid
, void **ppobj
)
122 TRACE("%p (%s %p)\n", iface
, debugstr_guid(riid
), ppobj
);
127 if(IsEqualGUID(&IID_IUnknown
, riid
) || IsEqualGUID(&IID_IClassFactory
, riid
))
130 IClassFactory_AddRef(iface
);
134 WARN("Interface not supported.\n");
137 return E_NOINTERFACE
;
140 /*************************************************************************
143 static ULONG WINAPI
EFCF_AddRef(IClassFactory
*iface
)
147 return 2; /* non-heap based object */
150 /*************************************************************************
153 static ULONG WINAPI
EFCF_Release(IClassFactory
*iface
)
155 EFRAME_UnlockModule();
157 return 1; /* non-heap based object */
160 /*************************************************************************
161 * EFCF_CreateInstance (IClassFactory)
163 static HRESULT WINAPI
EFCF_CreateInstance(IClassFactory
*iface
, IUnknown
*pOuter
,
164 REFIID riid
, void **ppobj
)
166 IClassFactoryImpl
*This
= impl_from_IClassFactory(iface
);
167 return This
->cf(pOuter
, riid
, ppobj
);
170 /*************************************************************************
171 * EFCF_LockServer (IClassFactory)
173 static HRESULT WINAPI
EFCF_LockServer(IClassFactory
*iface
, BOOL dolock
)
175 TRACE("%p (%d)\n", iface
, dolock
);
180 EFRAME_UnlockModule();
185 static const IClassFactoryVtbl EFCF_Vtbl
=
194 /*************************************************************************
195 * DllGetClassObject (ExplorerFrame.@)
197 HRESULT WINAPI
DllGetClassObject(REFCLSID rclsid
, REFIID riid
, void **ppv
)
199 static IClassFactoryImpl NSTCClassFactory
= {{&EFCF_Vtbl
}, NamespaceTreeControl_Constructor
};
200 static IClassFactoryImpl TaskbarListFactory
= {{&EFCF_Vtbl
}, TaskbarList_Constructor
};
202 TRACE("%s, %s, %p\n", debugstr_guid(rclsid
), debugstr_guid(riid
), ppv
);
204 if(IsEqualGUID(&CLSID_NamespaceTreeControl
, rclsid
))
205 return IClassFactory_QueryInterface(&NSTCClassFactory
.IClassFactory_iface
, riid
, ppv
);
207 if(IsEqualGUID(&CLSID_TaskbarList
, rclsid
))
208 return IClassFactory_QueryInterface(&TaskbarListFactory
.IClassFactory_iface
, riid
, ppv
);
210 return CLASS_E_CLASSNOTAVAILABLE
;
213 /*************************************************************************
214 * DllRegisterServer (ExplorerFrame.@)
216 HRESULT WINAPI
DllRegisterServer(void)
218 return __wine_register_resources( explorerframe_hinstance
);
221 /*************************************************************************
222 * DllUnregisterServer (ExplorerFrame.@)
224 HRESULT WINAPI
DllUnregisterServer(void)
226 return __wine_unregister_resources( explorerframe_hinstance
);