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+
14191459bool 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+
14311485bool 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