' ---------------------------------------------------------- ' Script d'accès direct via REGEDIT à une clef importante ' de la Base de registres ' ' JC BELLAMY © 2003 ' ---------------------------------------------------------- Dim shell,fso Set fso = WScript.CreateObject("Scripting.FileSystemObject") Set shell = WScript.CreateObject("WScript.Shell") FicHTML=GetPath() & "setregedit.html" CreateHTML ' Ouverture d'Internet Explorer Set oIE = WScript.CreateObject("InternetExplorer.Application", "IE_") oIE.Left = 50 oIE.Top = 100 oIE.Height = 350 oIE.Width = 600 oIE.MenuBar = 0 oIE.ToolBar = 0 oIE.StatusBar = 0 oIE.navigate FicHTML oIE.Visible = 2 Do While (oIE.Busy) WScript.Sleep 200 Loop Do While true oIE.Visible = 2 shell.AppActivate "Accès direct BDR" ' Attente d'action sur le bouton ou fermeture de la fenêtre On Error Resume Next Do WScript.Sleep 100 Loop While (oIE.Document.Script.CheckVal() = 0) ' Si on ferme directement IE sans passer par un bouton, ' cela provoque une erreur qui est détectée et alors ' on quitte le script If Err <> 0 Then Wscript.quit test=oIE.Document.Script.CheckVal() If test=-1 Then CloseIE Wscript.quit end if oIE.Document.Script.Window_OnLoad() SelectedKey="" ' Lancement de REGEDIT avec la clef choisie If test=1 Then SelectedKey=oIE.Document.RegEditForm.key.value Else FirstKey=oIE.Document.RegEditForm.extent.value If left(FirstKey,1)<>"." Then FirstKey="." & FirstKey typeKey=shell.RegRead("HKEY_CLASSES_ROOT\" & FirstKey & "\") If Err <>0 Then msgbox "Extension " & FirstKey & " absente de la BDR",vbCritical,"Accès direct BDR" else SelectedKey="HKEY_CLASSES_ROOT\" & TypeKey & "\shell\open\command" End If End If If SelectedKey<>"" Then KeyName="HKCU\Software\Microsoft\Windows\CurrentVersion\Applets\Regedit\LastKey" shell.RegWrite keyName, SelectedKey oIE.Visible = 0 shell.Run "REGEDIT",1,true End If loop '-------------------------------------------------------------------- ' Fonction de récupération du répertoire courant Function GetPath() Dim path path = WScript.ScriptFullName GetPath = Left(path, InStrRev(path, "\")) End Function '-------------------------------------------------------------------- ' Fermeture d'Internet Explorer Sub CloseIE oIE.Quit Set oIE = Nothing End Sub '-------------------------------------------------------------------- Sub CreateHTML Dim tabkey,tablib tabkey=array( _ "HKEY_CLASSES_ROOT\http\shell\open\command", _ "HKEY_CLASSES_ROOT\CLSID\{20D04FE0-3AEA-1069-A2D8-08002B30309D}\DefaultIcon", _ "HKEY_CLASSES_ROOT\CLSID\{645FF040-5081-101B-9F08-00AA002F954E}\DefaultIcon", _ "HKEY_CLASSES_ROOT\CLSID\{208D2C60-3AEA-1069-A2D7-08002B30309D}\DefaultIcon", _ "HKEY_CURRENT_USER\Control Panel\Keyboard", _ "HKEY_CURRENT_USER\Control Panel\Desktop", _ "HKEY_CURRENT_USER\Control Panel\International", _ "HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders", _ "HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders", _ "HKEY_CURRENT_USER\Software\Policies\Microsoft\Internet Explorer\Control Panel", _ "HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\Main", _ "HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Run", _ "HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Run", _ "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Active Setup\Installed Components\{44BBA840-CC51-11CF-AAFA-00AA00B6015C}", _ "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Active Setup\Installed Components\{44BBA842-CC51-11CF-AAFA-00AA00B6015B}", _ "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Active Setup\Installed Components\{89820200-ECBD-11cf-8B85-00AA005B4383}", _ "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Active Setup\Installed Components\{4f645220-306d-11d2-995d-00c04f98bbc9}", _ "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Active Setup\Installed Components\{5945c046-1e7d-11d1-bc44-00c04fd912be}", _ "HKEY_LOCAL_MACHINE\Network\Logon", _ "HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\policies\Ratings", _ "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion", _ "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon", _ "HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\Session Manager", _ "HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Uninstall", _ "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Setup", _ "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Browser\Parameters", _ "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\VxD\VNETSUP\Ndi\Params\MaintainServerList", _ "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services", _ "HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\RunServices", _ "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\hivelist") tablib=array( _ "(HKCR) Navigateur par défaut", _ "(HKCR) Icône poste de travail", _ "(HKCR) Icône corbeille", _ "(HKCR) Icône voisinage réseau", _ "(HKCU) Configuration clavier", _ "(HKCU) Configuration bureau", _ "(HKCU) Configuration international", _ "(HKCU) Dossiers système", _ "(HKLM) Dossiers système", _ "(HKCU) Page d'accueil IE", _ "(HKCU) Paramètres principaux IE", _ "(HKCU) Applis lancées au démarrage", _ "(HKLM) Applis lancées au démarrage", _ "(HKLM) Installation de Outlook Express", _ "(HKLM) Installation de NetMeeting", _ "(HKLM) Installation de Internet Explorer", _ "(HKLM) Installation de VBScript", _ "(HKLM) Installation de Messenger", _ "(HKLM) Authentification par serveur de domaine (Win9x)", _ "(HKLM) Contrôle d'accès IE", _ "(HKLM) Chemins principaux", _ "(HKLM) Winlogon (NT)", _ "(HKLM) Session Manager (NT)", _ "(HKLM) Désinstallation d'applis", _ "(HKLM) Installation de Windows", _ "(HKLM) Master browser (NT)", _ "(HKLM) Master browser (Win9x)", _ "(HKLM) Services (NT)", _ "(HKLM) Services (Win9x)", _ "(HKLM) Nom des ruches (NT)") Dim ts Set ts = fso.CreateTextFile(fichtml, True) ts.writeline "" ts.writeline "" ts.writeline "Accès direct BDR" ts.writeline "" ts.writeline "" ts.writeline "" ts.writeline "" ts.writeline "
" ts.writeline "

Ouverture directe de REGEDIT


" ts.writeline "Clefs usuelles :
" ts.writeline "" ts.writeline "HKCR = HKEY_CLASSES_ROOT
" ts.writeline "HKCU = HKEY_CURRENT_USER
" ts.writeline "HKLM = HKEY_LOCAL_MACHINE
" ts.writeline "
" ts.writeline "" ts.writeline "" ts.writeline "
" ts.writeline "Recherche de ""HKCR\...\shell\command\open""
" ts.writeline "à partir de l'extension d'un type de fichier
" ts.writeline "Extension : " ts.writeline "
" ts.writeline "
" ts.writeline "" ts.writeline "
" ts.writeline "
" ts.writeline "JCB © 2003" ts.writeline "" ts.writeline "" ts.close End Sub '--------------------------------------------------------------------