Commit ab73f0e6 authored by Damien Fouilleul's avatar Damien Fouilleul

- ActiveX: support for libvlc and common scripting APIS, widl has replaced...

- ActiveX: support for libvlc and common scripting APIS, widl has replaced midl as default IDL compiler
parent d3a30439
......@@ -38,6 +38,8 @@ SOURCES_activex = \
viewobject.h \
vlccontrol.cpp \
vlccontrol.h \
vlccontrol2.cpp \
vlccontrol2.h \
plugin.cpp \
plugin.h \
axvlc_idl.c \
......@@ -100,10 +102,20 @@ axvlc.tlb axvlc_idl.c axvlc_idl.h: axvlc.idl
clean-tlb:
rm -f axvlc.tlb axvlc_idl.c axvlc_idl.h
else
if HAS_WIDL_COMPILER
axvlc.tlb axvlc_idl.c axvlc_idl.h: axvlc.idl
$(WIDL) -I$(WINE_SDK_PATH)/include -tuh -T axvlc.tlb -U axvlc_idl.c -H axvlc_idl.h axvlc.idl
clean-tlb:
rm -f axvlc.tlb axvlc_idl.c axvlc_idl.h
else
clean-tlb:
endif
endif
DATA_axvlc_rc = $(noinst_axvlc_rc_DATA)
......@@ -125,14 +137,13 @@ endif
clean-stamp:
rm -f stamp-pic
stamp-pic: FORCE
@for dep in "" `$(VLC_CONFIG) --target builtin`; do \
if test "$${dep}" -nt "$(LIBRARIES_activex)"; then \
rm -f $@; \
break; \
fi; \
done
@if test ! -f $@; then printf "" > $@; fi
if BUILD_SHARED
stamp-pic:
else
stamp-pic: $(shell $(VLC_CONFIG) --target builtin)
endif
@touch $@
###############################################################################
# Clean rules
......@@ -142,7 +153,6 @@ clean-local: clean-stamp clean-tlb
rm -f axvlc$(LIBEXT)
###############################################################################
# Force rule
# Force rules
###############################################################################
FORCE:
/*****************************************************************************
* axvlc.idl: ActiveX control for VLC
*****************************************************************************
* Copyright (C) 2005 the VideoLAN team
* Copyright (C) 2006 the VideoLAN team
*
* Authors: Damien Fouilleul <Damien.Fouilleul@laposte.net>
*
......@@ -23,19 +23,23 @@
//comments terminated by [t] are by tonsofpcs, regarding the string review. April 02, 2006. [t]
//Possibly change all instances of "the current playlist" to "the playlist" and "current playlist" to "the playlist" [t]
import "oaidl.idl";
[
uuid(DF2BBE39-40A8-433b-A279-073F48DA94B6),
version(1.0),
helpstring("VideoLAN VLC ActiveX Plugin"),
helpstring("VideoLAN VLC ActiveX Plugin")
]
library AXVLC
{
importlib("stdole2.tlb");
// Forward declare all types defined in this typelib
interface IVLCControl;
interface IVLCPlaylist;
interface ILibVLCControl;
dispinterface DVLCEvents;
importlib("stdole2.tlb");
enum VLCPlaylistMode
{
VLCPlayListInsert = 1,
......@@ -64,7 +68,7 @@ library AXVLC
[
odl,
uuid(C2FA41D0-B113-476e-AC8C-9BD14999C1C1),
helpstring("VLC Control"),
helpstring("VLC Control (deprecated)"),
dual,
hidden,
oleautomation
......@@ -166,14 +170,173 @@ library AXVLC
void stop();
};
[
odl,
uuid(9E0BD17B-2D3C-4656-B94D-03084F3FD9D4),
helpstring("VLC Audio APIs"),
dual,
oleautomation
]
interface IVLCAudio : IDispatch
{
[propget, helpstring("Returns/sets the audio mute state.")]
HRESULT mute([out, retval] VARIANT_BOOL* muted);
[propput, helpstring("Returns/sets the audio mute state.")]
HRESULT mute([in] VARIANT_BOOL muted);
[propget, helpstring("Returns/sets audio volume as a percent value.")]
HRESULT volume([out, retval] int* volume);
[propput, helpstring("Returns/sets audio volume as a percent value.")]
HRESULT volume([in] int volume);
[helpstring("Mute/unmute audio playback.")]
HRESULT toggleMute();
};
[
odl,
uuid(49E0DBD1-9440-466C-9C97-95C67190C603),
helpstring("VLC Input APIs"),
dual,
oleautomation
]
interface IVLCInput : IDispatch
{
[propget, helpstring("Returns the clip length, in milliseconds.")]
HRESULT length([out, retval] __int64* length);
[propget, helpstring("Returns/sets playback position in current clip. Position is ranging from 0.0 to 1.0.")]
HRESULT position([out, retval] float* position);
[propput, helpstring("Returns/sets playback position in the current clip. Position ranging from 0.0 to 1.0.")]
HRESULT position([in] float position);
[propget, helpstring("Returns/sets playback time in current clip, in milliseconds.")]
HRESULT time([out, retval] __int64* time);
[propput, helpstring("Returns/sets playback time in the current clip, in milliseconds.")]
HRESULT time([in] __int64 time);
[propget, helpstring("Returns current playback state.")]
HRESULT state([out, retval] int* state);
[propget, helpstring("Returns/sets current playback rate, normal rate is 1.0 ")]
HRESULT rate([out, retval] float* rate);
[propput, helpstring("Returns/sets current playback rate, normal rate is 1.0.")]
HRESULT rate([in] float rate);
[propget, helpstring("Returns current playback frames per seconds if available.")]
HRESULT fps([out, retval] float* fps);
[propget, helpstring("Returns whether current playback displays video.")]
HRESULT hasVout([out, retval] VARIANT_BOOL* hasVout);
};
[
odl,
uuid(54613049-40BF-4035-9E70-0A9312C0188D),
helpstring("VLC Playlist APIs"),
dual,
oleautomation
]
interface IVLCPlaylist : IDispatch
{
[propget, helpstring("Returns number of items in playlist.")]
HRESULT itemCount([out, retval] int* count);
[propget, helpstring("Returns whether playback displays video.")]
HRESULT isPlaying([out, retval] VARIANT_BOOL* playing);
[helpstring("Add a playlist item.")]
HRESULT add([in] BSTR uri, [in] BSTR name, [in, optional] VARIANT options, [out, retval] int* item);
[helpstring("Play/Resume the playlist.")]
HRESULT play();
[helpstring("Play item in playlist.")]
HRESULT playItem([in] int item);
[helpstring("Play/Pause current clip.")]
HRESULT togglePause();
[helpstring("Stop current clip.")]
HRESULT stop();
[helpstring("Advance to next item in playlist.")]
HRESULT next();
[helpstring("Advance to previous item in playlist.")]
HRESULT prev();
[helpstring("Remove all items from playlist.")]
HRESULT clear();
[helpstring("remove item from playlist.")]
HRESULT removeItem([in] int item);
};
[
odl,
uuid(0AAEDF0B-D333-4B27-A0C6-BBF31413A42E),
helpstring("VLC Video APIs"),
dual,
oleautomation
]
interface IVLCVideo : IDispatch
{
[propget, helpstring("Returns/sets the fullscreen state.")]
HRESULT fullscreen([out, retval] VARIANT_BOOL* fullscreen);
[propput, helpstring("Returns/sets the fullscreen state.")]
HRESULT fullscreen([in] VARIANT_BOOL fullscreen);
[propget, helpstring("Returns video original width.")]
HRESULT width([out, retval] int* width);
[propget, helpstring("Returns video original height.")]
HRESULT height([out, retval] int* height);
};
[
odl,
uuid(2D719729-5333-406C-BF12-8DE787FD65E3),
helpstring("VLC Control"),
dual,
oleautomation
]
interface IVLCControl2 : IDispatch
{
[propget, helpstring("Returns the audio object.")]
HRESULT audio([out, retval] IVLCAudio** obj);
[propget, helpstring("Returns the audio object.")]
HRESULT input([out, retval] IVLCInput** obj);
[propget, helpstring("Returns the playlist object.")]
HRESULT playlist([out, retval] IVLCPlaylist** obj);
[propget, helpstring("Returns the audio object.")]
HRESULT video([out, retval] IVLCVideo** obj);
};
[
uuid(E23FE9C6-778E-49D4-B537-38FCDE4887D8),
helpstring("VLC control"),
helpstring("VLC control (deprecated)"),
control
]
coclass VLCPlugin
{
[default] interface IVLCControl;
interface IVLCControl2;
[default, source] dispinterface DVLCEvents;
};
[
uuid(9BE31822-FDAD-461B-AD51-BE1D1C159921),
helpstring("VLC control"),
control
]
coclass VLCPlugin2
{
[default] interface IVLCControl2;
interface IVLCControl;
[default, source] dispinterface DVLCEvents;
};
};
No preview for this file type
/* this file contains the actual definitions of */
/* the IIDs and CLSIDs */
/*** Autogenerated by WIDL 0.9.20 from axvlc.idl - Do not edit ***/
/* link this file in with the server and any clients */
#include <rpc.h>
#include <rpcndr.h>
#define INITGUID
#include <guiddef.h>
/* File created by MIDL compiler version 5.01.0164 */
/* at Sun Apr 02 19:22:45 2006
*/
/* Compiler settings for axvlc.idl:
Oicf (OptLev=i2), W1, Zp8, env=Win32, ms_ext, c_ext
error checks: allocation ref bounds_check enum stub_data
*/
//@@MIDL_FILE_HEADING( )
#ifdef __cplusplus
extern "C"{
#endif
#ifndef __IID_DEFINED__
#define __IID_DEFINED__
typedef struct _IID
{
unsigned long x;
unsigned short s1;
unsigned short s2;
unsigned char c[8];
} IID;
#endif // __IID_DEFINED__
#ifndef CLSID_DEFINED
#define CLSID_DEFINED
typedef IID CLSID;
#endif // CLSID_DEFINED
const IID LIBID_AXVLC = {0xDF2BBE39,0x40A8,0x433b,{0xA2,0x79,0x07,0x3F,0x48,0xDA,0x94,0xB6}};
const IID IID_IVLCControl = {0xC2FA41D0,0xB113,0x476e,{0xAC,0x8C,0x9B,0xD1,0x49,0x99,0xC1,0xC1}};
const IID DIID_DVLCEvents = {0xDF48072F,0x5EF8,0x434e,{0x9B,0x40,0xE2,0xF3,0xAE,0x75,0x9B,0x5F}};
const CLSID CLSID_VLCPlugin = {0xE23FE9C6,0x778E,0x49D4,{0xB5,0x37,0x38,0xFC,0xDE,0x48,0x87,0xD8}};
extern "C" {
#endif
DEFINE_GUID(LIBID_AXVLC, 0xdf2bbe39, 0x40a8, 0x433b, 0xa2,0x79, 0x07,0x3f,0x48,0xda,0x94,0xb6);
DEFINE_GUID(IID_IVLCControl, 0xc2fa41d0, 0xb113, 0x476e, 0xac,0x8c, 0x9b,0xd1,0x49,0x99,0xc1,0xc1);
DEFINE_GUID(DIID_DVLCEvents, 0xdf48072f, 0x5ef8, 0x434e, 0x9b,0x40, 0xe2,0xf3,0xae,0x75,0x9b,0x5f);
DEFINE_GUID(IID_IVLCAudio, 0x9e0bd17b, 0x2d3c, 0x4656, 0xb9,0x4d, 0x03,0x08,0x4f,0x3f,0xd9,0xd4);
DEFINE_GUID(IID_IVLCInput, 0x49e0dbd1, 0x9440, 0x466c, 0x9c,0x97, 0x95,0xc6,0x71,0x90,0xc6,0x03);
DEFINE_GUID(IID_IVLCPlaylist, 0x54613049, 0x40bf, 0x4035, 0x9e,0x70, 0x0a,0x93,0x12,0xc0,0x18,0x8d);
DEFINE_GUID(IID_IVLCVideo, 0x0aaedf0b, 0xd333, 0x4b27, 0xa0,0xc6, 0xbb,0xf3,0x14,0x13,0xa4,0x2e);
DEFINE_GUID(IID_IVLCControl2, 0x2d719729, 0x5333, 0x406c, 0xbf,0x12, 0x8d,0xe7,0x87,0xfd,0x65,0xe3);
DEFINE_GUID(CLSID_VLCPlugin, 0xe23fe9c6, 0x778e, 0x49d4, 0xb5,0x37, 0x38,0xfc,0xde,0x48,0x87,0xd8);
DEFINE_GUID(CLSID_VLCPlugin2, 0x9be31822, 0xfdad, 0x461b, 0xad,0x51, 0xbe,0x1d,0x1c,0x15,0x99,0x21);
#ifdef __cplusplus
}
#endif
This diff is collapsed.
/*****************************************************************************
* guiddef.h: ActiveX control for VLC
*****************************************************************************
* Copyright (C) 2006 the VideoLAN team
*
* Authors: Damien Fouilleul <Damien.Fouilleul@laposte.net>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
*****************************************************************************/
#ifndef __GUIDDEF_H__
#define __GUIDDEF_H__
/*
** Widl generated code requires guiddef.h,
** which is not available under MinGW
*/
#undef GUID_EXT
#define GUID_EXT
#include <initguid.h>
#endif
......@@ -21,6 +21,9 @@
*****************************************************************************/
#include "plugin.h"
#include "utils.h"
#include <stdio.h>
#include <comcat.h>
#include <windows.h>
......@@ -30,16 +33,12 @@ using namespace std;
#define COMPANY_STR "VideoLAN"
#define PROGRAM_STR "VLCPlugin"
#define VERSION_MAJOR_STR "1"
#define VERSION_MINOR_STR "0"
#define DESCRIPTION "VideoLAN VLC ActiveX Plugin"
#define THREADING_MODEL "Apartment"
#define MISC_STATUS "131473"
#define PROGID_STR COMPANY_STR"."PROGRAM_STR
#define VERS_PROGID_STR COMPANY_STR"."PROGRAM_STR"."VERSION_MAJOR_STR
#define VERSION_STR VERSION_MAJOR_STR"."VERSION_MINOR_STR
#define GUID_STRLEN 39
......@@ -58,9 +57,10 @@ STDAPI DllGetClassObject(REFCLSID rclsid, REFIID riid, LPVOID *ppv)
*ppv = NULL;
if( CLSID_VLCPlugin == rclsid )
if( (CLSID_VLCPlugin == rclsid)
|| (CLSID_VLCPlugin2 == rclsid) )
{
VLCPluginClass *plugin = new VLCPluginClass(&i_class_ref, h_instance);
VLCPluginClass *plugin = new VLCPluginClass(&i_class_ref, h_instance, rclsid);
hr = plugin->QueryInterface(riid, ppv);
plugin->Release();
}
......@@ -72,48 +72,67 @@ STDAPI DllCanUnloadNow(VOID)
return (0 == i_class_ref) ? S_OK: S_FALSE;
};
static LPCTSTR TStrFromGUID(REFGUID clsid)
static inline HKEY keyCreate(HKEY parentKey, LPCSTR keyName)
{
LPOLESTR oleStr;
if( FAILED(StringFromIID(clsid, &oleStr)) )
return NULL;
//check whether TCHAR and OLECHAR are both either ANSI or UNICODE
if( sizeof(TCHAR) == sizeof(OLECHAR) )
return (LPCTSTR)oleStr;
LPTSTR pct_CLSID = NULL;
#ifndef OLE2ANSI
size_t len = WideCharToMultiByte(CP_ACP, 0, oleStr, -1, NULL, 0, NULL, NULL);
if( len > 0 )
HKEY childKey;
if( ERROR_SUCCESS == RegCreateKeyExA(parentKey, keyName, 0, NULL,
REG_OPTION_NON_VOLATILE, KEY_ALL_ACCESS, NULL, &childKey, NULL) )
{
pct_CLSID = (char *)CoTaskMemAlloc(len);
WideCharToMultiByte(CP_ACP, 0, oleStr, -1, pct_CLSID, len, NULL, NULL);
return childKey;
}
#else
size_t len = MutiByteToWideChar(CP_ACP, 0, oleStr, -1, NULL, 0);
if( len > 0 )
return NULL;
};
static inline HKEY keySet(HKEY hKey, LPCSTR valueName, const void *s, size_t len)
{
if( NULL != hKey )
{
clsidStr = (wchar_t *)CoTaskMemAlloc(len*sizeof(wchar_t));
MultiByteToWideChar(CP_ACP, 0, oleStr, -1, pct_CLSID, len);
RegSetValueExA(hKey, valueName, 0, REG_SZ,
(const BYTE*)s, len);
}
#endif
CoTaskMemFree(oleStr);
return pct_CLSID;
return hKey;
};
static HKEY keyCreate(HKEY parentKey, LPCTSTR keyName)
static inline HKEY keySetDef(HKEY hKey, const void *s, size_t len)
{
HKEY childKey;
if( ERROR_SUCCESS == RegCreateKeyEx(parentKey, keyName, 0, NULL,
REG_OPTION_NON_VOLATILE, KEY_ALL_ACCESS, NULL, &childKey, NULL) )
return keySet(hKey, NULL, s, len);
};
static inline HKEY keySetDef(HKEY hKey, LPCSTR s)
{
return keySetDef(hKey, s, strlen(s)+1);
};
static inline HKEY keyClose(HKEY hKey)
{
if( NULL != hKey )
{
return childKey;
RegCloseKey(hKey);
}
return NULL;
};
static HRESULT UnregisterProgID(REFCLSID rclsid, unsigned int version)
{
LPCSTR psz_CLSID = CStrFromGUID(rclsid);
if( NULL == psz_CLSID )
return E_OUTOFMEMORY;
char progId[sizeof(PROGID_STR)+16];
sprintf(progId, "%s.%u", PROGID_STR, version);
SHDeleteKeyA(HKEY_CLASSES_ROOT, progId);
HKEY hClsIDKey;
if( ERROR_SUCCESS == RegOpenKeyExA(HKEY_CLASSES_ROOT, "CLSID", 0, KEY_WRITE, &hClsIDKey) )
{
SHDeleteKey(hClsIDKey, psz_CLSID);
RegCloseKey(hClsIDKey);
}
CoTaskMemFree((void *)psz_CLSID);
};
STDAPI DllUnregisterServer(VOID)
{
// unregister type lib from the registry
......@@ -132,177 +151,193 @@ STDAPI DllUnregisterServer(VOID)
pcr->UnRegisterClassImplCategories(CLSID_VLCPlugin,
sizeof(implCategories)/sizeof(CATID), implCategories);
pcr->UnRegisterClassImplCategories(CLSID_VLCPlugin2,
sizeof(implCategories)/sizeof(CATID), implCategories);
pcr->Release();
}
SHDeleteKey(HKEY_CLASSES_ROOT, TEXT(VERS_PROGID_STR));
SHDeleteKey(HKEY_CLASSES_ROOT, TEXT(PROGID_STR));
LPCTSTR psz_CLSID = TStrFromGUID(CLSID_VLCPlugin);
if( NULL == psz_CLSID )
return E_OUTOFMEMORY;
HKEY hClsIDKey;
if( ERROR_SUCCESS == RegOpenKeyEx(HKEY_CLASSES_ROOT, TEXT("CLSID"), 0, KEY_WRITE, &hClsIDKey) )
{
SHDeleteKey(hClsIDKey, psz_CLSID);
RegCloseKey(hClsIDKey);
}
CoTaskMemFree((void *)psz_CLSID);
UnregisterProgID(CLSID_VLCPlugin, 1);
UnregisterProgID(CLSID_VLCPlugin2, 1);
return S_OK;
};
STDAPI DllRegisterServer(VOID)
static HRESULT RegisterClassID(HKEY hParent, REFCLSID rclsid, unsigned int version, const char *path, size_t pathLen)
{
DllUnregisterServer();
char DllPath[MAX_PATH];
DWORD DllPathLen= GetModuleFileName(h_instance, DllPath, sizeof(DllPath)) ;
if( 0 == DllPathLen )
return E_UNEXPECTED;
LPCTSTR psz_CLSID = TStrFromGUID(CLSID_VLCPlugin);
if( NULL == psz_CLSID )
return E_OUTOFMEMORY;
HKEY hClassKey;
{
LPCSTR psz_CLSID = CStrFromGUID(rclsid);
HKEY hBaseKey;
if( NULL == psz_CLSID )
return E_OUTOFMEMORY;
if( ERROR_SUCCESS != RegOpenKeyEx(HKEY_CLASSES_ROOT, TEXT("CLSID"), 0, KEY_CREATE_SUB_KEY, &hBaseKey) )
return SELFREG_E_CLASS;
HKEY hClassKey = keyCreate(hBaseKey, psz_CLSID);
hClassKey = keyCreate(hParent, psz_CLSID);
CoTaskMemFree((void *)psz_CLSID);
}
if( NULL != hClassKey )
{
HKEY hSubKey;
// default key value
RegSetValueEx(hClassKey, NULL, 0, REG_SZ,
(const BYTE*)DESCRIPTION, sizeof(DESCRIPTION));
keySetDef(hClassKey, DESCRIPTION, sizeof(DESCRIPTION));
// Control key value
hSubKey = keyCreate(hClassKey, TEXT("Control"));
RegCloseKey(hSubKey);
keyClose(keyCreate(hClassKey, "Control"));
// Insertable key value
//hSubKey = keyCreate(hClassKey, TEXT("Insertable"));
//RegCloseKey(hSubKey);
//keyClose(keyCreate(hClassKey, "Insertable"));
// ToolboxBitmap32 key value
hSubKey = keyCreate(hClassKey, TEXT("ToolboxBitmap32"));
strcpy(DllPath+DllPathLen, ",1");
RegSetValueEx(hSubKey, NULL, 0, REG_SZ,
(const BYTE*)DllPath, DllPathLen+2);
DllPath[DllPathLen] = '\0';
RegCloseKey(hSubKey);
{
char iconPath[pathLen+3];
memcpy(iconPath, path, pathLen);
strcpy(iconPath+pathLen, ",1");
keyClose(keySetDef(keyCreate(hClassKey,
"ToolboxBitmap32"),
iconPath, sizeof(iconPath)));
}
#ifdef BUILD_LOCALSERVER
// LocalServer32 key value
hSubKey = keyCreate(hClassKey, TEXT("LocalServer32"));
RegSetValueEx(hSubKey, NULL, 0, REG_SZ,
(const BYTE*)DllPath, DllPathLen);
RegCloseKey(hSubKey);
keyClose(keySetDef(keyCreate(hClassKey,
"LocalServer32", path, pathLen+1)));
#else
// InprocServer32 key value
hSubKey = keyCreate(hClassKey, TEXT("InprocServer32"));
RegSetValueEx(hSubKey, NULL, 0, REG_SZ,
(const BYTE*)DllPath, DllPathLen);
RegSetValueEx(hSubKey, TEXT("ThreadingModel"), 0, REG_SZ,
(const BYTE*)THREADING_MODEL, sizeof(THREADING_MODEL));
RegCloseKey(hSubKey);
{
HKEY hSubKey = keySetDef(keyCreate(hClassKey,
"InprocServer32"),
path, pathLen+1);
keySet(hSubKey,
"ThreadingModel",
THREADING_MODEL, sizeof(THREADING_MODEL));
keyClose(hSubKey);
}
#endif
// MiscStatus key value
hSubKey = keyCreate(hClassKey, TEXT("MiscStatus\\1"));
RegSetValueEx(hSubKey, NULL, 0, REG_SZ, (const BYTE*)MISC_STATUS, sizeof(MISC_STATUS));
RegCloseKey(hSubKey);
keyClose(keySetDef(keyCreate(hClassKey,
"MiscStatus\\1"),
MISC_STATUS, sizeof(MISC_STATUS)));
// Programmable key value
hSubKey = keyCreate(hClassKey, TEXT("Programmable"));
RegCloseKey(hSubKey);
keyClose(keyCreate(hClassKey, "Programmable"));
// ProgID key value
hSubKey = keyCreate(hClassKey, TEXT("ProgID"));
RegSetValueEx(hSubKey, NULL, 0, REG_SZ,
(const BYTE*)VERS_PROGID_STR, sizeof(VERS_PROGID_STR));
RegCloseKey(hSubKey);
{
char progId[sizeof(PROGID_STR)+16];
sprintf(progId, "%s.%u", PROGID_STR, version);
keyClose(keySetDef(keyCreate(hClassKey,
TEXT("ProgID")),
progId));
}
// VersionIndependentProgID key value
hSubKey = keyCreate(hClassKey, TEXT("VersionIndependentProgID"));
RegSetValueEx(hSubKey, NULL, 0, REG_SZ,
(const BYTE*)PROGID_STR, sizeof(PROGID_STR));
RegCloseKey(hSubKey);
keyClose(keySetDef(keyCreate(hClassKey,
"VersionIndependentProgID"),
PROGID_STR, sizeof(PROGID_STR)));
// Version key value
hSubKey = keyCreate(hClassKey, TEXT("Version"));
RegSetValueEx(hSubKey, NULL, 0, REG_SZ,
(const BYTE*)VERSION_STR, sizeof(VERSION_STR));
RegCloseKey(hSubKey);
{
char ver[32];
sprintf(ver, "%u.0", version);
keyClose(keySetDef(keyCreate(hClassKey,
"Version"),
ver));
}
// TypeLib key value
LPCTSTR psz_LIBID = TStrFromGUID(LIBID_AXVLC);
LPCSTR psz_LIBID = CStrFromGUID(LIBID_AXVLC);
if( NULL != psz_LIBID )
{
hSubKey = keyCreate(hClassKey, TEXT("TypeLib"));
RegSetValueEx(hSubKey, NULL, 0, REG_SZ,
(const BYTE*)psz_LIBID, sizeof(TCHAR)*GUID_STRLEN);
RegCloseKey(hSubKey);
keyClose(keySetDef(keyCreate(hClassKey,
"TypeLib"),
psz_LIBID, GUID_STRLEN));
CoTaskMemFree((void *)psz_LIBID);
}
RegCloseKey(hClassKey);
}
RegCloseKey(hBaseKey);
return S_OK;
}
static HRESULT RegisterProgID(REFCLSID rclsid, unsigned int version)
{
LPCSTR psz_CLSID = CStrFromGUID(rclsid);
hBaseKey = keyCreate(HKEY_CLASSES_ROOT, TEXT(PROGID_STR));
if( NULL == psz_CLSID )
return E_OUTOFMEMORY;
char progId[sizeof(PROGID_STR)+16];
sprintf(progId, "%s.%u", PROGID_STR, version);
HKEY hBaseKey = keyCreate(HKEY_CLASSES_ROOT, progId);
if( NULL != hBaseKey )
{
// default key value
RegSetValueEx(hBaseKey, NULL, 0, REG_SZ,
(const BYTE*)DESCRIPTION, sizeof(DESCRIPTION));
HKEY hSubKey = keyCreate(hBaseKey, TEXT("CLSID"));
if( NULL != hSubKey )
{