diff options
author | George Hazan <george.hazan@gmail.com> | 2012-07-21 19:29:50 +0000 |
---|---|---|
committer | George Hazan <george.hazan@gmail.com> | 2012-07-21 19:29:50 +0000 |
commit | e461ff6e109039b7c8993877a68b2a0ecf3ff413 (patch) | |
tree | 2e43c5f60beb1272be0f92400ea3b1f41b5cd0a9 /plugins/VersionInfo | |
parent | c2df6e7bbf6efdb36f751379c154623191864a1f (diff) |
fix for displaying version
git-svn-id: http://svn.miranda-ng.org/main/trunk@1095 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/VersionInfo')
-rw-r--r-- | plugins/VersionInfo/CPlugin.cpp | 36 | ||||
-rw-r--r-- | plugins/VersionInfo/version.h | 2 |
2 files changed, 24 insertions, 14 deletions
diff --git a/plugins/VersionInfo/CPlugin.cpp b/plugins/VersionInfo/CPlugin.cpp index 56dc3e994a..54d762064a 100644 --- a/plugins/VersionInfo/CPlugin.cpp +++ b/plugins/VersionInfo/CPlugin.cpp @@ -19,10 +19,11 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
#include "CPlugin.h"
-//#include "AggressiveOptimize.h"
#include "common.h"
+#pragma comment(lib, "version.lib")
+
const int cPLUGIN_UUID_MARK = 4;
TCHAR PLUGIN_UUID_MARK[cPLUGIN_UUID_MARK];
@@ -41,8 +42,26 @@ CPlugin::CPlugin(LPCTSTR eFileName, LPCTSTR eShortName, MUUID pluginID, LPCTSTR lpzTimestamp = eTimestamp;
lpzLinkedModules = eLinkedModules;
+ int v1, v2, v3, v4;
+
+ DWORD unused, verInfoSize = GetFileVersionInfoSize(eFileName, &unused);
+ if (verInfoSize != 0) {
+ UINT blockSize;
+ VS_FIXEDFILEINFO* fi;
+ void* pVerInfo = mir_alloc(verInfoSize);
+ GetFileVersionInfo(eFileName, 0, verInfoSize, pVerInfo);
+ VerQueryValue(pVerInfo, _T("\\"), (LPVOID*)&fi, &blockSize);
+ v1 = HIWORD(fi->dwProductVersionMS), v2 = LOWORD(fi->dwProductVersionMS),
+ v3 = HIWORD(fi->dwProductVersionLS), v4 = LOWORD(fi->dwProductVersionLS);
+ mir_free(pVerInfo);
+ }
+ else {
+ DWORD ver = eVersion;
+ v1 = HIBYTE(HIWORD(ver)), v2 = LOBYTE(HIWORD(ver)), v3 = HIBYTE(LOWORD(ver)), v4 = LOBYTE(LOWORD(ver));
+ }
+
TCHAR aux[128];
- mir_sntprintf(aux, SIZEOF(aux), _T("%d.%d.%d.%d"), (eVersion>>24)&0xFF, (eVersion>>16)&0xFF, (eVersion>>8)&0xFF, (eVersion)&0xFF);
+ mir_sntprintf(aux, SIZEOF(aux), _T("%d.%d.%d.%d"), v1, v2, v3, v4);
lpzVersion = aux;
this->pluginID = pluginID;
@@ -58,17 +77,8 @@ CPlugin::CPlugin(const CPlugin& other) { pluginID = other.pluginID;
}
-CPlugin::~CPlugin() {
- //Debug information
-// char str[64]; wsprintf(str, "~CPlugin(): %s", lpzFileName.c_str());
-// MB(str);
- //
- lpzFileName.~basic_string();
- lpzShortName.~basic_string();
- lpzVersion.~basic_string();
- lpzUnicodeInfo.~basic_string();
- lpzTimestamp.~basic_string();
- lpzLinkedModules.~basic_string();
+CPlugin::~CPlugin()
+{
}
void CPlugin::SetErrorMessage(LPCTSTR error)
diff --git a/plugins/VersionInfo/version.h b/plugins/VersionInfo/version.h index 200ac05349..18a7fcf39a 100644 --- a/plugins/VersionInfo/version.h +++ b/plugins/VersionInfo/version.h @@ -24,7 +24,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #define __MAJOR_VERSION 1
#define __MINOR_VERSION 5
#define __RELEASE_NUM 0
-#define __BUILD_NUM 2
+#define __BUILD_NUM 3
#define VERSION PLUGIN_MAKE_VERSION(__MAJOR_VERSION, __MINOR_VERSION, __RELEASE_NUM, __BUILD_NUM)
|