Added enumerate_registry_values().
authorIain Patterson <me@iain.cx>
Fri, 22 Jul 2016 14:47:11 +0000 (15:47 +0100)
committerIain Patterson <me@iain.cx>
Thu, 28 Jul 2016 15:44:20 +0000 (16:44 +0100)
New function to retrieve values under a key.

registry.cpp
registry.h

index 7c93a3d..48783f1 100644 (file)
@@ -67,6 +67,14 @@ int create_messages() {
   return 0;\r
 }\r
 \r
+long enumerate_registry_values(HKEY key, unsigned long *index, TCHAR *name, unsigned long namelen) {\r
+  unsigned long type;\r
+  unsigned long datalen = namelen;\r
+  long error = RegEnumValue(key, *index, name, &datalen, 0, &type, 0, 0);\r
+  if (error == ERROR_SUCCESS) ++*index;\r
+  return error;\r
+}\r
+\r
 int create_parameters(nssm_service_t *service, bool editing) {\r
   /* Try to open the registry */\r
   HKEY key = open_registry(service->name, KEY_WRITE);\r
index d8018ac..11c4e69 100644 (file)
@@ -43,6 +43,7 @@ long open_registry(const TCHAR *, const TCHAR *, REGSAM sam, HKEY *, bool);
 HKEY open_registry(const TCHAR *, const TCHAR *, REGSAM sam, bool);\r
 HKEY open_registry(const TCHAR *, const TCHAR *, REGSAM sam);\r
 HKEY open_registry(const TCHAR *, REGSAM sam);\r
+long enumerate_registry_values(HKEY, unsigned long *, TCHAR *, unsigned long);\r
 int create_messages();\r
 int create_parameters(nssm_service_t *, bool);\r
 int create_exit_action(TCHAR *, const TCHAR *, bool);\r