Source Archive

This page is an archive of win32 source code snippets & examples that were originally published on 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)

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)

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)

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.

Attach to a specified desktop

Registry utilities which mimic the GetPrivateProfile_xxx APIs (2005)

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)

Filename Drag+Drop the Windows 3.1 way (2005)

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

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

SetForegroundWindow replacement (that works!) (2003)

Enable XP themes on dialog boxes (2002)

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.

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

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.

Wrapper around the ZwQuerySystemInformation native system service. (2005)

Convert a username to SID (2005)

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

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

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

Windows NT Device Driver snippets

Windows NT kernel-mode snippets.

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

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)