diff --git a/dlls/mshtml/olecmd.c b/dlls/mshtml/olecmd.c
index 941731177f..5916010767 100644
--- a/dlls/mshtml/olecmd.c
+++ b/dlls/mshtml/olecmd.c
@@ -546,6 +546,12 @@ static HRESULT exec_get_print_template(HTMLDocument *This, DWORD nCmdexecopt, VA
return E_NOTIMPL;
}
+static HRESULT exec_optical_zoom(HTMLDocument *This, DWORD nCmdexecopt, VARIANT *pvaIn, VARIANT *pvaOut)
+{
+ FIXME("(%p)->(%d %p %p)\n", This, nCmdexecopt, pvaIn, pvaOut);
+ return E_NOTIMPL;
+}
+
static HRESULT query_mshtml_copy(HTMLDocument *This, OLECMD *cmd)
{
FIXME("(%p)\n", This);
@@ -695,7 +701,7 @@ static HRESULT query_enabled_stub(HTMLDocument *This, OLECMD *cmd)
static const struct {
OLECMDF cmdf;
HRESULT (*func)(HTMLDocument*,DWORD,VARIANT*,VARIANT*);
-} exec_table[OLECMDID_GETPRINTTEMPLATE+1] = {
+} exec_table[] = {
{0},
{ OLECMDF_SUPPORTED, exec_open }, /* OLECMDID_OPEN */
{ OLECMDF_SUPPORTED, exec_new }, /* OLECMDID_NEW */
@@ -735,7 +741,9 @@ static const struct {
{ OLECMDF_SUPPORTED, exec_close }, /* OLECMDID_CLOSE */
{0},{0},{0},
{ OLECMDF_SUPPORTED, exec_set_print_template }, /* OLECMDID_SETPRINTTEMPLATE */
- { OLECMDF_SUPPORTED, exec_get_print_template } /* OLECMDID_GETPRINTTEMPLATE */
+ { OLECMDF_SUPPORTED, exec_get_print_template }, /* OLECMDID_GETPRINTTEMPLATE */
+ {0},{0},{0},{0},{0},{0},{0},{0},{0},{0},
+ { 0, /* not reported as supported */ exec_optical_zoom } /* OLECMDID_OPTICAL_ZOOM */
};
static const cmdtable_t base_cmds[] = {
@@ -874,7 +882,7 @@ static HRESULT WINAPI OleCommandTarget_Exec(IOleCommandTarget *iface, const GUID
HTMLDocument *This = impl_from_IOleCommandTarget(iface);
if(!pguidCmdGroup) {
- if(nCmdIDOLECMDID_GETPRINTTEMPLATE || !exec_table[nCmdID].func) {
+ if(nCmdID < OLECMDID_OPEN || nCmdID >= sizeof(exec_table)/sizeof(*exec_table) || !exec_table[nCmdID].func) {
WARN("Unsupported cmdID = %d\n", nCmdID);
return OLECMDERR_E_NOTSUPPORTED;
}
diff --git a/dlls/mshtml/tests/htmldoc.c b/dlls/mshtml/tests/htmldoc.c
index ace3128402..16d6b45861 100644
--- a/dlls/mshtml/tests/htmldoc.c
+++ b/dlls/mshtml/tests/htmldoc.c
@@ -6292,7 +6292,7 @@ static void test_clear(IHTMLDocument2 *doc)
ok(hres == S_OK, "clear failed: %08x\n", hres);
}
-static const OLECMDF expect_cmds[OLECMDID_GETPRINTTEMPLATE+1] = {
+static const OLECMDF expect_cmds[] = {
0,
OLECMDF_SUPPORTED, /* OLECMDID_OPEN */
OLECMDF_SUPPORTED, /* OLECMDID_NEW */
@@ -6347,7 +6347,7 @@ static void _test_QueryStatus(unsigned line, IUnknown *unk, REFIID cgid, ULONG c
return;
hres = IOleCommandTarget_QueryStatus(cmdtrg, cgid, 1, &olecmd, NULL);
- ok(hres == S_OK, "QueryStatus(%u) failed: %08x\n", cmdid, hres);
+ ok(hres == cmdf ? S_OK : OLECMDERR_E_NOTSUPPORTED, "QueryStatus(%u) failed: %08x\n", cmdid, hres);
IOleCommandTarget_Release(cmdtrg);
@@ -6380,7 +6380,7 @@ static void test_MSHTML_QueryStatus(IHTMLDocument2 *doc, DWORD cmdf)
static void test_OleCommandTarget(IHTMLDocument2 *doc)
{
IOleCommandTarget *cmdtrg;
- OLECMD cmds[OLECMDID_GETPRINTTEMPLATE];
+ OLECMD cmds[sizeof(expect_cmds)/sizeof(*expect_cmds)-1];
int i;
HRESULT hres;
@@ -6389,7 +6389,7 @@ static void test_OleCommandTarget(IHTMLDocument2 *doc)
if(FAILED(hres))
return;
- for(i=0; i