Fix up things suggested in Code Review

This commit is contained in:
Paul Betts
2014-07-30 12:44:04 +02:00
parent 6e7b9c7927
commit 56761921fa
3 changed files with 9 additions and 11 deletions

View File

@@ -3,15 +3,14 @@
#include "resource.h"
// http://msdn.microsoft.com/en-us/library/hh925568(v=vs.110).aspx#net_b
const wchar_t* ndpPath = L"SOFTWARE\\Microsoft\\NET Framework Setup\\NDP\\v4\\Full";
const int fx45ReleaseVersion = 378389;
static const wchar_t* ndpPath = L"SOFTWARE\\Microsoft\\NET Framework Setup\\NDP\\v4\\Full";
static const int fx45ReleaseVersion = 378389;
bool CFxHelper::IsDotNet45OrHigherInstalled(void)
bool CFxHelper::IsDotNet45OrHigherInstalled()
{
ATL::CRegKey key;
if (key.Open(HKEY_LOCAL_MACHINE, ndpPath, KEY_READ) != ERROR_SUCCESS) {
DWORD dwErr = GetLastError();
return false;
}

View File

@@ -3,7 +3,7 @@
class CFxHelper
{
public:
static bool IsDotNet45OrHigherInstalled(void);
static bool IsDotNet45OrHigherInstalled();
static void HelpUserInstallDotNetFramework(bool isQuiet);
};

View File

@@ -23,11 +23,9 @@ int CUpdateRunner::ExtractUpdaterAndRun(wchar_t* lpCommandLine)
CResource zipResource;
wchar_t targetDir[MAX_PATH];
ExpandEnvironmentStrings(L"%LocalAppData%\\SquirrelTemp", targetDir, MAX_PATH);
if (GetFileAttributes(targetDir) == INVALID_FILE_ATTRIBUTES) {
if (!CreateDirectory(targetDir, NULL)) {
goto failedExtract;
}
ExpandEnvironmentStrings(L"%LocalAppData%\\SquirrelTemp", targetDir, _countof(targetDir));
if (!CreateDirectory(targetDir, NULL) && GetLastError() != ERROR_ALREADY_EXISTS) {
goto failedExtract;
}
if (!zipResource.Load(L"DATA", IDR_UPDATE_ZIP)) {
@@ -45,9 +43,10 @@ int CUpdateRunner::ExtractUpdaterAndRun(wchar_t* lpCommandLine)
// NB: This library is kind of a disaster
ZRESULT zr;
ZIPENTRY zentry;
int index = 0;
do {
ZIPENTRY zentry;
zr = GetZipItem(zipFile, index, &zentry);
if (zr != ZR_OK && zr != ZR_MORE) {
break;