Can anyone tell me why im gettting a fatal error at when i make my call to RegSetValueEx? and when i create a key do i have to close it befor writeing to it? or can i just write to it right away?

.data
subkey            db "Software\Tray_Protector\Pass\",0

.data?
keyholder   dd ?
dispo       dd ?
tpass       db 20 dup(?)
rpass       db 21 dup(?)
rdpass      dd ?

.code
invoke RegCreateKeyEx,HKEY_LOCAL_MACHINE,addr subkey,0,NULL,REG_OPTION_NON_VOLATILE,KEY_ALL_ACCESS,NULL,addr keyholder,addr dispo
                invoke RegCloseKey,HKEY_LOCAL_MACHINE
                invoke RegOpenKeyEx,HKEY_LOCAL_MACHINE,NULL,0,KEY_ALL_ACCESS,addr dispo
                invoke GetDlgItemText,winhand,IDC_NEWPASS1,tpass,20
                invoke RegSetValueEx,HKEY_LOCAL_MACHINE,addr subkey,0,REG_SZ, addr tpass,sizeof tpass
                invoke RegQueryValueEx,HKEY_LOCAL_MACHINE,addr subkey,0,addr value,addr rpass, addr rdpass
                invoke SetDlgItemText,winhand,IDC_NEWPASS2,rpass
               
Any help would be apreciated. THANX! -brad
Posted on 2001-02-14 19:34:00 by Rage9
I don't see trouble with RegSetValueEx but I see this one: invoke GetDlgItemText,winhand,IDC_NEWPASS1,tpass,20 The third parameter to GetDlgItemText must be the pointer to the buffer. It should be like this: invoke GetDlgItemText,winhand,IDC_NEWPASS1,addr tpass,20 Also in RegCreateKeyEx, you SHOULD NOT use KEY_ALL_ACCESS. It is ok if you want your prog to be able to work only under win9x. That RegCreateKeyEx would fail miserably under win2k with error "Access denied" because Win32 api states that you can't create a subkey under HKEY_LOCAL_MACHINE and JEY_ALL_ACCESS does include the the access right for subkey creation. Also this line: invoke SetDlgItemText,winhand,IDC_NEWPASS2,rpass should be: invoke SetDlgItemText,winhand,IDC_NEWPASS2,addr rpass This message was edited by Iczelion, on 2/15/2001 7:00:35 AM
Posted on 2001-02-15 06:58:00 by Iczelion