home *** CD-ROM | disk | FTP | other *** search
- // LibraryInfo.cpp: implementation of the CLibraryInfo class.
- //
- // THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF
- // ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO
- // THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A
- // PARTICULAR PURPOSE.
- //
- // Copyright (C) 1995 Kohli Computers, Inc.. All Rights Reserved.
- //
- // MODULE: LibrarryInfo.cpp
- //
- // PURPOSE: Class used to extract information about a DLL/EXE module.
- //
-
-
- #include "stdafx.h"
-
- #ifdef _DEBUG
- #undef THIS_FILE
- static char THIS_FILE[]=__FILE__;
- #define new DEBUG_NEW
- #endif
-
- //
- // Function:
- // CLibraryInfo()
- //
- // Parameters:
- //
- // Returns:
- //
- // Remarks:
- // Constructor for the class CLibraryInfo
- //
-
- CLibraryInfo::CLibraryInfo()
- {
- m_DllInfo.stDllName = _T("");
- m_DllInfo.stCompany = _T("");
- m_DllInfo.stCopyRight = _T("");
- m_DllInfo.stDescription = _T("");;
- m_DllInfo.stFileVersion = _T("");
- m_DllInfo.stMajorVersion = _T("");
- m_DllInfo.stMinorVersion = _T("");
- m_DllInfo.stInternalName = _T("");
- m_DllInfo.stOriginalName = _T("");
- m_DllInfo.stProductName = _T("");
- m_DllInfo.stProductVersion = _T("");
- m_DllInfo.stDllVersion = _T("");
- m_DllInfo.stFileOS = _T("");
- m_DllInfo.stFileType = _T("");
- m_DllInfo.stLanguageId = _T("");
- m_DllInfo.stCharSet = _T("");
-
- m_pVersionInfo = NULL;
-
- m_bInfoObtained = false;
- m_bLibLoaded = false;
- }
-
- //
- // Function:
- // ~CLibraryInfo()
- //
- // Parameters:
- //
- // Returns:
- //
- // Remarks:
- // Destructor for the class CLibraryInfo
- //
-
- CLibraryInfo::~CLibraryInfo()
- {
- if (m_pVersionInfo != NULL) {
- delete m_pVersionInfo;
- }
- }
-
- //
- // Function:
- // SetDllName (const CString & name)
- //
- // Parameters:
- // name Dll/Exe's name
- //
- // Returns:
- //
- // Remarks:
- // Function sets the name of the Dll/Exe's name in the DLLINFO structure.
- //
-
- void
- CLibraryInfo::SetDllName (const CString & name)
- {
- m_bInfoObtained = (name == m_DllInfo.stDllName) ? true : false;
-
- m_DllInfo.stDllName = name;
- }
-
- //
- // Function:
- // const CString & GetDllName () const
- //
- // Parameters:
- //
- // Returns:
- // Reference to the Dll/Exe name string.
- //
- // Remarks:
- // Function gets the name of the Dll/Exe's name from the DLLINFO structure.
- //
-
- const CString &
- CLibraryInfo::GetDllName () const
- {
- return (m_DllInfo.stDllName);
- }
-
- //
- // Function:
- // bool GetInfo()
- //
- // Parameters:
- //
- // Returns:
- // true/false - success/error.
- //
- // Remarks:
- // Function gets the information for the Dll/Exe module. This function internally
- // calls all the routines for getting static and dynamic information about the module.
- // GetModuleHandle function call succeeds if the module is mapped into the process's
- // memory space. Therefore this function call can't be used for other modules. To
- // make it work for all modules, first call is made to this function, if it fails then
- // the LoadLibrary function call is made to load the module into process's memory
- // space. But care must be taken if the loadlibrary call is used. Make sure to free the
- // module before exiting the module.
- //
-
- bool CLibraryInfo::GetInfo()
- {
- HMODULE hModule;
- DWORD length, size, nullHandle;
- TCHAR fileName [MAX_PATH];
- LPVOID versionPtr;
- UINT verLength;
-
- // Get module handle for dll
-
- if (m_DllInfo.stDllName.IsEmpty ()) {
- return (false);
- }
-
- hModule = ::GetModuleHandle (m_DllInfo.stDllName);
-
- if (hModule == NULL) {
- // the dll/module may not be mapped into our space. So try to load the module
-
- hModule = (HMODULE)LoadLibrary (m_DllInfo.stDllName);
-
- if (hModule == NULL) {
- return (false);
- }
-
- m_bLibLoaded = true;
- }
-
- // Retrieve the full path and filename for the executable file containing
- // the specified module.
-
- size = sizeof (fileName) / sizeof (fileName [0]);
-
- length = ::GetModuleFileName (hModule, fileName, size);
-
- if (length <= 0) {
- if (m_bLibLoaded) {
- FreeLib (hModule);
- }
- }
-
- // Determine whether the operating system can obtain version information
- // about the file. If version information is available, GetFileVersionInfoSize
- // returns the size in bytes of that information.
- // As with other file installation functions, GetFileVersionInfo works only
- // with Win32 file images. It does not work with 16-bit Windows file images.
-
- // Its is neccessary to call this function before calling GetFileVersionInfo.
-
- length = ::GetFileVersionInfoSize (fileName, &nullHandle);
-
- if (length <= 0) {
- if (m_bLibLoaded) {
- FreeLib (hModule);
- }
- return (false);
- }
-
- // Now call the GetFileVersionInfo function to version information
- // First initialize the member variable to recieve the information.
-
- m_pVersionInfo = new BYTE [length];
-
- if (!::GetFileVersionInfo (fileName, NULL, length, m_pVersionInfo)) {
- if (m_bLibLoaded) {
- FreeLib (hModule);
- }
- return (false);
- }
-
- // The Win32 API contains the following predefined version information
- // strings.
- // CompanyName, FileDescription, FileVersion, InternalName, LegalCopyright,
- // OriginalFilename ProductName ProductVersion
-
- if (!::VerQueryValue (m_pVersionInfo, _T ("\\"), &versionPtr, &verLength)) {
- if (m_bLibLoaded) {
- FreeLib (hModule);
- }
- return (false);
- }
-
- m_FixedFileInfo = *(VS_FIXEDFILEINFO*)versionPtr;
-
- if (!GetDynamicInfo ()) {
- if (m_bLibLoaded) {
- FreeLib (hModule);
- }
- return (false);
- }
-
- // Get the information which is fixed for the module.
-
- if (!GetFixedFileInfo ()) {
- if (m_bLibLoaded) {
- FreeLib (hModule);
- }
- return (false);
- }
-
- // Don't forget to free the loaded library.
-
- if (m_bLibLoaded) {
- FreeLib (hModule);
- }
-
-
- // Set the infoObtained flag to true.
-
- m_bInfoObtained = true;
-
- return (true);
- }
-
- //
- // Function:
- // bool GetFixedFileInfo()
- //
- // Parameters:
- //
- // Returns:
- // true/false - success/error
- //
- // Remarks:
- // Function retrieves the information which is ficed for a module e.g. file type, OS etc.
- //
-
- bool
- CLibraryInfo::GetFixedFileInfo()
- {
- // dwFileVersionMS specifies the most significant 32 bits of the fileÆs binary
- // version number. This member is used with dwFileVersionLS to form a 64-bit
- // value used for numeric comparisons.
- // dwFileVersionLS specifies the least significant 32 bits of the fileÆs binary
- // version number. This member is used with dwFileVersionMS to form a 64-bit
- // value used for numeric comparisons
-
- m_DllInfo.stDllVersion.Format ("%d.%d.%d.%d",
- HIWORD (m_FixedFileInfo.dwFileVersionMS), LOWORD (m_FixedFileInfo.dwFileVersionMS),
- HIWORD (m_FixedFileInfo.dwFileVersionLS), LOWORD (m_FixedFileInfo.dwFileVersionLS));
-
- // Get the file type
-
- if (m_FixedFileInfo.dwFileType == VFT_DRV) {
- switch (m_FixedFileInfo.dwFileSubtype) {
- case VFT2_DRV_DISPLAY:
- m_DllInfo.stFileType = _T ("Display driver");
- break;
- case VFT2_DRV_INSTALLABLE:
- m_DllInfo.stFileType = _T ("Installable driver");
- break;
- case VFT2_DRV_KEYBOARD:
- m_DllInfo.stFileType = _T ("Keyboard driver");
- break;
- case VFT2_DRV_LANGUAGE:
- m_DllInfo.stFileType = _T ("Language driver");
- break;
- case VFT2_DRV_MOUSE:
- m_DllInfo.stFileType = _T ("Mouse driver");
- break;
- case VFT2_DRV_NETWORK:
- m_DllInfo.stFileType = _T ("Network driver");
- break;
- case VFT2_DRV_PRINTER:
- m_DllInfo.stFileType = _T ("Printer driver");
- break;
- case VFT2_DRV_SOUND:
- m_DllInfo.stFileType = _T ("Sound driver");
- break;
- case VFT2_DRV_SYSTEM:
- m_DllInfo.stFileType = _T ("System driver");
- break;
- case VFT2_UNKNOWN:
- m_DllInfo.stFileType = _T ("Unknown driver");
- break;
- }
- }
- else if (m_FixedFileInfo.dwFileType == VFT_FONT) {
- switch (m_FixedFileInfo.dwFileSubtype) {
- case VFT2_FONT_RASTER:
- m_DllInfo.stFileType = _T ("Raster font");
- break;
- case VFT2_FONT_TRUETYPE:
- m_DllInfo.stFileType = _T ("Truetype font");
- break;
- case VFT2_FONT_VECTOR:
- m_DllInfo.stFileType = _T ("Vector font");
- break;
- case VFT2_UNKNOWN:
- m_DllInfo.stFileType = _T ("Unknown font");
- break;
- }
- }
- else if (m_FixedFileInfo.dwFileType == VFT_APP) {
- m_DllInfo.stFileType = _T ("Application");
- }
- else if (m_FixedFileInfo.dwFileType == VFT_DLL) {
- m_DllInfo.stFileType = _T ("Dynamic link library");
- }
- else if (m_FixedFileInfo.dwFileType == VFT_STATIC_LIB) {
- m_DllInfo.stFileType = _T ("Static link library");
- }
- else if (m_FixedFileInfo.dwFileType == VFT_VXD) {
- m_DllInfo.stFileType = _T ("Virtual device");
- }
- else if (m_FixedFileInfo.dwFileType == VFT_UNKNOWN) {
- m_DllInfo.stFileType = _T ("Unknown type");
- }
-
- // Get OS for which this file was designed
-
- switch (m_FixedFileInfo.dwFileOS) {
- case VOS_DOS:
- m_DllInfo.stFileOS = _T ("MS-DOS");
- break;
- case VOS_DOS_WINDOWS16:
- m_DllInfo.stFileOS = _T ("16-bit windows running on MS-DOS");
- break;
- case VOS_DOS_WINDOWS32:
- m_DllInfo.stFileOS = _T ("Win32 API running on MS-DOS");
- break;
- case VOS_OS216:
- m_DllInfo.stFileOS = _T ("16-bit OS/2");
- break;
- case VOS_OS216_PM16:
- m_DllInfo.stFileOS = _T ("16-bit Presentation manager running on 16-bit OS/2");
- break;
- case VOS_OS232:
- m_DllInfo.stFileOS = _T ("32-bit OS/2");
- break;
- case VOS_NT:
- m_DllInfo.stFileOS = _T ("Windows NT");
- break;
- case VOS_NT_WINDOWS32:
- m_DllInfo.stFileOS = _T ("Win32 API on Windows NT");
- break;
- case VOS_UNKNOWN:
- m_DllInfo.stFileOS = _T ("Unknown OS");
- break;
- }
-
- return (true);
-
- }
-
- //
- // Function:
- // bool GetDynamicInfo()
- //
- // Parameters:
- //
- // Returns:
- // true/false - success/error
- //
- // Remarks:
- // Function gets the dynamic information of the module e.g. company name, copy right,
- // description, names etc.
- //
-
- bool
- CLibraryInfo::GetDynamicInfo()
- {
- UINT verLength;
- LPVOID voidPtr;
- CString query;
-
- // Get the translation information.
- // Translation table consistes of an array of two WORD entries.
- // First entry is langauge Id and second one is character set
-
- // This translation is to be used in subsequent queries for info
-
- if (::VerQueryValue (m_pVersionInfo, "\\VarFileInfo\\Translation", &voidPtr, &verLength)) {
- m_Translation = *(TRANSLATE*)voidPtr;
- }
-
- // GetCompany name
-
- query.Format (_T ("\\StringFileInfo\\%04x%04x\\CompanyName"),
- m_Translation.languageId, m_Translation.characterSet);
-
- ::VerQueryValue (m_pVersionInfo, (LPTSTR)(LPCTSTR)query, (LPVOID*)&m_DllInfo.stCompany,
- &verLength);
-
-
- // Get copy right information.
-
- query.Format (_T ("\\StringFileInfo\\%04x%04x\\LegalCopyRight"),
- m_Translation.languageId, m_Translation.characterSet);
-
- ::VerQueryValue (m_pVersionInfo, (LPTSTR)(LPCTSTR)query, (LPVOID*)&m_DllInfo.stCopyRight,
- &verLength);
-
- // Get product name information
-
- query.Format (_T ("\\StringFileInfo\\%04x%04x\\ProductName"),
- m_Translation.languageId, m_Translation.characterSet);
-
- ::VerQueryValue (m_pVersionInfo, (LPTSTR)(LPCTSTR)query, (LPVOID*)&m_DllInfo.stProductName,
- &verLength);
-
- // Get product version
-
- query.Format (_T ("\\StringFileInfo\\%04x%04x\\ProductVersion"),
- m_Translation.languageId, m_Translation.characterSet);
-
- ::VerQueryValue (m_pVersionInfo, (LPTSTR)(LPCTSTR)query, (LPVOID*)&m_DllInfo.stProductVersion,
- &verLength);
-
- // Get original file name.
-
- query.Format (_T ("\\StringFileInfo\\%04x%04x\\OriginalFileName"),
- m_Translation.languageId, m_Translation.characterSet);
-
- ::VerQueryValue (m_pVersionInfo, (LPTSTR)(LPCTSTR)query, (LPVOID*)&m_DllInfo.stOriginalName,
- &verLength);
-
- // Get original file description.
-
- query.Format (_T ("\\StringFileInfo\\%04x%04x\\FileDescription"),
- m_Translation.languageId, m_Translation.characterSet);
-
- ::VerQueryValue (m_pVersionInfo, (LPTSTR)(LPCTSTR)query, (LPVOID*)&m_DllInfo.stDescription,
- &verLength);
-
- // Get original file version.
-
- query.Format (_T ("\\StringFileInfo\\%04x%04x\\FileVersion"),
- m_Translation.languageId, m_Translation.characterSet);
-
- ::VerQueryValue (m_pVersionInfo, (LPTSTR)(LPCTSTR)query, (LPVOID*)&m_DllInfo.stFileVersion,
- &verLength);
-
- // Get original file version.
-
- query.Format (_T ("\\StringFileInfo\\%04x%04x\\InternalName"),
- m_Translation.languageId, m_Translation.characterSet);
-
- ::VerQueryValue (m_pVersionInfo, (LPTSTR)(LPCTSTR)query, (LPVOID*)&m_DllInfo.stInternalName,
- &verLength);
-
- return (true);
- }
-
- //
- // Function:
- // void FreeLib (HMODULE hModule)
- //
- // Parameters:
- // hModule Handle to the loaded Dll/Exe module
- //
- // Returns:
- //
- // Remarks:
- // Function makes Win32 API call to free the module if it was specifically loaded by
- // the application to get module information.
- //
-
- void
- CLibraryInfo::FreeLib (HMODULE hModule)
- {
- if (hModule != NULL) {
- FreeLibrary (hModule);
- }
- }
-
- //
- // bool GetCompanyName(CString & companyName)
- //
- // Parameters:
- // companyName Reference to comapny name string
- //
- // Returns:
- // true/false - success/error
- //
- // Remarks:
- // Gets the comapny name for the module.
- //
-
- bool
- CLibraryInfo::GetCompanyName(CString & companyName)
- {
- bool stat;
-
- // First make sure that we already have all the module information. If not then get the
- // information first.
-
- stat = (!m_bInfoObtained) ? GetInfo () : true;
-
- companyName = (stat) ? m_DllInfo.stCompany : _T("");
-
- return (stat);
- }
-
- //
- // bool GetCopyRight(CString & copyRight)
- //
- // Parameters:
- // copyRight Reference to copyright string
- //
- // Returns:
- // true/false - success/error
- //
- // Remarks:
- // Gets the copyright information for the module.
- //
-
- bool
- CLibraryInfo::GetCopyRight(CString ©Right)
- {
- bool stat;
-
- // First make sure that we already have all the module information. If not then get the
- // information first.
-
- stat = (!m_bInfoObtained) ? GetInfo () : true;
-
- copyRight = (stat) ? m_DllInfo.stCopyRight : _T("");
-
- return (stat);
- }
-
- //
- // bool GetOrigFileName(CString & origName)
- //
- // Parameters:
- // origName Reference to original module name string
- //
- // Returns:
- // true/false - success/error
- //
- // Remarks:
- // Gets the original module name for the module.
- //
-
- bool
- CLibraryInfo::GetOrigFileName(CString & origName)
- {
- bool stat;
-
- // First make sure that we already have all the module information. If not then get the
- // information first.
-
- stat = (!m_bInfoObtained) ? GetInfo () : true;
-
- origName = (stat) ? m_DllInfo.stOriginalName : _T("");
-
- return (stat);
- }
-
- //
- // bool GetInternalName(CString & internalName)
- //
- // Parameters:
- // internalName Reference to intrnal module name string
- //
- // Returns:
- // true/false - success/error
- //
- // Remarks:
- // Gets the intrnal module name for the module.
- //
-
- bool
- CLibraryInfo::GetInternalName(CString & internalName)
- {
- bool stat;
-
- // First make sure that we already have all the module information. If not then get the
- // information first.
-
- stat = (!m_bInfoObtained) ? GetInfo () : true;
-
- internalName = (stat) ? m_DllInfo.stInternalName : _T("");
-
- return (stat);
- }
-
- //
- // bool GetProductName(CString & prodName)
- //
- // Parameters:
- // prodName Reference to product name string
- //
- // Returns:
- // true/false - success/error
- //
- // Remarks:
- // Gets the product name for which the module has been written.
- //
-
- bool
- CLibraryInfo::GetProductName(CString & prodName)
- {
- bool stat;
-
- // First make sure that we already have all the module information. If not then get the
- // information first.
-
- stat = (!m_bInfoObtained) ? GetInfo () : true;
-
- prodName = (stat) ? m_DllInfo.stProductName : _T("");
-
- return (stat);
- }
-
- //
- // bool GetProductVersion(CString & prodVersion)
- //
- // Parameters:
- // prodVersion Reference to product version string
- //
- // Returns:
- // true/false - success/error
- //
- // Remarks:
- // Gets the version for the module.
- //
-
- bool
- CLibraryInfo::GetProductVersion(CString & prodVersion)
- {
- bool stat;
-
- // First make sure that we already have all the module information. If not then get the
- // information first.
-
- stat = (!m_bInfoObtained) ? GetInfo () : true;
-
- prodVersion = (stat) ? m_DllInfo.stProductVersion : _T("");
-
- return (stat);
- }
-
- //
- // bool GetDescription(CString & desc)
- //
- // Parameters:
- // desc Reference to description string
- //
- // Returns:
- // true/false - success/error
- //
- // Remarks:
- // Gets the description(if available) for the module.
- //
-
- bool
- CLibraryInfo::GetDescription(CString & desc)
- {
- bool stat;
-
- // First make sure that we already have all the module information. If not then get the
- // information first.
-
- stat = (!m_bInfoObtained) ? GetInfo () : true;
-
- desc = (stat) ? m_DllInfo.stDescription : _T("");
-
- return (stat);
- }
-
- //
- // bool GetFileVersion(CString & fileVer)
- //
- // Parameters:
- // fileVer Reference to file version string
- //
- // Returns:
- // true/false - success/error
- //
- // Remarks:
- // Gets the file version for the module.
- //
-
- bool
- CLibraryInfo::GetFileVersion(CString & fileVer)
- {
- bool stat;
-
- // First make sure that we already have all the module information. If not then get the
- // information first.
-
- stat = (!m_bInfoObtained) ? GetInfo () : true;
-
- fileVer = (stat) ? m_DllInfo.stFileVersion : _T("");
-
- return (stat);
- }
-
- //
- // bool GetMajorVersion(CString & majorVer)
- //
- // Parameters:
- // majorVer Reference to file's major version string
- //
- // Returns:
- // true/false - success/error
- //
- // Remarks:
- // Gets the file's major version numer for the module.
- //
-
- bool
- CLibraryInfo::GetMajorVersion(CString & majorVer)
- {
- bool stat;
-
- // First make sure that we already have all the module information. If not then get the
- // information first.
-
- stat = (!m_bInfoObtained) ? GetInfo () : true;
-
- majorVer = (stat) ? m_DllInfo.stMajorVersion : _T("");
-
- return (stat);
- }
-
- //
- // bool GetMinorVer(CString & minorVer)
- //
- // Parameters:
- // minorVer Reference to file's minor version string
- //
- // Returns:
- // true/false - success/error
- //
- // Remarks:
- // Gets the file's minor version numer for the module.
- //
-
- bool
- CLibraryInfo::GetMinorVer(CString & minorVer)
- {
- bool stat;
-
- // First make sure that we already have all the module information. If not then get the
- // information first.
-
- stat = (!m_bInfoObtained) ? GetInfo () : true;
-
- minorVer = (stat) ? m_DllInfo.stMinorVersion : _T("");
-
- return (stat);
- }
-
- //
- // bool GetLanguage(CString & language)
- //
- // Parameters:
- // language Reference to language string
- //
- // Returns:
- // true/false - success/error
- //
- // Remarks:
- // Gets the language for which this module has been written.
- //
-
- bool
- CLibraryInfo::GetLanguage(CString & language)
- {
- bool stat;
-
- // First make sure that we already have all the module information. If not then get the
- // information first.
-
- stat = (!m_bInfoObtained) ? GetInfo () : true;
-
- language = (stat) ? m_DllInfo.stLanguageId : _T("");
-
- return (stat);
- }
-
- //
- // bool GetCharacterSet(CString & characterSet)
- //
- // Parameters:
- // characterSet Reference to language string
- //
- // Returns:
- // true/false - success/error
- //
- // Remarks:
- // Gets the character set for which this module has been written.
- //
-
- bool
- CLibraryInfo::GetCharacterSet(CString & characterSet)
- {
- bool stat;
-
- // First make sure that we already have all the module information. If not then get the
- // information first.
-
- stat = (!m_bInfoObtained) ? GetInfo () : true;
-
- characterSet = (stat) ? m_DllInfo.stCharSet : _T("");
-
- return (stat);
- }
-
- //
- // bool GetLanguageId (WORD &langId)
- //
- // Parameters:
- // langId Reference to language id of module.
- //
- // Returns:
- // true/false - success/error
- //
- // Remarks:
- // Gets the id of the language for which this module has been written. This Id can be
- // derefrenced with the help of Win32 API to get exact language information.
- //
-
- bool
- CLibraryInfo::GetLanguageId (WORD &langId)
- {
- bool stat;
-
- // First make sure that we already have all the module information. If not then get the
- // information first.
-
- stat = (!m_bInfoObtained) ? GetInfo () : true;
-
- langId = (stat) ? m_Translation.languageId : WORD(NULL);
-
- return (stat);
- }
-
- //
- // bool GetCharacterset (WORD &charSet)
- //
- // Parameters:
- // charSet Reference to character set of module.
- //
- // Returns:
- // true/false - success/error
- //
- // Remarks:
- // Gets the character set of the language for which this module has been written. This set can
- // be derefrenced with the help of Win32 API to get exact character set information.
- //
-
- bool
- CLibraryInfo::GetCharacterset (WORD &charSet)
- {
- bool stat;
-
- // First make sure that we already have all the module information. If not then get the
- // information first.
-
- stat = (!m_bInfoObtained) ? GetInfo () : true;
-
- charSet = (stat) ? m_Translation.characterSet : (WORD)NULL;
-
- return (stat);
- }
-
- //
- // bool GetDllInfo (DLLINFO &info)
- //
- // Parameters:
- // info Reference to DLLINFO structure
- //
- // Returns:
- // true/false - success/error
- //
- // Remarks:
- // Gets the module information and returns in the DLLINFO structure.
- //
-
- bool
- CLibraryInfo::GetDllInfo (DLLINFO &info)
- {
- bool stat;
-
- // First make sure that we already have all the module information. If not then get the
- // information first.
-
- stat = (!m_bInfoObtained) ? GetInfo () : true;
-
- if (stat) {
- info.stDllName = m_DllInfo.stDllName;
- info.stCompany = m_DllInfo.stCompany;
- info.stCopyRight = m_DllInfo.stCopyRight;
- info.stDescription = m_DllInfo.stDescription;
- info.stFileVersion = m_DllInfo.stFileVersion;
- info.stMajorVersion = m_DllInfo.stMajorVersion;
- info. stMinorVersion = m_DllInfo. stMinorVersion;
- info.stInternalName = m_DllInfo.stInternalName;
- info.stOriginalName = m_DllInfo.stOriginalName;
- info.stProductName = m_DllInfo.stProductName;
- info.stProductVersion = m_DllInfo.stProductVersion;
- info.stDllVersion = m_DllInfo.stDllVersion;
- info.stFileOS = m_DllInfo.stFileOS;
- info.stFileType = m_DllInfo.stFileType;
- info.stLanguageId = m_DllInfo.stLanguageId;
- info.stCharSet = m_DllInfo.stCharSet;
- }
-
- return (stat);
- }
-
- //
- // bool GetDllInfo (BYTE *versionInfo)
- //
- // Parameters:
- // versionInfo Pointer to versioninfo
- //
- // Returns:
- // true/false - success/error
- //
- // Remarks:
- // Gets the pointer to the version info. This pointer can be derefrenced and manipulated to
- // get the complete information about module.
- //
-
- bool
- CLibraryInfo::GetDllInfo (BYTE *versionInfo)
- {
- bool stat;
-
- // First make sure that we already have all the module information. If not then get the
- // information first.
-
- stat = (!m_bInfoObtained) ? GetInfo () : true;
-
- versionInfo = (stat) ? m_pVersionInfo : NULL;
-
- return (stat);
- }
-
- //
- // bool GetDllInfo (VS_FIXEDFILEINFO &fixedInfo)
- //
- // Parameters:
- // fixedInfo Reference to VS_FIXEDFILEINFO
- //
- // Returns:
- // true/false - success/error
- //
- // Remarks:
- // Gets the reference to VS_FIXEDFILEINFO data structure which contains complete fixed
- // file info for the module.
- //
-
- bool
- CLibraryInfo::GetDllInfo (VS_FIXEDFILEINFO &fixedInfo)
- {
- bool stat;
-
- // First make sure that we already have all the module information. If not then get the
- // information first.
-
- stat = (!m_bInfoObtained) ? GetInfo () : true;
-
- if (stat) {
- fixedInfo.dwSignature = m_FixedFileInfo.dwSignature;
- fixedInfo.dwStrucVersion = m_FixedFileInfo.dwStrucVersion;
- fixedInfo.dwFileVersionMS = m_FixedFileInfo.dwFileVersionMS;
- fixedInfo.dwFileVersionLS = m_FixedFileInfo.dwFileVersionLS;
- fixedInfo.dwProductVersionMS = m_FixedFileInfo.dwProductVersionMS;
- fixedInfo.dwProductVersionLS = m_FixedFileInfo.dwProductVersionLS;
- fixedInfo.dwFileFlagsMask = m_FixedFileInfo.dwFileFlagsMask;
- fixedInfo.dwFileFlags = m_FixedFileInfo.dwFileFlags;
- fixedInfo.dwFileOS = m_FixedFileInfo.dwFileOS;
- fixedInfo.dwFileType = m_FixedFileInfo.dwFileType;
- fixedInfo.dwFileSubtype = m_FixedFileInfo.dwFileSubtype;
- fixedInfo.dwFileDateMS = m_FixedFileInfo.dwFileDateMS;
- fixedInfo.dwFileDateLS = m_FixedFileInfo.dwFileDateLS;
-
- }
-
- return (stat);
- }