3rd Tuesday of the month. 7:30PM - C/C++ Group, SPRS
Welcome to the 2000-2001 season of the C++ Users Group. This group is a "Special Interest Group" of the ACGNJ devoted to discussing programming languages in general and C, C++, and C++ for Windows programming in particular. Each month a small but hopefully useful program (complete with source code) is presented for discussion.
// DllDups.cpp : Search drive for duplicate DLL's. B.Arnold 10/12/00 // /* *************** SAMPLE OUTPUT ************************************************ Ctl3d.dll 20976 10/03/1995 13:39:00 2.00.0004.0 c:\Magicsql\NETMAP\CTL3D.DLL Ctl3d.dll 26768 07/14/1995 00:43:40 2.31.0000.0 c:\WINNT\system\CTL3D.DLL Ctl3d.dll 20272 03/30/1994 01:06:00 2.00.0001.0 c:\WINNT\SYSTEM32\CTL3D.DLL Ctl3d.dll 14416 03/22/1993 00:00:00 1.01.0000.0 c:\PRODHELP\CTL3D.DLL
DllDups.exe will search your hard drive and list all DLL files that have more than one instance. This tool will help you fix problems caused by DLL file conflicts (often called DLL Hell) and to provide general auditing of computer files.
"DLL Hell" is a term used whenever the following happens: 1. A windows application fails on some computers but not others. 2. An application was working but now fails after a new applicaton is installed.
The program code has a number of special features: a) It uses a recursive file searching algorithm to search the entire hard drive. b) It uses a part of the Standard C++ Library called the Standard Template Library (STL) in order to store the huge amount of data. c) Once duplicates are found, each file is interrogated to determine its version number.
A good reference for STL is The C++ Standard Library by Nicolai Josuttis (Addison Wesley)
Here's a link which provides file version information from Microsoft: http://support.microsoft.com/servicedesks/fileversion/dllinfo.asp
SAMPLE CODE =========== hFind= ::FindFirstFile( (LPCTSTR) searchname, &fd); if (hFind != INVALID_HANDLE_VALUE) { do { filename = fd.cFileName; if (fd.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) { if (filename != "." && filename != ".." ) { CString newpath = path + filename; process( (LPCTSTR)newpath, dllfiles); } } else { if (filename.Right(4).CompareNoCase(".dll")!=0) continue; if (SpecialWin2k(path)) { cacheFlag = 1; continue; } filename.MakeLower(); p = filename.GetBuffer(15); *p = toupper(*p); // make first char upper case. filename.ReleaseBuffer(); record.Name = filename; record.WriteTime = fd.ftLastWriteTime; FileTimeToLocalFileTime(&fd.ftLastWriteTime, &localFt); FileTimeToSystemTime(&localFt, &st); record.FullName = path + fd.cFileName; record.Data.Format("%12lu %02d/%02d/%02d %02d:%02d:%02d", fd.nFileSizeHigh ? 999999999 : fd.nFileSizeLow, st.wMonth, st.wDay, st.wYear, st.wHour, st.wMinute, st.wSecond ); dllfiles.push_back(record); // Add all data to list. } } while (::FindNextFile(hFind, &fd));