Skip to content

Commit 481db07

Browse files
committed
Fix some more beta registry key issues.
- Beta now _does_ use the "v3.7-beta" registry key instead of "v3.7". - Beta now only copies v3.6 registry data if no existing v3.7 proper installation is found.
1 parent b6532d0 commit 481db07

File tree

2 files changed

+69
-3
lines changed

2 files changed

+69
-3
lines changed

windows/pvedit.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,8 @@
3838
#ifndef PVEDIT_H_INCLUDED
3939
#define PVEDIT_H_INCLUDED
4040

41+
#include "base/version.h"
42+
4143
#define EDITDLLVERSION 0x0302
4244

4345
#define MAX_EDITORS 32

windows/pvengine.cpp

Lines changed: 67 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
/// @parblock
1111
///
1212
/// Persistence of Vision Ray Tracer ('POV-Ray') version 3.7.
13-
/// Copyright 1991-2016 Persistence of Vision Raytracer Pty. Ltd.
13+
/// Copyright 1991-2017 Persistence of Vision Raytracer Pty. Ltd.
1414
///
1515
/// POV-Ray is free software: you can redistribute it and/or modify
1616
/// it under the terms of the GNU Affero General Public License as
@@ -1416,6 +1416,46 @@ bool copy36EditSettings(void)
14161416
return (result == ERROR_SUCCESS) ;
14171417
}
14181418

1419+
#ifdef POVRAY_IS_BETA
1420+
bool copy37NoBetaEditSettings(void)
1421+
{
1422+
HKEY hKeySrc ;
1423+
HKEY hKeyDst ;
1424+
DWORD result ;
1425+
HINSTANCE hLib ;
1426+
shCopyType *shCopyKey ;
1427+
1428+
if ((hLib = LoadLibrary ("shlwapi.dll")) == NULL)
1429+
return (false) ;
1430+
shCopyKey = (shCopyType *) GetProcAddress (hLib, "SHCopyKeyA") ;
1431+
if (shCopyKey == NULL)
1432+
{
1433+
FreeLibrary (hLib) ;
1434+
return (false) ;
1435+
}
1436+
1437+
if (RegOpenKeyEx (HKEY_CURRENT_USER, "Software\\" REGKEY "\\" REGVER, 0, KEY_READ, &hKeySrc) != ERROR_SUCCESS)
1438+
{
1439+
FreeLibrary (hLib) ;
1440+
return (false) ;
1441+
}
1442+
1443+
if (RegCreateKeyEx (HKEY_CURRENT_USER, "Software\\" REGKEY "\\" REGVERKEY "\\POV-Edit", 0, "", REG_OPTION_NON_VOLATILE, KEY_WRITE, NULL, &hKeyDst, NULL) != ERROR_SUCCESS)
1444+
{
1445+
RegCloseKey (hKeySrc) ;
1446+
FreeLibrary (hLib) ;
1447+
return (false) ;
1448+
}
1449+
1450+
result = shCopyKey (hKeySrc, "POV-Edit", hKeyDst, NULL) ;
1451+
RegCloseKey (hKeySrc) ;
1452+
RegCloseKey (hKeyDst) ;
1453+
FreeLibrary (hLib) ;
1454+
1455+
return (result == ERROR_SUCCESS) ;
1456+
}
1457+
#endif
1458+
14191459
bool checkEditKey36 (void)
14201460
{
14211461
HKEY key ;
@@ -1428,6 +1468,20 @@ bool checkEditKey36 (void)
14281468
return (false) ;
14291469
}
14301470

1471+
#ifdef POVRAY_IS_BETA
1472+
bool checkEditKey37NoBeta (void)
1473+
{
1474+
HKEY key ;
1475+
1476+
if (RegOpenKeyEx (HKEY_CURRENT_USER, "Software\\" REGKEY "\\" REGVER "\\POV-Edit", 0, KEY_READ, &key) == ERROR_SUCCESS)
1477+
{
1478+
RegCloseKey (key) ;
1479+
return (true) ;
1480+
}
1481+
return (false) ;
1482+
}
1483+
#endif
1484+
14311485
bool checkEditKey37 (void)
14321486
{
14331487
HKEY key ;
@@ -5421,8 +5475,18 @@ int PASCAL WinMain (HINSTANCE hInst, HINSTANCE hPrev, LPSTR szCmdLine, int sw)
54215475
sprintf(ToolIniFileName, "%sini\\pvtools.ini", DocumentsPath);
54225476
sprintf(EngineIniFileName, "%sini\\pvengine.ini", DocumentsPath);
54235477

5424-
if (checkEditKey37() == false && checkEditKey36() == true)
5425-
copy36EditSettings();
5478+
if (!checkEditKey37())
5479+
{
5480+
#ifdef POVRAY_IS_BETA
5481+
if (checkEditKey37NoBeta())
5482+
copy37NoBetaEditSettings();
5483+
else if (checkEditKey36())
5484+
copy36EditSettings();
5485+
#else
5486+
if (checkEditKey36())
5487+
copy36EditSettings();
5488+
#endif
5489+
}
54265490

54275491
if (checkRegKey () == false || FreshInstall == true)
54285492
if (!CloneOptions())

0 commit comments

Comments
 (0)