uuid: Mark all GUID variables as hidden.
[wine/hacks.git] / dlls / oleaut32 / oleaut.c
blob95b5fe86fea7c8b596e20c80c3047d77b47e031d
1 /*
2 * OLEAUT32
4 * Copyright 1999, 2000 Marcus Meissner
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
21 #include <stdarg.h>
22 #include <string.h>
24 #define COBJMACROS
26 #include "windef.h"
27 #include "winbase.h"
28 #include "wingdi.h"
29 #include "winuser.h"
30 #include "winerror.h"
32 #include "ole2.h"
33 #include "olectl.h"
34 #include "oleauto.h"
35 #include "typelib.h"
37 #include "wine/debug.h"
39 WINE_DEFAULT_DEBUG_CHANNEL(ole);
41 static BOOL BSTR_bCache = TRUE; /* Cache allocations to minimise alloc calls? */
43 HMODULE OLEAUT32_hModule = NULL;
45 /******************************************************************************
46 * BSTR {OLEAUT32}
48 * NOTES
49 * BSTR is a simple typedef for a wide-character string used as the principle
50 * string type in ole automation. When encapsulated in a Variant type they are
51 * automatically copied and destroyed as the variant is processed.
53 * The low level BSTR Api allows manipulation of these strings and is used by
54 * higher level Api calls to manage the strings transparently to the caller.
56 * Internally the BSTR type is allocated with space for a DWORD byte count before
57 * the string data begins. This is undocumented and non-system code should not
58 * access the count directly. Use SysStringLen() or SysStringByteLen()
59 * instead. Note that the byte count does not include the terminating NUL.
61 * To create a new BSTR, use SysAllocString(), SysAllocStringLen() or
62 * SysAllocStringByteLen(). To change the size of an existing BSTR, use SysReAllocString()
63 * or SysReAllocStringLen(). Finally to destroy a string use SysFreeString().
65 * BSTR's are cached by Ole Automation by default. To override this behaviour
66 * either set the environment variable 'OANOCACHE', or call SetOaNoCache().
68 * SEE ALSO
69 * 'Inside OLE, second edition' by Kraig Brockshmidt.
72 /******************************************************************************
73 * SysStringLen [OLEAUT32.7]
75 * Get the allocated length of a BSTR in wide characters.
77 * PARAMS
78 * str [I] BSTR to find the length of
80 * RETURNS
81 * The allocated length of str, or 0 if str is NULL.
83 * NOTES
84 * See BSTR.
85 * The returned length may be different from the length of the string as
86 * calculated by lstrlenW(), since it returns the length that was used to
87 * allocate the string by SysAllocStringLen().
89 UINT WINAPI SysStringLen(BSTR str)
91 DWORD* bufferPointer;
93 if (!str) return 0;
95 * The length of the string (in bytes) is contained in a DWORD placed
96 * just before the BSTR pointer
98 bufferPointer = (DWORD*)str;
100 bufferPointer--;
102 return (int)(*bufferPointer/sizeof(WCHAR));
105 /******************************************************************************
106 * SysStringByteLen [OLEAUT32.149]
108 * Get the allocated length of a BSTR in bytes.
110 * PARAMS
111 * str [I] BSTR to find the length of
113 * RETURNS
114 * The allocated length of str, or 0 if str is NULL.
116 * NOTES
117 * See SysStringLen(), BSTR().
119 UINT WINAPI SysStringByteLen(BSTR str)
121 DWORD* bufferPointer;
123 if (!str) return 0;
125 * The length of the string (in bytes) is contained in a DWORD placed
126 * just before the BSTR pointer
128 bufferPointer = (DWORD*)str;
130 bufferPointer--;
132 return (int)(*bufferPointer);
135 /******************************************************************************
136 * SysAllocString [OLEAUT32.2]
138 * Create a BSTR from an OLESTR.
140 * PARAMS
141 * str [I] Source to create BSTR from
143 * RETURNS
144 * Success: A BSTR allocated with SysAllocStringLen().
145 * Failure: NULL, if oleStr is NULL.
147 * NOTES
148 * See BSTR.
149 * MSDN (October 2001) incorrectly states that NULL is returned if oleStr has
150 * a length of 0. Native Win32 and this implementation both return a valid
151 * empty BSTR in this case.
153 BSTR WINAPI SysAllocString(LPCOLESTR str)
155 if (!str) return 0;
157 /* Delegate this to the SysAllocStringLen32 method. */
158 return SysAllocStringLen(str, lstrlenW(str));
161 /******************************************************************************
162 * SysFreeString [OLEAUT32.6]
164 * Free a BSTR.
166 * PARAMS
167 * str [I] BSTR to free.
169 * RETURNS
170 * Nothing.
172 * NOTES
173 * See BSTR.
174 * str may be NULL, in which case this function does nothing.
176 void WINAPI SysFreeString(BSTR str)
178 DWORD* bufferPointer;
180 /* NULL is a valid parameter */
181 if(!str) return;
184 * We have to be careful when we free a BSTR pointer, it points to
185 * the beginning of the string but it skips the byte count contained
186 * before the string.
188 bufferPointer = (DWORD*)str;
190 bufferPointer--;
193 * Free the memory from its "real" origin.
195 HeapFree(GetProcessHeap(), 0, bufferPointer);
198 /******************************************************************************
199 * SysAllocStringLen [OLEAUT32.4]
201 * Create a BSTR from an OLESTR of a given wide character length.
203 * PARAMS
204 * str [I] Source to create BSTR from
205 * len [I] Length of oleStr in wide characters
207 * RETURNS
208 * Success: A newly allocated BSTR from SysAllocStringByteLen()
209 * Failure: NULL, if len is >= 0x80000000, or memory allocation fails.
211 * NOTES
212 * See BSTR(), SysAllocStringByteLen().
214 BSTR WINAPI SysAllocStringLen(const OLECHAR *str, unsigned int len)
216 DWORD bufferSize;
217 DWORD* newBuffer;
218 WCHAR* stringBuffer;
221 * Find the length of the buffer passed-in in bytes.
223 bufferSize = len * sizeof (WCHAR);
226 * Allocate a new buffer to hold the string.
227 * don't forget to keep an empty spot at the beginning of the
228 * buffer for the character count and an extra character at the
229 * end for the NULL.
231 newBuffer = HeapAlloc(GetProcessHeap(), 0,
232 bufferSize + sizeof(WCHAR) + sizeof(DWORD));
235 * If the memory allocation failed, return a null pointer.
237 if (newBuffer==0)
238 return 0;
241 * Copy the length of the string in the placeholder.
243 *newBuffer = bufferSize;
246 * Skip the byte count.
248 newBuffer++;
251 * Copy the information in the buffer.
252 * Since it is valid to pass a NULL pointer here, we'll initialize the
253 * buffer to nul if it is the case.
255 if (str != 0)
256 memcpy(newBuffer, str, bufferSize);
257 else
258 memset(newBuffer, 0, bufferSize);
261 * Make sure that there is a nul character at the end of the
262 * string.
264 stringBuffer = (WCHAR*)newBuffer;
265 stringBuffer[len] = L'\0';
267 return (LPWSTR)stringBuffer;
270 /******************************************************************************
271 * SysReAllocStringLen [OLEAUT32.5]
273 * Change the length of a previously created BSTR.
275 * PARAMS
276 * old [O] BSTR to change the length of
277 * str [I] New source for pbstr
278 * len [I] Length of oleStr in wide characters
280 * RETURNS
281 * Success: 1. The size of pbstr is updated.
282 * Failure: 0, if len >= 0x80000000 or memory allocation fails.
284 * NOTES
285 * See BSTR(), SysAllocStringByteLen().
286 * *pbstr may be changed by this function.
288 int WINAPI SysReAllocStringLen(BSTR* old, const OLECHAR* str, unsigned int len)
290 if (*old!=NULL) {
291 DWORD newbytelen = len*sizeof(WCHAR);
292 DWORD *ptr = HeapReAlloc(GetProcessHeap(),0,((DWORD*)*old)-1,newbytelen+sizeof(WCHAR)+sizeof(DWORD));
293 *old = (BSTR)(ptr+1);
294 *ptr = newbytelen;
295 if (str) {
296 memcpy(*old, str, newbytelen);
297 (*old)[len] = 0;
298 } else {
299 /* Subtle hidden feature: The old string data is still there
300 * when 'in' is NULL!
301 * Some Microsoft program needs it.
304 } else {
306 * Allocate the new string
308 *old = SysAllocStringLen(str, len);
311 return 1;
314 /******************************************************************************
315 * SysAllocStringByteLen [OLEAUT32.150]
317 * Create a BSTR from an OLESTR of a given byte length.
319 * PARAMS
320 * str [I] Source to create BSTR from
321 * len [I] Length of oleStr in bytes
323 * RETURNS
324 * Success: A newly allocated BSTR
325 * Failure: NULL, if len is >= 0x80000000, or memory allocation fails.
327 * NOTES
328 * -If len is 0 or oleStr is NULL the resulting string is empty ("").
329 * -This function always NUL terminates the resulting BSTR.
330 * -oleStr may be either an LPCSTR or LPCOLESTR, since it is copied
331 * without checking for a terminating NUL.
332 * See BSTR.
334 BSTR WINAPI SysAllocStringByteLen(LPCSTR str, UINT len)
336 DWORD* newBuffer;
337 char* stringBuffer;
340 * Allocate a new buffer to hold the string.
341 * don't forget to keep an empty spot at the beginning of the
342 * buffer for the character count and an extra character at the
343 * end for the NULL.
345 newBuffer = HeapAlloc(GetProcessHeap(), 0,
346 len + sizeof(WCHAR) + sizeof(DWORD));
349 * If the memory allocation failed, return a null pointer.
351 if (newBuffer==0)
352 return 0;
355 * Copy the length of the string in the placeholder.
357 *newBuffer = len;
360 * Skip the byte count.
362 newBuffer++;
365 * Copy the information in the buffer.
366 * Since it is valid to pass a NULL pointer here, we'll initialize the
367 * buffer to nul if it is the case.
369 if (str != 0)
370 memcpy(newBuffer, str, len);
373 * Make sure that there is a nul character at the end of the
374 * string.
376 stringBuffer = (char *)newBuffer;
377 stringBuffer[len] = 0;
378 stringBuffer[len+1] = 0;
380 return (LPWSTR)stringBuffer;
383 /******************************************************************************
384 * SysReAllocString [OLEAUT32.3]
386 * Change the length of a previously created BSTR.
388 * PARAMS
389 * old [I/O] BSTR to change the length of
390 * str [I] New source for pbstr
392 * RETURNS
393 * Success: 1
394 * Failure: 0.
396 * NOTES
397 * See BSTR(), SysAllocStringStringLen().
399 INT WINAPI SysReAllocString(LPBSTR old,LPCOLESTR str)
402 * Sanity check
404 if (old==NULL)
405 return 0;
408 * Make sure we free the old string.
410 if (*old!=NULL)
411 SysFreeString(*old);
414 * Allocate the new string
416 *old = SysAllocString(str);
418 return 1;
421 /******************************************************************************
422 * SetOaNoCache (OLEAUT32.327)
424 * Instruct Ole Automation not to cache BSTR allocations.
426 * PARAMS
427 * None.
429 * RETURNS
430 * Nothing.
432 * NOTES
433 * See BSTR.
435 void WINAPI SetOaNoCache(void)
437 BSTR_bCache = FALSE;
440 static const WCHAR _delimiter[2] = {'!',0}; /* default delimiter apparently */
441 static const WCHAR *pdelimiter = &_delimiter[0];
443 /***********************************************************************
444 * RegisterActiveObject (OLEAUT32.33)
446 * Registers an object in the global item table.
448 * PARAMS
449 * punk [I] Object to register.
450 * rcid [I] CLSID of the object.
451 * dwFlags [I] Flags.
452 * pdwRegister [O] Address to store cookie of object registration in.
454 * RETURNS
455 * Success: S_OK.
456 * Failure: HRESULT code.
458 HRESULT WINAPI RegisterActiveObject(
459 LPUNKNOWN punk,REFCLSID rcid,DWORD dwFlags,LPDWORD pdwRegister
461 WCHAR guidbuf[80];
462 HRESULT ret;
463 LPRUNNINGOBJECTTABLE runobtable;
464 LPMONIKER moniker;
466 StringFromGUID2(rcid,guidbuf,39);
467 ret = CreateItemMoniker(pdelimiter,guidbuf,&moniker);
468 if (FAILED(ret))
469 return ret;
470 ret = GetRunningObjectTable(0,&runobtable);
471 if (FAILED(ret)) {
472 IMoniker_Release(moniker);
473 return ret;
475 ret = IRunningObjectTable_Register(runobtable,dwFlags,punk,moniker,pdwRegister);
476 IRunningObjectTable_Release(runobtable);
477 IMoniker_Release(moniker);
478 return ret;
481 /***********************************************************************
482 * RevokeActiveObject (OLEAUT32.34)
484 * Revokes an object from the global item table.
486 * PARAMS
487 * xregister [I] Registration cookie.
488 * reserved [I] Reserved. Set to NULL.
490 * RETURNS
491 * Success: S_OK.
492 * Failure: HRESULT code.
494 HRESULT WINAPI RevokeActiveObject(DWORD xregister,LPVOID reserved)
496 LPRUNNINGOBJECTTABLE runobtable;
497 HRESULT ret;
499 ret = GetRunningObjectTable(0,&runobtable);
500 if (FAILED(ret)) return ret;
501 ret = IRunningObjectTable_Revoke(runobtable,xregister);
502 if (SUCCEEDED(ret)) ret = S_OK;
503 IRunningObjectTable_Release(runobtable);
504 return ret;
507 /***********************************************************************
508 * GetActiveObject (OLEAUT32.35)
510 * Gets an object from the global item table.
512 * PARAMS
513 * rcid [I] CLSID of the object.
514 * preserved [I] Reserved. Set to NULL.
515 * ppunk [O] Address to store object into.
517 * RETURNS
518 * Success: S_OK.
519 * Failure: HRESULT code.
521 HRESULT WINAPI GetActiveObject(REFCLSID rcid,LPVOID preserved,LPUNKNOWN *ppunk)
523 WCHAR guidbuf[80];
524 HRESULT ret;
525 LPRUNNINGOBJECTTABLE runobtable;
526 LPMONIKER moniker;
528 StringFromGUID2(rcid,guidbuf,39);
529 ret = CreateItemMoniker(pdelimiter,guidbuf,&moniker);
530 if (FAILED(ret))
531 return ret;
532 ret = GetRunningObjectTable(0,&runobtable);
533 if (FAILED(ret)) {
534 IMoniker_Release(moniker);
535 return ret;
537 ret = IRunningObjectTable_GetObject(runobtable,moniker,ppunk);
538 IRunningObjectTable_Release(runobtable);
539 IMoniker_Release(moniker);
540 return ret;
544 /***********************************************************************
545 * OaBuildVersion [OLEAUT32.170]
547 * Get the Ole Automation build version.
549 * PARAMS
550 * None
552 * RETURNS
553 * The build version.
555 * NOTES
556 * Known oleaut32.dll versions:
557 *| OLE Ver. Comments Date Build Ver.
558 *| -------- ------------------------- ---- ---------
559 *| OLE 2.1 NT 1993-95 10 3023
560 *| OLE 2.1 10 3027
561 *| Win32s Ver 1.1e 20 4049
562 *| OLE 2.20 W95/NT 1993-96 20 4112
563 *| OLE 2.20 W95/NT 1993-96 20 4118
564 *| OLE 2.20 W95/NT 1993-96 20 4122
565 *| OLE 2.30 W95/NT 1993-98 30 4265
566 *| OLE 2.40 NT?? 1993-98 40 4267
567 *| OLE 2.40 W98 SE orig. file 1993-98 40 4275
568 *| OLE 2.40 W2K orig. file 1993-XX 40 4514
570 * Currently the versions returned are 2.20 for Win3.1, 2.30 for Win95 & NT 3.51,
571 * and 2.40 for all later versions. The build number is maximum, i.e. 0xffff.
573 ULONG WINAPI OaBuildVersion()
575 switch(GetVersion() & 0x8000ffff) /* mask off build number */
577 case 0x80000a03: /* WIN31 */
578 return MAKELONG(0xffff, 20);
579 case 0x00003303: /* NT351 */
580 return MAKELONG(0xffff, 30);
581 case 0x80000004: /* WIN95; I'd like to use the "standard" w95 minor
582 version here (30), but as we still use w95
583 as default winver (which is good IMHO), I better
584 play safe and use the latest value for w95 for now.
585 Change this as soon as default winver gets changed
586 to something more recent */
587 case 0x80000a04: /* WIN98 */
588 case 0x00000004: /* NT40 */
589 case 0x00000005: /* W2K */
590 case 0x00000105: /* WinXP */
591 return MAKELONG(0xffff, 40);
592 default:
593 FIXME("Version value not known yet. Please investigate it !\n");
594 return MAKELONG(0xffff, 40); /* for now return the same value as for w2k */
598 /******************************************************************************
599 * OleTranslateColor [OLEAUT32.421]
601 * Convert an OLE_COLOR to a COLORREF.
603 * PARAMS
604 * clr [I] Color to convert
605 * hpal [I] Handle to a palette for the conversion
606 * pColorRef [O] Destination for converted color, or NULL to test if the conversion is ok
608 * RETURNS
609 * Success: S_OK. The conversion is ok, and pColorRef contains the converted color if non-NULL.
610 * Failure: E_INVALIDARG, if any argument is invalid.
612 * FIXME
613 * Document the conversion rules.
615 HRESULT WINAPI OleTranslateColor(
616 OLE_COLOR clr,
617 HPALETTE hpal,
618 COLORREF* pColorRef)
620 COLORREF colorref;
621 BYTE b = HIBYTE(HIWORD(clr));
623 TRACE("(%08lx, %p, %p)\n", clr, hpal, pColorRef);
626 * In case pColorRef is NULL, provide our own to simplify the code.
628 if (pColorRef == NULL)
629 pColorRef = &colorref;
631 switch (b)
633 case 0x00:
635 if (hpal != 0)
636 *pColorRef = PALETTERGB(GetRValue(clr),
637 GetGValue(clr),
638 GetBValue(clr));
639 else
640 *pColorRef = clr;
642 break;
645 case 0x01:
647 if (hpal != 0)
649 PALETTEENTRY pe;
651 * Validate the palette index.
653 if (GetPaletteEntries(hpal, LOWORD(clr), 1, &pe) == 0)
654 return E_INVALIDARG;
657 *pColorRef = clr;
659 break;
662 case 0x02:
663 *pColorRef = clr;
664 break;
666 case 0x80:
668 int index = LOBYTE(LOWORD(clr));
671 * Validate GetSysColor index.
673 if ((index < COLOR_SCROLLBAR) || (index > COLOR_MENUBAR))
674 return E_INVALIDARG;
676 *pColorRef = GetSysColor(index);
678 break;
681 default:
682 return E_INVALIDARG;
685 return S_OK;
688 extern HRESULT OLEAUTPS_DllGetClassObject(REFCLSID rclsid, REFIID riid, LPVOID *ppv);
690 extern void _get_STDFONT_CF(LPVOID);
691 extern void _get_STDPIC_CF(LPVOID);
693 static HRESULT WINAPI PSDispatchFacBuf_QueryInterface(IPSFactoryBuffer *iface, REFIID riid, void **ppv)
695 if (IsEqualIID(riid, &IID_IUnknown) ||
696 IsEqualIID(riid, &IID_IPSFactoryBuffer))
698 IUnknown_AddRef(iface);
699 *ppv = (void *)iface;
700 return S_OK;
702 return E_NOINTERFACE;
705 static ULONG WINAPI PSDispatchFacBuf_AddRef(IPSFactoryBuffer *iface)
707 return 2;
710 static ULONG WINAPI PSDispatchFacBuf_Release(IPSFactoryBuffer *iface)
712 return 1;
715 static HRESULT WINAPI PSDispatchFacBuf_CreateProxy(IPSFactoryBuffer *iface, IUnknown *pUnkOuter, REFIID riid, IRpcProxyBuffer **ppProxy, void **ppv)
717 IPSFactoryBuffer *pPSFB;
718 HRESULT hr;
720 if (IsEqualIID(riid, &IID_IDispatch))
721 hr = OLEAUTPS_DllGetClassObject(&CLSID_PSDispatch, &IID_IPSFactoryBuffer, (void **)&pPSFB);
722 else
723 hr = TMARSHAL_DllGetClassObject(&CLSID_PSOAInterface, &IID_IPSFactoryBuffer, (void **)&pPSFB);
725 if (FAILED(hr)) return hr;
727 hr = IPSFactoryBuffer_CreateProxy(pPSFB, pUnkOuter, riid, ppProxy, ppv);
729 IPSFactoryBuffer_Release(pPSFB);
730 return hr;
733 static HRESULT WINAPI PSDispatchFacBuf_CreateStub(IPSFactoryBuffer *iface, REFIID riid, IUnknown *pUnkOuter, IRpcStubBuffer **ppStub)
735 IPSFactoryBuffer *pPSFB;
736 HRESULT hr;
738 if (IsEqualIID(riid, &IID_IDispatch))
739 hr = OLEAUTPS_DllGetClassObject(&CLSID_PSDispatch, &IID_IPSFactoryBuffer, (void **)&pPSFB);
740 else
741 hr = TMARSHAL_DllGetClassObject(&CLSID_PSOAInterface, &IID_IPSFactoryBuffer, (void **)&pPSFB);
743 if (FAILED(hr)) return hr;
745 hr = IPSFactoryBuffer_CreateStub(pPSFB, riid, pUnkOuter, ppStub);
747 IPSFactoryBuffer_Release(pPSFB);
748 return hr;
751 static const IPSFactoryBufferVtbl PSDispatchFacBuf_Vtbl =
753 PSDispatchFacBuf_QueryInterface,
754 PSDispatchFacBuf_AddRef,
755 PSDispatchFacBuf_Release,
756 PSDispatchFacBuf_CreateProxy,
757 PSDispatchFacBuf_CreateStub
760 /* This is the whole PSFactoryBuffer object, just the vtableptr */
761 static const IPSFactoryBufferVtbl *pPSDispatchFacBuf = &PSDispatchFacBuf_Vtbl;
763 /***********************************************************************
764 * DllGetClassObject (OLEAUT32.@)
766 HRESULT WINAPI DllGetClassObject(REFCLSID rclsid, REFIID iid, LPVOID *ppv)
768 *ppv = NULL;
769 if (IsEqualGUID(rclsid,&CLSID_StdFont)) {
770 if (IsEqualGUID(iid,&IID_IClassFactory)) {
771 _get_STDFONT_CF(ppv);
772 IClassFactory_AddRef((IClassFactory*)*ppv);
773 return S_OK;
776 if (IsEqualGUID(rclsid,&CLSID_StdPicture)) {
777 if (IsEqualGUID(iid,&IID_IClassFactory)) {
778 _get_STDPIC_CF(ppv);
779 IClassFactory_AddRef((IClassFactory*)*ppv);
780 return S_OK;
783 if (IsEqualCLSID(rclsid, &CLSID_PSTypeInfo) ||
784 IsEqualCLSID(rclsid, &CLSID_PSTypeLib) ||
785 IsEqualCLSID(rclsid, &CLSID_PSEnumVariant)) {
786 return OLEAUTPS_DllGetClassObject(&CLSID_PSDispatch, iid, ppv);
788 if (IsEqualCLSID(rclsid, &CLSID_PSDispatch) && IsEqualIID(iid, &IID_IPSFactoryBuffer)) {
789 *ppv = &pPSDispatchFacBuf;
790 IPSFactoryBuffer_AddRef((IPSFactoryBuffer *)*ppv);
791 return S_OK;
793 if (IsEqualGUID(rclsid,&CLSID_PSOAInterface)) {
794 if (S_OK==TMARSHAL_DllGetClassObject(rclsid,iid,ppv))
795 return S_OK;
796 /*FALLTHROUGH*/
798 FIXME("\n\tCLSID:\t%s,\n\tIID:\t%s\n",debugstr_guid(rclsid),debugstr_guid(iid));
799 return CLASS_E_CLASSNOTAVAILABLE;
802 /***********************************************************************
803 * DllCanUnloadNow (OLEAUT32.@)
805 * Determine if this dll can be unloaded from the callers address space.
807 * PARAMS
808 * None.
810 * RETURNS
811 * Always returns S_FALSE. This dll cannot be unloaded.
813 HRESULT WINAPI DllCanUnloadNow(void)
815 return S_FALSE;
818 /*****************************************************************************
819 * DllMain [OLEAUT32.@]
821 BOOL WINAPI DllMain(HINSTANCE hInstDll, DWORD fdwReason, LPVOID lpvReserved)
823 TRACE("(%p,%ld,%p)\n", hInstDll, fdwReason, lpvReserved);
825 switch (fdwReason) {
826 case DLL_PROCESS_ATTACH:
827 DisableThreadLibraryCalls(hInstDll);
828 OLEAUT32_hModule = (HMODULE)hInstDll;
829 break;
830 case DLL_PROCESS_DETACH:
831 break;
834 return TRUE;