Skip to content

Instantly share code, notes, and snippets.

View ADeltaX's full-sized avatar

ADeltaX ADeltaX

View GitHub Profile
@ADeltaX
ADeltaX / main.cpp
Created June 18, 2021 11:46
DWM Thumbnail/VirtualDesktop USING Windows.UI.Composition
#include <Unknwn.h>
#include <Windows.h>
#include <wrl\implements.h>
#include <comutil.h>
#include <dcomp.h>
#include <dwmapi.h>
#include <dxgi1_3.h>
#include <d3d11_2.h>
#include <d2d1_2.h>
#include <d2d1_2helper.h>
@ADeltaX
ADeltaX / dispatcherqueue.cpp
Last active November 30, 2024 04:59
C++/WinRT snippet for creating or getting a DispatcherQueue (15063+)
#include <winrt/Windows.System.h>
winrt::Windows::System::DispatcherQueue CreateDispatcherQueue()
{
auto coreMsgLib = LoadLibrary(L"CoreMessaging.dll");
typedef HRESULT(WINAPI* CreateDispatcherQueueForCurrentThread)(
_Deref_out_ ABI::Windows::System::IDispatcherQueue** dispatcherQueueController);
auto pCreateDispatcherQueueForCurrentThread =
@ADeltaX
ADeltaX / MagicUnlock.reg
Created June 11, 2021 02:55
wincap? UWP? Yes.
Windows Registry Editor Version 5.00
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\SecurityManager]
"InternalDevUnlock"=dword:00000001
@ADeltaX
ADeltaX / dllmain.cpp
Created March 22, 2021 17:54
Example for accessing SetWindowBand function via dll injection via explorer.exe
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
#include <mutex>
//INSTALL DETOURS FROM NUGET! (or build from source yourself)
#include <detours.h>
//Definitions
typedef BOOL(WINAPI* SetWindowBand)(IN HWND hWnd, IN HWND hwndInsertAfter, IN DWORD dwBand);
typedef BOOL(WINAPI* NtUserEnableIAMAccess)(IN ULONG64 key, IN BOOL enable);
@ADeltaX
ADeltaX / main.cpp
Created March 22, 2021 15:38
DWM Thumbnail/VirtualDesktop IDCompositionVisual example
#include <Unknwn.h>
#include <Windows.h>
#include <ntstatus.h>
#include <winternl.h>
#include <wrl\implements.h>
#include <comutil.h>
#include <dcomp.h>
#include <dwmapi.h>
#include <dxgi1_3.h>
#include <d3d11_2.h>
@ADeltaX
ADeltaX / FeatureTokenGenerator.cs
Last active December 22, 2024 16:54
Access LimitedAccessFeatures from UWP
//!!!!!!!!!!!!!!
//Thanks to @thebookisclosed for the code. I just rearranged in a way so you can access without having to use the registry
//HINT about compatibility: they CANNOT change feature keys otherwise existing apps would break
using System;
using System.Collections.Generic;
using System.Linq;
using System.Security.Cryptography;
using System.Text;
using Windows.ApplicationModel;
@ADeltaX
ADeltaX / Program.cs
Created May 22, 2020 21:09
Change Theme color (Dark/Light mode) FAST!
using System;
using System.Runtime.InteropServices;
using Microsoft.Win32;
class Program
{
[DllImport("user32.dll", SetLastError = true)]
static extern bool SendNotifyMessage(IntPtr hWnd, uint Msg, UIntPtr wParam, string lParam);
static void Main(string[] args)
@ADeltaX
ADeltaX / Program.cs
Last active April 2, 2020 14:49
Hacky way to disable edge swipes (to restore them --> restart explorer.exe process)
using System;
using System.Runtime.InteropServices;
namespace ShutUpEdgeUI
{
class Program
{
[DllImport("user32.dll")]
public static extern bool GetClientRect(IntPtr hwnd, ref Rect rectangle);
@ADeltaX
ADeltaX / Program.cs
Last active March 13, 2020 13:36
DPI Reset - Temporarily sets DPI to first value
using System;
using System.Runtime.InteropServices;
class Program
{
[DllImport("user32.dll")]
static extern bool SystemParametersInfo(uint uiAction, uint uiParam, IntPtr pvParam, uint val);
static void Main() => SystemParametersInfo(0x009F, 0, IntPtr.Zero, 1);
}
@ADeltaX
ADeltaX / main.cpp
Last active September 24, 2024 12:49
Example of creating a window using a private api on a dll-injected immersive process
#include "pch.h"
#pragma comment(lib, "gdi32.lib")
enum ZBID
{
ZBID_DEFAULT = 0,
ZBID_DESKTOP = 1,
ZBID_UIACCESS = 2,
ZBID_IMMERSIVE_IHM = 3,
ZBID_IMMERSIVE_NOTIFICATION = 4,