From: Iain Patterson Date: Fri, 22 Jul 2016 14:47:11 +0000 (+0100) Subject: Added enumerate_registry_values(). X-Git-Url: http://git.iain.cx/?a=commitdiff_plain;ds=sidebyside;h=70c205435a839d0378035071777e8c8384008337;p=nssm.git Added enumerate_registry_values(). New function to retrieve values under a key. --- diff --git a/registry.cpp b/registry.cpp index 7c93a3d..48783f1 100644 --- a/registry.cpp +++ b/registry.cpp @@ -67,6 +67,14 @@ int create_messages() { return 0; } +long enumerate_registry_values(HKEY key, unsigned long *index, TCHAR *name, unsigned long namelen) { + unsigned long type; + unsigned long datalen = namelen; + long error = RegEnumValue(key, *index, name, &datalen, 0, &type, 0, 0); + if (error == ERROR_SUCCESS) ++*index; + return error; +} + int create_parameters(nssm_service_t *service, bool editing) { /* Try to open the registry */ HKEY key = open_registry(service->name, KEY_WRITE); diff --git a/registry.h b/registry.h index d8018ac..11c4e69 100644 --- a/registry.h +++ b/registry.h @@ -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); HKEY open_registry(const TCHAR *, const TCHAR *, REGSAM sam); HKEY open_registry(const TCHAR *, REGSAM sam); +long enumerate_registry_values(HKEY, unsigned long *, TCHAR *, unsigned long); int create_messages(); int create_parameters(nssm_service_t *, bool); int create_exit_action(TCHAR *, const TCHAR *, bool);