Initial community commit

This commit is contained in:
Jef 2024-09-24 14:54:57 +02:00
parent 537bcbc862
commit fc06254474
16440 changed files with 4239995 additions and 2 deletions

189
Src/ie_plugin/IWinamp.h Normal file
View file

@ -0,0 +1,189 @@
/* this ALWAYS GENERATED file contains the definitions for the interfaces */
/* File created by MIDL compiler version 7.00.0500 */
/* at Mon Aug 24 16:18:09 2009
*/
/* Compiler settings for .\IWinamp.idl:
Oicf, W1, Zp8, env=Win32 (32b run)
protocol : dce , ms_ext, c_ext, robust
error checks: allocation ref bounds_check enum stub_data
VC __declspec() decoration level:
__declspec(uuid()), __declspec(selectany), __declspec(novtable)
DECLSPEC_UUID(), MIDL_INTERFACE()
*/
//@@MIDL_FILE_HEADING( )
#pragma warning( disable: 4049 ) /* more than 64k source lines */
/* verify that the <rpcndr.h> version is high enough to compile this file*/
#ifndef __REQUIRED_RPCNDR_H_VERSION__
#define __REQUIRED_RPCNDR_H_VERSION__ 475
#endif
#include "rpc.h"
#include "rpcndr.h"
#ifndef __RPCNDR_H_VERSION__
#error this stub requires an updated version of <rpcndr.h>
#endif // __RPCNDR_H_VERSION__
#ifndef COM_NO_WINDOWS_H
#include "windows.h"
#include "ole2.h"
#endif /*COM_NO_WINDOWS_H*/
#ifndef __IWinamp_h__
#define __IWinamp_h__
#if defined(_MSC_VER) && (_MSC_VER >= 1020)
#pragma once
#endif
/* Forward Declarations */
#ifndef __IWinamp_FWD_DEFINED__
#define __IWinamp_FWD_DEFINED__
typedef interface IWinamp IWinamp;
#endif /* __IWinamp_FWD_DEFINED__ */
#ifndef __Winamp_FWD_DEFINED__
#define __Winamp_FWD_DEFINED__
#ifdef __cplusplus
typedef class Winamp Winamp;
#else
typedef struct Winamp Winamp;
#endif /* __cplusplus */
#endif /* __Winamp_FWD_DEFINED__ */
/* header files for imported files */
#include "oaidl.h"
#include "ocidl.h"
#ifdef __cplusplus
extern "C"{
#endif
#ifndef __IWinamp_INTERFACE_DEFINED__
#define __IWinamp_INTERFACE_DEFINED__
/* interface IWinamp */
/* [unique][helpstring][uuid][object] */
EXTERN_C const IID IID_IWinamp;
#if defined(__cplusplus) && !defined(CINTERFACE)
MIDL_INTERFACE("007374A5-FE80-4b29-AF8C-FD9C0F16C85C")
IWinamp : public IObjectWithSite
{
public:
};
#else /* C style interface */
typedef struct IWinampVtbl
{
BEGIN_INTERFACE
HRESULT ( STDMETHODCALLTYPE *QueryInterface )(
IWinamp * This,
/* [in] */ REFIID riid,
/* [iid_is][out] */
__RPC__deref_out void **ppvObject);
ULONG ( STDMETHODCALLTYPE *AddRef )(
IWinamp * This);
ULONG ( STDMETHODCALLTYPE *Release )(
IWinamp * This);
HRESULT ( STDMETHODCALLTYPE *SetSite )(
IWinamp * This,
/* [in] */ IUnknown *pUnkSite);
HRESULT ( STDMETHODCALLTYPE *GetSite )(
IWinamp * This,
/* [in] */ REFIID riid,
/* [iid_is][out] */ void **ppvSite);
END_INTERFACE
} IWinampVtbl;
interface IWinamp
{
CONST_VTBL struct IWinampVtbl *lpVtbl;
};
#ifdef COBJMACROS
#define IWinamp_QueryInterface(This,riid,ppvObject) \
( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) )
#define IWinamp_AddRef(This) \
( (This)->lpVtbl -> AddRef(This) )
#define IWinamp_Release(This) \
( (This)->lpVtbl -> Release(This) )
#define IWinamp_SetSite(This,pUnkSite) \
( (This)->lpVtbl -> SetSite(This,pUnkSite) )
#define IWinamp_GetSite(This,riid,ppvSite) \
( (This)->lpVtbl -> GetSite(This,riid,ppvSite) )
#endif /* COBJMACROS */
#endif /* C style interface */
#endif /* __IWinamp_INTERFACE_DEFINED__ */
#ifndef __ElevatorLib_LIBRARY_DEFINED__
#define __ElevatorLib_LIBRARY_DEFINED__
/* library ElevatorLib */
/* [helpstring][version][uuid] */
EXTERN_C const IID LIBID_ElevatorLib;
EXTERN_C const CLSID CLSID_Winamp;
#ifdef __cplusplus
class DECLSPEC_UUID("D9C17076-9F55-49b5-8BEB-6A857931E62C")
Winamp;
#endif
#endif /* __ElevatorLib_LIBRARY_DEFINED__ */
/* Additional Prototypes for ALL interfaces */
/* end of Additional Prototypes */
#ifdef __cplusplus
}
#endif
#endif

20
Src/ie_plugin/IWinamp.idl Normal file
View file

@ -0,0 +1,20 @@
import "oaidl.idl";
import "ocidl.idl";
import "wtypes.idl";
[
uuid(B44A606E-EF90-4062-BD41-197D8495884D),
version(1.0),
helpstring("Winamp 1.0 Type Library")
]
library ElevatorLib
{
[
uuid(D9C17076-9F55-49b5-8BEB-6A857931E62C),
helpstring("Winamp Class")
]
coclass Winamp
{
};
};

85
Src/ie_plugin/IWinamp_i.c Normal file
View file

@ -0,0 +1,85 @@
/* this ALWAYS GENERATED file contains the IIDs and CLSIDs */
/* link this file in with the server and any clients */
/* File created by MIDL compiler version 7.00.0500 */
/* at Mon Aug 24 15:08:56 2009
*/
/* Compiler settings for .\IWinamp.idl:
Oicf, W1, Zp8, env=Win32 (32b run)
protocol : dce , ms_ext, c_ext, robust
error checks: allocation ref bounds_check enum stub_data
VC __declspec() decoration level:
__declspec(uuid()), __declspec(selectany), __declspec(novtable)
DECLSPEC_UUID(), MIDL_INTERFACE()
*/
//@@MIDL_FILE_HEADING( )
#pragma warning( disable: 4049 ) /* more than 64k source lines */
#ifdef __cplusplus
extern "C"{
#endif
#include <rpc.h>
#include <rpcndr.h>
#ifdef _MIDL_USE_GUIDDEF_
#ifndef INITGUID
#define INITGUID
#include <guiddef.h>
#undef INITGUID
#else
#include <guiddef.h>
#endif
#define MIDL_DEFINE_GUID(type,name,l,w1,w2,b1,b2,b3,b4,b5,b6,b7,b8) \
DEFINE_GUID(name,l,w1,w2,b1,b2,b3,b4,b5,b6,b7,b8)
#else // !_MIDL_USE_GUIDDEF_
#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
#define MIDL_DEFINE_GUID(type,name,l,w1,w2,b1,b2,b3,b4,b5,b6,b7,b8) \
const type name = {l,w1,w2,{b1,b2,b3,b4,b5,b6,b7,b8}}
#endif !_MIDL_USE_GUIDDEF_
MIDL_DEFINE_GUID(IID, IID_IWinamp,0x007374A5,0xFE80,0x4b29,0xAF,0x8C,0xFD,0x9C,0x0F,0x16,0xC8,0x5C);
MIDL_DEFINE_GUID(IID, LIBID_ElevatorLib,0xB44A606E,0xEF90,0x4062,0xBD,0x41,0x19,0x7D,0x84,0x95,0x88,0x4D);
MIDL_DEFINE_GUID(CLSID, CLSID_Winamp,0xD9C17076,0x9F55,0x49b5,0x8B,0xEB,0x6A,0x85,0x79,0x31,0xE6,0x2C);
#undef MIDL_DEFINE_GUID
#ifdef __cplusplus
}
#endif

