[vlc-commits] ActiveX: Changed files to be compilable by VC.

Sergey Radionov git at videolan.org
Sun Nov 20 18:12:30 CET 2011


npapi-vlc | branch: master | Sergey Radionov <RSATom at gmail.com> | Fri Nov 18 09:10:49 2011 +0700| [20d2d99dd52496dbb3813c56ff3bb6060d636cbe] | committer: Rafaël Carré

ActiveX: Changed files to be compilable by VC.

Modified-by: Rafaël Carré : moved config.h at top of includes
Signed-off-by: Rafaël Carré <funman at videolan.org>

> http://git.videolan.org/gitweb.cgi/npapi-vlc.git/?a=commit;h=20d2d99dd52496dbb3813c56ff3bb6060d636cbe
---

 activex/connectioncontainer.cpp |    2 ++
 activex/main.cpp                |   37 +++++++++++++++++--------------------
 activex/persiststreaminit.cpp   |    4 +++-
 activex/plugin.cpp              |    2 ++
 activex/plugin.h                |    2 ++
 activex/position.h              |    2 ++
 activex/vlccontrol2.cpp         |    1 +
 7 files changed, 29 insertions(+), 21 deletions(-)

diff --git a/activex/connectioncontainer.cpp b/activex/connectioncontainer.cpp
index 7d3800c..a7e6918 100644
--- a/activex/connectioncontainer.cpp
+++ b/activex/connectioncontainer.cpp
@@ -33,6 +33,7 @@
 
 using namespace std;
 
+#ifdef __MINGW32__
 ////////////////////////////////////////////////////////////////////////////////////////////////
 DEFINE_GUID(IID_IGlobalInterfaceTable,     0x00000146, 0x0000, 0x0000, 0xc0,0x00, 0x00,0x00,0x00,0x00,0x00,0x46);
 DEFINE_GUID(CLSID_StdGlobalInterfaceTable, 0x00000323, 0x0000, 0x0000, 0xc0,0x00, 0x00,0x00,0x00,0x00,0x00,0x46);
@@ -40,6 +41,7 @@ DEFINE_GUID(CLSID_StdGlobalInterfaceTable, 0x00000323, 0x0000, 0x0000, 0xc0,0x00
 const GUID  IID_IGlobalInterfaceTable = { 0x00000146, 0, 0, {0xc0, 0, 0, 0, 0, 0, 0, 0x46} };
 const CLSID CLSID_StdGlobalInterfaceTable = { 0x00000323, 0, 0, {0xc0, 0, 0, 0, 0, 0, 0, 0x46} };
 ////////////////////////////////////////////////////////////////////////////////////////////////
+#endif
 
 /* this function object is used to return the value from a map pair */
 struct VLCEnumConnectionsDereference
diff --git a/activex/main.cpp b/activex/main.cpp
index c57c813..dd309cd 100644
--- a/activex/main.cpp
+++ b/activex/main.cpp
@@ -31,15 +31,13 @@
 
 #include <tchar.h>
 
+#ifdef __MINGW32__
 #include <_mingw.h>
+#endif
 
-#ifdef __MINGW64_VERSION_MAJOR
-
-#include <guiddef.h>
 #include <objsafe.h>
 
-#else /* ! __MINGW64_VERSION_MAJOR */
-
+#if defined(__MINGW32_MAJOR_VERSION) && !defined(__MINGW64_VERSION_MAJOR)
 /*
 ** Widl generated code requires guiddef.h,
 ** which is not available under MinGW32
@@ -54,13 +52,11 @@
 /* CATID_InternetAware is declared as extern but not present in library */
 DEFINE_GUID(CATID_InternetAware, \
     0x0DE86A58, 0x2BAA, 0x11CF, 0xA2, 0x29, 0x00,0xAA,0x00,0x3D,0x73,0x52);
-static DEFINE_GUID(CATID_SafeForInitializing, \
-	0x7DD95802, 0x9882, 0x11CF, 0x9F, 0xA9, 0x00,0xAA,0x00,0x6C,0x42,0xC4);
-static DEFINE_GUID(CATID_SafeForScripting, \
-	0x7DD95801, 0x9882, 0x11CF, 0x9F, 0xA9, 0x00,0xAA,0x00,0x6C,0x42,0xC4);
-
-#endif /* __MINGW64_VERSION_MAJOR */
-
+DEFINE_GUID(CATID_SafeForInitializing, \
+    0x7DD95802, 0x9882, 0x11CF, 0x9F, 0xA9, 0x00,0xAA,0x00,0x6C,0x42,0xC4);
+DEFINE_GUID(CATID_SafeForScripting, \
+    0x7DD95801, 0x9882, 0x11CF, 0x9F, 0xA9, 0x00,0xAA,0x00,0x6C,0x42,0xC4);
+#endif
 
 using namespace std;
 
@@ -71,7 +67,7 @@ using namespace std;
 #define THREADING_MODEL "Apartment"
 #define MISC_STATUS     "131473"
 
-#define PROGID_STR COMPANY_STR"."PROGRAM_STR
+#define PROGID_STR TEXT(COMPANY_STR) TEXT(".") TEXT(PROGRAM_STR)
 
 #define GUID_STRLEN 39
 
@@ -152,7 +148,7 @@ static void UnregisterProgID(REFCLSID rclsid, unsigned int version)
     StringFromGUID2(rclsid, szCLSID, GUID_STRLEN);
 
     TCHAR progId[sizeof(PROGID_STR)+16];
-    _stprintf(progId, TEXT("%s.%u"), TEXT(PROGID_STR), version);
+    _stprintf(progId, TEXT("%s.%u"), PROGID_STR, version);
 
     SHDeleteKey(HKEY_CLASSES_ROOT, progId);
 
@@ -188,7 +184,7 @@ STDAPI DllUnregisterServer(VOID)
         pcr->Release();
     }
 
