Made some updates.

This commit is contained in:
Tyler Jaacks 2024-09-10 23:09:27 -05:00
parent 8f24021e0b
commit f4ff2a6d3a
9 changed files with 219 additions and 48 deletions

View File

@ -1,19 +1,20 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>WinExe</OutputType>
<TargetFramework>net8.0-windows10.0.19041.0</TargetFramework>
<TargetPlatformMinVersion>10.0.17763.0</TargetPlatformMinVersion>
<RootNamespace>WinDurango</RootNamespace>
<ApplicationManifest>app.manifest</ApplicationManifest>
<Platforms>x86;x64;ARM64</Platforms>
<RuntimeIdentifiers Condition="$([MSBuild]::GetTargetFrameworkVersion('$(TargetFramework)')) &gt;= 8">win-x86;win-x64;win-arm64</RuntimeIdentifiers>
<RuntimeIdentifiers Condition="$([MSBuild]::GetTargetFrameworkVersion('$(TargetFramework)')) &lt; 8">win10-x86;win10-x64;win10-arm64</RuntimeIdentifiers>
<UseWinUI>true</UseWinUI>
<OutputType>WinExe</OutputType>
<TargetFramework>net8.0-windows10.0.19041.0</TargetFramework>
<TargetPlatformMinVersion>10.0.17763.0</TargetPlatformMinVersion>
<RootNamespace>WinDurango</RootNamespace>
<ApplicationManifest>app.manifest</ApplicationManifest>
<Platforms>x86;x64;ARM64</Platforms>
<RuntimeIdentifiers Condition="$([MSBuild]::GetTargetFrameworkVersion('$(TargetFramework)')) &gt;= 8">win-x86;win-x64;win-arm64</RuntimeIdentifiers>
<RuntimeIdentifiers Condition="$([MSBuild]::GetTargetFrameworkVersion('$(TargetFramework)')) &lt; 8">win10-x86;win10-x64;win10-arm64</RuntimeIdentifiers>
<UseWinUI>true</UseWinUI>
<WindowsAppSDKSelfContained>true</WindowsAppSDKSelfContained>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.Windows.SDK.BuildTools" Version="10.0.22621.756" />
<PackageReference Include="Microsoft.WindowsAppSDK" Version="1.5.240802000" />
<Manifest Include="$(ApplicationManifest)" />
<PackageReference Include="Microsoft.Windows.SDK.BuildTools" Version="10.0.22621.756" />
<PackageReference Include="Microsoft.WindowsAppSDK" Version="1.5.240802000" />
<Manifest Include="$(ApplicationManifest)" />
</ItemGroup>
</Project>

View File

@ -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<GetActivationFactory>(GetProcAddress(
(HMODULE)library, "GetActivationFactory_X"));
Microsoft::WRL::ComPtr<IActivationFactory> _factory{};
Microsoft::WRL::ComPtr<IActivationFactory> _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<PVOID&>(TrueRoGetActivationFactory), RoGetActivationFactory_Hook);
DetourTransactionCommit();
}
else if (dwReason == DLL_PROCESS_DETACH)
{
DetourTransactionBegin();
if (dwReason == DLL_PROCESS_ATTACH)
{
DetourRestoreAfterWith();
DetourTransactionBegin();
DetourUpdateThread(GetCurrentThread());
DetourDetach(&reinterpret_cast<PVOID&>(TrueRoGetActivationFactory), RoGetActivationFactory_Hook);
DetourTransactionCommit();
}
DetourAttach(&reinterpret_cast<PVOID&>(TrueRoGetActivationFactory), RoGetActivationFactory_Hook);
DetourTransactionCommit();
}
else if (dwReason == DLL_PROCESS_DETACH)
{
DetourTransactionBegin();
DetourUpdateThread(GetCurrentThread());
DetourDetach(&reinterpret_cast<PVOID&>(TrueRoGetActivationFactory), RoGetActivationFactory_Hook);
DetourTransactionCommit();
}
return TRUE;
return TRUE;
}

View File

