Skip to content

Instantly share code, notes, and snippets.

@Aetopia
Aetopia / Get-SCEWIN.ps1
Created August 16, 2023 13:46
Get the latest version of SCEWIN.
& {
Add-Type -AssemblyName System.Web.Extensions
Add-Type -AssemblyName System.IO.Compression.FileSystem
[System.Web.Script.Serialization.JavaScriptSerializer]$JavaScriptSerializer = New-Object System.Web.Script.Serialization.JavaScriptSerializer
[System.Net.WebClient]$WebClient = New-Object System.Net.WebClient
$WebClient.Headers.Add("user-agent", "request")
$WebClient.DownloadFile(($JavaScriptSerializer.DeserializeObject(
$WebClient.DownloadString(
"https://api.github.com/repos/dscharrer/innoextract/releases/latest"
#include <windows.h>
#include <dwmapi.h>
#include <tlhelp32.h>
// Callback function that marks a window as rude or non-rude depending on the parameter passed to MarkRudeWindow(HWND hWnd, BOOL bRude)
BOOL EnumWindowsProc(HWND hWnd, LPARAM lParam)
{
static UINT uShellHookMessage = 0;
WCHAR rgwcClassName[256] = {0};
@Aetopia
Aetopia / MarkFullscreenWindow(HWND hWnd, BOOL fFullscreen).c
Last active August 4, 2023 09:51
VOID MarkFullscreenWindow(HWND hWnd, BOOL fFullscreen) Function.
// Marks a window as fullscreen.
VOID MarkFullscreenWindow(HWND hWnd, BOOL fFullscreen)
{
// Source: https://learn.microsoft.com/en-us/windows/win32/api/shobjidl_core/nf-shobjidl_core-itaskbarlist2-markfullscreenwindow
ITaskbarList2 *pTaskbarList2 = NULL;
CoInitializeEx(NULL, COINIT_APARTMENTTHREADED | COINIT_DISABLE_OLE1DDE | COINIT_SPEED_OVER_MEMORY);
CoCreateInstance(&CLSID_TaskbarList, NULL, CLSCTX_INPROC_SERVER, &IID_ITaskbarList2, (LPVOID *)&pTaskbarList2);
if (fFullscreen)
@Aetopia
Aetopia / ShellHookMonitor.c
Last active August 5, 2023 14:32
Shell Hook Monitor: A tool to monitor shell hook messages.
#define _WIN32_WINNT _WIN32_WINNT_WIN10
#include <windows.h>
int printf(const char *__format, ...);
LPWSTR ShellHookMessageToStringW(WPARAM wParam)
{
switch (wParam)
{
case HSHELL_WINDOWCREATED:
return L"HSHELL_WINDOWCREATED";
@Aetopia
Aetopia / DynamicSteamWebHelperSuspension.c
Last active September 28, 2024 17:15
Dynamically terminating the Steam WebHelper.
#include <windows.h>
#define printf __builtin_printf
BOOL EnumWindowsProc(HWND hWnd, LPARAM lParam)
{
DWORD maxCount = GetWindowTextLengthW(hWnd) + 1;
WCHAR className[256] = {}, windowText[maxCount] = {};
GetClassNameW(hWnd, className, 256);
GetWindowTextW(hWnd, windowText, maxCount);
if (!wcscmp(L"vguiPopupWindow", className))
#define _WIN32_WINNT 0x0602
#include <windows.h>
#include <dwmapi.h>
#define printf __builtin_printf
HWND windowHandle = NULL;
BOOL windowCloak = FALSE;
LRESULT WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
static UINT shellHookMessage = 0;
@Aetopia
Aetopia / winini.c
Last active July 25, 2023 09:50
WinIni
#include <windows.h>
#include <shlwapi.h>
// (Unicode) Get the required length to store a string of section names.
DWORD GetSectionNamesLengthW(IN LPCWSTR lpFileName)
{
DWORD bufferLength = 0;
WCHAR *returnBuffer = NULL;
if (!PathIsRelativeW(lpFileName) || !PathFileExistsW(lpFileName))
@Aetopia
Aetopia / ProcessPriorityLister.c
Created June 8, 2023 20:04
Process Priority Lister
#include <windows.h>
#include <wtsapi32.h>
#include <winternl.h>
#define printf __builtin_printf
int WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nShowCmd)
{
WTS_PROCESS_INFOW *pProcessInfo;
PROCESS_BASIC_INFORMATION peb;
HANDLE hProcess;
@Aetopia
Aetopia / Bypassing SetForegroundWindow(HWND hWnd) Restrictions.md
Last active May 10, 2025 03:09
Bypassing SetForegroundWindow(HWND hWnd) Restrictions

Bypassing SetForegroundWindow(HWND hWnd) Restrictions

Aim

I wanted to list/document the various methods use by people to bypass restrictions within Windows for the function SetForegroundWindow(HWND hWnd).

What does SetForegroundWindow(HWND hWnd) do and what restrictions are set it in place for it?

SetForegroundWindow(HWND hWnd) brings the specified window into the foreground, activates it and keyboard input is direct towards that window.

SetForegroundWindow(HWND hWnd) also has the following criteria either of which must be fulfilled to call the function.

Bypassing The Restrictions

@Aetopia
Aetopia / PaintDesktop.c
Created April 10, 2023 03:17
PaintDesktop.c
#include <windows.h>
LRESULT WindowProc(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam)
{
switch (Msg)
{
case WM_CREATE:
SetWindowLongPtrW(hWnd, GWL_STYLE, WS_VISIBLE | WS_POPUP);
SetWindowLongPtrW(hWnd, GWL_EXSTYLE, WS_EX_TOOLWINDOW|WS_EX_LAYERED);
SetWindowPos(hWnd, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE);