Move activescript sapi to PECL

This commit is contained in:
Wez Furlong 2004-07-28 12:35:52 +00:00
parent 9a19f065af
commit 3d9eeb4538
13 changed files with 0 additions and 3582 deletions

View File

@ -1,2 +0,0 @@
ActiveScript
Wez Furlong

View File

@ -1,5 +0,0 @@
this module is experimental,
its functions may change their names
or move to extension all together
so do not rely to much on them
you have been warned!

View File

@ -1,59 +0,0 @@
This is the ActiveScript SAPI for PHP.
======================================
Once registered on your system (using regsvr32), you will be able to use
PHP script in any ActiveScript compliant host. The list includes:
o. Windows Script Host
o. ASP and ASP.NET
o. Windows Script Components / Behaviours
o. MS Scriptlet control
Probably the most useful of these will be using it with the scriptlet
control, or in your own activescript host, so that you can very easily
embed PHP into your win32 application.
Installation.
=============
Build and install it somewhere; then register the engine like this:
regsvr32 php5activescript.dll
Configuration.
==============
PHPScript will not use the default php.ini file.
Instead, it will look only in the same directory as the .exe that caused it to
load.
You should create php-activescript.ini and place it in that folder, if you wish
to load extensions etc.
Usage.
======
o. Windows Script Host
Create a .wsf file like this:
<job id="test">
<script language="PHPScript">
$WScript->Echo("Hello");
</script>
</job>
o. ASP and ASP.NET
<%@language=PHPScript %>
<% $Response->Write("Hello"); %>
o. Windows Script Components / Behaviours
Use language="PHPScript" on your <script> tags
o. MS Scriptlet control
Set the language property to "PHPScript"

View File

