https://git.reactos.org/?p=reactos.git;a=commitdiff;h=f2d34ab4c9532af5b22b0c56dc5eb882f1ae234e
commit f2d34ab4c9532af5b22b0c56dc5eb882f1ae234e Author: Katayama Hirofumi MZ <katayama.hirofumi...@gmail.com> AuthorDate: Sat Dec 23 11:02:40 2023 +0900 Commit: Katayama Hirofumi MZ <katayama.hirofumi...@gmail.com> CommitDate: Sat Dec 23 11:02:40 2023 +0900 [SDK] Add cicRealCoCreateInstance into <cicero/cicbase.h> It looks like Cicero wants to hook CoCreateInstance. CORE-19363 --- sdk/include/reactos/cicero/cicbase.h | 30 ++++++++++++++++++++---------- 1 file changed, 20 insertions(+), 10 deletions(-) diff --git a/sdk/include/reactos/cicero/cicbase.h b/sdk/include/reactos/cicero/cicbase.h index 805a8187d7b..6bf6a491e80 100644 --- a/sdk/include/reactos/cicero/cicbase.h +++ b/sdk/include/reactos/cicero/cicbase.h @@ -241,29 +241,20 @@ _cicGetSetUserCoCreateInstance(FN_CoCreateInstance fnUserCoCreateInstance) return s_fn; } -/** - * @implemented - */ static inline HRESULT -cicCoCreateInstance( +cicRealCoCreateInstance( REFCLSID rclsid, LPUNKNOWN pUnkOuter, DWORD dwClsContext, REFIID iid, LPVOID *ppv) { - FN_CoCreateInstance fnUserCoCreateInstance = _cicGetSetUserCoCreateInstance(NULL); - if (fnUserCoCreateInstance) - return fnUserCoCreateInstance(rclsid, pUnkOuter, dwClsContext, iid, ppv); - static HINSTANCE s_hOle32 = NULL; static FN_CoCreateInstance s_fnCoCreateInstance = NULL; if (!s_fnCoCreateInstance) { if (!s_hOle32) s_hOle32 = cicLoadSystemLibrary(L"ole32.dll", FALSE); - if (!s_hOle32) - return E_NOTIMPL; s_fnCoCreateInstance = (FN_CoCreateInstance)GetProcAddress(s_hOle32, "CoCreateInstance"); if (!s_fnCoCreateInstance) return E_NOTIMPL; @@ -272,6 +263,25 @@ cicCoCreateInstance( return s_fnCoCreateInstance(rclsid, pUnkOuter, dwClsContext, iid, ppv); } +/** + * @implemented + */ +static inline HRESULT +cicCoCreateInstance( + REFCLSID rclsid, + LPUNKNOWN pUnkOuter, + DWORD dwClsContext, + REFIID iid, + LPVOID *ppv) +{ + // NOTE: It looks like Cicero wants to hook CoCreateInstance + FN_CoCreateInstance fnUserCoCreateInstance = _cicGetSetUserCoCreateInstance(NULL); + if (fnUserCoCreateInstance) + return fnUserCoCreateInstance(rclsid, pUnkOuter, dwClsContext, iid, ppv); + + return cicRealCoCreateInstance(rclsid, pUnkOuter, dwClsContext, iid, ppv); +} + /** * @implemented */