aboutsummaryrefslogtreecommitdiffstats
path: root/common/w32-reg.c
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--common/w32-reg.c46
1 files changed, 23 insertions, 23 deletions
diff --git a/common/w32-reg.c b/common/w32-reg.c
index 5809c32bb..5dc2be584 100644
--- a/common/w32-reg.c
+++ b/common/w32-reg.c
@@ -36,7 +36,7 @@ static HKEY
get_root_key(const char *root)
{
HKEY root_key;
-
+
if (!root)
root_key = HKEY_CURRENT_USER;
else if (!strcmp( root, "HKEY_CLASSES_ROOT" ) )
@@ -53,7 +53,7 @@ get_root_key(const char *root)
root_key = HKEY_CURRENT_CONFIG;
else
return NULL;
-
+
return root_key;
}
@@ -69,10 +69,10 @@ read_w32_registry_string (const char *root, const char *dir, const char *name)
DWORD n1, nbytes, type;
char *result = NULL;
wchar_t *wdir, *wname;
-
+
if ( !(root_key = get_root_key(root) ) )
return NULL;
-
+
wdir = utf8_to_wchar (dir);
if (!wdir)
return NULL;
@@ -115,7 +115,7 @@ read_w32_registry_string (const char *root, const char *dir, const char *name)
goto leave;
}
result[nbytes] = 0; /* Make sure it is a string. */
- result[nbytes+1] = 0;
+ result[nbytes+1] = 0;
if (type == REG_SZ || type == REG_EXPAND_SZ)
{
wchar_t *tmp = (void*)result;
@@ -131,10 +131,10 @@ read_w32_registry_string (const char *root, const char *dir, const char *name)
HKEY root_key, key_handle;
DWORD n1, nbytes, type;
char *result = NULL;
-
+
if ( !(root_key = get_root_key(root) ) )
return NULL;
-
+
if (RegOpenKeyEx (root_key, dir, 0, KEY_READ, &key_handle) )
{
if (root)
@@ -160,7 +160,7 @@ read_w32_registry_string (const char *root, const char *dir, const char *name)
if (type == REG_EXPAND_SZ && strchr (result, '%'))
{
char *tmp;
-
+
n1 += 1000;
tmp = jnlib_malloc (n1+1);
if (!tmp)
@@ -177,7 +177,7 @@ read_w32_registry_string (const char *root, const char *dir, const char *name)
if (nbytes && nbytes > n1)
{
/* Oops - truncated, better don't expand at all. */
- jnlib_free (tmp);
+ jnlib_free (tmp);
goto leave;
}
tmp[nbytes] = 0;
@@ -192,14 +192,14 @@ read_w32_registry_string (const char *root, const char *dir, const char *name)
result = jnlib_malloc (strlen (tmp)+1);
if (!result)
result = tmp;
- else
+ else
{
strcpy (result, tmp);
jnlib_free (tmp);
}
}
- else
- {
+ else
+ {
/* Error - don't expand. */
jnlib_free (tmp);
}
@@ -215,7 +215,7 @@ read_w32_registry_string (const char *root, const char *dir, const char *name)
/* Note: This code is not well tested. However, it is not used in
GnuPG. */
int
-write_w32_registry_string (const char *root, const char *dir,
+write_w32_registry_string (const char *root, const char *dir,
const char *name, const char *value)
{
HKEY root_key, reg_key;
@@ -236,7 +236,7 @@ write_w32_registry_string (const char *root, const char *dir,
return -1;
}
jnlib_free (wdir);
-
+
if (name)
{
wname = utf8_to_wchar (name);
@@ -253,12 +253,12 @@ write_w32_registry_string (const char *root, const char *dir,
return -1;
}
- if (RegSetValueEx (reg_key, wname, 0, REG_SZ,
+ if (RegSetValueEx (reg_key, wname, 0, REG_SZ,
(BYTE *)wvalue, wcslen (wvalue)) != ERROR_SUCCESS )
{
if (RegCreateKeyEx (root_key, wname, 0, NULL, 0, 0, NULL,
- &reg_key, &disp) != ERROR_SUCCESS)
+ &reg_key, &disp) != ERROR_SUCCESS)
{
RegCloseKey(reg_key);
jnlib_free (wname);
@@ -274,7 +274,7 @@ write_w32_registry_string (const char *root, const char *dir,
return -1;
}
}
-
+
jnlib_free (wname);
jnlib_free (wvalue);
RegCloseKey (reg_key);
@@ -283,15 +283,15 @@ write_w32_registry_string (const char *root, const char *dir,
if ( !(root_key = get_root_key(root) ) )
return -1;
-
- if ( RegOpenKeyEx( root_key, dir, 0, KEY_WRITE, &reg_key )
+
+ if ( RegOpenKeyEx( root_key, dir, 0, KEY_WRITE, &reg_key )
!= ERROR_SUCCESS )
return -1;
-
- if ( RegSetValueEx (reg_key, name, 0, REG_SZ, (BYTE *)value,
+
+ if ( RegSetValueEx (reg_key, name, 0, REG_SZ, (BYTE *)value,
strlen( value ) ) != ERROR_SUCCESS )
{
- if ( RegCreateKey( root_key, name, &reg_key ) != ERROR_SUCCESS )
+ if ( RegCreateKey( root_key, name, &reg_key ) != ERROR_SUCCESS )
{
RegCloseKey(reg_key);
return -1;
@@ -303,7 +303,7 @@ write_w32_registry_string (const char *root, const char *dir,
return -1;
}
}
-
+
RegCloseKey (reg_key);
return 0;
#endif /*!HAVE_W32CE_SYSTEM*/