WinSource Index


Source code illustrating various useful and interesting bits of Windows programming.   At present all the source is C++.


C++ classes written by John Rennie to simplify various aspects of Windows programming.   In general these classes concentrate on providing a simple interface to the more commonly used features rather than trying to provide a comprehensive but huge and complex interface as the MFC classes do.

Some of the applications in this archive use these classes. 41278 20/06/1999
CIsapi is a simple C++ class to encapsulate the interface provided by Microsoft Internet Information Server to ISAPI dlls.  It comes with an example ISAPI dll to show how it is used. 11269 09/08/1999
A C++ class to encapsulate the Win32 registry api. 38042 25/08/1999
Various classes for handling Internet operations.  For example there is a class for submitting HTTP POST requests, another to encapsulate FTP transactions and so on.   Some of these classes require the Microsoft wininet dll, but this ships as standard these days so that shouldn't be a problem.  Some of the classes that do not use wininet.dll require the CRhsSocket class.
The CRhsSMTP class was updated on 24/8/99 to improve behaviour with ESMTP servers. 67,958 18/12/2000
Miscellaneous C++ classes. 10128 20/06/1999
CRhsADO is a group of C++ classes to encapsulate the ADO COM interface.  At present the classes only support read queries and cannot update data (except by using a SQL update or insert query).  The zip includes a test application to illustrate the use of the classes.  This application requires the CRhsVariant and CRhsDate classes from 11141 20/06/1999
CRhsBitmap is a class to encapsulate Windows bitmaps.  The class allows bitmaps to be easily read and displayed, though not to be modified or written back to files.   The class is designed to be extensible to other formats of bitmap but this hasn't been implemented yet. 20177 20/06/1999
CRhsDAO is a group of C++ classes to encapsulate the DAO COM interface.  The classes allow simple querying and modifying of databases.  The zip includes a test application to illustrate the use of the classes.  This application requires the CRhsVariant class from 16829 20/06/1999
CXYGraph is a simple C++ class to draw XY graphs.  The class is very basic and likely to be useful only where a simple graph is required and aesthetics are not that important. 52062 20/06/1999
CRhsRTF and CRhsOleRTF are C++ classes which provide a fairly abstracted encapsulation of the Windows Rich Text control.  The classes handle loading, displaying and saving of the RTF control and the CRhsOleRTF allows object embedding too.  An application is included to show how the classes are used.  The classes and the application require various classes from 11062 25/08/1999
CRhsSocket is a C++ class encapsulating an IP socket.  The class provides a simple but powerful and comprehensive interface which greatly simplifies the writing of socket applications.  The zip includes a test application to read data from a Web server.
Updated 24/8/99 to add a select method. 9305 20/06/1999
CRhsSecurityDescriptor is a C++ class to encapsulate an NT security descriptor.  It allows a security descriptor to be created and optionally initialised from any object like a file or registry key.  Entries can be added to or removed from the descriptor and the descriptor reapplied to an object. 21065 28/06/2006
CSecurableObject and derived classes are C++ classes which encapsulate objects which have security descriptor.  Note that these classes encapsulate the object, for example the file or registry key, while the above CRhsSecurityDescriptor class encapsulates the security descriptor (the classes do not use or depend on each other).   The zip includes an example app showing how to modify file security.


Other source code. 89855 20/06/1999
C++ code showing how to implement OLE drag-drop clients and servers.  Several example apps are included. 19259 20/06/1999
C++ code showing how a standard edit control can be subclassed to add OLE drag-drop. 36074 20/06/1999
A Windows NT keyboard filter device driver.  This particular driver filters out ctrl-alt-delete etc and can be used to prevent users from messing around with the system.   The code could be easily modified to implement other keystroke filtering.  You need the NT Device Drivers Kit to build the code. 51196 20/06/1999
101 useful C++ code snippets.

Console Apps

Applications run from the command line or in batch scripts.  On NT these apps can be run from the scheduler.


Apps which perform various Internet related activities.  Also of interest in showing how to code protocols such as HTTP and FTP. 17398 20/06/1999
C++ app to perform a directory listing of an FTP server.  Uses the wininet library and requires 19959 20/06/1999
C++ app to get a file from an FTP server.  Uses the wininet library and requires 19905 20/06/1999
C++ app to put a file to an FTP server.  Uses the wininet library and requires 40334 12/01/2000
C++ app to read the time from a SNTP server and set the system time to match.   Requires the CRhsSocket class from   This was updated on 12/1/00 to correct a leap year bug; it wasn't a Y2k bug, it was just that Y2k was the next leap year to come along! 27915 20/06/1999
C++ app to grab an entire Web site.  It works by reading the starting page then following links to read every other linked page in the starting directory or sub-directories.  Uses the wininet library. 22151 20/06/1999
C++ app to read data from a web server.  Requires the CRhsSocket class from 18062 20/06/1999
A C++ server that listens on port 80 and prints anything sent to it.  I wrote it for diagnosing problems with requests sent by HTTP clients.  Not actually useful as a web server.  Requires the CRhsSocket class from 16735 20/06/1999
C++ classes used by some of apps here. 23575 20/06/1999
C++ app to mirror an entire FTP site to disk.  The FTP equivalent of the grabsite app.  Uses the wininet library and requires 19040 06/08/1999
Simple ping app to show how the ICMP protocol can be coded into your own programs. 35692 01/12/2006
C++ app to do various useful things with a POP3 server. Requires the CRhsSocket class from 21692 01/12/2006
C++ app to do various useful things with an SMTP server. Requires the CRhsSocket class from 20760 20/06/1999
C++ app to retrieve data from a Web server using a POST query.  Uses the wininet library and requires 18237 20/06/1999
C++ app to read data from a web server.  Unlike HttpGrabber this just retrieves the data and not the HTTP header.  Uses the wininet library and requires

