ReactOS 0.4.16-dev-2332-g4cba65d
compositemoniker.c
Go to the documentation of this file.
1/*
2 * CompositeMonikers implementation
3 *
4 * Copyright 1999 Noomen Hamza
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 <string.h>
24
25#define COBJMACROS
26
27#include "windef.h"
28#include "winbase.h"
29#include "winuser.h"
30#include "winerror.h"
31#include "ole2.h"
32#include "moniker.h"
33
34#include "wine/debug.h"
35
37
39{
44
47 unsigned int comp_count;
49
51{
52 return CONTAINING_RECORD(iface, CompositeMonikerImpl, IMoniker_iface);
53}
54
55static const IMonikerVtbl VT_CompositeMonikerImpl;
56
58{
59 if (iface->lpVtbl != &VT_CompositeMonikerImpl)
60 return NULL;
61 return CONTAINING_RECORD(iface, CompositeMonikerImpl, IMoniker_iface);
62}
63
65{
66 return CONTAINING_RECORD(iface, CompositeMonikerImpl, IROTData_iface);
67}
68
70{
71 return CONTAINING_RECORD(iface, CompositeMonikerImpl, IMarshal_iface);
72}
73
74typedef struct EnumMonikerImpl
75{
77 LONG ref;
79 unsigned int count;
80 unsigned int pos;
82
84{
85 return CONTAINING_RECORD(iface, EnumMonikerImpl, IEnumMoniker_iface);
86}
87
88static HRESULT create_enumerator(IMoniker **components, unsigned int count, BOOL forward, IEnumMoniker **ret);
90static HRESULT composite_get_leftmost(CompositeMonikerImpl *composite, IMoniker **leftmost);
91
92/*******************************************************************************
93 * CompositeMoniker_QueryInterface
94 *******************************************************************************/
95static HRESULT WINAPI
97{
99
100 TRACE("(%p,%s,%p)\n",This,debugstr_guid(riid),ppvObject);
101
102 /* Perform a sanity check on the parameters.*/
103 if ( ppvObject==0 )
104 return E_INVALIDARG;
105
106 /* Initialize the return parameter */
107 *ppvObject = 0;
108
109 /* Compare the riid with the interface IDs implemented by this object.*/
113 IsEqualIID(&IID_IMoniker, riid)
114 )
115 *ppvObject = iface;
116 else if (IsEqualIID(&IID_IROTData, riid))
117 *ppvObject = &This->IROTData_iface;
118 else if (IsEqualIID(&IID_IMarshal, riid))
119 *ppvObject = &This->IMarshal_iface;
120
121 /* Check that we obtained an interface.*/
122 if ((*ppvObject)==0)
123 return E_NOINTERFACE;
124
125 /* Query Interface always increases the reference count by one when it is successful */
126 IMoniker_AddRef(iface);
127
128 return S_OK;
129}
130
131/******************************************************************************
132 * CompositeMoniker_AddRef
133 ******************************************************************************/
134static ULONG WINAPI
136{
138
139 TRACE("(%p)\n",This);
140
141 return InterlockedIncrement(&This->ref);
142}
143
145{
147 ULONG refcount = InterlockedDecrement(&moniker->ref);
148
149 TRACE("%p, refcount %lu\n", iface, refcount);
150
151 if (!refcount)
152 {
153 if (moniker->left) IMoniker_Release(moniker->left);
154 if (moniker->right) IMoniker_Release(moniker->right);
155 free(moniker);
156 }
157
158 return refcount;
159}
160
161/******************************************************************************
162 * CompositeMoniker_GetClassID
163 ******************************************************************************/
164static HRESULT WINAPI
166{
167 TRACE("(%p,%p)\n",iface,pClassID);
168
169 if (pClassID==NULL)
170 return E_POINTER;
171
172 *pClassID = CLSID_CompositeMoniker;
173
174 return S_OK;
175}
176
177/******************************************************************************
178 * CompositeMoniker_IsDirty
179 ******************************************************************************/
180static HRESULT WINAPI
182{
183 /* Note that the OLE-provided implementations of the IPersistStream::IsDirty
184 method in the OLE-provided moniker interfaces always return S_FALSE because
185 their internal state never changes. */
186
187 TRACE("(%p)\n",iface);
188
189 return S_FALSE;
190}
191
193{
195 IMoniker *last, *m, *c;
196 DWORD i, count;
197 HRESULT hr;
198
199 TRACE("%p, %p\n", iface, stream);
200
201 if (moniker->comp_count)
202 return E_UNEXPECTED;
203
204 hr = IStream_Read(stream, &count, sizeof(DWORD), NULL);
205 if (hr != S_OK)
206 {
207 WARN("Failed to read component count, hr %#lx.\n", hr);
208 return hr;
209 }
210
211 if (count < 2)
212 {
213 WARN("Unexpected component count %lu.\n", count);
214 return E_UNEXPECTED;
215 }
216
217 if (FAILED(hr = OleLoadFromStream(stream, &IID_IMoniker, (void **)&last)))
218 return hr;
219
220 for (i = 1; i < count - 1; ++i)
221 {
222 if (FAILED(hr = OleLoadFromStream(stream, &IID_IMoniker, (void **)&m)))
223 {
224 WARN("Failed to initialize component %lu, hr %#lx.\n", i, hr);
225 IMoniker_Release(last);
226 return hr;
227 }
229 IMoniker_Release(last);
230 IMoniker_Release(m);
231 if (FAILED(hr)) return hr;
232 last = c;
233 }
234
235 if (FAILED(hr = OleLoadFromStream(stream, &IID_IMoniker, (void **)&m)))
236 {
237 IMoniker_Release(last);
238 return hr;
239 }
240
241 moniker->left = last;
242 moniker->right = m;
243 moniker->comp_count = count;
244
245 return hr;
246}
247
249{
250 CompositeMonikerImpl *comp_moniker;
251 HRESULT hr;
252
253 if ((comp_moniker = unsafe_impl_from_IMoniker(moniker)))
254 {
255 if (SUCCEEDED(hr = composite_save_components(comp_moniker->left, stream)))
256 hr = composite_save_components(comp_moniker->right, stream);
257 }
258 else
260
261 return hr;
262}
263
265{
267 HRESULT hr;
268
269 TRACE("%p, %p, %d\n", iface, stream, clear_dirty);
270
271 if (!moniker->comp_count)
272 return E_UNEXPECTED;
273
274 hr = IStream_Write(stream, &moniker->comp_count, sizeof(moniker->comp_count), NULL);
275 if (FAILED(hr)) return hr;
276
277 return composite_save_components(iface, stream);
278}
279
280/******************************************************************************
281 * CompositeMoniker_GetSizeMax
282 ******************************************************************************/
283static HRESULT WINAPI
285{
286 IEnumMoniker *enumMk;
287 IMoniker *pmk;
288 ULARGE_INTEGER ptmpSize;
289
290 /* The sizeMax of this object is calculated by calling GetSizeMax on
291 * each moniker within this object then summing all returned values
292 */
293
294 TRACE("(%p,%p)\n",iface,pcbSize);
295
296 if (!pcbSize)
297 return E_POINTER;
298
299 pcbSize->QuadPart = sizeof(DWORD);
300
301 IMoniker_Enum(iface,TRUE,&enumMk);
302
303 while(IEnumMoniker_Next(enumMk,1,&pmk,NULL)==S_OK){
304
305 IMoniker_GetSizeMax(pmk,&ptmpSize);
306
307 IMoniker_Release(pmk);
308
309 pcbSize->QuadPart += ptmpSize.QuadPart + sizeof(CLSID);
310 }
311
312 IEnumMoniker_Release(enumMk);
313
314 return S_OK;
315}
316
318{
319 HRESULT hr = IMoniker_ComposeWith(left, right, TRUE, c);
320 if (FAILED(hr) && hr != MK_E_NEEDGENERIC) return hr;
322}
323
325 IMoniker *toleft, REFIID riid, void **result)
326{
328 IMoniker *left, *rightmost, *c;
331 HRESULT hr;
332
333 TRACE("%p, %p, %p, %s, %p.\n", iface, pbc, toleft, debugstr_guid(riid), result);
334
335 if (!result)
336 return E_POINTER;
337
338 *result = NULL;
339
340 if (!toleft)
341 {
342 hr = IBindCtx_GetRunningObjectTable(pbc, &rot);
343 if (SUCCEEDED(hr))
344 {
345 hr = IRunningObjectTable_GetObject(rot, iface, &object);
346 IRunningObjectTable_Release(rot);
347 if (FAILED(hr)) return E_INVALIDARG;
348
349 hr = IUnknown_QueryInterface(object, riid, result);
350 IUnknown_Release(object);
351 }
352
353 return hr;
354 }
355
356 /* Try to bind rightmost component with (toleft, composite->left) composite at its left side */
357 if (FAILED(hr = composite_get_rightmost(moniker, &left, &rightmost)))
358 return hr;
359
360 hr = compose_with(toleft, left, &c);
361 IMoniker_Release(left);
362
363 if (SUCCEEDED(hr))
364 {
365 hr = IMoniker_BindToObject(rightmost, pbc, c, riid, result);
366 IMoniker_Release(c);
367 }
368
369 IMoniker_Release(rightmost);
370
371 return hr;
372}
373
375 IMoniker *toleft, REFIID riid, void **result)
376{
378 IMoniker *left, *rightmost, *composed_left;
379 HRESULT hr;
380
381 TRACE("%p, %p, %p, %s, %p.\n", iface, pbc, toleft, debugstr_guid(riid), result);
382
383 *result = NULL;
384
385 if (FAILED(hr = composite_get_rightmost(moniker, &left, &rightmost)))
386 return hr;
387
388 if (toleft)
389 {
390 hr = compose_with(toleft, left, &composed_left);
391 }
392 else
393 {
394 composed_left = left;
395 IMoniker_AddRef(composed_left);
396 }
397
398 if (SUCCEEDED(hr))
399 {
400 hr = IMoniker_BindToStorage(rightmost, pbc, composed_left, riid, result);
401 IMoniker_Release(composed_left);
402 }
403
404 IMoniker_Release(rightmost);
405 IMoniker_Release(left);
406
407 return hr;
408}
409
411 IMoniker **toleft, IMoniker **reduced)
412{
414 IMoniker *m, *reduced_left, *reduced_right;
415 BOOL was_reduced;
416 HRESULT hr;
417
418 TRACE("%p, %p, %ld, %p, %p.\n", iface, pbc, howfar, toleft, reduced);
419
420 if (!pbc || !reduced)
421 return E_INVALIDARG;
422
423 if (FAILED(hr = IMoniker_Reduce(moniker->left, pbc, howfar, NULL, &reduced_left)))
424 return hr;
425
426 m = moniker->left;
427 if (FAILED(hr = IMoniker_Reduce(moniker->right, pbc, howfar, &m, &reduced_right)))
428 {
429 IMoniker_Release(reduced_left);
430 return hr;
431 }
432
433 if ((was_reduced = (reduced_left != moniker->left || reduced_right != moniker->right)))
434 {
435 hr = CreateGenericComposite(reduced_left, reduced_right, reduced);
436 }
437 else
438 {
439 *reduced = iface;
440 IMoniker_AddRef(*reduced);
441 }
442
443 IMoniker_Release(reduced_left);
444 IMoniker_Release(reduced_right);
445
446 return was_reduced ? hr : MK_S_REDUCED_TO_SELF;
447}
448
450 BOOL only_if_not_generic, IMoniker **composite)
451{
452 TRACE("%p, %p, %d, %p.\n", iface, right, only_if_not_generic, composite);
453
454 *composite = NULL;
455
456 return only_if_not_generic ? MK_E_NEEDGENERIC : CreateGenericComposite(iface, right, composite);
457}
458
460{
461 CompositeMonikerImpl *comp_moniker;
462
463 if ((comp_moniker = unsafe_impl_from_IMoniker(moniker)))
464 {
467 }
468 else
469 {
471 (*index)++;
472 }
473}
474
476{
478 unsigned int index;
479
480 if ((moniker = unsafe_impl_from_IMoniker(iface)))
481 *count = moniker->comp_count;
482 else
483 *count = 1;
484
485 if (!(*components = malloc(*count * sizeof(**components))))
486 return E_OUTOFMEMORY;
487
488 index = 0;
490
491 return S_OK;
492}
493
495{
496 IMoniker **monikers;
497 unsigned int count;
498 HRESULT hr;
499
500 TRACE("%p, %d, %p\n", iface, forward, ret_enum);
501
502 if (!ret_enum)
503 return E_INVALIDARG;
504
505 if (FAILED(hr = composite_get_components_alloc(iface, &count, &monikers)))
506 return hr;
507
508 hr = create_enumerator(monikers, count, forward, ret_enum);
509 free(monikers);
510
511 return hr;
512}
513
515{
516 CompositeMonikerImpl *moniker = impl_from_IMoniker(iface), *other_moniker;
517 IMoniker **components, **other_components;
518 unsigned int i, count;
519 HRESULT hr;
520
521 TRACE("%p, %p.\n", iface, other);
522
523 if (!other)
524 return E_INVALIDARG;
525
526 if (!(other_moniker = unsafe_impl_from_IMoniker(other)))
527 return S_FALSE;
528
529 if (moniker->comp_count != other_moniker->comp_count)
530 return S_FALSE;
531
532 if (FAILED(hr = composite_get_components_alloc(iface, &count, &components))) return hr;
533 if (FAILED(hr = composite_get_components_alloc(other, &count, &other_components)))
534 {
536 return hr;
537 }
538
539 for (i = 0; i < moniker->comp_count; ++i)
540 {
541 if ((hr = IMoniker_IsEqual(components[i], other_components[i]) != S_OK))
542 break;
543 }
544
545 free(other_components);
547
548 return hr;
549}
550
552{
554 DWORD left_hash, right_hash;
555 HRESULT hr;
556
557 TRACE("%p, %p\n", iface, hash);
558
559 if (!hash)
560 return E_POINTER;
561
562 if (!moniker->comp_count)
563 return E_UNEXPECTED;
564
565 *hash = 0;
566
567 if (FAILED(hr = IMoniker_Hash(moniker->left, &left_hash))) return hr;
568 if (FAILED(hr = IMoniker_Hash(moniker->right, &right_hash))) return hr;
569
570 *hash = left_hash ^ right_hash;
571
572 return hr;
573}
574
576 IMoniker *toleft, IMoniker *newly_running)
577{
579 IMoniker *c, *left, *rightmost;
581 HRESULT hr;
582
583 TRACE("%p, %p, %p, %p.\n", iface, pbc, toleft, newly_running);
584
585 if (!pbc)
586 return E_INVALIDARG;
587
588 if (toleft)
589 {
590 if (SUCCEEDED(hr = CreateGenericComposite(toleft, iface, &c)))
591 {
592 hr = IMoniker_IsRunning(c, pbc, NULL, newly_running);
593 IMoniker_Release(c);
594 }
595
596 return hr;
597 }
598
599 if (newly_running)
600 return IMoniker_IsEqual(iface, newly_running);
601
602 if (FAILED(hr = IBindCtx_GetRunningObjectTable(pbc, &rot)))
603 return hr;
604
605 hr = IRunningObjectTable_IsRunning(rot, iface);
606 IRunningObjectTable_Release(rot);
607 if (hr == S_OK) return S_OK;
608
609 if (FAILED(hr = composite_get_rightmost(moniker, &left, &rightmost)))
610 return hr;
611
612 hr = IMoniker_IsRunning(rightmost, pbc, left, NULL);
613
614 IMoniker_Release(left);
615 IMoniker_Release(rightmost);
616
617 return hr;
618}
619
621 IMoniker *toleft, FILETIME *changetime)
622{
624 IMoniker *left, *rightmost, *composed_left = NULL, *running = NULL;
626 HRESULT hr;
627
628 TRACE("%p, %p, %p, %p.\n", iface, pbc, toleft, changetime);
629
630 if (!changetime || !pbc)
631 return E_INVALIDARG;
632
633 if (FAILED(hr = composite_get_rightmost(moniker, &left, &rightmost)))
634 return hr;
635
636 if (toleft)
637 {
638 /* Compose (toleft, left) and check that against rightmost */
639 if (SUCCEEDED(hr = compose_with(toleft, left, &composed_left)) && composed_left)
640 hr = compose_with(composed_left, rightmost, &running);
641 }
642 else
643 {
644 composed_left = left;
645 IMoniker_AddRef(composed_left);
646 running = iface;
647 IMoniker_AddRef(running);
648 }
649
650 if (SUCCEEDED(hr))
651 {
652 if (SUCCEEDED(hr = IBindCtx_GetRunningObjectTable(pbc, &rot)))
653 {
654 if (IRunningObjectTable_GetTimeOfLastChange(rot, running, changetime) != S_OK)
655 hr = IMoniker_GetTimeOfLastChange(rightmost, pbc, composed_left, changetime);
656 IRunningObjectTable_Release(rot);
657 }
658 }
659
660 if (composed_left)
661 IMoniker_Release(composed_left);
662 if (running)
663 IMoniker_Release(running);
664 IMoniker_Release(rightmost);
665 IMoniker_Release(left);
666
667 return hr;
668}
669
671{
673 IMoniker *right_inverted, *left_inverted;
674 HRESULT hr;
675
676 TRACE("%p, %p.\n", iface, inverse);
677
678 if (!inverse)
679 return E_INVALIDARG;
680
681 *inverse = NULL;
682
683 if (FAILED(hr = IMoniker_Inverse(moniker->right, &right_inverted))) return hr;
684 if (FAILED(hr = IMoniker_Inverse(moniker->left, &left_inverted)))
685 {
686 IMoniker_Release(right_inverted);
687 return hr;
688 }
689
690 hr = CreateGenericComposite(right_inverted, left_inverted, inverse);
691
692 IMoniker_Release(left_inverted);
693 IMoniker_Release(right_inverted);
694
695 return hr;
696}
697
700{
701 CompositeMonikerImpl *moniker = impl_from_IMoniker(iface), *other_moniker;
702 unsigned int i, count, prefix_len = 0;
703 IMoniker *leftmost;
704 HRESULT hr;
705
706 TRACE("%p, %p, %p.\n", iface, other, prefix);
707
708 /* If the other moniker is a composite, this method compares the components of each composite from left */
709 /* to right. The returned common prefix moniker might also be a composite moniker, depending on how many */
710 /* of the leftmost components were common to both monikers. */
711
712 if (prefix)
713 *prefix = NULL;
714
715 if (!other || !prefix)
716 return E_INVALIDARG;
717
718 if ((other_moniker = unsafe_impl_from_IMoniker(other)))
719 {
720 IMoniker **components, **other_components, **prefix_components;
721 IMoniker *last, *c;
722
723 if (FAILED(hr = composite_get_components_alloc(iface, &count, &components))) return hr;
724 if (FAILED(hr = composite_get_components_alloc(other, &count, &other_components)))
725 {
727 return hr;
728 }
729
730 count = min(moniker->comp_count, other_moniker->comp_count);
731 if (!(prefix_components = calloc(count, sizeof(*prefix_components))))
732 {
734 free(other_components);
735 return E_OUTOFMEMORY;
736 }
737
738 /* Collect prefix components */
739 for (i = 0; i < count; ++i)
740 {
741 IMoniker *p;
742
743 if (FAILED(hr = IMoniker_CommonPrefixWith(components[i], other_components[i], &p)))
744 break;
745 prefix_components[prefix_len++] = p;
746 /* S_OK means that prefix was found and is neither of tested monikers */
747 if (hr == S_OK) break;
748 }
749
751 free(other_components);
752
753 if (!prefix_len)
754 {
755 free(prefix_components);
756 return MK_E_NOPREFIX;
757 }
758
759 last = prefix_components[0];
760 for (i = 1; i < prefix_len; ++i)
761 {
762 hr = CreateGenericComposite(last, prefix_components[i], &c);
763 IMoniker_Release(last);
764 IMoniker_Release(prefix_components[i]);
765 if (FAILED(hr)) break;
766 last = c;
767 }
768 free(prefix_components);
769
770 if (SUCCEEDED(hr))
771 {
772 *prefix = last;
773 if (IMoniker_IsEqual(iface, *prefix) == S_OK)
774 hr = MK_S_US;
775 else if (prefix_len < count)
776 hr = S_OK;
777 else
778 hr = prefix_len == moniker->comp_count ? MK_S_ME : MK_S_HIM;
779 }
780
781 return hr;
782 }
783
784 /* For non-composite, compare to leftmost component */
785 if (SUCCEEDED(hr = composite_get_leftmost(moniker, &leftmost)))
786 {
787 if ((hr = IMoniker_IsEqual(leftmost, other)) == S_OK)
788 {
789 *prefix = leftmost;
790 IMoniker_AddRef(*prefix);
791 }
792
794 IMoniker_Release(leftmost);
795 }
796
797 return hr;
798}
799
801{
802 IMoniker *last, *c;
803 HRESULT hr = S_OK;
804 unsigned int i;
805
806 last = comp[0];
807 IMoniker_AddRef(last);
808
809 for (i = 1; i < count; ++i)
810 {
811 hr = CreateGenericComposite(last, comp[i], &c);
812 IMoniker_Release(last);
813 if (FAILED(hr)) break;
814 last = c;
815 }
816
817 *ret = SUCCEEDED(hr) ? last : NULL;
818
819 return hr;
820}
821
823 IMoniker **relpath)
824{
825 unsigned int count, this_count, other_count, prefix_len = 0;
826 IMoniker *inv, *tail = NULL, *other_tail = NULL, *rel = NULL;
827 IMoniker **components, **other_components;
828 unsigned int start = 0, other_start = 0;
829 HRESULT hr;
830
831 TRACE("%p, %p, %p.\n", iface, other, relpath);
832
833 if (!relpath)
834 return E_INVALIDARG;
835
836 *relpath = NULL;
837
838 if (FAILED(hr = composite_get_components_alloc(iface, &this_count, &components))) return hr;
839 if (FAILED(hr = composite_get_components_alloc(other, &other_count, &other_components)))
840 {
842 return hr;
843 }
844
845 /* Skip common prefix of equal components */
846 count = min(other_count, this_count);
847 while (IMoniker_IsEqual(components[prefix_len], other_components[prefix_len]) == S_OK)
848 {
849 if (++prefix_len == count) break;
850 }
851
852 if (prefix_len)
853 {
854 this_count -= prefix_len;
855 other_count -= prefix_len;
856 other_start += prefix_len;
857 start += prefix_len;
858 }
859 else
860 {
861 /* Replace first component of the other tail with relative path */
862 if (SUCCEEDED(hr = IMoniker_RelativePathTo(*components, *other_components, &rel)))
863 *other_components = rel;
864
865 this_count--;
866 start++;
867 }
868
869 /* Invert left side tail */
870 if (this_count && SUCCEEDED(hr))
871 {
873 {
874 hr = IMoniker_Inverse(tail, &inv);
875 IMoniker_Release(tail);
876 tail = inv;
877 }
878 }
879
880 if (other_count && SUCCEEDED(hr))
881 hr = composite_compose_components(&other_components[other_start], other_count, &other_tail);
882
883 if (tail || other_tail)
884 hr = CreateGenericComposite(tail, other_tail, relpath);
885 else if (SUCCEEDED(hr))
886 {
887 *relpath = other;
888 IMoniker_AddRef(*relpath);
889 hr = MK_S_HIM;
890 }
891
892 if (rel)
893 IMoniker_Release(rel);
894 if (tail)
895 IMoniker_Release(tail);
896 if (other_tail)
897 IMoniker_Release(other_tail);
898
899 free(other_components);
901
902 return hr;
903}
904
906 IMoniker *pmkToLeft, LPOLESTR *displayname)
907{
909 WCHAR *left_name = NULL, *right_name = NULL;
910 HRESULT hr;
911
912 TRACE("%p, %p, %p, %p\n", iface, pbc, pmkToLeft, displayname);
913
914 if (!pbc || !displayname || !moniker->comp_count)
915 return E_INVALIDARG;
916
917 if (FAILED(hr = IMoniker_GetDisplayName(moniker->left, pbc, NULL, &left_name))) return hr;
918 if (FAILED(hr = IMoniker_GetDisplayName(moniker->right, pbc, NULL, &right_name)))
919 {
920 CoTaskMemFree(left_name);
921 return hr;
922 }
923
924 if (!(*displayname = CoTaskMemAlloc((lstrlenW(left_name) + lstrlenW(right_name) + 1) * sizeof(WCHAR))))
925 {
926 CoTaskMemFree(left_name);
927 CoTaskMemFree(right_name);
928 return E_OUTOFMEMORY;
929 }
930
931 lstrcpyW(*displayname, left_name);
932 lstrcatW(*displayname, right_name);
933
934 CoTaskMemFree(left_name);
935 CoTaskMemFree(right_name);
936
937 return S_OK;
938}
939
941 IMoniker *pmkToLeft, LPOLESTR name, ULONG *eaten, IMoniker **result)
942{
944 IMoniker *left, *rightmost;
945 HRESULT hr;
946
947 TRACE("%p, %p, %p, %s, %p, %p.\n", iface, pbc, pmkToLeft, debugstr_w(name), eaten, result);
948
949 if (!pbc)
950 return E_INVALIDARG;
951
952 if (FAILED(hr = composite_get_rightmost(moniker, &left, &rightmost)))
953 return hr;
954
955 /* Let rightmost component parse the name, using what's left of the composite as a left side. */
956 hr = IMoniker_ParseDisplayName(rightmost, pbc, left, name, eaten, result);
957
958 IMoniker_Release(left);
959 IMoniker_Release(rightmost);
960
961 return hr;
962}
963
964/******************************************************************************
965 * CompositeMoniker_IsSystemMoniker
966 ******************************************************************************/
967static HRESULT WINAPI
969{
970 TRACE("(%p,%p)\n",iface,pwdMksys);
971
972 if (!pwdMksys)
973 return E_POINTER;
974
975 (*pwdMksys)=MKSYS_GENERICCOMPOSITE;
976
977 return S_OK;
978}
979
980/*******************************************************************************
981 * CompositeMonikerIROTData_QueryInterface
982 *******************************************************************************/
983static HRESULT WINAPI
985 VOID** ppvObject)
986{
988
989 TRACE("(%p,%s,%p)\n",iface,debugstr_guid(riid),ppvObject);
990
991 return CompositeMonikerImpl_QueryInterface(&This->IMoniker_iface, riid, ppvObject);
992}
993
994/***********************************************************************
995 * CompositeMonikerIROTData_AddRef
996 */
997static ULONG WINAPI
999{
1001
1002 TRACE("(%p)\n",iface);
1003
1004 return IMoniker_AddRef(&This->IMoniker_iface);
1005}
1006
1007/***********************************************************************
1008 * CompositeMonikerIROTData_Release
1009 */
1011{
1013
1014 TRACE("(%p)\n",iface);
1015
1016 return IMoniker_Release(&This->IMoniker_iface);
1017}
1018
1020 BYTE *data, ULONG max_len, ULONG *ret_len)
1021{
1022 IROTData *rot_data;
1023 HRESULT hr;
1024
1025 if (FAILED(hr = IMoniker_QueryInterface(moniker, &IID_IROTData, (void **)&rot_data)))
1026 {
1027 WARN("Failed to get IROTData for component moniker, hr %#lx.\n", hr);
1028 return hr;
1029 }
1030
1031 hr = IROTData_GetComparisonData(rot_data, data, max_len, ret_len);
1032 IROTData_Release(rot_data);
1033
1034 return hr;
1035}
1036
1038 BYTE *data, ULONG max_len, ULONG *ret_len)
1039{
1041 HRESULT hr;
1042 ULONG len;
1043
1044 TRACE("%p, %p, %lu, %p\n", iface, data, max_len, ret_len);
1045
1046 if (!moniker->comp_count)
1047 return E_UNEXPECTED;
1048
1049 /* Get required size first */
1050 *ret_len = sizeof(CLSID);
1051
1052 len = 0;
1054 if (SUCCEEDED(hr) || hr == E_OUTOFMEMORY)
1055 *ret_len += len;
1056 else
1057 {
1058 WARN("Failed to get comparison data length for left component, hr %#lx.\n", hr);
1059 return hr;
1060 }
1061
1062 len = 0;
1064 if (SUCCEEDED(hr) || hr == E_OUTOFMEMORY)
1065 *ret_len += len;
1066 else
1067 {
1068 WARN("Failed to get comparison data length for right component, hr %#lx.\n", hr);
1069 return hr;
1070 }
1071
1072 if (max_len < *ret_len)
1073 return E_OUTOFMEMORY;
1074
1075 memcpy(data, &CLSID_CompositeMoniker, sizeof(CLSID));
1076 data += sizeof(CLSID);
1077 max_len -= sizeof(CLSID);
1079 {
1080 WARN("Failed to get comparison data for left component, hr %#lx.\n", hr);
1081 return hr;
1082 }
1083 data += len;
1084 max_len -= len;
1086 {
1087 WARN("Failed to get comparison data for right component, hr %#lx.\n", hr);
1088 return hr;
1089 }
1090
1091 return S_OK;
1092}
1093
1095{
1097
1098 TRACE("(%p,%s,%p)\n",iface,debugstr_guid(riid),ppv);
1099
1100 return CompositeMonikerImpl_QueryInterface(&This->IMoniker_iface, riid, ppv);
1101}
1102
1104{
1106
1107 TRACE("(%p)\n",iface);
1108
1109 return CompositeMonikerImpl_AddRef(&This->IMoniker_iface);
1110}
1111
1113{
1115
1116 TRACE("(%p)\n",iface);
1117
1118 return CompositeMonikerImpl_Release(&This->IMoniker_iface);
1119}
1120
1122 IMarshal *iface, REFIID riid, void *pv, DWORD dwDestContext,
1123 void* pvDestContext, DWORD mshlflags, CLSID* pCid)
1124{
1126
1127 TRACE("%s, %p, %lx, %p, %lx, %p.\n", debugstr_guid(riid), pv,
1128 dwDestContext, pvDestContext, mshlflags, pCid);
1129
1130 return IMoniker_GetClassID(&This->IMoniker_iface, pCid);
1131}
1132
1134 IMarshal *iface, REFIID riid, void *pv, DWORD dwDestContext,
1135 void* pvDestContext, DWORD mshlflags, DWORD* pSize)
1136{
1138 HRESULT hr;
1139 ULONG size;
1140
1141 TRACE("%s, %p, %lx, %p, %lx, %p.\n", debugstr_guid(riid), pv,
1142 dwDestContext, pvDestContext, mshlflags, pSize);
1143
1144 if (!moniker->comp_count)
1145 return E_UNEXPECTED;
1146
1147 *pSize = 0x10; /* to match native */
1148
1149 if (FAILED(hr = CoGetMarshalSizeMax(&size, &IID_IMoniker, (IUnknown *)moniker->left, dwDestContext,
1150 pvDestContext, mshlflags)))
1151 {
1152 return hr;
1153 }
1154 *pSize += size;
1155
1156 if (FAILED(hr = CoGetMarshalSizeMax(&size, &IID_IMoniker, (IUnknown *)moniker->right, dwDestContext,
1157 pvDestContext, mshlflags)))
1158 {
1159 return hr;
1160 }
1161 *pSize += size;
1162
1163 return hr;
1164}
1165
1167 REFIID riid, void *pv, DWORD dwDestContext, void *pvDestContext, DWORD flags)
1168{
1170 HRESULT hr;
1171
1172 TRACE("%p, %p, %s, %p, %lx, %p, %#lx\n", iface, stream, debugstr_guid(riid), pv, dwDestContext, pvDestContext, flags);
1173
1174 if (!moniker->comp_count)
1175 return E_UNEXPECTED;
1176
1177 if (FAILED(hr = CoMarshalInterface(stream, &IID_IMoniker, (IUnknown *)moniker->left, dwDestContext, pvDestContext, flags)))
1178 {
1179 WARN("Failed to marshal left component, hr %#lx.\n", hr);
1180 return hr;
1181 }
1182
1183 if (FAILED(hr = CoMarshalInterface(stream, &IID_IMoniker, (IUnknown *)moniker->right, dwDestContext, pvDestContext, flags)))
1184 WARN("Failed to marshal right component, hr %#lx.\n", hr);
1185
1186 return hr;
1187}
1188
1190 REFIID riid, void **ppv)
1191{
1193 HRESULT hr;
1194
1195 TRACE("%p, %p, %s, %p\n", iface, stream, debugstr_guid(riid), ppv);
1196
1197 if (moniker->left)
1198 {
1199 IMoniker_Release(moniker->left);
1200 moniker->left = NULL;
1201 }
1202
1203 if (moniker->right)
1204 {
1205 IMoniker_Release(moniker->right);
1206 moniker->right = NULL;
1207 }
1208
1209 if (FAILED(hr = CoUnmarshalInterface(stream, &IID_IMoniker, (void **)&moniker->left)))
1210 {
1211 WARN("Failed to unmarshal left moniker, hr %#lx.\n", hr);
1212 return hr;
1213 }
1214
1215 if (FAILED(hr = CoUnmarshalInterface(stream, &IID_IMoniker, (void **)&moniker->right)))
1216 {
1217 WARN("Failed to unmarshal right moniker, hr %#lx.\n", hr);
1218 return hr;
1219 }
1220
1221 return IMoniker_QueryInterface(&moniker->IMoniker_iface, riid, ppv);
1222}
1223
1225{
1226 TRACE("(%p)\n", pStm);
1227 /* can't release a state-based marshal as nothing on server side to
1228 * release */
1229 return S_OK;
1230}
1231
1234{
1235 TRACE("%#lx\n", dwReserved);
1236 /* can't disconnect a state-based marshal as nothing on server side to
1237 * disconnect from */
1238 return S_OK;
1239}
1240
1241/******************************************************************************
1242 * EnumMonikerImpl_QueryInterface
1243 ******************************************************************************/
1244static HRESULT WINAPI
1246{
1248
1249 TRACE("(%p,%s,%p)\n",This,debugstr_guid(riid),ppvObject);
1250
1251 /* Perform a sanity check on the parameters.*/
1252 if ( ppvObject==0 )
1253 return E_INVALIDARG;
1254
1255 /* Initialize the return parameter */
1256 *ppvObject = 0;
1257
1258 /* Compare the riid with the interface IDs implemented by this object.*/
1260 *ppvObject = iface;
1261
1262 /* Check that we obtained an interface.*/
1263 if ((*ppvObject)==0)
1264 return E_NOINTERFACE;
1265
1266 /* Query Interface always increases the reference count by one when it is successful */
1267 IEnumMoniker_AddRef(iface);
1268
1269 return S_OK;
1270}
1271
1272/******************************************************************************
1273 * EnumMonikerImpl_AddRef
1274 ******************************************************************************/
1275static ULONG WINAPI
1277{
1279
1280 TRACE("(%p)\n",This);
1281
1282 return InterlockedIncrement(&This->ref);
1283
1284}
1285
1287{
1289 ULONG refcount = InterlockedDecrement(&e->ref);
1290 unsigned int i;
1291
1292 TRACE("%p, refcount %lu.\n", iface, refcount);
1293
1294 if (!refcount)
1295 {
1296 for (i = 0; i < e->count; ++i)
1297 IMoniker_Release(e->monikers[i]);
1298 free(e->monikers);
1299 free(e);
1300 }
1301
1302 return refcount;
1303}
1304
1306 IMoniker **m, ULONG *fetched)
1307{
1309 unsigned int i;
1310
1311 TRACE("%p, %lu, %p, %p.\n", iface, count, m, fetched);
1312
1313 if (!m)
1314 return E_INVALIDARG;
1315
1316 *m = NULL;
1317
1318 /* retrieve the requested number of moniker from the current position */
1319 for (i = 0; (e->pos < e->count) && (i < count); ++i)
1320 {
1321 m[i] = e->monikers[e->pos++];
1322 IMoniker_AddRef(m[i]);
1323 }
1324
1325 if (fetched)
1326 *fetched = i;
1327
1328 return i == count ? S_OK : S_FALSE;
1329}
1330
1332{
1334
1335 TRACE("%p, %lu.\n", iface, count);
1336
1337 if (!count)
1338 return S_OK;
1339
1340 if ((e->pos + count) >= e->count)
1341 return S_FALSE;
1342
1343 e->pos += count;
1344
1345 return S_OK;
1346}
1347
1349{
1351
1352 TRACE("%p.\n", iface);
1353
1354 e->pos = 0;
1355
1356 return S_OK;
1357}
1358
1360{
1361 TRACE("%p, %p.\n", iface, ret);
1362
1363 if (!ret)
1364 return E_INVALIDARG;
1365
1366 *ret = NULL;
1367
1368 return E_NOTIMPL;
1369}
1370
1371static const IEnumMonikerVtbl VT_EnumMonikerImpl =
1372{
1380};
1381
1383{
1385 unsigned int i;
1386
1387 if (!(object = calloc(1, sizeof(*object))))
1388 return E_OUTOFMEMORY;
1389
1390 object->IEnumMoniker_iface.lpVtbl = &VT_EnumMonikerImpl;
1391 object->ref = 1;
1392 object->count = count;
1393
1394 if (!(object->monikers = calloc(count, sizeof(*object->monikers))))
1395 {
1396 free(object);
1397 return E_OUTOFMEMORY;
1398 }
1399
1400 for (i = 0; i < count; ++i)
1401 {
1402 object->monikers[i] = forward ? components[i] : components[count - i - 1];
1403 IMoniker_AddRef(object->monikers[i]);
1404 }
1405
1406 *ret = &object->IEnumMoniker_iface;
1407
1408 return S_OK;
1409}
1410
1411static const IMonikerVtbl VT_CompositeMonikerImpl =
1412{
1436};
1437
1438/********************************************************************************/
1439/* Virtual function table for the IROTData class. */
1440static const IROTDataVtbl VT_ROTDataImpl =
1441{
1446};
1447
1448static const IMarshalVtbl VT_MarshalImpl =
1449{
1459};
1460
1462{
1467};
1468
1470 struct comp_node **ret)
1471{
1472 CompositeMonikerImpl *comp_moniker;
1473 struct comp_node *node;
1474
1475 if (!(node = calloc(1, sizeof(*node))))
1476 return E_OUTOFMEMORY;
1477 node->parent = parent;
1478
1479 if ((comp_moniker = unsafe_impl_from_IMoniker(moniker)))
1480 {
1481 moniker_get_tree_representation(comp_moniker->left, node, &node->left);
1482 moniker_get_tree_representation(comp_moniker->right, node, &node->right);
1483 }
1484 else
1485 {
1486 node->moniker = moniker;
1487 IMoniker_AddRef(node->moniker);
1488 }
1489
1490 *ret = node;
1491
1492 return S_OK;
1493}
1494
1496{
1497 if (!root->left && !root->right) return root->moniker ? root : NULL;
1498 while (root->right) root = root->right;
1499 return root;
1500}
1501
1503{
1504 if (!root->left && !root->right) return root->moniker ? root : NULL;
1505 while (root->left) root = root->left;
1506 return root;
1507}
1508
1510{
1511 if (node->moniker)
1512 IMoniker_Release(node->moniker);
1513 free(node);
1514}
1515
1517{
1518 if (node->left)
1520 if (node->right)
1523}
1524
1525static void moniker_tree_replace_node(struct comp_node *node, struct comp_node *replace_with)
1526{
1527 if (node->parent)
1528 {
1529 if (node->parent->left == node) node->parent->left = replace_with;
1530 else node->parent->right = replace_with;
1531 replace_with->parent = node->parent;
1532 }
1533 else if (replace_with->moniker)
1534 {
1535 /* Replacing root with non-composite */
1536 node->moniker = replace_with->moniker;
1537 IMoniker_AddRef(node->moniker);
1538 node->left = node->right = NULL;
1539 moniker_tree_node_release(replace_with);
1540 }
1541 else
1542 {
1543 /* Attaching composite branches to the root */
1544 node->left = replace_with->left;
1545 node->right = replace_with->right;
1546 moniker_tree_node_release(replace_with);
1547 }
1548}
1549
1551{
1552 if (node->parent)
1553 {
1554 moniker_tree_replace_node(node->parent, left ? node->parent->left : node->parent->right);
1556 }
1557 else
1558 {
1559 IMoniker_Release(node->moniker);
1560 node->moniker = NULL;
1561 }
1562}
1563
1564static HRESULT moniker_create_from_tree(const struct comp_node *root, unsigned int *count, IMoniker **moniker)
1565{
1566 IMoniker *left_moniker, *right_moniker;
1567 HRESULT hr;
1568
1569 *moniker = NULL;
1570
1571 /* Non-composite node */
1572 if (!root->left && !root->right)
1573 {
1574 (*count)++;
1575 *moniker = root->moniker;
1576 if (*moniker) IMoniker_AddRef(*moniker);
1577 return S_OK;
1578 }
1579
1580 if (FAILED(hr = moniker_create_from_tree(root->left, count, &left_moniker))) return hr;
1581 if (FAILED(hr = moniker_create_from_tree(root->right, count, &right_moniker)))
1582 {
1583 IMoniker_Release(left_moniker);
1584 return hr;
1585 }
1586
1587 hr = CreateGenericComposite(left_moniker, right_moniker, moniker);
1588 IMoniker_Release(left_moniker);
1589 IMoniker_Release(right_moniker);
1590 return hr;
1591}
1592
1593static void moniker_get_tree_comp_count(const struct comp_node *root, unsigned int *count)
1594{
1595 if (!root->left && !root->right)
1596 {
1597 (*count)++;
1598 return;
1599 }
1600
1603}
1604
1606{
1607 struct comp_node *root, *node;
1608 unsigned int count;
1609 HRESULT hr;
1610
1611 /* Shortcut for trivial case when right component is non-composite */
1612 if (!unsafe_impl_from_IMoniker(composite->right))
1613 {
1614 *left = composite->left;
1615 IMoniker_AddRef(*left);
1616 *rightmost = composite->right;
1617 IMoniker_AddRef(*rightmost);
1618 return S_OK;
1619 }
1620
1621 *left = *rightmost = NULL;
1622
1624 return hr;
1625
1627 {
1628 WARN("Couldn't get right most component.\n");
1630 return E_FAIL;
1631 }
1632
1633 *rightmost = node->moniker;
1634 IMoniker_AddRef(*rightmost);
1636
1639 if (FAILED(hr))
1640 {
1641 IMoniker_Release(*rightmost);
1642 *rightmost = NULL;
1643 }
1644
1645 return hr;
1646}
1647
1649{
1650 struct comp_node *root, *node;
1651 HRESULT hr;
1652
1653 if (!unsafe_impl_from_IMoniker(composite->left))
1654 {
1655 *leftmost = composite->left;
1656 IMoniker_AddRef(*leftmost);
1657 return S_OK;
1658 }
1659
1661 return hr;
1662
1664 {
1665 WARN("Couldn't get left most component.\n");
1667 return E_FAIL;
1668 }
1669
1670 *leftmost = node->moniker;
1671 IMoniker_AddRef(*leftmost);
1672
1674
1675 return S_OK;
1676}
1677
1679 unsigned int *count, IMoniker **new_left, IMoniker **new_right)
1680{
1681 struct comp_node *left_tree, *right_tree;
1682 unsigned int modified = 0;
1683 HRESULT hr = S_OK;
1684 IMoniker *c;
1685
1686 *count = 0;
1687
1690
1691 /* Simplify by composing trees together, in a non-generic way. */
1692 for (;;)
1693 {
1694 struct comp_node *l, *r;
1695
1696 if (!(l = moniker_tree_get_rightmost(left_tree))) break;
1697 if (!(r = moniker_tree_get_leftmost(right_tree))) break;
1698
1699 c = NULL;
1700 if (FAILED(IMoniker_ComposeWith(l->moniker, r->moniker, TRUE, &c))) break;
1701 modified++;
1702
1703 if (c)
1704 {
1705 /* Replace with composed moniker on the left side */
1706 IMoniker_Release(l->moniker);
1707 l->moniker = c;
1708 }
1709 else
1712 }
1713
1714 if (!modified)
1715 {
1716 *new_left = left;
1717 IMoniker_AddRef(*new_left);
1718 *new_right = right;
1719 IMoniker_AddRef(*new_right);
1720
1723 }
1724 else
1725 {
1726 hr = moniker_create_from_tree(left_tree, count, new_left);
1727 if (SUCCEEDED(hr))
1728 hr = moniker_create_from_tree(right_tree, count, new_right);
1729 }
1730
1731 moniker_tree_release(left_tree);
1732 moniker_tree_release(right_tree);
1733
1734 if (FAILED(hr))
1735 {
1736 if (*new_left) IMoniker_Release(*new_left);
1737 if (*new_right) IMoniker_Release(*new_right);
1738 *new_left = *new_right = NULL;
1739 }
1740
1741 return hr;
1742}
1743
1745{
1746 IMoniker *new_left, *new_right;
1748 HRESULT hr;
1749
1750 *moniker = NULL;
1751
1752 if (!(object = calloc(1, sizeof(*object))))
1753 return E_OUTOFMEMORY;
1754
1755 object->IMoniker_iface.lpVtbl = &VT_CompositeMonikerImpl;
1756 object->IROTData_iface.lpVtbl = &VT_ROTDataImpl;
1757 object->IMarshal_iface.lpVtbl = &VT_MarshalImpl;
1758 object->ref = 1;
1759
1760 /* Uninitialized moniker created by object activation */
1761 if (!left && !right)
1762 {
1763 *moniker = &object->IMoniker_iface;
1764 return S_OK;
1765 }
1766
1767 if (FAILED(hr = moniker_simplify_composition(left, right, &object->comp_count, &new_left, &new_right)))
1768 {
1769 IMoniker_Release(&object->IMoniker_iface);
1770 return hr;
1771 }
1772
1773 if (!new_left || !new_right)
1774 {
1775 *moniker = new_left ? new_left : new_right;
1776 IMoniker_Release(&object->IMoniker_iface);
1777 return S_OK;
1778 }
1779
1780 object->left = new_left;
1781 object->right = new_right;
1782
1783 *moniker = &object->IMoniker_iface;
1784
1785 return S_OK;
1786}
1787
1788/******************************************************************************
1789 * CreateGenericComposite [OLE32.@]
1790 ******************************************************************************/
1792{
1793 TRACE("%p, %p, %p\n", left, right, composite);
1794
1795 if (!composite)
1796 return E_POINTER;
1797
1798 if (!left && right)
1799 {
1800 *composite = right;
1801 IMoniker_AddRef(*composite);
1802 return S_OK;
1803 }
1804 else if (left && !right)
1805 {
1806 *composite = left;
1807 IMoniker_AddRef(*composite);
1808 return S_OK;
1809 }
1810 else if (!left && !right)
1811 return S_OK;
1812
1813 return create_composite(left, right, composite);
1814}
1815
1816/******************************************************************************
1817 * MonikerCommonPrefixWith [OLE32.@]
1818 ******************************************************************************/
1820MonikerCommonPrefixWith(IMoniker* pmkThis,IMoniker* pmkOther,IMoniker** ppmkCommon)
1821{
1822 FIXME("(),stub!\n");
1823 return E_NOTIMPL;
1824}
1825
1827 IUnknown *pUnk, REFIID riid, void **ppv)
1828{
1829 IMoniker* pMoniker;
1830 HRESULT hr;
1831
1832 TRACE("(%p, %s, %p)\n", pUnk, debugstr_guid(riid), ppv);
1833
1834 *ppv = NULL;
1835
1836 if (pUnk)
1837 return CLASS_E_NOAGGREGATION;
1838
1839 hr = create_composite(NULL, NULL, &pMoniker);
1840
1841 if (SUCCEEDED(hr))
1842 {
1843 hr = IMoniker_QueryInterface(pMoniker, riid, ppv);
1844 IMoniker_Release(pMoniker);
1845 }
1846
1847 return hr;
1848}
GLfloat rot
Definition: 3dtext.c:36
struct outqueuenode * tail
Definition: adnsresfilter.c:66
#define InterlockedIncrement
Definition: armddk.h:53
#define InterlockedDecrement
Definition: armddk.h:52
#define WINE_DEFAULT_DEBUG_CHANNEL(t)
Definition: precomp.h:23
#define index(s, c)
Definition: various.h:29
#define FIXME(fmt,...)
Definition: precomp.h:53
#define WARN(fmt,...)
Definition: precomp.h:61
const GUID IID_IUnknown
struct _root root
r l[0]
Definition: byte_order.h:168
static HRESULT WINAPI EnumMonikerImpl_Skip(IEnumMoniker *iface, ULONG count)
static CompositeMonikerImpl * impl_from_IMarshal(IMarshal *iface)
static void moniker_tree_discard(struct comp_node *node, BOOL left)
static HRESULT WINAPI CompositeMonikerMarshalImpl_DisconnectObject(IMarshal *iface, DWORD dwReserved)
static CompositeMonikerImpl * impl_from_IMoniker(IMoniker *iface)
static HRESULT WINAPI CompositeMonikerImpl_CommonPrefixWith(IMoniker *iface, IMoniker *other, IMoniker **prefix)
static void moniker_tree_replace_node(struct comp_node *node, struct comp_node *replace_with)
static ULONG WINAPI CompositeMonikerImpl_Release(IMoniker *iface)
static const IMarshalVtbl VT_MarshalImpl
HRESULT WINAPI MonikerCommonPrefixWith(IMoniker *pmkThis, IMoniker *pmkOther, IMoniker **ppmkCommon)
static HRESULT WINAPI CompositeMonikerImpl_GetTimeOfLastChange(IMoniker *iface, IBindCtx *pbc, IMoniker *toleft, FILETIME *changetime)
static HRESULT WINAPI EnumMonikerImpl_Reset(IEnumMoniker *iface)
static EnumMonikerImpl * impl_from_IEnumMoniker(IEnumMoniker *iface)
static HRESULT WINAPI CompositeMonikerMarshalImpl_UnmarshalInterface(IMarshal *iface, IStream *stream, REFIID riid, void **ppv)
static ULONG WINAPI EnumMonikerImpl_Release(IEnumMoniker *iface)
static HRESULT WINAPI CompositeMonikerImpl_GetSizeMax(IMoniker *iface, ULARGE_INTEGER *pcbSize)
static HRESULT WINAPI CompositeMonikerMarshalImpl_MarshalInterface(IMarshal *iface, IStream *stream, REFIID riid, void *pv, DWORD dwDestContext, void *pvDestContext, DWORD flags)
static CompositeMonikerImpl * impl_from_IROTData(IROTData *iface)
static HRESULT create_enumerator(IMoniker **components, unsigned int count, BOOL forward, IEnumMoniker **ret)
static HRESULT create_composite(IMoniker *left, IMoniker *right, IMoniker **moniker)
static HRESULT composite_compose_components(IMoniker **comp, unsigned int count, IMoniker **ret)
static HRESULT WINAPI CompositeMonikerImpl_IsSystemMoniker(IMoniker *iface, DWORD *pwdMksys)
static ULONG WINAPI CompositeMonikerMarshalImpl_AddRef(IMarshal *iface)
static HRESULT WINAPI CompositeMonikerROTDataImpl_QueryInterface(IROTData *iface, REFIID riid, VOID **ppvObject)
static HRESULT WINAPI CompositeMonikerImpl_Reduce(IMoniker *iface, IBindCtx *pbc, DWORD howfar, IMoniker **toleft, IMoniker **reduced)
struct EnumMonikerImpl EnumMonikerImpl
static const IMonikerVtbl VT_CompositeMonikerImpl
static HRESULT WINAPI CompositeMonikerMarshalImpl_QueryInterface(IMarshal *iface, REFIID riid, LPVOID *ppv)
static HRESULT WINAPI EnumMonikerImpl_Clone(IEnumMoniker *iface, IEnumMoniker **ret)
static HRESULT WINAPI CompositeMonikerImpl_ParseDisplayName(IMoniker *iface, IBindCtx *pbc, IMoniker *pmkToLeft, LPOLESTR name, ULONG *eaten, IMoniker **result)
static ULONG WINAPI CompositeMonikerImpl_AddRef(IMoniker *iface)
static struct comp_node * moniker_tree_get_rightmost(struct comp_node *root)
static HRESULT WINAPI CompositeMonikerImpl_Enum(IMoniker *iface, BOOL forward, IEnumMoniker **ret_enum)
static CompositeMonikerImpl * unsafe_impl_from_IMoniker(IMoniker *iface)
static void composite_get_components(IMoniker *moniker, IMoniker **components, unsigned int *index)
static HRESULT WINAPI EnumMonikerImpl_Next(IEnumMoniker *iface, ULONG count, IMoniker **m, ULONG *fetched)
HRESULT WINAPI CompositeMoniker_CreateInstance(IClassFactory *iface, IUnknown *pUnk, REFIID riid, void **ppv)
static ULONG WINAPI CompositeMonikerMarshalImpl_Release(IMarshal *iface)
static HRESULT WINAPI CompositeMonikerImpl_BindToObject(IMoniker *iface, IBindCtx *pbc, IMoniker *toleft, REFIID riid, void **result)
static const IROTDataVtbl VT_ROTDataImpl
static ULONG WINAPI CompositeMonikerROTDataImpl_AddRef(IROTData *iface)
static HRESULT composite_get_leftmost(CompositeMonikerImpl *composite, IMoniker **leftmost)
static HRESULT WINAPI CompositeMonikerImpl_Inverse(IMoniker *iface, IMoniker **inverse)
static HRESULT composite_save_components(IMoniker *moniker, IStream *stream)
static void moniker_tree_node_release(struct comp_node *node)
static HRESULT WINAPI CompositeMonikerImpl_GetClassID(IMoniker *iface, CLSID *pClassID)
static HRESULT composite_get_moniker_comparison_data(IMoniker *moniker, BYTE *data, ULONG max_len, ULONG *ret_len)
static HRESULT WINAPI CompositeMonikerROTDataImpl_GetComparisonData(IROTData *iface, BYTE *data, ULONG max_len, ULONG *ret_len)
static HRESULT WINAPI CompositeMonikerImpl_IsEqual(IMoniker *iface, IMoniker *other)
static HRESULT WINAPI CompositeMonikerImpl_IsRunning(IMoniker *iface, IBindCtx *pbc, IMoniker *toleft, IMoniker *newly_running)
static HRESULT WINAPI CompositeMonikerMarshalImpl_GetUnmarshalClass(IMarshal *iface, REFIID riid, void *pv, DWORD dwDestContext, void *pvDestContext, DWORD mshlflags, CLSID *pCid)
static HRESULT compose_with(IMoniker *left, IMoniker *right, IMoniker **c)
static HRESULT WINAPI CompositeMonikerImpl_IsDirty(IMoniker *iface)
static HRESULT moniker_get_tree_representation(IMoniker *moniker, struct comp_node *parent, struct comp_node **ret)
static void moniker_get_tree_comp_count(const struct comp_node *root, unsigned int *count)
static struct comp_node * moniker_tree_get_leftmost(struct comp_node *root)
static HRESULT WINAPI CompositeMonikerImpl_Hash(IMoniker *iface, DWORD *hash)
static HRESULT WINAPI CompositeMonikerImpl_BindToStorage(IMoniker *iface, IBindCtx *pbc, IMoniker *toleft, REFIID riid, void **result)
static HRESULT WINAPI CompositeMonikerImpl_GetDisplayName(IMoniker *iface, IBindCtx *pbc, IMoniker *pmkToLeft, LPOLESTR *displayname)
static ULONG WINAPI EnumMonikerImpl_AddRef(IEnumMoniker *iface)
static HRESULT WINAPI CompositeMonikerImpl_QueryInterface(IMoniker *iface, REFIID riid, void **ppvObject)
static HRESULT WINAPI CompositeMonikerMarshalImpl_GetMarshalSizeMax(IMarshal *iface, REFIID riid, void *pv, DWORD dwDestContext, void *pvDestContext, DWORD mshlflags, DWORD *pSize)
static HRESULT WINAPI CompositeMonikerMarshalImpl_ReleaseMarshalData(IMarshal *iface, IStream *pStm)
static HRESULT WINAPI CompositeMonikerImpl_Load(IMoniker *iface, IStream *stream)
static void moniker_tree_release(struct comp_node *node)
static HRESULT composite_get_rightmost(CompositeMonikerImpl *composite, IMoniker **left, IMoniker **rightmost)
static HRESULT moniker_simplify_composition(IMoniker *left, IMoniker *right, unsigned int *count, IMoniker **new_left, IMoniker **new_right)
static HRESULT moniker_create_from_tree(const struct comp_node *root, unsigned int *count, IMoniker **moniker)
static HRESULT WINAPI EnumMonikerImpl_QueryInterface(IEnumMoniker *iface, REFIID riid, void **ppvObject)
static HRESULT WINAPI CompositeMonikerImpl_RelativePathTo(IMoniker *iface, IMoniker *other, IMoniker **relpath)
static ULONG WINAPI CompositeMonikerROTDataImpl_Release(IROTData *iface)
static HRESULT WINAPI CompositeMonikerImpl_ComposeWith(IMoniker *iface, IMoniker *right, BOOL only_if_not_generic, IMoniker **composite)
static HRESULT composite_get_components_alloc(IMoniker *iface, unsigned int *count, IMoniker ***components)
static const IEnumMonikerVtbl VT_EnumMonikerImpl
HRESULT WINAPI CreateGenericComposite(IMoniker *left, IMoniker *right, IMoniker **composite)
static HRESULT WINAPI CompositeMonikerImpl_Save(IMoniker *iface, IStream *stream, BOOL clear_dirty)
#define E_OUTOFMEMORY
Definition: ddrawi.h:100
#define E_INVALIDARG
Definition: ddrawi.h:101
#define E_NOTIMPL
Definition: ddrawi.h:99
#define E_FAIL
Definition: ddrawi.h:102
#define free
Definition: debug_ros.c:5
#define malloc
Definition: debug_ros.c:4
#define NULL
Definition: types.h:112
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
HRESULT WINAPI CoMarshalInterface(IStream *stream, REFIID riid, IUnknown *unk, DWORD dest_context, void *pvDestContext, DWORD mshlFlags)
Definition: marshal.c:483
HRESULT WINAPI CoUnmarshalInterface(IStream *stream, REFIID riid, void **ppv)
Definition: marshal.c:793
HRESULT WINAPI CoGetMarshalSizeMax(ULONG *size, REFIID riid, IUnknown *unk, DWORD dest_context, void *pvDestContext, DWORD mshlFlags)
Definition: marshal.c:440
#define lstrcpyW
Definition: compat.h:749
#define lstrlenW
Definition: compat.h:750
HRESULT WINAPI OleLoadFromStream(IStream *pStm, REFIID iidInterface, void **ppvObj)
Definition: storage32.c:9001
HRESULT WINAPI OleSaveToStream(IPersistStream *pPStm, IStream *pStm)
Definition: storage32.c:9036
static void *static void *static LPDIRECTPLAY IUnknown * pUnk
Definition: dplayx.c:30
return ret
Definition: mutex.c:146
r parent
Definition: btrfs.c:3010
unsigned int BOOL
Definition: ntddk_ex.h:94
unsigned long DWORD
Definition: ntddk_ex.h:95
GLuint start
Definition: gl.h:1545
GLuint GLuint GLsizei count
Definition: gl.h:1545
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl.h:1950
GLdouble GLdouble GLdouble r
Definition: gl.h:2055
GLsizeiptr size
Definition: glext.h:5919
GLenum GLenum GLuint components
Definition: glext.h:9620
const GLubyte * c
Definition: glext.h:8905
GLuint index
Definition: glext.h:6031
GLdouble GLdouble right
Definition: glext.h:10859
GLint left
Definition: glext.h:7726
GLbitfield flags
Definition: glext.h:7161
GLuint64EXT * result
Definition: glext.h:11304
GLfloat GLfloat p
Definition: glext.h:8902
GLenum GLsizei len
Definition: glext.h:6722
const GLfloat * m
Definition: glext.h:10848
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
REFIID riid
Definition: atlbase.h:39
REFIID LPVOID * ppv
Definition: atlbase.h:39
#define S_OK
Definition: intsafe.h:52
#define SUCCEEDED(hr)
Definition: intsafe.h:50
#define FAILED(hr)
Definition: intsafe.h:51
#define e
Definition: ke_i.h:82
#define c
Definition: ke_i.h:80
#define debugstr_guid
Definition: kernel32.h:35
#define debugstr_w
Definition: kernel32.h:32
LPWSTR WINAPI lstrcatW(LPWSTR lpString1, LPCWSTR lpString2)
Definition: lstring.c:274
void *WINAPI CoTaskMemAlloc(SIZE_T size)
Definition: malloc.c:381
void WINAPI CoTaskMemFree(void *ptr)
Definition: malloc.c:389
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
static UINT UINT last
Definition: font.c:45
static JOBOBJECTINFOCLASS LPVOID DWORD LPDWORD ret_len
Definition: process.c:81
static BSTR *static LPOLESTR
Definition: varformat.c:44
#define min(a, b)
Definition: monoChain.cc:55
int other
Definition: msacm.c:1376
IID CLSID
Definition: mstsclib_i.c:62
_In_ HANDLE _In_ DWORD _In_ DWORD _Inout_opt_ LPOVERLAPPED _In_opt_ LPTRANSMIT_FILE_BUFFERS _In_ DWORD dwReserved
Definition: mswsock.h:95
#define DWORD
Definition: nt_native.h:44
const GUID IID_IEnumMoniker
long LONG
Definition: pedump.c:60
const GUID IID_IPersist
Definition: proxy.cpp:14
const GUID IID_IPersistStream
Definition: proxy.cpp:13
#define IsEqualIID(riid1, riid2)
Definition: guiddef.h:95
#define REFIID
Definition: guiddef.h:118
#define calloc
Definition: rosglue.h:14
HRESULT hr
Definition: shlfolder.c:183
#define TRACE(s)
Definition: solgame.cpp:4
IEnumMoniker IEnumMoniker_iface
Definition: mediacatenum.c:36
IMoniker ** monikers
unsigned int count
unsigned int pos
ULONGLONG QuadPart
Definition: ms-dtyp.idl:185
struct comp_node * parent
IMoniker * moniker
struct comp_node * left
struct comp_node * right
Definition: _hash_fun.h:40
Definition: main.c:40
IMoniker IMoniker_iface
Definition: main.c:41
Definition: name.c:39
Definition: parse.h:23
Character const *const prefix
Definition: tempnam.cpp:195
#define CONTAINING_RECORD(address, type, field)
Definition: typedefs.h:260
uint32_t ULONG
Definition: typedefs.h:59
Definition: dlist.c:348
#define WINAPI
Definition: msvc.h:6
#define S_FALSE
Definition: winerror.h:3451
#define MK_S_REDUCED_TO_SELF
Definition: winerror.h:3892
#define E_NOINTERFACE
Definition: winerror.h:3479
#define MK_E_NOPREFIX
Definition: winerror.h:3909
#define CLASS_E_NOAGGREGATION
Definition: winerror.h:3771
#define E_UNEXPECTED
Definition: winerror.h:3528
#define MK_S_ME
Definition: winerror.h:3895
#define MK_E_NEEDGENERIC
Definition: winerror.h:3893
#define MK_S_HIM
Definition: winerror.h:3897
#define E_POINTER
Definition: winerror.h:3480
#define MK_S_US
Definition: winerror.h:3899
__wchar_t WCHAR
Definition: xmlstorage.h:180
unsigned char BYTE
Definition: xxhash.c:193