Commit ebf11a99 authored by Damien Fouilleul's avatar Damien Fouilleul

- activex: globally use win32 unicode APIs, hopefully this will fix reported registration problems

parent 560b07b4
This diff is collapsed.
......@@ -430,30 +430,43 @@ HRESULT VLCPlugin::getVLC(libvlc_instance_t** pp_libvlc)
int ppsz_argc = 1;
HKEY h_key;
DWORD i_type, i_data = MAX_PATH + 1;
char p_data[MAX_PATH + 1];
if( RegOpenKeyEx( HKEY_LOCAL_MACHINE, "Software\\VideoLAN\\VLC",
char p_data[MAX_PATH];
if( RegOpenKeyEx( HKEY_LOCAL_MACHINE, TEXT("Software\\VideoLAN\\VLC"),
0, KEY_READ, &h_key ) == ERROR_SUCCESS )
{
if( RegQueryValueEx( h_key, "InstallDir", 0, &i_type,
(LPBYTE)p_data, &i_data ) == ERROR_SUCCESS )
DWORD i_type, i_data = MAX_PATH;
TCHAR w_data[MAX_PATH];
if( RegQueryValueEx( h_key, TEXT("InstallDir"), 0, &i_type,
(LPBYTE)w_data, &i_data ) == ERROR_SUCCESS )
{
if( i_type == REG_SZ )
{
strcat( p_data, "\\plugins" );
ppsz_argv[ppsz_argc++] = "--plugin-path";
ppsz_argv[ppsz_argc++] = p_data;
if( WideCharToMultiByte(CP_UTF8, 0, w_data, -1, p_data,
sizeof(p_data)-sizeof("\\plugins")+1, NULL, NULL) )
{
strcat( p_data, "\\plugins" );
ppsz_argv[ppsz_argc++] = "--plugin-path";
ppsz_argv[ppsz_argc++] = p_data;
}
}
}
RegCloseKey( h_key );
}
char p_path[MAX_PATH+1];
DWORD len = GetModuleFileNameA(DllGetModule(), p_path, sizeof(p_path));
if( len > 0 )
char p_path[MAX_PATH];
{
p_path[len] = '\0';
ppsz_argv[0] = p_path;
TCHAR w_path[MAX_PATH];
DWORD len = GetModuleFileName(DllGetModule(), w_path, MAX_PATH);
if( len > 0 )
{
len = WideCharToMultiByte(CP_UTF8, 0, w_path, len, p_path,
sizeof(p_path)-1, NULL, NULL);
if( len > 0 )
{
p_path[len] = '\0';
ppsz_argv[0] = p_path;
}
}
}
// make sure plugin isn't affected with VLC single instance mode
......@@ -681,7 +694,7 @@ HRESULT VLCPlugin::onActivateInPlace(LPMSG lpMesg, HWND hwndParent, LPCRECT lprc
** properly displayed.
*/
_inplacewnd = CreateWindow(_p_class->getInPlaceWndClassName(),
"VLC Plugin In-Place Window",
TEXT("VLC Plugin In-Place Window"),
WS_CHILD|WS_CLIPCHILDREN|WS_CLIPSIBLINGS,
lprcPosRect->left,
lprcPosRect->top,
......
......@@ -51,7 +51,7 @@ public:
REFCLSID getClassID(void) { return (REFCLSID)_classid; };
LPCSTR getInPlaceWndClassName(void) const { return TEXT("VLC Plugin In-Place"); };
LPCTSTR getInPlaceWndClassName(void) const { return TEXT("VLC Plugin In-Place"); };
HINSTANCE getHInstance(void) const { return _hinstance; };
LPPICTURE getInPlacePict(void) const
{ if( NULL != _inplace_picture) _inplace_picture->AddRef(); return _inplace_picture; };
......
......@@ -77,28 +77,6 @@ BSTR BSTRFromCStr(UINT codePage, LPCSTR s)
return NULL;
};
char *CStrFromGUID(REFGUID clsid)
{
LPOLESTR oleStr;
if( FAILED(StringFromIID(clsid, &oleStr)) )
return NULL;
#ifdef OLE2ANSI
return (LPCSTR)oleStr;
#else
char *pct_CLSID = NULL;
size_t len = WideCharToMultiByte(CP_ACP, 0, oleStr, -1, NULL, 0, NULL, NULL);
if( len > 0 )
{
pct_CLSID = (char *)CoTaskMemAlloc(len);
WideCharToMultiByte(CP_ACP, 0, oleStr, -1, pct_CLSID, len, NULL, NULL);
}
CoTaskMemFree(oleStr);
return pct_CLSID;
#endif
};
/*
** properties
*/
......
......@@ -32,8 +32,6 @@ extern char *CStrFromWSTR(UINT codePage, LPCWSTR wstr, UINT len);
extern char *CStrFromBSTR(UINT codePage, BSTR bstr);
extern BSTR BSTRFromCStr(UINT codePage, LPCSTR s);
extern char *CStrFromGUID(REFGUID clsid);
// properties
extern HRESULT GetObjectProperty(LPUNKNOWN object, DISPID dispID, VARIANT& v);
......
......@@ -5268,7 +5268,7 @@ then
AC_LANG_PUSH(C++)
AC_CHECK_HEADERS(ole2.h,
[AC_CHECK_HEADERS(olectl.h,
[ VLC_ADD_CPPFLAGS([activex],[-D_MIDL_USE_GUIDDEF_])
[ VLC_ADD_CPPFLAGS([activex],[-DUNICODE -D_UNICODE -D_MIDL_USE_GUIDDEF_])
VLC_ADD_CXXFLAGS([activex],[-fno-exceptions])
VLC_ADD_LDFLAGS([activex],[-lole32 -loleaut32 -luuid -lshlwapi])
AC_CHECK_HEADERS(objsafe.h,
......
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