MfcCDDB v1.47 A set of C++ classes to support
access to CDDB servers
Welcome to MfcCDDB, a collection of C++ classes to support access to the
Compact Disc DataBases on the Internet.
CDDB is an information database containing artist, disc title, track titles,
and other information for digital audio compact discs. Over time, this archive has
grown to contain a substantial collection of CD information and is continuing to
grow at a rapid rate. This database can be accessed by applications via the CDDB
server hosts that have been set up on the Internet around the world. The CDDB data
format and the CDDB servers are designed to be open, and are used by many client
applications requiring CD information. CDDB has become the de facto standard for
Internet access of compact disc information. For more information please see
https://gnudb.org.
The enclosed zip file contains the MfcCDDB
source code and a simple VC2017 console based test program which exercises all class
API's.
Copyright
- You are allowed to include the source code in any product (commercial, shareware,
freeware or otherwise) when your product is released in binary form.
- You are allowed to modify the source code in any way you want except you
cannot modify the copyright details at the top of each module.
- If you want to distribute source code with your application, then you are
only allowed to distribute versions released by the author. This is to maintain
a single distribution point for the source code.
Updates
v1.47 (17 August 2022)
- Reworked to use latest version of WinHTTPWrappers classes.
v1.46 (14 August 2022)
- Reworked network code to use author's WinHTTPWrappers classes instead of
raw sockets to connect via HTTP to the CDDB servers.
v1.45 (28 May 2022)
- Updated copyright details.
- Updated the code to use C++ uniform initialization for all variable
declarations.
v1.44 (28 December 2021)
- Updated copyright details.
- The code has now been tested with gnudb.gnudb.org now that freedb.org
has been closed.
- Updated links in documentation to be gnudb.org.
v1.43 (12 April 2020)
- Updated copyright details.
- Fixed more Clang-Tidy static code analysis warnings in the code.
v1.42 (23 December 2019)
- Fixed various Clang-Tidy static code analysis warnings in the code.
v1.41 (29 September 2019)
- Fixed a number of compiler warnings when the code is compiled with VS
2019 Preview
v1.40 (6 June 2019)
- Updated copyright details.
- Updated the code to clean compile on VC 2019
v1.39 (2 January 2019)
- Updated copyright details.
- Fixed a number of C++ core guidelines compiler warnings. These changes
mean that the code will now only compile on VC 2017 or later.
- Removed code which supported CWSOCKET_MFC_EXTENSIONS preprocessor
define
v1.38 (26 December 2017)
- Updated the code to compile cleanly when _ATL_NO_AUTOMATIC_NAMESPACE is
defined.
v1.37 (4 October 2017)
- Replaced NULL throughout the codebase with nullptr. This means that the
minimum requirement for the framework is now VC 2010.
- Replaced CString::operator LPC*STR() calls throughout the codebase with
CString::GetString calls.
v1.36 (20 May 2017)
- Updated copyright details.
- Updated the code to compile cleanly using /permissive-.
v1.35 (30 July 2016)
- Updated code to use new preprocessor define of CWSOCKET_MFC_EXTENSIONS instead
of CWSOCKET_MFC_EXTENSTIONS
v1.34 (26 February 2016)
- Updated copyright details.
- Removed all the proxy connection methods as they cannot be easily supported
/ tested by the author.
- Updated the code to work with the latest version of the author's CWSocket
classes. The CWSocket class requires VC 2008 at a minimum to compile now and
this is the earliest supported version of VC for the MfcCDDB classes now.
- Updated the code to clean compile on VC 2010 - VC 2015
- Reworked ParseRecordBodyFromFile method to use ATL::CHeapPtr class.
- Reworked the MapFromProtocolString & MapToProtocolString methods internal
implementation.
- All the classes have been moved to a C++ namespace called "CDDB"
- Renamed the "CCDDB" class to "CClient".
- Removed the Read(const String& sDirectory...) method as this requires
a full copy of the freedb database on the local file system and this is now
approaching 1 GB in size as of Q1 2016.
- Removed the ParseRecordBodyFromFile method.
- Reworked the classes to optionally compile without MFC. By default the class
now use STL classes and idioms but if you define CWSOCKET_MFC_EXTENSTIONS the
class will revert back to the MFC behaviour.
- Added SAL annotations to all the code.
- Changed ordering of parameters in GetTrackPositionsUsingMCI, GetTrackPositionsUsingDeviceIoControl,
ParseRecordBodyHelper, ParseSiteBodyHelper, ParseQueryBodyHelper & Sites
methods.
- ParseRecordBodyHelper, ParseSiteBodyHelper, ParseQueryBodyHelper and ParseStatusBody
now calls SetLastError with ERROR_INVALID_DATA if they detects parsing errors
v1.33 (10 April 2010)
- Updated copyright details.
- CCDDB::ParseQueryBody now does not consider receiving a 202 response as
an error
v1.32 (24 December 2009)
- Removed various preprocessor defines from top of MfcCDDB as they are available
in standard VC headers.
- Fixed up a minor case sensitively issue with the various "MfcCDBD"
files.
- Updated copyright details.
- Updated the sample app configuration settings to more modern default values.
- Fix a bug where the drive/device name created in GetTrackPositionsUsingDeviceIoControl
was incorrectly created as "\\.\\[Drive Letter]:" instead of the correct
format of "\\.\[Drive Letter]:". This could lead to this function
call failing in certain circumstances. Thanks to "Jase" for reporting
this issue.
- Updated the code in CCDDB::ReadResponse in line with the similar response
parsing code in the CPJNPOP3Connection v1.47, This helps address an issue where
the terminator could not be found if the response gets split across socket calls.
This update also helps avoid excessive CPU utilization when we receive large
responses. Thanks to Markus Hlacer, "Jase" and Alexey Rabets for reporting
this issue.
- Eliminated use of old style CT2A / CA2T macros and replaced with CStringA/W.
v1.31 (31 August 2008)
- Code now compiles cleanly using Code Analysis (/analyze)
- Updated code to compile correctly using _ATL_CSTRING_EXPLICIT_CONSTRUCTORS
define
- The code now only supports VC 2005 or later.
- Added support for parsing CCDDBSite::m_sProtocol
- Code now uses ATL's support for base64 encoding
- The code now uses the author's CWSocket to encapsulate socket functionality
- Fixed a bug in the calculation of the total track length in CCDDB::ComputeDiscID.
Thanks to Tom van Dijck for reporting this bug.
- General tidy up of all the parsing code in the classes
- The classes now supports v6 Protocol level (if the code is compiled for
Unicode)
- GetTrackPositions has been renamed to GetTrackPositionsUsingMCI.
- Addition of a GetTrackPositionsUsingDeviceIoControl using the API DeviceIoControl
and the IOCTL code of IOCTL_CDROM_READ_TOC to get the track positions. This
method works on all versions of Windows based on the NT Kernel (i.e. NT, 2000,
XP, 2003, Vista and 2008). It should also work for multi-session CD's i.e. CD's
which have data sessions as well as an audio session.
- ComputeDiscID has been renamed to ComputeDiscIDUsingMCI.
- Addition of a ComputeDiscIDUsingDeviceIoControl method.
v1.30 (12 January 2008)
- Updated copyright details.
- Updated sample app code to remove VC 6 style classwizard comments
- Updated the sample app to clean compile on VC 2008
- CCDDBException::GetErrorMessage now uses the FORMAT_MESSAGE_IGNORE_INSERTS
flag. For more information please see Raymond Chen's blog at
http://blogs.msdn.com/oldnewthing/archive/2007/11/28/6564257.aspx. Thanks
to Alexey Kuznetsov for reporting this issue.
- CCDDBException::GetErrorMessage now uses Checked::tcsncpy_s if compiled
using VC 2005 or later.
v1.29 (1 January 2007)
- Updated copyright details.
- Addition of a MFCCDDB_EXT_CLASS preprocessor macro to allow the classes
to be more easily added to an extension dll
- Updated the code to clean compile in VC 2005
- Updated documentation to use the same style as the web site
- Default timeout is now 60 seconds for release builds and 90 seconds for
debug builds
- Reviewed all CString::Format calls for correctness
- Optimized CCDDBSite constructor code
- Optimized CCDDBQueryResult constructor code
- Optimized CCDDBTrackPosition constructor code
- Optimized CCDDBRecord constructor code
- Optimized CCDDB constructor code
- Removed unused CCDDB destructor
- Fixed Unicode issue in CCDDB::GetCDROMDrives
- Updated usage of CString::TrimLeft and CString::TrimRight in the code
- Replaced usage of CCDDB::ReplaceSubString with CString::Replace
- Hostname can now be customized via a SetHostName method
- m_sLastCommandResponse is now not reset when a response is successfully
parsed
- UserName can now be customized via a SetUserName method
- CCDDBSite::Parse now does not fail if protocol is not "http"
- Reworked the classes to be exception based along the lines of the author's
CPJNSMTPConnection class. This should improve the robustness of client application
code. Please note that because of this redesign, you should re-examine all client
code to make sure it catches the new exceptions thrown from the classes as appropriate
- Fixed a bug in CCDDB::SplitSemiColonLine where 1 character length values
would not be parsed correctly
- Added a constructor to the class CCDDBStatus
- Fixed a bug in CCDDB::ParseCommentLine where 1 character length values would
not be parsed correctly
- Fixed a bug in CCDDB::ReadResponse where it had problems parsing the body
of the response for query and submit requests if the body arrives in a second
packet from the network
- CCDDB::ParseRecordBodyFromFile now allows other processes to read the file
which it is currently attempting to parse
- Optimized code in CCDDB::Read(const CString& sDirectory... which operates
on the passed in dwDiscID parameter
- Optimized code in CCDDB::ParseRecordBodyFromFile to handle parsing the non-standard
(Windows) format of CDDB record format
v1.28 (29 June 2005)
- Updated copyright details.
- Updated comments regarding how to include headers into your pre compiled
header
- Reviewed all TRACE statements for correctness
- Updates to the GetUserName and GetHostName functions to exclude high ASCII
characters. Thanks to Stefan Becker for providing the fix for this bug.
- Removed unreferenced variable warning in CCDDB::FormSubmitLine.
- Fixed a number of level 4 warnings when code is compiled in Visual Studio
.NET 2003
- Fixed various warnings when code is compiled with /Wp64 compiler setting
in Visual Studio .NET 2003. Please note that to achieve this, the code now requires
a recentish Platform SDK to be installed and configured if the code is compiled
on Visual C++ 6.
v1.27 (20 August 2004)
- General tidy up of the GetUserName and GetHostName functions.
v1.26 (3 November 2003)
- Simplified the code in CCDDB::ReadResponse. Thanks to Clarke Brunt for reporting
this issue.
v1.25 (3 August 2003)
- Fixed a bug when the MCI device was not being closed if the inserted CD
did not contain an Audio CD. Thanks to Christian Inkster for reporting this
problem.
v1.24 (24 June 2002)
- Now fully supports local access to database. The standard and alternate
form are both fully supported.
- Optimized #include of 2 files in mfccddb.cpp
v1.23 (2 February 2002)
- Fixed a minor parsing bug in CCDDB::GetNextLine. Thanks to Thomas Lang for
this fix.
v1.22 (8 October 2001)
- Minor update following feedback from freedb.
v1.21 (7 October 2001)
- Major update to bring code into line with freedb standard. As mentioned
in previous updates you can no longer use MFCCDDB with the commerical CDDB web
site at Gracenote (formerly CDDB). Instead now the code can only be used with
the open source alternative of freedb. Updates include:
- Updated copyright information
- Fixed calculation the extra disc length parameter, which must be specified
in the query string.
- Fixed bug where discid for submissions was having any leading 0's stripped.
- Updated m_sProductVersion as it was out of date.
- Changed default server in Sites method to "freedb.freedb.org"
- Removed comment line which says "Copyright ... CDDB Inc" from
Submit method
- Updated links in documentation to be www.freedb.org
- Fixed a bug in ReadResponse when an error occurs reading from the socket
- Reworked the ReadResponse method to be more inline with my W3MFC socket
class
- Updated the sample app to display the last command response when a function
fails
- framework now works with version 5 of the CDDB protocol. This gives two
extra fields in the CDDB record class namely Year and Genre.
- Complete rewrite of the ParseRecordBody to improve readibilty of the function.
This means that the code now correctly supports all text record values which
span multiple lines
- Made m_ExtendedData member of CCDDBRecord a CString instead of a string
array
- Fixed a bug in CCDDB::ParseKeywordLine
- Fixed bug when separating artist and title from DTITLE lines
- Fixed an infinite recursion bug in ReplaceSubString
v1.20 (9 August 2001)
- Fixed a bug where the first track title was not being parsed correctly.
Thanks to Jared Allen for spotting this.
v1.19 (5 September 2000)
- Modified CCDDB::GetTrackPositions to fail when the CD does not contain any
audio tracks
v1.18 (30 May 2000)
- Now prevents creation of empty extended track tags (EXTT=).
v1.17 (17 May 2000)
- Now handles CDDB records which have more than one DTITLE line.
v1.16 (7 May 2000)
- Fixed a problem in GetUserName and GetHostName with embedded spaces
v1.15 (13 February 2000)
- Now fully supports access when behind a HTTP proxy.
- Also now includes support for proxy authentication.
v1.14 (23 January 2000)
- The code has now been fully tested with the open source alternative to CDDB
namely www.freedb.org. CDDB has become more
commercialized of late, since its introduction of a binary SDK with closed validation
and new licensing rules. I also believe that CDDB will stop access sometime
in 2000 to its databases via non CDDB originated code. Therefore I would suggest
that developers using MfcCDDB should provide users with a configuration dialog
to allow the CDDB server to be specified, that way you will not have irate customers
ringing you when CDDB stops allowing access to it. You can use this open source
server instead of the CDDB one in the MfcCDDB code by using "freedb.freedb.org"
instead of "cddb.cddb.com" in the call to CCDDB::Sites and by specifying
CDDB protocol version 3 in the function SetCDDBProtocolVersion. This is required
because as of January 2000 freedb only supports CDDB protocol version 3.
- Fixed a bug in the app.cpp code to the sample Submit call which was causing
it to fail.
v1.13 (17 January 2000)
- Fixed a number of compiler errors which seem to have crept into MfcCDDB.H
v1.12.
v1.12 (29 November 1999)
- Fixed a number of bugs when compiled with VC 6.0.
v1.11 (14 July 1999)
- Fixed two potential GPF's in the CCDDB::ReadResponse function.
- Minor Update to the documentation.
v1.1 (20 May 1999)
- Added support for MOTD (Message of the Day).
- Added support for Submitting an album to CDDB.
- Fixed a number of places where calling the TRACE function was causing an
access violation
- Fixed a bug in GetErrorMessage which was causing SDK errors to return the
string "The operation completed successfully".
v1.0 (11 May 1999)