RegEnumValue and Indexing

This is very strange. Say that in the registry of the key I wanted to enumurate values of a subkey.
i.e.
My_Key
(has values of )
aaa
bbb
ccc

when I try to enumuerate it, I see I read in
bbb
bbb
aaa

though I start the index at 0.

Here is the code piece... help :wave
TCHAR szValue[200];
DWORD dwBufLen = {sizeof (szValue)};
RegQueryInfoKey (hKey,NULL,NULL,NULL,NULL,NULL,NULL,&TotalEntries,NULL,NULL,NULL,NULL);
int i = 0;
DWORD type = REG_SZ;
while(RegEnumValue(hKey,i,szValue,&dwBufLen,NULL,&type,NULL,NULL)!= ERROR_NO_MORE_ITEMS) { }

thanks.
Jiac
[657 byte] By [jiac] at [2007-11-18 15:10:02]