@ -1,373 +0,0 @@
/*
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2004 The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.0 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
| available through the world-wide-web at the following url: |
| http://www.php.net/license/3_0.txt. |
| If you did not receive a copy of the PHP license and are unable to |
| obtain it through the world-wide-web, please send a note to |
| license@php.net so we can mail you a copy immediately. |
+----------------------------------------------------------------------+
| Authors: Wez Furlong <wez@thebrainroom.com> |
+----------------------------------------------------------------------+
*/
/* $Id$ */
/* IClassFactory Implementation, and DllXXX function implementation */
#define DEBUG_CLASS_FACTORY 0
#define WIN32_LEAN_AND_MEAN
#include <winsock2.h>
#include <windows.h>
#include <objbase.h>
#define INITGUID
#include <initguid.h>
extern "C" {
HINSTANCE module_handle;
}
#include <comcat.h>
#include "TSRM.h"
#include "php5as_classfactory.h"
#include "php5as_scriptengine.h"
volatile LONG TPHPClassFactory::factory_count = 0;
volatile LONG TPHPClassFactory::object_count = 0;
/* {{{ Class Factory Implementation */
TPHPClassFactory::TPHPClassFactory()
{
m_refcount = 1;
InterlockedIncrement(const_cast<long*> (&factory_count));
}
TPHPClassFactory::~TPHPClassFactory()
{
InterlockedDecrement(const_cast<long*> (&factory_count));
}
void TPHPClassFactory::AddToObjectCount(void)
{
InterlockedIncrement(const_cast<long*> (&object_count));
}
void TPHPClassFactory::RemoveFromObjectCount(void)
{
InterlockedDecrement(const_cast<long*> (&object_count));
}
STDMETHODIMP_(DWORD) TPHPClassFactory::AddRef(void)
{
return InterlockedIncrement(const_cast<long*> (&m_refcount));
}
STDMETHODIMP_(DWORD) TPHPClassFactory::Release(void)
{
DWORD ret = InterlockedDecrement(const_cast<long*> (&m_refcount));
if (ret == 0)
delete this;
return ret;
}
STDMETHODIMP TPHPClassFactory::QueryInterface(REFIID iid, void **ppvObject)
{
*ppvObject = NULL;
if (IsEqualGUID(IID_IClassFactory, iid)) {
*ppvObject = (IClassFactory*)this;
} else if (IsEqualGUID(IID_IUnknown, iid)) {
*ppvObject = this;
}
if (*ppvObject) {
AddRef();
return S_OK;
}
return E_NOINTERFACE;
}
STDMETHODIMP TPHPClassFactory::LockServer(BOOL fLock)
{
return E_NOTIMPL;
}
STDMETHODIMP TPHPClassFactory::CreateInstance(IUnknown *pUnkOuter, REFIID iid, void **ppvObject)
{
IUnknown *punk = create_scripting_engine(NULL);
HRESULT ret;
if (punk) {
ret = punk->QueryInterface(iid, ppvObject);
punk->Release();
} else {
ret = E_UNEXPECTED;
}
return ret;
}
int TPHPClassFactory::CanUnload(void)
{
return (object_count + factory_count) == 0 ? 1 : 0;
}
/* }}} */
/* {{{ Registration structures */
struct reg_entry {
HKEY root_key;
char *sub_key;
char *value_name;
char *data;
};
struct reg_class {
/* REFIID here causes compilation errors */
const GUID *class_id;
char *class_name;
char *threading;
const struct reg_entry *reg;
const GUID **cats;
};
#define MAX_REG_SUBST 8
struct reg_subst {
int count;
char *names[MAX_REG_SUBST];
char *values[MAX_REG_SUBST];
};
/* }}} */
/* {{{ Registration information */
/* This registers the sapi as a scripting engine that can be instantiated using it's progid */
static const struct reg_entry engine_entries[] = {
{ HKEY_CLASSES_ROOT, "CLSID\\[CLSID]", NULL, "[CLASSNAME]" },
{ HKEY_CLASSES_ROOT, "CLSID\\[CLSID]\\InprocServer32", NULL, "[MODULENAME]" },
{ HKEY_CLASSES_ROOT, "CLSID\\[CLSID]\\InprocServer32", "ThreadingModel", "[THREADING]" },
{ HKEY_CLASSES_ROOT, "CLSID\\[CLSID]\\OLEScript", NULL, NULL },
{ HKEY_CLASSES_ROOT, "CLSID\\[CLSID]\\ProgID", NULL, "PHPScript" },
{ HKEY_CLASSES_ROOT, "PHPScript", NULL, "PHPScript" },
{ HKEY_CLASSES_ROOT, "PHPScript\\CLSID", NULL, "[CLSID]"},
{ HKEY_CLASSES_ROOT, "PHPScript\\OLEScript", NULL, NULL},
{ 0, NULL, NULL, NULL }
};
static const GUID *script_engine_categories[] = {
&CATID_ActiveScript,
&CATID_ActiveScriptParse,
NULL
};
static const struct reg_class classes_to_register[] = {
{ &CLSID_PHPActiveScriptEngine, "PHP Active Script Engine",
#if ACTIVEPHP_THREADING_MODE == COINIT_MULTITHREADED
"Both",
#else
"Apartment",
#endif
engine_entries, script_engine_categories },
{ NULL, NULL, NULL, 0, NULL }
};
/* }}} */
/* {{{ Registration code */
static void substitute(struct reg_subst *subst, char *srcstring, char *deststring)
{
int i;
char *srcpos = srcstring;
char *destpos = deststring;
while(1) {
char *repstart = strchr(srcpos, '[');
if (repstart == NULL) {
strcpy(destpos, srcpos);
break;
}
/* copy everything up until that character to the dest */
strncpy(destpos, srcpos, repstart - srcpos);
destpos += repstart - srcpos;
*destpos = 0;
/* search for replacement strings in the table */
for (i = 0; i < subst->count; i++) {
int len = strlen(subst->names[i]);
if (strncmp(subst->names[i], repstart + 1, len) == 0) {
/* append the replacement value to the buffer */
strcpy(destpos, subst->values[i]);
destpos += strlen(subst->values[i]);
srcpos = repstart + len + 2;
break;
}
}
}
#if DEBUG_CLASS_FACTORY
MessageBox(0, deststring, srcstring, MB_ICONHAND);
#endif
}
static int reg_string(BOOL do_reg, struct reg_subst *subst, const struct reg_entry *entry)
{
char subbuf[MAX_PATH], valuebuf[MAX_PATH], databuf[MAX_PATH];
char *sub = NULL, *value = NULL, *data = NULL;
LRESULT res;
HKEY hkey;
DWORD disp;
if (entry->sub_key) {
substitute(subst, entry->sub_key, subbuf);
sub = subbuf;
}
if (entry->value_name) {
substitute(subst, entry->value_name, valuebuf);
value = valuebuf;
}
if (entry->data) {
substitute(subst, entry->data, databuf);
data = databuf;
}
if (do_reg) {
res = RegCreateKeyEx(entry->root_key, sub, 0, NULL, REG_OPTION_NON_VOLATILE,
KEY_WRITE, NULL, &hkey, &disp);
if (res == NOERROR) {
if (data)
res = RegSetValueEx(hkey, value, 0, REG_SZ, (LPBYTE)data, strlen(data) + 1);
RegCloseKey(hkey);
}
} else {
res = RegDeleteKey(entry->root_key, sub);
}
return res == NOERROR ? 1 : 0;
}
static int perform_registration(BOOL do_reg)
{
char module_name[MAX_PATH];
char classid[40];
int ret = 1;
int i, j;
struct reg_subst subst = {0};
LPOLESTR classidw;
ICatRegister *catreg = NULL;
CATID cats[8];
int ncats;
CoInitialize(NULL);
CoCreateInstance(CLSID_StdComponentCategoriesMgr, NULL, CLSCTX_INPROC_SERVER, IID_ICatRegister, (LPVOID*)&catreg);
GetModuleFileName(module_handle, module_name, sizeof(module_name));
subst.names[0] = "CLSID";
subst.values[0] = classid;
subst.names[1] = "MODULENAME";
subst.values[1] = module_name;
subst.names[2] = "CLASSNAME";
subst.names[3] = "THREADING";
subst.count = 4;
for (i = 0; classes_to_register[i].class_id; i++) {
StringFromCLSID(*classes_to_register[i].class_id, &classidw);
WideCharToMultiByte(CP_ACP, 0, classidw, -1, classid, sizeof(classid), NULL, NULL);
classid[39] = 0;
CoTaskMemFree(classidw);
subst.values[2] = classes_to_register[i].class_name;
subst.values[3] = classes_to_register[i].threading;
if (catreg && classes_to_register[i].cats) {
ncats = 0;
while(classes_to_register[i].cats[ncats]) {
CopyMemory(&cats[ncats], classes_to_register[i].cats[ncats], sizeof(CATID));
ncats++;
}
}
if (do_reg) {
for (j = 0; classes_to_register[i].reg[j].root_key; j++) {
if (!reg_string(do_reg, &subst, &classes_to_register[i].reg[j])) {
ret = 0;
break;
}
}
if (catreg && ncats) {
catreg->RegisterClassImplCategories(*classes_to_register[i].class_id, ncats, cats);
}
} else {
if (catreg && ncats) {
catreg->UnRegisterClassImplCategories(*classes_to_register[i].class_id, ncats, cats);
}
/* do it in reverse order, so count the number of entries first */
for (j = 0; classes_to_register[i].reg[j].root_key; j++)
;
while(j-- > 0) {
if (!reg_string(do_reg, &subst, &classes_to_register[i].reg[j])) {
ret = 0;
break;
}
}
}
}
if (catreg)
catreg->Release();
CoUninitialize();
return ret;
}
/* }}} */
/* {{{ Standard COM server DllXXX entry points */
STDAPI DllCanUnloadNow(void)
{
if (TPHPClassFactory::CanUnload())
return S_OK;
return S_FALSE;
}
STDAPI DllGetClassObject(REFCLSID rclsid, REFIID riid, LPVOID* ppv)
{
HRESULT ret = E_FAIL;
if (IsEqualCLSID(CLSID_PHPActiveScriptEngine, rclsid)) {
TPHPClassFactory *factory = new TPHPClassFactory();
if (factory) {
ret = factory->QueryInterface(riid, ppv);
factory->Release();
}
}
return ret;
}
STDAPI DllRegisterServer(void)
{
return perform_registration(TRUE) ? S_OK : S_FALSE;
}
STDAPI DllUnregisterServer(void)
{
return perform_registration(FALSE) ? S_OK : S_FALSE;
}
/* }}} */

View File

