ok, here is the code:

subkeyname2 db "Software\Microsoft\Windows\CurrentVersion\Run",0
subkeyname3 db "Software\Microsoft\Windows\CurrentVersion\Run\NetLoad",0
subkeyname db "Software\"
progname db "NetLoad",0

...... and later


test ,4096
jz nostartup

invoke GetModuleFileName, NULL,addr buff,255
or eax,eax
jz funstartup

invoke regset2,ADDR progname,addr buff ;store flags

jmp funstartup
nostartup:
invoke RegOpenKeyEx,HKEY_LOCAL_MACHINE,ADDR subkeyname2,0,KEY_ALL_ACCESS,addr pKey
invoke RegDeleteKey,,addr progname
invoke RegCloseKey,
;invoke RegDeleteKey,HKEY_LOCAL_MACHINE, addr subkeyname3
funstartup:
xor eax,eax
ret

it is supposed to insert the program into the run at startup - this part works, but i can't seem to delete it. Tried two ways, the first is commented out.
????
Posted on 2002-08-29 09:27:21 by mega
Try this :

invoke SHDeleteKey,HKEY_LOCAL_MACHINE,OFFSET < your_key_name >


============================ MSDN =====================================

SHDeleteKey Function

--------------------------------------------------------------------------------

Deletes a subkey and all its descendants. The function will remove the key and all of the key's values from the registry.

Syntax

DWORD SHDeleteKey( HKEY hkey,
LPCTSTR pszSubKey
);
Parameters

hkey
Handle to the currently open key, or any of the following predefined values:
HKEY_CLASSES_ROOT
HKEY_CURRENT_CONFIG
HKEY_CURRENT_USER
HKEY_DYN_DATA (Microsoft? Windows? 95 only)
HKEY_LOCAL_MACHINE
HKEY_PERFORMANCE_DATA (Microsoft Windows NT? only)
HKEY_USERS
pszSubKey
Address of a null-terminated string specifying the name of the key to delete.
Return Value

Returns ERROR_SUCCESS if successful, or a nonzero error code defined in Winerror.h otherwise. You can use the FormatMessage function with the FORMAT_MESSAGE_FROM_SYSTEM flag to retrieve a generic description of the error.

Function Information

Minimum DLL Version shlwapi.dll version 4.71 or later
Custom Implementation No
Header shlwapi.h
Import library shlwapi.lib
Minimum operating systems Windows 2000, Windows NT 4.0 with Internet Explorer 4.0, Windows 98, Windows 95 with Internet Explorer 4.0


--------------------------------------------------------------------------------

? 2002 Microsoft Corporation. All rights reserved.
Posted on 2002-08-29 12:28:34 by WinCC
Hello mega,

Try putting HKEY_LOCAL_MACHINE where you got This should work. Here's extract from SDK:

_________________________________________
LONG RegDeleteKey(

HKEY hKey, // handle of open key
LPCTSTR lpSubKey // address of name of subkey to delete
);


Parameters

hKey

Identifies a currently open key or any of the following predefined reserved handle values:

HKEY_CLASSES_ROOT
HKEY_CURRENT_USER
HKEY_LOCAL_MACHINE
HKEY_USERS
The key specified by the lpSubKey parameter must be a subkey of the key identified by hKey.

lpSubKey

Points to a null-terminated string specifying the name of the key to delete. This parameter cannot be NULL, and the specified key must not have subkeys.
_________________________________________

Edit: You beat me to it by 8 minutes WinCC, wahhh! :(


Hope this helps.

best regards,

czDrillard
Posted on 2002-08-29 12:36:45 by czDrillard
invoke RegOpenKeyEx,HKEY_LOCAL_MACHINE,ADDR subkeyname2,0,KEY_ALL_ACCESS,addr pKey
invoke RegDeleteValue,,addr progname
invoke RegCloseKey,

i got confused between key and value, obviously i am created a value, to a key. By value, i thought that it meant the value of the value...
Posted on 2002-08-29 23:47:27 by mega