277
Src/ie_plugin/IWinamp_p.c Normal file
View file

@ -0,0 +1,277 @@
/* this ALWAYS GENERATED file contains the proxy stub code */
/* File created by MIDL compiler version 7.00.0500 */
/* at Mon Aug 24 16:18:09 2009
*/
/* Compiler settings for .\IWinamp.idl:
Oicf, W1, Zp8, env=Win32 (32b run)
protocol : dce , ms_ext, c_ext, robust
error checks: allocation ref bounds_check enum stub_data
VC __declspec() decoration level:
__declspec(uuid()), __declspec(selectany), __declspec(novtable)
DECLSPEC_UUID(), MIDL_INTERFACE()
*/
//@@MIDL_FILE_HEADING( )
#if !defined(_M_IA64) && !defined(_M_AMD64)
#pragma warning( disable: 4049 ) /* more than 64k source lines */
#if _MSC_VER >= 1200
#pragma warning(push)
#endif
#pragma warning( disable: 4211 ) /* redefine extern to static */
#pragma warning( disable: 4232 ) /* dllimport identity*/
#pragma warning( disable: 4024 ) /* array to pointer mapping*/
#pragma warning( disable: 4152 ) /* function/data pointer conversion in expression */
#pragma warning( disable: 4100 ) /* unreferenced arguments in x86 call */
#pragma optimize("", off )
#define USE_STUBLESS_PROXY
/* verify that the <rpcproxy.h> version is high enough to compile this file*/
#ifndef __REDQ_RPCPROXY_H_VERSION__
#define __REQUIRED_RPCPROXY_H_VERSION__ 475
#endif
#include "rpcproxy.h"
#ifndef __RPCPROXY_H_VERSION__
#error this stub requires an updated version of <rpcproxy.h>
#endif // __RPCPROXY_H_VERSION__
#include "IWinamp.h"
#define TYPE_FORMAT_STRING_SIZE 3
#define PROC_FORMAT_STRING_SIZE 1
#define EXPR_FORMAT_STRING_SIZE 1
#define TRANSMIT_AS_TABLE_SIZE 0
#define WIRE_MARSHAL_TABLE_SIZE 0
typedef struct _IWinamp_MIDL_TYPE_FORMAT_STRING
{
short Pad;
unsigned char Format[ TYPE_FORMAT_STRING_SIZE ];
} IWinamp_MIDL_TYPE_FORMAT_STRING;
typedef struct _IWinamp_MIDL_PROC_FORMAT_STRING
{
short Pad;
unsigned char Format[ PROC_FORMAT_STRING_SIZE ];
} IWinamp_MIDL_PROC_FORMAT_STRING;
typedef struct _IWinamp_MIDL_EXPR_FORMAT_STRING
{
long Pad;
unsigned char Format[ EXPR_FORMAT_STRING_SIZE ];
} IWinamp_MIDL_EXPR_FORMAT_STRING;
static RPC_SYNTAX_IDENTIFIER _RpcTransferSyntax =
{{0x8A885D04,0x1CEB,0x11C9,{0x9F,0xE8,0x08,0x00,0x2B,0x10,0x48,0x60}},{2,0}};
extern const IWinamp_MIDL_TYPE_FORMAT_STRING IWinamp__MIDL_TypeFormatString;
extern const IWinamp_MIDL_PROC_FORMAT_STRING IWinamp__MIDL_ProcFormatString;
extern const IWinamp_MIDL_EXPR_FORMAT_STRING IWinamp__MIDL_ExprFormatString;
extern const MIDL_STUB_DESC Object_StubDesc;
extern const MIDL_SERVER_INFO IWinamp_ServerInfo;
extern const MIDL_STUBLESS_PROXY_INFO IWinamp_ProxyInfo;
#if !defined(__RPC_WIN32__)
#error Invalid build platform for this stub.
#endif
#if !(TARGET_IS_NT50_OR_LATER)
#error You need a Windows 2000 or later to run this stub because it uses these features:
#error /robust command line switch.
#error However, your C/C++ compilation flags indicate you intend to run this app on earlier systems.
#error This app will fail with the RPC_X_WRONG_STUB_VERSION error.
#endif
static const IWinamp_MIDL_PROC_FORMAT_STRING IWinamp__MIDL_ProcFormatString =
{
0,
{
0x0
}
};
static const IWinamp_MIDL_TYPE_FORMAT_STRING IWinamp__MIDL_TypeFormatString =
{
0,
{
NdrFcShort( 0x0 ), /* 0 */
0x0
}
};
/* Object interface: IUnknown, ver. 0.0,
GUID={0x00000000,0x0000,0x0000,{0xC0,0x00,0x00,0x00,0x00,0x00,0x00,0x46}} */
/* Object interface: IObjectWithSite, ver. 0.0,
GUID={0xFC4801A3,0x2BA9,0x11CF,{0xA2,0x29,0x00,0xAA,0x00,0x3D,0x73,0x52}} */
/* Object interface: IWinamp, ver. 0.0,
GUID={0x007374A5,0xFE80,0x4b29,{0xAF,0x8C,0xFD,0x9C,0x0F,0x16,0xC8,0x5C}} */
#pragma code_seg(".orpc")
static const unsigned short IWinamp_FormatStringOffsetTable[] =
{
(unsigned short) -1,
(unsigned short) -1,
0
};
static const MIDL_STUBLESS_PROXY_INFO IWinamp_ProxyInfo =
{
&Object_StubDesc,
IWinamp__MIDL_ProcFormatString.Format,
&IWinamp_FormatStringOffsetTable[-3],
0,
0,
0
};
static const MIDL_SERVER_INFO IWinamp_ServerInfo =
{
&Object_StubDesc,
0,
IWinamp__MIDL_ProcFormatString.Format,
&IWinamp_FormatStringOffsetTable[-3],
0,
0,
0,
0};
CINTERFACE_PROXY_VTABLE(5) _IWinampProxyVtbl =
{
0,
&IID_IWinamp,
IUnknown_QueryInterface_Proxy,
IUnknown_AddRef_Proxy,
IUnknown_Release_Proxy ,
0 /* (void *) (INT_PTR) -1 /* IObjectWithSite::SetSite */ ,
0 /* (void *) (INT_PTR) -1 /* IObjectWithSite::GetSite */
};
static const PRPC_STUB_FUNCTION IWinamp_table[] =
{
STUB_FORWARDING_FUNCTION,
STUB_FORWARDING_FUNCTION
};
CInterfaceStubVtbl _IWinampStubVtbl =
{
&IID_IWinamp,
&IWinamp_ServerInfo,
5,
&IWinamp_table[-3],
CStdStubBuffer_DELEGATING_METHODS
};
static const MIDL_STUB_DESC Object_StubDesc =
{
0,
NdrOleAllocate,
NdrOleFree,
0,
0,
0,
0,
0,
IWinamp__MIDL_TypeFormatString.Format,
1, /* -error bounds_check flag */
0x50002, /* Ndr library version */
0,
0x70001f4, /* MIDL Version 7.0.500 */
0,
0,
0, /* notify & notify_flag routine table */
0x1, /* MIDL flag */
0, /* cs routines */
0, /* proxy/server info */
0
};
const CInterfaceProxyVtbl * _IWinamp_ProxyVtblList[] =
{
( CInterfaceProxyVtbl *) &_IWinampProxyVtbl,
0
};
const CInterfaceStubVtbl * _IWinamp_StubVtblList[] =
{
( CInterfaceStubVtbl *) &_IWinampStubVtbl,
0
};
PCInterfaceName const _IWinamp_InterfaceNamesList[] =
{
"IWinamp",
0
};
const IID * _IWinamp_BaseIIDList[] =
{
&IID_IObjectWithSite,
0
};
#define _IWinamp_CHECK_IID(n) IID_GENERIC_CHECK_IID( _IWinamp, pIID, n)
int __stdcall _IWinamp_IID_Lookup( const IID * pIID, int * pIndex )
{
if(!_IWinamp_CHECK_IID(0))
{
*pIndex = 0;
return 1;
}
return 0;
}
const ExtendedProxyFileInfo IWinamp_ProxyFileInfo =
{
(PCInterfaceProxyVtblList *) & _IWinamp_ProxyVtblList,
(PCInterfaceStubVtblList *) & _IWinamp_StubVtblList,
(const PCInterfaceName * ) & _IWinamp_InterfaceNamesList,
(const IID ** ) & _IWinamp_BaseIIDList,
& _IWinamp_IID_Lookup,
1,
2,
0, /* table of [async_uuid] interfaces */
0, /* Filler1 */
0, /* Filler2 */
0 /* Filler3 */
};
#pragma optimize("", on )
#if _MSC_VER >= 1200
#pragma warning(pop)
#endif
#endif /* !defined(_M_IA64) && !defined(_M_AMD64)*/