-    SHDeleteKey(HKEY_CLASSES_ROOT, TEXT(PROGID_STR));
+    SHDeleteKey(HKEY_CLASSES_ROOT, PROGID_STR);
 
     UnregisterProgID(CLSID_VLCPlugin, 2);
     UnregisterProgID(CLSID_VLCPlugin2, 1);
@@ -199,7 +195,7 @@ STDAPI DllUnregisterServer(VOID)
 static HRESULT RegisterClassID(HKEY hParent, REFCLSID rclsid, unsigned int version, BOOL isDefault, LPCTSTR path, size_t pathLen)
 {
     TCHAR progId[sizeof(PROGID_STR)+16];
-    _stprintf(progId, TEXT("%s.%u"), TEXT(PROGID_STR), version);
+    _stprintf(progId, TEXT("%s.%u"), PROGID_STR, version);
 
     TCHAR description[sizeof(DESCRIPTION)+16];
     _stprintf(description, TEXT("%s v%u"), TEXT(DESCRIPTION), version);
@@ -225,7 +221,7 @@ static HRESULT RegisterClassID(HKEY hParent, REFCLSID rclsid, unsigned int versi
         }
         if( isDefault )
         {
-            hProgKey = keyCreate(HKEY_CLASSES_ROOT, TEXT(PROGID_STR));
+            hProgKey = keyCreate(HKEY_CLASSES_ROOT, PROGID_STR);
             if( NULL != hProgKey )
             {
                 // default key value
@@ -253,12 +249,13 @@ static HRESULT RegisterClassID(HKEY hParent, REFCLSID rclsid, unsigned int versi
 
         // ToolboxBitmap32 key value
         {
-            TCHAR iconPath[pathLen+3];
+            std::vector<TCHAR> iconPathBuf(pathLen+3, 0);
+            TCHAR* iconPath = &iconPathBuf[0];
             memcpy(iconPath, path, sizeof(TCHAR)*pathLen);
             _tcscpy(iconPath+pathLen, TEXT(",1"));
             keyClose(keySetDef(keyCreate(hClassKey,
                 TEXT("ToolboxBitmap32")),
-                iconPath, sizeof(iconPath)));
+                iconPath, sizeof(TCHAR)*(_tcslen(iconPath)+1)));
         }
 
 #ifdef BUILD_LOCALSERVER
@@ -291,7 +288,7 @@ static HRESULT RegisterClassID(HKEY hParent, REFCLSID rclsid, unsigned int versi
         // VersionIndependentProgID key value
         keyClose(keySetDef(keyCreate(hClassKey,
                                      TEXT("VersionIndependentProgID")),
-                           TEXT(PROGID_STR), sizeof(TEXT(PROGID_STR))));
+                           PROGID_STR, sizeof(PROGID_STR)));
 
         // Version key value
         keyClose(keySetDef(keyCreate(hClassKey,TEXT("Version")),TEXT("1.0")));
diff --git a/activex/persiststreaminit.cpp b/activex/persiststreaminit.cpp
index 2ec4adb..fe302a1 100644
--- a/activex/persiststreaminit.cpp
+++ b/activex/persiststreaminit.cpp
@@ -25,6 +25,7 @@
 
 #include "utils.h"
 #include <map>
+#include <vector>
 
 #include <malloc.h>
 #include <wchar.h>
@@ -417,7 +418,8 @@ private:
         if( 0 == len )
             return E_INVALIDARG;
 
-        WCHAR propName[len + 1];
+        vector<WCHAR> propNameBuf(len + 1, 0);
+        WCHAR* propName = &propNameBuf[0];
 
         result = pStm->Read(propName, len*sizeof(WCHAR), NULL);
         if( FAILED(result) )
diff --git a/activex/plugin.cpp b/activex/plugin.cpp
index 2d5d1c2..a439600 100644
--- a/activex/plugin.cpp
+++ b/activex/plugin.cpp
@@ -21,6 +21,8 @@
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
  *****************************************************************************/
 
+#include "config.h"
+
 #include "plugin.h"
 
 #include "oleobject.h"
diff --git a/activex/plugin.h b/activex/plugin.h
index 5823c7c..08e228e 100644
--- a/activex/plugin.h
+++ b/activex/plugin.h
@@ -24,6 +24,8 @@
 #ifndef __PLUGIN_H__
 #define __PLUGIN_H__
 
+#include "config.h"
+
 #include <ole2.h>
 #include <olectl.h>
 
diff --git a/activex/position.h b/activex/position.h
index ec1c7f8..42d3141 100644
--- a/activex/position.h
+++ b/activex/position.h
@@ -22,6 +22,8 @@
 #ifndef POSITION_H
 #define POSITION_H
 
+#include "config.h"
+
 struct posidx_s { const char *n; size_t i; };
 static const posidx_s posidx[] = {
     { "center",        0 },
diff --git a/activex/vlccontrol2.cpp b/activex/vlccontrol2.cpp
index 5c8c268..b80980f 100644
--- a/activex/vlccontrol2.cpp
+++ b/activex/vlccontrol2.cpp
@@ -21,6 +21,7 @@
  * with this program; if not, write to the Free Software Foundation, Inc.,
  * 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
  *****************************************************************************/
+#include "config.h"
 
 #include <stdio.h>
 #include <shlwapi.h>



More information about the vlc-commits mailing list