1 |
/* wptRegistryMobile.cpp - Mobile config access |
/* wptRegistryMobile.cpp - Registry emulation for the mobile mode |
2 |
* Copyright (C) 2006 Timo Schulz |
* Copyright (C) 2006, 2007 Timo Schulz |
3 |
* |
* |
4 |
* This file is part of WinPT. |
* This file is part of WinPT. |
5 |
* |
* |
12 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
13 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
14 |
* General Public License for more details. |
* General Public License for more details. |
|
* |
|
|
* You should have received a copy of the GNU General Public License |
|
|
* along with WinPT; if not, write to the Free Software Foundation, |
|
|
* Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
|
15 |
*/ |
*/ |
16 |
#ifdef HAVE_CONFIG_H |
#ifdef HAVE_CONFIG_H |
17 |
#include <config.h> |
#include <config.h> |
27 |
#include "wptW32API.h" |
#include "wptW32API.h" |
28 |
#include "wptErrors.h" |
#include "wptErrors.h" |
29 |
|
|
30 |
static config_file_t pr = NULL; |
|
31 |
|
static config_file_t cfg_file = NULL; |
32 |
|
|
33 |
struct winpt_prefs_s reg_prefs; |
struct winpt_prefs_s reg_prefs; |
34 |
|
|
46 |
void |
void |
47 |
free_reg_prefs (void) |
free_reg_prefs (void) |
48 |
{ |
{ |
49 |
if (pr != NULL) { |
if (cfg_file != NULL) { |
50 |
commit_config ("c:\\winpt_prefs.txt", &pr); |
commit_config ("c:\\winpt_prefs.txt", &cfg_file); |
51 |
release_config (pr); |
release_config (cfg_file); |
52 |
} |
} |
53 |
pr = NULL; |
cfg_file = NULL; |
54 |
} |
} |
55 |
|
|
56 |
|
|
57 |
static gpg_option_t |
static gpg_option_t |
58 |
reg_find_option (const char *key) |
reg_find_option (const char *key) |
59 |
{ |
{ |
60 |
if (pr == NULL) |
if (cfg_file == NULL) |
61 |
parse_config ("c:\\winpt_prefs.txt", &pr); |
parse_config ("c:\\winpt_prefs.txt", &pr); |
62 |
return find_option (pr, key); |
return find_option (pr, key); |
63 |
} |
} |
68 |
{ |
{ |
69 |
char buf[128]; |
char buf[128]; |
70 |
size_t i; |
size_t i; |
|
int rc = 0; |
|
71 |
|
|
72 |
if (pr == NULL) |
if (cfg_file == NULL) |
73 |
new_config (&pr); |
new_config (&cfg_file); |
74 |
|
|
75 |
for (i=1; i < DIM (cfg); i++) { |
for (i=1; i < DIM (cfg); i++) { |
76 |
switch (i) { |
switch (i) { |
206 |
|
|
207 |
|
|
208 |
|
|
209 |
|
/* Just a dummy needed for 1-to-1 mapping. */ |
210 |
int |
int |
211 |
regist_inst_gnupg (int create_mokey) |
regist_inst_gnupg (int create_mokey) |
212 |
{ |
{ |
215 |
|
|
216 |
|
|
217 |
|
|
218 |
|
/* Just a dummy for 1-to-1 mapping. */ |
219 |
int |
int |
220 |
regist_inst_winpt (int with_ext, int *created) |
regist_inst_winpt (int with_ext, int *created) |
221 |
{ |
{ |
257 |
int |
int |
258 |
set_reg_entry_gpg (const char *key, const char *value) |
set_reg_entry_gpg (const char *key, const char *value) |
259 |
{ |
{ |
|
|
|
260 |
return set_reg_entry (HKEY_CURRENT_USER, NULL, key, value); |
return set_reg_entry (HKEY_CURRENT_USER, NULL, key, value); |
261 |
} |
} |
262 |
|
|
327 |
} |
} |
328 |
|
|
329 |
|
|
|
|
|
330 |
int |
int |
331 |
set_reg_winpt_flag (const char *name, int val) |
set_reg_winpt_flag (const char *name, int val) |
332 |
{ |
{ |