Old common version.cpp and version.h is no longer required, remove it.

This commit is contained in:
Emmet Young 2015-02-17 21:00:44 +11:00
parent d38de99bfa
commit e540a7fdac
7 changed files with 0 additions and 172 deletions

View File

@ -49,7 +49,6 @@
<PrecompiledHeader>Create</PrecompiledHeader>
</ClCompile>
<ClCompile Include="Trace.cpp" />
<ClCompile Include="Version.cpp" />
</ItemGroup>
<ItemGroup>
<ClInclude Include="CriticalSection.h" />
@ -65,7 +64,6 @@
<ClInclude Include="stdafx.h" />
<ClInclude Include="Trace.h" />
<ClInclude Include="TraceDefs.h" />
<ClInclude Include="Version.h" />
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">

View File

@ -41,9 +41,6 @@
<ClCompile Include="Trace.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="Version.cpp">
<Filter>Source Files</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="CriticalSection.h">
@ -85,8 +82,5 @@
<ClInclude Include="TraceDefs.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="Version.h">
<Filter>Header Files</Filter>
</ClInclude>
</ItemGroup>
</Project>

View File

@ -1,145 +0,0 @@
#include "stdafx.h"
#pragma comment(lib, "version.lib")
stdstr ReadVersionInfo( BYTE * Array, LPCTSTR Info )
{
// Read the list of languages and code pages. We will use only the first one.
struct SLangCP { WORD wLang; WORD wCP; } * pTrans ;
UINT nVersionLen = 0 ;
BOOL bRetCode = ::VerQueryValue( Array, TEXT("\\VarFileInfo\\Translation"), (LPVOID*)&pTrans, &nVersionLen );
if (!bRetCode)
{
WriteTrace(TraceError,_T("ReadVersionInfo(): VerQueryValue failed"));
return _T("");
}
// Get the file version
TCHAR szLookup[MAX_PATH] ;
_stprintf( szLookup, TEXT("\\StringFileInfo\\%04x%04x\\%s"),pTrans[0].wLang, pTrans[0].wCP,Info ) ;
LPTSTR pszVersion = NULL ;
bRetCode = ::VerQueryValue( Array, szLookup, (LPVOID*)&pszVersion, &nVersionLen ) ;
if (!bRetCode)
{
WriteTrace(TraceError,_T("ReadVersionInfo(): VerQueryValue failed"));
return _T("");
}
if (_tcscmp(Info,VERSION_PRODUCT_VERSION) == 0 || _tcscmp(Info,VERSION_FILE_VERSION) == 0)
{
for (ULONG Pos = 0; Pos < _tcslen(pszVersion); Pos ++) {
if (pszVersion[Pos] == ',')
{
pszVersion[Pos] = '.';
}
}
}
return pszVersion;
}
bool HasFileVersionInfo( LPCTSTR /*Info*/, LPCTSTR FileName )
{
DWORD dwHandle;
DWORD Size = GetFileVersionInfoSize((LPTSTR)FileName,&dwHandle);
if ( Size == 0)
{
return false;
}
return true;
}
stdstr FileVersionInfo( LPCTSTR Info, LPCTSTR FileName )
{
stdstr Result;
if(FileName)
{
if(_tcslen(FileName) != 0)
{
DWORD dwHandle = 0;
DWORD Size = GetFileVersionInfoSize((LPSTR)FileName,&dwHandle);
if ( Size == 0)
{
//WriteTraceF(TraceError,_T("FileVersionInfo(%s, %s): GetFileVersionInfoSize failed, error (%s)"),Info,FileName,BaseException::GetLastErrorDescription(GetLastError()).c_str());
return TEXT("");
}
BYTE * Array = new BYTE [Size+(1*sizeof(TCHAR))];
if(Array)
{
memset(Array, 0, Size+(1*sizeof(TCHAR)));
try
{
if (!GetFileVersionInfo((LPSTR)FileName,0,Size,Array))
{
//WriteTraceF(TraceError,_T("FileVersionInfo(%s, %s): GetFileVersionInfo(%d) failed, error (%s)"),Info,FileName,Size,BaseException::GetLastErrorDescription(GetLastError()).c_str());
delete [] Array;
return _T("");
}
}
catch (...)
{
WriteTrace(TraceError,_T("Unhandled exception in FileVersionInfo (1)"));
delete [] Array;
return _T("");
}
try
{
Result = ReadVersionInfo(Array,Info);
if(!Result.empty())
{
if (strcmp(Info,VERSION_PRODUCT_VERSION) == 0)
{
Result.Replace(" ","");
}
} else {
WriteTraceF(TraceError,_T("FileVersionInfo(%s), ReadVersionInfo() failed"), FileName);
}
}
catch (...)
{
WriteTrace(TraceError,_T("Unhandled exception in FileVersionInfo (2)"));
delete [] Array;
return _T("");
}
delete [] Array;
}
else
{
WriteTraceF(TraceError,_T("Failed to allocate %d bytes"), Size+(1*sizeof(TCHAR)));
}
}
else
{
WriteTraceF(TraceError,_T("FileVersionInfo received a pointer to an empty string"));
}
}
else
{
WriteTraceF(TraceError,_T("FileVersionInfo received NULL pointer"));
}
return Result;
}
stdstr VersionInfo(LPCTSTR Info, HMODULE hModule)
{
TCHAR FileName[MAX_PATH];
if (GetModuleFileName(hModule,FileName,sizeof(FileName)) != 0)
{
return FileVersionInfo(Info,FileName);
}
return TEXT("");
}

View File

@ -1,16 +0,0 @@
#pragma once
#define VERSION_COMPANY_NAME "CompanyName"
#define VERSION_FILE_DESCRIPTION "FileDescription"
#define VERSION_FILE_VERSION "FileVersion"
#define VERSION_INTERNAL_NAME "InternalName"
#define VERSION_LEGAL_COPYRIGHT "LegalCopyright"
#define VERSION_ORIGINAL_FILE_NAME "OriginalFileName"
#define VERSION_PRODUCT_NAME "ProductName"
#define VERSION_PRODUCT_VERSION "ProductVersion"
#include "std string.h"
bool HasFileVersionInfo ( LPCSTR Info, LPCSTR FileName );
stdstr FileVersionInfo ( LPCSTR Info, LPCSTR FileName );
stdstr VersionInfo ( LPCSTR Info, HMODULE hModule = NULL);

View File

@ -15,6 +15,5 @@
#include "Log Class.h"
#include "TraceDefs.h"
#include "Trace.h"
#include "Version.h"
#include "md5.h"
#include "Smart Pointer.h"

View File

@ -8,7 +8,6 @@
#include <common//Log Class.h>
#include <common/TraceDefs.h>
#include <common/Trace.h>
#include <common/Version.h>
#include <common/path.h>
#include <common/Smart Pointer.h>
#include <common/Ini File Class.h>

View File

@ -30,7 +30,6 @@
#include <stdio.h>
#include <common/std string.h>
#include <common/Version.h>
#include "../Settings/Settings.h"
extern "C" {