@ -1,13 +0,0 @@
// vim:ft=javascript
// $Id$
ARG_ENABLE('activescript', 'Build ActiveScript version of PHP', 'no');
if (PHP_ACTIVESCRIPT == "yes") {
if (PHP_ZTS == "no") {
ERROR("ActiveScript module requires an --enable-zts build of PHP");
}
SAPI('activescript', 'classfactory.cpp php5activescript.c scriptengine.cpp marshal.cpp', 'php' + PHP_VERSION + 'activescript.dll', '/D PHP5ISAPI_EXPORTS /D ACTIVEPHP_OBJECT_SAFETY=1');
ADD_FLAG('LDFLAGS_ACTIVESCRIPT', 'oleaut32.lib ole32.lib user32.lib advapi32.lib /DEF:' + configure_module_dirname + '\\php5activescript.def');
}

View File

@ -1,428 +0,0 @@
/*
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
| Copyright (c) 2004 The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.0 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
| available through the world-wide-web at the following url: |
| http://www.php.net/license/3_0.txt. |
| If you did not receive a copy of the PHP license and are unable to |
| obtain it through the world-wide-web, please send a note to |
| license@php.net so we can mail you a copy immediately. |
+----------------------------------------------------------------------+
| Authors: Wez Furlong <wez@thebrainroom.com> |
+----------------------------------------------------------------------+
*/
/* $Id$ */
/* Fun with threads */
#define _WIN32_DCOM
#define ZEND_INCLUDE_FULL_WINDOWS_HEADERS
#include <winsock2.h>
#include "php5as_scriptengine.h"
#include "php5as_classfactory.h"
#include <objbase.h>
#undef php_win_err
extern "C" char *php_win_err(HRESULT ret);
#define APHPM_IN 1
#define APHPM_OUT 2
#define APHPT_TERM 0
#define APHPT_UNK 1 /* IUnknown * */
#define APHPT_DISP 2 /* IDispatch * */
#define APHPT_VAR 3 /* PVARIANT */
static inline void trace(char *fmt, ...)
{
va_list ap;
char buf[4096];
sprintf(buf, "T=%08x [MARSHAL] ", tsrm_thread_id());
OutputDebugString(buf);
va_start(ap, fmt);
vsnprintf(buf, sizeof(buf), fmt, ap);
OutputDebugString(buf);
va_end(ap);
}
struct marshal_arg {
int type;
int argno;
int direction;
};
static int parse_script_text_mdef[] = {
APHPT_UNK, 2, APHPM_IN,
APHPT_VAR, 7, APHPM_OUT,
APHPT_TERM
};
static int get_script_dispatch_mdef[] = {
APHPT_DISP, 1, APHPM_OUT,
APHPT_TERM
};
static int parse_procedure_text_mdef[] = {
APHPT_UNK, 4, APHPM_IN,
APHPT_DISP, 9, APHPM_OUT,
APHPT_TERM
};
static int *mdef_by_func[APHP__Max] = {
parse_script_text_mdef,
NULL, /* InitNew */
NULL, /* AddNamedItem */
NULL, /* SetScriptState */
get_script_dispatch_mdef,
NULL, /* Close */
NULL, /* AddTypeLib */
NULL, /* AddScriptlet */
parse_procedure_text_mdef,
};
static HRESULT do_marshal_in(int stub, void *args[16], int *mdef, LPSTREAM *ppstm)
{
int i = 0;
int want;
HRESULT ret = S_OK;
LPSTREAM stm = NULL;
if (!mdef)
return S_OK;
trace("marshalling ... \n");
ret = CreateStreamOnHGlobal(NULL, TRUE, &stm);
if (FAILED(ret)) {
trace(" failed to create stm %s", php_win_err(ret));
return ret;
}
*ppstm = stm;
/* if stub is true, we are the stub and are marshaling OUT params,
* otherwise, we are the proxy and are marshalling IN params */
if (stub) {
want = APHPM_OUT;
} else {
want = APHPM_IN;
}
while (mdef[i] != APHPT_TERM) {
if ((mdef[i+2] & want) == want) {
int argno = mdef[i+1];
int isout = (mdef[i+2] & APHPM_OUT) == APHPM_OUT;
#undef OUT_IFACE
#define OUT_IFACE (isout ? *(IUnknown**)args[argno] : (IUnknown*)args[argno])
#define IFACE_PRESENT args[argno] && (!isout || *(IUnknown**)args[argno])
switch (mdef[i]) {
case APHPT_UNK:
if (IFACE_PRESENT) {
ret = CoMarshalInterface(stm, IID_IUnknown, OUT_IFACE, MSHCTX_INPROC, NULL, MSHLFLAGS_NORMAL);
trace(" arg=%d IUnknown --> %s", argno, php_win_err(ret));
} else {
trace(" arg=%d IUnknown(NULL) - skip\n", argno);
}
break;
case APHPT_DISP:
if (IFACE_PRESENT) {
ret = CoMarshalInterface(stm, IID_IDispatch, OUT_IFACE, MSHCTX_INPROC, NULL, MSHLFLAGS_NORMAL);
trace(" arg=%d IDispatch --> %s", argno, php_win_err(ret));
} else {
trace(" arg=%d IDispatch(NULL) - skip\n", argno);
}
break;
case APHPT_VAR:
if (args[argno])
ret = E_NOTIMPL;
break;
default:
ret = E_NOTIMPL;
}
if (FAILED(ret))
break;
} else {
trace(" -- skipping (this param is not needed in this direction)\n");
}
i += 3;
}
if (FAILED(ret)) {
/* TODO: rollback (refcounts are held during marshalling) */
trace(" rolling back\n");
stm->Release();
*ppstm = NULL;
} else {
LARGE_INTEGER pos = {0};
stm->Seek(pos, STREAM_SEEK_SET, NULL);
}
return ret;
}
static HRESULT do_marshal_out(int stub, void *args[16], int *mdef, LPSTREAM stm)
{
int i = 0;
int want;
HRESULT ret = S_OK;
if (!mdef)
return S_OK;
trace(" unmarshalling...\n");
/* if stub is true, we are the stub and are unmarshaling IN params,
* otherwise, we are the proxy and are unmarshalling OUT params */
if (!stub) {
want = APHPM_OUT;
} else {
want = APHPM_IN;
}
while (mdef[i] != APHPT_TERM) {
if ((mdef[i+2] & want) == want) {
int argno = mdef[i+1];
int isout = (mdef[i+2] & APHPM_OUT) == APHPM_OUT;
#undef OUT_IFACE
#define OUT_IFACE (isout ? (void**)args[argno] : &args[argno])
switch (mdef[i]) {
case APHPT_UNK:
if (IFACE_PRESENT) {
ret = CoUnmarshalInterface(stm, IID_IUnknown, OUT_IFACE);
trace(" unmarshal arg=%d IUnknown --> %s", argno, php_win_err(ret));
} else {
trace(" unmarshal arg=%d IUnknown(NULL) - skip\n", argno);
}
break;
case APHPT_DISP:
if (IFACE_PRESENT) {
trace(" unmarshal dispatch: args[%d]=%p *args[%d]=%p\n",
argno, args[argno], argno, args[argno] ? *(void**)args[argno] : NULL);
ret = CoUnmarshalInterface(stm, IID_IDispatch, OUT_IFACE);
trace(" unmarshal arg=%d IDispatch --> %s: args[%d]=%p *args[%d]=%p\n", argno, php_win_err(ret),
argno, args[argno], argno, args[argno] ? *(void**)args[argno] : NULL);
} else {
trace(" unmarshal arg=%d IDispatch(NULL) - skip\n", argno);
}
break;
case APHPT_VAR:
if (args[argno])
ret = E_NOTIMPL;
break;
default:
ret = E_NOTIMPL;
}
if (FAILED(ret))
break;
}
i += 3;
}
return ret;
}
struct activephp_serialize_msg {
class TPHPScriptingEngine *engine;
void *args[16];
int nargs;
enum activephp_engine_func func;
int *marshal_defs;
LPSTREAM instm, outstm;
HANDLE evt;
HRESULT ret;
};
static const char *func_names[APHP__Max] = {
"ParseScriptText",
"InitNew",
"AddnamedItem",
"SetScriptState",
"GetScriptDispatch",
"Close",
"AddTypeLib",
"AddScriptlet",
"ParseProcedureText",
};
HRESULT marshal_call(class TPHPScriptingEngine *engine, enum activephp_engine_func func, int nargs, ...)
{
va_list ap;
struct activephp_serialize_msg msg ;
HRESULT ret;
memset(&msg, 0, sizeof(msg));
msg.engine = engine;
msg.func = func;
msg.marshal_defs = mdef_by_func[func];
trace(" prepping for function code %d %s, %d args, marshal defs at %p\n", func, func_names[func], nargs, msg.marshal_defs);
va_start(ap, nargs);
for (msg.nargs = 0; msg.nargs < nargs; msg.nargs++) {
msg.args[msg.nargs] = va_arg(ap, void*);
}
va_end(ap);
ret = do_marshal_in(0, msg.args, msg.marshal_defs, &msg.instm);
if (FAILED(ret)) {
return ret;
}
#if 1
msg.evt = CreateEvent(NULL, TRUE, FALSE, NULL);
PostMessage(engine->m_queue, WM_ACTIVEPHP_SERIALIZE, 0, (LPARAM)&msg);
while (WAIT_OBJECT_0 != WaitForSingleObject(msg.evt, 0)) {
DWORD status = MsgWaitForMultipleObjects(1, &msg.evt, FALSE, INFINITE, QS_ALLEVENTS|QS_ALLINPUT|QS_ALLPOSTMESSAGE|QS_SENDMESSAGE|QS_POSTMESSAGE);
if (status == WAIT_OBJECT_0)
break;
MSG msg;
while (PeekMessage(&msg, NULL, 0, 0, PM_REMOVE)) {
TranslateMessage(&msg);
DispatchMessage(&msg);
}
}
CloseHandle(msg.evt);
#else
ret = SendMessage(engine->m_queue, WM_ACTIVEPHP_SERIALIZE, 0, (LPARAM)&msg);
#endif
if (msg.outstm) {
ret = do_marshal_out(0, msg.args, msg.marshal_defs, msg.outstm);
msg.outstm->Release();
}
if (msg.instm)
msg.instm->Release();
trace("marshall call to %s completed %s", func_names[func], php_win_err(ret));
return ret;
}
HRESULT marshal_stub(LPARAM lparam)
{
struct activephp_serialize_msg *msg = (struct activephp_serialize_msg*)lparam;
if (msg->instm) {
msg->ret = do_marshal_out(1, msg->args, msg->marshal_defs, msg->instm);
if (FAILED(msg->ret)) {
SetEvent(msg->evt);
return msg->ret;
}
}
switch (msg->func) {
case APHP_ParseScriptText:
msg->ret = msg->engine->ParseScriptText(
(LPCOLESTR)msg->args[0],
(LPCOLESTR)msg->args[1],
(IUnknown*)msg->args[2],
(LPCOLESTR)msg->args[3],
(DWORD)msg->args[4],
(ULONG)msg->args[5],
(DWORD)msg->args[6],
(VARIANT*)msg->args[7],
(EXCEPINFO*)msg->args[8]);
break;
case APHP_InitNew:
msg->ret = msg->engine->InitNew();
break;
case APHP_AddNamedItem:
msg->ret = msg->engine->AddNamedItem(
(LPCOLESTR)msg->args[0],
(DWORD)msg->args[1]);
break;
case APHP_SetScriptState:
msg->ret = msg->engine->SetScriptState((SCRIPTSTATE)(LONG)msg->args[0]);
break;
case APHP_GetScriptDispatch:
msg->ret = msg->engine->GetScriptDispatch(
(LPCOLESTR)msg->args[0],
(IDispatch**)msg->args[1]);
break;
case APHP_Close:
msg->ret = msg->engine->Close();
break;
case APHP_AddTypeLib:
msg->ret = msg->engine->AddTypeLib(
(REFGUID)msg->args[0],
(DWORD)msg->args[1],
(DWORD)msg->args[2],
(DWORD)msg->args[3]);
break;
case APHP_AddScriptlet:
msg->ret = msg->engine->AddScriptlet(
(LPCOLESTR)msg->args[0],
(LPCOLESTR)msg->args[1],
(LPCOLESTR)msg->args[2],
(LPCOLESTR)msg->args[3],
(LPCOLESTR)msg->args[4],
(LPCOLESTR)msg->args[5],
(DWORD)msg->args[6],
(ULONG)msg->args[7],
(DWORD)msg->args[8],
(BSTR*)msg->args[9],
(EXCEPINFO*)msg->args[10]);
break;
case APHP_ParseProcedureText:
msg->ret = msg->engine->ParseProcedureText(
(LPCOLESTR)msg->args[0],
(LPCOLESTR)msg->args[1],
(LPCOLESTR)msg->args[2],
(LPCOLESTR)msg->args[3],
(IUnknown*)msg->args[4],
(LPCOLESTR)msg->args[5],
(DWORD)msg->args[6],
(ULONG)msg->args[7],
(DWORD)msg->args[8],
(IDispatch**)msg->args[9]);
break;
default:
msg->ret = E_NOTIMPL;
}
if (SUCCEEDED(msg->ret)) {
msg->ret = do_marshal_in(1, msg->args, msg->marshal_defs, &msg->outstm);
}
SetEvent(msg->evt);
return msg->ret;
}

