Articles
289 articles, snippets and musings on programming, databases, networking and more.
Borland 5.02
Last version of the Borland C++ IDE with bundled tools which supports 16-bit development.
Joshua Chisum
Josh Chisum was one of my earliest friends, gracious software tester and a source of constant moral support.
A Brief Introduction to Secure Scripting
A Brief Introduction to Secure Scripting with PL-SQL
Disk Benchmarking with SQLIO
Benchmark your server's storage with various block-sizes and centralize the results foe easy analysis.
Dial-up Sounds Explained
Ever wondered what all that noise was when establishing a dial-up connection?
SQL Server Virtual File Stats
Easily view the cumulative I/O stats for each SQL Server database file.
Bringing RESTful Services to C++ Developers
Bringing RESTful Services to C++ Developers
Simple Debugging with AllocConsole
AllocConsole is a debuggers friend - now made easier with STD-I/O redirection.
Java is a Horrible Language
Linus Torvalds, the creator of my second favorate operating system expresses discontent with java - and I couldn't agree more.
Enable or Disable Schema Replication
A straight forward approach to enabling of disabling the automatic replication of schema changes in transactional replication.
Page Splits per-Second Over Time
A script to get you on the easy road to page-split baselining.
Alter the Fill Factor on all GUID Columns
Easily decrease the fill factors on all of those uniqueidentifier/GUID columns.
Finding Duplicate SQL Statistics
A quick and efficient view to find duplicate statistics on your SQL Server tables.
Finding Duplicate SQL Indexes
A quick and efficient view to find duplicate indexes on your SQL Server tables.
Get Table Row Counts
A script to quickly retrieve the count of rows from all tables in a database.
Read File as Table
Allows you to easily select from a file on the file system as if it were a table.
Split Array
SplitArray is a powerful table SQL function which splits delimited values into a row-set.
Get Days Of Month
Returns a table with one row per day of a given year and month.
Get First and Last day of Month
Two simple functions to get the first and last day of a month.
Format Currency
Easy currency formatting of numbers in SQL Server using a scalar function.
Format Number and Decimal Value
Easy formatting of numbers in SQL Server using a scalar function.
String and Numeric Padding
SQL functions used to left and right pad a values with 0s (or some other value),
Delete Unused Agent Schedules
Ever stepped back and looked at the enourmous barrage of unused SQL Agent Schedules? Clean them up!
Proper Name Casing in SQL Server
Need to format a name for a form? Well, this isn't perfect by any means, but it's a start.
Exploited antique code
Exploited antique code warning, not for the faint of heart!!
Password Cracking
Generic password cracking with a password list for ethical internal security probing.
Microsoft's ListView, What is it good for?
Microsoft's ListView... What is it good for?! Well, I've got a few ideas...
It's not volatile, this is critical
For far too long I have listened to the likes of those who believe that the volatile modifier is the end-all answer to multi-threaded development.
Identifying Page Splits in SQL Server
SQL and SQL only: Identifying Page Splits in a SQL Server Database
Going Native : Day 1 Keynote - Bjarne Stroustrup: C++11 Style
Bjarne Stroustrup speaks words of gold at the Going Native Conference.
IO DMVs
A collection of queries covering the IO DMVs: per-file IO stats, pending IOs, IO by drive letter and index space usage.
Rename a SQL Server Instance
A short script showing how to rename a SQL Server instance's registered name and verify it.
Page Life Expectancy Health
A script that compares Page Life Expectancy against a computed target and reports buffer pool health as a percentage.
Split Words
A table valued function that splits text into words on spaces and punctuation, remembering each word's position.
vDomainUser View
A view that splits the current user name into Domain and Username columns.
Current Activity DMVs
A collection of queries covering the current-activity DMVs: sessions, connections, requests, waiting tasks and blocked processes.
Change Replication Username and Password
A script generator that produces the T-SQL needed to change the agent credentials for log reader, snapshot and distribution agents across a publication.
Script All Primary Keys
A script that generates create or drop statements for every primary key in the database, preserving clustering and column direction.
Recommend Decimal Field Sizes
A script that scans actual decimal values and recommends the tightest fitting data type for each column, with ALTER scripts.
How Long Since Restart
A one-line query that returns the SQL Server instance's last restart time.
Database Users Without Connect Permission
A query that lists every database principal lacking the CONNECT permission and generates a grant script for each.
Parse Proc Call Traces
A view that parses stored procedure names out of RPC:Completed rows in a trace table.
Date Array
A table valued function that returns one row per day between a start and end date.
Last Table Select
A query that reports the last seek, scan or lookup date for every user table using index usage statistics.
Running Jobs
A query that lists all SQL Agent jobs currently executing with their elapsed time.
CPU Usage by SPID Over Time
A query that measures CPU consumption per SPID over a 30-second window with full SQL text.
Recommend String Field Sizes
A script that scans actual string lengths and recommends right-sized varchar/nvarchar columns with ALTER scripts.
QuickTrace
A one-shot server trace that runs for a fixed duration, captures the standard tuning events, reads the results back and deletes the file.
Toggle Foreign Keys on an Object
A stored procedure that enables or disables all foreign key constraints on a table, optionally including referencing tables.
View Snapshot Isolation Disk Usage
A query that reports snapshot isolation version store disk usage per database relative to tempdb.
Fix Orphaned Users
How to repair a single orphaned database user with sp_change_users_login Auto_Fix.
Count CRLF Pairs in a String
A scalar function that counts how many Windows-style carriage return / line feed (CRLF) pairs exist inside a string.
Indexing DMVs
A collection of queries covering the indexing DMVs: operational stats, usage stats, fragmentation and missing index recommendations.
Force Drop Publisher from Distributor
A last-resort script for removing a publisher and its distribution database from the distributor when normal unconfiguration fails.
Resource Governor Starter Setup
A Resource Governor starter setup with workload groups and a classifier function routing by login and application.
sp_help_revlogin for SQL Server 2000
The original SQL Server 2000 version of sp_help_revlogin using sysxlogins and sp_addlogin.
CPU DMVs
A collection of queries covering the CPU-related DMVs: schedulers, signal vs resource waits and the processes currently using CPU.
Free Space in All Databases
A script that reports free space in gigabytes for every file in every online database on the server.
SQL Agent Reader Permissions
The complete grant script for giving a user read-only SQL Server Agent visibility.
Test Compile All Procedures
A script that test-compiles every procedure, function, trigger and view in the database and reports the ones that fail.
App Query Duration
A query that reports how long each of a specific application's queries has been executing.
Replication Monitor Alerts Job
The SQL Agent job definition that runs SendErrorAlerts every ten minutes to surface replication errors.
Skip Snapshot Process
A trick for forcing the distribution agent through a snapshot cycle without actually delivering any data.
View All Users Permissions on All Databases
A cursor-driven script that audits every permission in every database and shows which roles inherit them.
Show Index Statistics
The DBCC SHOW_STATISTICS variants for inspecting index statistics headers, density vectors and histograms.
Top 10 Queries by Total CPU Time
A query that lists the top ten queries by total CPU time with per-execution averages.
Guid Search
A stored procedure that finds every table and column containing a given GUID across the whole database.
Enable or Disable All Foreign Keys on a Table
Two statements that disable or enable all foreign key constraints on a table at once.
Get Login Info
A stored procedure that reports the host, domain and user name of the current session.
Change Database Growth Rate
A script that sets a consistent file growth rate on every data and log file in every online database.
Enable Change Tracking on Database and Table
The two ALTER statements that turn on change tracking for a database and for an individual table.
Password Cracker
A brute-force and dictionary SQL login password cracker that reports blank, username-as-password and cracked accounts.
Trace Filter Ids
A reference table of every SQL Server trace filter column id with its name and description.
Performance Data Collection Viewer
A stored procedure that reports weighted notable query statistics from the Maintenance Data Warehouse over a time range.
Replace a GUID Everywhere
A stored procedure that replaces one GUID with another across every uniqueidentifier column in a database.
Agent Job Step Duration
A query that decodes SQL Agent job history durations into real datetimes and seconds for sorting and analysis.
Sample IO Performance
A script that samples virtual file I/O statistics over ten minutes and reports per-file throughput and latency.
Poll SPID Performance
A script that polls a single SPID every second and breaks down its wait types, CPU and physical I/O until it sleeps.
sp_help_revlogin
The classic stored procedure that generates CREATE LOGIN scripts for every login on a SQL Server instance.
Missing Indexes
A query that reports missing index candidates with improvement measures and generated CREATE INDEX statements.
Statistics With Columns View
Two views that expose every statistic's columns and flag duplicate statistics on the same column set.
View Tables and Indexes with Compression
Queries that list every table and index partition with its data compression setting.
Enable and Disable Schema Replication
Two sp_changepublication calls that turn DDL (schema change) replication on or off for a publication.
View All Users Permissions
A CTE query that lists every effective permission in the current database, tracing role grants back to their members.
Articles with Missing Filter Procedures
A diagnostic query that finds replicated articles whose row filter procedures have gone missing from the publisher database.
View Transaction Isolation Levels
A query that lists every session with its current transaction isolation level.
Currently Executing Requests
A query that reports full detail on every request currently executing, including the exact statement text.
User Specific Schema
A script that gives a user their own schema with full rights inside it while denying them the dbo schema.
GreaterOf Series
A family of four scalar functions that return the greatest of two, three, four, or five values.
Update All Statistics with Fullscan
A script that forces a full-scan statistics update on every table regardless of the row modification counter.
Read Commands from Distribution Database
How to use sp_browsereplcmds on the distribution database to inspect pending replication commands when diagnosing agent errors.
Page Splits by Index
A per-database query that counts page splits per index from the transaction log.
Refresh All Views
A stored procedure that refreshes every view in the database and reports only the real failures.
Set Publication Defaults
A batch of sp_changepublication calls that reset a publication to native sync with anonymous and immediate sync disabled.
fn_trace_gettable
How to read a .trc trace file back into a table, with and without event class names.
Replication Monitor Database
The complete DDL for a ReplicationMonitor database that records replication throughput and errors over time.
Space Used by Table Across a Database
A stored procedure that runs sp_spaceused against every table in a given database and returns one combined report.
Virtual File Stats
Queries that report cumulative virtual file I/O statistics per file and per database.
Get XML Inner Text
A scalar function that extracts the inner text of a named tag from a simple XML string using substring math.
Query To CSV
A stored procedure that wraps any single-column query into one delimited, optionally padded, comma-separated string.
View Orphaned Users on All Databases
A cursor-driven script that finds orphaned users in every database on the server with drop scripts.
Get Table Column Info
A stored procedure that reports every constraint, computed column, view and index attached to a given table column.
Reset Fill Factors
A script that resets fill factors on all indexes to a standard policy, with lower fill for GUID-based indexes.
Long Running Queries
A query that finds long-running queries that are waiting, blocked or holding open transactions.
Script All Database Foreign Keys
A script that generates drop and create statements for every foreign key in the database, optionally limited to one table.
Drop Foreign Keys on a Column
A stored procedure that drops all foreign key constraints attached to a given table's column.
Write Query Results to a File
Stored procedures that write a table or any query's results to a delimited text file from inside SQL Server.
Database File Usage by Process
A query that reports tempdb space usage in GB per process, with login and command details.
Running Processes
A query that lists all active processes on the server with their current SQL statement, waits and resource usage.
Drop a Column's Default Constraint
A stored procedure that drops a column's default constraint without dropping the column.
Users by Database
A script that finds which databases contain a given user by searching sysusers across the whole server.
Disable Index Page Locks
A script that generates statements to disable page locks on every index in the database.
DBCheck
A stored procedure that checks or repairs a database, handling single-user mode, options and UPDATEUSAGE for you.
SQL Trace Event Summary
A query that counts how many rows of each event class a trace table contains.
Enable or Fix Service Broker on msdb
A short script that enables or repairs Service Broker on the msdb database.
Compiled Plans vs Plan Stubs
A query that compares the size and count of compiled plans versus plan stubs in the cache.
Get All Server Index Fragmentation
A stored procedure that reports index fragmentation across every database on the server with ready-to-run rebuild statements.
Enable Snapshot Isolation
The statements to enable snapshot isolation on a database and monitor active snapshot transactions.
Top Waits
A query that reports the top waits making up 95% of total wait time, split into resource and signal time.
Generate Database Restore Scripts
A script that generates RESTORE DATABASE ... MOVE statements for every online user database on the server.
Enable CDC on All Tables
A script that generates the statements to enable change data capture on every table in the current database.
Audit Password Complexity
A script that audits SQL login passwords against a wordlist using PWDCOMPARE to find weak or dictionary-based passwords.
Shrink All Log Files
A stored procedure that truncates and shrinks the log file in every online database on the server.
Delete Rows Containing a GUID
A stored procedure that finds and deletes every row containing a given GUID across all uniqueidentifier columns in a database.
Ragged Sort
A scalar function that zero-pads mixed numeric and text values so they sort in natural order.
Compare and Fix Replicated Data
A script generator that produces a batch of tablediff and sqlcmd commands to compare and repair every replicated table on a subscriber.
Remove a Specific Plan from the Cache
A query that lists all cached plans with their handles and text so you can evict a specific one with DBCC FREEPROCCACHE.
Drop Article and Re-add without Reinitializing
A step-by-step procedure for dropping a single article from a publication and re-adding it without forcing a full reinitialization.
Print NVarChar(Max)
A stored procedure that prints nvarchar(max) values in line-break-aware 4000-character chunks.
Password Cracker v2
A set-based SQL login password cracker that matches a word list against SHA-1 hashes with MAXDOP control.
View All Permissions
A query that lists every permission granted in the current database with the principal, class and object.
Database Count, Allocated and Used Space
A script that reports the count, allocated space and used space in gigabytes across all databases on the server.
Simple Dead Lock Trace
A server trace that captures only deadlock graph events for a fixed window.
Format DateTime
A scalar function that formats a datetime into any of about twenty named formats, including a UNIX timestamp.
Rename Subscriber Database
A seven-step checklist for renaming a subscriber database and updating every replication table that references it.
Week Days In Month
A scalar function that returns the number of business days (Monday to Friday) in the month of a given date.
SQL Trace Event Class Names
A reference table of every SQL Server trace event class id and its name.
Move Databases to New Storage
A script that generates ALTER DATABASE MODIFY FILE statements to move every database's files to new locations.
Sort a Delimited String
A scalar function that sorts the pieces of a delimited string and rejoins them with the same delimiter.
Execution DMVs
A collection of queries covering the execution DMVs: query stats, cached plans and plan attributes for finding and analyzing queries.
View All SysAdmins
A query that lists every sysadmin login on the server with its type and dates.
Record Log Reader Commands
A stored procedure that scrapes log reader agent history from every distributor database and records hourly command throughput for reporting.
Get All Index Fragmentation Levels
A query that reports the fragmentation percentage and page count of every index in the current database.
Remove SQL User
A stored procedure that generates the complete drop script for a user across every database: objects, schemas, users and login.
Job History View
A view over sysjobhistory that converts the packed run date/time/duration integers into readable start and end times.
Queries Taking Longer Than One Hour of CPU
A query that finds all queries whose cumulative CPU worker time exceeds one hour, with plan handles for eviction.
Abandon Pending Log Reads
A three-line recovery script that resets the log reader and flushes replication when pending reads must be abandoned.
Overall DMVs
A collection of queries covering the overall health DMVs: wait statistics, performance counters, system info and memory state.
Create Partition Check Constraints
A script that generates IN-list check constraints on low-cardinality columns to support table partitioning.
Clear Cache Entries for a Resource Pool
How to clear all cached plans associated with a specific Resource Governor resource pool.
Drop All Non-Primary-Key Indexes
A script that generates DROP INDEX statements for every non-primary-key index in the database.
Change Tracking Version to Date Time
A query that converts change tracking commit versions from sys.dm_tran_commit_table into local time.
Table Size (Rows and Bytes)
A query that reports row counts and data size in GB for every user table in the current database.
Add or Remove NOT FOR REPLICATION on All Identity Columns
A script that adds or removes the NOT FOR REPLICATION attribute on every identity column in the current database.
SQL Agent Admin Permissions
The complete grant script for giving a user full SQL Server Agent administration rights.
Skip Individual Log Reader Transaction
A detailed runbook for isolating and skipping a single bad transaction that has halted the log reader agent.
View Orphaned Users
A query that finds orphaned users in the current database and generates a drop script for each.
Grant Server State
The single grant statement that lets a login view server performance counters and DMVs.
Format Decimal Value
A scalar function that formats a decimal value with thousands separators and an exact number of decimal places.
Memory DMVs
A collection of queries covering the memory DMVs: buffer usage by database and by object, plus Buffer Manager performance counters.
Script Database Logins and Roles
Two queries that generate CREATE USER and sp_addrolemember scripts for every user and role membership in a database.
Suggest Index Column Order
A stored procedure that suggests index column order based on measured distinct value counts.
Move TempDB
A short script showing how to move the tempdb data and log files to a new location.
Discover and Modify SQL Traces
How to list every running server trace and stop, start or delete one by id.
Change All Databases to Simple Recovery
A script that switches every online database on the server to the SIMPLE recovery model.
User Password Age
A query that lists every enabled SQL login whose password was last changed more than 90 days ago.
Top 10 Longest-Running Queries
A query that lists the ten longest-running queries currently executing with their statement text.
Using Change Tracking
A worked example of polling CHANGETABLE(CHANGES) with an anchor version to pull incremental changes.
Search For Dependencies
A stored procedure that finds which SQL modules reference a given string in their definitions.
Schema Map
A script that maps every table and column in the database with types, keys, foreign keys and extended property comments.
Blocked and Blocking Processes
A comprehensive report of all blocked and blocking processes with wait details and full SQL text.
Objects and Filegroups
A query that maps every index to its table, filegroup and physical file.
Get the Nth Token from a Delimited String
A scalar function that returns the Nth token from a delimited string using a recursive CTE.
Simple Performance Tuner Trace
A fully annotated server trace template capturing the five standard tuning events with a complete commented filter library.
Change All Database Owners to SA
A cursor-driven script that reassigns the owner of every user database on the server to sa.
Resource User Roles DDL Trigger
A server-wide DDL trigger that maintains a ResourceUserRoles table tracking every database role membership.
Replication Monitor Undistributed Commands Job
The SQL Agent job definition that records undistributed replication commands every fifteen minutes.
Split Time
A scalar function that returns the time portion of a datetime as a string.
Order Tables by Foreign Key Dependencies
A recursive CTE query that orders all user tables by their foreign key dependencies, from referenced to referencing.
Trigger Template with Identity Preservation
A trigger template that saves and restores @@IDENTITY around trigger logic.
Drop Column and Its Default Constraint
A stored procedure that drops a column together with its default constraint, if one exists.
Regenerate Service Master Key
How to force-regenerate the service master key to fix replication decryption errors after a restore.
Transparent Database Encryption
The four-step TDE setup: master key, certificate, database encryption key and turning encryption on.
Deadlock Generator
A self-contained script that simulates repeatable deadlocks on demand for testing recovery code.
Cell Level Encryption
A complete walkthrough of cell-level data encryption using a master key, certificate and AES-256 symmetric key.
Page Splits Per Second
A script that measures page splits per second over a configurable time window using performance counters.
Sample System Processes Over Time
A continuous sampler that records per-session CPU, I/O and wait deltas over a configurable time window.
Get Primary Key Columns (GPKC)
A stored procedure that builds a formatted list of a table's primary key columns with configurable format tokens and delimiters.
Toggle Indexes on an Object
A stored procedure that disables or rebuilds all non-primary-key indexes on a table, with an exclusion list.
Repair a Suspect Database
The step-by-step sequence for attempting to repair a database that has gone into the suspect state.
Replication Monitor Record Commands Job
The SQL Agent job definition that runs the log reader and distribution command recording procedures every minute.
Remap Users
A cursor script that regenerates and executes ALTER USER WITH LOGIN statements for every mapped user in a database.
DimTime Dimension
A script that populates a DimTime dimension table with every second of a day for SSAS time intelligence.
Reindex with Before and After Comparison
A stored procedure that defrags or rebuilds fragmented indexes and reports before/after scan density with timing.
Create a Database Snapshot with All Files
A script that generates the complete CREATE DATABASE ... AS SNAPSHOT OF statement for the current database, including all data files.
Metaphone Phonetic Function
A complete T-SQL implementation of the Metaphone phonetic algorithm for fuzzy name matching.
Cached Pages and Size by Database
A query that reports the number of cached pages and buffer pool usage in GB for each database.
Database Compression Evaluator
A script that estimates data compression savings for every table and generates rebuild scripts for the worthwhile ones.
Common Controls - Calendar
A dialog demo for the date and time picker common controls, with the full ICC_ flag reference.
NTFS Alternate Streams
A C program that writes to and reads back an NTFS Alternate Data Stream using plain fopen with a file:stream name.
Recursive Directory Scan
A C++ function that recursively walks a directory tree with FindFirstFile/FindNextFile, printing every file it finds.
Win32 Version Dialog
A Win32 dialog that displays the current Windows version string, with a ShellAbout entry in the system menu.
CheckBox Dialog
A Win32 dialog demo showing how to detect a checkbox click and read its state with IsDlgButtonChecked.
FILE Open Read Write Seek
A C console program that copies a file two ways — character at a time with fscanf, then in 512-byte buffered chunks after seeking back to the start.
Get File Size
A minimal C program that opens a file with CreateFile and prints its size in bytes using GetFileSize.
Send To Printer
A C program that shows the standard print dialog and sends a line of text to the chosen printer using GDI.
File Mapped Memory Allocator
A C++ class that implements a full page-based memory allocator (Alloc, CAlloc, ReAlloc, Free, FreeAll) on top of a file-backed memory-mapped region.
Named Pipe Client Server
A pair of minimal C console programs — a named-pipe server built with CreateNamedPipe and a client that opens it and writes a message.
RadioButton Dialog
A Win32 dialog example showing how to read the state of radio buttons with IsDlgButtonChecked.
Suspend Process
A C console utility that attaches to a process by PID with DebugActiveProcess, leaving it suspended until the debugger detaches.
NT Fiber
A minimal C++ program that converts the main thread to a fiber, creates a second fiber, and switches between them.
Memory Status
A C console program that prints system memory statistics — physical, page file, and virtual — using GlobalMemoryStatus.
Tree View Dialog
A Win32 dialog example that builds a TreeView with an image list, adds nested nodes, and sub-classes the control to add its own behavior.
Shell Extension Context Menu
The IContextMenu implementation from the Project Epsilon shell extension — adding a menu item with a bitmap and launching the associated program on selection.
Win32 Set Attributes
A C program that sets a file's attributes to archive plus read-only using SetFileAttributes.
Network Connect Get Disconnect
A C program that connects to a network share with WNetAddConnection, queries it with WNetGetConnection, and disconnects with WNetCancelConnection — each with full error reporting.
Common Controls - IP Address
A dialog demo for the IP address common control, loaded with ICC_INTERNET_CLASSES.
Change Case
LCase, UCase and MCase string helpers built on strlwr/strupr with a rotating buffer of results.
Basic Window
The smallest complete Win32 window program: register a class, create a window, run the message loop.
Open File Dialog Helper
A C helper function that wraps GetOpenFileName with file-type filters, a default extension, and an initial directory.
Animated Icon
A dialog demo that displays an animated cursor or icon loaded from a resource or file.
Load DLL At Runtime
A minimal pair of programs — a DLL exporting two functions and a console app that loads it at runtime with LoadLibrary/GetProcAddress.
Shell Extension Class Factory
The COM plumbing of a Win32 shell extension DLL — DllGetClassObject, the class factory, reference counting, and QueryInterface across all six shell extension interfaces.
Windows UpTime
A C console program that reports system uptime in days, hours, minutes, and seconds from GetTickCount.
Memory Mapping Helpers
Helper functions and a server/client pair for creating, opening, and mapping named shared memory backed by a file.
Replace String In String
A C function that replaces every occurrence of a substring with another substring, building the result into a caller-supplied buffer.
Build Lookup Table
A function that fills a 65 by 256 byte substitution table from a single build value using XOR mixing.
Search In String
A hand-rolled C substring search that returns the index of the first occurrence, written before reaching for strstr.
List System Directories
Four small C functions that return the current, temp, Windows, and system directories, each using a static buffer ring to stay safe across repeated calls.
Scroll Window Into View
A Win32 technique that animates a window sliding up into view from below the desktop edge, driven by a worker thread.
Hash Table
A public-domain C hash table (by Jerry Coffin) with insert, lookup, delete, enumerate, and free operations, plus a driver that exercises the full lifecycle.
Affinity Priority Fiber
A console snippet that pins a process and thread to a specific CPU using affinity masks and ideal-processor calls.
DiskType & Size
A snippet that reports a drive's type and its total, free and available space in megabytes.
StdIO Binary Round Trip
A C++ program that writes a DWORD to a file with ofstream and reads it back with ifstream — raw binary I/O through the standard streams.
AllocConsole
A snippet that attaches a console to a GUI process and redirects stdout into it.
Volume Information
A C program that queries a drive's volume name, file system, and capability flags with GetVolumeInformation.
Create Thread
A console snippet that spawns a second thread with CreateThread and lets both threads print in parallel.
Detect WinVersion
A console snippet that identifies the running Windows version from GetVersionEx and prints it with build number.
Move Rename File
A one-line C program that renames a file on the desktop using MoveFile.
Win32 Power Utilities
Three tiny C utilities — shutdown, restart, and logoff — each a confirmation dialog followed by one call to ExitWindowsEx.
Modeless Dialog
A Win32 example of running a dialog non-modally with CreateDialog plus a message loop, instead of the blocking DialogBox call.
Server Extension DllMain
A minimal DllMain skeleton for a server-side extension DLL, handling process and thread attach/detach with initialization hooks.
Shell Extension Registry Helpers
A portable registry helper library — create, delete (including recursive via SHDeleteKey), and get/set string, DWORD, and binary values.
Linear Sort Algorithm
A simple linear (bubble-style) sort for an array of C strings, with a pass function that reports how many swaps it made.
Reverse String
A C function that reverses a string in place using the XOR swap trick.
Signal Event
A pair of C programs demonstrating cross-process synchronization with a named event — one waits on it, the other finds and signals it.
Ticking Dialog
A Win32 dialog that displays the system tick count updating as fast as the timer allows — a minimal high-frequency UI refresh example.
App Template
A minimal Win32 dialog application skeleton with single-instance mutex and a spinning OpenGL logo about box.
ListView Dialog
A Win32 dialog example that builds a ListView with columns, a small icon image list, ten rows of data, custom text color, and sorting.
Tray Icon Wrapper
A complete C++ tray-icon wrapper — create, update, and destroy a Shell_NotifyIcon entry with a right-click menu and TaskbarCreated recovery.
C++ Classes
A minimal example of declaring a C++ class with public members and using an instance of it.
ASCII Control Characters
A header of named constants for every ASCII control character, with a test program that prints their values.
CreateKey
A snippet that creates a new registry key under HKEY_CLASSES_ROOT with RegCreateKeyEx.
DiskType
A console snippet that walks every drive letter and reports its type with GetDriveType.
Get Resource User Name
A small C program that uses WNetGetUser to retrieve the username associated with a mapped network drive, with full error reporting.
SHA2 Implementation
A complete, dependency-free C implementation of the FIPS 180-2 SHA-2 family — SHA-224, SHA-256, SHA-384, and SHA-512.
Date-Time
A snippet that formats the current date and time with GetDateFormat and GetTimeFormat.
Fixed Memory Allocator
A C++ class implementing a page-chained memory allocator (Alloc, CAlloc, ReAlloc, Free) over a single fixed-size virtual memory block.
Splash Screen
A minimal Win32 splash screen — a borderless dialog with a bitmap that stays up for five seconds driven by a timer.
Replace Char In String
A C function that returns a new string with every occurrence of one character replaced by another.
DLL Skeleton
A minimal C DLL with a set of exported system and string functions, plus a console test driver that calls every export.
Registry Delete Key
A minimal C program that opens a registry key and deletes a subkey with RegDeleteKey.
Basic DeviceIO
A console snippet that opens a raw disk handle and issues an IOCTL_STORAGE_EJECT_MEDIA control code.
Kill Process
A C console utility that attaches to a running process by PID using DebugActiveProcess and terminates it.
Win32 Get Attributes
A C program that prints every set file attribute for a given file using GetFileAttributesEx.
Make Delete Directory
A five-line C program that creates a directory with CreateDirectory, waits, and removes it again with RemoveDirectory.
ListBox Dialog
A Win32 dialog application demonstrating ListBox message handling — inserting and deleting items via LB_INSERTSTRING and LB_DELETESTRING.
Time Display
A C function that formats the current local time as HH:MM:SS using time, localtime, and strftime.
Delete File
A one-line file deletion using DeleteFile, with the CRT unlink alternative commented alongside.
Run As Service
A C helper that calls RegisterServiceProcess to make the current process count as a Windows service, resolved dynamically from kernel32.
Calendar Control
A standalone Win32 program that creates a month calendar common control in its own window.
Extended SQL2K StoredProc
A complete extended stored procedure (XSP) for SQL Server 2000 that takes a row count and returns that many rows with a greeting message.
CheckPort Library
Two exported functions that test whether a TCP or UDP port on a host is in use.
AVI Control
A dialog demo that plays an AVI file inside a window using the common controls Animate class.
Load Cursor
A Win32 dialog example showing how to load cursors from system resources, compiled resources, and an .ani file on disk, then apply them with SetClassLong.
Simple Dialog
The minimal Win32 dialog procedure — set title and icon, wire up an edit box and static text, run a one-second timer.
Network Connect Get Disconnect v2
The WNetAddConnection2 variant of the network-drive example, using a NETRESOURCE structure to map a share with full error reporting.
Named Mutex
A C program that creates a named mutex and uses GetLastError to detect whether another process already holds it.
Registry Set Value
A minimal C program that opens a registry key and writes a string value with RegSetValueEx.
Win32 Kill Tasks
A tiny C utility that force-closes every running task with a single ExitWindowsEx(EWX_FORCE) call.
Create Window Control
Helper functions that create STATIC and EDIT controls at runtime with a standard font.
True Wait
A C helper that performs a timed wait on a background thread, flipping a flag when the interval elapses so the caller can keep working meanwhile.