hi all
i have a problem with this code .what is wrong with it :
invoke RegCreateKeyEx,HKEY_CURRENT_USER,addr soft0,
NULL,NULL,REG_OPTION_NON_VOLATILE,
KEY_ALL_ACCESS,NULL,addr reghand,addr disp
invoke RegQueryValueEx,reghand,addr regname,NULL,0,0,yek
where :
disp db "REG_OPENED_EXISTING_KEY",0
soft0 db "Software\Yahoo\Pager",0
regname db "Yahoo! User ID",0
reghand dd ?
I know that RegCreateKeyEx return a true handle in reghand but but i dont know why RegQueryValueEx doesnt work!!!
thx
i have a problem with this code .what is wrong with it :
invoke RegCreateKeyEx,HKEY_CURRENT_USER,addr soft0,
NULL,NULL,REG_OPTION_NON_VOLATILE,
KEY_ALL_ACCESS,NULL,addr reghand,addr disp
invoke RegQueryValueEx,reghand,addr regname,NULL,0,0,yek
where :
disp db "REG_OPENED_EXISTING_KEY",0
soft0 db "Software\Yahoo\Pager",0
regname db "Yahoo! User ID",0
reghand dd ?
I know that RegCreateKeyEx return a true handle in reghand but but i dont know why RegQueryValueEx doesnt work!!!
thx
You must use "addr reghand" - RegCreateKeyEx wants a pointer to the variable that will receive the key, not the value of the key variable :)
thx for your answer f0dder but i found the problem in RegOpenKeyEx and this is work :
invoke RegCreateKeyEx,HKEY_CURRENT_USER,addr soft0,
NULL,NULL,REG_OPTION_NON_VOLATILE,
KEY_ALL_ACCESS,NULL,addr reghand,addr disp
invoke RegQueryValueEx,reghand,addr regname,0,0,addr titlebuf,addr yek
where :
titlebuf db 100 dup(?)
yek DWORD 100
reghand dd ?
soft0 db "Software\Yahoo\pager\",0
regname db "Yahoo! User ID",0
disp db "REG_OPENED_EXISTING_KEY",0
now this is work
thx all
invoke RegCreateKeyEx,HKEY_CURRENT_USER,addr soft0,
NULL,NULL,REG_OPTION_NON_VOLATILE,
KEY_ALL_ACCESS,NULL,addr reghand,addr disp
invoke RegQueryValueEx,reghand,addr regname,0,0,addr titlebuf,addr yek
where :
titlebuf db 100 dup(?)
yek DWORD 100
reghand dd ?
soft0 db "Software\Yahoo\pager\",0
regname db "Yahoo! User ID",0
disp db "REG_OPENED_EXISTING_KEY",0
now this is work
thx all
Sorry, I responded a bit too soon after waking up :blush:, I dunno why I read your CreateKey as passing by value instead of by address.
Unless you'll be writing the key, you might want to use RegOpenKeyEx instead of RegCreateKeyEx, so you won't pollute the user's registry if he doesn't have the Yahoo stuff installed. And if you're only going to read, you should use KEY_READ access (shouldn't matter much when dealing with HKCU, but for HKLM on NT machines with non-administrator accounts, it certainly does).
Unless you'll be writing the key, you might want to use RegOpenKeyEx instead of RegCreateKeyEx, so you won't pollute the user's registry if he doesn't have the Yahoo stuff installed. And if you're only going to read, you should use KEY_READ access (shouldn't matter much when dealing with HKCU, but for HKLM on NT machines with non-administrator accounts, it certainly does).
tanck you f0dder i got it