View File

@ -1,171 +0,0 @@
/*
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2004 The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.0 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
| available through the world-wide-web at the following url: |
| http://www.php.net/license/3_0.txt. |
| If you did not receive a copy of the PHP license and are unable to |
| obtain it through the world-wide-web, please send a note to |
| license@php.net so we can mail you a copy immediately. |
+----------------------------------------------------------------------+
| Authors: Wez Furlong <wez@thebrainroom.com> |
+----------------------------------------------------------------------+
*/
/* $Id$ */
#include "php.h"
#include "php_main.h"
#include "SAPI.h"
#include "php_globals.h"
#include "ext/standard/info.h"
#include "php_variables.h"
#include "php_ini.h"
#include "php5activescript.h"
/* SAPI definitions and DllMain */
static int php_activescript_startup(sapi_module_struct *sapi_module)
{
if (php_module_startup(sapi_module, &php_activescript_module, 1) == FAILURE) {
return FAILURE;
} else {
return SUCCESS;
}
}
static int sapi_activescript_ub_write(const char *str, uint str_length TSRMLS_DC)
{
/* In theory, this is a blackhole. In practice, I want to see the output
* in the debugger! */
#if ZEND_DEBUG
char buf[1024];
uint l, a = str_length;
while(a) {
l = a;
if (l > sizeof(buf) - 1)
l = sizeof(buf) - 1;
memcpy(buf, str, l);
buf[l] = 0;
OutputDebugString(buf);
a -= l;
}
#endif
return str_length;
}
static void sapi_activescript_register_server_variables(zval *track_vars_array TSRMLS_DC)
{
}
static char *sapi_activescript_read_cookies(TSRMLS_D)
{
return NULL;
}
static int sapi_activescript_header_handler(sapi_header_struct *sapi_header, sapi_headers_struct *sapi_headers TSRMLS_DC)
{
return SAPI_HEADER_ADD;
}
static int sapi_activescript_send_headers(sapi_headers_struct *sapi_headers TSRMLS_DC)
{
return SAPI_HEADER_SENT_SUCCESSFULLY;
}
zend_module_entry php_activescript_module = {
STANDARD_MODULE_HEADER,
"ActiveScript",
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
STANDARD_MODULE_PROPERTIES
};
sapi_module_struct activescript_sapi_module = {
"activescript", /* name */
"ActiveScript", /* pretty name */
php_activescript_startup, /* startup */
php_module_shutdown_wrapper, /* shutdown */
NULL, /* activate */
NULL, /* deactivate */
sapi_activescript_ub_write, /* unbuffered write */
NULL, /* flush */
NULL, /* get uid */
NULL, /* getenv */
zend_error, /* error handler */
sapi_activescript_header_handler, /* header handler */
sapi_activescript_send_headers, /* send headers handler */
NULL, /* send header handler */
NULL, /* read POST data */
sapi_activescript_read_cookies, /* read Cookies */
sapi_activescript_register_server_variables, /* register server variables */
NULL, /* Log message */
STANDARD_SAPI_MODULE_PROPERTIES
};
BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved)
{
switch (fdwReason) {
case DLL_PROCESS_ATTACH:
module_handle = hinstDLL;
tsrm_startup(128, 32, TSRM_ERROR_LEVEL_CORE, "C:\\TSRM.log");
/* useful behaviour for the host: we take the application path
* and use that dir as the override for the php.ini, so that
* we don't pick up a global .ini file */
{
char module_dir[MAXPATHLEN];
char *slash;
GetModuleFileName(0, module_dir, sizeof(module_dir));
slash = strrchr(module_dir, '\\');
if (slash) {
slash[1] = '\0';
}
activescript_sapi_module.php_ini_path_override = strdup(module_dir);
}
sapi_startup(&activescript_sapi_module);
if (activescript_sapi_module.startup) {
activescript_sapi_module.startup(&sapi_module);
}
break;
case DLL_THREAD_ATTACH:
break;
case DLL_THREAD_DETACH:
//OutputDebugString("THREAD_DETACH\n");
ts_free_thread();
break;
case DLL_PROCESS_DETACH:
if (activescript_sapi_module.shutdown) {
activescript_sapi_module.shutdown(&sapi_module);
}
//OutputDebugString("PROCESS_DETACH\n");
sapi_shutdown();
tsrm_shutdown();
break;
}
return TRUE;
}

View File

@ -1,5 +0,0 @@
EXPORTS
DllCanUnloadNow PRIVATE
DllGetClassObject PRIVATE
DllRegisterServer PRIVATE
DllUnregisterServer PRIVATE

View File

@ -1,185 +0,0 @@
# Microsoft Developer Studio Project File - Name="php5activescript" - Package Owner=<4>
# Microsoft Developer Studio Generated Build File, Format Version 6.00
# ** DO NOT EDIT **
# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102
CFG=php5activescript - Win32 Debug_TS
!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 "php5activescript.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 "php5activescript.mak" CFG="php5activescript - Win32 Debug_TS"
!MESSAGE
!MESSAGE Possible choices for configuration are:
!MESSAGE
!MESSAGE "php5activescript - Win32 Debug_TS" (based on "Win32 (x86) Dynamic-Link Library")
!MESSAGE "php5activescript - Win32 Release_TS" (based on "Win32 (x86) Dynamic-Link Library")
!MESSAGE "php5activescript - Win32 Release_TS_inline" (based on "Win32 (x86) Dynamic-Link Library")
!MESSAGE "php5activescript - Win32 Release_TSDbg" (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)" == "php5activescript - Win32 Debug_TS"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 1
# PROP BASE Output_Dir "Debug_TS"
# PROP BASE Intermediate_Dir "Debug_TS"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 1
# PROP Output_Dir "..\..\Debug_TS"
# PROP Intermediate_Dir "Debug_TS"
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "PHP5ISAPI_EXPORTS" /YX /FD /GZ /c
# ADD CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /I "..\..\win32" /I "..\..\Zend" /I "..\.." /I "..\..\main" /I "..\..\TSRM" /D "_DEBUG" /D "COMPILE_LIBZEND" /D ZEND_DEBUG=1 /D "_WINDOWS" /D "_USRDLL" /D "PHP5ISAPI_EXPORTS" /D "MSVC5" /D "ZTS" /D "ZEND_WIN32" /D "PHP_WIN32" /D "WIN32" /D "_MBCS" /D ACTIVEPHP_OBJECT_SAFETY=1 /FR /YX /FD /GZ /c
# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
# ADD BASE RSC /l 0x40d /d "_DEBUG"
# ADD RSC /l 0x40d /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 /dll /debug /machine:I386 /pdbtype:sept
# ADD LINK32 wsock32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib php5ts_debug.lib /nologo /version:4.0 /dll /debug /machine:I386 /nodefaultlib:"libcmt" /pdbtype:sept /libpath:"..\..\Debug_TS"
!ELSEIF "$(CFG)" == "php5activescript - Win32 Release_TS"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 0
# PROP BASE Output_Dir "Release_TS"
# PROP BASE Intermediate_Dir "Release_TS"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 0
# PROP Output_Dir "..\..\Release_TS"
# PROP Intermediate_Dir "Release_TS"
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "PHP5ISAPI_EXPORTS" /YX /FD /c
# ADD CPP /nologo /MD /W3 /GX /O2 /I "...\..\include" /I "..\..\win32" /I "..\..\Zend" /I "..\.." /I "..\..\main" /I "..\..\TSRM" /D "NDEBUG" /D ZEND_DEBUG=0 /D "_WINDOWS" /D "_USRDLL" /D "PHP5ISAPI_EXPORTS" /D "MSVC5" /D "ZTS" /D "ZEND_WIN32" /D "PHP_WIN32" /D "WIN32" /D "_MBCS" /D ACTIVEPHP_OBJECT_SAFETY=1 /FR /YX /FD /c
# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
# ADD BASE RSC /l 0x40d /d "NDEBUG"
# ADD RSC /l 0x40d /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 /dll /machine:I386
# ADD LINK32 kernel32.lib user32.lib gdi32.lib wsock32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib php5ts.lib /nologo /version:4.0 /dll /machine:I386 /libpath:"..\..\Release_TS"
!ELSEIF "$(CFG)" == "php5activescript - Win32 Release_TS_inline"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 0
# PROP BASE Output_Dir "php5activescript___Win32_Release_TS_inline"
# PROP BASE Intermediate_Dir "php5activescript___Win32_Release_TS_inline"
# PROP BASE Ignore_Export_Lib 0
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 0
# PROP Output_Dir "..\..\Release_TS_inline"
# PROP Intermediate_Dir "Release_TS_inline"
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /MD /W3 /GX /O2 /I "...\..\include" /I "..\..\win32" /I "..\..\Zend" /I "..\.." /D "NDEBUG" /D "_WINDOWS" /D "_USRDLL" /D "PHP5ISAPI_EXPORTS" /D "MSVC5" /D "ZTS" /D "WIN32" /D "_MBCS" /D ZEND_DEBUG=0 /FR /YX /FD /c
# ADD CPP /nologo /MD /W3 /GX /O2 /I "...\..\include" /I "..\..\win32" /I "..\..\Zend" /I "..\.." /I "..\..\main" /I "..\..\TSRM" /D "NDEBUG" /D ZEND_DEBUG=0 /D "ZEND_WIN32_FORCE_INLINE" /D "_WINDOWS" /D "_USRDLL" /D "PHP5ISAPI_EXPORTS" /D "MSVC5" /D "ZTS" /D "ZEND_WIN32" /D "PHP_WIN32" /D "WIN32" /D "_MBCS" /D ACTIVEPHP_OBJECT_SAFETY=1 /FR /YX /FD /c
# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
# ADD BASE RSC /l 0x40d /d "NDEBUG"
# ADD RSC /l 0x40d /d "NDEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib wsock32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib php5ts.lib /nologo /dll /machine:I386 /libpath:"..\..\Release_TS"
# ADD LINK32 kernel32.lib user32.lib gdi32.lib wsock32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib php5ts.lib /nologo /version:4.0 /dll /machine:I386 /libpath:"..\..\Release_TS_inline"
!ELSEIF "$(CFG)" == "php5activescript - Win32 Release_TSDbg"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 0
# PROP BASE Output_Dir "php5activescript___Win32_Release_TSDbg"
# PROP BASE Intermediate_Dir "php5activescript___Win32_Release_TSDbg"
# PROP BASE Ignore_Export_Lib 0
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 0
# PROP Output_Dir "..\..\Release_TSDbg"
# PROP Intermediate_Dir "Release_TSDbg"
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /MD /W3 /GX /O2 /I "...\..\include" /I "..\..\win32" /I "..\..\Zend" /I "..\.." /I "..\..\main" /I "..\..\TSRM" /D "NDEBUG" /D ZEND_DEBUG=0 /D "_WINDOWS" /D "_USRDLL" /D "PHP5ISAPI_EXPORTS" /D "MSVC5" /D "ZTS" /D "ZEND_WIN32" /D "PHP_WIN32" /D "WIN32" /D "_MBCS" /FR /YX /FD /c
# ADD CPP /nologo /MD /W3 /GX /Zi /Od /I "...\..\include" /I "..\..\win32" /I "..\..\Zend" /I "..\.." /I "..\..\main" /I "..\..\TSRM" /D "NDEBUG" /D ZEND_DEBUG=0 /D "_WINDOWS" /D "_USRDLL" /D "PHP5ISAPI_EXPORTS" /D "MSVC5" /D "ZTS" /D "ZEND_WIN32" /D "PHP_WIN32" /D "WIN32" /D "_MBCS" /D ACTIVEPHP_OBJECT_SAFETY=1 /FR /YX /FD /c
# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
# ADD BASE RSC /l 0x40d /d "NDEBUG"
# ADD RSC /l 0x40d /d "NDEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib wsock32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib php5ts.lib /nologo /version:4.0 /dll /machine:I386 /libpath:"..\..\Release_TS"
# ADD LINK32 kernel32.lib user32.lib gdi32.lib wsock32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib php5ts.lib /nologo /version:4.0 /dll /debug /machine:I386 /libpath:"..\..\Release_TSDbg"
!ENDIF
# Begin Target
# Name "php5activescript - Win32 Debug_TS"
# Name "php5activescript - Win32 Release_TS"
# Name "php5activescript - Win32 Release_TS_inline"
# Name "php5activescript - Win32 Release_TSDbg"
# Begin Group "Source Files"
# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
# Begin Source File
SOURCE=.\classfactory.cpp
# End Source File
# Begin Source File
SOURCE=.\php5activescript.c
# End Source File
# Begin Source File
SOURCE=.\php5activescript.def
# End Source File
# Begin Source File
SOURCE=.\scriptengine.cpp
# End Source File
# End Group
# Begin Group "Header Files"
# PROP Default_Filter "h;hpp;hxx;hm;inl"
# Begin Source File
SOURCE=.\php5activescript.h
# End Source File
# Begin Source File
SOURCE=.\php5as_classfactory.h
# End Source File
# Begin Source File
SOURCE=.\php5as_scriptengine.h
# End Source File
# End Group
# End Target
# End Project

View File

@ -1,25 +0,0 @@
/*
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2004 The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.0 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
| available through the world-wide-web at the following url: |
| http://www.php.net/license/3_0.txt. |
| If you did not receive a copy of the PHP license and are unable to |
| obtain it through the world-wide-web, please send a note to |
| license@php.net so we can mail you a copy immediately. |
+----------------------------------------------------------------------+
| Authors: Wez Furlong <wez@thebrainroom.com> |
+----------------------------------------------------------------------+
*/
/* $Id$ */
extern zend_module_entry php_activescript_module;
extern sapi_module_struct activescript_sapi_module;
extern HINSTANCE module_handle;
extern void activescript_error_func(int type, const char *error_msg, ...);
extern void activescript_error_handler(int type, const char *error_filename,
const uint error_lineno, const char *format, va_list args);

View File

@ -1,63 +0,0 @@
/*
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2004 The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.0 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
| available through the world-wide-web at the following url: |
| http://www.php.net/license/3_0.txt. |
| If you did not receive a copy of the PHP license and are unable to |
| obtain it through the world-wide-web, please send a note to |
| license@php.net so we can mail you a copy immediately. |
+----------------------------------------------------------------------+
| Authors: Wez Furlong <wez@thebrainroom.com> |
+----------------------------------------------------------------------+
*/
/* $Id$ */
/* IClassFactory Implementation */
#include <unknwn.h>
// {CF108A38-59A9-468a-AF45-1368D7855DAE}
DEFINE_GUID(CLSID_PHPActiveScriptEngine,
0xcf108a38, 0x59a9, 0x468a, 0xaf, 0x45, 0x13, 0x68, 0xd7, 0x85, 0x5d, 0xae);
// {AD504760-D6B9-4537-AEAC-512FFB359009}
DEFINE_GUID(CLSID_PHPActiveScriptEngineMarshal,
0xad504760, 0xd6b9, 0x4537, 0xae, 0xac, 0x51, 0x2f, 0xfb, 0x35, 0x90, 0x9);
#if 0
/* this was for PHP 4 */
// {A0AD8E7A-95EC-4819-986F-78D93895F2AE}
DEFINE_GUID(CLSID_PHPActiveScriptEngine,
0xa0ad8e7a, 0x95ec, 0x4819, 0x98, 0x6f, 0x78, 0xd9, 0x38, 0x95, 0xf2, 0xae);
#endif
class TPHPClassFactory:
public IClassFactory
{
protected:
volatile LONG m_refcount;
static volatile LONG factory_count;
static volatile LONG object_count;
public: /* IUnknown */
STDMETHODIMP QueryInterface(REFIID iid, void **ppvObject);
STDMETHODIMP_(DWORD) AddRef(void);
STDMETHODIMP_(DWORD) Release(void);
public: /* IClassFactory */
STDMETHODIMP CreateInstance(IUnknown *pUnkOuter, REFIID iid, void **ppvObject);
STDMETHODIMP LockServer(BOOL fLock);
TPHPClassFactory();
~TPHPClassFactory();
static void AddToObjectCount(void);
static void RemoveFromObjectCount(void);
static int CanUnload(void);
};

