diff --git a/apps/WinDurango/WinDurango/WinDurango.csproj b/apps/WinDurango/WinDurango/WinDurango.csproj index 4ff65ae..4b142d3 100644 --- a/apps/WinDurango/WinDurango/WinDurango.csproj +++ b/apps/WinDurango/WinDurango/WinDurango.csproj @@ -1,19 +1,20 @@ - WinExe - net8.0-windows10.0.19041.0 - 10.0.17763.0 - WinDurango - app.manifest - x86;x64;ARM64 - win-x86;win-x64;win-arm64 - win10-x86;win10-x64;win10-arm64 - true + WinExe + net8.0-windows10.0.19041.0 + 10.0.17763.0 + WinDurango + app.manifest + x86;x64;ARM64 + win-x86;win-x64;win-arm64 + win10-x86;win10-x64;win10-arm64 + true + true - - - + + + \ No newline at end of file diff --git a/dlls/kernelx/dllmain.cpp b/dlls/kernelx/dllmain.cpp index 97a6387..e094201 100644 --- a/dlls/kernelx/dllmain.cpp +++ b/dlls/kernelx/dllmain.cpp @@ -16,48 +16,48 @@ HRESULT WINAPI RoGetActivationFactory_Hook(HSTRING classId, REFIID iid, void** f const std::wstring message = std::wstring(L"classId: ") + WindowsGetStringRawBuffer(classId, nullptr); - if (FAILED(hr)) - { + if (FAILED(hr)) + { MessageBox(nullptr, message.c_str(), L"RoGetActivationFactory Failed", MB_OK); - auto library = LoadLibraryW(L"winrt_x.dll"); + auto library = LoadLibraryW(L"winrt_x.dll"); GetActivationFactory pGetActivationFactory = reinterpret_cast(GetProcAddress( (HMODULE)library, "GetActivationFactory_X")); - Microsoft::WRL::ComPtr _factory{}; + Microsoft::WRL::ComPtr _factory{}; - auto b = _factory.GetAddressOf(); + auto b = _factory.GetAddressOf(); - hr = pGetActivationFactory(classId, _factory.GetAddressOf()); - } - else - { + hr = pGetActivationFactory(classId, _factory.GetAddressOf()); + } + else + { MessageBox(nullptr, message.c_str(), L"RoGetActivationFactory Success", MB_OK); - } + } - return hr; + return hr; } BOOL WINAPI DllMain(HINSTANCE hInstance, DWORD dwReason, LPVOID reserved) { - if (DetourIsHelperProcess()) return TRUE; + if (DetourIsHelperProcess()) return TRUE; - if (dwReason == DLL_PROCESS_ATTACH) - { - DetourRestoreAfterWith(); - DetourTransactionBegin(); - DetourUpdateThread(GetCurrentThread()); - DetourAttach(&reinterpret_cast(TrueRoGetActivationFactory), RoGetActivationFactory_Hook); - DetourTransactionCommit(); - } - else if (dwReason == DLL_PROCESS_DETACH) - { - DetourTransactionBegin(); + if (dwReason == DLL_PROCESS_ATTACH) + { + DetourRestoreAfterWith(); + DetourTransactionBegin(); DetourUpdateThread(GetCurrentThread()); - DetourDetach(&reinterpret_cast(TrueRoGetActivationFactory), RoGetActivationFactory_Hook); - DetourTransactionCommit(); - } + DetourAttach(&reinterpret_cast(TrueRoGetActivationFactory), RoGetActivationFactory_Hook); + DetourTransactionCommit(); + } + else if (dwReason == DLL_PROCESS_DETACH) + { + DetourTransactionBegin(); + DetourUpdateThread(GetCurrentThread()); + DetourDetach(&reinterpret_cast(TrueRoGetActivationFactory), RoGetActivationFactory_Hook); + DetourTransactionCommit(); + } - return TRUE; + return TRUE; } diff --git a/dlls/winrt_x/Windows.Xbox/Windows.Xbox.Achievement.AchievementNotifier.h b/dlls/winrt_x/Windows.Xbox/Windows.Xbox.Achievement.AchievementNotifier.h new file mode 100644 index 0000000..a0a0cf8 --- /dev/null +++ b/dlls/winrt_x/Windows.Xbox/Windows.Xbox.Achievement.AchievementNotifier.h @@ -0,0 +1,36 @@ +// ReSharper disable CppClangTidyClangDiagnosticLanguageExtensionToken +// ReSharper disable CppInconsistentNaming +#pragma once + +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include + +#include "Windows.Xbox.h" +#include "Windows.Xbox.Shell.Social.h" +#include "Windows.Xbox.System.h" + +namespace Windows { + namespace Xbox { + namespace Achievements { + MIDL_INTERFACE("DE87AD07-75DC-4EEC-9226-5628E98B9914") + IXboxAchievementNotifier : public IInspectable + { + // TODO: Maybe we generate these I'm an idiot so IDK. + }; + + constexpr PCWSTR RuntimeClass_XboxAchievementNotifier = L"Microsoft.Xbox.Achievement.AchievementNotifier"; + inline const __declspec(selectany) auto& IID_IXboxAchievementNotifier = __uuidof(IXboxAchievementNotifier); + } + } +} + diff --git a/dlls/winrt_x/Windows.Xbox/Windows.Xbox.Shell.Social.h b/dlls/winrt_x/Windows.Xbox/Windows.Xbox.Shell.Social.h new file mode 100644 index 0000000..73b4b86 --- /dev/null +++ b/dlls/winrt_x/Windows.Xbox/Windows.Xbox.Shell.Social.h @@ -0,0 +1 @@ +#pragma once diff --git a/dlls/winrt_x/Windows.Xbox/Windows.Xbox.System.h b/dlls/winrt_x/Windows.Xbox/Windows.Xbox.System.h new file mode 100644 index 0000000..73b4b86 --- /dev/null +++ b/dlls/winrt_x/Windows.Xbox/Windows.Xbox.System.h @@ -0,0 +1 @@ +#pragma once diff --git a/dlls/winrt_x/Windows.Xbox/Windows.Xbox.h b/dlls/winrt_x/Windows.Xbox/Windows.Xbox.h new file mode 100644 index 0000000..5f28270 --- /dev/null +++ b/dlls/winrt_x/Windows.Xbox/Windows.Xbox.h @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/dlls/winrt_x/winrt_x.cpp b/dlls/winrt_x/winrt_x.cpp index 5d098bc..0b2d68a 100644 --- a/dlls/winrt_x/winrt_x.cpp +++ b/dlls/winrt_x/winrt_x.cpp @@ -1,16 +1,41 @@ // ReSharper disable CppInconsistentNaming #include "pch.h" +#include +#include + +#include "Windows.Xbox/Windows.Xbox.Achievement.AchievementNotifier.h" + HRESULT GetActivationFactory_X(HSTRING classId, IActivationFactory** factory) { - /* - switch (classId) + const std::wstring classIdStr = WindowsGetStringRawBuffer(classId, nullptr); + + if (wcscmp(classIdStr.c_str(), L"Windows.Xbox.Achievement.AchievementNotifier") == 0) { - case "Windows.Xbox.Achievements.AchievementNotifier": - default: - break; + Windows::Xbox::Achievements::IXboxAchievementNotifier* pXboxAchievementNotifier = nullptr; + + + HSTRING hStrRuntimeClass = nullptr; + HSTRING_HEADER hStrHeader = { nullptr }; + + + // TODO: Not sure if we need this. + auto hr = RoInitialize(RO_INIT_SINGLETHREADED); + + if (hr != S_OK()) + return hr; + + hr = WindowsCreateStringReference( + Windows::Xbox::Achievements::RuntimeClass_XboxAchievementNotifier, + static_cast(wcslen(Windows::Xbox::Achievements::RuntimeClass_XboxAchievementNotifier)), + &hStrHeader, + &hStrRuntimeClass); + + if (hr != S_OK()) + return hr; + + hr = RoGetActivationFactory(hStrRuntimeClass, Windows::Xbox::Achievements::IID_IXboxAchievementNotifier, reinterpret_cast(&pXboxAchievementNotifier)); } - */ return S_OK; } diff --git a/dlls/winrt_x/winrt_x.vcxproj b/dlls/winrt_x/winrt_x.vcxproj index c08c0f6..bfb0157 100644 --- a/dlls/winrt_x/winrt_x.vcxproj +++ b/dlls/winrt_x/winrt_x.vcxproj @@ -73,15 +73,19 @@ winrt_x + D:\Desktop\WinDurango\dlls\winrt_x\idl;$(IncludePath) winrtx + D:\Desktop\WinDurango\dlls\winrt_x\idl;$(IncludePath) winrtx + D:\Desktop\WinDurango\dlls\winrt_x\idl;$(IncludePath) winrtx + D:\Desktop\WinDurango\dlls\winrt_x\idl;$(IncludePath) @@ -158,6 +162,10 @@ + + + + @@ -175,9 +183,29 @@ - - true - + + + + + + + + + + + + + + + + + + + + + + + diff --git a/dlls/winrt_x/winrt_x.vcxproj.filters b/dlls/winrt_x/winrt_x.vcxproj.filters index c175dbf..b0c9100 100644 --- a/dlls/winrt_x/winrt_x.vcxproj.filters +++ b/dlls/winrt_x/winrt_x.vcxproj.filters @@ -24,6 +24,18 @@ Header Files + + Header Files + + + Header Files + + + Header Files + + + Header Files + @@ -46,5 +58,71 @@ Source Files + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + \ No newline at end of file