Created
March 15, 2024 10:39
-
-
Save Aetopia/863940f9cf1b3b4c96f08204229cc944 to your computer and use it in GitHub Desktop.
NoSteamWebHelper
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@echo off | |
cd "%~dp0" | |
gcc -municode -mwindows -nostdlib -Os -s WinMain.c -lUser32 -lKernel32 -lShell32 -o NoSteamWebHelper.exe | |
upx --best --ultra-brute NoSteamWebHelper.exe>nul 2>&1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <windows.h> | |
#include <tlhelp32.h> | |
LRESULT WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam) | |
{ | |
static NOTIFYICONDATAW Data = {.cbSize = sizeof(NOTIFYICONDATAW), | |
.uCallbackMessage = WM_USER, | |
.uFlags = NIF_ICON | NIF_MESSAGE | NIF_TIP, | |
.szTip = L"NoSteamWebHelper"}; | |
static UINT TaskbarCreated = WM_NULL; | |
switch (uMsg) | |
{ | |
case WM_CREATE: { | |
TaskbarCreated = RegisterWindowMessageW(L"TaskbarCreated"); | |
Data.hWnd = hWnd; | |
Data.hIcon = LoadIconW(NULL, IDI_APPLICATION); | |
Shell_NotifyIconW(NIM_ADD, &Data); | |
break; | |
} | |
case WM_USER: { | |
if (lParam == WM_RBUTTONDOWN) | |
{ | |
POINT Point = {}; | |
HMENU hMenu = NULL; | |
SetForegroundWindow(hWnd); | |
GetCursorPos(&Point); | |
hMenu = CreatePopupMenu(); | |
AppendMenuW(hMenu, MF_STRING, 1, L"On"); | |
AppendMenuW(hMenu, MF_STRING, 2, L"Off"); | |
AppendMenuW(hMenu, MF_STRING, 3, L"Exit"); | |
TrackPopupMenu(hMenu, TPM_LEFTALIGN | TPM_LEFTBUTTON, Point.x, Point.y, 0, hWnd, NULL); | |
} | |
break; | |
} | |
case WM_COMMAND: { | |
HANDLE hThread = OpenThread(THREAD_SUSPEND_RESUME, FALSE, | |
GetWindowThreadProcessId(FindWindowW(L"vguiPopupWindow", L"Untitled"), NULL)); | |
switch (wParam) | |
{ | |
case 2: { | |
HANDLE hSnapshot = CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS, 0); | |
PROCESSENTRY32W pe = {.dwSize = sizeof(PROCESSENTRY32W)}; | |
if (Process32FirstW(hSnapshot, &pe)) | |
do | |
if (CompareStringOrdinal(L"steamwebhelper.exe", -1, pe.szExeFile, -1, TRUE) == CSTR_EQUAL) | |
{ | |
HANDLE hProcess = OpenProcess(PROCESS_TERMINATE, FALSE, pe.th32ProcessID); | |
TerminateProcess(hProcess, 0); | |
CloseHandle(hProcess); | |
} | |
while (Process32NextW(hSnapshot, &pe)); | |
CloseHandle(hSnapshot); | |
SuspendThread(hThread); | |
break; | |
} | |
case 1: | |
case 3: { | |
ResumeThread(hThread); | |
if (wParam == 3) | |
{ | |
CloseHandle(hThread); | |
Shell_NotifyIconW(NIM_DELETE, &Data); | |
PostQuitMessage(0); | |
} | |
break; | |
} | |
} | |
CloseHandle(hThread); | |
break; | |
} | |
default: | |
if (uMsg == TaskbarCreated) | |
Shell_NotifyIconW(NIM_ADD, &Data); | |
break; | |
} | |
return DefWindowProcW(hWnd, uMsg, wParam, lParam); | |
} | |
int WinMainCRTStartup() | |
{ | |
HINSTANCE hInstance = GetModuleHandleW(NULL); | |
if (!RegisterClassW( | |
&((WNDCLASSW){.lpszClassName = L"NoSteamWebHelper", .hInstance = hInstance, .lpfnWndProc = WndProc})) || | |
!CreateWindowExW(WS_EX_LEFT | WS_EX_LTRREADING, L"NoSteamWebHelper", NULL, WS_OVERLAPPED, 0, 0, 0, 0, NULL, | |
NULL, hInstance, 0)) | |
ExitProcess(1); | |
MSG msg = {}; | |
while (GetMessageW(&msg, NULL, 0, 0)) | |
{ | |
TranslateMessage(&msg); | |
DispatchMessageW(&msg); | |
} | |
ExitProcess(0); | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment