Commit 77e19efd authored by Damien Fouilleul's avatar Damien Fouilleul

- install axvlc.dll within the VLC directory, rather than WINDOWS

- DllRegisterServer modified to use current DLL path when registering control
parent f700641d
...@@ -28,7 +28,6 @@ ...@@ -28,7 +28,6 @@
using namespace std; using namespace std;
#define COMDLLPATH "axvlc.dll"
#define THREADING_MODEL "Both" #define THREADING_MODEL "Both"
#define COMPANY_STR "VideoLAN" #define COMPANY_STR "VideoLAN"
#define PROGRAM_STR "VLCPlugin" #define PROGRAM_STR "VLCPlugin"
...@@ -147,6 +146,7 @@ STDAPI DllUnregisterServer(VOID) ...@@ -147,6 +146,7 @@ STDAPI DllUnregisterServer(VOID)
SHDeleteKey(hClsIDKey, psz_CLSID); SHDeleteKey(hClsIDKey, psz_CLSID);
RegCloseKey(hClsIDKey); RegCloseKey(hClsIDKey);
} }
CoTaskMemFree((void *)psz_CLSID);
return S_OK; return S_OK;
}; };
...@@ -155,6 +155,11 @@ STDAPI DllRegisterServer(VOID) ...@@ -155,6 +155,11 @@ STDAPI DllRegisterServer(VOID)
{ {
DllUnregisterServer(); DllUnregisterServer();
char DllPath[MAX_PATH];
DWORD DllPathLen= GetModuleFileName(h_instance, DllPath, sizeof(DllPath)) ;
if( 0 == DllPathLen )
return E_FAIL;
LPCTSTR psz_CLSID = TStrFromGUID(CLSID_VLCPlugin); LPCTSTR psz_CLSID = TStrFromGUID(CLSID_VLCPlugin);
if( NULL == psz_CLSID ) if( NULL == psz_CLSID )
...@@ -181,7 +186,7 @@ STDAPI DllRegisterServer(VOID) ...@@ -181,7 +186,7 @@ STDAPI DllRegisterServer(VOID)
// InprocServer32 key value // InprocServer32 key value
hSubKey = keyCreate(hClassKey, TEXT("InprocServer32")); hSubKey = keyCreate(hClassKey, TEXT("InprocServer32"));
RegSetValueEx(hSubKey, NULL, 0, REG_SZ, RegSetValueEx(hSubKey, NULL, 0, REG_SZ,
(const BYTE*)COMDLLPATH, sizeof(COMDLLPATH)); (const BYTE*)DllPath, DllPathLen);
RegSetValueEx(hSubKey, TEXT("ThreadingModel"), 0, REG_SZ, RegSetValueEx(hSubKey, TEXT("ThreadingModel"), 0, REG_SZ,
(const BYTE*)THREADING_MODEL, sizeof(THREADING_MODEL)); (const BYTE*)THREADING_MODEL, sizeof(THREADING_MODEL));
RegCloseKey(hSubKey); RegCloseKey(hSubKey);
...@@ -291,8 +296,22 @@ STDAPI DllRegisterServer(VOID) ...@@ -291,8 +296,22 @@ STDAPI DllRegisterServer(VOID)
// register type lib into the registry // register type lib into the registry
ITypeLib *typeLib; ITypeLib *typeLib;
if( SUCCEEDED(LoadTypeLibEx(OLESTR("")COMDLLPATH, REGKIND_REGISTER, &typeLib)) ) #ifndef OLE2ANSI
size_t typeLibPathLen = MultiByteToWideChar(CP_ACP, 0, DllPath, DllPathLen, NULL, 0);
if( typeLibPathLen > 0 )
{
LPOLESTR typeLibPath = (LPOLESTR)CoTaskMemAlloc(typeLibPathLen*sizeof(wchar_t));
MultiByteToWideChar(CP_ACP, 0, DllPath, DllPathLen, typeLibPath, typeLibPathLen);
if( SUCCEEDED(LoadTypeLibEx(typeLibPath, REGKIND_REGISTER, &typeLib)) )
typeLib->Release(); typeLib->Release();
CoTaskMemFree((void *)typeLibPath);
}
#else
if( SUCCEEDED(LoadTypeLibEx((LPOLESTR)DllPath, REGKIND_REGISTER, &typeLib)) )
typeLib->Release();
#endif
CoTaskMemFree((void *)psz_CLSID);
return S_OK; return S_OK;
}; };
...@@ -302,7 +321,7 @@ STDAPI DllRegisterServer(VOID) ...@@ -302,7 +321,7 @@ STDAPI DllRegisterServer(VOID)
/* /*
** easier to debug an application than a DLL on cygwin GDB :) ** easier to debug an application than a DLL on cygwin GDB :)
*/ */
#include <stream.h> #include <iostream>
STDAPI_(int) WinMain(HINSTANCE hInst, HINSTANCE hPrev, LPSTR szCmdLine, int sw) STDAPI_(int) WinMain(HINSTANCE hInst, HINSTANCE hPrev, LPSTR szCmdLine, int sw)
{ {
......
...@@ -202,9 +202,9 @@ SectionEnd ...@@ -202,9 +202,9 @@ SectionEnd
Section /o "ActiveX plugin" SEC04 Section /o "ActiveX plugin" SEC04
SectionIn 2 3 SectionIn 2 3
SetOutPath $SYSDIR SetOutPath "$INSTDIR"
File activex\axvlc.dll File activex\axvlc.dll
RegDLL $SYSDIR\axvlc.dll RegDLL "$INSTDIR\axvlc.dll"
SectionEnd SectionEnd
SubSection "File type associations" SEC05 SubSection "File type associations" SEC05
...@@ -335,8 +335,8 @@ Section Uninstall ...@@ -335,8 +335,8 @@ Section Uninstall
!insertmacro UnRegisterExtensionSection ".wma" !insertmacro UnRegisterExtensionSection ".wma"
!insertmacro UnRegisterExtensionSection ".wmv" !insertmacro UnRegisterExtensionSection ".wmv"
UnRegDLL $SYSDIR\axvlc.dll UnRegDLL "$INSTDIR\axvlc.dll"
Delete /REBOOTOK $SYSDIR\axvlc.dll Delete /REBOOTOK "$INSTDIR\axvlc.dll"
RMDir "$SMPROGRAMS\VideoLAN" RMDir "$SMPROGRAMS\VideoLAN"
RMDir /r $SMPROGRAMS\VideoLAN RMDir /r $SMPROGRAMS\VideoLAN
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment