Signed-off-by: Zebediah Figura z.figura12@gmail.com --- dlls/vbscript/lex.c | 3 ++- dlls/vbscript/tests/run.c | 7 +++++++ 2 files changed, 9 insertions(+), 1 deletion(-)
diff --git a/dlls/vbscript/lex.c b/dlls/vbscript/lex.c index 98b4cbb..21fe2e4 100644 --- a/dlls/vbscript/lex.c +++ b/dlls/vbscript/lex.c @@ -383,7 +383,7 @@ static int parse_hex_literal(parser_ctx_t *ctx, LONG *ret)
static void skip_spaces(parser_ctx_t *ctx) { - while(*ctx->ptr == ' ' || *ctx->ptr == '\t' || *ctx->ptr == '\r') + while(*ctx->ptr == ' ' || *ctx->ptr == '\t') ctx->ptr++; }
@@ -421,6 +421,7 @@ static int parse_next_token(void *lval, parser_ctx_t *ctx)
switch(c) { case '\n': + case '\r': ctx->ptr++; return tNL; case ''': diff --git a/dlls/vbscript/tests/run.c b/dlls/vbscript/tests/run.c index 6b57540..2f50377 100644 --- a/dlls/vbscript/tests/run.c +++ b/dlls/vbscript/tests/run.c @@ -2394,6 +2394,13 @@ static void run_tests(void) ok(FAILED(hres), "script didn't fail\n"); todo_wine CHECK_CALLED(OnScriptError);
+ parse_script_a("Sub testsub(arg)\r" + "If arg = 1 Then\r\r" + "arg = 2\n\n" + "End If\r\n" + "End Sub\n\r" + "Call testsub(1)"); + run_from_res("lang.vbs"); run_from_res("api.vbs"); run_from_res("regexp.vbs");
Visual Pinball 9.9.5 expects this interface to be present, and crashes on teardown trying to Release() it.
Signed-off-by: Zebediah Figura z.figura12@gmail.com --- dlls/vbscript/vbscript.c | 65 ++++++++++++++++++++++++++++++++++++++++++++++++ dlls/vbscript/vbscript.h | 1 + 2 files changed, 66 insertions(+)
diff --git a/dlls/vbscript/vbscript.c b/dlls/vbscript/vbscript.c index b97cf5a..06a855b 100644 --- a/dlls/vbscript/vbscript.c +++ b/dlls/vbscript/vbscript.c @@ -29,12 +29,14 @@ WINE_DEFAULT_DEBUG_CHANNEL(vbscript); #ifdef _WIN64
#define CTXARG_T DWORDLONG +#define IActiveScriptDebugVtbl IActiveScriptDebug64Vtbl #define IActiveScriptParseVtbl IActiveScriptParse64Vtbl #define IActiveScriptParseProcedure2Vtbl IActiveScriptParseProcedure2_64Vtbl
#else
#define CTXARG_T DWORD +#define IActiveScriptDebugVtbl IActiveScriptDebug32Vtbl #define IActiveScriptParseVtbl IActiveScriptParse32Vtbl #define IActiveScriptParseProcedure2Vtbl IActiveScriptParseProcedure2_32Vtbl
@@ -42,6 +44,7 @@ WINE_DEFAULT_DEBUG_CHANNEL(vbscript);
struct VBScript { IActiveScript IActiveScript_iface; + IActiveScriptDebug IActiveScriptDebug_iface; IActiveScriptParse IActiveScriptParse_iface; IActiveScriptParseProcedure2 IActiveScriptParseProcedure2_iface; IObjectSafety IObjectSafety_iface; @@ -267,6 +270,9 @@ static HRESULT WINAPI VBScript_QueryInterface(IActiveScript *iface, REFIID riid, }else if(IsEqualGUID(riid, &IID_IActiveScript)) { TRACE("(%p)->(IID_IActiveScript %p)\n", This, ppv); *ppv = &This->IActiveScript_iface; + }else if(IsEqualGUID(riid, &IID_IActiveScriptDebug)) { + TRACE("(%p)->(IID_IActiveScriptDebug %p)\n", This, ppv); + *ppv = &This->IActiveScriptDebug_iface; }else if(IsEqualGUID(riid, &IID_IActiveScriptParse)) { TRACE("(%p)->(IID_IActiveScriptParse %p)\n", This, ppv); *ppv = &This->IActiveScriptParse_iface; @@ -564,6 +570,64 @@ static const IActiveScriptVtbl VBScriptVtbl = { VBScript_Clone };
+static inline VBScript *impl_from_IActiveScriptDebug(IActiveScriptDebug *iface) +{ + return CONTAINING_RECORD(iface, VBScript, IActiveScriptDebug_iface); +} + +static HRESULT WINAPI VBScriptDebug_QueryInterface(IActiveScriptDebug *iface, REFIID riid, void **ppv) +{ + VBScript *This = impl_from_IActiveScriptDebug(iface); + return IActiveScript_QueryInterface(&This->IActiveScript_iface, riid, ppv); +} + +static ULONG WINAPI VBScriptDebug_AddRef(IActiveScriptDebug *iface) +{ + VBScript *This = impl_from_IActiveScriptDebug(iface); + return IActiveScript_AddRef(&This->IActiveScript_iface); +} + +static ULONG WINAPI VBScriptDebug_Release(IActiveScriptDebug *iface) +{ + VBScript *This = impl_from_IActiveScriptDebug(iface); + return IActiveScript_Release(&This->IActiveScript_iface); +} + +static HRESULT WINAPI VBScriptDebug_GetScriptTextAttributes(IActiveScriptDebug *iface, + LPCOLESTR code, ULONG len, LPCOLESTR delimiter, DWORD flags, SOURCE_TEXT_ATTR *attr) +{ + VBScript *This = impl_from_IActiveScriptDebug(iface); + FIXME("(%p)->(%s %u %s %#x %p)\n", This, debugstr_w(code), len, + debugstr_w(delimiter), flags, attr); + return E_NOTIMPL; +} + +static HRESULT WINAPI VBScriptDebug_GetScriptletTextAttributes(IActiveScriptDebug *iface, + LPCOLESTR code, ULONG len, LPCOLESTR delimiter, DWORD flags, SOURCE_TEXT_ATTR *attr) +{ + VBScript *This = impl_from_IActiveScriptDebug(iface); + FIXME("(%p)->(%s %u %s %#x %p)\n", This, debugstr_w(code), len, + debugstr_w(delimiter), flags, attr); + return E_NOTIMPL; +} + +static HRESULT WINAPI VBScriptDebug_EnumCodeContextsOfPosition(IActiveScriptDebug *iface, + CTXARG_T source, ULONG offset, ULONG len, IEnumDebugCodeContexts **ret) +{ + VBScript *This = impl_from_IActiveScriptDebug(iface); + FIXME("(%p)->(%s %u %u %p)\n", This, wine_dbgstr_longlong(source), offset, len, ret); + return E_NOTIMPL; +} + +static const IActiveScriptDebugVtbl VBScriptDebugVtbl = { + VBScriptDebug_QueryInterface, + VBScriptDebug_AddRef, + VBScriptDebug_Release, + VBScriptDebug_GetScriptTextAttributes, + VBScriptDebug_GetScriptletTextAttributes, + VBScriptDebug_EnumCodeContextsOfPosition, +}; + static inline VBScript *impl_from_IActiveScriptParse(IActiveScriptParse *iface) { return CONTAINING_RECORD(iface, VBScript, IActiveScriptParse_iface); @@ -806,6 +870,7 @@ HRESULT WINAPI VBScriptFactory_CreateInstance(IClassFactory *iface, IUnknown *pU return E_OUTOFMEMORY;
ret->IActiveScript_iface.lpVtbl = &VBScriptVtbl; + ret->IActiveScriptDebug_iface.lpVtbl = &VBScriptDebugVtbl; ret->IActiveScriptParse_iface.lpVtbl = &VBScriptParseVtbl; ret->IActiveScriptParseProcedure2_iface.lpVtbl = &VBScriptParseProcedureVtbl; ret->IObjectSafety_iface.lpVtbl = &VBScriptSafetyVtbl; diff --git a/dlls/vbscript/vbscript.h b/dlls/vbscript/vbscript.h index 5877762..98a5cb1 100644 --- a/dlls/vbscript/vbscript.h +++ b/dlls/vbscript/vbscript.h @@ -25,6 +25,7 @@ #include "ole2.h" #include "dispex.h" #include "activscp.h" +#include "activdbg.h"
#include "vbscript_classes.h"
Signed-off-by: Jacek Caban jacek@codeweavers.com
Signed-off-by: Jacek Caban jacek@codeweavers.com
On 05/22/2018 03:32 AM, Zebediah Figura wrote:
@@ -421,6 +421,7 @@ static int parse_next_token(void *lval, parser_ctx_t *ctx)
switch(c) { case '\n':
- case '\r': ctx->ptr++; return tNL; case ''':
It would be nice to handle that in comment_line() as well. Otherwise if script uses \r instead of \n, a comment will consume all the script.
Thanks, Jacek
On 22/05/18 03:41, Jacek Caban wrote:
Signed-off-by: Jacek Caban jacek@codeweavers.com
On 05/22/2018 03:32 AM, Zebediah Figura wrote:
@@ -421,6 +421,7 @@ static int parse_next_token(void *lval, parser_ctx_t *ctx)
switch(c) { case '\n':
- case '\r': ctx->ptr++; return tNL; case ''':
It would be nice to handle that in comment_line() as well. Otherwise if script uses \r instead of \n, a comment will consume all the script.
Thanks, Jacek
Thanks; I've sent an updated patch.