void Registry::EnumKeys(EnumKeyCallback Callback)
{
char KeyName[MAX_KEY_LENGTH];
DWORD Size;
int Index = 0;
while(RegEnumKeyEx(hKey, Index, KeyName, &Size, NULL, NULL, NULL, NULL) != ERROR_NO_MORE_ITEMS) {
OutputDebugString("Calling...");
OutputDebugString(KeyName);
OutputDebugString("\n");
//Callback(KeyName);
Index++;
}
}
Outputs "Calling...test" twice. Should be test and test2. ugh makes no sense
MAX_KEY_LENGTH = 255
Perhaps the second pass returns a failure code (other than ERROR_NO_MORE_ITEMS), leading you to run the loop with stale data?
Also, you should initialize Size on each iteration. RegEnumKeyEx reads it on startup and modifies it before returning.
Ugh, not setting size was the issue. Been working on this project too long today.. Thanks