Rob van der Woude's Scripting Pages
Powered by GeSHi

Source code for getrundl.vbs

(view source code of getrundl.vbs as plain text)

  1. Option Explicit
  2.  
  3. Dim arrKeys, arrSubKeys
  4. Dim i, j
  5. Dim objReg
  6. Dim strKey, strMsg, strSubKey, strSubSubKey, strValue
  7.  
  8. Const HKCR = &H80000000
  9.  
  10. If WScript.Arguments.Count > 0 Then Syntax
  11.  
  12. strMsg = ""
  13.  
  14. Set objReg = GetObject( "winmgmts:{impersonationLevel=impersonate}!//./root/default:StdRegProv" )
  15.  
  16. objReg.EnumKey HKCR, "", arrKeys
  17.  
  18. For i = 0 To UBound( arrKeys )
  19. 	strSubKey = arrKeys(i) & "\shell"
  20. 	objReg.EnumKey HKCR, strSubKey, arrSubKeys
  21. 	If IsArray( arrSubKeys ) Then
  22. 		For j = 0 To UBound( arrSubKeys )
  23. 			strSubSubKey = arrKeys(i) & "\shell\" & arrSubKeys(j) & "\command"
  24. 			objReg.GetStringValue HKCR, strSubSubKey, "", strValue
  25. 			If InStr( 1, strValue, "RUNDLL", vbTextCompare ) Then
  26. 				strMsg = strMsg _
  27. 				       & "[HKCR\" & strSubSubKey & "]" & vbTab _
  28. 				       & Replace( strValue, "C:\WINDOWS\system32\", "", 1, -1, vbTextCompare ) & vbCrLf
  29. 			End If
  30. 		Next
  31. 	End If
  32. 	arrSubKeys = ""
  33. Next
  34.  
  35. Set objReg = Nothing
  36.  
  37. WScript.Echo strMsg
  38.  
  39.  
  40. Sub Syntax
  41. 	strMsg = vbCrLf _
  42. 	       & WScript.ScriptName & ",  Version 1.00" _
  43. 	       & vbCrLf _
  44. 	       & "List all RUNDLL(32) commands associated with file types in the registry" _
  45. 	       & vbCrLf & vbCrLf _
  46. 	       & "Usage:  CSCRIPT.EXE  //NoLogo  " & UCase( WScript.ScriptName ) _
  47. 	       & vbCrLf & vbCrLf _
  48. 	       & "Written by Rob van der Woude" _
  49. 	       & vbCrLf _
  50. 	       & "http://www.robvanderwoude.com"
  51. 	WScript.Echo strMsg
  52. 	WScript.Quit 1
  53. End Sub
  54.  

page last modified: 2024-04-16; loaded in 0.0201 seconds