rpcrt4: Initialise pStubMsg->MemorySize to zero before calling ComplexStructMemorySiz...
[wine/multimedia.git] / dlls / oleaut32 / oleaut.c
blobda186109f8377b4c09eafcb4872f738ac2a2772a
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 /* The OLE Automation ProxyStub Interface Class (aka Typelib Marshaler) */
42 extern const GUID CLSID_PSOAInterface;
44 extern const GUID CLSID_PSDispatch;
45 extern const GUID CLSID_PSEnumVariant;
46 extern const GUID CLSID_PSTypeInfo;
47 extern const GUID CLSID_PSTypeLib;
48 extern const GUID CLSID_PSTypeComp;
50 static BOOL BSTR_bCache = TRUE; /* Cache allocations to minimise alloc calls? */
52 HMODULE OLEAUT32_hModule = NULL;
54 /******************************************************************************
55 * BSTR {OLEAUT32}
57 * NOTES
58 * BSTR is a simple typedef for a wide-character string used as the principle
59 * string type in ole automation. When encapsulated in a Variant type they are
60 * automatically copied and destroyed as the variant is processed.
62 * The low level BSTR Api allows manipulation of these strings and is used by
63 * higher level Api calls to manage the strings transparently to the caller.
65 * Internally the BSTR type is allocated with space for a DWORD byte count before
66 * the string data begins. This is undocumented and non-system code should not
67 * access the count directly. Use SysStringLen() or SysStringByteLen()
68 * instead. Note that the byte count does not include the terminating NUL.
70 * To create a new BSTR, use SysAllocString(), SysAllocStringLen() or
71 * SysAllocStringByteLen(). To change the size of an existing BSTR, use SysReAllocString()
72 * or SysReAllocStringLen(). Finally to destroy a string use SysFreeString().
74 * BSTR's are cached by Ole Automation by default. To override this behaviour
75 * either set the environment variable 'OANOCACHE', or call SetOaNoCache().
77 * SEE ALSO
78 * 'Inside OLE, second edition' by Kraig Brockshmidt.
81 /******************************************************************************
82 * SysStringLen [OLEAUT32.7]
84 * Get the allocated length of a BSTR in wide characters.
86 * PARAMS
87 * str [I] BSTR to find the length of
89 * RETURNS
90 * The allocated length of str, or 0 if str is NULL.
92 * NOTES
93 * See BSTR.
94 * The returned length may be different from the length of the string as
95 * calculated by lstrlenW(), since it returns the length that was used to
96 * allocate the string by SysAllocStringLen().
98 UINT WINAPI SysStringLen(BSTR str)
100 DWORD* bufferPointer;
102 if (!str) return 0;
104 * The length of the string (in bytes) is contained in a DWORD placed
105 * just before the BSTR pointer
107 bufferPointer = (DWORD*)str;
109 bufferPointer--;
111 return (int)(*bufferPointer/sizeof(WCHAR));
114 /******************************************************************************
115 * SysStringByteLen [OLEAUT32.149]
117 * Get the allocated length of a BSTR in bytes.
119 * PARAMS
120 * str [I] BSTR to find the length of
122 * RETURNS
123 * The allocated length of str, or 0 if str is NULL.
125 * NOTES
126 * See SysStringLen(), BSTR().
128 UINT WINAPI SysStringByteLen(BSTR str)
130 DWORD* bufferPointer;
132 if (!str) return 0;
134 * The length of the string (in bytes) is contained in a DWORD placed
135 * just before the BSTR pointer
137 bufferPointer = (DWORD*)str;
139 bufferPointer--;
141 return (int)(*bufferPointer);
144 /******************************************************************************
145 * SysAllocString [OLEAUT32.2]
147 * Create a BSTR from an OLESTR.
149 * PARAMS
150 * str [I] Source to create BSTR from
152 * RETURNS
153 * Success: A BSTR allocated with SysAllocStringLen().
154 * Failure: NULL, if oleStr is NULL.
156 * NOTES
157 * See BSTR.
158 * MSDN (October 2001) incorrectly states that NULL is returned if oleStr has
159 * a length of 0. Native Win32 and this implementation both return a valid
160 * empty BSTR in this case.
162 BSTR WINAPI SysAllocString(LPCOLESTR str)
164 if (!str) return 0;
166 /* Delegate this to the SysAllocStringLen32 method. */
167 return SysAllocStringLen(str, lstrlenW(str));
170 /******************************************************************************
171 * SysFreeString [OLEAUT32.6]
173 * Free a BSTR.
175 * PARAMS
176 * str [I] BSTR to free.
178 * RETURNS
179 * Nothing.
181 * NOTES
182 * See BSTR.
183 * str may be NULL, in which case this function does nothing.
185 void WINAPI SysFreeString(BSTR str)
187 DWORD* bufferPointer;
189 /* NULL is a valid parameter */
190 if(!str) return;
193 * We have to be careful when we free a BSTR pointer, it points to
194 * the beginning of the string but it skips the byte count contained
195 * before the string.
197 bufferPointer = (DWORD*)str;
199 bufferPointer--;
202 * Free the memory from its "real" origin.
204 HeapFree(GetProcessHeap(), 0, bufferPointer);
207 /******************************************************************************
208 * SysAllocStringLen [OLEAUT32.4]
210 * Create a BSTR from an OLESTR of a given wide character length.
212 * PARAMS
213 * str [I] Source to create BSTR from
214 * len [I] Length of oleStr in wide characters
216 * RETURNS
217 * Success: A newly allocated BSTR from SysAllocStringByteLen()
218 * Failure: NULL, if len is >= 0x80000000, or memory allocation fails.
220 * NOTES
221 * See BSTR(), SysAllocStringByteLen().
223 BSTR WINAPI SysAllocStringLen(const OLECHAR *str, unsigned int len)
225 DWORD bufferSize;
226 DWORD* newBuffer;
227 WCHAR* stringBuffer;
230 * Find the length of the buffer passed-in in bytes.
232 bufferSize = len * sizeof (WCHAR);
235 * Allocate a new buffer to hold the string.
236 * don't forget to keep an empty spot at the beginning of the
237 * buffer for the character count and an extra character at the
238 * end for the NULL.
240 newBuffer = HeapAlloc(GetProcessHeap(), 0,
241 bufferSize + sizeof(WCHAR) + sizeof(DWORD));
244 * If the memory allocation failed, return a null pointer.
246 if (newBuffer==0)
247 return 0;
250 * Copy the length of the string in the placeholder.
252 *newBuffer = bufferSize;
255 * Skip the byte count.
257 newBuffer++;
260 * Copy the information in the buffer.
261 * Since it is valid to pass a NULL pointer here, we'll initialize the
262 * buffer to nul if it is the case.
264 if (str != 0)
265 memcpy(newBuffer, str, bufferSize);
266 else
267 memset(newBuffer, 0, bufferSize);
270 * Make sure that there is a nul character at the end of the
271 * string.
273 stringBuffer = (WCHAR*)newBuffer;
274 stringBuffer[len] = L'\0';
276 return (LPWSTR)stringBuffer;
279 /******************************************************************************
280 * SysReAllocStringLen [OLEAUT32.5]
282 * Change the length of a previously created BSTR.
284 * PARAMS
285 * old [O] BSTR to change the length of
286 * str [I] New source for pbstr
287 * len [I] Length of oleStr in wide characters
289 * RETURNS
290 * Success: 1. The size of pbstr is updated.
291 * Failure: 0, if len >= 0x80000000 or memory allocation fails.
293 * NOTES
294 * See BSTR(), SysAllocStringByteLen().
295 * *pbstr may be changed by this function.
297 int WINAPI SysReAllocStringLen(BSTR* old, const OLECHAR* str, unsigned int len)
299 if (*old!=NULL) {
300 DWORD newbytelen = len*sizeof(WCHAR);
301 DWORD *ptr = HeapReAlloc(GetProcessHeap(),0,((DWORD*)*old)-1,newbytelen+sizeof(WCHAR)+sizeof(DWORD));
302 *old = (BSTR)(ptr+1);
303 *ptr = newbytelen;
304 if (str) {
305 memcpy(*old, str, newbytelen);
306 (*old)[len] = 0;
307 } else {
308 /* Subtle hidden feature: The old string data is still there
309 * when 'in' is NULL!
310 * Some Microsoft program needs it.
313 } else {
315 * Allocate the new string
317 *old = SysAllocStringLen(str, len);
320 return 1;
323 /******************************************************************************
324 * SysAllocStringByteLen [OLEAUT32.150]
326 * Create a BSTR from an OLESTR of a given byte length.
328 * PARAMS
329 * str [I] Source to create BSTR from
330 * len [I] Length of oleStr in bytes
332 * RETURNS
333 * Success: A newly allocated BSTR
334 * Failure: NULL, if len is >= 0x80000000, or memory allocation fails.
336 * NOTES
337 * -If len is 0 or oleStr is NULL the resulting string is empty ("").
338 * -This function always NUL terminates the resulting BSTR.
339 * -oleStr may be either an LPCSTR or LPCOLESTR, since it is copied
340 * without checking for a terminating NUL.
341 * See BSTR.
343 BSTR WINAPI SysAllocStringByteLen(LPCSTR str, UINT len)
345 DWORD* newBuffer;
346 char* stringBuffer;
349 * Allocate a new buffer to hold the string.
350 * don't forget to keep an empty spot at the beginning of the
351 * buffer for the character count and an extra character at the
352 * end for the NULL.
354 newBuffer = HeapAlloc(GetProcessHeap(), 0,
355 len + sizeof(WCHAR) + sizeof(DWORD));
358 * If the memory allocation failed, return a null pointer.
360 if (newBuffer==0)
361 return 0;
364 * Copy the length of the string in the placeholder.
366 *newBuffer = len;
369 * Skip the byte count.
371 newBuffer++;
374 * Copy the information in the buffer.
375 * Since it is valid to pass a NULL pointer here, we'll initialize the
376 * buffer to nul if it is the case.
378 if (str != 0)
379 memcpy(newBuffer, str, len);
382 * Make sure that there is a nul character at the end of the
383 * string.
385 stringBuffer = (char *)newBuffer;
386 stringBuffer[len] = 0;
387 stringBuffer[len+1] = 0;
389 return (LPWSTR)stringBuffer;
392 /******************************************************************************
393 * SysReAllocString [OLEAUT32.3]
395 * Change the length of a previously created BSTR.
397 * PARAMS
398 * old [I/O] BSTR to change the length of
399 * str [I] New source for pbstr
401 * RETURNS
402 * Success: 1
403 * Failure: 0.
405 * NOTES
406 * See BSTR(), SysAllocStringStringLen().
408 INT WINAPI SysReAllocString(LPBSTR old,LPCOLESTR str)
411 * Sanity check
413 if (old==NULL)
414 return 0;
417 * Make sure we free the old string.
419 if (*old!=NULL)
420 SysFreeString(*old);
423 * Allocate the new string
425 *old = SysAllocString(str);
427 return 1;
430 /******************************************************************************
431 * SetOaNoCache (OLEAUT32.327)
433 * Instruct Ole Automation not to cache BSTR allocations.
435 * PARAMS
436 * None.
438 * RETURNS
439 * Nothing.
441 * NOTES
442 * See BSTR.
444 void WINAPI SetOaNoCache(void)
446 BSTR_bCache = FALSE;
449 static const WCHAR _delimiter[2] = {'!',0}; /* default delimiter apparently */
450 static const WCHAR *pdelimiter = &_delimiter[0];
452 /***********************************************************************
453 * RegisterActiveObject (OLEAUT32.33)
455 * Registers an object in the global item table.
457 * PARAMS
458 * punk [I] Object to register.
459 * rcid [I] CLSID of the object.
460 * dwFlags [I] Flags.
461 * pdwRegister [O] Address to store cookie of object registration in.
463 * RETURNS
464 * Success: S_OK.
465 * Failure: HRESULT code.
467 HRESULT WINAPI RegisterActiveObject(
468 LPUNKNOWN punk,REFCLSID rcid,DWORD dwFlags,LPDWORD pdwRegister
470 WCHAR guidbuf[80];
471 HRESULT ret;
472 LPRUNNINGOBJECTTABLE runobtable;
473 LPMONIKER moniker;
475 StringFromGUID2(rcid,guidbuf,39);
476 ret = CreateItemMoniker(pdelimiter,guidbuf,&moniker);
477 if (FAILED(ret))
478 return ret;
479 ret = GetRunningObjectTable(0,&runobtable);
480 if (FAILED(ret)) {
481 IMoniker_Release(moniker);
482 return ret;
484 ret = IRunningObjectTable_Register(runobtable,dwFlags,punk,moniker,pdwRegister);
485 IRunningObjectTable_Release(runobtable);
486 IMoniker_Release(moniker);
487 return ret;
490 /***********************************************************************
491 * RevokeActiveObject (OLEAUT32.34)
493 * Revokes an object from the global item table.
495 * PARAMS
496 * xregister [I] Registration cookie.
497 * reserved [I] Reserved. Set to NULL.
499 * RETURNS
500 * Success: S_OK.
501 * Failure: HRESULT code.
503 HRESULT WINAPI RevokeActiveObject(DWORD xregister,LPVOID reserved)
505 LPRUNNINGOBJECTTABLE runobtable;
506 HRESULT ret;
508 ret = GetRunningObjectTable(0,&runobtable);
509 if (FAILED(ret)) return ret;
510 ret = IRunningObjectTable_Revoke(runobtable,xregister);
511 if (SUCCEEDED(ret)) ret = S_OK;
512 IRunningObjectTable_Release(runobtable);
513 return ret;
516 /***********************************************************************
517 * GetActiveObject (OLEAUT32.35)
519 * Gets an object from the global item table.
521 * PARAMS
522 * rcid [I] CLSID of the object.
523 * preserved [I] Reserved. Set to NULL.
524 * ppunk [O] Address to store object into.
526 * RETURNS
527 * Success: S_OK.
528 * Failure: HRESULT code.
530 HRESULT WINAPI GetActiveObject(REFCLSID rcid,LPVOID preserved,LPUNKNOWN *ppunk)
532 WCHAR guidbuf[80];
533 HRESULT ret;
534 LPRUNNINGOBJECTTABLE runobtable;
535 LPMONIKER moniker;
537 StringFromGUID2(rcid,guidbuf,39);
538 ret = CreateItemMoniker(pdelimiter,guidbuf,&moniker);
539 if (FAILED(ret))
540 return ret;
541 ret = GetRunningObjectTable(0,&runobtable);
542 if (FAILED(ret)) {
543 IMoniker_Release(moniker);
544 return ret;
546 ret = IRunningObjectTable_GetObject(runobtable,moniker,ppunk);
547 IRunningObjectTable_Release(runobtable);
548 IMoniker_Release(moniker);
549 return ret;
553 /***********************************************************************
554 * OaBuildVersion [OLEAUT32.170]
556 * Get the Ole Automation build version.
558 * PARAMS
559 * None
561 * RETURNS
562 * The build version.
564 * NOTES
565 * Known oleaut32.dll versions:
566 *| OLE Ver. Comments Date Build Ver.
567 *| -------- ------------------------- ---- ---------
568 *| OLE 2.1 NT 1993-95 10 3023
569 *| OLE 2.1 10 3027
570 *| Win32s Ver 1.1e 20 4049
571 *| OLE 2.20 W95/NT 1993-96 20 4112
572 *| OLE 2.20 W95/NT 1993-96 20 4118
573 *| OLE 2.20 W95/NT 1993-96 20 4122
574 *| OLE 2.30 W95/NT 1993-98 30 4265
575 *| OLE 2.40 NT?? 1993-98 40 4267
576 *| OLE 2.40 W98 SE orig. file 1993-98 40 4275
577 *| OLE 2.40 W2K orig. file 1993-XX 40 4514
579 * Currently the versions returned are 2.20 for Win3.1, 2.30 for Win95 & NT 3.51,
580 * and 2.40 for all later versions. The build number is maximum, i.e. 0xffff.
582 ULONG WINAPI OaBuildVersion()
584 switch(GetVersion() & 0x8000ffff) /* mask off build number */
586 case 0x80000a03: /* WIN31 */
587 return MAKELONG(0xffff, 20);
588 case 0x00003303: /* NT351 */
589 return MAKELONG(0xffff, 30);
590 case 0x80000004: /* WIN95; I'd like to use the "standard" w95 minor
591 version here (30), but as we still use w95
592 as default winver (which is good IMHO), I better
593 play safe and use the latest value for w95 for now.
594 Change this as soon as default winver gets changed
595 to something more recent */
596 case 0x80000a04: /* WIN98 */
597 case 0x00000004: /* NT40 */
598 case 0x00000005: /* W2K */
599 case 0x00000105: /* WinXP */
600 return MAKELONG(0xffff, 40);
601 default:
602 FIXME("Version value not known yet. Please investigate it !\n");
603 return MAKELONG(0xffff, 40); /* for now return the same value as for w2k */
607 /******************************************************************************
608 * OleTranslateColor [OLEAUT32.421]
610 * Convert an OLE_COLOR to a COLORREF.
612 * PARAMS
613 * clr [I] Color to convert
614 * hpal [I] Handle to a palette for the conversion
615 * pColorRef [O] Destination for converted color, or NULL to test if the conversion is ok
617 * RETURNS
618 * Success: S_OK. The conversion is ok, and pColorRef contains the converted color if non-NULL.
619 * Failure: E_INVALIDARG, if any argument is invalid.
621 * FIXME
622 * Document the conversion rules.
624 HRESULT WINAPI OleTranslateColor(
625 OLE_COLOR clr,
626 HPALETTE hpal,
627 COLORREF* pColorRef)
629 COLORREF colorref;
630 BYTE b = HIBYTE(HIWORD(clr));
632 TRACE("(%08lx, %p, %p)\n", clr, hpal, pColorRef);
635 * In case pColorRef is NULL, provide our own to simplify the code.
637 if (pColorRef == NULL)
638 pColorRef = &colorref;
640 switch (b)
642 case 0x00:
644 if (hpal != 0)
645 *pColorRef = PALETTERGB(GetRValue(clr),
646 GetGValue(clr),
647 GetBValue(clr));
648 else
649 *pColorRef = clr;
651 break;
654 case 0x01:
656 if (hpal != 0)
658 PALETTEENTRY pe;
660 * Validate the palette index.
662 if (GetPaletteEntries(hpal, LOWORD(clr), 1, &pe) == 0)
663 return E_INVALIDARG;
666 *pColorRef = clr;
668 break;
671 case 0x02:
672 *pColorRef = clr;
673 break;
675 case 0x80:
677 int index = LOBYTE(LOWORD(clr));
680 * Validate GetSysColor index.
682 if ((index < COLOR_SCROLLBAR) || (index > COLOR_MENUBAR))
683 return E_INVALIDARG;
685 *pColorRef = GetSysColor(index);
687 break;
690 default:
691 return E_INVALIDARG;
694 return S_OK;
697 extern HRESULT OLEAUTPS_DllGetClassObject(REFCLSID rclsid, REFIID riid, LPVOID *ppv);
699 extern void _get_STDFONT_CF(LPVOID);
700 extern void _get_STDPIC_CF(LPVOID);
702 static HRESULT WINAPI PSDispatchFacBuf_QueryInterface(IPSFactoryBuffer *iface, REFIID riid, void **ppv)
704 if (IsEqualIID(riid, &IID_IUnknown) ||
705 IsEqualIID(riid, &IID_IPSFactoryBuffer))
707 IUnknown_AddRef(iface);
708 *ppv = (void *)iface;
709 return S_OK;
711 return E_NOINTERFACE;
714 static ULONG WINAPI PSDispatchFacBuf_AddRef(IPSFactoryBuffer *iface)
716 return 2;
719 static ULONG WINAPI PSDispatchFacBuf_Release(IPSFactoryBuffer *iface)
721 return 1;
724 static HRESULT WINAPI PSDispatchFacBuf_CreateProxy(IPSFactoryBuffer *iface, IUnknown *pUnkOuter, REFIID riid, IRpcProxyBuffer **ppProxy, void **ppv)
726 IPSFactoryBuffer *pPSFB;
727 HRESULT hr;
729 if (IsEqualIID(riid, &IID_IDispatch))
730 hr = OLEAUTPS_DllGetClassObject(&CLSID_PSDispatch, &IID_IPSFactoryBuffer, (void **)&pPSFB);
731 else
732 hr = TMARSHAL_DllGetClassObject(&CLSID_PSOAInterface, &IID_IPSFactoryBuffer, (void **)&pPSFB);
734 if (FAILED(hr)) return hr;
736 hr = IPSFactoryBuffer_CreateProxy(pPSFB, pUnkOuter, riid, ppProxy, ppv);
738 IPSFactoryBuffer_Release(pPSFB);
739 return hr;
742 static HRESULT WINAPI PSDispatchFacBuf_CreateStub(IPSFactoryBuffer *iface, REFIID riid, IUnknown *pUnkOuter, IRpcStubBuffer **ppStub)
744 IPSFactoryBuffer *pPSFB;
745 HRESULT hr;
747 if (IsEqualIID(riid, &IID_IDispatch))
748 hr = OLEAUTPS_DllGetClassObject(&CLSID_PSDispatch, &IID_IPSFactoryBuffer, (void **)&pPSFB);
749 else
750 hr = TMARSHAL_DllGetClassObject(&CLSID_PSOAInterface, &IID_IPSFactoryBuffer, (void **)&pPSFB);
752 if (FAILED(hr)) return hr;
754 hr = IPSFactoryBuffer_CreateStub(pPSFB, riid, pUnkOuter, ppStub);
756 IPSFactoryBuffer_Release(pPSFB);
757 return hr;
760 static const IPSFactoryBufferVtbl PSDispatchFacBuf_Vtbl =
762 PSDispatchFacBuf_QueryInterface,
763 PSDispatchFacBuf_AddRef,
764 PSDispatchFacBuf_Release,
765 PSDispatchFacBuf_CreateProxy,
766 PSDispatchFacBuf_CreateStub
769 /* This is the whole PSFactoryBuffer object, just the vtableptr */
770 static const IPSFactoryBufferVtbl *pPSDispatchFacBuf = &PSDispatchFacBuf_Vtbl;
772 /***********************************************************************
773 * DllGetClassObject (OLEAUT32.@)
775 HRESULT WINAPI DllGetClassObject(REFCLSID rclsid, REFIID iid, LPVOID *ppv)
777 *ppv = NULL;
778 if (IsEqualGUID(rclsid,&CLSID_StdFont)) {
779 if (IsEqualGUID(iid,&IID_IClassFactory)) {
780 _get_STDFONT_CF(ppv);
781 IClassFactory_AddRef((IClassFactory*)*ppv);
782 return S_OK;
785 if (IsEqualGUID(rclsid,&CLSID_StdPicture)) {
786 if (IsEqualGUID(iid,&IID_IClassFactory)) {
787 _get_STDPIC_CF(ppv);
788 IClassFactory_AddRef((IClassFactory*)*ppv);
789 return S_OK;
792 if (IsEqualCLSID(rclsid, &CLSID_PSTypeInfo) ||
793 IsEqualCLSID(rclsid, &CLSID_PSTypeLib) ||
794 IsEqualCLSID(rclsid, &CLSID_PSEnumVariant)) {
795 return OLEAUTPS_DllGetClassObject(&CLSID_PSDispatch, iid, ppv);
797 if (IsEqualCLSID(rclsid, &CLSID_PSDispatch) && IsEqualIID(iid, &IID_IPSFactoryBuffer)) {
798 *ppv = &pPSDispatchFacBuf;
799 IPSFactoryBuffer_AddRef((IPSFactoryBuffer *)*ppv);
800 return S_OK;
802 if (IsEqualGUID(rclsid,&CLSID_PSOAInterface)) {
803 if (S_OK==TMARSHAL_DllGetClassObject(rclsid,iid,ppv))
804 return S_OK;
805 /*FALLTHROUGH*/
807 FIXME("\n\tCLSID:\t%s,\n\tIID:\t%s\n",debugstr_guid(rclsid),debugstr_guid(iid));
808 return CLASS_E_CLASSNOTAVAILABLE;
811 /***********************************************************************
812 * DllCanUnloadNow (OLEAUT32.@)
814 * Determine if this dll can be unloaded from the callers address space.
816 * PARAMS
817 * None.
819 * RETURNS
820 * Always returns S_FALSE. This dll cannot be unloaded.
822 HRESULT WINAPI DllCanUnloadNow(void)
824 return S_FALSE;
827 /*****************************************************************************
828 * DllMain [OLEAUT32.@]
830 BOOL WINAPI DllMain(HINSTANCE hInstDll, DWORD fdwReason, LPVOID lpvReserved)
832 TRACE("(%p,%ld,%p)\n", hInstDll, fdwReason, lpvReserved);
834 switch (fdwReason) {
835 case DLL_PROCESS_ATTACH:
836 DisableThreadLibraryCalls(hInstDll);
837 OLEAUT32_hModule = (HMODULE)hInstDll;
838 break;
839 case DLL_PROCESS_DETACH:
840 break;
843 return TRUE;