View File

@ -1,214 +0,0 @@
/*
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2004 The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.0 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
| available through the world-wide-web at the following url: |
| http://www.php.net/license/3_0.txt. |
| If you did not receive a copy of the PHP license and are unable to |
| obtain it through the world-wide-web, please send a note to |
| license@php.net so we can mail you a copy immediately. |
+----------------------------------------------------------------------+
| Authors: Wez Furlong <wez@thebrainroom.com> |
+----------------------------------------------------------------------+
*/
/* $Id$ */
#include <activscp.h>
#include <objsafe.h>
#include "zend.h"
#if 0
#define ACTIVEPHP_THREADING_MODE COINIT_MULTITHREADED
#else
#define ACTIVEPHP_THREADING_MODE COINIT_APARTMENTTHREADED
#endif
#define WM_ACTIVEPHP_SERIALIZE WM_USER + 200
enum activephp_engine_func { /* if you change the order, change marshal.cpp too */
APHP_ParseScriptText,
APHP_InitNew,
APHP_AddNamedItem,
APHP_SetScriptState,
APHP_GetScriptDispatch,
APHP_Close,
APHP_AddTypeLib,
APHP_AddScriptlet,
APHP_ParseProcedureText,
APHP__Max
};
HRESULT marshal_call(class TPHPScriptingEngine *engine, enum activephp_engine_func func, int nargs, ...);
HRESULT marshal_stub(LPARAM lparam);
class TPHPScriptingEngine:
public IActiveScript,
public IActiveScriptParse,
public IActiveScriptParseProcedure,
public IObjectSafety,
public IDispatch
#if 0
, public IMarshal
#endif
{
public:
volatile LONG m_refcount;
IActiveScriptSite *m_pass;
SCRIPTSTATE m_scriptstate;
void add_to_global_namespace(IDispatch *disp, DWORD flags, char *name TSRMLS_DC);
THREAD_T m_enginethread, m_basethread;
HashTable m_frags;
ULONG m_lambda_count;
DWORD m_gitcookie, m_asscookie;
HWND m_queue;
int m_done_init;
int m_in_main, m_stop_main;
void do_clone(TPHPScriptingEngine *src);
void setup_engine_state(void);
int create_id(OLECHAR *name, DISPID *dispid TSRMLS_DC);
char *m_names[1024];
int m_lens[1024];
int m_ids;
public: /* IUnknown */
STDMETHODIMP QueryInterface(REFIID iid, void **ppvObject);
STDMETHODIMP_(DWORD) AddRef(void);
STDMETHODIMP_(DWORD) Release(void);
public: /* IActiveScript */
STDMETHODIMP SetScriptSite(
/* [in] */ IActiveScriptSite *pass);
STDMETHODIMP GetScriptSite(
/* [in] */ REFIID riid,
/* [iid_is][out] */ void **ppvObject);
STDMETHODIMP SetScriptState(
/* [in] */ SCRIPTSTATE ss);
STDMETHODIMP GetScriptState(
/* [out] */ SCRIPTSTATE *pssState);
STDMETHODIMP Close( void);
STDMETHODIMP AddNamedItem(
/* [in] */ LPCOLESTR pstrName,
/* [in] */ DWORD dwFlags);
STDMETHODIMP AddTypeLib(
/* [in] */ REFGUID rguidTypeLib,
/* [in] */ DWORD dwMajor,
/* [in] */ DWORD dwMinor,
/* [in] */ DWORD dwFlags);
STDMETHODIMP GetScriptDispatch(
/* [in] */ LPCOLESTR pstrItemName,
/* [out] */ IDispatch **ppdisp);
STDMETHODIMP GetCurrentScriptThreadID(
/* [out] */ SCRIPTTHREADID *pstidThread);
STDMETHODIMP GetScriptThreadID(
/* [in] */ DWORD dwWin32ThreadId,
/* [out] */ SCRIPTTHREADID *pstidThread);
STDMETHODIMP GetScriptThreadState(
/* [in] */ SCRIPTTHREADID stidThread,
/* [out] */ SCRIPTTHREADSTATE *pstsState);
STDMETHODIMP InterruptScriptThread(
/* [in] */ SCRIPTTHREADID stidThread,
/* [in] */ const EXCEPINFO *pexcepinfo,
/* [in] */ DWORD dwFlags);
STDMETHODIMP Clone(
/* [out] */ IActiveScript **ppscript);
public: /* IActiveScriptParse */
STDMETHODIMP InitNew( void);
STDMETHODIMP AddScriptlet(
/* [in] */ LPCOLESTR pstrDefaultName,
/* [in] */ LPCOLESTR pstrCode,
/* [in] */ LPCOLESTR pstrItemName,
/* [in] */ LPCOLESTR pstrSubItemName,
/* [in] */ LPCOLESTR pstrEventName,
/* [in] */ LPCOLESTR pstrDelimiter,
/* [in] */ DWORD dwSourceContextCookie,
/* [in] */ ULONG ulStartingLineNumber,
/* [in] */ DWORD dwFlags,
/* [out] */ BSTR *pbstrName,
/* [out] */ EXCEPINFO *pexcepinfo);
STDMETHODIMP ParseScriptText(
/* [in] */ LPCOLESTR pstrCode,
/* [in] */ LPCOLESTR pstrItemName,
/* [in] */ IUnknown *punkContext,
/* [in] */ LPCOLESTR pstrDelimiter,
/* [in] */ DWORD dwSourceContextCookie,
/* [in] */ ULONG ulStartingLineNumber,
/* [in] */ DWORD dwFlags,
/* [out] */ VARIANT *pvarResult,
/* [out] */ EXCEPINFO *pexcepinfo);
public: /* IActiveScriptParseProcedure */
STDMETHODIMP ParseProcedureText(
/* [in] */ LPCOLESTR pstrCode,
/* [in] */ LPCOLESTR pstrFormalParams,
/* [in] */ LPCOLESTR pstrProcedureName,
/* [in] */ LPCOLESTR pstrItemName,
/* [in] */ IUnknown *punkContext,
/* [in] */ LPCOLESTR pstrDelimiter,
/* [in] */ DWORD dwSourceContextCookie,
/* [in] */ ULONG ulStartingLineNumber,
/* [in] */ DWORD dwFlags,
/* [out] */ IDispatch **ppdisp);
public: /* IObjectSafety */
STDMETHODIMP GetInterfaceSafetyOptions(
/* [in] */ REFIID riid, // Interface that we want options for
/* [out] */ DWORD *pdwSupportedOptions, // Options meaningful on this interface
/* [out] */ DWORD *pdwEnabledOptions); // current option values on this interface
STDMETHODIMP SetInterfaceSafetyOptions(
/* [in] */ REFIID riid, // Interface to set options for
/* [in] */ DWORD dwOptionSetMask, // Options to change
/* [in] */ DWORD dwEnabledOptions); // New option values
#if 0
public: /* IMarshal */
STDMETHODIMP GetUnmarshalClass(
REFIID riid, void *pv, DWORD dwDestContext, void *pvDestContext, DWORD mshlflags, CLSID *pCid);
STDMETHODIMP GetMarshalSizeMax(
REFIID riid, void *pv, DWORD dwDestContext, void *pvDestContext, DWORD mshlflags, ULONG *pSize);
STDMETHODIMP MarshalInterface(
IStream *pStm, REFIID riid, void *pv, DWORD dwDestContext, void *pvDestContext, DWORD mshflags);
STDMETHODIMP UnmarshalInterface(
IStream *pStm, REFIID riid, void **ppv);
STDMETHODIMP ReleaseMarshalData(IStream *pStm);
STDMETHODIMP DisconnectObject(DWORD dwReserved);
#endif
public: /* IDispatch */
STDMETHODIMP GetIDsOfNames( REFIID riid, OLECHAR **rgszNames, unsigned int cNames, LCID lcid, DISPID *rgDispId);
STDMETHODIMP Invoke( DISPID dispIdMember, REFIID riid, LCID lcid, WORD wFlags,
DISPPARAMS FAR* pdp, VARIANT FAR* pvarRes, EXCEPINFO FAR* pei,
unsigned int FAR* puArgErr);
STDMETHODIMP GetTypeInfoCount(unsigned int * pctinfo);
STDMETHODIMP GetTypeInfo( unsigned int iTInfo, LCID lcid, ITypeInfo **ppTInfo);
public:
TPHPScriptingEngine();
~TPHPScriptingEngine();
};
IUnknown *create_scripting_engine(TPHPScriptingEngine *tobecloned);

File diff suppressed because it is too large Load Diff