Skip to content

Instantly share code, notes, and snippets.

View valinet's full-sized avatar

Valentin Radu valinet

View GitHub Profile
@valinet
valinet / winring0fix.c
Created May 23, 2026 19:51
WinRing0 fix
/*
WinRing0 Fix(ish)
=================
Recently, there's been a ton of debate about how WinRing0 is the worst thing to have hit
the planet. A lot of overexaggerated crap, yet the conclusion seems to be that WinRing0
is the ultimate sin because it doesn't protect its device with a DACL that disallows
non-elevated processes from interacting with it. For now, until "security" becomes even
more "secure", the consensus is that it is okayish for apps to mess with arbitrary
memory regions (or at least, there's not much you can do about it), only when elevated tho.
@valinet
valinet / winring0.c
Last active May 25, 2026 00:59
WinRing0 redirect to PawnIO for EC access
// Copyright 2026 Valentin Radu
// License: GPLv2
//
// cl /nologo winring0.c kernel32.lib ntdll.lib /O1 /GS- /Gs9999999 /GF /kernel /link /DLL /ENTRY:DllMain /NODEFAULTLIB /SUBSYSTEM:windows /NOCOFFGRPINFO /ALIGN:16 /MERGE:.rdata=.text /MERGE:.pdata=.text /OUT:WinRing0x64.dll
//
// cl /nologo winring0.c kernel32.lib ntdll.lib /O1 /GS- /Gs9999999 /GF /kernel /link /DLL /ENTRY:DllMain /NODEFAULTLIB /SUBSYSTEM:windows /NOCOFFGRPINFO /ALIGN:16 /MERGE:.rdata=.text /MERGE:.pdata=.text /OUT:WinRing0.dll
//
#define WIN32_LEAN_AND_MEAN
#include <ntstatus.h>
#define WIN32_NO_STATUS
@valinet
valinet / truncate.c
Created May 27, 2026 11:14
Truncate utility for Windows
// cl /nologo truncate.c kernel32.lib shell32.lib /O1 /GS- /Gs9999999 /GF /kernel /link /ENTRY:main /NODEFAULTLIB /SUBSYSTEM:windows /NOCOFFGRPINFO /ALIGN:16 /MERGE:.rdata=.text /MERGE:.pdata=.text /OUT:truncate.exe
#define WIN32_LEAN_AND_MEAN
#include <Windows.h>
#include <shellapi.h>
#include <stdio.h>
BOOL ParseUInt64W(const wchar_t* s, const wchar_t** end, ULONGLONG* out) {
ULONGLONG v = 0;
const wchar_t* p = s;