Gabriel Ivăncescu : msscript.ocx: Implement IActiveScriptSiteWindow::GetWindow.
Alexandre Julliard
julliard at winehq.org
Fri Sep 4 15:47:32 CDT 2020
Module: wine
Branch: master
Commit: c57e2de626a59f395fa7ab786e6aaaa5f13bec4d
URL: https://source.winehq.org/git/wine.git/?a=commit;h=c57e2de626a59f395fa7ab786e6aaaa5f13bec4d
Author: Gabriel Ivăncescu <gabrielopcode at gmail.com>
Date: Thu Sep 3 17:50:24 2020 +0300
msscript.ocx: Implement IActiveScriptSiteWindow::GetWindow.
Signed-off-by: Gabriel Ivăncescu <gabrielopcode at gmail.com>
Signed-off-by: Jacek Caban <jacek at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
---
dlls/msscript.ocx/msscript.c | 14 ++++++++++++--
dlls/msscript.ocx/tests/msscript.c | 24 ++++++++++++------------
2 files changed, 24 insertions(+), 14 deletions(-)
diff --git a/dlls/msscript.ocx/msscript.c b/dlls/msscript.ocx/msscript.c
index 845d501814..a61763458b 100644
--- a/dlls/msscript.ocx/msscript.c
+++ b/dlls/msscript.ocx/msscript.c
@@ -147,6 +147,7 @@ struct ScriptHost {
IActiveScript *script;
IActiveScriptParse *parse;
ScriptError *error;
+ HWND site_hwnd;
SCRIPTSTATE script_state;
CLSID clsid;
@@ -761,9 +762,13 @@ static HRESULT WINAPI ActiveScriptSiteWindow_GetWindow(IActiveScriptSiteWindow *
{
ScriptHost *This = impl_from_IActiveScriptSiteWindow(iface);
- FIXME("(%p, %p)\n", This, hwnd);
+ TRACE("(%p, %p)\n", This, hwnd);
- return E_NOTIMPL;
+ if (!hwnd) return E_POINTER;
+ if (This->site_hwnd == ((HWND)-1)) return E_FAIL;
+
+ *hwnd = This->site_hwnd;
+ return S_OK;
}
static HRESULT WINAPI ActiveScriptSiteWindow_EnableModeless(IActiveScriptSiteWindow *iface, BOOL enable)
@@ -2481,6 +2486,7 @@ static HRESULT init_script_host(ScriptControl *control, const CLSID *clsid, Scri
goto failed;
}
host->script_state = SCRIPTSTATE_INITIALIZED;
+ host->site_hwnd = control->allow_ui ? control->site_hwnd : ((HWND)-1);
host->error = control->error;
IScriptError_AddRef(&host->error->IScriptError_iface);
@@ -2758,6 +2764,8 @@ static HRESULT WINAPI ScriptControl_put_SitehWnd(IScriptControl *iface, LONG hwn
return CTL_E_INVALIDPROPERTYVALUE;
This->site_hwnd = LongToHandle(hwnd);
+ if (This->host)
+ This->host->site_hwnd = This->allow_ui ? This->site_hwnd : ((HWND)-1);
return S_OK;
}
@@ -2820,6 +2828,8 @@ static HRESULT WINAPI ScriptControl_put_AllowUI(IScriptControl *iface, VARIANT_B
TRACE("(%p)->(%x)\n", This, allow_ui);
This->allow_ui = allow_ui;
+ if (This->host)
+ This->host->site_hwnd = allow_ui ? This->site_hwnd : ((HWND)-1);
return S_OK;
}
diff --git a/dlls/msscript.ocx/tests/msscript.c b/dlls/msscript.ocx/tests/msscript.c
index 8e4fa1bfcf..2df85ffb40 100644
--- a/dlls/msscript.ocx/tests/msscript.c
+++ b/dlls/msscript.ocx/tests/msscript.c
@@ -1994,10 +1994,10 @@ static void test_SitehWnd(void)
window = NULL;
hr = IActiveScriptSiteWindow_GetWindow(site_window, NULL);
- todo_wine ok(hr == E_POINTER, "got 0x%08x\n", hr);
+ ok(hr == E_POINTER, "got 0x%08x\n", hr);
hr = IActiveScriptSiteWindow_GetWindow(site_window, &window);
- todo_wine ok(hr == S_OK, "got 0x%08x\n", hr);
- todo_wine ok(window == hwnd, "got %p, expected %p\n", window, hwnd);
+ ok(hr == S_OK, "got 0x%08x\n", hr);
+ ok(window == hwnd, "got %p, expected %p\n", window, hwnd);
hr = IActiveScriptSiteWindow_EnableModeless(site_window, FALSE);
todo_wine ok(hr == S_OK, "got 0x%08x\n", hr);
@@ -2013,8 +2013,8 @@ static void test_SitehWnd(void)
window = (HWND)0xdeadbeef;
hr = IActiveScriptSiteWindow_GetWindow(site_window, &window);
- todo_wine ok(hr == S_OK, "got 0x%08x\n", hr);
- todo_wine ok(!window, "got %p\n", window);
+ ok(hr == S_OK, "got 0x%08x\n", hr);
+ ok(!window, "got %p\n", window);
site_hwnd = 0;
hr = IScriptControl_put_SitehWnd(sc, (LONG)(LONG_PTR)hwnd);
@@ -2025,8 +2025,8 @@ static void test_SitehWnd(void)
window = NULL;
hr = IActiveScriptSiteWindow_GetWindow(site_window, &window);
- todo_wine ok(hr == S_OK, "got 0x%08x\n", hr);
- todo_wine ok(window == hwnd, "got %p, expected %p\n", window, hwnd);
+ ok(hr == S_OK, "got 0x%08x\n", hr);
+ ok(window == hwnd, "got %p, expected %p\n", window, hwnd);
hr = IScriptControl_put_AllowUI(sc, VARIANT_FALSE);
ok(hr == S_OK, "got 0x%08x\n", hr);
@@ -2037,7 +2037,7 @@ static void test_SitehWnd(void)
window = NULL;
hr = IActiveScriptSiteWindow_GetWindow(site_window, &window);
- todo_wine ok(hr == E_FAIL, "got 0x%08x\n", hr);
+ ok(hr == E_FAIL, "got 0x%08x\n", hr);
ok(!window, "got %p\n", window);
hr = IScriptControl_put_AllowUI(sc, VARIANT_TRUE);
@@ -2045,8 +2045,8 @@ static void test_SitehWnd(void)
window = NULL;
hr = IActiveScriptSiteWindow_GetWindow(site_window, &window);
- todo_wine ok(hr == S_OK, "got 0x%08x\n", hr);
- todo_wine ok(window == hwnd, "got %p, expected %p\n", window, hwnd);
+ ok(hr == S_OK, "got 0x%08x\n", hr);
+ ok(window == hwnd, "got %p, expected %p\n", window, hwnd);
IActiveScriptSite_Release(site);
@@ -2056,8 +2056,8 @@ static void test_SitehWnd(void)
window = NULL;
hr = IActiveScriptSiteWindow_GetWindow(site_window, &window);
- todo_wine ok(hr == S_OK, "got 0x%08x\n", hr);
- todo_wine ok(window == hwnd, "got %p, expected %p\n", window, hwnd);
+ ok(hr == S_OK, "got 0x%08x\n", hr);
+ ok(window == hwnd, "got %p, expected %p\n", window, hwnd);
IActiveScriptSiteWindow_Release(site_window);
}
More information about the wine-cvs
mailing list