I tried to modify the regwrite from
http://www.autohotkey.com/forum/viewtopic.php?t=39560 to make a reg delete but I am WAY to stupid!
Taken from MSDN,
http://msdn.microsoft.com/en-us/library ... 85%29.aspx
Quote:
RegDeleteKeyEx Function
Deletes a subkey and its values from the specified platform-specific view of the registry. Note that key names are not case sensitive.
To delete a subkey as a transacted operation, call the RegDeleteKeyTransacted function.
Syntax
C++
LONG WINAPI RegDeleteKeyEx(
__in HKEY hKey,
__in LPCTSTR lpSubKey,
__in REGSAM samDesired,
__reserved DWORD Reserved
);
My foolish try, (Its an added function from
http://www.autohotkey.com/forum/viewtopic.php?t=39560 and I tried to change things around to see if it works. It may be best to ignore this foolishness and strart fresh with your own function.)
Code:
RegDel64(sRootKey, sKeyName, sValueName = "", sValue = "") {
HKEY_CLASSES_ROOT := 0x80000000 ; http://msdn.microsoft.com/en-us/library/aa393286.aspx
HKEY_CURRENT_USER := 0x80000001
HKEY_LOCAL_MACHINE := 0x80000002
HKEY_USERS := 0x80000003
HKEY_CURRENT_CONFIG := 0x80000005
HKEY_DYN_DATA := 0x80000006
HKCR := HKEY_CLASSES_ROOT
HKCU := HKEY_CURRENT_USER
HKLM := HKEY_LOCAL_MACHINE
HKU := HKEY_USERS
HKCC := HKEY_CURRENT_CONFIG
REG_NONE := 0 ; http://msdn.microsoft.com/en-us/library/ms724884.aspx
REG_SZ := 1
REG_EXPAND_SZ := 2
REG_BINARY := 3
REG_DWORD := 4
REG_DWORD_BIG_ENDIAN := 5
REG_LINK := 6
REG_MULTI_SZ := 7
REG_RESOURCE_LIST := 8
KEY_QUERY_VALUE := 0x0001 ; http://msdn.microsoft.com/en-us/library/ms724878.aspx
KEY_WOW64_64KEY := 0x0100 ; http://msdn.microsoft.com/en-gb/library/aa384129.aspx (do not redirect to Wow6432Node on 64-bit machines)
KEY_SET_VALUE := 0x0002
KEY_WRITE := 0x20006
myhKey := %sRootKey% ; pick out value (0x8000000x) from list of HKEY_xx vars
;myValueType := %sValueType% ; pick out value (0-8) from list of REG_SZ,REG_DWORD etc. types
IfEqual,myhKey,, { ; Error - Invalid root key
ErrorLevel := 3
return ErrorLevel
}
RegAccessRight := KEY_QUERY_VALUE + KEY_WOW64_64KEY + KEY_ALL_ACCESS
DllCall("Advapi32.dll\RegDeleteKeyEx", "uint", myhKey, "str", sKeyName, "uint", 0, "uint", 0, "uint", 0, "uint", RegAccessRight, "uint", 0, "uint*", hKey) ; open/create key
If (myValueType == REG_SZ or myValueType == REG_EXPAND_SZ) {
vValueSize := StrLen(sValue) + 1
DllCall("Advapi32.dll\RegDeleteKeyEx", "uint", hKey, "str", sValueName, "uint", 0, "uint", 0, "str", sValue, "uint", vValueSize) ; write string
} Else If (myValueType == REG_DWORD) {
vValueSize := 4
DllCall("Advapi32.dll\RegDeleteKeyEx", "uint", hKey, "str", sValueName, "uint", 0, "uint", 0, "uint*", sValue, "uint", vValueSize) ; write dword
} Else { ; REG_MULTI_SZ, REG_BINARY, or other unsupported value type
ErrorLevel := 2
}
DllCall("Advapi32.dll\RegCloseKey", "uint", hKey)
return ErrorLevel
}
basically I added, KEY_ALL_ACCESS to RegAccessRight and tried to delete extra things that the regwrite has becasue regdelete does not need the " myValueType := %sValueType% ; pick out value (0-8) from list of REG_SZ,REG_DWORD etc. types " Again, you should ignore this and start fresh, I am just trying to prove I tried before I asked for help.
Also, if someone is able to understand this stuff, I would
KILL or DIE to have a way of manipulating the security and owner stuff in the registry through AHK!
Seriously, I have was not broke, I would pay $1000 for this help!
http://msdn.microsoft.com/en-us/library ... 85%29.aspx
When all is said and done, for everyone, not just me, I think the best functions would be.
RegWrite64()
RegRead64()
RegDelete64()
SetOwner()
SetPermissions()
With Windows 7 mainly being 64bit, more and more people will need this.
RegWrite64() and RegRead64() work great but others may need delete too. Setting Owner and Permissions will be a usefull tool for me and others.
I have spent days trying to understand this stuff and port it into AHK.
If you want something in exchange for your time to make these functions, name it. We can fix computers better than anyone I know of and we guarantee it for a year. So if you got a brother or annoying sister who keeps getting infected, PM me and I will take care of them for you.