www.digitalmars.com         C & C++   DMDScript  

c++.stlsoft - CoInitializer

reply "JAVIER ESTRADA" <ljestrada verizon.net> writes:
Matthew,

I missed a RAII that wraps the calls to CoInitialize(Ex) and CoUninitialize.
I make heavy use of such a simple wrapper, and it can serve as a base class
for "active" classes--those that create their own thread and enter a COM
apartment, or as an automatic variable when entering COM is necessary for
the length of a function call:

#ifndef _WIN32_DCOM
#define _WIN32_DCOM
#endif

#include <windef.h>   // DWORD
#include <winerror.h> // FAILED, SUCCEEDED macros
#include <objbase.h>  // CoInitializeEx, CoUninitialize

class CoInitializer
{
  CoInitializer(CoInitializer const&);
  CoInitializer& operator=(CoInitializer const&);

public:

  explicit CoInitializer(DWORD dwCoInit = COINIT_APARTMENTTHREADED)
  {
    if (FAILED(::CoInitializeEx(0, dwCoInit)))
      /*a throw clause here if desired*/;
  }

  ~CoInitializer() { ::CoUninitialize(); }
};
Feb 25 2004
parent reply "Matthew" <matthew.hat stlsoft.dot.org> writes:
"JAVIER ESTRADA" <ljestrada verizon.net> wrote in message
news:c1judk$1knu$1 digitaldaemon.com...
 Matthew,

 I missed a RAII that wraps the calls to CoInitialize(Ex) and
CoUninitialize.
 I make heavy use of such a simple wrapper, and it can serve as a base
class
 for "active" classes--those that create their own thread and enter a COM
 apartment, or as an automatic variable when entering COM is necessary for
 the length of a function call:
Check out comstl_initialisers.h, which contains the com_initialiser and ole_initialiser classes. There's a test program in the test\comstl\initialisers_test subdirectory. They currently use a half-hearted mechanism to attempt to prevent inheritance, so may not serve your needs in their current form. There's also a problem with them is that they're not spelled correctly for US-English speakers, so I'm adding the appropriate typedefs in the next version. This may be how you missed them (although I would have assumed that you'd grep for CoInitialize.) However, I'm including the latest version, which have these issues addressed now.
 #ifndef _WIN32_DCOM
 #define _WIN32_DCOM
 #endif

 #include <windef.h>   // DWORD
 #include <winerror.h> // FAILED, SUCCEEDED macros
 #include <objbase.h>  // CoInitializeEx, CoUninitialize

 class CoInitializer
 {
   CoInitializer(CoInitializer const&);
   CoInitializer& operator=(CoInitializer const&);

 public:

   explicit CoInitializer(DWORD dwCoInit = COINIT_APARTMENTTHREADED)
   {
     if (FAILED(::CoInitializeEx(0, dwCoInit)))
       /*a throw clause here if desired*/;
   }

   ~CoInitializer() { ::CoUninitialize(); }
 };
This is wrong! You need to match a call to CoUninitialize() *only* with a successful call to CoInitialize(), CoInitializeEx(), and the same follows for OleInitialize() and OleUninitialize(). MSDN says: "A thread must call CoUninitialize once for each successful call it has made to CoInitialize or CoInitializeEx. Only the CoUninitialize call corresponding to the CoInitialize or CoInitializeEx call that initialized the library can close it." I'm including the latest version here. This will get into 1.7.1, so you are pretty safe using it as is. btw, I'm thinking of changing them to allow for parameterisation by an error-handling policy, so as to throw exceptions if it fails. But don't worry, as I'll make sure that all current typenames will be valid instantiations of the templates with the same semantics as they now have. :) Cheers Matthew begin 666 comstl_initialisers.h M+RH +R\O+R\O+R\O+R\O+R\O+R\O+R\O+R\O+R\O+R\O+R\O+R\O+R\O+R\O M+R\O+R\O+R\O+R\O+R\O+R\O+R\O+R\O+R\O+R\O+R\O+R\-"B J($9I;&4Z M(" (" ("!C;VUS=&Q?:6YI=&EA;&ES97)S+F *&]R:6=I;F%L;'D 34]) M;FET+F L(#HZ4WEN97-I<T-O;2D-"B J#0H *B!0=7)P;W-E.B (" 0V]N M=&%I;G, 8VQA<W-E<R!F;W( :6YI=&EA;&ES:6YG($-/32]/3$4N#0H * T* M("H 0W)E871E9#H (" (#AT:"!&96)R=6%R>2 Q.3DY#0H *B!5<&1A=&5D M.B (" ,C9T:"!&96)R=6%R>2 R,# T#0H * T*("H 075T:&]R.B (" M($UA='1H97< 5VEL<V]N+"!3>6YE<VES(%-O9G1W87)E(%!T>2!,=&0N#0H M* T*("H 3&EC96YS93H (" ("A,:6-E;G-E9"!U;F1E<B!T:&4 4WEN97-I M<R!3;V9T=V%R92!3=&%N9&%R9"!3;W5R8V4 3&EC96YS92D-"B J#0H *B M(" (" (" (" 0V]P>7)I9VAT("A#*2 R,# R+3(P,#,L(%-Y;F5S:7, M4V]F='=A<F4 4'1Y($QT9"X-"B J#0H *B (" (" (" (" 06QL(')I M9VAT<R!R97-E<G9E9"X-"B J#0H *B (" (" (" (" =W=W.B (" M(" :'1T<#HO+W=W=RYS>6YE<VES+F-O;2YA=2]C;VUS=&P-"B J(" (" M(" (" (" (" (" (" ("!H='1P.B\O=W=W+F-O;7-T;"YO<F<O#0H M* T*("H (" (" (" (" (&5M86EL.B (" ('-U8FUI<W-I;VYS0&-O M;7-T;"YO<F< (&9O<B!S=6)M:7-S:6]N<PT*("H (" (" (" (" (" M(" (" (" (&%D;6EN0&-O;7-T;"YO<F< (" (" (&9O<B!O=&AE<B!E M;G%U:7)I97,-"B J#0H *B (" (" (" (" 4F5D:7-T<FEB=71I;VX M86YD('5S92!I;B!S;W5R8V4 86YD(&)I;F%R>2!F;W)M<RP =VET:"!O< T* M("H (" (" (" (" ('=I=&AO=70 ;6]D:69I8V%T:6]N+"!A<F4 <&5R M;6ET=&5D('!R;W9I9&5D('1H870 =&AE(&9O;&QO=VEN9PT*("H (" (" M(" (" (&-O;F1I=&EO;G, 87)E(&UE=#H-"B J#0H *B (" (" (" M(" *&DI(%)E9&ES=')I8G5T:6]N<R!O9B!S;W5R8V4 8V]D92!M=7-T(')E M=&%I;B!T:&4 86)O=F4-"B J(" (" (" (" ("!C;W!Y<FEG:'0 ;F]T M:6-E(&%N9"!C;VYT86-T(&EN9F]R;6%T:6]N+"!T:&ES(&QI<W0 ;V8-"B J M(" (" (" (" ("!C;VYD:71I;VYS(&%N9"!T:&4 9F]L;&]W:6YG(&1I M<V-L86EM97(N#0H * T*("H (" (" (" (" ("AI:2D 06YY(&1E<FEV M960 =F5R<VEO;G, ;V8 =&AI<R!S;V9T=V%R92 H:&]W<V]E=F5R(&UO9&EF M:65D*0T*("H (" (" (" (" (')E;6%I;B!T:&4 <V]L92!P<F]P97)T M>2!O9B!3>6YE<VES(%-O9G1W87)E+ T*("H-"B J(" (" (" (" (" H M:6EI*2!!;GD 9&5R:79E9"!V97)S:6]N<R!O9B!T:&ES('-O9G1W87)E("AH M;W=S;V5V97( ;6]D:69I960I#0H *B (" (" (" (" <F5M86EN('-U M8FIE8W0 =&\ 86QL('1H97-E(&-O;F1I=&EO;G,N#0H * T*("H (" (" M(" (" ("AI=BD 3F5I=&AE<B!T:&4 ;F%M92!O9B!3>6YE<VES(%-O9G1W M87)E(&YO<B!T:&4 ;F%M97, ;V8 86YY#0H *B (" (" (" (" <W5B M9&EV:7-I;VYS+"!E;7!L;WEE97, ;W( 86=E;G1S(&]F(%-Y;F5S:7, 4V]F M='=A<F4L(&YO<B!T:&4-"B J(" (" (" (" ("!N86UE<R!O9B!A;GD M;W1H97( 8V]N=')I8G5T;W)S('1O('1H:7, <V]F='=A<F4 ;6%Y(&)E('5S M960 =&\-"B J(" (" (" (" ("!E;F1O<G-E(&]R('!R;VUO=&4 <')O M9'5C=', 9&5R:79E9"!F<F]M('1H:7, <V]F='=A<F4 =VET:&]U= T*("H M(" (" (" (" ('-P96-I9FEC('!R:6]R('=R:71T96X <&5R;6ES<VEO M;BX-"B J#0H *B (" (" (" (" 5&AI<R!S;W5R8V4 8V]D92!I<R!P M<F]V:61E9"!B>2!3>6YE<VES(%-O9G1W87)E(")A<R!I<R( 86YD(&%N>0T* M("H (" (" (" (" ('=A<G)A;G1I97,L('=H971H97( 97AP<F5S<V5D M(&]R(&EM<&QI960L(&EN8VQU9&EN9RP 8G5T(&YO= T*("H (" (" (" M(" (&QI;6ET960 =&\L('1H92!I;7!L:65D('=A<G)A;G1I97, ;V8 ;65R M8VAA;G1A8FEL:71Y(&%N9 T*("H (" (" (" (" (&9I=&YE<W, 9F]R M(&$ <&%R=&EC=6QA<B!P=7)P;W-E(&%R92!D:7-C;&%I;65D+B!);B!N;R!E M=F5N= T*("H (" (" (" (" ('-H86QL('1H92!3>6YE<VES(%-O9G1W M87)E(&)E(&QI86)L92!F;W( 86YY(&1I<F5C="P :6YD:7)E8W0L#0H *B M(" (" (" (" :6YC:61E;G1A;"P <W!E8VEA;"P 97AE;7!L87)Y+"!O M<B!C;VYS97%U96YT:6%L(&1A;6%G97,-"B J(" (" (" (" (" H:6YC M;'5D:6YG+"!B=70 ;F]T(&QI;6ET960 =&\L('!R;V-U<F5M96YT(&]F('-U M8G-T:71U=&4 9V]O9',-"B J(" (" (" (" ("!O<B!S97)V:6-E<SL M;&]S<R!O9B!U<V4L(&1A=&$L(&]R('!R;V9I=',[(&]R(&)U<VEN97-S#0H M*B (" (" (" (" :6YT97)R=7!T:6]N*2!H;W=E=F5R(&-A=7-E9"!A M;F0 ;VX 86YY('1H96]R>2!O9B!L:6%B:6QI='DL#0H *B (" (" (" M(" =VAE=&AE<B!I;B!C;VYT<F%C="P <W1R:6-T(&QI86)I;&ET>2P ;W( M=&]R=" H:6YC;'5D:6YG#0H *B (" (" (" (" ;F5G;&EG96YC92!O M<B!O=&AE<G=I<V4I(&%R:7-I;F< :6X 86YY('=A>2!O=70 ;V8 =&AE('5S M92!O9 T*("H (" (" (" (" ('1H:7, <V]F='=A<F4L(&5V96X :68 M861V:7-E9"!O9B!T:&4 <&]S<VEB:6QI='D ;V8 <W5C: T*("H (" (" M(" (" (&1A;6%G92X-"B J#0H *B O+R\O+R\O+R\O+R\O+R\O+R\O+R\O M+R\O+R\O+R\O+R\O+R\O+R\O+R\O+R\O+R\O+R\O+R\O+R\O+R\O+R\O+R\O M+R\O+R\O+R J+PT*#0H-"B-I9FYD968 0T]-4U1,7TE.0TQ?2%]#3TU35$Q? M24Y)5$E!3$E315)3#0HC9&5F:6YE($-/35-43%])3D-,7TA?0T]-4U1,7TE. M251)04Q)4T524PT*#0HC:69N9&5F(%]?4U1,4T]&5%]$3T-5345.5$%424]. M7U-+25!?4T5#5$E/3 T*(R!D969I;F4 7T-/35-43%]615)?2%]#3TU35$Q? M24Y)5$E!3$E315)37TU!2D]2(" (#$-"B, 9&5F:6YE(%]#3TU35$Q?5D52 M7TA?0T]-4U1,7TE.251)04Q)4T524U]-24Y/4B (" X#0HC(&1E9FEN92!? M0T]-4U1,7U9%4E](7T-/35-43%])3DE424%,25-%4E-?4D5625-)3TX ,0T* M(R!D969I;F4 7T-/35-43%]615)?2%]#3TU35$Q?24Y)5$E!3$E315)37T5$ M250 (" (#,U#0HC96YD:68 +RH (5]?4U1,4T]&5%]$3T-5345.5$%424]. M7U-+25!?4T5#5$E/3B J+PT*#0HO*B O+R\O+R\O+R\O+R\O+R\O+R\O+R\O M+R\O+R\O+R\O+R\O+R\O+R\O+R\O+R\O+R\O+R\O+R\O+R\O+R\O+R\O+R\O M+R\O+R\O+R\O#0H *B!);F-L=61E<PT*("HO#0H-"B-I9FYD968 0T]-4U1, M7TE.0TQ?2%]#3TU35$P-"B, :6YC;'5D92 B8V]M<W1L+F B(" (" (" M(" (" ("\O($EN8VQU9&4 =&AE($-/35-43"!R;V]T(&AE861E< T*(V5N M9&EF("\J("%#3TU35$Q?24Y#3%](7T-/35-43" J+PT*#0HO*B O+R\O+R\O M+R\O+R\O+R\O+R\O+R\O+R\O+R\O+R\O+R\O+R\O+R\O+R\O+R\O+R\O+R\O M+R\O+R\O+R\O+R\O+R\O+R\O+R\O+R\O+PT*("H 3F%M97-P86-E#0H * T* M("H 5&AE($-/35-43"!C;VUP;VYE;G1S(&%R92!C;VYT86EN960 =VET:&EN M('1H92!C;VUS=&P ;F%M97-P86-E+B!4:&ES(&ES#0H *B!A8W1U86QL>2!A M;B!A;&EA<R!F;W( <W1L<V]F=#HZ8V]M<W1L7W!R;VIE8W0L#0H * T*("H M5&AE(&1E9FEN:71I;VX ;6%T<FEX(&ES(&%S(&9O;&QO=W,Z#0H * T*("H M7U-43%-/1E1?3D]?3D%-15-004-%(" (%]#3TU35$Q?3D]?3D%-15-004-% M(" (&-O;7-T;"!D969I;FET:6]N#0H *B M+2TM+2TM+2TM+2TM+2TM+2TM M+2T (" +2TM+2TM+2TM+2TM+2TM+2TM+2T (" +2TM+2TM+2TM+2TM+2TM M+2T-"B J("!N;W0 9&5F:6YE9" (" (" (" (" ;F]T(&1E9FEN960 M(" (" (" (" /2!S=&QS;V9T.CIC;VUS=&Q?<')O:F5C= T*("H (&YO M="!D969I;F5D(" (" (" (" ("!D969I;F5D(" (" (" (" (" M("!N;W0 9&5F:6YE9 T*("H (&1E9FEN960 (" (" (" (" (" ("!N M;W0 9&5F:6YE9" (" (" (" ("!C;VUS=&P-"B J("!D969I;F5D(" M(" (" (" (" (" 9&5F:6YE9" (" (" (" (" (" ;F]T(&1E M9FEN960-"B J#0H *B\-" T*(VEF;F1E9B!?0T]-4U1,7TY/7TY!34534$%# M10T*(R!I9F1E9B!?4U1,4T]&5%].3U].04U%4U!!0T4-"B\J(%1H97)E(&ES M(&YO('-T;'-O9G0 ;F%M97-P86-E+"!S;R!M=7-T(&1E9FEN92 Z.F-O;7-T M;" J+PT*;F%M97-P86-E(&-O;7-T; T*>PT*(R!E;'-E#0HO*B!$969I;F4 M<W1L<V]F=#HZ8V]M<W1L7W!R;VIE8W0 *B\-" T*;F%M97-P86-E('-T;'-O M9G0-"GL-" T*;F%M97-P86-E(&-O;7-T;%]P<F]J96-T#0I[#0H-"B, 96YD M:68 +RH 7U-43%-/1E1?3D]?3D%-15-004-%("HO#0HC96YD:68 +RH (5]# M3TU35$Q?3D]?3D%-15-004-%("HO#0H-"B\J("\O+R\O+R\O+R\O+R\O+R\O M+R\O+R\O+R\O+R\O+R\O+R\O+R\O+R\O+R\O+R\O+R\O+R\O+R\O+R\O+R\O M+R\O+R\O+R\O+R\O+R\O#0H *B!#;&%S<V5S#0H *B\-" T*+R\O($EN:71I M86QI<V5S('1H92!#3TT ;&EB<F%R:65S#0HO+R\-"B\O+R!4:&ES(&-L87-S M(&ES('5S960 =&\ :6YI=&EA;&ES92!T:&4 0T]-(&QI8G)A<FEE<RX 268 M8V%N(')E<W!O;F0 =&\-"B\O+R!#;TEN:71I86QI>F5%>"!A<F=U;65N="!F M;&%G<R!W:&5N('1R86YS;&%T960 :6X 82!$0T]-(&)U:6QD+ T*8VQA<W, M8V]M7VEN:71I86QI<V5R#0I[#0IP<FEV871E. T*(" ('1Y<&5D968 8V]M M7VEN:71I86QI<V5R(" 8VQA<W-?='EP93L-" T*+R\ 0V]N<W1R=6-T:6]N M#0IP=6)L:6,Z#0H (" +R\O($EN:71I86QI<V5S('9I82!#;TEN:71I86QI M>F4H*0T*(" (&-O;5]I;FET:6%L:7-E<B I.PT*(VEF9&5F(%]?0T]-4U1, M7T-&7T1#3TU?4U504$]25 T*(" ("\O+R!);FET:6%L:7-E<R!V:6$ 0V]) M;FET:6%L:7IE17 H*2!T86MI;F< 8CY#3TE.251?*CPO8CX 9FQA9W,-"B M("!S<U]E>'!L:6-I=%]K(&-O;5]I;FET:6%L:7-E<BA$5T]21"!D=TEN:70 M+RH /2!#3TE.251?05!!4E1-14Y45$A214%$140 *B\I.PT*(V5N9&EF("\J M(%]?0T]-4U1,7T-&7T1#3TU?4U504$]25" J+PT*(" ("\O+R!5;FEN:71I M86QI<V5S('9I82!#;U5N:6YI=&EA;&EZ92 I#0H (" ?F-O;5]I;FET:6%L M:7-E<B I(&-O;7-T;%]T:')O=U\P*"D[#0H-"B\O($%T=')I8G5T97,-"G!U M8FQI8SH-"B (" O+R\ 4F5F;&5C=', =VAE=&AE<B!T:&4 0T]-(&QI8G)A M<FEE<R!W97)E(&EN:71I86QI<V5D#0H (" 8W-?8F]O;%]T(&ES7VEN:71I M86QI<V5D*"D 8V]N<W0[#0H (" +R\O(%)E9FQE8W1S('=H971H97( =&AE M($-/32!L:6)R87)I97, =V5R92!N;W0 :6YI=&EA;&ES960-"B ("!C<U]B M;V]L7W0 ;W!E<F%T;W( (2 I(&-O;G-T.PT*(" ("\O+R!4:&4 <F5S=6QT M(&]F('1H92!C86QL('1O($-O26YI=&EA;&EZ92 I+T-O26YI=&EA;&EZ945X M*"D-"B ("!(4D5354Q4(&=E=%](4D5354Q4*"D 8V]N<W0[#0H-"B\O($UE M;6)E<G,-"G!R:79A=&4Z#0H (" 2%)%4U5,5"!C;VYS=" (&U?:'([#0H- M"B\O($YO="!T;R!B92!I;7!L96UE;G1E9 T*<')I=F%T93H-"B ("!C;VU? M:6YI=&EA;&ES97(H8VQA<W-?='EP92!C;VYS=" F<FAS*3L-"B ("!C;&%S M<U]T>7!E(&-O;G-T("9O<&5R871O<B ]*&-L87-S7W1Y<&4 8V]N<W0 )G)H M<RD[#0I].PT*#0HO+R\ 26YI=&EA;&ES97, =&AE($],12!L:6)R87)I97,- M"B\O+PT*+R\O(%1H:7, 8VQA<W, :7, =7-E9"!T;R!I;FET:6%L:7-E('1H M92!/3$4 ;&EB<F%R:65S+ T*8VQA<W, ;VQE7VEN:71I86QI<V5R#0I[#0IP M<FEV871E. T*(" ('1Y<&5D968 ;VQE7VEN:71I86QI<V5R("!C;&%S<U]T M>7!E.PT*#0HO+R!#;VYS=')U8W1I;VX-"G!U8FQI8SH-"B (" O+R\ 26YI M=&EA;&ES97, =FEA($]L94EN:71I86QI>F4H*0T*(" (&]L95]I;FET:6%L M:7-E<B I.PT*(" ("\O+R!);FET:6%L:7-E<R!V:6$ 3VQE56YI;FET:6%L M:7IE*"D-"B ("!^;VQE7VEN:71I86QI<V5R*"D 8V]M<W1L7W1H<F]W7S H M*3L-" T*+R\ 071T<FEB=71E<PT*<'5B;&EC. T*(" ("\O+R!2969L96-T M<R!W:&5T:&5R('1H92!/3$4 ;&EB<F%R:65S('=E<F4 :6YI=&EA;&ES960- M"B ("!C<U]B;V]L7W0 :7-?:6YI=&EA;&ES960H*2!C;VYS=#L-"B (" O M+R\ 4F5F;&5C=', =VAE=&AE<B!T:&4 3TQ%(&QI8G)A<FEE<R!W97)E(&YO M="!I;FET:6%L:7-E9 T*(" (&-S7V)O;VQ?="!O<&5R871O<B A*"D 8V]N M<W0[#0H (" +R\O(%1H92!R97-U;'0 ;V8 =&AE(&-A;&P =&\ 3VQE26YI M=&EA;&EZ92 I#0H (" 2%)%4U5,5"!G971?2%)%4U5,5" I(&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F4 2%)%4U5,5"!O;&5?:6YI=&EA;&ES97(Z.F=E=%](4D53 M54Q4*"D 8V]N<W0-"GL-"B ("!R971U<FX ;5]H<CL-"GT-" T*+RH +R\O M+R\O+R\O+R\O+R\O+R\O+R\O+R\O+R\O+R\O+R\O+R\O+R\O+R\O+R\O+R\O M+R\O+R\O+R\O+R\O+R\O+R\O+R\O+R\O+R\ *B\-" T*(VEF;F1E9B!?0T]- M4U1,7TY/7TY!34534$%#10T*(R!I9F1E9B!?4U1,4T]&5%].3U].04U%4U!! M0T4-"GT +R\ ;F%M97-P86-E(&-O;7-T; T*(R!E;'-E#0I]("\O(&YA;65S M<&%C92!S=&QS;V9T.CIC;VUS=&Q?<')O:F5C= T*?2 O+R!N86UE<W!A8V4 M<W1L<V]F= T*(R!E;F1I9B O*B!?4U1,4T]&5%].3U].04U%4U!!0T4 *B\- M"B-E;F1I9B O*B A7T-/35-43%].3U].04U%4U!!0T4 *B\-" T*+RH +R\O M+R\O+R\O+R\O+R\O+R\O+R\O+R\O+R\O+R\O+R\O+R\O+R\O+R\O+R\O+R\O M+R\O+R\O+R\O+R\O+R\O+R\O+R\O+R\O+R\ *B\-" T*(V5N9&EF("\J("%# M3TU35$Q?24Y#3%](7T-/35-43%])3DE424%,25-%4E, *B\-" T*+RH +R\O M+R\O+R\O+R\O+R\O+R\O+R\O+R\O+R\O+R\O+R\O+R\O+R\O+R\O+R\O+R\O ?+R\O+R\O+R\O+R\O+R\O+R\O+R\O+R\O+R\ *B\-" `` ` end
Feb 25 2004
parent "Matthew" <matthew.hat stlsoft.dot.org> writes:
No time like the present. Here's the policy-based version.

Thanks for providing the impetus. :)

Matthew


"Matthew" <matthew.hat stlsoft.dot.org> wrote in message
news:c1k3b1$1tg4$1 digitaldaemon.com...
 "JAVIER ESTRADA" <ljestrada verizon.net> wrote in message
 news:c1judk$1knu$1 digitaldaemon.com...
 Matthew,

 I missed a RAII that wraps the calls to CoInitialize(Ex) and
CoUninitialize.
 I make heavy use of such a simple wrapper, and it can serve as a base
class
 for "active" classes--those that create their own thread and enter a COM
 apartment, or as an automatic variable when entering COM is necessary
for
 the length of a function call:
Check out comstl_initialisers.h, which contains the com_initialiser and ole_initialiser classes. There's a test program in the test\comstl\initialisers_test subdirectory. They currently use a half-hearted mechanism to attempt to prevent inheritance, so may not serve your needs in their current form. There's also a problem with them is that they're not spelled correctly for US-English speakers, so I'm adding the appropriate typedefs in the next version. This may be how you missed them (although I would have assumed
that
 you'd grep for CoInitialize.)

 However, I'm including the latest version, which have these issues
addressed
 now.

 #ifndef _WIN32_DCOM
 #define _WIN32_DCOM
 #endif

 #include <windef.h>   // DWORD
 #include <winerror.h> // FAILED, SUCCEEDED macros
 #include <objbase.h>  // CoInitializeEx, CoUninitialize

 class CoInitializer
 {
   CoInitializer(CoInitializer const&);
   CoInitializer& operator=(CoInitializer const&);

 public:

   explicit CoInitializer(DWORD dwCoInit = COINIT_APARTMENTTHREADED)
   {
     if (FAILED(::CoInitializeEx(0, dwCoInit)))
       /*a throw clause here if desired*/;
   }

   ~CoInitializer() { ::CoUninitialize(); }
 };
This is wrong! You need to match a call to CoUninitialize() *only* with a successful call to CoInitialize(), CoInitializeEx(), and the same follows for OleInitialize() and OleUninitialize(). MSDN says: "A thread must call CoUninitialize once for each successful call it has
made
 to CoInitialize or CoInitializeEx. Only the CoUninitialize call
 corresponding to the CoInitialize or CoInitializeEx call that initialized
 the library can close it."


 I'm including the latest version here. This will get into 1.7.1, so you
are
 pretty safe using it as is.

 btw, I'm thinking of changing them to allow for parameterisation by an
 error-handling policy, so as to throw exceptions if it fails. But don't
 worry, as I'll make sure that all current typenames will be valid
 instantiations of the templates with the same semantics as they now have.
:)
 Cheers

 Matthew
begin 666 comstl_initialisers.h M+RH +R\O+R\O+R\O+R\O+R\O+R\O+R\O+R\O+R\O+R\O+R\O+R\O+R\O+R\O M+R\O+R\O+R\O+R\O+R\O+R\O+R\O+R\O+R\O+R\O+R\O+R\-"B J($9I;&4Z M(" (" ("!C;VUS=&Q?:6YI=&EA;&ES97)S+F *&]R:6=I;F%L;'D 34]) M;FET+F L(#HZ4WEN97-I<T-O;2D-"B J#0H *B!0=7)P;W-E.B (" 0V]N M=&%I;G, 8VQA<W-E<R!F;W( :6YI=&EA;&ES:6YG($-/32]/3$4N#0H * T* M("H 0W)E871E9#H (" (#AT:"!&96)R=6%R>2 Q.3DY#0H *B!5<&1A=&5D M.B (" ,C9T:"!&96)R=6%R>2 R,# T#0H * T*("H 075T:&]R.B (" M($UA='1H97< 5VEL<V]N+"!3>6YE<VES(%-O9G1W87)E(%!T>2!,=&0N#0H M* T*("H 3&EC96YS93H (" ("A,:6-E;G-E9"!U;F1E<B!T:&4 4WEN97-I M<R!3;V9T=V%R92!3=&%N9&%R9"!3;W5R8V4 3&EC96YS92D-"B J#0H *B M(" (" (" (" 0V]P>7)I9VAT("A#*2 R,# R+3(P,#,L(%-Y;F5S:7, M4V]F='=A<F4 4'1Y($QT9"X-"B J#0H *B (" (" (" (" 06QL(')I M9VAT<R!R97-E<G9E9"X-"B J#0H *B (" (" (" (" =W=W.B (" M(" :'1T<#HO+W=W=RYS>6YE<VES+F-O;2YA=2]C;VUS=&P-"B J(" (" M(" (" (" (" (" (" ("!H='1P.B\O=W=W+F-O;7-T;"YO<F<O#0H M* T*("H (" (" (" (" (&5M86EL.B (" ('-U8FUI<W-I;VYS0&-O M;7-T;"YO<F< (&9O<B!S=6)M:7-S:6]N<PT*("H (" (" (" (" (" M(" (" (" (&%D;6EN0&-O;7-T;"YO<F< (" (" (&9O<B!O=&AE<B!E M;G%U:7)I97,-"B J#0H *B (" (" (" (" 4F5D:7-T<FEB=71I;VX M86YD('5S92!I;B!S;W5R8V4 86YD(&)I;F%R>2!F;W)M<RP =VET:"!O< T* M("H (" (" (" (" ('=I=&AO=70 ;6]D:69I8V%T:6]N+"!A<F4 <&5R M;6ET=&5D('!R;W9I9&5D('1H870 =&AE(&9O;&QO=VEN9PT*("H (" (" M(" (" (&-O;F1I=&EO;G, 87)E(&UE=#H-"B J#0H *B (" (" (" M(" *&DI(%)E9&ES=')I8G5T:6]N<R!O9B!S;W5R8V4 8V]D92!M=7-T(')E M=&%I;B!T:&4 86)O=F4-"B J(" (" (" (" ("!C;W!Y<FEG:'0 ;F]T M:6-E(&%N9"!C;VYT86-T(&EN9F]R;6%T:6]N+"!T:&ES(&QI<W0 ;V8-"B J M(" (" (" (" ("!C;VYD:71I;VYS(&%N9"!T:&4 9F]L;&]W:6YG(&1I M<V-L86EM97(N#0H * T*("H (" (" (" (" ("AI:2D 06YY(&1E<FEV M960 =F5R<VEO;G, ;V8 =&AI<R!S;V9T=V%R92 H:&]W<V]E=F5R(&UO9&EF M:65D*0T*("H (" (" (" (" (')E;6%I;B!T:&4 <V]L92!P<F]P97)T M>2!O9B!3>6YE<VES(%-O9G1W87)E+ T*("H-"B J(" (" (" (" (" H M:6EI*2!!;GD 9&5R:79E9"!V97)S:6]N<R!O9B!T:&ES('-O9G1W87)E("AH M;W=S;V5V97( ;6]D:69I960I#0H *B (" (" (" (" <F5M86EN('-U M8FIE8W0 =&\ 86QL('1H97-E(&-O;F1I=&EO;G,N#0H * T*("H (" (" M(" (" ("AI=BD 3F5I=&AE<B!T:&4 ;F%M92!O9B!3>6YE<VES(%-O9G1W M87)E(&YO<B!T:&4 ;F%M97, ;V8 86YY#0H *B (" (" (" (" <W5B M9&EV:7-I;VYS+"!E;7!L;WEE97, ;W( 86=E;G1S(&]F(%-Y;F5S:7, 4V]F M='=A<F4L(&YO<B!T:&4-"B J(" (" (" (" ("!N86UE<R!O9B!A;GD M;W1H97( 8V]N=')I8G5T;W)S('1O('1H:7, <V]F='=A<F4 ;6%Y(&)E('5S M960 =&\-"B J(" (" (" (" ("!E;F1O<G-E(&]R('!R;VUO=&4 <')O M9'5C=', 9&5R:79E9"!F<F]M('1H:7, <V]F='=A<F4 =VET:&]U= T*("H M(" (" (" (" ('-P96-I9FEC('!R:6]R('=R:71T96X <&5R;6ES<VEO M;BX-"B J#0H *B (" (" (" (" 5&AI<R!S;W5R8V4 8V]D92!I<R!P M<F]V:61E9"!B>2!3>6YE<VES(%-O9G1W87)E(")A<R!I<R( 86YD(&%N>0T* M("H (" (" (" (" ('=A<G)A;G1I97,L('=H971H97( 97AP<F5S<V5D M(&]R(&EM<&QI960L(&EN8VQU9&EN9RP 8G5T(&YO= T*("H (" (" (" M(" (&QI;6ET960 =&\L('1H92!I;7!L:65D('=A<G)A;G1I97, ;V8 ;65R M8VAA;G1A8FEL:71Y(&%N9 T*("H (" (" (" (" (&9I=&YE<W, 9F]R M(&$ <&%R=&EC=6QA<B!P=7)P;W-E(&%R92!D:7-C;&%I;65D+B!);B!N;R!E M=F5N= T*("H (" (" (" (" ('-H86QL('1H92!3>6YE<VES(%-O9G1W M87)E(&)E(&QI86)L92!F;W( 86YY(&1I<F5C="P :6YD:7)E8W0L#0H *B M(" (" (" (" :6YC:61E;G1A;"P <W!E8VEA;"P 97AE;7!L87)Y+"!O M<B!C;VYS97%U96YT:6%L(&1A;6%G97,-"B J(" (" (" (" (" H:6YC M;'5D:6YG+"!B=70 ;F]T(&QI;6ET960 =&\L('!R;V-U<F5M96YT(&]F('-U M8G-T:71U=&4 9V]O9',-"B J(" (" (" (" ("!O<B!S97)V:6-E<SL M;&]S<R!O9B!U<V4L(&1A=&$L(&]R('!R;V9I=',[(&]R(&)U<VEN97-S#0H M*B (" (" (" (" :6YT97)R=7!T:6]N*2!H;W=E=F5R(&-A=7-E9"!A M;F0 ;VX 86YY('1H96]R>2!O9B!L:6%B:6QI='DL#0H *B (" (" (" M(" =VAE=&AE<B!I;B!C;VYT<F%C="P <W1R:6-T(&QI86)I;&ET>2P ;W( M=&]R=" H:6YC;'5D:6YG#0H *B (" (" (" (" ;F5G;&EG96YC92!O M<B!O=&AE<G=I<V4I(&%R:7-I;F< :6X 86YY('=A>2!O=70 ;V8 =&AE('5S M92!O9 T*("H (" (" (" (" ('1H:7, <V]F='=A<F4L(&5V96X :68 M861V:7-E9"!O9B!T:&4 <&]S<VEB:6QI='D ;V8 <W5C: T*("H (" (" M(" (" (&1A;6%G92X-"B J#0H *B O+R\O+R\O+R\O+R\O+R\O+R\O+R\O M+R\O+R\O+R\O+R\O+R\O+R\O+R\O+R\O+R\O+R\O+R\O+R\O+R\O+R\O+R\O M+R\O+R\O+R J+PT*#0H-"B-I9FYD968 0T]-4U1,7TE.0TQ?2%]#3TU35$Q? M24Y)5$E!3$E315)3#0HC9&5F:6YE($-/35-43%])3D-,7TA?0T]-4U1,7TE. M251)04Q)4T524PT*#0HC:69N9&5F(%]?4U1,4T]&5%]$3T-5345.5$%424]. M7U-+25!?4T5#5$E/3 T*(R!D969I;F4 7T-/35-43%]615)?2%]#3TU35$Q? M24Y)5$E!3$E315)37TU!2D]2(" (#$-"B, 9&5F:6YE(%]#3TU35$Q?5D52 M7TA?0T]-4U1,7TE.251)04Q)4T524U]-24Y/4B (" Y#0HC(&1E9FEN92!? M0T]-4U1,7U9%4E](7T-/35-43%])3DE424%,25-%4E-?4D5625-)3TX ,0T* M(R!D969I;F4 7T-/35-43%]615)?2%]#3TU35$Q?24Y)5$E!3$E315)37T5$ M250 (" (#,V#0HC96YD:68 +RH (5]?4U1,4T]&5%]$3T-5345.5$%424]. M7U-+25!?4T5#5$E/3B J+PT*#0HO*B O+R\O+R\O+R\O+R\O+R\O+R\O+R\O M+R\O+R\O+R\O+R\O+R\O+R\O+R\O+R\O+R\O+R\O+R\O+R\O+R\O+R\O+R\O M+R\O+R\O+R\O#0H *B!);F-L=61E<PT*("HO#0H-"B-I9FYD968 0T]-4U1, M7TE.0TQ?2%]#3TU35$P-"B, :6YC;'5D92 B8V]M<W1L+F B(" (" (" M(" (" ("\O($EN8VQU9&4 =&AE($-/35-43"!R;V]T(&AE861E< T*(V5N M9&EF("\J("%#3TU35$Q?24Y#3%](7T-/35-43" J+PT*#0HO*B O+R\O+R\O M+R\O+R\O+R\O+R\O+R\O+R\O+R\O+R\O+R\O+R\O+R\O+R\O+R\O+R\O+R\O M+R\O+R\O+R\O+R\O+R\O+R\O+R\O+R\O+PT*("H 3F%M97-P86-E#0H * T* M("H 5&AE($-/35-43"!C;VUP;VYE;G1S(&%R92!C;VYT86EN960 =VET:&EN M('1H92!C;VUS=&P ;F%M97-P86-E+B!4:&ES(&ES#0H *B!A8W1U86QL>2!A M;B!A;&EA<R!F;W( <W1L<V]F=#HZ8V]M<W1L7W!R;VIE8W0L#0H * T*("H M5&AE(&1E9FEN:71I;VX ;6%T<FEX(&ES(&%S(&9O;&QO=W,Z#0H * T*("H M7U-43%-/1E1?3D]?3D%-15-004-%(" (%]#3TU35$Q?3D]?3D%-15-004-% M(" (&-O;7-T;"!D969I;FET:6]N#0H *B M+2TM+2TM+2TM+2TM+2TM+2TM M+2T (" +2TM+2TM+2TM+2TM+2TM+2TM+2T (" +2TM+2TM+2TM+2TM+2TM M+2T-"B J("!N;W0 9&5F:6YE9" (" (" (" (" ;F]T(&1E9FEN960 M(" (" (" (" /2!S=&QS;V9T.CIC;VUS=&Q?<')O:F5C= T*("H (&YO M="!D969I;F5D(" (" (" (" ("!D969I;F5D(" (" (" (" (" M("!N;W0 9&5F:6YE9 T*("H (&1E9FEN960 (" (" (" (" (" ("!N M;W0 9&5F:6YE9" (" (" (" ("!C;VUS=&P-"B J("!D969I;F5D(" M(" (" (" (" (" 9&5F:6YE9" (" (" (" (" (" ;F]T(&1E M9FEN960-"B J#0H *B\-" T*(VEF;F1E9B!?0T]-4U1,7TY/7TY!34534$%# M10T*(R!I9F1E9B!?4U1,4T]&5%].3U].04U%4U!!0T4-"B\J(%1H97)E(&ES M(&YO('-T;'-O9G0 ;F%M97-P86-E+"!S;R!M=7-T(&1E9FEN92 Z.F-O;7-T M;" J+PT*;F%M97-P86-E(&-O;7-T; T*>PT*(R!E;'-E#0HO*B!$969I;F4 M<W1L<V]F=#HZ8V]M<W1L7W!R;VIE8W0 *B\-" T*;F%M97-P86-E('-T;'-O M9G0-"GL-" T*;F%M97-P86-E(&-O;7-T;%]P<F]J96-T#0I[#0H-"B, 96YD M:68 +RH 7U-43%-/1E1?3D]?3D%-15-004-%("HO#0HC96YD:68 +RH (5]# M3TU35$Q?3D]?3D%-15-004-%("HO#0H-"B\J("\O+R\O+R\O+R\O+R\O+R\O M+R\O+R\O+R\O+R\O+R\O+R\O+R\O+R\O+R\O+R\O+R\O+R\O+R\O+R\O+R\O M+R\O+R\O+R\O+R\O+R\O#0H *B!#;&%S<V5S#0H *B\-" T*+R\O($EN:71I M86QI<V5S('1H92!#3TT ;&EB<F%R:65S#0HO+R\-"B\O+R!4:&ES(&-L87-S M(&ES('5S960 =&\ :6YI=&EA;&ES92!T:&4 0T]-(&QI8G)A<FEE<RX 270 M8V%N(')E<W!O;F0 =&\-"B\O+R!#;TEN:71I86QI>F5%>"!A<F=U;65N="!F M;&%G<R!W:&5N('1R86YS;&%T960 :6X 82!$0T]-(&)U:6QD+ T*=&5M<&QA M=&4\(" <W-?='EP96YA;65?<&%R86U?:R!)4" +RH 26YI=&EA;&ES871I M;VX <&]L:6-Y('1Y<&4 *B\-"B (" (" +" ('-S7W1Y<&5N86UE7W!A M<F%M7VL 6% ("\J($5X8V5P=&EO;B!P;VQI8WD ='EP92 J+PT*(" (" M(" ^#0IC;&%S<R!I;FET:6%L:7-E< T*>PT*<')I=F%T93H-"B ("!T>7!E M9&5F(&EN:71I86QI<V5R(" 8VQA<W-?='EP93L-"G!U8FQI8SH-"B (" O M+R\ 5&AE(&EN:71I86QI871I;VX <&]L:6-Y('1Y<&4-"B ("!T>7!E9&5F M($E0(" (" (" (" (" (" (" (" (" (" (" (" (" (" M(" (" (" (" :6YI=&EA;&ES871I;VY?<&]L:6-Y7W1Y<&4[#0H (" M+R\O(%1H92!E>&-E<'1I;VX ='EP90T*(" ('1Y<&5D968 6% (" (" M(" (" (" (" (" (" (" (" (" (" (" (" (" (" (" M("!E>&-E<'1I;VY?<&]L:6-Y7W1Y<&4[#0H (" +R\O(%1H92!T:')O=VX M='EP90T*(" ('1Y<&5D968 <W-?='EP96YA;65?='EP95]K(&5X8V5P=&EO M;E]P;VQI8WE?='EP93HZ=&AR;W=N7W1Y<&4 ("!T:')O=VY?='EP93L-" T* M+R\ 0V]N<W1R=6-T:6]N#0IP=6)L:6,Z#0H (" +R\O($EN:71I86QI<V5S M('9I82!#;TEN:71I86QI>F4H*0T*(" (&EN:71I86QI<V5R*"D[#0HC:69D M968 7U]#3TU35$Q?0T9?1$-/35]355!03U)4#0H (" +R\O($EN:71I86QI M<V5S('9I82!#;TEN:71I86QI>F5%>" I('1A:VEN9R!B/D-/24Y)5%\J/"]B M/B!F;&%G<PT*(" ('-S7V5X<&QI8VET7VL :6YI=&EA;&ES97(H8W-?9'=O M<F1?="!D=TEN:70 +RH /2!#3TE.251?05!!4E1-14Y45$A214%$140 *B\I M.PT*(V5N9&EF("\J(%]?0T]-4U1,7T-&7T1#3TU?4U504$]25" J+PT*(" M("\O+R!5;FEN:71I86QI<V5S('9I82!#;U5N:6YI=&EA;&EZ92 I#0H (" M?FEN:71I86QI<V5R*"D 8V]M<W1L7W1H<F]W7S H*3L-" T*+R\ 071T<FEB M=71E<PT*<'5B;&EC. T*(" ("\O+R!2969L96-T<R!W:&5T:&5R('1H92!# M3TT ;&EB<F%R:65S('=E<F4 :6YI=&EA;&ES960-"B ("!C<U]B;V]L7W0 M:7-?:6YI=&EA;&ES960H*2!C;VYS=#L-"B (" O+R\ 4F5F;&5C=', =VAE M=&AE<B!T:&4 0T]-(&QI8G)A<FEE<R!W97)E(&YO="!I;FET:6%L:7-E9 T* M(" (&-S7V)O;VQ?="!O<&5R871O<B A*"D 8V]N<W0[#0H (" +R\O(%1H M92!R97-U;'0 ;V8 =&AE(&-A;&P =&\ 0V]);FET:6%L:7IE*"DO0V]);FET M:6%L:7IE17 H*0T*(" ($A215-53%0 9V5T7TA215-53%0H*2!C;VYS=#L- M" T*+R\ 365M8F5R<PT*<')I=F%T93H-"B ("!(4D5354Q4(&-O;G-T(" M;5]H<CL-" T*+R\ 3F]T('1O(&)E(&EM<&QE;65N=&5D#0IP<FEV871E. T* M(" (&EN:71I86QI<V5R*&-L87-S7W1Y<&4 8V]N<W0 )G)H<RD[#0H (" M8VQA<W-?='EP92!C;VYS=" F;W!E<F%T;W( /2AC;&%S<U]T>7!E(&-O;G-T M("9R:',I.PT*?3L-" T*+R\O+R\O+R\O+R\O+R\O+R\O+R\O+R\O+R\O+R\O M+R\O+R\O+R\O+R\O+R\O+R\O+R\O+R\O+R\O+R\O+R\O+R\O+R\O+R\O+R\O M+R\O+R\-"B\O(%9A;'5E('!O;&EC:65S#0H-"G-T<G5C="!#;TEN:71I86QI M>F5?<&]L:6-Y#0I[#0IP=6)L:6,Z#0H (" <W1A=&EC($A215-53%0 :6YI M=" I#0H (" >PT*(" (" ("!R971U<FX .CI#;TEN:71I86QI>F4H3E5, M3"D[#0H (" ?0T*(VEF9&5F(%]?0T]-4U1,7T-&7T1#3TU?4U504$]25 T* M(" ('-T871I8R!(4D5354Q4(&EN:70H8W-?9'=O<F1?="!C;TEN:70I#0H M(" >PT*(" (" ("!R971U<FX .CI#;TEN:71I86QI>F5%>"A.54Q,+"!C M;TEN:70I.PT*(" ('T-"B-E;F1I9B O*B!?7T-/35-43%]#1E]$0T]-7U-5 M4%!/4E0 *B\-"B ("!S=&%T:6, =F]I9"!U;FEN:70H*0T*(" ('L-"B M(" (" .CI#;U5N:6YI=&EA;&EZ92 I.PT*(" ('T-"GT[#0H-"G-T<G5C M="!/;&5);FET:6%L:7IE7W!O;&EC>0T*>PT*<'5B;&EC. T*(" ('-T871I M8R!(4D5354Q4(&EN:70H*0T*(" ('L-"B (" (" <F5T=7)N(#HZ3VQE M26YI=&EA;&EZ92A.54Q,*3L-"B ("!]#0H (" <W1A=&EC('9O:60 =6YI M;FET*"D-"B ("![#0H (" (" (#HZ3VQE56YI;FET:6%L:7IE*"D[#0H M(" ?0T*?3L-" T*+R\O+R\O+R\O+R\O+R\O+R\O+R\O+R\O+R\O+R\O+R\O M+R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#0H-"G1Y<&5D968 8V]M7VEN:71I86QI<V5R(&-O;5]I M;FET:6%L:7IE<CL-"G1Y<&5D968 ;VQE7VEN:71I86QI<V5R(&]L95]I;FET M:6%L:7IE<CL-" T*+R\O+R\O+R\O+R\O+R\O+R\O+R\O+R\O+R\O+R\O+R\O M+R\O+R\O+R\O+R\O+R\O+R\O+R\O+R\O+R\O+R\O+R\O+R\O+R\O+R\O+R\O M+R\-"B\O($EM<&QE;65N=&%T:6]N#0H-"B\O(&EN:71I86QI<V5R#0H-"G1E M;7!L871E/" ('-S7W1Y<&5N86UE7W!A<F%M7VL 25 -"B (" (" +" M('-S7W1Y<&5N86UE7W!A<F%M7VL 6% -"B (" (" / T*:6YL:6YE(&EN M:71I86QI<V5R/$E0+"!84#XZ.FEN:71I86QI<V5R*"D-"B (" Z(&U?:'(H M:6YI=&EA;&ES871I;VY?<&]L:6-Y7W1Y<&4Z.FEN:70H*2D-"GM]#0H-"B-I M9F1E9B!?7T-/35-43%]#1E]$0T]-7U-54%!/4E0-"G1E;7!L871E/" ('-S M7W1Y<&5N86UE7W!A<F%M7VL 25 -"B (" (" +" ('-S7W1Y<&5N86UE M7W!A<F%M7VL 6% -"B (" (" / T*:6YL:6YE(&EN:71I86QI<V5R/$E0 M+"!84#XZ.FEN:71I86QI<V5R*&-S7V1W;W)D7W0 8V]);FET*0T*(" (#H M;5]H<BAI;FET:6%L:7-A=&EO;E]P;VQI8WE?='EP93HZ:6YI="AC;TEN:70I M*0T*>WT-"B-E;F1I9B O+R!?7T-/35-43%]#1E]$0T]-7U-54%!/4E0-" T* M=&5M<&QA=&4\(" <W-?='EP96YA;65?<&%R86U?:R!)4 T*(" (" (" L M(" <W-?='EP96YA;65?<&%R86U?:R!84 T*(" (" (" ^#0II;FQI;F4 M:6YI=&EA;&ES97(\25 L(%A0/CHZ?FEN:71I86QI<V5R*"D 8V]M<W1L7W1H M<F]W7S H*0T*>PT*(" (&EF*&ES7VEN:71I86QI<V5D*"DI#0H (" >PT* M(" (" ("!I;FET:6%L:7-A=&EO;E]P;VQI8WE?='EP93HZ=6YI;FET*"D[ M#0H (" ?0T*?0T*#0IT96UP;&%T93P ("!S<U]T>7!E;F%M95]P87)A;5]K M($E0#0H (" (" ("P ("!S<U]T>7!E;F%M95]P87)A;5]K(%A0#0H (" M(" (#X-"FEN;&EN92!C<U]B;V]L7W0 :6YI=&EA;&ES97(\25 L(%A0/CHZ M:7-?:6YI=&EA;&ES960H*2!C;VYS= T*>PT*(" (')E='5R;B!354-#145$ M140H;5]H<BD[#0I]#0H-"G1E;7!L871E/" ('-S7W1Y<&5N86UE7W!A<F%M M7VL 25 -"B (" (" +" ('-S7W1Y<&5N86UE7W!A<F%M7VL 6% -"B M(" (" / T*:6YL:6YE(&-S7V)O;VQ?="!I;FET:6%L:7-E<CQ)4"P 6% ^ M.CIO<&5R871O<B A*"D 8V]N<W0-"GL-"B ("!R971U<FX (6ES7VEN:71I M86QI<V5D*"D[#0I]#0H-"G1E;7!L871E/" ('-S7W1Y<&5N86UE7W!A<F%M M7VL 25 -"B (" (" +" ('-S7W1Y<&5N86UE7W!A<F%M7VL 6% -"B M(" (" / T*:6YL:6YE($A215-53%0 :6YI=&EA;&ES97(\25 L(%A0/CHZ M9V5T7TA215-53%0H*2!C;VYS= T*>PT*(" (')E='5R;B!M7VAR.PT*?0T* M#0HO*B O+R\O+R\O+R\O+R\O+R\O+R\O+R\O+R\O+R\O+R\O+R\O+R\O+R\O M+R\O+R\O+R\O+R\O+R\O+R\O+R\O+R\O+R\O+R\O+R\O+R J+PT*#0HC:69N M9&5F(%]#3TU35$Q?3D]?3D%-15-004-%#0HC(&EF9&5F(%]35$Q33T947TY/ M7TY!34534$%#10T*?2 O+R!N86UE<W!A8V4 8V]M<W1L#0HC(&5L<V4-"GT M+R\ ;F%M97-P86-E('-T;'-O9G0Z.F-O;7-T;%]P<F]J96-T#0I]("\O(&YA M;65S<&%C92!S=&QS;V9T#0HC(&5N9&EF("\J(%]35$Q33T947TY/7TY!3453 M4$%#12 J+PT*(V5N9&EF("\J("%?0T]-4U1,7TY/7TY!34534$%#12 J+PT* M#0HO*B O+R\O+R\O+R\O+R\O+R\O+R\O+R\O+R\O+R\O+R\O+R\O+R\O+R\O M+R\O+R\O+R\O+R\O+R\O+R\O+R\O+R\O+R\O+R\O+R\O+R J+PT*#0HC96YD M:68 +RH (4-/35-43%])3D-,7TA?0T]-4U1,7TE.251)04Q)4T524R J+PT* M#0HO*B O+R\O+R\O+R\O+R\O+R\O+R\O+R\O+R\O+R\O+R\O+R\O+R\O+R\O G+R\O+R\O+R\O+R\O+R\O+R\O+R\O+R\O+R\O+R\O+R\O+R J+PT* ` end
Feb 25 2004