mirror of
https://github.com/WinDurango/WinDurango.git
synced 2026-01-07 11:49:45 -06:00
This commit introduces logging statements to `QueryInterface` methods for better debugging of requested IIDs. New classes `MMDeviceCollectionWrapper` and `MMDeviceWrapper` are added to wrap existing COM interfaces, enhancing reference counting and interface querying. Additional logging is implemented in `dllmain.cpp` for specific game packages, particularly "Happy Dungeons." The `hooks.h` file is updated with detailed logging for various hooked functions to trace execution flow. New methods in the `Windows.Xbox.Multiplayer` namespace, including `Party`, `PartyChat`, and `PartyConfig`, provide multiplayer functionalities with logging for method invocations. Project files are updated to include these new classes, ensuring they are part of the build process. Overall, these changes improve debugging capabilities and introduce new device management and multiplayer features.
182 lines
5.1 KiB
C++
182 lines
5.1 KiB
C++
#include "pch.h"
|
|
#include "CoreApplicationWrapperX.h"
|
|
#include "FrameworkViewSourceWrapper.h"
|
|
using namespace ABI::Windows::ApplicationModel::Core;
|
|
|
|
HRESULT CoreApplicationWrapperX::GetIids(ULONG* iidCount, IID** iids)
|
|
{
|
|
printf("GetIids\n");
|
|
return m_realFactory->GetIids(iidCount, iids);
|
|
}
|
|
|
|
HRESULT CoreApplicationWrapperX::GetRuntimeClassName(HSTRING* className)
|
|
{
|
|
printf("GetRuntimeClassName\n");
|
|
return m_realFactory->GetRuntimeClassName(className);
|
|
}
|
|
|
|
HRESULT CoreApplicationWrapperX::GetTrustLevel(TrustLevel* trustLevel)
|
|
{
|
|
printf("GetTrustLevel\n");
|
|
return m_realFactory->GetTrustLevel(trustLevel);
|
|
}
|
|
|
|
INT32 CoreApplicationWrapperX::_abi_add_Resuming(__FIEventHandler_1_IInspectable* handler, EventRegistrationToken* token)
|
|
{
|
|
printf("_abi_add_Resuming\n");
|
|
//return m_realCoreApplication->add_Resuming(handler, token);
|
|
return S_OK;
|
|
}
|
|
|
|
INT32 CoreApplicationWrapperX::_abi_remove_Resuming(EventRegistrationToken token)
|
|
{
|
|
printf("_abi_remove_Resuming\n");
|
|
return m_realCoreApplication->remove_Resuming(token);
|
|
}
|
|
|
|
INT32 CoreApplicationWrapperX::_abi_add_Suspending(__FIEventHandler_1_Windows__CApplicationModel__CSuspendingEventArgs* handler, EventRegistrationToken* token)
|
|
{
|
|
printf("_abi_add_Suspending\n");
|
|
//return m_realCoreApplication->add_Suspending(handler, token);
|
|
return S_OK;
|
|
}
|
|
|
|
INT32 CoreApplicationWrapperX::_abi_remove_Suspending(EventRegistrationToken token)
|
|
{
|
|
printf("_abi_remove_Suspending\n");
|
|
return m_realCoreApplication->remove_Suspending(token);
|
|
}
|
|
|
|
HRESULT CoreApplicationWrapperX::_abi_get_ResourceAvailability(ResourceAvailability* resourceAvailability)
|
|
{
|
|
// TODO: Stubbed for now.
|
|
*resourceAvailability = ResourceAvailability_Full;
|
|
printf("_abi_get_ResourceAvailability\n");
|
|
return S_OK;
|
|
}
|
|
|
|
HRESULT CoreApplicationWrapperX::_abi_add_ResourceAvailabilityChanged(winrt::Windows::Foundation::EventHandler<IInspectable>* handler, EventRegistrationToken* token)
|
|
{
|
|
printf("_abi_add_ResourceAvailabilityChanged\n");
|
|
//Stubbed at this moment.
|
|
return 0;
|
|
}
|
|
|
|
HRESULT CoreApplicationWrapperX::_abi_remove_ResourceAvailabilityChanged(EventRegistrationToken token)
|
|
{
|
|
printf("_abi_remove_ResourceAvailabilityChanged\n");
|
|
//Stubbed at this moment.
|
|
return 0;
|
|
}
|
|
|
|
HRESULT CoreApplicationWrapperX::get_DisableKinectGpuReservation(bool* pOutValue)
|
|
{
|
|
*pOutValue = this->m_KinectGpuReservation;
|
|
return S_OK;
|
|
}
|
|
|
|
HRESULT CoreApplicationWrapperX::set_DisableKinectGpuReservation(bool value)
|
|
{
|
|
this->m_KinectGpuReservation = value;
|
|
return S_OK;
|
|
}
|
|
|
|
INT32 CoreApplicationWrapperX::_abi_GetCurrentView(ABI::Windows::ApplicationModel::Core::ICoreApplicationView** value)
|
|
{
|
|
printf("[CoreApplicationWrapperX] ---> _abi_GetCurrentView\n");
|
|
return m_realCoreApplication->GetCurrentView(value);
|
|
}
|
|
|
|
INT32 CoreApplicationWrapperX::_abi_Run(ABI::Windows::ApplicationModel::Core::IFrameworkViewSource* viewSource)
|
|
{
|
|
printf("_abi_Run\n");
|
|
|
|
// Wrap the ViewSource and pass it to the original function
|
|
FrameworkViewSourceWrapper* wrappedViewSource = new FrameworkViewSourceWrapper(viewSource);
|
|
return m_realCoreApplication->Run(wrappedViewSource);
|
|
}
|
|
|
|
INT32 CoreApplicationWrapperX::_abi_get_Id(HSTRING* value)
|
|
{
|
|
printf("_abi_get_Id\n");
|
|
return m_realCoreApplication->get_Id(value);
|
|
}
|
|
|
|
INT32 CoreApplicationWrapperX::_abi_get_Properties(ABI::Windows::Foundation::Collections::IPropertySet** value)
|
|
{
|
|
printf("_abi_get_Properties\n");
|
|
return m_realCoreApplication->get_Properties(value);
|
|
}
|
|
|
|
|
|
HRESULT CoreApplicationWrapperX::QueryInterface(const IID& riid, void** ppvObject)
|
|
{
|
|
LPOLESTR str = nullptr;
|
|
StringFromIID(riid, &str);
|
|
wprintf(L"CoreApplicationWrapperX [QI] IID Requested: %s\n", str);
|
|
CoTaskMemFree(str);
|
|
|
|
if (riid == __uuidof(IActivationFactory) || riid == __uuidof(IUnknown))
|
|
{
|
|
*ppvObject = static_cast<IActivationFactory*>(this);
|
|
AddRef();
|
|
return S_OK;
|
|
}
|
|
|
|
if (riid == __uuidof(ICoreApplicationX))
|
|
{
|
|
*ppvObject = static_cast<ICoreApplicationX*>(this);
|
|
AddRef();
|
|
return S_OK;
|
|
}
|
|
|
|
if (riid == __uuidof(ICoreApplicationResourceAvailabilityX)) // allow ICoreApplicationResourceAvailabilityX interface
|
|
{
|
|
*ppvObject = static_cast<ICoreApplicationResourceAvailabilityX*>(this);
|
|
AddRef();
|
|
return S_OK;
|
|
}
|
|
|
|
if (riid == __uuidof(ICoreApplicationGpuPolicy)) // allow ICoreApplicationResourceAvailabilityX interface
|
|
{
|
|
*ppvObject = static_cast<ICoreApplicationGpuPolicy*>(this);
|
|
AddRef();
|
|
return S_OK;
|
|
}
|
|
|
|
if (riid == __uuidof(ICoreApplicationExit)) {
|
|
printf("ICoreApplicationExit CALLED - GAME OVER BRO\n");
|
|
*ppvObject = this;
|
|
AddRef();
|
|
return S_OK;
|
|
}
|
|
|
|
// DEBUG
|
|
HRESULT hr = m_realFactory->QueryInterface(riid, ppvObject);
|
|
if(FAILED(hr))
|
|
{
|
|
char iidstr[sizeof("{AAAAAAAA-BBBB-CCCC-DDEE-FFGGHHIIJJKK}")];
|
|
OLECHAR iidwstr[sizeof(iidstr)];
|
|
StringFromGUID2(riid, iidwstr, ARRAYSIZE(iidwstr));
|
|
WideCharToMultiByte(CP_UTF8, 0, iidwstr, -1, iidstr, sizeof(iidstr), nullptr, nullptr);
|
|
MessageBoxA(nullptr, iidstr, typeid(*this).name(), MB_OK);
|
|
}
|
|
|
|
*ppvObject = nullptr;
|
|
return E_NOINTERFACE;
|
|
}
|
|
|
|
ULONG CoreApplicationWrapperX::AddRef()
|
|
{
|
|
return InterlockedIncrement(&m_RefCount);
|
|
}
|
|
|
|
ULONG CoreApplicationWrapperX::Release()
|
|
{
|
|
ULONG refCount = InterlockedDecrement(&m_RefCount);
|
|
if (refCount == 0)
|
|
delete this;
|
|
return refCount;
|
|
}
|
|
|