Commit 24d9f52f authored by Gabriel Ivăncescu's avatar Gabriel Ivăncescu Committed by Alexandre Julliard

msscript.ocx: Implement IScriptError::get_Description.

parent 7b46eb1e
...@@ -126,6 +126,7 @@ typedef struct { ...@@ -126,6 +126,7 @@ typedef struct {
HRESULT number; HRESULT number;
BSTR source; BSTR source;
BSTR desc;
BOOLEAN info_filled; BOOLEAN info_filled;
} ScriptError; } ScriptError;
...@@ -2132,6 +2133,7 @@ static void fill_error_info(ScriptError *error) ...@@ -2132,6 +2133,7 @@ static void fill_error_info(ScriptError *error)
error->number = info.scode; error->number = info.scode;
error->source = info.bstrSource; error->source = info.bstrSource;
error->desc = info.bstrDescription;
} }
static HRESULT WINAPI ScriptError_QueryInterface(IScriptError *iface, REFIID riid, void **ppv) static HRESULT WINAPI ScriptError_QueryInterface(IScriptError *iface, REFIID riid, void **ppv)
...@@ -2267,9 +2269,11 @@ static HRESULT WINAPI ScriptError_get_Description(IScriptError *iface, BSTR *pbs ...@@ -2267,9 +2269,11 @@ static HRESULT WINAPI ScriptError_get_Description(IScriptError *iface, BSTR *pbs
{ {
ScriptError *This = impl_from_IScriptError(iface); ScriptError *This = impl_from_IScriptError(iface);
FIXME("(%p)->(%p)\n", This, pbstrDescription); TRACE("(%p)->(%p)\n", This, pbstrDescription);
return E_NOTIMPL; fill_error_info(This);
*pbstrDescription = SysAllocString(This->desc);
return S_OK;
} }
static HRESULT WINAPI ScriptError_get_HelpFile(IScriptError *iface, BSTR *pbstrHelpFile) static HRESULT WINAPI ScriptError_get_HelpFile(IScriptError *iface, BSTR *pbstrHelpFile)
...@@ -2329,9 +2333,11 @@ static HRESULT WINAPI ScriptError_Clear(IScriptError *iface) ...@@ -2329,9 +2333,11 @@ static HRESULT WINAPI ScriptError_Clear(IScriptError *iface)
This->object = NULL; This->object = NULL;
} }
SysFreeString(This->source); SysFreeString(This->source);
SysFreeString(This->desc);
This->number = 0; This->number = 0;
This->source = NULL; This->source = NULL;
This->desc = NULL;
This->info_filled = FALSE; This->info_filled = FALSE;
return S_OK; return S_OK;
......
...@@ -3339,6 +3339,9 @@ static void test_IScriptControl_get_Error(void) ...@@ -3339,6 +3339,9 @@ static void test_IScriptControl_get_Error(void)
hr = IScriptError_get_Source(error, &str); hr = IScriptError_get_Source(error, &str);
ok(hr == S_OK, "IScriptError_get_Source failed: 0x%08x.\n", hr); ok(hr == S_OK, "IScriptError_get_Source failed: 0x%08x.\n", hr);
ok(str == NULL, "Error Source is not (null), got %s.\n", wine_dbgstr_w(str)); ok(str == NULL, "Error Source is not (null), got %s.\n", wine_dbgstr_w(str));
hr = IScriptError_get_Description(error, &str);
ok(hr == S_OK, "IScriptError_get_Description failed: 0x%08x.\n", hr);
ok(str == NULL, "Error Description is not (null), got %s.\n", wine_dbgstr_w(str));
str = SysAllocString(L"jscript"); str = SysAllocString(L"jscript");
hr = IScriptControl_put_Language(sc, str); hr = IScriptControl_put_Language(sc, str);
...@@ -3361,6 +3364,10 @@ static void test_IScriptControl_get_Error(void) ...@@ -3361,6 +3364,10 @@ static void test_IScriptControl_get_Error(void)
ok(hr == S_OK, "IScriptError_get_Source failed: 0x%08x.\n", hr); ok(hr == S_OK, "IScriptError_get_Source failed: 0x%08x.\n", hr);
ok(str != NULL, "Error Source is (null).\n"); ok(str != NULL, "Error Source is (null).\n");
SysFreeString(str); SysFreeString(str);
hr = IScriptError_get_Description(error, &str);
ok(hr == S_OK, "IScriptError_get_Description failed: 0x%08x.\n", hr);
ok(str != NULL, "Error Description is (null).\n");
SysFreeString(str);
hr = IScriptError_Clear(error); hr = IScriptError_Clear(error);
ok(hr == S_OK, "IScriptError_Clear failed: 0x%08x.\n", hr); ok(hr == S_OK, "IScriptError_Clear failed: 0x%08x.\n", hr);
...@@ -3371,6 +3378,9 @@ static void test_IScriptControl_get_Error(void) ...@@ -3371,6 +3378,9 @@ static void test_IScriptControl_get_Error(void)
hr = IScriptError_get_Source(error, &str); hr = IScriptError_get_Source(error, &str);
ok(hr == S_OK, "IScriptError_get_Source failed: 0x%08x.\n", hr); ok(hr == S_OK, "IScriptError_get_Source failed: 0x%08x.\n", hr);
ok(str == NULL, "Error Source is not (null), got %s.\n", wine_dbgstr_w(str)); ok(str == NULL, "Error Source is not (null), got %s.\n", wine_dbgstr_w(str));
hr = IScriptError_get_Description(error, &str);
ok(hr == S_OK, "IScriptError_get_Description failed: 0x%08x.\n", hr);
ok(str == NULL, "Error Description is not (null), got %s.\n", wine_dbgstr_w(str));
hr = IScriptControl_get_Error(sc, &error2); hr = IScriptControl_get_Error(sc, &error2);
ok(hr == S_OK, "IScriptControl_get_Error failed: 0x%08x.\n", hr); ok(hr == S_OK, "IScriptControl_get_Error failed: 0x%08x.\n", hr);
...@@ -3424,6 +3434,9 @@ static void test_IScriptControl_get_Error(void) ...@@ -3424,6 +3434,9 @@ static void test_IScriptControl_get_Error(void)
hr = IScriptError_get_Source(error, &str); hr = IScriptError_get_Source(error, &str);
ok(hr == S_OK, "IScriptError_get_Source failed: 0x%08x.\n", hr); ok(hr == S_OK, "IScriptError_get_Source failed: 0x%08x.\n", hr);
ok(str == NULL, "Error Source is not (null), got %s.\n", wine_dbgstr_w(str)); ok(str == NULL, "Error Source is not (null), got %s.\n", wine_dbgstr_w(str));
hr = IScriptError_get_Description(error, &str);
ok(hr == S_OK, "IScriptError_get_Description failed: 0x%08x.\n", hr);
ok(str == NULL, "Error Description is not (null), got %s.\n", wine_dbgstr_w(str));
SET_EXPECT(GetSourceLineText); SET_EXPECT(GetSourceLineText);
hr = IScriptError_get_Text(error, &str); hr = IScriptError_get_Text(error, &str);
...@@ -3456,8 +3469,9 @@ static void test_IScriptControl_get_Error(void) ...@@ -3456,8 +3469,9 @@ static void test_IScriptControl_get_Error(void)
ok(!lstrcmpW(str, L"foobar"), "Error Source is wrong, got %s.\n", wine_dbgstr_w(str)); ok(!lstrcmpW(str, L"foobar"), "Error Source is wrong, got %s.\n", wine_dbgstr_w(str));
SysFreeString(str); SysFreeString(str);
hr = IScriptError_get_Description(error, &str); hr = IScriptError_get_Description(error, &str);
todo_wine ok(hr == S_OK, "IScriptError_get_Description failed: 0x%08x.\n", hr); ok(hr == S_OK, "IScriptError_get_Description failed: 0x%08x.\n", hr);
if (SUCCEEDED(hr)) SysFreeString(str); ok(!lstrcmpW(str, L"barfoo"), "Error Description is wrong, got %s.\n", wine_dbgstr_w(str));
SysFreeString(str);
SET_EXPECT(GetSourceLineText); SET_EXPECT(GetSourceLineText);
hr = IScriptError_get_Text(error, &str); hr = IScriptError_get_Text(error, &str);
...@@ -3490,8 +3504,8 @@ static void test_IScriptControl_get_Error(void) ...@@ -3490,8 +3504,8 @@ static void test_IScriptControl_get_Error(void)
ok(!lstrcmpW(str, L"source"), "Error Source is wrong, got %s.\n", wine_dbgstr_w(str)); ok(!lstrcmpW(str, L"source"), "Error Source is wrong, got %s.\n", wine_dbgstr_w(str));
SysFreeString(str); SysFreeString(str);
hr = IScriptError_get_Description(error, &str); hr = IScriptError_get_Description(error, &str);
todo_wine ok(hr == S_OK, "IScriptError_get_Description failed: 0x%08x.\n", hr); ok(hr == S_OK, "IScriptError_get_Description failed: 0x%08x.\n", hr);
if (SUCCEEDED(hr)) SysFreeString(str); ok(str == NULL, "Error Description is not (null), got %s.\n", wine_dbgstr_w(str));
SET_EXPECT(GetSourceLineText); SET_EXPECT(GetSourceLineText);
hr = IScriptError_get_Text(error, &str); hr = IScriptError_get_Text(error, &str);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment