ReactOS 0.4.17-dev-573-g8315b8c
oleaut.c
Go to the documentation of this file.
1/*
2 * OLEAUT32
3 *
4 * Copyright 1999, 2000 Marcus Meissner
5 *
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.
10 *
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.
15 *
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
19 */
20
21#include <assert.h>
22#include <stdarg.h>
23#include <stdio.h>
24#include <string.h>
25#include <limits.h>
26
27#define COBJMACROS
28
29#include "windef.h"
30#include "winbase.h"
31#include "wingdi.h"
32#include "winuser.h"
33#include "winerror.h"
34
35#include "ole2.h"
36#include "olectl.h"
37#include "oleauto.h"
38#include "rpcproxy.h"
39#include "initguid.h"
40#include "typelib.h"
41#include "oleaut32_oaidl.h"
42
43#include "wine/debug.h"
44
47
48/******************************************************************************
49 * BSTR {OLEAUT32}
50 *
51 * NOTES
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.
55 *
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.
58 *
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.
63 *
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().
67 *
68 * BSTR's are cached by Ole Automation by default. To override this behaviour
69 * either set the environment variable 'OANOCACHE', or call SetOaNoCache().
70 *
71 * SEE ALSO
72 * 'Inside OLE, second edition' by Kraig Brockshmidt.
73 */
74
76
79{
80 0, 0, &cs_bstr_cache,
82 0, 0, { (DWORD_PTR)(__FILE__ ": bstr_cache") }
83};
84static CRITICAL_SECTION cs_bstr_cache = { &cs_bstr_cache_dbg, -1, 0, 0, 0, 0 };
85
86typedef struct {
87#ifdef _WIN64
88 DWORD pad;
89#endif
91 union {
92 char ptr[1];
94 DWORD dwptr[1];
95 } u;
96} bstr_t;
97
98#define BUCKET_SIZE 16
99#define BUCKET_BUFFER_SIZE 6
100
101typedef struct {
102 unsigned short head;
103 unsigned short cnt;
106
107#define ARENA_INUSE_FILLER 0x55
108#define ARENA_TAIL_FILLER 0xab
109#define ARENA_FREE_FILLER 0xfeeefeee
110
112
113static inline size_t bstr_alloc_size(size_t size)
114{
115 return (FIELD_OFFSET(bstr_t, u.ptr[size]) + sizeof(WCHAR) + BUCKET_SIZE-1) & ~(BUCKET_SIZE-1);
116}
117
119{
120 return CONTAINING_RECORD(str, bstr_t, u.str);
121}
122
123static inline bstr_cache_entry_t *get_cache_entry_from_idx(unsigned cache_idx)
124{
125 return bstr_cache_enabled && cache_idx < ARRAY_SIZE(bstr_cache) ? bstr_cache + cache_idx : NULL;
126}
127
129{
130 unsigned cache_idx = FIELD_OFFSET(bstr_t, u.ptr[size+sizeof(WCHAR)-1])/BUCKET_SIZE;
131 return get_cache_entry_from_idx(cache_idx);
132}
133
135{
136 unsigned cache_idx;
137 if (alloc_size < BUCKET_SIZE) return NULL;
138 cache_idx = (alloc_size - BUCKET_SIZE) / BUCKET_SIZE;
139 return get_cache_entry_from_idx(cache_idx);
140}
141
142static bstr_t *alloc_bstr(size_t size)
143{
145 bstr_t *ret;
146
147 if(cache_entry) {
149
150 if(!cache_entry->cnt) {
152 if(cache_entry && !cache_entry->cnt)
154 }
155
156 if(cache_entry) {
157 ret = cache_entry->buf[cache_entry->head++];
159 cache_entry->cnt--;
160 }
161
163
164 if(cache_entry) {
165 if(WARN_ON(heap)) {
166 size_t fill_size = (FIELD_OFFSET(bstr_t, u.ptr[size])+2*sizeof(WCHAR)-1) & ~(sizeof(WCHAR)-1);
167 memset(ret, ARENA_INUSE_FILLER, fill_size);
168 memset((char *)ret+fill_size, ARENA_TAIL_FILLER, bstr_alloc_size(size)-fill_size);
169 }
170 ret->size = size;
171 return ret;
172 }
173 }
174
176 if(ret)
177 ret->size = size;
178 return ret;
179}
180
181/******************************************************************************
182 * SysStringLen [OLEAUT32.7]
183 *
184 * Get the allocated length of a BSTR in wide characters.
185 *
186 * PARAMS
187 * str [I] BSTR to find the length of
188 *
189 * RETURNS
190 * The allocated length of str, or 0 if str is NULL.
191 *
192 * NOTES
193 * See BSTR.
194 * The returned length may be different from the length of the string as
195 * calculated by lstrlenW(), since it returns the length that was used to
196 * allocate the string by SysAllocStringLen().
197 */
199{
200 return str ? bstr_from_str(str)->size/sizeof(WCHAR) : 0;
201}
202
203/******************************************************************************
204 * SysStringByteLen [OLEAUT32.149]
205 *
206 * Get the allocated length of a BSTR in bytes.
207 *
208 * PARAMS
209 * str [I] BSTR to find the length of
210 *
211 * RETURNS
212 * The allocated length of str, or 0 if str is NULL.
213 *
214 * NOTES
215 * See SysStringLen(), BSTR().
216 */
218{
219 return str ? bstr_from_str(str)->size : 0;
220}
221
222/******************************************************************************
223 * SysAllocString [OLEAUT32.2]
224 *
225 * Create a BSTR from an OLESTR.
226 *
227 * PARAMS
228 * str [I] Source to create BSTR from
229 *
230 * RETURNS
231 * Success: A BSTR allocated with SysAllocStringLen().
232 * Failure: NULL, if oleStr is NULL.
233 *
234 * NOTES
235 * See BSTR.
236 * MSDN (October 2001) incorrectly states that NULL is returned if oleStr has
237 * a length of 0. Native Win32 and this implementation both return a valid
238 * empty BSTR in this case.
239 */
241{
242 if (!str) return 0;
243
244 /* Delegate this to the SysAllocStringLen32 method. */
246}
247
248static inline IMalloc *get_malloc(void)
249{
250 static IMalloc *malloc;
251
252 if (!malloc)
253 CoGetMalloc(1, &malloc);
254
255 return malloc;
256}
257
258/******************************************************************************
259 * SysFreeString [OLEAUT32.6]
260 *
261 * Free a BSTR.
262 *
263 * PARAMS
264 * str [I] BSTR to free.
265 *
266 * RETURNS
267 * Nothing.
268 *
269 * NOTES
270 * See BSTR.
271 * str may be NULL, in which case this function does nothing.
272 */
274{
276 bstr_t *bstr;
278 SIZE_T alloc_size;
279
280 if(!str)
281 return;
282
283 bstr = bstr_from_str(str);
284
285 alloc_size = IMalloc_GetSize(malloc, bstr);
286 if (alloc_size == ~0UL)
287 return;
288
290 if(cache_entry) {
291 unsigned i;
292
294
295 /* According to tests, freeing a string that's already in cache doesn't corrupt anything.
296 * For that to work we need to search the cache. */
297 for(i=0; i < cache_entry->cnt; i++) {
298 if(cache_entry->buf[(cache_entry->head+i) % BUCKET_BUFFER_SIZE] == bstr) {
299 WARN_(heap)("String already is in cache!\n");
301 return;
302 }
303 }
304
305 if(cache_entry->cnt < ARRAY_SIZE(cache_entry->buf)) {
306 cache_entry->buf[(cache_entry->head+cache_entry->cnt) % BUCKET_BUFFER_SIZE] = bstr;
307 cache_entry->cnt++;
308
309 if(WARN_ON(heap)) {
310 unsigned n = (alloc_size-FIELD_OFFSET(bstr_t, u.ptr))/sizeof(DWORD);
311 for(i=0; i<n; i++)
312 bstr->u.dwptr[i] = ARENA_FREE_FILLER;
313 }
314
316 return;
317 }
318
320 }
321
322 CoTaskMemFree(bstr);
323}
324
325/******************************************************************************
326 * SysAllocStringLen [OLEAUT32.4]
327 *
328 * Create a BSTR from an OLESTR of a given wide character length.
329 *
330 * PARAMS
331 * str [I] Source to create BSTR from
332 * len [I] Length of oleStr in wide characters
333 *
334 * RETURNS
335 * Success: A newly allocated BSTR from SysAllocStringByteLen()
336 * Failure: NULL, if len is >= 0x80000000, or memory allocation fails.
337 *
338 * NOTES
339 * See BSTR(), SysAllocStringByteLen().
340 */
342{
343 bstr_t *bstr;
344 DWORD size;
345
346 /* Detect integer overflow. */
347 if (len >= ((UINT_MAX-sizeof(WCHAR)-sizeof(DWORD))/sizeof(WCHAR)))
348 return NULL;
349
350 TRACE("%s\n", debugstr_wn(str, len));
351
352 size = len*sizeof(WCHAR);
353 bstr = alloc_bstr(size);
354 if(!bstr)
355 return NULL;
356
357 if(str) {
358 memcpy(bstr->u.str, str, size);
359 bstr->u.str[len] = 0;
360 }else {
361 memset(bstr->u.str, 0, size+sizeof(WCHAR));
362 }
363
364 return bstr->u.str;
365}
366
367/******************************************************************************
368 * SysReAllocStringLen [OLEAUT32.5]
369 *
370 * Change the length of a previously created BSTR.
371 *
372 * PARAMS
373 * old [O] BSTR to change the length of
374 * str [I] New source for pbstr
375 * len [I] Length of oleStr in wide characters
376 *
377 * RETURNS
378 * Success: 1. The size of pbstr is updated.
379 * Failure: 0, if len >= 0x80000000 or memory allocation fails.
380 *
381 * NOTES
382 * See BSTR(), SysAllocStringByteLen().
383 * *old may be changed by this function.
384 */
385int WINAPI SysReAllocStringLen(BSTR* old, const OLECHAR* str, unsigned int len)
386{
387 /* Detect integer overflow. */
388 if (len >= ((UINT_MAX-sizeof(WCHAR)-sizeof(DWORD))/sizeof(WCHAR)))
389 return FALSE;
390
391 if (*old!=NULL) {
392 DWORD newbytelen = len*sizeof(WCHAR);
393 bstr_t *old_bstr = bstr_from_str(*old);
394 bstr_t *bstr = CoTaskMemRealloc(old_bstr, bstr_alloc_size(newbytelen));
395
396 if (!bstr) return FALSE;
397
398 *old = bstr->u.str;
399 bstr->size = newbytelen;
400 /* The old string data is still there when str is NULL */
401 if (str && old_bstr->u.str != str) memmove(bstr->u.str, str, newbytelen);
402 bstr->u.str[len] = 0;
403 } else {
404 *old = SysAllocStringLen(str, len);
405 }
406
407 return TRUE;
408}
409
410/******************************************************************************
411 * SysAllocStringByteLen [OLEAUT32.150]
412 *
413 * Create a BSTR from an OLESTR of a given byte length.
414 *
415 * PARAMS
416 * str [I] Source to create BSTR from
417 * len [I] Length of oleStr in bytes
418 *
419 * RETURNS
420 * Success: A newly allocated BSTR
421 * Failure: NULL, if len is >= 0x80000000, or memory allocation fails.
422 *
423 * NOTES
424 * -If len is 0 or oleStr is NULL the resulting string is empty ("").
425 * -This function always NUL terminates the resulting BSTR.
426 * -oleStr may be either an LPCSTR or LPCOLESTR, since it is copied
427 * without checking for a terminating NUL.
428 * See BSTR.
429 */
431{
432 bstr_t *bstr;
433
434 /* Detect integer overflow. */
435 if (len >= (UINT_MAX-sizeof(WCHAR)-sizeof(DWORD)))
436 return NULL;
437
438 bstr = alloc_bstr(len);
439 if(!bstr)
440 return NULL;
441
442 if(str) {
443 memcpy(bstr->u.ptr, str, len);
444 bstr->u.ptr[len] = 0;
445 }else {
446 memset(bstr->u.ptr, 0, len+1);
447 }
448 bstr->u.str[(len+sizeof(WCHAR)-1)/sizeof(WCHAR)] = 0;
449
450 return bstr->u.str;
451}
452
453/******************************************************************************
454 * SysReAllocString [OLEAUT32.3]
455 *
456 * Change the length of a previously created BSTR.
457 *
458 * PARAMS
459 * old [I/O] BSTR to change the length of
460 * str [I] New source for pbstr
461 *
462 * RETURNS
463 * Success: 1
464 * Failure: 0.
465 *
466 * NOTES
467 * See BSTR(), SysAllocStringStringLen().
468 */
469INT WINAPI SysReAllocString(LPBSTR old,LPCOLESTR str)
470{
471 /*
472 * Sanity check
473 */
474 if (old==NULL)
475 return 0;
476
477 /*
478 * Make sure we free the old string.
479 */
480 SysFreeString(*old);
481
482 /*
483 * Allocate the new string
484 */
485 *old = SysAllocString(str);
486
487 return 1;
488}
489
490/******************************************************************************
491 * SetOaNoCache (OLEAUT32.327)
492 *
493 * Instruct Ole Automation not to cache BSTR allocations.
494 *
495 * PARAMS
496 * None.
497 *
498 * RETURNS
499 * Nothing.
500 *
501 * NOTES
502 * SetOaNoCache does not release cached strings, so it leaks by design.
503 */
505{
506 TRACE("\n");
508}
509
510/***********************************************************************
511 * RegisterActiveObject (OLEAUT32.33)
512 *
513 * Registers an object in the global item table.
514 *
515 * PARAMS
516 * punk [I] Object to register.
517 * rcid [I] CLSID of the object.
518 * dwFlags [I] Flags.
519 * pdwRegister [O] Address to store cookie of object registration in.
520 *
521 * RETURNS
522 * Success: S_OK.
523 * Failure: HRESULT code.
524 */
526 LPUNKNOWN punk,REFCLSID rcid,DWORD dwFlags,LPDWORD pdwRegister
527) {
528 WCHAR guidbuf[80];
529 HRESULT ret;
530 LPRUNNINGOBJECTTABLE runobtable;
532 DWORD rot_flags = ROTFLAGS_REGISTRATIONKEEPSALIVE; /* default registration is strong */
533
534 StringFromGUID2(rcid,guidbuf,39);
535 ret = CreateItemMoniker(L"!", guidbuf, &moniker);
536 if (FAILED(ret))
537 return ret;
538 ret = GetRunningObjectTable(0,&runobtable);
539 if (FAILED(ret)) {
540 IMoniker_Release(moniker);
541 return ret;
542 }
544 rot_flags = 0;
545 ret = IRunningObjectTable_Register(runobtable,rot_flags,punk,moniker,pdwRegister);
546 IRunningObjectTable_Release(runobtable);
547 IMoniker_Release(moniker);
548 return ret;
549}
550
551/***********************************************************************
552 * RevokeActiveObject (OLEAUT32.34)
553 *
554 * Revokes an object from the global item table.
555 *
556 * PARAMS
557 * xregister [I] Registration cookie.
558 * reserved [I] Reserved. Set to NULL.
559 *
560 * RETURNS
561 * Success: S_OK.
562 * Failure: HRESULT code.
563 */
565{
566 LPRUNNINGOBJECTTABLE runobtable;
567 HRESULT ret;
568
569 ret = GetRunningObjectTable(0,&runobtable);
570 if (FAILED(ret)) return ret;
571 ret = IRunningObjectTable_Revoke(runobtable,xregister);
572 if (SUCCEEDED(ret)) ret = S_OK;
573 IRunningObjectTable_Release(runobtable);
574 return ret;
575}
576
577/***********************************************************************
578 * GetActiveObject (OLEAUT32.35)
579 *
580 * Gets an object from the global item table.
581 *
582 * PARAMS
583 * rcid [I] CLSID of the object.
584 * preserved [I] Reserved. Set to NULL.
585 * ppunk [O] Address to store object into.
586 *
587 * RETURNS
588 * Success: S_OK.
589 * Failure: HRESULT code.
590 */
592{
593 WCHAR guidbuf[80];
594 HRESULT ret;
595 LPRUNNINGOBJECTTABLE runobtable;
597
598 StringFromGUID2(rcid,guidbuf,39);
599 ret = CreateItemMoniker(L"!", guidbuf, &moniker);
600 if (FAILED(ret))
601 return ret;
602 ret = GetRunningObjectTable(0,&runobtable);
603 if (FAILED(ret)) {
604 IMoniker_Release(moniker);
605 return ret;
606 }
607 ret = IRunningObjectTable_GetObject(runobtable,moniker,ppunk);
608 IRunningObjectTable_Release(runobtable);
609 IMoniker_Release(moniker);
610 return ret;
611}
612
613
614/***********************************************************************
615 * OaBuildVersion [OLEAUT32.170]
616 *
617 * Get the Ole Automation build version.
618 *
619 * PARAMS
620 * None
621 *
622 * RETURNS
623 * The build version.
624 *
625 * NOTES
626 * Known oleaut32.dll versions:
627 *| OLE Ver. Comments Date Build Ver.
628 *| -------- ------------------------- ---- ---------
629 *| OLE 2.1 NT 1993-95 10 3023
630 *| OLE 2.1 10 3027
631 *| Win32s Ver 1.1e 20 4049
632 *| OLE 2.20 W95/NT 1993-96 20 4112
633 *| OLE 2.20 W95/NT 1993-96 20 4118
634 *| OLE 2.20 W95/NT 1993-96 20 4122
635 *| OLE 2.30 W95/NT 1993-98 30 4265
636 *| OLE 2.40 NT?? 1993-98 40 4267
637 *| OLE 2.40 W98 SE orig. file 1993-98 40 4275
638 *| OLE 2.40 W2K orig. file 1993-XX 40 4514
639 *
640 * Currently the versions returned are 2.20 for Win3.1, 2.30 for Win95 & NT 3.51,
641 * and 2.40 for all later versions. The build number is maximum, i.e. 0xffff.
642 */
644{
645 switch(GetVersion() & 0x8000ffff) /* mask off build number */
646 {
647 case 0x80000a03: /* WIN31 */
648 return MAKELONG(0xffff, 20);
649 case 0x00003303: /* NT351 */
650 return MAKELONG(0xffff, 30);
651 case 0x80000004: /* WIN95; I'd like to use the "standard" w95 minor
652 version here (30), but as we still use w95
653 as default winver (which is good IMHO), I better
654 play safe and use the latest value for w95 for now.
655 Change this as soon as default winver gets changed
656 to something more recent */
657 case 0x80000a04: /* WIN98 */
658 case 0x00000004: /* NT40 */
659 case 0x00000005: /* W2K */
660 return MAKELONG(0xffff, 40);
661 case 0x00000105: /* WinXP */
662 case 0x00000006: /* Vista */
663 case 0x00000106: /* Win7 */
664 case 0x00000205: /* W2K3 */
665 case 0x00000206: /* Win8, Win10, Win11 */
666 return MAKELONG(0xffff, 50);
667 default:
668 FIXME("Version value not known yet. Please investigate it !\n");
669 return MAKELONG(0xffff, 50); /* for now return the same value as for Win10 */
670 }
671}
672
673/******************************************************************************
674 * OleTranslateColor [OLEAUT32.421]
675 *
676 * Convert an OLE_COLOR to a COLORREF.
677 *
678 * PARAMS
679 * clr [I] Color to convert
680 * hpal [I] Handle to a palette for the conversion
681 * pColorRef [O] Destination for converted color, or NULL to test if the conversion is ok
682 *
683 * RETURNS
684 * Success: S_OK. The conversion is ok, and pColorRef contains the converted color if non-NULL.
685 * Failure: E_INVALIDARG, if any argument is invalid.
686 *
687 * FIXME
688 * Document the conversion rules.
689 */
691 OLE_COLOR clr,
692 HPALETTE hpal,
693 COLORREF* pColorRef)
694{
695 COLORREF colorref;
696 BYTE b = HIBYTE(HIWORD(clr));
697
698 TRACE("%#lx, %p, %p.\n", clr, hpal, pColorRef);
699
700 /*
701 * In case pColorRef is NULL, provide our own to simplify the code.
702 */
703 if (pColorRef == NULL)
704 pColorRef = &colorref;
705
706 switch (b)
707 {
708 case 0x00:
709 {
710 if (hpal != 0)
711 *pColorRef = PALETTERGB(GetRValue(clr),
712 GetGValue(clr),
713 GetBValue(clr));
714 else
715 *pColorRef = clr;
716
717 break;
718 }
719
720 case 0x01:
721 {
722 if (hpal != 0)
723 {
724 PALETTEENTRY pe;
725 /*
726 * Validate the palette index.
727 */
728 if (GetPaletteEntries(hpal, LOWORD(clr), 1, &pe) == 0)
729 return E_INVALIDARG;
730 }
731
732 *pColorRef = clr;
733
734 break;
735 }
736
737 case 0x02:
738 *pColorRef = clr;
739 break;
740
741 case 0x80:
742 {
743 int index = LOBYTE(LOWORD(clr));
744
745 /*
746 * Validate GetSysColor index.
747 */
748 if ((index < COLOR_SCROLLBAR) || (index > COLOR_MENUBAR))
749 return E_INVALIDARG;
750
751 *pColorRef = GetSysColor(index);
752
753 break;
754 }
755
756 default:
757 return E_INVALIDARG;
758 }
759
760 return S_OK;
761}
762
767
769 IUnknown *outer, REFIID iid, IRpcProxyBuffer **proxy, void **obj);
772
774{
775 ULONG size;
776 DWORD mask;
777 GUID iid;
779 GUID tlbid;
780 GUID base;
783};
784
786{
797};
798
800{
801 struct ifacepsredirect_data *iface;
802 struct tlibredirect_data *tlib;
803 ACTCTX_SECTION_KEYED_DATA data;
804 WCHAR *ptrW;
805
806 data.cbSize = sizeof(data);
807 if (!FindActCtxSectionGuid(0, NULL, ACTIVATION_CONTEXT_SECTION_COM_INTERFACE_REDIRECTION,
808 iid, &data))
809 return FALSE;
810
811 iface = (struct ifacepsredirect_data *)data.lpData;
812 if (!FindActCtxSectionGuid(0, NULL, ACTIVATION_CONTEXT_SECTION_COM_TYPE_LIBRARY_REDIRECTION,
813 &iface->tlbid, &data))
814 return FALSE;
815
816 tlib = (struct tlibredirect_data *)data.lpData;
817 ptrW = (WCHAR *)((BYTE *)data.lpSectionBase + tlib->name_offset);
818
819 if (tlib->name_len/sizeof(WCHAR) >= len)
820 {
821 ERR("need larger module buffer, %lu.\n", tlib->name_len);
822 return FALSE;
823 }
824
825 memcpy(module, ptrW, tlib->name_len);
826 module[tlib->name_len/sizeof(WCHAR)] = 0;
827 return TRUE;
828}
829
831{
832 REGSAM opposite = (sizeof(void*) == 8) ? KEY_WOW64_32KEY : KEY_WOW64_64KEY;
833 char tlguid[200], typelibkey[316], interfacekey[300], ver[100], tlfn[260];
834 DWORD tlguidlen, verlen, type;
835 LONG tlfnlen, err;
837 HKEY ikey;
838
839 sprintf( interfacekey, "Interface\\{%08lx-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x}\\Typelib",
840 iid->Data1, iid->Data2, iid->Data3,
841 iid->Data4[0], iid->Data4[1], iid->Data4[2], iid->Data4[3],
842 iid->Data4[4], iid->Data4[5], iid->Data4[6], iid->Data4[7]
843 );
844
845 err = RegOpenKeyExA(HKEY_CLASSES_ROOT,interfacekey,0,KEY_READ,&ikey);
846 if (err && (opposite == KEY_WOW64_32KEY || (IsWow64Process(GetCurrentProcess(), &is_wow64)
847 && is_wow64)))
848 err = RegOpenKeyExA(HKEY_CLASSES_ROOT,interfacekey,0,KEY_READ|opposite,&ikey);
849
850 if (err)
851 {
852 ERR("No %s key found.\n", interfacekey);
853 return E_FAIL;
854 }
855
856 tlguidlen = sizeof(tlguid);
857 if (RegQueryValueExA(ikey, NULL, NULL, &type, (BYTE *)tlguid, &tlguidlen))
858 {
859 ERR("Getting typelib guid failed.\n");
860 RegCloseKey(ikey);
861 return E_FAIL;
862 }
863
864 verlen = sizeof(ver);
865 if (RegQueryValueExA(ikey, "Version", NULL, &type, (BYTE *)ver, &verlen))
866 {
867 ERR("Could not get version value?\n");
868 RegCloseKey(ikey);
869 return E_FAIL;
870 }
871
872 RegCloseKey(ikey);
873
874#ifndef __REACTOS__
875 sprintf(typelibkey, "Typelib\\%s\\%s\\0\\win%u", tlguid, ver, sizeof(void *) == 8 ? 64 : 32);
876#else
877 snprintf(typelibkey, sizeof(typelibkey), "Typelib\\%s\\%s\\0\\win%u", tlguid, ver, sizeof(void *) == 8 ? 64 : 32);
878#endif /* __REACTOS__ */
879 tlfnlen = sizeof(tlfn);
880 if (RegQueryValueA(HKEY_CLASSES_ROOT, typelibkey, tlfn, &tlfnlen))
881 {
882#ifdef _WIN64
883 sprintf(typelibkey, "Typelib\\%s\\%s\\0\\win32", tlguid, ver);
884 tlfnlen = sizeof(tlfn);
885 if (RegQueryValueA(HKEY_CLASSES_ROOT, typelibkey, tlfn, &tlfnlen))
886 {
887#endif
888 ERR("Could not get typelib fn?\n");
889 return E_FAIL;
890#ifdef _WIN64
891 }
892#endif
893 }
894 MultiByteToWideChar(CP_ACP, 0, tlfn, -1, module, len);
895 return S_OK;
896}
897
899{
902 HRESULT hr;
903
904 *typeinfo = NULL;
905
906 module[0] = 0;
908 {
910 if (FAILED(hr))
911 return hr;
912 }
913
915 if (hr != S_OK) {
916 ERR("Failed to load typelib for %s, but it should be there.\n", debugstr_guid(iid));
917 return hr;
918 }
919
920 hr = ITypeLib_GetTypeInfoOfGuid(typelib, iid, typeinfo);
921 ITypeLib_Release(typelib);
922 if (hr != S_OK)
923 ERR("typelib does not contain info for %s\n", debugstr_guid(iid));
924
925 return hr;
926}
927
929{
930 if (IsEqualIID(iid, &IID_IPSFactoryBuffer) || IsEqualIID(iid, &IID_IUnknown))
931 {
932 *out = iface;
933 return S_OK;
934 }
935
936 FIXME("No interface for %s.\n", debugstr_guid(iid));
937 *out = NULL;
938 return E_NOINTERFACE;
939}
940
942{
943 return 2;
944}
945
947{
948 return 1;
949}
950
952{
954 HRESULT hr;
955
956 hr = OLEAUTPS_DllGetClassObject(&CLSID_PSFactoryBuffer, &IID_IPSFactoryBuffer, (void **)&factory);
957 if (FAILED(hr)) return hr;
958
959 hr = IPSFactoryBuffer_CreateProxy(factory, outer, &IID_IDispatch, proxy, out);
960 IPSFactoryBuffer_Release(factory);
961 return hr;
962}
963
965 IUnknown *outer, REFIID iid, IRpcProxyBuffer **proxy, void **out)
966{
968 TYPEATTR *attr;
969 HRESULT hr;
970
971 if (IsEqualGUID(iid, &IID_IDispatch))
973
975 if (FAILED(hr)) return hr;
976
977 hr = ITypeInfo_GetTypeAttr(typeinfo, &attr);
978 if (FAILED(hr))
979 {
980 ITypeInfo_Release(typeinfo);
981 return hr;
982 }
983
984 if (attr->typekind == TKIND_INTERFACE || (attr->wTypeFlags & TYPEFLAG_FDUAL))
986 else
988
989 if (FAILED(hr))
990 ERR("Failed to create proxy, hr %#lx.\n", hr);
991
992 ITypeInfo_ReleaseTypeAttr(typeinfo, attr);
993 ITypeInfo_Release(typeinfo);
994 return hr;
995}
996
998{
1000 HRESULT hr;
1001
1002 hr = OLEAUTPS_DllGetClassObject(&CLSID_PSFactoryBuffer, &IID_IPSFactoryBuffer, (void **)&factory);
1003 if (FAILED(hr)) return hr;
1004
1005 hr = IPSFactoryBuffer_CreateStub(factory, &IID_IDispatch, server, stub);
1006 IPSFactoryBuffer_Release(factory);
1007 return hr;
1008}
1009
1011{
1014};
1015
1017{
1018 return CONTAINING_RECORD(&iface->lpVtbl, struct dispinterface_stub, stub_buffer.lpVtbl);
1019}
1020
1022{
1024 unsigned int refcount = InterlockedDecrement(&stub->stub_buffer.RefCount);
1025
1026 TRACE("%p decreasing refcount to %u.\n", stub, refcount);
1027
1028 if (!refcount)
1029 {
1030 /* Copied from NdrCStdStubBuffer_Release(), but supposedly incorrect
1031 * according to the comment there. */
1032 IRpcStubBuffer_Disconnect(iface);
1033
1034 free(stub);
1035 }
1036 return refcount;
1037}
1038
1040
1042{
1043 CInterfaceStubVtbl *const *vtbl;
1044
1045 for (vtbl = oleaut32_oaidl_ProxyFileInfo.pStubVtblList; *vtbl; ++vtbl)
1046 {
1047 if (IsEqualGUID((*vtbl)->header.piid, &IID_IDispatch))
1048 return *vtbl;
1049 }
1050
1051 assert(0);
1052 return NULL;
1053}
1054
1055/* Normal dispinterfaces have an IID specified by the IDL compiler as DIID_*,
1056 * but are otherwise identical to IDispatch. Unfortunately, such interfaces may
1057 * not actually support IDispatch in QueryInterface.
1058 *
1059 * This becomes a problem, since CreateStub() was designed such that, for some
1060 * reason, the caller need not actually pass the interface matching "iid". As
1061 * such the standard rpcrt4 implementation will query the server for the
1062 * relevant IID.
1063 *
1064 * This means that we cannot just pass IID_IDispatch with the object, even
1065 * though it is in theory an IDispatch. However, while the standard stub
1066 * constructor is not exported from rpcrt4, all of the vtbl methods are, and
1067 * the type is public, so we *can* manually create it ourselves, bypassing the
1068 * QueryInterface check.
1069 *
1070 * This relies on some rpcrt4 implementation details.
1071 */
1073{
1075 struct dispinterface_stub *object;
1076 void *dispatch;
1077 HRESULT hr;
1078
1079 if (!(object = calloc(1, sizeof(*object))))
1080 return E_OUTOFMEMORY;
1081
1082 /* It's possible we can just assume that "server" is already the
1083 * dispinterface type—we don't have tests for this—but since rpcrt4 queries
1084 * (which we do have tests for) it makes sense for us to match that
1085 * behaviour. */
1086 if (FAILED(hr = IUnknown_QueryInterface(server, iid, &dispatch)))
1087 {
1088 ERR("Object does not support interface %s.\n", debugstr_guid(iid));
1089 free(object);
1090 return hr;
1091 }
1092
1093 object->stub_vtbl.header = stub_vtbl->header;
1094 object->stub_vtbl.Vtbl.QueryInterface = CStdStubBuffer_QueryInterface;
1095 object->stub_vtbl.Vtbl.AddRef = CStdStubBuffer_AddRef;
1096 object->stub_vtbl.Vtbl.Release = dispinterface_stub_Release;
1097 object->stub_vtbl.Vtbl.Connect = CStdStubBuffer_Connect;
1098 object->stub_vtbl.Vtbl.Disconnect = CStdStubBuffer_Disconnect;
1099 object->stub_vtbl.Vtbl.Invoke = CStdStubBuffer_Invoke;
1100 object->stub_vtbl.Vtbl.IsIIDSupported = CStdStubBuffer_IsIIDSupported;
1101 object->stub_vtbl.Vtbl.CountRefs = CStdStubBuffer_CountRefs;
1102 object->stub_vtbl.Vtbl.DebugServerQueryInterface = CStdStubBuffer_DebugServerQueryInterface;
1103 object->stub_vtbl.Vtbl.DebugServerRelease = CStdStubBuffer_DebugServerRelease;
1104 object->stub_buffer.lpVtbl = &object->stub_vtbl.Vtbl;
1105 object->stub_buffer.RefCount = 1;
1106 object->stub_buffer.pvServerObject = dispatch;
1107 /* rpcrt4 will also fill pPSFactory, but it never uses it except in the
1108 * Release method (which we reimplement). It's only to keep a reference to
1109 * the module to implement NdrDllCanUnloadNow(). We use the default
1110 * DllCanUnloadNow() from winecrt0, which always returns S_FALSE, so don't
1111 * bother filling pPSFactory. */
1112
1113 TRACE("Created stub %p.\n", object);
1114 *stub = (IRpcStubBuffer *)&object->stub_buffer.lpVtbl;
1115 return S_OK;
1116}
1117
1120{
1122 TYPEATTR *attr;
1123 HRESULT hr;
1124
1125 if (IsEqualGUID(iid, &IID_IDispatch))
1127
1129 if (FAILED(hr)) return hr;
1130
1131 hr = ITypeInfo_GetTypeAttr(typeinfo, &attr);
1132 if (FAILED(hr))
1133 {
1134 ITypeInfo_Release(typeinfo);
1135 return hr;
1136 }
1137
1138 if (attr->typekind == TKIND_INTERFACE || (attr->wTypeFlags & TYPEFLAG_FDUAL))
1140 else
1142
1143 if (FAILED(hr))
1144 ERR("Failed to create stub, hr %#lx.\n", hr);
1145
1146 ITypeInfo_ReleaseTypeAttr(typeinfo, attr);
1147 ITypeInfo_Release(typeinfo);
1148 return hr;
1149}
1150
1151static const IPSFactoryBufferVtbl dispatch_typelib_ps_vtbl =
1152{
1158};
1159
1161
1162extern void _get_STDFONT_CF(LPVOID *);
1163extern void _get_STDPIC_CF(LPVOID *);
1164
1165/***********************************************************************
1166 * DllGetClassObject (OLEAUT32.@)
1167 */
1169{
1170 *ppv = NULL;
1171 if (IsEqualGUID(rclsid,&CLSID_StdFont)) {
1172 if (IsEqualGUID(iid,&IID_IClassFactory)) {
1174 IClassFactory_AddRef((IClassFactory*)*ppv);
1175 return S_OK;
1176 }
1177 }
1178 if (IsEqualGUID(rclsid,&CLSID_StdPicture)) {
1179 if (IsEqualGUID(iid,&IID_IClassFactory)) {
1181 IClassFactory_AddRef((IClassFactory*)*ppv);
1182 return S_OK;
1183 }
1184 }
1185
1186 if (IsEqualGUID(rclsid, &CLSID_PSDispatch) || IsEqualGUID(rclsid, &CLSID_PSOAInterface))
1187 return IPSFactoryBuffer_QueryInterface(&dispatch_typelib_ps, iid, ppv);
1188
1189 if (IsEqualCLSID(rclsid, &CLSID_PSTypeComp) ||
1190 IsEqualCLSID(rclsid, &CLSID_PSTypeInfo) ||
1191 IsEqualCLSID(rclsid, &CLSID_PSTypeLib) ||
1192 IsEqualCLSID(rclsid, &CLSID_PSDispatch) ||
1193 IsEqualCLSID(rclsid, &CLSID_PSEnumVariant))
1195
1196 return OLEAUTPS_DllGetClassObject(rclsid, iid, ppv);
1197}
1198
1199/*****************************************************************************
1200 * DllMain [OLEAUT32.@]
1201 */
1203{
1206
1207 return OLEAUTPS_DllMain( hInstDll, fdwReason, lpvReserved );
1208}
1209
1210/***********************************************************************
1211 * DllRegisterServer (OLEAUT32.@)
1212 */
1214{
1216}
1217
1218/***********************************************************************
1219 * DllUnregisterServer (OLEAUT32.@)
1220 */
1222{
1224}
1225
1226/***********************************************************************
1227 * OleIconToCursor (OLEAUT32.415)
1228 */
1230{
1231 FIXME("(%p,%p), partially implemented.\n",hinstExe,hIcon);
1232 /* FIXME: make an extended conversation from HICON to HCURSOR */
1233 return CopyCursor(hIcon);
1234}
1235
1236/***********************************************************************
1237 * GetAltMonthNames (OLEAUT32.@)
1238 */
1240{
1241 static const WCHAR *arabic_hijri[] =
1242 {
1243 L"\x0645\x062d\x0631\x0645",
1244 L"\x0635\x0641\x0631",
1245 L"\x0631\x0628\x064a\x0639 \x0627\x0644\x0627\x0648\x0644",
1246 L"\x0631\x0628\x064a\x0639 \x0627\x0644\x062b\x0627\x0646\x064a",
1247 L"\x062c\x0645\x0627\x062f\x0649 \x0627\x0644\x0627\x0648\x0644\x0649",
1248 L"\x062c\x0645\x0627\x062f\x0649 \x0627\x0644\x062b\x0627\x0646\x064a\x0629",
1249 L"\x0631\x062c\x0628",
1250 L"\x0634\x0639\x0628\x0627\x0646",
1251 L"\x0631\x0645\x0636\x0627\x0646",
1252 L"\x0634\x0648\x0627\x0643",
1253 L"\x0630\x0648 \x0627\x0644\x0642\x0639\x062f\x0629",
1254 L"\x0630\x0648 \x0627\x0644\x062d\x062c\x0629",
1255 NULL
1256 };
1257
1258 static const WCHAR *polish_genitive_names[] =
1259 {
1260 L"stycznia",
1261 L"lutego",
1262 L"marca",
1263 L"kwietnia",
1264 L"maja",
1265 L"czerwca",
1266 L"lipca",
1267 L"sierpnia",
1268 L"wrze\x015bnia",
1269 L"pa\x017a" "dziernika",
1270 L"listopada",
1271 L"grudnia",
1272 NULL
1273 };
1274
1275 static const WCHAR *russian_genitive_names[] =
1276 {
1277 L"\x044f\x043d\x0432\x0430\x0440\x044f",
1278 L"\x0444\x0435\x0432\x0440\x0430\x043b\x044f",
1279 L"\x043c\x0430\x0440\x0442\x0430",
1280 L"\x0430\x043f\x0440\x0435\x043b\x044f",
1281 L"\x043c\x0430\x044f",
1282 L"\x0438\x044e\x043d\x044f",
1283 L"\x0438\x044e\x043b\x044f",
1284 L"\x0430\x0432\x0433\x0443\x0441\x0442\x0430",
1285 L"\x0441\x0435\x043d\x0442\x044f\x0431\x0440\x044f",
1286 L"\x043e\x043a\x0442\x044f\x0431\x0440\x044f",
1287 L"\x043d\x043e\x044f\x0431\x0440\x044f",
1288 L"\x0434\x0435\x043a\x0430\x0431\x0440\x044f",
1289 NULL
1290 };
1291
1292 TRACE("%#lx, %p.\n", lcid, str);
1293
1295 *str = (LPOLESTR *)arabic_hijri;
1297 *str = (LPOLESTR *)polish_genitive_names;
1299 *str = (LPOLESTR *)russian_genitive_names;
1300 else
1301 *str = NULL;
1302
1303 return S_OK;
1304}
#define DECLSPEC_HOTPATCH
Definition: _mingw.h:240
static DWORD const fdwReason
#define InterlockedDecrement
Definition: armddk.h:52
#define WINE_DEFAULT_DEBUG_CHANNEL(t)
Definition: precomp.h:23
#define ARRAY_SIZE(A)
Definition: main.h:20
void dispatch(HANDLE hStopEvent)
Definition: dispatch.c:70
#define FIXME(fmt,...)
Definition: precomp.h:53
#define ERR(fmt,...)
Definition: precomp.h:57
const GUID IID_IUnknown
const GUID IID_IClassFactory
#define RegCloseKey(hKey)
Definition: registry.h:49
#define E_OUTOFMEMORY
Definition: ddrawi.h:100
#define E_INVALIDARG
Definition: ddrawi.h:101
#define E_FAIL
Definition: ddrawi.h:102
#define free
Definition: debug_ros.c:5
#define malloc
Definition: debug_ros.c:4
HRESULT hr
Definition: delayimp.cpp:582
static LPVOID LPUNKNOWN
Definition: dinput.c:53
#define NULL
Definition: types.h:112
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
LONG WINAPI RegOpenKeyExA(_In_ HKEY hKey, _In_ LPCSTR lpSubKey, _In_ DWORD ulOptions, _In_ REGSAM samDesired, _Out_ PHKEY phkResult)
Definition: reg.c:3298
LSTATUS WINAPI RegQueryValueA(HKEY hkey, LPCSTR name, LPSTR data, LPLONG count)
Definition: reg.c:4212
LONG WINAPI RegQueryValueExA(_In_ HKEY hkeyorg, _In_ LPCSTR name, _In_ LPDWORD reserved, _Out_opt_ LPDWORD type, _Out_opt_ LPBYTE data, _Inout_opt_ LPDWORD count)
Definition: reg.c:4009
INT WINAPI StringFromGUID2(REFGUID guid, LPOLESTR str, INT cmax)
Definition: combase.c:1525
void *WINAPI CoTaskMemAlloc(SIZE_T size)
Definition: malloc.c:381
void *WINAPI CoTaskMemRealloc(void *ptr, SIZE_T size)
Definition: malloc.c:397
void WINAPI CoTaskMemFree(void *ptr)
Definition: malloc.c:389
HRESULT WINAPI CoGetMalloc(DWORD context, IMalloc **imalloc)
Definition: malloc.c:365
#define DLL_PROCESS_ATTACH
Definition: compat.h:131
#define CP_ACP
Definition: compat.h:109
#define GetEnvironmentVariableW(x, y, z)
Definition: compat.h:755
WCHAR OLECHAR
Definition: compat.h:2292
OLECHAR * BSTR
Definition: compat.h:2293
#define GetCurrentProcess()
Definition: compat.h:759
#define IsWow64Process
Definition: compat.h:760
#define MAX_PATH
Definition: compat.h:34
#define WINE_DECLARE_DEBUG_CHANNEL(x)
Definition: compat.h:45
#define MultiByteToWideChar
Definition: compat.h:110
#define lstrlenW
Definition: compat.h:750
BOOL WINAPI FindActCtxSectionGuid(DWORD dwFlags, const GUID *lpExtGuid, ULONG ulId, const GUID *lpSearchGuid, PACTCTX_SECTION_KEYED_DATA pInfo)
Definition: actctx.c:265
LCID lcid
Definition: locale.c:5660
DWORD WINAPI GetVersion(void)
Definition: version.c:1458
#define assert(_expr)
Definition: assert.h:32
#define UINT_MAX
Definition: limits.h:27
HRESULT WINAPI GetRunningObjectTable(DWORD reserved, IRunningObjectTable **ret)
Definition: moniker.c:729
HRESULT WINAPI LoadTypeLib(const OLECHAR *szFile, ITypeLib **pptLib)
Definition: typelib.c:434
ULONG WINAPI CStdStubBuffer_CountRefs(LPRPCSTUBBUFFER iface)
Definition: cstub.c:326
void WINAPI CStdStubBuffer_DebugServerRelease(LPRPCSTUBBUFFER iface, LPVOID pv)
Definition: cstub.c:341
HRESULT WINAPI CStdStubBuffer_QueryInterface(LPRPCSTUBBUFFER iface, REFIID riid, LPVOID *obj)
Definition: cstub.c:185
ULONG WINAPI CStdStubBuffer_AddRef(LPRPCSTUBBUFFER iface)
Definition: cstub.c:203
void WINAPI CStdStubBuffer_Disconnect(LPRPCSTUBBUFFER iface)
Definition: cstub.c:270
LPRPCSTUBBUFFER WINAPI CStdStubBuffer_IsIIDSupported(LPRPCSTUBBUFFER iface, REFIID riid)
Definition: cstub.c:314
HRESULT WINAPI CStdStubBuffer_Invoke(LPRPCSTUBBUFFER iface, PRPCOLEMESSAGE pMsg, LPRPCCHANNELBUFFER pChannel)
Definition: cstub.c:282
HRESULT WINAPI CStdStubBuffer_DebugServerQueryInterface(LPRPCSTUBBUFFER iface, LPVOID *ppv)
Definition: cstub.c:333
HRESULT WINAPI CStdStubBuffer_Connect(LPRPCSTUBBUFFER iface, LPUNKNOWN lpUnkServer)
Definition: cstub.c:254
#define GetBValue(quad)
Definition: precomp.h:71
#define GetGValue(quad)
Definition: precomp.h:70
#define GetRValue(quad)
Definition: precomp.h:69
return ret
Definition: mutex.c:146
#define L(x)
Definition: resources.c:13
r reserved
Definition: btrfs.c:3006
unsigned short WORD
Definition: ntddk_ex.h:93
unsigned int BOOL
Definition: ntddk_ex.h:94
unsigned long DWORD
Definition: ntddk_ex.h:95
int proxy
Definition: main.c:67
GLuint GLuint GLsizei GLenum type
Definition: gl.h:1545
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl.h:1950
GLdouble n
Definition: glext.h:7729
GLsizeiptr size
Definition: glext.h:5919
GLuint index
Definition: glext.h:6031
GLboolean GLboolean GLboolean b
Definition: glext.h:6204
GLenum GLuint GLenum GLsizei const GLchar * buf
Definition: glext.h:7751
GLenum GLsizei len
Definition: glext.h:6722
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble * u
Definition: glfuncs.h:240
unsigned int UINT
Definition: sysinfo.c:13
REFIID LPVOID * ppv
Definition: atlbase.h:39
ULONG AddRef()
#define S_OK
Definition: intsafe.h:52
#define SUCCEEDED(hr)
Definition: intsafe.h:50
#define FAILED(hr)
Definition: intsafe.h:51
HRESULT WINAPI CreateItemMoniker(const WCHAR *delimiter, const WCHAR *name, IMoniker **ret)
Definition: itemmoniker.c:932
#define LOBYTE(W)
Definition: jmemdos.c:487
#define HIBYTE(W)
Definition: jmemdos.c:486
#define debugstr_guid
Definition: kernel32.h:35
#define debugstr_wn
Definition: kernel32.h:33
BOOL is_wow64
Definition: main.c:38
USHORT LANGID
Definition: mui.h:9
if(dx< 0)
Definition: linetemp.h:194
static IN DWORD IN LPVOID lpvReserved
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
#define memmove(s1, s2, n)
Definition: mkisofs.h:881
#define WARN_ON(c)
Definition: module.h:257
static PVOID ptr
Definition: dispmode.c:27
#define sprintf
Definition: sprintf.c:45
static HICON
Definition: imagelist.c:80
static IUnknown * outer
Definition: compobj.c:82
static const CLSID CLSID_StdFont
Definition: compobj.c:92
HICON hIcon
Definition: msconfig.c:44
_In_ LPWSTR _In_ DWORD _In_ DWORD _In_ DWORD dwFlags
Definition: netsh.h:141
#define KEY_READ
Definition: nt_native.h:1026
interface IMoniker * LPMONIKER
Definition: objfwd.h:9
interface IRunningObjectTable * LPRUNNINGOBJECTTABLE
Definition: objfwd.h:17
static HRESULT dispatch_create_proxy(IUnknown *outer, IRpcProxyBuffer **proxy, void **out)
Definition: oleaut.c:951
HRESULT WINAPI OleTranslateColor(OLE_COLOR clr, HPALETTE hpal, COLORREF *pColorRef)
Definition: oleaut.c:690
static struct dispinterface_stub * impl_from_IRpcStubBuffer(IRpcStubBuffer *iface)
Definition: oleaut.c:1016
HRESULT WINAPI DECLSPEC_HOTPATCH RevokeActiveObject(DWORD xregister, LPVOID reserved)
Definition: oleaut.c:564
HRESULT WINAPI DECLSPEC_HOTPATCH GetActiveObject(REFCLSID rcid, LPVOID preserved, LPUNKNOWN *ppunk)
Definition: oleaut.c:591
HRESULT WINAPI DllRegisterServer(void)
Definition: oleaut.c:1213
static const IPSFactoryBufferVtbl dispatch_typelib_ps_vtbl
Definition: oleaut.c:1151
void _get_STDPIC_CF(LPVOID *)
Definition: olepicture.c:2594
static size_t bstr_alloc_size(size_t size)
Definition: oleaut.c:113
static BOOL actctx_get_typelib_module(REFIID iid, WCHAR *module, DWORD len)
Definition: oleaut.c:799
#define BUCKET_SIZE
Definition: oleaut.c:98
UINT WINAPI SysStringByteLen(BSTR str)
Definition: oleaut.c:217
static bstr_cache_entry_t * get_cache_entry_from_idx(unsigned cache_idx)
Definition: oleaut.c:123
void _get_STDFONT_CF(LPVOID *)
Definition: olefont.c:2138
static HRESULT get_typeinfo_for_iid(REFIID iid, ITypeInfo **typeinfo)
Definition: oleaut.c:898
static ULONG WINAPI dispatch_typelib_ps_AddRef(IPSFactoryBuffer *iface)
Definition: oleaut.c:941
static bstr_cache_entry_t bstr_cache[0x10000/BUCKET_SIZE]
Definition: oleaut.c:111
HRESULT WINAPI OLEAUTPS_DllGetClassObject(REFCLSID, REFIID, LPVOID *)
const ExtendedProxyFileInfo oleaut32_oaidl_ProxyFileInfo
HRESULT WINAPI OLEAUTPS_DllRegisterServer(void)
static HRESULT WINAPI dispatch_typelib_ps_CreateProxy(IPSFactoryBuffer *iface, IUnknown *outer, REFIID iid, IRpcProxyBuffer **proxy, void **out)
Definition: oleaut.c:964
HRESULT WINAPI OLEAUTPS_DllUnregisterServer(void)
static bstr_t * alloc_bstr(size_t size)
Definition: oleaut.c:142
static bstr_t * bstr_from_str(BSTR str)
Definition: oleaut.c:118
HRESULT WINAPI GetAltMonthNames(LCID lcid, LPOLESTR **str)
Definition: oleaut.c:1239
BSTR WINAPI SysAllocString(LPCOLESTR str)
Definition: oleaut.c:240
INT WINAPI SysReAllocString(LPBSTR old, LPCOLESTR str)
Definition: oleaut.c:469
UINT WINAPI SysStringLen(BSTR str)
Definition: oleaut.c:198
#define ARENA_FREE_FILLER
Definition: oleaut.c:109
void WINAPI DECLSPEC_HOTPATCH SysFreeString(BSTR str)
Definition: oleaut.c:273
HRESULT WINAPI DllUnregisterServer(void)
Definition: oleaut.c:1221
HCURSOR WINAPI OleIconToCursor(HINSTANCE hinstExe, HICON hIcon)
Definition: oleaut.c:1229
static BOOL bstr_cache_enabled
Definition: oleaut.c:75
HRESULT WINAPI CreateStubFromTypeInfo(ITypeInfo *typeinfo, REFIID iid, IUnknown *server, IRpcStubBuffer **stub)
Definition: ndr_typelib.c:1693
BOOL WINAPI OLEAUTPS_DllMain(HINSTANCE, DWORD, LPVOID)
static HRESULT reg_get_typelib_module(REFIID iid, WCHAR *module, DWORD len)
Definition: oleaut.c:830
static bstr_cache_entry_t * get_cache_entry_from_alloc_size(SIZE_T alloc_size)
Definition: oleaut.c:134
int WINAPI SysReAllocStringLen(BSTR *old, const OLECHAR *str, unsigned int len)
Definition: oleaut.c:385
static ULONG WINAPI dispatch_typelib_ps_Release(IPSFactoryBuffer *iface)
Definition: oleaut.c:946
static bstr_cache_entry_t * get_cache_entry(size_t size)
Definition: oleaut.c:128
static IMalloc * get_malloc(void)
Definition: oleaut.c:248
static CRITICAL_SECTION cs_bstr_cache
Definition: oleaut.c:77
static HRESULT dispatch_create_stub(IUnknown *server, IRpcStubBuffer **stub)
Definition: oleaut.c:997
static CRITICAL_SECTION_DEBUG cs_bstr_cache_dbg
Definition: oleaut.c:78
void WINAPI SetOaNoCache(void)
Definition: oleaut.c:504
static HRESULT WINAPI dispatch_typelib_ps_QueryInterface(IPSFactoryBuffer *iface, REFIID iid, void **out)
Definition: oleaut.c:928
#define ARENA_INUSE_FILLER
Definition: oleaut.c:107
static ULONG WINAPI dispinterface_stub_Release(IRpcStubBuffer *iface)
Definition: oleaut.c:1021
BSTR WINAPI DECLSPEC_HOTPATCH SysAllocStringByteLen(LPCSTR str, UINT len)
Definition: oleaut.c:430
#define ARENA_TAIL_FILLER
Definition: oleaut.c:108
static const CInterfaceStubVtbl * find_idispatch_stub_vtbl(void)
Definition: oleaut.c:1041
static HRESULT WINAPI dispatch_typelib_ps_CreateStub(IPSFactoryBuffer *iface, REFIID iid, IUnknown *server, IRpcStubBuffer **stub)
Definition: oleaut.c:1118
static HRESULT dispinterface_create_stub(IUnknown *server, const GUID *iid, IRpcStubBuffer **stub)
Definition: oleaut.c:1072
HRESULT WINAPI DllGetClassObject(REFCLSID rclsid, REFIID iid, LPVOID *ppv)
Definition: oleaut.c:1168
HRESULT WINAPI DECLSPEC_HOTPATCH RegisterActiveObject(LPUNKNOWN punk, REFCLSID rcid, DWORD dwFlags, LPDWORD pdwRegister)
Definition: oleaut.c:525
BSTR WINAPI SysAllocStringLen(const OLECHAR *str, unsigned int len)
Definition: oleaut.c:341
HRESULT WINAPI CreateProxyFromTypeInfo(ITypeInfo *typeinfo, IUnknown *outer, REFIID iid, IRpcProxyBuffer **proxy, void **obj)
Definition: ndr_typelib.c:1556
BOOL WINAPI DllMain(HINSTANCE hInstDll, DWORD fdwReason, LPVOID lpvReserved)
Definition: oleaut.c:1202
static IPSFactoryBuffer dispatch_typelib_ps
Definition: oleaut.c:1160
#define BUCKET_BUFFER_SIZE
Definition: oleaut.c:99
ULONG WINAPI OaBuildVersion(void)
Definition: oleaut.c:643
#define ACTIVEOBJECT_WEAK
Definition: oleauto.h:182
const GUID CLSID_StdPicture
const GUID IID_IDispatch
#define LOWORD(l)
Definition: pedump.c:82
short WCHAR
Definition: pedump.c:58
long LONG
Definition: pedump.c:60
#define IsEqualGUID(rguid1, rguid2)
Definition: guiddef.h:147
#define IsEqualIID(riid1, riid2)
Definition: guiddef.h:95
#define REFIID
Definition: guiddef.h:118
#define REFCLSID
Definition: guiddef.h:117
#define IsEqualCLSID(rclsid1, rclsid2)
Definition: guiddef.h:96
_In_opt_ IUnknown * punk
Definition: shlwapi.h:158
#define err(...)
#define calloc
Definition: rosglue.h:14
const WCHAR * str
#define LANG_POLISH
Definition: nls.h:107
#define LANGIDFROMLCID(l)
Definition: nls.h:18
#define LANG_RUSSIAN
Definition: nls.h:113
#define LANG_ARABIC
Definition: nls.h:29
DWORD LCID
Definition: nls.h:13
#define PRIMARYLANGID(l)
Definition: nls.h:16
#define WARN_(ch,...)
Definition: debug.h:157
#define memset(x, y, z)
Definition: compat.h:39
#define TRACE(s)
Definition: solgame.cpp:4
Definition: stubgen.c:11
Definition: cookie.c:202
Definition: oleaut.c:101
unsigned short head
Definition: oleaut.c:102
unsigned short cnt
Definition: oleaut.c:103
Definition: oleaut.c:86
char ptr[1]
Definition: oleaut.c:92
DWORD dwptr[1]
Definition: oleaut.c:94
WCHAR str[1]
Definition: oleaut.c:93
union bstr_t::@557 u
DWORD size
Definition: oleaut.c:90
Definition: svc_auth_des.c:77
CInterfaceStubVtbl stub_vtbl
Definition: oleaut.c:1012
CStdStubBuffer stub_buffer
Definition: oleaut.c:1013
Definition: main.c:439
Definition: heap.c:86
Definition: main.c:40
CInterfaceStubHeader header
Definition: rpcproxy.h:99
const IRpcStubBufferVtbl * lpVtbl
Definition: rpcproxy.h:105
const PCInterfaceStubVtblList * pStubVtblList
Definition: rpcproxy.h:48
ULONG name_offset
Definition: oleaut.c:790
ULONG help_len
Definition: oleaut.c:793
ULONG help_offset
Definition: oleaut.c:794
WORD minor_version
Definition: oleaut.c:796
ULONG name_len
Definition: oleaut.c:789
LANGID langid
Definition: oleaut.c:791
WORD major_version
Definition: oleaut.c:795
#define DWORD_PTR
Definition: treelist.c:76
#define UL
Definition: tui.h:164
const char * LPCSTR
Definition: typedefs.h:52
#define FIELD_OFFSET(t, f)
Definition: typedefs.h:255
ULONG_PTR SIZE_T
Definition: typedefs.h:80
uint32_t * LPDWORD
Definition: typedefs.h:59
int32_t INT
Definition: typedefs.h:58
#define MAKELONG(a, b)
Definition: typedefs.h:249
#define CONTAINING_RECORD(address, type, field)
Definition: typedefs.h:260
uint32_t ULONG
Definition: typedefs.h:59
#define HIWORD(l)
Definition: typedefs.h:247
GUID const CLSID_PSFactoryBuffer
static rfbScreenInfoPtr server
Definition: vnc.c:74
wchar_t tm const _CrtWcstime_Writes_and_advances_ptr_ count wchar_t ** out
Definition: wcsftime.cpp:383
@ TKIND_INTERFACE
Definition: widltypes.h:237
UINT WINAPI GetPaletteEntries(HPALETTE hpal, UINT iStartIndex, UINT cEntries, LPPALETTEENTRY ppe)
Definition: palette.c:64
void WINAPI LeaveCriticalSection(LPCRITICAL_SECTION)
void WINAPI EnterCriticalSection(LPCRITICAL_SECTION)
DWORD COLORREF
Definition: windef.h:100
HICON HCURSOR
Definition: windef.h:99
#define WINAPI
Definition: msvc.h:6
#define E_NOINTERFACE
Definition: winerror.h:3479
#define PALETTERGB(r, g, b)
Definition: wingdi.h:3388
ACCESS_MASK REGSAM
Definition: winreg.h:76
#define HKEY_CLASSES_ROOT
Definition: winreg.h:10
#define snprintf
Definition: wintirpc.h:48
DWORD WINAPI GetSysColor(_In_ int)
#define COLOR_SCROLLBAR
Definition: winuser.h:923
#define CopyCursor(c)
Definition: winuser.h:4389
#define KEY_WOW64_32KEY
Definition: cmtypes.h:45
#define KEY_WOW64_64KEY
Definition: cmtypes.h:46
unsigned char BYTE
Definition: xxhash.c:193