01c7700793e3db356c774e7e7d2bf80456db1014Danny Mayer// VersionInfo.cpp: implementation of the CVersionInfo class.
01c7700793e3db356c774e7e7d2bf80456db1014Danny Mayer//
01c7700793e3db356c774e7e7d2bf80456db1014Danny Mayer//////////////////////////////////////////////////////////////////////
01c7700793e3db356c774e7e7d2bf80456db1014Danny Mayer
01c7700793e3db356c774e7e7d2bf80456db1014Danny Mayer#include "stdafx.h"
01c7700793e3db356c774e7e7d2bf80456db1014Danny Mayer#include "bindinstall.h"
01c7700793e3db356c774e7e7d2bf80456db1014Danny Mayer#include "VersionInfo.h"
01c7700793e3db356c774e7e7d2bf80456db1014Danny Mayer#include <winver.h>
01c7700793e3db356c774e7e7d2bf80456db1014Danny Mayer
fcb5e646e4d775539e348fa21ba13307f2695bf5Mark Andrews#include <config.h>
fcb5e646e4d775539e348fa21ba13307f2695bf5Mark Andrews
01c7700793e3db356c774e7e7d2bf80456db1014Danny Mayer#ifdef _DEBUG
01c7700793e3db356c774e7e7d2bf80456db1014Danny Mayer#undef THIS_FILE
01c7700793e3db356c774e7e7d2bf80456db1014Danny Mayerstatic char THIS_FILE[]=__FILE__;
01c7700793e3db356c774e7e7d2bf80456db1014Danny Mayer#define new DEBUG_NEW
01c7700793e3db356c774e7e7d2bf80456db1014Danny Mayer#endif
01c7700793e3db356c774e7e7d2bf80456db1014Danny Mayer
01c7700793e3db356c774e7e7d2bf80456db1014Danny Mayer//////////////////////////////////////////////////////////////////////
01c7700793e3db356c774e7e7d2bf80456db1014Danny Mayer// Construction/Destruction
01c7700793e3db356c774e7e7d2bf80456db1014Danny Mayer//////////////////////////////////////////////////////////////////////
01c7700793e3db356c774e7e7d2bf80456db1014Danny Mayer
01c7700793e3db356c774e7e7d2bf80456db1014Danny MayerCVersionInfo::CVersionInfo(CString filename)
01c7700793e3db356c774e7e7d2bf80456db1014Danny Mayer{
01c7700793e3db356c774e7e7d2bf80456db1014Danny Mayer HANDLE hFile;
01c7700793e3db356c774e7e7d2bf80456db1014Danny Mayer WIN32_FIND_DATA fd;
01c7700793e3db356c774e7e7d2bf80456db1014Danny Mayer memset(&fd, 0, sizeof(WIN32_FIND_DATA));
01c7700793e3db356c774e7e7d2bf80456db1014Danny Mayer
01c7700793e3db356c774e7e7d2bf80456db1014Danny Mayer m_status = ERROR_SUCCESS;
01c7700793e3db356c774e7e7d2bf80456db1014Danny Mayer m_isValid = FALSE;
01c7700793e3db356c774e7e7d2bf80456db1014Danny Mayer m_filename = filename;
01c7700793e3db356c774e7e7d2bf80456db1014Danny Mayer
01c7700793e3db356c774e7e7d2bf80456db1014Danny Mayer // See if the given file exists
01c7700793e3db356c774e7e7d2bf80456db1014Danny Mayer hFile = FindFirstFile(filename, &fd);
01c7700793e3db356c774e7e7d2bf80456db1014Danny Mayer if(hFile == INVALID_HANDLE_VALUE)
01c7700793e3db356c774e7e7d2bf80456db1014Danny Mayer {
01c7700793e3db356c774e7e7d2bf80456db1014Danny Mayer m_status = ERROR_FILE_NOT_FOUND;
01c7700793e3db356c774e7e7d2bf80456db1014Danny Mayer m_versionInfo = NULL;
01c7700793e3db356c774e7e7d2bf80456db1014Danny Mayer return;
01c7700793e3db356c774e7e7d2bf80456db1014Danny Mayer }
01c7700793e3db356c774e7e7d2bf80456db1014Danny Mayer FindClose(hFile);
01c7700793e3db356c774e7e7d2bf80456db1014Danny Mayer
01c7700793e3db356c774e7e7d2bf80456db1014Danny Mayer // Extract the file info
01c7700793e3db356c774e7e7d2bf80456db1014Danny Mayer DWORD handle;
01c7700793e3db356c774e7e7d2bf80456db1014Danny Mayer DWORD viSize = GetFileVersionInfoSize((LPTSTR)(LPCTSTR)filename, &handle);
01c7700793e3db356c774e7e7d2bf80456db1014Danny Mayer m_versionInfo = NULL;
01c7700793e3db356c774e7e7d2bf80456db1014Danny Mayer
01c7700793e3db356c774e7e7d2bf80456db1014Danny Mayer if(viSize == 0)
01c7700793e3db356c774e7e7d2bf80456db1014Danny Mayer {
01c7700793e3db356c774e7e7d2bf80456db1014Danny Mayer m_status = GetLastError();
01c7700793e3db356c774e7e7d2bf80456db1014Danny Mayer }
01c7700793e3db356c774e7e7d2bf80456db1014Danny Mayer else
01c7700793e3db356c774e7e7d2bf80456db1014Danny Mayer {
01c7700793e3db356c774e7e7d2bf80456db1014Danny Mayer m_versionInfo = new char[viSize];
01c7700793e3db356c774e7e7d2bf80456db1014Danny Mayer
01c7700793e3db356c774e7e7d2bf80456db1014Danny Mayer // Get the block of version info from the file
01c7700793e3db356c774e7e7d2bf80456db1014Danny Mayer if(!GetFileVersionInfo((LPTSTR)(LPCTSTR)filename, handle, viSize, m_versionInfo))
01c7700793e3db356c774e7e7d2bf80456db1014Danny Mayer {
01c7700793e3db356c774e7e7d2bf80456db1014Danny Mayer if(m_versionInfo)
01c7700793e3db356c774e7e7d2bf80456db1014Danny Mayer {
04115a59c176759177545c72376e844e10dc557cMark Andrews delete [] m_versionInfo;
01c7700793e3db356c774e7e7d2bf80456db1014Danny Mayer m_versionInfo = NULL;
01c7700793e3db356c774e7e7d2bf80456db1014Danny Mayer }
01c7700793e3db356c774e7e7d2bf80456db1014Danny Mayer return;
01c7700793e3db356c774e7e7d2bf80456db1014Danny Mayer }
01c7700793e3db356c774e7e7d2bf80456db1014Danny Mayer
01c7700793e3db356c774e7e7d2bf80456db1014Danny Mayer // Now extract the sub block we are interested in
01c7700793e3db356c774e7e7d2bf80456db1014Danny Mayer UINT versionLen = 0;
01c7700793e3db356c774e7e7d2bf80456db1014Danny Mayer LPVOID viBlob = NULL;
01c7700793e3db356c774e7e7d2bf80456db1014Danny Mayer if(!VerQueryValue(m_versionInfo, "\\", &viBlob, &versionLen))
01c7700793e3db356c774e7e7d2bf80456db1014Danny Mayer {
01c7700793e3db356c774e7e7d2bf80456db1014Danny Mayer if(m_versionInfo)
01c7700793e3db356c774e7e7d2bf80456db1014Danny Mayer {
04115a59c176759177545c72376e844e10dc557cMark Andrews delete [] m_versionInfo;
01c7700793e3db356c774e7e7d2bf80456db1014Danny Mayer m_versionInfo = NULL;
01c7700793e3db356c774e7e7d2bf80456db1014Danny Mayer }
01c7700793e3db356c774e7e7d2bf80456db1014Danny Mayer return;
01c7700793e3db356c774e7e7d2bf80456db1014Danny Mayer }
01c7700793e3db356c774e7e7d2bf80456db1014Danny Mayer
01c7700793e3db356c774e7e7d2bf80456db1014Danny Mayer // And finally the version info is ours
01c7700793e3db356c774e7e7d2bf80456db1014Danny Mayer m_fixedInfo = (VS_FIXEDFILEINFO *)viBlob;
01c7700793e3db356c774e7e7d2bf80456db1014Danny Mayer
01c7700793e3db356c774e7e7d2bf80456db1014Danny Mayer UINT blobLen = 0;
01c7700793e3db356c774e7e7d2bf80456db1014Danny Mayer
01c7700793e3db356c774e7e7d2bf80456db1014Danny Mayer // If we got here, all is good
01c7700793e3db356c774e7e7d2bf80456db1014Danny Mayer }
01c7700793e3db356c774e7e7d2bf80456db1014Danny Mayer m_isValid = TRUE;
01c7700793e3db356c774e7e7d2bf80456db1014Danny Mayer}
01c7700793e3db356c774e7e7d2bf80456db1014Danny Mayer
01c7700793e3db356c774e7e7d2bf80456db1014Danny MayerCVersionInfo::~CVersionInfo()
01c7700793e3db356c774e7e7d2bf80456db1014Danny Mayer{
01c7700793e3db356c774e7e7d2bf80456db1014Danny Mayer m_fixedInfo = NULL;
01c7700793e3db356c774e7e7d2bf80456db1014Danny Mayer if(m_versionInfo)
01c7700793e3db356c774e7e7d2bf80456db1014Danny Mayer {
04115a59c176759177545c72376e844e10dc557cMark Andrews delete [] m_versionInfo;
01c7700793e3db356c774e7e7d2bf80456db1014Danny Mayer m_versionInfo = NULL;
01c7700793e3db356c774e7e7d2bf80456db1014Danny Mayer }
01c7700793e3db356c774e7e7d2bf80456db1014Danny Mayer}
01c7700793e3db356c774e7e7d2bf80456db1014Danny Mayer
01c7700793e3db356c774e7e7d2bf80456db1014Danny MayerCString CVersionInfo::GetFileVersionString()
01c7700793e3db356c774e7e7d2bf80456db1014Danny Mayer{
01c7700793e3db356c774e7e7d2bf80456db1014Danny Mayer return(QueryStringValue("FileVersion"));
01c7700793e3db356c774e7e7d2bf80456db1014Danny Mayer}
01c7700793e3db356c774e7e7d2bf80456db1014Danny Mayer
01c7700793e3db356c774e7e7d2bf80456db1014Danny MayerCString CVersionInfo::GetProductVersionString()
01c7700793e3db356c774e7e7d2bf80456db1014Danny Mayer{
01c7700793e3db356c774e7e7d2bf80456db1014Danny Mayer return(QueryStringValue("ProductVersion"));
01c7700793e3db356c774e7e7d2bf80456db1014Danny Mayer}
01c7700793e3db356c774e7e7d2bf80456db1014Danny Mayer
01c7700793e3db356c774e7e7d2bf80456db1014Danny MayerCString CVersionInfo::GetComments()
01c7700793e3db356c774e7e7d2bf80456db1014Danny Mayer{
01c7700793e3db356c774e7e7d2bf80456db1014Danny Mayer return(QueryStringValue("Comments"));
01c7700793e3db356c774e7e7d2bf80456db1014Danny Mayer}
01c7700793e3db356c774e7e7d2bf80456db1014Danny Mayer
01c7700793e3db356c774e7e7d2bf80456db1014Danny MayerCString CVersionInfo::GetFileDescription()
01c7700793e3db356c774e7e7d2bf80456db1014Danny Mayer{
01c7700793e3db356c774e7e7d2bf80456db1014Danny Mayer return(QueryStringValue("FileDescription"));
01c7700793e3db356c774e7e7d2bf80456db1014Danny Mayer}
01c7700793e3db356c774e7e7d2bf80456db1014Danny Mayer
01c7700793e3db356c774e7e7d2bf80456db1014Danny MayerCString CVersionInfo::GetInternalName()
01c7700793e3db356c774e7e7d2bf80456db1014Danny Mayer{
01c7700793e3db356c774e7e7d2bf80456db1014Danny Mayer return(QueryStringValue("InternalName"));
01c7700793e3db356c774e7e7d2bf80456db1014Danny Mayer}
01c7700793e3db356c774e7e7d2bf80456db1014Danny Mayer
01c7700793e3db356c774e7e7d2bf80456db1014Danny MayerCString CVersionInfo::GetLegalCopyright()
01c7700793e3db356c774e7e7d2bf80456db1014Danny Mayer{
01c7700793e3db356c774e7e7d2bf80456db1014Danny Mayer return(QueryStringValue("LegalCopyright"));
01c7700793e3db356c774e7e7d2bf80456db1014Danny Mayer}
01c7700793e3db356c774e7e7d2bf80456db1014Danny Mayer
01c7700793e3db356c774e7e7d2bf80456db1014Danny MayerCString CVersionInfo::GetLegalTrademarks()
01c7700793e3db356c774e7e7d2bf80456db1014Danny Mayer{
01c7700793e3db356c774e7e7d2bf80456db1014Danny Mayer return(QueryStringValue("LegalTrademarks"));
01c7700793e3db356c774e7e7d2bf80456db1014Danny Mayer}
01c7700793e3db356c774e7e7d2bf80456db1014Danny Mayer
01c7700793e3db356c774e7e7d2bf80456db1014Danny MayerCString CVersionInfo::GetOriginalFileName()
01c7700793e3db356c774e7e7d2bf80456db1014Danny Mayer{
01c7700793e3db356c774e7e7d2bf80456db1014Danny Mayer return(QueryStringValue("OriginalFilename"));
01c7700793e3db356c774e7e7d2bf80456db1014Danny Mayer}
01c7700793e3db356c774e7e7d2bf80456db1014Danny Mayer
01c7700793e3db356c774e7e7d2bf80456db1014Danny MayerCString CVersionInfo::GetProductName()
01c7700793e3db356c774e7e7d2bf80456db1014Danny Mayer{
01c7700793e3db356c774e7e7d2bf80456db1014Danny Mayer return(QueryStringValue("ProductName"));
01c7700793e3db356c774e7e7d2bf80456db1014Danny Mayer}
01c7700793e3db356c774e7e7d2bf80456db1014Danny Mayer
01c7700793e3db356c774e7e7d2bf80456db1014Danny MayerCString CVersionInfo::GetSpecialBuildString()
01c7700793e3db356c774e7e7d2bf80456db1014Danny Mayer{
01c7700793e3db356c774e7e7d2bf80456db1014Danny Mayer return(QueryStringValue("SpecialBuild"));
01c7700793e3db356c774e7e7d2bf80456db1014Danny Mayer}
01c7700793e3db356c774e7e7d2bf80456db1014Danny Mayer
01c7700793e3db356c774e7e7d2bf80456db1014Danny MayerCString CVersionInfo::GetPrivateBuildString()
01c7700793e3db356c774e7e7d2bf80456db1014Danny Mayer{
01c7700793e3db356c774e7e7d2bf80456db1014Danny Mayer return(QueryStringValue("PrivateBuild"));
01c7700793e3db356c774e7e7d2bf80456db1014Danny Mayer}
01c7700793e3db356c774e7e7d2bf80456db1014Danny Mayer
01c7700793e3db356c774e7e7d2bf80456db1014Danny MayerCString CVersionInfo::GetCompanyName()
01c7700793e3db356c774e7e7d2bf80456db1014Danny Mayer{
01c7700793e3db356c774e7e7d2bf80456db1014Danny Mayer return(QueryStringValue("CompanyName"));
01c7700793e3db356c774e7e7d2bf80456db1014Danny Mayer}
01c7700793e3db356c774e7e7d2bf80456db1014Danny Mayer
01c7700793e3db356c774e7e7d2bf80456db1014Danny Mayer#ifdef NOTUSED
01c7700793e3db356c774e7e7d2bf80456db1014Danny MayerBOOL CVersionInfo::CopyFileCheckVersion(CVersionInfo &originalFile)
01c7700793e3db356c774e7e7d2bf80456db1014Danny Mayer{
01c7700793e3db356c774e7e7d2bf80456db1014Danny Mayer _int64 myVer = GetFileVersion();
01c7700793e3db356c774e7e7d2bf80456db1014Danny Mayer _int64 origVer = originalFile.GetFileVersion();
01c7700793e3db356c774e7e7d2bf80456db1014Danny Mayer
01c7700793e3db356c774e7e7d2bf80456db1014Danny Mayer if(origVer > myVer)
01c7700793e3db356c774e7e7d2bf80456db1014Danny Mayer {
01c7700793e3db356c774e7e7d2bf80456db1014Danny Mayer CString msg;
01c7700793e3db356c774e7e7d2bf80456db1014Danny Mayer msg.Format(IDS_EXISTING_NEWER, m_filename);
01c7700793e3db356c774e7e7d2bf80456db1014Danny Mayer DWORD query = AfxMessageBox(msg, MB_YESNO);
01c7700793e3db356c774e7e7d2bf80456db1014Danny Mayer if(query == IDNO)
01c7700793e3db356c774e7e7d2bf80456db1014Danny Mayer return(TRUE);
01c7700793e3db356c774e7e7d2bf80456db1014Danny Mayer }
01c7700793e3db356c774e7e7d2bf80456db1014Danny Mayer
01c7700793e3db356c774e7e7d2bf80456db1014Danny Mayer return(CopyFileNoVersion(originalFile));
01c7700793e3db356c774e7e7d2bf80456db1014Danny Mayer}
01c7700793e3db356c774e7e7d2bf80456db1014Danny Mayer#endif
01c7700793e3db356c774e7e7d2bf80456db1014Danny Mayer
01c7700793e3db356c774e7e7d2bf80456db1014Danny MayerBOOL CVersionInfo::CopyFileNoVersion(CVersionInfo &originalFile)
01c7700793e3db356c774e7e7d2bf80456db1014Danny Mayer{
01c7700793e3db356c774e7e7d2bf80456db1014Danny Mayer int x = 7;
01c7700793e3db356c774e7e7d2bf80456db1014Danny Mayer return(CopyFile(originalFile.GetFilename(), m_filename, FALSE));
01c7700793e3db356c774e7e7d2bf80456db1014Danny Mayer}
01c7700793e3db356c774e7e7d2bf80456db1014Danny Mayer
01c7700793e3db356c774e7e7d2bf80456db1014Danny Mayer
01c7700793e3db356c774e7e7d2bf80456db1014Danny Mayer_int64 CVersionInfo::GetFileVersion()
01c7700793e3db356c774e7e7d2bf80456db1014Danny Mayer{
01c7700793e3db356c774e7e7d2bf80456db1014Danny Mayer _int64 ver = 0;
01c7700793e3db356c774e7e7d2bf80456db1014Danny Mayer
01c7700793e3db356c774e7e7d2bf80456db1014Danny Mayer if(m_versionInfo)
01c7700793e3db356c774e7e7d2bf80456db1014Danny Mayer {
01c7700793e3db356c774e7e7d2bf80456db1014Danny Mayer ver = m_fixedInfo->dwFileVersionMS;
01c7700793e3db356c774e7e7d2bf80456db1014Danny Mayer ver <<= 32;
01c7700793e3db356c774e7e7d2bf80456db1014Danny Mayer ver += m_fixedInfo->dwFileVersionLS;
01c7700793e3db356c774e7e7d2bf80456db1014Danny Mayer }
01c7700793e3db356c774e7e7d2bf80456db1014Danny Mayer return(ver);
01c7700793e3db356c774e7e7d2bf80456db1014Danny Mayer}
01c7700793e3db356c774e7e7d2bf80456db1014Danny Mayer
01c7700793e3db356c774e7e7d2bf80456db1014Danny Mayer_int64 CVersionInfo::GetProductVersion()
01c7700793e3db356c774e7e7d2bf80456db1014Danny Mayer{
01c7700793e3db356c774e7e7d2bf80456db1014Danny Mayer _int64 ver = 0;
01c7700793e3db356c774e7e7d2bf80456db1014Danny Mayer
01c7700793e3db356c774e7e7d2bf80456db1014Danny Mayer if(m_versionInfo)
01c7700793e3db356c774e7e7d2bf80456db1014Danny Mayer {
01c7700793e3db356c774e7e7d2bf80456db1014Danny Mayer ver = m_fixedInfo->dwProductVersionMS;
01c7700793e3db356c774e7e7d2bf80456db1014Danny Mayer ver <<= 32;
01c7700793e3db356c774e7e7d2bf80456db1014Danny Mayer ver += m_fixedInfo->dwProductVersionLS;
01c7700793e3db356c774e7e7d2bf80456db1014Danny Mayer }
01c7700793e3db356c774e7e7d2bf80456db1014Danny Mayer return(ver);
01c7700793e3db356c774e7e7d2bf80456db1014Danny Mayer}
01c7700793e3db356c774e7e7d2bf80456db1014Danny Mayer
01c7700793e3db356c774e7e7d2bf80456db1014Danny Mayer_int64 CVersionInfo::GetFileDate()
01c7700793e3db356c774e7e7d2bf80456db1014Danny Mayer{
01c7700793e3db356c774e7e7d2bf80456db1014Danny Mayer _int64 fDate = 0;
01c7700793e3db356c774e7e7d2bf80456db1014Danny Mayer
01c7700793e3db356c774e7e7d2bf80456db1014Danny Mayer if(m_versionInfo)
01c7700793e3db356c774e7e7d2bf80456db1014Danny Mayer {
01c7700793e3db356c774e7e7d2bf80456db1014Danny Mayer fDate = m_fixedInfo->dwFileDateMS;
01c7700793e3db356c774e7e7d2bf80456db1014Danny Mayer fDate <<= 32;
01c7700793e3db356c774e7e7d2bf80456db1014Danny Mayer fDate += m_fixedInfo->dwFileDateLS;
01c7700793e3db356c774e7e7d2bf80456db1014Danny Mayer }
01c7700793e3db356c774e7e7d2bf80456db1014Danny Mayer return(fDate);
01c7700793e3db356c774e7e7d2bf80456db1014Danny Mayer}
01c7700793e3db356c774e7e7d2bf80456db1014Danny Mayer
01c7700793e3db356c774e7e7d2bf80456db1014Danny MayerDWORD CVersionInfo::GetFileFlagMask()
01c7700793e3db356c774e7e7d2bf80456db1014Danny Mayer{
01c7700793e3db356c774e7e7d2bf80456db1014Danny Mayer if(m_versionInfo)
01c7700793e3db356c774e7e7d2bf80456db1014Danny Mayer {
01c7700793e3db356c774e7e7d2bf80456db1014Danny Mayer return(m_fixedInfo->dwFileFlagsMask);
01c7700793e3db356c774e7e7d2bf80456db1014Danny Mayer }
01c7700793e3db356c774e7e7d2bf80456db1014Danny Mayer return(0);
01c7700793e3db356c774e7e7d2bf80456db1014Danny Mayer}
01c7700793e3db356c774e7e7d2bf80456db1014Danny Mayer
01c7700793e3db356c774e7e7d2bf80456db1014Danny MayerDWORD CVersionInfo::GetFileFlags()
01c7700793e3db356c774e7e7d2bf80456db1014Danny Mayer{
01c7700793e3db356c774e7e7d2bf80456db1014Danny Mayer if(m_versionInfo)
01c7700793e3db356c774e7e7d2bf80456db1014Danny Mayer {
01c7700793e3db356c774e7e7d2bf80456db1014Danny Mayer return(m_fixedInfo->dwFileFlags);
01c7700793e3db356c774e7e7d2bf80456db1014Danny Mayer }
01c7700793e3db356c774e7e7d2bf80456db1014Danny Mayer return(0);
01c7700793e3db356c774e7e7d2bf80456db1014Danny Mayer}
01c7700793e3db356c774e7e7d2bf80456db1014Danny Mayer
01c7700793e3db356c774e7e7d2bf80456db1014Danny MayerDWORD CVersionInfo::GetFileOS()
01c7700793e3db356c774e7e7d2bf80456db1014Danny Mayer{
01c7700793e3db356c774e7e7d2bf80456db1014Danny Mayer if(m_versionInfo)
01c7700793e3db356c774e7e7d2bf80456db1014Danny Mayer {
01c7700793e3db356c774e7e7d2bf80456db1014Danny Mayer return(m_fixedInfo->dwFileOS);
01c7700793e3db356c774e7e7d2bf80456db1014Danny Mayer }
01c7700793e3db356c774e7e7d2bf80456db1014Danny Mayer return(VOS_UNKNOWN);
01c7700793e3db356c774e7e7d2bf80456db1014Danny Mayer}
01c7700793e3db356c774e7e7d2bf80456db1014Danny Mayer
01c7700793e3db356c774e7e7d2bf80456db1014Danny MayerDWORD CVersionInfo::GetFileType()
01c7700793e3db356c774e7e7d2bf80456db1014Danny Mayer{
01c7700793e3db356c774e7e7d2bf80456db1014Danny Mayer if(m_versionInfo)
01c7700793e3db356c774e7e7d2bf80456db1014Danny Mayer {
01c7700793e3db356c774e7e7d2bf80456db1014Danny Mayer return(m_fixedInfo->dwFileType);
01c7700793e3db356c774e7e7d2bf80456db1014Danny Mayer }
01c7700793e3db356c774e7e7d2bf80456db1014Danny Mayer return(VFT_UNKNOWN);
01c7700793e3db356c774e7e7d2bf80456db1014Danny Mayer}
01c7700793e3db356c774e7e7d2bf80456db1014Danny Mayer
01c7700793e3db356c774e7e7d2bf80456db1014Danny MayerDWORD CVersionInfo::GetFileSubType()
01c7700793e3db356c774e7e7d2bf80456db1014Danny Mayer{
01c7700793e3db356c774e7e7d2bf80456db1014Danny Mayer if(m_versionInfo)
01c7700793e3db356c774e7e7d2bf80456db1014Danny Mayer {
01c7700793e3db356c774e7e7d2bf80456db1014Danny Mayer return(m_fixedInfo->dwFileSubtype);
01c7700793e3db356c774e7e7d2bf80456db1014Danny Mayer }
01c7700793e3db356c774e7e7d2bf80456db1014Danny Mayer return(VFT2_UNKNOWN);
01c7700793e3db356c774e7e7d2bf80456db1014Danny Mayer}
01c7700793e3db356c774e7e7d2bf80456db1014Danny Mayer
01c7700793e3db356c774e7e7d2bf80456db1014Danny MayerCString CVersionInfo::QueryStringValue(CString value)
01c7700793e3db356c774e7e7d2bf80456db1014Danny Mayer{
01c7700793e3db356c774e7e7d2bf80456db1014Danny Mayer UINT blobLen = 0;
01c7700793e3db356c774e7e7d2bf80456db1014Danny Mayer LPVOID viBlob = NULL;
fcb5e646e4d775539e348fa21ba13307f2695bf5Mark Andrews int n;
01c7700793e3db356c774e7e7d2bf80456db1014Danny Mayer
01c7700793e3db356c774e7e7d2bf80456db1014Danny Mayer if(m_versionInfo)
01c7700793e3db356c774e7e7d2bf80456db1014Danny Mayer {
01c7700793e3db356c774e7e7d2bf80456db1014Danny Mayer char queryString[256];
01c7700793e3db356c774e7e7d2bf80456db1014Danny Mayer
fcb5e646e4d775539e348fa21ba13307f2695bf5Mark Andrews // This code page value is for American English.
fcb5e646e4d775539e348fa21ba13307f2695bf5Mark Andrews // If you change the resources to be other than that
01c7700793e3db356c774e7e7d2bf80456db1014Danny Mayer // You probably should change this to match it.
01c7700793e3db356c774e7e7d2bf80456db1014Danny Mayer DWORD codePage = 0x040904B0;
01c7700793e3db356c774e7e7d2bf80456db1014Danny Mayer
fcb5e646e4d775539e348fa21ba13307f2695bf5Mark Andrews n = snprintf(queryString, sizeof(queryString),
fcb5e646e4d775539e348fa21ba13307f2695bf5Mark Andrews "\\StringFileInfo\\%08X\\%s",
fcb5e646e4d775539e348fa21ba13307f2695bf5Mark Andrews codePage, (LPCTSTR) value);
fcb5e646e4d775539e348fa21ba13307f2695bf5Mark Andrews if (n >= 0 && (size_t)n < sizeof(queryString)) {
fcb5e646e4d775539e348fa21ba13307f2695bf5Mark Andrews if(VerQueryValue(m_versionInfo, queryString,
fcb5e646e4d775539e348fa21ba13307f2695bf5Mark Andrews &viBlob, &blobLen))
fcb5e646e4d775539e348fa21ba13307f2695bf5Mark Andrews return((char *)viBlob);
fcb5e646e4d775539e348fa21ba13307f2695bf5Mark Andrews }
01c7700793e3db356c774e7e7d2bf80456db1014Danny Mayer }
01c7700793e3db356c774e7e7d2bf80456db1014Danny Mayer return("Not Available");
01c7700793e3db356c774e7e7d2bf80456db1014Danny Mayer}