01c7700793e3db356c774e7e7d2bf80456db1014Danny Mayer// VersionInfo.cpp: implementation of the CVersionInfo class.
01c7700793e3db356c774e7e7d2bf80456db1014Danny Mayer//////////////////////////////////////////////////////////////////////
01c7700793e3db356c774e7e7d2bf80456db1014Danny Mayer//////////////////////////////////////////////////////////////////////
01c7700793e3db356c774e7e7d2bf80456db1014Danny Mayer//////////////////////////////////////////////////////////////////////
01c7700793e3db356c774e7e7d2bf80456db1014Danny Mayer // See if the given file exists
01c7700793e3db356c774e7e7d2bf80456db1014Danny Mayer // Extract the file info
01c7700793e3db356c774e7e7d2bf80456db1014Danny Mayer DWORD viSize = GetFileVersionInfoSize((LPTSTR)(LPCTSTR)filename, &handle);
01c7700793e3db356c774e7e7d2bf80456db1014Danny Mayer // Get the block of version info from the file
01c7700793e3db356c774e7e7d2bf80456db1014Danny Mayer if(!GetFileVersionInfo((LPTSTR)(LPCTSTR)filename, handle, viSize, m_versionInfo))
01c7700793e3db356c774e7e7d2bf80456db1014Danny Mayer // Now extract the sub block we are interested in
01c7700793e3db356c774e7e7d2bf80456db1014Danny Mayer if(!VerQueryValue(m_versionInfo, "\\", &viBlob, &versionLen))
01c7700793e3db356c774e7e7d2bf80456db1014Danny Mayer // And finally the version info is ours
01c7700793e3db356c774e7e7d2bf80456db1014Danny Mayer // If we got here, all is good
01c7700793e3db356c774e7e7d2bf80456db1014Danny MayerBOOL CVersionInfo::CopyFileCheckVersion(CVersionInfo &originalFile)
01c7700793e3db356c774e7e7d2bf80456db1014Danny MayerBOOL CVersionInfo::CopyFileNoVersion(CVersionInfo &originalFile)
01c7700793e3db356c774e7e7d2bf80456db1014Danny Mayer return(CopyFile(originalFile.GetFilename(), m_filename, FALSE));
01c7700793e3db356c774e7e7d2bf80456db1014Danny MayerCString CVersionInfo::QueryStringValue(CString value)
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.
fcb5e646e4d775539e348fa21ba13307f2695bf5Mark Andrews "\\StringFileInfo\\%08X\\%s",
fcb5e646e4d775539e348fa21ba13307f2695bf5Mark Andrews if (n >= 0 && (size_t)n < sizeof(queryString)) {
fcb5e646e4d775539e348fa21ba13307f2695bf5Mark Andrews return((char *)viBlob);
01c7700793e3db356c774e7e7d2bf80456db1014Danny Mayer return("Not Available");