Sign in to follow this  
Followers 0
telmob

Registry to list problem...

6 posts in this topic

I'm need to count how many string values (REG_SZ) are in :

HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Policies\Explorer\DisallowRun

But i've search for help with RegEnumKey in the forum, came up with a lot of scripts but none seemed to read the key strings, only the key, and still i wasn't able to count them.(This registry key will have many strings inside.)

And i need to place each value of these strings in a list.

I have really no idea where to start :S

Little help please....

Share this post


Link to post
Share on other sites



the @extended for RegEnumVal is set to type:

$Val = ""

For $i = 1 to 999
$Val &= RegEnumVal("HKCUSoftwareMicrosoftWindowsCurrentVersionPoliciesExplorerDisallowRun" , $i)
if @Error <> 0 Then ExitLoop
If @Extended = 1 then $type = "String"
If @Extended = 2 then $type = "Expandable"
If @Extended = 3 then $type = "Binary"
If @Extended = 4 then $type = "Dword"
If @Extended = 7 then $type = "Multi"
If @Extended = 11 then $type = "Qword"
$Val &= " :type: " & $type & @CRLF
Next

msgbox (0, '' , $Val)

,-. .--. ________ .-. .-. ,---. ,-. .-. .-. .-.
|(| / /\ \ |\ /| |__ __||| | | || .-' | |/ / \ \_/ )/
(_) / /__\ \ |(\ / | )| | | `-' | | `-. | | / __ \ (_)
| | | __ | (_)\/ | (_) | | .-. | | .-' | | \ |__| ) (
| | | | |)| | \ / | | | | | |)| | `--. | |) \ | |
`-' |_| (_) | |\/| | `-' /( (_)/( __.' |((_)-' /(_|
'-' '-' (__) (__) (_) (__)

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

Thank you for your good will, but i need the full count numbers and the interior of all the strings placed in a list.

For example:

Msgbox("","Number of Strings:", "The total number of strings in the key DisallowRun is:" & $StringCount")

For $i = 1 to 1000

$RegistryStringContents = regread,,,,,,blablabla("HKCUSoftwareMicrosoftWindowsCurrentVersionPoliciesExplorerDisallowRun" , $i)

GUICtrlCreateList("", 296, 64, 257, 97)

Guictrlsetdata(-1, $RegistryStringContents)

Next

If i have the following registry strings inside the key:

"HKCUSoftwareMicrosoftWindowsCurrentVersionPoliciesExplorerDisallowRun", "1", "application1.exe"

"HKCUSoftwareMicrosoftWindowsCurrentVersionPoliciesExplorerDisallowRun", "2", "application2.exe"

"HKCUSoftwareMicrosoftWindowsCurrentVersionPoliciesExplorerDisallowRun", "3", "application3.exe"

"HKCUSoftwareMicrosoftWindowsCurrentVersionPoliciesExplorerDisallowRun", "4", "application4.exe"'

I need the

'application1,exe'

'application2,exe'

'application3,exe'

'application4,exe'

placed inside the list.

But i can't do this right. I can't get the full count of the registry strings or place all the strings inside the damn list :(

Edited by telmob

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

Sorry I had misled by your first line into thinking you only wanted the SZs, i left that portion commented if that indeed is needed. This should dump the key + values to a list...

$Val = ""
$key = "HKCUSoftwareMicrosoftWindowsCurrentVersionPoliciesExplorerDisallowRun"

For $i = 1 to 999
$Val &= RegEnumVal($key , $i) & @LF
if @Error <> 0 Then ExitLoop
;~ If @Extended = 1 then $type = "String"
;~ If @Extended = 2 then $type = "Expandable"
;~ If @Extended = 3 then $type = "Binary"
;~ If @Extended = 4 then $type = "Dword"
;~ If @Extended = 7 then $type = "Multi"
;~ If @Extended = 11 then $type = "Qword"
;~ $Val &= " :type: " & $type & @CRLF
Next

$Aval = stringsplit($Val , @LF)

$GUI = GUICreate("Key Enum" , 1000 , 800 , 0 , 0)
$list = GUICtrlCreateList("" , 0 , 0 , 1000 , 800)

for $i = 1 to $Aval[0] - 1
If stringright($key & "" & $Aval[$i] , 1) = "" Then
GuiCtrlSetData($list , $key & "" & $Aval[$i])
Else
GuiCtrlSetData($list , $key & "" & $Aval[$i] & " value= " & regread($key , $Aval[$i]))
Endif
Next

GuiSetState(@SW_SHOW)

sleep (6000)
Edited by boththose
1 person likes this

,-. .--. ________ .-. .-. ,---. ,-. .-. .-. .-.
|(| / /\ \ |\ /| |__ __||| | | || .-' | |/ / \ \_/ )/
(_) / /__\ \ |(\ / | )| | | `-' | | `-. | | / __ \ (_)
| | | __ | (_)\/ | (_) | | .-. | | .-' | | \ |__| ) (
| | | | |)| | \ / | | | | | |)| | `--. | |) \ | |
`-' |_| (_) | |\/| | `-' /( (_)/( __.' |((_)-' /(_|
'-' '-' (__) (__) (_) (__)

Share this post


Link to post
Share on other sites

WOW! Its so good i can't thank you enough.

That is exactly what i needed.

Don't quite understand this:

for $i = 1 to $Aval[0] -1

But i'll try to use it other scripts so i get used to it :)

Again... Thank you!

Share this post


Link to post
Share on other sites

That just loops through the array that stringsplit made. You can delete the trailing blank entry in the array or ignore it, since $Aval[0] contains the number of elements, that minus 1 excludes the blank space from the count. put an _arraydisplay($Aval) after the stringsplit, and a msgbox(0, '' , $Aval[$i]) inside the loop above the stringright and you should see a little clearer what is occuring.


,-. .--. ________ .-. .-. ,---. ,-. .-. .-. .-.
|(| / /\ \ |\ /| |__ __||| | | || .-' | |/ / \ \_/ )/
(_) / /__\ \ |(\ / | )| | | `-' | | `-. | | / __ \ (_)
| | | __ | (_)\/ | (_) | | .-. | | .-' | | \ |__| ) (
| | | | |)| | \ / | | | | | |)| | `--. | |) \ | |
`-' |_| (_) | |\/| | `-' /( (_)/( __.' |((_)-' /(_|
'-' '-' (__) (__) (_) (__)

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0