summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2012-07-21 19:29:50 +0000
committerGeorge Hazan <george.hazan@gmail.com>2012-07-21 19:29:50 +0000
commite461ff6e109039b7c8993877a68b2a0ecf3ff413 (patch)
tree2e43c5f60beb1272be0f92400ea3b1f41b5cd0a9
parentc2df6e7bbf6efdb36f751379c154623191864a1f (diff)
fix for displaying version
git-svn-id: http://svn.miranda-ng.org/main/trunk@1095 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
-rw-r--r--plugins/CrashDumper/src/dumper.cpp22
-rw-r--r--plugins/CrashDumper/src/version.h6
-rw-r--r--plugins/VersionInfo/CPlugin.cpp36
-rw-r--r--plugins/VersionInfo/version.h2
4 files changed, 47 insertions, 19 deletions
diff --git a/plugins/CrashDumper/src/dumper.cpp b/plugins/CrashDumper/src/dumper.cpp
index bae091a023..df69f881a1 100644
--- a/plugins/CrashDumper/src/dumper.cpp
+++ b/plugins/CrashDumper/src/dumper.cpp
@@ -22,6 +22,7 @@ extern TCHAR* vertxt;
extern TCHAR* profname;
extern TCHAR* profpath;
+#pragma comment(lib, "version.lib")
void CreateMiniDump(HANDLE hDumpFile, PEXCEPTION_POINTERS exc_ptr)
{
@@ -241,10 +242,27 @@ static void GetPluginsString(bkstring& buffer, unsigned& flags)
const TCHAR *unica = (ep && ((PLUGININFOEX*)pi)->flags & 1) ? TEXT("|Unicode aware|") : TEXT("");
ListItem* lst = new ListItem;
- DWORD ver = pi->version;
+ int v1, v2, v3, v4;
+
+ DWORD unused, verInfoSize = GetFileVersionInfoSize(path, &unused);
+ if (verInfoSize != 0) {
+ UINT blockSize;
+ VS_FIXEDFILEINFO* fi;
+ void* pVerInfo = mir_alloc(verInfoSize);
+ GetFileVersionInfo(path, 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 = pi->version;
+ v1 = HIBYTE(HIWORD(ver)), v2 = LOBYTE(HIWORD(ver)), v3 = HIBYTE(LOWORD(ver)), v4 = LOBYTE(LOWORD(ver));
+ }
+
lst->str.appendfmt(format, ep ? TEXT('\xa4') : TEXT(' '), FindFileData.cFileName,
(flags & VI_FLAG_FORMAT) ? TEXT("[b]") : TEXT(""),
- HIBYTE(HIWORD(ver)), LOBYTE(HIWORD(ver)), HIBYTE(LOWORD(ver)), LOBYTE(LOWORD(ver)),
+ v1, v2, v3, v4,
(flags & VI_FLAG_FORMAT) ? TEXT("[/b]") : TEXT(""),
timebuf, pi->shortName ? pi->shortName : "", unica);
diff --git a/plugins/CrashDumper/src/version.h b/plugins/CrashDumper/src/version.h
index 776e30e404..288dccf0fa 100644
--- a/plugins/CrashDumper/src/version.h
+++ b/plugins/CrashDumper/src/version.h
@@ -1,3 +1,3 @@
-#define __FILEVERSION_STRING 0,0,4,21
-#define __VERSION_STRING "0.0.4.21"
-#define __VERSION_DWORD PLUGIN_MAKE_VERSION(0, 0, 4, 21)
+#define __FILEVERSION_STRING 0,0,4,22
+#define __VERSION_STRING "0.0.4.22"
+#define __VERSION_DWORD PLUGIN_MAKE_VERSION(0, 0, 4, 22)
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)