Permalink
Browse files

Fix for update PM, use default file version

- wrong verb used to start Gpup (open instead of runas)
- File Version now used, not the translated (locale specific) file version.
  • Loading branch information...
1 parent f605ecb commit 1eb1507d9400e8ceca9aaf526bcb08c5f0128206 @bruderstein committed Dec 30, 2011
Showing with 48 additions and 27 deletions.
  1. +16 −15 gpup/src/gpup.rc
  2. +11 −1 libinstall/src/CopyStep.cpp
  3. +18 −8 pluginManager/src/PluginList.cpp
  4. +3 −3 pluginManager/src/PluginManagerVersion.h
View
@@ -13,13 +13,11 @@
#undef APSTUDIO_READONLY_SYMBOLS
/////////////////////////////////////////////////////////////////////////////
-// English (U.S.) resources
+// English (United States) resources
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
-#ifdef _WIN32
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
#pragma code_page(1252)
-#endif //_WIN32
#ifdef APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
@@ -46,18 +44,16 @@ END
#endif // APSTUDIO_INVOKED
-#endif // English (U.S.) resources
+#endif // English (United States) resources
/////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////
-// English (U.K.) resources
+// English (United Kingdom) resources
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENG)
-#ifdef _WIN32
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_UK
#pragma code_page(1252)
-#endif //_WIN32
/////////////////////////////////////////////////////////////////////////////
//
@@ -81,7 +77,7 @@ END
//
#ifdef APSTUDIO_INVOKED
-GUIDELINES DESIGNINFO
+GUIDELINES DESIGNINFO
BEGIN
IDD_PROGRESSDIALOG, DIALOG
BEGIN
@@ -100,8 +96,8 @@ END
//
VS_VERSION_INFO VERSIONINFO
- FILEVERSION 1,0,0,0
- PRODUCTVERSION 1,0,0,0
+ FILEVERSION 1,0,6,0
+ PRODUCTVERSION 1,0,6,0
FILEFLAGSMASK 0x17L
#ifdef _DEBUG
FILEFLAGS 0x1L
@@ -118,12 +114,12 @@ BEGIN
BEGIN
VALUE "Comments", "A generic(ish) plugin updater, built initially for Notepad++"
VALUE "FileDescription", "gpup"
- VALUE "FileVersion", "1, 0, 0, 0"
+ VALUE "FileVersion", "1.0.6.0"
VALUE "InternalName", "gpup"
VALUE "LegalCopyright", "Copyright (C) 2009-10 Dave Brotherstone"
VALUE "OriginalFilename", "gpup.exe"
VALUE "ProductName", " gpup"
- VALUE "ProductVersion", "1, 0, 0, 0"
+ VALUE "ProductVersion", "1.0.6.0"
END
END
BLOCK "VarFileInfo"
@@ -132,7 +128,14 @@ BEGIN
END
END
-#endif // English (U.K.) resources
+
+/////////////////////////////////////////////////////////////////////////////
+//
+// RT_MANIFEST
+//
+
+MANIFEST_RESOURCE_ID RT_MANIFEST "gpup.exe.manifest"
+#endif // English (United Kingdom) resources
/////////////////////////////////////////////////////////////////////////////
@@ -147,5 +150,3 @@ END
/////////////////////////////////////////////////////////////////////////////
#endif // not APSTUDIO_INVOKED
-#define MANIFEST_RESOURCE_ID 1
-MANIFEST_RESOURCE_ID RT_MANIFEST "gpup.exe.manifest"
@@ -356,12 +356,22 @@ void CopyStep::copyGpup(const tstring& basePath, const tstring& toPath)
void CopyStep::callGpup(const TCHAR *gpupPath, const TCHAR *arguments)
{
+ OSVERSIONINFO osvi;
+ BOOL bIsWindowsVistaOrLater;
+
+ ZeroMemory(&osvi, sizeof(OSVERSIONINFO));
+ osvi.dwOSVersionInfoSize = sizeof(OSVERSIONINFO);
+
+ GetVersionEx(&osvi);
+
+ bIsWindowsVistaOrLater = (osvi.dwMajorVersion >= 6);
+
SHELLEXECUTEINFO sei;
memset(&sei, 0, sizeof(sei));
sei.cbSize = sizeof(sei);
sei.lpFile = gpupPath;
sei.lpParameters = arguments;
- sei.lpVerb = _T("open");
+ sei.lpVerb = bIsWindowsVistaOrLater ? _T("runas") : _T("open");
sei.nShow = SW_SHOW;
if (::ShellExecuteEx(&sei))
@@ -672,21 +672,27 @@ BOOL PluginList::setInstalledVersion(tstring pluginFilename, Plugin* plugin)
unsigned char* buffer = new unsigned char[bufferSize];
::GetFileVersionInfo(pluginFilename.c_str(), handle, bufferSize, buffer);
- struct LANGANDCODEPAGE {
+ /*struct LANGANDCODEPAGE {
WORD wLanguage;
WORD wCodePage;
- } *lpTranslate;
+ } *lpTranslate;*/
- UINT cbTranslate;
+ VS_FIXEDFILEINFO* lpFileInfo;
+
+ UINT cbFileInfo;
VerQueryValue(buffer,
- _T("\\VarFileInfo\\Translation"),
- (LPVOID*)&lpTranslate,
- &cbTranslate);
+ _T("\\"),
+ (LPVOID*)&lpFileInfo,
+ &cbFileInfo);
- if (cbTranslate)
+ if (cbFileInfo)
{
-
+ plugin->setInstalledVersion(PluginVersion((lpFileInfo->dwFileVersionMS & 0xFFFF0000) >> 16,
+ lpFileInfo->dwFileVersionMS & 0x0000FFFF,
+ (lpFileInfo->dwFileVersionLS & 0xFFFF0000) >> 16,
+ lpFileInfo->dwFileVersionLS & 0x0000FFFF));
+ /*
HRESULT hr;
TCHAR subBlock[50];
hr = StringCchPrintf(subBlock, 50,
@@ -708,12 +714,16 @@ BOOL PluginList::setInstalledVersion(tstring pluginFilename, Plugin* plugin)
plugin->setInstalledVersion(PluginVersion(fileVersion));
}
}
+ */
+
}
else
{
+ delete[] buffer;
return FALSE;
}
+ delete[] buffer;
return TRUE;
@@ -1,9 +1,9 @@
#ifndef _PLUGINMANAGERVERSION_H
#define _PLUGINMANAGERVERSION_H
-#define PLUGINMANAGERVERSION_STRING "1.0.5.0"
-#define PLUGINMANAGERVERSION_RESOURCE 1,0,5,0
-#define PLUGINMANAGERVERSION_RESOURCE_STRING "1, 0, 5, 0"
+#define PLUGINMANAGERVERSION_STRING "1.0.6.0"
+#define PLUGINMANAGERVERSION_RESOURCE 1,0,6,0
+#define PLUGINMANAGERVERSION_RESOURCE_STRING "1, 0, 6, 0"
#define PLUGINMANAGERVERSION_RELEASEDATE "December 2011"
#endif

0 comments on commit 1eb1507

Please sign in to comment.