Update .editorconfig.

This commit is contained in:
Tyler Jaacks
2024-10-14 16:46:14 -05:00
parent 001450dc3e
commit 2b6b80fe71
2 changed files with 19 additions and 29 deletions

View File

@@ -99,4 +99,5 @@ resharper_cpp_clang_tidy_clang_diagnostic_microsoft_cast_highlighting = none
resharper_cpp_clang_tidy_clang_diagnostic_undefined_reinterpret_cast_highlighting = none
resharper_cpp_clang_tidy_clang_diagnostic_shadow_highlighting = none
resharper_cpp_clang_tidy_clang_diagnostic_cast_function_type_strict_highlighting = none
resharper_cpp_functional_style_cast_highlighting = none
resharper_cpp_functional_style_cast_highlighting = none
resharper_cpp_non_inline_variable_definition_in_header_file_highlighting = none

View File

@@ -12,15 +12,15 @@ inline bool IsClassName(HSTRING classId, const char* classIdName)
}
typedef HRESULT(*DllGetForCurrentThreadFunc) (ICoreWindowStatic*, CoreWindow**);
typedef HRESULT(*DllGetForCurrentThreadFunc_App) (ABI::Windows::ApplicationModel::Core::ICoreApplication*, winrt::Windows::ApplicationModel::Core::CoreApplication**);
typedef HRESULT(*DllGetForCurrentThreadFunc_App) (ICoreApplication*, winrt::Windows::ApplicationModel::Core::CoreApplication**);
typedef HRESULT(*DllGetActivationFactoryFunc) (HSTRING, IActivationFactory**);
DllGetForCurrentThreadFunc pDllGetForCurrentThread = nullptr;
DllGetForCurrentThreadFunc_App pDllGetForCurrentThread_App = nullptr;
DllGetActivationFactoryFunc pDllGetActivationFactory = nullptr;
HRESULT(STDMETHODCALLTYPE* TrueGetForCurrentThread_App)(ABI::Windows::ApplicationModel::Core::ICoreApplication* Iapplication,
winrt::Windows::ApplicationModel::Core::CoreApplication** Application);
// ReSharper disable once CppNonInlineVariableDefinitionInHeaderFile
HRESULT(STDMETHODCALLTYPE* TrueGetForCurrentThread_App)(ICoreApplication* application, winrt::Windows::ApplicationModel::Core::CoreApplication** Application);
HRESULT(STDMETHODCALLTYPE* TrueGetForCurrentThread)(ICoreWindowStatic* staticWindow, CoreWindow** window);
HRESULT(WINAPI* TrueRoGetActivationFactory)(HSTRING classId, REFIID iid, void** factory) = RoGetActivationFactory;
@@ -37,13 +37,12 @@ inline HRESULT STDMETHODCALLTYPE GetForCurrentThread_Hook(ICoreWindowStatic* par
return hr;
}
inline HRESULT STDMETHODCALLTYPE GetForCurrentThread_Hook_App(ABI::Windows::ApplicationModel::Core::ICoreApplication* paramThis,
inline HRESULT STDMETHODCALLTYPE GetForCurrentThreadApp_Hook(ICoreApplication* paramThis,
winrt::Windows::ApplicationModel::Core::CoreApplication** Application)
{
// ReSharper disable once CppLocalVariableMayBeConst
HRESULT hrApp = TrueGetForCurrentThread_App(paramThis, Application);
//*reinterpret_cast<void**>(Application) = new CoreApplicationX(*Application);
auto pApp = *reinterpret_cast<void**>(Application);
pApp = new CoreApplicationX(*Application);
@@ -71,39 +70,29 @@ inline HRESULT WINAPI RoGetActivationFactory_Hook(HSTRING classId, REFIID iid, v
ComPtr<IActivationFactory> _factory;
if (IsClassName(classId, "Windows.ApplicationModel.Core.CoreApplication"))
{
ComPtr<ABI::Windows::ApplicationModel::Core::ICoreApplication> ICoreApplicationPtr;
if (IsClassName(classId, "Windows.UI.Core.CoreWindow"))
hr = RoGetActivationFactory(HStringReference(RuntimeClass_Windows_ApplicationModel_Core_CoreApplication).Get(), IID_PPV_ARGS(&ICoreApplicationPtr));
*reinterpret_cast<void**>(&TrueGetForCurrentThread_App) = (*reinterpret_cast<void***>(ICoreApplicationPtr.Get()))[ 6 ];
DetourAttach(&TrueGetForCurrentThread_App, GetForCurrentThreadApp_Hook);
}
else if (IsClassName(classId, "Windows.UI.Core.CoreWindow"))
{
ComPtr<ICoreWindowStatic> coreWindowStatic;
hr = RoGetActivationFactory(HStringReference(RuntimeClass_Windows_UI_Core_CoreWindow).Get( ), IID_PPV_ARGS(&coreWindowStatic));
hr = RoGetActivationFactory(HStringReference(RuntimeClass_Windows_UI_Core_CoreWindow).Get(), IID_PPV_ARGS(&coreWindowStatic));
*reinterpret_cast<void**>(&TrueGetForCurrentThread) = (*reinterpret_cast<void***>(coreWindowStatic.Get( )))[ 6 ];
*reinterpret_cast<void**>(&TrueGetForCurrentThread) = (*reinterpret_cast<void***>(coreWindowStatic.Get()))[ 6 ];
DetourAttach(&TrueGetForCurrentThread, GetForCurrentThread_Hook);
}
else
{
hr = pDllGetActivationFactory(classId, _factory.GetAddressOf( ));
}
if (FAILED(hr)) return hr;
return _factory.CopyTo(iid, factory);
if (IsClassName(classId, "Windows.ApplicationModel.Core.CoreApplication"))
{
ComPtr<ABI::Windows::ApplicationModel::Core::ICoreApplication> ICoreApplicationPtr;
hr = RoGetActivationFactory(HStringReference(RuntimeClass_Windows_ApplicationModel_Core_CoreApplication).Get( ), IID_PPV_ARGS(&ICoreApplicationPtr));
*reinterpret_cast<void**>(&TrueGetForCurrentThread_App) = (*reinterpret_cast<void***>(ICoreApplicationPtr.Get( )))[ 6 ];
DetourAttach(&TrueGetForCurrentThread_App, GetForCurrentThread_Hook_App);
}
else
{
hr = pDllGetActivationFactory(classId, _factory.GetAddressOf( ));
hr = pDllGetActivationFactory(classId, _factory.GetAddressOf());
}
if (FAILED(hr)) return hr;