Initial commit: Complete open-source Decal rebuild
All 5 phases of the open-source Decal rebuild: Phase 1: 14 decompiled .NET projects (Interop.*, Adapter, FileService, DecalUtil) Phase 2: 10 native DLLs rewritten as C# COM servers with matching GUIDs - DecalDat, DHS, SpellFilter, DecalInput, DecalNet, DecalFilters - Decal.Core, DecalControls, DecalRender, D3DService Phase 3: C++ shims for Inject.DLL (D3D9 hooking) and LauncherHook.DLL Phase 4: DenAgent WinForms tray application Phase 5: WiX installer and build script 25 C# projects building with 0 errors. Native C++ projects require VS 2022 + Windows SDK (x86). Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
commit
d1442e3747
1382 changed files with 170725 additions and 0 deletions
351
Native/PlainText/Attic/PlainText.h
Normal file
351
Native/PlainText/Attic/PlainText.h
Normal file
|
|
@ -0,0 +1,351 @@
|
|||
/* this ALWAYS GENERATED file contains the definitions for the interfaces */
|
||||
|
||||
|
||||
/* File created by MIDL compiler version 5.01.0164 */
|
||||
/* at Sun Sep 23 00:59:18 2001
|
||||
*/
|
||||
/* Compiler settings for C:\Projects\decaldev2\source\PlainText\PlainText.idl:
|
||||
Oicf (OptLev=i2), W1, Zp8, env=Win32, ms_ext, c_ext
|
||||
error checks: allocation ref bounds_check enum stub_data
|
||||
*/
|
||||
//@@MIDL_FILE_HEADING( )
|
||||
|
||||
|
||||
/* verify that the <rpcndr.h> version is high enough to compile this file*/
|
||||
#ifndef __REQUIRED_RPCNDR_H_VERSION__
|
||||
#define __REQUIRED_RPCNDR_H_VERSION__ 440
|
||||
#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 __PlainText_h__
|
||||
#define __PlainText_h__
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"{
|
||||
#endif
|
||||
|
||||
/* Forward Declarations */
|
||||
|
||||
#ifndef __IScriptPluginSite_FWD_DEFINED__
|
||||
#define __IScriptPluginSite_FWD_DEFINED__
|
||||
typedef interface IScriptPluginSite IScriptPluginSite;
|
||||
#endif /* __IScriptPluginSite_FWD_DEFINED__ */
|
||||
|
||||
|
||||
#ifndef __IPluginEvents_FWD_DEFINED__
|
||||
#define __IPluginEvents_FWD_DEFINED__
|
||||
typedef interface IPluginEvents IPluginEvents;
|
||||
#endif /* __IPluginEvents_FWD_DEFINED__ */
|
||||
|
||||
|
||||
#ifndef __IPluginEvents_FWD_DEFINED__
|
||||
#define __IPluginEvents_FWD_DEFINED__
|
||||
typedef interface IPluginEvents IPluginEvents;
|
||||
#endif /* __IPluginEvents_FWD_DEFINED__ */
|
||||
|
||||
|
||||
#ifndef __ScriptPlugin_FWD_DEFINED__
|
||||
#define __ScriptPlugin_FWD_DEFINED__
|
||||
|
||||
#ifdef __cplusplus
|
||||
typedef class ScriptPlugin ScriptPlugin;
|
||||
#else
|
||||
typedef struct ScriptPlugin ScriptPlugin;
|
||||
#endif /* __cplusplus */
|
||||
|
||||
#endif /* __ScriptPlugin_FWD_DEFINED__ */
|
||||
|
||||
|
||||
/* header files for imported files */
|
||||
#include "oaidl.h"
|
||||
#include "ocidl.h"
|
||||
|
||||
void __RPC_FAR * __RPC_USER MIDL_user_allocate(size_t);
|
||||
void __RPC_USER MIDL_user_free( void __RPC_FAR * );
|
||||
|
||||
#ifndef __IScriptPluginSite_INTERFACE_DEFINED__
|
||||
#define __IScriptPluginSite_INTERFACE_DEFINED__
|
||||
|
||||
/* interface IScriptPluginSite */
|
||||
/* [unique][helpstring][dual][uuid][object] */
|
||||
|
||||
|
||||
EXTERN_C const IID IID_IScriptPluginSite;
|
||||
|
||||
#if defined(__cplusplus) && !defined(CINTERFACE)
|
||||
|
||||
MIDL_INTERFACE("7A6ECAD8-839E-47d9-B829-8581F065CEAC")
|
||||
IScriptPluginSite : public IDispatch
|
||||
{
|
||||
public:
|
||||
virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE CreateObject(
|
||||
BSTR strProgID,
|
||||
/* [retval][out] */ LPDISPATCH __RPC_FAR *ppObject) = 0;
|
||||
|
||||
};
|
||||
|
||||
#else /* C style interface */
|
||||
|
||||
typedef struct IScriptPluginSiteVtbl
|
||||
{
|
||||
BEGIN_INTERFACE
|
||||
|
||||
HRESULT ( STDMETHODCALLTYPE __RPC_FAR *QueryInterface )(
|
||||
IScriptPluginSite __RPC_FAR * This,
|
||||
/* [in] */ REFIID riid,
|
||||
/* [iid_is][out] */ void __RPC_FAR *__RPC_FAR *ppvObject);
|
||||
|
||||
ULONG ( STDMETHODCALLTYPE __RPC_FAR *AddRef )(
|
||||
IScriptPluginSite __RPC_FAR * This);
|
||||
|
||||
ULONG ( STDMETHODCALLTYPE __RPC_FAR *Release )(
|
||||
IScriptPluginSite __RPC_FAR * This);
|
||||
|
||||
HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetTypeInfoCount )(
|
||||
IScriptPluginSite __RPC_FAR * This,
|
||||
/* [out] */ UINT __RPC_FAR *pctinfo);
|
||||
|
||||
HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetTypeInfo )(
|
||||
IScriptPluginSite __RPC_FAR * This,
|
||||
/* [in] */ UINT iTInfo,
|
||||
/* [in] */ LCID lcid,
|
||||
/* [out] */ ITypeInfo __RPC_FAR *__RPC_FAR *ppTInfo);
|
||||
|
||||
HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetIDsOfNames )(
|
||||
IScriptPluginSite __RPC_FAR * This,
|
||||
/* [in] */ REFIID riid,
|
||||
/* [size_is][in] */ LPOLESTR __RPC_FAR *rgszNames,
|
||||
/* [in] */ UINT cNames,
|
||||
/* [in] */ LCID lcid,
|
||||
/* [size_is][out] */ DISPID __RPC_FAR *rgDispId);
|
||||
|
||||
/* [local] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *Invoke )(
|
||||
IScriptPluginSite __RPC_FAR * This,
|
||||
/* [in] */ DISPID dispIdMember,
|
||||
/* [in] */ REFIID riid,
|
||||
/* [in] */ LCID lcid,
|
||||
/* [in] */ WORD wFlags,
|
||||
/* [out][in] */ DISPPARAMS __RPC_FAR *pDispParams,
|
||||
/* [out] */ VARIANT __RPC_FAR *pVarResult,
|
||||
/* [out] */ EXCEPINFO __RPC_FAR *pExcepInfo,
|
||||
/* [out] */ UINT __RPC_FAR *puArgErr);
|
||||
|
||||
/* [helpstring][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *CreateObject )(
|
||||
IScriptPluginSite __RPC_FAR * This,
|
||||
BSTR strProgID,
|
||||
/* [retval][out] */ LPDISPATCH __RPC_FAR *ppObject);
|
||||
|
||||
END_INTERFACE
|
||||
} IScriptPluginSiteVtbl;
|
||||
|
||||
interface IScriptPluginSite
|
||||
{
|
||||
CONST_VTBL struct IScriptPluginSiteVtbl __RPC_FAR *lpVtbl;
|
||||
};
|
||||
|
||||
|
||||
|
||||
#ifdef COBJMACROS
|
||||
|
||||
|
||||
#define IScriptPluginSite_QueryInterface(This,riid,ppvObject) \
|
||||
(This)->lpVtbl -> QueryInterface(This,riid,ppvObject)
|
||||
|
||||
#define IScriptPluginSite_AddRef(This) \
|
||||
(This)->lpVtbl -> AddRef(This)
|
||||
|
||||
#define IScriptPluginSite_Release(This) \
|
||||
(This)->lpVtbl -> Release(This)
|
||||
|
||||
|
||||
#define IScriptPluginSite_GetTypeInfoCount(This,pctinfo) \
|
||||
(This)->lpVtbl -> GetTypeInfoCount(This,pctinfo)
|
||||
|
||||
#define IScriptPluginSite_GetTypeInfo(This,iTInfo,lcid,ppTInfo) \
|
||||
(This)->lpVtbl -> GetTypeInfo(This,iTInfo,lcid,ppTInfo)
|
||||
|
||||
#define IScriptPluginSite_GetIDsOfNames(This,riid,rgszNames,cNames,lcid,rgDispId) \
|
||||
(This)->lpVtbl -> GetIDsOfNames(This,riid,rgszNames,cNames,lcid,rgDispId)
|
||||
|
||||
#define IScriptPluginSite_Invoke(This,dispIdMember,riid,lcid,wFlags,pDispParams,pVarResult,pExcepInfo,puArgErr) \
|
||||
(This)->lpVtbl -> Invoke(This,dispIdMember,riid,lcid,wFlags,pDispParams,pVarResult,pExcepInfo,puArgErr)
|
||||
|
||||
|
||||
#define IScriptPluginSite_CreateObject(This,strProgID,ppObject) \
|
||||
(This)->lpVtbl -> CreateObject(This,strProgID,ppObject)
|
||||
|
||||
#endif /* COBJMACROS */
|
||||
|
||||
|
||||
#endif /* C style interface */
|
||||
|
||||
|
||||
|
||||
/* [helpstring][id] */ HRESULT STDMETHODCALLTYPE IScriptPluginSite_CreateObject_Proxy(
|
||||
IScriptPluginSite __RPC_FAR * This,
|
||||
BSTR strProgID,
|
||||
/* [retval][out] */ LPDISPATCH __RPC_FAR *ppObject);
|
||||
|
||||
|
||||
void __RPC_STUB IScriptPluginSite_CreateObject_Stub(
|
||||
IRpcStubBuffer *This,
|
||||
IRpcChannelBuffer *_pRpcChannelBuffer,
|
||||
PRPC_MESSAGE _pRpcMessage,
|
||||
DWORD *_pdwStubPhase);
|
||||
|
||||
|
||||
|
||||
#endif /* __IScriptPluginSite_INTERFACE_DEFINED__ */
|
||||
|
||||
|
||||
|
||||
#ifndef __PlainText_LIBRARY_DEFINED__
|
||||
#define __PlainText_LIBRARY_DEFINED__
|
||||
|
||||
/* library PlainText */
|
||||
/* [helpstring][version][uuid] */
|
||||
|
||||
|
||||
|
||||
EXTERN_C const IID LIBID_PlainText;
|
||||
|
||||
#ifndef __IPluginEvents_DISPINTERFACE_DEFINED__
|
||||
#define __IPluginEvents_DISPINTERFACE_DEFINED__
|
||||
|
||||
/* dispinterface IPluginEvents */
|
||||
/* [helpstring][uuid] */
|
||||
|
||||
|
||||
EXTERN_C const IID DIID_IPluginEvents;
|
||||
|
||||
#if defined(__cplusplus) && !defined(CINTERFACE)
|
||||
|
||||
MIDL_INTERFACE("4E1AE4C6-2120-489e-A124-F58E91C9B262")
|
||||
IPluginEvents : public IDispatch
|
||||
{
|
||||
};
|
||||
|
||||
#else /* C style interface */
|
||||
|
||||
typedef struct IPluginEventsVtbl
|
||||
{
|
||||
BEGIN_INTERFACE
|
||||
|
||||
HRESULT ( STDMETHODCALLTYPE __RPC_FAR *QueryInterface )(
|
||||
IPluginEvents __RPC_FAR * This,
|
||||
/* [in] */ REFIID riid,
|
||||
/* [iid_is][out] */ void __RPC_FAR *__RPC_FAR *ppvObject);
|
||||
|
||||
ULONG ( STDMETHODCALLTYPE __RPC_FAR *AddRef )(
|
||||
IPluginEvents __RPC_FAR * This);
|
||||
|
||||
ULONG ( STDMETHODCALLTYPE __RPC_FAR *Release )(
|
||||
IPluginEvents __RPC_FAR * This);
|
||||
|
||||
HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetTypeInfoCount )(
|
||||
IPluginEvents __RPC_FAR * This,
|
||||
/* [out] */ UINT __RPC_FAR *pctinfo);
|
||||
|
||||
HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetTypeInfo )(
|
||||
IPluginEvents __RPC_FAR * This,
|
||||
/* [in] */ UINT iTInfo,
|
||||
/* [in] */ LCID lcid,
|
||||
/* [out] */ ITypeInfo __RPC_FAR *__RPC_FAR *ppTInfo);
|
||||
|
||||
HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetIDsOfNames )(
|
||||
IPluginEvents __RPC_FAR * This,
|
||||
/* [in] */ REFIID riid,
|
||||
/* [size_is][in] */ LPOLESTR __RPC_FAR *rgszNames,
|
||||
/* [in] */ UINT cNames,
|
||||
/* [in] */ LCID lcid,
|
||||
/* [size_is][out] */ DISPID __RPC_FAR *rgDispId);
|
||||
|
||||
/* [local] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *Invoke )(
|
||||
IPluginEvents __RPC_FAR * This,
|
||||
/* [in] */ DISPID dispIdMember,
|
||||
/* [in] */ REFIID riid,
|
||||
/* [in] */ LCID lcid,
|
||||
/* [in] */ WORD wFlags,
|
||||
/* [out][in] */ DISPPARAMS __RPC_FAR *pDispParams,
|
||||
/* [out] */ VARIANT __RPC_FAR *pVarResult,
|
||||
/* [out] */ EXCEPINFO __RPC_FAR *pExcepInfo,
|
||||
/* [out] */ UINT __RPC_FAR *puArgErr);
|
||||
|
||||
END_INTERFACE
|
||||
} IPluginEventsVtbl;
|
||||
|
||||
interface IPluginEvents
|
||||
{
|
||||
CONST_VTBL struct IPluginEventsVtbl __RPC_FAR *lpVtbl;
|
||||
};
|
||||
|
||||
|
||||
|
||||
#ifdef COBJMACROS
|
||||
|
||||
|
||||
#define IPluginEvents_QueryInterface(This,riid,ppvObject) \
|
||||
(This)->lpVtbl -> QueryInterface(This,riid,ppvObject)
|
||||
|
||||
#define IPluginEvents_AddRef(This) \
|
||||
(This)->lpVtbl -> AddRef(This)
|
||||
|
||||
#define IPluginEvents_Release(This) \
|
||||
(This)->lpVtbl -> Release(This)
|
||||
|
||||
|
||||
#define IPluginEvents_GetTypeInfoCount(This,pctinfo) \
|
||||
(This)->lpVtbl -> GetTypeInfoCount(This,pctinfo)
|
||||
|
||||
#define IPluginEvents_GetTypeInfo(This,iTInfo,lcid,ppTInfo) \
|
||||
(This)->lpVtbl -> GetTypeInfo(This,iTInfo,lcid,ppTInfo)
|
||||
|
||||
#define IPluginEvents_GetIDsOfNames(This,riid,rgszNames,cNames,lcid,rgDispId) \
|
||||
(This)->lpVtbl -> GetIDsOfNames(This,riid,rgszNames,cNames,lcid,rgDispId)
|
||||
|
||||
#define IPluginEvents_Invoke(This,dispIdMember,riid,lcid,wFlags,pDispParams,pVarResult,pExcepInfo,puArgErr) \
|
||||
(This)->lpVtbl -> Invoke(This,dispIdMember,riid,lcid,wFlags,pDispParams,pVarResult,pExcepInfo,puArgErr)
|
||||
|
||||
#endif /* COBJMACROS */
|
||||
|
||||
|
||||
#endif /* C style interface */
|
||||
|
||||
|
||||
#endif /* __IPluginEvents_DISPINTERFACE_DEFINED__ */
|
||||
|
||||
|
||||
EXTERN_C const CLSID CLSID_ScriptPlugin;
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
class DECLSPEC_UUID("F8F77FFC-88E1-4d50-9F51-C30F3F35C4EF")
|
||||
ScriptPlugin;
|
||||
#endif
|
||||
#endif /* __PlainText_LIBRARY_DEFINED__ */
|
||||
|
||||
/* Additional Prototypes for ALL interfaces */
|
||||
|
||||
unsigned long __RPC_USER BSTR_UserSize( unsigned long __RPC_FAR *, unsigned long , BSTR __RPC_FAR * );
|
||||
unsigned char __RPC_FAR * __RPC_USER BSTR_UserMarshal( unsigned long __RPC_FAR *, unsigned char __RPC_FAR *, BSTR __RPC_FAR * );
|
||||
unsigned char __RPC_FAR * __RPC_USER BSTR_UserUnmarshal(unsigned long __RPC_FAR *, unsigned char __RPC_FAR *, BSTR __RPC_FAR * );
|
||||
void __RPC_USER BSTR_UserFree( unsigned long __RPC_FAR *, BSTR __RPC_FAR * );
|
||||
|
||||
/* end of Additional Prototypes */
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
11
Native/PlainText/NamedObjects.h
Normal file
11
Native/PlainText/NamedObjects.h
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
// NamedObjects.h
|
||||
// Declaration of class cNamedObjects, cache for keeping track of named objects
|
||||
|
||||
#ifndef __NAMEDOBJECTS_H
|
||||
#define __NAMEDOBJECTS_H
|
||||
|
||||
class cNamedObjects
|
||||
{
|
||||
};
|
||||
|
||||
#endif
|
||||
72
Native/PlainText/PlainText.cpp
Normal file
72
Native/PlainText/PlainText.cpp
Normal file
|
|
@ -0,0 +1,72 @@
|
|||
// PlainText.cpp : Implementation of DLL Exports.
|
||||
|
||||
|
||||
// Note: Proxy/Stub Information
|
||||
// To build a separate proxy/stub DLL,
|
||||
// run nmake -f PlainTextps.mk in the project directory.
|
||||
|
||||
#include "stdafx.h"
|
||||
#include "resource.h"
|
||||
#include <initguid.h>
|
||||
#include "PlainText.h"
|
||||
|
||||
#include "PlainText_i.c"
|
||||
|
||||
#include "ScriptPlugin.h"
|
||||
#include "ScriptView.h"
|
||||
|
||||
CComModule _Module;
|
||||
|
||||
BEGIN_OBJECT_MAP(ObjectMap)
|
||||
OBJECT_ENTRY(CLSID_ScriptPlugin, cScriptPlugin)
|
||||
OBJECT_ENTRY(CLSID_ScriptView, CScriptView)
|
||||
END_OBJECT_MAP()
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// DLL Entry Point
|
||||
|
||||
extern "C"
|
||||
BOOL WINAPI DllMain(HINSTANCE hInstance, DWORD dwReason, LPVOID /*lpReserved*/)
|
||||
{
|
||||
if (dwReason == DLL_PROCESS_ATTACH)
|
||||
{
|
||||
_Module.Init(ObjectMap, hInstance, &LIBID_PlainText);
|
||||
DisableThreadLibraryCalls(hInstance);
|
||||
}
|
||||
else if (dwReason == DLL_PROCESS_DETACH)
|
||||
_Module.Term();
|
||||
return TRUE; // ok
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Used to determine whether the DLL can be unloaded by OLE
|
||||
|
||||
STDAPI DllCanUnloadNow(void)
|
||||
{
|
||||
return (_Module.GetLockCount()==0) ? S_OK : S_FALSE;
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Returns a class factory to create an object of the requested type
|
||||
|
||||
STDAPI DllGetClassObject(REFCLSID rclsid, REFIID riid, LPVOID* ppv)
|
||||
{
|
||||
return _Module.GetClassObject(rclsid, riid, ppv);
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// DllRegisterServer - Adds entries to the system registry
|
||||
|
||||
STDAPI DllRegisterServer(void)
|
||||
{
|
||||
// registers object, typelib and all interfaces in typelib
|
||||
return _Module.RegisterServer(TRUE);
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// DllUnregisterServer - Removes entries from the system registry
|
||||
|
||||
STDAPI DllUnregisterServer(void)
|
||||
{
|
||||
return _Module.UnregisterServer(TRUE);
|
||||
}
|
||||
9
Native/PlainText/PlainText.def
Normal file
9
Native/PlainText/PlainText.def
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
; PlainText.def : Declares the module parameters.
|
||||
|
||||
LIBRARY "PlainText.DLL"
|
||||
|
||||
EXPORTS
|
||||
DllCanUnloadNow PRIVATE
|
||||
DllGetClassObject PRIVATE
|
||||
DllRegisterServer PRIVATE
|
||||
DllUnregisterServer PRIVATE
|
||||
189
Native/PlainText/PlainText.dsp
Normal file
189
Native/PlainText/PlainText.dsp
Normal file
|
|
@ -0,0 +1,189 @@
|
|||
# Microsoft Developer Studio Project File - Name="PlainText" - Package Owner=<4>
|
||||
# Microsoft Developer Studio Generated Build File, Format Version 6.00
|
||||
# ** DO NOT EDIT **
|
||||
|
||||
# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102
|
||||
|
||||
CFG=PlainText - Win32 Debug
|
||||
!MESSAGE This is not a valid makefile. To build this project using NMAKE,
|
||||
!MESSAGE use the Export Makefile command and run
|
||||
!MESSAGE
|
||||
!MESSAGE NMAKE /f "PlainText.mak".
|
||||
!MESSAGE
|
||||
!MESSAGE You can specify a configuration when running NMAKE
|
||||
!MESSAGE by defining the macro CFG on the command line. For example:
|
||||
!MESSAGE
|
||||
!MESSAGE NMAKE /f "PlainText.mak" CFG="PlainText - Win32 Debug"
|
||||
!MESSAGE
|
||||
!MESSAGE Possible choices for configuration are:
|
||||
!MESSAGE
|
||||
!MESSAGE "PlainText - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library")
|
||||
!MESSAGE "PlainText - Win32 Release MinDependency" (based on "Win32 (x86) Dynamic-Link Library")
|
||||
!MESSAGE
|
||||
|
||||
# Begin Project
|
||||
# PROP AllowPerConfigDependencies 0
|
||||
# PROP Scc_ProjName ""
|
||||
# PROP Scc_LocalPath ""
|
||||
CPP=cl.exe
|
||||
MTL=midl.exe
|
||||
RSC=rc.exe
|
||||
|
||||
!IF "$(CFG)" == "PlainText - Win32 Debug"
|
||||
|
||||
# PROP BASE Use_MFC 0
|
||||
# PROP BASE Use_Debug_Libraries 1
|
||||
# PROP BASE Output_Dir "Debug"
|
||||
# PROP BASE Intermediate_Dir "Debug"
|
||||
# PROP BASE Target_Dir ""
|
||||
# PROP Use_MFC 0
|
||||
# PROP Use_Debug_Libraries 1
|
||||
# PROP Output_Dir "..\Debug"
|
||||
# PROP Intermediate_Dir "Debug"
|
||||
# PROP Ignore_Export_Lib 1
|
||||
# PROP Target_Dir ""
|
||||
# ADD BASE CPP /nologo /MTd /W3 /Gm /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /Yu"stdafx.h" /FD /GZ /c
|
||||
# ADD CPP /nologo /MDd /W3 /Gm /Gi /GX /ZI /Od /I "..\Include" /I "..\Inject" /I "..\DecalControls" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /Yu"stdafx.h" /FD /GZ /c
|
||||
# ADD MTL /nologo /I "..\Include" /Oicf
|
||||
# ADD BASE RSC /l 0x1009 /d "_DEBUG"
|
||||
# ADD RSC /l 0x1009 /d "_DEBUG"
|
||||
BSC32=bscmake.exe
|
||||
# ADD BASE BSC32 /nologo
|
||||
# ADD BSC32 /nologo
|
||||
LINK32=link.exe
|
||||
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /debug /machine:I386 /pdbtype:sept
|
||||
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /debug /machine:I386 /pdbtype:sept
|
||||
# Begin Custom Build - Performing registration
|
||||
OutDir=.\..\Debug
|
||||
TargetPath=\source\Debug\PlainText.dll
|
||||
InputPath=\source\Debug\PlainText.dll
|
||||
SOURCE="$(InputPath)"
|
||||
|
||||
"$(OutDir)\regsvr32.trg" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
|
||||
regsvr32 /s /c "$(TargetPath)"
|
||||
echo regsvr32 exec. time > "$(OutDir)\regsvr32.trg"
|
||||
|
||||
# End Custom Build
|
||||
|
||||
!ELSEIF "$(CFG)" == "PlainText - Win32 Release MinDependency"
|
||||
|
||||
# PROP BASE Use_MFC 0
|
||||
# PROP BASE Use_Debug_Libraries 0
|
||||
# PROP BASE Output_Dir "ReleaseMinDependency"
|
||||
# PROP BASE Intermediate_Dir "ReleaseMinDependency"
|
||||
# PROP BASE Target_Dir ""
|
||||
# PROP Use_MFC 0
|
||||
# PROP Use_Debug_Libraries 0
|
||||
# PROP Output_Dir "..\Release"
|
||||
# PROP Intermediate_Dir "ReleaseMinDependency"
|
||||
# PROP Ignore_Export_Lib 1
|
||||
# PROP Target_Dir ""
|
||||
# ADD BASE CPP /nologo /MT /W3 /O1 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "_ATL_STATIC_REGISTRY" /D "_ATL_MIN_CRT" /Yu"stdafx.h" /FD /c
|
||||
# ADD CPP /nologo /MD /W3 /Zi /Oa /Og /Oi /Os /Oy /Ob1 /Gf /Gy /I "..\Include" /I "..\Inject" /I "..\DecalControls" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /Yu"stdafx.h" /FD /c
|
||||
# ADD MTL /nologo /I "..\Include" /Oicf
|
||||
# ADD BASE RSC /l 0x1009 /d "NDEBUG"
|
||||
# ADD RSC /l 0x1009 /d "NDEBUG"
|
||||
BSC32=bscmake.exe
|
||||
# ADD BASE BSC32 /nologo
|
||||
# ADD BSC32 /nologo
|
||||
LINK32=link.exe
|
||||
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /machine:I386
|
||||
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /debug /machine:I386 /pdbtype:sept /libpath:"..\Release"
|
||||
# Begin Custom Build - Performing registration
|
||||
OutDir=.\..\Release
|
||||
TargetPath=\source\Release\PlainText.dll
|
||||
InputPath=\source\Release\PlainText.dll
|
||||
SOURCE="$(InputPath)"
|
||||
|
||||
"$(OutDir)\regsvr32.trg" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
|
||||
regsvr32 /s /c "$(TargetPath)"
|
||||
echo regsvr32 exec. time > "$(OutDir)\regsvr32.trg"
|
||||
|
||||
# End Custom Build
|
||||
|
||||
!ENDIF
|
||||
|
||||
# Begin Target
|
||||
|
||||
# Name "PlainText - Win32 Debug"
|
||||
# Name "PlainText - Win32 Release MinDependency"
|
||||
# Begin Group "Source Files"
|
||||
|
||||
# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\PlainText.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\PlainText.def
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\PlainText.idl
|
||||
# ADD MTL /tlb ".\PlainText.tlb" /h "PlainText.h" /iid "PlainText_i.c" /Oicf
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\PlainText.rc
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\ScriptPlugin.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\ScriptSiteImpl.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\ScriptView.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\StdAfx.cpp
|
||||
# ADD CPP /Yc"stdafx.h"
|
||||
# End Source File
|
||||
# End Group
|
||||
# Begin Group "Header Files"
|
||||
|
||||
# PROP Default_Filter "h;hpp;hxx;hm;inl"
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\PlainTextCP.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\Resource.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\ScriptPlugin.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\ScriptSiteImpl.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\ScriptView.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\StdAfx.h
|
||||
# End Source File
|
||||
# End Group
|
||||
# Begin Group "Resource Files"
|
||||
|
||||
# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\ScriptPlugin.rgs
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\ScriptView.rgs
|
||||
# End Source File
|
||||
# End Group
|
||||
# End Target
|
||||
# End Project
|
||||
93
Native/PlainText/PlainText.idl
Normal file
93
Native/PlainText/PlainText.idl
Normal file
|
|
@ -0,0 +1,93 @@
|
|||
// PlainText.idl : IDL source for PlainText.dll
|
||||
//
|
||||
|
||||
// This file will be processed by the MIDL tool to
|
||||
// produce the type library (PlainText.tlb) and marshalling code.
|
||||
|
||||
import "oaidl.idl";
|
||||
import "ocidl.idl";
|
||||
|
||||
import "..\Inject\Inject.idl";
|
||||
import "..\DecalControls\DecalControls.idl";
|
||||
|
||||
[
|
||||
object,
|
||||
uuid(7A6ECAD8-839E-47d9-B829-8581F065CEAC),
|
||||
dual,
|
||||
helpstring("IScriptPluginSite Interface"),
|
||||
pointer_default(unique)
|
||||
]
|
||||
interface IScriptPluginSite : IDispatch
|
||||
{
|
||||
[id(1), helpstring("method CreateObject")] HRESULT CreateObject(BSTR strProgID, [out, retval] LPDISPATCH *ppObject);
|
||||
[id(2), helpstring("method WriteToChatWindow")] HRESULT WriteToChatWindow(BSTR szText, long lColor);
|
||||
[id(3), helpstring("method MessageBox")] HRESULT MessageBox(BSTR Title, BSTR Text);
|
||||
[id(4), helpstring("method LoadView")] HRESULT LoadView(BSTR Text, [out, retval] IView **pView);
|
||||
[id(8), helpstring("method CreateView")] HRESULT CreateView(BSTR strTemplateName, [out, retval] LPDISPATCH *ppNewView);
|
||||
};
|
||||
|
||||
[
|
||||
uuid(4E1AE4C6-2120-489e-A124-F58E91C9B262),
|
||||
helpstring("IPluginEvents Interface")
|
||||
]
|
||||
dispinterface IPluginEvents
|
||||
{
|
||||
properties:
|
||||
methods:
|
||||
[id(1), helpstring("method Initialize")] HRESULT Initialize();
|
||||
[id(2), helpstring("method Terminate")] HRESULT Terminate();
|
||||
};
|
||||
[
|
||||
object,
|
||||
uuid(555175AF-1D74-4658-A199-EE6CCA3E066D),
|
||||
dual,
|
||||
helpstring("IScriptView Interface"),
|
||||
pointer_default(unique)
|
||||
]
|
||||
interface IScriptView : IDispatch
|
||||
{
|
||||
};
|
||||
[
|
||||
uuid(02CA4EB7-2816-4b68-8EC0-4502C9C35E7D),
|
||||
helpstring("IViewEvents Interface")
|
||||
]
|
||||
dispinterface IScriptViewEvents
|
||||
{
|
||||
properties:
|
||||
methods:
|
||||
[id(1), helpstring("method Initialize")] void Initialize();
|
||||
[id(2), helpstring("method Terminate")] void Terminate();
|
||||
[id(3), helpstring("method Activate")] void Activate();
|
||||
[id(4), helpstring("method Deactivate")] void Deactivate();
|
||||
};
|
||||
[
|
||||
uuid(1658A49F-0444-43E5-BA11-ED1AD1C256DB),
|
||||
version(1.0),
|
||||
helpstring("PlainText 1.0 Type Library")
|
||||
]
|
||||
library PlainText
|
||||
{
|
||||
importlib("stdole32.tlb");
|
||||
importlib("stdole2.tlb");
|
||||
|
||||
dispinterface IPluginEvents;
|
||||
dispinterface IScriptViewEvents;
|
||||
[
|
||||
uuid(F8F77FFC-88E1-4d50-9F51-C30F3F35C4EF),
|
||||
helpstring("ScriptPlugin Class")
|
||||
]
|
||||
coclass ScriptPlugin
|
||||
{
|
||||
[default] interface IScriptPluginSite;
|
||||
[default, source] dispinterface IPluginEvents;
|
||||
};
|
||||
[
|
||||
uuid(B537CBEC-98C1-480A-910D-4C99E5E96273),
|
||||
helpstring("ScriptView Class")
|
||||
]
|
||||
coclass ScriptView
|
||||
{
|
||||
[default] interface IScriptView;
|
||||
[default, source] interface IScriptViewEvents;
|
||||
};
|
||||
};
|
||||
140
Native/PlainText/PlainText.rc
Normal file
140
Native/PlainText/PlainText.rc
Normal file
|
|
@ -0,0 +1,140 @@
|
|||
// Microsoft Visual C++ generated resource script.
|
||||
//
|
||||
#include "resource.h"
|
||||
#include "..\Include\DecalVersion.h"
|
||||
|
||||
#define APSTUDIO_READONLY_SYMBOLS
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Generated from the TEXTINCLUDE 2 resource.
|
||||
//
|
||||
#include "winres.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 ""winres.h""\r\n"
|
||||
"\0"
|
||||
END
|
||||
|
||||
3 TEXTINCLUDE
|
||||
BEGIN
|
||||
"1 TYPELIB ""PlainText.tlb""\r\n"
|
||||
"\0"
|
||||
END
|
||||
|
||||
#endif // APSTUDIO_INVOKED
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Version
|
||||
//
|
||||
|
||||
VS_VERSION_INFO VERSIONINFO
|
||||
FILEVERSION DECAL_MAJOR, DECAL_MINOR, DECAL_BUGFIX, DECAL_RELEASE
|
||||
PRODUCTVERSION DECAL_MAJOR, DECAL_MINOR, DECAL_BUGFIX, DECAL_RELEASE
|
||||
FILEFLAGSMASK 0x3fL
|
||||
#ifdef _DEBUG
|
||||
FILEFLAGS 0x1L
|
||||
#else
|
||||
FILEFLAGS 0x0L
|
||||
#endif
|
||||
FILEOS 0x4L
|
||||
FILETYPE 0x2L
|
||||
FILESUBTYPE 0x0L
|
||||
BEGIN
|
||||
BLOCK "StringFileInfo"
|
||||
BEGIN
|
||||
BLOCK "040904b0"
|
||||
BEGIN
|
||||
VALUE "Comments", "PlainText is a Decal surrogate that allows plug-ins to be written using Windows Scripting Technologies"
|
||||
VALUE "FileDescription", "PlainText Module"
|
||||
VALUE "FileVersion", DECAL_VERSION_STRING
|
||||
VALUE "InternalName", "PlainText"
|
||||
VALUE "LegalCopyright", "Copyright 2001"
|
||||
VALUE "OriginalFilename", "PlainText.DLL"
|
||||
VALUE "ProductName", "PlainText Module"
|
||||
VALUE "ProductVersion", DECAL_VERSION_STRING
|
||||
END
|
||||
END
|
||||
BLOCK "VarFileInfo"
|
||||
BEGIN
|
||||
VALUE "Translation", 0x409, 1200
|
||||
END
|
||||
END
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// REGISTRY
|
||||
//
|
||||
|
||||
IDR_SCRIPTVIEW REGISTRY "ScriptView.rgs"
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// String Table
|
||||
//
|
||||
|
||||
STRINGTABLE
|
||||
BEGIN
|
||||
IDS_PROJNAME "PlainText"
|
||||
END
|
||||
|
||||
#endif // English (U.S.) resources
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// English (Canada) resources
|
||||
|
||||
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENC)
|
||||
#ifdef _WIN32
|
||||
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_CAN
|
||||
#pragma code_page(1252)
|
||||
#endif //_WIN32
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// REGISTRY
|
||||
//
|
||||
|
||||
IDR_SCRIPTPLUGIN REGISTRY "ScriptPlugin.rgs"
|
||||
#endif // English (Canada) resources
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
|
||||
#ifndef APSTUDIO_INVOKED
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Generated from the TEXTINCLUDE 3 resource.
|
||||
//
|
||||
1 TYPELIB "PlainText.tlb"
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
#endif // not APSTUDIO_INVOKED
|
||||
|
||||
339
Native/PlainText/PlainText.vcproj
Normal file
339
Native/PlainText/PlainText.vcproj
Normal file
|
|
@ -0,0 +1,339 @@
|
|||
<?xml version="1.0" encoding="Windows-1252"?>
|
||||
<VisualStudioProject
|
||||
ProjectType="Visual C++"
|
||||
Version="7.10"
|
||||
Name="PlainText"
|
||||
SccProjectName=""
|
||||
SccLocalPath="">
|
||||
<Platforms>
|
||||
<Platform
|
||||
Name="Win32"/>
|
||||
</Platforms>
|
||||
<Configurations>
|
||||
<Configuration
|
||||
Name="Debug|Win32"
|
||||
OutputDirectory=".\..\Debug"
|
||||
IntermediateDirectory=".\Debug"
|
||||
ConfigurationType="2"
|
||||
UseOfMFC="0"
|
||||
ATLMinimizesCRunTimeLibraryUsage="FALSE"
|
||||
CharacterSet="2">
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="0"
|
||||
AdditionalIncludeDirectories="..\Include,..\Inject,..\DecalControls"
|
||||
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL"
|
||||
BasicRuntimeChecks="3"
|
||||
RuntimeLibrary="3"
|
||||
UsePrecompiledHeader="3"
|
||||
PrecompiledHeaderThrough="stdafx.h"
|
||||
PrecompiledHeaderFile=".\Debug/PlainText.pch"
|
||||
AssemblerListingLocation=".\Debug/"
|
||||
ObjectFile=".\Debug/"
|
||||
ProgramDataBaseFileName=".\Debug/"
|
||||
WarningLevel="3"
|
||||
SuppressStartupBanner="TRUE"
|
||||
DebugInformationFormat="4"
|
||||
CompileAs="0"/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
IgnoreImportLibrary="TRUE"
|
||||
OutputFile=".\..\Debug/PlainText.dll"
|
||||
LinkIncremental="1"
|
||||
SuppressStartupBanner="TRUE"
|
||||
ModuleDefinitionFile=".\PlainText.def"
|
||||
GenerateDebugInformation="TRUE"
|
||||
ProgramDatabaseFile=".\..\Debug/PlainText.pdb"
|
||||
SubSystem="2"
|
||||
ImportLibrary=".\..\Debug/PlainText.lib"
|
||||
TargetMachine="1"/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"
|
||||
AdditionalIncludeDirectories="..\Include"
|
||||
SuppressStartupBanner="TRUE"
|
||||
TargetEnvironment="1"
|
||||
GenerateStublessProxies="TRUE"
|
||||
TypeLibraryName=".\..\Debug/PlainText.tlb"
|
||||
HeaderFileName=""/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"/>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
PreprocessorDefinitions="_DEBUG"
|
||||
Culture="4105"/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"/>
|
||||
<Tool
|
||||
Name="VCWebDeploymentTool"/>
|
||||
<Tool
|
||||
Name="VCManagedWrapperGeneratorTool"/>
|
||||
<Tool
|
||||
Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
|
||||
</Configuration>
|
||||
<Configuration
|
||||
Name="Release MinDependency|Win32"
|
||||
OutputDirectory=".\..\Release"
|
||||
IntermediateDirectory=".\ReleaseMinDependency"
|
||||
ConfigurationType="2"
|
||||
UseOfMFC="0"
|
||||
ATLMinimizesCRunTimeLibraryUsage="FALSE"
|
||||
CharacterSet="2">
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="4"
|
||||
GlobalOptimizations="TRUE"
|
||||
InlineFunctionExpansion="1"
|
||||
EnableIntrinsicFunctions="TRUE"
|
||||
FavorSizeOrSpeed="2"
|
||||
OmitFramePointers="TRUE"
|
||||
AdditionalIncludeDirectories="..\Include,..\Inject,..\DecalControls"
|
||||
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL"
|
||||
StringPooling="TRUE"
|
||||
RuntimeLibrary="0"
|
||||
EnableFunctionLevelLinking="TRUE"
|
||||
UsePrecompiledHeader="3"
|
||||
PrecompiledHeaderThrough="stdafx.h"
|
||||
PrecompiledHeaderFile=".\ReleaseMinDependency/PlainText.pch"
|
||||
AssemblerListingLocation=".\ReleaseMinDependency/"
|
||||
ObjectFile=".\ReleaseMinDependency/"
|
||||
ProgramDataBaseFileName=".\ReleaseMinDependency/"
|
||||
WarningLevel="3"
|
||||
SuppressStartupBanner="TRUE"
|
||||
DebugInformationFormat="3"
|
||||
CompileAs="0"/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
IgnoreImportLibrary="TRUE"
|
||||
OutputFile=".\..\Release/PlainText.dll"
|
||||
LinkIncremental="1"
|
||||
SuppressStartupBanner="TRUE"
|
||||
AdditionalLibraryDirectories="..\Release"
|
||||
ModuleDefinitionFile=".\PlainText.def"
|
||||
GenerateDebugInformation="TRUE"
|
||||
ProgramDatabaseFile=".\..\Release/PlainText.pdb"
|
||||
SubSystem="2"
|
||||
ImportLibrary=".\..\Release/PlainText.lib"
|
||||
TargetMachine="1"/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"
|
||||
AdditionalIncludeDirectories="..\Include"
|
||||
SuppressStartupBanner="TRUE"
|
||||
TargetEnvironment="1"
|
||||
GenerateStublessProxies="TRUE"
|
||||
TypeLibraryName=".\..\Release/PlainText.tlb"
|
||||
HeaderFileName=""/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"/>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
PreprocessorDefinitions="NDEBUG"
|
||||
Culture="4105"/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"/>
|
||||
<Tool
|
||||
Name="VCWebDeploymentTool"/>
|
||||
<Tool
|
||||
Name="VCManagedWrapperGeneratorTool"/>
|
||||
<Tool
|
||||
Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
|
||||
</Configuration>
|
||||
</Configurations>
|
||||
<References>
|
||||
</References>
|
||||
<Files>
|
||||
<Filter
|
||||
Name="Source Files"
|
||||
Filter="cpp;c;cxx;rc;def;r;odl;idl;hpj;bat">
|
||||
<File
|
||||
RelativePath="PlainText.cpp">
|
||||
<FileConfiguration
|
||||
Name="Debug|Win32">
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="0"
|
||||
AdditionalIncludeDirectories=""
|
||||
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_MBCS;_USRDLL;$(NoInherit)"
|
||||
BasicRuntimeChecks="3"/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
Name="Release MinDependency|Win32">
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
AdditionalIncludeDirectories=""
|
||||
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_MBCS;_USRDLL;$(NoInherit)"/>
|
||||
</FileConfiguration>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="PlainText.def">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="PlainText.idl">
|
||||
<FileConfiguration
|
||||
Name="Debug|Win32">
|
||||
<Tool
|
||||
Name="VCMIDLTool"
|
||||
AdditionalIncludeDirectories=""
|
||||
TargetEnvironment="1"
|
||||
TypeLibraryName=".\PlainText.tlb"
|
||||
HeaderFileName="PlainText.h"
|
||||
InterfaceIdentifierFileName="PlainText_i.c"/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
Name="Release MinDependency|Win32">
|
||||
<Tool
|
||||
Name="VCMIDLTool"
|
||||
AdditionalIncludeDirectories=""
|
||||
TargetEnvironment="1"
|
||||
TypeLibraryName=".\PlainText.tlb"
|
||||
HeaderFileName="PlainText.h"
|
||||
InterfaceIdentifierFileName="PlainText_i.c"/>
|
||||
</FileConfiguration>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="PlainText.rc">
|
||||
<FileConfiguration
|
||||
Name="Debug|Win32">
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
PreprocessorDefinitions=""
|
||||
AdditionalIncludeDirectories="$(OUTDIR)"/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
Name="Release MinDependency|Win32">
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
PreprocessorDefinitions=""
|
||||
AdditionalIncludeDirectories="$(OUTDIR)"/>
|
||||
</FileConfiguration>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="ScriptPlugin.cpp">
|
||||
<FileConfiguration
|
||||
Name="Debug|Win32">
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="0"
|
||||
AdditionalIncludeDirectories=""
|
||||
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_MBCS;_USRDLL;$(NoInherit)"
|
||||
BasicRuntimeChecks="3"/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
Name="Release MinDependency|Win32">
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
AdditionalIncludeDirectories=""
|
||||
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_MBCS;_USRDLL;$(NoInherit)"/>
|
||||
</FileConfiguration>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="ScriptSiteImpl.cpp">
|
||||
<FileConfiguration
|
||||
Name="Debug|Win32">
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="0"
|
||||
AdditionalIncludeDirectories=""
|
||||
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_MBCS;_USRDLL;$(NoInherit)"
|
||||
BasicRuntimeChecks="3"/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
Name="Release MinDependency|Win32">
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
AdditionalIncludeDirectories=""
|
||||
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_MBCS;_USRDLL;$(NoInherit)"/>
|
||||
</FileConfiguration>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="ScriptView.cpp">
|
||||
<FileConfiguration
|
||||
Name="Debug|Win32">
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="0"
|
||||
AdditionalIncludeDirectories=""
|
||||
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_MBCS;_USRDLL;$(NoInherit)"
|
||||
BasicRuntimeChecks="3"/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
Name="Release MinDependency|Win32">
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
AdditionalIncludeDirectories=""
|
||||
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_MBCS;_USRDLL;$(NoInherit)"/>
|
||||
</FileConfiguration>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="StdAfx.cpp">
|
||||
<FileConfiguration
|
||||
Name="Debug|Win32">
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="0"
|
||||
AdditionalIncludeDirectories=""
|
||||
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_MBCS;_USRDLL;$(NoInherit)"
|
||||
BasicRuntimeChecks="3"
|
||||
UsePrecompiledHeader="1"/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
Name="Release MinDependency|Win32">
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
AdditionalIncludeDirectories=""
|
||||
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_MBCS;_USRDLL;$(NoInherit)"
|
||||
UsePrecompiledHeader="1"/>
|
||||
</FileConfiguration>
|
||||
</File>
|
||||
</Filter>
|
||||
<Filter
|
||||
Name="Header Files"
|
||||
Filter="h;hpp;hxx;hm;inl">
|
||||
<File
|
||||
RelativePath="PlainTextCP.h">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="Resource.h">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="ScriptPlugin.h">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="ScriptSiteImpl.h">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="ScriptView.h">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="StdAfx.h">
|
||||
</File>
|
||||
</Filter>
|
||||
<Filter
|
||||
Name="Resource Files"
|
||||
Filter="ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe">
|
||||
<File
|
||||
RelativePath="ScriptPlugin.rgs">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="ScriptView.rgs">
|
||||
</File>
|
||||
</Filter>
|
||||
</Files>
|
||||
<Globals>
|
||||
</Globals>
|
||||
</VisualStudioProject>
|
||||
145
Native/PlainText/PlainTextCP.h
Normal file
145
Native/PlainText/PlainTextCP.h
Normal file
|
|
@ -0,0 +1,145 @@
|
|||
#ifndef _PLAINTEXTCP_H_
|
||||
#define _PLAINTEXTCP_H_
|
||||
|
||||
|
||||
template <class T>
|
||||
class CProxyIPluginEvents : public IConnectionPointImpl<T, &DIID_IPluginEvents, CComDynamicUnkArray>
|
||||
{
|
||||
//Warning this class may be recreated by the wizard.
|
||||
public:
|
||||
HRESULT Fire_Initialize()
|
||||
{
|
||||
CComVariant varResult;
|
||||
T* pT = static_cast<T*>(this);
|
||||
int nConnectionIndex;
|
||||
int nConnections = m_vec.GetSize();
|
||||
|
||||
for (nConnectionIndex = 0; nConnectionIndex < nConnections; nConnectionIndex++)
|
||||
{
|
||||
pT->Lock();
|
||||
CComPtr<IUnknown> sp = m_vec.GetAt(nConnectionIndex);
|
||||
pT->Unlock();
|
||||
IDispatch* pDispatch = reinterpret_cast<IDispatch*>(sp.p);
|
||||
if (pDispatch != NULL)
|
||||
{
|
||||
VariantClear(&varResult);
|
||||
DISPPARAMS disp = { NULL, NULL, 0, 0 };
|
||||
pDispatch->Invoke(0x1, IID_NULL, LOCALE_USER_DEFAULT, DISPATCH_METHOD, &disp, &varResult, NULL, NULL);
|
||||
}
|
||||
}
|
||||
return varResult.scode;
|
||||
|
||||
}
|
||||
HRESULT Fire_Terminate()
|
||||
{
|
||||
CComVariant varResult;
|
||||
T* pT = static_cast<T*>(this);
|
||||
int nConnectionIndex;
|
||||
int nConnections = m_vec.GetSize();
|
||||
|
||||
for (nConnectionIndex = 0; nConnectionIndex < nConnections; nConnectionIndex++)
|
||||
{
|
||||
pT->Lock();
|
||||
CComPtr<IUnknown> sp = m_vec.GetAt(nConnectionIndex);
|
||||
pT->Unlock();
|
||||
IDispatch* pDispatch = reinterpret_cast<IDispatch*>(sp.p);
|
||||
if (pDispatch != NULL)
|
||||
{
|
||||
VariantClear(&varResult);
|
||||
DISPPARAMS disp = { NULL, NULL, 0, 0 };
|
||||
pDispatch->Invoke(0x2, IID_NULL, LOCALE_USER_DEFAULT, DISPATCH_METHOD, &disp, &varResult, NULL, NULL);
|
||||
}
|
||||
}
|
||||
return varResult.scode;
|
||||
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
template <class T>
|
||||
class CProxyIScriptViewEvents : public IConnectionPointImpl<T, &DIID_IScriptViewEvents, CComDynamicUnkArray>
|
||||
{
|
||||
//Warning this class may be recreated by the wizard.
|
||||
public:
|
||||
VOID Fire_Initialize()
|
||||
{
|
||||
T* pT = static_cast<T*>(this);
|
||||
int nConnectionIndex;
|
||||
int nConnections = m_vec.GetSize();
|
||||
|
||||
for (nConnectionIndex = 0; nConnectionIndex < nConnections; nConnectionIndex++)
|
||||
{
|
||||
pT->Lock();
|
||||
CComPtr<IUnknown> sp = m_vec.GetAt(nConnectionIndex);
|
||||
pT->Unlock();
|
||||
IDispatch* pDispatch = reinterpret_cast<IDispatch*>(sp.p);
|
||||
if (pDispatch != NULL)
|
||||
{
|
||||
DISPPARAMS disp = { NULL, NULL, 0, 0 };
|
||||
pDispatch->Invoke(0x1, IID_NULL, LOCALE_USER_DEFAULT, DISPATCH_METHOD, &disp, NULL, NULL, NULL);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
VOID Fire_Terminate()
|
||||
{
|
||||
T* pT = static_cast<T*>(this);
|
||||
int nConnectionIndex;
|
||||
int nConnections = m_vec.GetSize();
|
||||
|
||||
for (nConnectionIndex = 0; nConnectionIndex < nConnections; nConnectionIndex++)
|
||||
{
|
||||
pT->Lock();
|
||||
CComPtr<IUnknown> sp = m_vec.GetAt(nConnectionIndex);
|
||||
pT->Unlock();
|
||||
IDispatch* pDispatch = reinterpret_cast<IDispatch*>(sp.p);
|
||||
if (pDispatch != NULL)
|
||||
{
|
||||
DISPPARAMS disp = { NULL, NULL, 0, 0 };
|
||||
pDispatch->Invoke(0x2, IID_NULL, LOCALE_USER_DEFAULT, DISPATCH_METHOD, &disp, NULL, NULL, NULL);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
VOID Fire_Activate()
|
||||
{
|
||||
T* pT = static_cast<T*>(this);
|
||||
int nConnectionIndex;
|
||||
int nConnections = m_vec.GetSize();
|
||||
|
||||
for (nConnectionIndex = 0; nConnectionIndex < nConnections; nConnectionIndex++)
|
||||
{
|
||||
pT->Lock();
|
||||
CComPtr<IUnknown> sp = m_vec.GetAt(nConnectionIndex);
|
||||
pT->Unlock();
|
||||
IDispatch* pDispatch = reinterpret_cast<IDispatch*>(sp.p);
|
||||
if (pDispatch != NULL)
|
||||
{
|
||||
DISPPARAMS disp = { NULL, NULL, 0, 0 };
|
||||
pDispatch->Invoke(0x3, IID_NULL, LOCALE_USER_DEFAULT, DISPATCH_METHOD, &disp, NULL, NULL, NULL);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
VOID Fire_Deactivate()
|
||||
{
|
||||
T* pT = static_cast<T*>(this);
|
||||
int nConnectionIndex;
|
||||
int nConnections = m_vec.GetSize();
|
||||
|
||||
for (nConnectionIndex = 0; nConnectionIndex < nConnections; nConnectionIndex++)
|
||||
{
|
||||
pT->Lock();
|
||||
CComPtr<IUnknown> sp = m_vec.GetAt(nConnectionIndex);
|
||||
pT->Unlock();
|
||||
IDispatch* pDispatch = reinterpret_cast<IDispatch*>(sp.p);
|
||||
if (pDispatch != NULL)
|
||||
{
|
||||
DISPPARAMS disp = { NULL, NULL, 0, 0 };
|
||||
pDispatch->Invoke(0x4, IID_NULL, LOCALE_USER_DEFAULT, DISPATCH_METHOD, &disp, NULL, NULL, NULL);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
};
|
||||
#endif
|
||||
11
Native/PlainText/PlainTextps.def
Normal file
11
Native/PlainText/PlainTextps.def
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
|
||||
LIBRARY "PlainTextPS"
|
||||
|
||||
DESCRIPTION 'Proxy/Stub DLL'
|
||||
|
||||
EXPORTS
|
||||
DllGetClassObject @1 PRIVATE
|
||||
DllCanUnloadNow @2 PRIVATE
|
||||
GetProxyDllInfo @3 PRIVATE
|
||||
DllRegisterServer @4 PRIVATE
|
||||
DllUnregisterServer @5 PRIVATE
|
||||
16
Native/PlainText/PlainTextps.mk
Normal file
16
Native/PlainText/PlainTextps.mk
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
|
||||
PlainTextps.dll: dlldata.obj PlainText_p.obj PlainText_i.obj
|
||||
link /dll /out:PlainTextps.dll /def:PlainTextps.def /entry:DllMain dlldata.obj PlainText_p.obj PlainText_i.obj \
|
||||
kernel32.lib rpcndr.lib rpcns4.lib rpcrt4.lib oleaut32.lib uuid.lib \
|
||||
|
||||
.c.obj:
|
||||
cl /c /Ox /DWIN32 /D_WIN32_WINNT=0x0400 /DREGISTER_PROXY_DLL \
|
||||
$<
|
||||
|
||||
clean:
|
||||
@del PlainTextps.dll
|
||||
@del PlainTextps.lib
|
||||
@del PlainTextps.exp
|
||||
@del dlldata.obj
|
||||
@del PlainText_p.obj
|
||||
@del PlainText_i.obj
|
||||
305
Native/PlainText/ScriptPlugin.cpp
Normal file
305
Native/PlainText/ScriptPlugin.cpp
Normal file
|
|
@ -0,0 +1,305 @@
|
|||
// ScriptPlugin.cpp : Implementation of cScriptPlugin
|
||||
#include "stdafx.h"
|
||||
#include "PlainText.h"
|
||||
#include "ScriptPlugin.h"
|
||||
#include "../Inject/Inject.h"
|
||||
#include "ScriptView.h"
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// cScriptPlugin
|
||||
|
||||
void cScriptPlugin::getCLSID( BSTR *pbstrCLSID )
|
||||
{
|
||||
MSXML::IXMLDOMAttributePtr pAttr = m_pPlugin->selectSingleNode( _T( "/plugin/@clsid" ) );
|
||||
|
||||
_ASSERTE( pAttr.GetInterfacePtr() != NULL );
|
||||
|
||||
*pbstrCLSID = OLE2BSTR( pAttr->value.bstrVal );
|
||||
}
|
||||
|
||||
void cScriptPlugin::getLanguage( BSTR *pbstrLanguage )
|
||||
{
|
||||
MSXML::IXMLDOMAttributePtr pAttr = m_pPlugin->selectSingleNode( _T( "/plugin/@language" ) );
|
||||
|
||||
if( pAttr.GetInterfacePtr() == NULL )
|
||||
*pbstrLanguage = T2BSTR( _T( "VBScript" ) );
|
||||
else
|
||||
*pbstrLanguage = OLE2BSTR( pAttr->value.bstrVal );
|
||||
}
|
||||
|
||||
HRESULT cScriptPlugin::LoadScript(BSTR strFilename)
|
||||
{
|
||||
USES_CONVERSION;
|
||||
|
||||
HRESULT hRes = ::CoCreateInstance( __uuidof( MSXML::DOMDocument ), NULL, CLSCTX_INPROC_SERVER,
|
||||
__uuidof( MSXML::IXMLDOMDocument ), reinterpret_cast< void ** >( &m_pPlugin ) );
|
||||
|
||||
if( FAILED( hRes ) )
|
||||
return hRes;
|
||||
|
||||
bool bLoad = !!m_pPlugin->load( strFilename );
|
||||
|
||||
if( !bLoad )
|
||||
{
|
||||
// The document failed to load, get the error info for posterity
|
||||
MSXML::IXMLDOMParseErrorPtr pErr = m_pPlugin->parseError;
|
||||
|
||||
long nCode = pErr->errorCode;
|
||||
long nFilePos = pErr->filepos;
|
||||
long nLine = pErr->line;
|
||||
long nLinePos = pErr->linepos;
|
||||
_bstr_t strReason = pErr->reason;
|
||||
_bstr_t strText = pErr->srcText;
|
||||
|
||||
TCHAR szError[ 1024 ];
|
||||
::_stprintf( szError, _T( "0x%08X (%i, %i): %s" ),
|
||||
nCode, nLine, nLinePos, OLE2T( strReason ) );
|
||||
|
||||
::MessageBox( NULL, szError, _T( "XML Parse Error" ), MB_ICONERROR | MB_OK );
|
||||
|
||||
// Give the user a chance to break and look at this lovely info
|
||||
_ASSERTE( FALSE );
|
||||
|
||||
return E_FAIL;
|
||||
}
|
||||
|
||||
// Looking good
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
STDMETHODIMP cScriptPlugin::CreateInstance(IDecalEnum *pInitData, REFIID iid, LPVOID *pObject)
|
||||
{
|
||||
CComVariant vFile;
|
||||
HRESULT hRes = pInitData->get_Property( _bstr_t( "File" ), &vFile );
|
||||
if( FAILED( hRes ) )
|
||||
return hRes;
|
||||
|
||||
if( vFile.vt != VT_BSTR )
|
||||
return E_FAIL;
|
||||
|
||||
m_strFilename = vFile.bstrVal;
|
||||
return static_cast< IDecalSurrogate * >( this )->QueryInterface( iid, pObject );
|
||||
}
|
||||
|
||||
STDMETHODIMP cScriptPlugin::Initialize( IPluginSite2 *pSite )
|
||||
{
|
||||
USES_CONVERSION;
|
||||
m_pSite = pSite;
|
||||
|
||||
// First, map the map and load the script file
|
||||
CComPtr< IDecal > pDecal;
|
||||
m_pSite->get_Decal( &pDecal );
|
||||
|
||||
CComBSTR strTruePath;
|
||||
HRESULT hRes = pDecal->MapPath( m_strFilename, &strTruePath );
|
||||
if( FAILED( hRes ) )
|
||||
return hRes;
|
||||
|
||||
hRes = LoadScript( strTruePath );
|
||||
if( FAILED( hRes ) )
|
||||
return hRes;
|
||||
|
||||
// Set up the scripting environment, the default scripting language
|
||||
// is VBScript
|
||||
CComBSTR strScript;
|
||||
|
||||
getLanguage( &strScript );
|
||||
hRes = createScriptEngine( strScript );
|
||||
|
||||
_ASSERTE( SUCCEEDED( hRes ) );
|
||||
|
||||
// Load the script text
|
||||
CComPtr< IActiveScriptParse > pParse;
|
||||
m_pScript->QueryInterface( &pParse );
|
||||
|
||||
pParse->InitNew();
|
||||
|
||||
addNamedItem( _bstr_t( _T( "Site" ) ), static_cast< IDispatch * >( this ) );
|
||||
|
||||
MSXML::IXMLDOMElementPtr pScript = m_pPlugin->selectSingleNode( _T( "/plugin/script" ) );
|
||||
|
||||
// Load the main script block
|
||||
if( pScript.GetInterfacePtr() != NULL )
|
||||
{
|
||||
EXCEPINFO ei;
|
||||
HRESULT hRes = pParse->ParseScriptText( pScript->text, NULL, NULL, NULL, 0, 0,
|
||||
SCRIPTITEM_ISVISIBLE, NULL, &ei );
|
||||
|
||||
_ASSERTE( SUCCEEDED( hRes ) );
|
||||
} else {
|
||||
::MessageBox(NULL, "Couldn't load the main script block", "cScriptPlugin::Initialize", MB_OK);
|
||||
}
|
||||
|
||||
// Walk through the intrinsic object
|
||||
MSXML::IXMLDOMNodeListPtr pNetworks = m_pPlugin->selectNodes( _T( "/plugin/decal" ) );
|
||||
for( MSXML::IXMLDOMElementPtr pNetwork = pNetworks->nextNode(); pNetwork.GetInterfacePtr() != NULL; pNetwork = pNetworks->nextNode() )
|
||||
{
|
||||
CComPtr< IDispatch > pObject;
|
||||
HRESULT hRes = pDecal->get_Object( pNetwork->getAttribute( _T( "path" ) ).bstrVal, IID_IDispatch, reinterpret_cast< void ** >( &pObject ) );
|
||||
if( FAILED( hRes ) )
|
||||
{
|
||||
::MessageBox(NULL, "SCRIPT ERROR: Couldn't load decal object", OLE2A(pNetwork->getAttribute(_T("path")).bstrVal), MB_OK);
|
||||
continue;
|
||||
}
|
||||
|
||||
// Add the item
|
||||
addNamedItem( pNetwork->getAttribute( _T( "name" ) ).bstrVal, pObject );
|
||||
}
|
||||
|
||||
// Walk through the instance objects
|
||||
MSXML::IXMLDOMNodeListPtr pObjects = m_pPlugin->selectNodes( _T( "/plugin/object" ) );
|
||||
for( MSXML::IXMLDOMElementPtr pObject = pObjects->nextNode(); pObject.GetInterfacePtr() != NULL; pObject = pObjects->nextNode() )
|
||||
{
|
||||
_variant_t vProgid = pObject->getAttribute( _T( "progid" ) );
|
||||
|
||||
if( vProgid.vt == VT_NULL )
|
||||
{
|
||||
_ASSERT( FALSE );
|
||||
continue;
|
||||
}
|
||||
|
||||
CComPtr< IDispatch > pInstance;
|
||||
CLSID clsid;
|
||||
HRESULT hRes = ::CLSIDFromProgID( vProgid.bstrVal, &clsid );
|
||||
|
||||
if( FAILED( hRes ) )
|
||||
{
|
||||
_ASSERT( FALSE );
|
||||
continue;
|
||||
}
|
||||
|
||||
hRes = ::CoCreateInstance( clsid, NULL, CLSCTX_INPROC_SERVER, IID_IDispatch, reinterpret_cast< void ** >( &pInstance ) );
|
||||
|
||||
if( FAILED( hRes ) )
|
||||
{
|
||||
_ASSERT( FALSE );
|
||||
continue;
|
||||
}
|
||||
|
||||
// Add the item
|
||||
addNamedItem( pObject->getAttribute( _T( "name" ) ).bstrVal, pInstance );
|
||||
}
|
||||
|
||||
// Start up the plugin
|
||||
m_pScript->SetScriptState(SCRIPTSTATE_CONNECTED);
|
||||
Fire_Initialize();
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
STDMETHODIMP cScriptPlugin::Terminate()
|
||||
{
|
||||
// Shut down the plugin
|
||||
Fire_Terminate();
|
||||
|
||||
m_pScript->SetScriptState( SCRIPTSTATE_DISCONNECTED );
|
||||
m_pScript->Close();
|
||||
|
||||
m_pSite.Release();
|
||||
m_pPlugin.Release();
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
STDMETHODIMP cScriptPlugin::CreateObject( BSTR strProgID, LPDISPATCH *pDisp )
|
||||
{
|
||||
if( pDisp == NULL )
|
||||
{
|
||||
_ASSERT( FALSE );
|
||||
return E_POINTER;
|
||||
}
|
||||
|
||||
HRESULT hRes;
|
||||
CLSID clsid;
|
||||
if( strProgID[ 0 ] == OLESTR( '{' ) )
|
||||
hRes = ::CLSIDFromString( strProgID, &clsid );
|
||||
else
|
||||
hRes = ::CLSIDFromProgID( strProgID, &clsid );
|
||||
|
||||
if( FAILED( hRes ) )
|
||||
return hRes;
|
||||
|
||||
return ::CoCreateInstance( clsid, NULL, CLSCTX_INPROC_SERVER, IID_IDispatch, reinterpret_cast< void ** >( pDisp ) );
|
||||
}
|
||||
|
||||
STDMETHODIMP cScriptPlugin::WriteToChatWindow(BSTR szText, long lColor)
|
||||
{
|
||||
getPluginSite()->WriteToChatWindow(szText, lColor);
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
STDMETHODIMP cScriptPlugin::MessageBox(BSTR Title, BSTR Text)
|
||||
{
|
||||
USES_CONVERSION;
|
||||
|
||||
::MessageBox(NULL, OLE2A(Text), OLE2A(Title), MB_OK);
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
IPluginSite * cScriptPlugin::getPluginSite()
|
||||
{
|
||||
CComPtr< IDecal > pDecal;
|
||||
m_pSite->get_Decal ( &pDecal );
|
||||
|
||||
CComPtr< IInjectService > pInject;
|
||||
CComPtr< IPluginSite > pSite;
|
||||
HRESULT hRes = pDecal->get_Object ( _bstr_t ( _T( "services\\DecalPlugins.InjectService" ) ),
|
||||
__uuidof ( IInjectService ), reinterpret_cast< LPVOID * > ( &pInject ) );
|
||||
|
||||
pInject->get_Site(&pSite);
|
||||
return pSite;
|
||||
}
|
||||
|
||||
STDMETHODIMP cScriptPlugin::LoadView(BSTR Text, IView **pView)
|
||||
{
|
||||
getPluginSite()->LoadView(Text, pView);
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
void cScriptPlugin::removeView( CScriptView *pView )
|
||||
{
|
||||
for( cViewList::iterator i = m_views.begin(); i != m_views.end(); ++ i )
|
||||
{
|
||||
if( *i == pView )
|
||||
{
|
||||
m_views.erase( i );
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
// The view was not found in the list
|
||||
_ASSERTE( FALSE );
|
||||
}
|
||||
|
||||
void cScriptPlugin::postRemoveView( CScriptView *pView )
|
||||
{
|
||||
m_destroy.push_back( pView );
|
||||
}
|
||||
|
||||
STDMETHODIMP cScriptPlugin::CreateView(BSTR strTemplateName, LPDISPATCH *ppNewView)
|
||||
{
|
||||
USES_CONVERSION;
|
||||
|
||||
TCHAR szQuery[ 255 ];
|
||||
::_stprintf( szQuery, _T( "/plugin/view[@name='%s']" ), OLE2T( strTemplateName ) );
|
||||
|
||||
MSXML::IXMLDOMElementPtr pView = m_pPlugin->selectSingleNode( szQuery );
|
||||
|
||||
if( pView.GetInterfacePtr() == NULL )
|
||||
return E_INVALIDARG;
|
||||
|
||||
CComObject< CScriptView > *pNewView;
|
||||
CComObject< CScriptView >::CreateInstance( &pNewView );
|
||||
|
||||
CComPtr< IDispatch > pDispPlugin;
|
||||
m_pScript->GetScriptDispatch( NULL, &pDispPlugin );
|
||||
|
||||
CComBSTR strLanguage;
|
||||
getLanguage( &strLanguage );
|
||||
|
||||
pNewView->loadView( this, pView, ppNewView );
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
115
Native/PlainText/ScriptPlugin.h
Normal file
115
Native/PlainText/ScriptPlugin.h
Normal file
|
|
@ -0,0 +1,115 @@
|
|||
// ScriptPlugin.h : Declaration of the cScriptPlugin
|
||||
|
||||
#ifndef __SCRIPTPLUGIN_H_
|
||||
#define __SCRIPTPLUGIN_H_
|
||||
|
||||
#include "resource.h" // main symbols
|
||||
#include "PlainTextCP.h"
|
||||
|
||||
#include <DecalImpl.h>
|
||||
#include "ScriptSiteImpl.h"
|
||||
|
||||
class CScriptView;
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// cScriptPlugin
|
||||
class ATL_NO_VTABLE cScriptPlugin :
|
||||
public CComObjectRootEx<CComMultiThreadModel>,
|
||||
public CComCoClass<cScriptPlugin, &CLSID_ScriptPlugin>,
|
||||
public IActiveScriptSiteImpl,
|
||||
public IPlugin2,
|
||||
public IDecalSurrogate,
|
||||
public IProvideClassInfo2Impl< &CLSID_ScriptPlugin, &DIID_IPluginEvents, &LIBID_PlainText >,
|
||||
public IDispatchImpl< IScriptPluginSite, &IID_IScriptPluginSite, &LIBID_PlainText >,
|
||||
public IDecalFileSurrogateXMLImpl< cScriptPlugin, &CLSID_ScriptPlugin >,
|
||||
public IConnectionPointContainerImpl<cScriptPlugin>,
|
||||
public CProxyIPluginEvents< cScriptPlugin >
|
||||
{
|
||||
public:
|
||||
cScriptPlugin()
|
||||
{
|
||||
}
|
||||
|
||||
static LPCTSTR getConfigGroup()
|
||||
{
|
||||
return _T( "Plugins" );
|
||||
}
|
||||
|
||||
DECLARE_REGISTRY_RESOURCEID(IDR_SCRIPTPLUGIN)
|
||||
DECLARE_PROTECT_FINAL_CONSTRUCT()
|
||||
|
||||
BEGIN_COM_MAP(cScriptPlugin)
|
||||
COM_INTERFACE_ENTRY(IActiveScriptSite)
|
||||
COM_INTERFACE_ENTRY(IPlugin2)
|
||||
COM_INTERFACE_ENTRY(IDecalFileSurrogate)
|
||||
COM_INTERFACE_ENTRY(IDecalSurrogate)
|
||||
COM_INTERFACE_ENTRY(IScriptPluginSite)
|
||||
COM_INTERFACE_ENTRY(IDispatch)
|
||||
COM_INTERFACE_ENTRY(IProvideClassInfo)
|
||||
COM_INTERFACE_ENTRY(IProvideClassInfo2)
|
||||
COM_INTERFACE_ENTRY_IMPL(IConnectionPointContainer)
|
||||
END_COM_MAP()
|
||||
|
||||
BEGIN_CONNECTION_POINT_MAP(cScriptPlugin)
|
||||
CONNECTION_POINT_ENTRY(DIID_IPluginEvents)
|
||||
END_CONNECTION_POINT_MAP()
|
||||
|
||||
CComPtr< IPluginSite2 > m_pSite;
|
||||
MSXML::IXMLDOMDocumentPtr m_pPlugin;
|
||||
|
||||
void getCLSID( BSTR *pbstrCLSID );
|
||||
void getLanguage( BSTR *pbstrLanguage );
|
||||
|
||||
HRESULT LoadScript( BSTR strFilename );
|
||||
|
||||
CComBSTR m_strFilename;
|
||||
|
||||
void postRemoveView( CScriptView *pView );
|
||||
void removeView( CScriptView * );
|
||||
|
||||
typedef std::deque< CScriptView * > cViewList;
|
||||
cViewList m_views,
|
||||
m_destroy;
|
||||
public:
|
||||
STDMETHOD(CreateView)(BSTR strTemplateName, /*[out, retval]*/ LPDISPATCH *ppNewView);
|
||||
STDMETHOD(LoadView)(/*[in]*/ BSTR Text, /*[out]*/ IView **pView);
|
||||
IPluginSite * getPluginSite();
|
||||
STDMETHOD(MessageBox)(BSTR Title, BSTR Text);
|
||||
STDMETHOD(WriteToChatWindow)(BSTR szText, long lColor);
|
||||
// IScriptPluginSite Methods
|
||||
STDMETHOD(CreateObject)(BSTR strProgID, LPDISPATCH *pDisp);
|
||||
|
||||
// IDecalSurrogate Methods
|
||||
STDMETHOD(CreateInstance)(IDecalEnum *pInitData, REFIID iid, LPVOID *pObject);
|
||||
|
||||
// IPlugin Methods
|
||||
STDMETHOD(Initialize)( IPluginSite2 *pSite );
|
||||
STDMETHOD(Terminate)();
|
||||
|
||||
// IDecalFileSurrogate
|
||||
STDMETHOD(get_Extension)( BSTR *pVal )
|
||||
{
|
||||
if( pVal == NULL )
|
||||
{
|
||||
_ASSERT( FALSE );
|
||||
return E_POINTER;
|
||||
}
|
||||
|
||||
*pVal = T2BSTR( _T( "acs" ) );
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
STDMETHOD(get_Description)( BSTR *pVal )
|
||||
{
|
||||
if( pVal == NULL )
|
||||
{
|
||||
_ASSERT( FALSE );
|
||||
return E_POINTER;
|
||||
}
|
||||
|
||||
*pVal = T2BSTR( _T( "Script Plugin" ) );
|
||||
return S_OK;
|
||||
}
|
||||
};
|
||||
|
||||
#endif //__SCRIPTPLUGIN_H_
|
||||
45
Native/PlainText/ScriptPlugin.rgs
Normal file
45
Native/PlainText/ScriptPlugin.rgs
Normal file
|
|
@ -0,0 +1,45 @@
|
|||
HKCR
|
||||
{
|
||||
PlainText.ScriptPlugin.1 = s 'ScriptPlugin Class'
|
||||
{
|
||||
CLSID = s '{F8F77FFC-88E1-4d50-9F51-C30F3F35C4EF}'
|
||||
}
|
||||
PlainText.ScriptPlugin = s 'ScriptPlugin Class'
|
||||
{
|
||||
CLSID = s '{F8F77FFC-88E1-4d50-9F51-C30F3F35C4EF}'
|
||||
CurVer = s 'PlainText.ScriptPlugin.1'
|
||||
}
|
||||
NoRemove CLSID
|
||||
{
|
||||
ForceRemove {F8F77FFC-88E1-4d50-9F51-C30F3F35C4EF} = s 'ScriptPlugin Class'
|
||||
{
|
||||
ProgID = s 'PlainText.ScriptPlugin.1'
|
||||
VersionIndependentProgID = s 'PlainText.ScriptPlugin'
|
||||
ForceRemove 'Programmable'
|
||||
InprocServer32 = s '%MODULE%'
|
||||
{
|
||||
val ThreadingModel = s 'Both'
|
||||
}
|
||||
'TypeLib' = s '{1658A49F-0444-43E5-BA11-ED1AD1C256DB}'
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
HKLM
|
||||
{
|
||||
NoRemove SOFTWARE
|
||||
{
|
||||
NoRemove Decal
|
||||
{
|
||||
NoRemove Surrogates
|
||||
{
|
||||
ForceRemove {F8F77FFC-88E1-4d50-9F51-C30F3F35C4EF} = s 'VBScript Plugin Surrogate'
|
||||
{
|
||||
val Enabled = d '1'
|
||||
val Extension = s 'acs'
|
||||
val Description = s 'Script Plugin'
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
92
Native/PlainText/ScriptSiteImpl.cpp
Normal file
92
Native/PlainText/ScriptSiteImpl.cpp
Normal file
|
|
@ -0,0 +1,92 @@
|
|||
// ScriptSiteImpl.cpp
|
||||
// Implementation of IActiveScriptSiteImpl
|
||||
|
||||
#include "stdafx.h"
|
||||
#include "ScriptSiteImpl.h"
|
||||
|
||||
HRESULT IActiveScriptSiteImpl::createScriptEngine( LPCOLESTR strLanguage )
|
||||
{
|
||||
CLSID clsidScript;
|
||||
//CComPtr< IActiveScript > pScript;
|
||||
HRESULT hRes = ::CLSIDFromProgID( strLanguage, &clsidScript );
|
||||
|
||||
_ASSERTE( SUCCEEDED( hRes ) );
|
||||
|
||||
hRes = ::CoCreateInstance( clsidScript, NULL, CLSCTX_INPROC_SERVER, IID_IActiveScript, reinterpret_cast< void ** >( &m_pScript ) );
|
||||
_ASSERTE( SUCCEEDED( hRes ) );
|
||||
|
||||
// Configure the script engine
|
||||
//pScript->Clone(&m_pScript);
|
||||
m_pScript->SetScriptSite( this );
|
||||
|
||||
return hRes;
|
||||
}
|
||||
|
||||
void IActiveScriptSiteImpl::addNamedItem( BSTR szName, IUnknown *pObject, DWORD dwFlags )
|
||||
{
|
||||
USES_CONVERSION;
|
||||
HRESULT hRes = m_pScript->AddNamedItem( szName, dwFlags );
|
||||
|
||||
cObject o( szName, pObject );
|
||||
|
||||
m_objects.push_back( o );
|
||||
}
|
||||
|
||||
STDMETHODIMP IActiveScriptSiteImpl::GetItemInfo(LPCOLESTR pstrName, DWORD dwReturnMask, IUnknown **ppunkItem, ITypeInfo **ppTypeInfo)
|
||||
{
|
||||
// First look for the item
|
||||
for( cObjectList::iterator i = m_objects.begin(); i != m_objects.end(); ++ i )
|
||||
{
|
||||
if( ::wcscmp( i->m_strName, pstrName ) == 0 )
|
||||
{
|
||||
if( dwReturnMask & SCRIPTINFO_IUNKNOWN )
|
||||
{
|
||||
*ppunkItem = i->m_pObject;
|
||||
( *ppunkItem )->AddRef();
|
||||
}
|
||||
|
||||
if( dwReturnMask & SCRIPTINFO_ITYPEINFO )
|
||||
{
|
||||
CComPtr< IProvideClassInfo > pPCI;
|
||||
HRESULT hRes = i->m_pObject->QueryInterface( &pPCI );
|
||||
if( SUCCEEDED( hRes ) )
|
||||
{
|
||||
HRESULT hRes = pPCI->GetClassInfo( ppTypeInfo );
|
||||
_ASSERTE( SUCCEEDED( hRes ) );
|
||||
}
|
||||
else
|
||||
*ppTypeInfo = NULL;
|
||||
}
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
}
|
||||
|
||||
// The item was not found
|
||||
return TYPE_E_ELEMENTNOTFOUND;
|
||||
}
|
||||
|
||||
STDMETHODIMP IActiveScriptSiteImpl::OnScriptError(IActiveScriptError *pase)
|
||||
{
|
||||
USES_CONVERSION;
|
||||
|
||||
EXCEPINFO ei;
|
||||
DWORD dwCookie;
|
||||
ULONG uLine;
|
||||
LONG nChar;
|
||||
CComBSTR strLine;
|
||||
|
||||
pase->GetExceptionInfo( &ei );
|
||||
pase->GetSourcePosition( &dwCookie, &uLine, &nChar );
|
||||
pase->GetSourceLineText( &strLine );
|
||||
|
||||
TCHAR szError[ 1024 ];
|
||||
::_stprintf( szError, _T( "0x%08X (%i, %i): %s" ),
|
||||
ei.wCode, uLine, nChar, OLE2T( ei.bstrDescription ) );
|
||||
|
||||
::MessageBox( NULL, szError, OLE2T( ei.bstrSource ), MB_ICONERROR | MB_OK );
|
||||
|
||||
_ASSERTE( FALSE );
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
82
Native/PlainText/ScriptSiteImpl.h
Normal file
82
Native/PlainText/ScriptSiteImpl.h
Normal file
|
|
@ -0,0 +1,82 @@
|
|||
// ScriptSiteImpl.h
|
||||
// Declaration of class IActiveScriptSiteImpl
|
||||
|
||||
#ifndef __SCRIPTSITEIMPL_H
|
||||
#define __SCRIPTSITEIMPL_H
|
||||
|
||||
class IActiveScriptSiteImpl
|
||||
: public IActiveScriptSite
|
||||
{
|
||||
class cObject
|
||||
{
|
||||
public:
|
||||
cObject( BSTR szName, IUnknown *pObject )
|
||||
: m_strName( szName ),
|
||||
m_pObject( pObject )
|
||||
{
|
||||
}
|
||||
|
||||
_bstr_t m_strName;
|
||||
CComPtr< IUnknown > m_pObject;
|
||||
};
|
||||
|
||||
public:
|
||||
|
||||
typedef std::deque< cObject > cObjectList;
|
||||
cObjectList m_objects;
|
||||
|
||||
CComPtr< IActiveScript > m_pScript;
|
||||
|
||||
IActiveScriptSiteImpl()
|
||||
: m_pScript( NULL )
|
||||
{
|
||||
}
|
||||
|
||||
HRESULT createScriptEngine( LPCOLESTR strLanguage );
|
||||
|
||||
// Helper functions
|
||||
void addNamedItem( BSTR szName, IUnknown *pObject, DWORD dwFlags = SCRIPTITEM_ISSOURCE | SCRIPTITEM_ISVISIBLE );
|
||||
|
||||
// IActiveScriptSite Methods
|
||||
STDMETHOD(GetLCID)(LCID *plcid)
|
||||
{
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
STDMETHOD(GetItemInfo)(LPCOLESTR pstrName, DWORD dwReturnMask, IUnknown **ppunkItem, ITypeInfo **ppTypeInfo);
|
||||
STDMETHOD(GetDocVersionString)(BSTR *pbstrVersionString)
|
||||
{
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
STDMETHOD(OnScriptTerminate)(const VARIANT *pvarResult, const EXCEPINFO *pexcepinfo)
|
||||
{
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
STDMETHOD(OnStateChange)(SCRIPTSTATE ssScriptState)
|
||||
{
|
||||
if( ssScriptState == SCRIPTSTATE_CLOSED )
|
||||
{
|
||||
m_objects.clear();
|
||||
m_pScript.Release();
|
||||
}
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
STDMETHOD(OnScriptError)(IActiveScriptError *pase);
|
||||
|
||||
STDMETHOD(OnEnterScript)()
|
||||
{
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
STDMETHOD(OnLeaveScript)()
|
||||
{
|
||||
return S_OK;
|
||||
}
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
93
Native/PlainText/ScriptView.cpp
Normal file
93
Native/PlainText/ScriptView.cpp
Normal file
|
|
@ -0,0 +1,93 @@
|
|||
// ScriptView.cpp : Implementation of CScriptView
|
||||
#include "stdafx.h"
|
||||
#include "PlainText.h"
|
||||
#include "ScriptView.h"
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// CScriptView
|
||||
|
||||
|
||||
void CScriptView::loadView( cScriptPlugin *pPlugin, MSXML::IXMLDOMElementPtr &pView, LPDISPATCH *ppNewView )
|
||||
{
|
||||
USES_CONVERSION;
|
||||
|
||||
// Get IPluginSite
|
||||
CComPtr< IDecal > pDecal;
|
||||
CComPtr< IInjectService > pInject;
|
||||
pPlugin->m_pSite->get_Decal ( &pDecal );
|
||||
pDecal->get_Object ( _bstr_t ( _T( "services\\DecalPlugins.InjectService" ) ),
|
||||
__uuidof ( IInjectService ), reinterpret_cast< LPVOID * > ( &pInject ) );
|
||||
|
||||
pInject->get_Site(&m_pOldSite);
|
||||
|
||||
m_pPlugin = pPlugin;
|
||||
|
||||
// Initialize a new script engine
|
||||
CComBSTR strLanguage;
|
||||
pPlugin->getLanguage( &strLanguage );
|
||||
|
||||
HRESULT hRes = createScriptEngine( strLanguage );
|
||||
|
||||
CComPtr< IActiveScriptParse > pParse;
|
||||
m_pScript->QueryInterface( &pParse );
|
||||
|
||||
pParse->InitNew();
|
||||
|
||||
m_pOldSite->LoadViewObject( pView, &m_pView );
|
||||
|
||||
IViewEventsImpl< VIEW_ID, CScriptView >::DispEventAdvise( m_pView );
|
||||
|
||||
// Add in the plugin
|
||||
CComPtr< IDispatch > pDispPlugin;
|
||||
pPlugin->m_pScript->GetScriptDispatch( NULL, &pDispPlugin );
|
||||
addNamedItem( T2OLE( _T( "Plugin" ) ), pDispPlugin );
|
||||
|
||||
// Add in the site
|
||||
addNamedItem( T2OLE( _T( "Site" ) ), static_cast< IDispatch * >( pPlugin ) );
|
||||
|
||||
// Add in the view as a base object
|
||||
addNamedItem( T2OLE( _T( "View" ) ), static_cast< IDispatch * >( m_pView ) );
|
||||
|
||||
MSXML::IXMLDOMElementPtr pScript = pView->selectSingleNode( _T( "script" ) );
|
||||
|
||||
if( pScript.GetInterfacePtr() != NULL )
|
||||
{
|
||||
EXCEPINFO ei;
|
||||
HRESULT hRes = pParse->ParseScriptText( pScript->text, NULL, NULL, NULL, 0, 0,
|
||||
SCRIPTTEXT_ISVISIBLE, NULL, &ei );
|
||||
|
||||
_ASSERTE( SUCCEEDED( hRes ) );
|
||||
}
|
||||
|
||||
MSXML::IXMLDOMNodeListPtr pControls = pView->selectNodes( _T( ".//control[@name]" ) );
|
||||
for( MSXML::IXMLDOMElementPtr pControl = pControls->nextNode(); pControl.GetInterfacePtr() != NULL; pControl = pControls->nextNode() )
|
||||
{
|
||||
CComPtr< IControl > pCtl;
|
||||
_bstr_t strName = pControl->getAttribute( _T( "name" ) ).bstrVal;
|
||||
m_pView->get_Control( strName, &pCtl );
|
||||
addNamedItem( strName, pCtl );
|
||||
}
|
||||
|
||||
// Add ourself into the view list
|
||||
m_pPlugin->m_views.push_back( this );
|
||||
|
||||
m_pScript->SetScriptState( SCRIPTSTATE_CONNECTED );
|
||||
m_pScript->GetScriptDispatch( NULL, ppNewView );
|
||||
|
||||
_ASSERTE( *ppNewView != NULL );
|
||||
|
||||
Fire_Initialize();
|
||||
}
|
||||
|
||||
void CScriptView::destroy()
|
||||
{
|
||||
Fire_Terminate();
|
||||
IViewEventsImpl< VIEW_ID, CScriptView >::DispEventUnadvise( m_pView );
|
||||
|
||||
m_pScript->SetScriptState( SCRIPTSTATE_DISCONNECTED );
|
||||
m_pScript->Close();
|
||||
|
||||
// Remove ourself from the list, the next line might destroy this object
|
||||
m_pView.Release();
|
||||
m_pPlugin->removeView( this );
|
||||
}
|
||||
83
Native/PlainText/ScriptView.h
Normal file
83
Native/PlainText/ScriptView.h
Normal file
|
|
@ -0,0 +1,83 @@
|
|||
// ScriptView.h : Declaration of the CScriptView
|
||||
|
||||
//
|
||||
// DEVELOPER COMMENTS (elphkotm)
|
||||
// This is an import of the February Decal PlainText class, called
|
||||
// cScriptView, I intentionally use an upper case C bye the way.
|
||||
//
|
||||
|
||||
#ifndef __SCRIPTVIEW_H_
|
||||
#define __SCRIPTVIEW_H_
|
||||
|
||||
#include "resource.h" // main symbols
|
||||
#include "ScriptPlugin.h"
|
||||
#include <DecalImpl.h>
|
||||
#include "ScriptSiteImpl.h"
|
||||
#include "../Inject/SinkImpl.h"
|
||||
#include "PlainTextCP.h"
|
||||
|
||||
#define VIEW_ID 1
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// CScriptView
|
||||
class ATL_NO_VTABLE CScriptView :
|
||||
public CComObjectRootEx<CComSingleThreadModel>,
|
||||
public CComCoClass<CScriptView, &CLSID_ScriptView>,
|
||||
public IActiveScriptSiteImpl,
|
||||
public IProvideClassInfo2Impl< &CLSID_ScriptView, &IID_IScriptView, &LIBID_PlainText >,
|
||||
public IViewEventsImpl<VIEW_ID, CScriptView>,
|
||||
public IDispatchImpl<IScriptView, &IID_IScriptView, &LIBID_PlainText>,
|
||||
public IConnectionPointContainerImpl<CScriptView>,
|
||||
public CProxyIScriptViewEvents< CScriptView >
|
||||
{
|
||||
public:
|
||||
CScriptView()
|
||||
{
|
||||
}
|
||||
|
||||
DECLARE_REGISTRY_RESOURCEID(IDR_SCRIPTVIEW)
|
||||
|
||||
DECLARE_PROTECT_FINAL_CONSTRUCT()
|
||||
|
||||
BEGIN_COM_MAP(CScriptView)
|
||||
COM_INTERFACE_ENTRY(IActiveScriptSite)
|
||||
COM_INTERFACE_ENTRY(IScriptView)
|
||||
COM_INTERFACE_ENTRY(IDispatch)
|
||||
COM_INTERFACE_ENTRY(IProvideClassInfo)
|
||||
COM_INTERFACE_ENTRY(IProvideClassInfo2)
|
||||
COM_INTERFACE_ENTRY_IMPL(IConnectionPointContainer)
|
||||
END_COM_MAP()
|
||||
|
||||
BEGIN_CONNECTION_POINT_MAP(CScriptView)
|
||||
CONNECTION_POINT_ENTRY(DIID_IScriptViewEvents)
|
||||
END_CONNECTION_POINT_MAP()
|
||||
|
||||
BEGIN_SINK_MAP(CScriptView)
|
||||
SINK_ENTRY_EX( VIEW_ID, DIID_IViewEvents, DISPID_ACTIVATE, onViewActivate )
|
||||
SINK_ENTRY_EX( VIEW_ID, DIID_IViewEvents, DISPID_DEACTIVATE, onViewDeactivate )
|
||||
END_SINK_MAP()
|
||||
|
||||
// IScriptView
|
||||
public:
|
||||
void loadView( cScriptPlugin *pPlugin, MSXML::IXMLDOMElementPtr &pView, LPDISPATCH *ppNewView );
|
||||
void destroy();
|
||||
|
||||
CComPtr< IView > m_pView;
|
||||
CComPtr< IPluginSite > m_pOldSite;
|
||||
|
||||
cScriptPlugin *m_pPlugin;
|
||||
_bstr_t m_strTemplate;
|
||||
|
||||
// Method Calls
|
||||
void __stdcall onViewActivate()
|
||||
{
|
||||
Fire_Activate();
|
||||
}
|
||||
|
||||
void __stdcall onViewDeactivate()
|
||||
{
|
||||
Fire_Deactivate();
|
||||
}
|
||||
};
|
||||
|
||||
#endif //__SCRIPTVIEW_H_
|
||||
26
Native/PlainText/ScriptView.rgs
Normal file
26
Native/PlainText/ScriptView.rgs
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
HKCR
|
||||
{
|
||||
PlainText.ScriptView.1 = s 'ScriptView Class'
|
||||
{
|
||||
CLSID = s '{B537CBEC-98C1-480A-910D-4C99E5E96273}'
|
||||
}
|
||||
PlainText.ScriptView = s 'ScriptView Class'
|
||||
{
|
||||
CLSID = s '{B537CBEC-98C1-480A-910D-4C99E5E96273}'
|
||||
CurVer = s 'PlainText.ScriptView.1'
|
||||
}
|
||||
NoRemove CLSID
|
||||
{
|
||||
ForceRemove {B537CBEC-98C1-480A-910D-4C99E5E96273} = s 'ScriptView Class'
|
||||
{
|
||||
ProgID = s 'PlainText.ScriptView.1'
|
||||
VersionIndependentProgID = s 'PlainText.ScriptView'
|
||||
ForceRemove 'Programmable'
|
||||
InprocServer32 = s '%MODULE%'
|
||||
{
|
||||
val ThreadingModel = s 'Apartment'
|
||||
}
|
||||
'TypeLib' = s '{1658A49F-0444-43E5-BA11-ED1AD1C256DB}'
|
||||
}
|
||||
}
|
||||
}
|
||||
11
Native/PlainText/StdAfx.cpp
Normal file
11
Native/PlainText/StdAfx.cpp
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
// stdafx.cpp : source file that includes just the standard includes
|
||||
// stdafx.pch will be the pre-compiled header
|
||||
// stdafx.obj will contain the pre-compiled type information
|
||||
|
||||
#include "stdafx.h"
|
||||
|
||||
#include <atlimpl.cpp>
|
||||
|
||||
#include "..\Inject\SinkImpl.cpp"
|
||||
#include "..\Inject\Inject_i.c"
|
||||
#include "..\DecalControls\DecalControls_i.c"
|
||||
36
Native/PlainText/StdAfx.h
Normal file
36
Native/PlainText/StdAfx.h
Normal file
|
|
@ -0,0 +1,36 @@
|
|||
// stdafx.h : include file for standard system include files,
|
||||
// or project specific include files that are used frequently,
|
||||
// but are changed infrequently
|
||||
|
||||
#if !defined(AFX_STDAFX_H__211984B4_5E1D_4D2A_B7AD_0DC631864826__INCLUDED_)
|
||||
#define AFX_STDAFX_H__211984B4_5E1D_4D2A_B7AD_0DC631864826__INCLUDED_
|
||||
|
||||
#if _MSC_VER > 1000
|
||||
#pragma once
|
||||
#endif // _MSC_VER > 1000
|
||||
|
||||
#define STRICT
|
||||
#define _WIN32_WINDOWS 0x0410
|
||||
#define _ATL_APARTMENT_THREADED
|
||||
|
||||
#pragma warning(disable:4530)
|
||||
|
||||
//C Library includes
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include <atlbase.h>
|
||||
//You may derive a class from CComModule and use it if you want to override
|
||||
//something, but do not change the name of _Module
|
||||
extern CComModule _Module;
|
||||
#include <atlcom.h>
|
||||
|
||||
#import <msxml.dll>
|
||||
#include <deque>
|
||||
#include <ActivScp.h>
|
||||
#include <Decal.h>
|
||||
|
||||
//{{AFX_INSERT_LOCATION}}
|
||||
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
|
||||
|
||||
#endif // !defined(AFX_STDAFX_H__211984B4_5E1D_4D2A_B7AD_0DC631864826__INCLUDED)
|
||||
20
Native/PlainText/resource.h
Normal file
20
Native/PlainText/resource.h
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
//{{NO_DEPENDENCIES}}
|
||||
// Microsoft Developer Studio generated include file.
|
||||
// Used by PlainText.rc
|
||||
//
|
||||
#define IDS_PROJNAME 100
|
||||
#define IDR_SCRIPTPLUGIN 101
|
||||
#define IDR_PLUGINFACTORY 102
|
||||
#define IDR_SCRIPTVIEW 103
|
||||
#define IDR_DECALSCRIPT 104
|
||||
|
||||
// Next default values for new objects
|
||||
//
|
||||
#ifdef APSTUDIO_INVOKED
|
||||
#ifndef APSTUDIO_READONLY_SYMBOLS
|
||||
#define _APS_NEXT_RESOURCE_VALUE 201
|
||||
#define _APS_NEXT_COMMAND_VALUE 32768
|
||||
#define _APS_NEXT_CONTROL_VALUE 201
|
||||
#define _APS_NEXT_SYMED_VALUE 105
|
||||
#endif
|
||||
#endif
|
||||
Loading…
Add table
Add a link
Reference in a new issue