summaryrefslogtreecommitdiffstats
path: root/source/lib/util.c
diff options
context:
space:
mode:
authorLuke Leighton <lkcl@samba.org>1998-11-11 14:23:55 +0000
committerLuke Leighton <lkcl@samba.org>1998-11-11 14:23:55 +0000
commit13a0ee851fe0ce9acddfe57f9aba19fc78085c39 (patch)
treeb81bc35aedd705fa25b8d7d83dce638ddd1fbde0 /source/lib/util.c
parenta41defc36756eef0054f66dcbd46890453ad5ae3 (diff)
downloadsamba-13a0ee851fe0ce9acddfe57f9aba19fc78085c39.tar.gz
samba-13a0ee851fe0ce9acddfe57f9aba19fc78085c39.tar.xz
samba-13a0ee851fe0ce9acddfe57f9aba19fc78085c39.zip
changed syntax of registry commands so keys can start with HKLM or HKU.
sorted lookupsids command
Diffstat (limited to 'source/lib/util.c')
-rw-r--r--source/lib/util.c68
1 files changed, 55 insertions, 13 deletions
diff --git a/source/lib/util.c b/source/lib/util.c
index 5db404196ba..f1fae9155c8 100644
--- a/source/lib/util.c
+++ b/source/lib/util.c
@@ -924,20 +924,9 @@ static void expand_one(char *Mask,int len)
/****************************************************************************
parse out a directory name from a path name. Assumes dos style filenames.
****************************************************************************/
-static char *dirname_dos(char *path,char *buf)
+static void dirname_dos(char *path,char *buf)
{
- char *p = strrchr(path,'\\');
-
- if (!p)
- pstrcpy(buf,path);
- else
- {
- *p = 0;
- pstrcpy(buf,path);
- *p = '\\';
- }
-
- return(buf);
+ split_at_last_component(path, buf, '\\', NULL);
}
@@ -3053,3 +3042,56 @@ int set_maxfiles(int requested_max)
return requested_max;
#endif
}
+
+
+/*****************************************************************
+ splits out the last subkey of a key
+ *****************************************************************/
+void reg_get_subkey(char *full_keyname, char *key_name, char *subkey_name)
+{
+ split_at_last_component(full_keyname, key_name, '\\', subkey_name);
+}
+
+/*****************************************************************
+ splits out the start of the key (HKLM or HKU) and the rest of the key
+ *****************************************************************/
+BOOL reg_split_key(char *full_keyname, uint32 *reg_type, char *key_name)
+{
+ pstring tmp;
+
+ if (!next_token(&full_keyname, tmp, "\\", sizeof(tmp)))
+ {
+ return False;
+ }
+
+ (*reg_type) = 0;
+
+ DEBUG(10, ("reg_split_key: hive %s\n", tmp));
+
+ if (strequal(tmp, "HKLM") || strequal(tmp, "HKEY_LOCAL_MACHINE"))
+ {
+ (*reg_type) = HKEY_LOCAL_MACHINE;
+ }
+ else if (strequal(tmp, "HKU") || strequal(tmp, "HKEY_USERS"))
+ {
+ (*reg_type) = HKEY_USERS;
+ }
+ else
+ {
+ DEBUG(10,("reg_split_key: unrecognised hive key %s\n", tmp));
+ return False;
+ }
+
+ if (next_token(NULL, tmp, "\n\r", sizeof(tmp)))
+ {
+ fstrcpy(key_name, tmp);
+ }
+ else
+ {
+ key_name[0] = 0;
+ }
+
+ DEBUG(10, ("reg_split_key: name %s\n", key_name));
+
+ return True;
+}