System Utilities

Apps which may interest system administrators and power users.  Also of interest in showing various aspects of NT system programming. 15,758 20/06/1999
C++ app to change a users password.  Will only work on NT.  Uses the Lan Manager apis.
CopyFloppy 17,183 30/11/1999
C++ app to copy a floppy disk to an image file and copy the image file back to a floppy disk.
CopySecurity 31,930 18/12/2000
C++ app to copy file permissions from source file(s) and/or directories to destination file(s) and/or directories.  Will only work on NT. 39,565 20/06/1999
Some C++ apps to play with NT device names.  Similar functionality to the subst command provided with NT, but the apps here work at a lower level and are more powerful (and dangerous!). 14530 20/06/1999
C++ app to change the owner of a file on NT by modifying the file security descriptor. 33838 20/06/1999
C++ app which can do registry searching and replacing using regular expressions. 15133 20/06/1999
C++ app which allows administrators to kill any process including processes they do not own.  It works by enabling the debug privilege and connecting to the process as a debugger.  Once this is done the process can be killed. 23204 20/06/1999
C++ app to list open files on a network server and optionally forcibly close them.   Uses the Lan Manager apis. 35501 20/06/1999
C++ app to manage logon scripting on a Windows NT network.  The app greatly simplifies managing connections to file and print servers.  Tested in the white heat of my own network and is extremely reliable. 17012 20/06/1999
C++ app to show how NT Workstation can be modified to become NT Server by fiddling the registry.  NB not tested for Service Pack levels greater than 2. 11662 20/06/1999
NT Posix apps to rename and delete files.  Occasionally useful for attacking files with names like LPT1 or NUL that the NT Win32 subsystem will not open. 40478 19/07/2008
C++ app to reconcile the contents of two directories by:
  - creating files that exist in the source but not the destination
  - copying files which are newer in the source than in the destination
  - deleting files in the destination which do not exist in the source
  I've used this for some years to synchronise many Gb of data in two huge directory trees and it has been totally reliable. 22221 20/06/1999
C++ app to test or update registry values.  Particularly useful for setting registry keys from users login scripts. 32093 06/08/1999
C++ service to reset a lost administrator password on Windows NT. 23253 28/06/2006
List the permissions for a directory and all subdirectories. NB works only on W2k or later. 25419 02/07/2007
List the permissions for a registry key and all subkeys. NB works only on W2k or later. 14469 20/06/1999
C++ app waits for the specified number of seconds.  Useful in batch files to pause execution for a period. 20880 20/06/1999
C++ app for NT which switches the user to another user account.  Like the unix su command this is usually the administrator account, but any other account can be switched to.  Includes some interesting aspects of NT programming including logging in as other users and managing window station security.  Requires the CSecurableObject classes from  This app isn't as useful as it could be because it requires several NT privileges to be granted before it will work. 13861 20/06/1999
C++ filter to direct output from stdout to a file as well as to stdout. 25620 20/06/1999
C++ applet to execute a SQL query against an ODBC connection and write the results to stdout.  Requires the CRhsODBC class from   A good example of how easy ODBC programming can be given the right class support.

GUI Apps

Applications which have a windowed interface. 23999 20/06/1999
C++ app to log off, shut down or reboot NT.  Can be used to reboot machines remotely.  Can also be used as a console app. 519947 20/06/1999
C++ app which pops up a window when a hot-key is pressed and allows a command to be typed.  Provides usual file manipulation commands which are more powerful than their NT equivalents.  Also includes extra libraries for a range of commands including ODBC queries, network mapping directory syncronisation and others. 280338 20/06/1999
Alternative shell for NT.  Quite widely used on NT3.51 and earlier, but largely superceded by Explorer on NT4.  C++. 28410 22/06/2005
Applet for testing CPU usage. 16666 20/06/1999
File Manager extension which allows administrators to read directories to which they don't have access by enabling the Backup privilege.  C++. 19475 20/06/1999
File Manager extension which places a button on the toolbar to run the selected file.   The process is started in a separate thread which avoids File Manager hanging up when starting a slow app like MS Word by clicking a .doc file.  C++. 56973 23/05/2000
Shows processes running on the system and can kill processes.  Similar information to the Process tab in the NT Task Manager, but gives more memory information and can kill processes which you don't own.  Interesting as an example of how to use the NT performance counters and contains a class to simplify using performance counters.   C++. 99390 20/06/1999
Simple but very popular telephone number application.  C++. 147229 20/06/1999
Shows detailed memory usage of an application including all dlls the process loads.   C++.


Servers.  Mostly of interest in how to code a server including tackling some tricky bits of NT system programming.  The servers are not really industrial strength. 43498 20/06/1999
Service which allows applications to be run from a login script with administrator access even if an ordinary user is logged on. 56405 20/06/1999
A Berkeley LPD server.  Written because I found the LPD server in NT rather unreliable. 106791 20/06/1999
A telnet server for NT.  Tackles some quite tricky problems of logging users on and managing security. 51474 25/08/99
COM server that handles SMTP mail.

System admin and monitoring

Bits and bobs for managing and monitoring servers.

DiskThrasher 29731 06/05/08
Simple disk speed tester.
RhsEventLogReader 54888 20/12/06
COM server for reading the Event Log from VBScript. Requires the CRhsEventLog class from
RhsEventMon 132675 25/08/99
A service for monitoring the NT registry and forwarding events to a web server for processing.

Last modified 20th December 2006