#include <windows.h>
#include <shlwapi.h>
+#include <guiddef.h>
+
using namespace std;
#define COMPANY_STR "VideoLAN"
#define GUID_STRLEN 39
/*
-** MingW headers do not declare those
+** MingW headers & libs do not declare those
*/
-extern const CATID CATID_SafeForInitializing;
-extern const CATID CATID_SafeForScripting;
+static 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);
static LONG i_class_ref= 0;
static HINSTANCE h_instance= 0;
+HMODULE DllGetModule()
+{
+ return h_instance;
+};
+
STDAPI DllGetClassObject(REFCLSID rclsid, REFIID riid, LPVOID *ppv)
{
HRESULT hr = CLASS_E_CLASSNOTAVAILABLE;
*ppv = NULL;
- if( CLSID_VLCPlugin2 == rclsid )
+ if( (CLSID_VLCPlugin == rclsid )
+ || ( CLSID_VLCPlugin2 == rclsid) )
{
VLCPluginClass *plugin = new VLCPluginClass(&i_class_ref, h_instance, rclsid);
hr = plugin->QueryInterface(riid, ppv);
CATID implCategories[] = {
CATID_Control,
CATID_PersistsToPropertyBag,
- CATID_SafeForInitializing,
- CATID_SafeForScripting,
+ _CATID_InternetAware,
+ _CATID_SafeForInitializing,
+ _CATID_SafeForScripting,
};
pcr->UnRegisterClassImplCategories(CLSID_VLCPlugin,
keyClose(keySetDef(keyCreate(hProgKey, "CLSID"),
psz_CLSID,
GUID_STRLEN));
-
+
//hSubKey = keyClose(keyCreate(hBaseKey, "Insertable"));
-
+
RegCloseKey(hProgKey);
}
if( isDefault )
keyClose(keySetDef(keyCreate(hProgKey, "CLSID"),
psz_CLSID,
GUID_STRLEN));
-
+
keyClose(keySetDef(keyCreate(hProgKey, "CurVer"),
progId));
}
char DllPath[MAX_PATH];
DWORD DllPathLen=GetModuleFileNameA(h_instance, DllPath, sizeof(DllPath)) ;
- if( 0 == DllPathLen )
+ if( 0 == DllPathLen )
return E_UNEXPECTED;
HKEY hBaseKey;
if( ERROR_SUCCESS != RegOpenKeyExA(HKEY_CLASSES_ROOT, "CLSID", 0, KEY_CREATE_SUB_KEY, &hBaseKey) )
return SELFREG_E_CLASS;
-
+
RegisterClassID(hBaseKey, CLSID_VLCPlugin, 1, FALSE, DllPath, DllPathLen);
RegisterClassID(hBaseKey, CLSID_VLCPlugin2, 2, TRUE, DllPath, DllPathLen);
CATID implCategories[] = {
CATID_Control,
CATID_PersistsToPropertyBag,
- CATID_SafeForInitializing,
- CATID_SafeForScripting,
+ _CATID_InternetAware,
+ _CATID_SafeForInitializing,
+ _CATID_SafeForScripting,
};
pcr->RegisterClassImplCategories(CLSID_VLCPlugin,
// replace .exe by .tlb
strcpy(DllPath+DllPathLen-4, ".tlb");
#endif
-
+
#ifndef OLE2ANSI
size_t typeLibPathLen = MultiByteToWideChar(CP_ACP, 0, DllPath, -1, NULL, 0);
if( typeLibPathLen > 0 )
return 0;
DWORD dwRegisterClassObject;
+ DWORD dwRegisterClassObject2;
if( FAILED(CoRegisterClassObject(CLSID_VLCPlugin, classProc,
CLSCTX_LOCAL_SERVER, REGCLS_MULTIPLEUSE, &dwRegisterClassObject)) )
ACTIVEOBJECT_WEAK, &dwRegisterActiveObject)) )
return 0;
+ if( FAILED(RegisterActiveObject(classProc, CLSID_VLCPlugin2,
+ ACTIVEOBJECT_WEAK, &dwRegisterActiveObject2)) )
+ return 0;
+
classProc->Release();
/*
while( PeekMessage(&msg, NULL, 0, 0, PM_REMOVE) )
{
if( msg.message == WM_QUIT )
- break; // Leave the PeekMessage while() loop
+ break; // break out PeekMessage loop
/*if(TranslateAccelerator(ghwndApp, ghAccel, &msg))
continue;*/
}
if(msg.message == WM_QUIT)
- break; // Leave the for() loop
+ break; // break out main loop
WaitMessage();
}
if( SUCCEEDED(RevokeActiveObject(dwRegisterActiveObject, NULL)) )
CoRevokeClassObject(dwRegisterClassObject);
+ if( SUCCEEDED(RevokeActiveObject(dwRegisterActiveObject2, NULL)) )
+ CoRevokeClassObject(dwRegisterClassObject2);
+
// Reached on WM_QUIT message
- CoUninitialize();
+ OleUninitialize();
return ((int) msg.wParam);
};