... sorry I post the prev msg by mistake ...
Hi All,
I am trying to enumerate the subkeys of a given registry
key, but unfortunately I still have no luck.
Here is the code:
#define DIM_MANAGEMENT_PATH 512
...
int i;
unsigned long dim;
HRESULT ret;
HKEY key;
wchar_t child[DIM_MANAGEMENT_PATH];
wchar_t fullName[DIM_MANAGEMENT_PATH];
RegOpenKeyEx(
HKEY_LOCAL_MACHINE,
//fullContext,
TEXT("Software"),
0,
KEY_ENUMERATE_SUB_KEYS,
&key
);
if (key == 0) {
// some error handling
goto finally;
}
for (i=0; i<*size; ++i) {
dim = DIM_MANAGEMENT_PATH;
ret = RegEnumKeyEx(key, i, child, &dim, NULL, NULL,
NULL, NULL);
if (ret != ERROR_SUCCESS) {
LOG.debug(TEXT("Not NULL"));
if (ret == ERROR_NO_MORE_ITEMS) {
break;
} else {
// some error handling
goto finally;
}
}
LOG.debug(child);
}
*size = i;
finally:
if (key != 0) {
RegCloseKey(key);
}
What I get is that RegEnumKey always returns 183 (something
like "it is not possible to create a file if it is already
open).
What am I doing wrong?
Thanks in advance.
Stefano