I have a problem with RegQueryValueEx on my XP box ... i didn't try it on other win based OS. This is snippet which make program crashes.

invoke RegCreateKeyEx, HKEY_LOCAL_MACHINE, offset VerString, NULL, NULL, REG_OPTION_NON_VOLATILE, KEY_ALL_ACCESS, NULL, ADDR pKey, ADDR TType
.if TType==REG_CREATED_NEW_KEY
invoke RegSetValueEx, pKey, offset TimeVar, NULL, REG_DWORD, offset TimeAct, 4 invoke RegSetValueEx, pKey, offset TimeVarOld, NULL, REG_DWORD, offset TimeAct, 4 .else
invoke RegQueryValueEx, pKey, offset TimeVar, NULL, REG_DWORD, offset TimeAct, offset RecCount
.endif

Everything is Ok until program reach RegQueryValueEx API call. I allocate all buffers properly in .data section and all other variables which are needed.
Posted on 2002-02-12 11:01:31 by dJed_mRaz
I find out what was the problem ..
I should put pointer to buffer instead REG_DWORD constant ..
Always overlook function declaration .. stupid :)
Posted on 2002-02-12 11:13:30 by dJed_mRaz
This is realy wierd ..
When i open a existing key with RegCreateKeyEx and then try to read value with RegQueryValueEx i have to read that value twice
because first time when i read value function fail somehow .. i didn't get any errror message, and value which show how many bytes was read is correct but buffer which should contain value is empty.. then i call same function again with same parameters and everything is OK ..
Anyone have any idea about this ?
Posted on 2002-02-12 13:11:04 by dJed_mRaz
use KEY_WRITE or KEY_READ flags using KEY_ALL_ACCESS is bad habit
Posted on 2002-02-12 14:32:15 by LaptoniC
one thing that maybe a problem is the REG_OPTION_NON_VOLATILE parameter you set. according to the msdn all key set with the RegCreateKeyEx on window nt/2000 and later are volatile. so you could try and change it to REG_OPTION_VOLATILE instead. ive always left this paramter set to null anyways so ive never tested this.

i didnt get a chance to really look over all your code so this may not be the problem.
Posted on 2002-02-12 15:09:19 by smurf