MzCom: repairs for some Windows configurations

Registration of the typelib seems to be required on some modern
configurations, and myssink must claim to not implement
INoMarshal.
This commit is contained in:
Matthew Flatt 2018-06-19 13:22:03 -06:00
parent ff867155d1
commit d72ccb521d
3 changed files with 19 additions and 4 deletions

View File

@ -86,7 +86,6 @@
(test (void) (com-unregister-event-callback mzcom "SchemeError"))
(test (void) ((sync exec)))
(test #t (regexp-match? #rx"bad" recved))
(test #f (com-iunknown? mzcom))
(test #t (com-iunknown? (com-object-get-iunknown mzcom)))
(test #t (com-iunknown? (com-object-get-idispatch mzcom)))
@ -116,7 +115,6 @@
(and (regexp-match #rx"released" (exn-message exn))
'no))])
(com-invoke mzcom2 "About"))))
(define ie (com-create-instance "InternetExplorer.Application.1"))
(test #t (and (member "Visible" (com-get-properties ie)) #t))
(test #t (and (member "Visible" (com-set-properties ie)) #t))
@ -133,7 +131,7 @@
(define doc (com-get-property ie "Document"))
(test #t (com-object? doc))
(test "The Racket Language" (com-get-property ie "Document" "title"))
(test "Racket" (com-get-property ie "Document" "title"))
(test (void) (com-set-property! ie "Document" "title" "The Racket Documentation"))
(test "The Racket Documentation" (com-get-property ie "Document" "title"))
(test '(-> () string) #:alts '((-> () any)) (com-get-property-type doc "title"))

View File

@ -174,7 +174,13 @@ HRESULT CSink::InternalQueryInterface(void *pThis,
}
}
// Use IUnknown pointer for IUnknown, ISink, and the outbound interface
/* Don't claim to implement INoMarshal, because that disables
the sink for some uses, including with MzCOM */
if (riid == IID_INoMarshal) {
return E_NOINTERFACE;
}
// Use IUnknown pointer for IUnknown, ISink, and anything else (which we assume to be the outbound interface)
return CComObjectRootEx<CComSingleThreadModel>::InternalQueryInterface(pThis,pEntries,IID_IUnknown,ppVoid);

View File

@ -247,6 +247,17 @@ extern "C" int WINAPI WinMain(HINSTANCE hInstance,
nRet |= RegCloseKey(sub);
}
if (!nRet) {
ITypeLib *typelib;
wchar_t *path;
path = (wchar_t *)malloc(1024 * sizeof(wchar_t));
GetModuleFileNameW(NULL, path, 1024);
nRet = LoadTypeLibEx(path, REGKIND_REGISTER, &typelib);
if (!nRet)
typelib->Release();
free(path);
}
bRun = FALSE;
}
}