Commit f5f4d3d3087640bf44880a9650c3bd05c73d1291

Authored by Perry Werneck
1 parent 7b3943f7
Exists in v5.2

Fixing windows registry management.

Showing 2 changed files with 10 additions and 22 deletions   Show diff stats
src/pw3270/common.h
@@ -32,6 +32,7 @@ @@ -32,6 +32,7 @@
32 #include <config.h> 32 #include <config.h>
33 33
34 #ifdef _WIN32 34 #ifdef _WIN32
  35 + #include <winsock2.h>
35 #include <windows.h> 36 #include <windows.h>
36 #endif // _WIN32 37 #endif // _WIN32
37 38
src/pw3270/windows/config.c
@@ -32,6 +32,8 @@ @@ -32,6 +32,8 @@
32 #include "../pw3270/private.h" 32 #include "../pw3270/private.h"
33 33
34 #include "../common.h" 34 #include "../common.h"
  35 + #include <lib3270.h>
  36 + #include <lib3270/log.h>
35 #include <stdarg.h> 37 #include <stdarg.h>
36 #include <glib/gstdio.h> 38 #include <glib/gstdio.h>
37 #include <v3270/settings.h> 39 #include <v3270/settings.h>
@@ -100,6 +102,13 @@ @@ -100,6 +102,13 @@
100 return TRUE; 102 return TRUE;
101 } 103 }
102 104
  105 + if(RegCreateKey(HKEY_CURRENT_USER,path,hKey) == ERROR_SUCCESS) {
  106 + g_message("Registry key %s was created",path);
  107 + return TRUE;
  108 + }
  109 +
  110 + g_warning("Can´t create registry key for %s",path);
  111 +
103 return FALSE; 112 return FALSE;
104 113
105 } 114 }
@@ -135,28 +144,6 @@ @@ -135,28 +144,6 @@
135 } 144 }
136 145
137 146
138 - /*  
139 - static BOOL registry_open_key(const gchar *group, const gchar *key, REGSAM samDesired, HKEY *hKey)  
140 - {  
141 - static HKEY predefined[] = { HKEY_CURRENT_USER, HKEY_LOCAL_MACHINE };  
142 - int f;  
143 - gchar * path = g_strdup_printf("%s\\%s\\%s",registry_path,g_get_application_name(),group);  
144 -  
145 - for(f=0;f<G_N_ELEMENTS(predefined);f++)  
146 - {  
147 - if(RegOpenKeyEx(predefined[f],path,0,samDesired,hKey) == ERROR_SUCCESS)  
148 - {  
149 - g_free(path);  
150 - return TRUE;  
151 - }  
152 - }  
153 -  
154 - g_free(path);  
155 -  
156 - return FALSE;  
157 - }  
158 - */  
159 -  
160 147
161 gboolean get_boolean_from_config(const gchar *group, const gchar *key, gboolean def) 148 gboolean get_boolean_from_config(const gchar *group, const gchar *key, gboolean def)
162 { 149 {