ShInstUtil/ 0000775 0000000 0000000 00000000000 12642233654 011633 5 ustar root root ShInstUtil/ShInstUtil.vcproj 0000664 0000000 0000000 00000010535 12167520112 015120 0 ustar root root
ShInstUtil/ShInstUtil.rc 0000664 0000000 0000000 00000005334 12670010676 014232 0 ustar root root // Microsoft Visual C++ generated resource script.
//
#include "resource.h"
#define APSTUDIO_READONLY_SYMBOLS
/////////////////////////////////////////////////////////////////////////////
//
// Generated from the TEXTINCLUDE 2 resource.
//
#include "afxres.h"
/////////////////////////////////////////////////////////////////////////////
#undef APSTUDIO_READONLY_SYMBOLS
/////////////////////////////////////////////////////////////////////////////
// German (Germany) resources
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_DEU)
#ifdef _WIN32
LANGUAGE LANG_GERMAN, SUBLANG_GERMAN
#pragma code_page(1252)
#endif //_WIN32
#ifdef APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// TEXTINCLUDE
//
1 TEXTINCLUDE
BEGIN
"resource.h\0"
END
2 TEXTINCLUDE
BEGIN
"#include ""afxres.h""\r\n"
"\0"
END
3 TEXTINCLUDE
BEGIN
"\r\n"
"\0"
END
#endif // APSTUDIO_INVOKED
#endif // German (Germany) resources
/////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////
// English (U.S.) resources
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
#ifdef _WIN32
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
#pragma code_page(1252)
#endif //_WIN32
/////////////////////////////////////////////////////////////////////////////
//
// Version
//
VS_VERSION_INFO VERSIONINFO
FILEVERSION 2,32,0,0
PRODUCTVERSION 2,32,0,0
FILEFLAGSMASK 0x17L
#ifdef _DEBUG
FILEFLAGS 0x1L
#else
FILEFLAGS 0x0L
#endif
FILEOS 0x4L
FILETYPE 0x1L
FILESUBTYPE 0x0L
BEGIN
BLOCK "StringFileInfo"
BEGIN
BLOCK "040904b0"
BEGIN
VALUE "CompanyName", "Dominik Reichl"
VALUE "FileDescription", "ShInstUtil - KeePass Helper Utility"
VALUE "FileVersion", "2.32.0.0"
VALUE "InternalName", "ShInstUtil"
VALUE "LegalCopyright", "Copyright (c) 2007-2016 Dominik Reichl"
VALUE "OriginalFilename", "ShInstUtil.exe"
VALUE "ProductName", "ShInstUtil - KeePass Helper Utility"
VALUE "ProductVersion", "2.32.0.0"
END
END
BLOCK "VarFileInfo"
BEGIN
VALUE "Translation", 0x409, 1200
END
END
#endif // English (U.S.) resources
/////////////////////////////////////////////////////////////////////////////
#ifndef APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// Generated from the TEXTINCLUDE 3 resource.
//
/////////////////////////////////////////////////////////////////////////////
#endif // not APSTUDIO_INVOKED
ShInstUtil/ShInstUtil.h 0000664 0000000 0000000 00000005723 12641463000 014046 0 ustar root root /*
KeePass Password Safe - The Open-Source Password Manager
Copyright (C) 2003-2016 Dominik Reichl
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
#ifndef ___SH_INST_UTIL_H___
#define ___SH_INST_UTIL_H___
#pragma once
#ifndef VC_EXTRALEAN
#define VC_EXTRALEAN
#endif
#ifndef WIN32_LEAN_AND_MEAN
#define WIN32_LEAN_AND_MEAN
#endif
#ifndef WINVER
#define WINVER 0x0501
#endif
#ifndef _WIN32_WINNT
#define _WIN32_WINNT 0x0501
#endif
#ifndef _WIN32_WINDOWS
#define _WIN32_WINDOWS 0x0410
#endif
#ifndef _WIN32_IE
#define _WIN32_IE 0x0600
#endif
#ifndef MMNOMIDI
#define MMNOMIDI
#endif
#ifndef MMNOAUX
#define MMNOAUX
#endif
#ifndef MMNOMIXER
#define MMNOMIXER
#endif
#if (_MSC_VER >= 1400) // Manifest linking
#if defined(_M_IX86)
#pragma comment(linker, "/manifestdependency:\"type='win32' " \
"name='Microsoft.Windows.Common-Controls' " \
"version='6.0.0.0' " \
"processorArchitecture='x86' " \
"publicKeyToken='6595b64144ccf1df' " \
"language='*'\"")
#elif defined(_M_AMD64)
#pragma comment(linker, "/manifestdependency:\"type='win32' " \
"name='Microsoft.Windows.Common-Controls' " \
"version='6.0.0.0' " \
"processorArchitecture='amd64' " \
"publicKeyToken='6595b64144ccf1df' " \
"language='*'\"")
#elif defined(_M_IA64)
#pragma comment(linker, "/manifestdependency:\"type='win32' " \
"name='Microsoft.Windows.Common-Controls' " \
"version='6.0.0.0' " \
"processorArchitecture='ia64' " \
"publicKeyToken='6595b64144ccf1df' " \
"language='*'\"")
#endif
#endif // (_MSC_VER >= 1400)
#include
#include
#include
#include
#include
#include
#include
typedef std::basic_string std_string;
int WINAPI _tWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance,
LPTSTR lpCmdLine, int nCmdShow);
void UpdateNativeImage(bool bInstall);
void RegisterPreLoad(bool bRegister);
std_string GetNetInstallRoot();
std_string GetKeePassExePath();
void EnsureTerminatingSeparator(std_string& strPath);
std_string FindNGen();
void FindNGenRec(const std_string& strPath, std_string& strNGenPath,
ULONGLONG& ullVersion);
ULONGLONG SiuGetFileVersion(const std_string& strFilePath);
void CheckDotNetInstalled();
#endif // ___SH_INST_UTIL_H___
ShInstUtil/Resource.h 0000664 0000000 0000000 00000000627 11247000604 013563 0 ustar root root //{{NO_DEPENDENCIES}}
// Microsoft Visual C++ generated include file.
// Used by ShInstUtil.rc
// Nchste Standardwerte fr neue Objekte
//
#ifdef APSTUDIO_INVOKED
#ifndef APSTUDIO_READONLY_SYMBOLS
#define _APS_NEXT_RESOURCE_VALUE 101
#define _APS_NEXT_COMMAND_VALUE 40001
#define _APS_NEXT_CONTROL_VALUE 1001
#define _APS_NEXT_SYMED_VALUE 101
#endif
#endif
ShInstUtil/ShInstUtil.cpp 0000664 0000000 0000000 00000022030 12641463000 014367 0 ustar root root /*
KeePass Password Safe - The Open-Source Password Manager
Copyright (C) 2003-2016 Dominik Reichl
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include "ShInstUtil.h"
#pragma warning(push)
#pragma warning(disable: 4996) // SCL warning
#include
#include
#pragma warning(pop)
static const std_string g_strNGenInstall = _T("ngen_install");
static const std_string g_strNGenUninstall = _T("ngen_uninstall");
static const std_string g_strNetCheck = _T("net_check");
static const std_string g_strPreLoadRegister = _T("preload_register");
static const std_string g_strPreLoadUnregister = _T("preload_unregister");
static LPCTSTR g_lpPathTrimChars = _T("\"' \t\r\n");
int WINAPI _tWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance,
LPTSTR lpCmdLine, int nCmdShow)
{
UNREFERENCED_PARAMETER(hInstance);
UNREFERENCED_PARAMETER(hPrevInstance);
UNREFERENCED_PARAMETER(lpCmdLine);
UNREFERENCED_PARAMETER(nCmdShow);
INITCOMMONCONTROLSEX icc;
ZeroMemory(&icc, sizeof(INITCOMMONCONTROLSEX));
icc.dwSize = sizeof(INITCOMMONCONTROLSEX);
icc.dwICC = ICC_STANDARD_CLASSES;
InitCommonControlsEx(&icc);
std_string strCmdLine = GetCommandLine();
boost::trim_if(strCmdLine, boost::is_any_of(g_lpPathTrimChars));
std::transform(strCmdLine.begin(), strCmdLine.end(), strCmdLine.begin(), tolower);
if((strCmdLine.size() >= g_strNGenInstall.size()) && (strCmdLine.substr(
strCmdLine.size() - g_strNGenInstall.size()) == g_strNGenInstall))
{
UpdateNativeImage(false);
Sleep(200);
UpdateNativeImage(true);
}
if((strCmdLine.size() >= g_strNGenUninstall.size()) && (strCmdLine.substr(
strCmdLine.size() - g_strNGenUninstall.size()) == g_strNGenUninstall))
{
UpdateNativeImage(false);
}
if((strCmdLine.size() >= g_strPreLoadRegister.size()) && (strCmdLine.substr(
strCmdLine.size() - g_strPreLoadRegister.size()) == g_strPreLoadRegister))
{
RegisterPreLoad(true);
}
if((strCmdLine.size() >= g_strPreLoadUnregister.size()) && (strCmdLine.substr(
strCmdLine.size() - g_strPreLoadUnregister.size()) == g_strPreLoadUnregister))
{
RegisterPreLoad(false);
}
if((strCmdLine.size() >= g_strNetCheck.size()) && (strCmdLine.substr(
strCmdLine.size() - g_strNetCheck.size()) == g_strNetCheck))
{
CheckDotNetInstalled();
}
return 0;
}
void UpdateNativeImage(bool bInstall)
{
const std_string strNGen = FindNGen();
if(strNGen.size() == 0) return;
const std_string strKeePassExe = GetKeePassExePath();
if(strKeePassExe.size() == 0) return;
std_string strParam = (bInstall ? _T("") : _T("un"));
strParam += _T("install \"");
strParam += strKeePassExe + _T("\"");
SHELLEXECUTEINFO sei;
ZeroMemory(&sei, sizeof(SHELLEXECUTEINFO));
sei.cbSize = sizeof(SHELLEXECUTEINFO);
sei.fMask = SEE_MASK_NOCLOSEPROCESS;
sei.lpVerb = _T("open");
sei.lpFile = strNGen.c_str();
sei.lpParameters = strParam.c_str();
sei.nShow = SW_HIDE;
ShellExecuteEx(&sei);
if(sei.hProcess != NULL)
{
WaitForSingleObject(sei.hProcess, 16000);
CloseHandle(sei.hProcess);
}
}
void RegisterPreLoad(bool bRegister)
{
const std_string strPath = GetKeePassExePath();
if(strPath.size() == 0) return;
HKEY hKey = NULL;
if(RegOpenKeyEx(HKEY_LOCAL_MACHINE, _T("Software\\Microsoft\\Windows\\CurrentVersion\\Run"),
0, KEY_WRITE, &hKey) != ERROR_SUCCESS) return;
if(hKey == NULL) return;
const std_string strItemName = _T("KeePass 2 PreLoad");
std_string strItemValue = _T("\"");
strItemValue += strPath;
strItemValue += _T("\" --preload");
if(bRegister)
RegSetValueEx(hKey, strItemName.c_str(), 0, REG_SZ,
(const BYTE*)strItemValue.c_str(), static_cast((strItemValue.size() +
1) * sizeof(TCHAR)));
else
RegDeleteValue(hKey, strItemName.c_str());
RegCloseKey(hKey);
}
std_string GetNetInstallRoot()
{
std_string str;
HKEY hNet = NULL;
LONG lRes = RegOpenKeyEx(HKEY_LOCAL_MACHINE, _T("SOFTWARE\\Microsoft\\.NETFramework"),
0, KEY_READ, &hNet);
if((lRes != ERROR_SUCCESS) || (hNet == NULL)) return str;
const DWORD cbData = 2050;
BYTE pbData[cbData];
ZeroMemory(pbData, cbData * sizeof(BYTE));
DWORD dwData = cbData - 2;
lRes = RegQueryValueEx(hNet, _T("InstallRoot"), NULL, NULL, pbData, &dwData);
if(lRes == ERROR_SUCCESS) str = (LPCTSTR)(LPTSTR)pbData;
RegCloseKey(hNet);
return str;
}
std_string GetKeePassExePath()
{
const DWORD cbData = 2050;
TCHAR tszName[cbData];
ZeroMemory(tszName, cbData * sizeof(TCHAR));
GetModuleFileName(NULL, tszName, cbData - 2);
for(int i = static_cast(_tcslen(tszName)) - 1; i >= 0; --i)
{
if(tszName[i] == _T('\\')) break;
else tszName[i] = 0;
}
std_string strPath = tszName;
boost::trim_if(strPath, boost::is_any_of(g_lpPathTrimChars));
if(strPath.size() == 0) return strPath;
return strPath + _T("KeePass.exe");
}
void EnsureTerminatingSeparator(std_string& strPath)
{
if(strPath.size() == 0) return;
if(strPath.c_str()[strPath.size() - 1] == _T('\\')) return;
strPath += _T("\\");
}
std_string FindNGen()
{
std_string strNGen;
std_string strRoot = GetNetInstallRoot();
if(strRoot.size() == 0) return strNGen;
EnsureTerminatingSeparator(strRoot);
ULONGLONG ullVersion = 0;
FindNGenRec(strRoot, strNGen, ullVersion);
return strNGen;
}
#pragma warning(push)
#pragma warning(disable: 4127) // Conditional expression is constant
void FindNGenRec(const std_string& strPath, std_string& strNGenPath,
ULONGLONG& ullVersion)
{
const std_string strSearch = strPath + _T("*.*");
const std_string strNGen = _T("ngen.exe");
WIN32_FIND_DATA wfd;
ZeroMemory(&wfd, sizeof(WIN32_FIND_DATA));
HANDLE hFind = FindFirstFile(strSearch.c_str(), &wfd);
if(hFind == INVALID_HANDLE_VALUE) return;
while(true)
{
if((wfd.cFileName[0] == 0) || (_tcsicmp(wfd.cFileName, _T(".")) == 0) ||
(_tcsicmp(wfd.cFileName, _T("..")) == 0)) { }
else if((wfd.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) != 0)
FindNGenRec((strPath + wfd.cFileName) + _T("\\"), strNGenPath, ullVersion);
else if(_tcsicmp(wfd.cFileName, strNGen.c_str()) == 0)
{
const std_string strFullPath = strPath + strNGen;
const ULONGLONG ullThisVer = SiuGetFileVersion(strFullPath);
if(ullThisVer >= ullVersion)
{
strNGenPath = strFullPath;
ullVersion = ullThisVer;
}
}
if(FindNextFile(hFind, &wfd) == FALSE) break;
}
FindClose(hFind);
}
#pragma warning(pop)
ULONGLONG SiuGetFileVersion(const std_string& strFilePath)
{
DWORD dwDummy = 0;
const DWORD dwVerSize = GetFileVersionInfoSize(
strFilePath.c_str(), &dwDummy);
if(dwVerSize == 0) return 0;
boost::scoped_array vVerInfo(new BYTE[dwVerSize]);
if(vVerInfo.get() == NULL) return 0; // Out of memory
if(GetFileVersionInfo(strFilePath.c_str(), 0, dwVerSize,
vVerInfo.get()) == FALSE) return 0;
VS_FIXEDFILEINFO* pFileInfo = NULL;
UINT uFixedInfoLen = 0;
if(VerQueryValue(vVerInfo.get(), _T("\\"), (LPVOID*)&pFileInfo,
&uFixedInfoLen) == FALSE) return 0;
if(pFileInfo == NULL) return 0;
return ((static_cast(pFileInfo->dwFileVersionMS) <<
32) | static_cast(pFileInfo->dwFileVersionLS));
}
void CheckDotNetInstalled()
{
OSVERSIONINFO osv;
ZeroMemory(&osv, sizeof(OSVERSIONINFO));
osv.dwOSVersionInfoSize = sizeof(OSVERSIONINFO);
GetVersionEx(&osv);
if(osv.dwMajorVersion >= 6) return; // .NET ships with Vista and higher
const std_string strNGen = FindNGen();
if(strNGen.size() == 0)
{
std_string strMsg = _T("KeePass 2.x requires the Microsoft .NET Framework >= 2.0, ");
strMsg += _T("however this framework currently doesn't seem to be installed ");
strMsg += _T("on your computer. Without this framework, KeePass will not run.\r\n\r\n");
strMsg += _T("The Microsoft .NET Framework is available as free download from the ");
strMsg += _T("Microsoft website.\r\n\r\n");
strMsg += _T("Do you want to visit the Microsoft website now?");
const int nRes = MessageBox(NULL, strMsg.c_str(), _T("KeePass Setup"),
MB_ICONQUESTION | MB_YESNO);
if(nRes == IDYES)
{
SHELLEXECUTEINFO sei;
ZeroMemory(&sei, sizeof(SHELLEXECUTEINFO));
sei.cbSize = sizeof(SHELLEXECUTEINFO);
sei.lpVerb = _T("open");
sei.lpFile = _T("http://msdn.microsoft.com/en-us/netframework/aa569263.aspx");
sei.nShow = SW_SHOW;
ShellExecuteEx(&sei);
}
}
}
ShInstUtil/ShInstUtil.sln 0000664 0000000 0000000 00000001565 11632635050 014420 0 ustar root root
Microsoft Visual Studio Solution File, Format Version 10.00
# Visual Studio 2008
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ShInstUtil", "ShInstUtil.vcproj", "{C9FBA6FD-04AC-4B2F-8277-B852B8013DAE}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Win32 = Debug|Win32
Release|Win32 = Release|Win32
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{C9FBA6FD-04AC-4B2F-8277-B852B8013DAE}.Debug|Win32.ActiveCfg = Debug|Win32
{C9FBA6FD-04AC-4B2F-8277-B852B8013DAE}.Debug|Win32.Build.0 = Debug|Win32
{C9FBA6FD-04AC-4B2F-8277-B852B8013DAE}.Release|Win32.ActiveCfg = Release|Win32
{C9FBA6FD-04AC-4B2F-8277-B852B8013DAE}.Release|Win32.Build.0 = Release|Win32
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
EndGlobal
ShInstUtil/Resources/ 0000775 0000000 0000000 00000000000 12606740442 013603 5 ustar root root ShInstUtil/Resources/TrustInfoManifest.xml 0000664 0000000 0000000 00000000644 11247225200 017743 0 ustar root root
Ext/ 0000775 0000000 0000000 00000000000 12606740432 010322 5 ustar root root Ext/Icons_04_CB/ 0000775 0000000 0000000 00000000000 12606740430 012242 5 ustar root root Ext/Icons_04_CB/lockgreen.ico 0000664 0000000 0000000 00000061176 10062522356 014721 0 ustar root root 00 h ( 00 h ^" 00 % ' nM h ^ ( 0 ` p ww p wv p x hnvh v~7vxp w~wjfh 犆zv~wfx xvvz~f pww~znzvh xxx vv福 ~ ~vvnh pxp vgg x` ~vj~ x vfx gvvzz p w vwggp ~zvgf p0 ~wgpxx` hzw p ~7go wwgh h~w~w~vx 與 xx~www xxhfx xxx~~zx p wwwp (~~ p x燨 xp ~w p w~ p` xx p ` xx pp H x h p h p x v gxv p ` p %p ? ? ( @ p ww p gw hw hggfhp ~wfx x~zw~f` px~#%&zvh ~vv x` v~p op vvwh xr v p莂 gwgg興 w~z ~w~z~` w~vp`~x~xpp~zp g$pp xxz x o x爆 xp ` hxx wwp p p g p vv p p w ? ? ( p w wfxw xggnp vh`w vwp~xw(~o`wwx x 8p ww p p ( 0 `
"# $& +4 .5 !! #$ %%# %%% ./* /2( 3:# 49' 01. 6<* 333 461 666 897 ;=6 ::9 =>: >I$ >B4 ?@= O_( GN5 HP4 OY9 PX<