server: Clone file_get_sd() and file_set_fd() for directories.
[wine/multimedia.git] / dlls / oleaut32 / oleaut.c
blob4e636e32cf6541b52e848afecdadcebec8df5511
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>
23 #include <limits.h>
25 #define COBJMACROS
27 #include "windef.h"
28 #include "winbase.h"
29 #include "wingdi.h"
30 #include "winuser.h"
31 #include "winerror.h"
33 #include "ole2.h"
34 #include "olectl.h"
35 #include "oleauto.h"
36 #include "typelib.h"
38 #include "wine/debug.h"
40 WINE_DEFAULT_DEBUG_CHANNEL(ole);
42 static BOOL BSTR_bCache = TRUE; /* Cache allocations to minimise alloc calls? */
44 HMODULE OLEAUT32_hModule = NULL;
46 /******************************************************************************
47 * BSTR {OLEAUT32}
49 * NOTES
50 * BSTR is a simple typedef for a wide-character string used as the principle
51 * string type in ole automation. When encapsulated in a Variant type they are
52 * automatically copied and destroyed as the variant is processed.
54 * The low level BSTR Api allows manipulation of these strings and is used by
55 * higher level Api calls to manage the strings transparently to the caller.
57 * Internally the BSTR type is allocated with space for a DWORD byte count before
58 * the string data begins. This is undocumented and non-system code should not
59 * access the count directly. Use SysStringLen() or SysStringByteLen()
60 * instead. Note that the byte count does not include the terminating NUL.
62 * To create a new BSTR, use SysAllocString(), SysAllocStringLen() or
63 * SysAllocStringByteLen(). To change the size of an existing BSTR, use SysReAllocString()
64 * or SysReAllocStringLen(). Finally to destroy a string use SysFreeString().
66 * BSTR's are cached by Ole Automation by default. To override this behaviour
67 * either set the environment variable 'OANOCACHE', or call SetOaNoCache().
69 * SEE ALSO
70 * 'Inside OLE, second edition' by Kraig Brockshmidt.
73 /******************************************************************************
74 * SysStringLen [OLEAUT32.7]
76 * Get the allocated length of a BSTR in wide characters.
78 * PARAMS
79 * str [I] BSTR to find the length of
81 * RETURNS
82 * The allocated length of str, or 0 if str is NULL.
84 * NOTES
85 * See BSTR.
86 * The returned length may be different from the length of the string as
87 * calculated by lstrlenW(), since it returns the length that was used to
88 * allocate the string by SysAllocStringLen().
90 UINT WINAPI SysStringLen(BSTR str)
92 DWORD* bufferPointer;
94 if (!str) return 0;
96 * The length of the string (in bytes) is contained in a DWORD placed
97 * just before the BSTR pointer
99 bufferPointer = (DWORD*)str;
101 bufferPointer--;
103 return (int)(*bufferPointer/sizeof(WCHAR));
106 /******************************************************************************
107 * SysStringByteLen [OLEAUT32.149]
109 * Get the allocated length of a BSTR in bytes.
111 * PARAMS
112 * str [I] BSTR to find the length of
114 * RETURNS
115 * The allocated length of str, or 0 if str is NULL.
117 * NOTES
118 * See SysStringLen(), BSTR().
120 UINT WINAPI SysStringByteLen(BSTR str)
122 DWORD* bufferPointer;
124 if (!str) return 0;
126 * The length of the string (in bytes) is contained in a DWORD placed
127 * just before the BSTR pointer
129 bufferPointer = (DWORD*)str;
131 bufferPointer--;
133 return (int)(*bufferPointer);
136 /******************************************************************************
137 * SysAllocString [OLEAUT32.2]
139 * Create a BSTR from an OLESTR.
141 * PARAMS
142 * str [I] Source to create BSTR from
144 * RETURNS
145 * Success: A BSTR allocated with SysAllocStringLen().
146 * Failure: NULL, if oleStr is NULL.
148 * NOTES
149 * See BSTR.
150 * MSDN (October 2001) incorrectly states that NULL is returned if oleStr has
151 * a length of 0. Native Win32 and this implementation both return a valid
152 * empty BSTR in this case.
154 BSTR WINAPI SysAllocString(LPCOLESTR str)
156 if (!str) return 0;
158 /* Delegate this to the SysAllocStringLen32 method. */
159 return SysAllocStringLen(str, lstrlenW(str));
162 /******************************************************************************
163 * SysFreeString [OLEAUT32.6]
165 * Free a BSTR.
167 * PARAMS
168 * str [I] BSTR to free.
170 * RETURNS
171 * Nothing.
173 * NOTES
174 * See BSTR.
175 * str may be NULL, in which case this function does nothing.
177 void WINAPI SysFreeString(BSTR str)
179 DWORD* bufferPointer;
181 /* NULL is a valid parameter */
182 if(!str) return;
185 * We have to be careful when we free a BSTR pointer, it points to
186 * the beginning of the string but it skips the byte count contained
187 * before the string.
189 bufferPointer = (DWORD*)str;
191 bufferPointer--;
194 * Free the memory from its "real" origin.
196 HeapFree(GetProcessHeap(), 0, bufferPointer);
199 /******************************************************************************
200 * SysAllocStringLen [OLEAUT32.4]
202 * Create a BSTR from an OLESTR of a given wide character length.
204 * PARAMS
205 * str [I] Source to create BSTR from
206 * len [I] Length of oleStr in wide characters
208 * RETURNS
209 * Success: A newly allocated BSTR from SysAllocStringByteLen()
210 * Failure: NULL, if len is >= 0x80000000, or memory allocation fails.
212 * NOTES
213 * See BSTR(), SysAllocStringByteLen().
215 BSTR WINAPI SysAllocStringLen(const OLECHAR *str, unsigned int len)
217 DWORD bufferSize;
218 DWORD* newBuffer;
219 WCHAR* stringBuffer;
221 /* Detect integer overflow. */
222 if (len >= ((UINT_MAX-sizeof(WCHAR)-sizeof(DWORD))/sizeof(WCHAR)))
223 return NULL;
225 * Find the length of the buffer passed-in, in bytes.
227 bufferSize = len * sizeof (WCHAR);
230 * Allocate a new buffer to hold the string.
231 * don't forget to keep an empty spot at the beginning of the
232 * buffer for the character count and an extra character at the
233 * end for the NULL.
235 newBuffer = HeapAlloc(GetProcessHeap(), 0,
236 bufferSize + sizeof(WCHAR) + sizeof(DWORD));
239 * If the memory allocation failed, return a null pointer.
241 if (!newBuffer)
242 return NULL;
245 * Copy the length of the string in the placeholder.
247 *newBuffer = bufferSize;
250 * Skip the byte count.
252 newBuffer++;
255 * Copy the information in the buffer.
256 * Since it is valid to pass a NULL pointer here, we'll initialize the
257 * buffer to nul if it is the case.
259 if (str != 0)
260 memcpy(newBuffer, str, bufferSize);
261 else
262 memset(newBuffer, 0, bufferSize);
265 * Make sure that there is a nul character at the end of the
266 * string.
268 stringBuffer = (WCHAR*)newBuffer;
269 stringBuffer[len] = '\0';
271 return (LPWSTR)stringBuffer;
274 /******************************************************************************
275 * SysReAllocStringLen [OLEAUT32.5]
277 * Change the length of a previously created BSTR.
279 * PARAMS
280 * old [O] BSTR to change the length of
281 * str [I] New source for pbstr
282 * len [I] Length of oleStr in wide characters
284 * RETURNS
285 * Success: 1. The size of pbstr is updated.
286 * Failure: 0, if len >= 0x80000000 or memory allocation fails.
288 * NOTES
289 * See BSTR(), SysAllocStringByteLen().
290 * *old may be changed by this function.
292 int WINAPI SysReAllocStringLen(BSTR* old, const OLECHAR* str, unsigned int len)
294 /* Detect integer overflow. */
295 if (len >= ((UINT_MAX-sizeof(WCHAR)-sizeof(DWORD))/sizeof(WCHAR)))
296 return 0;
298 if (*old!=NULL) {
299 DWORD newbytelen = len*sizeof(WCHAR);
300 DWORD *ptr = HeapReAlloc(GetProcessHeap(),0,((DWORD*)*old)-1,newbytelen+sizeof(WCHAR)+sizeof(DWORD));
301 *old = (BSTR)(ptr+1);
302 *ptr = newbytelen;
303 if (str) {
304 memmove(*old, str, newbytelen);
305 (*old)[len] = 0;
306 } else {
307 /* Subtle hidden feature: The old string data is still there
308 * when 'in' is NULL!
309 * Some Microsoft program needs it.
312 } else {
314 * Allocate the new string
316 *old = SysAllocStringLen(str, len);
319 return 1;
322 /******************************************************************************
323 * SysAllocStringByteLen [OLEAUT32.150]
325 * Create a BSTR from an OLESTR of a given byte length.
327 * PARAMS
328 * str [I] Source to create BSTR from
329 * len [I] Length of oleStr in bytes
331 * RETURNS
332 * Success: A newly allocated BSTR
333 * Failure: NULL, if len is >= 0x80000000, or memory allocation fails.
335 * NOTES
336 * -If len is 0 or oleStr is NULL the resulting string is empty ("").
337 * -This function always NUL terminates the resulting BSTR.
338 * -oleStr may be either an LPCSTR or LPCOLESTR, since it is copied
339 * without checking for a terminating NUL.
340 * See BSTR.
342 BSTR WINAPI SysAllocStringByteLen(LPCSTR str, UINT len)
344 DWORD* newBuffer;
345 char* stringBuffer;
347 /* Detect integer overflow. */
348 if (len >= (UINT_MAX-sizeof(WCHAR)-sizeof(DWORD)))
349 return NULL;
352 * Allocate a new buffer to hold the string.
353 * don't forget to keep an empty spot at the beginning of the
354 * buffer for the character count and an extra character at the
355 * end for the NULL.
357 newBuffer = HeapAlloc(GetProcessHeap(), 0,
358 len + sizeof(WCHAR) + sizeof(DWORD));
361 * If the memory allocation failed, return a null pointer.
363 if (newBuffer==0)
364 return 0;
367 * Copy the length of the string in the placeholder.
369 *newBuffer = len;
372 * Skip the byte count.
374 newBuffer++;
377 * Copy the information in the buffer.
378 * Since it is valid to pass a NULL pointer here, we'll initialize the
379 * buffer to nul if it is the case.
381 if (str != 0)
382 memcpy(newBuffer, str, len);
385 * Make sure that there is a nul character at the end of the
386 * string.
388 stringBuffer = (char *)newBuffer;
389 stringBuffer[len] = 0;
390 stringBuffer[len+1] = 0;
392 return (LPWSTR)stringBuffer;
395 /******************************************************************************
396 * SysReAllocString [OLEAUT32.3]
398 * Change the length of a previously created BSTR.
400 * PARAMS
401 * old [I/O] BSTR to change the length of
402 * str [I] New source for pbstr
404 * RETURNS
405 * Success: 1
406 * Failure: 0.
408 * NOTES
409 * See BSTR(), SysAllocStringStringLen().
411 INT WINAPI SysReAllocString(LPBSTR old,LPCOLESTR str)
414 * Sanity check
416 if (old==NULL)
417 return 0;
420 * Make sure we free the old string.
422 SysFreeString(*old);
425 * Allocate the new string
427 *old = SysAllocString(str);
429 return 1;
432 /******************************************************************************
433 * SetOaNoCache (OLEAUT32.327)
435 * Instruct Ole Automation not to cache BSTR allocations.
437 * PARAMS
438 * None.
440 * RETURNS
441 * Nothing.
443 * NOTES
444 * See BSTR.
446 void WINAPI SetOaNoCache(void)
448 BSTR_bCache = FALSE;
451 static const WCHAR _delimiter[2] = {'!',0}; /* default delimiter apparently */
452 static const WCHAR *pdelimiter = &_delimiter[0];
454 /***********************************************************************
455 * RegisterActiveObject (OLEAUT32.33)
457 * Registers an object in the global item table.
459 * PARAMS
460 * punk [I] Object to register.
461 * rcid [I] CLSID of the object.
462 * dwFlags [I] Flags.
463 * pdwRegister [O] Address to store cookie of object registration in.
465 * RETURNS
466 * Success: S_OK.
467 * Failure: HRESULT code.
469 HRESULT WINAPI RegisterActiveObject(
470 LPUNKNOWN punk,REFCLSID rcid,DWORD dwFlags,LPDWORD pdwRegister
472 WCHAR guidbuf[80];
473 HRESULT ret;
474 LPRUNNINGOBJECTTABLE runobtable;
475 LPMONIKER moniker;
477 StringFromGUID2(rcid,guidbuf,39);
478 ret = CreateItemMoniker(pdelimiter,guidbuf,&moniker);
479 if (FAILED(ret))
480 return ret;
481 ret = GetRunningObjectTable(0,&runobtable);
482 if (FAILED(ret)) {
483 IMoniker_Release(moniker);
484 return ret;
486 ret = IRunningObjectTable_Register(runobtable,dwFlags,punk,moniker,pdwRegister);
487 IRunningObjectTable_Release(runobtable);
488 IMoniker_Release(moniker);
489 return ret;
492 /***********************************************************************
493 * RevokeActiveObject (OLEAUT32.34)
495 * Revokes an object from the global item table.
497 * PARAMS
498 * xregister [I] Registration cookie.
499 * reserved [I] Reserved. Set to NULL.
501 * RETURNS
502 * Success: S_OK.
503 * Failure: HRESULT code.
505 HRESULT WINAPI RevokeActiveObject(DWORD xregister,LPVOID reserved)
507 LPRUNNINGOBJECTTABLE runobtable;
508 HRESULT ret;
510 ret = GetRunningObjectTable(0,&runobtable);
511 if (FAILED(ret)) return ret;
512 ret = IRunningObjectTable_Revoke(runobtable,xregister);
513 if (SUCCEEDED(ret)) ret = S_OK;
514 IRunningObjectTable_Release(runobtable);
515 return ret;
518 /***********************************************************************
519 * GetActiveObject (OLEAUT32.35)
521 * Gets an object from the global item table.
523 * PARAMS
524 * rcid [I] CLSID of the object.
525 * preserved [I] Reserved. Set to NULL.
526 * ppunk [O] Address to store object into.
528 * RETURNS
529 * Success: S_OK.
530 * Failure: HRESULT code.
532 HRESULT WINAPI GetActiveObject(REFCLSID rcid,LPVOID preserved,LPUNKNOWN *ppunk)
534 WCHAR guidbuf[80];
535 HRESULT ret;
536 LPRUNNINGOBJECTTABLE runobtable;
537 LPMONIKER moniker;
539 StringFromGUID2(rcid,guidbuf,39);
540 ret = CreateItemMoniker(pdelimiter,guidbuf,&moniker);
541 if (FAILED(ret))
542 return ret;
543 ret = GetRunningObjectTable(0,&runobtable);
544 if (FAILED(ret)) {
545 IMoniker_Release(moniker);
546 return ret;
548 ret = IRunningObjectTable_GetObject(runobtable,moniker,ppunk);
549 IRunningObjectTable_Release(runobtable);
550 IMoniker_Release(moniker);
551 return ret;
555 /***********************************************************************
556 * OaBuildVersion [OLEAUT32.170]
558 * Get the Ole Automation build version.
560 * PARAMS
561 * None
563 * RETURNS
564 * The build version.
566 * NOTES
567 * Known oleaut32.dll versions:
568 *| OLE Ver. Comments Date Build Ver.
569 *| -------- ------------------------- ---- ---------
570 *| OLE 2.1 NT 1993-95 10 3023
571 *| OLE 2.1 10 3027
572 *| Win32s Ver 1.1e 20 4049
573 *| OLE 2.20 W95/NT 1993-96 20 4112
574 *| OLE 2.20 W95/NT 1993-96 20 4118
575 *| OLE 2.20 W95/NT 1993-96 20 4122
576 *| OLE 2.30 W95/NT 1993-98 30 4265
577 *| OLE 2.40 NT?? 1993-98 40 4267
578 *| OLE 2.40 W98 SE orig. file 1993-98 40 4275
579 *| OLE 2.40 W2K orig. file 1993-XX 40 4514
581 * Currently the versions returned are 2.20 for Win3.1, 2.30 for Win95 & NT 3.51,
582 * and 2.40 for all later versions. The build number is maximum, i.e. 0xffff.
584 ULONG WINAPI OaBuildVersion(void)
586 switch(GetVersion() & 0x8000ffff) /* mask off build number */
588 case 0x80000a03: /* WIN31 */
589 return MAKELONG(0xffff, 20);
590 case 0x00003303: /* NT351 */
591 return MAKELONG(0xffff, 30);
592 case 0x80000004: /* WIN95; I'd like to use the "standard" w95 minor
593 version here (30), but as we still use w95
594 as default winver (which is good IMHO), I better
595 play safe and use the latest value for w95 for now.
596 Change this as soon as default winver gets changed
597 to something more recent */
598 case 0x80000a04: /* WIN98 */
599 case 0x00000004: /* NT40 */
600 case 0x00000005: /* W2K */
601 case 0x00000105: /* WinXP */
602 return MAKELONG(0xffff, 40);
603 default:
604 FIXME("Version value not known yet. Please investigate it !\n");
605 return MAKELONG(0xffff, 40); /* for now return the same value as for w2k */
609 /******************************************************************************
610 * OleTranslateColor [OLEAUT32.421]
612 * Convert an OLE_COLOR to a COLORREF.
614 * PARAMS
615 * clr [I] Color to convert
616 * hpal [I] Handle to a palette for the conversion
617 * pColorRef [O] Destination for converted color, or NULL to test if the conversion is ok
619 * RETURNS
620 * Success: S_OK. The conversion is ok, and pColorRef contains the converted color if non-NULL.
621 * Failure: E_INVALIDARG, if any argument is invalid.
623 * FIXME
624 * Document the conversion rules.
626 HRESULT WINAPI OleTranslateColor(
627 OLE_COLOR clr,
628 HPALETTE hpal,
629 COLORREF* pColorRef)
631 COLORREF colorref;
632 BYTE b = HIBYTE(HIWORD(clr));
634 TRACE("(%08x, %p, %p)\n", clr, hpal, pColorRef);
637 * In case pColorRef is NULL, provide our own to simplify the code.
639 if (pColorRef == NULL)
640 pColorRef = &colorref;
642 switch (b)
644 case 0x00:
646 if (hpal != 0)
647 *pColorRef = PALETTERGB(GetRValue(clr),
648 GetGValue(clr),
649 GetBValue(clr));
650 else
651 *pColorRef = clr;
653 break;
656 case 0x01:
658 if (hpal != 0)
660 PALETTEENTRY pe;
662 * Validate the palette index.
664 if (GetPaletteEntries(hpal, LOWORD(clr), 1, &pe) == 0)
665 return E_INVALIDARG;
668 *pColorRef = clr;
670 break;
673 case 0x02:
674 *pColorRef = clr;
675 break;
677 case 0x80:
679 int index = LOBYTE(LOWORD(clr));
682 * Validate GetSysColor index.
684 if ((index < COLOR_SCROLLBAR) || (index > COLOR_MENUBAR))
685 return E_INVALIDARG;
687 *pColorRef = GetSysColor(index);
689 break;
692 default:
693 return E_INVALIDARG;
696 return S_OK;
699 extern HRESULT OLEAUTPS_DllGetClassObject(REFCLSID rclsid, REFIID riid, LPVOID *ppv);
701 extern void _get_STDFONT_CF(LPVOID *);
702 extern void _get_STDPIC_CF(LPVOID *);
704 static HRESULT WINAPI PSDispatchFacBuf_QueryInterface(IPSFactoryBuffer *iface, REFIID riid, void **ppv)
706 if (IsEqualIID(riid, &IID_IUnknown) ||
707 IsEqualIID(riid, &IID_IPSFactoryBuffer))
709 IUnknown_AddRef(iface);
710 *ppv = (void *)iface;
711 return S_OK;
713 return E_NOINTERFACE;
716 static ULONG WINAPI PSDispatchFacBuf_AddRef(IPSFactoryBuffer *iface)
718 return 2;
721 static ULONG WINAPI PSDispatchFacBuf_Release(IPSFactoryBuffer *iface)
723 return 1;
726 static HRESULT WINAPI PSDispatchFacBuf_CreateProxy(IPSFactoryBuffer *iface, IUnknown *pUnkOuter, REFIID riid, IRpcProxyBuffer **ppProxy, void **ppv)
728 IPSFactoryBuffer *pPSFB;
729 HRESULT hr;
731 if (IsEqualIID(riid, &IID_IDispatch))
732 hr = OLEAUTPS_DllGetClassObject(&CLSID_PSDispatch, &IID_IPSFactoryBuffer, (void **)&pPSFB);
733 else
734 hr = TMARSHAL_DllGetClassObject(&CLSID_PSOAInterface, &IID_IPSFactoryBuffer, (void **)&pPSFB);
736 if (FAILED(hr)) return hr;
738 hr = IPSFactoryBuffer_CreateProxy(pPSFB, pUnkOuter, riid, ppProxy, ppv);
740 IPSFactoryBuffer_Release(pPSFB);
741 return hr;
744 static HRESULT WINAPI PSDispatchFacBuf_CreateStub(IPSFactoryBuffer *iface, REFIID riid, IUnknown *pUnkOuter, IRpcStubBuffer **ppStub)
746 IPSFactoryBuffer *pPSFB;
747 HRESULT hr;
749 if (IsEqualIID(riid, &IID_IDispatch))
750 hr = OLEAUTPS_DllGetClassObject(&CLSID_PSDispatch, &IID_IPSFactoryBuffer, (void **)&pPSFB);
751 else
752 hr = TMARSHAL_DllGetClassObject(&CLSID_PSOAInterface, &IID_IPSFactoryBuffer, (void **)&pPSFB);
754 if (FAILED(hr)) return hr;
756 hr = IPSFactoryBuffer_CreateStub(pPSFB, riid, pUnkOuter, ppStub);
758 IPSFactoryBuffer_Release(pPSFB);
759 return hr;
762 static const IPSFactoryBufferVtbl PSDispatchFacBuf_Vtbl =
764 PSDispatchFacBuf_QueryInterface,
765 PSDispatchFacBuf_AddRef,
766 PSDispatchFacBuf_Release,
767 PSDispatchFacBuf_CreateProxy,
768 PSDispatchFacBuf_CreateStub
771 /* This is the whole PSFactoryBuffer object, just the vtableptr */
772 static const IPSFactoryBufferVtbl *pPSDispatchFacBuf = &PSDispatchFacBuf_Vtbl;
774 /***********************************************************************
775 * DllGetClassObject (OLEAUT32.@)
777 HRESULT WINAPI DllGetClassObject(REFCLSID rclsid, REFIID iid, LPVOID *ppv)
779 *ppv = NULL;
780 if (IsEqualGUID(rclsid,&CLSID_StdFont)) {
781 if (IsEqualGUID(iid,&IID_IClassFactory)) {
782 _get_STDFONT_CF(ppv);
783 IClassFactory_AddRef((IClassFactory*)*ppv);
784 return S_OK;
787 if (IsEqualGUID(rclsid,&CLSID_StdPicture)) {
788 if (IsEqualGUID(iid,&IID_IClassFactory)) {
789 _get_STDPIC_CF(ppv);
790 IClassFactory_AddRef((IClassFactory*)*ppv);
791 return S_OK;
794 if (IsEqualCLSID(rclsid, &CLSID_PSTypeInfo) ||
795 IsEqualCLSID(rclsid, &CLSID_PSTypeLib) ||
796 IsEqualCLSID(rclsid, &CLSID_PSEnumVariant)) {
797 return OLEAUTPS_DllGetClassObject(&CLSID_PSDispatch, iid, ppv);
799 if (IsEqualCLSID(rclsid, &CLSID_PSDispatch) && IsEqualIID(iid, &IID_IPSFactoryBuffer)) {
800 *ppv = &pPSDispatchFacBuf;
801 IPSFactoryBuffer_AddRef((IPSFactoryBuffer *)*ppv);
802 return S_OK;
804 if (IsEqualGUID(rclsid,&CLSID_PSOAInterface)) {
805 if (S_OK==TMARSHAL_DllGetClassObject(rclsid,iid,ppv))
806 return S_OK;
807 /*FALLTHROUGH*/
809 return OLEAUTPS_DllGetClassObject(rclsid, iid, ppv);
812 /***********************************************************************
813 * DllCanUnloadNow (OLEAUT32.@)
815 * Determine if this dll can be unloaded from the callers address space.
817 * PARAMS
818 * None.
820 * RETURNS
821 * Always returns S_FALSE. This dll cannot be unloaded.
823 HRESULT WINAPI DllCanUnloadNow(void)
825 return S_FALSE;
828 /*****************************************************************************
829 * DllMain [OLEAUT32.@]
831 BOOL WINAPI DllMain(HINSTANCE hInstDll, DWORD fdwReason, LPVOID lpvReserved)
833 TRACE("(%p,%d,%p)\n", hInstDll, fdwReason, lpvReserved);
835 switch (fdwReason) {
836 case DLL_PROCESS_ATTACH:
837 DisableThreadLibraryCalls(hInstDll);
838 OLEAUT32_hModule = hInstDll;
839 break;
840 case DLL_PROCESS_DETACH:
841 break;
844 return TRUE;
847 /***********************************************************************
848 * OleIconToCursor (OLEAUT32.415)
850 HCURSOR WINAPI OleIconToCursor( HINSTANCE hinstExe, HICON hIcon)
852 FIXME("(%p,%p), partially implemented.\n",hinstExe,hIcon);
853 /* FIXME: make a extended conversation from HICON to HCURSOR */
854 return CopyCursor(hIcon);