@ -0,0 +1,36 @@
// ReSharper disable CppClangTidyClangDiagnosticLanguageExtensionToken
// ReSharper disable CppInconsistentNaming
#pragma once
#include <cstdint>
#include <roapi.h>
#include <eventtoken.h>
#include <winstring.h>
#include <ole2.h>
#include <inspectable.h>
#include <asyncinfo.h>
#include <EventToken.h>
#include <WindowsContracts.h>
#include <windows.foundation.h>
#include <windows.system.h>
#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);
}
}
}

View File

@ -0,0 +1 @@
#pragma once

View File

@ -0,0 +1 @@
#pragma once

View File

@ -0,0 +1 @@


View File

@ -1,16 +1,41 @@
// ReSharper disable CppInconsistentNaming
#include "pch.h"
#include <string>
#include <WinString.h>
#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<UINT32>(wcslen(Windows::Xbox::Achievements::RuntimeClass_XboxAchievementNotifier)),
&hStrHeader,
&hStrRuntimeClass);
if (hr != S_OK())
return hr;
hr = RoGetActivationFactory(hStrRuntimeClass, Windows::Xbox::Achievements::IID_IXboxAchievementNotifier, reinterpret_cast<void**>(&pXboxAchievementNotifier));
}
*/
return S_OK;
}

View File

@ -73,15 +73,19 @@
<PropertyGroup Label="UserMacros" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<TargetName>winrt_x</TargetName>
<IncludePath>D:\Desktop\WinDurango\dlls\winrt_x\idl;$(IncludePath)</IncludePath>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<TargetName>winrtx</TargetName>
<IncludePath>D:\Desktop\WinDurango\dlls\winrt_x\idl;$(IncludePath)</IncludePath>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<TargetName>winrtx</TargetName>
<IncludePath>D:\Desktop\WinDurango\dlls\winrt_x\idl;$(IncludePath)</IncludePath>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<TargetName>winrtx</TargetName>
<IncludePath>D:\Desktop\WinDurango\dlls\winrt_x\idl;$(IncludePath)</IncludePath>
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ClCompile>
@ -158,6 +162,10 @@
<ItemGroup>
<ClInclude Include="framework.h" />
<ClInclude Include="pch.h" />
<ClInclude Include="Windows.Xbox\Windows.Xbox.Achievement.AchievementNotifier.h" />
<ClInclude Include="Windows.Xbox\Windows.Xbox.h" />
<ClInclude Include="Windows.Xbox\Windows.Xbox.Shell.Social.h" />
<ClInclude Include="Windows.Xbox\Windows.Xbox.System.h" />
<ClInclude Include="winrt_x.h" />
</ItemGroup>
<ItemGroup>
@ -175,9 +183,29 @@
<None Include="packages.config" />
</ItemGroup>
<ItemGroup>
<Midl Include="idl\Windows.Xbox.Achievements.idl">
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
</Midl>
<Midl Include="idl\Windows.Xbox.Achievements.idl" />
<Midl Include="idl\Windows.Xbox.Audio.idl" />
<Midl Include="idl\Windows.Xbox.Cab.Internal.idl" />
<Midl Include="idl\Windows.Xbox.Chat.Internal.idl" />
<Midl Include="idl\Windows.Xbox.CloudLanguageServices.idl" />
<Midl Include="idl\Windows.Xbox.Controls.NuiControl.idl" />
<Midl Include="idl\Windows.Xbox.Graphics.Display.idl" />
<Midl Include="idl\Windows.Xbox.Graphics.Display.Internal.idl" />
<Midl Include="idl\Windows.Xbox.idl" />
<Midl Include="idl\Windows.Xbox.Input.idl" />
<Midl Include="idl\Windows.Xbox.Internal.Networking.idl" />
<Midl Include="idl\Windows.Xbox.Management.Devices.idl" />
<Midl Include="idl\Windows.Xbox.Management.idl" />
<Midl Include="idl\Windows.Xbox.Management.Package.idl" />
<Midl Include="idl\Windows.Xbox.Media.idl" />
<Midl Include="idl\Windows.Xbox.Multiplayer.idl" />
<Midl Include="idl\Windows.Xbox.Multiplayer.Internal.idl" />
<Midl Include="idl\Windows.Xbox.Safety.Internal.idl" />
<Midl Include="idl\Windows.Xbox.Security.idl" />
<Midl Include="idl\Windows.Xbox.Services.idl" />
<Midl Include="idl\Windows.Xbox.Shell.idl" />
<Midl Include="idl\Windows.Xbox.Shell.Social.idl" />
<Midl Include="idl\Windows.Xbox.System.idl" />
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">

