Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSimon Clitherow <aphex@nildram.co.uk>2003-05-22 22:06:25 +0400
committerSimon Clitherow <aphex@nildram.co.uk>2003-05-22 22:06:25 +0400
commitd617df479310b39c8f0ba8f1cbd57bc29d95a8f9 (patch)
treedd944f5543f13d11b4fbf6be3357685b508bb88f /source/blender/blenlib/intern/winstuff.c
parentb8f2835ba28e7dec09086599127c48b54c9fd3e7 (diff)
- fixed 'double-click on blend file' errors on Windows -- INTERNATIONAL stuff now also checks the installation directory for /.blender, etc
- registering .blend files for WinNT/2000/XP now works correctly (settings remain after a reboot).
Diffstat (limited to 'source/blender/blenlib/intern/winstuff.c')
-rw-r--r--source/blender/blenlib/intern/winstuff.c44
1 files changed, 41 insertions, 3 deletions
diff --git a/source/blender/blenlib/intern/winstuff.c b/source/blender/blenlib/intern/winstuff.c
index a0fb005e992..2a69bf0b1e5 100644
--- a/source/blender/blenlib/intern/winstuff.c
+++ b/source/blender/blenlib/intern/winstuff.c
@@ -46,15 +46,53 @@
#include "BLI_util.h"
#include "BLI_winstuff.h"
+#include "BKE_utildefines.h" /* FILE_MAXDIR + FILE_MAXFILE */
+
+int BLI_getInstallationDir( char * str ) {
+ LONG lresult;
+ HKEY hkey = 0;
+ LONG type;
+ char buffer[FILE_MAXDIR+FILE_MAXFILE];
+ DWORD size;
+
+ size = sizeof(buffer);
+
+ lresult = RegOpenKeyEx(HKEY_LOCAL_MACHINE, "SOFTWARE\\BlenderFoundation", 0,
+ KEY_ALL_ACCESS, &hkey);
+
+ if (lresult == ERROR_SUCCESS) {
+ lresult = RegQueryValueEx(hkey, "Install_Dir", 0, NULL, (LPBYTE)buffer, &size);
+ strcpy(str, buffer);
+ RegCloseKey(hkey);
+ return 1;
+ }
+ else
+ return 0;
+}
+
void RegisterBlendExtension(char * str) {
LONG lresult;
HKEY hkey = 0;
DWORD dwd = 0;
+ char *dir;
char buffer[128];
+
+ /* Add installation dir to registry --aphex */
+
+ strncpy(dir, str, strlen(str)-11);
+
+ lresult = RegCreateKeyEx(HKEY_LOCAL_MACHINE, "SOFTWARE\\BlenderFoundation", 0,
+ "", REG_OPTION_NON_VOLATILE, KEY_ALL_ACCESS, NULL, &hkey, &dwd);
+
+ if (lresult == ERROR_SUCCESS) {
+ if (dwd != REG_OPENED_EXISTING_KEY)
+ lresult = RegSetValueEx(hkey, "Install_Dir", 0, REG_SZ, dir, strlen(dir)+1);
+ RegCloseKey(hkey);
+ }
lresult = RegCreateKeyEx(HKEY_CLASSES_ROOT, "blendfile\\shell\\open\\command", 0,
- "", REG_OPTION_VOLATILE, KEY_ALL_ACCESS, NULL, &hkey, &dwd);
+ "", REG_OPTION_NON_VOLATILE, KEY_ALL_ACCESS, NULL, &hkey, &dwd);
if (lresult == ERROR_SUCCESS) {
sprintf(buffer, "\"%s\" \"%%1\"", str);
@@ -63,7 +101,7 @@ void RegisterBlendExtension(char * str) {
}
lresult = RegCreateKeyEx(HKEY_CLASSES_ROOT, "blendfile\\DefaultIcon", 0,
- "", REG_OPTION_VOLATILE, KEY_ALL_ACCESS, NULL, &hkey, &dwd);
+ "", REG_OPTION_NON_VOLATILE, KEY_ALL_ACCESS, NULL, &hkey, &dwd);
if (lresult == ERROR_SUCCESS) {
sprintf(buffer, "\"%s\",1", str);
@@ -72,7 +110,7 @@ void RegisterBlendExtension(char * str) {
}
lresult = RegCreateKeyEx(HKEY_CLASSES_ROOT, ".blend", 0,
- "", REG_OPTION_VOLATILE, KEY_ALL_ACCESS, NULL, &hkey, &dwd);
+ "", REG_OPTION_NON_VOLATILE, KEY_ALL_ACCESS, NULL, &hkey, &dwd);
if (lresult == ERROR_SUCCESS) {
sprintf(buffer, "%s", "blendfile");