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
40 #include "oleaut32_oaidl.h"
42 #include "wine/debug.h"
43 #include "wine/unicode.h"
45 WINE_DEFAULT_DEBUG_CHANNEL(ole
);
46 WINE_DECLARE_DEBUG_CHANNEL(heap
);
48 /******************************************************************************
52 * BSTR is a simple typedef for a wide-character string used as the principle
53 * string type in ole automation. When encapsulated in a Variant type they are
54 * automatically copied and destroyed as the variant is processed.
56 * The low level BSTR API allows manipulation of these strings and is used by
57 * higher level API calls to manage the strings transparently to the caller.
59 * Internally the BSTR type is allocated with space for a DWORD byte count before
60 * the string data begins. This is undocumented and non-system code should not
61 * access the count directly. Use SysStringLen() or SysStringByteLen()
62 * instead. Note that the byte count does not include the terminating NUL.
64 * To create a new BSTR, use SysAllocString(), SysAllocStringLen() or
65 * SysAllocStringByteLen(). To change the size of an existing BSTR, use SysReAllocString()
66 * or SysReAllocStringLen(). Finally to destroy a string use SysFreeString().
68 * BSTR's are cached by Ole Automation by default. To override this behaviour
69 * either set the environment variable 'OANOCACHE', or call SetOaNoCache().
72 * 'Inside OLE, second edition' by Kraig Brockshmidt.
75 static BOOL bstr_cache_enabled
;
77 static CRITICAL_SECTION cs_bstr_cache
;
78 static CRITICAL_SECTION_DEBUG cs_bstr_cache_dbg
=
81 { &cs_bstr_cache_dbg
.ProcessLocksList
, &cs_bstr_cache_dbg
.ProcessLocksList
},
82 0, 0, { (DWORD_PTR
)(__FILE__
": bstr_cache") }
84 static CRITICAL_SECTION cs_bstr_cache
= { &cs_bstr_cache_dbg
, -1, 0, 0, 0, 0 };
95 #define BUCKET_SIZE 16
96 #define BUCKET_BUFFER_SIZE 6
101 bstr_t
*buf
[BUCKET_BUFFER_SIZE
];
102 } bstr_cache_entry_t
;
104 #define ARENA_INUSE_FILLER 0x55
105 #define ARENA_TAIL_FILLER 0xab
106 #define ARENA_FREE_FILLER 0xfeeefeee
108 static bstr_cache_entry_t bstr_cache
[0x10000/BUCKET_SIZE
];
110 static inline size_t bstr_alloc_size(size_t size
)
112 return (FIELD_OFFSET(bstr_t
, u
.ptr
[size
]) + sizeof(WCHAR
) + BUCKET_SIZE
-1) & ~(BUCKET_SIZE
-1);
115 static inline bstr_t
*bstr_from_str(BSTR str
)
117 return CONTAINING_RECORD(str
, bstr_t
, u
.str
);
120 static inline bstr_cache_entry_t
*get_cache_entry(size_t size
)
122 unsigned cache_idx
= FIELD_OFFSET(bstr_t
, u
.ptr
[size
-1])/BUCKET_SIZE
;
123 return bstr_cache_enabled
&& cache_idx
< sizeof(bstr_cache
)/sizeof(*bstr_cache
)
124 ? bstr_cache
+ cache_idx
128 static bstr_t
*alloc_bstr(size_t size
)
130 bstr_cache_entry_t
*cache_entry
= get_cache_entry(size
+sizeof(WCHAR
));
134 EnterCriticalSection(&cs_bstr_cache
);
136 if(!cache_entry
->cnt
) {
137 cache_entry
= get_cache_entry(size
+sizeof(WCHAR
)+BUCKET_SIZE
);
138 if(cache_entry
&& !cache_entry
->cnt
)
143 ret
= cache_entry
->buf
[cache_entry
->head
++];
144 cache_entry
->head
%= BUCKET_BUFFER_SIZE
;
148 LeaveCriticalSection(&cs_bstr_cache
);
154 memset(ret
, ARENA_INUSE_FILLER
, FIELD_OFFSET(bstr_t
, u
.ptr
[size
+sizeof(WCHAR
)]));
155 tail
= bstr_alloc_size(size
) - FIELD_OFFSET(bstr_t
, u
.ptr
[size
+sizeof(WCHAR
)]);
157 memset(ret
->u
.ptr
+size
+sizeof(WCHAR
), ARENA_TAIL_FILLER
, tail
);
164 ret
= HeapAlloc(GetProcessHeap(), 0, bstr_alloc_size(size
));
170 /******************************************************************************
171 * SysStringLen [OLEAUT32.7]
173 * Get the allocated length of a BSTR in wide characters.
176 * str [I] BSTR to find the length of
179 * The allocated length of str, or 0 if str is NULL.
183 * The returned length may be different from the length of the string as
184 * calculated by lstrlenW(), since it returns the length that was used to
185 * allocate the string by SysAllocStringLen().
187 UINT WINAPI
SysStringLen(BSTR str
)
189 return str
? bstr_from_str(str
)->size
/sizeof(WCHAR
) : 0;
192 /******************************************************************************
193 * SysStringByteLen [OLEAUT32.149]
195 * Get the allocated length of a BSTR in bytes.
198 * str [I] BSTR to find the length of
201 * The allocated length of str, or 0 if str is NULL.
204 * See SysStringLen(), BSTR().
206 UINT WINAPI
SysStringByteLen(BSTR str
)
208 return str
? bstr_from_str(str
)->size
: 0;
211 /******************************************************************************
212 * SysAllocString [OLEAUT32.2]
214 * Create a BSTR from an OLESTR.
217 * str [I] Source to create BSTR from
220 * Success: A BSTR allocated with SysAllocStringLen().
221 * Failure: NULL, if oleStr is NULL.
225 * MSDN (October 2001) incorrectly states that NULL is returned if oleStr has
226 * a length of 0. Native Win32 and this implementation both return a valid
227 * empty BSTR in this case.
229 BSTR WINAPI
SysAllocString(LPCOLESTR str
)
233 /* Delegate this to the SysAllocStringLen32 method. */
234 return SysAllocStringLen(str
, lstrlenW(str
));
237 /******************************************************************************
238 * SysFreeString [OLEAUT32.6]
243 * str [I] BSTR to free.
250 * str may be NULL, in which case this function does nothing.
252 void WINAPI
SysFreeString(BSTR str
)
254 bstr_cache_entry_t
*cache_entry
;
260 bstr
= bstr_from_str(str
);
261 cache_entry
= get_cache_entry(bstr
->size
+sizeof(WCHAR
));
265 EnterCriticalSection(&cs_bstr_cache
);
267 /* According to tests, freeing a string that's already in cache doesn't corrupt anything.
268 * For that to work we need to search the cache. */
269 for(i
=0; i
< cache_entry
->cnt
; i
++) {
270 if(cache_entry
->buf
[(cache_entry
->head
+i
) % BUCKET_BUFFER_SIZE
] == bstr
) {
271 WARN_(heap
)("String already is in cache!\n");
272 LeaveCriticalSection(&cs_bstr_cache
);
277 if(cache_entry
->cnt
< sizeof(cache_entry
->buf
)/sizeof(*cache_entry
->buf
)) {
278 cache_entry
->buf
[(cache_entry
->head
+cache_entry
->cnt
) % BUCKET_BUFFER_SIZE
] = bstr
;
282 unsigned n
= bstr_alloc_size(bstr
->size
) / sizeof(DWORD
) - 1;
283 bstr
->size
= ARENA_FREE_FILLER
;
285 bstr
->u
.dwptr
[i
] = ARENA_FREE_FILLER
;
288 LeaveCriticalSection(&cs_bstr_cache
);
292 LeaveCriticalSection(&cs_bstr_cache
);
295 HeapFree(GetProcessHeap(), 0, bstr
);
298 /******************************************************************************
299 * SysAllocStringLen [OLEAUT32.4]
301 * Create a BSTR from an OLESTR of a given wide character length.
304 * str [I] Source to create BSTR from
305 * len [I] Length of oleStr in wide characters
308 * Success: A newly allocated BSTR from SysAllocStringByteLen()
309 * Failure: NULL, if len is >= 0x80000000, or memory allocation fails.
312 * See BSTR(), SysAllocStringByteLen().
314 BSTR WINAPI
SysAllocStringLen(const OLECHAR
*str
, unsigned int len
)
319 /* Detect integer overflow. */
320 if (len
>= ((UINT_MAX
-sizeof(WCHAR
)-sizeof(DWORD
))/sizeof(WCHAR
)))
323 TRACE("%s\n", debugstr_wn(str
, len
));
325 size
= len
*sizeof(WCHAR
);
326 bstr
= alloc_bstr(size
);
331 memcpy(bstr
->u
.str
, str
, size
);
332 bstr
->u
.str
[len
] = 0;
334 memset(bstr
->u
.str
, 0, size
+sizeof(WCHAR
));
340 /******************************************************************************
341 * SysReAllocStringLen [OLEAUT32.5]
343 * Change the length of a previously created BSTR.
346 * old [O] BSTR to change the length of
347 * str [I] New source for pbstr
348 * len [I] Length of oleStr in wide characters
351 * Success: 1. The size of pbstr is updated.
352 * Failure: 0, if len >= 0x80000000 or memory allocation fails.
355 * See BSTR(), SysAllocStringByteLen().
356 * *old may be changed by this function.
358 int WINAPI
SysReAllocStringLen(BSTR
* old
, const OLECHAR
* str
, unsigned int len
)
360 /* Detect integer overflow. */
361 if (len
>= ((UINT_MAX
-sizeof(WCHAR
)-sizeof(DWORD
))/sizeof(WCHAR
)))
365 BSTR old_copy
= *old
;
366 DWORD newbytelen
= len
*sizeof(WCHAR
);
367 bstr_t
*bstr
= HeapReAlloc(GetProcessHeap(),0,((DWORD
*)*old
)-1,bstr_alloc_size(newbytelen
));
369 bstr
->size
= newbytelen
;
370 /* Subtle hidden feature: The old string data is still there
372 * Some Microsoft program needs it.
373 * FIXME: Is it a sideeffect of BSTR caching?
375 if (str
&& old_copy
!=str
) memmove(*old
, str
, newbytelen
);
379 * Allocate the new string
381 *old
= SysAllocStringLen(str
, len
);
387 /******************************************************************************
388 * SysAllocStringByteLen [OLEAUT32.150]
390 * Create a BSTR from an OLESTR of a given byte length.
393 * str [I] Source to create BSTR from
394 * len [I] Length of oleStr in bytes
397 * Success: A newly allocated BSTR
398 * Failure: NULL, if len is >= 0x80000000, or memory allocation fails.
401 * -If len is 0 or oleStr is NULL the resulting string is empty ("").
402 * -This function always NUL terminates the resulting BSTR.
403 * -oleStr may be either an LPCSTR or LPCOLESTR, since it is copied
404 * without checking for a terminating NUL.
407 BSTR WINAPI
SysAllocStringByteLen(LPCSTR str
, UINT len
)
411 /* Detect integer overflow. */
412 if (len
>= (UINT_MAX
-sizeof(WCHAR
)-sizeof(DWORD
)))
415 bstr
= alloc_bstr(len
);
420 memcpy(bstr
->u
.ptr
, str
, len
);
421 bstr
->u
.ptr
[len
] = bstr
->u
.ptr
[len
+1] = 0;
423 memset(bstr
->u
.ptr
, 0, len
+sizeof(WCHAR
));
429 /******************************************************************************
430 * SysReAllocString [OLEAUT32.3]
432 * Change the length of a previously created BSTR.
435 * old [I/O] BSTR to change the length of
436 * str [I] New source for pbstr
443 * See BSTR(), SysAllocStringStringLen().
445 INT WINAPI
SysReAllocString(LPBSTR old
,LPCOLESTR str
)
454 * Make sure we free the old string.
459 * Allocate the new string
461 *old
= SysAllocString(str
);
466 /******************************************************************************
467 * SetOaNoCache (OLEAUT32.327)
469 * Instruct Ole Automation not to cache BSTR allocations.
478 * SetOaNoCache does not release cached strings, so it leaks by design.
480 void WINAPI
SetOaNoCache(void)
483 bstr_cache_enabled
= FALSE
;
486 static const WCHAR _delimiter
[] = {'!',0}; /* default delimiter apparently */
487 static const WCHAR
*pdelimiter
= &_delimiter
[0];
489 /***********************************************************************
490 * RegisterActiveObject (OLEAUT32.33)
492 * Registers an object in the global item table.
495 * punk [I] Object to register.
496 * rcid [I] CLSID of the object.
498 * pdwRegister [O] Address to store cookie of object registration in.
502 * Failure: HRESULT code.
504 HRESULT WINAPI DECLSPEC_HOTPATCH
RegisterActiveObject(
505 LPUNKNOWN punk
,REFCLSID rcid
,DWORD dwFlags
,LPDWORD pdwRegister
509 LPRUNNINGOBJECTTABLE runobtable
;
511 DWORD rot_flags
= ROTFLAGS_REGISTRATIONKEEPSALIVE
; /* default registration is strong */
513 StringFromGUID2(rcid
,guidbuf
,39);
514 ret
= CreateItemMoniker(pdelimiter
,guidbuf
,&moniker
);
517 ret
= GetRunningObjectTable(0,&runobtable
);
519 IMoniker_Release(moniker
);
522 if(dwFlags
== ACTIVEOBJECT_WEAK
)
524 ret
= IRunningObjectTable_Register(runobtable
,rot_flags
,punk
,moniker
,pdwRegister
);
525 IRunningObjectTable_Release(runobtable
);
526 IMoniker_Release(moniker
);
530 /***********************************************************************
531 * RevokeActiveObject (OLEAUT32.34)
533 * Revokes an object from the global item table.
536 * xregister [I] Registration cookie.
537 * reserved [I] Reserved. Set to NULL.
541 * Failure: HRESULT code.
543 HRESULT WINAPI DECLSPEC_HOTPATCH
RevokeActiveObject(DWORD xregister
,LPVOID reserved
)
545 LPRUNNINGOBJECTTABLE runobtable
;
548 ret
= GetRunningObjectTable(0,&runobtable
);
549 if (FAILED(ret
)) return ret
;
550 ret
= IRunningObjectTable_Revoke(runobtable
,xregister
);
551 if (SUCCEEDED(ret
)) ret
= S_OK
;
552 IRunningObjectTable_Release(runobtable
);
556 /***********************************************************************
557 * GetActiveObject (OLEAUT32.35)
559 * Gets an object from the global item table.
562 * rcid [I] CLSID of the object.
563 * preserved [I] Reserved. Set to NULL.
564 * ppunk [O] Address to store object into.
568 * Failure: HRESULT code.
570 HRESULT WINAPI DECLSPEC_HOTPATCH
GetActiveObject(REFCLSID rcid
,LPVOID preserved
,LPUNKNOWN
*ppunk
)
574 LPRUNNINGOBJECTTABLE runobtable
;
577 StringFromGUID2(rcid
,guidbuf
,39);
578 ret
= CreateItemMoniker(pdelimiter
,guidbuf
,&moniker
);
581 ret
= GetRunningObjectTable(0,&runobtable
);
583 IMoniker_Release(moniker
);
586 ret
= IRunningObjectTable_GetObject(runobtable
,moniker
,ppunk
);
587 IRunningObjectTable_Release(runobtable
);
588 IMoniker_Release(moniker
);
593 /***********************************************************************
594 * OaBuildVersion [OLEAUT32.170]
596 * Get the Ole Automation build version.
605 * Known oleaut32.dll versions:
606 *| OLE Ver. Comments Date Build Ver.
607 *| -------- ------------------------- ---- ---------
608 *| OLE 2.1 NT 1993-95 10 3023
610 *| Win32s Ver 1.1e 20 4049
611 *| OLE 2.20 W95/NT 1993-96 20 4112
612 *| OLE 2.20 W95/NT 1993-96 20 4118
613 *| OLE 2.20 W95/NT 1993-96 20 4122
614 *| OLE 2.30 W95/NT 1993-98 30 4265
615 *| OLE 2.40 NT?? 1993-98 40 4267
616 *| OLE 2.40 W98 SE orig. file 1993-98 40 4275
617 *| OLE 2.40 W2K orig. file 1993-XX 40 4514
619 * Currently the versions returned are 2.20 for Win3.1, 2.30 for Win95 & NT 3.51,
620 * and 2.40 for all later versions. The build number is maximum, i.e. 0xffff.
622 ULONG WINAPI
OaBuildVersion(void)
624 switch(GetVersion() & 0x8000ffff) /* mask off build number */
626 case 0x80000a03: /* WIN31 */
627 return MAKELONG(0xffff, 20);
628 case 0x00003303: /* NT351 */
629 return MAKELONG(0xffff, 30);
630 case 0x80000004: /* WIN95; I'd like to use the "standard" w95 minor
631 version here (30), but as we still use w95
632 as default winver (which is good IMHO), I better
633 play safe and use the latest value for w95 for now.
634 Change this as soon as default winver gets changed
635 to something more recent */
636 case 0x80000a04: /* WIN98 */
637 case 0x00000004: /* NT40 */
638 case 0x00000005: /* W2K */
639 return MAKELONG(0xffff, 40);
640 case 0x00000105: /* WinXP */
641 case 0x00000006: /* Vista */
642 case 0x00000106: /* Win7 */
643 return MAKELONG(0xffff, 50);
645 FIXME("Version value not known yet. Please investigate it !\n");
646 return MAKELONG(0xffff, 40); /* for now return the same value as for w2k */
650 /******************************************************************************
651 * OleTranslateColor [OLEAUT32.421]
653 * Convert an OLE_COLOR to a COLORREF.
656 * clr [I] Color to convert
657 * hpal [I] Handle to a palette for the conversion
658 * pColorRef [O] Destination for converted color, or NULL to test if the conversion is ok
661 * Success: S_OK. The conversion is ok, and pColorRef contains the converted color if non-NULL.
662 * Failure: E_INVALIDARG, if any argument is invalid.
665 * Document the conversion rules.
667 HRESULT WINAPI
OleTranslateColor(
673 BYTE b
= HIBYTE(HIWORD(clr
));
675 TRACE("(%08x, %p, %p)\n", clr
, hpal
, pColorRef
);
678 * In case pColorRef is NULL, provide our own to simplify the code.
680 if (pColorRef
== NULL
)
681 pColorRef
= &colorref
;
688 *pColorRef
= PALETTERGB(GetRValue(clr
),
703 * Validate the palette index.
705 if (GetPaletteEntries(hpal
, LOWORD(clr
), 1, &pe
) == 0)
720 int index
= LOBYTE(LOWORD(clr
));
723 * Validate GetSysColor index.
725 if ((index
< COLOR_SCROLLBAR
) || (index
> COLOR_MENUBAR
))
728 *pColorRef
= GetSysColor(index
);
740 extern HRESULT WINAPI
OLEAUTPS_DllGetClassObject(REFCLSID
, REFIID
, LPVOID
*) DECLSPEC_HIDDEN
;
741 extern BOOL WINAPI
OLEAUTPS_DllMain(HINSTANCE
, DWORD
, LPVOID
) DECLSPEC_HIDDEN
;
742 extern HRESULT WINAPI
OLEAUTPS_DllRegisterServer(void) DECLSPEC_HIDDEN
;
743 extern HRESULT WINAPI
OLEAUTPS_DllUnregisterServer(void) DECLSPEC_HIDDEN
;
745 extern void _get_STDFONT_CF(LPVOID
*);
746 extern void _get_STDPIC_CF(LPVOID
*);
748 static HRESULT WINAPI
PSDispatchFacBuf_QueryInterface(IPSFactoryBuffer
*iface
, REFIID riid
, void **ppv
)
750 if (IsEqualIID(riid
, &IID_IUnknown
) ||
751 IsEqualIID(riid
, &IID_IPSFactoryBuffer
))
753 IPSFactoryBuffer_AddRef(iface
);
757 return E_NOINTERFACE
;
760 static ULONG WINAPI
PSDispatchFacBuf_AddRef(IPSFactoryBuffer
*iface
)
765 static ULONG WINAPI
PSDispatchFacBuf_Release(IPSFactoryBuffer
*iface
)
770 static HRESULT WINAPI
PSDispatchFacBuf_CreateProxy(IPSFactoryBuffer
*iface
, IUnknown
*pUnkOuter
, REFIID riid
, IRpcProxyBuffer
**ppProxy
, void **ppv
)
772 IPSFactoryBuffer
*pPSFB
;
775 if (IsEqualIID(riid
, &IID_IDispatch
))
776 hr
= OLEAUTPS_DllGetClassObject(&CLSID_PSFactoryBuffer
, &IID_IPSFactoryBuffer
, (void **)&pPSFB
);
778 hr
= TMARSHAL_DllGetClassObject(&CLSID_PSOAInterface
, &IID_IPSFactoryBuffer
, (void **)&pPSFB
);
780 if (FAILED(hr
)) return hr
;
782 hr
= IPSFactoryBuffer_CreateProxy(pPSFB
, pUnkOuter
, riid
, ppProxy
, ppv
);
784 IPSFactoryBuffer_Release(pPSFB
);
788 static HRESULT WINAPI
PSDispatchFacBuf_CreateStub(IPSFactoryBuffer
*iface
, REFIID riid
, IUnknown
*pUnkOuter
, IRpcStubBuffer
**ppStub
)
790 IPSFactoryBuffer
*pPSFB
;
793 if (IsEqualIID(riid
, &IID_IDispatch
))
794 hr
= OLEAUTPS_DllGetClassObject(&CLSID_PSFactoryBuffer
, &IID_IPSFactoryBuffer
, (void **)&pPSFB
);
796 hr
= TMARSHAL_DllGetClassObject(&CLSID_PSOAInterface
, &IID_IPSFactoryBuffer
, (void **)&pPSFB
);
798 if (FAILED(hr
)) return hr
;
800 hr
= IPSFactoryBuffer_CreateStub(pPSFB
, riid
, pUnkOuter
, ppStub
);
802 IPSFactoryBuffer_Release(pPSFB
);
806 static const IPSFactoryBufferVtbl PSDispatchFacBuf_Vtbl
=
808 PSDispatchFacBuf_QueryInterface
,
809 PSDispatchFacBuf_AddRef
,
810 PSDispatchFacBuf_Release
,
811 PSDispatchFacBuf_CreateProxy
,
812 PSDispatchFacBuf_CreateStub
815 /* This is the whole PSFactoryBuffer object, just the vtableptr */
816 static const IPSFactoryBufferVtbl
*pPSDispatchFacBuf
= &PSDispatchFacBuf_Vtbl
;
818 /***********************************************************************
819 * DllGetClassObject (OLEAUT32.@)
821 HRESULT WINAPI
DllGetClassObject(REFCLSID rclsid
, REFIID iid
, LPVOID
*ppv
)
824 if (IsEqualGUID(rclsid
,&CLSID_StdFont
)) {
825 if (IsEqualGUID(iid
,&IID_IClassFactory
)) {
826 _get_STDFONT_CF(ppv
);
827 IClassFactory_AddRef((IClassFactory
*)*ppv
);
831 if (IsEqualGUID(rclsid
,&CLSID_StdPicture
)) {
832 if (IsEqualGUID(iid
,&IID_IClassFactory
)) {
834 IClassFactory_AddRef((IClassFactory
*)*ppv
);
838 if (IsEqualCLSID(rclsid
, &CLSID_PSDispatch
) && IsEqualIID(iid
, &IID_IPSFactoryBuffer
)) {
839 *ppv
= &pPSDispatchFacBuf
;
840 IPSFactoryBuffer_AddRef((IPSFactoryBuffer
*)*ppv
);
843 if (IsEqualGUID(rclsid
,&CLSID_PSOAInterface
)) {
844 if (S_OK
==TMARSHAL_DllGetClassObject(rclsid
,iid
,ppv
))
848 if (IsEqualCLSID(rclsid
, &CLSID_PSTypeInfo
) ||
849 IsEqualCLSID(rclsid
, &CLSID_PSTypeLib
) ||
850 IsEqualCLSID(rclsid
, &CLSID_PSDispatch
) ||
851 IsEqualCLSID(rclsid
, &CLSID_PSEnumVariant
))
852 return OLEAUTPS_DllGetClassObject(&CLSID_PSFactoryBuffer
, iid
, ppv
);
854 return OLEAUTPS_DllGetClassObject(rclsid
, iid
, ppv
);
857 /***********************************************************************
858 * DllCanUnloadNow (OLEAUT32.@)
860 * Determine if this dll can be unloaded from the callers address space.
866 * Always returns S_FALSE. This dll cannot be unloaded.
868 HRESULT WINAPI
DllCanUnloadNow(void)
873 /*****************************************************************************
874 * DllMain [OLEAUT32.@]
876 BOOL WINAPI
DllMain(HINSTANCE hInstDll
, DWORD fdwReason
, LPVOID lpvReserved
)
878 static const WCHAR oanocacheW
[] = {'o','a','n','o','c','a','c','h','e',0};
880 if(fdwReason
== DLL_PROCESS_ATTACH
)
881 bstr_cache_enabled
= !GetEnvironmentVariableW(oanocacheW
, NULL
, 0);
883 return OLEAUTPS_DllMain( hInstDll
, fdwReason
, lpvReserved
);
886 /***********************************************************************
887 * DllRegisterServer (OLEAUT32.@)
889 HRESULT WINAPI
DllRegisterServer(void)
891 return OLEAUTPS_DllRegisterServer();
894 /***********************************************************************
895 * DllUnregisterServer (OLEAUT32.@)
897 HRESULT WINAPI
DllUnregisterServer(void)
899 return OLEAUTPS_DllUnregisterServer();
902 /***********************************************************************
903 * OleIconToCursor (OLEAUT32.415)
905 HCURSOR WINAPI
OleIconToCursor( HINSTANCE hinstExe
, HICON hIcon
)
907 FIXME("(%p,%p), partially implemented.\n",hinstExe
,hIcon
);
908 /* FIXME: make an extended conversation from HICON to HCURSOR */
909 return CopyCursor(hIcon
);