409
Src/ie_plugin/Winamp.cpp Normal file
View file

@ -0,0 +1,409 @@
#include "Winamp.h"
#include "../Winamp/JSAPI.h"
#include <mshtmdid.h>
#include <mshtmhst.h>
#include <stdio.h>
#include <shlwapi.h>
#include <malloc.h>
#define BUFFER_LEN 1024
// {294DFA02-5A90-4dc7-872D-1EF54817078D}
static const GUID CLSID_WINAMP_CRAP =
{ 0x294dfa02, 0x5a90, 0x4dc7, { 0x87, 0x2d, 0x1e, 0xf5, 0x48, 0x17, 0x7, 0x8d } };
Winamp::Winamp()
{
refCount=1;
webBrowser_=0;
connectionPointContainer=0;
cookie_=0;
document_=0;
client_site = 0;
}
/* other things being asked for:
{00000008-0000-0000-C000-000000000046} (dunno what interface)
HTMLDocument
IOleControl B196B288-BAB4-101A-B69C-00AA00341D07
IClientSecurity
IQuickActivate
IPersistPropertyBag2
IPersistPropertyBag
IPersistStreamInit
IPersistStorage
IViewObjectEx
IViewObject
IActiveScript BB1A2AE1-A4F9-11CF-8F20-00805F2CD064
IOleCommandTarget B722BCCB-4E68-101B-A2BC-00AA00404770
IDispatchEx A6EF9860-C720-11D0-9337-00A0C90DCAA9
CB5BDC81-93C1-11cf-8F20-00805F2CD064
6D5140D3-7436-11CE-8034-00AA006009FA (dunno what interface)
*/
HRESULT Winamp::QueryInterface(REFIID riid, LPVOID FAR *ppvObj)
{
//DebugBreak();
if (!ppvObj)
return E_POINTER;
else if (IsEqualIID(riid, IID_IUnknown))
*ppvObj = /*static_cast<IUnknown *>*/(this);
else if (IsEqualIID(riid, IID_IObjectWithSite))
*ppvObj = static_cast<IObjectWithSite *>(this);
//else if (IsEqualIID(riid, __uuidof(IWinamp)))
//*ppvObj = static_cast<IWinamp *>(this);
else if (IsEqualIID(riid, IID_IDispatch))
*ppvObj = (IDispatch *)this;
else if (IsEqualIID(riid, IID_IOleObject))
*ppvObj = (IOleObject *)this;
else if (IsEqualIID(riid, IID_IPersistStorage))
*ppvObj = (IPersistStorage *)this;
else if (IsEqualIID(riid, IID_IDataObject))
*ppvObj = (IDataObject *)this;
else if (IsEqualIID(riid, IID_IObjectSafety))
*ppvObj = (IObjectSafety *)this;
else
{
LPOLESTR guidstr;
StringFromIID(riid, &guidstr);
//MessageBox(NULL, guidstr, L"queryinterface", MB_OK);
*ppvObj = NULL;
return E_NOINTERFACE;
}
AddRef();
return S_OK;
}
ULONG Winamp::AddRef(void)
{
return ++refCount;
}
ULONG Winamp::Release(void)
{
if (refCount == 0)
return 0;
ULONG retCount=--refCount;
if (refCount == 0)
delete this;
return retCount;
}
#define DISP_TABLE \
CHECK_ID(Test)\
CHECK_ID(getVersion)\
#define CHECK_ID(str) JSAPI_DISP_ENUMIFY(str),
enum {
DISP_TABLE
};
#undef CHECK_ID
#define CHECK_ID(str) if (wcscmp(rgszNames[i], L## #str) == 0) { rgdispid[i] = JSAPI_DISP_ENUMIFY(str); continue; }
HRESULT Winamp::GetIDsOfNames(REFIID riid, OLECHAR FAR* FAR* rgszNames, unsigned int cNames, LCID lcid, DISPID FAR* rgdispid)
{
bool unknowns = false;
for (unsigned int i = 0;i != cNames;i++)
{
DISP_TABLE
rgdispid[i] = DISPID_UNKNOWN;
unknowns = true;
}
if (unknowns)
return DISP_E_UNKNOWNNAME;
else
return S_OK;
}
HRESULT Winamp::GetTypeInfo(unsigned int itinfo, LCID lcid, ITypeInfo FAR* FAR* pptinfo)
{
return E_NOTIMPL;
}
HRESULT Winamp::GetTypeInfoCount(unsigned int FAR * pctinfo)
{
return E_NOTIMPL;
}
#undef CHECK_ID
#define CHECK_ID(str) case JSAPI_DISP_ENUMIFY(str): return str(wFlags, pdispparams, pvarResult, puArgErr);
HRESULT Winamp::Invoke(DISPID dispid, REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS FAR *pdispparams, VARIANT FAR *pvarResult, EXCEPINFO FAR * pexecinfo, unsigned int FAR *puArgErr)
{
switch (dispid)
{
DISP_TABLE
}
return DISP_E_MEMBERNOTFOUND;
}
HRESULT Winamp::GetSite(REFIID riid, void** ppvSite)
{
return E_NOINTERFACE;
}
HRESULT Winamp::SetSite(IUnknown* iu)
{/*
if (! (iu->QueryInterface(IID_IWebBrowser2, (void**) &webBrowser_) == S_OK ))
{
return E_FAIL;
}
if (! (iu->QueryInterface(IID_IConnectionPointContainer, (void**) &connectionPointContainer) == S_OK ))
{
return E_FAIL;
// ::MessageBox(0, "xxx", 0, 0);
}
// make sure we\'re getting browser events
IConnectionPoint* spCP;
HRESULT hr = connectionPointContainer->FindConnectionPoint(DIID_DWebBrowserEvents2, &spCP);
if (FAILED(hr))
{
return hr;
}
hr = spCP->Advise(static_cast<IDispatch*>(this), &cookie_);
*/
return S_OK;
}
HRESULT Winamp::Test(WORD wFlags, DISPPARAMS FAR *pdispparams, VARIANT FAR *pvarResult, unsigned int FAR *puArgErr)
{
JSAPI_VERIFY_METHOD(wFlags);
JSAPI_VERIFY_PARAMCOUNT(pdispparams, 0);
MessageBoxA(NULL,"test", "IWinamp", MB_OK);
JSAPI_INIT_RESULT(pvarResult, VT_BOOL);
JSAPI_SET_VARIANT(pvarResult, V_BOOL, VARIANT_TRUE);
return S_OK;
}
#if 0
HRESULT Winamp::getVersion(WORD wFlags, DISPPARAMS FAR *pdispparams, VARIANT FAR *pvarResult, unsigned int FAR *puArgErr)
{
JSAPI_VERIFY_METHOD(wFlags);
JSAPI_VERIFY_PARAMCOUNT(pdispparams, 0);
JSAPI_INIT_RESULT(pvarResult, VT_BSTR);
JSAPI_SET_RESULT(pvarResult, bstrVal, SysAllocString(L"7766"));
return S_OK;
}
#endif
HRESULT Winamp::getVersion(WORD wFlags, DISPPARAMS FAR *pdispparams, VARIANT FAR *pvarResult, unsigned int FAR *puArgErr)
{
JSAPI_VERIFY_METHOD(wFlags);
JSAPI_VERIFY_PARAMCOUNT(pdispparams, 0);
wchar_t csVersion[BUFFER_LEN];
////////////////////////////////
DWORD BufferSize = BUFFER_LEN;
DWORD cbData;
bool keyFound = false;
wchar_t exeName[] = L"\\winamp.exe";
wchar_t fileName[BUFFER_LEN];
csVersion[0]=0;
memset(&fileName[0],'\0',BUFFER_LEN);
wchar_t fileNameTemp[BUFFER_LEN];
HKEY hKey;
cbData = BUFFER_LEN;
// first check the protocol handler registry key, we're looking for
// the winamp:// protocol handler. If we find this, then this is the
// "right" exe for winamp we need to get the version number on
if (RegOpenKeyEx(HKEY_CLASSES_ROOT, TEXT("winamp\\shell\\open\\command"), 0, KEY_READ, &hKey) == ERROR_SUCCESS) {
if ( RegQueryValueEx( hKey,
TEXT(""),
NULL,
NULL,
(LPBYTE) fileNameTemp,
&cbData ) != ERROR_SUCCESS) {
return ERROR_PATH_NOT_FOUND;
}
RegCloseKey (hKey);
if (StrStrW(fileNameTemp,L"winamp.exe")) {
int indexOfFirstQuote = StrCSpnW(fileNameTemp, L"\"");
int indexOfSecondQuote = StrCSpnW(&fileNameTemp[indexOfFirstQuote+1], L"\"");
if (indexOfFirstQuote >= 0) {
keyFound = true;
lstrcpynW(fileName,&fileNameTemp[indexOfFirstQuote+1], indexOfSecondQuote+1);
}
} else {
// some other app (itunes ??) controlling the winamp:// protocol
// return error
return ERROR_PATH_NOT_FOUND;
}
}
if (!keyFound) {
// See if the reg key exists
if (RegOpenKeyEx(HKEY_CURRENT_USER, TEXT("Software\\Winamp"), 0, KEY_READ, &hKey) != ERROR_SUCCESS) {
return ERROR_PATH_NOT_FOUND;
}
cbData = BUFFER_LEN;
if ( RegQueryValueEx( hKey,
TEXT(""),
NULL,
NULL,
(LPBYTE) fileName,
&cbData ) != ERROR_SUCCESS) {
return ERROR_PATH_NOT_FOUND;
}
RegCloseKey (hKey);
keyFound = true;
wcscat(fileName,exeName);
}
if (!keyFound) {
return ERROR_PATH_NOT_FOUND;
}
////////////////////////////////
static TCHAR sBackSlash[] = {'\\','\0'};
DWORD dwVersionDataLen = GetFileVersionInfoSize(fileName, NULL);
if (dwVersionDataLen)
{
char* fvBuf = (char *)alloca(dwVersionDataLen);//new char[dwVersionDataLen];
if (GetFileVersionInfo(fileName, 0, dwVersionDataLen, fvBuf)) {
LPVOID pVal;
UINT nValLen;
if (VerQueryValue(fvBuf, sBackSlash, &pVal, &nValLen)) {
if (nValLen == sizeof(VS_FIXEDFILEINFO)) {
VS_FIXEDFILEINFO* pFixedFileInfo = (VS_FIXEDFILEINFO*)pVal;
//wsprintf(csVersion, L"%d.%d.%d.%d",
// HIWORD(pFixedFileInfo->dwFileVersionMS), LOWORD(pFixedFileInfo->dwFileVersionMS),
// HIWORD(pFixedFileInfo->dwFileVersionLS), LOWORD(pFixedFileInfo->dwFileVersionLS));
wsprintf(csVersion, L"%d.%d%d",
HIWORD(pFixedFileInfo->dwFileVersionMS), LOWORD(pFixedFileInfo->dwFileVersionMS),
HIWORD(pFixedFileInfo->dwFileVersionLS));
}
}
}
}
JSAPI_INIT_RESULT(pvarResult, VT_BSTR);
JSAPI_SET_RESULT(pvarResult, bstrVal, SysAllocString(csVersion));
return S_OK;
}
HRESULT Winamp::SetClientSite(IOleClientSite *pClientSite)
{
// TODO
client_site = pClientSite;
return S_OK;
}
HRESULT Winamp::GetClientSite(IOleClientSite **ppClientSite)
{ return E_NOTIMPL; }
HRESULT Winamp::SetHostNames(LPCOLESTR szContainerApp,LPCOLESTR szContainerObj)
{ return S_OK; }
HRESULT Winamp::Close(DWORD dwSaveOption)
{ return S_OK; }
HRESULT Winamp::SetMoniker(DWORD dwWhichMoniker,IMoniker *pmk)
{ return E_NOTIMPL; }
HRESULT Winamp::GetMoniker(DWORD dwAssign, DWORD dwWhichMoniker,IMoniker **ppmk)
{ return E_NOTIMPL; }
HRESULT Winamp::InitFromData(IDataObject *pDataObject,BOOL fCreation,DWORD dwReserved)
{ return E_NOTIMPL; }
HRESULT Winamp::GetClipboardData(DWORD dwReserved,IDataObject **ppDataObject)
{ return E_NOTIMPL; }
HRESULT Winamp::DoVerb(LONG iVerb,LPMSG lpmsg,IOleClientSite *pActiveSite,LONG lindex, HWND hwndParent, LPCRECT lprcPosRect)
{ return S_OK; }
HRESULT Winamp::EnumVerbs(IEnumOLEVERB **ppEnumOleVerb)
{ return E_NOTIMPL; }
HRESULT Winamp::Update(void)
{ return E_NOTIMPL; }
HRESULT Winamp::IsUpToDate(void)
{ return E_NOTIMPL; }
HRESULT Winamp::GetUserClassID(CLSID *pClsid)
{ return E_NOTIMPL; }
HRESULT Winamp::GetUserType(DWORD dwFormOfType,LPOLESTR *pszUserType)
{ return E_NOTIMPL; }
HRESULT Winamp::SetExtent(DWORD dwDrawAspect,SIZEL *psizel)
{ return E_NOTIMPL; }
HRESULT Winamp::GetExtent(DWORD dwDrawAspect,SIZEL *psizel)
{
// TODO
return E_NOTIMPL;
}
HRESULT Winamp::Advise(IAdviseSink *pAdvSink,DWORD *pdwConnection)
{ return E_NOTIMPL; }
HRESULT Winamp::Unadvise(DWORD dwConnection)
{ return E_NOTIMPL; }
HRESULT Winamp::EnumAdvise(IEnumSTATDATA **ppenumAdvise)
{ return E_NOTIMPL; }
HRESULT Winamp::GetMiscStatus(DWORD dwAspect,DWORD *pdwStatus)
{
*pdwStatus = OLEMISC_INVISIBLEATRUNTIME;
return S_OK;
}
HRESULT Winamp::SetColorScheme(LOGPALETTE *pLogpal)
{ return E_NOTIMPL; }
HRESULT Winamp::GetClassID(CLSID *pClassID)
{ *pClassID = CLSID_WINAMP_CRAP; return S_OK; }
HRESULT Winamp::IsDirty(void)
{ return E_NOTIMPL; }
HRESULT Winamp::InitNew(IStorage *pStg)
{ return E_NOTIMPL; }
HRESULT Winamp::Load(IStorage *pStg)
{ return E_NOTIMPL; }
HRESULT Winamp::Save(IStorage *pStgSave, BOOL fSameAsLoad)
{ return E_NOTIMPL; }
HRESULT Winamp::SaveCompleted(IStorage *pStgNew)
{ return E_NOTIMPL; }
HRESULT Winamp::HandsOffStorage(void)
{ return E_NOTIMPL; }
HRESULT Winamp::GetData(FORMATETC *pformatetcIn,STGMEDIUM *pmedium)
{ return E_NOTIMPL; }
HRESULT Winamp::GetDataHere(FORMATETC *pformatetc,STGMEDIUM *pmedium)
{ return E_NOTIMPL; }
HRESULT Winamp::QueryGetData(FORMATETC *pformatetc)
{ return E_NOTIMPL; }
HRESULT Winamp::GetCanonicalFormatEtc(FORMATETC *pformatectIn,FORMATETC *pformatetcOut)
{ return E_NOTIMPL; }
HRESULT Winamp::SetData(FORMATETC *pformatetc,STGMEDIUM *pmedium,BOOL fRelease)
{ return E_NOTIMPL; }
HRESULT Winamp::EnumFormatEtc(DWORD dwDirection,IEnumFORMATETC **ppenumFormatEtc)
{ return E_NOTIMPL; }
HRESULT Winamp::DAdvise(FORMATETC *pformatetc,DWORD advf,IAdviseSink *pAdvSink,DWORD *pdwConnection)
{ return E_NOTIMPL; }
HRESULT Winamp::DUnadvise(DWORD dwConnection)
{ return E_NOTIMPL; }
HRESULT Winamp::EnumDAdvise(IEnumSTATDATA **ppenumAdvise)
{ return E_NOTIMPL; }
HRESULT Winamp::GetInterfaceSafetyOptions(REFIID riid, DWORD *pdwSupportedOptions, DWORD *pdwEnabledOptions)
{
*pdwSupportedOptions = INTERFACESAFE_FOR_UNTRUSTED_CALLER | INTERFACESAFE_FOR_UNTRUSTED_DATA;
*pdwEnabledOptions = INTERFACESAFE_FOR_UNTRUSTED_CALLER | INTERFACESAFE_FOR_UNTRUSTED_DATA;
return S_OK;
}
HRESULT Winamp::SetInterfaceSafetyOptions(REFIID riid, DWORD dwOptionSetMask, DWORD dwEnabledOptions)
{
return S_OK;
}

