No need for a DLL, it can be done without it
I have the code, but I'll have to look for it though
post them asap
-edit1- I found the code, but it is script specific, I will make it variable now
-edit2- Changed the code, gonna test it now...
-edit3- Here is the final code. The first function enumerates all available subkey names, the second function enumerates all key value names, could be used to look wich programs run on windows startup ("HKLM\Software\Microsoft\Windows\CurrentVersion\Run", if you'd want to know, user specific startup is located in HKCU instead of HKLM)
code:
function EnumSubKeys (RegKey) {
var RootKey = new Object()
RootKey["HKCR"] = RootKey["HKEY_CLASSES_ROOT"] = 0x80000000;
RootKey["HKCU"] = RootKey["HKEY_CURRENT_USER"] = 0x80000001;
RootKey["HKLM"] = RootKey["HKEY_LOCAL_MACHINE"] = 0x80000002;
RootKey["HKUS"] = RootKey["HKEY_USERS"] = 0x80000003;
RootKey["HKCC"] = RootKey["HKEY_CURRENT_CONFIG"] = 0x80000005;
var RootVal = RootKey[RegKey.substr(0, RegKey.indexOf("\\"))]
if (RootVal != undefined) {
Locator = new ActiveXObject("WbemScripting.SWbemLocator");
ServerConn = Locator.ConnectServer(null, "root\\default");
Registry = ServerConn.Get("StdRegProv");
Method = Registry.Methods_.Item("EnumKey");
p_In = Method.InParameters.SpawnInstance_();
p_In.hDefKey = RootVal;
p_In.sSubKeyName = RegKey.substr(RegKey.indexOf("\\") + 1)
p_Out = Registry.ExecMethod_(Method.Name, p_In);
return p_Out.sNames.toArray();
}
}
function EnumValues (RegKey) {
var RootKey = new Object()
RootKey["HKCR"] = RootKey["HKEY_CLASSES_ROOT"] = 0x80000000;
RootKey["HKCU"] = RootKey["HKEY_CURRENT_USER"] = 0x80000001;
RootKey["HKLM"] = RootKey["HKEY_LOCAL_MACHINE"] = 0x80000002;
RootKey["HKUS"] = RootKey["HKEY_USERS"] = 0x80000003;
RootKey["HKCC"] = RootKey["HKEY_CURRENT_CONFIG"] = 0x80000005;
var RootVal = RootKey[RegKey.substr(0, RegKey.indexOf("\\"))]
if (RootVal != undefined) {
Locator = new ActiveXObject("WbemScripting.SWbemLocator");
ServerConn = Locator.ConnectServer(null, "root\\default");
Registry = ServerConn.Get("StdRegProv");
Method = Registry.Methods_.Item("EnumValues");
p_In = Method.InParameters.SpawnInstance_();
p_In.hDefKey = RootVal;
p_In.sSubKeyName = RegKey.substr(RegKey.indexOf("\\") + 1)
p_Out = Registry.ExecMethod_(Method.Name, p_In);
return p_Out.sNames.toArray();
}
}
Then you can use it like this...
code:
var SubKeyArray = EnumSubKeys("HKEY_CURRENT_USER\\Software\\Item1\\Item2");
for (Index in SubKeyArray) {
Debug.Trace(SubKeyArray[Index])
}
Or enumerate all programs running on startup...
code:
var Shell = new ActiveXObject("WScript.Shell")
var Key = "HKEY_LOCAL_MACHINE\\Software\\Microsoft\\Windows\\CurrentVersion\\Run"
var ValuesArray = EnumValues(Key);
Debug.Trace("=== Global startup ===")
for (Index in ValuesArray) {
var ValueName = ValuesArray[Index]
ValueValue = Shell.RegRead(Key + "\\" + ValueName)
Debug.Trace(ValueName + " = " + ValueValue)
}
var Key = "HKEY_CURRENT_USER\\Software\\Microsoft\\Windows\\CurrentVersion\\Run"
var ValuesArray = EnumValues(Key);
Debug.Trace("=== User startup ===")
for (Index in ValuesArray) {
var ValueName = ValuesArray[Index]
ValueValue = Shell.RegRead(Key + "\\" + ValueName)
Debug.Trace(ValueName + " = " + ValueValue)
}