Skip to content

Instantly share code, notes, and snippets.

using System;
using System.Runtime.InteropServices;
using System.Security;
using System.Security.Principal;
using Windows.Security.Cryptography.Certificates;
[StructLayout(LayoutKind.Sequential)]
unsafe readonly ref struct WTS_PROCESS_INFO
{
internal readonly int SessionId, ProcessId;
@Aetopia
Aetopia / Library.cpp
Last active July 25, 2025 13:01
Check for any pre-existing hooks.
#define INITGUID
#define COBJMACROS
#define WIDL_C_INLINE_WRAPPERS
#include <windows.h>
#include <MinHook.h>
#include <d3d11.h>
#include <winrt/base.h>
#include <winrt/Windows.UI.Core.h>
@Aetopia
Aetopia / Script.ps1
Last active March 30, 2025 17:56
Check if a machine has a license for Minecraft: Bedrock Edition.
using namespace System
using namespace Windows.Foundation
using namespace Windows.Globalization
using namespace System.Threading.Tasks
using namespace System.Web.Script.Serialization
using namespace Windows.ApplicationModel.Store.LicenseManagement
$Preference = $ProgressPreference
$ProgressPreference = 'SilentlyContinue'
#define INITGUID
#define COBJMACROS
#define _MINAPPMODEL_H_
#define WIDL_C_INLINE_WRAPPERS
#include <aclapi.h>
#include <shlwapi.h>
#include <userenv.h>
#include <appmodel.h>
#include <shobjidl.h>
using System;
using System.Collections.Generic;
static class Bubble
{
internal static void Sort(int[] value)
{
int[] collection = new int[value.Length];
value.CopyTo(collection, default);
@Aetopia
Aetopia / Game.Launch.Monitor.c
Created February 16, 2025 11:25
Attempts to monitor any launch of Minecraft: Bedrock Edition, latches & waits for the game to initailize.
#define _MINAPPMODEL_H_
#include <windows.h>
#include <appmodel.h>
#include <threadpoollegacyapiset.h>
#include <shlobj.h>
#include <shlwapi.h>
#include <userenv.h>
#include <sddl.h>
#include <stdio.h>
@Aetopia
Aetopia / Game.cpp
Last active February 14, 2025 08:11
Launch & wait for Minecraft Bedrock Edition to initialize.
#include <filesystem>
#include <initguid.h>
#include <windows.h>
#include <shobjidl.h>
#include <winrt/Windows.ApplicationModel.h>
#include <winrt/Windows.System.h>
#include <winrt/Windows.Foundation.Collections.h>
#include <winrt/Windows.Management.Core.h>
#include <winrt/Windows.Storage.h>
@Aetopia
Aetopia / Object.cpp
Created February 4, 2025 09:17
A simple C++ class that auto manages a COM pointer's lifetime + COM library initialization & uninitialization.
template <typename T> class Object
{
private:
com_ptr<T> Unknown;
public:
Object(guid const &value)
{
if (FAILED(CoGetContextToken(nullptr)))
init_apartment();
@Aetopia
Aetopia / WinMain.c
Created January 30, 2025 09:54
Get various app properties via "appmodel.h".
#define _MINAPPMODEL_H_
#include <windows.h>
#include <appmodel.h>
#include <tlhelp32.h>
#include <stdio.h>
VOID AppPolicyPrintClrCompat(HANDLE hToken)
{
PCSTR pBuffer = {};
AppPolicyClrCompat _ = {};
http://blogs.msdn.com/b/windowsappdev/archive/2012/09/04/automating-the-testing-of-windows-8-apps.aspx