89
Src/ie_plugin/Winamp.h Normal file
View file

@ -0,0 +1,89 @@
#pragma once
#include <ocidl.h>
#include <exdisp.h>
#include <objsafe.h>
class Winamp : public IObjectWithSite,
public IDispatch,
public IOleObject,
public IPersistStorage,
public IDataObject,
public IObjectSafety
{
public:
Winamp();
/* IUnknown */
HRESULT STDMETHODCALLTYPE QueryInterface(REFIID riid, void __RPC_FAR *__RPC_FAR *ppvObject);
ULONG STDMETHODCALLTYPE AddRef(void);
ULONG STDMETHODCALLTYPE Release(void);
// *** IDispatch Methods ***
STDMETHOD (GetIDsOfNames)(REFIID riid, OLECHAR FAR* FAR* rgszNames, unsigned int cNames, LCID lcid, DISPID FAR* rgdispid);
STDMETHOD (GetTypeInfo)(unsigned int itinfo, LCID lcid, ITypeInfo FAR* FAR* pptinfo);
STDMETHOD (GetTypeInfoCount)(unsigned int FAR * pctinfo);
STDMETHOD (Invoke)(DISPID dispid, REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS FAR *pdispparams, VARIANT FAR *pvarResult, EXCEPINFO FAR * pexecinfo, unsigned int FAR *puArgErr);
/* IOleObject */
HRESULT STDMETHODCALLTYPE SetClientSite(IOleClientSite *pClientSite);
HRESULT STDMETHODCALLTYPE GetClientSite(IOleClientSite **ppClientSite);
HRESULT STDMETHODCALLTYPE SetHostNames(LPCOLESTR szContainerApp,LPCOLESTR szContainerObj);
HRESULT STDMETHODCALLTYPE Close(DWORD dwSaveOption);
HRESULT STDMETHODCALLTYPE SetMoniker(DWORD dwWhichMoniker,IMoniker *pmk);
HRESULT STDMETHODCALLTYPE GetMoniker(DWORD dwAssign, DWORD dwWhichMoniker,IMoniker **ppmk);
HRESULT STDMETHODCALLTYPE InitFromData(IDataObject *pDataObject,BOOL fCreation,DWORD dwReserved);
HRESULT STDMETHODCALLTYPE GetClipboardData(DWORD dwReserved,IDataObject **ppDataObject);
HRESULT STDMETHODCALLTYPE DoVerb(LONG iVerb,LPMSG lpmsg,IOleClientSite *pActiveSite,LONG lindex, HWND hwndParent, LPCRECT lprcPosRect);
HRESULT STDMETHODCALLTYPE EnumVerbs(IEnumOLEVERB **ppEnumOleVerb);
HRESULT STDMETHODCALLTYPE Update(void);
HRESULT STDMETHODCALLTYPE IsUpToDate(void);
HRESULT STDMETHODCALLTYPE GetUserClassID(CLSID *pClsid);
HRESULT STDMETHODCALLTYPE GetUserType(DWORD dwFormOfType,LPOLESTR *pszUserType);
HRESULT STDMETHODCALLTYPE SetExtent(DWORD dwDrawAspect,SIZEL *psizel);
HRESULT STDMETHODCALLTYPE GetExtent(DWORD dwDrawAspect,SIZEL *psizel);
HRESULT STDMETHODCALLTYPE Advise(IAdviseSink *pAdvSink,DWORD *pdwConnection);
HRESULT STDMETHODCALLTYPE Unadvise(DWORD dwConnection);
HRESULT STDMETHODCALLTYPE EnumAdvise(IEnumSTATDATA **ppenumAdvise);
HRESULT STDMETHODCALLTYPE GetMiscStatus(DWORD dwAspect,DWORD *pdwStatus);
HRESULT STDMETHODCALLTYPE SetColorScheme(LOGPALETTE *pLogpal);
/* IPersistStorage */
HRESULT STDMETHODCALLTYPE GetClassID(CLSID *pClassID);
HRESULT STDMETHODCALLTYPE IsDirty(void);
HRESULT STDMETHODCALLTYPE InitNew(IStorage *pStg);
HRESULT STDMETHODCALLTYPE Load(IStorage *pStg);
HRESULT STDMETHODCALLTYPE Save(IStorage *pStgSave, BOOL fSameAsLoad);
HRESULT STDMETHODCALLTYPE SaveCompleted(IStorage *pStgNew);
HRESULT STDMETHODCALLTYPE HandsOffStorage(void);
/* IDataStorage */
HRESULT STDMETHODCALLTYPE GetData(FORMATETC *pformatetcIn,STGMEDIUM *pmedium);
HRESULT STDMETHODCALLTYPE GetDataHere(FORMATETC *pformatetc,STGMEDIUM *pmedium);
HRESULT STDMETHODCALLTYPE QueryGetData(FORMATETC *pformatetc);
HRESULT STDMETHODCALLTYPE GetCanonicalFormatEtc(FORMATETC *pformatectIn,FORMATETC *pformatetcOut);
HRESULT STDMETHODCALLTYPE SetData(FORMATETC *pformatetc,STGMEDIUM *pmedium,BOOL fRelease);
HRESULT STDMETHODCALLTYPE EnumFormatEtc(DWORD dwDirection,IEnumFORMATETC **ppenumFormatEtc);
HRESULT STDMETHODCALLTYPE DAdvise(FORMATETC *pformatetc,DWORD advf,IAdviseSink *pAdvSink,DWORD *pdwConnection);
HRESULT STDMETHODCALLTYPE DUnadvise(DWORD dwConnection);
HRESULT STDMETHODCALLTYPE EnumDAdvise(IEnumSTATDATA **ppenumAdvise);
/* IObjectSafety */
HRESULT STDMETHODCALLTYPE GetInterfaceSafetyOptions(REFIID riid, DWORD *pdwSupportedOptions, DWORD *pdwEnabledOptions);
HRESULT STDMETHODCALLTYPE SetInterfaceSafetyOptions(REFIID riid, DWORD dwOptionSetMask, DWORD dwEnabledOptions);
/* IObjectWithSite */
HRESULT STDMETHODCALLTYPE GetSite(REFIID riid, void** ppvSite);
HRESULT STDMETHODCALLTYPE SetSite(IUnknown*);
STDMETHOD (Test)(WORD wFlags, DISPPARAMS FAR *pdispparams, VARIANT FAR *pvarResult, unsigned int FAR *puArgErr);
STDMETHOD (getVersion)(WORD wFlags, DISPPARAMS FAR *pdispparams, VARIANT FAR *pvarResult, unsigned int FAR *puArgErr);
private:
LONG refCount;
IOleClientSite *client_site;
private:
IWebBrowser2 *webBrowser_;
IConnectionPointContainer *connectionPointContainer;
DWORD cookie_;
IDispatch *document_;
};

View file

@ -0,0 +1,65 @@
#include "WinampFactory.h"
#include "Winamp.h"
//FileTypeRegistrar registrar;
WinampFactory::WinampFactory()
{
}
WinampFactory::~WinampFactory()
{
}
ULONG WinampFactory::AddRef()
{
return 10;
}
ULONG WinampFactory::Release()
{
return 10;
}
HRESULT WinampFactory::QueryInterface(REFIID riid, void ** ppAny)
{
// IID_IUnknown is the REFIID of standard interface IUnknown
if(riid == IID_IUnknown)
{
*ppAny = (IUnknown *)this;
}
else if(riid == IID_IClassFactory)
{
*ppAny = (IClassFactory *)this;
}
else
{
*ppAny = NULL;
return E_NOINTERFACE;
}
((IUnknown *)(*ppAny))->AddRef();
return S_OK;
}
HRESULT WinampFactory::LockServer(BOOL fLock)
{
return S_OK;
}
HRESULT WinampFactory::CreateInstance(LPUNKNOWN pUnkOuter, REFIID riid, void **ppAny)
{
if(pUnkOuter != NULL)
{
return CLASS_E_NOAGGREGATION;
}
Winamp *winamp = new Winamp;
HRESULT hr = winamp->QueryInterface(riid, ppAny);
if (FAILED(hr))
delete winamp;
return hr;
}

