diff --git a/src/pw3270/common/common.h b/src/pw3270/common/common.h index 7714aba..74ba23c 100644 --- a/src/pw3270/common/common.h +++ b/src/pw3270/common/common.h @@ -77,6 +77,7 @@ #ifdef ENABLE_WINDOWS_REGISTRY gboolean get_registry_handle(const gchar *group, HKEY *hKey, REGSAM samDesired); + HKEY get_application_registry(REGSAM samDesired); void registry_foreach(HKEY parent, const gchar *name,void (*cbk)(const gchar *key, const gchar *val, gpointer *user_data), gpointer *user_data); void registry_set_double(HKEY hKey, const gchar *key, gdouble value); gboolean registry_get_double(HKEY hKey, const gchar *key, gdouble *value); diff --git a/src/pw3270/common/config.c b/src/pw3270/common/config.c index aeefc16..749397d 100644 --- a/src/pw3270/common/config.c +++ b/src/pw3270/common/config.c @@ -726,9 +726,14 @@ gchar * filename_from_va(const gchar *first_element, va_list args) gboolean get_registry_handle(const gchar *group, HKEY *hKey, REGSAM samDesired) { gboolean ret; - gchar * path = g_strdup_printf("%s\\%s\\%s",registry_path,g_get_application_name(),group); + gchar * path; DWORD disp; + if(group) + path = g_strdup_printf("%s\\%s\\%s",registry_path,g_get_application_name(),group); + else + path = g_strdup_printf("%s\\%s",registry_path,g_get_application_name()); + if(RegCreateKeyEx(HKEY_CURRENT_USER,path,0,NULL,REG_OPTION_NON_VOLATILE,samDesired,NULL,hKey,&disp) == ERROR_SUCCESS) ret = TRUE; else diff --git a/src/pw3270/window.c b/src/pw3270/window.c index 5fe92c1..d0ef4e3 100644 --- a/src/pw3270/window.c +++ b/src/pw3270/window.c @@ -409,8 +409,18 @@ static GtkWidget * trace_window = NULL; #ifdef ENABLE_WINDOWS_REGISTRY + HKEY hKey; + + if(get_registry_handle(NULL, &hKey, KEY_SET_VALUE)) + { + v3270_to_registry(widget, hKey, "terminal"); + RegCloseKey(hKey); + } + #else + v3270_to_key_file(widget, get_application_keyfile(), "terminal"); + #endif // _WIN32 } -- libgit2 0.21.2