Snippets
Presented here are a collection of sourcecode snippets and mini-projects.
All downloads are plain Win32 C and C++, and compile under Microsoft Visual
Studio 6.0.
Code Snippets
A collection of C and C++ programming snippets organised into categories
of functionality.
Win32 Sourcecode projects
Sourcecode downloads which implement full applications or utilities
| Global Titlebar Hook 25 Oct 2005 Insert buttons into window titlebars on a global level (system-wide). Handles XP Themes if available. Requires NT/2000/XP. |
| WinCap3 30 Mar 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. Click here and here for old versions. |
| ReportView 6 Feb 2005 Force Report-style view in all Open and Save common dialogs. |
| Directory Tree 2 Feb 2005 Display a directory hierarchy using ASCII graphics (ala the "tree" DOS command). |
| Process Tree 4 Feb 2005 Display a process hierarchy like SysInternal's ProcessExplorer. |
| 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 2 Feb 2005 Registry utilities which mimic the GetPrivateProfile_xxx APIs |
| EnableDebug 4 Feb 2005 Enable SE_DEBUG_NAME and other system privileges (useful for opening system processes) |
|
C++ Socket Library |
|
Trace macro |
|
DragFile |
| Alpha-blended windows 17 Jan 2002 Simple functions to provide alpha-blended window support. |
| Styles 6 Feb 2005 Helper functions to set window and dialog item styles, using SetWindowLong. |
| ForceSetForegroundWindow 15 Aug 2003 SetForegroundWindow replacement (that works!) |
| EnableDialogTheme 20 Jan 2002 Enable XP themes on dialog boxes |
| GetVersionString 6 Feb 2005 Howto retrieve version strings (e.g. File description) from an executable's version resources. |
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 2 Oct 2005 Modify the Win32 Console's palette dynamically at runtime. |
| 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 4 Feb 2005 Wrapper around the ZwQuerySystemInformation native system service. |
| UsernameToSid 4 Feb 2005 Convert a username to SID |
| KMem 26 Mar 2004 Read kernel memory from usermode (kmemcpy function). Gary Nebbet original author. |
| InjectThread 2003 CreateRemoteThread replacement, can inject into an already-running thread. View the example usage. |
| BreakPoint 8 Feb 2005 Hardware breakpoint and single-step debugging routines. |
Windows NT Device Driver snippets
Windows NT kernel-mode snippets.
| IsrSpinlock 28 Oct 2003 Howto acquire a spinlock at any IRQL level - implemented as a custom spinlock |
| InterlockedExecute 6 Jun 2004 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! |
| Attachment | Size |
|---|---|
| Attach to a specified desktop | 2.57 KB |
| Force Report-style view in all Open and Save common dialogs | 5.4 KB |
Recent comments
16 sec ago
2 min 58 sec ago
7 min 22 sec ago
11 min 50 sec ago
10 min 5 sec ago
8 weeks 5 days ago
9 weeks 2 days ago
29 weeks 12 hours ago
34 weeks 6 days ago
34 weeks 6 days ago