View file

@ -0,0 +1,18 @@
#pragma once
#include <unknwn.h>
class WinampFactory: public IClassFactory
{
public:
WinampFactory();
virtual ~WinampFactory();
HRESULT __stdcall QueryInterface(REFIID riid, void ** ppAny);
ULONG __stdcall AddRef();
ULONG __stdcall Release();
HRESULT __stdcall CreateInstance(LPUNKNOWN pUnkOuter, REFIID riid, void ** ppAny);
HRESULT __stdcall LockServer(BOOL fLock);
};

38
Src/ie_plugin/dlldata.c Normal file
View file

@ -0,0 +1,38 @@
/*********************************************************
DllData file -- generated by MIDL compiler
DO NOT ALTER THIS FILE
This file is regenerated by MIDL on every IDL file compile.
To completely reconstruct this file, delete it and rerun MIDL
on all the IDL files in this DLL, specifying this file for the
/dlldata command line option
*********************************************************/
#define PROXY_DELEGATION
#include <rpcproxy.h>
#ifdef __cplusplus
extern "C" {
#endif
EXTERN_PROXY_FILE( IWinamp )
PROXYFILE_LIST_START
/* Start of list */
REFERENCE_PROXY_FILE( IWinamp ),
/* End of list */
PROXYFILE_LIST_END
DLLDATA_ROUTINES( aProxyFileList, GET_DLL_CLSID )
#ifdef __cplusplus
} /*extern "C" */
#endif
/* end of generated dlldata file */

7
Src/ie_plugin/export.def Normal file
View file

@ -0,0 +1,7 @@
LIBRARY "iewachk"
EXPORTS
DllRegisterServer PRIVATE
DllUnregisterServer PRIVATE
DllCanUnloadNow PRIVATE
DllGetClassObject PRIVATE

View file

@ -0,0 +1,20 @@

Microsoft Visual Studio Solution File, Format Version 10.00
# Visual Studio 2008
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ie_plugin", "ie_plugin.vcproj", "{4850D09C-B868-4FF4-A180-A76CB7070C40}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Win32 = Debug|Win32
Release|Win32 = Release|Win32
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{4850D09C-B868-4FF4-A180-A76CB7070C40}.Debug|Win32.ActiveCfg = Debug|Win32
{4850D09C-B868-4FF4-A180-A76CB7070C40}.Debug|Win32.Build.0 = Debug|Win32
{4850D09C-B868-4FF4-A180-A76CB7070C40}.Release|Win32.ActiveCfg = Release|Win32
{4850D09C-B868-4FF4-A180-A76CB7070C40}.Release|Win32.Build.0 = Release|Win32
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
EndGlobal

