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
38 #include "oleaut32_oaidl.h"
40 #include "wine/debug.h"
41 #include "wine/unicode.h"
43 WINE_DEFAULT_DEBUG_CHANNEL(ole
);
44 WINE_DECLARE_DEBUG_CHANNEL(heap
);
46 /******************************************************************************
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().
70 * 'Inside OLE, second edition' by Kraig Brockshmidt.
73 static BOOL bstr_cache_enabled
;
75 static CRITICAL_SECTION cs_bstr_cache
;
76 static CRITICAL_SECTION_DEBUG cs_bstr_cache_dbg
=
79 { &cs_bstr_cache_dbg
.ProcessLocksList
, &cs_bstr_cache_dbg
.ProcessLocksList
},
80 0, 0, { (DWORD_PTR
)(__FILE__
": bstr_cache") }
82 static CRITICAL_SECTION cs_bstr_cache
= { &cs_bstr_cache_dbg
, -1, 0, 0, 0, 0 };
93 #define BUCKET_SIZE 16
94 #define BUCKET_BUFFER_SIZE 6
99 bstr_t
*buf
[BUCKET_BUFFER_SIZE
];
100 } bstr_cache_entry_t
;
102 #define ARENA_INUSE_FILLER 0x55
103 #define ARENA_TAIL_FILLER 0xab
104 #define ARENA_FREE_FILLER 0xfeeefeee
106 static bstr_cache_entry_t bstr_cache
[0x10000/BUCKET_SIZE
];
108 static inline size_t bstr_alloc_size(size_t size
)
110 return (FIELD_OFFSET(bstr_t
, u
.ptr
[size
]) + sizeof(WCHAR
) + BUCKET_SIZE
-1) & ~(BUCKET_SIZE
-1);
113 static inline bstr_t
*bstr_from_str(BSTR str
)
115 return CONTAINING_RECORD(str
, bstr_t
, u
.str
);
118 static inline bstr_cache_entry_t
*get_cache_entry(size_t size
)
120 unsigned cache_idx
= FIELD_OFFSET(bstr_t
, u
.ptr
[size
-1])/BUCKET_SIZE
;
121 return bstr_cache_enabled
&& cache_idx
< sizeof(bstr_cache
)/sizeof(*bstr_cache
)
122 ? bstr_cache
+ cache_idx
126 static bstr_t
*alloc_bstr(size_t size
)
128 bstr_cache_entry_t
*cache_entry
= get_cache_entry(size
+sizeof(WCHAR
));
132 EnterCriticalSection(&cs_bstr_cache
);
134 if(!cache_entry
->cnt
) {
135 cache_entry
= get_cache_entry(size
+sizeof(WCHAR
)+BUCKET_SIZE
);
136 if(cache_entry
&& !cache_entry
->cnt
)
141 ret
= cache_entry
->buf
[cache_entry
->head
++];
142 cache_entry
->head
%= BUCKET_BUFFER_SIZE
;
146 LeaveCriticalSection(&cs_bstr_cache
);
152 memset(ret
, ARENA_INUSE_FILLER
, FIELD_OFFSET(bstr_t
, u
.ptr
[size
+sizeof(WCHAR
)]));
153 tail
= bstr_alloc_size(size
) - FIELD_OFFSET(bstr_t
, u
.ptr
[size
+sizeof(WCHAR
)]);
155 memset(ret
->u
.ptr
+size
+sizeof(WCHAR
), ARENA_TAIL_FILLER
, tail
);
162 ret
= HeapAlloc(GetProcessHeap(), 0, bstr_alloc_size(size
));
168 /******************************************************************************
169 * SysStringLen [OLEAUT32.7]
171 * Get the allocated length of a BSTR in wide characters.
174 * str [I] BSTR to find the length of
177 * The allocated length of str, or 0 if str is NULL.
181 * The returned length may be different from the length of the string as
182 * calculated by lstrlenW(), since it returns the length that was used to
183 * allocate the string by SysAllocStringLen().
185 UINT WINAPI
SysStringLen(BSTR str
)
187 return str
? bstr_from_str(str
)->size
/sizeof(WCHAR
) : 0;
190 /******************************************************************************
191 * SysStringByteLen [OLEAUT32.149]
193 * Get the allocated length of a BSTR in bytes.
196 * str [I] BSTR to find the length of
199 * The allocated length of str, or 0 if str is NULL.
202 * See SysStringLen(), BSTR().
204 UINT WINAPI
SysStringByteLen(BSTR str
)
206 return str
? bstr_from_str(str
)->size
: 0;
209 /******************************************************************************
210 * SysAllocString [OLEAUT32.2]
212 * Create a BSTR from an OLESTR.
215 * str [I] Source to create BSTR from
218 * Success: A BSTR allocated with SysAllocStringLen().
219 * Failure: NULL, if oleStr is NULL.
223 * MSDN (October 2001) incorrectly states that NULL is returned if oleStr has
224 * a length of 0. Native Win32 and this implementation both return a valid
225 * empty BSTR in this case.
227 BSTR WINAPI
SysAllocString(LPCOLESTR str
)
231 /* Delegate this to the SysAllocStringLen32 method. */
232 return SysAllocStringLen(str
, lstrlenW(str
));
235 /******************************************************************************
236 * SysFreeString [OLEAUT32.6]
241 * str [I] BSTR to free.
248 * str may be NULL, in which case this function does nothing.
250 void WINAPI
SysFreeString(BSTR str
)
252 bstr_cache_entry_t
*cache_entry
;
258 bstr
= bstr_from_str(str
);
259 cache_entry
= get_cache_entry(bstr
->size
+sizeof(WCHAR
));
263 EnterCriticalSection(&cs_bstr_cache
);
265 /* According to tests, freeing a string that's already in cache doesn't corrupt anything.
266 * For that to work we need to search the cache. */
267 for(i
=0; i
< cache_entry
->cnt
; i
++) {
268 if(cache_entry
->buf
[(cache_entry
->head
+i
) % BUCKET_BUFFER_SIZE
] == bstr
) {
269 WARN_(heap
)("String already is in cache!\n");
270 LeaveCriticalSection(&cs_bstr_cache
);
275 if(cache_entry
->cnt
< sizeof(cache_entry
->buf
)/sizeof(*cache_entry
->buf
)) {
276 cache_entry
->buf
[(cache_entry
->head
+cache_entry
->cnt
) % BUCKET_BUFFER_SIZE
] = bstr
;
280 unsigned n
= bstr_alloc_size(bstr
->size
) / sizeof(DWORD
) - 1;
281 bstr
->size
= ARENA_FREE_FILLER
;
283 bstr
->u
.dwptr
[i
] = ARENA_FREE_FILLER
;
286 LeaveCriticalSection(&cs_bstr_cache
);
290 LeaveCriticalSection(&cs_bstr_cache
);
293 HeapFree(GetProcessHeap(), 0, bstr
);
296 /******************************************************************************
297 * SysAllocStringLen [OLEAUT32.4]
299 * Create a BSTR from an OLESTR of a given wide character length.
302 * str [I] Source to create BSTR from
303 * len [I] Length of oleStr in wide characters
306 * Success: A newly allocated BSTR from SysAllocStringByteLen()
307 * Failure: NULL, if len is >= 0x80000000, or memory allocation fails.
310 * See BSTR(), SysAllocStringByteLen().
312 BSTR WINAPI
SysAllocStringLen(const OLECHAR
*str
, unsigned int len
)
317 /* Detect integer overflow. */
318 if (len
>= ((UINT_MAX
-sizeof(WCHAR
)-sizeof(DWORD
))/sizeof(WCHAR
)))
321 TRACE("%s\n", debugstr_wn(str
, len
));
323 size
= len
*sizeof(WCHAR
);
324 bstr
= alloc_bstr(size
);
329 memcpy(bstr
->u
.str
, str
, size
);
330 bstr
->u
.str
[len
] = 0;
332 memset(bstr
->u
.str
, 0, size
+sizeof(WCHAR
));
338 /******************************************************************************
339 * SysReAllocStringLen [OLEAUT32.5]
341 * Change the length of a previously created BSTR.
344 * old [O] BSTR to change the length of
345 * str [I] New source for pbstr
346 * len [I] Length of oleStr in wide characters
349 * Success: 1. The size of pbstr is updated.
350 * Failure: 0, if len >= 0x80000000 or memory allocation fails.
353 * See BSTR(), SysAllocStringByteLen().
354 * *old may be changed by this function.
356 int WINAPI
SysReAllocStringLen(BSTR
* old
, const OLECHAR
* str
, unsigned int len
)
358 /* Detect integer overflow. */
359 if (len
>= ((UINT_MAX
-sizeof(WCHAR
)-sizeof(DWORD
))/sizeof(WCHAR
)))
363 BSTR old_copy
= *old
;
364 DWORD newbytelen
= len
*sizeof(WCHAR
);
365 bstr_t
*bstr
= HeapReAlloc(GetProcessHeap(),0,((DWORD
*)*old
)-1,bstr_alloc_size(newbytelen
));
367 bstr
->size
= newbytelen
;
368 /* Subtle hidden feature: The old string data is still there
370 * Some Microsoft program needs it.
371 * FIXME: Is it a sideeffect of BSTR caching?
373 if (str
&& old_copy
!=str
) memmove(*old
, str
, newbytelen
);
377 * Allocate the new string
379 *old
= SysAllocStringLen(str
, len
);
385 /******************************************************************************
386 * SysAllocStringByteLen [OLEAUT32.150]
388 * Create a BSTR from an OLESTR of a given byte length.
391 * str [I] Source to create BSTR from
392 * len [I] Length of oleStr in bytes
395 * Success: A newly allocated BSTR
396 * Failure: NULL, if len is >= 0x80000000, or memory allocation fails.
399 * -If len is 0 or oleStr is NULL the resulting string is empty ("").
400 * -This function always NUL terminates the resulting BSTR.
401 * -oleStr may be either an LPCSTR or LPCOLESTR, since it is copied
402 * without checking for a terminating NUL.
405 BSTR WINAPI
SysAllocStringByteLen(LPCSTR str
, UINT len
)
409 /* Detect integer overflow. */
410 if (len
>= (UINT_MAX
-sizeof(WCHAR
)-sizeof(DWORD
)))
413 bstr
= alloc_bstr(len
);
418 memcpy(bstr
->u
.ptr
, str
, len
);
419 bstr
->u
.ptr
[len
] = bstr
->u
.ptr
[len
+1] = 0;
421 memset(bstr
->u
.ptr
, 0, len
+sizeof(WCHAR
));
427 /******************************************************************************
428 * SysReAllocString [OLEAUT32.3]
430 * Change the length of a previously created BSTR.
433 * old [I/O] BSTR to change the length of
434 * str [I] New source for pbstr
441 * See BSTR(), SysAllocStringStringLen().
443 INT WINAPI
SysReAllocString(LPBSTR old
,LPCOLESTR str
)
452 * Make sure we free the old string.
457 * Allocate the new string
459 *old
= SysAllocString(str
);
464 /******************************************************************************
465 * SetOaNoCache (OLEAUT32.327)
467 * Instruct Ole Automation not to cache BSTR allocations.
476 * SetOaNoCache does not release cached strings, so it leaks by design.
478 void WINAPI
SetOaNoCache(void)
481 bstr_cache_enabled
= FALSE
;
484 static const WCHAR _delimiter
[] = {'!',0}; /* default delimiter apparently */
485 static const WCHAR
*pdelimiter
= &_delimiter
[0];
487 /***********************************************************************
488 * RegisterActiveObject (OLEAUT32.33)
490 * Registers an object in the global item table.
493 * punk [I] Object to register.
494 * rcid [I] CLSID of the object.
496 * pdwRegister [O] Address to store cookie of object registration in.
500 * Failure: HRESULT code.
502 HRESULT WINAPI
RegisterActiveObject(
503 LPUNKNOWN punk
,REFCLSID rcid
,DWORD dwFlags
,LPDWORD pdwRegister
507 LPRUNNINGOBJECTTABLE runobtable
;
509 DWORD rot_flags
= ROTFLAGS_REGISTRATIONKEEPSALIVE
; /* default registration is strong */
511 StringFromGUID2(rcid
,guidbuf
,39);
512 ret
= CreateItemMoniker(pdelimiter
,guidbuf
,&moniker
);
515 ret
= GetRunningObjectTable(0,&runobtable
);
517 IMoniker_Release(moniker
);
520 if(dwFlags
== ACTIVEOBJECT_WEAK
)
522 ret
= IRunningObjectTable_Register(runobtable
,rot_flags
,punk
,moniker
,pdwRegister
);
523 IRunningObjectTable_Release(runobtable
);
524 IMoniker_Release(moniker
);
528 /***********************************************************************
529 * RevokeActiveObject (OLEAUT32.34)
531 * Revokes an object from the global item table.
534 * xregister [I] Registration cookie.
535 * reserved [I] Reserved. Set to NULL.
539 * Failure: HRESULT code.
541 HRESULT WINAPI
RevokeActiveObject(DWORD xregister
,LPVOID reserved
)
543 LPRUNNINGOBJECTTABLE runobtable
;
546 ret
= GetRunningObjectTable(0,&runobtable
);
547 if (FAILED(ret
)) return ret
;
548 ret
= IRunningObjectTable_Revoke(runobtable
,xregister
);
549 if (SUCCEEDED(ret
)) ret
= S_OK
;
550 IRunningObjectTable_Release(runobtable
);
554 /***********************************************************************
555 * GetActiveObject (OLEAUT32.35)
557 * Gets an object from the global item table.
560 * rcid [I] CLSID of the object.
561 * preserved [I] Reserved. Set to NULL.
562 * ppunk [O] Address to store object into.
566 * Failure: HRESULT code.
568 HRESULT WINAPI
GetActiveObject(REFCLSID rcid
,LPVOID preserved
,LPUNKNOWN
*ppunk
)
572 LPRUNNINGOBJECTTABLE runobtable
;
575 StringFromGUID2(rcid
,guidbuf
,39);
576 ret
= CreateItemMoniker(pdelimiter
,guidbuf
,&moniker
);
579 ret
= GetRunningObjectTable(0,&runobtable
);
581 IMoniker_Release(moniker
);
584 ret
= IRunningObjectTable_GetObject(runobtable
,moniker
,ppunk
);
585 IRunningObjectTable_Release(runobtable
);
586 IMoniker_Release(moniker
);
591 /***********************************************************************
592 * OaBuildVersion [OLEAUT32.170]
594 * Get the Ole Automation build version.
603 * Known oleaut32.dll versions:
604 *| OLE Ver. Comments Date Build Ver.
605 *| -------- ------------------------- ---- ---------
606 *| OLE 2.1 NT 1993-95 10 3023
608 *| Win32s Ver 1.1e 20 4049
609 *| OLE 2.20 W95/NT 1993-96 20 4112
610 *| OLE 2.20 W95/NT 1993-96 20 4118
611 *| OLE 2.20 W95/NT 1993-96 20 4122
612 *| OLE 2.30 W95/NT 1993-98 30 4265
613 *| OLE 2.40 NT?? 1993-98 40 4267
614 *| OLE 2.40 W98 SE orig. file 1993-98 40 4275
615 *| OLE 2.40 W2K orig. file 1993-XX 40 4514
617 * Currently the versions returned are 2.20 for Win3.1, 2.30 for Win95 & NT 3.51,
618 * and 2.40 for all later versions. The build number is maximum, i.e. 0xffff.
620 ULONG WINAPI
OaBuildVersion(void)
622 switch(GetVersion() & 0x8000ffff) /* mask off build number */
624 case 0x80000a03: /* WIN31 */
625 return MAKELONG(0xffff, 20);
626 case 0x00003303: /* NT351 */
627 return MAKELONG(0xffff, 30);
628 case 0x80000004: /* WIN95; I'd like to use the "standard" w95 minor
629 version here (30), but as we still use w95
630 as default winver (which is good IMHO), I better
631 play safe and use the latest value for w95 for now.
632 Change this as soon as default winver gets changed
633 to something more recent */
634 case 0x80000a04: /* WIN98 */
635 case 0x00000004: /* NT40 */
636 case 0x00000005: /* W2K */
637 return MAKELONG(0xffff, 40);
638 case 0x00000105: /* WinXP */
639 case 0x00000006: /* Vista */
640 case 0x00000106: /* Win7 */
641 return MAKELONG(0xffff, 50);
643 FIXME("Version value not known yet. Please investigate it !\n");
644 return MAKELONG(0xffff, 40); /* for now return the same value as for w2k */
648 /******************************************************************************
649 * OleTranslateColor [OLEAUT32.421]
651 * Convert an OLE_COLOR to a COLORREF.
654 * clr [I] Color to convert
655 * hpal [I] Handle to a palette for the conversion
656 * pColorRef [O] Destination for converted color, or NULL to test if the conversion is ok
659 * Success: S_OK. The conversion is ok, and pColorRef contains the converted color if non-NULL.
660 * Failure: E_INVALIDARG, if any argument is invalid.
663 * Document the conversion rules.
665 HRESULT WINAPI
OleTranslateColor(
671 BYTE b
= HIBYTE(HIWORD(clr
));
673 TRACE("(%08x, %p, %p)\n", clr
, hpal
, pColorRef
);
676 * In case pColorRef is NULL, provide our own to simplify the code.
678 if (pColorRef
== NULL
)
679 pColorRef
= &colorref
;
686 *pColorRef
= PALETTERGB(GetRValue(clr
),
701 * Validate the palette index.
703 if (GetPaletteEntries(hpal
, LOWORD(clr
), 1, &pe
) == 0)
718 int index
= LOBYTE(LOWORD(clr
));
721 * Validate GetSysColor index.
723 if ((index
< COLOR_SCROLLBAR
) || (index
> COLOR_MENUBAR
))
726 *pColorRef
= GetSysColor(index
);
738 extern HRESULT WINAPI
OLEAUTPS_DllGetClassObject(REFCLSID
, REFIID
, LPVOID
*) DECLSPEC_HIDDEN
;
739 extern BOOL WINAPI
OLEAUTPS_DllMain(HINSTANCE
, DWORD
, LPVOID
) DECLSPEC_HIDDEN
;
740 extern HRESULT WINAPI
OLEAUTPS_DllRegisterServer(void) DECLSPEC_HIDDEN
;
741 extern HRESULT WINAPI
OLEAUTPS_DllUnregisterServer(void) DECLSPEC_HIDDEN
;
743 extern void _get_STDFONT_CF(LPVOID
*);
744 extern void _get_STDPIC_CF(LPVOID
*);
746 static HRESULT WINAPI
PSDispatchFacBuf_QueryInterface(IPSFactoryBuffer
*iface
, REFIID riid
, void **ppv
)
748 if (IsEqualIID(riid
, &IID_IUnknown
) ||
749 IsEqualIID(riid
, &IID_IPSFactoryBuffer
))
751 IPSFactoryBuffer_AddRef(iface
);
755 return E_NOINTERFACE
;
758 static ULONG WINAPI
PSDispatchFacBuf_AddRef(IPSFactoryBuffer
*iface
)
763 static ULONG WINAPI
PSDispatchFacBuf_Release(IPSFactoryBuffer
*iface
)
768 static HRESULT WINAPI
PSDispatchFacBuf_CreateProxy(IPSFactoryBuffer
*iface
, IUnknown
*pUnkOuter
, REFIID riid
, IRpcProxyBuffer
**ppProxy
, void **ppv
)
770 IPSFactoryBuffer
*pPSFB
;
773 if (IsEqualIID(riid
, &IID_IDispatch
))
774 hr
= OLEAUTPS_DllGetClassObject(&CLSID_PSFactoryBuffer
, &IID_IPSFactoryBuffer
, (void **)&pPSFB
);
776 hr
= TMARSHAL_DllGetClassObject(&CLSID_PSOAInterface
, &IID_IPSFactoryBuffer
, (void **)&pPSFB
);
778 if (FAILED(hr
)) return hr
;
780 hr
= IPSFactoryBuffer_CreateProxy(pPSFB
, pUnkOuter
, riid
, ppProxy
, ppv
);
782 IPSFactoryBuffer_Release(pPSFB
);
786 static HRESULT WINAPI
PSDispatchFacBuf_CreateStub(IPSFactoryBuffer
*iface
, REFIID riid
, IUnknown
*pUnkOuter
, IRpcStubBuffer
**ppStub
)
788 IPSFactoryBuffer
*pPSFB
;
791 if (IsEqualIID(riid
, &IID_IDispatch
))
792 hr
= OLEAUTPS_DllGetClassObject(&CLSID_PSFactoryBuffer
, &IID_IPSFactoryBuffer
, (void **)&pPSFB
);
794 hr
= TMARSHAL_DllGetClassObject(&CLSID_PSOAInterface
, &IID_IPSFactoryBuffer
, (void **)&pPSFB
);
796 if (FAILED(hr
)) return hr
;
798 hr
= IPSFactoryBuffer_CreateStub(pPSFB
, riid
, pUnkOuter
, ppStub
);
800 IPSFactoryBuffer_Release(pPSFB
);
804 static const IPSFactoryBufferVtbl PSDispatchFacBuf_Vtbl
=
806 PSDispatchFacBuf_QueryInterface
,
807 PSDispatchFacBuf_AddRef
,
808 PSDispatchFacBuf_Release
,
809 PSDispatchFacBuf_CreateProxy
,
810 PSDispatchFacBuf_CreateStub
813 /* This is the whole PSFactoryBuffer object, just the vtableptr */
814 static const IPSFactoryBufferVtbl
*pPSDispatchFacBuf
= &PSDispatchFacBuf_Vtbl
;
816 /***********************************************************************
817 * DllGetClassObject (OLEAUT32.@)
819 HRESULT WINAPI
DllGetClassObject(REFCLSID rclsid
, REFIID iid
, LPVOID
*ppv
)
822 if (IsEqualGUID(rclsid
,&CLSID_StdFont
)) {
823 if (IsEqualGUID(iid
,&IID_IClassFactory
)) {
824 _get_STDFONT_CF(ppv
);
825 IClassFactory_AddRef((IClassFactory
*)*ppv
);
829 if (IsEqualGUID(rclsid
,&CLSID_StdPicture
)) {
830 if (IsEqualGUID(iid
,&IID_IClassFactory
)) {
832 IClassFactory_AddRef((IClassFactory
*)*ppv
);
836 if (IsEqualCLSID(rclsid
, &CLSID_PSDispatch
) && IsEqualIID(iid
, &IID_IPSFactoryBuffer
)) {
837 *ppv
= &pPSDispatchFacBuf
;
838 IPSFactoryBuffer_AddRef((IPSFactoryBuffer
*)*ppv
);
841 if (IsEqualGUID(rclsid
,&CLSID_PSOAInterface
)) {
842 if (S_OK
==TMARSHAL_DllGetClassObject(rclsid
,iid
,ppv
))
846 if (IsEqualCLSID(rclsid
, &CLSID_PSTypeInfo
) ||
847 IsEqualCLSID(rclsid
, &CLSID_PSTypeLib
) ||
848 IsEqualCLSID(rclsid
, &CLSID_PSDispatch
) ||
849 IsEqualCLSID(rclsid
, &CLSID_PSEnumVariant
))
850 return OLEAUTPS_DllGetClassObject(&CLSID_PSFactoryBuffer
, iid
, ppv
);
852 return OLEAUTPS_DllGetClassObject(rclsid
, iid
, ppv
);
855 /***********************************************************************
856 * DllCanUnloadNow (OLEAUT32.@)
858 * Determine if this dll can be unloaded from the callers address space.
864 * Always returns S_FALSE. This dll cannot be unloaded.
866 HRESULT WINAPI
DllCanUnloadNow(void)
871 /*****************************************************************************
872 * DllMain [OLEAUT32.@]
874 BOOL WINAPI
DllMain(HINSTANCE hInstDll
, DWORD fdwReason
, LPVOID lpvReserved
)
876 static const WCHAR oanocacheW
[] = {'o','a','n','o','c','a','c','h','e',0};
878 if(fdwReason
== DLL_PROCESS_ATTACH
)
879 bstr_cache_enabled
= !GetEnvironmentVariableW(oanocacheW
, NULL
, 0);
881 return OLEAUTPS_DllMain( hInstDll
, fdwReason
, lpvReserved
);
884 /***********************************************************************
885 * DllRegisterServer (OLEAUT32.@)
887 HRESULT WINAPI
DllRegisterServer(void)
889 return OLEAUTPS_DllRegisterServer();
892 /***********************************************************************
893 * DllUnregisterServer (OLEAUT32.@)
895 HRESULT WINAPI
DllUnregisterServer(void)
897 return OLEAUTPS_DllUnregisterServer();
900 /***********************************************************************
901 * OleIconToCursor (OLEAUT32.415)
903 HCURSOR WINAPI
OleIconToCursor( HINSTANCE hinstExe
, HICON hIcon
)
905 FIXME("(%p,%p), partially implemented.\n",hinstExe
,hIcon
);
906 /* FIXME: make an extended conversation from HICON to HCURSOR */
907 return CopyCursor(hIcon
);