Shell integration idea

Robert Shearman rob at codeweavers.com
Sun Jun 4 07:21:34 CDT 2006


Mikołaj Zalewski wrote:

>
>> The number of developers that understand COM aggregation and all the
>> baroque rules that make it up is very, very low. A simple ops struct of
>> function pointers as used in the wineserver or kernel would be fine here
>> ... COM adds an awful lot of complexity that really isn't needed at all
>> (eg you must call CoInitialize, which means caring about apartments, 
>> which
>> means possibly instantiating a STA when windows wouldn't, which means 
>> pain).
>>  
>>
>  OK, I won't insist on aggregation :). As for apartments I've thought 
> that something like that:
> HRESULT res=CoInitializeEx(NULL, COINIT_MULTITHREADED);
> /* working with objects with ThreadingModel Both */
> if (SUCCEEDED(res)) CoUninitialize();
>
> won't have any side effects. But if the number of developers that 
> knows about COM is low then maybe that it's better to use simple ops 
> structs instead.


As long as the lifetime of the objects doesn't outlive the lifetime of 
the apartment (which dies in the CoUninitialize call) then it is fine, 
although trying to change the apartment of the current thread will cause 
builtin ole32 to print an ERR at the console.

-- 
Rob Shearman




More information about the wine-devel mailing list