View file

@ -0,0 +1,236 @@
<?xml version="1.0" encoding="Windows-1252"?>
<VisualStudioProject
ProjectType="Visual C++"
Version="9.00"
Name="ie_plugin"
ProjectGUID="{4850D09C-B868-4FF4-A180-A76CB7070C40}"
RootNamespace="ie_plugin"
Keyword="Win32Proj"
TargetFrameworkVersion="196613"
>
<Platforms>
<Platform
Name="Win32"
/>
</Platforms>
<ToolFiles>
</ToolFiles>
<Configurations>
<Configuration
Name="Debug|Win32"
OutputDirectory="$(SolutionDir)$(ConfigurationName)"
IntermediateDirectory="$(ConfigurationName)"
ConfigurationType="2"
CharacterSet="1"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
/>
<Tool
Name="VCCLCompilerTool"
Optimization="0"
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;IE_PLUGIN_EXPORTS;_CRT_SECURE_NO_WARNINGS"
MinimalRebuild="true"
BasicRuntimeChecks="3"
RuntimeLibrary="1"
UsePrecompiledHeader="0"
WarningLevel="3"
DebugInformationFormat="4"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
AdditionalDependencies="Version.lib shlwapi.lib"
OutputFile="$(ProgramFiles)\Winamp\browserplugins\ie\iewachk.dll"
LinkIncremental="2"
ModuleDefinitionFile="export.def"
GenerateDebugInformation="true"
SubSystem="2"
TargetMachine="1"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCManifestTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCAppVerifierTool"
/>
<Tool
Name="VCPostBuildEventTool"
CommandLine="IF NOT EXIST ..\output MD ..\output&#x0D;&#x0A;IF NOT EXIST ..\output\winamp MD ..\output\winamp&#x0D;&#x0A;IF NOT EXIST ..\output\winamp\browserplugins MD ..\output\winamp\browserplugins&#x0D;&#x0A;IF NOT EXIST ..\output\winamp\browserplugins\ie MD ..\output\winamp\browserplugins\ie&#x0D;&#x0A;COPY &quot;$(ProgramFiles)&quot;\Winamp\browserplugins\ie\iewachk.dll ..\output\winamp\browserplugins\ie&#x0D;&#x0A;"
/>
</Configuration>
<Configuration
Name="Release|Win32"
OutputDirectory="$(SolutionDir)$(ConfigurationName)"
IntermediateDirectory="$(ConfigurationName)"
ConfigurationType="2"
CharacterSet="1"
WholeProgramOptimization="1"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
/>
<Tool
Name="VCCLCompilerTool"
Optimization="2"
EnableIntrinsicFunctions="true"
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;IE_PLUGIN_EXPORTS;_CRT_SECURE_NO_WARNINGS"
StringPooling="true"
RuntimeLibrary="0"
BufferSecurityCheck="false"
RuntimeTypeInfo="false"
UsePrecompiledHeader="0"
WarningLevel="3"
DebugInformationFormat="3"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
AdditionalDependencies="Version.lib shlwapi.lib"
OutputFile="$(ProgramFiles)\Winamp\browserplugins\ie\iewachk.dll"
LinkIncremental="1"
IgnoreAllDefaultLibraries="false"
IgnoreDefaultLibraryNames="msvcprt.lib"
ModuleDefinitionFile="export.def"
GenerateDebugInformation="true"
SubSystem="2"
OptimizeReferences="2"
EnableCOMDATFolding="2"
TargetMachine="1"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCManifestTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCAppVerifierTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
</Configurations>
<References>
</References>
<Files>
<Filter
Name="Source Files"
Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
>
<File
RelativePath=".\export.def"
>
</File>
<File
RelativePath=".\main.cpp"
>
</File>
<File
RelativePath=".\test.html"
>
</File>
<File
RelativePath=".\Winamp.cpp"
>
</File>
<File
RelativePath=".\Winamp.h"
>
</File>
<File
RelativePath=".\WinampFactory.cpp"
>
</File>
<File
RelativePath=".\WinampFactory.h"
>
</File>
</Filter>
<Filter
Name="Header Files"
Filter="h;hpp;hxx;hm;inl;inc;xsd"
UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
>
<File
RelativePath=".\resource.h"
>
</File>
</Filter>
<Filter
Name="Resource Files"
Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav"
UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}"
>
<File
RelativePath=".\winamp.rc"
>
</File>
</Filter>
</Files>
<Globals>
</Globals>
</VisualStudioProject>

169
Src/ie_plugin/main.cpp Normal file
View file

@ -0,0 +1,169 @@
#include <windows.h>
#include "Winamp.h"
#include "resource.h"
#include "WinampFactory.h"
#define INITGUID
#include <guiddef.h>
#include <strsafe.h>
//D9C17076-9F55-49b5-8BEB-6A857931E62C
DEFINE_GUID(CLSID_Winamp,0xD9C17076,0x9F55,0x49b5,0x8B,0xEB,0x6A,0x85,0x79,0x31,0xE6,0x2C);
static HRESULT UnregisterComponent(const CLSID &clsid);
static HRESULT RegisterComponent(HMODULE hModule, const CLSID &clsid, LPCWSTR pszFriendlyName);
static const WCHAR szComponentFriendlyName[] = L"Winamp Application Detector";
static HINSTANCE hMainInstance=0;
static DWORD regID = 0;
extern "C"
BOOL WINAPI DllMain(HINSTANCE hInstance, DWORD dwReason, LPVOID /*lpReserved*/)
{
if (dwReason == DLL_PROCESS_ATTACH)
{
hMainInstance=hInstance;
// CoRegisterClassObject(CLSID_Winamp,(IClassFactory*)&cf, CLSCTX_INPROC_SERVER, REGCLS_MULTIPLEUSE, &regID);
}
return TRUE; // ok
}
STDAPI DllRegisterServer()
{
HRESULT hr(S_OK);
hr = RegisterComponent(hMainInstance, CLSID_Winamp, szComponentFriendlyName);
return hr;
}
STDAPI DllCanUnloadNow()
{
return S_OK;
}
STDAPI DllGetClassObject(REFCLSID rclsid, REFIID riid, LPVOID * ppv)
{
HRESULT hr = E_OUTOFMEMORY;
*ppv = NULL;
WinampFactory *winampFactory = new WinampFactory();
if (winampFactory != NULL) {
hr = winampFactory->QueryInterface(riid, ppv);
winampFactory->Release();
}
return hr;
}
STDAPI DllUnregisterServer()
{
HRESULT hr(S_OK);
hr = UnregisterComponent(CLSID_Winamp);
return hr;
}
static BOOL WriteRegKey(HKEY hKeyParent, LPCWSTR pszKey, LPCWSTR pszValue, HKEY *phKey = NULL)
{
HKEY hKey;
LONG result;
result = RegCreateKeyExW(hKeyParent, pszKey, 0, NULL, REG_OPTION_NON_VOLATILE, KEY_WRITE, NULL, &hKey, NULL);
if (ERROR_SUCCESS != result || !hKey) return FALSE;
if (pszValue) {
result = RegSetValueExW(hKey, NULL, 0, REG_SZ, (BYTE*)pszValue, (DWORD)(sizeof(wchar_t)*(1 + lstrlenW(pszValue))));
}
if (!phKey) RegCloseKey(hKey);
else *phKey = hKey;
return (ERROR_SUCCESS == result);
}
static BOOL WriteRegValue(HKEY hKeyParent, LPCWSTR pszKey, LPCWSTR pszEntry, LPCWSTR pszValue)
{
HKEY hKey;
LONG result;
result = RegOpenKeyExW(hKeyParent, pszKey, 0, KEY_SET_VALUE, &hKey);
if (ERROR_SUCCESS != result || !hKey) return FALSE;
if (pszValue)
{
result = RegSetValueEx(hKey, pszEntry, 0, REG_SZ, (BYTE*)pszValue, (DWORD)(sizeof(wchar_t)*(1 + lstrlenW(pszValue))));
}
RegCloseKey(hKey);
return (ERROR_SUCCESS == result);
}
static BOOL WriteRegValue(HKEY hKeyParent, LPCWSTR pszKey, LPCWSTR pszEntry, DWORD pszValue)
{
HKEY hKey;
LONG result;
result = RegOpenKeyExW(hKeyParent, pszKey, 0, KEY_SET_VALUE, &hKey);
if (ERROR_SUCCESS != result || !hKey) return FALSE;
if (pszValue)
{
result = RegSetValueEx(hKey, pszEntry, 0, REG_DWORD, (BYTE*)&pszValue, sizeof(DWORD));
}
RegCloseKey(hKey);
return (ERROR_SUCCESS == result);
}
static LONG DeleteRegKey(HKEY hKeyParent, LPCWSTR pszKey)
{
HKEY hKey;
LONG result;
FILETIME time;
WCHAR szBuffer[512];
DWORD dwSize = sizeof(szBuffer)/sizeof(WCHAR);
result = RegOpenKeyExW(hKeyParent, pszKey, 0, KEY_SET_VALUE | KEY_ENUMERATE_SUB_KEYS , &hKey);
if (ERROR_SUCCESS != result) return result;
while (ERROR_SUCCESS == RegEnumKeyExW(hKey, 0, szBuffer, &dwSize, NULL, NULL, NULL, &time))
{
if (ERROR_SUCCESS != (result = DeleteRegKey(hKey, szBuffer)))
{
RegCloseKey(hKey);
return result;
}
dwSize = sizeof(szBuffer)/sizeof(WCHAR);
}
RegCloseKey(hKey);
return RegDeleteKeyW(hKeyParent, pszKey);
}
static HRESULT RegisterComponent(HMODULE hModule, const CLSID &clsid, LPCWSTR pszFriendlyName)
{
HKEY hKey, hKey2=0;
BOOL br;
WCHAR szBuffer[MAX_PATH], szCLSID[64];
if (!StringFromGUID2(clsid, szCLSID, sizeof(szCLSID)/sizeof(WCHAR))) return E_OUTOFMEMORY;
StringCchPrintfW(szBuffer, sizeof(szBuffer)/sizeof(WCHAR), L"CLSID\\%s", szCLSID);
if (!WriteRegKey(HKEY_CLASSES_ROOT, szBuffer, pszFriendlyName, &hKey)) return E_ACCESSDENIED;
if (!GetModuleFileNameW(hModule, szBuffer, sizeof(szBuffer)/sizeof(WCHAR))) return S_FALSE;
//wchar_t localizedString[MAX_PATH+15];
//StringCbPrintf(localizedString, sizeof(localizedString), L"@%s,-%u", szBuffer, IDS_WINAMP);
br = (WriteRegKey(hKey, L"InProcServer32" , szBuffer, &hKey2) &&
WriteRegValue(hKey2, NULL, L"ThreadingModel", L"Both"));
RegCloseKey(hKey);
if (hKey2) RegCloseKey(hKey2);
if (!br) return E_ACCESSDENIED;
return S_OK;
}
static HRESULT UnregisterComponent(const CLSID &clsid)
{
LONG result;
WCHAR szBuffer[MAX_PATH], szCLSID[64];
if (!StringFromGUID2(clsid, szCLSID, sizeof(szCLSID)/sizeof(WCHAR))) return E_OUTOFMEMORY;
StringCchPrintfW(szBuffer, sizeof(szBuffer)/sizeof(WCHAR), L"CLSID\\%s", szCLSID);
result = DeleteRegKey(HKEY_CLASSES_ROOT, szBuffer);
if (ERROR_SUCCESS != result && ERROR_FILE_NOT_FOUND != result) return S_FALSE;
return S_OK;
}

16
Src/ie_plugin/resource.h Normal file
View file

@ -0,0 +1,16 @@
//{{NO_DEPENDENCIES}}
// Microsoft Visual C++ generated include file.
// Used by winamp.rc
//
#define IDS_WINAMP 101
// Next default values for new objects
//
#ifdef APSTUDIO_INVOKED
#ifndef APSTUDIO_READONLY_SYMBOLS
#define _APS_NEXT_RESOURCE_VALUE 102
#define _APS_NEXT_COMMAND_VALUE 40001
#define _APS_NEXT_CONTROL_VALUE 1001
#define _APS_NEXT_SYMED_VALUE 101
#endif
#endif

113
Src/ie_plugin/winamp.rc Normal file
View file

@ -0,0 +1,113 @@
// Microsoft Visual C++ generated resource script.
//
#include "resource.h"
#define APSTUDIO_READONLY_SYMBOLS
/////////////////////////////////////////////////////////////////////////////
//
// Generated from the TEXTINCLUDE 2 resource.
//
#include "afxres.h"
/////////////////////////////////////////////////////////////////////////////
#undef APSTUDIO_READONLY_SYMBOLS
/////////////////////////////////////////////////////////////////////////////
// English (U.S.) resources
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
#ifdef _WIN32
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
#pragma code_page(1252)
#endif //_WIN32
#ifdef APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// TEXTINCLUDE
//
1 TEXTINCLUDE
BEGIN
"resource.h\0"
END
2 TEXTINCLUDE
BEGIN
"#include ""afxres.h""\r\n"
"\0"
END
3 TEXTINCLUDE
BEGIN
"\r\n"
"\0"
END
#endif // APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// Version
//
VS_VERSION_INFO VERSIONINFO
FILEVERSION 1,0,0,1
PRODUCTVERSION 1,0,0,1
FILEFLAGSMASK 0x17L
#ifdef _DEBUG
FILEFLAGS 0x1L
#else
FILEFLAGS 0x0L
#endif
FILEOS 0x4L
FILETYPE 0x2L
FILESUBTYPE 0x0L
BEGIN
BLOCK "StringFileInfo"
BEGIN
BLOCK "040904b0"
BEGIN
VALUE "CompanyName", "Winamp SA"
VALUE "FileDescription", "Winamp Application Detector"
VALUE "FileVersion", "1, 0, 0, 1"
VALUE "InternalName", "AppDetector"
VALUE "LegalCopyright", "Copyright © 2009-2014 Winamp SA"
VALUE "OriginalFilename", "iewachk.dll"
VALUE "ProductName", "Winamp Application Detector"
VALUE "ProductVersion", "1, 0, 0, 1"
END
END
BLOCK "VarFileInfo"
BEGIN
VALUE "Translation", 0x409, 1200
END
END
/////////////////////////////////////////////////////////////////////////////
//
// String Table
//
STRINGTABLE
BEGIN
IDS_WINAMP "Nullsoft Winamp"
END
#endif // English (U.S.) resources
/////////////////////////////////////////////////////////////////////////////
#ifndef APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// Generated from the TEXTINCLUDE 3 resource.
//
/////////////////////////////////////////////////////////////////////////////
#endif // not APSTUDIO_INVOKED