Bastian Molkenthin - Sunshine2k

arrow C / C++


C memory allocation functions

C memory allocation functions example Version : 1.0 / Date: October 2019
Description :
Example implementations of the C memory allocation functions malloc(), calloc(), realloc() and free().
Contains two different implementation variants as well as a simple test application with various test cases.
Be sure to check out the corresponding article with the detailed explanation of those algorithms and implementations:
Sample implementation of C memory functions

Download Executable & Source (34KB)



CSerialPort

CSerialPort Version : 1.0 / Date: September 2019
Source available : YES

Description :
A small example component how to use the Serial / COM port using Windows API. Comes with an test application that opens, reads (synchronous and asynchronous) and writes (synchronous and asynchronous) to a configured serial COM port.
This is the result while playing around with the COM port Windows API and could be helpful for everyone that dives into this topic.
Check the readme file in the archive how to use the example application. The source file with the actual COM port access implementation are well documented and should be easy to understand.

Download Executable & Source (29KB)



Unsigned 32x32 bit multiplication

Unsigned 32x32 bit multiplication Version : 1.0 / Date: November 2017
Source available : YES

Description :
This is a little demo how to multiply two unsigned 32 bit values using only 16bit multiplications, casts to uint32_t respectively uint64_t and shift operations.

Her's the corresponding article with notes for the algorithm Unsigned 32x32 bit multiplication notes.

Download Executable & Source (8KB)



Windows Progressbar Example

Windows Progressbar Example Version : 1.0 / Date: August 2016
Source available : YES

Description :
This is a little demo how to use the TaskbarList3 interface using plain Windows API to set the progress info on the taskbar, handle taskbar buttons or set an overlay info.

Download Executable & Source (15KB)



WindowsUpTimes

WindowsUpTimes Version : 1.0 / Date: August 2014
Source available : YES

Description :
This is a little tool which prints the startup and shutdown time stamps of Windows to the console. Therefore it accesses the Windows System Event Log using the Event Logging API. So it runs even under good old Windows XP

Download Executable & Source V1.0 (11KB)



Searchstr

Searchstr Date: September 2010 / Update: June 2011 -> Version 1.1 (fixed minor bugs)

Source available : YES

Description :
A little commandline tool (I required for personal needs) to search files or whole directories for strings (byte-wise search). This tool proved itself quite useful, at least for me.

Download Executable & Source V1.1 (14KB)



Simple Bootsector Info Tool

Bootsector tool Version : 0.6 / Date: June 2009

Source available : YES

Description :
A very simple example on how to read the bootsector of a hard/usb drive, display the important FAT/FAT32/NTFS fields and dump the bootsector to file. Maybe this is a good starting point for some kind of disk-information tool.

Download Executable & Source (34KB)



Display Settings Changer

Display Settings Changer Date: June 2009 / Version: 1.0

Source available : YES

Description :
This little commandline tool allows to change to display mode of the primary display by commandline arguments. I needed the possibility to change the resolution from a .bat file, so maybe someone also requires such a functionality.

Download Executable & Source (11KB)



AviToYuv

AviToYuv Date: September 2008 / Version: 1.0

Source available : YES

Description :
This little commandline tool converts avi files to planar 4:2:0 yuv files using the Video for Windows Interface for accessing the single frames

Download Executable & Source (12KB)



Message Box API Hook

Message Box API Hook Date: October 2007

Source available : YES

Description :
This is my own lame example of coding an api hook. It injects a dll into the address space of a target application. As soon it is loaded, it searches the import table of the target to redirect the MessageBox function. Works only with a few apps but perhaps it is interesting for you :-)

Download Executable & Source (29KB)



CmdLine in Explore

CmdLine in Explorer screenshot Date: June 2007

Source available : YES

Description :
This tiny programm adds a new menu item to the context menu when you right-click a folder in windows explorer. Selecting this item opens a commandline window in the current directory. This feature can be very handy if you work often with the console und are tired of opening the cmd and changing to your desired directory with cd\.. . Have a look at the screenshots to see what I mean.
This works under XP without problems; under Vista you have to execute this app with administrator rights; under Win7 it's not necessary because you can press the shift key while right-clicking a folder in explorer to get a similar menu item in the context menu.

Download Executable & Source (55KB)



Sunshine's Desktop Symbol Utility V1

Sunshine's Desktop Symbol Utility Date : August 2006 / Version: 1.0

Source available : YES

Description :
This utility change the text color and the text background color of the desktop symbols. Windows XP/Vista has the disadvantage that the symbol text is shaded when the background color is set to transparent. This tool corrects this behaviour by injecting a dll file into the explorer.exe process.
For further information, check the Desktop Symbol Utility Site.



Huffman Compression

Huffman Compression Version : 1.1 / Date: August 2006

Source available : YES

Description :
This is my own implementation of the huffman compression algorithm. Well, it works and is relatively fast but the compression ratio is not that good. It was not that easy to code, so hopyfully the source is useful for you :-)
Version 1.1 is a slightly improved version (more stable and better compression).

Download Executable & Source (32KB)



Region Creator

Region Creator Date: September 2005 / Version: 1.1

Source available : YES

Description :
This little application scans an image for a chosen transparent color and save this region to file.

Features:
* supports bmp, png, gif and jpeg files
* choose transparent color from image or type in the RGB values
* preview of region

New in Version 1.1:
* Option to save the region to a C source file. So you don't have to include a rgn file to your resource or as a file anymore. Just include the generated header file to your project and call one single function on startup. That's it :-)
* Possibility to use another layout by specifying the argument -newGUI on the RegionCreator commandline.
Well that's not a real feature but I was playing around how to subclass a window and that's the result: Some little bugfixes / 'beauty changes' and more errorhandling.

Download Executable V1.1 (48KB)
Download Source V1.1 (78KB)
Download Examples V1.1 (51KB)
Old version (1.0, September 2005):
Download Executable V1.0 (48KB)
Download Source V1.0 (78KB)



Who owns the fish?

Who owns the fish Date: June 2005

Source available : YES

Description :
This is my try to solve the logical quest 'Who owns the fish?'. Can can read it here:
In German
In English
In fact I didn't know how to solve a logical quest in C. So probably this isn't the best solution, but it works :-) Nevertheless have a look yourself at the source...

Download Executable & Source (8KB)



A very simple Hex/Dec/Bin Calculator

Calculator screenshot Date: June 2005

Source available : YES

Description :
Converts hexadecimal numbers in decimal & binary and the other ways round... Very basic, can not handle negative and floating-point numbers.

Download Executable & Source (8KB)



SecMaker V2

SecMaker V2 screenshot Date: June 2005 / Version: 2.0

Source available : YES

Description :
This little tool allows you to add zeropadded sections to a PE file, taking care of file-alignment and so on in order keep the file valid & executable... This version should be nearly bugfree :-)

Download Executable & Source (62KB)



FindFiles

FindFiles Date: January 2004

Source available : YES

Description :
Just a little file searcher tool. It's the result while I was playing with the FindFirstFile/FindNextFile Apis.

Download Executable & Source (63KB)





This site is part of Sunshine's Homepage