shdocvw: Add German translation.
[wine/multimedia.git] / dlls / oleaut32 / oleaut.c
blob89e1ab9dc2c6f255d67e71d389ae41bc2943982c
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 /******************************************************************************
45 * BSTR {OLEAUT32}
47 * NOTES
48 * BSTR is a simple typedef for a wide-character string used as the principle
49 * string type in ole automation. When encapsulated in a Variant type they are
50 * automatically copied and destroyed as the variant is processed.
52 * The low level BSTR Api allows manipulation of these strings and is used by
53 * higher level Api calls to manage the strings transparently to the caller.
55 * Internally the BSTR type is allocated with space for a DWORD byte count before
56 * the string data begins. This is undocumented and non-system code should not
57 * access the count directly. Use SysStringLen() or SysStringByteLen()
58 * instead. Note that the byte count does not include the terminating NUL.
60 * To create a new BSTR, use SysAllocString(), SysAllocStringLen() or
61 * SysAllocStringByteLen(). To change the size of an existing BSTR, use SysReAllocString()
62 * or SysReAllocStringLen(). Finally to destroy a string use SysFreeString().
64 * BSTR's are cached by Ole Automation by default. To override this behaviour
65 * either set the environment variable 'OANOCACHE', or call SetOaNoCache().
67 * SEE ALSO
68 * 'Inside OLE, second edition' by Kraig Brockshmidt.
71 /******************************************************************************
72 * SysStringLen [OLEAUT32.7]
74 * Get the allocated length of a BSTR in wide characters.
76 * PARAMS
77 * str [I] BSTR to find the length of
79 * RETURNS
80 * The allocated length of str, or 0 if str is NULL.
82 * NOTES
83 * See BSTR.
84 * The returned length may be different from the length of the string as
85 * calculated by lstrlenW(), since it returns the length that was used to
86 * allocate the string by SysAllocStringLen().
88 UINT WINAPI SysStringLen(BSTR str)
90 DWORD* bufferPointer;
92 if (!str) return 0;
94 * The length of the string (in bytes) is contained in a DWORD placed
95 * just before the BSTR pointer
97 bufferPointer = (DWORD*)str;
99 bufferPointer--;
101 return (int)(*bufferPointer/sizeof(WCHAR));
104 /******************************************************************************
105 * SysStringByteLen [OLEAUT32.149]
107 * Get the allocated length of a BSTR in bytes.
109 * PARAMS
110 * str [I] BSTR to find the length of
112 * RETURNS
113 * The allocated length of str, or 0 if str is NULL.
115 * NOTES
116 * See SysStringLen(), BSTR().
118 UINT WINAPI SysStringByteLen(BSTR str)
120 DWORD* bufferPointer;
122 if (!str) return 0;
124 * The length of the string (in bytes) is contained in a DWORD placed
125 * just before the BSTR pointer
127 bufferPointer = (DWORD*)str;
129 bufferPointer--;
131 return (int)(*bufferPointer);
134 /******************************************************************************
135 * SysAllocString [OLEAUT32.2]
137 * Create a BSTR from an OLESTR.
139 * PARAMS
140 * str [I] Source to create BSTR from
142 * RETURNS
143 * Success: A BSTR allocated with SysAllocStringLen().
144 * Failure: NULL, if oleStr is NULL.
146 * NOTES
147 * See BSTR.
148 * MSDN (October 2001) incorrectly states that NULL is returned if oleStr has
149 * a length of 0. Native Win32 and this implementation both return a valid
150 * empty BSTR in this case.
152 BSTR WINAPI SysAllocString(LPCOLESTR str)
154 if (!str) return 0;
156 /* Delegate this to the SysAllocStringLen32 method. */
157 return SysAllocStringLen(str, lstrlenW(str));
160 /******************************************************************************
161 * SysFreeString [OLEAUT32.6]
163 * Free a BSTR.
165 * PARAMS
166 * str [I] BSTR to free.
168 * RETURNS
169 * Nothing.
171 * NOTES
172 * See BSTR.
173 * str may be NULL, in which case this function does nothing.
175 void WINAPI SysFreeString(BSTR str)
177 DWORD* bufferPointer;
179 /* NULL is a valid parameter */
180 if(!str) return;
183 * We have to be careful when we free a BSTR pointer, it points to
184 * the beginning of the string but it skips the byte count contained
185 * before the string.
187 bufferPointer = (DWORD*)str;
189 bufferPointer--;
192 * Free the memory from its "real" origin.
194 HeapFree(GetProcessHeap(), 0, bufferPointer);
197 /******************************************************************************
198 * SysAllocStringLen [OLEAUT32.4]
200 * Create a BSTR from an OLESTR of a given wide character length.
202 * PARAMS
203 * str [I] Source to create BSTR from
204 * len [I] Length of oleStr in wide characters
206 * RETURNS
207 * Success: A newly allocated BSTR from SysAllocStringByteLen()
208 * Failure: NULL, if len is >= 0x80000000, or memory allocation fails.
210 * NOTES
211 * See BSTR(), SysAllocStringByteLen().
213 BSTR WINAPI SysAllocStringLen(const OLECHAR *str, unsigned int len)
215 DWORD bufferSize;
216 DWORD* newBuffer;
217 WCHAR* stringBuffer;
219 /* Detect integer overflow. */
220 if (len >= ((UINT_MAX-sizeof(WCHAR)-sizeof(DWORD))/sizeof(WCHAR)))
221 return NULL;
223 * Find the length of the buffer passed-in, in bytes.
225 bufferSize = len * sizeof (WCHAR);
228 * Allocate a new buffer to hold the string.
229 * don't forget to keep an empty spot at the beginning of the
230 * buffer for the character count and an extra character at the
231 * end for the NULL.
233 newBuffer = HeapAlloc(GetProcessHeap(), 0,
234 bufferSize + sizeof(WCHAR) + sizeof(DWORD));
237 * If the memory allocation failed, return a null pointer.
239 if (!newBuffer)
240 return NULL;
243 * Copy the length of the string in the placeholder.
245 *newBuffer = bufferSize;
248 * Skip the byte count.
250 newBuffer++;
253 * Copy the information in the buffer.
254 * Since it is valid to pass a NULL pointer here, we'll initialize the
255 * buffer to nul if it is the case.
257 if (str != 0)
258 memcpy(newBuffer, str, bufferSize);
259 else
260 memset(newBuffer, 0, bufferSize);
263 * Make sure that there is a nul character at the end of the
264 * string.
266 stringBuffer = (WCHAR*)newBuffer;
267 stringBuffer[len] = '\0';
269 return stringBuffer;
272 /******************************************************************************
273 * SysReAllocStringLen [OLEAUT32.5]
275 * Change the length of a previously created BSTR.
277 * PARAMS
278 * old [O] BSTR to change the length of
279 * str [I] New source for pbstr
280 * len [I] Length of oleStr in wide characters
282 * RETURNS
283 * Success: 1. The size of pbstr is updated.
284 * Failure: 0, if len >= 0x80000000 or memory allocation fails.
286 * NOTES
287 * See BSTR(), SysAllocStringByteLen().
288 * *old may be changed by this function.
290 int WINAPI SysReAllocStringLen(BSTR* old, const OLECHAR* str, unsigned int len)
292 /* Detect integer overflow. */
293 if (len >= ((UINT_MAX-sizeof(WCHAR)-sizeof(DWORD))/sizeof(WCHAR)))
294 return 0;
296 if (*old!=NULL) {
297 BSTR old_copy = *old;
298 DWORD newbytelen = len*sizeof(WCHAR);
299 DWORD *ptr = HeapReAlloc(GetProcessHeap(),0,((DWORD*)*old)-1,newbytelen+sizeof(WCHAR)+sizeof(DWORD));
300 *old = (BSTR)(ptr+1);
301 *ptr = newbytelen;
302 /* Subtle hidden feature: The old string data is still there
303 * when 'in' is NULL!
304 * Some Microsoft program needs it.
306 if (str && old_copy!=str) memmove(*old, str, newbytelen);
307 (*old)[len] = 0;
308 } else {
310 * Allocate the new string
312 *old = SysAllocStringLen(str, len);
315 return 1;
318 /******************************************************************************
319 * SysAllocStringByteLen [OLEAUT32.150]
321 * Create a BSTR from an OLESTR of a given byte length.
323 * PARAMS
324 * str [I] Source to create BSTR from
325 * len [I] Length of oleStr in bytes
327 * RETURNS
328 * Success: A newly allocated BSTR
329 * Failure: NULL, if len is >= 0x80000000, or memory allocation fails.
331 * NOTES
332 * -If len is 0 or oleStr is NULL the resulting string is empty ("").
333 * -This function always NUL terminates the resulting BSTR.
334 * -oleStr may be either an LPCSTR or LPCOLESTR, since it is copied
335 * without checking for a terminating NUL.
336 * See BSTR.
338 BSTR WINAPI SysAllocStringByteLen(LPCSTR str, UINT len)
340 DWORD* newBuffer;
341 char* stringBuffer;
343 /* Detect integer overflow. */
344 if (len >= (UINT_MAX-sizeof(WCHAR)-sizeof(DWORD)))
345 return NULL;
348 * Allocate a new buffer to hold the string.
349 * don't forget to keep an empty spot at the beginning of the
350 * buffer for the character count and an extra character at the
351 * end for the NULL.
353 newBuffer = HeapAlloc(GetProcessHeap(), 0,
354 len + sizeof(WCHAR) + sizeof(DWORD));
357 * If the memory allocation failed, return a null pointer.
359 if (newBuffer==0)
360 return 0;
363 * Copy the length of the string in the placeholder.
365 *newBuffer = len;
368 * Skip the byte count.
370 newBuffer++;
373 * Copy the information in the buffer.
374 * Since it is valid to pass a NULL pointer here, we'll initialize the
375 * buffer to nul if it is the case.
377 if (str != 0)
378 memcpy(newBuffer, str, len);
381 * Make sure that there is a nul character at the end of the
382 * string.
384 stringBuffer = (char *)newBuffer;
385 stringBuffer[len] = 0;
386 stringBuffer[len+1] = 0;
388 return (LPWSTR)stringBuffer;
391 /******************************************************************************
392 * SysReAllocString [OLEAUT32.3]
394 * Change the length of a previously created BSTR.
396 * PARAMS
397 * old [I/O] BSTR to change the length of
398 * str [I] New source for pbstr
400 * RETURNS
401 * Success: 1
402 * Failure: 0.
404 * NOTES
405 * See BSTR(), SysAllocStringStringLen().
407 INT WINAPI SysReAllocString(LPBSTR old,LPCOLESTR str)
410 * Sanity check
412 if (old==NULL)
413 return 0;
416 * Make sure we free the old string.
418 SysFreeString(*old);
421 * Allocate the new string
423 *old = SysAllocString(str);
425 return 1;
428 /******************************************************************************
429 * SetOaNoCache (OLEAUT32.327)
431 * Instruct Ole Automation not to cache BSTR allocations.
433 * PARAMS
434 * None.
436 * RETURNS
437 * Nothing.
439 * NOTES
440 * See BSTR.
442 void WINAPI SetOaNoCache(void)
444 BSTR_bCache = FALSE;
447 static const WCHAR _delimiter[2] = {'!',0}; /* default delimiter apparently */
448 static const WCHAR *pdelimiter = &_delimiter[0];
450 /***********************************************************************
451 * RegisterActiveObject (OLEAUT32.33)
453 * Registers an object in the global item table.
455 * PARAMS
456 * punk [I] Object to register.
457 * rcid [I] CLSID of the object.
458 * dwFlags [I] Flags.
459 * pdwRegister [O] Address to store cookie of object registration in.
461 * RETURNS
462 * Success: S_OK.
463 * Failure: HRESULT code.
465 HRESULT WINAPI RegisterActiveObject(
466 LPUNKNOWN punk,REFCLSID rcid,DWORD dwFlags,LPDWORD pdwRegister
468 WCHAR guidbuf[80];
469 HRESULT ret;
470 LPRUNNINGOBJECTTABLE runobtable;
471 LPMONIKER moniker;
473 StringFromGUID2(rcid,guidbuf,39);
474 ret = CreateItemMoniker(pdelimiter,guidbuf,&moniker);
475 if (FAILED(ret))
476 return ret;
477 ret = GetRunningObjectTable(0,&runobtable);
478 if (FAILED(ret)) {
479 IMoniker_Release(moniker);
480 return ret;
482 ret = IRunningObjectTable_Register(runobtable,dwFlags,punk,moniker,pdwRegister);
483 IRunningObjectTable_Release(runobtable);
484 IMoniker_Release(moniker);
485 return ret;
488 /***********************************************************************
489 * RevokeActiveObject (OLEAUT32.34)
491 * Revokes an object from the global item table.
493 * PARAMS
494 * xregister [I] Registration cookie.
495 * reserved [I] Reserved. Set to NULL.
497 * RETURNS
498 * Success: S_OK.
499 * Failure: HRESULT code.
501 HRESULT WINAPI RevokeActiveObject(DWORD xregister,LPVOID reserved)
503 LPRUNNINGOBJECTTABLE runobtable;
504 HRESULT ret;
506 ret = GetRunningObjectTable(0,&runobtable);
507 if (FAILED(ret)) return ret;
508 ret = IRunningObjectTable_Revoke(runobtable,xregister);
509 if (SUCCEEDED(ret)) ret = S_OK;
510 IRunningObjectTable_Release(runobtable);
511 return ret;
514 /***********************************************************************
515 * GetActiveObject (OLEAUT32.35)
517 * Gets an object from the global item table.
519 * PARAMS
520 * rcid [I] CLSID of the object.
521 * preserved [I] Reserved. Set to NULL.
522 * ppunk [O] Address to store object into.
524 * RETURNS
525 * Success: S_OK.
526 * Failure: HRESULT code.
528 HRESULT WINAPI GetActiveObject(REFCLSID rcid,LPVOID preserved,LPUNKNOWN *ppunk)
530 WCHAR guidbuf[80];
531 HRESULT ret;
532 LPRUNNINGOBJECTTABLE runobtable;
533 LPMONIKER moniker;
535 StringFromGUID2(rcid,guidbuf,39);
536 ret = CreateItemMoniker(pdelimiter,guidbuf,&moniker);
537 if (FAILED(ret))
538 return ret;
539 ret = GetRunningObjectTable(0,&runobtable);
540 if (FAILED(ret)) {
541 IMoniker_Release(moniker);
542 return ret;
544 ret = IRunningObjectTable_GetObject(runobtable,moniker,ppunk);
545 IRunningObjectTable_Release(runobtable);
546 IMoniker_Release(moniker);
547 return ret;
551 /***********************************************************************
552 * OaBuildVersion [OLEAUT32.170]
554 * Get the Ole Automation build version.
556 * PARAMS
557 * None
559 * RETURNS
560 * The build version.
562 * NOTES
563 * Known oleaut32.dll versions:
564 *| OLE Ver. Comments Date Build Ver.
565 *| -------- ------------------------- ---- ---------
566 *| OLE 2.1 NT 1993-95 10 3023
567 *| OLE 2.1 10 3027
568 *| Win32s Ver 1.1e 20 4049
569 *| OLE 2.20 W95/NT 1993-96 20 4112
570 *| OLE 2.20 W95/NT 1993-96 20 4118
571 *| OLE 2.20 W95/NT 1993-96 20 4122
572 *| OLE 2.30 W95/NT 1993-98 30 4265
573 *| OLE 2.40 NT?? 1993-98 40 4267
574 *| OLE 2.40 W98 SE orig. file 1993-98 40 4275
575 *| OLE 2.40 W2K orig. file 1993-XX 40 4514
577 * Currently the versions returned are 2.20 for Win3.1, 2.30 for Win95 & NT 3.51,
578 * and 2.40 for all later versions. The build number is maximum, i.e. 0xffff.
580 ULONG WINAPI OaBuildVersion(void)
582 switch(GetVersion() & 0x8000ffff) /* mask off build number */
584 case 0x80000a03: /* WIN31 */
585 return MAKELONG(0xffff, 20);
586 case 0x00003303: /* NT351 */
587 return MAKELONG(0xffff, 30);
588 case 0x80000004: /* WIN95; I'd like to use the "standard" w95 minor
589 version here (30), but as we still use w95
590 as default winver (which is good IMHO), I better
591 play safe and use the latest value for w95 for now.
592 Change this as soon as default winver gets changed
593 to something more recent */
594 case 0x80000a04: /* WIN98 */
595 case 0x00000004: /* NT40 */
596 case 0x00000005: /* W2K */
597 case 0x00000105: /* WinXP */
598 return MAKELONG(0xffff, 40);
599 default:
600 FIXME("Version value not known yet. Please investigate it !\n");
601 return MAKELONG(0xffff, 40); /* for now return the same value as for w2k */
605 /******************************************************************************
606 * OleTranslateColor [OLEAUT32.421]
608 * Convert an OLE_COLOR to a COLORREF.
610 * PARAMS
611 * clr [I] Color to convert
612 * hpal [I] Handle to a palette for the conversion
613 * pColorRef [O] Destination for converted color, or NULL to test if the conversion is ok
615 * RETURNS
616 * Success: S_OK. The conversion is ok, and pColorRef contains the converted color if non-NULL.
617 * Failure: E_INVALIDARG, if any argument is invalid.
619 * FIXME
620 * Document the conversion rules.
622 HRESULT WINAPI OleTranslateColor(
623 OLE_COLOR clr,
624 HPALETTE hpal,
625 COLORREF* pColorRef)
627 COLORREF colorref;
628 BYTE b = HIBYTE(HIWORD(clr));
630 TRACE("(%08x, %p, %p)\n", clr, hpal, pColorRef);
633 * In case pColorRef is NULL, provide our own to simplify the code.
635 if (pColorRef == NULL)
636 pColorRef = &colorref;
638 switch (b)
640 case 0x00:
642 if (hpal != 0)
643 *pColorRef = PALETTERGB(GetRValue(clr),
644 GetGValue(clr),
645 GetBValue(clr));
646 else
647 *pColorRef = clr;
649 break;
652 case 0x01:
654 if (hpal != 0)
656 PALETTEENTRY pe;
658 * Validate the palette index.
660 if (GetPaletteEntries(hpal, LOWORD(clr), 1, &pe) == 0)
661 return E_INVALIDARG;
664 *pColorRef = clr;
666 break;
669 case 0x02:
670 *pColorRef = clr;
671 break;
673 case 0x80:
675 int index = LOBYTE(LOWORD(clr));
678 * Validate GetSysColor index.
680 if ((index < COLOR_SCROLLBAR) || (index > COLOR_MENUBAR))
681 return E_INVALIDARG;
683 *pColorRef = GetSysColor(index);
685 break;
688 default:
689 return E_INVALIDARG;
692 return S_OK;
695 extern HRESULT WINAPI OLEAUTPS_DllGetClassObject(REFCLSID, REFIID, LPVOID *) DECLSPEC_HIDDEN;
696 extern BOOL WINAPI OLEAUTPS_DllMain(HINSTANCE, DWORD, LPVOID) DECLSPEC_HIDDEN;
697 extern GUID const CLSID_PSFactoryBuffer DECLSPEC_HIDDEN;
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 = 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_PSFactoryBuffer, &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_PSFactoryBuffer, &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_PSDispatch) && IsEqualIID(iid, &IID_IPSFactoryBuffer)) {
793 *ppv = &pPSDispatchFacBuf;
794 IPSFactoryBuffer_AddRef((IPSFactoryBuffer *)*ppv);
795 return S_OK;
797 if (IsEqualGUID(rclsid,&CLSID_PSOAInterface)) {
798 if (S_OK==TMARSHAL_DllGetClassObject(rclsid,iid,ppv))
799 return S_OK;
800 /*FALLTHROUGH*/
802 if (IsEqualCLSID(rclsid, &CLSID_PSTypeInfo) ||
803 IsEqualCLSID(rclsid, &CLSID_PSTypeLib) ||
804 IsEqualCLSID(rclsid, &CLSID_PSDispatch) ||
805 IsEqualCLSID(rclsid, &CLSID_PSEnumVariant))
806 return OLEAUTPS_DllGetClassObject(&CLSID_PSFactoryBuffer, iid, ppv);
808 return OLEAUTPS_DllGetClassObject(rclsid, iid, ppv);
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 return OLEAUTPS_DllMain( hInstDll, fdwReason, lpvReserved );
835 /***********************************************************************
836 * OleIconToCursor (OLEAUT32.415)
838 HCURSOR WINAPI OleIconToCursor( HINSTANCE hinstExe, HICON hIcon)
840 FIXME("(%p,%p), partially implemented.\n",hinstExe,hIcon);
841 /* FIXME: make a extended conversation from HICON to HCURSOR */
842 return CopyCursor(hIcon);