so far i've got.
DeleteString proc lpszKey:DWORD
LOCAL phkResult :DWORD
invoke RegOpenKeyEx,HKEY_LOCAL_MACHINE,lpszKey,0,KEY_ALL_ACCESS,ADDR phkResult
invoke RegCloseKey,phkResult
xor eax,eax
DeleteString endp
but my program always errors
im calling it like.
invoke DeleteString, addr szAllKey
szAllKey DB "test",0
the folder is there in regedit.exe so it must work.
can you gelp me at all?
Use RegDeleteKey to delete keys and and RegDeleteValue to delete key values. Remember the sub key you are deleting can't have any subkeys and the key must be opened with DELETE access rights.
best regards,
czDrillard
Here is a small registry-key related app. DeleteKey is similar. See the win32api.hlp
; Mark Jones/Helios Studios 2005
; build as "console assemble and link"
include masm32rt.inc ; "compile-time" libs
include advapi32.inc ; registry functions
includelib advapi32.lib
.data
szKey DB "SYSTEM\CurrentControlSet\Services\Tcpip\Parameters\",0
szValue DB "GlobalMaxTcpWindowSize",0
.data?
buff DD ?
buffsize DD ?
hKey DD ?
keyType DD ?
.code
start:
print chr$("GlobalMaxTcpWindowSize: ")
invoke RegOpenKeyEx,HKEY_LOCAL_MACHINE,addr szKey,0,KEY_QUERY_VALUE,addr hKey
test eax,eax ; does the key exist?
jnz nokey
mov buffsize,4
invoke RegQueryValueEx,hKey,addr szValue,0,addr keyType,addr buff,addr buffsize
test eax,eax ; is there a GlobalMaxTcpWindowSize value?
jz valfound
print chr$("value not present.")
jmp endit
nokey:
print chr$("key not present!")
jmp endit
valfound:
print ustr$(buff)
endit:
Invoke RegCloseKey,hKey ; close key
mov eax, input(13,10,13,10,"Press enter to exit:")
invoke ExitProcess, 0 ; exit gracefully
end start