View File

@ -24,6 +24,18 @@
<ClInclude Include="pch.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="Windows.Xbox\Windows.Xbox.Achievement.AchievementNotifier.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="Windows.Xbox\Windows.Xbox.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="Windows.Xbox\Windows.Xbox.System.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="Windows.Xbox\Windows.Xbox.Shell.Social.h">
<Filter>Header Files</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<ClCompile Include="winrt_x.cpp">
@ -46,5 +58,71 @@
<Midl Include="idl\Windows.Xbox.Achievements.idl">
<Filter>Source Files</Filter>
</Midl>
<Midl Include="idl\Windows.Xbox.idl">
<Filter>Source Files</Filter>
</Midl>
<Midl Include="idl\Windows.Xbox.System.idl">
<Filter>Source Files</Filter>
</Midl>
<Midl Include="idl\Windows.Xbox.Input.idl">
<Filter>Source Files</Filter>
</Midl>
<Midl Include="idl\Windows.Xbox.Audio.idl">
<Filter>Source Files</Filter>
</Midl>
<Midl Include="idl\Windows.Xbox.Cab.Internal.idl">
<Filter>Source Files</Filter>
</Midl>
<Midl Include="idl\Windows.Xbox.Chat.Internal.idl">
<Filter>Source Files</Filter>
</Midl>
<Midl Include="idl\Windows.Xbox.CloudLanguageServices.idl">
<Filter>Source Files</Filter>
</Midl>
<Midl Include="idl\Windows.Xbox.Controls.NuiControl.idl">
<Filter>Source Files</Filter>
</Midl>
<Midl Include="idl\Windows.Xbox.Graphics.Display.idl">
<Filter>Source Files</Filter>
</Midl>
<Midl Include="idl\Windows.Xbox.Graphics.Display.Internal.idl">
<Filter>Source Files</Filter>
</Midl>
<Midl Include="idl\Windows.Xbox.Internal.Networking.idl">
<Filter>Source Files</Filter>
</Midl>
<Midl Include="idl\Windows.Xbox.Management.Devices.idl">
<Filter>Source Files</Filter>
</Midl>
<Midl Include="idl\Windows.Xbox.Management.idl">
<Filter>Source Files</Filter>
</Midl>
<Midl Include="idl\Windows.Xbox.Management.Package.idl">
<Filter>Source Files</Filter>
</Midl>
<Midl Include="idl\Windows.Xbox.Media.idl">
<Filter>Source Files</Filter>
</Midl>
<Midl Include="idl\Windows.Xbox.Multiplayer.idl">
<Filter>Source Files</Filter>
</Midl>
<Midl Include="idl\Windows.Xbox.Multiplayer.Internal.idl">
<Filter>Source Files</Filter>
</Midl>
<Midl Include="idl\Windows.Xbox.Safety.Internal.idl">
<Filter>Source Files</Filter>
</Midl>
<Midl Include="idl\Windows.Xbox.Security.idl">
<Filter>Source Files</Filter>
</Midl>
<Midl Include="idl\Windows.Xbox.Services.idl">
<Filter>Source Files</Filter>
</Midl>
<Midl Include="idl\Windows.Xbox.Shell.Social.idl">
<Filter>Source Files</Filter>
</Midl>
<Midl Include="idl\Windows.Xbox.Shell.idl">
<Filter>Source Files</Filter>
</Midl>
</ItemGroup>
</Project>