Source Archive


3 minute read  • 

win32

This page is an archive of win32 source code snippets & examples that were originally published on catch22.net. These sources are old. Like, really old. I doubt they are useful anymore, and anyone looking through them is advised to do so through a le

Win32 sourcecode projects

Global Titlebar Hook
Insert buttons into window titlebars on a global level (system-wide). Handles XP Themes if available. Requires NT/2000/XP. (2005)

WinCap3
Capture hidden and obscured windows - proof of concept demo application. Windows XP only - will not work under Win95/98/ME. Might work under NT,2000 but untested. (2005)

ReportView
Force Report-style view in all Open and Save common dialogs. (2005)

Directory Tree
Display a directory hierarchy using ASCII graphics (ala the “tree” DOS command). (2005)

Process Tree
Display a process hierarchy like SysInternal’s ProcessExplorer. (2005)

SetRes
Control multiple display resolutions and colour depths with this useful tool.

Win32 sourcecode snippets

A collection of useful functions which I’ve accumulated over the years.

AttachDesktop
Attach to a specified desktop

RegHelper
Registry utilities which mimic the GetPrivateProfile_xxx APIs (2005)

EnableDebug
Enable SE_DEBUG_NAME and other system privileges (useful for opening system processes) (2005)

C++ Socket Library
C++ class wrappers around the winsock library - makes socket programming much easier! (2005)

Trace macro
“printf” style wrapper around the OutputDebugString API (2005)

DragFile
Filename Drag+Drop the Windows 3.1 way (2005)

Alpha-blended windows
Simple functions to provide alpha-blended window support. (2002)

Styles
Helper functions to set window and dialog item styles, using SetWindowLong. (2005)

ForceSetForegroundWindow
SetForegroundWindow replacement (that works!) (2003)

EnableDialogTheme
Enable XP themes on dialog boxes (2002)

GetVersionString
Howto retrieve version strings (e.g. File description) from an executable’s version resources. (2005)

Windows NT sourcecode

The following sourcecode snippets are specific to the Windows NT family of operating systems - Windows NT, 2000, XP and 2003 Server. Many of the downloads are heavily influenced by USENET threads, in particular postings by Gary Nebbett.

SetConsolePalette
Modify the Win32 Console’s palette dynamically at runtime. (2005)

CreateToken
Create an access token for local user accounts without knowing the password - requires SeCreateTokenPrivilege level. You also require a custom ntdll.h if you don’t already have one. Gary Nebbet original author.

QuerySystemInfo
Wrapper around the ZwQuerySystemInformation native system service. (2005)

UsernameToSid
Convert a username to SID (2005)

KMem
Read kernel memory from usermode (kmemcpy function). Gary Nebbet original author. (2004)

InjectThread
CreateRemoteThread replacement, can inject into an already-running thread. View the example usage. (2003)

BreakPoint
Hardware breakpoint and single-step debugging routines. (2005)

Windows NT Device Driver snippets

Windows NT kernel-mode snippets.

IsrSpinlock
Howto acquire a spinlock at any IRQL level - implemented as a custom spinlock (2003)

InterlockedExecute
Acquire exclusive access to all CPUs and execute a single function with full system lock. Please send feedback on this technique if you find it useful! (2004)