[vlc-commits] Win32: use CoInitializeEx() instead of CoInitialize()

Rémi Denis-Courmont git at videolan.org
Mon Oct 1 17:36:57 CEST 2012


vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Mon Oct  1 18:30:36 2012 +0300| [9b58a46173cbea1dc564cced3cfe208979849209] | committer: Rémi Denis-Courmont

Win32: use CoInitializeEx() instead of CoInitialize()

That is recommended by MSDN. Also, do not use 0 for NULL.

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=9b58a46173cbea1dc564cced3cfe208979849209
---

 modules/access/dshow/dshow.cpp                    |    2 +-
 modules/access/dtv/bdagraph.cpp                   |    4 +---
 modules/codec/dmo/dmo.c                           |    2 +-
 modules/gui/qt4/components/simple_preferences.cpp |    2 +-
 modules/gui/qt4/main_interface_win32.cpp          |    2 +-
 modules/video_output/msw/common.c                 |    2 +-
 6 files changed, 6 insertions(+), 8 deletions(-)

diff --git a/modules/access/dshow/dshow.cpp b/modules/access/dshow/dshow.cpp
index 3efd39b..384230f 100644
--- a/modules/access/dshow/dshow.cpp
+++ b/modules/access/dshow/dshow.cpp
@@ -409,7 +409,7 @@ static int CommonOpen( vlc_object_t *p_this, access_sys_t *p_sys,
     bool b_use_video = true;
 
     /* Initialize OLE/COM */
-    CoInitialize( 0 );
+    CoInitializeEx( NULL, COINIT_APARTMENTTHREADED );
 
     var_Create( p_this,  CFG_PREFIX "config", VLC_VAR_BOOL | VLC_VAR_DOINHERIT );
     var_Create( p_this,  CFG_PREFIX "tuner", VLC_VAR_BOOL | VLC_VAR_DOINHERIT );
diff --git a/modules/access/dtv/bdagraph.cpp b/modules/access/dtv/bdagraph.cpp
index 608a3f8..48661c7 100644
--- a/modules/access/dtv/bdagraph.cpp
+++ b/modules/access/dtv/bdagraph.cpp
@@ -369,9 +369,7 @@ BDAGraph::BDAGraph( vlc_object_t *p_this ):
     p_scanning_tuner = NULL;
     p_grabber = NULL;
 
-    /* Initialize COM - MS says to use CoInitializeEx in preference to
-     * CoInitialize */
-    CoInitializeEx( 0, COINIT_APARTMENTTHREADED );
+    CoInitializeEx( NULL, COINIT_APARTMENTTHREADED );
 }
 
 /*****************************************************************************
diff --git a/modules/codec/dmo/dmo.c b/modules/codec/dmo/dmo.c
index 4f5f3fc..ed62556 100644
--- a/modules/codec/dmo/dmo.c
+++ b/modules/codec/dmo/dmo.c
@@ -379,7 +379,7 @@ static int DecOpen( decoder_t *p_dec )
     ldt_fs_t *ldt_fs = Setup_LDT_Keeper();
 #else
     /* Initialize OLE/COM */
-    CoInitialize( 0 );
+    CoInitializeEx( NULL, COINIT_APARTMENTTHREADED );
 #endif /* LOADER */
 
     if( LoadDMO( VLC_OBJECT(p_dec), &hmsdmo_dll, &p_dmo, &p_dec->fmt_in, false )
diff --git a/modules/gui/qt4/components/simple_preferences.cpp b/modules/gui/qt4/components/simple_preferences.cpp
index e69fc58..c19b30a 100644
--- a/modules/gui/qt4/components/simple_preferences.cpp
+++ b/modules/gui/qt4/components/simple_preferences.cpp
@@ -935,7 +935,7 @@ bool SPrefsPanel::addType( const char * psz_ext, QTreeWidgetItem* current,
 void SPrefsPanel::assoDialog()
 {
     IApplicationAssociationRegistrationUI *p_appassoc;
-    CoInitialize( 0 );
+    CoInitializeEx( NULL, COINIT_APARTMENTTHREADED );
 
     if( S_OK == CoCreateInstance(CLSID_ApplicationAssociationRegistrationUI,
                 NULL, CLSCTX_INPROC_SERVER,
diff --git a/modules/gui/qt4/main_interface_win32.cpp b/modules/gui/qt4/main_interface_win32.cpp
index e9f9752..5623cdd 100644
--- a/modules/gui/qt4/main_interface_win32.cpp
+++ b/modules/gui/qt4/main_interface_win32.cpp
@@ -79,7 +79,7 @@ void MainInterface::createTaskBarButtons()
     FIXME:the play button's picture doesn't changed to pause when clicked
     */
 
-    CoInitialize( 0 );
+    CoInitializeEx( NULL, COINIT_APARTMENTTHREADED );
 
     if( S_OK == CoCreateInstance( CLSID_TaskbarList,
                 NULL, CLSCTX_INPROC_SERVER,
diff --git a/modules/video_output/msw/common.c b/modules/video_output/msw/common.c
index bc8e96f..1272455 100644
--- a/modules/video_output/msw/common.c
+++ b/modules/video_output/msw/common.c
@@ -274,7 +274,7 @@ static void CommonChangeThumbnailClip(vout_display_t *vd, bool show)
     if (!GetVersionEx(&winVer) || winVer.dwMajorVersion <= 5)
         return;
 
-    CoInitialize(0);
+    CoInitializeEx(NULL, COINIT_APARTMENTTHREADED);
 
     void *ptr;
     if (S_OK == CoCreateInstance(&CLSID_TaskbarList,



More information about the vlc-commits mailing list