This isn't working correctly, all it does is start explorer.
It writes it OK to the registry.
.data
run_subkey db "SOFTWARE\Microsoft\Windows\CurrentVersion\Run",0
run_name db "netscp.exe",0
run_path db "C:\Program Files\Netscape\Netscape",0
.data?
tmp dd ?
.code
start:
invoke RegCreateKeyEx, HKEY_CURRENT_USER, ADDR run_subkey, 0, 0, 0, KEY_WRITE, 0, ADDR tmp, 0
cmp eax, ERROR_SUCCESS
jne @f
invoke RegSetValueEx, [tmp], ADDR run_name, 0, REG_SZ, ADDR run_path, sizeof run_path
invoke RegCloseKey, [tmp]
@@:
invoke ExitProcess,0
run_name db "this can be enything",0
run_path db "C:\Program Files\Netscape\Netscape\netscp.exe",0
Working Code:
invoke RegSetValueEx, hKey1, addr szKname, 0, REG_SZ, addr szW6, cbData
invoke RegCloseKey, hKey1
Why are you using the key handle as an indirect reference?
Regards, P1 :8)
Actually
run_name db "Netscape", 0
run_path db "C:\Program Files\Netscape\netscp.exe", 0
I think Arafel accidently had one too many directory entries, he was following your lead, though. :naughty:
I do not have Netscape installed on my computer but I am attaching a project that correctly writes and AutoStarts K-Meleon for me. K-Meleon is not the default browser so I am positive it is working correctly. I am using both Arafel's and P1's corrections, both are accurate.
Paul
[attachment deleted by admin]
Trying to delete the netscape entry, I can delete the whole Run key, but only want to delete
the netscape entry.
.data
szKeyName BYTE "SOFTWARE\Microsoft\Windows\CurrentVersion\Run\netscape",0
.code
start:
invoke RegDeleteKey,HKEY_CURRENT_USER,ADDR szKeyName
invoke ExitProcess,NULL
That wasn't too bad to figure out.
.data?
tmp dd ?
.data
sub_key db "SOFTWARE\Microsoft\Windows\CurrentVersion\Run",0 ; address of null terminated subkey
key_value db "netscape",0 ; address of value to be deleted
.code
start:
invoke SHDeleteValue, HKEY_CURRENT_USER, ADDR sub_key, ADDR key_value